@polymorphism-tech/morph-spec 8.37.1 → 8.38.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/CLAUDE.md +19 -6
- package/README.md +2 -2
- package/bin/morph-spec.js +16 -7
- package/claude-plugin.json +1 -1
- package/docs/CHEATSHEET.md +1 -1
- package/docs/QUICKSTART.md +1 -1
- package/framework/CLAUDE.md +3 -3
- package/framework/MORPH.md +25 -22
- package/framework/agents.json +76 -27
- package/framework/docs/CLI.md +54 -17
- package/framework/evals/rubrics/code-quality.md +5 -0
- package/framework/evals/rubrics/condensed.md +6 -2
- package/framework/evals/rubrics/contracts.md +20 -0
- package/framework/evals/rubrics/test-coverage.md +17 -6
- package/framework/hooks/README.md +9 -3
- package/framework/hooks/claude-code/core/graph-refresh-kick.js +52 -0
- package/framework/hooks/claude-code/core/telemetry-log.js +172 -87
- package/framework/hooks/claude-code/core/validate-completion.js +16 -90
- package/framework/hooks/claude-code/core/worktree-context.js +10 -0
- package/framework/hooks/shared/command-tokens.js +96 -0
- package/framework/hooks/shared/git-exclude.js +44 -0
- package/framework/hooks/shared/git-paths.js +52 -0
- package/framework/hooks/shared/graph-freshness.js +380 -0
- package/framework/hooks/shared/graph-refresh.js +416 -0
- package/framework/hooks/shared/morph-cli.js +17 -5
- package/framework/hooks/shared/redact-secrets.js +55 -0
- package/framework/hooks/shared/telemetry-logger.js +25 -2
- package/framework/hooks/shared/transcript-usage.js +80 -0
- package/framework/rubrics/backend.json +2 -2
- package/framework/rubrics/default.json +2 -2
- package/framework/rubrics/frontend.json +2 -2
- package/framework/rules/csharp-standards.md +1 -0
- package/framework/rules/morph-workflow.md +1 -0
- package/framework/rules/nextjs-standards.md +1 -0
- package/framework/schemas/config.schema.json +41 -1
- package/framework/schemas/feature.schema.json +5 -1
- package/framework/skills/core/create-umbraco-lp/SKILL.md +1 -1
- package/framework/skills/core/migrate-lp-to-umbraco/SKILL.md +1 -1
- package/framework/skills/core/morph-apply/SKILL.md +36 -11
- package/framework/skills/core/morph-brainstorming/SKILL.md +16 -7
- package/framework/skills/core/morph-eval/SKILL.md +1 -1
- package/framework/skills/core/morph-hotfix/SKILL.md +1 -1
- package/framework/skills/core/morph-implement/SKILL.md +39 -10
- package/framework/skills/core/morph-media/SKILL.md +1 -1
- package/framework/skills/core/morph-plan/SKILL.md +72 -15
- package/framework/skills/core/morph-proposal/SKILL.md +1 -1
- package/framework/skills/core/morph-review/SKILL.md +51 -13
- package/framework/skills/core/morph-stack-scan/SKILL.md +1 -1
- package/framework/skills/core/morph-standards/SKILL.md +1 -1
- package/framework/skills/core/morph-uiux/SKILL.md +34 -9
- package/framework/standards/STANDARDS.json +187 -12
- package/framework/standards/ai-agents/testing-ai.md +2 -1
- package/framework/standards/architecture/code-comments.md +64 -0
- package/framework/standards/backend/dotnet/testing.md +22 -0
- package/framework/standards/frontend/admin-app/data-table.md +562 -0
- package/framework/standards/frontend/admin-app/feedback.md +236 -0
- package/framework/standards/frontend/admin-app/forms.md +232 -0
- package/framework/standards/frontend/admin-app/page-structure.md +203 -0
- package/framework/standards/frontend/nextjs/components.md +37 -58
- package/framework/standards/frontend/nextjs/data-fetching.md +1 -0
- package/framework/standards/frontend/nextjs/forms.md +31 -30
- package/framework/standards/frontend/nextjs/state-management.md +2 -1
- package/framework/standards/frontend/nextjs/testing.md +18 -0
- package/framework/templates/context/design-system.md +3 -3
- package/framework/templates/docs/proposal.md +11 -0
- package/framework/templates/docs/spec.md +15 -0
- package/framework/templates/docs/ui-mockups.md +115 -98
- package/framework/templates/feature/decisions.md +124 -122
- package/package.json +1 -1
- package/src/commands/graph/affected.js +4 -3
- package/src/commands/graph/build.js +109 -18
- package/src/commands/graph/explain.js +8 -5
- package/src/commands/graph/status.js +14 -8
- package/src/commands/observability/cost.js +148 -18
- package/src/commands/project/doctor.js +82 -10
- package/src/commands/project/update.js +25 -0
- package/src/commands/project/worktree.js +73 -90
- package/src/commands/state/advance.js +18 -0
- package/src/commands/state/approve.js +15 -0
- package/src/commands/state/archive.js +62 -9
- package/src/commands/state/finish.js +62 -14
- package/src/commands/state/gate-check.js +8 -1
- package/src/commands/state/gate-decision.js +8 -4
- package/src/commands/state/report-check.js +90 -9
- package/src/commands/state/usecase.js +66 -0
- package/src/commands/tasks/dag.js +17 -2
- package/src/commands/validation/validate-feature.js +6 -1
- package/src/commands/validation/verify.js +20 -1
- package/src/dashboard/scanner/agents-scanner.js +5 -1
- package/src/dashboard/scanner/hooks-scanner.js +8 -1
- package/src/dashboard/scanner/standards-scanner.js +2 -1
- package/src/lib/ai/comment-stripper.js +101 -4
- package/src/lib/evaluator-report.js +25 -0
- package/src/lib/generators/handoff-generator.js +4 -18
- package/src/lib/git/default-branch.js +52 -0
- package/src/lib/git/tree-fingerprint.js +58 -0
- package/src/lib/git/tree-state.js +167 -0
- package/src/lib/graph/god-nodes.js +12 -3
- package/src/lib/graph/graph-health.js +48 -2
- package/src/lib/graph/graph-loader.js +99 -25
- package/src/lib/graph/graphifyignore.js +145 -28
- package/src/lib/graph/sanitize.js +117 -11
- package/src/lib/risk-detector.js +90 -0
- package/src/lib/specs/acervo-format.js +70 -0
- package/src/lib/specs/acervo-lifecycle.js +264 -0
- package/src/lib/specs/adr-index.js +169 -0
- package/src/lib/specs/revocations.js +156 -0
- package/src/lib/specs/screen-checklist.js +357 -0
- package/src/lib/specs/usecase-check.js +20 -16
- package/src/lib/specs/usecase-promoter.js +103 -38
- package/src/lib/specs/usecase-registry.js +7 -7
- package/src/lib/tasks/tasks-json-parser.js +2 -3
- package/src/lib/telemetry/metrics.js +386 -0
- package/src/lib/telemetry/telemetry-reader.js +161 -51
- package/src/lib/telemetry/verify-event.js +79 -0
- package/src/lib/validators/code-budget/code-budget-validator.js +172 -0
- package/src/lib/validators/code-budget/comment-scanner.js +75 -0
- package/src/lib/validators/code-budget/index.js +9 -0
- package/src/lib/validators/reuse/reuse-validator.js +4 -2
- package/src/lib/validators/reuse/symbol-scanner.js +27 -22
- package/src/lib/validators/validation-runner.js +21 -5
- package/src/lib/validators/verify-runner.js +11 -0
- package/src/lib/worktree/finish-backup.js +739 -0
- package/src/lib/worktree/ignored-triage.js +15 -8
- package/src/lib/worktree/worktree-audit.js +5 -0
- package/src/scripts/setup-infra.js +29 -18
- package/src/utils/agents-installer.js +281 -12
- package/src/utils/hooks-installer.js +75 -15
|
@@ -35,8 +35,25 @@ import { realEffects } from '../lib/installers/effects.js';
|
|
|
35
35
|
* (junctions, port block, primary-root landing) and its removal routed
|
|
36
36
|
* through the safe `worktree remove --if-clean` — and appends
|
|
37
37
|
* block-raw-worktree-add to the PreToolUse:Bash chain.
|
|
38
|
+
*
|
|
39
|
+
* 3.9.0 binds telemetry-log to PostToolUseFailure (a Bash command that exits
|
|
40
|
+
* non-zero fires only that event, so red runs used to vanish from the log),
|
|
41
|
+
* PostToolBatch (once per model turn that used tools) and SubagentStop (the
|
|
42
|
+
* sub-agent's own token usage). The three only record, so they run with
|
|
43
|
+
* `async: true`: a node process per model turn never holds the turn up.
|
|
44
|
+
*
|
|
45
|
+
* 3.10.0 appends graph-refresh-kick to the all-tools PostToolUse chain: after a
|
|
46
|
+
* Bash or PowerShell command that runs git/gh/morph-spec it launches the
|
|
47
|
+
* detached refresh of the ROOT's codebase graph
|
|
48
|
+
* (framework/hooks/shared/graph-refresh.js). `update` re-runs
|
|
49
|
+
* this installer, so installed projects get the refresh without re-running
|
|
50
|
+
* `setup-infra` — the step that never reached them.
|
|
51
|
+
*
|
|
52
|
+
* 3.11.0 writes every `timeout` in seconds, the unit Claude Code reads: the
|
|
53
|
+
* values were milliseconds, so a hung hook held the session for hours (120000
|
|
54
|
+
* on WorktreeCreate is 33 h) instead of the seconds they meant.
|
|
38
55
|
*/
|
|
39
|
-
const HOOKS_VERSION = '3.
|
|
56
|
+
const HOOKS_VERSION = '3.11.0';
|
|
40
57
|
|
|
41
58
|
/** Marker for old dispatch.js (v1) */
|
|
42
59
|
const OLD_DISPATCH_COMMAND = 'node framework/hooks/agent-teams/dispatch.js';
|
|
@@ -119,7 +136,7 @@ const MORPH_HOOKS = [
|
|
|
119
136
|
hooks: [{
|
|
120
137
|
type: 'command',
|
|
121
138
|
command: 'node framework/hooks/claude-code/core/worktree-context.js',
|
|
122
|
-
timeout:
|
|
139
|
+
timeout: 5
|
|
123
140
|
}]
|
|
124
141
|
},
|
|
125
142
|
|
|
@@ -173,7 +190,7 @@ const MORPH_HOOKS = [
|
|
|
173
190
|
hooks: [{
|
|
174
191
|
type: 'command',
|
|
175
192
|
command: 'node framework/hooks/claude-code/core/worktree-create.js',
|
|
176
|
-
timeout:
|
|
193
|
+
timeout: 120
|
|
177
194
|
}]
|
|
178
195
|
},
|
|
179
196
|
|
|
@@ -188,7 +205,7 @@ const MORPH_HOOKS = [
|
|
|
188
205
|
hooks: [{
|
|
189
206
|
type: 'command',
|
|
190
207
|
command: 'node framework/hooks/claude-code/core/worktree-remove.js',
|
|
191
|
-
timeout:
|
|
208
|
+
timeout: 60
|
|
192
209
|
}]
|
|
193
210
|
},
|
|
194
211
|
|
|
@@ -227,24 +244,66 @@ const MORPH_HOOKS = [
|
|
|
227
244
|
type: 'command',
|
|
228
245
|
command: 'node framework/hooks/claude-code/core/chain.js',
|
|
229
246
|
args: ['state-sync', 'gate-guard'],
|
|
230
|
-
timeout:
|
|
247
|
+
timeout: 6
|
|
231
248
|
}]
|
|
232
249
|
},
|
|
233
250
|
|
|
234
|
-
// === PostToolUse: All — telemetry capture (silent) + loop detection
|
|
235
|
-
// telemetry-log is the single generic vantage point of an
|
|
236
|
-
// every tool call (skill, sub-agent dispatch, knowledge-base
|
|
237
|
-
// .morph/logs/events.jsonl. Silent and fail-open — never blocks,
|
|
238
|
-
// injects. `morph-spec telemetry` reads the stream back.
|
|
239
|
-
//
|
|
251
|
+
// === PostToolUse: All — telemetry capture (silent) + loop detection +
|
|
252
|
+
// graph refresh kick. telemetry-log is the single generic vantage point of an
|
|
253
|
+
// NLH: it appends every tool call (skill, sub-agent dispatch, knowledge-base
|
|
254
|
+
// read, …) to .morph/logs/events.jsonl. Silent and fail-open — never blocks,
|
|
255
|
+
// never injects. `morph-spec telemetry` reads the stream back.
|
|
256
|
+
// graph-refresh-kick only spawns a DETACHED worker (never waits on graphify),
|
|
257
|
+
// so it rides this chain instead of costing a process of its own per Bash
|
|
258
|
+
// call. Timeout stays the sum of the first two links (sequential worst case);
|
|
259
|
+
// the kick returns in milliseconds. ===
|
|
240
260
|
{
|
|
241
261
|
event: 'PostToolUse',
|
|
242
262
|
matcher: null,
|
|
243
263
|
hooks: [{
|
|
244
264
|
type: 'command',
|
|
245
265
|
command: 'node framework/hooks/claude-code/core/chain.js',
|
|
246
|
-
args: ['telemetry-log', 'loop-detect'],
|
|
247
|
-
timeout:
|
|
266
|
+
args: ['telemetry-log', 'loop-detect', 'graph-refresh-kick'],
|
|
267
|
+
timeout: 10
|
|
268
|
+
}]
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
// === PostToolUseFailure: All — telemetry of the failed call (exit code,
|
|
272
|
+
// duration). loop-detect stays out: its warning is shaped for PostToolUse.
|
|
273
|
+
{
|
|
274
|
+
event: 'PostToolUseFailure',
|
|
275
|
+
matcher: null,
|
|
276
|
+
hooks: [{
|
|
277
|
+
type: 'command',
|
|
278
|
+
command: 'node framework/hooks/claude-code/core/telemetry-log.js',
|
|
279
|
+
timeout: 5,
|
|
280
|
+
async: true
|
|
281
|
+
}]
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
// === PostToolBatch — one event per model turn that used tools. The event
|
|
285
|
+
// takes no matcher. ===
|
|
286
|
+
{
|
|
287
|
+
event: 'PostToolBatch',
|
|
288
|
+
matcher: null,
|
|
289
|
+
hooks: [{
|
|
290
|
+
type: 'command',
|
|
291
|
+
command: 'node framework/hooks/claude-code/core/telemetry-log.js',
|
|
292
|
+
timeout: 5,
|
|
293
|
+
async: true
|
|
294
|
+
}]
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// === SubagentStop — the sub-agent's token usage, read from its own
|
|
298
|
+
// transcript (the session transcript does not include it). ===
|
|
299
|
+
{
|
|
300
|
+
event: 'SubagentStop',
|
|
301
|
+
matcher: null,
|
|
302
|
+
hooks: [{
|
|
303
|
+
type: 'command',
|
|
304
|
+
command: 'node framework/hooks/claude-code/core/telemetry-log.js',
|
|
305
|
+
timeout: 10,
|
|
306
|
+
async: true
|
|
248
307
|
}]
|
|
249
308
|
},
|
|
250
309
|
|
|
@@ -258,7 +317,7 @@ const MORPH_HOOKS = [
|
|
|
258
317
|
hooks: [{
|
|
259
318
|
type: 'command',
|
|
260
319
|
command: 'node framework/hooks/claude-code/core/telemetry-log.js',
|
|
261
|
-
timeout:
|
|
320
|
+
timeout: 5
|
|
262
321
|
}]
|
|
263
322
|
},
|
|
264
323
|
|
|
@@ -338,7 +397,8 @@ export async function installClaudeHooks(targetPath, { fx = realEffects() } = {}
|
|
|
338
397
|
return {
|
|
339
398
|
type: h.type,
|
|
340
399
|
command,
|
|
341
|
-
...(h.timeout !== undefined ? { timeout: h.timeout } : {})
|
|
400
|
+
...(h.timeout !== undefined ? { timeout: h.timeout } : {}),
|
|
401
|
+
...(h.async ? { async: true } : {})
|
|
342
402
|
};
|
|
343
403
|
});
|
|
344
404
|
|