claude-agent 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +171 -0
- package/agents/ca-executor.md +75 -0
- package/agents/ca-researcher.md +69 -0
- package/agents/ca-verifier.md +80 -0
- package/bin/install.js +161 -0
- package/bin/uninstall.js +67 -0
- package/commands/ca/_rules.md +40 -0
- package/commands/ca/context.md +47 -0
- package/commands/ca/discuss.md +74 -0
- package/commands/ca/execute.md +86 -0
- package/commands/ca/fix.md +69 -0
- package/commands/ca/forget.md +34 -0
- package/commands/ca/help.md +62 -0
- package/commands/ca/map.md +46 -0
- package/commands/ca/new.md +109 -0
- package/commands/ca/next.md +36 -0
- package/commands/ca/plan.md +151 -0
- package/commands/ca/quick.md +109 -0
- package/commands/ca/remember.md +35 -0
- package/commands/ca/research.md +74 -0
- package/commands/ca/settings.md +114 -0
- package/commands/ca/status.md +30 -0
- package/commands/ca/todo.md +33 -0
- package/commands/ca/todos.md +29 -0
- package/commands/ca/verify.md +114 -0
- package/hooks/ca-statusline.js +50 -0
- package/package.json +20 -0
- package/references/model-profiles.md +18 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# /ca:context — Show Persistent Context
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
No prerequisites.
|
|
6
|
+
|
|
7
|
+
## Behavior
|
|
8
|
+
|
|
9
|
+
### 1. Show persistent context
|
|
10
|
+
|
|
11
|
+
Read and display the contents of `.claude/rules/ca-context.md` (project context) and `~/.claude/rules/ca-context.md` (global context).
|
|
12
|
+
|
|
13
|
+
If the files are empty or don't exist, tell the user there's no saved context yet and suggest using `/ca:remember <info>` to add some.
|
|
14
|
+
|
|
15
|
+
### 2. Show loaded files in current context
|
|
16
|
+
|
|
17
|
+
Check your own context window to determine which files are currently loaded. Do NOT use Glob or Read tools to check the disk — instead, inspect what you can actually "see" in your current conversation context.
|
|
18
|
+
|
|
19
|
+
For each of the following categories, report whether the file's content is present in your context and show a brief summary if loaded:
|
|
20
|
+
|
|
21
|
+
**Auto-loaded via rules/ system** (loaded into context automatically by Claude Code if the file exists on disk):
|
|
22
|
+
- `~/.claude/rules/ca-rules.md` — shared rules
|
|
23
|
+
- `~/.claude/rules/ca-settings.md` — global language settings
|
|
24
|
+
- `~/.claude/rules/ca-context.md` — global persistent context
|
|
25
|
+
- `~/.claude/rules/ca-errors.md` — global error lessons
|
|
26
|
+
- `.claude/rules/ca-settings.md` — project language settings
|
|
27
|
+
- `.claude/rules/ca-context.md` — project persistent context
|
|
28
|
+
- `.claude/rules/ca-errors.md` — project error lessons
|
|
29
|
+
|
|
30
|
+
**Runtime config** (loaded only when a workflow command explicitly reads them):
|
|
31
|
+
- `~/.claude/ca/config.md` — global config
|
|
32
|
+
- `.ca/config.md` — workspace config
|
|
33
|
+
|
|
34
|
+
**Workflow files** (loaded only when read during workflow command execution):
|
|
35
|
+
- `.ca/current/STATUS.md`
|
|
36
|
+
- `.ca/current/BRIEF.md`
|
|
37
|
+
- `.ca/current/REQUIREMENT.md`
|
|
38
|
+
- `.ca/current/RESEARCH.md`
|
|
39
|
+
- `.ca/current/PLAN.md`
|
|
40
|
+
- `.ca/current/SUMMARY.md`
|
|
41
|
+
|
|
42
|
+
**Other persistent data:**
|
|
43
|
+
- `.ca/todos.md`
|
|
44
|
+
- `.ca/map.md`
|
|
45
|
+
|
|
46
|
+
Only display files that are loaded in your context. Skip files that are not loaded — do not show them at all.
|
|
47
|
+
For each loaded file, show: ✅ **Loaded** — followed by a 1-line summary.
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# /ca:discuss — Discuss Requirements
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
1. Check `.ca/current/STATUS.md` exists. If not, tell the user to run `/ca:new` first and stop.
|
|
6
|
+
2. Read `.ca/current/STATUS.md` and check `workflow_type`. If `workflow_type: quick`, tell the user: "This is a quick workflow. The discuss step is skipped. Please proceed with `/ca:plan`." **Stop immediately.**
|
|
7
|
+
|
|
8
|
+
## Behavior
|
|
9
|
+
|
|
10
|
+
You are conducting a focused requirements discussion. Your goal is to understand **exactly** what the user wants before any code is written.
|
|
11
|
+
|
|
12
|
+
### 1. Start the discussion
|
|
13
|
+
|
|
14
|
+
Read `.ca/current/BRIEF.md` if it exists. Use the brief as the starting point for the discussion — acknowledge what the user wants to do based on the brief.
|
|
15
|
+
|
|
16
|
+
Also read `.ca/map.md` (if exists) to understand the project structure and inform the discussion.
|
|
17
|
+
|
|
18
|
+
If the user also provided a task description with this command, incorporate it as well.
|
|
19
|
+
|
|
20
|
+
If neither the brief nor a task description exists, ask what they want to accomplish.
|
|
21
|
+
|
|
22
|
+
### 2. Ask clarifying questions ONE AT A TIME
|
|
23
|
+
|
|
24
|
+
Do NOT dump a list of questions. Ask the most important question first, wait for the answer, then ask the next based on their response. Focus on:
|
|
25
|
+
|
|
26
|
+
- **Scope**: What exactly should change? What should NOT change?
|
|
27
|
+
- **Behavior**: What should happen? What's the expected input/output?
|
|
28
|
+
- **Constraints**: Any specific approaches to use or avoid?
|
|
29
|
+
- **Success criteria**: How will we know it's done correctly?
|
|
30
|
+
|
|
31
|
+
Keep asking until the requirements are clear. Typically 2-5 questions suffice.
|
|
32
|
+
|
|
33
|
+
**IMPORTANT**: If the user indicates they don't understand your question, you MUST stop and explain or rephrase the current question. Do NOT move on to the next question until the current one is resolved. Follow the Discussion Completeness Rule in `_rules.md`.
|
|
34
|
+
|
|
35
|
+
**When a question has clear, enumerable options** (e.g., choosing between approaches, selecting a strategy, yes/no decisions), use `AskUserQuestion` with appropriate options instead of plain text. Reserve plain text for open-ended questions that cannot be expressed as choices.
|
|
36
|
+
|
|
37
|
+
### 3. Present requirement summary
|
|
38
|
+
|
|
39
|
+
When you have enough information, present a structured summary:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
## Requirement Summary
|
|
43
|
+
|
|
44
|
+
### Goal
|
|
45
|
+
<one-line description>
|
|
46
|
+
|
|
47
|
+
### Details
|
|
48
|
+
<specific requirements>
|
|
49
|
+
|
|
50
|
+
### Scope
|
|
51
|
+
- Files/areas affected: ...
|
|
52
|
+
- Out of scope: ...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 4. MANDATORY CONFIRMATION
|
|
56
|
+
|
|
57
|
+
Use `AskUserQuestion` with:
|
|
58
|
+
- header: "Requirements"
|
|
59
|
+
- question: "Does this accurately capture your requirements?"
|
|
60
|
+
- options:
|
|
61
|
+
- "Accurate" — "Requirements are correct, proceed"
|
|
62
|
+
- "Needs changes" — "I want to revise something"
|
|
63
|
+
|
|
64
|
+
- If **Accurate**: Write the summary to `.ca/current/REQUIREMENT.md` and also write the success criteria to `.ca/current/CRITERIA.md`:
|
|
65
|
+
```
|
|
66
|
+
# Success Criteria
|
|
67
|
+
|
|
68
|
+
1. ...
|
|
69
|
+
2. ...
|
|
70
|
+
```
|
|
71
|
+
Update STATUS.md (`discuss_completed: true`, `current_step: discuss`). Tell the user they can proceed with `/ca:research` or `/ca:plan` (or `/ca:next`). Suggest using `/clear` before proceeding to the next step to free up context.
|
|
72
|
+
- If **Needs changes**: Ask what needs to change, revise the summary, and ask for confirmation again.
|
|
73
|
+
|
|
74
|
+
**Do NOT proceed to any next step automatically. Wait for the user to invoke the next command.**
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# /ca:execute — Execute Confirmed Plan
|
|
2
|
+
|
|
3
|
+
Read `~/.claude/ca/config.md` for global config, then read `.ca/config.md` for workspace config. Workspace values override global values. These are needed for runtime settings (model_profile, auto_proceed_*, per-agent model overrides).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
1. Check `.ca/current/STATUS.md` exists. If not, tell the user to run `/ca:new` first and stop.
|
|
8
|
+
2. Read `.ca/current/STATUS.md` and verify `plan_confirmed: true`. If not, tell the user to run `/ca:plan` first and get all three confirmations. **Stop immediately.**
|
|
9
|
+
|
|
10
|
+
## Behavior
|
|
11
|
+
|
|
12
|
+
You are the execution orchestrator. You delegate the actual work to the `ca-executor` agent running in the foreground.
|
|
13
|
+
|
|
14
|
+
### 1. Read context
|
|
15
|
+
|
|
16
|
+
Read these files and collect their full content:
|
|
17
|
+
- `.ca/current/PLAN.md`
|
|
18
|
+
- `.ca/current/REQUIREMENT.md` (or `.ca/current/BRIEF.md` if `workflow_type: quick`)
|
|
19
|
+
|
|
20
|
+
### 1b. Ensure codebase map exists
|
|
21
|
+
|
|
22
|
+
Check if `.ca/map.md` exists:
|
|
23
|
+
- If it does NOT exist, check if the project has existing source files (i.e., the project is not empty).
|
|
24
|
+
- If the project is **not empty**: Run `/ca:map` to create the codebase map before proceeding to execution.
|
|
25
|
+
- If the project is **empty** (new project): Skip for now — the map will be created after execution (see step 7).
|
|
26
|
+
|
|
27
|
+
### 2. Resolve model for ca-executor
|
|
28
|
+
|
|
29
|
+
Read the model configuration from config (global then workspace override):
|
|
30
|
+
1. Check for per-agent override: `ca-executor_model` in config. If set, use that model.
|
|
31
|
+
2. Otherwise, read `model_profile` from config (default: `balanced`). Read `references/model-profiles.md` and look up the model for `ca-executor` in the corresponding profile column.
|
|
32
|
+
3. The resolved model will be passed to the Task tool.
|
|
33
|
+
|
|
34
|
+
### 3. Launch ca-executor agent
|
|
35
|
+
|
|
36
|
+
Use the Task tool with `subagent_type: "ca-executor"` and the resolved `model` parameter to launch the ca-executor agent. Pass it:
|
|
37
|
+
- The full content of PLAN.md
|
|
38
|
+
- The full content of REQUIREMENT.md (or BRIEF.md if `workflow_type: quick`)
|
|
39
|
+
- The project root path
|
|
40
|
+
- Instructions to follow the `ca-executor` agent prompt
|
|
41
|
+
|
|
42
|
+
The agent runs in the foreground and executes the implementation steps, returning an execution summary.
|
|
43
|
+
|
|
44
|
+
### 4. Write SUMMARY.md
|
|
45
|
+
|
|
46
|
+
Take the agent's returned summary and write it to `.ca/current/SUMMARY.md`.
|
|
47
|
+
|
|
48
|
+
### 5. Present execution summary
|
|
49
|
+
|
|
50
|
+
Display to the user:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
## Execution Summary
|
|
54
|
+
|
|
55
|
+
### Changes Made
|
|
56
|
+
- file1.py — what changed
|
|
57
|
+
- file2.py — what changed
|
|
58
|
+
|
|
59
|
+
### Steps Completed
|
|
60
|
+
1. ...
|
|
61
|
+
2. ...
|
|
62
|
+
|
|
63
|
+
### Notes/Deviations (if any)
|
|
64
|
+
- ...
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 6. Update STATUS.md
|
|
68
|
+
|
|
69
|
+
Set `execute_completed: true`, `current_step: execute`.
|
|
70
|
+
|
|
71
|
+
### 7. Update codebase map
|
|
72
|
+
|
|
73
|
+
If `.ca/map.md` exists:
|
|
74
|
+
- Read the current map and the execution summary
|
|
75
|
+
- Update `.ca/map.md` to reflect any new or modified files and their purposes
|
|
76
|
+
- Update the "Last updated" date
|
|
77
|
+
|
|
78
|
+
If `.ca/map.md` does not exist (e.g., new project that was empty before execution), create it now by running the equivalent of `/ca:map` — scan the project structure and write `.ca/map.md`.
|
|
79
|
+
|
|
80
|
+
### 8. Auto-proceed to verification
|
|
81
|
+
|
|
82
|
+
Check config for `auto_proceed_to_verify`.
|
|
83
|
+
- If `true`: Tell the user execution is complete, then automatically execute `Skill(ca:verify)`.
|
|
84
|
+
- If `false` or not set: Tell the user execution is complete. Suggest using `/clear` before verification to free up context, then tell the user to run `/ca:verify` (or `/ca:next`). Also mention: "Tip: You can set `auto_proceed_to_verify: true` in `/ca:settings` to auto-proceed."
|
|
85
|
+
|
|
86
|
+
**Do NOT proceed to verification automatically, unless `auto_proceed_to_verify` is set to `true` in config.**
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# /ca:fix — Roll Back to a Previous Step
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
Check `.ca/current/STATUS.md` exists. If not, tell the user to run `/ca:new` first and stop.
|
|
6
|
+
|
|
7
|
+
## Behavior
|
|
8
|
+
|
|
9
|
+
### 1. Show current state
|
|
10
|
+
|
|
11
|
+
Read `.ca/current/STATUS.md` and display where the workflow currently is.
|
|
12
|
+
|
|
13
|
+
### 2. Determine target step
|
|
14
|
+
|
|
15
|
+
The user's message after `/ca:fix` may specify a step name. Valid steps:
|
|
16
|
+
- `discuss` — go back to requirements discussion
|
|
17
|
+
- `research` — go back to research
|
|
18
|
+
- `plan` — go back to planning
|
|
19
|
+
|
|
20
|
+
If no step is specified, show the options and ask the user where they want to go back to.
|
|
21
|
+
|
|
22
|
+
### 3. Update STATUS.md
|
|
23
|
+
|
|
24
|
+
Based on the target step, reset the status flags:
|
|
25
|
+
|
|
26
|
+
- **Back to discuss**: Set `discuss_completed: false`, `research_completed: false`, `plan_completed: false`, `plan_confirmed: false`, `execute_completed: false`, `verify_completed: false`, `current_step: init`
|
|
27
|
+
- **Back to research**: Set `research_completed: false`, `plan_completed: false`, `plan_confirmed: false`, `execute_completed: false`, `verify_completed: false`, `current_step: discuss`
|
|
28
|
+
- **Back to plan**: Set `plan_completed: false`, `plan_confirmed: false`, `execute_completed: false`, `verify_completed: false`, `current_step: research` (or `discuss` if research wasn't done)
|
|
29
|
+
|
|
30
|
+
### 4. Preserve files
|
|
31
|
+
|
|
32
|
+
Do NOT delete any existing files in `.ca/current/`. They serve as reference for the user when revising.
|
|
33
|
+
|
|
34
|
+
### 5. Update PLAN.md for fix mode (if rolling back to plan)
|
|
35
|
+
|
|
36
|
+
If the target step is `plan` and `.ca/current/PLAN.md` exists:
|
|
37
|
+
- Read the current PLAN.md and `.ca/current/SUMMARY.md` (if exists)
|
|
38
|
+
- Based on the execution summary, mark completed implementation steps with `[x]` prefix
|
|
39
|
+
- Mark steps that failed, need modification, or were not reached with `[ ]` prefix
|
|
40
|
+
- Add a section at the end of PLAN.md:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
## Fix Notes
|
|
44
|
+
|
|
45
|
+
Rolled back to plan on YYYY-MM-DD.
|
|
46
|
+
Steps marked [x] were completed before rollback.
|
|
47
|
+
Steps marked [ ] need to be re-planned or modified.
|
|
48
|
+
The planner should append/update fix steps below, NOT rewrite the entire plan.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### 6. Update CRITERIA.md for fix mode (if rolling back to plan)
|
|
52
|
+
|
|
53
|
+
If `.ca/current/CRITERIA.md` exists:
|
|
54
|
+
- Read the current CRITERIA.md
|
|
55
|
+
- Keep all existing criteria entries intact
|
|
56
|
+
- Add a note at the end:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
## Fix Notes
|
|
60
|
+
|
|
61
|
+
Rolled back on YYYY-MM-DD. All criteria above must still be verified after fix.
|
|
62
|
+
New criteria for fix changes should be appended below this line.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### 7. Confirm
|
|
66
|
+
|
|
67
|
+
Tell the user which step they've rolled back to and what command to run next.
|
|
68
|
+
|
|
69
|
+
If rolled back to plan, also tell the user: "PLAN.md has been updated with completion markers. When `/ca:plan` runs, it will append/update steps rather than rewriting."
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# /ca:forget — Remove from Persistent Context
|
|
2
|
+
|
|
3
|
+
## Prerequisites
|
|
4
|
+
|
|
5
|
+
No prerequisites — context files are checked on demand.
|
|
6
|
+
|
|
7
|
+
## Behavior
|
|
8
|
+
|
|
9
|
+
### 1. Ask target level
|
|
10
|
+
|
|
11
|
+
Use `AskUserQuestion` with:
|
|
12
|
+
- header: "Level"
|
|
13
|
+
- question: "Remove from global or project context?"
|
|
14
|
+
- options:
|
|
15
|
+
- "Project" — "Remove from .claude/rules/ca-context.md"
|
|
16
|
+
- "Global" — "Remove from ~/.claude/rules/ca-context.md"
|
|
17
|
+
|
|
18
|
+
### 2. Read current context
|
|
19
|
+
|
|
20
|
+
Based on the user's choice:
|
|
21
|
+
- **Project**: Read `.claude/rules/ca-context.md` and display its contents.
|
|
22
|
+
- **Global**: Read `~/.claude/rules/ca-context.md` and display its contents. If the file doesn't exist, tell the user there is no global context and stop.
|
|
23
|
+
|
|
24
|
+
### 3. Identify what to remove
|
|
25
|
+
|
|
26
|
+
The user's message after `/ca:forget` describes what to remove. Match it against existing entries.
|
|
27
|
+
|
|
28
|
+
If the match is ambiguous, show the matching entries and ask the user to confirm which one(s) to remove.
|
|
29
|
+
|
|
30
|
+
### 4. Remove and confirm
|
|
31
|
+
|
|
32
|
+
Remove the matching entry/entries from the chosen context file and write the updated file.
|
|
33
|
+
|
|
34
|
+
Tell the user what was removed and show the remaining context.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# /ca:help — Command Reference
|
|
2
|
+
|
|
3
|
+
Display all available CA commands in the user's preferred language:
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
| Command | Description |
|
|
8
|
+
|---------|-------------|
|
|
9
|
+
| `/ca:settings` | Configure language settings (global or workspace) |
|
|
10
|
+
|
|
11
|
+
## Workflow Commands
|
|
12
|
+
|
|
13
|
+
| Command | Description |
|
|
14
|
+
|---------|-------------|
|
|
15
|
+
| `/ca:new [description]` | Start a new requirement — creates `.ca/` directory, collects initial brief |
|
|
16
|
+
| `/ca:quick [description]` | Quick workflow — skip discuss & research, go straight to plan |
|
|
17
|
+
| `/ca:discuss` | Discuss requirements — ask clarifying questions, produce confirmed requirement summary |
|
|
18
|
+
| `/ca:research` | Analyze codebase + external resources (optional step) |
|
|
19
|
+
| `/ca:plan` | Propose implementation plan with **triple confirmation** |
|
|
20
|
+
| `/ca:execute` | Execute the confirmed plan (uses ca-executor agent) |
|
|
21
|
+
| `/ca:verify` | Self-check + user acceptance + git commit confirmation (uses ca-verifier agent) |
|
|
22
|
+
| `/ca:next` | Auto-detect current step and execute the next one |
|
|
23
|
+
|
|
24
|
+
## Context Management
|
|
25
|
+
|
|
26
|
+
| Command | Description |
|
|
27
|
+
|---------|-------------|
|
|
28
|
+
| `/ca:remember <info>` | Save information to persistent context |
|
|
29
|
+
| `/ca:context` | Display current persistent context |
|
|
30
|
+
| `/ca:forget <info>` | Remove information from context |
|
|
31
|
+
|
|
32
|
+
## Todo Management
|
|
33
|
+
|
|
34
|
+
| Command | Description |
|
|
35
|
+
|---------|-------------|
|
|
36
|
+
| `/ca:todo <item>` | Add a todo item |
|
|
37
|
+
| `/ca:todos` | List all todo items |
|
|
38
|
+
|
|
39
|
+
## Navigation
|
|
40
|
+
|
|
41
|
+
| Command | Description |
|
|
42
|
+
|---------|-------------|
|
|
43
|
+
| `/ca:status` | Show current workflow status |
|
|
44
|
+
| `/ca:fix [step]` | Roll back to a previous step |
|
|
45
|
+
| `/ca:map` | Scan project structure and generate/update `.ca/map.md` |
|
|
46
|
+
| `/ca:help` | Show this reference |
|
|
47
|
+
|
|
48
|
+
## Typical Workflow
|
|
49
|
+
|
|
50
|
+
**Standard:**
|
|
51
|
+
```
|
|
52
|
+
/ca:new → /ca:discuss → /ca:research (optional) → /ca:plan → /ca:execute → /ca:verify
|
|
53
|
+
```
|
|
54
|
+
**Or use `/ca:next` repeatedly to auto-advance through each step.**
|
|
55
|
+
|
|
56
|
+
**Quick:**
|
|
57
|
+
```
|
|
58
|
+
/ca:quick → /ca:plan → /ca:execute → /ca:verify
|
|
59
|
+
```
|
|
60
|
+
**Or use `/ca:next` repeatedly to auto-advance through each step.**
|
|
61
|
+
|
|
62
|
+
Every step has a **mandatory confirmation point** — nothing proceeds without your explicit approval.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# /ca:map — Scan Project Structure
|
|
2
|
+
|
|
3
|
+
## Behavior
|
|
4
|
+
|
|
5
|
+
### 1. Check existing map
|
|
6
|
+
|
|
7
|
+
If `.ca/map.md` already exists, use `AskUserQuestion` with:
|
|
8
|
+
- header: "Map"
|
|
9
|
+
- question: "A codebase map already exists. What would you like to do?"
|
|
10
|
+
- options:
|
|
11
|
+
- "Update" — "Refresh the existing map"
|
|
12
|
+
- "Regenerate" — "Regenerate from scratch"
|
|
13
|
+
- "Cancel" — "Keep the current map"
|
|
14
|
+
|
|
15
|
+
If **Cancel**: Stop.
|
|
16
|
+
|
|
17
|
+
### 2. Scan project structure
|
|
18
|
+
|
|
19
|
+
Scan the project root directory:
|
|
20
|
+
- List all top-level directories and files
|
|
21
|
+
- For each significant directory, list its contents (1-2 levels deep)
|
|
22
|
+
- Identify key files (entry points, configs, READMEs, etc.)
|
|
23
|
+
- Skip `.git/`, `node_modules/`, `.ca/`, and other common ignored directories
|
|
24
|
+
|
|
25
|
+
### 3. Analyze and generate map
|
|
26
|
+
|
|
27
|
+
For each significant file/directory, write a brief description of its purpose. Generate `.ca/map.md` with:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
# Codebase Map
|
|
31
|
+
|
|
32
|
+
> Auto-generated by /ca:map. Last updated: YYYY-MM-DD
|
|
33
|
+
|
|
34
|
+
## Project Overview
|
|
35
|
+
<brief description of what this project does>
|
|
36
|
+
|
|
37
|
+
## Directory Structure
|
|
38
|
+
<tree-like structure with descriptions>
|
|
39
|
+
|
|
40
|
+
## Key Files
|
|
41
|
+
<list of important files with their purposes>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### 4. Confirm
|
|
45
|
+
|
|
46
|
+
Tell the user the map has been generated/updated. Show a summary of what was mapped.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# /ca:new — Start a New Requirement
|
|
2
|
+
|
|
3
|
+
Read `~/.claude/ca/config.md` for global config, then read `.ca/config.md` for workspace config. Workspace values override global values. These are needed for runtime settings and to check if global config exists.
|
|
4
|
+
|
|
5
|
+
## Behavior
|
|
6
|
+
|
|
7
|
+
### 1. Check for global config
|
|
8
|
+
|
|
9
|
+
If `~/.claude/ca/config.md` does not exist, **automatically run the settings flow inline**:
|
|
10
|
+
- Ask the user for the three language settings (interaction_language, comment_language, code_language) using `AskUserQuestion`, one at a time.
|
|
11
|
+
- Save to `~/.claude/ca/config.md` as global config.
|
|
12
|
+
- Also generate `~/.claude/rules/ca-settings.md` with corresponding language rules.
|
|
13
|
+
- Then continue with the steps below.
|
|
14
|
+
|
|
15
|
+
### 2. Check for unfinished workflow
|
|
16
|
+
|
|
17
|
+
If `.ca/current/STATUS.md` exists, check if `verify_completed` is `false`.
|
|
18
|
+
|
|
19
|
+
If there is an unfinished workflow:
|
|
20
|
+
- **Warn the user**: Tell them there is an unfinished workflow in `.ca/current/`.
|
|
21
|
+
- Show what step it was on.
|
|
22
|
+
- Use `AskUserQuestion` with:
|
|
23
|
+
- header: "Archive"
|
|
24
|
+
- question: "Do you want to archive the unfinished workflow and start fresh?"
|
|
25
|
+
- options:
|
|
26
|
+
- "Archive and start fresh" — "Move old files to history and start new"
|
|
27
|
+
- "Keep current" — "Continue the existing workflow"
|
|
28
|
+
- If **Archive and start fresh**: Move all files from `.ca/current/` to `.ca/history/<next-number>-unfinished/`, then continue.
|
|
29
|
+
- If **Keep current**: Stop. Tell the user to finish the current workflow first or use `/ca:fix` to go back.
|
|
30
|
+
|
|
31
|
+
### 3. Create directory structure
|
|
32
|
+
|
|
33
|
+
Create the following directories and files if they don't exist:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
.ca/
|
|
37
|
+
todos.md
|
|
38
|
+
current/
|
|
39
|
+
history/
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 4. Collect initial requirement description and link to todo
|
|
43
|
+
|
|
44
|
+
**If the user provided a description** with this command:
|
|
45
|
+
1. Read `.ca/todos.md` and find all uncompleted todo items (under `# Todo List`, not in `# Archive`).
|
|
46
|
+
2. Analyze the user's description and see if it matches any existing todo item.
|
|
47
|
+
3. If a match is found, use `AskUserQuestion` with:
|
|
48
|
+
- header: "Link Todo"
|
|
49
|
+
- question: "I found a matching todo: <todo text>. Link this requirement to it?"
|
|
50
|
+
- options:
|
|
51
|
+
- "Yes, link" — "Link to this todo"
|
|
52
|
+
- "No, skip" — "Don't link"
|
|
53
|
+
- If **Yes, link**: Save the todo text for linking in step 5.
|
|
54
|
+
- If **No, skip**: Continue without linking.
|
|
55
|
+
4. If no match is found, use `AskUserQuestion` with:
|
|
56
|
+
- header: "Add Todo"
|
|
57
|
+
- question: "This requirement doesn't match any existing todo. Add it as a new todo item?"
|
|
58
|
+
- options:
|
|
59
|
+
- "Yes, add" — "Add to todo list"
|
|
60
|
+
- "No, skip" — "Don't add"
|
|
61
|
+
- If **Yes, add**: Append to `.ca/todos.md` with format `- [ ] <user's description>` and `> Added: YYYY-MM-DD` (use today's date). Save the todo text for linking in step 5.
|
|
62
|
+
- If **No, skip**: Continue without linking.
|
|
63
|
+
|
|
64
|
+
**If the user did NOT provide a description**:
|
|
65
|
+
1. Read `.ca/todos.md` and find all uncompleted todo items.
|
|
66
|
+
2. Analyze and present them to the user: **"Here are your current todos. Which one would you like to work on? (Or describe a new requirement)"**
|
|
67
|
+
- Show each uncompleted todo with a number.
|
|
68
|
+
3. If the user selects a todo, use that as the requirement description and save it for linking in step 5.
|
|
69
|
+
4. If the user provides a new description instead, use it and proceed to match/add logic as above.
|
|
70
|
+
|
|
71
|
+
### 5. Write BRIEF.md
|
|
72
|
+
|
|
73
|
+
Write `.ca/current/BRIEF.md` with:
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
# Brief
|
|
77
|
+
|
|
78
|
+
<user's description>
|
|
79
|
+
|
|
80
|
+
linked_todo: <todo text if linked, otherwise omit this line>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**IMPORTANT**: The `linked_todo` value must be the **exact original text** from `todos.md`. Do NOT modify, abbreviate, rephrase, or summarize the todo text. Copy it verbatim.
|
|
84
|
+
|
|
85
|
+
Include `linked_todo` only if a todo was linked in step 4.
|
|
86
|
+
|
|
87
|
+
### 6. Initialize STATUS.md
|
|
88
|
+
|
|
89
|
+
Write `.ca/current/STATUS.md` with:
|
|
90
|
+
|
|
91
|
+
```markdown
|
|
92
|
+
# Workflow Status
|
|
93
|
+
|
|
94
|
+
workflow_type: standard
|
|
95
|
+
current_step: new
|
|
96
|
+
init_completed: true
|
|
97
|
+
discuss_completed: false
|
|
98
|
+
research_completed: false
|
|
99
|
+
plan_completed: false
|
|
100
|
+
plan_confirmed: false
|
|
101
|
+
execute_completed: false
|
|
102
|
+
verify_completed: false
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### 7. Confirm completion
|
|
106
|
+
|
|
107
|
+
Tell the user the new requirement has been created. Show the brief. Suggest proceeding with `/ca:discuss` (or `/ca:next`) to discuss and refine the requirements.
|
|
108
|
+
|
|
109
|
+
**Do NOT proceed to discuss automatically. Wait for the user to invoke the next command.**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# /ca:next — Execute Next Workflow Step
|
|
2
|
+
|
|
3
|
+
Read `~/.claude/ca/config.md` for global config, then read `.ca/config.md` for workspace config. Workspace values override global values. These are needed for runtime settings (model_profile, auto_proceed_*, per-agent model overrides).
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Check `.ca/current/STATUS.md` exists. If not, tell the user to run `/ca:new` first and stop.
|
|
8
|
+
|
|
9
|
+
## Behavior
|
|
10
|
+
|
|
11
|
+
### 1. Read current status
|
|
12
|
+
|
|
13
|
+
Read `.ca/current/STATUS.md` and determine the current workflow state.
|
|
14
|
+
|
|
15
|
+
### 2. Determine and execute next step
|
|
16
|
+
|
|
17
|
+
Based on the status flags and `workflow_type`, determine the next step and execute it using the `Skill` tool:
|
|
18
|
+
|
|
19
|
+
**For `workflow_type: standard`:**
|
|
20
|
+
- If `init_completed: true` and `discuss_completed: false` → Execute `Skill(ca:discuss)`
|
|
21
|
+
- If `discuss_completed: true` and `research_completed: false` → Execute `Skill(ca:research)`
|
|
22
|
+
- If `research_completed: true` and `plan_completed: false` → Execute `Skill(ca:plan)`
|
|
23
|
+
- If `plan_confirmed: true` and `execute_completed: false` → Execute `Skill(ca:execute)`
|
|
24
|
+
- If `execute_completed: true` and `verify_completed: false` → Execute `Skill(ca:verify)`
|
|
25
|
+
- If `verify_completed: true` → Tell the user the workflow is complete.
|
|
26
|
+
|
|
27
|
+
**For `workflow_type: quick`:**
|
|
28
|
+
- If `init_completed: true` and `plan_completed: false` → Execute `Skill(ca:plan)`
|
|
29
|
+
- If `plan_confirmed: true` and `execute_completed: false` → Execute `Skill(ca:execute)`
|
|
30
|
+
- If `execute_completed: true` and `verify_completed: false` → Execute `Skill(ca:verify)`
|
|
31
|
+
- If `verify_completed: true` → Tell the user the workflow is complete.
|
|
32
|
+
|
|
33
|
+
### 3. Edge cases
|
|
34
|
+
|
|
35
|
+
- If no STATUS.md exists, tell the user to run `/ca:new` first.
|
|
36
|
+
- If the workflow is in an inconsistent state (e.g., plan_completed but not plan_confirmed), tell the user and suggest running the appropriate command.
|