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,107 @@
1
+ ---
2
+ name: research-external-solution
3
+ description: COMPREHENSIVE, IN-DEPTH, CODE-LEVEL Analysis of User Story Implementation in External Repository
4
+ argument-hint: "story=<file-path|github-url> external-codebase=<source-path|github-url> [external-docs=<weblink|filepath>]"
5
+ disable-model-invocation: true
6
+ allowed-tools: Read, Bash, Write, AskUserQuestion, Glob, Grep, WebFetch
7
+ model: opus
8
+ effort: max
9
+ context: fork
10
+ agent: ace-code-discovery-analyst
11
+ ---
12
+
13
+ # Research External Solution
14
+
15
+ Perform a COMPREHENSIVE, IN-DEPTH, CODE-LEVEL ANALYSIS of how a specific story's functionality is implemented in an external reference system.
16
+
17
+ ## When to Use
18
+
19
+ - After `/ace:plan-story` -- once story requirements (pass 1-2) are complete
20
+ - Anytime a story references an external system or reference implementation
21
+ - When a story or feature references an external codebase to learn from
22
+ - When you need to understand how an industry-standard system implements specific functionality
23
+ - When you want to extract algorithms, patterns, and implementation details from reference code
24
+
25
+ ## Input
26
+
27
+ ### Required
28
+
29
+ - **`story`** -- Story source:
30
+ - **File path**: Path to a markdown file containing the story (from plan-story command)
31
+ - **GitHub URL or issue number**: GitHub story reference
32
+ - Must be a valid, accessible file or GitHub issue.
33
+ - Contains the user story and acceptance criteria that define what to analyze.
34
+ - **Requirements for the analysis are extracted from this story.**
35
+ - If not valid, stop and prompt the user.
36
+
37
+ - **`external-codebase`** -- Path or GitHub repo to the external industry-standard system to analyze:
38
+ - If local path: Confirm folder exists and contains source code
39
+ - If GitHub URL: Verify repository accessibility
40
+
41
+ ### Optional
42
+
43
+ - **`external-docs`** -- Link or path to external system documentation:
44
+ - If weblink: Verify URL is accessible
45
+ - If filepath: Verify file exists and is readable
46
+ - **PREFER using context7 MCP server** when installed -- it provides up-to-date library documentation automatically.
47
+
48
+ ## Environment Context (preprocessed)
49
+
50
+ !`node "${CLAUDE_SKILL_DIR}/script.js" init "$ARGUMENTS" 2>/dev/null`
51
+
52
+ ## Supporting Resources
53
+
54
+ Read ALL of these before starting the workflow:
55
+
56
+ - **Workflow**: Read [workflow.xml](workflow.xml) -- complete orchestration process with all steps
57
+ - **External solution template**: Read [external-solution-template.xml](external-solution-template.xml) -- output format for the analysis
58
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` -- ACE output formatting rules
59
+
60
+ ## Process
61
+
62
+ Use the `ace-code-discovery-analyst` agent for code discovery.
63
+
64
+ 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.
65
+
66
+ 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).
67
+
68
+ This is NOT a high-level overview -- it's a DEEP DIVE into:
69
+ - EXACT code implementations with line-by-line analysis
70
+ - COMPLETE algorithms and formulas extracted verbatim from code
71
+ - ALL design patterns with actual code examples
72
+ - EVERY file, function, and constant involved in the story
73
+ - FULL execution paths traced 5+ levels deep minimum
74
+
75
+ All output is written ONLY to the analysis file -- no GitHub updates, no modifications to the story file.
76
+
77
+ ## Artifacts
78
+
79
+ ```
80
+ .ace/artifacts/product/<id-epic_name>/<id-feature_name>/<id-story_name>/external-analysis.md
81
+ ```
82
+
83
+ ## Example Usage
84
+
85
+ ```
86
+ # Example with file path story and GitHub external repo
87
+ /ace:research-external-solution \
88
+ story=.ace/artifacts/product/e1-auth/f3-oauth/s1-buttons/s1-buttons.md \
89
+ external-codebase=https://github.com/tradingview/lightweight-charts \
90
+ external-docs=https://tradingview.github.io/lightweight-charts/
91
+
92
+ # Example with GitHub story and local external repo
93
+ /ace:research-external-solution \
94
+ story=https://github.com/owner/repo/issues/83 \
95
+ external-codebase=src/external/lightweight-charts/
96
+
97
+ # Example with context7 (no external-docs needed)
98
+ /ace:research-external-solution \
99
+ story=.ace/artifacts/product/e1-charts/f2-rendering/s3-canvas/s3-canvas.md \
100
+ external-codebase=https://github.com/tradingview/lightweight-charts
101
+ ```
102
+
103
+ ## Next Steps
104
+
105
+ - Continue with story refinement -- integration analysis (pass 4) and technical solution (pass 5)
106
+ - `/ace:research-external-solution story=... external-codebase=...` -- Analyze another story
107
+ - `/ace:help` -- Check project initialization status
@@ -0,0 +1,238 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * research-external-solution skill script — Entry point for ace-tools operations
5
+ * needed by the research-external-solution skill.
6
+ *
7
+ * Subcommands:
8
+ * init [story-param] Environment detection for research-external-solution 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
+ case 'verify-path-exists': {
38
+ const targetPath = args.slice(1).filter(a => a !== '--raw').join(' ');
39
+ if (!targetPath) error('verify-path-exists requires path argument');
40
+ const exists = pathExists(cwd, targetPath);
41
+ output({ exists, path: targetPath }, raw, String(exists));
42
+ break;
43
+ }
44
+ default:
45
+ error(`Unknown command: ${cmd}\nAvailable: init, verify-path-exists`);
46
+ }
47
+
48
+ // ─── Init: Research Story ───────────────────────────────────────────────────
49
+
50
+ /**
51
+ * Environment detection for the research-external-solution workflow.
52
+ *
53
+ * Replicates cmdInitResearchStory from ace-tools.js:
54
+ * 1. loadConfig, detect git/gh CLI/github_project
55
+ * 2. classifyStoryParam — validate story source
56
+ * 3. Load story content (from file or GitHub)
57
+ * 4. extractStoryMetadata, extractStoryRequirements, extractWikiReferences
58
+ * 5. computeStoryPaths or derive from file location
59
+ * 6. Check artifact existence (external/integration analysis, feature file)
60
+ * 7. Verify wiki doc existence
61
+ * 8. Output JSON with all data
62
+ */
63
+ function cmdInit(cwd, raw, storyParam) {
64
+ const config = loadConfig(cwd);
65
+
66
+ // ── Environment detection ──
67
+ const has_git = pathExists(cwd, '.git');
68
+ const has_gh_cli = (() => {
69
+ try {
70
+ const { execSync } = require('child_process');
71
+ execSync('gh --version', { stdio: 'pipe' });
72
+ return true;
73
+ } catch { return false; }
74
+ })();
75
+ const github_project = (() => {
76
+ const settings = loadSettings(cwd);
77
+ return settings.github_project;
78
+ })();
79
+
80
+ // ── Classify the story parameter ──
81
+ const classified = classifyStoryParam(storyParam);
82
+
83
+ // Early exit if invalid
84
+ if (classified.type === null || classified.type === 'invalid') {
85
+ output({
86
+ analyst_model: resolveModel(cwd, 'ace-code-integration-analyst'),
87
+ mapper_model: resolveModel(cwd, 'ace-wiki-mapper'),
88
+ commit_docs: config.commit_docs,
89
+ has_git, has_gh_cli, github_project,
90
+ story_source: null,
91
+ story_valid: false,
92
+ story_error: classified.reason || 'No story parameter provided',
93
+ story: { id: null, title: null, status: null, size: null },
94
+ feature: { id: null, title: null },
95
+ epic: { id: null, title: null },
96
+ user_story: null, description: null, acceptance_criteria_count: 0,
97
+ paths: null,
98
+ has_external_analysis: false, has_integration_analysis: false, has_feature_file: false,
99
+ wiki_references: { system_wide: [], subsystem_docs: [], total_count: 0 },
100
+ wiki_docs_exist: { existing: [], missing: [] },
101
+ }, raw);
102
+ return;
103
+ }
104
+
105
+ // ── Load story content ──
106
+ let storyContent = null;
107
+ let storySource = classified.type === 'file' ? 'file' : 'github';
108
+ let storyError = null;
109
+ let storyFilePath = null;
110
+
111
+ if (classified.type === 'file') {
112
+ const resolvedPath = path.isAbsolute(classified.filePath)
113
+ ? classified.filePath
114
+ : path.join(cwd, classified.filePath);
115
+ if (!pathExists(cwd, classified.filePath)) {
116
+ storyError = `Story file not found: ${classified.filePath}`;
117
+ } else {
118
+ storyContent = safeReadFile(resolvedPath);
119
+ storyFilePath = classified.filePath;
120
+ if (!storyContent) storyError = `Could not read story file: ${classified.filePath}`;
121
+ }
122
+ } else {
123
+ // github-url or issue-number
124
+ if (!has_gh_cli) {
125
+ storyError = 'GitHub CLI (gh) not installed. Cannot fetch GitHub issues.';
126
+ } else {
127
+ const repo = classified.repo || (github_project.repo || null);
128
+ if (!repo) {
129
+ storyError = 'No repository configured. Provide a full GitHub URL or configure github_project.repo in settings.';
130
+ } else {
131
+ const ghResult = execCommand(
132
+ `gh issue view ${classified.issueNumber} --repo ${repo} --json title,body,labels,state`,
133
+ cwd
134
+ );
135
+ if (!ghResult) {
136
+ storyError = `Could not fetch GitHub issue #${classified.issueNumber} from ${repo}.`;
137
+ } else {
138
+ try {
139
+ const issue = JSON.parse(ghResult);
140
+ storyContent = issue.body || '';
141
+ if (storyContent && !storyContent.match(/^#\s+/m)) {
142
+ storyContent = `# ${issue.title}\n\n${storyContent}`;
143
+ }
144
+ } catch {
145
+ storyError = `Failed to parse GitHub issue response for #${classified.issueNumber}.`;
146
+ }
147
+ }
148
+ }
149
+ }
150
+ }
151
+
152
+ // ── Extract metadata & requirements ──
153
+ const metadata = extractStoryMetadata(storyContent);
154
+ const requirements = extractStoryRequirements(storyContent);
155
+ const wikiRefs = extractWikiReferences(storyContent);
156
+
157
+ // ── Compute paths ──
158
+ let paths = null;
159
+ if (storyFilePath) {
160
+ const resolvedPath = path.isAbsolute(storyFilePath)
161
+ ? storyFilePath
162
+ : path.join(cwd, storyFilePath);
163
+ const storyDir = path.dirname(resolvedPath);
164
+ const relStoryDir = path.relative(cwd, storyDir).replace(/\\/g, '/');
165
+ const storySlug = path.basename(storyDir);
166
+ const featureDir = path.dirname(storyDir);
167
+ const relFeatureDir = path.relative(cwd, featureDir).replace(/\\/g, '/');
168
+ const featureSlug = path.basename(featureDir);
169
+
170
+ paths = {
171
+ epic_slug: null,
172
+ feature_slug: featureSlug,
173
+ story_slug: storySlug,
174
+ story_dir: relStoryDir,
175
+ story_file: storyFilePath.replace(/\\/g, '/'),
176
+ external_analysis_file: `${relStoryDir}/external-analysis.md`,
177
+ integration_analysis_file: `${relStoryDir}/integration-analysis.md`,
178
+ feature_dir: relFeatureDir,
179
+ feature_file: `${relFeatureDir}/${featureSlug}.md`,
180
+ };
181
+ } else if (metadata.epic.id && metadata.feature.id && metadata.id) {
182
+ paths = computeStoryPaths(
183
+ metadata.epic.id, metadata.epic.title || '',
184
+ metadata.feature.id, metadata.feature.title || '',
185
+ metadata.id, metadata.title || ''
186
+ );
187
+ }
188
+
189
+ // ── Check artifact existence ──
190
+ const has_external_analysis = paths ? pathExists(cwd, paths.external_analysis_file) : false;
191
+ const has_integration_analysis = paths ? pathExists(cwd, paths.integration_analysis_file) : false;
192
+ const has_feature_file = paths ? pathExists(cwd, paths.feature_file) : false;
193
+
194
+ // ── Verify wiki doc existence ──
195
+ const allWikiPaths = [...wikiRefs.system_wide, ...wikiRefs.subsystem_docs.map(d => d.path)];
196
+ const wikiExisting = [];
197
+ const wikiMissing = [];
198
+ for (const wikiPath of allWikiPaths) {
199
+ if (pathExists(cwd, wikiPath)) {
200
+ wikiExisting.push(wikiPath);
201
+ } else {
202
+ wikiMissing.push(wikiPath);
203
+ }
204
+ }
205
+
206
+ // ── Build result ──
207
+ const result = {
208
+ analyst_model: resolveModel(cwd, 'ace-code-integration-analyst'),
209
+ mapper_model: resolveModel(cwd, 'ace-wiki-mapper'),
210
+ commit_docs: config.commit_docs,
211
+ has_git, has_gh_cli, github_project,
212
+ story_source: storySource,
213
+ story_valid: storyContent !== null && storyError === null,
214
+ story_error: storyError,
215
+ story: {
216
+ id: metadata.id,
217
+ title: metadata.title,
218
+ status: metadata.status,
219
+ size: metadata.size,
220
+ },
221
+ feature: metadata.feature,
222
+ epic: metadata.epic,
223
+ user_story: requirements.user_story,
224
+ description: requirements.description,
225
+ acceptance_criteria_count: requirements.acceptance_criteria_count,
226
+ paths,
227
+ has_external_analysis,
228
+ has_integration_analysis,
229
+ has_feature_file,
230
+ wiki_references: wikiRefs,
231
+ wiki_docs_exist: {
232
+ existing: wikiExisting,
233
+ missing: wikiMissing,
234
+ },
235
+ };
236
+
237
+ output(result, raw);
238
+ }
@@ -0,0 +1,134 @@
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-external-solution 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.acceptance_criteria_count, 1);
110
+ assert.ok(result.paths, 'should have computed paths');
111
+ assert.ok(result.wiki_references, 'should have wiki_references');
112
+ assert.ok(result.wiki_docs_exist, 'should have wiki_docs_exist');
113
+ });
114
+
115
+ it('errors on init without story param', () => {
116
+ const result = JSON.parse(runScript('init', '', tmpDir));
117
+ assert.strictEqual(result.story_valid, false);
118
+ });
119
+
120
+ it('handles non-existent story file gracefully', () => {
121
+ const result = JSON.parse(runScript('init', 'nonexistent/story.md', tmpDir));
122
+ assert.strictEqual(result.story_valid, false);
123
+ assert.ok(result.story_error.includes('not found'));
124
+ });
125
+ });
126
+
127
+ describe('error handling', () => {
128
+ it('errors on unknown command', () => {
129
+ assert.throws(() => {
130
+ execSync(`node "${SCRIPT}" bogus`, { encoding: 'utf-8', stdio: 'pipe' });
131
+ });
132
+ });
133
+ });
134
+ });
@@ -33,12 +33,10 @@
33
33
  <step name="setup" order="1">
34
34
  **MANDATORY FIRST STEP — Execute environment detection and story initialization:**
35
35
 
36
- ```bash
37
- INIT=$(node ~/.claude/agile-context-engineering/src/ace-tools.js init research-story {story_param})
38
- ```
36
+ INIT is available from the preprocessed Environment Context above — do NOT re-run init.
39
37
 
40
- This single call validates the story parameter, extracts metadata/requirements/wiki
41
- references, computes all paths and slugs, and checks artifact existence.
38
+ This preprocessing validated the story parameter, extracted metadata/requirements/wiki
39
+ references, computed all paths and slugs, and checked artifact existence.
42
40
 
43
41
  Parse INIT JSON for:
44
42
  - **Environment**: `has_git`, `has_gh_cli`, `github_project`, `analyst_model`
@@ -229,7 +227,7 @@
229
227
 
230
228
  Verify file exists:
231
229
  ```bash
232
- DOCS_EXISTS=$(node ~/.claude/agile-context-engineering/src/ace-tools.js verify-path-exists {filepath} --raw)
230
+ DOCS_EXISTS=$(node "${CLAUDE_SKILL_DIR}/script.js" verify-path-exists {filepath} --raw)
233
231
  ```
234
232
 
235
233
  **If not exists:** Display warning (non-fatal):
@@ -0,0 +1,98 @@
1
+ ---
2
+ name: research-integration-solution
3
+ description: COMPREHENSIVE, IN-DEPTH System Integration Analysis for Integrating a New Story into the Existing Codebase
4
+ argument-hint: "story=<file-path|github-url>"
5
+ disable-model-invocation: true
6
+ allowed-tools: Read, Bash, Write, AskUserQuestion, Glob, Grep, Agent
7
+ model: opus
8
+ effort: max
9
+ context: fork
10
+ agent: ace-code-integration-analyst
11
+ ---
12
+
13
+ # Research Integration Solution
14
+
15
+ Perform a COMPREHENSIVE, IN-DEPTH System Integration Analysis that ensures new story implementations integrate seamlessly with existing systems.
16
+
17
+ ## When to Use
18
+
19
+ - After `/ace:plan-story` -- once story requirements (pass 1-2) are complete
20
+ - After `/ace:research-external-solution` -- if external analysis was performed (pass 3)
21
+ - Anytime you need to understand how a story integrates with the existing codebase
22
+ - When story requirements and wiki references are available (passes 1-2 complete)
23
+ - When you need to identify refactoring needs, integration points, and hardcoded values to replace
24
+ - When you need a comprehensive analysis to guide AI agents implementing the story
25
+
26
+ ## Input
27
+
28
+ ### Required
29
+
30
+ - **`story`** -- Story source:
31
+ - **File path**: Path to a markdown file containing the story (from plan-story command)
32
+ - **GitHub URL or issue number**: GitHub story reference
33
+ - Must be a valid, accessible file or GitHub issue.
34
+ - Contains the user story, acceptance criteria, and Relevant Wiki references that define what to analyze and which wiki docs to load.
35
+ - **Requirements and wiki references are extracted from this story.**
36
+ - If not valid, stop and prompt the user.
37
+
38
+ ## Environment Context (preprocessed)
39
+
40
+ !`node "${CLAUDE_SKILL_DIR}/script.js" init "$ARGUMENTS" 2>/dev/null`
41
+
42
+ ## Supporting Resources
43
+
44
+ Read ALL of these before starting the workflow:
45
+
46
+ - **Workflow**: Read [workflow.xml](workflow.xml) -- complete orchestration process with all steps
47
+ - **Integration solution template**: Read [integration-solution-template.xml](integration-solution-template.xml) -- output format for the analysis
48
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` -- ACE output formatting rules
49
+
50
+ ## Process
51
+
52
+ Use the `ace-code-integration-analyst` agent for code integration analysis.
53
+
54
+ 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.
55
+
56
+ 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).
57
+
58
+ **[MANDATORY]** Identify how a new story would PROPERLY integrate with the existing codebase while maintaining architectural integrity, maintainability, and extensibility while strictly following CODING STANDARDS.
59
+
60
+ The analysis covers:
61
+ - Architecture compatibility with Clean Architecture layers
62
+ - Existing patterns to follow (with specific file references)
63
+ - Required refactoring (with justification)
64
+ - CRITICAL: Hardcoded values and placeholder code that MUST be replaced
65
+ - Integration points across all architectural layers
66
+ - Impact analysis on existing code flows
67
+ - Implementation guidelines and testing strategy
68
+ - Complete AI implementation context for the executing agent
69
+
70
+ All output is written ONLY to the analysis file -- no GitHub updates, no modifications to the story file.
71
+
72
+ ## Artifacts
73
+
74
+ ```
75
+ .ace/artifacts/product/<id-epic_name>/<id-feature_name>/<id-story_name>/integration-analysis.md
76
+ ```
77
+
78
+ ## Example Usage
79
+
80
+ ```
81
+ # Example with file path story
82
+ /ace:research-integration-solution \
83
+ story=.ace/artifacts/product/e1-auth/f3-oauth/s1-buttons/s1-buttons.md
84
+
85
+ # Example with GitHub story
86
+ /ace:research-integration-solution \
87
+ story=https://github.com/owner/repo/issues/83
88
+
89
+ # Example with just issue number (uses current repo)
90
+ /ace:research-integration-solution \
91
+ story=83
92
+ ```
93
+
94
+ ## Next Steps
95
+
96
+ - Continue with story refinement -- technical solution (pass 5)
97
+ - `/ace:research-integration-solution story=...` -- Analyze another story
98
+ - `/ace:help` -- Check project initialization status
@@ -526,6 +526,7 @@
526
526
  - **Patterns**: Design patterns in use with examples
527
527
  - **Cross-Cutting Concerns**: Shared concerns (auth, logging, errors, etc.)
528
528
  - **Guides**: How-to guides for common implementation tasks
529
+ - **Walkthroughs**: Deep tutorial-style flow explanations with actual code snippets
529
530
  - **Decisions (ADRs)**: Architecture decisions that constrain design
530
531
  - **Architecture**: Subsystem architecture documents
531
532