@principles/pd-cli 1.152.12 → 1.152.14
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/commands/candidate.d.ts.map +1 -1
- package/dist/commands/candidate.js +34 -7
- package/dist/commands/candidate.js.map +1 -1
- package/dist/commands/diagnose.d.ts.map +1 -1
- package/dist/commands/diagnose.js +23 -7
- package/dist/commands/diagnose.js.map +1 -1
- package/dist/commands/pain-retry.d.ts.map +1 -1
- package/dist/commands/pain-retry.js +21 -7
- package/dist/commands/pain-retry.js.map +1 -1
- package/package.json +13 -7
- package/CHANGELOG.md +0 -23
- package/dist/commands/__tests__/intent-flag-wiring.test.d.ts +0 -9
- package/dist/commands/__tests__/intent-flag-wiring.test.d.ts.map +0 -1
- package/dist/commands/__tests__/intent-flag-wiring.test.js +0 -237
- package/dist/commands/__tests__/intent-flag-wiring.test.js.map +0 -1
- package/dist/commands/__tests__/legacy-cleanup.test.d.ts +0 -18
- package/dist/commands/__tests__/legacy-cleanup.test.d.ts.map +0 -1
- package/dist/commands/__tests__/legacy-cleanup.test.js +0 -467
- package/dist/commands/__tests__/legacy-cleanup.test.js.map +0 -1
- package/dist/commands/__tests__/mvp-smoke.test.d.ts +0 -15
- package/dist/commands/__tests__/mvp-smoke.test.d.ts.map +0 -1
- package/dist/commands/__tests__/mvp-smoke.test.js +0 -262
- package/dist/commands/__tests__/mvp-smoke.test.js.map +0 -1
- package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.d.ts +0 -2
- package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.d.ts.map +0 -1
- package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.js +0 -60
- package/dist/commands/__tests__/pain-retry-maxTokens-flag.test.js.map +0 -1
- package/dist/commands/__tests__/rulecode-flag-wiring.test.d.ts +0 -21
- package/dist/commands/__tests__/rulecode-flag-wiring.test.d.ts.map +0 -1
- package/dist/commands/__tests__/rulecode-flag-wiring.test.js +0 -186
- package/dist/commands/__tests__/rulecode-flag-wiring.test.js.map +0 -1
- package/dist/commands/__tests__/rulecode-handler.test.d.ts +0 -16
- package/dist/commands/__tests__/rulecode-handler.test.d.ts.map +0 -1
- package/dist/commands/__tests__/rulecode-handler.test.js +0 -285
- package/dist/commands/__tests__/rulecode-handler.test.js.map +0 -1
- package/dist/commands/__tests__/run-rulehost-flag-wiring.test.d.ts +0 -24
- package/dist/commands/__tests__/run-rulehost-flag-wiring.test.d.ts.map +0 -1
- package/dist/commands/__tests__/run-rulehost-flag-wiring.test.js +0 -232
- package/dist/commands/__tests__/run-rulehost-flag-wiring.test.js.map +0 -1
- package/dist/commands/__tests__/runtime-activation-nextaction.test.d.ts +0 -15
- package/dist/commands/__tests__/runtime-activation-nextaction.test.d.ts.map +0 -1
- package/dist/commands/__tests__/runtime-activation-nextaction.test.js +0 -73
- package/dist/commands/__tests__/runtime-activation-nextaction.test.js.map +0 -1
- package/dist/commands/__tests__/runtime-probe-config.test.d.ts +0 -20
- package/dist/commands/__tests__/runtime-probe-config.test.d.ts.map +0 -1
- package/dist/commands/__tests__/runtime-probe-config.test.js +0 -389
- package/dist/commands/__tests__/runtime-probe-config.test.js.map +0 -1
- package/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts +0 -9
- package/dist/commands/__tests__/telemetry-flag-wiring.test.d.ts.map +0 -1
- package/dist/commands/__tests__/telemetry-flag-wiring.test.js +0 -76
- package/dist/commands/__tests__/telemetry-flag-wiring.test.js.map +0 -1
- package/dist/commands/__tests__/version.test.d.ts +0 -2
- package/dist/commands/__tests__/version.test.d.ts.map +0 -1
- package/dist/commands/__tests__/version.test.js +0 -238
- package/dist/commands/__tests__/version.test.js.map +0 -1
- package/dist/commands/runtime-uat.guard.test.d.ts +0 -2
- package/dist/commands/runtime-uat.guard.test.d.ts.map +0 -1
- package/dist/commands/runtime-uat.guard.test.js +0 -153
- package/dist/commands/runtime-uat.guard.test.js.map +0 -1
- package/dist/services/__tests__/cli-output.test.d.ts +0 -18
- package/dist/services/__tests__/cli-output.test.d.ts.map +0 -1
- package/dist/services/__tests__/cli-output.test.js +0 -103
- package/dist/services/__tests__/cli-output.test.js.map +0 -1
- package/dist/services/__tests__/evaluator-runner-deps.test.d.ts +0 -2
- package/dist/services/__tests__/evaluator-runner-deps.test.d.ts.map +0 -1
- package/dist/services/__tests__/evaluator-runner-deps.test.js +0 -343
- package/dist/services/__tests__/evaluator-runner-deps.test.js.map +0 -1
- package/dist/services/__tests__/rulehost-readiness.test.d.ts +0 -2
- package/dist/services/__tests__/rulehost-readiness.test.d.ts.map +0 -1
- package/dist/services/__tests__/rulehost-readiness.test.js +0 -311
- package/dist/services/__tests__/rulehost-readiness.test.js.map +0 -1
- package/dist/services/__tests__/runtime-adapter-resolver.test.d.ts +0 -18
- package/dist/services/__tests__/runtime-adapter-resolver.test.d.ts.map +0 -1
- package/dist/services/__tests__/runtime-adapter-resolver.test.js +0 -673
- package/dist/services/__tests__/runtime-adapter-resolver.test.js.map +0 -1
- package/dist/utils/production-workspace-guard.test.d.ts +0 -2
- package/dist/utils/production-workspace-guard.test.d.ts.map +0 -1
- package/dist/utils/production-workspace-guard.test.js +0 -137
- package/dist/utils/production-workspace-guard.test.js.map +0 -1
- package/scripts/llm-dogfood.ts +0 -456
- package/scripts/migrate-illegal-expected-decision.ts +0 -252
- package/src/commands/__tests__/intent-flag-wiring.test.ts +0 -282
- package/src/commands/__tests__/legacy-cleanup.test.ts +0 -602
- package/src/commands/__tests__/mvp-smoke.test.ts +0 -300
- package/src/commands/__tests__/pain-retry-maxTokens-flag.test.ts +0 -73
- package/src/commands/__tests__/rulecode-flag-wiring.test.ts +0 -237
- package/src/commands/__tests__/rulecode-handler.test.ts +0 -369
- package/src/commands/__tests__/run-rulehost-flag-wiring.test.ts +0 -292
- package/src/commands/__tests__/runtime-activation-nextaction.test.ts +0 -81
- package/src/commands/__tests__/runtime-probe-config.test.ts +0 -432
- package/src/commands/__tests__/telemetry-flag-wiring.test.ts +0 -84
- package/src/commands/__tests__/version.test.ts +0 -251
- package/src/commands/admission-gate.ts +0 -30
- package/src/commands/artifact.ts +0 -82
- package/src/commands/build-trajectory-evidence.ts +0 -298
- package/src/commands/candidate.ts +0 -1250
- package/src/commands/codex-ingest-catchup.ts +0 -114
- package/src/commands/codex-ingest-quarantine.ts +0 -127
- package/src/commands/codex-reconcile.ts +0 -84
- package/src/commands/codex-setup.ts +0 -476
- package/src/commands/codex-worker.ts +0 -185
- package/src/commands/command-helpers.ts +0 -24
- package/src/commands/config-doctor.ts +0 -193
- package/src/commands/console.ts +0 -797
- package/src/commands/context.ts +0 -72
- package/src/commands/demo-story-a.ts +0 -241
- package/src/commands/diagnose.ts +0 -756
- package/src/commands/errors-list.ts +0 -441
- package/src/commands/evolution-tasks-list.ts +0 -48
- package/src/commands/evolution-tasks-show.ts +0 -62
- package/src/commands/flow.ts +0 -60
- package/src/commands/health-codex.ts +0 -576
- package/src/commands/health.ts +0 -315
- package/src/commands/history.ts +0 -63
- package/src/commands/intent.ts +0 -457
- package/src/commands/legacy-cleanup.ts +0 -531
- package/src/commands/legacy-import.ts +0 -104
- package/src/commands/mvp-smoke.ts +0 -160
- package/src/commands/pain-evidence.ts +0 -226
- package/src/commands/pain-list.ts +0 -239
- package/src/commands/pain-record.ts +0 -612
- package/src/commands/pain-retry.ts +0 -916
- package/src/commands/principles-stats.ts +0 -700
- package/src/commands/proven-channel-baseline.ts +0 -115
- package/src/commands/quality-scorecard.ts +0 -272
- package/src/commands/remediation-output.ts +0 -66
- package/src/commands/rulecode.ts +0 -465
- package/src/commands/run.ts +0 -89
- package/src/commands/runtime-activation.ts +0 -1629
- package/src/commands/runtime-artifact-repair.ts +0 -524
- package/src/commands/runtime-canary.ts +0 -395
- package/src/commands/runtime-compatibility-scan.ts +0 -105
- package/src/commands/runtime-diagnostics-export.ts +0 -229
- package/src/commands/runtime-features.ts +0 -153
- package/src/commands/runtime-gfi-snapshot.ts +0 -135
- package/src/commands/runtime-health-snapshot.ts +0 -108
- package/src/commands/runtime-init.ts +0 -429
- package/src/commands/runtime-internalization-enqueue-successors.ts +0 -530
- package/src/commands/runtime-internalization-integrity-repair.ts +0 -79
- package/src/commands/runtime-internalization-integrity.ts +0 -107
- package/src/commands/runtime-internalization-queue.ts +0 -135
- package/src/commands/runtime-internalization-retry.ts +0 -191
- package/src/commands/runtime-internalization-run-once.ts +0 -791
- package/src/commands/runtime-internalization-run-rulehost.ts +0 -749
- package/src/commands/runtime-internalization-wake-once.ts +0 -87
- package/src/commands/runtime-pain-flood-simulation.ts +0 -121
- package/src/commands/runtime-pruning.ts +0 -438
- package/src/commands/runtime-recovery-failed-tasks.ts +0 -258
- package/src/commands/runtime-recovery.ts +0 -109
- package/src/commands/runtime-synthetic-baseline.ts +0 -70
- package/src/commands/runtime-uat.guard.test.ts +0 -175
- package/src/commands/runtime-uat.ts +0 -380
- package/src/commands/runtime.ts +0 -473
- package/src/commands/samples-list.ts +0 -39
- package/src/commands/samples-review.ts +0 -36
- package/src/commands/task.ts +0 -271
- package/src/commands/telemetry.ts +0 -349
- package/src/commands/trace.ts +0 -174
- package/src/commands/trajectory-db-unavailable.ts +0 -19
- package/src/commands/trajectory.ts +0 -64
- package/src/commands/version.ts +0 -49
- package/src/config-reader.ts +0 -122
- package/src/index.ts +0 -1276
- package/src/legacy/legacy-import.ts +0 -179
- package/src/legacy/session-history-import.ts +0 -203
- package/src/resolve-workspace.ts +0 -106
- package/src/services/__tests__/cli-output.test.ts +0 -130
- package/src/services/__tests__/evaluator-runner-deps.test.ts +0 -382
- package/src/services/__tests__/rulehost-readiness.test.ts +0 -363
- package/src/services/__tests__/runtime-adapter-resolver.test.ts +0 -793
- package/src/services/cli-output.ts +0 -95
- package/src/services/config-doctor.ts +0 -697
- package/src/services/console-launcher.ts +0 -537
- package/src/services/demo-rule-compiler.ts +0 -40
- package/src/services/demo-story-a-runner.ts +0 -471
- package/src/services/mainline-snapshot-assembler.ts +0 -579
- package/src/services/pain-flood-simulation-runner.ts +0 -462
- package/src/services/pd-config-loader.ts +0 -433
- package/src/services/proven-channel-baseline-runner.ts +0 -157
- package/src/services/quality-scorecard/data-extractor.ts +0 -150
- package/src/services/quality-scorecard/local-evaluator.ts +0 -142
- package/src/services/quality-scorecard/strong-model-gate.ts +0 -202
- package/src/services/resolve-runtime-from-pd-config.ts +0 -230
- package/src/services/rulehost-pipeline-runner.ts +0 -1214
- package/src/services/rulehost-readiness.ts +0 -326
- package/src/services/runtime-adapter-resolver.ts +0 -364
- package/src/services/synthetic-baseline-runner.ts +0 -400
- package/src/services/version-report.ts +0 -253
- package/src/services/workspace-tool-semantics.ts +0 -26
- package/src/utils/path-security.ts +0 -96
- package/src/utils/production-workspace-guard.test.ts +0 -157
- package/src/utils/production-workspace-guard.ts +0 -210
- package/tests/bdd/cli-contract.steps.ts +0 -346
- package/tests/bdd/principles-stats.steps.ts +0 -211
- package/tests/bdd/support/gherkin-loader.ts +0 -147
- package/tests/bdd/support/repo-root.ts +0 -62
- package/tests/bdd/support/vitest-bdd.ts +0 -179
- package/tests/commands/admission-gate-coverage.test.ts +0 -79
- package/tests/commands/build-trajectory-evidence.test.ts +0 -508
- package/tests/commands/candidate-audit-repair.test.ts +0 -421
- package/tests/commands/candidate-intake.test.ts +0 -732
- package/tests/commands/candidate-internalization-backfill.test.ts +0 -548
- package/tests/commands/candidate-internalize-lineage.test.ts +0 -628
- package/tests/commands/candidate-internalize.test.ts +0 -299
- package/tests/commands/candidate-route.test.ts +0 -329
- package/tests/commands/candidate-show.test.ts +0 -95
- package/tests/commands/cli-command-tree.test.ts +0 -144
- package/tests/commands/cli-help-snapshot.test.ts +0 -155
- package/tests/commands/cli-skill-contract.test.ts +0 -121
- package/tests/commands/codex-consent-reversibility.steps.test.ts +0 -299
- package/tests/commands/codex-ingest-quarantine.test.ts +0 -136
- package/tests/commands/codex-setup.test.ts +0 -297
- package/tests/commands/codex-worker-daemon.test.ts +0 -95
- package/tests/commands/codex-worker-registration.test.ts +0 -207
- package/tests/commands/config-doctor.test.ts +0 -336
- package/tests/commands/console-launcher-edge-cases.test.ts +0 -388
- package/tests/commands/console-open.test.ts +0 -1381
- package/tests/commands/context.test.ts +0 -114
- package/tests/commands/demo-story-a.test.ts +0 -318
- package/tests/commands/diagnose.test.ts +0 -1803
- package/tests/commands/errors-list.test.ts +0 -679
- package/tests/commands/evolution-tasks-list.test.ts +0 -41
- package/tests/commands/evolution-tasks-show.test.ts +0 -46
- package/tests/commands/health-codex.test.ts +0 -349
- package/tests/commands/health-host-wiring.test.ts +0 -76
- package/tests/commands/health-reliability.test.ts +0 -99
- package/tests/commands/health.test.ts +0 -413
- package/tests/commands/intent.test.ts +0 -321
- package/tests/commands/legacy-cleanup.test.ts +0 -148
- package/tests/commands/pain-evidence.test.ts +0 -518
- package/tests/commands/pain-list.test.ts +0 -219
- package/tests/commands/pain-record-async.test.ts +0 -335
- package/tests/commands/pain-record-session-parser.test.ts +0 -228
- package/tests/commands/pain-record.test.ts +0 -851
- package/tests/commands/pain-retry.test.ts +0 -1121
- package/tests/commands/plugin-config-resolution-cutover.test.ts +0 -229
- package/tests/commands/pri-393-runtime-config-unification.test.ts +0 -443
- package/tests/commands/principles-stats-wiring.test.ts +0 -135
- package/tests/commands/principles-stats.test.ts +0 -274
- package/tests/commands/product-path-regression.test.ts +0 -86
- package/tests/commands/proven-channel-baseline.test.ts +0 -441
- package/tests/commands/rulecode.test.ts +0 -177
- package/tests/commands/run-rulehost-handler.test.ts +0 -908
- package/tests/commands/runtime-activation-approve-flag-wiring.test.ts +0 -227
- package/tests/commands/runtime-activation-deactivate-flag-wiring.test.ts +0 -167
- package/tests/commands/runtime-activation-dispatch-flag-wiring.test.ts +0 -262
- package/tests/commands/runtime-activation-governance-audit.test.ts +0 -95
- package/tests/commands/runtime-activation-list-flag-wiring.test.ts +0 -193
- package/tests/commands/runtime-activation-promote-flag-wiring.test.ts +0 -248
- package/tests/commands/runtime-activation-shadow-telemetry.test.ts +0 -130
- package/tests/commands/runtime-activation.test.ts +0 -2052
- package/tests/commands/runtime-artifact-repair-registration.test.ts +0 -74
- package/tests/commands/runtime-artifact-repair.test.ts +0 -404
- package/tests/commands/runtime-canary.test.ts +0 -430
- package/tests/commands/runtime-compatibility-scan.test.ts +0 -146
- package/tests/commands/runtime-diagnostics-export.test.ts +0 -175
- package/tests/commands/runtime-features.test.ts +0 -249
- package/tests/commands/runtime-health-snapshot.test.ts +0 -358
- package/tests/commands/runtime-init-empty-workspace.test.ts +0 -252
- package/tests/commands/runtime-init.test.ts +0 -420
- package/tests/commands/runtime-internalization-enqueue-successors.test.ts +0 -782
- package/tests/commands/runtime-internalization-integrity-repair.test.ts +0 -239
- package/tests/commands/runtime-internalization-integrity.test.ts +0 -140
- package/tests/commands/runtime-internalization-queue.test.ts +0 -380
- package/tests/commands/runtime-internalization-retry-owner-authority.test.ts +0 -431
- package/tests/commands/runtime-internalization-run-once-evaluator-parity.test.ts +0 -269
- package/tests/commands/runtime-internalization-run-once-language.test.ts +0 -303
- package/tests/commands/runtime-internalization-run-once-real-config.test.ts +0 -237
- package/tests/commands/runtime-internalization-run-once-rollout-parity.test.ts +0 -706
- package/tests/commands/runtime-internalization-run-once.test.ts +0 -1791
- package/tests/commands/runtime-internalization-wake-once.test.ts +0 -171
- package/tests/commands/runtime-internalization.test.ts +0 -53
- package/tests/commands/runtime-pain-flood-simulation.test.ts +0 -418
- package/tests/commands/runtime-pruning.test.ts +0 -694
- package/tests/commands/runtime-recovery-failed-tasks.test.ts +0 -328
- package/tests/commands/runtime-recovery.test.ts +0 -120
- package/tests/commands/runtime-synthetic-baseline.test.ts +0 -249
- package/tests/commands/runtime-uat.test.ts +0 -397
- package/tests/commands/runtime.test.ts +0 -392
- package/tests/commands/samples-list.test.ts +0 -43
- package/tests/commands/samples-review.test.ts +0 -41
- package/tests/commands/task.test.ts +0 -153
- package/tests/commands/telemetry.test.ts +0 -190
- package/tests/commands/trace.test.ts +0 -316
- package/tests/config-reader.test.ts +0 -143
- package/tests/e2e/candidate-intake-e2e.test.ts +0 -338
- package/tests/e2e/cli-full-flow.test.ts +0 -233
- package/tests/e2e/cross-package-acceptance.test.ts +0 -635
- package/tests/helpers/pd-cli-path.ts +0 -5
- package/tests/pd-cli-smoke.test.ts +0 -13
- package/tests/resolve-workspace.test.ts +0 -196
- package/tests/services/config-doctor-signal-health.test.ts +0 -109
- package/tests/services/console-launcher.test.ts +0 -114
- package/tests/services/demo-rule-compiler.test.ts +0 -242
- package/tests/services/mainline-snapshot-assembler.test.ts +0 -572
- package/tests/services/pd-config-loader.test.ts +0 -505
- package/tests/services/proven-channel-baseline-runner.test.ts +0 -30
- package/tests/services/quality-scorecard/strong-model-gate.test.ts +0 -133
- package/tests/services/resolve-runtime-from-pd-config.test.ts +0 -485
- package/tests/services/rulehost-pipeline-e2e.test.ts +0 -538
- package/tests/services/rulehost-pipeline-runner.test.ts +0 -1242
- package/tests/services/workspace-tool-semantics.test.ts +0 -76
- package/tests/utils/path-security.test.ts +0 -180
- package/tsconfig.json +0 -26
- package/vitest.config.ts +0 -10
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parser-level tests for `pd activation approve` flags (CLI gate rule 7).
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `runtime-activation-promote-flag-wiring.test.ts`. Exercises the real
|
|
5
|
-
* `registerRuntimeActivationApproveCommand` helper (single source of truth
|
|
6
|
-
* shared with `index.ts`). Flag typos in production surface here at
|
|
7
|
-
* parseAsync time, not at handler dispatch.
|
|
8
|
-
*
|
|
9
|
-
* Covers:
|
|
10
|
-
* - --approval-id / -a is required (Commander rejects missing required option)
|
|
11
|
-
* - --decided-by, --note, --json are registered
|
|
12
|
-
* - --workspace / -w shorthand is registered
|
|
13
|
-
* - --dry-run / --confirm / --no-json are NOT registered
|
|
14
|
-
*
|
|
15
|
-
* Handler-level behavior (approval dispatch, JSON output shape) is covered by
|
|
16
|
-
* runtime-activation.test.ts.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { describe, it, expect } from 'vitest';
|
|
20
|
-
import { Command } from 'commander';
|
|
21
|
-
|
|
22
|
-
import { registerRuntimeActivationApproveCommand } from '../../src/commands/runtime-activation.js';
|
|
23
|
-
|
|
24
|
-
type ActionOptions = Record<string, unknown>;
|
|
25
|
-
|
|
26
|
-
interface CapturedAction {
|
|
27
|
-
opts: ActionOptions | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function attachCapture(cmd: Command, state: CapturedAction): void {
|
|
31
|
-
cmd.action(function captureAction(...args: unknown[]): void {
|
|
32
|
-
let optsArg: unknown = null;
|
|
33
|
-
for (let i = args.length - 1; i >= 0; i--) {
|
|
34
|
-
const arg: unknown = args[i];
|
|
35
|
-
if (arg !== null && typeof arg === 'object' && !(arg instanceof Command)) {
|
|
36
|
-
optsArg = arg;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (optsArg !== null && typeof optsArg === 'object') {
|
|
41
|
-
state.opts = optsArg as ActionOptions;
|
|
42
|
-
} else {
|
|
43
|
-
state.opts = {};
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function freshProgram(): Command {
|
|
49
|
-
const program = new Command();
|
|
50
|
-
program.name('pd').exitOverride();
|
|
51
|
-
return program;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
describe('pd activation approve — flag wiring (CLI gate rule 7)', () => {
|
|
55
|
-
// ── Option metadata ──────────────────────────────────────────────────────
|
|
56
|
-
|
|
57
|
-
it('registers -a, --approval-id as required option', () => {
|
|
58
|
-
const program = freshProgram();
|
|
59
|
-
const activationCmd = program.command('activation');
|
|
60
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
61
|
-
|
|
62
|
-
const opt = approveCmd.options.find((o) => o.long === '--approval-id');
|
|
63
|
-
expect(opt).toBeDefined();
|
|
64
|
-
expect(opt?.long).toBe('--approval-id');
|
|
65
|
-
expect(opt?.short).toBe('-a');
|
|
66
|
-
expect(opt?.required).toBe(true);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('registers --decided-by flag', () => {
|
|
70
|
-
const program = freshProgram();
|
|
71
|
-
const activationCmd = program.command('activation');
|
|
72
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
73
|
-
|
|
74
|
-
const opt = approveCmd.options.find((o) => o.long === '--decided-by');
|
|
75
|
-
expect(opt).toBeDefined();
|
|
76
|
-
expect(opt?.long).toBe('--decided-by');
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it('registers --note flag', () => {
|
|
80
|
-
const program = freshProgram();
|
|
81
|
-
const activationCmd = program.command('activation');
|
|
82
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
83
|
-
|
|
84
|
-
const opt = approveCmd.options.find((o) => o.long === '--note');
|
|
85
|
-
expect(opt).toBeDefined();
|
|
86
|
-
expect(opt?.long).toBe('--note');
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('registers --json flag', () => {
|
|
90
|
-
const program = freshProgram();
|
|
91
|
-
const activationCmd = program.command('activation');
|
|
92
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
93
|
-
|
|
94
|
-
const opt = approveCmd.options.find((o) => o.long === '--json');
|
|
95
|
-
expect(opt).toBeDefined();
|
|
96
|
-
expect(opt?.long).toBe('--json');
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('registers -w shorthand for --workspace', () => {
|
|
100
|
-
const program = freshProgram();
|
|
101
|
-
const activationCmd = program.command('activation');
|
|
102
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
103
|
-
|
|
104
|
-
const opt = approveCmd.options.find((o) => o.short === '-w');
|
|
105
|
-
expect(opt).toBeDefined();
|
|
106
|
-
expect(opt?.long).toBe('--workspace');
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('does NOT register --dry-run', () => {
|
|
110
|
-
const program = freshProgram();
|
|
111
|
-
const activationCmd = program.command('activation');
|
|
112
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
113
|
-
|
|
114
|
-
const opt = approveCmd.options.find((o) => o.long === '--dry-run');
|
|
115
|
-
expect(opt).toBeUndefined();
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('does NOT register --confirm', () => {
|
|
119
|
-
const program = freshProgram();
|
|
120
|
-
const activationCmd = program.command('activation');
|
|
121
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
122
|
-
|
|
123
|
-
const opt = approveCmd.options.find((o) => o.long === '--confirm');
|
|
124
|
-
expect(opt).toBeUndefined();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it('does NOT register --no-json (no accidental negation)', () => {
|
|
128
|
-
const program = freshProgram();
|
|
129
|
-
const activationCmd = program.command('activation');
|
|
130
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
131
|
-
|
|
132
|
-
const noForm = approveCmd.options.find((o) => o.long === '--no-json');
|
|
133
|
-
expect(noForm).toBeUndefined();
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// ── Parser-level tests (program.parseAsync) ───────────────────────────────
|
|
137
|
-
|
|
138
|
-
it('parses --approval-id and --json', async () => {
|
|
139
|
-
const program = freshProgram();
|
|
140
|
-
const activationCmd = program.command('activation');
|
|
141
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
142
|
-
const captured: CapturedAction = { opts: null };
|
|
143
|
-
attachCapture(approveCmd, captured);
|
|
144
|
-
|
|
145
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '--approval-id', 'apr-1', '--json']);
|
|
146
|
-
|
|
147
|
-
expect(captured.opts).not.toBeNull();
|
|
148
|
-
expect(captured.opts?.approvalId).toBe('apr-1');
|
|
149
|
-
expect(captured.opts?.json).toBe(true);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('parses -a shorthand for --approval-id', async () => {
|
|
153
|
-
const program = freshProgram();
|
|
154
|
-
const activationCmd = program.command('activation');
|
|
155
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
156
|
-
const captured: CapturedAction = { opts: null };
|
|
157
|
-
attachCapture(approveCmd, captured);
|
|
158
|
-
|
|
159
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '-a', 'apr-1']);
|
|
160
|
-
|
|
161
|
-
expect(captured.opts).not.toBeNull();
|
|
162
|
-
expect(captured.opts?.approvalId).toBe('apr-1');
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('parses --decided-by with value', async () => {
|
|
166
|
-
const program = freshProgram();
|
|
167
|
-
const activationCmd = program.command('activation');
|
|
168
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
169
|
-
const captured: CapturedAction = { opts: null };
|
|
170
|
-
attachCapture(approveCmd, captured);
|
|
171
|
-
|
|
172
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '--approval-id', 'apr-1', '--decided-by', 'alice']);
|
|
173
|
-
|
|
174
|
-
expect(captured.opts).not.toBeNull();
|
|
175
|
-
expect(captured.opts?.decidedBy).toBe('alice');
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
it('parses --note with value', async () => {
|
|
179
|
-
const program = freshProgram();
|
|
180
|
-
const activationCmd = program.command('activation');
|
|
181
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
182
|
-
const captured: CapturedAction = { opts: null };
|
|
183
|
-
attachCapture(approveCmd, captured);
|
|
184
|
-
|
|
185
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '--approval-id', 'apr-1', '--note', 'looks good']);
|
|
186
|
-
|
|
187
|
-
expect(captured.opts).not.toBeNull();
|
|
188
|
-
expect(captured.opts?.note).toBe('looks good');
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
it('parses -w shorthand for --workspace', async () => {
|
|
192
|
-
const program = freshProgram();
|
|
193
|
-
const activationCmd = program.command('activation');
|
|
194
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
195
|
-
const captured: CapturedAction = { opts: null };
|
|
196
|
-
attachCapture(approveCmd, captured);
|
|
197
|
-
|
|
198
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '--approval-id', 'apr-1', '-w', '/tmp/test']);
|
|
199
|
-
|
|
200
|
-
expect(captured.opts).not.toBeNull();
|
|
201
|
-
expect(captured.opts?.workspace).toBe('/tmp/test');
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
it('rejects missing --approval-id (required option)', async () => {
|
|
205
|
-
const program = freshProgram();
|
|
206
|
-
const activationCmd = program.command('activation');
|
|
207
|
-
registerRuntimeActivationApproveCommand(activationCmd);
|
|
208
|
-
|
|
209
|
-
// Commander should throw on missing required option
|
|
210
|
-
await expect(
|
|
211
|
-
program.parseAsync(['node', 'pd', 'activation', 'approve', '--json']),
|
|
212
|
-
).rejects.toThrow(/approval-id/);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
it('defaults --json to undefined when not passed', async () => {
|
|
216
|
-
const program = freshProgram();
|
|
217
|
-
const activationCmd = program.command('activation');
|
|
218
|
-
const approveCmd = registerRuntimeActivationApproveCommand(activationCmd);
|
|
219
|
-
const captured: CapturedAction = { opts: null };
|
|
220
|
-
attachCapture(approveCmd, captured);
|
|
221
|
-
|
|
222
|
-
await program.parseAsync(['node', 'pd', 'activation', 'approve', '--approval-id', 'apr-1']);
|
|
223
|
-
|
|
224
|
-
expect(captured.opts).not.toBeNull();
|
|
225
|
-
expect(captured.opts?.json).toBeUndefined();
|
|
226
|
-
});
|
|
227
|
-
});
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parser-level tests for `pd activation deactivate` flags (CLI gate rule 7).
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `runtime-activation-promote-flag-wiring.test.ts`. Exercises the real
|
|
5
|
-
* `registerRuntimeActivationDeactivateCommand` helper (single source of truth
|
|
6
|
-
* shared with `index.ts`). Flag typos in production surface here at
|
|
7
|
-
* parseAsync time, not at handler dispatch.
|
|
8
|
-
*
|
|
9
|
-
* Covers:
|
|
10
|
-
* - --activation-id is required (Commander rejects missing required option)
|
|
11
|
-
* - --json is registered
|
|
12
|
-
* - --workspace / -w shorthand is registered
|
|
13
|
-
* - --dry-run / --confirm / --no-json are NOT registered
|
|
14
|
-
*
|
|
15
|
-
* Handler-level behavior (deactivation idempotency, JSON output shape,
|
|
16
|
-
* refusal reasons) is covered by runtime-activation.test.ts.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import { describe, it, expect } from 'vitest';
|
|
20
|
-
import { Command } from 'commander';
|
|
21
|
-
|
|
22
|
-
import { registerRuntimeActivationDeactivateCommand } from '../../src/commands/runtime-activation.js';
|
|
23
|
-
|
|
24
|
-
type ActionOptions = Record<string, unknown>;
|
|
25
|
-
|
|
26
|
-
interface CapturedAction {
|
|
27
|
-
opts: ActionOptions | null;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function attachCapture(cmd: Command, state: CapturedAction): void {
|
|
31
|
-
cmd.action(function captureAction(...args: unknown[]): void {
|
|
32
|
-
let optsArg: unknown = null;
|
|
33
|
-
for (let i = args.length - 1; i >= 0; i--) {
|
|
34
|
-
const arg: unknown = args[i];
|
|
35
|
-
if (arg !== null && typeof arg === 'object' && !(arg instanceof Command)) {
|
|
36
|
-
optsArg = arg;
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (optsArg !== null && typeof optsArg === 'object') {
|
|
41
|
-
state.opts = optsArg as ActionOptions;
|
|
42
|
-
} else {
|
|
43
|
-
state.opts = {};
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function freshProgram(): Command {
|
|
49
|
-
const program = new Command();
|
|
50
|
-
program.name('pd').exitOverride();
|
|
51
|
-
return program;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
describe('pd activation deactivate — flag wiring (CLI gate rule 7)', () => {
|
|
55
|
-
// ── Option metadata ──────────────────────────────────────────────────────
|
|
56
|
-
|
|
57
|
-
it('registers --activation-id as required option', () => {
|
|
58
|
-
const program = freshProgram();
|
|
59
|
-
const activationCmd = program.command('activation');
|
|
60
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
61
|
-
|
|
62
|
-
const opt = deactivateCmd.options.find((o) => o.long === '--activation-id');
|
|
63
|
-
expect(opt).toBeDefined();
|
|
64
|
-
expect(opt?.long).toBe('--activation-id');
|
|
65
|
-
expect(opt?.required).toBe(true);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('registers --json flag', () => {
|
|
69
|
-
const program = freshProgram();
|
|
70
|
-
const activationCmd = program.command('activation');
|
|
71
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
72
|
-
|
|
73
|
-
const opt = deactivateCmd.options.find((o) => o.long === '--json');
|
|
74
|
-
expect(opt).toBeDefined();
|
|
75
|
-
expect(opt?.long).toBe('--json');
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('registers -w shorthand for --workspace', () => {
|
|
79
|
-
const program = freshProgram();
|
|
80
|
-
const activationCmd = program.command('activation');
|
|
81
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
82
|
-
|
|
83
|
-
const opt = deactivateCmd.options.find((o) => o.short === '-w');
|
|
84
|
-
expect(opt).toBeDefined();
|
|
85
|
-
expect(opt?.long).toBe('--workspace');
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('does NOT register --dry-run', () => {
|
|
89
|
-
const program = freshProgram();
|
|
90
|
-
const activationCmd = program.command('activation');
|
|
91
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
92
|
-
|
|
93
|
-
const opt = deactivateCmd.options.find((o) => o.long === '--dry-run');
|
|
94
|
-
expect(opt).toBeUndefined();
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('does NOT register --confirm', () => {
|
|
98
|
-
const program = freshProgram();
|
|
99
|
-
const activationCmd = program.command('activation');
|
|
100
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
101
|
-
|
|
102
|
-
const opt = deactivateCmd.options.find((o) => o.long === '--confirm');
|
|
103
|
-
expect(opt).toBeUndefined();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('does NOT register --no-json (no accidental negation)', () => {
|
|
107
|
-
const program = freshProgram();
|
|
108
|
-
const activationCmd = program.command('activation');
|
|
109
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
110
|
-
|
|
111
|
-
const noForm = deactivateCmd.options.find((o) => o.long === '--no-json');
|
|
112
|
-
expect(noForm).toBeUndefined();
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
// ── Parser-level tests (program.parseAsync) ───────────────────────────────
|
|
116
|
-
|
|
117
|
-
it('parses --activation-id and --json', async () => {
|
|
118
|
-
const program = freshProgram();
|
|
119
|
-
const activationCmd = program.command('activation');
|
|
120
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
121
|
-
const captured: CapturedAction = { opts: null };
|
|
122
|
-
attachCapture(deactivateCmd, captured);
|
|
123
|
-
|
|
124
|
-
await program.parseAsync(['node', 'pd', 'activation', 'deactivate', '--activation-id', 'act-1', '--json']);
|
|
125
|
-
|
|
126
|
-
expect(captured.opts).not.toBeNull();
|
|
127
|
-
expect(captured.opts?.activationId).toBe('act-1');
|
|
128
|
-
expect(captured.opts?.json).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('parses -w shorthand for --workspace', async () => {
|
|
132
|
-
const program = freshProgram();
|
|
133
|
-
const activationCmd = program.command('activation');
|
|
134
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
135
|
-
const captured: CapturedAction = { opts: null };
|
|
136
|
-
attachCapture(deactivateCmd, captured);
|
|
137
|
-
|
|
138
|
-
await program.parseAsync(['node', 'pd', 'activation', 'deactivate', '--activation-id', 'act-1', '-w', '/tmp/test']);
|
|
139
|
-
|
|
140
|
-
expect(captured.opts).not.toBeNull();
|
|
141
|
-
expect(captured.opts?.workspace).toBe('/tmp/test');
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
it('rejects missing --activation-id (required option)', async () => {
|
|
145
|
-
const program = freshProgram();
|
|
146
|
-
const activationCmd = program.command('activation');
|
|
147
|
-
registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
148
|
-
|
|
149
|
-
// Commander should throw on missing required option
|
|
150
|
-
await expect(
|
|
151
|
-
program.parseAsync(['node', 'pd', 'activation', 'deactivate', '--json']),
|
|
152
|
-
).rejects.toThrow(/activation-id/);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('defaults --json to undefined when not passed', async () => {
|
|
156
|
-
const program = freshProgram();
|
|
157
|
-
const activationCmd = program.command('activation');
|
|
158
|
-
const deactivateCmd = registerRuntimeActivationDeactivateCommand(activationCmd);
|
|
159
|
-
const captured: CapturedAction = { opts: null };
|
|
160
|
-
attachCapture(deactivateCmd, captured);
|
|
161
|
-
|
|
162
|
-
await program.parseAsync(['node', 'pd', 'activation', 'deactivate', '--activation-id', 'act-1']);
|
|
163
|
-
|
|
164
|
-
expect(captured.opts).not.toBeNull();
|
|
165
|
-
expect(captured.opts?.json).toBeUndefined();
|
|
166
|
-
});
|
|
167
|
-
});
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parser-level tests for `pd runtime activation dispatch` flags (CLI gate rule 7).
|
|
3
|
-
*
|
|
4
|
-
* Mirrors `runtime-activation-promote-flag-wiring.test.ts`. Exercises the real
|
|
5
|
-
* `registerRuntimeActivationDispatchCommand` helper (single source of truth
|
|
6
|
-
* shared with `index.ts`). Flag typos in production surface here at
|
|
7
|
-
* parseAsync time, not at handler dispatch.
|
|
8
|
-
*
|
|
9
|
-
* Covers:
|
|
10
|
-
* - --dry-run and --confirm are registered
|
|
11
|
-
* - --json is registered
|
|
12
|
-
* - --artifact-id / -a, --workspace / -w, --channel / -c shorthand flags
|
|
13
|
-
* - --channel defaults to 'prompt'
|
|
14
|
-
* - --no-dry-run / --no-confirm are NOT registered (no accidental negation)
|
|
15
|
-
*
|
|
16
|
-
* Handler-level behavior (mutual exclusivity enforcement, missing-artifact
|
|
17
|
-
* refusal, JSON output shape) is covered by runtime-activation.test.ts.
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
import { describe, it, expect } from 'vitest';
|
|
21
|
-
import { Command } from 'commander';
|
|
22
|
-
|
|
23
|
-
import { registerRuntimeActivationDispatchCommand } from '../../src/commands/runtime-activation.js';
|
|
24
|
-
|
|
25
|
-
type ActionOptions = Record<string, unknown>;
|
|
26
|
-
|
|
27
|
-
interface CapturedAction {
|
|
28
|
-
opts: ActionOptions | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function attachCapture(cmd: Command, state: CapturedAction): void {
|
|
32
|
-
cmd.action(function captureAction(...args: unknown[]): void {
|
|
33
|
-
let optsArg: unknown = null;
|
|
34
|
-
for (let i = args.length - 1; i >= 0; i--) {
|
|
35
|
-
const arg: unknown = args[i];
|
|
36
|
-
if (arg !== null && typeof arg === 'object' && !(arg instanceof Command)) {
|
|
37
|
-
optsArg = arg;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (optsArg !== null && typeof optsArg === 'object') {
|
|
42
|
-
state.opts = optsArg as ActionOptions;
|
|
43
|
-
} else {
|
|
44
|
-
state.opts = {};
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function freshProgram(): Command {
|
|
50
|
-
const program = new Command();
|
|
51
|
-
program.name('pd').exitOverride();
|
|
52
|
-
return program;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
describe('pd runtime activation dispatch — flag wiring (CLI gate rule 7)', () => {
|
|
56
|
-
// ── Option metadata ──────────────────────────────────────────────────────
|
|
57
|
-
|
|
58
|
-
it('registers --dry-run flag', () => {
|
|
59
|
-
const program = freshProgram();
|
|
60
|
-
const runtimeCmd = program.command('runtime');
|
|
61
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
62
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
63
|
-
|
|
64
|
-
const opt = dispatchCmd.options.find((o) => o.long === '--dry-run');
|
|
65
|
-
expect(opt).toBeDefined();
|
|
66
|
-
expect(opt?.long).toBe('--dry-run');
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
it('registers --confirm flag', () => {
|
|
70
|
-
const program = freshProgram();
|
|
71
|
-
const runtimeCmd = program.command('runtime');
|
|
72
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
73
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
74
|
-
|
|
75
|
-
const opt = dispatchCmd.options.find((o) => o.long === '--confirm');
|
|
76
|
-
expect(opt).toBeDefined();
|
|
77
|
-
expect(opt?.long).toBe('--confirm');
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
it('registers --json flag', () => {
|
|
81
|
-
const program = freshProgram();
|
|
82
|
-
const runtimeCmd = program.command('runtime');
|
|
83
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
84
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
85
|
-
|
|
86
|
-
const opt = dispatchCmd.options.find((o) => o.long === '--json');
|
|
87
|
-
expect(opt).toBeDefined();
|
|
88
|
-
expect(opt?.long).toBe('--json');
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it('registers -a shorthand for --artifact-id', () => {
|
|
92
|
-
const program = freshProgram();
|
|
93
|
-
const runtimeCmd = program.command('runtime');
|
|
94
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
95
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
96
|
-
|
|
97
|
-
const opt = dispatchCmd.options.find((o) => o.short === '-a');
|
|
98
|
-
expect(opt).toBeDefined();
|
|
99
|
-
expect(opt?.long).toBe('--artifact-id');
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it('registers -w shorthand for --workspace', () => {
|
|
103
|
-
const program = freshProgram();
|
|
104
|
-
const runtimeCmd = program.command('runtime');
|
|
105
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
106
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
107
|
-
|
|
108
|
-
const opt = dispatchCmd.options.find((o) => o.short === '-w');
|
|
109
|
-
expect(opt).toBeDefined();
|
|
110
|
-
expect(opt?.long).toBe('--workspace');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('registers -c shorthand for --channel', () => {
|
|
114
|
-
const program = freshProgram();
|
|
115
|
-
const runtimeCmd = program.command('runtime');
|
|
116
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
117
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
118
|
-
|
|
119
|
-
const opt = dispatchCmd.options.find((o) => o.short === '-c');
|
|
120
|
-
expect(opt).toBeDefined();
|
|
121
|
-
expect(opt?.long).toBe('--channel');
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('does NOT register --no-dry-run (no accidental negation)', () => {
|
|
125
|
-
const program = freshProgram();
|
|
126
|
-
const runtimeCmd = program.command('runtime');
|
|
127
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
128
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
129
|
-
|
|
130
|
-
const noForm = dispatchCmd.options.find((o) => o.long === '--no-dry-run');
|
|
131
|
-
expect(noForm).toBeUndefined();
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it('does NOT register --no-confirm (no accidental negation)', () => {
|
|
135
|
-
const program = freshProgram();
|
|
136
|
-
const runtimeCmd = program.command('runtime');
|
|
137
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
138
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
139
|
-
|
|
140
|
-
const noForm = dispatchCmd.options.find((o) => o.long === '--no-confirm');
|
|
141
|
-
expect(noForm).toBeUndefined();
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
// ── Parser-level tests (program.parseAsync) ───────────────────────────────
|
|
145
|
-
|
|
146
|
-
it('parses --dry-run as true', async () => {
|
|
147
|
-
const program = freshProgram();
|
|
148
|
-
const runtimeCmd = program.command('runtime');
|
|
149
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
150
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
151
|
-
const captured: CapturedAction = { opts: null };
|
|
152
|
-
attachCapture(dispatchCmd, captured);
|
|
153
|
-
|
|
154
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '--dry-run']);
|
|
155
|
-
|
|
156
|
-
expect(captured.opts).not.toBeNull();
|
|
157
|
-
expect(captured.opts?.dryRun).toBe(true);
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
it('parses --confirm as true', async () => {
|
|
161
|
-
const program = freshProgram();
|
|
162
|
-
const runtimeCmd = program.command('runtime');
|
|
163
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
164
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
165
|
-
const captured: CapturedAction = { opts: null };
|
|
166
|
-
attachCapture(dispatchCmd, captured);
|
|
167
|
-
|
|
168
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '--confirm']);
|
|
169
|
-
|
|
170
|
-
expect(captured.opts).not.toBeNull();
|
|
171
|
-
expect(captured.opts?.confirm).toBe(true);
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
it('parses both --dry-run and --confirm (handler enforces mutual exclusivity)', async () => {
|
|
175
|
-
// Commander parses both flags; the handler validates mutual exclusivity.
|
|
176
|
-
// This test proves the parser accepts both — the handler test in
|
|
177
|
-
// runtime-activation.test.ts proves the handler rejects the combination.
|
|
178
|
-
const program = freshProgram();
|
|
179
|
-
const runtimeCmd = program.command('runtime');
|
|
180
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
181
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
182
|
-
const captured: CapturedAction = { opts: null };
|
|
183
|
-
attachCapture(dispatchCmd, captured);
|
|
184
|
-
|
|
185
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '--dry-run', '--confirm']);
|
|
186
|
-
|
|
187
|
-
expect(captured.opts).not.toBeNull();
|
|
188
|
-
expect(captured.opts?.dryRun).toBe(true);
|
|
189
|
-
expect(captured.opts?.confirm).toBe(true);
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
it('defaults --dry-run and --confirm to undefined when neither is passed', async () => {
|
|
193
|
-
const program = freshProgram();
|
|
194
|
-
const runtimeCmd = program.command('runtime');
|
|
195
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
196
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
197
|
-
const captured: CapturedAction = { opts: null };
|
|
198
|
-
attachCapture(dispatchCmd, captured);
|
|
199
|
-
|
|
200
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch']);
|
|
201
|
-
|
|
202
|
-
expect(captured.opts).not.toBeNull();
|
|
203
|
-
expect(captured.opts?.dryRun).toBeUndefined();
|
|
204
|
-
expect(captured.opts?.confirm).toBeUndefined();
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
it('parses --json as true', async () => {
|
|
208
|
-
const program = freshProgram();
|
|
209
|
-
const runtimeCmd = program.command('runtime');
|
|
210
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
211
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
212
|
-
const captured: CapturedAction = { opts: null };
|
|
213
|
-
attachCapture(dispatchCmd, captured);
|
|
214
|
-
|
|
215
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '--json']);
|
|
216
|
-
|
|
217
|
-
expect(captured.opts).not.toBeNull();
|
|
218
|
-
expect(captured.opts?.json).toBe(true);
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
it('parses -a shorthand for --artifact-id', async () => {
|
|
222
|
-
const program = freshProgram();
|
|
223
|
-
const runtimeCmd = program.command('runtime');
|
|
224
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
225
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
226
|
-
const captured: CapturedAction = { opts: null };
|
|
227
|
-
attachCapture(dispatchCmd, captured);
|
|
228
|
-
|
|
229
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '-a', 'art-1']);
|
|
230
|
-
|
|
231
|
-
expect(captured.opts).not.toBeNull();
|
|
232
|
-
expect(captured.opts?.artifactId).toBe('art-1');
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it('parses -w shorthand for --workspace', async () => {
|
|
236
|
-
const program = freshProgram();
|
|
237
|
-
const runtimeCmd = program.command('runtime');
|
|
238
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
239
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
240
|
-
const captured: CapturedAction = { opts: null };
|
|
241
|
-
attachCapture(dispatchCmd, captured);
|
|
242
|
-
|
|
243
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch', '-w', '/tmp/test']);
|
|
244
|
-
|
|
245
|
-
expect(captured.opts).not.toBeNull();
|
|
246
|
-
expect(captured.opts?.workspace).toBe('/tmp/test');
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
it("channel defaults to 'prompt' when not specified", async () => {
|
|
250
|
-
const program = freshProgram();
|
|
251
|
-
const runtimeCmd = program.command('runtime');
|
|
252
|
-
const activationCmd = runtimeCmd.command('activation', { hidden: true });
|
|
253
|
-
const dispatchCmd = registerRuntimeActivationDispatchCommand(activationCmd);
|
|
254
|
-
const captured: CapturedAction = { opts: null };
|
|
255
|
-
attachCapture(dispatchCmd, captured);
|
|
256
|
-
|
|
257
|
-
await program.parseAsync(['node', 'pd', 'runtime', 'activation', 'dispatch']);
|
|
258
|
-
|
|
259
|
-
expect(captured.opts).not.toBeNull();
|
|
260
|
-
expect(captured.opts?.channel).toBe('prompt');
|
|
261
|
-
});
|
|
262
|
-
});
|