@lumenflow/core 3.1.2 → 3.1.3
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 +16 -16
- package/dist/cli/is-agent-branch.js +31 -10
- package/dist/index.js +3 -0
- package/package.json +5 -2
- package/dist/active-wu-detector.d.ts +0 -25
- package/dist/active-wu-detector.d.ts.map +0 -1
- package/dist/active-wu-detector.js +0 -109
- package/dist/active-wu-detector.js.map +0 -1
- package/dist/adapters/context-adapters.d.ts +0 -101
- package/dist/adapters/context-adapters.d.ts.map +0 -1
- package/dist/adapters/context-adapters.js +0 -98
- package/dist/adapters/context-adapters.js.map +0 -1
- package/dist/adapters/filesystem-metrics.adapter.d.ts +0 -91
- package/dist/adapters/filesystem-metrics.adapter.d.ts.map +0 -1
- package/dist/adapters/filesystem-metrics.adapter.js +0 -530
- package/dist/adapters/filesystem-metrics.adapter.js.map +0 -1
- package/dist/adapters/index.d.ts +0 -15
- package/dist/adapters/index.d.ts.map +0 -1
- package/dist/adapters/index.js +0 -21
- package/dist/adapters/index.js.map +0 -1
- package/dist/adapters/mock-dashboard-renderer.adapter.d.ts +0 -86
- package/dist/adapters/mock-dashboard-renderer.adapter.d.ts.map +0 -1
- package/dist/adapters/mock-dashboard-renderer.adapter.js +0 -93
- package/dist/adapters/mock-dashboard-renderer.adapter.js.map +0 -1
- package/dist/adapters/recovery-adapters.d.ts +0 -41
- package/dist/adapters/recovery-adapters.d.ts.map +0 -1
- package/dist/adapters/recovery-adapters.js +0 -32
- package/dist/adapters/recovery-adapters.js.map +0 -1
- package/dist/adapters/terminal-renderer.adapter.d.ts +0 -86
- package/dist/adapters/terminal-renderer.adapter.d.ts.map +0 -1
- package/dist/adapters/terminal-renderer.adapter.js +0 -342
- package/dist/adapters/terminal-renderer.adapter.js.map +0 -1
- package/dist/adapters/validation-adapters.d.ts +0 -53
- package/dist/adapters/validation-adapters.d.ts.map +0 -1
- package/dist/adapters/validation-adapters.js +0 -48
- package/dist/adapters/validation-adapters.js.map +0 -1
- package/dist/agent-patterns-registry.d.ts +0 -141
- package/dist/agent-patterns-registry.d.ts.map +0 -1
- package/dist/agent-patterns-registry.js +0 -319
- package/dist/agent-patterns-registry.js.map +0 -1
- package/dist/arg-parser.d.ts +0 -94
- package/dist/arg-parser.d.ts.map +0 -1
- package/dist/arg-parser.js +0 -774
- package/dist/arg-parser.js.map +0 -1
- package/dist/atomic-merge.d.ts +0 -21
- package/dist/atomic-merge.d.ts.map +0 -1
- package/dist/atomic-merge.js +0 -87
- package/dist/atomic-merge.js.map +0 -1
- package/dist/backlog-editor.d.ts +0 -103
- package/dist/backlog-editor.d.ts.map +0 -1
- package/dist/backlog-editor.js +0 -158
- package/dist/backlog-editor.js.map +0 -1
- package/dist/backlog-generator.d.ts +0 -90
- package/dist/backlog-generator.d.ts.map +0 -1
- package/dist/backlog-generator.js +0 -536
- package/dist/backlog-generator.js.map +0 -1
- package/dist/backlog-parser.d.ts +0 -46
- package/dist/backlog-parser.d.ts.map +0 -1
- package/dist/backlog-parser.js +0 -105
- package/dist/backlog-parser.js.map +0 -1
- package/dist/backlog-sync-validator.d.ts +0 -88
- package/dist/backlog-sync-validator.d.ts.map +0 -1
- package/dist/backlog-sync-validator.js +0 -324
- package/dist/backlog-sync-validator.js.map +0 -1
- package/dist/beacon-migration.d.ts +0 -56
- package/dist/beacon-migration.js +0 -101
- package/dist/branch-check.d.ts +0 -63
- package/dist/branch-check.d.ts.map +0 -1
- package/dist/branch-check.js +0 -197
- package/dist/branch-check.js.map +0 -1
- package/dist/branch-drift.d.ts +0 -24
- package/dist/branch-drift.d.ts.map +0 -1
- package/dist/branch-drift.js +0 -54
- package/dist/branch-drift.js.map +0 -1
- package/dist/cleanup-install-config.d.ts +0 -24
- package/dist/cleanup-install-config.d.ts.map +0 -1
- package/dist/cleanup-install-config.js +0 -40
- package/dist/cleanup-install-config.js.map +0 -1
- package/dist/cleanup-lock.d.ts +0 -125
- package/dist/cleanup-lock.d.ts.map +0 -1
- package/dist/cleanup-lock.js +0 -325
- package/dist/cleanup-lock.js.map +0 -1
- package/dist/cli/is-agent-branch.d.ts +0 -15
- package/dist/cli/is-agent-branch.d.ts.map +0 -1
- package/dist/cli/is-agent-branch.js.map +0 -1
- package/dist/cloud-detect.d.ts +0 -145
- package/dist/cloud-detect.d.ts.map +0 -1
- package/dist/cloud-detect.js +0 -116
- package/dist/cloud-detect.js.map +0 -1
- package/dist/code-path-validator.d.ts +0 -147
- package/dist/code-path-validator.d.ts.map +0 -1
- package/dist/code-path-validator.js +0 -551
- package/dist/code-path-validator.js.map +0 -1
- package/dist/code-paths-overlap.d.ts +0 -50
- package/dist/code-paths-overlap.d.ts.map +0 -1
- package/dist/code-paths-overlap.js +0 -248
- package/dist/code-paths-overlap.js.map +0 -1
- package/dist/color-support.d.ts +0 -21
- package/dist/color-support.d.ts.map +0 -1
- package/dist/color-support.js +0 -67
- package/dist/color-support.js.map +0 -1
- package/dist/commands-logger.d.ts +0 -71
- package/dist/commands-logger.d.ts.map +0 -1
- package/dist/commands-logger.js +0 -256
- package/dist/commands-logger.js.map +0 -1
- package/dist/commit-message-utils.d.ts +0 -26
- package/dist/commit-message-utils.d.ts.map +0 -1
- package/dist/commit-message-utils.js +0 -44
- package/dist/commit-message-utils.js.map +0 -1
- package/dist/compliance-parser.d.ts +0 -125
- package/dist/compliance-parser.d.ts.map +0 -1
- package/dist/compliance-parser.js +0 -457
- package/dist/compliance-parser.js.map +0 -1
- package/dist/constants/backlog-patterns.d.ts +0 -21
- package/dist/constants/backlog-patterns.d.ts.map +0 -1
- package/dist/constants/backlog-patterns.js +0 -26
- package/dist/constants/backlog-patterns.js.map +0 -1
- package/dist/constants/dora-constants.d.ts +0 -50
- package/dist/constants/dora-constants.d.ts.map +0 -1
- package/dist/constants/dora-constants.js +0 -56
- package/dist/constants/dora-constants.js.map +0 -1
- package/dist/constants/gate-constants.d.ts +0 -16
- package/dist/constants/gate-constants.d.ts.map +0 -1
- package/dist/constants/gate-constants.js +0 -18
- package/dist/constants/gate-constants.js.map +0 -1
- package/dist/constants/linter-constants.d.ts +0 -17
- package/dist/constants/linter-constants.d.ts.map +0 -1
- package/dist/constants/linter-constants.js +0 -19
- package/dist/constants/linter-constants.js.map +0 -1
- package/dist/constants/tokenizer-constants.d.ts +0 -16
- package/dist/constants/tokenizer-constants.d.ts.map +0 -1
- package/dist/constants/tokenizer-constants.js +0 -18
- package/dist/constants/tokenizer-constants.js.map +0 -1
- package/dist/context/context-computer.d.ts +0 -36
- package/dist/context/context-computer.d.ts.map +0 -1
- package/dist/context/context-computer.js +0 -128
- package/dist/context/context-computer.js.map +0 -1
- package/dist/context/git-state-reader.d.ts +0 -37
- package/dist/context/git-state-reader.d.ts.map +0 -1
- package/dist/context/git-state-reader.js +0 -64
- package/dist/context/git-state-reader.js.map +0 -1
- package/dist/context/index.d.ts +0 -18
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -20
- package/dist/context/index.js.map +0 -1
- package/dist/context/location-resolver.d.ts +0 -34
- package/dist/context/location-resolver.d.ts.map +0 -1
- package/dist/context/location-resolver.js +0 -179
- package/dist/context/location-resolver.js.map +0 -1
- package/dist/context/wu-state-reader.d.ts +0 -30
- package/dist/context/wu-state-reader.d.ts.map +0 -1
- package/dist/context/wu-state-reader.js +0 -126
- package/dist/context/wu-state-reader.js.map +0 -1
- package/dist/context-di.d.ts +0 -185
- package/dist/context-di.d.ts.map +0 -1
- package/dist/context-di.js +0 -165
- package/dist/context-di.js.map +0 -1
- package/dist/context-validation-integration.d.ts +0 -69
- package/dist/context-validation-integration.d.ts.map +0 -1
- package/dist/context-validation-integration.js +0 -161
- package/dist/context-validation-integration.js.map +0 -1
- package/dist/core/scope-checker.d.ts +0 -80
- package/dist/core/scope-checker.d.ts.map +0 -1
- package/dist/core/scope-checker.js +0 -166
- package/dist/core/scope-checker.js.map +0 -1
- package/dist/core/tool-runner.d.ts +0 -136
- package/dist/core/tool-runner.d.ts.map +0 -1
- package/dist/core/tool-runner.js +0 -396
- package/dist/core/tool-runner.js.map +0 -1
- package/dist/core/tool.constants.d.ts +0 -106
- package/dist/core/tool.constants.d.ts.map +0 -1
- package/dist/core/tool.constants.js +0 -104
- package/dist/core/tool.constants.js.map +0 -1
- package/dist/core/tool.schemas.d.ts +0 -227
- package/dist/core/tool.schemas.d.ts.map +0 -1
- package/dist/core/tool.schemas.js +0 -229
- package/dist/core/tool.schemas.js.map +0 -1
- package/dist/core/worktree-guard.d.ts +0 -115
- package/dist/core/worktree-guard.d.ts.map +0 -1
- package/dist/core/worktree-guard.js +0 -245
- package/dist/core/worktree-guard.js.map +0 -1
- package/dist/coverage-gate.d.ts +0 -126
- package/dist/coverage-gate.d.ts.map +0 -1
- package/dist/coverage-gate.js +0 -209
- package/dist/coverage-gate.js.map +0 -1
- package/dist/cycle-detector.d.ts +0 -52
- package/dist/cycle-detector.d.ts.map +0 -1
- package/dist/cycle-detector.js +0 -84
- package/dist/cycle-detector.js.map +0 -1
- package/dist/date-utils.d.ts +0 -66
- package/dist/date-utils.d.ts.map +0 -1
- package/dist/date-utils.js +0 -143
- package/dist/date-utils.js.map +0 -1
- package/dist/delegation-escalation.d.ts +0 -71
- package/dist/delegation-escalation.d.ts.map +0 -1
- package/dist/delegation-escalation.js +0 -264
- package/dist/delegation-escalation.js.map +0 -1
- package/dist/delegation-monitor.d.ts +0 -262
- package/dist/delegation-monitor.d.ts.map +0 -1
- package/dist/delegation-monitor.js +0 -678
- package/dist/delegation-monitor.js.map +0 -1
- package/dist/delegation-recovery.d.ts +0 -62
- package/dist/delegation-recovery.d.ts.map +0 -1
- package/dist/delegation-recovery.js +0 -304
- package/dist/delegation-recovery.js.map +0 -1
- package/dist/delegation-registry-schema.d.ts +0 -75
- package/dist/delegation-registry-schema.d.ts.map +0 -1
- package/dist/delegation-registry-schema.js +0 -93
- package/dist/delegation-registry-schema.js.map +0 -1
- package/dist/delegation-registry-store.d.ts +0 -145
- package/dist/delegation-registry-store.d.ts.map +0 -1
- package/dist/delegation-registry-store.js +0 -308
- package/dist/delegation-registry-store.js.map +0 -1
- package/dist/delegation-tree.d.ts +0 -52
- package/dist/delegation-tree.d.ts.map +0 -1
- package/dist/delegation-tree.js +0 -205
- package/dist/delegation-tree.js.map +0 -1
- package/dist/dependency-graph.d.ts +0 -169
- package/dist/dependency-graph.d.ts.map +0 -1
- package/dist/dependency-graph.js +0 -612
- package/dist/dependency-graph.js.map +0 -1
- package/dist/dependency-guard.d.ts +0 -41
- package/dist/dependency-guard.d.ts.map +0 -1
- package/dist/dependency-guard.js +0 -145
- package/dist/dependency-guard.js.map +0 -1
- package/dist/dependency-validator.d.ts +0 -89
- package/dist/dependency-validator.d.ts.map +0 -1
- package/dist/dependency-validator.js +0 -155
- package/dist/dependency-validator.js.map +0 -1
- package/dist/docs-path-validator.d.ts +0 -16
- package/dist/docs-path-validator.d.ts.map +0 -1
- package/dist/docs-path-validator.js +0 -98
- package/dist/docs-path-validator.js.map +0 -1
- package/dist/domain/context.schemas.d.ts +0 -170
- package/dist/domain/context.schemas.d.ts.map +0 -1
- package/dist/domain/context.schemas.js +0 -151
- package/dist/domain/context.schemas.js.map +0 -1
- package/dist/domain/index.d.ts +0 -15
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -23
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/orchestration.constants.d.ts +0 -111
- package/dist/domain/orchestration.constants.d.ts.map +0 -1
- package/dist/domain/orchestration.constants.js +0 -130
- package/dist/domain/orchestration.constants.js.map +0 -1
- package/dist/domain/orchestration.schemas.d.ts +0 -307
- package/dist/domain/orchestration.schemas.d.ts.map +0 -1
- package/dist/domain/orchestration.schemas.js +0 -214
- package/dist/domain/orchestration.schemas.js.map +0 -1
- package/dist/domain/orchestration.types.d.ts +0 -134
- package/dist/domain/orchestration.types.d.ts.map +0 -1
- package/dist/domain/orchestration.types.js +0 -5
- package/dist/domain/orchestration.types.js.map +0 -1
- package/dist/domain/recovery.schemas.d.ts +0 -164
- package/dist/domain/recovery.schemas.d.ts.map +0 -1
- package/dist/domain/recovery.schemas.js +0 -134
- package/dist/domain/recovery.schemas.js.map +0 -1
- package/dist/domain/validation.schemas.d.ts +0 -147
- package/dist/domain/validation.schemas.d.ts.map +0 -1
- package/dist/domain/validation.schemas.js +0 -117
- package/dist/domain/validation.schemas.js.map +0 -1
- package/dist/error-handler.d.ts +0 -144
- package/dist/error-handler.d.ts.map +0 -1
- package/dist/error-handler.js +0 -214
- package/dist/error-handler.js.map +0 -1
- package/dist/file-classifiers.d.ts +0 -63
- package/dist/file-classifiers.d.ts.map +0 -1
- package/dist/file-classifiers.js +0 -111
- package/dist/file-classifiers.js.map +0 -1
- package/dist/force-bypass-audit.d.ts +0 -47
- package/dist/force-bypass-audit.d.ts.map +0 -1
- package/dist/force-bypass-audit.js +0 -146
- package/dist/force-bypass-audit.js.map +0 -1
- package/dist/gates-agent-mode.d.ts +0 -107
- package/dist/gates-agent-mode.d.ts.map +0 -1
- package/dist/gates-agent-mode.js +0 -138
- package/dist/gates-agent-mode.js.map +0 -1
- package/dist/gates-config.d.ts +0 -268
- package/dist/gates-config.d.ts.map +0 -1
- package/dist/gates-config.js +0 -644
- package/dist/gates-config.js.map +0 -1
- package/dist/generate-traceability.d.ts +0 -106
- package/dist/generate-traceability.d.ts.map +0 -1
- package/dist/generate-traceability.js +0 -387
- package/dist/generate-traceability.js.map +0 -1
- package/dist/git-adapter.d.ts +0 -406
- package/dist/git-adapter.d.ts.map +0 -1
- package/dist/git-adapter.js +0 -686
- package/dist/git-adapter.js.map +0 -1
- package/dist/git-context-extractor.d.ts +0 -102
- package/dist/git-context-extractor.d.ts.map +0 -1
- package/dist/git-context-extractor.js +0 -571
- package/dist/git-context-extractor.js.map +0 -1
- package/dist/git-staged-validator.d.ts +0 -33
- package/dist/git-staged-validator.d.ts.map +0 -1
- package/dist/git-staged-validator.js +0 -52
- package/dist/git-staged-validator.js.map +0 -1
- package/dist/hardcoded-strings.d.ts +0 -67
- package/dist/hardcoded-strings.d.ts.map +0 -1
- package/dist/hardcoded-strings.js +0 -276
- package/dist/hardcoded-strings.js.map +0 -1
- package/dist/incremental-lint.d.ts +0 -71
- package/dist/incremental-lint.d.ts.map +0 -1
- package/dist/incremental-lint.js +0 -132
- package/dist/incremental-lint.js.map +0 -1
- package/dist/incremental-test.d.ts +0 -33
- package/dist/incremental-test.d.ts.map +0 -1
- package/dist/incremental-test.js +0 -64
- package/dist/incremental-test.js.map +0 -1
- package/dist/index.d.ts +0 -104
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invariants/check-automated-tests.d.ts +0 -42
- package/dist/invariants/check-automated-tests.d.ts.map +0 -1
- package/dist/invariants/check-automated-tests.js +0 -171
- package/dist/invariants/check-automated-tests.js.map +0 -1
- package/dist/invariants-runner.d.ts +0 -108
- package/dist/invariants-runner.d.ts.map +0 -1
- package/dist/invariants-runner.js +0 -547
- package/dist/invariants-runner.js.map +0 -1
- package/dist/lane-checker.d.ts +0 -132
- package/dist/lane-checker.d.ts.map +0 -1
- package/dist/lane-checker.js +0 -743
- package/dist/lane-checker.js.map +0 -1
- package/dist/lane-inference.d.ts +0 -29
- package/dist/lane-inference.d.ts.map +0 -1
- package/dist/lane-inference.js +0 -210
- package/dist/lane-inference.js.map +0 -1
- package/dist/lane-lock.d.ts +0 -220
- package/dist/lane-lock.d.ts.map +0 -1
- package/dist/lane-lock.js +0 -499
- package/dist/lane-lock.js.map +0 -1
- package/dist/lane-suggest-prompt.d.ts +0 -97
- package/dist/lane-suggest-prompt.d.ts.map +0 -1
- package/dist/lane-suggest-prompt.js +0 -362
- package/dist/lane-suggest-prompt.js.map +0 -1
- package/dist/lane-validator.d.ts +0 -49
- package/dist/lane-validator.d.ts.map +0 -1
- package/dist/lane-validator.js +0 -117
- package/dist/lane-validator.js.map +0 -1
- package/dist/logs-lib.d.ts +0 -89
- package/dist/logs-lib.d.ts.map +0 -1
- package/dist/logs-lib.js +0 -214
- package/dist/logs-lib.js.map +0 -1
- package/dist/lumenflow-config-schema.d.ts +0 -1428
- package/dist/lumenflow-config-schema.d.ts.map +0 -1
- package/dist/lumenflow-config-schema.js +0 -1255
- package/dist/lumenflow-config-schema.js.map +0 -1
- package/dist/lumenflow-config.d.ts +0 -94
- package/dist/lumenflow-config.d.ts.map +0 -1
- package/dist/lumenflow-config.js +0 -253
- package/dist/lumenflow-config.js.map +0 -1
- package/dist/lumenflow-home.d.ts +0 -118
- package/dist/lumenflow-home.d.ts.map +0 -1
- package/dist/lumenflow-home.js +0 -214
- package/dist/lumenflow-home.js.map +0 -1
- package/dist/manual-test-validator.d.ts +0 -84
- package/dist/manual-test-validator.d.ts.map +0 -1
- package/dist/manual-test-validator.js +0 -206
- package/dist/manual-test-validator.js.map +0 -1
- package/dist/merge-lock.d.ts +0 -107
- package/dist/merge-lock.d.ts.map +0 -1
- package/dist/merge-lock.js +0 -263
- package/dist/merge-lock.js.map +0 -1
- package/dist/micro-worktree-shared.d.ts +0 -128
- package/dist/micro-worktree-shared.d.ts.map +0 -1
- package/dist/micro-worktree-shared.js +0 -352
- package/dist/micro-worktree-shared.js.map +0 -1
- package/dist/micro-worktree.d.ts +0 -165
- package/dist/micro-worktree.d.ts.map +0 -1
- package/dist/micro-worktree.js +0 -463
- package/dist/micro-worktree.js.map +0 -1
- package/dist/migration-deployer.d.ts +0 -70
- package/dist/migration-deployer.d.ts.map +0 -1
- package/dist/migration-deployer.js +0 -152
- package/dist/migration-deployer.js.map +0 -1
- package/dist/normalize-config-keys.d.ts +0 -10
- package/dist/normalize-config-keys.d.ts.map +0 -1
- package/dist/normalize-config-keys.js +0 -70
- package/dist/normalize-config-keys.js.map +0 -1
- package/dist/orchestration-advisory-loader.d.ts +0 -19
- package/dist/orchestration-advisory-loader.d.ts.map +0 -1
- package/dist/orchestration-advisory-loader.js +0 -94
- package/dist/orchestration-advisory-loader.js.map +0 -1
- package/dist/orchestration-advisory.d.ts +0 -49
- package/dist/orchestration-advisory.d.ts.map +0 -1
- package/dist/orchestration-advisory.js +0 -97
- package/dist/orchestration-advisory.js.map +0 -1
- package/dist/orchestration-di.d.ts +0 -36
- package/dist/orchestration-di.d.ts.map +0 -1
- package/dist/orchestration-di.js +0 -60
- package/dist/orchestration-di.js.map +0 -1
- package/dist/orchestration-rules.d.ts +0 -60
- package/dist/orchestration-rules.d.ts.map +0 -1
- package/dist/orchestration-rules.js +0 -212
- package/dist/orchestration-rules.js.map +0 -1
- package/dist/orphan-detector.d.ts +0 -148
- package/dist/orphan-detector.d.ts.map +0 -1
- package/dist/orphan-detector.js +0 -253
- package/dist/orphan-detector.js.map +0 -1
- package/dist/pack-authoring-template-engine.d.ts +0 -54
- package/dist/pack-authoring-template-engine.d.ts.map +0 -1
- package/dist/pack-authoring-template-engine.js +0 -510
- package/dist/pack-authoring-template-engine.js.map +0 -1
- package/dist/path-classifiers.d.ts +0 -58
- package/dist/path-classifiers.d.ts.map +0 -1
- package/dist/path-classifiers.js +0 -96
- package/dist/path-classifiers.js.map +0 -1
- package/dist/patrol-loop.d.ts +0 -171
- package/dist/patrol-loop.d.ts.map +0 -1
- package/dist/patrol-loop.js +0 -197
- package/dist/patrol-loop.js.map +0 -1
- package/dist/piped-command-detector.d.ts +0 -25
- package/dist/piped-command-detector.d.ts.map +0 -1
- package/dist/piped-command-detector.js +0 -67
- package/dist/piped-command-detector.js.map +0 -1
- package/dist/ports/context.ports.d.ts +0 -136
- package/dist/ports/context.ports.d.ts.map +0 -1
- package/dist/ports/context.ports.js +0 -4
- package/dist/ports/context.ports.js.map +0 -1
- package/dist/ports/core-tools.ports.d.ts +0 -282
- package/dist/ports/core-tools.ports.d.ts.map +0 -1
- package/dist/ports/core-tools.ports.js +0 -4
- package/dist/ports/core-tools.ports.js.map +0 -1
- package/dist/ports/dashboard-renderer.port.d.ts +0 -113
- package/dist/ports/dashboard-renderer.port.d.ts.map +0 -1
- package/dist/ports/dashboard-renderer.port.js +0 -4
- package/dist/ports/dashboard-renderer.port.js.map +0 -1
- package/dist/ports/git-validator.ports.d.ts +0 -114
- package/dist/ports/git-validator.ports.d.ts.map +0 -1
- package/dist/ports/git-validator.ports.js +0 -4
- package/dist/ports/git-validator.ports.js.map +0 -1
- package/dist/ports/index.d.ts +0 -21
- package/dist/ports/index.d.ts.map +0 -1
- package/dist/ports/index.js +0 -23
- package/dist/ports/index.js.map +0 -1
- package/dist/ports/metrics-collector.port.d.ts +0 -133
- package/dist/ports/metrics-collector.port.d.ts.map +0 -1
- package/dist/ports/metrics-collector.port.js +0 -4
- package/dist/ports/metrics-collector.port.js.map +0 -1
- package/dist/ports/recovery.ports.d.ts +0 -59
- package/dist/ports/recovery.ports.d.ts.map +0 -1
- package/dist/ports/recovery.ports.js +0 -4
- package/dist/ports/recovery.ports.js.map +0 -1
- package/dist/ports/validation.ports.d.ts +0 -75
- package/dist/ports/validation.ports.d.ts.map +0 -1
- package/dist/ports/validation.ports.js +0 -4
- package/dist/ports/validation.ports.js.map +0 -1
- package/dist/ports/wu-helpers.ports.d.ts +0 -227
- package/dist/ports/wu-helpers.ports.d.ts.map +0 -1
- package/dist/ports/wu-helpers.ports.js +0 -4
- package/dist/ports/wu-helpers.ports.js.map +0 -1
- package/dist/process-detector.d.ts +0 -69
- package/dist/process-detector.d.ts.map +0 -1
- package/dist/process-detector.js +0 -175
- package/dist/process-detector.js.map +0 -1
- package/dist/prompt-linter.d.ts +0 -66
- package/dist/prompt-linter.d.ts.map +0 -1
- package/dist/prompt-linter.js +0 -323
- package/dist/prompt-linter.js.map +0 -1
- package/dist/prompt-monitor.d.ts +0 -6
- package/dist/prompt-monitor.d.ts.map +0 -1
- package/dist/prompt-monitor.js +0 -218
- package/dist/prompt-monitor.js.map +0 -1
- package/dist/rebase-artifact-cleanup.d.ts +0 -156
- package/dist/rebase-artifact-cleanup.d.ts.map +0 -1
- package/dist/rebase-artifact-cleanup.js +0 -475
- package/dist/rebase-artifact-cleanup.js.map +0 -1
- package/dist/recovery/index.d.ts +0 -12
- package/dist/recovery/index.d.ts.map +0 -1
- package/dist/recovery/index.js +0 -14
- package/dist/recovery/index.js.map +0 -1
- package/dist/recovery/recovery-analyzer.d.ts +0 -49
- package/dist/recovery/recovery-analyzer.d.ts.map +0 -1
- package/dist/recovery/recovery-analyzer.js +0 -149
- package/dist/recovery/recovery-analyzer.js.map +0 -1
- package/dist/resolve-policy.d.ts +0 -257
- package/dist/resolve-policy.d.ts.map +0 -1
- package/dist/resolve-policy.js +0 -269
- package/dist/resolve-policy.js.map +0 -1
- package/dist/retry-strategy.d.ts +0 -191
- package/dist/retry-strategy.d.ts.map +0 -1
- package/dist/retry-strategy.js +0 -286
- package/dist/retry-strategy.js.map +0 -1
- package/dist/risk-detector.d.ts +0 -109
- package/dist/risk-detector.d.ts.map +0 -1
- package/dist/risk-detector.js +0 -253
- package/dist/risk-detector.js.map +0 -1
- package/dist/rollback-utils.d.ts +0 -129
- package/dist/rollback-utils.d.ts.map +0 -1
- package/dist/rollback-utils.js +0 -217
- package/dist/rollback-utils.js.map +0 -1
- package/dist/sandbox-allowlist.d.ts +0 -16
- package/dist/sandbox-allowlist.d.ts.map +0 -1
- package/dist/sandbox-allowlist.js +0 -77
- package/dist/sandbox-allowlist.js.map +0 -1
- package/dist/sandbox-backend-linux.d.ts +0 -6
- package/dist/sandbox-backend-linux.d.ts.map +0 -1
- package/dist/sandbox-backend-linux.js +0 -67
- package/dist/sandbox-backend-linux.js.map +0 -1
- package/dist/sandbox-backend-macos.d.ts +0 -6
- package/dist/sandbox-backend-macos.d.ts.map +0 -1
- package/dist/sandbox-backend-macos.js +0 -66
- package/dist/sandbox-backend-macos.js.map +0 -1
- package/dist/sandbox-backend-windows.d.ts +0 -6
- package/dist/sandbox-backend-windows.d.ts.map +0 -1
- package/dist/sandbox-backend-windows.js +0 -30
- package/dist/sandbox-backend-windows.js.map +0 -1
- package/dist/sandbox-profile.d.ts +0 -53
- package/dist/sandbox-profile.d.ts.map +0 -1
- package/dist/sandbox-profile.js +0 -64
- package/dist/sandbox-profile.js.map +0 -1
- package/dist/schemas/arg-validators.d.ts +0 -58
- package/dist/schemas/arg-validators.d.ts.map +0 -1
- package/dist/schemas/arg-validators.js +0 -193
- package/dist/schemas/arg-validators.js.map +0 -1
- package/dist/schemas/command-schemas.d.ts +0 -171
- package/dist/schemas/command-schemas.d.ts.map +0 -1
- package/dist/schemas/command-schemas.js +0 -145
- package/dist/schemas/command-schemas.js.map +0 -1
- package/dist/schemas/flow-arg-validators.d.ts +0 -32
- package/dist/schemas/flow-arg-validators.d.ts.map +0 -1
- package/dist/schemas/flow-arg-validators.js +0 -57
- package/dist/schemas/flow-arg-validators.js.map +0 -1
- package/dist/schemas/flow-schemas.d.ts +0 -152
- package/dist/schemas/flow-schemas.d.ts.map +0 -1
- package/dist/schemas/flow-schemas.js +0 -105
- package/dist/schemas/flow-schemas.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -33
- package/dist/schemas/index.d.ts.map +0 -1
- package/dist/schemas/index.js +0 -96
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/initiative-arg-validators.d.ts +0 -64
- package/dist/schemas/initiative-arg-validators.d.ts.map +0 -1
- package/dist/schemas/initiative-arg-validators.js +0 -65
- package/dist/schemas/initiative-arg-validators.js.map +0 -1
- package/dist/schemas/initiative-schemas.d.ts +0 -256
- package/dist/schemas/initiative-schemas.d.ts.map +0 -1
- package/dist/schemas/initiative-schemas.js +0 -186
- package/dist/schemas/initiative-schemas.js.map +0 -1
- package/dist/schemas/memory-arg-validators.d.ts +0 -91
- package/dist/schemas/memory-arg-validators.d.ts.map +0 -1
- package/dist/schemas/memory-arg-validators.js +0 -75
- package/dist/schemas/memory-arg-validators.js.map +0 -1
- package/dist/schemas/memory-schemas.d.ts +0 -287
- package/dist/schemas/memory-schemas.d.ts.map +0 -1
- package/dist/schemas/memory-schemas.js +0 -242
- package/dist/schemas/memory-schemas.js.map +0 -1
- package/dist/schemas/schema-utils.d.ts +0 -87
- package/dist/schemas/schema-utils.d.ts.map +0 -1
- package/dist/schemas/schema-utils.js +0 -320
- package/dist/schemas/schema-utils.js.map +0 -1
- package/dist/schemas/setup-arg-validators.d.ts +0 -91
- package/dist/schemas/setup-arg-validators.d.ts.map +0 -1
- package/dist/schemas/setup-arg-validators.js +0 -98
- package/dist/schemas/setup-arg-validators.js.map +0 -1
- package/dist/schemas/setup-schemas.d.ts +0 -335
- package/dist/schemas/setup-schemas.d.ts.map +0 -1
- package/dist/schemas/setup-schemas.js +0 -260
- package/dist/schemas/setup-schemas.js.map +0 -1
- package/dist/schemas/validation-arg-validators.d.ts +0 -18
- package/dist/schemas/validation-arg-validators.d.ts.map +0 -1
- package/dist/schemas/validation-arg-validators.js +0 -59
- package/dist/schemas/validation-arg-validators.js.map +0 -1
- package/dist/schemas/validation-schemas.d.ts +0 -80
- package/dist/schemas/validation-schemas.d.ts.map +0 -1
- package/dist/schemas/validation-schemas.js +0 -88
- package/dist/schemas/validation-schemas.js.map +0 -1
- package/dist/schemas/wu-lifecycle-arg-validators.d.ts +0 -118
- package/dist/schemas/wu-lifecycle-arg-validators.d.ts.map +0 -1
- package/dist/schemas/wu-lifecycle-arg-validators.js +0 -82
- package/dist/schemas/wu-lifecycle-arg-validators.js.map +0 -1
- package/dist/schemas/wu-lifecycle-schemas.d.ts +0 -362
- package/dist/schemas/wu-lifecycle-schemas.d.ts.map +0 -1
- package/dist/schemas/wu-lifecycle-schemas.js +0 -284
- package/dist/schemas/wu-lifecycle-schemas.js.map +0 -1
- package/dist/section-headings.d.ts +0 -35
- package/dist/section-headings.d.ts.map +0 -1
- package/dist/section-headings.js +0 -54
- package/dist/section-headings.js.map +0 -1
- package/dist/spawn-escalation.d.ts +0 -91
- package/dist/spawn-escalation.d.ts.map +0 -1
- package/dist/spawn-escalation.js +0 -258
- package/dist/spawn-escalation.js.map +0 -1
- package/dist/spawn-monitor.d.ts +0 -230
- package/dist/spawn-monitor.d.ts.map +0 -1
- package/dist/spawn-monitor.js +0 -675
- package/dist/spawn-monitor.js.map +0 -1
- package/dist/spawn-prompt-schema.d.ts +0 -107
- package/dist/spawn-prompt-schema.d.ts.map +0 -1
- package/dist/spawn-prompt-schema.js +0 -163
- package/dist/spawn-prompt-schema.js.map +0 -1
- package/dist/spawn-recovery.d.ts +0 -83
- package/dist/spawn-recovery.d.ts.map +0 -1
- package/dist/spawn-recovery.js +0 -299
- package/dist/spawn-recovery.js.map +0 -1
- package/dist/spawn-registry-schema.d.ts +0 -122
- package/dist/spawn-registry-schema.d.ts.map +0 -1
- package/dist/spawn-registry-schema.js +0 -129
- package/dist/spawn-registry-schema.js.map +0 -1
- package/dist/spawn-registry-store.d.ts +0 -161
- package/dist/spawn-registry-store.d.ts.map +0 -1
- package/dist/spawn-registry-store.js +0 -301
- package/dist/spawn-registry-store.js.map +0 -1
- package/dist/spawn-strategy.d.ts +0 -60
- package/dist/spawn-strategy.d.ts.map +0 -1
- package/dist/spawn-strategy.js +0 -112
- package/dist/spawn-strategy.js.map +0 -1
- package/dist/spawn-tree.d.ts +0 -125
- package/dist/spawn-tree.d.ts.map +0 -1
- package/dist/spawn-tree.js +0 -286
- package/dist/spawn-tree.js.map +0 -1
- package/dist/stamp-status-validator.d.ts +0 -77
- package/dist/stamp-status-validator.d.ts.map +0 -1
- package/dist/stamp-status-validator.js +0 -138
- package/dist/stamp-status-validator.js.map +0 -1
- package/dist/stamp-tracking.d.ts +0 -12
- package/dist/stamp-tracking.d.ts.map +0 -1
- package/dist/stamp-tracking.js +0 -43
- package/dist/stamp-tracking.js.map +0 -1
- package/dist/stamp-utils.d.ts +0 -94
- package/dist/stamp-utils.d.ts.map +0 -1
- package/dist/stamp-utils.js +0 -245
- package/dist/stamp-utils.js.map +0 -1
- package/dist/state-cleanup-core.d.ts +0 -206
- package/dist/state-cleanup-core.d.ts.map +0 -1
- package/dist/state-cleanup-core.js +0 -225
- package/dist/state-cleanup-core.js.map +0 -1
- package/dist/state-doctor-core.d.ts +0 -177
- package/dist/state-doctor-core.d.ts.map +0 -1
- package/dist/state-doctor-core.js +0 -395
- package/dist/state-doctor-core.js.map +0 -1
- package/dist/state-machine.d.ts +0 -10
- package/dist/state-machine.d.ts.map +0 -1
- package/dist/state-machine.js +0 -89
- package/dist/state-machine.js.map +0 -1
- package/dist/stream-error-handler.d.ts +0 -68
- package/dist/stream-error-handler.d.ts.map +0 -1
- package/dist/stream-error-handler.js +0 -77
- package/dist/stream-error-handler.js.map +0 -1
- package/dist/system-map-validator.d.ts +0 -111
- package/dist/system-map-validator.d.ts.map +0 -1
- package/dist/system-map-validator.js +0 -383
- package/dist/system-map-validator.js.map +0 -1
- package/dist/telemetry.d.ts +0 -81
- package/dist/telemetry.d.ts.map +0 -1
- package/dist/telemetry.js +0 -219
- package/dist/telemetry.js.map +0 -1
- package/dist/template-loader.d.ts +0 -151
- package/dist/template-loader.d.ts.map +0 -1
- package/dist/template-loader.js +0 -400
- package/dist/template-loader.js.map +0 -1
- package/dist/test-baseline.d.ts +0 -177
- package/dist/test-baseline.d.ts.map +0 -1
- package/dist/test-baseline.js +0 -286
- package/dist/test-baseline.js.map +0 -1
- package/dist/token-counter.d.ts +0 -50
- package/dist/token-counter.d.ts.map +0 -1
- package/dist/token-counter.js +0 -144
- package/dist/token-counter.js.map +0 -1
- package/dist/usecases/analyze-recovery.usecase.d.ts +0 -43
- package/dist/usecases/analyze-recovery.usecase.d.ts.map +0 -1
- package/dist/usecases/analyze-recovery.usecase.js +0 -34
- package/dist/usecases/analyze-recovery.usecase.js.map +0 -1
- package/dist/usecases/compute-context.usecase.d.ts +0 -63
- package/dist/usecases/compute-context.usecase.d.ts.map +0 -1
- package/dist/usecases/compute-context.usecase.js +0 -91
- package/dist/usecases/compute-context.usecase.js.map +0 -1
- package/dist/usecases/get-dashboard-data.usecase.d.ts +0 -53
- package/dist/usecases/get-dashboard-data.usecase.d.ts.map +0 -1
- package/dist/usecases/get-dashboard-data.usecase.js +0 -54
- package/dist/usecases/get-dashboard-data.usecase.js.map +0 -1
- package/dist/usecases/get-suggestions.usecase.d.ts +0 -101
- package/dist/usecases/get-suggestions.usecase.d.ts.map +0 -1
- package/dist/usecases/get-suggestions.usecase.js +0 -148
- package/dist/usecases/get-suggestions.usecase.js.map +0 -1
- package/dist/usecases/index.d.ts +0 -15
- package/dist/usecases/index.d.ts.map +0 -1
- package/dist/usecases/index.js +0 -21
- package/dist/usecases/index.js.map +0 -1
- package/dist/usecases/validate-command.usecase.d.ts +0 -56
- package/dist/usecases/validate-command.usecase.d.ts.map +0 -1
- package/dist/usecases/validate-command.usecase.js +0 -143
- package/dist/usecases/validate-command.usecase.js.map +0 -1
- package/dist/user-normalizer.d.ts +0 -36
- package/dist/user-normalizer.d.ts.map +0 -1
- package/dist/user-normalizer.js +0 -149
- package/dist/user-normalizer.js.map +0 -1
- package/dist/validation/command-registry.d.ts +0 -26
- package/dist/validation/command-registry.d.ts.map +0 -1
- package/dist/validation/command-registry.js +0 -269
- package/dist/validation/command-registry.js.map +0 -1
- package/dist/validation/index.d.ts +0 -16
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js +0 -18
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/types.d.ts +0 -140
- package/dist/validation/types.d.ts.map +0 -1
- package/dist/validation/types.js +0 -4
- package/dist/validation/types.js.map +0 -1
- package/dist/validation/validate-command.d.ts +0 -16
- package/dist/validation/validate-command.d.ts.map +0 -1
- package/dist/validation/validate-command.js +0 -163
- package/dist/validation/validate-command.js.map +0 -1
- package/dist/validators/backlog-sync.d.ts +0 -11
- package/dist/validators/backlog-sync.d.ts.map +0 -1
- package/dist/validators/backlog-sync.js +0 -65
- package/dist/validators/backlog-sync.js.map +0 -1
- package/dist/validators/phi-constants.d.ts +0 -98
- package/dist/validators/phi-constants.d.ts.map +0 -1
- package/dist/validators/phi-constants.js +0 -153
- package/dist/validators/phi-constants.js.map +0 -1
- package/dist/validators/phi-scanner.d.ts +0 -59
- package/dist/validators/phi-scanner.d.ts.map +0 -1
- package/dist/validators/phi-scanner.js +0 -222
- package/dist/validators/phi-scanner.js.map +0 -1
- package/dist/validators/supabase-docs-linter.d.ts +0 -15
- package/dist/validators/supabase-docs-linter.d.ts.map +0 -1
- package/dist/validators/supabase-docs-linter.js +0 -45
- package/dist/validators/supabase-docs-linter.js.map +0 -1
- package/dist/validators/wu-tasks.d.ts +0 -21
- package/dist/validators/wu-tasks.d.ts.map +0 -1
- package/dist/validators/wu-tasks.js +0 -93
- package/dist/validators/wu-tasks.js.map +0 -1
- package/dist/work-classifier.d.ts +0 -95
- package/dist/work-classifier.d.ts.map +0 -1
- package/dist/work-classifier.js +0 -408
- package/dist/work-classifier.js.map +0 -1
- package/dist/worktree-ownership.d.ts +0 -51
- package/dist/worktree-ownership.d.ts.map +0 -1
- package/dist/worktree-ownership.js +0 -77
- package/dist/worktree-ownership.js.map +0 -1
- package/dist/worktree-scanner.d.ts +0 -118
- package/dist/worktree-scanner.d.ts.map +0 -1
- package/dist/worktree-scanner.js +0 -171
- package/dist/worktree-scanner.js.map +0 -1
- package/dist/worktree-symlink.d.ts +0 -86
- package/dist/worktree-symlink.d.ts.map +0 -1
- package/dist/worktree-symlink.js +0 -349
- package/dist/worktree-symlink.js.map +0 -1
- package/dist/wu-backlog-updater.d.ts +0 -10
- package/dist/wu-backlog-updater.d.ts.map +0 -1
- package/dist/wu-backlog-updater.js +0 -40
- package/dist/wu-backlog-updater.js.map +0 -1
- package/dist/wu-checkpoint.d.ts +0 -110
- package/dist/wu-checkpoint.d.ts.map +0 -1
- package/dist/wu-checkpoint.js +0 -236
- package/dist/wu-checkpoint.js.map +0 -1
- package/dist/wu-claim-helpers.d.ts +0 -21
- package/dist/wu-claim-helpers.d.ts.map +0 -1
- package/dist/wu-claim-helpers.js +0 -66
- package/dist/wu-claim-helpers.js.map +0 -1
- package/dist/wu-claim-resume.d.ts +0 -106
- package/dist/wu-claim-resume.d.ts.map +0 -1
- package/dist/wu-claim-resume.js +0 -279
- package/dist/wu-claim-resume.js.map +0 -1
- package/dist/wu-cli-constants.d.ts +0 -425
- package/dist/wu-cli-constants.d.ts.map +0 -1
- package/dist/wu-cli-constants.js +0 -430
- package/dist/wu-cli-constants.js.map +0 -1
- package/dist/wu-consistency-checker.d.ts +0 -189
- package/dist/wu-consistency-checker.d.ts.map +0 -1
- package/dist/wu-consistency-checker.js +0 -1026
- package/dist/wu-consistency-checker.js.map +0 -1
- package/dist/wu-constants.d.ts +0 -29
- package/dist/wu-constants.d.ts.map +0 -1
- package/dist/wu-constants.js +0 -37
- package/dist/wu-constants.js.map +0 -1
- package/dist/wu-context-constants.d.ts +0 -270
- package/dist/wu-context-constants.d.ts.map +0 -1
- package/dist/wu-context-constants.js +0 -267
- package/dist/wu-context-constants.js.map +0 -1
- package/dist/wu-create-defaults.d.ts +0 -11
- package/dist/wu-create-defaults.d.ts.map +0 -1
- package/dist/wu-create-defaults.js +0 -13
- package/dist/wu-create-defaults.js.map +0 -1
- package/dist/wu-create-validators.d.ts +0 -89
- package/dist/wu-create-validators.d.ts.map +0 -1
- package/dist/wu-create-validators.js +0 -215
- package/dist/wu-create-validators.js.map +0 -1
- package/dist/wu-domain-constants.d.ts +0 -295
- package/dist/wu-domain-constants.d.ts.map +0 -1
- package/dist/wu-domain-constants.js +0 -399
- package/dist/wu-domain-constants.js.map +0 -1
- package/dist/wu-done-branch-only.d.ts +0 -120
- package/dist/wu-done-branch-only.d.ts.map +0 -1
- package/dist/wu-done-branch-only.js +0 -412
- package/dist/wu-done-branch-only.js.map +0 -1
- package/dist/wu-done-branch-utils.d.ts +0 -8
- package/dist/wu-done-branch-utils.d.ts.map +0 -1
- package/dist/wu-done-branch-utils.js +0 -34
- package/dist/wu-done-branch-utils.js.map +0 -1
- package/dist/wu-done-cleanup.d.ts +0 -6
- package/dist/wu-done-cleanup.d.ts.map +0 -1
- package/dist/wu-done-cleanup.js +0 -161
- package/dist/wu-done-cleanup.js.map +0 -1
- package/dist/wu-done-concurrent-merge.d.ts +0 -103
- package/dist/wu-done-concurrent-merge.d.ts.map +0 -1
- package/dist/wu-done-concurrent-merge.js +0 -375
- package/dist/wu-done-concurrent-merge.js.map +0 -1
- package/dist/wu-done-docs-generate.d.ts +0 -72
- package/dist/wu-done-docs-generate.d.ts.map +0 -1
- package/dist/wu-done-docs-generate.js +0 -129
- package/dist/wu-done-docs-generate.js.map +0 -1
- package/dist/wu-done-docs-only.d.ts +0 -16
- package/dist/wu-done-docs-only.d.ts.map +0 -1
- package/dist/wu-done-docs-only.js +0 -68
- package/dist/wu-done-docs-only.js.map +0 -1
- package/dist/wu-done-errors.d.ts +0 -13
- package/dist/wu-done-errors.d.ts.map +0 -1
- package/dist/wu-done-errors.js +0 -27
- package/dist/wu-done-errors.js.map +0 -1
- package/dist/wu-done-initiative-sync.d.ts +0 -13
- package/dist/wu-done-initiative-sync.d.ts.map +0 -1
- package/dist/wu-done-initiative-sync.js +0 -235
- package/dist/wu-done-initiative-sync.js.map +0 -1
- package/dist/wu-done-inputs.d.ts +0 -10
- package/dist/wu-done-inputs.d.ts.map +0 -1
- package/dist/wu-done-inputs.js +0 -55
- package/dist/wu-done-inputs.js.map +0 -1
- package/dist/wu-done-machine.d.ts +0 -175
- package/dist/wu-done-machine.d.ts.map +0 -1
- package/dist/wu-done-machine.js +0 -227
- package/dist/wu-done-machine.js.map +0 -1
- package/dist/wu-done-merged-worktree.d.ts +0 -65
- package/dist/wu-done-merged-worktree.d.ts.map +0 -1
- package/dist/wu-done-merged-worktree.js +0 -197
- package/dist/wu-done-merged-worktree.js.map +0 -1
- package/dist/wu-done-messages.d.ts +0 -120
- package/dist/wu-done-messages.d.ts.map +0 -1
- package/dist/wu-done-messages.js +0 -191
- package/dist/wu-done-messages.js.map +0 -1
- package/dist/wu-done-metadata.d.ts +0 -123
- package/dist/wu-done-metadata.d.ts.map +0 -1
- package/dist/wu-done-metadata.js +0 -240
- package/dist/wu-done-metadata.js.map +0 -1
- package/dist/wu-done-paths.d.ts +0 -87
- package/dist/wu-done-paths.d.ts.map +0 -1
- package/dist/wu-done-paths.js +0 -263
- package/dist/wu-done-paths.js.map +0 -1
- package/dist/wu-done-pr.d.ts +0 -76
- package/dist/wu-done-pr.d.ts.map +0 -1
- package/dist/wu-done-pr.js +0 -189
- package/dist/wu-done-pr.js.map +0 -1
- package/dist/wu-done-preflight.d.ts +0 -65
- package/dist/wu-done-preflight.d.ts.map +0 -1
- package/dist/wu-done-preflight.js +0 -205
- package/dist/wu-done-preflight.js.map +0 -1
- package/dist/wu-done-retry-helpers.d.ts +0 -75
- package/dist/wu-done-retry-helpers.d.ts.map +0 -1
- package/dist/wu-done-retry-helpers.js +0 -175
- package/dist/wu-done-retry-helpers.js.map +0 -1
- package/dist/wu-done-ui.d.ts +0 -29
- package/dist/wu-done-ui.d.ts.map +0 -1
- package/dist/wu-done-ui.js +0 -74
- package/dist/wu-done-ui.js.map +0 -1
- package/dist/wu-done-validation.d.ts +0 -128
- package/dist/wu-done-validation.d.ts.map +0 -1
- package/dist/wu-done-validation.js +0 -530
- package/dist/wu-done-validation.js.map +0 -1
- package/dist/wu-done-validators.d.ts +0 -16
- package/dist/wu-done-validators.d.ts.map +0 -1
- package/dist/wu-done-validators.js +0 -16
- package/dist/wu-done-validators.js.map +0 -1
- package/dist/wu-done-worktree-services.d.ts +0 -174
- package/dist/wu-done-worktree-services.d.ts.map +0 -1
- package/dist/wu-done-worktree-services.js +0 -274
- package/dist/wu-done-worktree-services.js.map +0 -1
- package/dist/wu-done-worktree.d.ts +0 -229
- package/dist/wu-done-worktree.d.ts.map +0 -1
- package/dist/wu-done-worktree.js +0 -1290
- package/dist/wu-done-worktree.js.map +0 -1
- package/dist/wu-events-cleanup.d.ts +0 -131
- package/dist/wu-events-cleanup.d.ts.map +0 -1
- package/dist/wu-events-cleanup.js +0 -404
- package/dist/wu-events-cleanup.js.map +0 -1
- package/dist/wu-git-constants.d.ts +0 -176
- package/dist/wu-git-constants.d.ts.map +0 -1
- package/dist/wu-git-constants.js +0 -178
- package/dist/wu-git-constants.js.map +0 -1
- package/dist/wu-helpers.d.ts +0 -133
- package/dist/wu-helpers.d.ts.map +0 -1
- package/dist/wu-helpers.js +0 -268
- package/dist/wu-helpers.js.map +0 -1
- package/dist/wu-id-generator.d.ts +0 -51
- package/dist/wu-id-generator.d.ts.map +0 -1
- package/dist/wu-id-generator.js +0 -110
- package/dist/wu-id-generator.js.map +0 -1
- package/dist/wu-lint.d.ts +0 -191
- package/dist/wu-lint.d.ts.map +0 -1
- package/dist/wu-lint.js +0 -338
- package/dist/wu-lint.js.map +0 -1
- package/dist/wu-list.d.ts +0 -76
- package/dist/wu-list.d.ts.map +0 -1
- package/dist/wu-list.js +0 -181
- package/dist/wu-list.js.map +0 -1
- package/dist/wu-paths-constants.d.ts +0 -264
- package/dist/wu-paths-constants.d.ts.map +0 -1
- package/dist/wu-paths-constants.js +0 -272
- package/dist/wu-paths-constants.js.map +0 -1
- package/dist/wu-paths.d.ts +0 -211
- package/dist/wu-paths.d.ts.map +0 -1
- package/dist/wu-paths.js +0 -223
- package/dist/wu-paths.js.map +0 -1
- package/dist/wu-preflight-validators.d.ts +0 -64
- package/dist/wu-preflight-validators.d.ts.map +0 -1
- package/dist/wu-preflight-validators.js +0 -277
- package/dist/wu-preflight-validators.js.map +0 -1
- package/dist/wu-recovery.d.ts +0 -220
- package/dist/wu-recovery.d.ts.map +0 -1
- package/dist/wu-recovery.js +0 -470
- package/dist/wu-recovery.js.map +0 -1
- package/dist/wu-repair-core.d.ts +0 -150
- package/dist/wu-repair-core.d.ts.map +0 -1
- package/dist/wu-repair-core.js +0 -718
- package/dist/wu-repair-core.js.map +0 -1
- package/dist/wu-rules-core.d.ts +0 -95
- package/dist/wu-rules-core.d.ts.map +0 -1
- package/dist/wu-rules-core.js +0 -401
- package/dist/wu-rules-core.js.map +0 -1
- package/dist/wu-rules-engine.d.ts +0 -29
- package/dist/wu-rules-engine.d.ts.map +0 -1
- package/dist/wu-rules-engine.js +0 -61
- package/dist/wu-rules-engine.js.map +0 -1
- package/dist/wu-rules-resolvers.d.ts +0 -19
- package/dist/wu-rules-resolvers.d.ts.map +0 -1
- package/dist/wu-rules-resolvers.js +0 -210
- package/dist/wu-rules-resolvers.js.map +0 -1
- package/dist/wu-schema-normalization.d.ts +0 -18
- package/dist/wu-schema-normalization.d.ts.map +0 -1
- package/dist/wu-schema-normalization.js +0 -87
- package/dist/wu-schema-normalization.js.map +0 -1
- package/dist/wu-schema.d.ts +0 -772
- package/dist/wu-schema.d.ts.map +0 -1
- package/dist/wu-schema.js +0 -897
- package/dist/wu-schema.js.map +0 -1
- package/dist/wu-spawn-context.d.ts +0 -66
- package/dist/wu-spawn-context.d.ts.map +0 -1
- package/dist/wu-spawn-context.js +0 -185
- package/dist/wu-spawn-context.js.map +0 -1
- package/dist/wu-spawn-helpers.d.ts +0 -110
- package/dist/wu-spawn-helpers.d.ts.map +0 -1
- package/dist/wu-spawn-helpers.js +0 -276
- package/dist/wu-spawn-helpers.js.map +0 -1
- package/dist/wu-spawn-skills.d.ts +0 -39
- package/dist/wu-spawn-skills.d.ts.map +0 -1
- package/dist/wu-spawn-skills.js +0 -214
- package/dist/wu-spawn-skills.js.map +0 -1
- package/dist/wu-spawn.d.ts +0 -394
- package/dist/wu-spawn.d.ts.map +0 -1
- package/dist/wu-spawn.js +0 -1977
- package/dist/wu-spawn.js.map +0 -1
- package/dist/wu-state-schema.d.ts +0 -237
- package/dist/wu-state-schema.d.ts.map +0 -1
- package/dist/wu-state-schema.js +0 -172
- package/dist/wu-state-schema.js.map +0 -1
- package/dist/wu-state-store.d.ts +0 -275
- package/dist/wu-state-store.d.ts.map +0 -1
- package/dist/wu-state-store.js +0 -1057
- package/dist/wu-state-store.js.map +0 -1
- package/dist/wu-status-transition.d.ts +0 -58
- package/dist/wu-status-transition.d.ts.map +0 -1
- package/dist/wu-status-transition.js +0 -370
- package/dist/wu-status-transition.js.map +0 -1
- package/dist/wu-status-updater.d.ts +0 -18
- package/dist/wu-status-updater.d.ts.map +0 -1
- package/dist/wu-status-updater.js +0 -123
- package/dist/wu-status-updater.js.map +0 -1
- package/dist/wu-statuses.d.ts +0 -154
- package/dist/wu-statuses.d.ts.map +0 -1
- package/dist/wu-statuses.js +0 -176
- package/dist/wu-statuses.js.map +0 -1
- package/dist/wu-transaction-collectors.d.ts +0 -116
- package/dist/wu-transaction-collectors.d.ts.map +0 -1
- package/dist/wu-transaction-collectors.js +0 -273
- package/dist/wu-transaction-collectors.js.map +0 -1
- package/dist/wu-transaction.d.ts +0 -172
- package/dist/wu-transaction.d.ts.map +0 -1
- package/dist/wu-transaction.js +0 -288
- package/dist/wu-transaction.js.map +0 -1
- package/dist/wu-type-helpers.d.ts +0 -26
- package/dist/wu-type-helpers.d.ts.map +0 -1
- package/dist/wu-type-helpers.js +0 -45
- package/dist/wu-type-helpers.js.map +0 -1
- package/dist/wu-ui-constants.d.ts +0 -235
- package/dist/wu-ui-constants.d.ts.map +0 -1
- package/dist/wu-ui-constants.js +0 -237
- package/dist/wu-ui-constants.js.map +0 -1
- package/dist/wu-validation-constants.d.ts +0 -61
- package/dist/wu-validation-constants.d.ts.map +0 -1
- package/dist/wu-validation-constants.js +0 -69
- package/dist/wu-validation-constants.js.map +0 -1
- package/dist/wu-validation.d.ts +0 -121
- package/dist/wu-validation.d.ts.map +0 -1
- package/dist/wu-validation.js +0 -266
- package/dist/wu-validation.js.map +0 -1
- package/dist/wu-validator.d.ts +0 -128
- package/dist/wu-validator.d.ts.map +0 -1
- package/dist/wu-validator.js +0 -445
- package/dist/wu-validator.js.map +0 -1
- package/dist/wu-yaml-fixer.d.ts +0 -74
- package/dist/wu-yaml-fixer.d.ts.map +0 -1
- package/dist/wu-yaml-fixer.js +0 -273
- package/dist/wu-yaml-fixer.js.map +0 -1
- package/dist/wu-yaml.d.ts +0 -110
- package/dist/wu-yaml.d.ts.map +0 -1
- package/dist/wu-yaml.js +0 -300
- package/dist/wu-yaml.js.map +0 -1
package/dist/wu-spawn.js
DELETED
|
@@ -1,1977 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// Copyright (c) 2026 Hellmai Ltd
|
|
3
|
-
// SPDX-License-Identifier: AGPL-3.0-only
|
|
4
|
-
/**
|
|
5
|
-
* WU Spawn Helper
|
|
6
|
-
*
|
|
7
|
-
* Generates ready-to-use Task tool invocations for sub-agent WU execution.
|
|
8
|
-
* Includes context loading preamble, skills selection guidance, and constraints block.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* pnpm wu:spawn --id WU-123
|
|
12
|
-
* pnpm wu:spawn --id WU-123 --codex
|
|
13
|
-
*
|
|
14
|
-
* Output:
|
|
15
|
-
* A complete Task tool invocation block with:
|
|
16
|
-
* - Context loading preamble (.claude/CLAUDE.md, README, lumenflow, WU YAML)
|
|
17
|
-
* - WU details and acceptance criteria
|
|
18
|
-
* - Skills Selection section (sub-agent reads catalogue and selects at runtime)
|
|
19
|
-
* - Mandatory agent advisory
|
|
20
|
-
* - Constraints block at end (Lost in the Middle research)
|
|
21
|
-
*
|
|
22
|
-
* Skills Selection:
|
|
23
|
-
* This command is AGENT-FACING. Unlike /wu-prompt (human-facing, skills selected
|
|
24
|
-
* at generation time), wu:spawn instructs the sub-agent to read the skill catalogue
|
|
25
|
-
* and select skills at execution time based on WU context.
|
|
26
|
-
*
|
|
27
|
-
* Codex Mode:
|
|
28
|
-
* When --codex is used, outputs a Codex/GPT-friendly Markdown prompt (no antml/XML escaping).
|
|
29
|
-
*
|
|
30
|
-
* @see {@link https://lumenflow.dev/reference/agent-invocation-guide/} - Context loading templates
|
|
31
|
-
*/
|
|
32
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
33
|
-
import { fileURLToPath } from 'node:url';
|
|
34
|
-
import path from 'node:path';
|
|
35
|
-
import { createWUParser, WU_OPTIONS } from './arg-parser.js';
|
|
36
|
-
import { WU_PATHS } from './wu-paths.js';
|
|
37
|
-
import { parseYAML } from './wu-yaml.js';
|
|
38
|
-
import { die } from './error-handler.js';
|
|
39
|
-
import { WU_STATUS, PATTERNS, EMOJI, LUMENFLOW_PATHS } from './wu-constants.js';
|
|
40
|
-
// WU-1603: Check lane lock status before spawning
|
|
41
|
-
import { checkLaneLock } from './lane-lock.js';
|
|
42
|
-
import { minimatch } from 'minimatch';
|
|
43
|
-
// WU-1900: Import work classifier for domain-aware prompt generation
|
|
44
|
-
import { classifyWork } from './work-classifier.js';
|
|
45
|
-
import { SpawnStrategyFactory } from './spawn-strategy.js';
|
|
46
|
-
import { getConfig } from './lumenflow-config.js';
|
|
47
|
-
import { generateClientSkillsGuidance, generateSkillsSelectionSection, resolveClientConfig, } from './wu-spawn-skills.js';
|
|
48
|
-
// WU-2252: Import invariants loader for spawn output injection
|
|
49
|
-
import { loadInvariants, INVARIANT_TYPES } from './invariants-runner.js';
|
|
50
|
-
import { validateSpawnArgs, generateExecutionModeSection, generateThinkToolGuidance, recordSpawnToRegistry, formatSpawnRecordedMessage, } from './wu-spawn-helpers.js';
|
|
51
|
-
// Agent skills loading removed for vendor-agnostic design
|
|
52
|
-
import { validateSpawnDependencies, formatDependencyError } from './dependency-validator.js';
|
|
53
|
-
/**
|
|
54
|
-
* WU-1253/WU-1291: Template System for Spawn Prompts
|
|
55
|
-
*
|
|
56
|
-
* DECISION (WU-1291): Template system is ACTIVATED with graceful degradation.
|
|
57
|
-
*
|
|
58
|
-
* The template system loads prompt sections from .lumenflow/templates/spawn-prompt/
|
|
59
|
-
* with YAML frontmatter and manifest-driven assembly order. This design provides:
|
|
60
|
-
*
|
|
61
|
-
* 1. **Maintainability**: Templates in markdown files are easier to edit than code strings
|
|
62
|
-
* 2. **Client extensibility**: Client-specific overrides via templates.{client}/ directories
|
|
63
|
-
* 3. **Conditional inclusion**: Templates selected based on WU type and policy settings
|
|
64
|
-
* 4. **Graceful fallback**: If template loading fails, hardcoded functions are used
|
|
65
|
-
*
|
|
66
|
-
* Template loading is attempted via tryAssembleSpawnTemplates(). If it returns null
|
|
67
|
-
* (templates missing or assembly fails), the spawn output uses hardcoded generator
|
|
68
|
-
* functions (generateTDDDirective, generateBugDiscoverySection, etc.).
|
|
69
|
-
*
|
|
70
|
-
* @see template-loader.ts for the loading and assembly implementation
|
|
71
|
-
* @see .lumenflow/templates/manifest.yaml for the template registry
|
|
72
|
-
*/
|
|
73
|
-
import { loadManifest, loadTemplatesWithOverrides, assembleTemplates, } from './template-loader.js';
|
|
74
|
-
import { resolvePolicy } from './resolve-policy.js';
|
|
75
|
-
// WU-1270: Import telemetry emit function for methodology tracking
|
|
76
|
-
import { emit as emitTelemetry } from './telemetry.js';
|
|
77
|
-
/**
|
|
78
|
-
* Mandatory agent trigger patterns.
|
|
79
|
-
* Mirrors MANDATORY_TRIGGERS from orchestration.constants.ts.
|
|
80
|
-
*
|
|
81
|
-
* Note: For LumenFlow framework development, this is empty since we don't have
|
|
82
|
-
* application-specific concerns. Projects using LumenFlow
|
|
83
|
-
* should configure their own triggers based on their domain requirements.
|
|
84
|
-
*/
|
|
85
|
-
const MANDATORY_TRIGGERS = {
|
|
86
|
-
// No mandatory triggers for LumenFlow framework development.
|
|
87
|
-
};
|
|
88
|
-
const LOG_PREFIX = '[wu:spawn]';
|
|
89
|
-
function getErrorMessage(error) {
|
|
90
|
-
return error instanceof Error ? error.message : String(error);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* WU-1192: Truncation prevention constants (consolidated from CLI)
|
|
94
|
-
*
|
|
95
|
-
* These constants help detect when spawn output has been truncated during
|
|
96
|
-
* copy-paste operations or context loading. The warning banner alerts users
|
|
97
|
-
* to the truncation risk, and the end sentinel allows verification that
|
|
98
|
-
* the full output was received.
|
|
99
|
-
*/
|
|
100
|
-
export const TRUNCATION_WARNING_BANNER = `<!-- LUMENFLOW_TRUNCATION_WARNING -->
|
|
101
|
-
<!--
|
|
102
|
-
⚠️ CRITICAL: DO NOT TRUNCATE THIS OUTPUT
|
|
103
|
-
|
|
104
|
-
This spawn prompt MUST be copied verbatim. Truncation causes:
|
|
105
|
-
- Missing constraints (agents ignore safety rules)
|
|
106
|
-
- Missing TDD directives (agents skip tests)
|
|
107
|
-
- Degraded agent performance
|
|
108
|
-
|
|
109
|
-
VERIFICATION: The output MUST end with: <!-- LUMENFLOW_SPAWN_END -->
|
|
110
|
-
If you don't see that sentinel at the end, the output was truncated.
|
|
111
|
-
-->
|
|
112
|
-
`;
|
|
113
|
-
export const SPAWN_END_SENTINEL = '<!-- LUMENFLOW_SPAWN_END -->';
|
|
114
|
-
/**
|
|
115
|
-
* WU-1253/WU-1291: Try to assemble spawn prompt sections from templates.
|
|
116
|
-
*
|
|
117
|
-
* This function loads templates from .lumenflow/templates/ and assembles
|
|
118
|
-
* them according to the manifest order. Client-specific overrides are
|
|
119
|
-
* supported via templates.{client}/ directories.
|
|
120
|
-
*
|
|
121
|
-
* **Decision (WU-1291)**: Template system is ACTIVATED. This function is called
|
|
122
|
-
* by generateTaskInvocation() and generateCodexPrompt() to attempt template-based
|
|
123
|
-
* generation. If it returns null (templates missing, manifest invalid, or assembly
|
|
124
|
-
* fails), callers fall back to hardcoded generator functions.
|
|
125
|
-
*
|
|
126
|
-
* Template coverage (as of WU-1291):
|
|
127
|
-
* - Methodology directives (TDD, test-after, none)
|
|
128
|
-
* - Architecture directives (hexagonal, layered, none)
|
|
129
|
-
* - Type-specific directives (documentation, visual, refactor)
|
|
130
|
-
* - Agent guidance (effort-scaling, parallel-tool-calls, search-heuristics, token-budget)
|
|
131
|
-
* - Operational guidance (bug-discovery, quick-fix-commands, lane-selection)
|
|
132
|
-
* - Lane-specific guidance and constraints
|
|
133
|
-
*
|
|
134
|
-
* @param baseDir - Project root directory
|
|
135
|
-
* @param clientName - Client name for overrides (e.g., 'claude', 'cursor')
|
|
136
|
-
* @param context - Context for token replacement and condition evaluation
|
|
137
|
-
* @returns Assembled template content, or null if templates unavailable
|
|
138
|
-
*/
|
|
139
|
-
export function tryAssembleSpawnTemplates(baseDir, clientName, context) {
|
|
140
|
-
try {
|
|
141
|
-
const manifest = loadManifest(baseDir);
|
|
142
|
-
const templates = loadTemplatesWithOverrides(baseDir, clientName);
|
|
143
|
-
if (templates.size === 0) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
return assembleTemplates(templates, manifest, context);
|
|
147
|
-
}
|
|
148
|
-
catch {
|
|
149
|
-
// Template loading failed - return null for hardcoded fallback (intentional)
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Build template context from WU document.
|
|
155
|
-
*
|
|
156
|
-
* @param doc - WU YAML document
|
|
157
|
-
* @param id - WU ID
|
|
158
|
-
* @returns Context for template assembly
|
|
159
|
-
*/
|
|
160
|
-
export function buildTemplateContext(doc, id) {
|
|
161
|
-
const lane = doc.lane || '';
|
|
162
|
-
const laneParent = lane.split(':')[0]?.trim() || '';
|
|
163
|
-
return {
|
|
164
|
-
WU_ID: id,
|
|
165
|
-
LANE: lane,
|
|
166
|
-
TYPE: (doc.type || 'feature').toLowerCase(),
|
|
167
|
-
TITLE: doc.title || '',
|
|
168
|
-
DESCRIPTION: doc.description || '',
|
|
169
|
-
WORKTREE_PATH: doc.worktree_path || '',
|
|
170
|
-
laneParent,
|
|
171
|
-
// Add lowercase aliases for condition evaluation
|
|
172
|
-
type: (doc.type || 'feature').toLowerCase(),
|
|
173
|
-
lane,
|
|
174
|
-
worktreePath: doc.worktree_path || '',
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* WU-1261: Build template context with resolved policy fields.
|
|
179
|
-
*
|
|
180
|
-
* Extends buildTemplateContext() with policy.testing and policy.architecture
|
|
181
|
-
* fields for template condition evaluation.
|
|
182
|
-
*
|
|
183
|
-
* @param doc - WU YAML document
|
|
184
|
-
* @param id - WU ID
|
|
185
|
-
* @param policy - Resolved policy from resolvePolicy()
|
|
186
|
-
* @returns Context for template assembly with policy fields
|
|
187
|
-
*/
|
|
188
|
-
export function buildTemplateContextWithPolicy(doc, id, policy) {
|
|
189
|
-
const baseContext = buildTemplateContext(doc, id);
|
|
190
|
-
return {
|
|
191
|
-
...baseContext,
|
|
192
|
-
'policy.testing': policy.testing,
|
|
193
|
-
'policy.architecture': policy.architecture,
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* WU types that require TDD (failing test first)
|
|
198
|
-
* Note: Used as documentation reference. TDD is the default for UnsafeAny type not in other categories.
|
|
199
|
-
*/
|
|
200
|
-
const _TDD_REQUIRED_TYPES = ['feature', 'bug', 'tooling', 'enhancement'];
|
|
201
|
-
/**
|
|
202
|
-
* WU types that require existing tests to pass (no new tests mandated)
|
|
203
|
-
*/
|
|
204
|
-
const EXISTING_TESTS_TYPES = ['refactor'];
|
|
205
|
-
/**
|
|
206
|
-
* WU types that require smoke tests + manual QA
|
|
207
|
-
*/
|
|
208
|
-
const SMOKE_TEST_TYPES = ['visual', 'design', 'ui'];
|
|
209
|
-
/**
|
|
210
|
-
* WU types that only need format checks (no TDD)
|
|
211
|
-
*/
|
|
212
|
-
const DOCS_ONLY_TYPES = ['documentation', 'docs', 'config'];
|
|
213
|
-
/**
|
|
214
|
-
* Generate type-aware test guidance (WU-1142, WU-1192)
|
|
215
|
-
*
|
|
216
|
-
* Returns appropriate test guidance based on WU type:
|
|
217
|
-
* - feature/bug/tooling: Full TDD directive
|
|
218
|
-
* - documentation: Format check only
|
|
219
|
-
* - visual/design: Smoke test + manual QA
|
|
220
|
-
* - refactor: Existing tests must pass
|
|
221
|
-
*
|
|
222
|
-
* @param {string} wuType - WU type from YAML
|
|
223
|
-
* @returns {string} Test guidance section
|
|
224
|
-
*/
|
|
225
|
-
export function generateTestGuidance(wuType) {
|
|
226
|
-
const type = (wuType || 'feature').toLowerCase();
|
|
227
|
-
// Documentation WUs - no TDD, just format checks
|
|
228
|
-
if (DOCS_ONLY_TYPES.includes(type)) {
|
|
229
|
-
return `## Documentation Standards
|
|
230
|
-
|
|
231
|
-
**Format check only** - No TDD required for documentation WUs.
|
|
232
|
-
|
|
233
|
-
### Requirements
|
|
234
|
-
|
|
235
|
-
1. Run \`pnpm gates --docs-only\` before completion
|
|
236
|
-
2. Ensure markdown formatting is correct
|
|
237
|
-
3. Verify links are valid
|
|
238
|
-
4. Check spelling and grammar`;
|
|
239
|
-
}
|
|
240
|
-
// Visual/Design WUs - smoke tests + manual QA
|
|
241
|
-
if (SMOKE_TEST_TYPES.includes(type)) {
|
|
242
|
-
return `## Visual/Design Testing
|
|
243
|
-
|
|
244
|
-
**Smoke test + manual QA** - Visual WUs require different verification.
|
|
245
|
-
|
|
246
|
-
### Requirements
|
|
247
|
-
|
|
248
|
-
1. Create smoke test for component rendering (if applicable)
|
|
249
|
-
2. Verify visual appearance manually
|
|
250
|
-
3. Test responsive behavior across breakpoints
|
|
251
|
-
4. Check accessibility (keyboard navigation, screen reader)
|
|
252
|
-
5. Document manual QA results in completion notes`;
|
|
253
|
-
}
|
|
254
|
-
// Refactor WUs - existing tests must pass
|
|
255
|
-
if (EXISTING_TESTS_TYPES.includes(type)) {
|
|
256
|
-
return `## Refactor Testing
|
|
257
|
-
|
|
258
|
-
**Existing tests must pass** - Refactoring must not break current behavior.
|
|
259
|
-
|
|
260
|
-
### Requirements
|
|
261
|
-
|
|
262
|
-
1. Run all existing tests BEFORE refactoring
|
|
263
|
-
2. Run all existing tests AFTER refactoring
|
|
264
|
-
3. No new tests required unless behavior changes
|
|
265
|
-
4. If tests fail after refactor, the refactor introduced a bug`;
|
|
266
|
-
}
|
|
267
|
-
// Default: TDD required (feature, bug, tooling, enhancement)
|
|
268
|
-
return generateTDDDirective();
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Generate the TDD directive section (WU-1585, WU-1192)
|
|
272
|
-
*
|
|
273
|
-
* Positioned immediately after </task> preamble per "Lost in the Middle" research.
|
|
274
|
-
* Critical instructions at START and END of prompt improve adherence.
|
|
275
|
-
*
|
|
276
|
-
* @returns {string} TDD directive section
|
|
277
|
-
*/
|
|
278
|
-
function generateTDDDirective() {
|
|
279
|
-
return `## ⛔ TDD DIRECTIVE — READ BEFORE CODING
|
|
280
|
-
|
|
281
|
-
**IF YOU WRITE IMPLEMENTATION CODE BEFORE A FAILING TEST, YOU HAVE FAILED THIS WU.**
|
|
282
|
-
|
|
283
|
-
### Test-First Workflow (MANDATORY)
|
|
284
|
-
|
|
285
|
-
1. Write a failing test for the acceptance criteria
|
|
286
|
-
2. Run the test to confirm it fails (RED)
|
|
287
|
-
3. Implement the minimum code to pass the test
|
|
288
|
-
4. Run the test to confirm it passes (GREEN)
|
|
289
|
-
5. Refactor if needed, keeping tests green
|
|
290
|
-
|
|
291
|
-
### Test Ratchet Rule (WU-1253)
|
|
292
|
-
|
|
293
|
-
Gates compare test results against \`.lumenflow/test-baseline.json\`:
|
|
294
|
-
|
|
295
|
-
- **NEW failures** (not in baseline) **BLOCK** gates - you must fix them
|
|
296
|
-
- **Pre-existing failures** (in baseline) show **WARNING** - do not block your WU
|
|
297
|
-
- When tests are **fixed**, baseline auto-updates (ratchet forward)
|
|
298
|
-
|
|
299
|
-
If gates fail due to test failures:
|
|
300
|
-
1. Check if failure is in baseline: \`cat .lumenflow/test-baseline.json\`
|
|
301
|
-
2. If pre-existing: continue, it will warn but not block
|
|
302
|
-
3. If NEW: fix the test or add to baseline with reason and fix-wu
|
|
303
|
-
|
|
304
|
-
### Why This Matters
|
|
305
|
-
|
|
306
|
-
- Tests document expected behavior BEFORE implementation
|
|
307
|
-
- Prevents scope creep and over-engineering
|
|
308
|
-
- Ensures every feature has verification
|
|
309
|
-
- Failing tests prove the test actually tests something
|
|
310
|
-
- Ratchet pattern prevents being blocked by unrelated failures`;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* WU-1279: Generate the Mandatory Standards section based on resolved policy
|
|
314
|
-
*
|
|
315
|
-
* Instead of hardcoding TDD/90%/Hexagonal, this function generates the
|
|
316
|
-
* section dynamically based on the resolved methodology policy.
|
|
317
|
-
*
|
|
318
|
-
* @param policy - Resolved policy from resolvePolicy()
|
|
319
|
-
* @returns Mandatory Standards section content
|
|
320
|
-
*/
|
|
321
|
-
export function generateMandatoryStandards(policy) {
|
|
322
|
-
const lines = ['## Mandatory Standards', ''];
|
|
323
|
-
// LumenFlow workflow is always required
|
|
324
|
-
lines.push('- **LumenFlow**: Follow trunk-based flow, WIP=1, worktree discipline');
|
|
325
|
-
// Testing methodology based on policy
|
|
326
|
-
if (policy.testing === 'tdd') {
|
|
327
|
-
lines.push(`- **TDD**: Failing test first, then implementation, then passing test. ${policy.coverage_threshold}%+ coverage on new application code`);
|
|
328
|
-
}
|
|
329
|
-
else if (policy.testing === 'test-after') {
|
|
330
|
-
lines.push(`- **Test-After**: Write implementation first, then add tests. ${policy.coverage_threshold}%+ coverage on new application code`);
|
|
331
|
-
}
|
|
332
|
-
else if (policy.testing === 'none') {
|
|
333
|
-
lines.push('- **Testing**: Tests are optional for this project');
|
|
334
|
-
}
|
|
335
|
-
// Architecture based on policy
|
|
336
|
-
if (policy.architecture === 'hexagonal') {
|
|
337
|
-
lines.push('- **Hexagonal Architecture**: Ports-first design. No application -> infrastructure imports');
|
|
338
|
-
}
|
|
339
|
-
else if (policy.architecture === 'layered') {
|
|
340
|
-
lines.push('- **Layered Architecture**: Clear layer separation. Each layer can only depend on layers below it');
|
|
341
|
-
}
|
|
342
|
-
// For architecture: 'none', we don't add UnsafeAny architecture guidance
|
|
343
|
-
// Always include these standards
|
|
344
|
-
lines.push('- **SOLID/DRY/YAGNI/KISS**: No over-engineering, no premature abstraction');
|
|
345
|
-
lines.push('- **Library-First**: Search context7 before writing custom code. No reinventing wheels');
|
|
346
|
-
lines.push('- **Code Quality**: No string literals, no magic numbers, no brittle regexes when libraries exist');
|
|
347
|
-
lines.push('- **Worktree Discipline**: ALWAYS use `pnpm wu:claim` to create worktrees (never `git worktree add` directly). Work ONLY in the worktree, never edit main');
|
|
348
|
-
lines.push('- **Documentation**: Update tooling docs if changing tools. Keep docs in sync with code');
|
|
349
|
-
lines.push('- **Sub-agents**: Use Explore agent for codebase investigation. Activate mandatory agents as configured for your project');
|
|
350
|
-
return lines.join('\n');
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* WU-1261, WU-1900: Generate test guidance based on resolved policy and classifier hint
|
|
354
|
-
*
|
|
355
|
-
* Selects the appropriate test guidance based on policy.testing value:
|
|
356
|
-
* - 'tdd': Full TDD directive (failing test first)
|
|
357
|
-
* - 'test-after': Implementation first, then tests
|
|
358
|
-
* - 'none': Testing is optional
|
|
359
|
-
*
|
|
360
|
-
* WU-1900: When the work classifier provides a testMethodologyHint of 'smoke-test'
|
|
361
|
-
* AND the WU type is 'bug', smoke-test guidance is returned instead of full TDD.
|
|
362
|
-
* This fixes bug #1: SMOKE_TEST_TYPES was unreachable via normal WU types.
|
|
363
|
-
*
|
|
364
|
-
* Type overrides still apply (documentation WUs always get docs guidance).
|
|
365
|
-
*
|
|
366
|
-
* @param wuType - WU type from YAML (e.g., 'feature', 'documentation')
|
|
367
|
-
* @param policy - Resolved policy from resolvePolicy()
|
|
368
|
-
* @param options - Optional classifier-driven test guidance options
|
|
369
|
-
* @returns Test guidance section
|
|
370
|
-
*/
|
|
371
|
-
export function generatePolicyBasedTestGuidance(wuType, policy, options) {
|
|
372
|
-
const type = (wuType || 'feature').toLowerCase();
|
|
373
|
-
// Type overrides take precedence (documentation never needs TDD)
|
|
374
|
-
if (DOCS_ONLY_TYPES.includes(type)) {
|
|
375
|
-
return `## Documentation Standards
|
|
376
|
-
|
|
377
|
-
**Format check only** - No TDD required for documentation WUs.
|
|
378
|
-
|
|
379
|
-
### Requirements
|
|
380
|
-
|
|
381
|
-
1. Run \`pnpm gates --docs-only\` before completion
|
|
382
|
-
2. Ensure markdown formatting is correct
|
|
383
|
-
3. Verify links are valid
|
|
384
|
-
4. Check spelling and grammar`;
|
|
385
|
-
}
|
|
386
|
-
// Visual/Design WUs - smoke tests + manual QA
|
|
387
|
-
if (SMOKE_TEST_TYPES.includes(type)) {
|
|
388
|
-
return generateSmokeTestGuidance();
|
|
389
|
-
}
|
|
390
|
-
// WU-1900: Classifier-driven smoke-test for bug WUs with UI code_paths
|
|
391
|
-
// This makes SMOKE_TEST_TYPES reachable through classifier signals
|
|
392
|
-
if (type === 'bug' && options?.testMethodologyHint === 'smoke-test') {
|
|
393
|
-
return generateSmokeTestGuidance();
|
|
394
|
-
}
|
|
395
|
-
// Refactor WUs - existing tests must pass
|
|
396
|
-
if (EXISTING_TESTS_TYPES.includes(type)) {
|
|
397
|
-
return `## Refactor Testing
|
|
398
|
-
|
|
399
|
-
**Existing tests must pass** - Refactoring must not break current behavior.
|
|
400
|
-
|
|
401
|
-
### Requirements
|
|
402
|
-
|
|
403
|
-
1. Run all existing tests BEFORE refactoring
|
|
404
|
-
2. Run all existing tests AFTER refactoring
|
|
405
|
-
3. No new tests required unless behavior changes
|
|
406
|
-
4. If tests fail after refactor, the refactor introduced a bug`;
|
|
407
|
-
}
|
|
408
|
-
// Policy-based selection for feature/bug/enhancement/tooling types
|
|
409
|
-
switch (policy.testing) {
|
|
410
|
-
case 'test-after':
|
|
411
|
-
return generateTestAfterDirective(policy.coverage_threshold);
|
|
412
|
-
case 'none':
|
|
413
|
-
return generateTestingOptionalDirective();
|
|
414
|
-
case 'tdd':
|
|
415
|
-
default:
|
|
416
|
-
return generateTDDDirective();
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* WU-1900: Generate smoke-test guidance (extracted from inline)
|
|
421
|
-
*/
|
|
422
|
-
function generateSmokeTestGuidance() {
|
|
423
|
-
return `## Visual/Design Testing
|
|
424
|
-
|
|
425
|
-
**Smoke test + manual QA** - Visual WUs require different verification.
|
|
426
|
-
|
|
427
|
-
### Requirements
|
|
428
|
-
|
|
429
|
-
1. Create smoke test for component rendering (if applicable)
|
|
430
|
-
2. Verify visual appearance manually
|
|
431
|
-
3. Test responsive behavior across breakpoints
|
|
432
|
-
4. Check accessibility (keyboard navigation, screen reader)
|
|
433
|
-
5. Document manual QA results in completion notes`;
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* WU-1261, WU-1279: Generate test-after directive
|
|
437
|
-
*
|
|
438
|
-
* @param coverageThreshold - Coverage threshold from resolved policy
|
|
439
|
-
* @returns Test-after guidance section
|
|
440
|
-
*/
|
|
441
|
-
function generateTestAfterDirective(coverageThreshold) {
|
|
442
|
-
return `## Test-After Methodology
|
|
443
|
-
|
|
444
|
-
**Write implementation first, then add tests** - Focus on solving the problem, then verify.
|
|
445
|
-
|
|
446
|
-
### Test-After Workflow
|
|
447
|
-
|
|
448
|
-
1. Understand the acceptance criteria
|
|
449
|
-
2. Write implementation first
|
|
450
|
-
3. Add tests to verify behavior
|
|
451
|
-
4. Aim for ${coverageThreshold}% coverage on new code
|
|
452
|
-
|
|
453
|
-
### When This Works
|
|
454
|
-
|
|
455
|
-
- Exploratory prototyping where requirements are unclear
|
|
456
|
-
- Quick iterations where test-first slows discovery
|
|
457
|
-
- Projects configured with \`methodology.testing: 'test-after'\`
|
|
458
|
-
|
|
459
|
-
### Requirements
|
|
460
|
-
|
|
461
|
-
- Tests must be added before \`wu:done\`
|
|
462
|
-
- Coverage target: ${coverageThreshold}%+ on new application code
|
|
463
|
-
- All existing tests must still pass`;
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* WU-1261: Generate testing optional directive
|
|
467
|
-
*
|
|
468
|
-
* @returns Testing optional guidance section
|
|
469
|
-
*/
|
|
470
|
-
function generateTestingOptionalDirective() {
|
|
471
|
-
return `## Testing Optional
|
|
472
|
-
|
|
473
|
-
**Tests are not required** - Project is configured without test requirements.
|
|
474
|
-
|
|
475
|
-
### Focus
|
|
476
|
-
|
|
477
|
-
- Code quality and functionality
|
|
478
|
-
- Run \`pnpm gates\` before completion (will skip coverage checks)
|
|
479
|
-
|
|
480
|
-
### If You Want to Add Tests
|
|
481
|
-
|
|
482
|
-
You can still add tests for critical functionality:
|
|
483
|
-
\`\`\`bash
|
|
484
|
-
pnpm test -- --coverage
|
|
485
|
-
\`\`\`
|
|
486
|
-
|
|
487
|
-
But they are not required for WU completion.`;
|
|
488
|
-
}
|
|
489
|
-
/**
|
|
490
|
-
* WU-1261: Generate architecture guidance based on resolved policy
|
|
491
|
-
*
|
|
492
|
-
* Selects appropriate architecture guidance based on policy.architecture:
|
|
493
|
-
* - 'hexagonal': Ports and adapters, dependency inversion
|
|
494
|
-
* - 'layered': Traditional layer separation
|
|
495
|
-
* - 'none': No architecture constraints
|
|
496
|
-
*
|
|
497
|
-
* @param policy - Resolved policy from resolvePolicy()
|
|
498
|
-
* @returns Architecture guidance section, or empty string for 'none'
|
|
499
|
-
*/
|
|
500
|
-
export function generatePolicyBasedArchitectureGuidance(policy) {
|
|
501
|
-
switch (policy.architecture) {
|
|
502
|
-
case 'hexagonal':
|
|
503
|
-
return `## Hexagonal Architecture
|
|
504
|
-
|
|
505
|
-
**Ports and Adapters** - Keep domain logic pure, infrastructure at the edges.
|
|
506
|
-
|
|
507
|
-
### Key Principles
|
|
508
|
-
|
|
509
|
-
- **Ports**: Interfaces defining what the domain needs (inbound) or uses (outbound)
|
|
510
|
-
- **Adapters**: Implementations connecting ports to infrastructure
|
|
511
|
-
- **Domain**: Pure business logic with no infrastructure imports
|
|
512
|
-
- **Dependency Rule**: Domain -> Ports <- Adapters (never domain -> adapters)
|
|
513
|
-
|
|
514
|
-
### Directory Structure
|
|
515
|
-
|
|
516
|
-
\`\`\`
|
|
517
|
-
src/
|
|
518
|
-
domain/ # Pure business logic
|
|
519
|
-
ports/ # Interfaces
|
|
520
|
-
adapters/ # Infrastructure implementations
|
|
521
|
-
application/ # Use cases orchestrating domain + ports
|
|
522
|
-
\`\`\``;
|
|
523
|
-
case 'layered':
|
|
524
|
-
return `## Layered Architecture
|
|
525
|
-
|
|
526
|
-
**Traditional layer separation** - Clear boundaries between concerns.
|
|
527
|
-
|
|
528
|
-
### Layers (Top to Bottom)
|
|
529
|
-
|
|
530
|
-
1. **Presentation**: UI, API controllers, CLI
|
|
531
|
-
2. **Application**: Use cases, orchestration
|
|
532
|
-
3. **Domain**: Business logic, entities
|
|
533
|
-
4. **Infrastructure**: Database, external services
|
|
534
|
-
|
|
535
|
-
### Dependency Rule
|
|
536
|
-
|
|
537
|
-
- Each layer can only depend on layers below it
|
|
538
|
-
- Presentation -> Application -> Domain -> Infrastructure
|
|
539
|
-
- Never skip layers (Presentation should not directly use Infrastructure)`;
|
|
540
|
-
case 'none':
|
|
541
|
-
default:
|
|
542
|
-
return '';
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
/**
|
|
546
|
-
* WU-1900: Generate design context section for UI-classified work.
|
|
547
|
-
*
|
|
548
|
-
* Provides vendor-agnostic guidance for UI work: pattern checks, viewport
|
|
549
|
-
* verification, accessibility, and codebase exploration hints.
|
|
550
|
-
*
|
|
551
|
-
* This section is intentionally free of client-specific syntax (no /skill commands).
|
|
552
|
-
* Client skill mapping happens in the skills selection section via capabilities_map.
|
|
553
|
-
*
|
|
554
|
-
* @param classification - Work classification result with domain and capabilities
|
|
555
|
-
* @returns Design context section for UI work, or empty string for non-UI work
|
|
556
|
-
*/
|
|
557
|
-
export function generateDesignContextSection(classification) {
|
|
558
|
-
if (classification.domain !== 'ui') {
|
|
559
|
-
return '';
|
|
560
|
-
}
|
|
561
|
-
return `## Design Context
|
|
562
|
-
|
|
563
|
-
This work involves UI components or styling. Follow these guidelines:
|
|
564
|
-
|
|
565
|
-
### Pattern Check
|
|
566
|
-
|
|
567
|
-
- Before creating new components, check for existing patterns in the codebase
|
|
568
|
-
- Search for similar components that may already solve the problem
|
|
569
|
-
- Verify design system tokens and variables are used instead of hardcoded values
|
|
570
|
-
|
|
571
|
-
### Viewport Verification
|
|
572
|
-
|
|
573
|
-
- Test across common viewport sizes (mobile: 375px, tablet: 768px, desktop: 1280px)
|
|
574
|
-
- Verify responsive behavior at breakpoints
|
|
575
|
-
- Check for overflow, text truncation, and layout shifts
|
|
576
|
-
|
|
577
|
-
### Accessibility
|
|
578
|
-
|
|
579
|
-
- Verify keyboard navigation works for interactive elements
|
|
580
|
-
- Ensure sufficient color contrast (WCAG 2.1 AA minimum)
|
|
581
|
-
- Add appropriate ARIA attributes where needed
|
|
582
|
-
- Test with screen reader if applicable
|
|
583
|
-
|
|
584
|
-
### Codebase Exploration
|
|
585
|
-
|
|
586
|
-
- Check the project's design system or component library before building custom
|
|
587
|
-
- Look for CSS variables, theme tokens, or shared style utilities
|
|
588
|
-
- Review existing component patterns for consistency`;
|
|
589
|
-
}
|
|
590
|
-
/**
|
|
591
|
-
* WU-1261: Generate enforcement summary from resolved policy
|
|
592
|
-
*
|
|
593
|
-
* Creates a "You will be judged by" section that summarizes the active
|
|
594
|
-
* enforcement rules based on the resolved policy.
|
|
595
|
-
*
|
|
596
|
-
* @param policy - Resolved policy from resolvePolicy()
|
|
597
|
-
* @returns Enforcement summary section
|
|
598
|
-
*/
|
|
599
|
-
export function generateEnforcementSummary(policy) {
|
|
600
|
-
const lines = ['## You will be judged by', ''];
|
|
601
|
-
// Testing methodology
|
|
602
|
-
const testingStatus = policy.tests_required ? 'required' : 'optional';
|
|
603
|
-
lines.push(`- **Testing**: ${policy.testing} (tests ${testingStatus})`);
|
|
604
|
-
// Coverage
|
|
605
|
-
if (policy.coverage_mode === 'off') {
|
|
606
|
-
lines.push('- **Coverage**: disabled');
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
const modeLabel = policy.coverage_mode === 'block' ? 'blocking' : 'warn only';
|
|
610
|
-
lines.push(`- **Coverage**: ${policy.coverage_threshold}% (${modeLabel})`);
|
|
611
|
-
}
|
|
612
|
-
// Architecture
|
|
613
|
-
if (policy.architecture !== 'none') {
|
|
614
|
-
lines.push(`- **Architecture**: ${policy.architecture}`);
|
|
615
|
-
}
|
|
616
|
-
return lines.join('\n');
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Generate worktree block recovery section (WU-1192)
|
|
620
|
-
*
|
|
621
|
-
* Provides guidance when agents encounter worktree hook blocks.
|
|
622
|
-
*
|
|
623
|
-
* @param {string} worktreePath - Path to the worktree
|
|
624
|
-
* @returns {string} Recovery section
|
|
625
|
-
*/
|
|
626
|
-
export function generateWorktreeBlockRecoverySection(worktreePath) {
|
|
627
|
-
return `## When Blocked by Worktree Hook
|
|
628
|
-
|
|
629
|
-
If you encounter a "worktree required" or "commit blocked" error:
|
|
630
|
-
|
|
631
|
-
1. **Check existing worktrees**: \`git worktree list\`
|
|
632
|
-
2. **Navigate to the worktree**: \`cd ${worktreePath || 'worktrees/<lane>-wu-xxx'}\`
|
|
633
|
-
3. **Retry your operation** from within the worktree
|
|
634
|
-
4. **Use relative paths only** (never absolute paths)
|
|
635
|
-
|
|
636
|
-
### Common Causes
|
|
637
|
-
|
|
638
|
-
- Running \`git commit\` from main checkout instead of worktree
|
|
639
|
-
- Using absolute paths that bypass worktree isolation
|
|
640
|
-
- Forgetting to \`cd\` to worktree after \`wu:claim\`
|
|
641
|
-
|
|
642
|
-
### Quick Fix
|
|
643
|
-
|
|
644
|
-
\`\`\`bash
|
|
645
|
-
# Check where you are
|
|
646
|
-
pwd
|
|
647
|
-
git worktree list
|
|
648
|
-
|
|
649
|
-
# Navigate to your worktree
|
|
650
|
-
cd ${worktreePath || 'worktrees/<lane>-wu-xxx'}
|
|
651
|
-
|
|
652
|
-
# Retry your commit
|
|
653
|
-
git add . && git commit -m "your message"
|
|
654
|
-
\`\`\``;
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Detect mandatory agents based on code paths.
|
|
658
|
-
*
|
|
659
|
-
* @param {string[]} codePaths - Array of file paths
|
|
660
|
-
* @returns {string[]} Array of mandatory agent names
|
|
661
|
-
*/
|
|
662
|
-
function detectMandatoryAgents(codePaths) {
|
|
663
|
-
if (!codePaths || codePaths.length === 0) {
|
|
664
|
-
return [];
|
|
665
|
-
}
|
|
666
|
-
const triggeredAgents = new Set();
|
|
667
|
-
for (const [agentName, patterns] of Object.entries(MANDATORY_TRIGGERS)) {
|
|
668
|
-
const isTriggered = codePaths.some((filePath) => patterns.some((pattern) => minimatch(filePath, pattern)));
|
|
669
|
-
if (isTriggered) {
|
|
670
|
-
triggeredAgents.add(agentName);
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
return Array.from(triggeredAgents);
|
|
674
|
-
}
|
|
675
|
-
/**
|
|
676
|
-
* Format acceptance criteria as markdown list
|
|
677
|
-
*
|
|
678
|
-
* @param {string[]|undefined} acceptance - Acceptance criteria array
|
|
679
|
-
* @returns {string} Formatted acceptance criteria
|
|
680
|
-
*/
|
|
681
|
-
function formatAcceptance(acceptance) {
|
|
682
|
-
if (!acceptance || acceptance.length === 0) {
|
|
683
|
-
return '- No acceptance criteria defined';
|
|
684
|
-
}
|
|
685
|
-
return acceptance.map((item) => `- [ ] ${item}`).join('\n');
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Format spec_refs as markdown links
|
|
689
|
-
*
|
|
690
|
-
* WU-1062: Handles external paths (lumenflow://, ~/.lumenflow/, $LUMENFLOW_HOME/)
|
|
691
|
-
* by expanding them to absolute paths and adding a note about reading them.
|
|
692
|
-
*
|
|
693
|
-
* @param {string[]|undefined} specRefs - Spec references array
|
|
694
|
-
* @returns {string} Formatted references or empty string if none
|
|
695
|
-
*/
|
|
696
|
-
function formatSpecRefs(specRefs) {
|
|
697
|
-
if (!specRefs || specRefs.length === 0) {
|
|
698
|
-
return '';
|
|
699
|
-
}
|
|
700
|
-
const formattedRefs = specRefs.map((ref) => {
|
|
701
|
-
// WU-1062: Add note for external paths
|
|
702
|
-
if (ref.startsWith('lumenflow://') ||
|
|
703
|
-
ref.startsWith('~/') ||
|
|
704
|
-
ref.startsWith('$LUMENFLOW_HOME') ||
|
|
705
|
-
(ref.startsWith('/') && ref.includes('.lumenflow'))) {
|
|
706
|
-
return `- ${ref} (external - read with filesystem access)`;
|
|
707
|
-
}
|
|
708
|
-
return `- ${ref}`;
|
|
709
|
-
});
|
|
710
|
-
return formattedRefs.join('\n');
|
|
711
|
-
}
|
|
712
|
-
/**
|
|
713
|
-
* Format risks as markdown list
|
|
714
|
-
*
|
|
715
|
-
* @param {string[]|undefined} risks - Risks array
|
|
716
|
-
* @returns {string} Formatted risks or empty string if none
|
|
717
|
-
*/
|
|
718
|
-
function formatRisks(risks) {
|
|
719
|
-
if (!risks || risks.length === 0) {
|
|
720
|
-
return '';
|
|
721
|
-
}
|
|
722
|
-
return risks.map((risk) => `- ${risk}`).join('\n');
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Format manual tests as markdown checklist
|
|
726
|
-
*
|
|
727
|
-
* @param {string[]|undefined} manualTests - Manual test steps
|
|
728
|
-
* @returns {string} Formatted tests or empty string if none
|
|
729
|
-
*/
|
|
730
|
-
function formatManualTests(manualTests) {
|
|
731
|
-
if (!manualTests || manualTests.length === 0) {
|
|
732
|
-
return '';
|
|
733
|
-
}
|
|
734
|
-
return manualTests.map((test) => `- [ ] ${test}`).join('\n');
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Generate implementation context section (WU-1833)
|
|
738
|
-
*
|
|
739
|
-
* Includes spec_refs, notes, risks, and tests.manual if present.
|
|
740
|
-
* Sections with no content are omitted to keep prompts lean.
|
|
741
|
-
*
|
|
742
|
-
* @param {object} doc - WU YAML document
|
|
743
|
-
* @returns {string} Implementation context section or empty string
|
|
744
|
-
*/
|
|
745
|
-
function generateImplementationContext(doc) {
|
|
746
|
-
const sections = [];
|
|
747
|
-
// References (spec_refs)
|
|
748
|
-
const refs = formatSpecRefs(doc.spec_refs);
|
|
749
|
-
if (refs) {
|
|
750
|
-
sections.push(`## References\n\n${refs}`);
|
|
751
|
-
}
|
|
752
|
-
// Implementation Notes
|
|
753
|
-
if (doc.notes && doc.notes.trim()) {
|
|
754
|
-
sections.push(`## Implementation Notes\n\n${doc.notes.trim()}`);
|
|
755
|
-
}
|
|
756
|
-
// Risks
|
|
757
|
-
const risks = formatRisks(doc.risks);
|
|
758
|
-
if (risks) {
|
|
759
|
-
sections.push(`## Risks\n\n${risks}`);
|
|
760
|
-
}
|
|
761
|
-
// Manual Verification (tests.manual)
|
|
762
|
-
const manualTests = formatManualTests(doc.tests?.manual);
|
|
763
|
-
if (manualTests) {
|
|
764
|
-
sections.push(`## Manual Verification\n\n${manualTests}`);
|
|
765
|
-
}
|
|
766
|
-
if (sections.length === 0) {
|
|
767
|
-
return '';
|
|
768
|
-
}
|
|
769
|
-
return sections.join('\n\n---\n\n');
|
|
770
|
-
}
|
|
771
|
-
/**
|
|
772
|
-
* Check if a code path matches an invariant based on type
|
|
773
|
-
*
|
|
774
|
-
* @param {object} invariant - Invariant definition
|
|
775
|
-
* @param {string[]} codePaths - Array of code paths
|
|
776
|
-
* @returns {boolean} True if code paths match the invariant
|
|
777
|
-
*/
|
|
778
|
-
function codePathMatchesInvariant(invariant, codePaths) {
|
|
779
|
-
switch (invariant.type) {
|
|
780
|
-
case INVARIANT_TYPES.FORBIDDEN_FILE:
|
|
781
|
-
case INVARIANT_TYPES.REQUIRED_FILE: {
|
|
782
|
-
const invariantPath = invariant.path;
|
|
783
|
-
if (!invariantPath)
|
|
784
|
-
return false;
|
|
785
|
-
return codePaths.some((p) => p === invariantPath || minimatch(p, invariantPath) || minimatch(invariantPath, p));
|
|
786
|
-
}
|
|
787
|
-
case INVARIANT_TYPES.MUTUAL_EXCLUSIVITY: {
|
|
788
|
-
const invariantPaths = invariant.paths ?? [];
|
|
789
|
-
return codePaths.some((p) => invariantPaths.some((invPath) => p === invPath || minimatch(p, invPath)));
|
|
790
|
-
}
|
|
791
|
-
case INVARIANT_TYPES.FORBIDDEN_PATTERN:
|
|
792
|
-
case INVARIANT_TYPES.REQUIRED_PATTERN:
|
|
793
|
-
return (invariant.scope?.some((scopePattern) => codePaths.some((p) => minimatch(p, scopePattern))) ?? false);
|
|
794
|
-
// WU-2254: forbidden-import uses 'from' glob instead of 'scope'
|
|
795
|
-
case INVARIANT_TYPES.FORBIDDEN_IMPORT: {
|
|
796
|
-
const fromPattern = invariant.from;
|
|
797
|
-
if (!fromPattern)
|
|
798
|
-
return false;
|
|
799
|
-
return codePaths.some((p) => minimatch(p, fromPattern));
|
|
800
|
-
}
|
|
801
|
-
default:
|
|
802
|
-
return false;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
/**
|
|
806
|
-
* Format a single invariant for output
|
|
807
|
-
*
|
|
808
|
-
* @param {object} inv - Invariant definition
|
|
809
|
-
* @returns {string[]} Lines of formatted output
|
|
810
|
-
*/
|
|
811
|
-
function formatInvariantForOutput(inv) {
|
|
812
|
-
const lines = [`### ${inv.id} (${inv.type})`, '', inv.description, ''];
|
|
813
|
-
if (inv.message) {
|
|
814
|
-
lines.push(`**Action:** ${inv.message}`, '');
|
|
815
|
-
}
|
|
816
|
-
if (inv.path) {
|
|
817
|
-
lines.push(`**Path:** \`${inv.path}\``);
|
|
818
|
-
}
|
|
819
|
-
if (inv.paths) {
|
|
820
|
-
const formattedPaths = inv.paths.map((p) => `\`${p}\``).join(', ');
|
|
821
|
-
lines.push(`**Paths:** ${formattedPaths}`);
|
|
822
|
-
}
|
|
823
|
-
// WU-2254: forbidden-import specific fields
|
|
824
|
-
if (inv.from) {
|
|
825
|
-
lines.push(`**From:** \`${inv.from}\``);
|
|
826
|
-
}
|
|
827
|
-
if (inv.cannot_import && Array.isArray(inv.cannot_import)) {
|
|
828
|
-
const formattedImports = inv.cannot_import.map((m) => `\`${m}\``).join(', ');
|
|
829
|
-
lines.push(`**Cannot Import:** ${formattedImports}`);
|
|
830
|
-
}
|
|
831
|
-
// WU-2254: required-pattern specific fields
|
|
832
|
-
if (inv.pattern &&
|
|
833
|
-
(inv.type === INVARIANT_TYPES.REQUIRED_PATTERN ||
|
|
834
|
-
inv.type === INVARIANT_TYPES.FORBIDDEN_PATTERN)) {
|
|
835
|
-
lines.push(`**Pattern:** \`${inv.pattern}\``);
|
|
836
|
-
}
|
|
837
|
-
if (inv.scope && Array.isArray(inv.scope)) {
|
|
838
|
-
const formattedScope = inv.scope.map((s) => `\`${s}\``).join(', ');
|
|
839
|
-
lines.push(`**Scope:** ${formattedScope}`);
|
|
840
|
-
}
|
|
841
|
-
lines.push('');
|
|
842
|
-
return lines;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* WU-2252: Generate invariants/prior-art section for code_paths
|
|
846
|
-
*
|
|
847
|
-
* Loads relevant invariants from invariants.yml and generates a section
|
|
848
|
-
* that surfaces constraints and prior-art for the WU's code_paths.
|
|
849
|
-
*
|
|
850
|
-
* @param {string[]} codePaths - Array of code paths from the WU
|
|
851
|
-
* @returns {string} Invariants/prior-art section or empty string if none relevant
|
|
852
|
-
*/
|
|
853
|
-
function generateInvariantsPriorArtSection(codePaths) {
|
|
854
|
-
if (!codePaths || codePaths.length === 0) {
|
|
855
|
-
return '';
|
|
856
|
-
}
|
|
857
|
-
// Try to load tools/invariants.yml
|
|
858
|
-
const invariantsPath = path.resolve('tools/invariants.yml');
|
|
859
|
-
if (!existsSync(invariantsPath)) {
|
|
860
|
-
return '';
|
|
861
|
-
}
|
|
862
|
-
let invariants;
|
|
863
|
-
try {
|
|
864
|
-
invariants = loadInvariants(invariantsPath);
|
|
865
|
-
}
|
|
866
|
-
catch {
|
|
867
|
-
return '';
|
|
868
|
-
}
|
|
869
|
-
if (!invariants || invariants.length === 0) {
|
|
870
|
-
return '';
|
|
871
|
-
}
|
|
872
|
-
// Find relevant invariants based on code_paths
|
|
873
|
-
const relevantInvariants = invariants.filter((inv) => codePathMatchesInvariant(inv, codePaths));
|
|
874
|
-
if (relevantInvariants.length === 0) {
|
|
875
|
-
return '';
|
|
876
|
-
}
|
|
877
|
-
// Format the section
|
|
878
|
-
const lines = [
|
|
879
|
-
'## Invariants/Prior-Art (WU-2252)',
|
|
880
|
-
'',
|
|
881
|
-
'The following repo invariants are relevant to your code_paths:',
|
|
882
|
-
'',
|
|
883
|
-
...relevantInvariants.flatMap(formatInvariantForOutput),
|
|
884
|
-
'**IMPORTANT:** Do not create specs or acceptance criteria that conflict with these invariants.',
|
|
885
|
-
];
|
|
886
|
-
return lines.join('\n');
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Generate the context loading preamble
|
|
890
|
-
*
|
|
891
|
-
* Follows AGENTS.md context loading protocol (WU-2247):
|
|
892
|
-
* 1. CLAUDE.md for workflow fundamentals
|
|
893
|
-
* 2. README.md for project structure
|
|
894
|
-
* 3. lumenflow-complete.md sections 1-7 (TDD, gates, DoD)
|
|
895
|
-
* 4. WU YAML for specific task
|
|
896
|
-
*
|
|
897
|
-
* Includes context recovery section for session resumption (WU-1589).
|
|
898
|
-
*
|
|
899
|
-
* @param {string} id - WU ID
|
|
900
|
-
* @returns {string} Context loading preamble
|
|
901
|
-
*/
|
|
902
|
-
/**
|
|
903
|
-
* Generate the context loading preamble using the strategy
|
|
904
|
-
*
|
|
905
|
-
* @param {string} id - WU ID
|
|
906
|
-
* @param {import('./spawn-strategy.js').SpawnStrategy} strategy - Client strategy
|
|
907
|
-
* @returns {string} Context loading preamble
|
|
908
|
-
*/
|
|
909
|
-
function generatePreamble(id, strategy) {
|
|
910
|
-
return strategy.getPreamble(id);
|
|
911
|
-
}
|
|
912
|
-
/**
|
|
913
|
-
* Generate the constraints block (appended at end per Lost in the Middle research)
|
|
914
|
-
*
|
|
915
|
-
* WU-2247: Aligned with LumenFlow §7.2 (stop-and-ask) and §7.3 (anti-loop guard).
|
|
916
|
-
* Includes item 6: MEMORY LAYER COORDINATION (WU-1589).
|
|
917
|
-
*
|
|
918
|
-
* WU-1900: TDD CHECKPOINT (constraint 1) is now conditional. It is omitted when:
|
|
919
|
-
* - Work is classified as UI domain (smoke-test methodology)
|
|
920
|
-
* - Policy methodology is 'none'
|
|
921
|
-
*
|
|
922
|
-
* @param {string} id - WU ID
|
|
923
|
-
* @param {ConstraintsOptions} options - Options for conditional constraints
|
|
924
|
-
* @returns {string} Constraints block
|
|
925
|
-
*/
|
|
926
|
-
function generateConstraints(id, options) {
|
|
927
|
-
const includeTdd = options?.includeTddCheckpoint !== false;
|
|
928
|
-
const tddCheckpointBlock = includeTdd
|
|
929
|
-
? `
|
|
930
|
-
1. TDD CHECKPOINT (VERIFY BEFORE IMPLEMENTATION)
|
|
931
|
-
- Did you write tests BEFORE implementation?
|
|
932
|
-
- Is there at least one failing test for each acceptance criterion?
|
|
933
|
-
- Never skip the RED phase — failing tests prove the test works
|
|
934
|
-
|
|
935
|
-
`
|
|
936
|
-
: '';
|
|
937
|
-
// Renumber constraints based on whether TDD is included
|
|
938
|
-
const antiLoopNum = includeTdd ? 2 : 1;
|
|
939
|
-
const stopAskNum = includeTdd ? 3 : 2;
|
|
940
|
-
const verifyNum = includeTdd ? 4 : 3;
|
|
941
|
-
const neverFabNum = includeTdd ? 5 : 4;
|
|
942
|
-
const gitNum = includeTdd ? 6 : 5;
|
|
943
|
-
const memNum = includeTdd ? 7 : 6;
|
|
944
|
-
const skipGatesNum = includeTdd ? 8 : 7;
|
|
945
|
-
const worktreeNum = includeTdd ? 9 : 8;
|
|
946
|
-
return `---
|
|
947
|
-
|
|
948
|
-
<constraints>
|
|
949
|
-
CRITICAL RULES - ENFORCE BEFORE EVERY ACTION:
|
|
950
|
-
${tddCheckpointBlock}${antiLoopNum}. ANTI-LOOP GUARD (LumenFlow §7.3)
|
|
951
|
-
- Max 3 attempts per unique error before escalating
|
|
952
|
-
- If same error repeats 3x, STOP and report with full context
|
|
953
|
-
- Retry with different approach, not same command
|
|
954
|
-
|
|
955
|
-
${stopAskNum}. STOP-AND-ASK TRIGGERS (LumenFlow §7.2 - narrow scope)
|
|
956
|
-
- Policy changes, auth/permissions modifications
|
|
957
|
-
- PII/safety issues, cloud spend, secrets, backups
|
|
958
|
-
- Same error repeats 3x
|
|
959
|
-
- For ordinary errors: fix and retry autonomously (up to 3 attempts)
|
|
960
|
-
|
|
961
|
-
${verifyNum}. VERIFY COMPLETION before reporting success
|
|
962
|
-
- Run: node packages/@lumenflow/agent/verification ${id} (from shared checkout)
|
|
963
|
-
- Exit 0 = passed, Exit 1 = INCOMPLETE
|
|
964
|
-
- Never report "done" if verification fails
|
|
965
|
-
|
|
966
|
-
${neverFabNum}. NEVER FABRICATE COMPLETION
|
|
967
|
-
- If blockers remain, report INCOMPLETE
|
|
968
|
-
- If verification fails, summarize failures
|
|
969
|
-
- Honesty over false completion
|
|
970
|
-
|
|
971
|
-
${gitNum}. GIT WORKFLOW (CRITICAL - GitHub rules reject merge commits)
|
|
972
|
-
- GitHub REJECTS merge commits on main
|
|
973
|
-
- ALWAYS use \`git rebase origin/main\` before push
|
|
974
|
-
- Push to main via \`git push origin lane/...:main\` (fast-forward only)
|
|
975
|
-
- NEVER use \`git merge\` on main branch
|
|
976
|
-
- Use \`pnpm wu:prep\` from worktree, then \`pnpm wu:done\` from main (WU-1223)
|
|
977
|
-
|
|
978
|
-
${memNum}. MEMORY LAYER COORDINATION (INIT-007)
|
|
979
|
-
- Use \`pnpm mem:checkpoint --wu ${id}\` to save progress before risky operations
|
|
980
|
-
- Check \`pnpm mem:inbox --wu ${id}\` periodically for parallel signals from other agents
|
|
981
|
-
- Checkpoint triggers (WU-1943): checkpoint after each acceptance criterion completed, checkpoint before gates, checkpoint every 30 tool calls
|
|
982
|
-
|
|
983
|
-
${skipGatesNum}. SKIP-GATES AUTONOMY (WU-1142)
|
|
984
|
-
- If gates fail, first check if failure is pre-existing on main: \`git checkout main && pnpm gates\`
|
|
985
|
-
- If failure exists on main (not your change), use: \`pnpm wu:done --id ${id} --skip-gates --reason "pre-existing on main" --fix-wu WU-XXXX\`
|
|
986
|
-
- Do NOT ask for approval - autonomous skip-gates for pre-existing failures is correct
|
|
987
|
-
- This prevents getting stuck on infrastructure debt
|
|
988
|
-
|
|
989
|
-
${worktreeNum}. WORKTREE DISCIPLINE (WU-1282)
|
|
990
|
-
- CRITICAL: PreToolUse hooks do not propagate to sub-agents spawned via Task tool
|
|
991
|
-
- BEFORE UnsafeAny Write/Edit operation, manually verify you are in a worktree:
|
|
992
|
-
- Run: \`pwd\` and confirm output contains \`worktrees/\`
|
|
993
|
-
- If not in worktree, STOP and navigate: \`cd worktrees/<lane>-wu-xxx\`
|
|
994
|
-
- Use RELATIVE paths only (never full absolute paths starting with root directory)
|
|
995
|
-
- This constraint exists because Claude Code does not inherit settings.json hooks in sub-agent sessions
|
|
996
|
-
</constraints>
|
|
997
|
-
|
|
998
|
-
${SPAWN_END_SENTINEL}`;
|
|
999
|
-
}
|
|
1000
|
-
function generateCodexConstraints(id) {
|
|
1001
|
-
return `## Constraints (Critical)
|
|
1002
|
-
|
|
1003
|
-
1. **TDD checkpoint**: tests BEFORE implementation; never skip RED
|
|
1004
|
-
2. **Stop on errors**: if UnsafeAny command fails, report BLOCKED (never DONE) with the error
|
|
1005
|
-
3. **Verify before success**: run \`pnpm gates\` in the worktree, then run \`node packages/@lumenflow/agent/verification ${id}\` (from the shared checkout)
|
|
1006
|
-
4. **No fabrication**: if blockers remain or verification fails, report INCOMPLETE
|
|
1007
|
-
5. **Git workflow**: avoid merge commits; use \`wu:prep\` from worktree, then \`wu:done\` from main
|
|
1008
|
-
6. **Scope discipline**: stay within \`code_paths\`; capture out-of-scope issues via \`pnpm mem:create\`
|
|
1009
|
-
7. **Worktree discipline (WU-1282)**: BEFORE UnsafeAny Write/Edit, verify \`pwd\` shows \`worktrees/\`; hooks do not propagate to sub-agents`;
|
|
1010
|
-
}
|
|
1011
|
-
/**
|
|
1012
|
-
* Generate mandatory agent advisory section
|
|
1013
|
-
*
|
|
1014
|
-
* @param {string[]} mandatoryAgents - Array of mandatory agent names
|
|
1015
|
-
* @param {string} _id - WU ID (reserved for future use)
|
|
1016
|
-
* @returns {string} Mandatory agent section or empty string
|
|
1017
|
-
*/
|
|
1018
|
-
function generateMandatoryAgentSection(mandatoryAgents, _id) {
|
|
1019
|
-
if (mandatoryAgents.length === 0) {
|
|
1020
|
-
return '';
|
|
1021
|
-
}
|
|
1022
|
-
const agentList = mandatoryAgents.map((agent) => ` - ${agent}`).join('\n');
|
|
1023
|
-
return `
|
|
1024
|
-
## Mandatory Agents (MUST invoke before wu:done)
|
|
1025
|
-
|
|
1026
|
-
Based on code_paths, the following agents MUST be invoked:
|
|
1027
|
-
|
|
1028
|
-
${agentList}
|
|
1029
|
-
|
|
1030
|
-
Run: pnpm orchestrate:monitor to check agent status
|
|
1031
|
-
`;
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Generate effort scaling rules section (WU-1986)
|
|
1035
|
-
*
|
|
1036
|
-
* Based on Anthropic multi-agent research: helps agents decide when to
|
|
1037
|
-
* spawn sub-agents vs handle inline.
|
|
1038
|
-
*
|
|
1039
|
-
* @returns {string} Effort scaling section
|
|
1040
|
-
*/
|
|
1041
|
-
export function generateEffortScalingRules() {
|
|
1042
|
-
return `## Effort Scaling (When to Spawn Sub-Agents)
|
|
1043
|
-
|
|
1044
|
-
Use this heuristic to decide complexity:
|
|
1045
|
-
|
|
1046
|
-
| Complexity | Approach | Tool Calls |
|
|
1047
|
-
|------------|----------|------------|
|
|
1048
|
-
| **Simple** (single file, <50 lines) | Handle inline | 3-10 |
|
|
1049
|
-
| **Moderate** (2-3 files, clear scope) | Handle inline | 10-20 |
|
|
1050
|
-
| **Complex** (4+ files, exploration needed) | Spawn Explore agent first | 20+ |
|
|
1051
|
-
| **Multi-domain** (cross-cutting concerns) | Spawn specialized sub-agents | Varies |
|
|
1052
|
-
|
|
1053
|
-
**Rule**: If you need >30 tool calls for a subtask, consider spawning a sub-agent with a focused scope.`;
|
|
1054
|
-
}
|
|
1055
|
-
/**
|
|
1056
|
-
* Generate parallel tool call guidance (WU-1986)
|
|
1057
|
-
*
|
|
1058
|
-
* Based on Anthropic research: 3+ parallel tool calls significantly improve performance.
|
|
1059
|
-
*
|
|
1060
|
-
* @returns {string} Parallel tool call guidance
|
|
1061
|
-
*/
|
|
1062
|
-
export function generateParallelToolCallGuidance() {
|
|
1063
|
-
return `## Parallel Tool Calls (Performance)
|
|
1064
|
-
|
|
1065
|
-
**IMPORTANT**: Make 3+ tool calls in parallel when operations are independent.
|
|
1066
|
-
|
|
1067
|
-
Good examples:
|
|
1068
|
-
- Reading multiple files simultaneously
|
|
1069
|
-
- Running independent grep searches
|
|
1070
|
-
- Spawning multiple Explore agents for different areas
|
|
1071
|
-
|
|
1072
|
-
Bad examples:
|
|
1073
|
-
- Reading a file then editing it (sequential dependency)
|
|
1074
|
-
- Running tests then checking results (sequential)
|
|
1075
|
-
|
|
1076
|
-
Parallelism reduces latency by 50-90% for complex tasks.`;
|
|
1077
|
-
}
|
|
1078
|
-
/**
|
|
1079
|
-
* Generate iterative search heuristics (WU-1986)
|
|
1080
|
-
*
|
|
1081
|
-
* Based on Anthropic research: start broad, narrow focus.
|
|
1082
|
-
*
|
|
1083
|
-
* @returns {string} Search heuristics section
|
|
1084
|
-
*/
|
|
1085
|
-
export function generateIterativeSearchHeuristics() {
|
|
1086
|
-
return `## Search Strategy (Broad to Narrow)
|
|
1087
|
-
|
|
1088
|
-
When exploring the codebase:
|
|
1089
|
-
|
|
1090
|
-
1. **Start broad**: Use Explore agent or glob patterns to understand structure
|
|
1091
|
-
2. **Evaluate findings**: What patterns exist? What's relevant?
|
|
1092
|
-
3. **Narrow focus**: Target specific files/functions based on findings
|
|
1093
|
-
4. **Iterate**: Refine if initial approach misses the target
|
|
1094
|
-
|
|
1095
|
-
Avoid: Jumping directly to specific file edits without understanding context.`;
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* Generate token budget awareness section (WU-1986)
|
|
1099
|
-
*
|
|
1100
|
-
* @param {string} id - WU ID
|
|
1101
|
-
* @returns {string} Token budget section
|
|
1102
|
-
*/
|
|
1103
|
-
export function generateTokenBudgetAwareness(id) {
|
|
1104
|
-
return `## Token Budget Awareness
|
|
1105
|
-
|
|
1106
|
-
Context limit is ~200K tokens. Monitor your usage:
|
|
1107
|
-
|
|
1108
|
-
- **At 50+ tool calls**: Create a checkpoint (\`pnpm mem:checkpoint --wu ${id}\`)
|
|
1109
|
-
- **At 100+ tool calls**: Consider spawning fresh sub-agent with focused scope
|
|
1110
|
-
- **Before risky operations**: Always checkpoint first
|
|
1111
|
-
|
|
1112
|
-
If approaching limits, summarize progress and spawn continuation agent.`;
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* Generate structured completion format (WU-1986)
|
|
1116
|
-
*
|
|
1117
|
-
* @param {string} id - WU ID
|
|
1118
|
-
* @returns {string} Completion format section
|
|
1119
|
-
*/
|
|
1120
|
-
export function generateCompletionFormat(_id) {
|
|
1121
|
-
return `## Completion Report Format
|
|
1122
|
-
|
|
1123
|
-
When finishing, provide structured output:
|
|
1124
|
-
|
|
1125
|
-
\`\`\`
|
|
1126
|
-
## Summary
|
|
1127
|
-
<1-3 sentences describing what was accomplished>
|
|
1128
|
-
|
|
1129
|
-
## Artifacts
|
|
1130
|
-
- Files modified: <list>
|
|
1131
|
-
- Tests added: <list>
|
|
1132
|
-
- Documentation updated: <list>
|
|
1133
|
-
|
|
1134
|
-
## Verification
|
|
1135
|
-
- Gates: <pass/fail>
|
|
1136
|
-
- Tests: <X passing, Y failing>
|
|
1137
|
-
|
|
1138
|
-
## Blockers (if UnsafeAny)
|
|
1139
|
-
- <blocker description>
|
|
1140
|
-
|
|
1141
|
-
## Follow-up (if needed)
|
|
1142
|
-
- <suggested next WU or action>
|
|
1143
|
-
\`\`\`
|
|
1144
|
-
|
|
1145
|
-
This format enables orchestrator to track progress across waves.`;
|
|
1146
|
-
}
|
|
1147
|
-
/**
|
|
1148
|
-
* Generate agent coordination section (WU-1987, WU-1203)
|
|
1149
|
-
*
|
|
1150
|
-
* Provides guidance on mem:signal for parallel agent coordination,
|
|
1151
|
-
* orchestrate:monitor for agent status checks, and abandoned WU handling.
|
|
1152
|
-
*
|
|
1153
|
-
* WU-1203: Reads progress_signals config to generate dynamic guidance.
|
|
1154
|
-
* When enabled:true, shows "Progress Signals (Required at Milestones)" with
|
|
1155
|
-
* configurable triggers. When enabled:false or not configured, shows
|
|
1156
|
-
* "Progress Signals (Optional)".
|
|
1157
|
-
*
|
|
1158
|
-
* @param {string} id - WU ID
|
|
1159
|
-
* @returns {string} Agent coordination section
|
|
1160
|
-
*/
|
|
1161
|
-
export function generateAgentCoordinationSection(id) {
|
|
1162
|
-
const config = getConfig();
|
|
1163
|
-
const progressSignals = config.memory?.progress_signals;
|
|
1164
|
-
// WU-1210: Default to enabled (Required at Milestones) when not explicitly configured
|
|
1165
|
-
// This ensures agents signal progress at key milestones by default
|
|
1166
|
-
const isEnabled = progressSignals?.enabled ?? true;
|
|
1167
|
-
// Generate milestone triggers section based on config
|
|
1168
|
-
const generateMilestoneTriggers = () => {
|
|
1169
|
-
if (!isEnabled) {
|
|
1170
|
-
// Disabled - show optional guidance only
|
|
1171
|
-
return `For long-running work, send progress signals at milestones:
|
|
1172
|
-
|
|
1173
|
-
\`\`\`bash
|
|
1174
|
-
pnpm mem:signal "50% complete: tests passing, implementing adapter" --wu ${id}
|
|
1175
|
-
pnpm mem:signal "Blocked: waiting for WU-XXX dependency" --wu ${id}
|
|
1176
|
-
\`\`\``;
|
|
1177
|
-
}
|
|
1178
|
-
// WU-1210: isEnabled is true (either by default or explicit config)
|
|
1179
|
-
// Build list of enabled triggers, using defaults when progressSignals is undefined
|
|
1180
|
-
const triggers = [];
|
|
1181
|
-
// Default all triggers to enabled when not explicitly configured
|
|
1182
|
-
if ((progressSignals?.on_milestone ?? true) !== false) {
|
|
1183
|
-
triggers.push('**After each acceptance criterion completed** - helps track progress');
|
|
1184
|
-
}
|
|
1185
|
-
if ((progressSignals?.on_tests_pass ?? true) !== false) {
|
|
1186
|
-
triggers.push('**When tests first pass** - indicates implementation is working');
|
|
1187
|
-
}
|
|
1188
|
-
if ((progressSignals?.before_gates ?? true) !== false) {
|
|
1189
|
-
triggers.push('**Before running gates** - signals imminent completion');
|
|
1190
|
-
}
|
|
1191
|
-
if ((progressSignals?.on_blocked ?? true) !== false) {
|
|
1192
|
-
triggers.push('**When blocked** - allows orchestrator to re-allocate or assist');
|
|
1193
|
-
}
|
|
1194
|
-
// Add frequency-based trigger if configured
|
|
1195
|
-
const frequency = progressSignals?.frequency ?? 0;
|
|
1196
|
-
let frequencyGuidance = '';
|
|
1197
|
-
if (frequency > 0) {
|
|
1198
|
-
frequencyGuidance = `\n5. **Every ${frequency} tool calls** - periodic progress update`;
|
|
1199
|
-
}
|
|
1200
|
-
const triggerList = triggers.length > 0
|
|
1201
|
-
? triggers.map((t, i) => `${i + 1}. ${t}`).join('\n') + frequencyGuidance
|
|
1202
|
-
: 'Signal at key milestones to enable orchestrator visibility.';
|
|
1203
|
-
return `**Signal at these milestones** to enable orchestrator visibility:
|
|
1204
|
-
|
|
1205
|
-
${triggerList}
|
|
1206
|
-
|
|
1207
|
-
\`\`\`bash
|
|
1208
|
-
pnpm mem:signal "AC1 complete: tests passing for feature X" --wu ${id}
|
|
1209
|
-
pnpm mem:signal "All tests passing, running gates" --wu ${id}
|
|
1210
|
-
pnpm mem:signal "Blocked: waiting for WU-XXX dependency" --wu ${id}
|
|
1211
|
-
\`\`\``;
|
|
1212
|
-
};
|
|
1213
|
-
const progressSectionTitle = isEnabled
|
|
1214
|
-
? '### Progress Signals (Required at Milestones)'
|
|
1215
|
-
: '### Progress Signals (Optional)';
|
|
1216
|
-
return `## Agent Coordination (Parallel Work)
|
|
1217
|
-
|
|
1218
|
-
### ⚠️ CRITICAL: Use mem:signal, NOT TaskOutput
|
|
1219
|
-
|
|
1220
|
-
**DO NOT** use TaskOutput to check agent progress - it returns full transcripts
|
|
1221
|
-
and causes "prompt too long" errors. Always use the memory layer instead:
|
|
1222
|
-
|
|
1223
|
-
\`\`\`bash
|
|
1224
|
-
# ✅ CORRECT: Compact signals (~6 lines)
|
|
1225
|
-
pnpm mem:inbox --since 30m
|
|
1226
|
-
|
|
1227
|
-
# ❌ WRONG: Full transcripts (context explosion)
|
|
1228
|
-
# TaskOutput with block=false <-- NEVER DO THIS FOR MONITORING
|
|
1229
|
-
\`\`\`
|
|
1230
|
-
|
|
1231
|
-
### Automatic Completion Signals
|
|
1232
|
-
|
|
1233
|
-
\`wu:done\` automatically broadcasts completion signals. You do not need to
|
|
1234
|
-
manually signal completion - just run \`wu:done\` and orchestrators will
|
|
1235
|
-
see your signal via \`mem:inbox\`.
|
|
1236
|
-
|
|
1237
|
-
${progressSectionTitle}
|
|
1238
|
-
|
|
1239
|
-
${generateMilestoneTriggers()}
|
|
1240
|
-
|
|
1241
|
-
### Checking Status
|
|
1242
|
-
|
|
1243
|
-
\`\`\`bash
|
|
1244
|
-
pnpm orchestrate:init-status -i INIT-XXX # Initiative progress (compact)
|
|
1245
|
-
pnpm mem:inbox --since 1h # Recent signals from all agents
|
|
1246
|
-
pnpm mem:inbox --lane "Experience: Web" # Lane-specific signals
|
|
1247
|
-
\`\`\``;
|
|
1248
|
-
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Generate quick fix commands section (WU-1987)
|
|
1251
|
-
*
|
|
1252
|
-
* Provides format/lint/typecheck commands for quick fixes before gates.
|
|
1253
|
-
*
|
|
1254
|
-
* @returns {string} Quick fix commands section
|
|
1255
|
-
*/
|
|
1256
|
-
export function generateQuickFixCommands() {
|
|
1257
|
-
return `## Quick Fix Commands
|
|
1258
|
-
|
|
1259
|
-
If gates fail, try these before investigating:
|
|
1260
|
-
|
|
1261
|
-
\`\`\`bash
|
|
1262
|
-
pnpm format # Auto-fix formatting issues
|
|
1263
|
-
pnpm lint # Check linting (use --fix for auto-fix)
|
|
1264
|
-
pnpm typecheck # Check TypeScript types
|
|
1265
|
-
\`\`\`
|
|
1266
|
-
|
|
1267
|
-
**Use before gates** to catch simple issues early. These are faster than full \`pnpm gates\`.`;
|
|
1268
|
-
}
|
|
1269
|
-
/**
|
|
1270
|
-
* WU-1270: Emit methodology telemetry event (opt-in)
|
|
1271
|
-
*
|
|
1272
|
-
* Emits privacy-preserving telemetry about methodology selection.
|
|
1273
|
-
* Only emits if telemetry.methodology.enabled is true in config.
|
|
1274
|
-
*
|
|
1275
|
-
* @param config - LumenFlow configuration
|
|
1276
|
-
* @param policy - Resolved methodology policy
|
|
1277
|
-
*/
|
|
1278
|
-
export function emitMethodologyTelemetry(config, policy) {
|
|
1279
|
-
// Check if methodology telemetry is opt-in enabled
|
|
1280
|
-
if (!config.telemetry?.methodology?.enabled) {
|
|
1281
|
-
return;
|
|
1282
|
-
}
|
|
1283
|
-
const event = {
|
|
1284
|
-
timestamp: new Date().toISOString(),
|
|
1285
|
-
event_type: 'methodology.selection',
|
|
1286
|
-
methodology_testing: policy.testing,
|
|
1287
|
-
methodology_architecture: policy.architecture,
|
|
1288
|
-
event_context: 'spawn',
|
|
1289
|
-
};
|
|
1290
|
-
// Use the telemetry emit function from telemetry.ts - WU-1430: Use centralized constant
|
|
1291
|
-
emitTelemetry(LUMENFLOW_PATHS.METHODOLOGY_LOG, event);
|
|
1292
|
-
}
|
|
1293
|
-
/**
|
|
1294
|
-
* Generate Lane Selection section (WU-2107)
|
|
1295
|
-
*
|
|
1296
|
-
* Provides guidance on lane selection when creating new WUs.
|
|
1297
|
-
* Points agents to wu:infer-lane for automated lane suggestions.
|
|
1298
|
-
*
|
|
1299
|
-
* @returns {string} Lane Selection section
|
|
1300
|
-
*/
|
|
1301
|
-
export function generateLaneSelectionSection() {
|
|
1302
|
-
return `## Lane Selection
|
|
1303
|
-
|
|
1304
|
-
When creating new WUs, use the correct lane to enable parallelization:
|
|
1305
|
-
|
|
1306
|
-
\`\`\`bash
|
|
1307
|
-
# Get lane suggestion based on code paths and description
|
|
1308
|
-
pnpm wu:infer-lane --id WU-XXX
|
|
1309
|
-
|
|
1310
|
-
# Or infer from manual inputs
|
|
1311
|
-
pnpm wu:infer-lane --paths "tools/**" --desc "CLI improvements"
|
|
1312
|
-
\`\`\`
|
|
1313
|
-
|
|
1314
|
-
**Lane taxonomy**: See \`.lumenflow.lane-inference.yaml\` for valid lanes and patterns.
|
|
1315
|
-
|
|
1316
|
-
**Why lanes matter**: WIP=1 per lane means correct lane selection enables parallel work across lanes.`;
|
|
1317
|
-
}
|
|
1318
|
-
/**
|
|
1319
|
-
* Generate Worktree Path Guidance section (WU-2362)
|
|
1320
|
-
*
|
|
1321
|
-
* Provides guidance for sub-agents on working within worktrees, including
|
|
1322
|
-
* how to determine the worktree root and where to create stamps.
|
|
1323
|
-
*
|
|
1324
|
-
* Problem: CLAUDE_PROJECT_DIR is hook-only; sub-agents inherit parent cwd (main).
|
|
1325
|
-
* Solution: Use git rev-parse --show-toplevel to determine actual worktree root.
|
|
1326
|
-
*
|
|
1327
|
-
* @param {string|undefined} worktreePath - Worktree path from WU YAML
|
|
1328
|
-
* @returns {string} Worktree path guidance section
|
|
1329
|
-
*/
|
|
1330
|
-
export function generateWorktreePathGuidance(worktreePath) {
|
|
1331
|
-
if (!worktreePath) {
|
|
1332
|
-
return '';
|
|
1333
|
-
}
|
|
1334
|
-
return `## Worktree Path Guidance (WU-2362)
|
|
1335
|
-
|
|
1336
|
-
**Your worktree:** \`${worktreePath}\`
|
|
1337
|
-
|
|
1338
|
-
### Finding the Worktree Root
|
|
1339
|
-
|
|
1340
|
-
Sub-agents may inherit the parent's cwd (main checkout). To find the actual worktree root:
|
|
1341
|
-
|
|
1342
|
-
\`\`\`bash
|
|
1343
|
-
# Get the worktree root (not main checkout)
|
|
1344
|
-
git rev-parse --show-toplevel
|
|
1345
|
-
\`\`\`
|
|
1346
|
-
|
|
1347
|
-
### Stamp Creation
|
|
1348
|
-
|
|
1349
|
-
When creating \`.lumenflow/\` stamps or other artifacts:
|
|
1350
|
-
|
|
1351
|
-
1. **ALWAYS** create stamps in the **worktree**, not main
|
|
1352
|
-
2. Use \`git rev-parse --show-toplevel\` to get the correct base path
|
|
1353
|
-
3. Stamps created on main will be lost when the worktree merges
|
|
1354
|
-
|
|
1355
|
-
\`\`\`bash
|
|
1356
|
-
# CORRECT: Create stamp in worktree
|
|
1357
|
-
WORKTREE_ROOT=$(git rev-parse --show-toplevel)
|
|
1358
|
-
mkdir -p "$WORKTREE_ROOT/.lumenflow/agent-runs"
|
|
1359
|
-
touch "$WORKTREE_ROOT/.lumenflow/agent-runs/code-reviewer.stamp"
|
|
1360
|
-
|
|
1361
|
-
# WRONG: Hardcoded path to main
|
|
1362
|
-
# touch /path/to/main/.lumenflow/agent-runs/code-reviewer.stamp
|
|
1363
|
-
\`\`\`
|
|
1364
|
-
|
|
1365
|
-
### Why This Matters
|
|
1366
|
-
|
|
1367
|
-
- Stamps on main get overwritten by worktree merge
|
|
1368
|
-
- \`wu:done\` validates stamps exist in the worktree branch
|
|
1369
|
-
- Parallel WUs in other lanes won't see your stamps if on main`;
|
|
1370
|
-
}
|
|
1371
|
-
/**
|
|
1372
|
-
* Generate the Bug Discovery section (WU-1592, WU-2284)
|
|
1373
|
-
*
|
|
1374
|
-
* Instructs sub-agents to capture bugs found mid-WU via mem:create.
|
|
1375
|
-
* This enables scope-creep tracking and ensures discovered bugs
|
|
1376
|
-
* are not lost when agents encounter issues outside their WU scope.
|
|
1377
|
-
*
|
|
1378
|
-
* WU-2284: Added explicit prohibition against using wu:create directly
|
|
1379
|
-
* for discovered issues. Agents must use mem:create for capture, then
|
|
1380
|
-
* human triage decides whether to promote to a WU.
|
|
1381
|
-
*
|
|
1382
|
-
* @param {string} id - WU ID
|
|
1383
|
-
* @returns {string} Bug Discovery section
|
|
1384
|
-
*/
|
|
1385
|
-
function generateBugDiscoverySection(id) {
|
|
1386
|
-
return `## Bug Discovery (Mid-WU Issue Capture)
|
|
1387
|
-
|
|
1388
|
-
If you discover a bug or issue **outside the scope of this WU**:
|
|
1389
|
-
|
|
1390
|
-
1. **Capture it immediately** using:
|
|
1391
|
-
\`\`\`bash
|
|
1392
|
-
pnpm mem:create 'Bug: <description>' --type discovery --tags bug,scope-creep --wu ${id}
|
|
1393
|
-
\`\`\`
|
|
1394
|
-
|
|
1395
|
-
2. **Continue with your WU** — do not fix bugs outside your scope
|
|
1396
|
-
3. **Reference in notes** — mention the mem node ID in your completion notes
|
|
1397
|
-
|
|
1398
|
-
### NEVER use wu:create for discovered issues
|
|
1399
|
-
|
|
1400
|
-
**Do NOT use \`wu:create\` directly for bugs discovered mid-WU.**
|
|
1401
|
-
|
|
1402
|
-
- \`mem:create\` = **capture** (immediate, no human approval needed)
|
|
1403
|
-
- \`wu:create\` = **planned work** (requires human triage and approval)
|
|
1404
|
-
|
|
1405
|
-
Discovered issues MUST go through human triage before becoming WUs.
|
|
1406
|
-
Using \`wu:create\` directly bypasses the triage workflow and creates
|
|
1407
|
-
unreviewed work items.
|
|
1408
|
-
|
|
1409
|
-
### When to Capture
|
|
1410
|
-
|
|
1411
|
-
- Found a bug in code NOT in your \`code_paths\`
|
|
1412
|
-
- Discovered an issue that would require >10 lines to fix
|
|
1413
|
-
- Encountered broken behaviour unrelated to your acceptance criteria
|
|
1414
|
-
|
|
1415
|
-
### Triage Workflow
|
|
1416
|
-
|
|
1417
|
-
After WU completion, bugs can be promoted to Bug WUs by humans:
|
|
1418
|
-
\`\`\`bash
|
|
1419
|
-
pnpm mem:triage --wu ${id} # List discoveries for this WU
|
|
1420
|
-
pnpm mem:triage --promote <node-id> --lane "<lane>" # Create Bug WU (human action)
|
|
1421
|
-
\`\`\`
|
|
1422
|
-
|
|
1423
|
-
See: https://lumenflow.dev/reference/agent-invocation-guide/ §Bug Discovery`;
|
|
1424
|
-
}
|
|
1425
|
-
/**
|
|
1426
|
-
* Generate lane-specific guidance
|
|
1427
|
-
*
|
|
1428
|
-
* @param {string} lane - Lane name
|
|
1429
|
-
* @returns {string} Lane-specific guidance or empty string
|
|
1430
|
-
*/
|
|
1431
|
-
function generateLaneGuidance(lane) {
|
|
1432
|
-
if (!lane)
|
|
1433
|
-
return '';
|
|
1434
|
-
const laneParent = (lane.split(':')[0] ?? '').trim();
|
|
1435
|
-
const guidance = {
|
|
1436
|
-
Operations: `## Lane-Specific: Tooling
|
|
1437
|
-
|
|
1438
|
-
- Update tool documentation in tools/README.md or relevant docs if adding new CLI commands`,
|
|
1439
|
-
Intelligence: `## Lane-Specific: Intelligence
|
|
1440
|
-
|
|
1441
|
-
- All prompt changes require golden dataset evaluation (pnpm prompts:eval)
|
|
1442
|
-
- Follow prompt versioning guidelines in ai/prompts/README.md`,
|
|
1443
|
-
Experience: `## Lane-Specific: Experience
|
|
1444
|
-
|
|
1445
|
-
- Follow design system tokens defined in the project
|
|
1446
|
-
- Ensure accessibility compliance (WCAG 2.1 AA)`,
|
|
1447
|
-
Core: `## Lane-Specific: Core
|
|
1448
|
-
|
|
1449
|
-
- Maintain hexagonal architecture boundaries
|
|
1450
|
-
- Update domain model documentation if changing entities`,
|
|
1451
|
-
};
|
|
1452
|
-
return guidance[laneParent] || '';
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
* Generate the Action section based on WU claim status (WU-1745).
|
|
1456
|
-
*
|
|
1457
|
-
* If WU is already claimed (has claimed_at and worktree_path), tells agent
|
|
1458
|
-
* to continue in the existing worktree.
|
|
1459
|
-
*
|
|
1460
|
-
* If WU is unclaimed (status: ready), tells agent to run wu:claim first.
|
|
1461
|
-
*
|
|
1462
|
-
* @param {object} doc - WU YAML document
|
|
1463
|
-
* @param {string} id - WU ID
|
|
1464
|
-
* @returns {string} Action section content
|
|
1465
|
-
*/
|
|
1466
|
-
export function generateActionSection(doc, id) {
|
|
1467
|
-
const isAlreadyClaimed = doc.claimed_at && doc.worktree_path;
|
|
1468
|
-
if (isAlreadyClaimed) {
|
|
1469
|
-
return `This WU is already claimed. Continue implementation in worktree following all standards above.
|
|
1470
|
-
|
|
1471
|
-
cd ${doc.worktree_path}`;
|
|
1472
|
-
}
|
|
1473
|
-
// WU is unclaimed - agent needs to claim first
|
|
1474
|
-
const laneSlug = (doc.lane || 'unknown')
|
|
1475
|
-
.toLowerCase()
|
|
1476
|
-
.replace(/[:\s]+/g, '-')
|
|
1477
|
-
.replace(/-+/g, '-');
|
|
1478
|
-
return `**FIRST: Claim this WU before starting work:**
|
|
1479
|
-
|
|
1480
|
-
\`\`\`bash
|
|
1481
|
-
pnpm wu:claim --id ${id} --lane "${doc.lane}"
|
|
1482
|
-
cd worktrees/${laneSlug}-${id.toLowerCase()}
|
|
1483
|
-
\`\`\`
|
|
1484
|
-
|
|
1485
|
-
Then implement following all standards above.
|
|
1486
|
-
|
|
1487
|
-
**CRITICAL:** Never use \`git worktree add\` directly. Always use \`pnpm wu:claim\` to ensure:
|
|
1488
|
-
- Event tracking in ${LUMENFLOW_PATHS.WU_EVENTS}
|
|
1489
|
-
- Lane lock acquisition (WIP=1 enforcement)
|
|
1490
|
-
- Session tracking for context recovery`;
|
|
1491
|
-
}
|
|
1492
|
-
function generateClientBlocksSection(clientContext) {
|
|
1493
|
-
if (!clientContext?.config?.blocks?.length)
|
|
1494
|
-
return '';
|
|
1495
|
-
const blocks = clientContext.config.blocks
|
|
1496
|
-
.map((block) => `### ${block.title}\n\n${block.content}`)
|
|
1497
|
-
.join('\n\n');
|
|
1498
|
-
return `## Client Guidance (${clientContext.name})\n\n${blocks}`;
|
|
1499
|
-
}
|
|
1500
|
-
/**
|
|
1501
|
-
* Generate the complete Task tool invocation
|
|
1502
|
-
*
|
|
1503
|
-
* @param {object} doc - WU YAML document
|
|
1504
|
-
* @param {string} id - WU ID
|
|
1505
|
-
* @param {SpawnStrategy} strategy - Client strategy
|
|
1506
|
-
* @param {object} [options={}] - Thinking mode options
|
|
1507
|
-
* @param {boolean} [options.thinking] - Whether extended thinking is enabled
|
|
1508
|
-
* @param {boolean} [options.noThinking] - Whether thinking is explicitly disabled
|
|
1509
|
-
* @param {string} [options.budget] - Token budget for thinking
|
|
1510
|
-
* @returns {string} Complete Task tool invocation
|
|
1511
|
-
*/
|
|
1512
|
-
export function generateTaskInvocation(doc, id, strategy, options = {}) {
|
|
1513
|
-
const codePaths = doc.code_paths || [];
|
|
1514
|
-
const mandatoryAgents = detectMandatoryAgents(codePaths);
|
|
1515
|
-
const preamble = generatePreamble(id, strategy);
|
|
1516
|
-
const clientContext = options.client;
|
|
1517
|
-
const config = options.config || getConfig();
|
|
1518
|
-
// WU-1279: Resolve policy and use policy-based test guidance
|
|
1519
|
-
const policy = resolvePolicy(config);
|
|
1520
|
-
// WU-1900: Run work classifier for domain-aware prompt generation
|
|
1521
|
-
const classificationConfig = config?.methodology?.work_classification;
|
|
1522
|
-
const classification = classifyWork({
|
|
1523
|
-
code_paths: doc.code_paths,
|
|
1524
|
-
lane: doc.lane,
|
|
1525
|
-
type: doc.type,
|
|
1526
|
-
description: doc.description,
|
|
1527
|
-
}, classificationConfig);
|
|
1528
|
-
// WU-1900: Pass classifier hint to test guidance
|
|
1529
|
-
const testGuidance = generatePolicyBasedTestGuidance(doc.type || 'feature', policy, {
|
|
1530
|
-
testMethodologyHint: classification.testMethodologyHint,
|
|
1531
|
-
});
|
|
1532
|
-
// WU-1279: Generate enforcement summary from resolved policy
|
|
1533
|
-
const enforcementSummary = generateEnforcementSummary(policy);
|
|
1534
|
-
// WU-1279: Generate mandatory standards based on resolved policy
|
|
1535
|
-
const mandatoryStandards = generateMandatoryStandards(policy);
|
|
1536
|
-
const clientSkillsGuidance = generateClientSkillsGuidance(clientContext);
|
|
1537
|
-
const skillsSection = generateSkillsSelectionSection(doc, config, clientContext?.name) +
|
|
1538
|
-
(clientSkillsGuidance ? `\n${clientSkillsGuidance}` : '');
|
|
1539
|
-
const clientBlocks = generateClientBlocksSection(clientContext);
|
|
1540
|
-
const mandatorySection = generateMandatoryAgentSection(mandatoryAgents, id);
|
|
1541
|
-
const laneGuidance = generateLaneGuidance(doc.lane);
|
|
1542
|
-
const bugDiscoverySection = generateBugDiscoverySection(id);
|
|
1543
|
-
// WU-1900: Generate constraints with conditional TDD CHECKPOINT
|
|
1544
|
-
const shouldIncludeTddCheckpoint = classification.domain !== 'ui' && policy.testing !== 'none';
|
|
1545
|
-
const constraints = generateConstraints(id, {
|
|
1546
|
-
includeTddCheckpoint: shouldIncludeTddCheckpoint,
|
|
1547
|
-
});
|
|
1548
|
-
// WU-1900: Generate design context section for UI-classified work
|
|
1549
|
-
const designContextSection = generateDesignContextSection(classification);
|
|
1550
|
-
const implementationContext = generateImplementationContext(doc);
|
|
1551
|
-
// WU-2252: Generate invariants/prior-art section for code_paths
|
|
1552
|
-
const invariantsPriorArt = generateInvariantsPriorArtSection(codePaths);
|
|
1553
|
-
// WU-1986: Anthropic multi-agent best practices sections
|
|
1554
|
-
const effortScaling = generateEffortScalingRules();
|
|
1555
|
-
const parallelToolCalls = generateParallelToolCallGuidance();
|
|
1556
|
-
const searchHeuristics = generateIterativeSearchHeuristics();
|
|
1557
|
-
const tokenBudget = generateTokenBudgetAwareness(id);
|
|
1558
|
-
const completionFormat = generateCompletionFormat(id);
|
|
1559
|
-
// WU-1987: Agent coordination and quick fix sections
|
|
1560
|
-
const agentCoordination = generateAgentCoordinationSection(id);
|
|
1561
|
-
const quickFix = generateQuickFixCommands();
|
|
1562
|
-
// WU-2107: Lane selection guidance
|
|
1563
|
-
const laneSelection = generateLaneSelectionSection();
|
|
1564
|
-
// WU-2362: Worktree path guidance for sub-agents
|
|
1565
|
-
const worktreeGuidance = generateWorktreePathGuidance(doc.worktree_path);
|
|
1566
|
-
// WU-1240: Memory context section
|
|
1567
|
-
// Include if explicitly enabled and not disabled via noContext
|
|
1568
|
-
const shouldIncludeMemoryContext = options.includeMemoryContext && !options.noContext;
|
|
1569
|
-
const memoryContextSection = shouldIncludeMemoryContext ? options.memoryContextContent || '' : '';
|
|
1570
|
-
// Generate thinking mode sections if applicable
|
|
1571
|
-
const executionModeSection = generateExecutionModeSection(options);
|
|
1572
|
-
const thinkToolGuidance = generateThinkToolGuidance(options);
|
|
1573
|
-
// Build optional sections string
|
|
1574
|
-
const thinkingSections = [executionModeSection, thinkToolGuidance]
|
|
1575
|
-
.filter((section) => section.length > 0)
|
|
1576
|
-
.join('\n\n---\n\n');
|
|
1577
|
-
const thinkingBlock = thinkingSections ? `${thinkingSections}\n\n---\n\n` : '';
|
|
1578
|
-
// Build the task prompt
|
|
1579
|
-
// WU-1192: Truncation warning at start, test guidance after </task> per "Lost in the Middle" research
|
|
1580
|
-
const taskPrompt = `${TRUNCATION_WARNING_BANNER}<task>
|
|
1581
|
-
${preamble}
|
|
1582
|
-
</task>
|
|
1583
|
-
|
|
1584
|
-
---
|
|
1585
|
-
|
|
1586
|
-
${testGuidance}
|
|
1587
|
-
|
|
1588
|
-
---
|
|
1589
|
-
|
|
1590
|
-
# ${id}: ${doc.title || 'Untitled'}
|
|
1591
|
-
|
|
1592
|
-
## WU Details
|
|
1593
|
-
|
|
1594
|
-
- **ID:** ${id}
|
|
1595
|
-
- **Lane:** ${doc.lane || 'Unknown'}
|
|
1596
|
-
- **Type:** ${doc.type || 'feature'}
|
|
1597
|
-
- **Status:** ${doc.status || 'unknown'}
|
|
1598
|
-
- **Worktree:** ${doc.worktree_path || `worktrees/<lane>-${id.toLowerCase()}`}
|
|
1599
|
-
|
|
1600
|
-
## Description
|
|
1601
|
-
|
|
1602
|
-
${doc.description || 'No description provided.'}
|
|
1603
|
-
|
|
1604
|
-
## Acceptance Criteria
|
|
1605
|
-
|
|
1606
|
-
${formatAcceptance(doc.acceptance)}
|
|
1607
|
-
|
|
1608
|
-
## Code Paths
|
|
1609
|
-
|
|
1610
|
-
${codePaths.length > 0 ? codePaths.map((p) => `- ${p}`).join('\n') : '- No code paths defined'}
|
|
1611
|
-
${mandatorySection}${invariantsPriorArt ? `---\n\n${invariantsPriorArt}\n\n` : ''}${implementationContext ? `---\n\n${implementationContext}\n\n` : ''}---
|
|
1612
|
-
|
|
1613
|
-
${thinkingBlock}${skillsSection}
|
|
1614
|
-
${memoryContextSection ? `---\n\n${memoryContextSection}\n\n` : ''}---
|
|
1615
|
-
|
|
1616
|
-
${mandatoryStandards}
|
|
1617
|
-
|
|
1618
|
-
---
|
|
1619
|
-
|
|
1620
|
-
${enforcementSummary}
|
|
1621
|
-
|
|
1622
|
-
${designContextSection ? `---\n\n${designContextSection}\n\n` : ''}${clientBlocks ? `---\n\n${clientBlocks}\n\n` : ''}${worktreeGuidance ? `---\n\n${worktreeGuidance}\n\n` : ''}---
|
|
1623
|
-
|
|
1624
|
-
${bugDiscoverySection}
|
|
1625
|
-
|
|
1626
|
-
---
|
|
1627
|
-
|
|
1628
|
-
${effortScaling}
|
|
1629
|
-
|
|
1630
|
-
---
|
|
1631
|
-
|
|
1632
|
-
${parallelToolCalls}
|
|
1633
|
-
|
|
1634
|
-
---
|
|
1635
|
-
|
|
1636
|
-
${searchHeuristics}
|
|
1637
|
-
|
|
1638
|
-
---
|
|
1639
|
-
|
|
1640
|
-
${tokenBudget}
|
|
1641
|
-
|
|
1642
|
-
---
|
|
1643
|
-
|
|
1644
|
-
${completionFormat}
|
|
1645
|
-
|
|
1646
|
-
---
|
|
1647
|
-
|
|
1648
|
-
${agentCoordination}
|
|
1649
|
-
|
|
1650
|
-
---
|
|
1651
|
-
|
|
1652
|
-
${quickFix}
|
|
1653
|
-
|
|
1654
|
-
---
|
|
1655
|
-
|
|
1656
|
-
${laneSelection}
|
|
1657
|
-
|
|
1658
|
-
---
|
|
1659
|
-
|
|
1660
|
-
${laneGuidance}${laneGuidance ? '\n\n---\n\n' : ''}## Action
|
|
1661
|
-
|
|
1662
|
-
${generateActionSection(doc, id)}
|
|
1663
|
-
|
|
1664
|
-
${constraints}`;
|
|
1665
|
-
// Escape special characters for XML output
|
|
1666
|
-
const escapedPrompt = taskPrompt
|
|
1667
|
-
.replace(/&/g, '&')
|
|
1668
|
-
.replace(/</g, '<')
|
|
1669
|
-
.replace(/>/g, '>');
|
|
1670
|
-
// Build the Task tool invocation block using antml format
|
|
1671
|
-
// Using array join to avoid XML parsing issues
|
|
1672
|
-
const openTag = '<' + 'antml:invoke name="Task">';
|
|
1673
|
-
const closeTag = '</' + 'antml:invoke>';
|
|
1674
|
-
const paramOpen = '<' + 'antml:parameter name="';
|
|
1675
|
-
const paramClose = '</' + 'antml:parameter>';
|
|
1676
|
-
const invocation = [
|
|
1677
|
-
'<' + 'antml:function_calls>',
|
|
1678
|
-
openTag,
|
|
1679
|
-
`${paramOpen}subagent_type">general-purpose${paramClose}`,
|
|
1680
|
-
`${paramOpen}description">Execute ${id}${paramClose}`,
|
|
1681
|
-
`${paramOpen}prompt">${escapedPrompt}${paramClose}`,
|
|
1682
|
-
closeTag,
|
|
1683
|
-
'</' + 'antml:function_calls>',
|
|
1684
|
-
].join('\n');
|
|
1685
|
-
return invocation;
|
|
1686
|
-
}
|
|
1687
|
-
export function generateCodexPrompt(doc, id, strategy, options = {}) {
|
|
1688
|
-
const codePaths = doc.code_paths || [];
|
|
1689
|
-
const mandatoryAgents = detectMandatoryAgents(codePaths);
|
|
1690
|
-
const preamble = generatePreamble(id, strategy);
|
|
1691
|
-
const mandatorySection = generateMandatoryAgentSection(mandatoryAgents, id);
|
|
1692
|
-
const laneGuidance = generateLaneGuidance(doc.lane);
|
|
1693
|
-
const bugDiscoverySection = generateBugDiscoverySection(id);
|
|
1694
|
-
const implementationContext = generateImplementationContext(doc);
|
|
1695
|
-
const action = generateActionSection(doc, id);
|
|
1696
|
-
const constraints = generateCodexConstraints(id);
|
|
1697
|
-
const clientContext = options.client;
|
|
1698
|
-
const config = options.config || getConfig();
|
|
1699
|
-
const clientSkillsGuidance = generateClientSkillsGuidance(clientContext);
|
|
1700
|
-
const skillsSection = generateSkillsSelectionSection(doc, config, clientContext?.name) +
|
|
1701
|
-
(clientSkillsGuidance ? `\n${clientSkillsGuidance}` : '');
|
|
1702
|
-
const clientBlocks = generateClientBlocksSection(clientContext);
|
|
1703
|
-
// WU-1290: Resolve policy and use policy-based test guidance (same as generateTaskInvocation)
|
|
1704
|
-
const policy = resolvePolicy(config);
|
|
1705
|
-
const testGuidance = generatePolicyBasedTestGuidance(doc.type || 'feature', policy);
|
|
1706
|
-
// WU-1290: Generate enforcement summary from resolved policy
|
|
1707
|
-
const enforcementSummary = generateEnforcementSummary(policy);
|
|
1708
|
-
// WU-1290: Generate mandatory standards based on resolved policy
|
|
1709
|
-
const mandatoryStandards = generateMandatoryStandards(policy);
|
|
1710
|
-
const executionModeSection = generateExecutionModeSection(options);
|
|
1711
|
-
const thinkToolGuidance = generateThinkToolGuidance(options);
|
|
1712
|
-
const thinkingSections = [executionModeSection, thinkToolGuidance]
|
|
1713
|
-
.filter((section) => section.length > 0)
|
|
1714
|
-
.join('\n\n---\n\n');
|
|
1715
|
-
const thinkingBlock = thinkingSections ? `${thinkingSections}\n\n---\n\n` : '';
|
|
1716
|
-
return `# ${id}: ${doc.title || 'Untitled'}
|
|
1717
|
-
|
|
1718
|
-
${testGuidance}
|
|
1719
|
-
|
|
1720
|
-
---
|
|
1721
|
-
|
|
1722
|
-
## Context
|
|
1723
|
-
|
|
1724
|
-
${preamble}
|
|
1725
|
-
|
|
1726
|
-
---
|
|
1727
|
-
|
|
1728
|
-
## WU Details
|
|
1729
|
-
|
|
1730
|
-
- **ID:** ${id}
|
|
1731
|
-
- **Lane:** ${doc.lane || 'Unknown'}
|
|
1732
|
-
- **Type:** ${doc.type || 'feature'}
|
|
1733
|
-
- **Status:** ${doc.status || 'unknown'}
|
|
1734
|
-
- **Worktree:** ${doc.worktree_path || `worktrees/<lane>-${id.toLowerCase()}`}
|
|
1735
|
-
|
|
1736
|
-
## Description
|
|
1737
|
-
|
|
1738
|
-
${doc.description || 'No description provided.'}
|
|
1739
|
-
|
|
1740
|
-
## Scope (code_paths)
|
|
1741
|
-
|
|
1742
|
-
Only change files within these paths:
|
|
1743
|
-
|
|
1744
|
-
${codePaths.length > 0 ? codePaths.map((p) => `- ${p}`).join('\n') : '- No code paths defined'}
|
|
1745
|
-
|
|
1746
|
-
## Acceptance Criteria
|
|
1747
|
-
|
|
1748
|
-
${formatAcceptance(doc.acceptance)}
|
|
1749
|
-
|
|
1750
|
-
---
|
|
1751
|
-
|
|
1752
|
-
${mandatoryStandards}
|
|
1753
|
-
|
|
1754
|
-
---
|
|
1755
|
-
|
|
1756
|
-
${enforcementSummary}
|
|
1757
|
-
|
|
1758
|
-
---
|
|
1759
|
-
|
|
1760
|
-
${skillsSection}
|
|
1761
|
-
|
|
1762
|
-
---
|
|
1763
|
-
|
|
1764
|
-
## Action
|
|
1765
|
-
|
|
1766
|
-
${action}
|
|
1767
|
-
|
|
1768
|
-
---
|
|
1769
|
-
|
|
1770
|
-
## Verification
|
|
1771
|
-
|
|
1772
|
-
- Run in worktree: \`pnpm gates\`
|
|
1773
|
-
- From shared checkout: \`node packages/@lumenflow/agent/verification ${id}\`
|
|
1774
|
-
|
|
1775
|
-
---
|
|
1776
|
-
|
|
1777
|
-
${mandatorySection}${implementationContext ? `${implementationContext}\n\n---\n\n` : ''}${clientBlocks ? `${clientBlocks}\n\n---\n\n` : ''}${thinkingBlock}${bugDiscoverySection}
|
|
1778
|
-
|
|
1779
|
-
---
|
|
1780
|
-
|
|
1781
|
-
${laneGuidance}${laneGuidance ? '\n\n---\n\n' : ''}${constraints}
|
|
1782
|
-
`;
|
|
1783
|
-
}
|
|
1784
|
-
/**
|
|
1785
|
-
* WU-1603: Check if a lane is currently occupied by another WU
|
|
1786
|
-
*
|
|
1787
|
-
* @param {string} lane - Lane name (e.g., "Operations: Tooling")
|
|
1788
|
-
* @returns {import('./lib/lane-lock.js').LockMetadata|null} Lock metadata if occupied, null otherwise
|
|
1789
|
-
*/
|
|
1790
|
-
export function checkLaneOccupation(lane) {
|
|
1791
|
-
const lockStatus = checkLaneLock(lane);
|
|
1792
|
-
if (lockStatus.locked && lockStatus.metadata) {
|
|
1793
|
-
return lockStatus.metadata;
|
|
1794
|
-
}
|
|
1795
|
-
return null;
|
|
1796
|
-
}
|
|
1797
|
-
/**
|
|
1798
|
-
* WU-1603: Generate a warning message when lane is occupied
|
|
1799
|
-
*
|
|
1800
|
-
* @param {import('./lib/lane-lock.js').LockMetadata} lockMetadata - Lock metadata
|
|
1801
|
-
* @param {string} targetWuId - WU ID being spawned
|
|
1802
|
-
* @param {LaneOccupationWarningOptions} [options={}] - Options
|
|
1803
|
-
* @returns {string} Warning message
|
|
1804
|
-
*/
|
|
1805
|
-
export function generateLaneOccupationWarning(lockMetadata, targetWuId, options = {}) {
|
|
1806
|
-
const { isStale = false } = options;
|
|
1807
|
-
let warning = `⚠️ Lane "${lockMetadata.lane}" is occupied by ${lockMetadata.wuId}\n`;
|
|
1808
|
-
warning += ` This violates WIP=1 (Work In Progress limit of 1 per lane).\n\n`;
|
|
1809
|
-
if (isStale) {
|
|
1810
|
-
warning += ` ⏰ This lock is STALE (>24 hours old) - the WU may be abandoned.\n`;
|
|
1811
|
-
warning += ` Consider using pnpm wu:block --id ${lockMetadata.wuId} if work is stalled.\n\n`;
|
|
1812
|
-
}
|
|
1813
|
-
warning += ` Options:\n`;
|
|
1814
|
-
warning += ` 1. Wait for ${lockMetadata.wuId} to complete or block\n`;
|
|
1815
|
-
warning += ` 2. Choose a different lane for ${targetWuId}\n`;
|
|
1816
|
-
warning += ` 3. Block ${lockMetadata.wuId} if work is stalled: pnpm wu:block --id ${lockMetadata.wuId}`;
|
|
1817
|
-
return warning;
|
|
1818
|
-
}
|
|
1819
|
-
/**
|
|
1820
|
-
* Main entry point
|
|
1821
|
-
*/
|
|
1822
|
-
async function main() {
|
|
1823
|
-
// WU-2202: Validate dependencies BEFORE UnsafeAny other operation
|
|
1824
|
-
// This prevents false lane occupancy reports when yaml package is missing
|
|
1825
|
-
const depResult = await validateSpawnDependencies();
|
|
1826
|
-
if (!depResult.valid) {
|
|
1827
|
-
die(formatDependencyError('wu:spawn', depResult.missing));
|
|
1828
|
-
}
|
|
1829
|
-
const args = createWUParser({
|
|
1830
|
-
name: 'wu-spawn',
|
|
1831
|
-
description: 'Generate Task tool invocation for sub-agent WU execution',
|
|
1832
|
-
options: [
|
|
1833
|
-
WU_OPTIONS.id,
|
|
1834
|
-
WU_OPTIONS.thinking,
|
|
1835
|
-
WU_OPTIONS.noThinking,
|
|
1836
|
-
WU_OPTIONS.budget,
|
|
1837
|
-
WU_OPTIONS.codex,
|
|
1838
|
-
WU_OPTIONS.id,
|
|
1839
|
-
WU_OPTIONS.thinking,
|
|
1840
|
-
WU_OPTIONS.noThinking,
|
|
1841
|
-
WU_OPTIONS.budget,
|
|
1842
|
-
WU_OPTIONS.codex,
|
|
1843
|
-
WU_OPTIONS.parentWu, // WU-1945: Parent WU for spawn registry tracking
|
|
1844
|
-
WU_OPTIONS.client,
|
|
1845
|
-
WU_OPTIONS.vendor,
|
|
1846
|
-
].filter((option) => option !== undefined),
|
|
1847
|
-
required: ['id'],
|
|
1848
|
-
allowPositionalId: true,
|
|
1849
|
-
});
|
|
1850
|
-
// Validate thinking mode options
|
|
1851
|
-
try {
|
|
1852
|
-
validateSpawnArgs(args);
|
|
1853
|
-
}
|
|
1854
|
-
catch (e) {
|
|
1855
|
-
die(getErrorMessage(e));
|
|
1856
|
-
}
|
|
1857
|
-
const id = args.id.toUpperCase();
|
|
1858
|
-
if (!PATTERNS.WU_ID.test(id)) {
|
|
1859
|
-
die(`Invalid WU id '${args.id}'. Expected format WU-123`);
|
|
1860
|
-
}
|
|
1861
|
-
const WU_PATH = WU_PATHS.WU(id);
|
|
1862
|
-
// Check if WU file exists
|
|
1863
|
-
if (!existsSync(WU_PATH)) {
|
|
1864
|
-
die(`WU file not found: ${WU_PATH}\n\n` +
|
|
1865
|
-
`Cannot spawn a sub-agent for a WU that doesn't exist.\n\n` +
|
|
1866
|
-
`Options:\n` +
|
|
1867
|
-
` 1. Create the WU first: pnpm wu:create --id ${id} --lane <lane> --title "..."\n` +
|
|
1868
|
-
` 2. Check if the WU ID is correct`);
|
|
1869
|
-
}
|
|
1870
|
-
// Read and parse WU YAML
|
|
1871
|
-
let doc;
|
|
1872
|
-
let text;
|
|
1873
|
-
try {
|
|
1874
|
-
text = readFileSync(WU_PATH, { encoding: 'utf-8' });
|
|
1875
|
-
}
|
|
1876
|
-
catch (e) {
|
|
1877
|
-
die(`Failed to read WU file: ${WU_PATH}\n\n` +
|
|
1878
|
-
`Error: ${getErrorMessage(e)}\n\n` +
|
|
1879
|
-
`Options:\n` +
|
|
1880
|
-
` 1. Check file permissions: ls -la ${WU_PATH}\n` +
|
|
1881
|
-
` 2. Ensure the file exists and is readable`);
|
|
1882
|
-
}
|
|
1883
|
-
try {
|
|
1884
|
-
doc = parseYAML(text);
|
|
1885
|
-
}
|
|
1886
|
-
catch (e) {
|
|
1887
|
-
die(`Failed to parse WU YAML ${WU_PATH}\n\n` +
|
|
1888
|
-
`Error: ${getErrorMessage(e)}\n\n` +
|
|
1889
|
-
`Options:\n` +
|
|
1890
|
-
` 1. Validate YAML syntax: pnpm wu:validate --id ${id}\n` +
|
|
1891
|
-
` 2. Fix YAML errors manually and retry`);
|
|
1892
|
-
}
|
|
1893
|
-
// Warn if WU is not in ready or in_progress status
|
|
1894
|
-
const validStatuses = [WU_STATUS.READY, WU_STATUS.IN_PROGRESS];
|
|
1895
|
-
if (!validStatuses.includes(doc.status)) {
|
|
1896
|
-
console.warn(`${LOG_PREFIX} ${EMOJI.WARNING} Warning: ${id} has status '${doc.status}'.`);
|
|
1897
|
-
console.warn(`${LOG_PREFIX} ${EMOJI.WARNING} Sub-agents typically work on ready or in_progress WUs.`);
|
|
1898
|
-
console.warn('');
|
|
1899
|
-
}
|
|
1900
|
-
// WU-1603: Check if lane is already occupied and warn
|
|
1901
|
-
const lane = doc.lane;
|
|
1902
|
-
if (lane) {
|
|
1903
|
-
const existingLock = checkLaneOccupation(lane);
|
|
1904
|
-
if (existingLock && existingLock.wuId !== id) {
|
|
1905
|
-
// Lane is occupied by a different WU
|
|
1906
|
-
const { isLockStale } = await import('./lane-lock.js');
|
|
1907
|
-
const isStale = isLockStale(existingLock);
|
|
1908
|
-
const warning = generateLaneOccupationWarning(existingLock, id, { isStale });
|
|
1909
|
-
console.warn(`${LOG_PREFIX} ${EMOJI.WARNING}\n${warning}\n`);
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
// Build thinking mode options for task invocation
|
|
1913
|
-
const thinkingOptions = {
|
|
1914
|
-
thinking: args.thinking,
|
|
1915
|
-
noThinking: args.noThinking,
|
|
1916
|
-
budget: args.budget,
|
|
1917
|
-
};
|
|
1918
|
-
// Client Resolution
|
|
1919
|
-
const config = getConfig();
|
|
1920
|
-
let clientName = args.client;
|
|
1921
|
-
if (!clientName && args.vendor) {
|
|
1922
|
-
console.warn(`${LOG_PREFIX} ${EMOJI.WARNING} Warning: --vendor is deprecated. Use --client.`);
|
|
1923
|
-
clientName = args.vendor;
|
|
1924
|
-
}
|
|
1925
|
-
// Codex handling (deprecated legacy flag)
|
|
1926
|
-
if (args.codex) {
|
|
1927
|
-
if (!clientName) {
|
|
1928
|
-
console.warn(`${LOG_PREFIX} ${EMOJI.WARNING} Warning: --codex is deprecated. Use --client codex-cli.`);
|
|
1929
|
-
clientName = 'codex-cli';
|
|
1930
|
-
}
|
|
1931
|
-
}
|
|
1932
|
-
if (!clientName) {
|
|
1933
|
-
clientName = config.agents.defaultClient || 'claude-code';
|
|
1934
|
-
}
|
|
1935
|
-
// Create strategy
|
|
1936
|
-
const strategy = SpawnStrategyFactory.create(clientName);
|
|
1937
|
-
const clientContext = { name: clientName, config: resolveClientConfig(config, clientName) };
|
|
1938
|
-
if (clientName === 'codex-cli' || args.codex) {
|
|
1939
|
-
const _prompt = generateCodexPrompt(doc, id, strategy, {
|
|
1940
|
-
...thinkingOptions,
|
|
1941
|
-
client: clientContext,
|
|
1942
|
-
config,
|
|
1943
|
-
});
|
|
1944
|
-
console.log(`${LOG_PREFIX} Generated Codex/GPT prompt for ${id}`);
|
|
1945
|
-
console.log(`${LOG_PREFIX} Copy the Markdown below:\n`);
|
|
1946
|
-
// ...
|
|
1947
|
-
// Generate and output the Task invocation
|
|
1948
|
-
const invocation = generateTaskInvocation(doc, id, strategy, {
|
|
1949
|
-
...thinkingOptions,
|
|
1950
|
-
client: clientContext,
|
|
1951
|
-
config,
|
|
1952
|
-
});
|
|
1953
|
-
console.log(`${LOG_PREFIX} Generated Task tool invocation for ${id}`);
|
|
1954
|
-
console.log(`${LOG_PREFIX} Copy the block below to spawn a sub-agent:\n`);
|
|
1955
|
-
console.log(invocation);
|
|
1956
|
-
// WU-1270: Emit methodology telemetry (opt-in only)
|
|
1957
|
-
const policy = resolvePolicy(config);
|
|
1958
|
-
emitMethodologyTelemetry(config, policy);
|
|
1959
|
-
// WU-1945: Record spawn event to registry (non-blocking)
|
|
1960
|
-
// Only record if --parent-wu is provided (orchestrator context)
|
|
1961
|
-
if (args.parentWu) {
|
|
1962
|
-
const registryResult = await recordSpawnToRegistry({
|
|
1963
|
-
parentWuId: args.parentWu,
|
|
1964
|
-
targetWuId: id,
|
|
1965
|
-
lane: doc.lane || 'Unknown',
|
|
1966
|
-
baseDir: LUMENFLOW_PATHS.STATE_DIR,
|
|
1967
|
-
});
|
|
1968
|
-
const registryMessage = formatSpawnRecordedMessage(registryResult.spawnId, registryResult.error);
|
|
1969
|
-
console.log(`\n${registryMessage}`);
|
|
1970
|
-
}
|
|
1971
|
-
}
|
|
1972
|
-
}
|
|
1973
|
-
// Guard main() for testability
|
|
1974
|
-
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
1975
|
-
void main();
|
|
1976
|
-
}
|
|
1977
|
-
//# sourceMappingURL=wu-spawn.js.map
|