agent-method 1.5.12

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 (108) hide show
  1. package/README.md +343 -0
  2. package/bin/wwa.js +115 -0
  3. package/docs/internal/cli-commands.yaml +259 -0
  4. package/docs/internal/doc-tokens.yaml +1103 -0
  5. package/docs/internal/feature-registry.yaml +1643 -0
  6. package/lib/boundaries.js +247 -0
  7. package/lib/cli/add.js +170 -0
  8. package/lib/cli/casestudy.js +1000 -0
  9. package/lib/cli/check.js +323 -0
  10. package/lib/cli/close.js +838 -0
  11. package/lib/cli/completion.js +735 -0
  12. package/lib/cli/deps.js +234 -0
  13. package/lib/cli/digest.js +73 -0
  14. package/lib/cli/doc-review.js +486 -0
  15. package/lib/cli/docs.js +315 -0
  16. package/lib/cli/helpers.js +198 -0
  17. package/lib/cli/implement.js +169 -0
  18. package/lib/cli/init.js +280 -0
  19. package/lib/cli/pipeline.js +206 -0
  20. package/lib/cli/plan.js +140 -0
  21. package/lib/cli/record.js +98 -0
  22. package/lib/cli/refine.js +202 -0
  23. package/lib/cli/report-helpers.js +113 -0
  24. package/lib/cli/review.js +76 -0
  25. package/lib/cli/routable.js +109 -0
  26. package/lib/cli/route.js +101 -0
  27. package/lib/cli/scan.js +133 -0
  28. package/lib/cli/serve.js +23 -0
  29. package/lib/cli/status.js +65 -0
  30. package/lib/cli/update-docs.js +574 -0
  31. package/lib/cli/upgrade.js +222 -0
  32. package/lib/cli/watch.js +32 -0
  33. package/lib/dependencies.js +196 -0
  34. package/lib/init.js +692 -0
  35. package/lib/mcp-server.js +612 -0
  36. package/lib/pipeline.js +907 -0
  37. package/lib/registry.js +132 -0
  38. package/lib/watcher.js +165 -0
  39. package/package.json +54 -0
  40. package/templates/README.md +363 -0
  41. package/templates/entry-points/.cursorrules +90 -0
  42. package/templates/entry-points/AGENT.md +90 -0
  43. package/templates/entry-points/CLAUDE.md +88 -0
  44. package/templates/extensions/MANIFEST.md +110 -0
  45. package/templates/extensions/analytical-system.md +96 -0
  46. package/templates/extensions/code-project.md +77 -0
  47. package/templates/extensions/data-exploration.md +117 -0
  48. package/templates/full/.context/BASE.md +101 -0
  49. package/templates/full/.context/COMPOSITION.md +47 -0
  50. package/templates/full/.context/INDEX.yaml +56 -0
  51. package/templates/full/.context/METHODOLOGY.md +246 -0
  52. package/templates/full/.context/PROTOCOL.yaml +169 -0
  53. package/templates/full/.context/REGISTRY.md +75 -0
  54. package/templates/full/.cursorrules +90 -0
  55. package/templates/full/AGENT.md +90 -0
  56. package/templates/full/CLAUDE.md +90 -0
  57. package/templates/full/Management/DIGEST.md +23 -0
  58. package/templates/full/Management/STATUS.md +46 -0
  59. package/templates/full/PLAN.md +67 -0
  60. package/templates/full/PROJECT-PROFILE.md +61 -0
  61. package/templates/full/PROJECT.md +80 -0
  62. package/templates/full/REQUIREMENTS.md +30 -0
  63. package/templates/full/ROADMAP.md +39 -0
  64. package/templates/full/Reviews/INDEX.md +41 -0
  65. package/templates/full/Reviews/backlog.md +52 -0
  66. package/templates/full/Reviews/plan.md +43 -0
  67. package/templates/full/Reviews/project.md +41 -0
  68. package/templates/full/Reviews/requirements.md +42 -0
  69. package/templates/full/Reviews/roadmap.md +41 -0
  70. package/templates/full/Reviews/state.md +56 -0
  71. package/templates/full/SESSION-LOG.md +102 -0
  72. package/templates/full/STATE.md +42 -0
  73. package/templates/full/SUMMARY.md +27 -0
  74. package/templates/full/agentWorkflows/INDEX.md +42 -0
  75. package/templates/full/agentWorkflows/observations.md +65 -0
  76. package/templates/full/agentWorkflows/patterns.md +68 -0
  77. package/templates/full/agentWorkflows/sessions.md +92 -0
  78. package/templates/full/intro/README.md +39 -0
  79. package/templates/full/registry/feature-registry.yaml +25 -0
  80. package/templates/full/registry/features/catalog.yaml +743 -0
  81. package/templates/full/registry/features/protocol.yaml +121 -0
  82. package/templates/full/registry/features/routing.yaml +358 -0
  83. package/templates/full/registry/features/workflows.yaml +404 -0
  84. package/templates/full/todos/backlog.md +19 -0
  85. package/templates/starter/.context/BASE.md +66 -0
  86. package/templates/starter/.context/INDEX.yaml +51 -0
  87. package/templates/starter/.context/METHODOLOGY.md +228 -0
  88. package/templates/starter/.context/PROTOCOL.yaml +165 -0
  89. package/templates/starter/.cursorrules +90 -0
  90. package/templates/starter/AGENT.md +90 -0
  91. package/templates/starter/CLAUDE.md +90 -0
  92. package/templates/starter/Management/DIGEST.md +23 -0
  93. package/templates/starter/Management/STATUS.md +46 -0
  94. package/templates/starter/PLAN.md +67 -0
  95. package/templates/starter/PROJECT-PROFILE.md +44 -0
  96. package/templates/starter/PROJECT.md +80 -0
  97. package/templates/starter/ROADMAP.md +39 -0
  98. package/templates/starter/Reviews/INDEX.md +75 -0
  99. package/templates/starter/SESSION-LOG.md +102 -0
  100. package/templates/starter/STATE.md +42 -0
  101. package/templates/starter/SUMMARY.md +27 -0
  102. package/templates/starter/agentWorkflows/INDEX.md +61 -0
  103. package/templates/starter/intro/README.md +37 -0
  104. package/templates/starter/registry/feature-registry.yaml +25 -0
  105. package/templates/starter/registry/features/catalog.yaml +743 -0
  106. package/templates/starter/registry/features/protocol.yaml +121 -0
  107. package/templates/starter/registry/features/routing.yaml +358 -0
  108. package/templates/starter/registry/features/workflows.yaml +404 -0
@@ -0,0 +1,234 @@
1
+ /** wwa deps — dependency graph visualization and analysis. */
2
+
3
+ import { resolve } from "node:path";
4
+ import { findOrphans } from "../dependencies.js";
5
+ import { loadDocGraph } from "../boundaries.js";
6
+ import { printCliReport, writeLastRunSummary } from "./report-helpers.js";
7
+
8
+ export function register(program) {
9
+ program
10
+ .command("deps [directory]")
11
+ .description("Show document dependency graph from doc-tokens.yaml")
12
+ .option("--full", "Show all nodes and edges")
13
+ .option("--orphans", "Show only disconnected nodes")
14
+ .option("--path <from-to>", "Show dependency chain between two files (from:to)")
15
+ .option("--type <type>", "Filter edges by type (cascades_to, reads_from, seeds, validates)")
16
+ .option("--cross-boundary", "Show edges crossing internal/release boundary")
17
+ .option("--json", "Output as JSON")
18
+ .action(async (directory, opts) => {
19
+ directory = directory || ".";
20
+ const d = resolve(directory);
21
+
22
+ const docGraph = await loadDocGraph(d);
23
+ if (!docGraph) {
24
+ console.log("\n No dependency graph found in token registry.");
25
+ console.log(" Run `wwa init` or complete brownfield onboarding to generate one.\n");
26
+ return;
27
+ }
28
+
29
+ const nodes = docGraph.nodes || [];
30
+ const edges = docGraph.edges || [];
31
+
32
+ // Filter edges by type if requested
33
+ const filteredEdges = opts.type
34
+ ? edges.filter((e) => e.type === opts.type)
35
+ : edges;
36
+
37
+ if (opts.json) {
38
+ const output = {
39
+ lastScan: docGraph.last_scan || null,
40
+ defaultsApplied: docGraph.defaults_applied || null,
41
+ nodes,
42
+ edges: filteredEdges,
43
+ orphans: findOrphans(docGraph),
44
+ };
45
+ if (opts.path) {
46
+ const [from, to] = opts.path.split(":");
47
+ output.chain = findChain(nodes, edges, from, to);
48
+ }
49
+ console.log(JSON.stringify(output, null, 2));
50
+ return;
51
+ }
52
+
53
+ if (opts.orphans) {
54
+ const orphans = findOrphans(docGraph);
55
+ console.log(`\n Orphan nodes (${orphans.length}):\n`);
56
+ if (orphans.length === 0) {
57
+ console.log(" All nodes have at least one edge.");
58
+ } else {
59
+ for (const o of orphans) {
60
+ const node = nodes.find((n) => n.path === o);
61
+ console.log(` - ${o}${node?.role ? ` — ${node.role}` : ""}`);
62
+ }
63
+ }
64
+ console.log("");
65
+ return;
66
+ }
67
+
68
+ if (opts.crossBoundary) {
69
+ const { loadBoundaries, isInternal, isRelease } = await import("../boundaries.js");
70
+ const bounds = await loadBoundaries(d);
71
+ const crossEdges = edges.filter((e) => {
72
+ const fromInt = isInternal(e.from, bounds);
73
+ const fromRel = isRelease(e.from, bounds);
74
+ const toInt = isInternal(e.to, bounds);
75
+ const toRel = isRelease(e.to, bounds);
76
+ return (fromInt && toRel) || (fromRel && toInt);
77
+ });
78
+
79
+ if (opts.json) {
80
+ console.log(JSON.stringify({ crossBoundaryEdges: crossEdges }, null, 2));
81
+ return;
82
+ }
83
+
84
+ console.log(`\n Cross-boundary edges (${crossEdges.length}):\n`);
85
+ if (crossEdges.length === 0) {
86
+ console.log(" No edges cross the internal/release boundary.");
87
+ } else {
88
+ for (const e of crossEdges) {
89
+ const fromZone = isInternal(e.from, bounds) ? "internal" : "release";
90
+ const toZone = isInternal(e.to, bounds) ? "internal" : "release";
91
+ console.log(` ${e.from} [${fromZone}] —[${e.type}]→ ${e.to} [${toZone}]`);
92
+ }
93
+ }
94
+ console.log("");
95
+ return;
96
+ }
97
+
98
+ if (opts.path) {
99
+ const [from, to] = opts.path.split(":");
100
+ if (!from || !to) {
101
+ console.error(" Use --path from:to format (e.g. --path STATE.md:ROADMAP.md)");
102
+ return;
103
+ }
104
+ const chain = findChain(nodes, edges, from, to);
105
+ console.log(`\n Dependency chain: ${from} → ${to}\n`);
106
+ if (chain.length === 0) {
107
+ console.log(" No path found between these nodes.");
108
+ } else {
109
+ for (let i = 0; i < chain.length; i++) {
110
+ const step = chain[i];
111
+ if (i < chain.length - 1) {
112
+ const edge = edges.find(
113
+ (e) => e.from === step && e.to === chain[i + 1]
114
+ );
115
+ const edgeType = edge ? ` —[${edge.type}]→ ` : " → ";
116
+ console.log(` ${i + 1}. ${step}${edgeType}`);
117
+ } else {
118
+ console.log(` ${i + 1}. ${step}`);
119
+ }
120
+ }
121
+ }
122
+ console.log("");
123
+ return;
124
+ }
125
+
126
+ // Default: summary view
127
+ const orphans = findOrphans(docGraph);
128
+ const summary = [
129
+ `${nodes.length} nodes, ${edges.length} edges.`,
130
+ `${orphans.length} orphan(s).`,
131
+ opts.full ? "Full node list shown below." : "Run wwa deps --full for all nodes.",
132
+ ].join(" ");
133
+ const inputRef = `directory=${directory}`;
134
+ printCliReport({ command: "deps", inputRef, summary });
135
+ console.log(" Detail — Document Dependency Graph\n");
136
+ console.log(` Last scan: ${docGraph.last_scan || "unknown"}`);
137
+ console.log(` Defaults: ${docGraph.defaults_applied || "none"}`);
138
+ console.log(` Nodes: ${nodes.length} Edges: ${edges.length}`);
139
+ console.log(` Orphans: ${orphans.length}`);
140
+
141
+ // Edge type breakdown
142
+ const byType = {};
143
+ for (const e of edges) {
144
+ byType[e.type] = (byType[e.type] || 0) + 1;
145
+ }
146
+ if (Object.keys(byType).length > 0) {
147
+ console.log(`\n Edge types:`);
148
+ for (const [type, count] of Object.entries(byType).sort()) {
149
+ console.log(` ${type}: ${count}`);
150
+ }
151
+ }
152
+
153
+ if (opts.full) {
154
+ // Group nodes by category
155
+ const byCategory = {};
156
+ for (const n of nodes) {
157
+ const cat = n.category || "unknown";
158
+ if (!byCategory[cat]) byCategory[cat] = [];
159
+ byCategory[cat].push(n);
160
+ }
161
+
162
+ console.log("");
163
+ for (const [cat, catNodes] of Object.entries(byCategory).sort()) {
164
+ console.log(` [${cat}]`);
165
+ for (const n of catNodes) {
166
+ const outgoing = filteredEdges
167
+ .filter((e) => e.from === n.path)
168
+ .map((e) => `→ ${e.to} (${e.type})`);
169
+ console.log(` ${n.path} — ${n.role}`);
170
+ for (const a of outgoing) {
171
+ console.log(` ${a}`);
172
+ }
173
+ }
174
+ }
175
+ }
176
+
177
+ console.log("");
178
+ writeLastRunSummary(d, { command: "deps", inputRef, summary });
179
+ });
180
+ }
181
+
182
+ // ---------------------------------------------------------------------------
183
+ // Helpers
184
+ // ---------------------------------------------------------------------------
185
+
186
+ /** BFS to find shortest path between two nodes, searching forward then reverse edges. */
187
+ function findChain(nodes, edges, from, to) {
188
+ const nodePaths = new Set(nodes.map((n) => n.path));
189
+ if (!nodePaths.has(from) || !nodePaths.has(to)) return [];
190
+
191
+ // Build adjacency (forward: from → to)
192
+ const fwd = {};
193
+ for (const p of nodePaths) fwd[p] = [];
194
+ for (const e of edges) {
195
+ if (fwd[e.from]) fwd[e.from].push(e.to);
196
+ }
197
+
198
+ // BFS forward
199
+ const visited = new Set([from]);
200
+ const queue = [[from]];
201
+ while (queue.length > 0) {
202
+ const path = queue.shift();
203
+ const current = path[path.length - 1];
204
+ if (current === to) return path;
205
+ for (const next of fwd[current] || []) {
206
+ if (!visited.has(next)) {
207
+ visited.add(next);
208
+ queue.push([...path, next]);
209
+ }
210
+ }
211
+ }
212
+
213
+ // BFS reverse (follow edges backwards: to → from)
214
+ const rev = {};
215
+ for (const p of nodePaths) rev[p] = [];
216
+ for (const e of edges) {
217
+ if (rev[e.to]) rev[e.to].push(e.from);
218
+ }
219
+ const visited2 = new Set([from]);
220
+ const queue2 = [[from]];
221
+ while (queue2.length > 0) {
222
+ const path = queue2.shift();
223
+ const current = path[path.length - 1];
224
+ if (current === to) return path;
225
+ for (const next of rev[current] || []) {
226
+ if (!visited2.has(next)) {
227
+ visited2.add(next);
228
+ queue2.push([...path, next]);
229
+ }
230
+ }
231
+ }
232
+
233
+ return [];
234
+ }
@@ -0,0 +1,73 @@
1
+ /** wwa digest — show management digest and project health. */
2
+
3
+ import { readFileSync, existsSync } from "node:fs";
4
+ import { resolve, join } from "node:path";
5
+ import { printCliReport, writeLastRunSummary } from "./report-helpers.js";
6
+
7
+ export function register(program) {
8
+ program
9
+ .command("digest [directory]")
10
+ .description("Show management digest from Management/DIGEST.md")
11
+ .option("--status", "Show Management/STATUS.md instead of digest")
12
+ .option("--json", "Output as JSON")
13
+ .action(async (directory, opts) => {
14
+ directory = directory || ".";
15
+ const d = resolve(directory);
16
+
17
+ const digestPath = join(d, "Management", "DIGEST.md");
18
+ const statusPath = join(d, "Management", "STATUS.md");
19
+
20
+ const target = opts.status ? statusPath : digestPath;
21
+ const label = opts.status ? "STATUS" : "DIGEST";
22
+
23
+ if (!existsSync(target)) {
24
+ // Try to synthesize from SUMMARY.md or STATE.md
25
+ const summaryPath = join(d, "SUMMARY.md");
26
+ const statePath = join(d, "STATE.md");
27
+
28
+ if (opts.json) {
29
+ console.log(
30
+ JSON.stringify(
31
+ {
32
+ error: `Management/${label}.md not found`,
33
+ hasSummary: existsSync(summaryPath),
34
+ hasState: existsSync(statePath),
35
+ },
36
+ null,
37
+ 2
38
+ )
39
+ );
40
+ return;
41
+ }
42
+
43
+ console.log(`\n Management/${label}.md not found.\n`);
44
+ if (existsSync(summaryPath) || existsSync(statePath)) {
45
+ console.log(" Available alternatives:");
46
+ if (existsSync(summaryPath))
47
+ console.log(" - SUMMARY.md (session audit trail)");
48
+ if (existsSync(statePath))
49
+ console.log(" - STATE.md (current position + decisions)");
50
+ }
51
+ console.log(
52
+ "\n To get management reports, use the starter or full template tier:" +
53
+ "\n wwa init <type>\n"
54
+ );
55
+ return;
56
+ }
57
+
58
+ const content = readFileSync(target, "utf-8");
59
+
60
+ if (opts.json) {
61
+ console.log(JSON.stringify({ file: target, content }, null, 2));
62
+ return;
63
+ }
64
+
65
+ const lineCount = content.split("\n").length;
66
+ const summary = `Management/${label}.md: ${lineCount} lines. Project health and digest below.`;
67
+ const inputRef = `directory=${directory}, source=${label}`;
68
+ printCliReport({ command: "digest", inputRef, summary });
69
+ console.log(" Detail\n");
70
+ console.log(content);
71
+ writeLastRunSummary(d, { command: "digest", inputRef, summary });
72
+ });
73
+ }