@rryando/arcs 4.0.0 → 4.2.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.
- package/README.md +18 -20
- package/dist/cli/arcs-flash.d.ts +1 -1
- package/dist/cli/arcs-flash.d.ts.map +1 -1
- package/dist/cli/arcs-flash.js +9 -50
- package/dist/cli/arcs-flash.js.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.d.ts +2 -2
- package/dist/cli/arcs-orchestrate-caveman.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate-caveman.js +2 -8
- package/dist/cli/arcs-orchestrate-caveman.js.map +1 -1
- package/dist/cli/arcs-orchestrate.d.ts +1 -1
- package/dist/cli/arcs-orchestrate.d.ts.map +1 -1
- package/dist/cli/arcs-orchestrate.js +4 -54
- package/dist/cli/arcs-orchestrate.js.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.d.ts +10 -30
- package/dist/cli/orchestrator-shared-blocks.d.ts.map +1 -1
- package/dist/cli/orchestrator-shared-blocks.js +46 -128
- package/dist/cli/orchestrator-shared-blocks.js.map +1 -1
- package/dist/utils/claude-code-hook-install.d.ts.map +1 -1
- package/dist/utils/claude-code-hook-install.js +3 -2
- package/dist/utils/claude-code-hook-install.js.map +1 -1
- package/dist/utils/diagram-generator.d.ts.map +1 -1
- package/dist/utils/diagram-generator.js +11 -6
- package/dist/utils/diagram-generator.js.map +1 -1
- package/dist/utils/hook-token-store.d.ts +5 -3
- package/dist/utils/hook-token-store.d.ts.map +1 -1
- package/dist/utils/hook-token-store.js +5 -3
- package/dist/utils/hook-token-store.js.map +1 -1
- package/dist/utils/session-store.d.ts +9 -57
- package/dist/utils/session-store.d.ts.map +1 -1
- package/dist/utils/session-store.js +19 -92
- package/dist/utils/session-store.js.map +1 -1
- package/dist/utils/storage-utils.d.ts +1 -1
- package/dist/utils/storage-utils.d.ts.map +1 -1
- package/dist/utils/storage-utils.js +1 -1
- package/dist/utils/storage-utils.js.map +1 -1
- package/dist/web-client/assets/{GraphCanvas-CTyf_XXQ.js → GraphCanvas-BPDgvsyT.js} +1 -1
- package/dist/web-client/assets/{MarkdownEditor-af2vwQOX.js → MarkdownEditor-D7TLp78z.js} +1 -1
- package/dist/web-client/assets/{abnfDiagram-VRR7QNED-CdxcKX9t.js → abnfDiagram-VRR7QNED-CyuP2N9t.js} +1 -1
- package/dist/web-client/assets/architecture-TIHT7OUA-Bdo2Yvm9.js +1 -0
- package/dist/web-client/assets/{architectureDiagram-ZJ3FMSHR-DOISDv6o.js → architectureDiagram-ZJ3FMSHR-DZ0ul9QX.js} +1 -1
- package/dist/web-client/assets/{blockDiagram-677ZJIJ3-DKwtbttM.js → blockDiagram-677ZJIJ3-LLGzlc9l.js} +1 -1
- package/dist/web-client/assets/{c4Diagram-LMCZKHZV-CilqK-Mm.js → c4Diagram-LMCZKHZV-CViu3CTc.js} +1 -1
- package/dist/web-client/assets/channel-DBNmizpo.js +1 -0
- package/dist/web-client/assets/{chunk-32BRIVSS-C79m1mkG.js → chunk-32BRIVSS-Bw_IuJCM.js} +1 -1
- package/dist/web-client/assets/{chunk-52WLFC77-C6WelGWJ.js → chunk-52WLFC77-C29h440W.js} +1 -1
- package/dist/web-client/assets/{chunk-C7G6YPKG-DLg7ryWI.js → chunk-C7G6YPKG-hhOrvw5w.js} +1 -1
- package/dist/web-client/assets/{chunk-EX3LRPZG-DjWgo4gL.js → chunk-EX3LRPZG-COMzol-M.js} +1 -1
- package/dist/web-client/assets/{chunk-FWX5IMBZ-BgS9p_zy.js → chunk-FWX5IMBZ-6vdX9EUn.js} +2 -2
- package/dist/web-client/assets/{chunk-HOUHSVGY-DuVR7dZO.js → chunk-HOUHSVGY-DWDW6sxp.js} +1 -1
- package/dist/web-client/assets/{chunk-ICXQ74PX-Y8DlnIJM.js → chunk-ICXQ74PX-BdMYglo2.js} +1 -1
- package/dist/web-client/assets/{chunk-MOJQB5TN-BEM3QgeD.js → chunk-MOJQB5TN-C0LAX_dC.js} +1 -1
- package/dist/web-client/assets/{chunk-OGEWGWER-DlM8LxGr.js → chunk-OGEWGWER-CBx8MB7f.js} +1 -1
- package/dist/web-client/assets/{chunk-PUDLZKDR-c6cqNVTx.js → chunk-PUDLZKDR-DKssR1nf.js} +1 -1
- package/dist/web-client/assets/{chunk-Q4XR5HBZ-C5lNmcka.js → chunk-Q4XR5HBZ-B3kcxFE-.js} +1 -1
- package/dist/web-client/assets/{chunk-V7JOEXUC-nSswxvSG.js → chunk-V7JOEXUC-CAlymndy.js} +1 -1
- package/dist/web-client/assets/{chunk-VAUOI2AC-CqJkCkT0.js → chunk-VAUOI2AC-BowfsmTW.js} +1 -1
- package/dist/web-client/assets/{chunk-VR4S4FIN-D3pFchin.js → chunk-VR4S4FIN-BBOydgvt.js} +1 -1
- package/dist/web-client/assets/{chunk-WYO6CB5R-BI9c-NzI.js → chunk-WYO6CB5R-DcymFbES.js} +1 -1
- package/dist/web-client/assets/{chunk-ZGVPDNZ5-CKTF2kLR.js → chunk-ZGVPDNZ5--uKFP-Lr.js} +1 -1
- package/dist/web-client/assets/classDiagram-OUVF2IWQ-CB3HiA1_.js +1 -0
- package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-CB3HiA1_.js +1 -0
- package/dist/web-client/assets/{cynefin-VYW2F7L2-BrJrnfh1.js → cynefin-VYW2F7L2-CjboUOMA.js} +1 -1
- package/dist/web-client/assets/{cynefinDiagram-TSTJHNR4-9jYzPWJZ.js → cynefinDiagram-TSTJHNR4-BcxygBP7.js} +1 -1
- package/dist/web-client/assets/{dagre-VKFMJZFB-B705Djpu.js → dagre-VKFMJZFB-D-tiERQE.js} +1 -1
- package/dist/web-client/assets/{diagram-FQU43EPY-BfQAlUlJ.js → diagram-FQU43EPY-ChPXczaS.js} +1 -1
- package/dist/web-client/assets/{diagram-G47NLZAW-s1YDe06A.js → diagram-G47NLZAW-CVL3Y91h.js} +1 -1
- package/dist/web-client/assets/{diagram-NH7WQ7WH-Dy3z11Hc.js → diagram-NH7WQ7WH-DsaNA9Lh.js} +1 -1
- package/dist/web-client/assets/{diagram-OA4YK3LP-Bius2xUN.js → diagram-OA4YK3LP-CXhrhdhU.js} +1 -1
- package/dist/web-client/assets/{diagram-WEI45ONY-D7x4VcHM.js → diagram-WEI45ONY-BTVPnk4E.js} +1 -1
- package/dist/web-client/assets/{ebnfDiagram-CCIWWBDH-CBg1xrmD.js → ebnfDiagram-CCIWWBDH-BAyrRBtM.js} +1 -1
- package/dist/web-client/assets/{erDiagram-Q63AITRT-CJRvTFvd.js → erDiagram-Q63AITRT-Qm24Wepm.js} +1 -1
- package/dist/web-client/assets/eventmodeling-45OFAUF4-DoTBIvl5.js +1 -0
- package/dist/web-client/assets/flowDiagram-23GEKE2U-BEH23L1A.js +1 -0
- package/dist/web-client/assets/{ganttDiagram-NO4QXBWP-C_LsypZ4.js → ganttDiagram-NO4QXBWP-D8h7l3XJ.js} +1 -1
- package/dist/web-client/assets/{gitGraph-TEB2WS4Q-Dx2XxdGk.js → gitGraph-TEB2WS4Q-DIBml1SB.js} +1 -1
- package/dist/web-client/assets/{gitGraphDiagram-IHSO6WYX-DiKWkGWQ.js → gitGraphDiagram-IHSO6WYX-CtkYoXjn.js} +1 -1
- package/dist/web-client/assets/{index-CYwhkPtc.js → index-DOSH4Q9H.js} +38 -38
- package/dist/web-client/assets/{info-DKCQHKI2-DORwHenK.js → info-DKCQHKI2-DLEUtV5Q.js} +1 -1
- package/dist/web-client/assets/{infoDiagram-FWYZ7A6U-CQecXS1E.js → infoDiagram-FWYZ7A6U-BJQ7aQux.js} +1 -1
- package/dist/web-client/assets/{ishikawaDiagram-FXEZZL3T-CWhj60Zp.js → ishikawaDiagram-FXEZZL3T-BPM11FvG.js} +1 -1
- package/dist/web-client/assets/{journeyDiagram-5HDEW3XC-Cj3z2U8u.js → journeyDiagram-5HDEW3XC-C0aX2z3c.js} +1 -1
- package/dist/web-client/assets/{kanban-definition-HUTT4EX6-DFmBRenP.js → kanban-definition-HUTT4EX6-C56F29Ib.js} +1 -1
- package/dist/web-client/assets/{line-C_Hxz9xb.js → line-BLFHLF2N.js} +1 -1
- package/dist/web-client/assets/{mermaid-parser.core-E3xRdzPn.js → mermaid-parser.core-BLC8FhgU.js} +3 -3
- package/dist/web-client/assets/{mermaid.core-C2_CcotH.js → mermaid.core-BBqkKuXt.js} +3 -3
- package/dist/web-client/assets/{mindmap-definition-LN4V7U3C-Bs7VxPid.js → mindmap-definition-LN4V7U3C-aVZbsoPc.js} +1 -1
- package/dist/web-client/assets/{packet-7NZHBO7P-D2nqso7i.js → packet-7NZHBO7P-D4aqSQfB.js} +1 -1
- package/dist/web-client/assets/{pegDiagram-2B236MQR-Cepo1sIu.js → pegDiagram-2B236MQR-DjfyNI0U.js} +1 -1
- package/dist/web-client/assets/{pie-RZYD4A2V-Sx0IGbXt.js → pie-RZYD4A2V-ChCwYsYj.js} +1 -1
- package/dist/web-client/assets/{pieDiagram-ENE6RG2P-D-PMDNhk.js → pieDiagram-ENE6RG2P-BeHLKkXC.js} +1 -1
- package/dist/web-client/assets/{quadrantDiagram-ABIIQ3AL-BNGC7Fms.js → quadrantDiagram-ABIIQ3AL-stga3gvq.js} +1 -1
- package/dist/web-client/assets/{radar-I7S5WNFK-CFf_-2OC.js → radar-I7S5WNFK-DOGheiwT.js} +1 -1
- package/dist/web-client/assets/{railroad-3IZDKUUU-BvZeVRGh.js → railroad-3IZDKUUU-_JnU7M6L.js} +1 -1
- package/dist/web-client/assets/railroad-abnf-AHOZXSZD-nhNub7LE.js +1 -0
- package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-BlQYe7Yf.js +1 -0
- package/dist/web-client/assets/railroad-peg-LSFZ7HO6-B3E8pRVN.js +1 -0
- package/dist/web-client/assets/{railroadDiagram-RFXS5EU6-D0iK_k84.js → railroadDiagram-RFXS5EU6-C0CkMsOd.js} +1 -1
- package/dist/web-client/assets/{requirementDiagram-TGXJPOKE-BPdsw9tz.js → requirementDiagram-TGXJPOKE-DuImwoRD.js} +1 -1
- package/dist/web-client/assets/{sankeyDiagram-HTMAVEWB-maA6ukOJ.js → sankeyDiagram-HTMAVEWB-kprq0XF9.js} +1 -1
- package/dist/web-client/assets/{sequenceDiagram-DBY2YBRQ-DKmAjmgr.js → sequenceDiagram-DBY2YBRQ-DiXKJMF6.js} +1 -1
- package/dist/web-client/assets/{stateDiagram-2N3HPSRC-esxmzk3w.js → stateDiagram-2N3HPSRC-D5qbVStE.js} +1 -1
- package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-DWwTAG1r.js +1 -0
- package/dist/web-client/assets/{swimlanes-5IMT3BWC-DFd-wGBv.js → swimlanes-5IMT3BWC-DCbw389c.js} +1 -1
- package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DabrCsjZ.js +8 -0
- package/dist/web-client/assets/{timeline-definition-FHXFAJF6-C7SG8MQH.js → timeline-definition-FHXFAJF6-CQeaYN_9.js} +1 -1
- package/dist/web-client/assets/{treeView-QDETBFTQ-M0rhxbs2.js → treeView-QDETBFTQ-Cf7Sq3qo.js} +1 -1
- package/dist/web-client/assets/{treemap-6X3UGDF4-BQfkQxSh.js → treemap-6X3UGDF4-BovzvoTU.js} +1 -1
- package/dist/web-client/assets/{vennDiagram-L72KCM5P-CyIlb8ju.js → vennDiagram-L72KCM5P-CZsJy139.js} +1 -1
- package/dist/web-client/assets/{wardley-OPB4EBWU-EE-7q8M1.js → wardley-OPB4EBWU-DJ7MS6XZ.js} +1 -1
- package/dist/web-client/assets/{wardleyDiagram-EHGQE667-bY8XdYYS.js → wardleyDiagram-EHGQE667-rqhcmsbM.js} +1 -1
- package/dist/web-client/assets/{xychartDiagram-FW5EYKEG-AhuXJ3de.js → xychartDiagram-FW5EYKEG-HuK4Seps.js} +1 -1
- package/dist/web-client/index.html +1 -1
- package/dist/web-server/app.d.ts +2 -2
- package/dist/web-server/app.d.ts.map +1 -1
- package/dist/web-server/app.js +0 -3
- package/dist/web-server/app.js.map +1 -1
- package/dist/web-server/routes/hook-events.d.ts +6 -7
- package/dist/web-server/routes/hook-events.d.ts.map +1 -1
- package/dist/web-server/routes/hook-events.js +18 -22
- package/dist/web-server/routes/hook-events.js.map +1 -1
- package/dist/web-server/routes/sessions.d.ts +6 -8
- package/dist/web-server/routes/sessions.d.ts.map +1 -1
- package/dist/web-server/routes/sessions.js +27 -137
- package/dist/web-server/routes/sessions.js.map +1 -1
- package/opencode/arcs/bundle-runtime.json +0 -3
- package/opencode/arcs/manifest.json +8 -25
- package/opencode/arcs/prompts/arcs-docs.txt +19 -157
- package/opencode/arcs/prompts/arcs-flash.txt +49 -152
- package/opencode/arcs/prompts/arcs-orchestrate-caveman.txt +47 -165
- package/opencode/arcs/prompts/arcs-orchestrate.txt +46 -158
- package/opencode/arcs/prompts/code-reviewer.txt +20 -60
- package/opencode/arcs/prompts/graph-explorer.txt +19 -49
- package/opencode/arcs/prompts/software-engineer.txt +21 -67
- package/opencode/arcs/prompts/tech-architect.txt +20 -130
- package/opencode/arcs/skills/brainstorming/SKILL.md +20 -100
- package/opencode/arcs/skills/brainstorming/visual-companion.md +6 -264
- package/opencode/arcs/skills/caveman-commit/SKILL.md +6 -43
- package/opencode/arcs/skills/deep-pr-review/SKILL.md +18 -200
- package/opencode/arcs/skills/deep-pr-review/codegraph-diff.md +7 -93
- package/opencode/arcs/skills/deep-pr-review/review-template.md +13 -60
- package/opencode/arcs/skills/enriching-codegraph-proposals/SKILL.md +16 -156
- package/opencode/arcs/skills/implementation/SKILL.md +20 -46
- package/opencode/arcs/skills/init-project/SKILL.md +12 -150
- package/opencode/arcs/skills/install-claude-code-hook/SKILL.md +13 -133
- package/opencode/arcs/skills/systematic-debugging/SKILL.md +13 -152
- package/opencode/arcs/skills/systematic-debugging/condition-based-waiting.md +7 -110
- package/opencode/arcs/skills/systematic-debugging/defense-in-depth.md +7 -119
- package/opencode/arcs/skills/systematic-debugging/phases-reference.md +9 -166
- package/opencode/arcs/skills/systematic-debugging/root-cause-tracing.md +8 -165
- package/opencode/arcs/skills/test-driven-development/SKILL.md +10 -61
- package/opencode/arcs/skills/test-driven-development/tdd-rationalizations-and-examples.md +7 -154
- package/opencode/arcs/skills/test-driven-development/testing-anti-patterns.md +8 -295
- package/opencode/arcs/skills/to-diagram/SKILL.md +18 -206
- package/opencode/arcs/skills/writing-knowledge/SKILL.md +11 -63
- package/opencode/arcs/skills/writing-plans/SKILL.md +25 -118
- package/opencode/arcs/skills/writing-plans/plan-document-reviewer-prompt.md +10 -61
- package/package.json +1 -1
- package/scripts/claude-code-session-hook.mjs +16 -41
- package/skills/explore-dag.md +9 -52
- package/skills/init-project.md +9 -98
- package/skills/orchestrate.md +15 -109
- package/skills/update-docs.md +9 -60
- package/dist/web-client/assets/architecture-TIHT7OUA-Bt2-DmfV.js +0 -1
- package/dist/web-client/assets/channel-C2mb9np_.js +0 -1
- package/dist/web-client/assets/classDiagram-OUVF2IWQ-CPd_w3Zr.js +0 -1
- package/dist/web-client/assets/classDiagram-v2-EOCWNBFH-CPd_w3Zr.js +0 -1
- package/dist/web-client/assets/eventmodeling-45OFAUF4-CTKRC2Yj.js +0 -1
- package/dist/web-client/assets/flowDiagram-23GEKE2U-CaZjFyU1.js +0 -1
- package/dist/web-client/assets/railroad-abnf-AHOZXSZD-DnGh6x2O.js +0 -1
- package/dist/web-client/assets/railroad-ebnf-EBAXGLYW-CGfgCoaE.js +0 -1
- package/dist/web-client/assets/railroad-peg-LSFZ7HO6-BzQxYdqp.js +0 -1
- package/dist/web-client/assets/stateDiagram-v2-6OUMAXLB-hcBqlOLc.js +0 -1
- package/dist/web-client/assets/swimlanesDiagram-G3AALYLV-DbSrPBYr.js +0 -8
- package/dist/web-server/opencode-client.d.ts +0 -123
- package/dist/web-server/opencode-client.d.ts.map +0 -1
- package/dist/web-server/opencode-client.js +0 -514
- package/dist/web-server/opencode-client.js.map +0 -1
- package/opencode/arcs/prompts/devil-advocate.txt +0 -79
- package/opencode/arcs/skills/executing-plans/SKILL.md +0 -49
|
@@ -1,299 +1,12 @@
|
|
|
1
1
|
# Testing Anti-Patterns
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Avoid:
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
- tests that assert private call order instead of behavior;
|
|
6
|
+
- mocks that reproduce the implementation;
|
|
7
|
+
- broad snapshots with no meaningful contract;
|
|
8
|
+
- sleeps instead of observable conditions;
|
|
9
|
+
- one test covering several unrelated behaviors;
|
|
10
|
+
- adding tests solely to increase line coverage.
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**Core principle:** Test what the code does, not what the mocks do.
|
|
10
|
-
|
|
11
|
-
**Following strict TDD prevents these anti-patterns.**
|
|
12
|
-
|
|
13
|
-
## The Iron Laws
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
1. NEVER test mock behavior
|
|
17
|
-
2. NEVER add test-only methods to production classes
|
|
18
|
-
3. NEVER mock without understanding dependencies
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Anti-Pattern 1: Testing Mock Behavior
|
|
22
|
-
|
|
23
|
-
**The violation:**
|
|
24
|
-
```typescript
|
|
25
|
-
// ❌ BAD: Testing that the mock exists
|
|
26
|
-
test('renders sidebar', () => {
|
|
27
|
-
render(<Page />);
|
|
28
|
-
expect(screen.getByTestId('sidebar-mock')).toBeInTheDocument();
|
|
29
|
-
});
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
**Why this is wrong:**
|
|
33
|
-
- You're verifying the mock works, not that the component works
|
|
34
|
-
- Test passes when mock is present, fails when it's not
|
|
35
|
-
- Tells you nothing about real behavior
|
|
36
|
-
|
|
37
|
-
**your human partner's correction:** "Are we testing the behavior of a mock?"
|
|
38
|
-
|
|
39
|
-
**The fix:**
|
|
40
|
-
```typescript
|
|
41
|
-
// ✅ GOOD: Test real component or don't mock it
|
|
42
|
-
test('renders sidebar', () => {
|
|
43
|
-
render(<Page />); // Don't mock sidebar
|
|
44
|
-
expect(screen.getByRole('navigation')).toBeInTheDocument();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
// OR if sidebar must be mocked for isolation:
|
|
48
|
-
// Don't assert on the mock - test Page's behavior with sidebar present
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Gate Function
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
BEFORE asserting on any mock element:
|
|
55
|
-
Ask: "Am I testing real component behavior or just mock existence?"
|
|
56
|
-
|
|
57
|
-
IF testing mock existence:
|
|
58
|
-
STOP - Delete the assertion or unmock the component
|
|
59
|
-
|
|
60
|
-
Test real behavior instead
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Anti-Pattern 2: Test-Only Methods in Production
|
|
64
|
-
|
|
65
|
-
**The violation:**
|
|
66
|
-
```typescript
|
|
67
|
-
// ❌ BAD: destroy() only used in tests
|
|
68
|
-
class Session {
|
|
69
|
-
async destroy() { // Looks like production API!
|
|
70
|
-
await this._workspaceManager?.destroyWorkspace(this.id);
|
|
71
|
-
// ... cleanup
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// In tests
|
|
76
|
-
afterEach(() => session.destroy());
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
**Why this is wrong:**
|
|
80
|
-
- Production class polluted with test-only code
|
|
81
|
-
- Dangerous if accidentally called in production
|
|
82
|
-
- Violates YAGNI and separation of concerns
|
|
83
|
-
- Confuses object lifecycle with entity lifecycle
|
|
84
|
-
|
|
85
|
-
**The fix:**
|
|
86
|
-
```typescript
|
|
87
|
-
// ✅ GOOD: Test utilities handle test cleanup
|
|
88
|
-
// Session has no destroy() - it's stateless in production
|
|
89
|
-
|
|
90
|
-
// In test-utils/
|
|
91
|
-
export async function cleanupSession(session: Session) {
|
|
92
|
-
const workspace = session.getWorkspaceInfo();
|
|
93
|
-
if (workspace) {
|
|
94
|
-
await workspaceManager.destroyWorkspace(workspace.id);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
// In tests
|
|
99
|
-
afterEach(() => cleanupSession(session));
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Gate Function
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
BEFORE adding any method to production class:
|
|
106
|
-
Ask: "Is this only used by tests?"
|
|
107
|
-
|
|
108
|
-
IF yes:
|
|
109
|
-
STOP - Don't add it
|
|
110
|
-
Put it in test utilities instead
|
|
111
|
-
|
|
112
|
-
Ask: "Does this class own this resource's lifecycle?"
|
|
113
|
-
|
|
114
|
-
IF no:
|
|
115
|
-
STOP - Wrong class for this method
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Anti-Pattern 3: Mocking Without Understanding
|
|
119
|
-
|
|
120
|
-
**The violation:**
|
|
121
|
-
```typescript
|
|
122
|
-
// ❌ BAD: Mock breaks test logic
|
|
123
|
-
test('detects duplicate server', () => {
|
|
124
|
-
// Mock prevents config write that test depends on!
|
|
125
|
-
vi.mock('ToolCatalog', () => ({
|
|
126
|
-
discoverAndCacheTools: vi.fn().mockResolvedValue(undefined)
|
|
127
|
-
}));
|
|
128
|
-
|
|
129
|
-
await addServer(config);
|
|
130
|
-
await addServer(config); // Should throw - but won't!
|
|
131
|
-
});
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
**Why this is wrong:**
|
|
135
|
-
- Mocked method had side effect test depended on (writing config)
|
|
136
|
-
- Over-mocking to "be safe" breaks actual behavior
|
|
137
|
-
- Test passes for wrong reason or fails mysteriously
|
|
138
|
-
|
|
139
|
-
**The fix:**
|
|
140
|
-
```typescript
|
|
141
|
-
// ✅ GOOD: Mock at correct level
|
|
142
|
-
test('detects duplicate server', () => {
|
|
143
|
-
// Mock the slow part, preserve behavior test needs
|
|
144
|
-
vi.mock('MCPServerManager'); // Just mock slow server startup
|
|
145
|
-
|
|
146
|
-
await addServer(config); // Config written
|
|
147
|
-
await addServer(config); // Duplicate detected ✓
|
|
148
|
-
});
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Gate Function
|
|
152
|
-
|
|
153
|
-
```
|
|
154
|
-
BEFORE mocking any method:
|
|
155
|
-
STOP - Don't mock yet
|
|
156
|
-
|
|
157
|
-
1. Ask: "What side effects does the real method have?"
|
|
158
|
-
2. Ask: "Does this test depend on any of those side effects?"
|
|
159
|
-
3. Ask: "Do I fully understand what this test needs?"
|
|
160
|
-
|
|
161
|
-
IF depends on side effects:
|
|
162
|
-
Mock at lower level (the actual slow/external operation)
|
|
163
|
-
OR use test doubles that preserve necessary behavior
|
|
164
|
-
NOT the high-level method the test depends on
|
|
165
|
-
|
|
166
|
-
IF unsure what test depends on:
|
|
167
|
-
Run test with real implementation FIRST
|
|
168
|
-
Observe what actually needs to happen
|
|
169
|
-
THEN add minimal mocking at the right level
|
|
170
|
-
|
|
171
|
-
Red flags:
|
|
172
|
-
- "I'll mock this to be safe"
|
|
173
|
-
- "This might be slow, better mock it"
|
|
174
|
-
- Mocking without understanding the dependency chain
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
## Anti-Pattern 4: Incomplete Mocks
|
|
178
|
-
|
|
179
|
-
**The violation:**
|
|
180
|
-
```typescript
|
|
181
|
-
// ❌ BAD: Partial mock - only fields you think you need
|
|
182
|
-
const mockResponse = {
|
|
183
|
-
status: 'success',
|
|
184
|
-
data: { userId: '123', name: 'Alice' }
|
|
185
|
-
// Missing: metadata that downstream code uses
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// Later: breaks when code accesses response.metadata.requestId
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
**Why this is wrong:**
|
|
192
|
-
- **Partial mocks hide structural assumptions** - You only mocked fields you know about
|
|
193
|
-
- **Downstream code may depend on fields you didn't include** - Silent failures
|
|
194
|
-
- **Tests pass but integration fails** - Mock incomplete, real API complete
|
|
195
|
-
- **False confidence** - Test proves nothing about real behavior
|
|
196
|
-
|
|
197
|
-
**The Iron Rule:** Mock the COMPLETE data structure as it exists in reality, not just fields your immediate test uses.
|
|
198
|
-
|
|
199
|
-
**The fix:**
|
|
200
|
-
```typescript
|
|
201
|
-
// ✅ GOOD: Mirror real API completeness
|
|
202
|
-
const mockResponse = {
|
|
203
|
-
status: 'success',
|
|
204
|
-
data: { userId: '123', name: 'Alice' },
|
|
205
|
-
metadata: { requestId: 'req-789', timestamp: 1234567890 }
|
|
206
|
-
// All fields real API returns
|
|
207
|
-
};
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
### Gate Function
|
|
211
|
-
|
|
212
|
-
```
|
|
213
|
-
BEFORE creating mock responses:
|
|
214
|
-
Check: "What fields does the real API response contain?"
|
|
215
|
-
|
|
216
|
-
Actions:
|
|
217
|
-
1. Examine actual API response from docs/examples
|
|
218
|
-
2. Include ALL fields system might consume downstream
|
|
219
|
-
3. Verify mock matches real response schema completely
|
|
220
|
-
|
|
221
|
-
Critical:
|
|
222
|
-
If you're creating a mock, you must understand the ENTIRE structure
|
|
223
|
-
Partial mocks fail silently when code depends on omitted fields
|
|
224
|
-
|
|
225
|
-
If uncertain: Include all documented fields
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Anti-Pattern 5: Integration Tests as Afterthought
|
|
229
|
-
|
|
230
|
-
**The violation:**
|
|
231
|
-
```
|
|
232
|
-
✅ Implementation complete
|
|
233
|
-
❌ No tests written
|
|
234
|
-
"Ready for testing"
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Why this is wrong:**
|
|
238
|
-
- Testing is part of implementation, not optional follow-up
|
|
239
|
-
- TDD would have caught this
|
|
240
|
-
- Can't claim complete without tests
|
|
241
|
-
|
|
242
|
-
**The fix:**
|
|
243
|
-
```
|
|
244
|
-
TDD cycle:
|
|
245
|
-
1. Write failing test
|
|
246
|
-
2. Implement to pass
|
|
247
|
-
3. Refactor
|
|
248
|
-
4. THEN claim complete
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
## When Mocks Become Too Complex
|
|
252
|
-
|
|
253
|
-
**Warning signs:**
|
|
254
|
-
- Mock setup longer than test logic
|
|
255
|
-
- Mocking everything to make test pass
|
|
256
|
-
- Mocks missing methods real components have
|
|
257
|
-
- Test breaks when mock changes
|
|
258
|
-
|
|
259
|
-
**your human partner's question:** "Do we need to be using a mock here?"
|
|
260
|
-
|
|
261
|
-
**Consider:** Integration tests with real components often simpler than complex mocks
|
|
262
|
-
|
|
263
|
-
## TDD Prevents These Anti-Patterns
|
|
264
|
-
|
|
265
|
-
**Why TDD helps:**
|
|
266
|
-
1. **Write test first** → Forces you to think about what you're actually testing
|
|
267
|
-
2. **Watch it fail** → Confirms test tests real behavior, not mocks
|
|
268
|
-
3. **Minimal implementation** → No test-only methods creep in
|
|
269
|
-
4. **Real dependencies** → You see what the test actually needs before mocking
|
|
270
|
-
|
|
271
|
-
**If you're testing mock behavior, you violated TDD** - you added mocks without watching test fail against real code first.
|
|
272
|
-
|
|
273
|
-
## Quick Reference
|
|
274
|
-
|
|
275
|
-
| Anti-Pattern | Fix |
|
|
276
|
-
|--------------|-----|
|
|
277
|
-
| Assert on mock elements | Test real component or unmock it |
|
|
278
|
-
| Test-only methods in production | Move to test utilities |
|
|
279
|
-
| Mock without understanding | Understand dependencies first, mock minimally |
|
|
280
|
-
| Incomplete mocks | Mirror real API completely |
|
|
281
|
-
| Tests as afterthought | TDD - tests first |
|
|
282
|
-
| Over-complex mocks | Consider integration tests |
|
|
283
|
-
|
|
284
|
-
## Red Flags
|
|
285
|
-
|
|
286
|
-
- Assertion checks for `*-mock` test IDs
|
|
287
|
-
- Methods only called in test files
|
|
288
|
-
- Mock setup is >50% of test
|
|
289
|
-
- Test fails when you remove mock
|
|
290
|
-
- Can't explain why mock is needed
|
|
291
|
-
- Mocking "just to be safe"
|
|
292
|
-
|
|
293
|
-
## The Bottom Line
|
|
294
|
-
|
|
295
|
-
**Mocks are tools to isolate, not things to test.**
|
|
296
|
-
|
|
297
|
-
If TDD reveals you're testing mock behavior, you've gone wrong.
|
|
298
|
-
|
|
299
|
-
Fix: Test real behavior or question why you're mocking at all.
|
|
12
|
+
Prefer stable public boundaries, realistic inputs, clear failure messages, and the smallest check that proves the requirement.
|
|
@@ -1,220 +1,32 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: to-diagram
|
|
3
|
-
description:
|
|
3
|
+
description: Create or update a helper-managed Mermaid execution diagram
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Plan Diagrams
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Contract
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Task metadata is the source of truth. The `.diagram.mmd` file is derived data for execution order and status.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Use `manage-diagram.mjs` with the supported `flowchart TD` format. Prefer ARCS CLI wrappers:
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
- `arcs diagram init <slug> <planId>`
|
|
15
|
+
- `arcs diagram inspect <slug> <planId>`
|
|
16
|
+
- `arcs diagram ready <slug> <planId>`
|
|
17
|
+
- `arcs diagram status <slug> <planId> <node> <status>`
|
|
18
|
+
- `arcs diagram validate <slug> <planId>`
|
|
15
19
|
|
|
16
|
-
|
|
17
|
-
flowchart TD
|
|
18
|
-
classDef decision fill:#f59e0b,color:#fff
|
|
20
|
+
## Metadata
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
HasDiagram -->|No| Create[Create from canonical metadata]
|
|
22
|
-
HasDiagram -->|Yes| Detect[Compare diagram vs metadata]
|
|
23
|
-
Detect --> DriftType{Drift type?}
|
|
24
|
-
DriftType -->|None| Done[No action]
|
|
25
|
-
DriftType -->|Status only| StatusUpdate[Surgical status update]
|
|
26
|
-
DriftType -->|Scope change| Regen[Full regeneration]
|
|
27
|
-
DriftType -->|Mixed| Regen
|
|
28
|
-
Create --> Validate[Validate .mmd syntax]
|
|
29
|
-
StatusUpdate --> Validate
|
|
30
|
-
Regen --> Validate
|
|
31
|
-
Validate --> Write[Write .mmd]
|
|
32
|
-
Write --> Done
|
|
22
|
+
Each node uses stable `T001`-style IDs and records title, status, skill, work mode, scope, acceptance, verify command, and dependencies. Implementation tasks use `skill: implementation` with `work-mode: bounded|inspect`.
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
```
|
|
24
|
+
Dependencies come from task `dependsOn`; do not hand-maintain conflicting arrows. New plans begin in backlog. Use the standard `done`, `inProgress`, `blocked`, and `backlog` classes.
|
|
36
25
|
|
|
37
|
-
##
|
|
26
|
+
## Update
|
|
38
27
|
|
|
39
|
-
|
|
28
|
+
- Status-only change: use `arcs diagram status`.
|
|
29
|
+
- Scope, task, or dependency change: update task metadata, then regenerate.
|
|
30
|
+
- Always validate after every write.
|
|
40
31
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```mermaid
|
|
44
|
-
flowchart TD
|
|
45
|
-
Read[Read .mmd] --> Verify{Node/edge count matches metadata?}
|
|
46
|
-
Verify -->|No| Escalate[Escalate to regeneration]
|
|
47
|
-
Verify -->|Yes| UpdateClass[Replace :::oldClass with :::newClass]
|
|
48
|
-
UpdateClass --> UpdateHeader[Recalc plan-level %% comments]
|
|
49
|
-
UpdateHeader --> UpdateMeta[Update per-node %% status lines]
|
|
50
|
-
UpdateMeta --> VerifyByte{Node/edge sets byte-identical?}
|
|
51
|
-
VerifyByte -->|Yes| Write[Write .mmd]
|
|
52
|
-
VerifyByte -->|No| Escalate
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Scope-Change Regeneration
|
|
56
|
-
|
|
57
|
-
```mermaid
|
|
58
|
-
flowchart TD
|
|
59
|
-
ReadMeta[Read canonical metadata] --> MapIDs[Map existing task→node IDs]
|
|
60
|
-
MapIDs --> AssignNew[Assign T### for new tasks]
|
|
61
|
-
AssignNew --> Retire[Retire removed IDs, never reuse]
|
|
62
|
-
Retire --> BuildGraph[Build flowchart TD from deps]
|
|
63
|
-
BuildGraph --> GenNodeMeta[Generate per-node %% blocks]
|
|
64
|
-
GenNodeMeta --> GenHeader[Generate plan-level %% comments]
|
|
65
|
-
GenHeader --> Preview[Preview diff summary]
|
|
66
|
-
Preview --> Write[Write .mmd]
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Canonical Source of Truth (Priority Order)
|
|
70
|
-
|
|
71
|
-
1. **Structured task metadata** (ARCS tasks) — always wins
|
|
72
|
-
2. **Plan body checkboxes** (`- [ ]`/`- [x]`) — fallback if no structured tasks
|
|
73
|
-
3. **`%%` comments in .mmd** — cache only, never authoritative
|
|
74
|
-
|
|
75
|
-
Metadata always wins. Diagram is regenerated from metadata on drift, never the reverse.
|
|
76
|
-
|
|
77
|
-
**Diagrams are derived data.** `-->` arrows and `%% blocked-by:` lines are auto-generated by `generateDiagramFromTasks` from each task's `dependsOn` field. Manual arrow edits are allowed but will be overwritten on the next regeneration — treat them as cosmetic only. The `dependsOn` field on the task record is the authoritative source for topology.
|
|
78
|
-
|
|
79
|
-
## Drift Types
|
|
80
|
-
|
|
81
|
-
| # | Type | Symptom |
|
|
82
|
-
|---|------|---------|
|
|
83
|
-
| 1 | classDef mismatch | Node has wrong :::class vs metadata status |
|
|
84
|
-
| 2 | Phantom node | Diagram node has no corresponding task |
|
|
85
|
-
| 3 | Missing node | Task exists but no diagram node |
|
|
86
|
-
| 4 | Topology mismatch | Edges don't match dependency metadata |
|
|
87
|
-
| 5 | Stale plan-level comments | %% status/ready/blocked inconsistent |
|
|
88
|
-
| 6 | Incomplete node metadata | Missing %% block or stale fields |
|
|
89
|
-
|
|
90
|
-
**Resolution for all 6:** Regenerate from metadata. Never patch metadata to match diagram.
|
|
91
|
-
|
|
92
|
-
## classDef Conventions
|
|
93
|
-
|
|
94
|
-
Always declare at top of every `flowchart TD`:
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
classDef done fill:#22c55e,color:#fff
|
|
98
|
-
classDef inProgress fill:#f59e0b,color:#fff
|
|
99
|
-
classDef blocked fill:#ef4444,color:#fff
|
|
100
|
-
classDef backlog fill:#94a3b8,color:#fff
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Assign via `:::className` suffix. At plan creation, all nodes start `:::backlog`.
|
|
104
|
-
|
|
105
|
-
## Node ID Rules
|
|
106
|
-
|
|
107
|
-
- Format: `T001`, `T002`, ... (zero-padded 3+ digits)
|
|
108
|
-
- If ARCS structured tasks exist, use their canonical IDs
|
|
109
|
-
- IDs are stable — never change on rename/reorder
|
|
110
|
-
- Removed IDs are retired, never reused
|
|
111
|
-
- New tasks get next unused sequential ID
|
|
112
|
-
|
|
113
|
-
## Per-Node Metadata Format
|
|
114
|
-
|
|
115
|
-
Between plan-level header and `flowchart TD` declaration:
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
%% node: T003
|
|
119
|
-
%% title: Build order management UI
|
|
120
|
-
%% status: backlog
|
|
121
|
-
%% skill: implementation
|
|
122
|
-
%% work-mode: inspect
|
|
123
|
-
%% scope: src/components/orders/, src/pages/orders/
|
|
124
|
-
%% files: src/components/orders/OrderList.tsx (optional)
|
|
125
|
-
%% acceptance: Order list renders with pagination
|
|
126
|
-
%% verify: npm test -- --testPathPattern=orders
|
|
127
|
-
%% blocked-by: T002 (optional)
|
|
128
|
-
%% delegate: yes (optional)
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
**Required:** node, title, status, skill, work-mode, scope, acceptance. **Optional:** files, verify, blocked-by, delegate.
|
|
132
|
-
|
|
133
|
-
Implementation nodes use `%% skill: implementation` plus `%% work-mode: bounded|inspect`. Structured task metadata supplies this canonical pair directly.
|
|
134
|
-
|
|
135
|
-
`verify` must name a command scoped to the node's files (e.g. `npm test -- --testPathPattern=orders`, `vitest run test/orders.test.ts`) — never the bare full suite (`npm test`, `vitest run`). The devil-advocate completion gate owns the single full-project pass.
|
|
136
|
-
|
|
137
|
-
## Plan-Level Header Comments
|
|
138
|
-
|
|
139
|
-
```
|
|
140
|
-
%% plan: <plan-id>
|
|
141
|
-
%% status: T001=done, T002=inProgress, T003=backlog
|
|
142
|
-
%% ready: T003 (all deps done)
|
|
143
|
-
%% blocked: T005 (waiting on T003)
|
|
144
|
-
%% next-action: Start T003
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## manage-diagram.mjs Commands
|
|
148
|
-
|
|
149
|
-
| Command | Purpose |
|
|
150
|
-
|---------|---------|
|
|
151
|
-
| `inspect <file>` | Structured JSON of nodes/edges/metadata |
|
|
152
|
-
| `ready <file>` | Compute executable nodes from topology |
|
|
153
|
-
| `validate <file> [--metadata f.json]` | Check integrity (+ drift detection) |
|
|
154
|
-
| `status <file> <nodeId> <status>` | Update single node status atomically |
|
|
155
|
-
| `sort-metadata <file>` | Order metadata blocks by node ID |
|
|
156
|
-
| `regenerate <file> --metadata f.json` | Full regeneration from canonical data |
|
|
157
|
-
|
|
158
|
-
Preferred: `arcs diagram ready <slug> <planId>` for ready detection. The CLI returns `{ok, data: {ready, blocked, inProgress, done}}` — four disjoint arrays of node IDs that together cover every node in the diagram. The bundled `manage-diagram.mjs ready` script remains the file-level fallback (emits a bare list of ready IDs only).
|
|
159
|
-
|
|
160
|
-
## File Convention
|
|
161
|
-
|
|
162
|
-
- Path: `plans/<plan-id>.diagram.mmd`
|
|
163
|
-
- Pure Mermaid syntax (no markdown fences)
|
|
164
|
-
- First line: `%% plan: <plan-id>`
|
|
165
|
-
- One diagram per plan
|
|
166
|
-
- Plan body references: `> Diagram: plans/<plan-id>.diagram.mmd`
|
|
167
|
-
|
|
168
|
-
## Scalability
|
|
169
|
-
|
|
170
|
-
Plans with 15+ nodes: cluster into `subgraph` blocks by phase. If unreadable, split into sub-plans.
|
|
171
|
-
|
|
172
|
-
## Constraints
|
|
173
|
-
|
|
174
|
-
- **Ownership:** Only orchestrator/coordinator writes .mmd files. Sub-agents read only and report status back
|
|
175
|
-
- **Presentation:** Internal skill — never narrate conventions to user. Show rendered diagram or URL only
|
|
176
|
-
- **Determinism:** Same metadata must produce byte-identical .mmd output (nodes ordered by ID, edges by source→target, fields in fixed order)
|
|
177
|
-
- **Confidence gate:** Self-score ≥80% before writing .mmd files
|
|
178
|
-
- **Validation before write:** unique IDs, valid edges, all 4 classDef present, valid :::class suffixes
|
|
179
|
-
- **Backward compat:** Plans without .mmd remain valid; diagrams without rich metadata upgraded during SYNC
|
|
180
|
-
|
|
181
|
-
## Reference Example
|
|
182
|
-
|
|
183
|
-
```
|
|
184
|
-
%% plan: order-system
|
|
185
|
-
%% status: T001=done, T002=inProgress, T003=backlog, T004=backlog, T005=blocked
|
|
186
|
-
%% ready: T003 (T001 done)
|
|
187
|
-
%% blocked: T005 (waiting on T003 and T004)
|
|
188
|
-
%% next-action: Start T003
|
|
189
|
-
|
|
190
|
-
%% node: T001
|
|
191
|
-
%% title: Design database schema for orders
|
|
192
|
-
%% status: done
|
|
193
|
-
%% skill: implementation
|
|
194
|
-
%% work-mode: bounded
|
|
195
|
-
%% scope: db/migrations/
|
|
196
|
-
%% acceptance: Migration runs; orders table has all required columns
|
|
197
|
-
%% verify: npm run db:migrate
|
|
198
|
-
|
|
199
|
-
%% node: T002
|
|
200
|
-
%% title: Build REST API endpoints
|
|
201
|
-
%% status: inProgress
|
|
202
|
-
%% skill: test-driven-development
|
|
203
|
-
%% work-mode: bounded
|
|
204
|
-
%% scope: src/api/orders/
|
|
205
|
-
%% acceptance: CRUD endpoints return correct status codes
|
|
206
|
-
%% verify: npm test -- --testPathPattern=api/orders
|
|
207
|
-
%% blocked-by: T001
|
|
208
|
-
|
|
209
|
-
flowchart TD
|
|
210
|
-
classDef done fill:#22c55e,color:#fff
|
|
211
|
-
classDef inProgress fill:#f59e0b,color:#fff
|
|
212
|
-
classDef blocked fill:#ef4444,color:#fff
|
|
213
|
-
classDef backlog fill:#94a3b8,color:#fff
|
|
214
|
-
|
|
215
|
-
T001[Design database schema]:::done --> T002[Build REST API]:::inProgress
|
|
216
|
-
T001 --> T003[Write integration tests]:::backlog
|
|
217
|
-
T002 --> T004[Build order UI]:::backlog
|
|
218
|
-
T003 --> T005[Deploy to staging]:::blocked
|
|
219
|
-
T004 --> T005
|
|
220
|
-
```
|
|
32
|
+
Never make the diagram authoritative over task records. Ask only when a proposed topology change materially changes the approved goal or scope.
|
|
@@ -1,75 +1,23 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: writing-knowledge
|
|
3
|
-
description:
|
|
3
|
+
description: Capture durable, actionable project knowledge without summary-only stubs
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Writing Knowledge
|
|
7
7
|
|
|
8
8
|
## When
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Capture a non-obvious fact that will save future work. Skip mechanical or instantly re-derived information.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Method
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
1. Choose the right kind: gotcha, lesson, pattern, architecture, decision, module, feature, or reference.
|
|
15
|
+
2. Run `arcs knowledge template --kind=<kind>` when the kind's structure is useful.
|
|
16
|
+
3. Write a specific title, useful summary, substantive body, keywords, and source files.
|
|
17
|
+
4. Search for an existing entry when duplication is plausible; prefer idempotent `upsert`.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
Summary is the headline; body is the reasoning and operational detail; source files anchor the entry to current code. A file-specific entry should include all three.
|
|
17
20
|
|
|
18
|
-
|
|
21
|
+
When the user requested the knowledge write, execute it directly with `arcs knowledge upsert` and report the resulting ID. Otherwise return the proposed entry for confirmation only when the write would be surprising.
|
|
19
22
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Before writing, scaffold the section skeleton from the command:
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
arcs knowledge template --kind=<kind> --json # structured sections
|
|
26
|
-
arcs knowledge template --kind=<kind> # plain markdown skeleton
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
This emits one `## <heading>` per section with a deletable hint comment. **Fill EVERY section** — a half-filled skeleton is still a stub.
|
|
30
|
-
|
|
31
|
-
> **DRY / authoritative source:** `arcs knowledge template` is the AUTHORITATIVE skeleton. The anatomy below only *illustrates* the shape. If the table here ever diverges from the command output, **the command wins** — scaffold from it, not from this file.
|
|
32
|
-
|
|
33
|
-
## The 8 Kinds at a Glance
|
|
34
|
-
|
|
35
|
-
| Kind | Section anatomy |
|
|
36
|
-
| --- | --- |
|
|
37
|
-
| **gotcha** | Symptom · Root cause · Fix or workaround · Trigger |
|
|
38
|
-
| **lesson** | Expectation · What happened · Why · Next time |
|
|
39
|
-
| **pattern** | When to use · Shape · Example · When not to use |
|
|
40
|
-
| **architecture** | Structure · Invariant or constraint · Failure mode |
|
|
41
|
-
| **decision** | Decision · Rationale and forces · Alternatives rejected · Consequences |
|
|
42
|
-
| **module** | Purpose · Key files and entry points · Responsibilities · Dependencies |
|
|
43
|
-
| **feature** | What it does · How it works · Entry points · Edge cases |
|
|
44
|
-
| **reference** | Summary · Canonical location · Usage notes |
|
|
45
|
-
|
|
46
|
-
Pick the kind by what the insight *is*: a bug you hit → `gotcha`; a wrong belief corrected → `lesson`; a reusable shape → `pattern`; a structural why → `architecture`; a single settled call → `decision`; an area of the codebase → `module`/`feature`; a pointer to a canonical source → `reference`.
|
|
47
|
-
|
|
48
|
-
## Author the Proposal
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
arcs knowledge upsert <slug> "<title>" \
|
|
52
|
-
--kind=<kind> \
|
|
53
|
-
--summary="<one-line headline>" \
|
|
54
|
-
--body="<every section of the kind, filled>" \
|
|
55
|
-
--keywords="<k1,k2>" \
|
|
56
|
-
--source-files="<path[:anchor],…>" \
|
|
57
|
-
--json
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
Return the command without executing it. The orchestrator applies approved proposals at fan-in. `upsert` is idempotent by title — create-or-update, no dedup search dance. `--summary` AND `--body` AND `--source-files` together are the floor for a file-specific entry.
|
|
61
|
-
|
|
62
|
-
## Self-Check Before You Return the Proposal
|
|
63
|
-
|
|
64
|
-
> **"Could someone act on this in six months without re-deriving it?"**
|
|
65
|
-
|
|
66
|
-
If the insight cost you reasoning, a debug session, or a dead end, capture *that* — not just its one-line conclusion. Inverse (per implementation minimalism): if anyone could re-derive it in ten seconds, don't write it at all.
|
|
67
|
-
|
|
68
|
-
## Constraints
|
|
69
|
-
|
|
70
|
-
- Scaffold from `arcs knowledge template` — never freehand the section headings.
|
|
71
|
-
- Fill every section; a half-filled skeleton is a stub.
|
|
72
|
-
- `--summary` is the headline, `--body` is the value — never ship summary-only.
|
|
73
|
-
- Match kind to the nature of the insight; don't force everything into `gotcha`.
|
|
74
|
-
- Skip capture entirely for purely mechanical work (renames, config nudges, diagram regens).
|
|
75
|
-
- Proposal-only: do not execute `arcs knowledge upsert` or any other DAG mutation from this skill.
|
|
23
|
+
Validate that a future agent could act on the entry without re-deriving it.
|