aiblueprint-cli 1.4.24 → 1.4.25
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/claude-code-config/skills/workflow-apex-free/SKILL.md +261 -0
- package/claude-code-config/skills/workflow-apex-free/scripts/setup-templates.sh +100 -0
- package/claude-code-config/skills/workflow-apex-free/scripts/update-progress.sh +80 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-00-init.md +267 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-00b-branch.md +126 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-00b-economy.md +244 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-00b-interactive.md +153 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-01-analyze.md +361 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-02-plan.md +264 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-03-execute.md +239 -0
- package/claude-code-config/skills/workflow-apex-free/steps/step-04-validate.md +251 -0
- package/claude-code-config/skills/workflow-apex-free/templates/00-context.md +43 -0
- package/claude-code-config/skills/workflow-apex-free/templates/01-analyze.md +10 -0
- package/claude-code-config/skills/workflow-apex-free/templates/02-plan.md +10 -0
- package/claude-code-config/skills/workflow-apex-free/templates/03-execute.md +10 -0
- package/claude-code-config/skills/workflow-apex-free/templates/04-validate.md +10 -0
- package/claude-code-config/skills/workflow-apex-free/templates/README.md +176 -0
- package/claude-code-config/skills/workflow-apex-free/templates/step-complete.md +7 -0
- package/dist/cli.js +146 -9
- package/package.json +1 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: apex
|
|
3
|
+
description: Systematic implementation using APEX methodology (Analyze-Plan-Execute-Validate) with parallel agents and self-validation. Use when implementing features, fixing bugs, or making code changes that benefit from structured workflow.
|
|
4
|
+
argument-hint: "[-a] [-s] [-e] [-b] [-i] [-r <task-id>] <task description>"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Execute systematic implementation workflows using the APEX methodology. This skill uses progressive step loading to minimize context usage and supports saving outputs for review and resumption.
|
|
9
|
+
</objective>
|
|
10
|
+
|
|
11
|
+
<quick_start>
|
|
12
|
+
**Basic usage:**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
/apex add authentication middleware
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Recommended workflow (autonomous with save):**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
/apex -a -s implement user registration
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Flags:**
|
|
25
|
+
|
|
26
|
+
- `-a` (auto): Skip confirmations
|
|
27
|
+
- `-s` (save): Save outputs to `.claude/output/apex/`
|
|
28
|
+
- `-e` (economy): No subagents, save tokens
|
|
29
|
+
|
|
30
|
+
See `<parameters>` for complete flag list.
|
|
31
|
+
</quick_start>
|
|
32
|
+
|
|
33
|
+
<parameters>
|
|
34
|
+
|
|
35
|
+
<flags>
|
|
36
|
+
**Enable flags (turn ON):**
|
|
37
|
+
| Short | Long | Description |
|
|
38
|
+
|-------|------|-------------|
|
|
39
|
+
| `-a` | `--auto` | Autonomous mode: skip confirmations, auto-approve plans |
|
|
40
|
+
| `-s` | `--save` | Save mode: output each step to `.claude/output/apex/` |
|
|
41
|
+
| `-e` | `--economy` | Economy mode: no subagents, save tokens (for limited plans) |
|
|
42
|
+
| `-r` | `--resume` | Resume mode: continue from a previous task |
|
|
43
|
+
| `-b` | `--branch` | Branch mode: verify not on main, create branch if needed |
|
|
44
|
+
| `-i` | `--interactive` | Interactive mode: configure flags via AskUserQuestion |
|
|
45
|
+
|
|
46
|
+
**Disable flags (turn OFF):**
|
|
47
|
+
| Short | Long | Description |
|
|
48
|
+
|-------|------|-------------|
|
|
49
|
+
| `-A` | `--no-auto` | Disable auto mode |
|
|
50
|
+
| `-S` | `--no-save` | Disable save mode |
|
|
51
|
+
| `-E` | `--no-economy` | Disable economy mode |
|
|
52
|
+
| `-B` | `--no-branch` | Disable branch mode |
|
|
53
|
+
</flags>
|
|
54
|
+
|
|
55
|
+
<examples>
|
|
56
|
+
```bash
|
|
57
|
+
# Basic
|
|
58
|
+
/apex add auth middleware
|
|
59
|
+
|
|
60
|
+
# Autonomous (skip confirmations)
|
|
61
|
+
/apex -a add auth middleware
|
|
62
|
+
|
|
63
|
+
# Save outputs
|
|
64
|
+
/apex -a -s add auth middleware
|
|
65
|
+
|
|
66
|
+
# Resume previous task
|
|
67
|
+
/apex -r 01-auth-middleware
|
|
68
|
+
/apex -r 01 # Partial match
|
|
69
|
+
|
|
70
|
+
# Economy mode (save tokens)
|
|
71
|
+
/apex -e add auth middleware
|
|
72
|
+
|
|
73
|
+
# Interactive flag config
|
|
74
|
+
/apex -i add auth middleware
|
|
75
|
+
|
|
76
|
+
# Disable flags (uppercase)
|
|
77
|
+
/apex -A add auth middleware # Disable auto
|
|
78
|
+
```
|
|
79
|
+
</examples>
|
|
80
|
+
|
|
81
|
+
<parsing_rules>
|
|
82
|
+
**Flag parsing:**
|
|
83
|
+
|
|
84
|
+
1. Defaults loaded from `steps/step-00-init.md` `<defaults>` section
|
|
85
|
+
2. Command-line flags override defaults (enable with lowercase `-x`, disable with uppercase `-X`)
|
|
86
|
+
3. Flags removed from input, remainder becomes `{task_description}`
|
|
87
|
+
4. Task ID generated as `NN-kebab-case-description`
|
|
88
|
+
|
|
89
|
+
For detailed parsing algorithm, see `steps/step-00-init.md`.
|
|
90
|
+
</parsing_rules>
|
|
91
|
+
|
|
92
|
+
</parameters>
|
|
93
|
+
|
|
94
|
+
<output_structure>
|
|
95
|
+
**When `{save_mode}` = true:**
|
|
96
|
+
|
|
97
|
+
All outputs saved to PROJECT directory (where Claude Code is running):
|
|
98
|
+
```
|
|
99
|
+
.claude/output/apex/{task-id}/
|
|
100
|
+
├── 00-context.md # Params, user request, timestamp
|
|
101
|
+
├── 01-analyze.md # Analysis findings
|
|
102
|
+
├── 02-plan.md # Implementation plan
|
|
103
|
+
├── 03-execute.md # Execution log
|
|
104
|
+
└── 04-validate.md # Validation results
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**00-context.md structure:**
|
|
108
|
+
```markdown
|
|
109
|
+
# APEX Task: {task_id}
|
|
110
|
+
|
|
111
|
+
**Created:** {timestamp}
|
|
112
|
+
**Task:** {task_description}
|
|
113
|
+
|
|
114
|
+
## Flags
|
|
115
|
+
- Auto mode: {auto_mode}
|
|
116
|
+
- Save mode: {save_mode}
|
|
117
|
+
- Economy mode: {economy_mode}
|
|
118
|
+
|
|
119
|
+
## User Request
|
|
120
|
+
{original user input}
|
|
121
|
+
|
|
122
|
+
## Acceptance Criteria
|
|
123
|
+
- [ ] AC1: {inferred criterion}
|
|
124
|
+
- [ ] AC2: {inferred criterion}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
</output_structure>
|
|
128
|
+
|
|
129
|
+
<resume_workflow>
|
|
130
|
+
**Resume mode (`-r {task-id}`):**
|
|
131
|
+
|
|
132
|
+
When provided, step-00 will:
|
|
133
|
+
|
|
134
|
+
1. Locate the task folder in `.claude/output/apex/`
|
|
135
|
+
2. Restore state from `00-context.md`
|
|
136
|
+
3. Find the last completed step
|
|
137
|
+
4. Continue from the next step
|
|
138
|
+
|
|
139
|
+
Supports partial matching (e.g., `-r 01` finds `01-add-auth-middleware`).
|
|
140
|
+
|
|
141
|
+
For implementation details, see `steps/step-00-init.md`.
|
|
142
|
+
</resume_workflow>
|
|
143
|
+
|
|
144
|
+
<workflow>
|
|
145
|
+
**Standard flow:**
|
|
146
|
+
1. Parse flags and task description
|
|
147
|
+
2. If `-r`: Execute resume workflow
|
|
148
|
+
3. If `-s`: Create output folder and 00-context.md
|
|
149
|
+
4. Load step-01-analyze.md → gather context
|
|
150
|
+
5. Load step-02-plan.md → create strategy
|
|
151
|
+
6. Load step-03-execute.md → implement
|
|
152
|
+
7. Load step-04-validate.md → verify and complete
|
|
153
|
+
</workflow>
|
|
154
|
+
|
|
155
|
+
<state_variables>
|
|
156
|
+
**Persist throughout all steps:**
|
|
157
|
+
|
|
158
|
+
| Variable | Type | Description |
|
|
159
|
+
| ----------------------- | ------- | ------------------------------------------------------ |
|
|
160
|
+
| `{task_description}` | string | What to implement (flags removed) |
|
|
161
|
+
| `{feature_name}` | string | Kebab-case name without number (e.g., `add-auth-middleware`) |
|
|
162
|
+
| `{task_id}` | string | Full identifier with number (e.g., `01-add-auth-middleware`) |
|
|
163
|
+
| `{acceptance_criteria}` | list | Success criteria (inferred or explicit) |
|
|
164
|
+
| `{auto_mode}` | boolean | Skip confirmations, use recommended options |
|
|
165
|
+
| `{save_mode}` | boolean | Save outputs to .claude/output/apex/ |
|
|
166
|
+
| `{economy_mode}` | boolean | No subagents, direct tool usage only |
|
|
167
|
+
| `{branch_mode}` | boolean | Verify not on main, create branch if needed |
|
|
168
|
+
| `{interactive_mode}` | boolean | Configure flags interactively |
|
|
169
|
+
| `{resume_task}` | string | Task ID to resume (if -r provided) |
|
|
170
|
+
| `{output_dir}` | string | Full path to output directory |
|
|
171
|
+
| `{branch_name}` | string | Created branch name (if branch_mode) |
|
|
172
|
+
|
|
173
|
+
</state_variables>
|
|
174
|
+
|
|
175
|
+
<entry_point>
|
|
176
|
+
|
|
177
|
+
**FIRST ACTION:** Load `steps/step-00-init.md`
|
|
178
|
+
|
|
179
|
+
Step 00 handles:
|
|
180
|
+
|
|
181
|
+
- Flag parsing (-a, -x, -s, -r, --test)
|
|
182
|
+
- Resume mode detection and task lookup
|
|
183
|
+
- Output folder creation (if save_mode)
|
|
184
|
+
- 00-context.md creation (if save_mode)
|
|
185
|
+
- State variable initialization
|
|
186
|
+
|
|
187
|
+
After initialization, step-00 loads step-01-analyze.md.
|
|
188
|
+
|
|
189
|
+
</entry_point>
|
|
190
|
+
|
|
191
|
+
<step_files>
|
|
192
|
+
**Progressive loading - only load current step:**
|
|
193
|
+
|
|
194
|
+
| Step | File | Purpose |
|
|
195
|
+
| ---- | ---------------------------- | ---------------------------------------------------- |
|
|
196
|
+
| 00 | `steps/step-00-init.md` | Parse flags, create output folder, initialize state |
|
|
197
|
+
| 01 | `steps/step-01-analyze.md` | Smart context gathering with 1-10 parallel agents based on complexity |
|
|
198
|
+
| 02 | `steps/step-02-plan.md` | File-by-file implementation strategy |
|
|
199
|
+
| 03 | `steps/step-03-execute.md` | Todo-driven implementation |
|
|
200
|
+
| 04 | `steps/step-04-validate.md` | Self-check, validation, and workflow completion |
|
|
201
|
+
|
|
202
|
+
</step_files>
|
|
203
|
+
|
|
204
|
+
<execution_rules>
|
|
205
|
+
|
|
206
|
+
- **Load one step at a time** - Only load the current step file
|
|
207
|
+
- **ULTRA THINK** before major decisions
|
|
208
|
+
- **Persist state variables** across all steps
|
|
209
|
+
- **Follow next_step directive** at end of each step
|
|
210
|
+
- **Save outputs** if `{save_mode}` = true (append to step file)
|
|
211
|
+
- **Use parallel agents** for independent exploration tasks
|
|
212
|
+
|
|
213
|
+
## 🧠 Smart Agent Strategy in Analyze Phase
|
|
214
|
+
|
|
215
|
+
The analyze phase (step-01) uses **adaptive agent launching** (unless economy_mode):
|
|
216
|
+
|
|
217
|
+
**Available agents:**
|
|
218
|
+
- `explore-codebase` - Find existing patterns, files, utilities
|
|
219
|
+
- `explore-docs` - Research library docs (use when unfamiliar with API)
|
|
220
|
+
- `websearch` - Find approaches, best practices, gotchas
|
|
221
|
+
|
|
222
|
+
**Launch 1-10 agents based on task complexity:**
|
|
223
|
+
|
|
224
|
+
| Complexity | Agents | When |
|
|
225
|
+
|------------|--------|------|
|
|
226
|
+
| Simple | 1-2 | Bug fix, small tweak |
|
|
227
|
+
| Medium | 2-4 | New feature in familiar stack |
|
|
228
|
+
| Complex | 4-7 | Unfamiliar libraries, integrations |
|
|
229
|
+
| Major | 6-10 | Multiple systems, many unknowns |
|
|
230
|
+
|
|
231
|
+
**BE SMART:** Analyze what you actually need before launching. Don't over-launch for simple tasks, don't under-launch for complex ones.
|
|
232
|
+
|
|
233
|
+
</execution_rules>
|
|
234
|
+
|
|
235
|
+
<save_output_pattern>
|
|
236
|
+
**When `{save_mode}` = true:**
|
|
237
|
+
|
|
238
|
+
Step-00 runs `scripts/setup-templates.sh` to initialize all output files from `templates/` directory.
|
|
239
|
+
|
|
240
|
+
**Each step then:**
|
|
241
|
+
|
|
242
|
+
1. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "in_progress"`
|
|
243
|
+
2. Append findings/outputs to the pre-created step file
|
|
244
|
+
3. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "complete"`
|
|
245
|
+
|
|
246
|
+
**Template system benefits:**
|
|
247
|
+
|
|
248
|
+
- Reduces token usage by ~75% (1,350 tokens saved per workflow)
|
|
249
|
+
- Templates in `templates/` directory (not inline in steps)
|
|
250
|
+
- Scripts handle progress tracking automatically
|
|
251
|
+
- See `templates/README.md` for details
|
|
252
|
+
|
|
253
|
+
</save_output_pattern>
|
|
254
|
+
|
|
255
|
+
<success_criteria>
|
|
256
|
+
|
|
257
|
+
- Each step loaded progressively
|
|
258
|
+
- All validation checks passing
|
|
259
|
+
- Outputs saved if `{save_mode}` enabled
|
|
260
|
+
- Clear completion summary provided
|
|
261
|
+
</success_criteria>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# APEX Template Setup Script
|
|
3
|
+
# Creates output directory structure and initializes template files
|
|
4
|
+
#
|
|
5
|
+
# Usage: setup-templates.sh "feature-name" [other args...]
|
|
6
|
+
# The script auto-generates the task ID with the next available number.
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
# Arguments - first arg is now just the feature name (kebab-case)
|
|
11
|
+
FEATURE_NAME="$1"
|
|
12
|
+
TASK_DESCRIPTION="$2"
|
|
13
|
+
AUTO_MODE="${3:-false}"
|
|
14
|
+
SAVE_MODE="${4:-false}"
|
|
15
|
+
ECONOMY_MODE="${5:-false}"
|
|
16
|
+
BRANCH_MODE="${6:-false}"
|
|
17
|
+
INTERACTIVE_MODE="${7:-false}"
|
|
18
|
+
BRANCH_NAME="${8:-}"
|
|
19
|
+
ORIGINAL_INPUT="${9:-}"
|
|
20
|
+
|
|
21
|
+
# Validate required arguments
|
|
22
|
+
if [[ -z "$FEATURE_NAME" ]]; then
|
|
23
|
+
echo "Error: FEATURE_NAME is required"
|
|
24
|
+
exit 1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [[ -z "$TASK_DESCRIPTION" ]]; then
|
|
28
|
+
echo "Error: TASK_DESCRIPTION is required"
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Get current timestamp
|
|
33
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
34
|
+
|
|
35
|
+
# Use current working directory as project root
|
|
36
|
+
PROJECT_ROOT=$(pwd)
|
|
37
|
+
APEX_OUTPUT_DIR="${PROJECT_ROOT}/.claude/output/apex"
|
|
38
|
+
|
|
39
|
+
# Create apex output directory if it doesn't exist
|
|
40
|
+
mkdir -p "$APEX_OUTPUT_DIR"
|
|
41
|
+
|
|
42
|
+
# Find the next available number
|
|
43
|
+
NEXT_NUM=1
|
|
44
|
+
if [[ -d "$APEX_OUTPUT_DIR" ]]; then
|
|
45
|
+
# Find highest existing number prefix
|
|
46
|
+
HIGHEST=$(ls -1 "$APEX_OUTPUT_DIR" 2>/dev/null | grep -oE '^[0-9]+' | sort -n | tail -1)
|
|
47
|
+
if [[ -n "$HIGHEST" ]]; then
|
|
48
|
+
# Force base-10 interpretation (leading zeros would be treated as octal)
|
|
49
|
+
NEXT_NUM=$((10#$HIGHEST + 1))
|
|
50
|
+
fi
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
# Format with leading zeros (2 digits)
|
|
54
|
+
TASK_NUM=$(printf "%02d" "$NEXT_NUM")
|
|
55
|
+
|
|
56
|
+
# Build full task ID
|
|
57
|
+
TASK_ID="${TASK_NUM}-${FEATURE_NAME}"
|
|
58
|
+
|
|
59
|
+
OUTPUT_DIR="${APEX_OUTPUT_DIR}/${TASK_ID}"
|
|
60
|
+
|
|
61
|
+
# Get skill directory
|
|
62
|
+
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
63
|
+
TEMPLATE_DIR="${SKILL_DIR}/templates"
|
|
64
|
+
|
|
65
|
+
# Create output directory
|
|
66
|
+
mkdir -p "$OUTPUT_DIR"
|
|
67
|
+
|
|
68
|
+
# Function to replace template variables
|
|
69
|
+
render_template() {
|
|
70
|
+
local template_file="$1"
|
|
71
|
+
local output_file="$2"
|
|
72
|
+
|
|
73
|
+
# Read template and replace variables
|
|
74
|
+
sed -e "s|{{task_id}}|${TASK_ID}|g" \
|
|
75
|
+
-e "s|{{task_description}}|${TASK_DESCRIPTION}|g" \
|
|
76
|
+
-e "s|{{timestamp}}|${TIMESTAMP}|g" \
|
|
77
|
+
-e "s|{{auto_mode}}|${AUTO_MODE}|g" \
|
|
78
|
+
-e "s|{{save_mode}}|${SAVE_MODE}|g" \
|
|
79
|
+
-e "s|{{economy_mode}}|${ECONOMY_MODE}|g" \
|
|
80
|
+
-e "s|{{branch_mode}}|${BRANCH_MODE}|g" \
|
|
81
|
+
-e "s|{{interactive_mode}}|${INTERACTIVE_MODE}|g" \
|
|
82
|
+
-e "s|{{branch_name}}|${BRANCH_NAME}|g" \
|
|
83
|
+
-e "s|{{original_input}}|${ORIGINAL_INPUT}|g" \
|
|
84
|
+
"$template_file" > "$output_file"
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Initialize 00-context.md
|
|
88
|
+
render_template "${TEMPLATE_DIR}/00-context.md" "${OUTPUT_DIR}/00-context.md"
|
|
89
|
+
|
|
90
|
+
# Initialize other step files (only headers, content appended during execution)
|
|
91
|
+
render_template "${TEMPLATE_DIR}/01-analyze.md" "${OUTPUT_DIR}/01-analyze.md"
|
|
92
|
+
render_template "${TEMPLATE_DIR}/02-plan.md" "${OUTPUT_DIR}/02-plan.md"
|
|
93
|
+
render_template "${TEMPLATE_DIR}/03-execute.md" "${OUTPUT_DIR}/03-execute.md"
|
|
94
|
+
render_template "${TEMPLATE_DIR}/04-validate.md" "${OUTPUT_DIR}/04-validate.md"
|
|
95
|
+
|
|
96
|
+
# Output the generated task_id for capture by caller
|
|
97
|
+
echo "TASK_ID=${TASK_ID}"
|
|
98
|
+
echo "OUTPUT_DIR=${OUTPUT_DIR}"
|
|
99
|
+
echo "✓ APEX templates initialized: ${OUTPUT_DIR}"
|
|
100
|
+
exit 0
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# APEX Progress Update Script
|
|
3
|
+
# Updates 00-context.md progress table
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Arguments
|
|
8
|
+
TASK_ID="$1"
|
|
9
|
+
STEP_NUMBER="$2"
|
|
10
|
+
STEP_NAME="$3"
|
|
11
|
+
STATUS="$4" # "in_progress" or "complete"
|
|
12
|
+
|
|
13
|
+
# Validate required arguments
|
|
14
|
+
if [[ -z "$TASK_ID" ]] || [[ -z "$STEP_NUMBER" ]] || [[ -z "$STEP_NAME" ]] || [[ -z "$STATUS" ]]; then
|
|
15
|
+
echo "Usage: $0 <task_id> <step_number> <step_name> <status>"
|
|
16
|
+
echo "Example: $0 01-add-auth 01 analyze complete"
|
|
17
|
+
exit 1
|
|
18
|
+
fi
|
|
19
|
+
|
|
20
|
+
# Find project root
|
|
21
|
+
PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
22
|
+
CONTEXT_FILE="${PROJECT_ROOT}/.claude/output/apex/${TASK_ID}/00-context.md"
|
|
23
|
+
|
|
24
|
+
# Validate context file exists
|
|
25
|
+
if [[ ! -f "$CONTEXT_FILE" ]]; then
|
|
26
|
+
echo "Error: Context file not found: $CONTEXT_FILE"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Get timestamp
|
|
31
|
+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
32
|
+
|
|
33
|
+
# Determine status symbol
|
|
34
|
+
if [[ "$STATUS" == "in_progress" ]]; then
|
|
35
|
+
STATUS_SYMBOL="⏳ In Progress"
|
|
36
|
+
elif [[ "$STATUS" == "complete" ]]; then
|
|
37
|
+
STATUS_SYMBOL="✓ Complete"
|
|
38
|
+
else
|
|
39
|
+
echo "Error: Invalid status. Use 'in_progress' or 'complete'"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Create temp file
|
|
44
|
+
TEMP_FILE=$(mktemp)
|
|
45
|
+
|
|
46
|
+
# Update the progress table
|
|
47
|
+
awk -v step="${STEP_NUMBER}-${STEP_NAME}" \
|
|
48
|
+
-v status="$STATUS_SYMBOL" \
|
|
49
|
+
-v timestamp="$TIMESTAMP" '
|
|
50
|
+
BEGIN { in_table = 0; found = 0 }
|
|
51
|
+
{
|
|
52
|
+
# Detect progress table start
|
|
53
|
+
if ($0 ~ /^## Progress/) {
|
|
54
|
+
in_table = 1
|
|
55
|
+
print $0
|
|
56
|
+
next
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
# If in table and found the matching step
|
|
60
|
+
if (in_table && $0 ~ "\\| " step " \\|") {
|
|
61
|
+
printf "| %s | %s | %s |\n", step, status, timestamp
|
|
62
|
+
found = 1
|
|
63
|
+
next
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Print line as-is
|
|
67
|
+
print $0
|
|
68
|
+
}
|
|
69
|
+
END {
|
|
70
|
+
if (!found) {
|
|
71
|
+
print "Warning: Step not found in progress table" > "/dev/stderr"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
' "$CONTEXT_FILE" > "$TEMP_FILE"
|
|
75
|
+
|
|
76
|
+
# Replace original file
|
|
77
|
+
mv "$TEMP_FILE" "$CONTEXT_FILE"
|
|
78
|
+
|
|
79
|
+
echo "✓ Progress updated: ${STEP_NUMBER}-${STEP_NAME} → ${STATUS_SYMBOL}"
|
|
80
|
+
exit 0
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: step-00-init
|
|
3
|
+
description: Initialize APEX workflow - parse flags, detect continuation, setup state
|
|
4
|
+
next_step: steps/step-01-analyze.md
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 0: Initialization
|
|
8
|
+
|
|
9
|
+
## MANDATORY EXECUTION RULES (READ FIRST):
|
|
10
|
+
|
|
11
|
+
- 🛑 NEVER skip flag parsing
|
|
12
|
+
- 🛑 ONLY check for existing workflow if resume_task is set
|
|
13
|
+
- ✅ ALWAYS parse ALL flags before any other action
|
|
14
|
+
- ✅ ONLY check for resume if {resume_task} is set
|
|
15
|
+
- 📋 YOU ARE AN INITIALIZER, not an executor
|
|
16
|
+
- 💬 FOCUS on setup only - don't look ahead to implementation
|
|
17
|
+
- 🚫 FORBIDDEN to load step-01 until init is complete
|
|
18
|
+
|
|
19
|
+
## EXECUTION PROTOCOLS:
|
|
20
|
+
|
|
21
|
+
- 🎯 Parse flags first, then check resume, then setup
|
|
22
|
+
- 💾 Create output structure if save_mode enabled
|
|
23
|
+
- 📖 Initialize all state variables before proceeding
|
|
24
|
+
- 🚫 FORBIDDEN to start analysis (that's step-01's job)
|
|
25
|
+
- ✅ ALWAYS show COMPACT summary (one table) and proceed immediately
|
|
26
|
+
- 🚫 FORBIDDEN to show verbose parsing logs or explanations
|
|
27
|
+
|
|
28
|
+
## CONTEXT BOUNDARIES:
|
|
29
|
+
|
|
30
|
+
- This is the FIRST step - no previous context exists
|
|
31
|
+
- User input contains flags and task description
|
|
32
|
+
- Output folder may or may not exist
|
|
33
|
+
- Don't assume anything about the codebase yet
|
|
34
|
+
|
|
35
|
+
## YOUR TASK:
|
|
36
|
+
|
|
37
|
+
Initialize the APEX workflow by parsing flags, detecting continuation state, and setting up the execution environment.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
<defaults>
|
|
42
|
+
## Default Configuration
|
|
43
|
+
|
|
44
|
+
**Edit these values to change default behavior. Flags always override defaults.**
|
|
45
|
+
|
|
46
|
+
```yaml
|
|
47
|
+
# ===========================================
|
|
48
|
+
# APEX DEFAULT SETTINGS
|
|
49
|
+
# ===========================================
|
|
50
|
+
|
|
51
|
+
auto_mode: false # -a: Skip confirmations, use recommended options
|
|
52
|
+
save_mode: false # -s: Save outputs to .claude/output/apex/
|
|
53
|
+
economy_mode: false # -e: No subagents, save tokens (for limited plans)
|
|
54
|
+
branch_mode: false # -b: Verify not on main, create branch if needed
|
|
55
|
+
interactive_mode: false # -i: Configure flags interactively
|
|
56
|
+
|
|
57
|
+
# Presets:
|
|
58
|
+
# Budget-friendly: economy_mode: true
|
|
59
|
+
# Full quality: save_mode: true
|
|
60
|
+
# Autonomous: auto_mode: true, save_mode: true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Flag Reference:** See `SKILL.md` for complete flag documentation and examples.
|
|
64
|
+
|
|
65
|
+
</defaults>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## EXECUTION SEQUENCE:
|
|
70
|
+
|
|
71
|
+
### 1. Parse Flags and Input
|
|
72
|
+
|
|
73
|
+
**Step 1: Load defaults from config above**
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
{auto_mode} = <default>
|
|
77
|
+
{save_mode} = <default>
|
|
78
|
+
{economy_mode} = <default>
|
|
79
|
+
{branch_mode} = <default>
|
|
80
|
+
{interactive_mode} = <default>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Step 2: Parse user input and override defaults:**
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
Enable flags (lowercase - turn ON):
|
|
87
|
+
-a or --auto → {auto_mode} = true
|
|
88
|
+
-s or --save → {save_mode} = true
|
|
89
|
+
-e or --economy → {economy_mode} = true
|
|
90
|
+
-b or --branch → {branch_mode} = true
|
|
91
|
+
|
|
92
|
+
Disable flags (UPPERCASE - turn OFF):
|
|
93
|
+
-A or --no-auto → {auto_mode} = false
|
|
94
|
+
-S or --no-save → {save_mode} = false
|
|
95
|
+
-E or --no-economy → {economy_mode} = false
|
|
96
|
+
-B or --no-branch → {branch_mode} = false
|
|
97
|
+
|
|
98
|
+
Interactive:
|
|
99
|
+
-i or --interactive → {interactive_mode} = true
|
|
100
|
+
|
|
101
|
+
Other:
|
|
102
|
+
-r or --resume → {resume_task} = <next argument>
|
|
103
|
+
Remainder → {task_description}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Step 3: Generate feature_name and task_id:**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
{feature_name} = kebab-case-description (without number prefix)
|
|
110
|
+
|
|
111
|
+
Example: "add user authentication" → "add-user-authentication"
|
|
112
|
+
|
|
113
|
+
{task_id} will be generated by the setup script:
|
|
114
|
+
- Script auto-detects next available number in .claude/output/apex/
|
|
115
|
+
- Result: "01-add-user-authentication" (or 02, 03, etc.)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 2. Check Resume Mode
|
|
119
|
+
|
|
120
|
+
<critical>
|
|
121
|
+
ONLY execute this section if {resume_task} is set!
|
|
122
|
+
If {resume_task} is NOT set, skip directly to step 3.
|
|
123
|
+
</critical>
|
|
124
|
+
|
|
125
|
+
**If `{resume_task}` is set:**
|
|
126
|
+
|
|
127
|
+
1. **Search for matching task:**
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
ls .claude/output/apex/ | grep "^{resume_task}"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
2. **If exact match found:**
|
|
134
|
+
- Read `00-context.md` to restore state variables
|
|
135
|
+
- Scan step files to find last completed step (check for completion marker)
|
|
136
|
+
- Load next incomplete step
|
|
137
|
+
- **STOP** - do not continue with fresh init
|
|
138
|
+
|
|
139
|
+
3. **If partial match (e.g., `-r 01`):**
|
|
140
|
+
- If single match: use it
|
|
141
|
+
- If multiple matches: list them and ask user to specify
|
|
142
|
+
|
|
143
|
+
4. **If no match found:**
|
|
144
|
+
- List available tasks
|
|
145
|
+
- Ask user to provide correct ID
|
|
146
|
+
|
|
147
|
+
**If {resume_task} is NOT set:** → Skip directly to step 3
|
|
148
|
+
|
|
149
|
+
### 3. Run Optional Sub-Steps
|
|
150
|
+
|
|
151
|
+
**Load sub-steps in order (if flags enabled):**
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
IF {interactive_mode} = true:
|
|
155
|
+
→ Load steps/step-00b-interactive.md
|
|
156
|
+
→ User configures flags interactively
|
|
157
|
+
→ Return here with updated flags
|
|
158
|
+
|
|
159
|
+
IF {branch_mode} = true:
|
|
160
|
+
→ Load steps/step-00b-branch.md
|
|
161
|
+
→ Verify/create branch
|
|
162
|
+
→ Return here with {branch_name} set
|
|
163
|
+
|
|
164
|
+
IF {economy_mode} = true:
|
|
165
|
+
→ Load steps/step-00b-economy.md
|
|
166
|
+
→ Apply economy overrides
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### 4. Create Output Structure (if save_mode)
|
|
170
|
+
|
|
171
|
+
**If `{save_mode}` = true:**
|
|
172
|
+
|
|
173
|
+
Run the template setup script to initialize all output files:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
bash {skill_dir}/scripts/setup-templates.sh \
|
|
177
|
+
"{feature_name}" \
|
|
178
|
+
"{task_description}" \
|
|
179
|
+
"{auto_mode}" \
|
|
180
|
+
"{save_mode}" \
|
|
181
|
+
"{economy_mode}" \
|
|
182
|
+
"{branch_mode}" \
|
|
183
|
+
"{interactive_mode}" \
|
|
184
|
+
"{branch_name}" \
|
|
185
|
+
"{original_input}"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Note:** Pass `{feature_name}` (without number prefix), NOT `{task_id}`.
|
|
189
|
+
The script auto-detects the next available number from existing folders.
|
|
190
|
+
|
|
191
|
+
This script:
|
|
192
|
+
|
|
193
|
+
- Auto-generates `{task_id}` = `NN-{feature_name}` (next available number)
|
|
194
|
+
- Creates `.claude/output/apex/{task_id}/` directory
|
|
195
|
+
- Initializes `00-context.md` with configuration and progress table
|
|
196
|
+
- Pre-creates all step files from templates (01-analyze.md, 02-plan.md, etc.)
|
|
197
|
+
- Outputs the generated `{task_id}` for use in subsequent steps
|
|
198
|
+
|
|
199
|
+
### 5. Initialize and Proceed
|
|
200
|
+
|
|
201
|
+
**Always (regardless of auto_mode):**
|
|
202
|
+
|
|
203
|
+
Show COMPACT initialization summary (one table, then proceed immediately):
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
✓ APEX: {task_description}
|
|
207
|
+
|
|
208
|
+
| Variable | Value |
|
|
209
|
+
|----------|-------|
|
|
210
|
+
| `{task_id}` | 01-kebab-name |
|
|
211
|
+
| `{auto_mode}` | true/false |
|
|
212
|
+
| `{save_mode}` | true/false |
|
|
213
|
+
| `{economy_mode}` | true/false |
|
|
214
|
+
| `{branch_mode}` | true/false |
|
|
215
|
+
|
|
216
|
+
→ Analyzing...
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
<critical>
|
|
220
|
+
KEEP OUTPUT MINIMAL:
|
|
221
|
+
- One line header with task
|
|
222
|
+
- One table with ALL variables (use brackets to show they're available)
|
|
223
|
+
- One line "→ Analyzing..." then IMMEDIATELY load step-01
|
|
224
|
+
- NO verbose explanations, NO parsing logs, NO separators
|
|
225
|
+
</critical>
|
|
226
|
+
|
|
227
|
+
**Then proceed directly to step-01-analyze.md**
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## SUCCESS METRICS:
|
|
232
|
+
|
|
233
|
+
✅ All flags correctly parsed (enable AND disable)
|
|
234
|
+
✅ Output is COMPACT (one table, no verbose logs)
|
|
235
|
+
✅ Variables shown with `{brackets}` notation
|
|
236
|
+
✅ Proceeded to step-01 immediately after table
|
|
237
|
+
✅ Output folder created with 00-context.md (if save_mode)
|
|
238
|
+
|
|
239
|
+
## FAILURE MODES:
|
|
240
|
+
|
|
241
|
+
❌ Verbose output with separators and explanations
|
|
242
|
+
❌ Showing parsing steps/logs to user
|
|
243
|
+
❌ Not using `{variable}` bracket notation
|
|
244
|
+
❌ Not proceeding immediately after summary
|
|
245
|
+
❌ **CRITICAL**: Blocking workflow with unnecessary confirmations
|
|
246
|
+
|
|
247
|
+
## INITIALIZATION PROTOCOLS:
|
|
248
|
+
|
|
249
|
+
- Parse ALL flags before any other action
|
|
250
|
+
- Check resume BEFORE creating new output folder
|
|
251
|
+
- Verify branch BEFORE creating output structure (if branch_mode)
|
|
252
|
+
- Create output structure BEFORE confirming start
|
|
253
|
+
- Load economy overrides BEFORE proceeding to step-01
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## NEXT STEP:
|
|
258
|
+
|
|
259
|
+
After showing initialization summary, always proceed directly to `./step-01-analyze.md`
|
|
260
|
+
|
|
261
|
+
<critical>
|
|
262
|
+
Remember:
|
|
263
|
+
- Step-00 is an INITIALIZER, not a GATEKEEPER
|
|
264
|
+
- Output MUST be compact: one table, no verbose logs
|
|
265
|
+
- Use `{variable}` notation to show available state
|
|
266
|
+
- Proceed immediately - never block!
|
|
267
|
+
</critical>
|