aiblueprint-cli 1.4.22 → 1.4.24

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.
Files changed (90) hide show
  1. package/claude-code-config/skills/git-commit/SKILL.md +42 -0
  2. package/claude-code-config/{commands/git/create-pr.md → skills/git-create-pr/SKILL.md} +12 -18
  3. package/claude-code-config/skills/git-fix-pr-comments/SKILL.md +51 -0
  4. package/claude-code-config/skills/git-merge/SKILL.md +68 -0
  5. package/claude-code-config/skills/{claude-memory → meta-claude-memory}/SKILL.md +7 -2
  6. package/claude-code-config/skills/meta-claude-memory/references/rules-directory-guide.md +298 -0
  7. package/claude-code-config/skills/meta-prompt-creator/SKILL.md +285 -0
  8. package/claude-code-config/skills/meta-prompt-creator/references/anthropic-best-practices.md +126 -0
  9. package/claude-code-config/skills/meta-prompt-creator/references/anti-patterns.md +57 -0
  10. package/claude-code-config/skills/meta-prompt-creator/references/clarity-principles.md +54 -0
  11. package/claude-code-config/skills/meta-prompt-creator/references/context-management.md +389 -0
  12. package/claude-code-config/skills/meta-prompt-creator/references/few-shot-patterns.md +47 -0
  13. package/claude-code-config/skills/meta-prompt-creator/references/openai-best-practices.md +50 -0
  14. package/claude-code-config/skills/meta-prompt-creator/references/prompt-templates.md +110 -0
  15. package/claude-code-config/skills/meta-prompt-creator/references/reasoning-techniques.md +52 -0
  16. package/claude-code-config/skills/meta-prompt-creator/references/system-prompt-patterns.md +48 -0
  17. package/claude-code-config/skills/meta-prompt-creator/references/xml-structure.md +36 -0
  18. package/claude-code-config/skills/meta-skill-creator/LICENSE.txt +202 -0
  19. package/claude-code-config/skills/meta-skill-creator/SKILL.md +421 -0
  20. package/claude-code-config/skills/meta-skill-creator/package.json +5 -0
  21. package/claude-code-config/skills/meta-skill-creator/references/output-patterns.md +82 -0
  22. package/claude-code-config/skills/meta-skill-creator/references/progressive-disclosure-patterns.md +374 -0
  23. package/claude-code-config/skills/meta-skill-creator/references/prompting-integration.md +363 -0
  24. package/claude-code-config/skills/meta-skill-creator/references/real-world-examples.md +513 -0
  25. package/claude-code-config/skills/meta-skill-creator/references/script-patterns.md +385 -0
  26. package/claude-code-config/skills/meta-skill-creator/references/workflows.md +28 -0
  27. package/claude-code-config/skills/meta-skill-creator/references/xml-tag-guide.md +606 -0
  28. package/claude-code-config/skills/meta-skill-creator/scripts/init-skill.ts +214 -0
  29. package/claude-code-config/skills/meta-skill-creator/scripts/package-skill.ts +146 -0
  30. package/claude-code-config/skills/meta-skill-creator/scripts/validate.ts +138 -0
  31. package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/SKILL.md +41 -15
  32. package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-00-init.md +2 -3
  33. package/claude-code-config/skills/utils-fix-errors/SKILL.md +61 -0
  34. package/claude-code-config/skills/utils-fix-grammar/SKILL.md +59 -0
  35. package/claude-code-config/skills/utils-oneshot/SKILL.md +56 -0
  36. package/claude-code-config/skills/workflow-apex/SKILL.md +303 -0
  37. package/claude-code-config/skills/workflow-apex/scripts/setup-templates.sh +134 -0
  38. package/claude-code-config/skills/workflow-apex/scripts/update-progress.sh +80 -0
  39. package/claude-code-config/skills/workflow-apex/steps/step-00-init.md +288 -0
  40. package/claude-code-config/skills/workflow-apex/steps/step-00b-branch.md +126 -0
  41. package/claude-code-config/skills/workflow-apex/steps/step-00b-economy.md +244 -0
  42. package/claude-code-config/skills/workflow-apex/steps/step-00b-interactive.md +153 -0
  43. package/claude-code-config/skills/workflow-apex/steps/step-01-analyze.md +361 -0
  44. package/claude-code-config/skills/workflow-apex/steps/step-02-plan.md +264 -0
  45. package/claude-code-config/skills/workflow-apex/steps/step-03-execute.md +239 -0
  46. package/claude-code-config/skills/workflow-apex/steps/step-04-validate.md +264 -0
  47. package/claude-code-config/skills/workflow-apex/steps/step-05-examine.md +294 -0
  48. package/claude-code-config/skills/workflow-apex/steps/step-06-resolve.md +237 -0
  49. package/claude-code-config/skills/workflow-apex/steps/step-07-tests.md +250 -0
  50. package/claude-code-config/skills/workflow-apex/steps/step-08-run-tests.md +308 -0
  51. package/claude-code-config/skills/workflow-apex/steps/step-09-finish.md +193 -0
  52. package/claude-code-config/skills/workflow-apex/templates/00-context.md +51 -0
  53. package/claude-code-config/skills/workflow-apex/templates/01-analyze.md +10 -0
  54. package/claude-code-config/skills/workflow-apex/templates/02-plan.md +10 -0
  55. package/claude-code-config/skills/workflow-apex/templates/03-execute.md +10 -0
  56. package/claude-code-config/skills/workflow-apex/templates/04-validate.md +10 -0
  57. package/claude-code-config/skills/workflow-apex/templates/05-examine.md +10 -0
  58. package/claude-code-config/skills/workflow-apex/templates/06-resolve.md +10 -0
  59. package/claude-code-config/skills/workflow-apex/templates/07-tests.md +10 -0
  60. package/claude-code-config/skills/workflow-apex/templates/08-run-tests.md +10 -0
  61. package/claude-code-config/skills/workflow-apex/templates/09-finish.md +10 -0
  62. package/claude-code-config/skills/workflow-apex/templates/README.md +195 -0
  63. package/claude-code-config/skills/workflow-apex/templates/step-complete.md +7 -0
  64. package/dist/cli.js +46 -3
  65. package/package.json +1 -1
  66. package/claude-code-config/commands/explore.md +0 -90
  67. package/claude-code-config/commands/git/commit.md +0 -60
  68. package/claude-code-config/commands/git/fix-pr-comments.md +0 -59
  69. package/claude-code-config/commands/oneshot.md +0 -57
  70. package/claude-code-config/skills/create-slash-commands/SKILL.md +0 -1110
  71. package/claude-code-config/skills/create-slash-commands/references/arguments.md +0 -273
  72. package/claude-code-config/skills/create-slash-commands/references/patterns.md +0 -947
  73. package/claude-code-config/skills/create-slash-commands/references/prompt-examples.md +0 -656
  74. package/claude-code-config/skills/create-slash-commands/references/tool-restrictions.md +0 -389
  75. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/comprehensive-example.md +0 -0
  76. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/project-patterns.md +0 -0
  77. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/prompting-techniques.md +0 -0
  78. /package/claude-code-config/skills/{claude-memory → meta-claude-memory}/references/section-templates.md +0 -0
  79. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/context-management.md +0 -0
  80. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/debugging-agents.md +0 -0
  81. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/error-handling-and-recovery.md +0 -0
  82. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/evaluation-and-testing.md +0 -0
  83. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/orchestration-patterns.md +0 -0
  84. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/subagents.md +0 -0
  85. /package/claude-code-config/skills/{create-subagents → meta-subagent-creator}/references/writing-subagent-prompts.md +0 -0
  86. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/SKILL.md +0 -0
  87. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/scripts/setup.sh +0 -0
  88. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-01-interactive-prd.md +0 -0
  89. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-02-create-stories.md +0 -0
  90. /package/claude-code-config/skills/{setup-ralph → ralph-loop}/steps/step-03-finish.md +0 -0
@@ -0,0 +1,303 @@
1
+ ---
2
+ name: apex
3
+ description: Systematic implementation using APEX methodology (Analyze-Plan-Execute-eXamine) with parallel agents, self-validation, and optional adversarial review. Use when implementing features, fixing bugs, or making code changes that benefit from structured workflow.
4
+ argument-hint: "[-a] [-x] [-s] [-t] [-b] [-pr] [-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
+ **With adversarial review:**
25
+
26
+ ```bash
27
+ /apex -a -x -s fix login bug
28
+ ```
29
+
30
+ **Flags:**
31
+
32
+ - `-a` (auto): Skip confirmations
33
+ - `-s` (save): Save outputs to `.claude/output/apex/`
34
+ - `-x` (examine): Include adversarial code review
35
+ - `-t` (test): Create and run tests
36
+ - `-pr` (pull-request): Create PR at end
37
+
38
+ See `<parameters>` for complete flag list.
39
+ </quick_start>
40
+
41
+ <parameters>
42
+
43
+ <flags>
44
+ **Enable flags (turn ON):**
45
+ | Short | Long | Description |
46
+ |-------|------|-------------|
47
+ | `-a` | `--auto` | Autonomous mode: skip confirmations, auto-approve plans |
48
+ | `-x` | `--examine` | Auto-examine mode: proceed to adversarial review |
49
+ | `-s` | `--save` | Save mode: output each step to `.claude/output/apex/` |
50
+ | `-t` | `--test` | Test mode: include test creation and runner steps |
51
+ | `-e` | `--economy` | Economy mode: no subagents, save tokens (for limited plans) |
52
+ | `-r` | `--resume` | Resume mode: continue from a previous task |
53
+ | `-b` | `--branch` | Branch mode: verify not on main, create branch if needed |
54
+ | `-pr` | `--pull-request` | PR mode: create pull request at end (enables -b) |
55
+ | `-i` | `--interactive` | Interactive mode: configure flags via AskUserQuestion |
56
+
57
+ **Disable flags (turn OFF):**
58
+ | Short | Long | Description |
59
+ |-------|------|-------------|
60
+ | `-A` | `--no-auto` | Disable auto mode |
61
+ | `-X` | `--no-examine` | Disable examine mode |
62
+ | `-S` | `--no-save` | Disable save mode |
63
+ | `-T` | `--no-test` | Disable test mode |
64
+ | `-E` | `--no-economy` | Disable economy mode |
65
+ | `-B` | `--no-branch` | Disable branch mode |
66
+ | `-PR` | `--no-pull-request` | Disable PR mode |
67
+ </flags>
68
+
69
+ <examples>
70
+ ```bash
71
+ # Basic
72
+ /apex add auth middleware
73
+
74
+ # Autonomous (skip confirmations)
75
+ /apex -a add auth middleware
76
+
77
+ # Save outputs + examine
78
+ /apex -a -x -s add auth middleware
79
+
80
+ # Full workflow with tests
81
+ /apex -a -x -s -t add auth middleware
82
+
83
+ # With PR creation
84
+ /apex -a -pr add auth middleware
85
+
86
+ # Resume previous task
87
+ /apex -r 01-auth-middleware
88
+ /apex -r 01 # Partial match
89
+
90
+ # Economy mode (save tokens)
91
+ /apex -e add auth middleware
92
+
93
+ # Interactive flag config
94
+ /apex -i add auth middleware
95
+
96
+ # Disable flags (uppercase)
97
+ /apex -A add auth middleware # Disable auto
98
+ ```
99
+ </examples>
100
+
101
+ <parsing_rules>
102
+ **Flag parsing:**
103
+
104
+ 1. Defaults loaded from `steps/step-00-init.md` `<defaults>` section
105
+ 2. Command-line flags override defaults (enable with lowercase `-x`, disable with uppercase `-X`)
106
+ 3. Flags removed from input, remainder becomes `{task_description}`
107
+ 4. Task ID generated as `NN-kebab-case-description`
108
+
109
+ For detailed parsing algorithm, see `steps/step-00-init.md`.
110
+ </parsing_rules>
111
+
112
+ </parameters>
113
+
114
+ <output_structure>
115
+ **When `{save_mode}` = true:**
116
+
117
+ All outputs saved to PROJECT directory (where Claude Code is running):
118
+ ```
119
+
120
+ .claude/output/apex/{task-id}/
121
+ ├── 00-context.md # Params, user request, timestamp
122
+ ├── 01-analyze.md # Analysis findings
123
+ ├── 02-plan.md # Implementation plan
124
+ ├── 03-execute.md # Execution log
125
+ ├── 04-validate.md # Validation results
126
+ ├── 05-examine.md # Review findings (if -x)
127
+ ├── 06-resolve.md # Resolution log (if -x)
128
+ ├── 07-tests.md # Test analysis and creation (if --test)
129
+ ├── 08-run-tests.md # Test runner log (if --test)
130
+ └── 09-finish.md # Workflow finish and PR creation (if --pull-request)
131
+
132
+ ````
133
+
134
+ **00-context.md structure:**
135
+ ```markdown
136
+ # APEX Task: {task_id}
137
+
138
+ **Created:** {timestamp}
139
+ **Task:** {task_description}
140
+
141
+ ## Flags
142
+ - Auto mode: {auto_mode}
143
+ - Examine mode: {examine_mode}
144
+ - Save mode: {save_mode}
145
+ - Test mode: {test_mode}
146
+
147
+ ## User Request
148
+ {original user input}
149
+
150
+ ## Acceptance Criteria
151
+ - [ ] AC1: {inferred criterion}
152
+ - [ ] AC2: {inferred criterion}
153
+ ````
154
+
155
+ </output_structure>
156
+
157
+ <resume_workflow>
158
+ **Resume mode (`-r {task-id}`):**
159
+
160
+ When provided, step-00 will:
161
+
162
+ 1. Locate the task folder in `.claude/output/apex/`
163
+ 2. Restore state from `00-context.md`
164
+ 3. Find the last completed step
165
+ 4. Continue from the next step
166
+
167
+ Supports partial matching (e.g., `-r 01` finds `01-add-auth-middleware`).
168
+
169
+ For implementation details, see `steps/step-00-init.md`.
170
+ </resume_workflow>
171
+
172
+ <workflow>
173
+ **Standard flow:**
174
+ 1. Parse flags and task description
175
+ 2. If `-r`: Execute resume workflow
176
+ 3. If `-s`: Create output folder and 00-context.md
177
+ 4. Load step-01-analyze.md → gather context
178
+ 5. Load step-02-plan.md → create strategy
179
+ 6. Load step-03-execute.md → implement
180
+ 7. Load step-04-validate.md → verify
181
+ 8. If `--test`: Load step-07-tests.md → analyze and create tests
182
+ 9. If `--test`: Load step-08-run-tests.md → run until green
183
+ 10. If `-x` or user requests: Load step-05-examine.md → adversarial review
184
+ 11. If findings: Load step-06-resolve.md → fix findings
185
+ 12. If `-pr`: Load step-09-finish.md → create pull request
186
+ </workflow>
187
+
188
+ <state_variables>
189
+ **Persist throughout all steps:**
190
+
191
+ | Variable | Type | Description |
192
+ | ----------------------- | ------- | ------------------------------------------------------ |
193
+ | `{task_description}` | string | What to implement (flags removed) |
194
+ | `{feature_name}` | string | Kebab-case name without number (e.g., `add-auth-middleware`) |
195
+ | `{task_id}` | string | Full identifier with number (e.g., `01-add-auth-middleware`) |
196
+ | `{acceptance_criteria}` | list | Success criteria (inferred or explicit) |
197
+ | `{auto_mode}` | boolean | Skip confirmations, use recommended options |
198
+ | `{examine_mode}` | boolean | Auto-proceed to adversarial review |
199
+ | `{save_mode}` | boolean | Save outputs to .claude/output/apex/ |
200
+ | `{test_mode}` | boolean | Include test steps (07-08) |
201
+ | `{economy_mode}` | boolean | No subagents, direct tool usage only |
202
+ | `{branch_mode}` | boolean | Verify not on main, create branch if needed |
203
+ | `{pr_mode}` | boolean | Create pull request at end |
204
+ | `{interactive_mode}` | boolean | Configure flags interactively |
205
+ | `{resume_task}` | string | Task ID to resume (if -r provided) |
206
+ | `{output_dir}` | string | Full path to output directory |
207
+ | `{branch_name}` | string | Created branch name (if branch_mode) |
208
+
209
+ </state_variables>
210
+
211
+ <entry_point>
212
+
213
+ **FIRST ACTION:** Load `steps/step-00-init.md`
214
+
215
+ Step 00 handles:
216
+
217
+ - Flag parsing (-a, -x, -s, -r, --test)
218
+ - Resume mode detection and task lookup
219
+ - Output folder creation (if save_mode)
220
+ - 00-context.md creation (if save_mode)
221
+ - State variable initialization
222
+
223
+ After initialization, step-00 loads step-01-analyze.md.
224
+
225
+ </entry_point>
226
+
227
+ <step_files>
228
+ **Progressive loading - only load current step:**
229
+
230
+ | Step | File | Purpose |
231
+ | ---- | ---------------------------- | ---------------------------------------------------- |
232
+ | 00 | `steps/step-00-init.md` | Parse flags, create output folder, initialize state |
233
+ | 01 | `steps/step-01-analyze.md` | Smart context gathering with 1-10 parallel agents based on complexity |
234
+ | 02 | `steps/step-02-plan.md` | File-by-file implementation strategy |
235
+ | 03 | `steps/step-03-execute.md` | Todo-driven implementation |
236
+ | 04 | `steps/step-04-validate.md` | Self-check and validation |
237
+ | 05 | `steps/step-05-examine.md` | Adversarial code review (optional) |
238
+ | 06 | `steps/step-06-resolve.md` | Finding resolution (optional) |
239
+ | 07 | `steps/step-07-tests.md` | Test analysis and creation (if --test) |
240
+ | 08 | `steps/step-08-run-tests.md` | Test runner loop until green (if --test) |
241
+ | 09 | `steps/step-09-finish.md` | Create pull request (if --pull-request) |
242
+
243
+ </step_files>
244
+
245
+ <execution_rules>
246
+
247
+ - **Load one step at a time** - Only load the current step file
248
+ - **ULTRA THINK** before major decisions
249
+ - **Persist state variables** across all steps
250
+ - **Follow next_step directive** at end of each step
251
+ - **Save outputs** if `{save_mode}` = true (append to step file)
252
+ - **Use parallel agents** for independent exploration tasks
253
+
254
+ ## 🧠 Smart Agent Strategy in Analyze Phase
255
+
256
+ The analyze phase (step-01) uses **adaptive agent launching** (unless economy_mode):
257
+
258
+ **Available agents:**
259
+ - `explore-codebase` - Find existing patterns, files, utilities
260
+ - `explore-docs` - Research library docs (use when unfamiliar with API)
261
+ - `websearch` - Find approaches, best practices, gotchas
262
+
263
+ **Launch 1-10 agents based on task complexity:**
264
+
265
+ | Complexity | Agents | When |
266
+ |------------|--------|------|
267
+ | Simple | 1-2 | Bug fix, small tweak |
268
+ | Medium | 2-4 | New feature in familiar stack |
269
+ | Complex | 4-7 | Unfamiliar libraries, integrations |
270
+ | Major | 6-10 | Multiple systems, many unknowns |
271
+
272
+ **BE SMART:** Analyze what you actually need before launching. Don't over-launch for simple tasks, don't under-launch for complex ones.
273
+
274
+ </execution_rules>
275
+
276
+ <save_output_pattern>
277
+ **When `{save_mode}` = true:**
278
+
279
+ Step-00 runs `scripts/setup-templates.sh` to initialize all output files from `templates/` directory.
280
+
281
+ **Each step then:**
282
+
283
+ 1. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "in_progress"`
284
+ 2. Append findings/outputs to the pre-created step file
285
+ 3. Run `scripts/update-progress.sh {task_id} {step_num} {step_name} "complete"`
286
+
287
+ **Template system benefits:**
288
+
289
+ - Reduces token usage by ~75% (1,350 tokens saved per workflow)
290
+ - Templates in `templates/` directory (not inline in steps)
291
+ - Scripts handle progress tracking automatically
292
+ - See `templates/README.md` for details
293
+
294
+ </save_output_pattern>
295
+
296
+ <success_criteria>
297
+
298
+ - Each step loaded progressively
299
+ - All validation checks passing
300
+ - Outputs saved if `{save_mode}` enabled
301
+ - Tests passing if `{test_mode}` enabled
302
+ - Clear completion summary provided
303
+ </success_criteria>
@@ -0,0 +1,134 @@
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
+ EXAMINE_MODE="${4:-false}"
15
+ SAVE_MODE="${5:-false}"
16
+ TEST_MODE="${6:-false}"
17
+ ECONOMY_MODE="${7:-false}"
18
+ BRANCH_MODE="${8:-false}"
19
+ PR_MODE="${9:-false}"
20
+ INTERACTIVE_MODE="${10:-false}"
21
+ BRANCH_NAME="${11:-}"
22
+ ORIGINAL_INPUT="${12:-}"
23
+
24
+ # Validate required arguments
25
+ if [[ -z "$FEATURE_NAME" ]]; then
26
+ echo "Error: FEATURE_NAME is required"
27
+ exit 1
28
+ fi
29
+
30
+ if [[ -z "$TASK_DESCRIPTION" ]]; then
31
+ echo "Error: TASK_DESCRIPTION is required"
32
+ exit 1
33
+ fi
34
+
35
+ # Get current timestamp
36
+ TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
37
+
38
+ # Use current working directory as project root
39
+ PROJECT_ROOT=$(pwd)
40
+ APEX_OUTPUT_DIR="${PROJECT_ROOT}/.claude/output/apex"
41
+
42
+ # Create apex output directory if it doesn't exist
43
+ mkdir -p "$APEX_OUTPUT_DIR"
44
+
45
+ # Find the next available number
46
+ NEXT_NUM=1
47
+ if [[ -d "$APEX_OUTPUT_DIR" ]]; then
48
+ # Find highest existing number prefix
49
+ HIGHEST=$(ls -1 "$APEX_OUTPUT_DIR" 2>/dev/null | grep -oE '^[0-9]+' | sort -n | tail -1)
50
+ if [[ -n "$HIGHEST" ]]; then
51
+ # Force base-10 interpretation (leading zeros would be treated as octal)
52
+ NEXT_NUM=$((10#$HIGHEST + 1))
53
+ fi
54
+ fi
55
+
56
+ # Format with leading zeros (2 digits)
57
+ TASK_NUM=$(printf "%02d" "$NEXT_NUM")
58
+
59
+ # Build full task ID
60
+ TASK_ID="${TASK_NUM}-${FEATURE_NAME}"
61
+
62
+ OUTPUT_DIR="${APEX_OUTPUT_DIR}/${TASK_ID}"
63
+
64
+ # Get skill directory
65
+ SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
66
+ TEMPLATE_DIR="${SKILL_DIR}/templates"
67
+
68
+ # Create output directory
69
+ mkdir -p "$OUTPUT_DIR"
70
+
71
+ # Function to replace template variables
72
+ render_template() {
73
+ local template_file="$1"
74
+ local output_file="$2"
75
+
76
+ # Determine status strings based on flags
77
+ local examine_status="⏭ Skip"
78
+ [[ "$EXAMINE_MODE" == "true" ]] && examine_status="⏸ Pending"
79
+
80
+ local test_status="⏭ Skip"
81
+ [[ "$TEST_MODE" == "true" ]] && test_status="⏸ Pending"
82
+
83
+ local pr_status="⏭ Skip"
84
+ [[ "$PR_MODE" == "true" ]] && pr_status="⏸ Pending"
85
+
86
+ # Read template and replace variables
87
+ sed -e "s|{{task_id}}|${TASK_ID}|g" \
88
+ -e "s|{{task_description}}|${TASK_DESCRIPTION}|g" \
89
+ -e "s|{{timestamp}}|${TIMESTAMP}|g" \
90
+ -e "s|{{auto_mode}}|${AUTO_MODE}|g" \
91
+ -e "s|{{examine_mode}}|${EXAMINE_MODE}|g" \
92
+ -e "s|{{save_mode}}|${SAVE_MODE}|g" \
93
+ -e "s|{{test_mode}}|${TEST_MODE}|g" \
94
+ -e "s|{{economy_mode}}|${ECONOMY_MODE}|g" \
95
+ -e "s|{{branch_mode}}|${BRANCH_MODE}|g" \
96
+ -e "s|{{pr_mode}}|${PR_MODE}|g" \
97
+ -e "s|{{interactive_mode}}|${INTERACTIVE_MODE}|g" \
98
+ -e "s|{{branch_name}}|${BRANCH_NAME}|g" \
99
+ -e "s|{{original_input}}|${ORIGINAL_INPUT}|g" \
100
+ -e "s|{{examine_status}}|${examine_status}|g" \
101
+ -e "s|{{test_status}}|${test_status}|g" \
102
+ -e "s|{{pr_status}}|${pr_status}|g" \
103
+ "$template_file" > "$output_file"
104
+ }
105
+
106
+ # Initialize 00-context.md
107
+ render_template "${TEMPLATE_DIR}/00-context.md" "${OUTPUT_DIR}/00-context.md"
108
+
109
+ # Initialize other step files (only headers, content appended during execution)
110
+ render_template "${TEMPLATE_DIR}/01-analyze.md" "${OUTPUT_DIR}/01-analyze.md"
111
+ render_template "${TEMPLATE_DIR}/02-plan.md" "${OUTPUT_DIR}/02-plan.md"
112
+ render_template "${TEMPLATE_DIR}/03-execute.md" "${OUTPUT_DIR}/03-execute.md"
113
+ render_template "${TEMPLATE_DIR}/04-validate.md" "${OUTPUT_DIR}/04-validate.md"
114
+
115
+ # Conditional templates
116
+ if [[ "$EXAMINE_MODE" == "true" ]]; then
117
+ render_template "${TEMPLATE_DIR}/05-examine.md" "${OUTPUT_DIR}/05-examine.md"
118
+ render_template "${TEMPLATE_DIR}/06-resolve.md" "${OUTPUT_DIR}/06-resolve.md"
119
+ fi
120
+
121
+ if [[ "$TEST_MODE" == "true" ]]; then
122
+ render_template "${TEMPLATE_DIR}/07-tests.md" "${OUTPUT_DIR}/07-tests.md"
123
+ render_template "${TEMPLATE_DIR}/08-run-tests.md" "${OUTPUT_DIR}/08-run-tests.md"
124
+ fi
125
+
126
+ if [[ "$PR_MODE" == "true" ]]; then
127
+ render_template "${TEMPLATE_DIR}/09-finish.md" "${OUTPUT_DIR}/09-finish.md"
128
+ fi
129
+
130
+ # Output the generated task_id for capture by caller
131
+ echo "TASK_ID=${TASK_ID}"
132
+ echo "OUTPUT_DIR=${OUTPUT_DIR}"
133
+ echo "✓ APEX templates initialized: ${OUTPUT_DIR}"
134
+ 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