Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 40 additions & 17 deletions .claude/skills/deepwork_jobs.implement/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,52 @@ Generate the DeepWork job directory structure and instruction files for each ste

Read the `job.yml` specification file and create all the necessary files to make the job functional, including directory structure and step instruction files. Then sync the commands to make them available.

### Step 1: Create Directory Structure Using Script
### Step 1: Determine Installation Scope

Run the `make_new_job.sh` script to create the standard directory structure:
**Ask the user where they want to install this job using structured questions:**

Present two options:
1. **Local** - Install in this project only (`.deepwork/jobs/`)
2. **Global** - Install for all projects in your user config (`~/.config/deepwork/jobs/`)

**Guidance for users:**
- Choose **local** if the job is specific to this project or you want to version control it
- Choose **global** if the job is reusable across multiple projects (e.g., a general "code review" or "documentation" workflow)

### Step 2: Create Directory Structure Using Script

Run the `make_new_job.sh` script to create the standard directory structure with the chosen scope:

**For local installation:**
```bash
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name]
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope local
```

This creates:
- `.deepwork/jobs/[job_name]/` - Main job directory
- `.deepwork/jobs/[job_name]/steps/` - Step instruction files
- `.deepwork/jobs/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `.deepwork/jobs/[job_name]/templates/` - Example file formats (with .gitkeep)
- `.deepwork/jobs/[job_name]/AGENTS.md` - Job management guidance

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories:
**For global installation:**
```bash
mkdir -p .deepwork/jobs/[job_name]/hooks .deepwork/jobs/[job_name]/templates
touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templates/.gitkeep
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope global
```

### Step 2: Read and Validate the Specification
This creates:
- `[scope_path]/[job_name]/` - Main job directory
- `[scope_path]/[job_name]/steps/` - Step instruction files
- `[scope_path]/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `[scope_path]/[job_name]/templates/` - Example file formats (with .gitkeep)
- `[scope_path]/[job_name]/AGENTS.md` - Job management guidance

Where `[scope_path]` is:
- `.deepwork/jobs` for local scope
- `~/.config/deepwork/jobs` (or `$XDG_CONFIG_HOME/deepwork/jobs`) for global scope

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories in the appropriate scope location.

### Step 3: Read and Validate the Specification

1. **Locate the job.yml file**
- Read `.deepwork/jobs/[job_name]/job.yml` from the review_job_spec step
- Read the job.yml from the review_job_spec step
- The file location depends on the chosen scope:
- Local: `.deepwork/jobs/[job_name]/job.yml`
- Global: `~/.config/deepwork/jobs/[job_name]/job.yml` (or `$XDG_CONFIG_HOME/deepwork/jobs/[job_name]/job.yml`)
- Parse the YAML content

2. **Validate the specification**
Expand All @@ -70,9 +91,11 @@ touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templat
- List of all steps with their details
- Understand the workflow structure

### Step 3: Generate Step Instruction Files
### Step 4: Generate Step Instruction Files

For each step in the job.yml, create a comprehensive instruction file at `.deepwork/jobs/[job_name]/steps/[step_id].md`.
For each step in the job.yml, create a comprehensive instruction file at the appropriate scope location:
- Local: `.deepwork/jobs/[job_name]/steps/[step_id].md`
- Global: `~/.config/deepwork/jobs/[job_name]/steps/[step_id].md`

**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.template` for the standard structure.

Expand Down
47 changes: 37 additions & 10 deletions .deepwork/jobs/deepwork_jobs/make_new_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,58 @@ validate_job_name() {
# Main script
main() {
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <job_name>"
echo "Usage: $0 <job_name> [--scope local|global]"
echo ""
echo "Creates the directory structure for a new DeepWork job."
echo ""
echo "Arguments:"
echo " job_name Name of the job (lowercase, underscores allowed)"
echo " --scope Installation scope: 'local' (project) or 'global' (XDG config)"
echo " Default: local"
echo ""
echo "Example:"
echo "Examples:"
echo " $0 competitive_research"
echo " $0 competitive_research --scope global"
exit 1
fi

local job_name="$1"
local scope="local"

# Parse optional --scope argument
if [[ $# -ge 2 ]] && [[ "$2" == "--scope" ]]; then
if [[ $# -ge 3 ]]; then
scope="$3"
if [[ "$scope" != "local" && "$scope" != "global" ]]; then
error "Invalid scope '$scope'. Must be 'local' or 'global'."
fi
else
error "--scope requires a value (local or global)"
fi
fi

validate_job_name "$job_name"

# Determine the base path - look for .deepwork directory
# Determine the base path based on scope
local base_path
if [[ -d ".deepwork/jobs" ]]; then
base_path=".deepwork/jobs"
elif [[ -d "../.deepwork/jobs" ]]; then
base_path="../.deepwork/jobs"
else
# Create from current directory
base_path=".deepwork/jobs"
if [[ "$scope" == "global" ]]; then
# Use XDG config directory for global jobs
local xdg_config="${XDG_CONFIG_HOME:-$HOME/.config}"
base_path="${xdg_config}/deepwork/jobs"
mkdir -p "$base_path"
info "Creating global job in $base_path"
else
# Local scope - look for .deepwork directory
if [[ -d ".deepwork/jobs" ]]; then
base_path=".deepwork/jobs"
elif [[ -d "../.deepwork/jobs" ]]; then
base_path="../.deepwork/jobs"
else
# Create from current directory
base_path=".deepwork/jobs"
mkdir -p "$base_path"
fi
info "Creating local job in $base_path"
fi

local job_path="${base_path}/${job_name}"
Expand Down
57 changes: 40 additions & 17 deletions .deepwork/jobs/deepwork_jobs/steps/implement.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,52 @@ Generate the DeepWork job directory structure and instruction files for each ste

Read the `job.yml` specification file and create all the necessary files to make the job functional, including directory structure and step instruction files. Then sync the commands to make them available.

### Step 1: Create Directory Structure Using Script
### Step 1: Determine Installation Scope

Run the `make_new_job.sh` script to create the standard directory structure:
**Ask the user where they want to install this job using structured questions:**

Present two options:
1. **Local** - Install in this project only (`.deepwork/jobs/`)
2. **Global** - Install for all projects in your user config (`~/.config/deepwork/jobs/`)

**Guidance for users:**
- Choose **local** if the job is specific to this project or you want to version control it
- Choose **global** if the job is reusable across multiple projects (e.g., a general "code review" or "documentation" workflow)

### Step 2: Create Directory Structure Using Script

Run the `make_new_job.sh` script to create the standard directory structure with the chosen scope:

**For local installation:**
```bash
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name]
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope local
```

This creates:
- `.deepwork/jobs/[job_name]/` - Main job directory
- `.deepwork/jobs/[job_name]/steps/` - Step instruction files
- `.deepwork/jobs/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `.deepwork/jobs/[job_name]/templates/` - Example file formats (with .gitkeep)
- `.deepwork/jobs/[job_name]/AGENTS.md` - Job management guidance

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories:
**For global installation:**
```bash
mkdir -p .deepwork/jobs/[job_name]/hooks .deepwork/jobs/[job_name]/templates
touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templates/.gitkeep
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope global
```

### Step 2: Read and Validate the Specification
This creates:
- `[scope_path]/[job_name]/` - Main job directory
- `[scope_path]/[job_name]/steps/` - Step instruction files
- `[scope_path]/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `[scope_path]/[job_name]/templates/` - Example file formats (with .gitkeep)
- `[scope_path]/[job_name]/AGENTS.md` - Job management guidance

Where `[scope_path]` is:
- `.deepwork/jobs` for local scope
- `~/.config/deepwork/jobs` (or `$XDG_CONFIG_HOME/deepwork/jobs`) for global scope

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories in the appropriate scope location.

### Step 3: Read and Validate the Specification

1. **Locate the job.yml file**
- Read `.deepwork/jobs/[job_name]/job.yml` from the review_job_spec step
- Read the job.yml from the review_job_spec step
- The file location depends on the chosen scope:
- Local: `.deepwork/jobs/[job_name]/job.yml`
- Global: `~/.config/deepwork/jobs/[job_name]/job.yml` (or `$XDG_CONFIG_HOME/deepwork/jobs/[job_name]/job.yml`)
- Parse the YAML content

2. **Validate the specification**
Expand All @@ -46,9 +67,11 @@ touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templat
- List of all steps with their details
- Understand the workflow structure

### Step 3: Generate Step Instruction Files
### Step 4: Generate Step Instruction Files

For each step in the job.yml, create a comprehensive instruction file at `.deepwork/jobs/[job_name]/steps/[step_id].md`.
For each step in the job.yml, create a comprehensive instruction file at the appropriate scope location:
- Local: `.deepwork/jobs/[job_name]/steps/[step_id].md`
- Global: `~/.config/deepwork/jobs/[job_name]/steps/[step_id].md`

**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.template` for the standard structure.

Expand Down
57 changes: 40 additions & 17 deletions .gemini/skills/deepwork_jobs/implement.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,31 +32,52 @@ Generate the DeepWork job directory structure and instruction files for each ste

Read the `job.yml` specification file and create all the necessary files to make the job functional, including directory structure and step instruction files. Then sync the commands to make them available.

### Step 1: Create Directory Structure Using Script
### Step 1: Determine Installation Scope

Run the `make_new_job.sh` script to create the standard directory structure:
**Ask the user where they want to install this job using structured questions:**

Present two options:
1. **Local** - Install in this project only (`.deepwork/jobs/`)
2. **Global** - Install for all projects in your user config (`~/.config/deepwork/jobs/`)

**Guidance for users:**
- Choose **local** if the job is specific to this project or you want to version control it
- Choose **global** if the job is reusable across multiple projects (e.g., a general "code review" or "documentation" workflow)

### Step 2: Create Directory Structure Using Script

Run the `make_new_job.sh` script to create the standard directory structure with the chosen scope:

**For local installation:**
```bash
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name]
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope local
```

This creates:
- `.deepwork/jobs/[job_name]/` - Main job directory
- `.deepwork/jobs/[job_name]/steps/` - Step instruction files
- `.deepwork/jobs/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `.deepwork/jobs/[job_name]/templates/` - Example file formats (with .gitkeep)
- `.deepwork/jobs/[job_name]/AGENTS.md` - Job management guidance

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories:
**For global installation:**
```bash
mkdir -p .deepwork/jobs/[job_name]/hooks .deepwork/jobs/[job_name]/templates
touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templates/.gitkeep
.deepwork/jobs/deepwork_jobs/make_new_job.sh [job_name] --scope global
```

### Step 2: Read and Validate the Specification
This creates:
- `[scope_path]/[job_name]/` - Main job directory
- `[scope_path]/[job_name]/steps/` - Step instruction files
- `[scope_path]/[job_name]/hooks/` - Custom validation scripts (with .gitkeep)
- `[scope_path]/[job_name]/templates/` - Example file formats (with .gitkeep)
- `[scope_path]/[job_name]/AGENTS.md` - Job management guidance

Where `[scope_path]` is:
- `.deepwork/jobs` for local scope
- `~/.config/deepwork/jobs` (or `$XDG_CONFIG_HOME/deepwork/jobs`) for global scope

**Note**: If the directory already exists (e.g., job.yml was created by define step), you can skip this step or manually create the additional directories in the appropriate scope location.

### Step 3: Read and Validate the Specification

1. **Locate the job.yml file**
- Read `.deepwork/jobs/[job_name]/job.yml` from the review_job_spec step
- Read the job.yml from the review_job_spec step
- The file location depends on the chosen scope:
- Local: `.deepwork/jobs/[job_name]/job.yml`
- Global: `~/.config/deepwork/jobs/[job_name]/job.yml` (or `$XDG_CONFIG_HOME/deepwork/jobs/[job_name]/job.yml`)
- Parse the YAML content

2. **Validate the specification**
Expand All @@ -70,9 +91,11 @@ touch .deepwork/jobs/[job_name]/hooks/.gitkeep .deepwork/jobs/[job_name]/templat
- List of all steps with their details
- Understand the workflow structure

### Step 3: Generate Step Instruction Files
### Step 4: Generate Step Instruction Files

For each step in the job.yml, create a comprehensive instruction file at `.deepwork/jobs/[job_name]/steps/[step_id].md`.
For each step in the job.yml, create a comprehensive instruction file at the appropriate scope location:
- Local: `.deepwork/jobs/[job_name]/steps/[step_id].md`
- Global: `~/.config/deepwork/jobs/[job_name]/steps/[step_id].md`

**Template reference**: See `.deepwork/jobs/deepwork_jobs/templates/step_instruction.md.template` for the standard structure.

Expand Down
2 changes: 2 additions & 0 deletions src/deepwork/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ def cli() -> None:
# Import commands
from deepwork.cli.hook import hook # noqa: E402
from deepwork.cli.install import install # noqa: E402
from deepwork.cli.port import port # noqa: E402
from deepwork.cli.rules import rules # noqa: E402
from deepwork.cli.sync import sync # noqa: E402

cli.add_command(install)
cli.add_command(sync)
cli.add_command(port)
cli.add_command(hook)
cli.add_command(rules)

Expand Down
Loading