agile-context-engineering 0.2.2 → 0.5.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.
Files changed (146) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/CHANGELOG.md +82 -0
  3. package/README.md +27 -18
  4. package/agents/ace-product-owner.md +1 -1
  5. package/agents/ace-technical-application-architect.md +28 -0
  6. package/agents/ace-wiki-mapper.md +144 -29
  7. package/bin/install.js +67 -63
  8. package/hooks/ace-check-update.js +17 -9
  9. package/package.json +7 -5
  10. package/shared/lib/ace-core.js +308 -0
  11. package/shared/lib/ace-core.test.js +308 -0
  12. package/shared/lib/ace-github.js +753 -0
  13. package/shared/lib/ace-story.js +400 -0
  14. package/shared/lib/ace-story.test.js +250 -0
  15. package/{agile-context-engineering → shared}/utils/ui-formatting.md +299 -299
  16. package/skills/execute-story/SKILL.md +110 -0
  17. package/skills/execute-story/script.js +305 -0
  18. package/skills/execute-story/script.test.js +261 -0
  19. package/skills/execute-story/walkthrough-template.xml +255 -0
  20. package/{agile-context-engineering/workflows/execute-story.xml → skills/execute-story/workflow.xml} +83 -9
  21. package/skills/help/SKILL.md +69 -0
  22. package/skills/help/script.js +318 -0
  23. package/skills/help/script.test.js +183 -0
  24. package/{agile-context-engineering/workflows/help.xml → skills/help/workflow.xml} +8 -8
  25. package/skills/init-coding-standards/SKILL.md +72 -0
  26. package/{agile-context-engineering/templates/wiki/coding-standards.xml → skills/init-coding-standards/coding-standards-template.xml} +38 -0
  27. package/skills/init-coding-standards/script.js +59 -0
  28. package/skills/init-coding-standards/script.test.js +70 -0
  29. package/{agile-context-engineering/workflows/init-coding-standards.xml → skills/init-coding-standards/workflow.xml} +4 -9
  30. package/skills/map-cross-cutting/SKILL.md +89 -0
  31. package/skills/map-cross-cutting/workflow.xml +330 -0
  32. package/skills/map-guide/SKILL.md +89 -0
  33. package/skills/map-guide/workflow.xml +320 -0
  34. package/skills/map-pattern/SKILL.md +89 -0
  35. package/skills/map-pattern/workflow.xml +331 -0
  36. package/skills/map-story/SKILL.md +127 -0
  37. package/skills/map-story/templates/guide.xml +137 -0
  38. package/skills/map-story/templates/pattern.xml +159 -0
  39. package/skills/map-story/templates/system-cross-cutting.xml +197 -0
  40. package/skills/map-story/templates/walkthrough.xml +255 -0
  41. package/{agile-context-engineering/workflows/map-story.xml → skills/map-story/workflow.xml} +258 -9
  42. package/skills/map-subsystem/SKILL.md +111 -0
  43. package/skills/map-subsystem/script.js +60 -0
  44. package/skills/map-subsystem/script.test.js +68 -0
  45. package/skills/map-subsystem/templates/decizions.xml +115 -0
  46. package/skills/map-subsystem/templates/guide.xml +137 -0
  47. package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/module-discovery.xml +3 -3
  48. package/skills/map-subsystem/templates/pattern.xml +159 -0
  49. package/skills/map-subsystem/templates/system-cross-cutting.xml +197 -0
  50. package/skills/map-subsystem/templates/system.xml +381 -0
  51. package/skills/map-subsystem/templates/walkthrough.xml +255 -0
  52. package/{agile-context-engineering/workflows/map-subsystem.xml → skills/map-subsystem/workflow.xml} +17 -21
  53. package/skills/map-sys-doc/SKILL.md +90 -0
  54. package/skills/map-sys-doc/system.xml +381 -0
  55. package/skills/map-sys-doc/workflow.xml +336 -0
  56. package/skills/map-system/SKILL.md +85 -0
  57. package/skills/map-system/script.js +84 -0
  58. package/skills/map-system/script.test.js +73 -0
  59. package/skills/map-system/templates/wiki-readme.xml +297 -0
  60. package/{agile-context-engineering/workflows/map-system.xml → skills/map-system/workflow.xml} +11 -16
  61. package/skills/map-walkthrough/SKILL.md +92 -0
  62. package/skills/map-walkthrough/walkthrough.xml +255 -0
  63. package/skills/map-walkthrough/workflow.xml +457 -0
  64. package/skills/plan-backlog/SKILL.md +75 -0
  65. package/skills/plan-backlog/script.js +136 -0
  66. package/skills/plan-backlog/script.test.js +83 -0
  67. package/{agile-context-engineering/workflows/plan-backlog.xml → skills/plan-backlog/workflow.xml} +13 -21
  68. package/skills/plan-feature/SKILL.md +76 -0
  69. package/skills/plan-feature/script.js +148 -0
  70. package/skills/plan-feature/script.test.js +80 -0
  71. package/{agile-context-engineering/workflows/plan-feature.xml → skills/plan-feature/workflow.xml} +21 -29
  72. package/skills/plan-product-vision/SKILL.md +75 -0
  73. package/skills/plan-product-vision/script.js +60 -0
  74. package/skills/plan-product-vision/script.test.js +69 -0
  75. package/{agile-context-engineering/workflows/plan-product-vision.xml → skills/plan-product-vision/workflow.xml} +4 -9
  76. package/skills/plan-story/SKILL.md +116 -0
  77. package/skills/plan-story/script.js +326 -0
  78. package/skills/plan-story/script.test.js +240 -0
  79. package/skills/plan-story/story-template.xml +451 -0
  80. package/{agile-context-engineering/workflows/plan-story.xml → skills/plan-story/workflow.xml} +1285 -909
  81. package/skills/research-external-solution/SKILL.md +107 -0
  82. package/skills/research-external-solution/script.js +238 -0
  83. package/skills/research-external-solution/script.test.js +134 -0
  84. package/{agile-context-engineering/workflows/research-external-solution.xml → skills/research-external-solution/workflow.xml} +4 -6
  85. package/skills/research-integration-solution/SKILL.md +98 -0
  86. package/{agile-context-engineering/templates/product/story-integration-solution.xml → skills/research-integration-solution/integration-solution-template.xml} +1 -0
  87. package/skills/research-integration-solution/script.js +231 -0
  88. package/skills/research-integration-solution/script.test.js +134 -0
  89. package/{agile-context-engineering/workflows/research-integration-solution.xml → skills/research-integration-solution/workflow.xml} +4 -5
  90. package/skills/research-story-wiki/SKILL.md +92 -0
  91. package/skills/research-story-wiki/script.js +231 -0
  92. package/skills/research-story-wiki/script.test.js +138 -0
  93. package/{agile-context-engineering/templates/product/story-wiki.xml → skills/research-story-wiki/story-wiki-template.xml} +4 -0
  94. package/{agile-context-engineering/workflows/research-story-wiki.xml → skills/research-story-wiki/workflow.xml} +5 -6
  95. package/skills/research-technical-solution/SKILL.md +103 -0
  96. package/skills/research-technical-solution/script.js +231 -0
  97. package/skills/research-technical-solution/script.test.js +134 -0
  98. package/{agile-context-engineering/workflows/research-technical-solution.xml → skills/research-technical-solution/workflow.xml} +4 -5
  99. package/skills/review-story/SKILL.md +100 -0
  100. package/skills/review-story/script.js +257 -0
  101. package/skills/review-story/script.test.js +169 -0
  102. package/skills/review-story/story-template.xml +451 -0
  103. package/{agile-context-engineering/workflows/review-story.xml → skills/review-story/workflow.xml} +1 -3
  104. package/skills/update/SKILL.md +53 -0
  105. package/{agile-context-engineering/workflows/update.xml → skills/update/workflow.xml} +237 -207
  106. package/agile-context-engineering/src/ace-tools.js +0 -2881
  107. package/agile-context-engineering/src/ace-tools.test.js +0 -1089
  108. package/agile-context-engineering/templates/_command.md +0 -54
  109. package/agile-context-engineering/templates/_workflow.xml +0 -17
  110. package/agile-context-engineering/templates/config.json +0 -0
  111. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  112. package/agile-context-engineering/templates/wiki/wiki-readme.xml +0 -276
  113. package/commands/ace/execute-story.md +0 -137
  114. package/commands/ace/help.md +0 -93
  115. package/commands/ace/init-coding-standards.md +0 -83
  116. package/commands/ace/map-story.md +0 -156
  117. package/commands/ace/map-subsystem.md +0 -138
  118. package/commands/ace/map-system.md +0 -92
  119. package/commands/ace/plan-backlog.md +0 -83
  120. package/commands/ace/plan-feature.md +0 -89
  121. package/commands/ace/plan-product-vision.md +0 -81
  122. package/commands/ace/plan-story.md +0 -145
  123. package/commands/ace/research-external-solution.md +0 -138
  124. package/commands/ace/research-integration-solution.md +0 -135
  125. package/commands/ace/research-story-wiki.md +0 -116
  126. package/commands/ace/research-technical-solution.md +0 -147
  127. package/commands/ace/review-story.md +0 -109
  128. package/commands/ace/update.md +0 -54
  129. /package/{agile-context-engineering → shared}/utils/questioning.xml +0 -0
  130. /package/{agile-context-engineering/templates/product/story.xml → skills/execute-story/story-template.xml} +0 -0
  131. /package/{agile-context-engineering/templates/wiki → skills/map-cross-cutting}/system-cross-cutting.xml +0 -0
  132. /package/{agile-context-engineering/templates/wiki → skills/map-guide}/guide.xml +0 -0
  133. /package/{agile-context-engineering/templates/wiki → skills/map-pattern}/pattern.xml +0 -0
  134. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/decizions.xml +0 -0
  135. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/system.xml +0 -0
  136. /package/{agile-context-engineering/templates/wiki → skills/map-story/templates}/tech-debt-index.xml +0 -0
  137. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-architecture.xml +0 -0
  138. /package/{agile-context-engineering/templates/wiki → skills/map-subsystem/templates}/subsystem-structure.xml +0 -0
  139. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-architecture.xml +0 -0
  140. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/system-structure.xml +0 -0
  141. /package/{agile-context-engineering/templates/wiki → skills/map-system/templates}/testing-framework.xml +0 -0
  142. /package/{agile-context-engineering/templates/product/product-backlog.xml → skills/plan-backlog/product-backlog-template.xml} +0 -0
  143. /package/{agile-context-engineering/templates/product/feature.xml → skills/plan-feature/feature-template.xml} +0 -0
  144. /package/{agile-context-engineering/templates/product/product-vision.xml → skills/plan-product-vision/product-vision-template.xml} +0 -0
  145. /package/{agile-context-engineering/templates/product/external-solution.xml → skills/research-external-solution/external-solution-template.xml} +0 -0
  146. /package/{agile-context-engineering/templates/product/story-technical-solution.xml → skills/research-technical-solution/technical-solution-template.xml} +0 -0
@@ -0,0 +1,231 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * research-story-wiki skill script — Entry point for ace-tools operations
5
+ * needed by the research-story-wiki skill.
6
+ *
7
+ * Subcommands:
8
+ * init [story-param] Environment detection for research-story-wiki workflow
9
+ *
10
+ * Usage: node script.js <subcommand> [args] [--raw]
11
+ */
12
+
13
+ const path = require('path');
14
+
15
+ const {
16
+ loadConfig, pathExists, safeReadFile, loadSettings, resolveModel,
17
+ execCommand, output, error,
18
+ } = require('../../shared/lib/ace-core');
19
+
20
+ const {
21
+ classifyStoryParam, extractStoryMetadata, extractStoryRequirements,
22
+ extractWikiReferences,
23
+ computeStoryPaths,
24
+ } = require('../../shared/lib/ace-story');
25
+
26
+ // ─── CLI Dispatch ────────────────────────────────────────────────────────────
27
+
28
+ const cwd = process.cwd();
29
+ const args = process.argv.slice(2);
30
+ const raw = args.includes('--raw');
31
+ const cmd = args[0];
32
+
33
+ switch (cmd) {
34
+ case 'init':
35
+ cmdInit(cwd, raw, args.slice(1).filter(a => a !== '--raw').join(' ') || undefined);
36
+ break;
37
+ default:
38
+ error(`Unknown command: ${cmd}\nAvailable: init`);
39
+ }
40
+
41
+ // ─── Init: Research Story ───────────────────────────────────────────────────
42
+
43
+ /**
44
+ * Environment detection for the research-story-wiki workflow.
45
+ *
46
+ * Replicates cmdInitResearchStory from ace-tools.js:
47
+ * 1. loadConfig, detect git/gh CLI/github_project
48
+ * 2. classifyStoryParam — validate story source
49
+ * 3. Load story content (from file or GitHub)
50
+ * 4. extractStoryMetadata, extractStoryRequirements, extractWikiReferences
51
+ * 5. computeStoryPaths or derive from file location
52
+ * 6. Check artifact existence (external/integration analysis, feature file)
53
+ * 7. Verify wiki doc existence
54
+ * 8. Output JSON with all data
55
+ */
56
+ function cmdInit(cwd, raw, storyParam) {
57
+ const config = loadConfig(cwd);
58
+
59
+ // ── Environment detection ──
60
+ const has_git = pathExists(cwd, '.git');
61
+ const has_gh_cli = (() => {
62
+ try {
63
+ const { execSync } = require('child_process');
64
+ execSync('gh --version', { stdio: 'pipe' });
65
+ return true;
66
+ } catch { return false; }
67
+ })();
68
+ const github_project = (() => {
69
+ const settings = loadSettings(cwd);
70
+ return settings.github_project;
71
+ })();
72
+
73
+ // ── Classify the story parameter ──
74
+ const classified = classifyStoryParam(storyParam);
75
+
76
+ // Early exit if invalid
77
+ if (classified.type === null || classified.type === 'invalid') {
78
+ output({
79
+ analyst_model: resolveModel(cwd, 'ace-code-integration-analyst'),
80
+ mapper_model: resolveModel(cwd, 'ace-wiki-mapper'),
81
+ commit_docs: config.commit_docs,
82
+ has_git, has_gh_cli, github_project,
83
+ story_source: null,
84
+ story_valid: false,
85
+ story_error: classified.reason || 'No story parameter provided',
86
+ story: { id: null, title: null, status: null, size: null },
87
+ feature: { id: null, title: null },
88
+ epic: { id: null, title: null },
89
+ user_story: null, description: null, acceptance_criteria_count: 0,
90
+ paths: null,
91
+ has_external_analysis: false, has_integration_analysis: false, has_feature_file: false,
92
+ wiki_references: { system_wide: [], subsystem_docs: [], total_count: 0 },
93
+ wiki_docs_exist: { existing: [], missing: [] },
94
+ }, raw);
95
+ return;
96
+ }
97
+
98
+ // ── Load story content ──
99
+ let storyContent = null;
100
+ let storySource = classified.type === 'file' ? 'file' : 'github';
101
+ let storyError = null;
102
+ let storyFilePath = null;
103
+
104
+ if (classified.type === 'file') {
105
+ const resolvedPath = path.isAbsolute(classified.filePath)
106
+ ? classified.filePath
107
+ : path.join(cwd, classified.filePath);
108
+ if (!pathExists(cwd, classified.filePath)) {
109
+ storyError = `Story file not found: ${classified.filePath}`;
110
+ } else {
111
+ storyContent = safeReadFile(resolvedPath);
112
+ storyFilePath = classified.filePath;
113
+ if (!storyContent) storyError = `Could not read story file: ${classified.filePath}`;
114
+ }
115
+ } else {
116
+ // github-url or issue-number
117
+ if (!has_gh_cli) {
118
+ storyError = 'GitHub CLI (gh) not installed. Cannot fetch GitHub issues.';
119
+ } else {
120
+ const repo = classified.repo || (github_project.repo || null);
121
+ if (!repo) {
122
+ storyError = 'No repository configured. Provide a full GitHub URL or configure github_project.repo in settings.';
123
+ } else {
124
+ const ghResult = execCommand(
125
+ `gh issue view ${classified.issueNumber} --repo ${repo} --json title,body,labels,state`,
126
+ cwd
127
+ );
128
+ if (!ghResult) {
129
+ storyError = `Could not fetch GitHub issue #${classified.issueNumber} from ${repo}.`;
130
+ } else {
131
+ try {
132
+ const issue = JSON.parse(ghResult);
133
+ storyContent = issue.body || '';
134
+ if (storyContent && !storyContent.match(/^#\s+/m)) {
135
+ storyContent = `# ${issue.title}\n\n${storyContent}`;
136
+ }
137
+ } catch {
138
+ storyError = `Failed to parse GitHub issue response for #${classified.issueNumber}.`;
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
144
+
145
+ // ── Extract metadata & requirements ──
146
+ const metadata = extractStoryMetadata(storyContent);
147
+ const requirements = extractStoryRequirements(storyContent);
148
+ const wikiRefs = extractWikiReferences(storyContent);
149
+
150
+ // ── Compute paths ──
151
+ let paths = null;
152
+ if (storyFilePath) {
153
+ const resolvedPath = path.isAbsolute(storyFilePath)
154
+ ? storyFilePath
155
+ : path.join(cwd, storyFilePath);
156
+ const storyDir = path.dirname(resolvedPath);
157
+ const relStoryDir = path.relative(cwd, storyDir).replace(/\\/g, '/');
158
+ const storySlug = path.basename(storyDir);
159
+ const featureDir = path.dirname(storyDir);
160
+ const relFeatureDir = path.relative(cwd, featureDir).replace(/\\/g, '/');
161
+ const featureSlug = path.basename(featureDir);
162
+
163
+ paths = {
164
+ epic_slug: null,
165
+ feature_slug: featureSlug,
166
+ story_slug: storySlug,
167
+ story_dir: relStoryDir,
168
+ story_file: storyFilePath.replace(/\\/g, '/'),
169
+ external_analysis_file: `${relStoryDir}/external-analysis.md`,
170
+ integration_analysis_file: `${relStoryDir}/integration-analysis.md`,
171
+ feature_dir: relFeatureDir,
172
+ feature_file: `${relFeatureDir}/${featureSlug}.md`,
173
+ };
174
+ } else if (metadata.epic.id && metadata.feature.id && metadata.id) {
175
+ paths = computeStoryPaths(
176
+ metadata.epic.id, metadata.epic.title || '',
177
+ metadata.feature.id, metadata.feature.title || '',
178
+ metadata.id, metadata.title || ''
179
+ );
180
+ }
181
+
182
+ // ── Check artifact existence ──
183
+ const has_external_analysis = paths ? pathExists(cwd, paths.external_analysis_file) : false;
184
+ const has_integration_analysis = paths ? pathExists(cwd, paths.integration_analysis_file) : false;
185
+ const has_feature_file = paths ? pathExists(cwd, paths.feature_file) : false;
186
+
187
+ // ── Verify wiki doc existence ──
188
+ const allWikiPaths = [...wikiRefs.system_wide, ...wikiRefs.subsystem_docs.map(d => d.path)];
189
+ const wikiExisting = [];
190
+ const wikiMissing = [];
191
+ for (const wikiPath of allWikiPaths) {
192
+ if (pathExists(cwd, wikiPath)) {
193
+ wikiExisting.push(wikiPath);
194
+ } else {
195
+ wikiMissing.push(wikiPath);
196
+ }
197
+ }
198
+
199
+ // ── Build result ──
200
+ const result = {
201
+ analyst_model: resolveModel(cwd, 'ace-code-integration-analyst'),
202
+ mapper_model: resolveModel(cwd, 'ace-wiki-mapper'),
203
+ commit_docs: config.commit_docs,
204
+ has_git, has_gh_cli, github_project,
205
+ story_source: storySource,
206
+ story_valid: storyContent !== null && storyError === null,
207
+ story_error: storyError,
208
+ story: {
209
+ id: metadata.id,
210
+ title: metadata.title,
211
+ status: metadata.status,
212
+ size: metadata.size,
213
+ },
214
+ feature: metadata.feature,
215
+ epic: metadata.epic,
216
+ user_story: requirements.user_story,
217
+ description: requirements.description,
218
+ acceptance_criteria_count: requirements.acceptance_criteria_count,
219
+ paths,
220
+ has_external_analysis,
221
+ has_integration_analysis,
222
+ has_feature_file,
223
+ wiki_references: wikiRefs,
224
+ wiki_docs_exist: {
225
+ existing: wikiExisting,
226
+ missing: wikiMissing,
227
+ },
228
+ };
229
+
230
+ output(result, raw);
231
+ }
@@ -0,0 +1,138 @@
1
+ const { describe, it, before, after } = require('node:test');
2
+ const assert = require('node:assert');
3
+ const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const os = require('os');
7
+
8
+ const SCRIPT = path.join(__dirname, 'script.js');
9
+
10
+ /**
11
+ * Create a minimal ACE project structure in a temp directory.
12
+ */
13
+ function createTestProject() {
14
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ace-test-'));
15
+
16
+ // .ace/config.json
17
+ const aceDir = path.join(tmpDir, '.ace');
18
+ fs.mkdirSync(aceDir, { recursive: true });
19
+ fs.writeFileSync(path.join(aceDir, 'config.json'), JSON.stringify({
20
+ version: '0.1.0',
21
+ projectName: 'test-project',
22
+ model_profile: 'quality',
23
+ commit_docs: true,
24
+ github: { enabled: false },
25
+ }, null, 2));
26
+
27
+ // .ace/settings.json
28
+ fs.writeFileSync(path.join(aceDir, 'settings.json'), JSON.stringify({
29
+ model_profile: 'quality',
30
+ commit_docs: true,
31
+ agent_teams: false,
32
+ github_project: { enabled: false, gh_installed: false, repo: '', project_number: null, owner: '' },
33
+ }, null, 2));
34
+
35
+ return tmpDir;
36
+ }
37
+
38
+ /**
39
+ * Create a story file in the test project.
40
+ */
41
+ function createStoryFile(tmpDir, relPath, content) {
42
+ const fullPath = path.join(tmpDir, relPath);
43
+ fs.mkdirSync(path.dirname(fullPath), { recursive: true });
44
+ fs.writeFileSync(fullPath, content, 'utf-8');
45
+ return relPath;
46
+ }
47
+
48
+ function runScript(subcommand, args, cwd) {
49
+ return execSync(`node "${SCRIPT}" ${subcommand} ${args}`, {
50
+ cwd,
51
+ encoding: 'utf-8',
52
+ timeout: 10000,
53
+ });
54
+ }
55
+
56
+ function cleanup(tmpDir) {
57
+ fs.rmSync(tmpDir, { recursive: true, force: true });
58
+ }
59
+
60
+ // ─── Tests ───────────────────────────────────────────────────────────────────
61
+
62
+ describe('research-story-wiki script', () => {
63
+
64
+ describe('init', () => {
65
+ let tmpDir;
66
+
67
+ before(() => { tmpDir = createTestProject(); });
68
+ after(() => { cleanup(tmpDir); });
69
+
70
+ it('returns valid JSON with environment detection for a story file', () => {
71
+ const storyContent = [
72
+ '# S1: Add Login Button',
73
+ '**Feature**: F1 User Auth | **Epic**: E1 Platform',
74
+ '**Status**: Todo | **Size**: 3 | **Sprint**: — | **Link**: —',
75
+ '',
76
+ '## User Story',
77
+ '',
78
+ '> As a user,',
79
+ '> I want to click a login button,',
80
+ '> so that I can access my account.',
81
+ '',
82
+ '## Description',
83
+ '',
84
+ 'Adds a login button to the header.',
85
+ '',
86
+ '## Acceptance Criteria',
87
+ '',
88
+ '### Scenario: Click login button',
89
+ '',
90
+ '**Given** the user is on the homepage',
91
+ '**When** they click "Login"',
92
+ '**Then** they see the login form',
93
+ ].join('\n');
94
+
95
+ const storyPath = createStoryFile(
96
+ tmpDir,
97
+ '.ace/artifacts/product/e1-platform/f1-user-auth/s1-add-login-button/s1-add-login-button.md',
98
+ storyContent
99
+ );
100
+
101
+ const result = JSON.parse(runScript('init', storyPath, tmpDir));
102
+
103
+ assert.ok(result.analyst_model, 'should have analyst_model');
104
+ assert.ok(result.mapper_model, 'should have mapper_model');
105
+ assert.strictEqual(result.story_valid, true, 'story should be valid');
106
+ assert.strictEqual(result.story_source, 'file');
107
+ assert.strictEqual(result.story.id, 'S1');
108
+ assert.strictEqual(result.story.title, 'Add Login Button');
109
+ assert.strictEqual(result.story.status, 'Todo');
110
+ assert.strictEqual(result.acceptance_criteria_count, 1);
111
+ assert.ok(result.paths, 'should have computed paths');
112
+ assert.ok(result.paths.story_file.includes('s1-add-login-button'));
113
+ assert.strictEqual(typeof result.commit_docs, 'boolean');
114
+ assert.strictEqual(typeof result.has_git, 'boolean');
115
+ assert.ok(result.wiki_references, 'should have wiki_references');
116
+ assert.ok(result.wiki_docs_exist, 'should have wiki_docs_exist');
117
+ });
118
+
119
+ it('errors on init without story param', () => {
120
+ const result = JSON.parse(runScript('init', '', tmpDir));
121
+ assert.strictEqual(result.story_valid, false);
122
+ });
123
+
124
+ it('handles non-existent story file gracefully', () => {
125
+ const result = JSON.parse(runScript('init', 'nonexistent/story.md', tmpDir));
126
+ assert.strictEqual(result.story_valid, false);
127
+ assert.ok(result.story_error.includes('not found'));
128
+ });
129
+ });
130
+
131
+ describe('error handling', () => {
132
+ it('errors on unknown command', () => {
133
+ assert.throws(() => {
134
+ execSync(`node "${SCRIPT}" bogus`, { encoding: 'utf-8', stdio: 'pipe' });
135
+ });
136
+ });
137
+ });
138
+ });
@@ -55,6 +55,9 @@
55
55
  ### Guides
56
56
  - [`.docs/wiki/subsystems/[name]/guides/[guide].md`] — [Why this guide is useful for this story]
57
57
 
58
+ ### Walkthroughs
59
+ - [`.docs/wiki/subsystems/[name]/walkthroughs/[flow].md`] — [Why this flow walkthrough helps understand the implementation context]
60
+
58
61
  ### Decisions
59
62
  - [`.docs/wiki/subsystems/[name]/decisions/[decision].md`] — [Why this ADR constrains or informs this story]
60
63
 
@@ -94,6 +97,7 @@
94
97
  - Documents a pattern this story must follow
95
98
  - Covers a cross-cutting concern this story must respect (auth, logging, error handling, etc.)
96
99
  - Contains a guide for a task this story requires (e.g., "how to add an API endpoint")
100
+ - Walks through a complex flow this story extends or modifies
97
101
  - Records an ADR that constrains design choices for this story
98
102
  - Describes the structure or architecture of a subsystem this story touches
99
103
  </include-when>
@@ -36,12 +36,10 @@
36
36
  <step name="setup" order="1">
37
37
  **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
38
38
 
39
- ```bash
40
- INIT=$(node ~/.claude/agile-context-engineering/src/ace-tools.js init research-story {story_param})
41
- ```
39
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
42
40
 
43
- This single call validates the story parameter, extracts metadata/requirements/wiki
44
- references, computes all paths and slugs, and checks artifact existence.
41
+ This preprocessing validated the story parameter, extracted metadata/requirements/wiki
42
+ references, computed all paths and slugs, and checked artifact existence.
45
43
 
46
44
  Parse INIT JSON for:
47
45
  - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `mapper_model`
@@ -246,7 +244,7 @@
246
244
  Instructions:
247
245
  1. List all files in .docs/wiki/subsystems/{subsystem_name}/ recursively
248
246
  2. Read each document (structure.md, architecture.md, and any docs in
249
- systems/, patterns/, cross-cutting/, guides/, decisions/ subdirectories)
247
+ systems/, patterns/, cross-cutting/, guides/, walkthroughs/, decisions/ subdirectories)
250
248
  3. For each document, assess: does it directly inform the technical solution
251
249
  for THIS story? Apply these criteria:
252
250
  - INCLUDE if: describes a system this story modifies/extends, documents a
@@ -299,6 +297,7 @@
299
297
  - **Patterns**: files under `subsystems/*/patterns/`
300
298
  - **Cross-Cutting Concerns**: files under `subsystems/*/cross-cutting/`
301
299
  - **Guides**: files under `subsystems/*/guides/`
300
+ - **Walkthroughs**: files under `subsystems/*/walkthroughs/`
302
301
  - **Decisions**: files under `subsystems/*/decisions/`
303
302
  - **Architecture**: `subsystems/*/architecture.md` files
304
303
  - **Structure**: `subsystems/*/structure.md` files (include under Systems category)
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: research-technical-solution
3
+ description: COMPREHENSIVE Technical Solution Design for a Story -- Architecture, Patterns, Algorithms, Sequence Diagrams, and Implementation Plan
4
+ argument-hint: "story=<file-path|github-url>"
5
+ disable-model-invocation: true
6
+ allowed-tools: Read, Bash, Write, Edit, AskUserQuestion, Glob, Grep, Agent
7
+ model: opus
8
+ effort: max
9
+ context: fork
10
+ agent: ace-technical-application-architect
11
+ ---
12
+
13
+ # Research Technical Solution
14
+
15
+ Use business requirements, integration analysis, and optionally external/industry-standard analysis to create a CONCRETE TECHNICAL SOLUTION DESIGN for a story.
16
+
17
+ ## When to Use
18
+
19
+ - After `/ace:plan-story` -- once story requirements (pass 1-2) are complete
20
+ - After `/ace:research-integration-solution` -- integration analysis (pass 4) MUST exist
21
+ - Optionally after `/ace:research-external-solution` -- external analysis (pass 3) if applicable
22
+ - When story requirements, wiki references, and integration analysis are available (passes 1-4 complete)
23
+ - When you need to design a concrete technical solution for the story
24
+ - When you want a detailed implementation blueprint with class diagrams, sequence diagrams, algorithms, and file structure
25
+ - When you need a comprehensive technical design to guide AI agents implementing the story
26
+
27
+ ## Input
28
+
29
+ ### Required
30
+
31
+ - **`story`** -- Story source:
32
+ - **File path**: Path to a markdown file containing the story (from plan-story command)
33
+ - **GitHub URL or issue number**: GitHub story reference
34
+ - Must be a valid, accessible file or GitHub issue.
35
+ - Contains the user story, acceptance criteria, and Relevant Wiki references that define what to design a technical solution for.
36
+ - All context is extracted from the story document: feature file, requirements, wiki references, external analysis (optional), integration analysis (mandatory).
37
+ - If not valid, stop and prompt the user.
38
+
39
+ ## Environment Context (preprocessed)
40
+
41
+ !`node "${CLAUDE_SKILL_DIR}/script.js" init "$ARGUMENTS" 2>/dev/null`
42
+
43
+ ## Supporting Resources
44
+
45
+ Read ALL of these before starting the workflow:
46
+
47
+ - **Workflow**: Read [workflow.xml](workflow.xml) -- complete orchestration process with all steps
48
+ - **Technical solution template**: Read [technical-solution-template.xml](technical-solution-template.xml) -- output format for the technical solution section
49
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` -- ACE output formatting rules
50
+
51
+ ## Process
52
+
53
+ Use the `ace-technical-application-architect` agent for application architecture and codebase-intimate technical design.
54
+
55
+ The Environment Context above contains the preprocessed INIT JSON -- use it directly instead of running the init script manually. The workflow's step 1 setup can skip the init bash call since that data is already available.
56
+
57
+ Read all supporting resources listed above, then execute the workflow defined in [workflow.xml](workflow.xml) end-to-end. Preserve all workflow gates (validation, approvals, commits).
58
+
59
+ **CRITICAL**: The technical solution MUST include detailed sequence diagrams for EVERY scenario in the Acceptance Criteria, showing the complete flow of data and control through all architectural layers.
60
+
61
+ The analysis covers:
62
+ - Complete component and boundary architecture
63
+ - Design patterns and technical decisions
64
+ - Full class diagrams and interfaces (one per file!)
65
+ - Data models and structures
66
+ - Algorithms and business logic
67
+ - Event flow and entry points
68
+ - MANDATORY sequence diagrams for ALL AC scenarios
69
+ - Complete file structure tree
70
+ - DI container configuration
71
+ - Testing strategy (unit, integration, e2e)
72
+ - Implementation order and dependencies
73
+
74
+ **Output**: The entire technical solution is written INTO the story document (appended as the Technical Solution section) AND updated in the GitHub issue.
75
+
76
+ ## Artifacts
77
+
78
+ ```
79
+ Written directly into the story file and GitHub issue -- pass 5 of the story specification pipeline.
80
+ ```
81
+
82
+ ## Example Usage
83
+
84
+ ```
85
+ # Example with file path story
86
+ /ace:research-technical-solution \
87
+ story=.ace/artifacts/product/e1-auth/f3-oauth/s1-buttons/s1-buttons.md
88
+
89
+ # Example with GitHub story
90
+ /ace:research-technical-solution \
91
+ story=https://github.com/owner/repo/issues/83
92
+
93
+ # Example with just issue number (uses current repo)
94
+ /ace:research-technical-solution \
95
+ story=83
96
+ ```
97
+
98
+ ## Next Steps
99
+
100
+ - The story is now fully refined (pass 5 complete) -- ready for implementation
101
+ - `/ace:execute-story story=...` -- Execute the story implementation
102
+ - `/ace:plan-story story=...` -- Re-refine if scope changes
103
+ - `/ace:help` -- Check project initialization status