popeye-cli 2.1.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/gemini.d.ts +14 -0
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +41 -6
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/grok.d.ts +14 -0
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +42 -6
- package/dist/adapters/grok.js.map +1 -1
- package/dist/adapters/openai.d.ts +10 -0
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +44 -5
- package/dist/adapters/openai.js.map +1 -1
- package/dist/cli/commands/create.js +1 -1
- package/dist/cli/commands/create.js.map +1 -1
- package/dist/cli/interactive.d.ts.map +1 -1
- package/dist/cli/interactive.js +328 -21
- package/dist/cli/interactive.js.map +1 -1
- package/dist/generators/all.d.ts.map +1 -1
- package/dist/generators/all.js +25 -2
- package/dist/generators/all.js.map +1 -1
- package/dist/generators/doc-parser.d.ts +21 -6
- package/dist/generators/doc-parser.d.ts.map +1 -1
- package/dist/generators/doc-parser.js +55 -4
- package/dist/generators/doc-parser.js.map +1 -1
- package/dist/generators/templates/fullstack.js +1 -1
- package/dist/generators/templates/website-components.js +1 -1
- package/dist/generators/templates/website-components.js.map +1 -1
- package/dist/generators/templates/website-config.d.ts +4 -1
- package/dist/generators/templates/website-config.d.ts.map +1 -1
- package/dist/generators/templates/website-config.js +17 -11
- package/dist/generators/templates/website-config.js.map +1 -1
- package/dist/generators/templates/website-conversion.js +1 -1
- package/dist/generators/templates/website-conversion.js.map +1 -1
- package/dist/generators/templates/website-landing.js +1 -1
- package/dist/generators/templates/website-landing.js.map +1 -1
- package/dist/generators/templates/website-layout.d.ts +36 -4
- package/dist/generators/templates/website-layout.d.ts.map +1 -1
- package/dist/generators/templates/website-layout.js +466 -23
- package/dist/generators/templates/website-layout.js.map +1 -1
- package/dist/generators/templates/website-pricing.js +1 -1
- package/dist/generators/templates/website-pricing.js.map +1 -1
- package/dist/generators/templates/website-sections.js +1 -1
- package/dist/generators/templates/website-sections.js.map +1 -1
- package/dist/generators/templates/website-seo.d.ts.map +1 -1
- package/dist/generators/templates/website-seo.js +4 -1
- package/dist/generators/templates/website-seo.js.map +1 -1
- package/dist/generators/templates/website.d.ts +1 -1
- package/dist/generators/templates/website.d.ts.map +1 -1
- package/dist/generators/templates/website.js +1 -1
- package/dist/generators/templates/website.js.map +1 -1
- package/dist/generators/website-content-ai.d.ts +52 -0
- package/dist/generators/website-content-ai.d.ts.map +1 -0
- package/dist/generators/website-content-ai.js +141 -0
- package/dist/generators/website-content-ai.js.map +1 -0
- package/dist/generators/website-content-scanner.d.ts +1 -1
- package/dist/generators/website-content-scanner.d.ts.map +1 -1
- package/dist/generators/website-content-scanner.js +98 -1
- package/dist/generators/website-content-scanner.js.map +1 -1
- package/dist/generators/website-context.d.ts +34 -1
- package/dist/generators/website-context.d.ts.map +1 -1
- package/dist/generators/website-context.js +131 -9
- package/dist/generators/website-context.js.map +1 -1
- package/dist/generators/website-debug.d.ts +12 -0
- package/dist/generators/website-debug.d.ts.map +1 -1
- package/dist/generators/website-debug.js +16 -0
- package/dist/generators/website-debug.js.map +1 -1
- package/dist/generators/website.d.ts.map +1 -1
- package/dist/generators/website.js +26 -4
- package/dist/generators/website.js.map +1 -1
- package/dist/pipeline/artifact-manager.d.ts.map +1 -1
- package/dist/pipeline/artifact-manager.js +3 -0
- package/dist/pipeline/artifact-manager.js.map +1 -1
- package/dist/pipeline/auto-recovery.d.ts +56 -0
- package/dist/pipeline/auto-recovery.d.ts.map +1 -0
- package/dist/pipeline/auto-recovery.js +185 -0
- package/dist/pipeline/auto-recovery.js.map +1 -0
- package/dist/pipeline/change-request.d.ts +39 -0
- package/dist/pipeline/change-request.d.ts.map +1 -1
- package/dist/pipeline/change-request.js +40 -1
- package/dist/pipeline/change-request.js.map +1 -1
- package/dist/pipeline/check-runner.d.ts +30 -1
- package/dist/pipeline/check-runner.d.ts.map +1 -1
- package/dist/pipeline/check-runner.js +122 -1
- package/dist/pipeline/check-runner.js.map +1 -1
- package/dist/pipeline/command-resolver.d.ts.map +1 -1
- package/dist/pipeline/command-resolver.js +33 -2
- package/dist/pipeline/command-resolver.js.map +1 -1
- package/dist/pipeline/consensus/arbitrator-query.d.ts +22 -0
- package/dist/pipeline/consensus/arbitrator-query.d.ts.map +1 -0
- package/dist/pipeline/consensus/arbitrator-query.js +70 -0
- package/dist/pipeline/consensus/arbitrator-query.js.map +1 -0
- package/dist/pipeline/consensus/consensus-runner.d.ts +131 -7
- package/dist/pipeline/consensus/consensus-runner.d.ts.map +1 -1
- package/dist/pipeline/consensus/consensus-runner.js +809 -35
- package/dist/pipeline/consensus/consensus-runner.js.map +1 -1
- package/dist/pipeline/cr-lifecycle.d.ts +42 -0
- package/dist/pipeline/cr-lifecycle.d.ts.map +1 -0
- package/dist/pipeline/cr-lifecycle.js +89 -0
- package/dist/pipeline/cr-lifecycle.js.map +1 -0
- package/dist/pipeline/gate-engine.d.ts +1 -0
- package/dist/pipeline/gate-engine.d.ts.map +1 -1
- package/dist/pipeline/gate-engine.js +27 -8
- package/dist/pipeline/gate-engine.js.map +1 -1
- package/dist/pipeline/migration.d.ts.map +1 -1
- package/dist/pipeline/migration.js +3 -26
- package/dist/pipeline/migration.js.map +1 -1
- package/dist/pipeline/orchestrator.d.ts +1 -1
- package/dist/pipeline/orchestrator.d.ts.map +1 -1
- package/dist/pipeline/orchestrator.js +311 -16
- package/dist/pipeline/orchestrator.js.map +1 -1
- package/dist/pipeline/packets/consensus-packet-builder.d.ts +15 -4
- package/dist/pipeline/packets/consensus-packet-builder.d.ts.map +1 -1
- package/dist/pipeline/packets/consensus-packet-builder.js +29 -17
- package/dist/pipeline/packets/consensus-packet-builder.js.map +1 -1
- package/dist/pipeline/phases/architecture.d.ts.map +1 -1
- package/dist/pipeline/phases/architecture.js +5 -3
- package/dist/pipeline/phases/architecture.js.map +1 -1
- package/dist/pipeline/phases/audit.d.ts.map +1 -1
- package/dist/pipeline/phases/audit.js +5 -3
- package/dist/pipeline/phases/audit.js.map +1 -1
- package/dist/pipeline/phases/consensus-architecture.d.ts.map +1 -1
- package/dist/pipeline/phases/consensus-architecture.js +10 -1
- package/dist/pipeline/phases/consensus-architecture.js.map +1 -1
- package/dist/pipeline/phases/consensus-master-plan.d.ts.map +1 -1
- package/dist/pipeline/phases/consensus-master-plan.js +10 -3
- package/dist/pipeline/phases/consensus-master-plan.js.map +1 -1
- package/dist/pipeline/phases/consensus-role-plans.d.ts.map +1 -1
- package/dist/pipeline/phases/consensus-role-plans.js +10 -1
- package/dist/pipeline/phases/consensus-role-plans.js.map +1 -1
- package/dist/pipeline/phases/done.d.ts.map +1 -1
- package/dist/pipeline/phases/done.js +9 -4
- package/dist/pipeline/phases/done.js.map +1 -1
- package/dist/pipeline/phases/intake.d.ts +1 -0
- package/dist/pipeline/phases/intake.d.ts.map +1 -1
- package/dist/pipeline/phases/intake.js +56 -13
- package/dist/pipeline/phases/intake.js.map +1 -1
- package/dist/pipeline/phases/phase-context.d.ts +2 -0
- package/dist/pipeline/phases/phase-context.d.ts.map +1 -1
- package/dist/pipeline/phases/phase-context.js +3 -1
- package/dist/pipeline/phases/phase-context.js.map +1 -1
- package/dist/pipeline/phases/production-gate.d.ts.map +1 -1
- package/dist/pipeline/phases/production-gate.js +28 -3
- package/dist/pipeline/phases/production-gate.js.map +1 -1
- package/dist/pipeline/phases/qa-validation.d.ts.map +1 -1
- package/dist/pipeline/phases/qa-validation.js +38 -5
- package/dist/pipeline/phases/qa-validation.js.map +1 -1
- package/dist/pipeline/phases/recovery-loop.d.ts +2 -0
- package/dist/pipeline/phases/recovery-loop.d.ts.map +1 -1
- package/dist/pipeline/phases/recovery-loop.js +200 -6
- package/dist/pipeline/phases/recovery-loop.js.map +1 -1
- package/dist/pipeline/phases/review.d.ts.map +1 -1
- package/dist/pipeline/phases/review.js +58 -28
- package/dist/pipeline/phases/review.js.map +1 -1
- package/dist/pipeline/phases/role-planning.d.ts.map +1 -1
- package/dist/pipeline/phases/role-planning.js +20 -5
- package/dist/pipeline/phases/role-planning.js.map +1 -1
- package/dist/pipeline/phases/stuck.d.ts.map +1 -1
- package/dist/pipeline/phases/stuck.js +10 -0
- package/dist/pipeline/phases/stuck.js.map +1 -1
- package/dist/pipeline/repo-snapshot.d.ts.map +1 -1
- package/dist/pipeline/repo-snapshot.js +3 -0
- package/dist/pipeline/repo-snapshot.js.map +1 -1
- package/dist/pipeline/role-execution-adapter.d.ts +2 -1
- package/dist/pipeline/role-execution-adapter.d.ts.map +1 -1
- package/dist/pipeline/role-execution-adapter.js +22 -7
- package/dist/pipeline/role-execution-adapter.js.map +1 -1
- package/dist/pipeline/skill-loader.d.ts +19 -0
- package/dist/pipeline/skill-loader.d.ts.map +1 -1
- package/dist/pipeline/skill-loader.js +22 -0
- package/dist/pipeline/skill-loader.js.map +1 -1
- package/dist/pipeline/skills/constitution-generator.d.ts +51 -0
- package/dist/pipeline/skills/constitution-generator.d.ts.map +1 -0
- package/dist/pipeline/skills/constitution-generator.js +210 -0
- package/dist/pipeline/skills/constitution-generator.js.map +1 -0
- package/dist/pipeline/skills/coverage-gate.d.ts +44 -0
- package/dist/pipeline/skills/coverage-gate.d.ts.map +1 -0
- package/dist/pipeline/skills/coverage-gate.js +143 -0
- package/dist/pipeline/skills/coverage-gate.js.map +1 -0
- package/dist/pipeline/skills/generator.d.ts +65 -0
- package/dist/pipeline/skills/generator.d.ts.map +1 -0
- package/dist/pipeline/skills/generator.js +221 -0
- package/dist/pipeline/skills/generator.js.map +1 -0
- package/dist/pipeline/skills/role-map.d.ts +38 -0
- package/dist/pipeline/skills/role-map.d.ts.map +1 -0
- package/dist/pipeline/skills/role-map.js +234 -0
- package/dist/pipeline/skills/role-map.js.map +1 -0
- package/dist/pipeline/skills/types.d.ts +47 -0
- package/dist/pipeline/skills/types.d.ts.map +1 -0
- package/dist/pipeline/skills/types.js +5 -0
- package/dist/pipeline/skills/types.js.map +1 -0
- package/dist/pipeline/skills/usage-registry.d.ts +48 -0
- package/dist/pipeline/skills/usage-registry.d.ts.map +1 -0
- package/dist/pipeline/skills/usage-registry.js +55 -0
- package/dist/pipeline/skills/usage-registry.js.map +1 -0
- package/dist/pipeline/strategy-context.d.ts +20 -0
- package/dist/pipeline/strategy-context.d.ts.map +1 -0
- package/dist/pipeline/strategy-context.js +55 -0
- package/dist/pipeline/strategy-context.js.map +1 -0
- package/dist/pipeline/type-defs/artifacts.d.ts +30 -5
- package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -1
- package/dist/pipeline/type-defs/artifacts.js +5 -0
- package/dist/pipeline/type-defs/artifacts.js.map +1 -1
- package/dist/pipeline/type-defs/audit.d.ts +28 -13
- package/dist/pipeline/type-defs/audit.d.ts.map +1 -1
- package/dist/pipeline/type-defs/checks.d.ts +19 -8
- package/dist/pipeline/type-defs/checks.d.ts.map +1 -1
- package/dist/pipeline/type-defs/checks.js +4 -0
- package/dist/pipeline/type-defs/checks.js.map +1 -1
- package/dist/pipeline/type-defs/packets.d.ts +119 -18
- package/dist/pipeline/type-defs/packets.d.ts.map +1 -1
- package/dist/pipeline/type-defs/packets.js +17 -1
- package/dist/pipeline/type-defs/packets.js.map +1 -1
- package/dist/pipeline/type-defs/state.d.ts +165 -16
- package/dist/pipeline/type-defs/state.d.ts.map +1 -1
- package/dist/pipeline/type-defs/state.js +26 -1
- package/dist/pipeline/type-defs/state.js.map +1 -1
- package/dist/shared/text-utils.d.ts +23 -0
- package/dist/shared/text-utils.d.ts.map +1 -0
- package/dist/shared/text-utils.js +66 -0
- package/dist/shared/text-utils.js.map +1 -0
- package/dist/shared/website-strategy-format.d.ts +18 -0
- package/dist/shared/website-strategy-format.d.ts.map +1 -0
- package/dist/shared/website-strategy-format.js +47 -0
- package/dist/shared/website-strategy-format.js.map +1 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/state/index.d.ts.map +1 -1
- package/dist/state/index.js +57 -8
- package/dist/state/index.js.map +1 -1
- package/dist/types/consensus.d.ts +1 -0
- package/dist/types/consensus.d.ts.map +1 -1
- package/dist/types/consensus.js.map +1 -1
- package/dist/types/website-strategy.d.ts +1 -1
- package/dist/types/workflow.d.ts +447 -0
- package/dist/types/workflow.d.ts.map +1 -1
- package/dist/types/workflow.js +3 -0
- package/dist/types/workflow.js.map +1 -1
- package/dist/upgrade/handlers.d.ts.map +1 -1
- package/dist/upgrade/handlers.js +6 -3
- package/dist/upgrade/handlers.js.map +1 -1
- package/dist/workflow/consensus.d.ts.map +1 -1
- package/dist/workflow/consensus.js +1 -0
- package/dist/workflow/consensus.js.map +1 -1
- package/dist/workflow/website-strategy.d.ts.map +1 -1
- package/dist/workflow/website-strategy.js +2 -29
- package/dist/workflow/website-strategy.js.map +1 -1
- package/dist/workflow/website-updater.d.ts.map +1 -1
- package/dist/workflow/website-updater.js +3 -2
- package/dist/workflow/website-updater.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/gemini.ts +51 -6
- package/src/adapters/grok.ts +51 -6
- package/src/adapters/openai.ts +53 -5
- package/src/cli/commands/create.ts +1 -1
- package/src/cli/interactive.ts +337 -20
- package/src/generators/all.ts +25 -2
- package/src/generators/doc-parser.ts +75 -15
- package/src/generators/templates/fullstack.ts +1 -1
- package/src/generators/templates/website-components.ts +1 -1
- package/src/generators/templates/website-config.ts +23 -11
- package/src/generators/templates/website-conversion.ts +1 -1
- package/src/generators/templates/website-landing.ts +1 -1
- package/src/generators/templates/website-layout.ts +491 -23
- package/src/generators/templates/website-pricing.ts +1 -1
- package/src/generators/templates/website-sections.ts +1 -1
- package/src/generators/templates/website-seo.ts +4 -1
- package/src/generators/templates/website.ts +3 -0
- package/src/generators/website-content-ai.ts +186 -0
- package/src/generators/website-content-scanner.ts +113 -1
- package/src/generators/website-context.ts +151 -12
- package/src/generators/website-debug.ts +26 -0
- package/src/generators/website.ts +28 -3
- package/src/pipeline/artifact-manager.ts +3 -0
- package/src/pipeline/auto-recovery.ts +283 -0
- package/src/pipeline/change-request.ts +63 -1
- package/src/pipeline/check-runner.ts +141 -2
- package/src/pipeline/command-resolver.ts +34 -2
- package/src/pipeline/consensus/arbitrator-query.ts +101 -0
- package/src/pipeline/consensus/consensus-runner.ts +1099 -42
- package/src/pipeline/cr-lifecycle.ts +103 -0
- package/src/pipeline/gate-engine.ts +36 -8
- package/src/pipeline/migration.ts +5 -30
- package/src/pipeline/orchestrator.ts +367 -16
- package/src/pipeline/packets/consensus-packet-builder.ts +44 -18
- package/src/pipeline/phases/architecture.ts +6 -3
- package/src/pipeline/phases/audit.ts +6 -3
- package/src/pipeline/phases/consensus-architecture.ts +10 -1
- package/src/pipeline/phases/consensus-master-plan.ts +10 -3
- package/src/pipeline/phases/consensus-role-plans.ts +10 -1
- package/src/pipeline/phases/done.ts +15 -4
- package/src/pipeline/phases/intake.ts +67 -14
- package/src/pipeline/phases/phase-context.ts +6 -1
- package/src/pipeline/phases/production-gate.ts +41 -3
- package/src/pipeline/phases/qa-validation.ts +51 -5
- package/src/pipeline/phases/recovery-loop.ts +229 -7
- package/src/pipeline/phases/review.ts +73 -30
- package/src/pipeline/phases/role-planning.ts +23 -5
- package/src/pipeline/phases/stuck.ts +10 -0
- package/src/pipeline/repo-snapshot.ts +3 -0
- package/src/pipeline/role-execution-adapter.ts +30 -4
- package/src/pipeline/skill-loader.ts +33 -0
- package/src/pipeline/skills/constitution-generator.ts +236 -0
- package/src/pipeline/skills/coverage-gate.ts +199 -0
- package/src/pipeline/skills/generator.ts +287 -0
- package/src/pipeline/skills/role-map.ts +248 -0
- package/src/pipeline/skills/types.ts +53 -0
- package/src/pipeline/skills/usage-registry.ts +87 -0
- package/src/pipeline/strategy-context.ts +60 -0
- package/src/pipeline/type-defs/artifacts.ts +5 -0
- package/src/pipeline/type-defs/checks.ts +4 -0
- package/src/pipeline/type-defs/packets.ts +18 -1
- package/src/pipeline/type-defs/state.ts +26 -1
- package/src/shared/text-utils.ts +70 -0
- package/src/shared/website-strategy-format.ts +56 -0
- package/src/state/index.ts +60 -8
- package/src/types/consensus.ts +1 -0
- package/src/types/workflow.ts +6 -0
- package/src/upgrade/handlers.ts +9 -3
- package/src/workflow/consensus.ts +1 -0
- package/src/workflow/website-strategy.ts +2 -36
- package/src/workflow/website-updater.ts +4 -2
- package/tests/adapters/gemini.test.ts +165 -0
- package/tests/adapters/grok.test.ts +137 -0
- package/tests/adapters/openai.test.ts +128 -0
- package/tests/generators/doc-parser.test.ts +88 -9
- package/tests/generators/quality-gate.test.ts +19 -3
- package/tests/generators/website-components.test.ts +34 -0
- package/tests/generators/website-content-ai.test.ts +308 -0
- package/tests/generators/website-content-scanner.test.ts +86 -0
- package/tests/generators/website-context.test.ts +3 -2
- package/tests/integration/smokestack-scaffold.test.ts +385 -0
- package/tests/pipeline/auto-recovery.test.ts +337 -0
- package/tests/pipeline/change-request.test.ts +70 -0
- package/tests/pipeline/command-resolver.test.ts +42 -0
- package/tests/pipeline/consensus/arbitrator-query.test.ts +107 -0
- package/tests/pipeline/consensus-runner.test.ts +1333 -10
- package/tests/pipeline/consensus-scoring.test.ts +602 -18
- package/tests/pipeline/gate-engine.test.ts +34 -0
- package/tests/pipeline/install-check.test.ts +261 -0
- package/tests/pipeline/migration.test.ts +4 -3
- package/tests/pipeline/orchestrator.test.ts +1506 -15
- package/tests/pipeline/packets/builders.test.ts +29 -6
- package/tests/pipeline/phases/role-planning.strategy.test.ts +204 -0
- package/tests/pipeline/pipeline-persistence.test.ts +230 -0
- package/tests/pipeline/recovery-loop-guidance.test.ts +280 -0
- package/tests/pipeline/role-execution-adapter.test.ts +88 -0
- package/tests/pipeline/skills/constitution-generator.test.ts +201 -0
- package/tests/pipeline/skills/coverage-gate.test.ts +370 -0
- package/tests/pipeline/skills/generator.test.ts +213 -0
- package/tests/pipeline/skills/role-map.test.ts +198 -0
- package/tests/pipeline/skills/usage-registry.test.ts +114 -0
- package/tests/pipeline/strategy-context.test.ts +148 -0
- package/tests/shared/text-utils.test.ts +155 -0
- package/tests/state/progress-analysis.test.ts +375 -0
- package/tests/upgrade/handlers.test.ts +33 -2
- package/tests/workflow/consensus.test.ts +6 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CR Lifecycle helpers — resolution after QA pass, stagnation detection.
|
|
3
|
+
* Extracted from orchestrator to keep it under 500 lines.
|
|
4
|
+
* v2.4.9
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createHash } from 'node:crypto';
|
|
8
|
+
import type { PipelineState } from './types.js';
|
|
9
|
+
|
|
10
|
+
/** Number of identical loop signatures before declaring stagnation */
|
|
11
|
+
export const STAGNATION_THRESHOLD = 3;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the active CR after its routed phase (e.g. QA_VALIDATION) passes.
|
|
15
|
+
* Sets CR status to 'resolved', clears activeChangeRequestId.
|
|
16
|
+
* For config CRs: sets baselineSnapshotOverride to accept the drift.
|
|
17
|
+
*
|
|
18
|
+
* Args:
|
|
19
|
+
* pipeline: The current pipeline state (mutated in place).
|
|
20
|
+
* onProgress: Optional progress callback for logging.
|
|
21
|
+
*/
|
|
22
|
+
export function resolveActiveCR(
|
|
23
|
+
pipeline: PipelineState,
|
|
24
|
+
onProgress?: (message: string) => void,
|
|
25
|
+
): void {
|
|
26
|
+
const activeCRId = pipeline.activeChangeRequestId;
|
|
27
|
+
if (!activeCRId) return;
|
|
28
|
+
|
|
29
|
+
const pending = pipeline.pendingChangeRequests;
|
|
30
|
+
if (!pending) return;
|
|
31
|
+
|
|
32
|
+
const cr = pending.find((c) => c.cr_id === activeCRId);
|
|
33
|
+
if (!cr) return;
|
|
34
|
+
|
|
35
|
+
cr.status = 'resolved';
|
|
36
|
+
pipeline.activeChangeRequestId = undefined;
|
|
37
|
+
|
|
38
|
+
// Advance baseline to accept the resolved drift (all CR types).
|
|
39
|
+
// Reason: prevents REVIEW from re-detecting the same drift on the next pass.
|
|
40
|
+
if (pipeline.latestRepoSnapshot) {
|
|
41
|
+
pipeline.baselineSnapshotOverride = { ...pipeline.latestRepoSnapshot };
|
|
42
|
+
onProgress?.(`CR ${cr.cr_id} resolved (${cr.change_type}) — baseline advanced to latest snapshot`);
|
|
43
|
+
} else {
|
|
44
|
+
onProgress?.(`CR ${cr.cr_id} resolved (${cr.change_type})`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Compute a loop signature for stagnation detection.
|
|
50
|
+
* Captures the essential state that should change between iterations.
|
|
51
|
+
*
|
|
52
|
+
* Args:
|
|
53
|
+
* pipeline: The current pipeline state.
|
|
54
|
+
*
|
|
55
|
+
* Returns:
|
|
56
|
+
* A 16-char hex string fingerprinting the current loop state.
|
|
57
|
+
*/
|
|
58
|
+
export function computeLoopSignature(pipeline: PipelineState): string {
|
|
59
|
+
// Reason: Use boolean (not count) so signature stays stable even as CRs accumulate
|
|
60
|
+
const hasPendingActive = pipeline.pendingChangeRequests
|
|
61
|
+
?.some((cr) => cr.status === 'proposed' || cr.status === 'approved') ?? false;
|
|
62
|
+
|
|
63
|
+
const input = [
|
|
64
|
+
pipeline.pipelinePhase,
|
|
65
|
+
pipeline.baselineSnapshotOverride?.artifact_id ?? 'none',
|
|
66
|
+
pipeline.latestRepoSnapshot?.artifact_id ?? 'none',
|
|
67
|
+
hasPendingActive ? 'pending' : 'clear',
|
|
68
|
+
pipeline.activeChangeRequestId ? 'active' : 'none',
|
|
69
|
+
].join('|');
|
|
70
|
+
|
|
71
|
+
return createHash('sha256').update(input).digest('hex').slice(0, 16);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Check for stagnation and update the rolling signature window.
|
|
76
|
+
* Returns true if stagnation is detected (pipeline should transition to STUCK).
|
|
77
|
+
*
|
|
78
|
+
* Args:
|
|
79
|
+
* pipeline: The current pipeline state (mutated: lastSignatures updated).
|
|
80
|
+
* onProgress: Optional progress callback for logging.
|
|
81
|
+
*
|
|
82
|
+
* Returns:
|
|
83
|
+
* true if the same loop signature repeated STAGNATION_THRESHOLD times.
|
|
84
|
+
*/
|
|
85
|
+
export function checkStagnation(
|
|
86
|
+
pipeline: PipelineState,
|
|
87
|
+
onProgress?: (message: string) => void,
|
|
88
|
+
): boolean {
|
|
89
|
+
const loopSig = computeLoopSignature(pipeline);
|
|
90
|
+
if (!pipeline.lastSignatures) pipeline.lastSignatures = [];
|
|
91
|
+
pipeline.lastSignatures.push(loopSig);
|
|
92
|
+
if (pipeline.lastSignatures.length > STAGNATION_THRESHOLD) {
|
|
93
|
+
pipeline.lastSignatures = pipeline.lastSignatures.slice(-STAGNATION_THRESHOLD);
|
|
94
|
+
}
|
|
95
|
+
if (
|
|
96
|
+
pipeline.lastSignatures.length === STAGNATION_THRESHOLD &&
|
|
97
|
+
pipeline.lastSignatures.every((s) => s === pipeline.lastSignatures![0])
|
|
98
|
+
) {
|
|
99
|
+
onProgress?.(`Stagnation detected: identical loop signature ${loopSig} repeated ${STAGNATION_THRESHOLD} times`);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* All 14 phases with specific required artifacts and checks per phase.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import logging from 'node:console';
|
|
8
|
+
|
|
7
9
|
import type {
|
|
8
10
|
PipelinePhase,
|
|
9
11
|
PipelineState,
|
|
@@ -32,6 +34,7 @@ export interface GateResult {
|
|
|
32
34
|
missingArtifacts: ArtifactType[];
|
|
33
35
|
failedChecks: GateCheckType[];
|
|
34
36
|
consensusScore?: number;
|
|
37
|
+
finalStatus?: string; // v2.4.3: 'APPROVED' | 'REJECTED' | 'ARBITRATED'
|
|
35
38
|
timestamp: string;
|
|
36
39
|
}
|
|
37
40
|
|
|
@@ -40,14 +43,14 @@ export interface GateResult {
|
|
|
40
43
|
const GATE_DEFINITIONS: Record<PipelinePhase, GateDefinition> = {
|
|
41
44
|
INTAKE: {
|
|
42
45
|
phase: 'INTAKE',
|
|
43
|
-
requiredArtifacts: ['master_plan', 'repo_snapshot'
|
|
46
|
+
requiredArtifacts: ['master_plan', 'repo_snapshot'],
|
|
44
47
|
requiredChecks: [],
|
|
45
48
|
allowedTransitions: ['CONSENSUS_MASTER_PLAN'],
|
|
46
49
|
failTransition: 'RECOVERY_LOOP',
|
|
47
50
|
},
|
|
48
51
|
CONSENSUS_MASTER_PLAN: {
|
|
49
52
|
phase: 'CONSENSUS_MASTER_PLAN',
|
|
50
|
-
requiredArtifacts: ['
|
|
53
|
+
requiredArtifacts: ['consensus'],
|
|
51
54
|
requiredChecks: [],
|
|
52
55
|
consensusThreshold: 0.95,
|
|
53
56
|
minReviewers: 2,
|
|
@@ -63,7 +66,7 @@ const GATE_DEFINITIONS: Record<PipelinePhase, GateDefinition> = {
|
|
|
63
66
|
},
|
|
64
67
|
CONSENSUS_ARCHITECTURE: {
|
|
65
68
|
phase: 'CONSENSUS_ARCHITECTURE',
|
|
66
|
-
requiredArtifacts: ['
|
|
69
|
+
requiredArtifacts: ['consensus'],
|
|
67
70
|
requiredChecks: [],
|
|
68
71
|
consensusThreshold: 0.95,
|
|
69
72
|
minReviewers: 2,
|
|
@@ -79,8 +82,8 @@ const GATE_DEFINITIONS: Record<PipelinePhase, GateDefinition> = {
|
|
|
79
82
|
},
|
|
80
83
|
CONSENSUS_ROLE_PLANS: {
|
|
81
84
|
phase: 'CONSENSUS_ROLE_PLANS',
|
|
82
|
-
requiredArtifacts: ['
|
|
83
|
-
requiredChecks: [],
|
|
85
|
+
requiredArtifacts: ['consensus'],
|
|
86
|
+
requiredChecks: ['skill_coverage'],
|
|
84
87
|
consensusThreshold: 0.95,
|
|
85
88
|
minReviewers: 2,
|
|
86
89
|
allowedTransitions: ['IMPLEMENTATION'],
|
|
@@ -117,7 +120,7 @@ const GATE_DEFINITIONS: Record<PipelinePhase, GateDefinition> = {
|
|
|
117
120
|
PRODUCTION_GATE: {
|
|
118
121
|
phase: 'PRODUCTION_GATE',
|
|
119
122
|
requiredArtifacts: ['production_readiness'],
|
|
120
|
-
requiredChecks: ['build', 'test', 'lint', 'typecheck'],
|
|
123
|
+
requiredChecks: ['build', 'test', 'lint', 'typecheck', 'skill_coverage'],
|
|
121
124
|
allowedTransitions: ['DONE'],
|
|
122
125
|
failTransition: 'RECOVERY_LOOP',
|
|
123
126
|
},
|
|
@@ -210,7 +213,8 @@ export class GateEngine {
|
|
|
210
213
|
// Check required check results
|
|
211
214
|
const phaseChecks = pipeline.gateChecks[phase] ?? [];
|
|
212
215
|
for (const requiredCheck of gateDef.requiredChecks) {
|
|
213
|
-
|
|
216
|
+
// v2.4.6: Use last check result (not first) — old failed results accumulate on retry
|
|
217
|
+
const checkResult = phaseChecks.findLast((c) => c.check_type === requiredCheck);
|
|
214
218
|
if (!checkResult) {
|
|
215
219
|
failedChecks.push(requiredCheck);
|
|
216
220
|
blockers.push(`Missing check result: ${requiredCheck}`);
|
|
@@ -226,7 +230,18 @@ export class GateEngine {
|
|
|
226
230
|
const consensusArtifact = findLatestConsensusForPhase(pipeline, phase);
|
|
227
231
|
if (consensusArtifact) {
|
|
228
232
|
consensusScore = parseConsensusScore(pipeline, phase);
|
|
229
|
-
|
|
233
|
+
|
|
234
|
+
// v2.4.3: Read finalStatus from phase handler's gateResult
|
|
235
|
+
const finalStatus = parseConsensusFinalStatus(pipeline, phase);
|
|
236
|
+
const isArbitrated = finalStatus === 'ARBITRATED';
|
|
237
|
+
|
|
238
|
+
if (isArbitrated) {
|
|
239
|
+
// Arbitration approved — skip threshold check
|
|
240
|
+
logging.log(
|
|
241
|
+
`[gate] Phase ${phase}: ARBITRATED overrides score check ` +
|
|
242
|
+
`(score=${consensusScore?.toFixed(2)}, threshold=${gateDef.consensusThreshold})`,
|
|
243
|
+
);
|
|
244
|
+
} else if (consensusScore !== undefined && consensusScore < gateDef.consensusThreshold) {
|
|
230
245
|
blockers.push(
|
|
231
246
|
`Consensus score ${consensusScore.toFixed(2)} below threshold ${gateDef.consensusThreshold}`,
|
|
232
247
|
);
|
|
@@ -345,3 +360,16 @@ function parseConsensusScore(
|
|
|
345
360
|
|
|
346
361
|
return undefined;
|
|
347
362
|
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Read finalStatus from phase handler's stored gate result.
|
|
366
|
+
* v2.4.3: Enables gate engine to respect ARBITRATED status
|
|
367
|
+
* set by consensus phase handlers.
|
|
368
|
+
*/
|
|
369
|
+
function parseConsensusFinalStatus(
|
|
370
|
+
pipeline: PipelineState,
|
|
371
|
+
phase: PipelinePhase,
|
|
372
|
+
): string | undefined {
|
|
373
|
+
const gateResult = pipeline.gateResults[phase];
|
|
374
|
+
return gateResult?.finalStatus;
|
|
375
|
+
}
|
|
@@ -3,9 +3,11 @@
|
|
|
3
3
|
* Auto-triggered on load when pipelinePhase is missing from state.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { PipelinePhase, PipelineState
|
|
6
|
+
import type { PipelinePhase, PipelineState } from './types.js';
|
|
7
7
|
import { createDefaultPipelineState } from './types.js';
|
|
8
8
|
import type { ProjectState, WorkflowPhase } from '../types/workflow.js';
|
|
9
|
+
import { getActiveRoles } from './skills/role-map.js';
|
|
10
|
+
import type { OutputLanguage } from '../types/project.js';
|
|
9
11
|
|
|
10
12
|
// ─── Phase Mapping ───────────────────────────────────────
|
|
11
13
|
|
|
@@ -52,8 +54,8 @@ export function migrateToPipelineState(state: ProjectState): PipelineState {
|
|
|
52
54
|
// Map legacy phase
|
|
53
55
|
pipeline.pipelinePhase = toPipelinePhase(state.phase);
|
|
54
56
|
|
|
55
|
-
// Derive active roles from language
|
|
56
|
-
pipeline.activeRoles =
|
|
57
|
+
// Derive active roles from language using shared role-map
|
|
58
|
+
pipeline.activeRoles = getActiveRoles(state.language as OutputLanguage);
|
|
57
59
|
|
|
58
60
|
return pipeline;
|
|
59
61
|
}
|
|
@@ -62,30 +64,3 @@ export function migrateToPipelineState(state: ProjectState): PipelineState {
|
|
|
62
64
|
export function needsPipelineMigration(state: unknown): boolean {
|
|
63
65
|
return !(state as Record<string, unknown>).pipeline;
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
// ─── Role Derivation ─────────────────────────────────────
|
|
67
|
-
|
|
68
|
-
function deriveActiveRoles(language: string): PipelineRole[] {
|
|
69
|
-
const baseRoles: PipelineRole[] = [
|
|
70
|
-
'DISPATCHER', 'ARCHITECT', 'REVIEWER', 'ARBITRATOR',
|
|
71
|
-
'DEBUGGER', 'AUDITOR', 'JOURNALIST', 'RELEASE_MANAGER',
|
|
72
|
-
'QA_TESTER',
|
|
73
|
-
];
|
|
74
|
-
|
|
75
|
-
switch (language) {
|
|
76
|
-
case 'fullstack':
|
|
77
|
-
case 'all':
|
|
78
|
-
return [
|
|
79
|
-
...baseRoles,
|
|
80
|
-
'DB_EXPERT', 'BACKEND_PROGRAMMER', 'FRONTEND_PROGRAMMER',
|
|
81
|
-
'WEBSITE_PROGRAMMER', 'UI_UX_SPECIALIST',
|
|
82
|
-
];
|
|
83
|
-
case 'python':
|
|
84
|
-
case 'typescript':
|
|
85
|
-
return [...baseRoles, 'BACKEND_PROGRAMMER'];
|
|
86
|
-
case 'website':
|
|
87
|
-
return [...baseRoles, 'WEBSITE_PROGRAMMER', 'MARKETING_EXPERT', 'SOCIAL_EXPERT'];
|
|
88
|
-
default:
|
|
89
|
-
return [...baseRoles, 'BACKEND_PROGRAMMER'];
|
|
90
|
-
}
|
|
91
|
-
}
|