popeye-cli 2.2.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 +324 -20
- package/dist/cli/interactive.js.map +1 -1
- package/dist/generators/all.d.ts.map +1 -1
- package/dist/generators/all.js +3 -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/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 +26 -7
- package/dist/pipeline/gate-engine.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 +306 -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.map +1 -1
- package/dist/pipeline/phases/intake.js +7 -3
- 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 +18 -2
- 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/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/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 +25 -5
- package/dist/pipeline/type-defs/artifacts.d.ts.map +1 -1
- package/dist/pipeline/type-defs/artifacts.js +4 -0
- package/dist/pipeline/type-defs/artifacts.js.map +1 -1
- package/dist/pipeline/type-defs/audit.d.ts +25 -13
- package/dist/pipeline/type-defs/audit.d.ts.map +1 -1
- package/dist/pipeline/type-defs/checks.d.ts +18 -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 +104 -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 +160 -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 +333 -19
- package/src/generators/all.ts +3 -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/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 +35 -7
- package/src/pipeline/orchestrator.ts +361 -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 +7 -3
- 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 +21 -2
- 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/coverage-gate.ts +199 -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 +4 -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/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/coverage-gate.test.ts +370 -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
|
@@ -192,4 +192,38 @@ describe('GateEngine', () => {
|
|
|
192
192
|
expect(engine.getPhaseIndex('RECOVERY_LOOP')).toBe(-1); // Not in linear sequence
|
|
193
193
|
});
|
|
194
194
|
});
|
|
195
|
+
|
|
196
|
+
// ─── v2.4.6: findLast for stale check results ─────────
|
|
197
|
+
|
|
198
|
+
describe('v2.4.6: uses latest check result (findLast)', () => {
|
|
199
|
+
it('should use the latest check result when multiple exist for same check_type', () => {
|
|
200
|
+
const pipeline = createDefaultPipelineState();
|
|
201
|
+
pipeline.artifacts.push(makeArtifact('qa_validation', 'QA_VALIDATION'));
|
|
202
|
+
|
|
203
|
+
// First check failed, second check passed (accumulated on retry)
|
|
204
|
+
pipeline.gateChecks['QA_VALIDATION'] = [
|
|
205
|
+
{
|
|
206
|
+
check_type: 'test',
|
|
207
|
+
status: 'fail',
|
|
208
|
+
command: 'npm test',
|
|
209
|
+
exit_code: 1,
|
|
210
|
+
duration_ms: 500,
|
|
211
|
+
stderr_summary: 'Error: test failed',
|
|
212
|
+
timestamp: '2024-01-01T00:00:00Z',
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
check_type: 'test',
|
|
216
|
+
status: 'pass',
|
|
217
|
+
command: 'npm test',
|
|
218
|
+
exit_code: 0,
|
|
219
|
+
duration_ms: 800,
|
|
220
|
+
timestamp: '2024-01-01T00:01:00Z',
|
|
221
|
+
},
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
const result = engine.evaluateGate('QA_VALIDATION', pipeline);
|
|
225
|
+
expect(result.pass).toBe(true);
|
|
226
|
+
expect(result.failedChecks).toHaveLength(0);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
195
229
|
});
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install check tests — install resolution, skip-heuristic, phase ordering, marker invalidation.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
6
|
+
import { resolveCommands } from '../../src/pipeline/command-resolver.js';
|
|
7
|
+
import {
|
|
8
|
+
shouldSkipInstall,
|
|
9
|
+
writeInstallMarker,
|
|
10
|
+
invalidateInstallMarker,
|
|
11
|
+
} from '../../src/pipeline/check-runner.js';
|
|
12
|
+
import type { RepoSnapshot, ConfigFileEntry } from '../../src/pipeline/types.js';
|
|
13
|
+
|
|
14
|
+
import * as fs from 'node:fs';
|
|
15
|
+
import * as path from 'node:path';
|
|
16
|
+
import { tmpdir } from 'node:os';
|
|
17
|
+
|
|
18
|
+
function makeSnapshot(overrides: Partial<RepoSnapshot> = {}): RepoSnapshot {
|
|
19
|
+
return {
|
|
20
|
+
snapshot_id: 'test-snap',
|
|
21
|
+
timestamp: new Date().toISOString(),
|
|
22
|
+
tree_summary: '',
|
|
23
|
+
config_files: [],
|
|
24
|
+
languages_detected: [],
|
|
25
|
+
package_manager: undefined,
|
|
26
|
+
scripts: {},
|
|
27
|
+
test_framework: undefined,
|
|
28
|
+
build_tool: undefined,
|
|
29
|
+
env_files: [],
|
|
30
|
+
migrations_present: false,
|
|
31
|
+
ports_entrypoints: [],
|
|
32
|
+
total_files: 0,
|
|
33
|
+
total_lines: 0,
|
|
34
|
+
...overrides,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function makeConfig(type: string, overrides: Partial<ConfigFileEntry> = {}): ConfigFileEntry {
|
|
39
|
+
return { path: type, type, content_hash: 'abc123', key_fields: {}, ...overrides };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ─── Install Resolution Tests ─────────────────────────────
|
|
43
|
+
|
|
44
|
+
describe('Install Resolution', () => {
|
|
45
|
+
it('should resolve install for npm project', () => {
|
|
46
|
+
const snap = makeSnapshot({
|
|
47
|
+
config_files: [makeConfig('package.json')],
|
|
48
|
+
package_manager: 'npm',
|
|
49
|
+
scripts: { build: 'tsc' },
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const cmds = resolveCommands(snap);
|
|
53
|
+
expect(cmds.install).toBe('npm install');
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should resolve install for yarn project', () => {
|
|
57
|
+
const snap = makeSnapshot({
|
|
58
|
+
config_files: [makeConfig('package.json')],
|
|
59
|
+
package_manager: 'yarn',
|
|
60
|
+
scripts: { build: 'tsc' },
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const cmds = resolveCommands(snap);
|
|
64
|
+
expect(cmds.install).toBe('yarn install');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should resolve install for pnpm project', () => {
|
|
68
|
+
const snap = makeSnapshot({
|
|
69
|
+
config_files: [makeConfig('package.json')],
|
|
70
|
+
package_manager: 'pnpm',
|
|
71
|
+
scripts: { build: 'tsc' },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const cmds = resolveCommands(snap);
|
|
75
|
+
expect(cmds.install).toBe('pnpm install');
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it('should resolve install for python project with requirements.txt', () => {
|
|
79
|
+
const snap = makeSnapshot({
|
|
80
|
+
config_files: [makeConfig('requirements.txt')],
|
|
81
|
+
languages_detected: ['python'],
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const cmds = resolveCommands(snap);
|
|
85
|
+
expect(cmds.install).toBe('pip install -r requirements.txt');
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should resolve install for python project with poetry.lock', () => {
|
|
89
|
+
const snap = makeSnapshot({
|
|
90
|
+
config_files: [makeConfig('pyproject.toml'), makeConfig('poetry.lock')],
|
|
91
|
+
languages_detected: ['python'],
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const cmds = resolveCommands(snap);
|
|
95
|
+
expect(cmds.install).toBe('poetry install');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('should return NO install for pyproject.toml-only python project', () => {
|
|
99
|
+
const snap = makeSnapshot({
|
|
100
|
+
config_files: [makeConfig('pyproject.toml')],
|
|
101
|
+
languages_detected: ['python'],
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const cmds = resolveCommands(snap);
|
|
105
|
+
expect(cmds.install).toBeUndefined();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
it('should return chained install for mixed project', () => {
|
|
109
|
+
const snap = makeSnapshot({
|
|
110
|
+
config_files: [
|
|
111
|
+
makeConfig('package.json'),
|
|
112
|
+
makeConfig('requirements.txt'),
|
|
113
|
+
],
|
|
114
|
+
package_manager: 'npm',
|
|
115
|
+
scripts: {},
|
|
116
|
+
languages_detected: ['typescript', 'python'],
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
const cmds = resolveCommands(snap);
|
|
120
|
+
expect(cmds.install).toBe('npm install && pip install -r requirements.txt');
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should set install_cwd for workspace project with workspaces field', () => {
|
|
124
|
+
const snap = makeSnapshot({
|
|
125
|
+
config_files: [
|
|
126
|
+
makeConfig('package.json', { key_fields: { workspaces: ['apps/*', 'packages/*'] } }),
|
|
127
|
+
],
|
|
128
|
+
package_manager: 'npm',
|
|
129
|
+
scripts: {},
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const cmds = resolveCommands(snap);
|
|
133
|
+
expect(cmds.install_cwd).toBe('.');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('should set install_cwd for pnpm workspace project', () => {
|
|
137
|
+
const snap = makeSnapshot({
|
|
138
|
+
config_files: [
|
|
139
|
+
makeConfig('package.json'),
|
|
140
|
+
makeConfig('pnpm-workspace.yaml'),
|
|
141
|
+
],
|
|
142
|
+
package_manager: 'pnpm',
|
|
143
|
+
scripts: {},
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const cmds = resolveCommands(snap);
|
|
147
|
+
expect(cmds.install_cwd).toBe('.');
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('should NOT set install_cwd for non-workspace project', () => {
|
|
151
|
+
const snap = makeSnapshot({
|
|
152
|
+
config_files: [makeConfig('package.json')],
|
|
153
|
+
package_manager: 'npm',
|
|
154
|
+
scripts: {},
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
const cmds = resolveCommands(snap);
|
|
158
|
+
expect(cmds.install_cwd).toBeUndefined();
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// ─── Skip-Heuristic Tests ─────────────────────────────────
|
|
163
|
+
|
|
164
|
+
describe('Install Skip Heuristic', () => {
|
|
165
|
+
let testDir: string;
|
|
166
|
+
|
|
167
|
+
beforeEach(() => {
|
|
168
|
+
testDir = fs.mkdtempSync(path.join(tmpdir(), 'install-skip-'));
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
afterEach(() => {
|
|
172
|
+
fs.rmSync(testDir, { recursive: true, force: true });
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('should return false when no marker exists', () => {
|
|
176
|
+
const snap = makeSnapshot({
|
|
177
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash1' })],
|
|
178
|
+
package_manager: 'npm',
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(false);
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('should return true when marker matches lockfile hash and node_modules exists', () => {
|
|
185
|
+
const snap = makeSnapshot({
|
|
186
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash1' })],
|
|
187
|
+
package_manager: 'npm',
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Create node_modules directory
|
|
191
|
+
fs.mkdirSync(path.join(testDir, 'node_modules'));
|
|
192
|
+
|
|
193
|
+
// Write marker
|
|
194
|
+
writeInstallMarker(testDir, snap);
|
|
195
|
+
|
|
196
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(true);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should return false when lockfile hash differs', () => {
|
|
200
|
+
const snap1 = makeSnapshot({
|
|
201
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash1' })],
|
|
202
|
+
package_manager: 'npm',
|
|
203
|
+
});
|
|
204
|
+
const snap2 = makeSnapshot({
|
|
205
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash2' })],
|
|
206
|
+
package_manager: 'npm',
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Create node_modules directory
|
|
210
|
+
fs.mkdirSync(path.join(testDir, 'node_modules'));
|
|
211
|
+
|
|
212
|
+
// Write marker with old hash
|
|
213
|
+
writeInstallMarker(testDir, snap1);
|
|
214
|
+
|
|
215
|
+
// Check with new hash
|
|
216
|
+
expect(shouldSkipInstall(testDir, snap2)).toBe(false);
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
it('should return false when node_modules is missing even if marker matches', () => {
|
|
220
|
+
const snap = makeSnapshot({
|
|
221
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash1' })],
|
|
222
|
+
package_manager: 'npm',
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
// Write marker but do NOT create node_modules
|
|
226
|
+
writeInstallMarker(testDir, snap);
|
|
227
|
+
|
|
228
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(false);
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it('should invalidate marker when called', () => {
|
|
232
|
+
const snap = makeSnapshot({
|
|
233
|
+
config_files: [makeConfig('package-lock.json', { content_hash: 'hash1' })],
|
|
234
|
+
package_manager: 'npm',
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// Create node_modules and write marker
|
|
238
|
+
fs.mkdirSync(path.join(testDir, 'node_modules'));
|
|
239
|
+
writeInstallMarker(testDir, snap);
|
|
240
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(true);
|
|
241
|
+
|
|
242
|
+
// Invalidate
|
|
243
|
+
invalidateInstallMarker(testDir);
|
|
244
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(false);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should work with python .venv directory for poetry projects', () => {
|
|
248
|
+
const snap = makeSnapshot({
|
|
249
|
+
config_files: [makeConfig('poetry.lock', { content_hash: 'pyhash1' })],
|
|
250
|
+
package_manager: 'poetry',
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
// Create .venv directory
|
|
254
|
+
fs.mkdirSync(path.join(testDir, '.venv'));
|
|
255
|
+
|
|
256
|
+
// Write marker
|
|
257
|
+
writeInstallMarker(testDir, snap);
|
|
258
|
+
|
|
259
|
+
expect(shouldSkipInstall(testDir, snap)).toBe(true);
|
|
260
|
+
});
|
|
261
|
+
});
|