agile-context-engineering 0.3.0 → 0.5.1
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-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +10 -0
- package/CHANGELOG.md +7 -1
- package/LICENSE +51 -51
- package/README.md +330 -318
- package/agents/ace-code-discovery-analyst.md +245 -245
- package/agents/ace-code-integration-analyst.md +248 -248
- package/agents/ace-code-reviewer.md +375 -375
- package/agents/ace-product-owner.md +365 -361
- package/agents/ace-project-researcher.md +606 -606
- package/agents/ace-research-synthesizer.md +228 -228
- package/agents/ace-technical-application-architect.md +315 -315
- package/agents/ace-wiki-mapper.md +449 -445
- package/bin/install.js +605 -195
- package/hooks/ace-check-update.js +71 -62
- package/hooks/ace-statusline.js +107 -89
- package/hooks/hooks.json +14 -0
- package/package.json +7 -5
- package/shared/lib/ace-core.js +361 -0
- package/shared/lib/ace-core.test.js +308 -0
- package/shared/lib/ace-github.js +753 -0
- package/shared/lib/ace-story.js +400 -0
- package/shared/lib/ace-story.test.js +250 -0
- package/{agile-context-engineering → shared}/utils/questioning.xml +110 -110
- package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
- package/{commands/ace/execute-story.md → skills/execute-story/SKILL.md} +116 -138
- package/skills/execute-story/script.js +291 -0
- package/skills/execute-story/script.test.js +261 -0
- package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +451 -451
- package/skills/execute-story/walkthrough-template.xml +255 -0
- package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +1221 -1219
- package/skills/help/SKILL.md +71 -0
- package/skills/help/script.js +315 -0
- package/skills/help/script.test.js +183 -0
- package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +544 -533
- package/{commands/ace/init-coding-standards.md → skills/init-coding-standards/SKILL.md} +91 -83
- package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +531 -531
- package/skills/init-coding-standards/script.js +50 -0
- package/skills/init-coding-standards/script.test.js +70 -0
- package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +381 -386
- package/skills/map-cross-cutting/SKILL.md +126 -0
- package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +197 -197
- package/skills/map-cross-cutting/workflow.xml +330 -0
- package/skills/map-guide/SKILL.md +126 -0
- package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +137 -137
- package/skills/map-guide/workflow.xml +320 -0
- package/skills/map-pattern/SKILL.md +125 -0
- package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +159 -159
- package/skills/map-pattern/workflow.xml +331 -0
- package/{commands/ace/map-story.md → skills/map-story/SKILL.md} +180 -165
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +115 -115
- package/skills/map-story/templates/guide.xml +137 -0
- package/skills/map-story/templates/pattern.xml +159 -0
- package/skills/map-story/templates/system-cross-cutting.xml +197 -0
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +381 -381
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +125 -125
- package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/walkthrough.xml +255 -255
- package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +1046 -1046
- package/{commands/ace/map-subsystem.md → skills/map-subsystem/SKILL.md} +155 -140
- package/skills/map-subsystem/script.js +51 -0
- package/skills/map-subsystem/script.test.js +68 -0
- package/skills/map-subsystem/templates/decizions.xml +115 -0
- package/skills/map-subsystem/templates/guide.xml +137 -0
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +174 -174
- package/skills/map-subsystem/templates/pattern.xml +159 -0
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +343 -343
- package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +234 -234
- package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
- package/skills/map-subsystem/templates/system.xml +381 -0
- package/skills/map-subsystem/templates/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +1173 -1178
- package/skills/map-sys-doc/SKILL.md +125 -0
- package/skills/map-sys-doc/system.xml +381 -0
- package/skills/map-sys-doc/workflow.xml +336 -0
- package/{commands/ace/map-system.md → skills/map-system/SKILL.md} +103 -92
- package/skills/map-system/script.js +75 -0
- package/skills/map-system/script.test.js +73 -0
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +254 -254
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +177 -177
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +283 -283
- package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/wiki-readme.xml +296 -296
- package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +667 -672
- package/{commands/ace/map-walkthrough.md → skills/map-walkthrough/SKILL.md} +140 -127
- package/skills/map-walkthrough/walkthrough.xml +255 -0
- package/{agile-context-engineering/workflows/map-walkthrough.xml → skills/map-walkthrough/workflow.xml} +457 -457
- package/{commands/ace/plan-backlog.md → skills/plan-backlog/SKILL.md} +93 -83
- package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +231 -231
- package/skills/plan-backlog/script.js +121 -0
- package/skills/plan-backlog/script.test.js +83 -0
- package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +1348 -1356
- package/{commands/ace/plan-feature.md → skills/plan-feature/SKILL.md} +99 -89
- package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +361 -361
- package/skills/plan-feature/script.js +131 -0
- package/skills/plan-feature/script.test.js +80 -0
- package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +1487 -1495
- package/{commands/ace/plan-product-vision.md → skills/plan-product-vision/SKILL.md} +91 -81
- package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +227 -227
- package/skills/plan-product-vision/script.js +51 -0
- package/skills/plan-product-vision/script.test.js +69 -0
- package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +337 -342
- package/{commands/ace/plan-story.md → skills/plan-story/SKILL.md} +139 -159
- package/skills/plan-story/script.js +295 -0
- package/skills/plan-story/script.test.js +240 -0
- package/skills/plan-story/story-template.xml +458 -0
- package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1301 -944
- package/{commands/ace/research-external-solution.md → skills/research-external-solution/SKILL.md} +120 -138
- package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +832 -832
- package/skills/research-external-solution/script.js +229 -0
- package/skills/research-external-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +657 -659
- package/{commands/ace/research-integration-solution.md → skills/research-integration-solution/SKILL.md} +121 -135
- package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1015 -1015
- package/skills/research-integration-solution/script.js +223 -0
- package/skills/research-integration-solution/script.test.js +134 -0
- package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +711 -713
- package/{commands/ace/research-story-wiki.md → skills/research-story-wiki/SKILL.md} +101 -116
- package/skills/research-story-wiki/script.js +223 -0
- package/skills/research-story-wiki/script.test.js +138 -0
- package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +194 -194
- package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +473 -475
- package/{commands/ace/research-technical-solution.md → skills/research-technical-solution/SKILL.md} +131 -147
- package/skills/research-technical-solution/script.js +223 -0
- package/skills/research-technical-solution/script.test.js +134 -0
- package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +1025 -1025
- package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +761 -763
- package/{commands/ace/review-story.md → skills/review-story/SKILL.md} +99 -109
- package/skills/review-story/script.js +249 -0
- package/skills/review-story/script.test.js +169 -0
- package/skills/review-story/story-template.xml +451 -0
- package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +279 -281
- package/{commands/ace/update.md → skills/update/SKILL.md} +65 -56
- package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +33 -18
- package/agile-context-engineering/src/ace-tools.js +0 -2881
- package/agile-context-engineering/src/ace-tools.test.js +0 -1089
- package/agile-context-engineering/templates/_command.md +0 -54
- package/agile-context-engineering/templates/_workflow.xml +0 -17
- package/agile-context-engineering/templates/config.json +0 -0
- package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
- package/commands/ace/help.md +0 -93
|
@@ -1,138 +1,116 @@
|
|
|
1
|
-
---
|
|
2
|
-
name:
|
|
3
|
-
description: Execute a fully-planned story
|
|
4
|
-
argument-hint: "story=<file-path|github-url> [--agent-teams-off]"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
story=https://github.com/owner/repo/issues/95
|
|
118
|
-
|
|
119
|
-
# Force solo mode (no agent teams)
|
|
120
|
-
/ace:execute-story \
|
|
121
|
-
story=.ace/artifacts/product/e1-auth/f3-oauth/s1-buttons/s1-buttons.md \
|
|
122
|
-
--agent-teams-off
|
|
123
|
-
|
|
124
|
-
# With just an issue number
|
|
125
|
-
/ace:execute-story story=#95
|
|
126
|
-
```
|
|
127
|
-
</example-usage>
|
|
128
|
-
|
|
129
|
-
<next-steps>
|
|
130
|
-
**After this command:**
|
|
131
|
-
- `/ace:execute-story story=...` — Execute the next story in the feature
|
|
132
|
-
- `/ace:review-story story=...` — Re-run code review (standalone)
|
|
133
|
-
- `/ace:plan-story story=...` — Plan the next story
|
|
134
|
-
- `/ace:help` — Check project status
|
|
135
|
-
</next-steps>
|
|
136
|
-
|
|
137
|
-
</command>
|
|
138
|
-
```
|
|
1
|
+
---
|
|
2
|
+
name: execute-story
|
|
3
|
+
description: Execute a fully-planned story -- loads AC + Technical Solution, creates execution plan via Plan Mode, implements (solo or agent teams), runs code review, updates state, and triggers wiki mapping
|
|
4
|
+
argument-hint: "story=<file-path|github-url> [--agent-teams-off]"
|
|
5
|
+
disable-model-invocation: true
|
|
6
|
+
allowed-tools: Read, Bash, Write, Edit, AskUserQuestion, Glob, Grep, Agent, EnterPlanMode, ExitPlanMode
|
|
7
|
+
model: opus
|
|
8
|
+
effort: max
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Environment Context (preprocessed)
|
|
12
|
+
|
|
13
|
+
!`node "${CLAUDE_SKILL_DIR}/script.js" init "$ARGUMENTS" 2>/dev/null`
|
|
14
|
+
|
|
15
|
+
## Supporting Resources (auto-loaded)
|
|
16
|
+
|
|
17
|
+
!`cat "${CLAUDE_SKILL_DIR}/workflow.xml"`
|
|
18
|
+
|
|
19
|
+
!`cat "${CLAUDE_SKILL_DIR}/story-template.xml"`
|
|
20
|
+
|
|
21
|
+
!`cat "${CLAUDE_SKILL_DIR}/walkthrough-template.xml"`
|
|
22
|
+
|
|
23
|
+
!`cat "${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml"`
|
|
24
|
+
|
|
25
|
+
!`cat "${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md"`
|
|
26
|
+
|
|
27
|
+
```xml
|
|
28
|
+
<command>
|
|
29
|
+
|
|
30
|
+
<execution-time>
|
|
31
|
+
<runs-after>
|
|
32
|
+
<trigger>After /ace:plan-story — once a story has AC + Technical Solution</trigger>
|
|
33
|
+
<trigger>Anytime — to execute a fully-planned story specification</trigger>
|
|
34
|
+
</runs-after>
|
|
35
|
+
<use-when>
|
|
36
|
+
<condition>A story has both Acceptance Criteria AND Technical Solution sections</condition>
|
|
37
|
+
<condition>Story status is "Refined" (ready for implementation)</condition>
|
|
38
|
+
</use-when>
|
|
39
|
+
</execution-time>
|
|
40
|
+
|
|
41
|
+
<input>
|
|
42
|
+
<flags>
|
|
43
|
+
<flag name="--agent-teams-off">
|
|
44
|
+
Force solo execution mode regardless of agent_teams setting.
|
|
45
|
+
Overrides the agent_teams flag in settings.json.
|
|
46
|
+
Use when you want single-context execution even if teams are enabled.
|
|
47
|
+
</flag>
|
|
48
|
+
</flags>
|
|
49
|
+
|
|
50
|
+
<parameters>
|
|
51
|
+
<required>
|
|
52
|
+
<param name="story" type="file | github-url">
|
|
53
|
+
Story source — can be either:
|
|
54
|
+
- **File path**: Path to a fully-planned story markdown file
|
|
55
|
+
(must have AC + Technical Solution sections)
|
|
56
|
+
- **GitHub URL or issue number**: GitHub story reference
|
|
57
|
+
Must be a valid, accessible file or GitHub issue.
|
|
58
|
+
The story MUST have been through /ace:plan-story (has AC + Technical Solution).
|
|
59
|
+
</param>
|
|
60
|
+
</required>
|
|
61
|
+
</parameters>
|
|
62
|
+
</input>
|
|
63
|
+
|
|
64
|
+
<execution-context>
|
|
65
|
+
<!-- All supporting files are auto-loaded in the Supporting Resources section above.
|
|
66
|
+
The model does NOT need to Read these files — they are already in context. -->
|
|
67
|
+
</execution-context>
|
|
68
|
+
|
|
69
|
+
<output>
|
|
70
|
+
<objective>
|
|
71
|
+
Take a fully-planned story (with AC + Technical Solution) and:
|
|
72
|
+
1. Create an execution plan via Claude Code Plan Mode
|
|
73
|
+
2. Execute the plan — solo or with Agent Teams
|
|
74
|
+
3. Run code review (3-level verification, anti-pattern detection, coding standards)
|
|
75
|
+
4. Present results to user for verification/approval
|
|
76
|
+
5. Commit implementation (single commit after approval)
|
|
77
|
+
6. Update state: story file, feature file, product backlog, GitHub
|
|
78
|
+
7. Trigger wiki mapping (background) with tech debt integration
|
|
79
|
+
|
|
80
|
+
Two execution modes:
|
|
81
|
+
- **Solo Mode** (default or --agent-teams-off): Single context, plan mode → execute
|
|
82
|
+
- **Agent Teams Mode** (when enabled + plan recommends): Lead + teammates for parallel work
|
|
83
|
+
</objective>
|
|
84
|
+
|
|
85
|
+
<artifacts>
|
|
86
|
+
Story file updated with Summary & State section and Wiki Updates section.
|
|
87
|
+
Feature file updated with story status.
|
|
88
|
+
Product backlog updated with story (and possibly feature) status.
|
|
89
|
+
Wiki documents updated/created based on implementation changes.
|
|
90
|
+
</artifacts>
|
|
91
|
+
</output>
|
|
92
|
+
|
|
93
|
+
<process>
|
|
94
|
+
**STRICT WORKFLOW EXECUTION — Follow the execute-story workflow STEP BY STEP.
|
|
95
|
+
Do NOT skip steps. Do NOT improvise. Do NOT start reading code or planning
|
|
96
|
+
until step 1 (init & validate) is fully complete with the init command output parsed.**
|
|
97
|
+
|
|
98
|
+
Execute the execute-story workflow from
|
|
99
|
+
`workflow.xml` end-to-end.
|
|
100
|
+
|
|
101
|
+
**MANDATORY FIRST ACTION: Run the init command (step 1.2) BEFORE doing anything else.
|
|
102
|
+
Do NOT read the story file manually. Do NOT explore the codebase. Do NOT start planning.
|
|
103
|
+
The init command validates the story and provides all paths and context needed.**
|
|
104
|
+
|
|
105
|
+
**CRITICAL REQUIREMENTS:**
|
|
106
|
+
- Story MUST have Acceptance Criteria — STOP if missing
|
|
107
|
+
- Story MUST have Technical Solution — STOP if missing
|
|
108
|
+
- NO intermediary commits during implementation
|
|
109
|
+
- ONE single commit per story after user approval (code + state + docs)
|
|
110
|
+
- Code review is MANDATORY — blockers must be fixed before approval
|
|
111
|
+
- Coding standards violations are BLOCKERS, not warnings
|
|
112
|
+
- Dead code and backwards-compatible shims must be DELETED
|
|
113
|
+
</process>
|
|
114
|
+
|
|
115
|
+
<example-usage>
|
|
116
|
+
```
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* execute-story skill script — Entry point for all ace-tools operations
|
|
5
|
+
* needed by the execute-story skill.
|
|
6
|
+
*
|
|
7
|
+
* Subcommands:
|
|
8
|
+
* init [story-param] Environment detection for execute-story workflow
|
|
9
|
+
* update-state story=X status=Y Update story status across files
|
|
10
|
+
* sync-github repo=X story_file=Y Sync story/feature to GitHub
|
|
11
|
+
* resolve-model <agent-type> Get model for agent based on profile
|
|
12
|
+
*
|
|
13
|
+
* Usage: node script.js <subcommand> [args] [--raw]
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const fs = require('fs');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
const {
|
|
20
|
+
loadConfig, pathExists, safeReadFile, resolveModel,
|
|
21
|
+
loadSettings, execCommand, output, error, runSkillScript,
|
|
22
|
+
} = require('../../shared/lib/ace-core');
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
classifyStoryParam, extractStoryMetadata, extractStoryRequirements,
|
|
26
|
+
extractMarkdownSection, extractIssueNumber, extractIssueNumberFromFile,
|
|
27
|
+
computeStoryPaths, updateState,
|
|
28
|
+
} = require('../../shared/lib/ace-story');
|
|
29
|
+
|
|
30
|
+
const { syncStory } = require('../../shared/lib/ace-github');
|
|
31
|
+
|
|
32
|
+
// ─── Runtime Config Dir ─────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Detect the runtime config directory name.
|
|
36
|
+
* In the plugin context, the script lives at:
|
|
37
|
+
* <base>/<config-dir>/skills/execute-story/script.js
|
|
38
|
+
* Default to '.claude' for backwards compatibility.
|
|
39
|
+
*/
|
|
40
|
+
function getRuntimeConfigDirName() {
|
|
41
|
+
try {
|
|
42
|
+
const skillDir = __dirname; // <base>/<config-dir>/skills/execute-story
|
|
43
|
+
const skillsDir = path.dirname(skillDir); // <base>/<config-dir>/skills
|
|
44
|
+
const configDir = path.dirname(skillsDir); // <base>/<config-dir>
|
|
45
|
+
const dirName = path.basename(configDir);
|
|
46
|
+
if (dirName === '.opencode' || dirName === '.codex' || dirName === '.claude') {
|
|
47
|
+
return dirName;
|
|
48
|
+
}
|
|
49
|
+
} catch {}
|
|
50
|
+
return '.claude';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const RUNTIME_CONFIG_DIR = getRuntimeConfigDirName();
|
|
54
|
+
|
|
55
|
+
// ─── CLI Dispatch ────────────────────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
runSkillScript({
|
|
58
|
+
init: cmdInit,
|
|
59
|
+
'update-state': (cwd, raw, args) => updateState(cwd, raw, args),
|
|
60
|
+
'sync-github': (cwd, raw, args) => syncStory(cwd, raw, args),
|
|
61
|
+
'resolve-model': (cwd, raw, args, parsed) => {
|
|
62
|
+
const agentType = parsed._positional || args[0];
|
|
63
|
+
if (!agentType) error('resolve-model requires agent-type argument');
|
|
64
|
+
const model = resolveModel(cwd, agentType);
|
|
65
|
+
output({ model, agent: agentType }, raw, model);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// ─── Init: Execute Story ────────────────────────────────────────────────────
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Environment detection for the execute-story workflow.
|
|
73
|
+
*
|
|
74
|
+
* Detects: git, gh CLI, GitHub project, agent teams, story source/content/metadata,
|
|
75
|
+
* acceptance criteria, technical solution, wiki refs, coding standards, computed paths.
|
|
76
|
+
*/
|
|
77
|
+
function cmdInit(cwd, raw, args, parsed) {
|
|
78
|
+
const config = loadConfig(cwd);
|
|
79
|
+
|
|
80
|
+
// ── Environment detection ──
|
|
81
|
+
const has_git = pathExists(cwd, '.git');
|
|
82
|
+
const has_gh_cli = (() => {
|
|
83
|
+
try {
|
|
84
|
+
const { execSync } = require('child_process');
|
|
85
|
+
execSync('gh --version', { stdio: 'pipe' });
|
|
86
|
+
return true;
|
|
87
|
+
} catch { return false; }
|
|
88
|
+
})();
|
|
89
|
+
const settings = loadSettings(cwd);
|
|
90
|
+
const github_project = settings.github_project;
|
|
91
|
+
|
|
92
|
+
// ── Agent teams detection (sync from runtime settings) ──
|
|
93
|
+
const claudeSettingsPath = path.join(cwd, RUNTIME_CONFIG_DIR, 'settings.json');
|
|
94
|
+
let agent_teams = settings.agent_teams || false;
|
|
95
|
+
try {
|
|
96
|
+
const claudeRaw = fs.readFileSync(claudeSettingsPath, 'utf-8');
|
|
97
|
+
const claudeSettings = JSON.parse(claudeRaw);
|
|
98
|
+
const val = claudeSettings?.env?.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
|
|
99
|
+
agent_teams = val === '1' || val === 'true';
|
|
100
|
+
} catch {}
|
|
101
|
+
|
|
102
|
+
// ── Parse story param ──
|
|
103
|
+
const storyParam = parsed.story || parsed._positional || null;
|
|
104
|
+
|
|
105
|
+
// ── Classify the story parameter ──
|
|
106
|
+
const classified = classifyStoryParam(storyParam);
|
|
107
|
+
|
|
108
|
+
// Early exit if invalid
|
|
109
|
+
if (classified.type === null || classified.type === 'invalid') {
|
|
110
|
+
output({
|
|
111
|
+
executor_model: resolveModel(cwd, 'ace-executor'),
|
|
112
|
+
reviewer_model: resolveModel(cwd, 'ace-code-reviewer'),
|
|
113
|
+
commit_docs: config.commit_docs,
|
|
114
|
+
has_git, has_gh_cli, github_project, agent_teams,
|
|
115
|
+
story_source: null,
|
|
116
|
+
story_valid: false,
|
|
117
|
+
story_error: classified.reason || 'No story parameter provided',
|
|
118
|
+
story_content: null,
|
|
119
|
+
story: { id: null, title: null, status: null, size: null },
|
|
120
|
+
feature: { id: null, title: null },
|
|
121
|
+
epic: { id: null, title: null },
|
|
122
|
+
has_acceptance_criteria: false,
|
|
123
|
+
acceptance_criteria_count: 0,
|
|
124
|
+
has_technical_solution: false,
|
|
125
|
+
has_wiki_refs: false,
|
|
126
|
+
has_coding_standards: false,
|
|
127
|
+
paths: null,
|
|
128
|
+
}, raw);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ── Load story content ──
|
|
133
|
+
let storyContent = null;
|
|
134
|
+
let storySource = classified.type === 'file' ? 'file' : 'github';
|
|
135
|
+
let storyError = null;
|
|
136
|
+
let storyFilePath = null;
|
|
137
|
+
|
|
138
|
+
if (classified.type === 'file') {
|
|
139
|
+
const resolvedPath = path.isAbsolute(classified.filePath)
|
|
140
|
+
? classified.filePath
|
|
141
|
+
: path.join(cwd, classified.filePath);
|
|
142
|
+
if (!pathExists(cwd, classified.filePath)) {
|
|
143
|
+
storyError = `Story file not found: ${classified.filePath}`;
|
|
144
|
+
} else {
|
|
145
|
+
storyContent = safeReadFile(resolvedPath);
|
|
146
|
+
storyFilePath = classified.filePath;
|
|
147
|
+
if (!storyContent) storyError = `Could not read story file: ${classified.filePath}`;
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
// github-url or issue-number
|
|
151
|
+
if (!has_gh_cli) {
|
|
152
|
+
storyError = 'GitHub CLI (gh) not installed. Cannot fetch GitHub issues.';
|
|
153
|
+
} else {
|
|
154
|
+
const repo = classified.repo || (github_project.repo || null);
|
|
155
|
+
if (!repo) {
|
|
156
|
+
storyError = 'No repository configured. Provide a full GitHub URL or configure github_project.repo in settings.';
|
|
157
|
+
} else {
|
|
158
|
+
const ghResult = execCommand(
|
|
159
|
+
`gh issue view ${classified.issueNumber} --repo ${repo} --json title,body,labels,state`,
|
|
160
|
+
cwd
|
|
161
|
+
);
|
|
162
|
+
if (!ghResult) {
|
|
163
|
+
storyError = `Could not fetch GitHub issue #${classified.issueNumber} from ${repo}.`;
|
|
164
|
+
} else {
|
|
165
|
+
try {
|
|
166
|
+
const issue = JSON.parse(ghResult);
|
|
167
|
+
storyContent = issue.body || '';
|
|
168
|
+
if (storyContent && !storyContent.match(/^#\s+/m)) {
|
|
169
|
+
storyContent = `# ${issue.title}\n\n${storyContent}`;
|
|
170
|
+
}
|
|
171
|
+
} catch {
|
|
172
|
+
storyError = `Failed to parse GitHub issue response for #${classified.issueNumber}.`;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// ── Extract metadata & requirements ──
|
|
180
|
+
const metadata = extractStoryMetadata(storyContent);
|
|
181
|
+
const requirements = extractStoryRequirements(storyContent);
|
|
182
|
+
|
|
183
|
+
// ── Detect key sections ──
|
|
184
|
+
const has_acceptance_criteria = requirements.acceptance_criteria_count > 0;
|
|
185
|
+
const has_technical_solution = storyContent
|
|
186
|
+
? !!extractMarkdownSection(storyContent, 'Technical Solution', 2)
|
|
187
|
+
: false;
|
|
188
|
+
const has_wiki_refs = storyContent
|
|
189
|
+
? !!extractMarkdownSection(storyContent, 'Relevant Wiki', 2)
|
|
190
|
+
: false;
|
|
191
|
+
const has_coding_standards = pathExists(cwd, '.docs/wiki/system-wide/coding-standards.md');
|
|
192
|
+
|
|
193
|
+
// ── Compute paths ──
|
|
194
|
+
let paths = null;
|
|
195
|
+
let has_story_file = false;
|
|
196
|
+
|
|
197
|
+
if (storyFilePath) {
|
|
198
|
+
const resolvedPath = path.isAbsolute(storyFilePath)
|
|
199
|
+
? storyFilePath
|
|
200
|
+
: path.join(cwd, storyFilePath);
|
|
201
|
+
const storyDir = path.dirname(resolvedPath);
|
|
202
|
+
const relStoryDir = path.relative(cwd, storyDir).replace(/\\/g, '/');
|
|
203
|
+
const storySlug = path.basename(storyDir);
|
|
204
|
+
const featureDir = path.dirname(storyDir);
|
|
205
|
+
const relFeatureDir = path.relative(cwd, featureDir).replace(/\\/g, '/');
|
|
206
|
+
const featureSlug = path.basename(featureDir);
|
|
207
|
+
|
|
208
|
+
paths = {
|
|
209
|
+
epic_slug: null,
|
|
210
|
+
feature_slug: featureSlug,
|
|
211
|
+
story_slug: storySlug,
|
|
212
|
+
story_dir: relStoryDir,
|
|
213
|
+
story_file: storyFilePath.replace(/\\/g, '/'),
|
|
214
|
+
external_analysis_file: `${relStoryDir}/external-analysis.md`,
|
|
215
|
+
integration_analysis_file: `${relStoryDir}/integration-analysis.md`,
|
|
216
|
+
feature_dir: relFeatureDir,
|
|
217
|
+
feature_file: `${relFeatureDir}/${featureSlug}.md`,
|
|
218
|
+
product_backlog: '.ace/artifacts/product/product-backlog.md',
|
|
219
|
+
coding_standards: '.docs/wiki/system-wide/coding-standards.md',
|
|
220
|
+
};
|
|
221
|
+
has_story_file = true;
|
|
222
|
+
} else if (metadata.epic.id && metadata.feature.id && metadata.id) {
|
|
223
|
+
const computed = computeStoryPaths(
|
|
224
|
+
metadata.epic.id, metadata.epic.title || '',
|
|
225
|
+
metadata.feature.id, metadata.feature.title || '',
|
|
226
|
+
metadata.id, metadata.title || ''
|
|
227
|
+
);
|
|
228
|
+
if (computed) {
|
|
229
|
+
paths = {
|
|
230
|
+
...computed,
|
|
231
|
+
product_backlog: '.ace/artifacts/product/product-backlog.md',
|
|
232
|
+
coding_standards: '.docs/wiki/system-wide/coding-standards.md',
|
|
233
|
+
};
|
|
234
|
+
has_story_file = pathExists(cwd, paths.story_file);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// ── Extract GitHub issue numbers ──
|
|
239
|
+
const storyIssueNumber = extractIssueNumber(metadata.link);
|
|
240
|
+
const featureIssueNumber = paths ? extractIssueNumberFromFile(cwd, paths.feature_file) : null;
|
|
241
|
+
|
|
242
|
+
// ── Build result ──
|
|
243
|
+
const result = {
|
|
244
|
+
// Models
|
|
245
|
+
executor_model: resolveModel(cwd, 'ace-executor'),
|
|
246
|
+
reviewer_model: resolveModel(cwd, 'ace-code-reviewer'),
|
|
247
|
+
|
|
248
|
+
// Config
|
|
249
|
+
commit_docs: config.commit_docs,
|
|
250
|
+
|
|
251
|
+
// Environment
|
|
252
|
+
has_git, has_gh_cli, github_project, agent_teams,
|
|
253
|
+
|
|
254
|
+
// Story source
|
|
255
|
+
story_source: storySource,
|
|
256
|
+
story_valid: storyContent !== null && storyError === null,
|
|
257
|
+
story_error: storyError,
|
|
258
|
+
|
|
259
|
+
// Raw story content
|
|
260
|
+
story_content: storyContent,
|
|
261
|
+
|
|
262
|
+
// Story metadata
|
|
263
|
+
story: {
|
|
264
|
+
id: metadata.id,
|
|
265
|
+
title: metadata.title,
|
|
266
|
+
status: metadata.status,
|
|
267
|
+
size: metadata.size,
|
|
268
|
+
issue_number: storyIssueNumber,
|
|
269
|
+
},
|
|
270
|
+
feature: {
|
|
271
|
+
...metadata.feature,
|
|
272
|
+
issue_number: featureIssueNumber,
|
|
273
|
+
},
|
|
274
|
+
epic: metadata.epic,
|
|
275
|
+
|
|
276
|
+
// Section detection
|
|
277
|
+
has_acceptance_criteria,
|
|
278
|
+
acceptance_criteria_count: requirements.acceptance_criteria_count,
|
|
279
|
+
has_technical_solution,
|
|
280
|
+
has_wiki_refs,
|
|
281
|
+
has_coding_standards,
|
|
282
|
+
|
|
283
|
+
// Computed paths
|
|
284
|
+
paths,
|
|
285
|
+
|
|
286
|
+
// Artifact existence
|
|
287
|
+
has_story_file,
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
output(result, raw);
|
|
291
|
+
}
|