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,336 @@
1
+ <workflow>
2
+
3
+ <purpose>
4
+ Create or update a system document in
5
+ `.docs/wiki/subsystems/[subsystem-name]/systems/`.
6
+
7
+ A system doc describes a coherent domain system — WHAT exists, HOW it works,
8
+ WHERE things live. It is the primary document an AI agent reads before
9
+ implementing a related story.
10
+
11
+ This workflow is executed directly — NO sub-agents are spawned.
12
+ The executing agent does everything: finding relevant code, reading it,
13
+ analyzing components/flows, and writing the document.
14
+ </purpose>
15
+
16
+ <mandatory-context>
17
+ Read all files referenced by the invoking command's execution-context before starting.
18
+ Also read any document or text passed as parameter ($ARGUMENTS) in the invoking command.
19
+ </mandatory-context>
20
+
21
+ <process>
22
+
23
+ <!-- ══════════════════════════════════════════════════════════════════ -->
24
+ <!-- STEP 1: SETUP AND VALIDATE -->
25
+ <!-- ══════════════════════════════════════════════════════════════════ -->
26
+
27
+ <step name="setup" order="1">
28
+
29
+ <substep order="1.1" name="display-banner">
30
+ Display stage banner:
31
+
32
+ ```
33
+ ╔══════════════════════════════════════════════════╗
34
+ ║ ACE > Map System Doc ║
35
+ ╚══════════════════════════════════════════════════╝
36
+ ```
37
+ </substep>
38
+
39
+ <substep order="1.2" name="parse-and-validate">
40
+ Parse $ARGUMENTS for: `text`, `subsystem`, `story-context`, `commits`.
41
+
42
+ **If `text` is missing:** Ask the user:
43
+ - header: "System Doc"
44
+ - question: "Describe the system to document — what domain concern does it address?\nE.g., 'Drawing system - manages all drawing tools on the chart'"
45
+
46
+ **If `subsystem` is missing:** Ask the user:
47
+ - header: "System Doc"
48
+ - question: "Which subsystem does this system belong to?"
49
+ </substep>
50
+
51
+ <substep order="1.3" name="resolve-subsystem">
52
+ Resolve the subsystem. Check if `.docs/wiki/subsystems/[subsystem-name]/` exists.
53
+
54
+ **If not found:**
55
+ ```
56
+ ! No wiki found for subsystem "[subsystem]".
57
+ Run /ace:map-subsystem first to create the subsystem wiki.
58
+ ```
59
+ Exit.
60
+
61
+ Ensure systems directory exists:
62
+ ```bash
63
+ mkdir -p .docs/wiki/subsystems/[subsystem_name]/systems
64
+ ```
65
+ </substep>
66
+
67
+ Display:
68
+ ```
69
+ i System: [text description]
70
+ Subsystem: [subsystem-name]
71
+ Story context: [path/issue, or "none"]
72
+ Commits: [value, or "search codebase directly"]
73
+ ```
74
+
75
+ Continue to step 2.
76
+ </step>
77
+
78
+ <!-- ══════════════════════════════════════════════════════════════════ -->
79
+ <!-- STEP 2: CHECK FOR EXISTING SYSTEM DOC -->
80
+ <!-- ══════════════════════════════════════════════════════════════════ -->
81
+
82
+ <step name="check-existing" order="2">
83
+
84
+ Scan for existing system docs:
85
+
86
+ ```
87
+ Glob(pattern='*.md', path='.docs/wiki/subsystems/[subsystem_name]/systems')
88
+ ```
89
+
90
+ **If existing system docs found:**
91
+ Read their titles and overview sections. Check if any covers the same
92
+ or overlapping domain concern.
93
+
94
+ **If overlap detected:**
95
+ Use AskUserQuestion:
96
+ - header: "System Doc"
97
+ - question: "An existing system doc may cover a similar concern:\n\n- `[existing-file]`: [title]\n\nShould I update the existing doc or create a new one?"
98
+ - options:
99
+ - "Update existing" — set MODE = update, set TARGET_FILE = existing path
100
+ - "Create new" — set MODE = create
101
+
102
+ **If no overlap or no existing docs:** Set MODE = create.
103
+
104
+ **If MODE = create:**
105
+ Derive file name from the system description in kebab-case.
106
+ Set TARGET_FILE = `.docs/wiki/subsystems/[subsystem_name]/systems/[system-name].md`
107
+
108
+ Continue to step 3.
109
+ </step>
110
+
111
+ <!-- ══════════════════════════════════════════════════════════════════ -->
112
+ <!-- STEP 3: GATHER CODE CONTEXT -->
113
+ <!-- ══════════════════════════════════════════════════════════════════ -->
114
+
115
+ <step name="gather-context" order="3">
116
+
117
+ <substep order="3.1" name="read-story-context">
118
+ <variant condition="story-context is a path">
119
+ Read all markdown files in the story artifacts folder.
120
+ Extract a brief summary of intent: what was built and why.
121
+ </variant>
122
+
123
+ <variant condition="story-context is a GitHub issue">
124
+ ```bash
125
+ gh issue view [issue-number] --json title,body,labels,comments
126
+ ```
127
+ Extract a brief summary of intent from the issue.
128
+ </variant>
129
+
130
+ <variant condition="no story-context">
131
+ Skip — rely on code analysis only.
132
+ </variant>
133
+ </substep>
134
+
135
+ <substep order="3.2" name="collect-relevant-files">
136
+ <variant condition="commits provided as number N">
137
+ ```bash
138
+ git diff --name-only HEAD~[N]..HEAD
139
+ ```
140
+ Filter to files within the subsystem. Read each file.
141
+ </variant>
142
+
143
+ <variant condition="commits provided as SHAs">
144
+ ```bash
145
+ git diff --name-only [first-sha]^..[last-sha]
146
+ ```
147
+ Filter to files within the subsystem. Read each file.
148
+ </variant>
149
+
150
+ <variant condition="no commits — search codebase directly">
151
+ Use the `text` description to identify the system's files:
152
+
153
+ 1. Read the subsystem's structure.md and architecture.md for orientation
154
+ 2. Grep for keywords from the text description (class names, domain terms)
155
+ 3. Follow imports/references to find all files belonging to this system
156
+ 4. Read each discovered file
157
+
158
+ **Be thorough.** A system doc covers an entire domain concern.
159
+ Follow class hierarchies, interface implementations, DI registrations,
160
+ and cross-references until you have the complete picture.
161
+ </variant>
162
+ </substep>
163
+
164
+ <substep order="3.3" name="analyze-system">
165
+ For every source file found, understand:
166
+
167
+ - Class hierarchies and interface implementations
168
+ - Entry points (API endpoints, event handlers, user actions)
169
+ - Data flow through all layers (trace E2E for sequence diagrams)
170
+ - State management (Redux, local state, database)
171
+ - Constants, enums, and configuration
172
+ - Integration points (imports from other systems, events)
173
+ - Error handling and propagation
174
+ - DI registrations, factory/registry entries
175
+
176
+ Build a mental model of the complete system.
177
+ </substep>
178
+
179
+ Continue to step 4.
180
+ </step>
181
+
182
+ <!-- ══════════════════════════════════════════════════════════════════ -->
183
+ <!-- STEP 4: WRITE THE SYSTEM DOC -->
184
+ <!-- ══════════════════════════════════════════════════════════════════ -->
185
+
186
+ <step name="write-doc" order="4">
187
+
188
+ Read ALL existing wiki docs under `.docs/wiki/subsystems/[subsystem_name]/`
189
+ for cross-referencing in the Related Systems section.
190
+
191
+ Follow the system template structure exactly.
192
+
193
+ <substep order="4.1" name="write-overview-and-file-tree">
194
+ - Overview: ONE paragraph — what the system DOES, why it exists
195
+ - File Tree: ALL files belonging to this system with purpose annotations (ASCII only)
196
+ </substep>
197
+
198
+ <substep order="4.2" name="write-system-boundary">
199
+ Build a mermaid graph diagram showing what is INSIDE vs OUTSIDE this system.
200
+ </substep>
201
+
202
+ <substep order="4.3" name="write-class-hierarchy">
203
+ Build a mermaid classDiagram for inheritance chains and interface implementations.
204
+ Include key contracts inline (interfaces/types only).
205
+ Omit if hierarchy is trivial (1 class, no inheritance).
206
+ </substep>
207
+
208
+ <substep order="4.4" name="write-entry-points">
209
+ List every "front door" into this system with `file:ClassName.method` references.
210
+ </substep>
211
+
212
+ <substep order="4.5" name="write-data-flow">
213
+ **MANDATORY — never skip.**
214
+ Write at least one mermaid sequenceDiagram showing complete E2E data flow.
215
+ One diagram per key behavior (1-5 behaviors typically).
216
+ Show COMPLETE flow from entry point through all layers to data store and back.
217
+ </substep>
218
+
219
+ <substep order="4.6" name="write-remaining-sections">
220
+ Write all remaining applicable sections from the template:
221
+ - Components (location, purpose, key interface)
222
+ - Key Behaviors (trigger, logic, effect)
223
+ - State Management (where, what shape, transitions)
224
+ - Error Propagation (throw/catch chain)
225
+ - Constants and Enums (exact file paths — agents must never hardcode)
226
+ - Related Systems (cross-reference with markdown links)
227
+ - Integration Points
228
+ - Configuration and Options
229
+ - Database (only if applicable)
230
+ - Gotchas
231
+
232
+ Omit sections that genuinely don't apply. NEVER omit Data Flow.
233
+ </substep>
234
+
235
+ <substep order="4.7" name="write-or-update">
236
+ **If MODE = create:** Write the complete document to TARGET_FILE.
237
+ **If MODE = update:** Read the existing doc, ADD/expand sections,
238
+ preserve unchanged content, match existing style, write to TARGET_FILE.
239
+ </substep>
240
+
241
+ Continue to step 5.
242
+ </step>
243
+
244
+ <!-- ══════════════════════════════════════════════════════════════════ -->
245
+ <!-- STEP 5: VERIFY, COMMIT, AND REPORT -->
246
+ <!-- ══════════════════════════════════════════════════════════════════ -->
247
+
248
+ <step name="verify-and-report" order="5">
249
+
250
+ <substep order="5.1" name="quality-check">
251
+ Re-read TARGET_FILE and verify:
252
+
253
+ <verification-checklist>
254
+ <check>50+ lines of substantial content</check>
255
+ <check>Overview present (ONE paragraph)</check>
256
+ <check>File Tree present with purpose annotations (ASCII only)</check>
257
+ <check>System Boundary mermaid diagram present</check>
258
+ <check>At least one mermaid sequenceDiagram in Data Flow section (MANDATORY)</check>
259
+ <check>Entry Points listed with file:Symbol references</check>
260
+ <check>Components listed with location, purpose, key interface</check>
261
+ <check>Constants and Enums locations documented</check>
262
+ <check>Code references use `file:Symbol` format, not line numbers</check>
263
+ <check>No pseudocode, no fabricated code, no filler phrases</check>
264
+ <check>No ASCII arrows for architecture/flows (all mermaid)</check>
265
+ <check>Related Systems cross-referenced with markdown links</check>
266
+ </verification-checklist>
267
+
268
+ Fix any failures by editing the document directly.
269
+ </substep>
270
+
271
+ <substep order="5.2" name="security-scan">
272
+ ```
273
+ Grep(
274
+ pattern="(sk-[a-zA-Z0-9]{20,}|sk_live_|sk_test_|ghp_[a-zA-Z0-9]{36}|AKIA[A-Z0-9]{16}|-----BEGIN.*PRIVATE KEY)",
275
+ path="[TARGET_FILE]",
276
+ output_mode="content"
277
+ )
278
+ ```
279
+
280
+ <variant condition="matches found">SECRETS_FOUND — alert user, do NOT commit.</variant>
281
+ <variant condition="no matches">CLEAN.</variant>
282
+ </substep>
283
+
284
+ <substep order="5.3" name="commit">
285
+ ```bash
286
+ git add [TARGET_FILE]
287
+ git commit -m "docs([subsystem_name]): add system doc — [system-name]"
288
+ ```
289
+ </substep>
290
+
291
+ <substep order="5.4" name="report">
292
+ Display:
293
+
294
+ ```
295
+ ╔══════════════════════════════════════════════════╗
296
+ ║ ACE > Map System Doc > Complete ║
297
+ ╚══════════════════════════════════════════════════╝
298
+
299
+ + [TARGET_FILE] ([line count] lines)
300
+
301
+ System: [text description]
302
+ Sections: [list of sections written]
303
+ Sequence diagrams: [count]
304
+
305
+ Next > /clear first for a fresh context window, then:
306
+
307
+ /ace:map-sys-doc — create another system document
308
+ /ace:map-pattern — document a pattern used by this system
309
+ /ace:map-guide — create a how-to guide for this system
310
+ Review file at [TARGET_FILE]
311
+ ```
312
+ </substep>
313
+
314
+ End workflow.
315
+ </step>
316
+
317
+ </process>
318
+
319
+ <success_criteria>
320
+ <criterion>System description parsed and subsystem validated</criterion>
321
+ <criterion>Relevant source files discovered (from commits or codebase search)</criterion>
322
+ <criterion>All source files read and analyzed for components, flows, state, errors</criterion>
323
+ <criterion>Existing docs checked to avoid duplication (create vs update decision)</criterion>
324
+ <criterion>System doc follows template structure from system.xml</criterion>
325
+ <criterion>At least one mermaid sequenceDiagram present (E2E flow mandatory)</criterion>
326
+ <criterion>System boundary mermaid diagram present</criterion>
327
+ <criterion>File tree uses ASCII only, no Unicode box-drawing</criterion>
328
+ <criterion>All diagrams use mermaid, no ASCII arrows for architecture/flows</criterion>
329
+ <criterion>Code references use file:Symbol format, no line numbers</criterion>
330
+ <criterion>Constants and enums locations documented</criterion>
331
+ <criterion>Related systems cross-referenced with markdown links</criterion>
332
+ <criterion>No filler, no pseudocode, no fabricated code</criterion>
333
+ <criterion>Security scan passed, document committed</criterion>
334
+ </success_criteria>
335
+
336
+ </workflow>
@@ -0,0 +1,85 @@
1
+ ---
2
+ name: map-system
3
+ description: Map system-wide codebase structure, architecture, and testing framework into .docs/wiki/system-wide/
4
+ argument-hint: "[optional: references='existing artifacts and documents to be considered alongside the codebase']"
5
+ disable-model-invocation: true
6
+ allowed-tools: Read, Bash, Glob, Grep, Write, Task, AskUserQuestion
7
+ model: opus
8
+ effort: max
9
+ ---
10
+
11
+ # Map System
12
+
13
+ Map system-wide codebase structure, architecture, and testing framework into .docs/wiki/system-wide/.
14
+
15
+ ## When to Use
16
+
17
+ - Before `/ace:help` (brownfield codebases) — understand existing code first
18
+ - After `/ace:help` (greenfield codebases) — document architecture decisions
19
+ - Anytime to refresh system-wide wiki documents
20
+ - Onboarding to an existing codebase (brownfield — analyzes code automatically)
21
+ - Starting a new project and need to document architecture decisions (greenfield — interviews you)
22
+ - System-wide documents are stale or missing
23
+ - After major refactoring that changed subsystem boundaries or tech stack
24
+
25
+ ## Input
26
+
27
+ ### Optional
28
+
29
+ - **`references`** — Existing architecture docs, ADRs, or design notes to consider alongside the codebase analysis. Absorbed before analysis begins.
30
+
31
+ ## Environment Context (preprocessed)
32
+
33
+ !`node "${CLAUDE_SKILL_DIR}/script.js" init "$ARGUMENTS" 2>/dev/null`
34
+
35
+ ## Supporting Resources
36
+
37
+ Read ALL of these before starting the workflow:
38
+
39
+ - **Workflow**: Read [workflow.xml](workflow.xml) — complete orchestration process with all steps
40
+ - **System structure template**: Read [templates/system-structure.xml](templates/system-structure.xml) — output format for system structure
41
+ - **System architecture template**: Read [templates/system-architecture.xml](templates/system-architecture.xml) — output format for system architecture
42
+ - **Testing framework template**: Read [templates/testing-framework.xml](templates/testing-framework.xml) — output format for testing framework
43
+ - **Wiki readme template**: Read [templates/wiki-readme.xml](templates/wiki-readme.xml) — output format for wiki readme
44
+ - **Questioning guide**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/questioning.xml` — deep questioning techniques
45
+ - **UI formatting**: Read `${CLAUDE_SKILL_DIR}/../../shared/utils/ui-formatting.md` — ACE output formatting rules
46
+
47
+ ## Process
48
+
49
+ Use the `ace-wiki-mapper` agent for codebase analysis and document generation.
50
+
51
+ 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.
52
+
53
+ Read all supporting resources listed above, then execute the workflow defined in [workflow.xml](workflow.xml) end-to-end. Preserve all workflow gates (validation, user questions, commits).
54
+
55
+ ## Artifacts
56
+
57
+ ```
58
+ .docs/wiki/wiki-readme.md (created if not already present)
59
+ .docs/wiki/system-wide/system-structure.md
60
+ .docs/wiki/system-wide/system-architecture.md
61
+ .docs/wiki/system-wide/testing-framework.md
62
+ CLAUDE.md (wiki maintenance instructions appended)
63
+ ```
64
+
65
+ ## Example Usage
66
+
67
+ ```
68
+ # Map system from codebase analysis (brownfield)
69
+ /ace:map-system
70
+
71
+ # Map system with reference docs
72
+ /ace:map-system references="docs/architecture-decisions/"
73
+
74
+ # Refresh system-wide wiki after refactoring
75
+ /ace:map-system
76
+ ```
77
+
78
+ ## Next Steps
79
+
80
+ After this command, `/clear` first for a fresh context window, then:
81
+
82
+ - `/ace:map-subsystem subsystem="src/api"` — Map individual subsystem internals
83
+ - `/ace:init-coding-standards` — Define prescriptive coding standards
84
+ - `/ace:help` — Check project initialization status and next steps
85
+ - Review and edit files in `.docs/wiki/system-wide/` anytime
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * map-system skill script — Entry point for ace-tools operations
5
+ * needed by the map-system skill.
6
+ *
7
+ * Subcommands:
8
+ * init [args] Environment detection for map-system workflow
9
+ *
10
+ * Usage: node script.js <subcommand> [args] [--raw]
11
+ */
12
+
13
+ const fs = require('fs');
14
+ const path = require('path');
15
+
16
+ const {
17
+ loadConfig, pathExists, resolveModel,
18
+ detectBrownfieldStatus, output, error,
19
+ } = require('../../shared/lib/ace-core');
20
+
21
+ // ─── CLI Dispatch ────────────────────────────────────────────────────────────
22
+
23
+ const cwd = process.cwd();
24
+ const args = process.argv.slice(2);
25
+ const raw = args.includes('--raw');
26
+ const cmd = args[0];
27
+
28
+ switch (cmd) {
29
+ case 'init':
30
+ cmdInit(cwd, raw, args.slice(1).filter(a => a !== '--raw'));
31
+ break;
32
+ default:
33
+ error(`Unknown command: ${cmd}\nAvailable: init`);
34
+ }
35
+
36
+ // ─── Init: Map System ───────────────────────────────────────────────────────
37
+
38
+ function cmdInit(cwd, raw) {
39
+ const config = loadConfig(cwd);
40
+ const brownfield = detectBrownfieldStatus(cwd);
41
+
42
+ // Check existing wiki documents
43
+ const wikiDir = '.docs/wiki/system-wide';
44
+ const wikiDirExists = pathExists(cwd, wikiDir);
45
+
46
+ const has_system_structure = pathExists(cwd, path.join(wikiDir, 'system-structure.md'));
47
+ const has_system_architecture = pathExists(cwd, path.join(wikiDir, 'system-architecture.md'));
48
+ const has_testing_framework = pathExists(cwd, path.join(wikiDir, 'testing-framework.md'));
49
+ const has_coding_standards = pathExists(cwd, path.join(wikiDir, 'coding-standards.md'));
50
+
51
+ // List existing wiki files if directory exists
52
+ let existing_wiki_files = [];
53
+ if (wikiDirExists) {
54
+ try {
55
+ existing_wiki_files = fs.readdirSync(path.join(cwd, wikiDir)).filter(f => f.endsWith('.md'));
56
+ } catch {}
57
+ }
58
+
59
+ const result = {
60
+ // Models
61
+ mapper_model: resolveModel(cwd, 'ace-wiki-mapper'),
62
+
63
+ // Config
64
+ commit_docs: config.commit_docs,
65
+
66
+ // Brownfield detection
67
+ ...brownfield,
68
+
69
+ // Wiki directory state
70
+ wiki_dir_exists: wikiDirExists,
71
+ existing_wiki_files,
72
+
73
+ // Per-document existence
74
+ has_system_structure,
75
+ has_system_architecture,
76
+ has_testing_framework,
77
+ has_coding_standards,
78
+
79
+ // Git state
80
+ has_git: pathExists(cwd, '.git'),
81
+ };
82
+
83
+ output(result, raw);
84
+ }
@@ -0,0 +1,73 @@
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
+ function createTestProject() {
11
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ace-test-'));
12
+
13
+ const aceDir = path.join(tmpDir, '.ace');
14
+ fs.mkdirSync(aceDir, { recursive: true });
15
+ fs.writeFileSync(path.join(aceDir, 'config.json'), JSON.stringify({
16
+ version: '0.1.0',
17
+ projectName: 'test-project',
18
+ model_profile: 'quality',
19
+ commit_docs: true,
20
+ github: { enabled: false },
21
+ }, null, 2));
22
+
23
+ return tmpDir;
24
+ }
25
+
26
+ function runScript(subcommand, args, cwd) {
27
+ return execSync(`node "${SCRIPT}" ${subcommand} ${args}`, {
28
+ cwd,
29
+ encoding: 'utf-8',
30
+ timeout: 10000,
31
+ });
32
+ }
33
+
34
+ function cleanup(tmpDir) {
35
+ fs.rmSync(tmpDir, { recursive: true, force: true });
36
+ }
37
+
38
+ describe('map-system script', () => {
39
+ it('errors on unknown command', () => {
40
+ assert.throws(() => {
41
+ execSync(`node "${SCRIPT}" bogus`, { encoding: 'utf-8', stdio: 'pipe' });
42
+ });
43
+ });
44
+
45
+ describe('init', () => {
46
+ let tmpDir;
47
+
48
+ before(() => { tmpDir = createTestProject(); });
49
+ after(() => { cleanup(tmpDir); });
50
+
51
+ it('init returns valid JSON', () => {
52
+ const result = JSON.parse(runScript('init', '', tmpDir));
53
+ assert.ok(typeof result === 'object');
54
+ assert.ok(result.mapper_model, 'should have mapper_model');
55
+ assert.strictEqual(typeof result.commit_docs, 'boolean');
56
+ assert.strictEqual(typeof result.has_git, 'boolean');
57
+ assert.strictEqual(typeof result.is_brownfield, 'boolean');
58
+ assert.strictEqual(typeof result.wiki_dir_exists, 'boolean');
59
+ assert.ok(Array.isArray(result.existing_wiki_files), 'should have existing_wiki_files array');
60
+ assert.strictEqual(typeof result.has_system_structure, 'boolean');
61
+ assert.strictEqual(typeof result.has_system_architecture, 'boolean');
62
+ assert.strictEqual(typeof result.has_testing_framework, 'boolean');
63
+ assert.strictEqual(typeof result.has_coding_standards, 'boolean');
64
+ });
65
+
66
+ it('returns brownfield detection fields', () => {
67
+ const result = JSON.parse(runScript('init', '', tmpDir));
68
+ assert.strictEqual(typeof result.is_brownfield, 'boolean');
69
+ assert.strictEqual(typeof result.is_greenfield, 'boolean');
70
+ assert.strictEqual(result.is_brownfield, !result.is_greenfield);
71
+ });
72
+ });
73
+ });