@principles/pd-cli 1.130.0 → 1.131.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.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * PRI-466: pd intent — parser-level flag wiring tests.
3
+ *
4
+ * Exercises the real Commander command tree via registerIntentCommand,
5
+ * verifying option metadata and parser-level dispatch (CLI Operator Gate
6
+ * rule 7). No handler logic is invoked — actions are captured.
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=intent-flag-wiring.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-flag-wiring.test.d.ts","sourceRoot":"","sources":["../../../src/commands/__tests__/intent-flag-wiring.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,166 @@
1
+ /**
2
+ * PRI-466: pd intent — parser-level flag wiring tests.
3
+ *
4
+ * Exercises the real Commander command tree via registerIntentCommand,
5
+ * verifying option metadata and parser-level dispatch (CLI Operator Gate
6
+ * rule 7). No handler logic is invoked — actions are captured.
7
+ */
8
+ import { describe, it, expect } from 'vitest';
9
+ import { Command } from 'commander';
10
+ import { registerIntentCommand } from '../intent.js';
11
+ function attachCapture(cmd, state) {
12
+ cmd.action(function captureAction(...args) {
13
+ let optsArg = null;
14
+ for (let i = args.length - 1; i >= 0; i--) {
15
+ const arg = args[i];
16
+ if (arg !== null && typeof arg === 'object' && !(arg instanceof Command)) {
17
+ optsArg = arg;
18
+ break;
19
+ }
20
+ }
21
+ state.opts = optsArg && typeof optsArg === 'object' ? optsArg : {};
22
+ });
23
+ }
24
+ function freshProgram() {
25
+ const program = new Command();
26
+ program.name('pd').exitOverride();
27
+ return program;
28
+ }
29
+ function requireCmd(cmd, name) {
30
+ if (cmd === undefined) {
31
+ throw new Error(`Command '${name}' not found in tree`);
32
+ }
33
+ return cmd;
34
+ }
35
+ describe('pd intent — command registration', () => {
36
+ it('registers "intent" command with "init" and "show" subcommands', () => {
37
+ const program = freshProgram();
38
+ registerIntentCommand(program);
39
+ const intentCmd = requireCmd(program.commands.find((c) => c.name() === 'intent'), 'intent');
40
+ const subNames = intentCmd.commands.map((c) => c.name());
41
+ expect(subNames).toContain('init');
42
+ expect(subNames).toContain('show');
43
+ });
44
+ });
45
+ describe('pd intent init — option metadata', () => {
46
+ it('has --workspace (-w), --force, --dry-run, --confirm, and --json options', () => {
47
+ const program = freshProgram();
48
+ registerIntentCommand(program);
49
+ const intentCmd = requireCmd(program.commands.find((c) => c.name() === 'intent'), 'intent');
50
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
51
+ expect(initCmd.options.find((o) => o.long === '--workspace')).toBeDefined();
52
+ expect(initCmd.options.find((o) => o.long === '--workspace')?.short).toBe('-w');
53
+ expect(initCmd.options.find((o) => o.long === '--force')).toBeDefined();
54
+ expect(initCmd.options.find((o) => o.long === '--dry-run')).toBeDefined();
55
+ expect(initCmd.options.find((o) => o.long === '--confirm')).toBeDefined();
56
+ expect(initCmd.options.find((o) => o.long === '--json')).toBeDefined();
57
+ });
58
+ it('does not register --no-json or --no-force negations', () => {
59
+ const program = freshProgram();
60
+ registerIntentCommand(program);
61
+ const intentCmd = requireCmd(program.commands.find((c) => c.name() === 'intent'), 'intent');
62
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
63
+ const noJson = initCmd.options.find((o) => o.long === '--no-json');
64
+ const noForce = initCmd.options.find((o) => o.long === '--no-force');
65
+ expect(noJson).toBeUndefined();
66
+ expect(noForce).toBeUndefined();
67
+ });
68
+ });
69
+ describe('pd intent show — option metadata', () => {
70
+ it('has --workspace (-w) and --json options, no --force', () => {
71
+ const program = freshProgram();
72
+ registerIntentCommand(program);
73
+ const intentCmd = requireCmd(program.commands.find((c) => c.name() === 'intent'), 'intent');
74
+ const showCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'show'), 'show');
75
+ expect(showCmd.options.find((o) => o.long === '--workspace')).toBeDefined();
76
+ expect(showCmd.options.find((o) => o.long === '--workspace')?.short).toBe('-w');
77
+ expect(showCmd.options.find((o) => o.long === '--json')).toBeDefined();
78
+ expect(showCmd.options.find((o) => o.long === '--force')).toBeUndefined();
79
+ });
80
+ });
81
+ describe('pd intent init — parser-level dispatch', () => {
82
+ it('parses --json as true', async () => {
83
+ const program = freshProgram();
84
+ const intentCmd = registerIntentCommand(program);
85
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
86
+ const captured = { opts: null };
87
+ attachCapture(initCmd, captured);
88
+ await program.parseAsync(['node', 'pd', 'intent', 'init', '--json']);
89
+ expect(captured.opts).not.toBeNull();
90
+ expect(captured.opts?.json).toBe(true);
91
+ });
92
+ it('parses --force as true', async () => {
93
+ const program = freshProgram();
94
+ const intentCmd = registerIntentCommand(program);
95
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
96
+ const captured = { opts: null };
97
+ attachCapture(initCmd, captured);
98
+ await program.parseAsync(['node', 'pd', 'intent', 'init', '--force']);
99
+ expect(captured.opts).not.toBeNull();
100
+ expect(captured.opts?.force).toBe(true);
101
+ });
102
+ it('parses -w as --workspace', async () => {
103
+ const program = freshProgram();
104
+ const intentCmd = registerIntentCommand(program);
105
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
106
+ const captured = { opts: null };
107
+ attachCapture(initCmd, captured);
108
+ await program.parseAsync(['node', 'pd', 'intent', 'init', '-w', '/tmp/ws']);
109
+ expect(captured.opts).not.toBeNull();
110
+ expect(captured.opts?.workspace).toBe('/tmp/ws');
111
+ });
112
+ it('defaults json and force to undefined when not passed', async () => {
113
+ const program = freshProgram();
114
+ const intentCmd = registerIntentCommand(program);
115
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
116
+ const captured = { opts: null };
117
+ attachCapture(initCmd, captured);
118
+ await program.parseAsync(['node', 'pd', 'intent', 'init']);
119
+ expect(captured.opts).not.toBeNull();
120
+ expect(captured.opts?.json).toBeUndefined();
121
+ expect(captured.opts?.force).toBeUndefined();
122
+ });
123
+ it('parses --dry-run as true', async () => {
124
+ const program = freshProgram();
125
+ const intentCmd = registerIntentCommand(program);
126
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
127
+ const captured = { opts: null };
128
+ attachCapture(initCmd, captured);
129
+ await program.parseAsync(['node', 'pd', 'intent', 'init', '--dry-run']);
130
+ expect(captured.opts).not.toBeNull();
131
+ expect(captured.opts?.dryRun).toBe(true);
132
+ });
133
+ it('parses --confirm as true', async () => {
134
+ const program = freshProgram();
135
+ const intentCmd = registerIntentCommand(program);
136
+ const initCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'init'), 'init');
137
+ const captured = { opts: null };
138
+ attachCapture(initCmd, captured);
139
+ await program.parseAsync(['node', 'pd', 'intent', 'init', '--confirm']);
140
+ expect(captured.opts).not.toBeNull();
141
+ expect(captured.opts?.confirm).toBe(true);
142
+ });
143
+ });
144
+ describe('pd intent show — parser-level dispatch', () => {
145
+ it('parses --json as true', async () => {
146
+ const program = freshProgram();
147
+ const intentCmd = registerIntentCommand(program);
148
+ const showCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'show'), 'show');
149
+ const captured = { opts: null };
150
+ attachCapture(showCmd, captured);
151
+ await program.parseAsync(['node', 'pd', 'intent', 'show', '--json']);
152
+ expect(captured.opts).not.toBeNull();
153
+ expect(captured.opts?.json).toBe(true);
154
+ });
155
+ it('parses -w as --workspace', async () => {
156
+ const program = freshProgram();
157
+ const intentCmd = registerIntentCommand(program);
158
+ const showCmd = requireCmd(intentCmd.commands.find((c) => c.name() === 'show'), 'show');
159
+ const captured = { opts: null };
160
+ attachCapture(showCmd, captured);
161
+ await program.parseAsync(['node', 'pd', 'intent', 'show', '-w', '/tmp/ws']);
162
+ expect(captured.opts).not.toBeNull();
163
+ expect(captured.opts?.workspace).toBe('/tmp/ws');
164
+ });
165
+ });
166
+ //# sourceMappingURL=intent-flag-wiring.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-flag-wiring.test.js","sourceRoot":"","sources":["../../../src/commands/__tests__/intent-flag-wiring.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAOrD,SAAS,aAAa,CAAC,GAAY,EAAE,KAAqB;IACxD,GAAG,CAAC,MAAM,CAAC,SAAS,aAAa,CAAC,GAAG,IAAe;QAClD,IAAI,OAAO,GAAY,IAAI,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YACpB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAC,GAAG,YAAY,OAAO,CAAC,EAAE,CAAC;gBACzE,OAAO,GAAG,GAAG,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,GAAG,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAE,OAAyB,CAAC,CAAC,CAAC,EAAE,CAAC;IACxF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,YAAY;IACnB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,UAAU,CAAC,GAAwB,EAAE,IAAY;IACxD,IAAI,GAAG,KAAK,SAAS,EAAE,CA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,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QACxF,MAAM,QAAQ,GAAmB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAChD,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAEjC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;QAC5E,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * pd intent — Owner-authored INTENT.md management (PRI-466).
3
+ *
4
+ * Subcommands:
5
+ * - init : create .principles/INTENT.md from the canonical template
6
+ * - show : display a read-only summary of INTENT.md (sections, hash, warnings)
7
+ *
8
+ * `init` is not gated by the intent_engineering flag — the Owner can
9
+ * initialise the intent doc at any time. `show` IS gated: flag-off returns
10
+ * a structured `flag_disabled` result without touching the filesystem,
11
+ * matching the Console backend contract.
12
+ *
13
+ * JSON mode is strict: --json outputs exactly one parseable JSON object on
14
+ * stdout (CLI Operator Gate rule 1). Failure paths include structured
15
+ * reason + nextAction (rule 6).
16
+ *
17
+ * ERR refs:
18
+ * - ERR-001 (no any): all types explicit
19
+ * - ERR-005 (no as bypass): no type casts on untrusted data
20
+ * - ERR-002 (graceful degradation with reason): all failure paths include
21
+ * reason + nextAction
22
+ * - ERR-009 (fail loud): missing file / flag-off surfaced explicitly
23
+ */
24
+ import type { Command } from 'commander';
25
+ import type { IntentDocWarning } from '@principles/core/runtime-v2';
26
+ export interface IntentInitOutput {
27
+ status: 'ok' | 'skipped' | 'dry_run' | 'read_error';
28
+ path: string;
29
+ overwritten: boolean;
30
+ reason?: string;
31
+ nextAction?: string;
32
+ }
33
+ export interface IntentShowOutput {
34
+ status: 'ok' | 'flag_disabled' | 'not_found' | 'oversized' | 'read_error';
35
+ flagEnabled: boolean;
36
+ found: boolean;
37
+ path?: string;
38
+ contentHash?: string;
39
+ lastEditedAt?: string;
40
+ sections?: Record<string, string>;
41
+ warnings: IntentDocWarning[];
42
+ reason?: string;
43
+ nextAction?: string;
44
+ }
45
+ export interface IntentInitOptions {
46
+ workspace?: string;
47
+ force?: boolean;
48
+ json?: boolean;
49
+ dryRun?: boolean;
50
+ confirm?: boolean;
51
+ }
52
+ export declare function handleIntentInit(opts: IntentInitOptions): Promise<void>;
53
+ export interface IntentShowOptions {
54
+ workspace?: string;
55
+ json?: boolean;
56
+ }
57
+ export declare function handleIntentShow(opts: IntentShowOptions): Promise<void>;
58
+ export declare function registerIntentCommand(parentCmd: Command): Command;
59
+ //# sourceMappingURL=intent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.d.ts","sourceRoot":"","sources":["../../src/commands/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,OAAO,KAAK,EAAqB,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAYvF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,IAAI,GAAG,eAAe,GAAG,WAAW,GAAG,WAAW,GAAG,YAAY,CAAC;IAC1E,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AA4CD,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2G7E;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmH7E;AAID,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,OAAO,GAAG,OAAO,CAoCjE"}
@@ -0,0 +1,350 @@
1
+ /**
2
+ * pd intent — Owner-authored INTENT.md management (PRI-466).
3
+ *
4
+ * Subcommands:
5
+ * - init : create .principles/INTENT.md from the canonical template
6
+ * - show : display a read-only summary of INTENT.md (sections, hash, warnings)
7
+ *
8
+ * `init` is not gated by the intent_engineering flag — the Owner can
9
+ * initialise the intent doc at any time. `show` IS gated: flag-off returns
10
+ * a structured `flag_disabled` result without touching the filesystem,
11
+ * matching the Console backend contract.
12
+ *
13
+ * JSON mode is strict: --json outputs exactly one parseable JSON object on
14
+ * stdout (CLI Operator Gate rule 1). Failure paths include structured
15
+ * reason + nextAction (rule 6).
16
+ *
17
+ * ERR refs:
18
+ * - ERR-001 (no any): all types explicit
19
+ * - ERR-005 (no as bypass): no type casts on untrusted data
20
+ * - ERR-002 (graceful degradation with reason): all failure paths include
21
+ * reason + nextAction
22
+ * - ERR-009 (fail loud): missing file / flag-off surfaced explicitly
23
+ */
24
+ import * as fs from 'node:fs';
25
+ import * as path from 'node:path';
26
+ import { INTENT_MAX_BYTES, INTENT_DOC_TEMPLATE, parseIntentDocSections, computeIntentContentHash, validateIntentDocSections, isFeatureEnabled, } from '@principles/core/runtime-v2';
27
+ import { resolveWorkspaceDir } from '../resolve-workspace.js';
28
+ import { loadPdConfig, computeFlagsFromLoadResult } from '../services/pd-config-loader.js';
29
+ import { emitResult } from '../services/cli-output.js';
30
+ // ── Constants ────────────────────────────────────────────────────────────────
31
+ const INTENT_DIR = '.principles';
32
+ const INTENT_FILENAME = 'INTENT.md';
33
+ // ── Helpers ──────────────────────────────────────────────────────────────────
34
+ function getIntentFilePath(workspaceDir) {
35
+ return path.join(workspaceDir, INTENT_DIR, INTENT_FILENAME);
36
+ }
37
+ function sectionsToRecord(sections) {
38
+ const record = {};
39
+ if (sections.why !== undefined) {
40
+ record.why = sections.why;
41
+ }
42
+ if (sections.desiredOutcome !== undefined) {
43
+ record.desiredOutcome = sections.desiredOutcome;
44
+ }
45
+ if (sections.nonNegotiables !== undefined) {
46
+ record.nonNegotiables = sections.nonNegotiables;
47
+ }
48
+ if (sections.stopEscalation !== undefined) {
49
+ record.stopEscalation = sections.stopEscalation;
50
+ }
51
+ if (sections.currentStrategicFocus !== undefined) {
52
+ record.currentStrategicFocus = sections.currentStrategicFocus;
53
+ }
54
+ return record;
55
+ }
56
+ function formatIntentShowText(o) {
57
+ const lines = [];
58
+ lines.push(`INTENT.md — ${o.path}`);
59
+ lines.push(`Content hash: ${o.contentHash}`);
60
+ lines.push(`Last edited: ${o.lastEditedAt}`);
61
+ lines.push('');
62
+ if (o.sections) {
63
+ if (o.sections.why) {
64
+ lines.push('## 1. Why');
65
+ lines.push(o.sections.why);
66
+ lines.push('');
67
+ }
68
+ if (o.sections.desiredOutcome) {
69
+ lines.push('## 2. Desired Outcome');
70
+ lines.push(o.sections.desiredOutcome);
71
+ lines.push('');
72
+ }
73
+ if (o.sections.nonNegotiables) {
74
+ lines.push('## 3. Non-negotiables');
75
+ lines.push(o.sections.nonNegotiables);
76
+ lines.push('');
77
+ }
78
+ if (o.sections.stopEscalation) {
79
+ lines.push('## 4. Stop / Escalation');
80
+ lines.push(o.sections.stopEscalation);
81
+ lines.push('');
82
+ }
83
+ if (o.sections.currentStrategicFocus) {
84
+ lines.push('## 5. Current Strategic Focus');
85
+ lines.push(o.sections.currentStrategicFocus);
86
+ lines.push('');
87
+ }
88
+ }
89
+ if (o.warnings.length > 0) {
90
+ lines.push('Warnings:');
91
+ for (const w of o.warnings) {
92
+ lines.push(` [${w.code}] ${w.message}`);
93
+ }
94
+ }
95
+ else {
96
+ lines.push('No warnings.');
97
+ }
98
+ return lines.join('\n');
99
+ }
100
+ export async function handleIntentInit(opts) {
101
+ // CLI Gate rule 4: --dry-run and --confirm must be mutually exclusive.
102
+ if (opts.dryRun && opts.confirm) {
103
+ const output = {
104
+ status: 'skipped',
105
+ path: '',
106
+ overwritten: false,
107
+ reason: 'flag_conflict',
108
+ nextAction: 'Use either --dry-run or --confirm, not both.',
109
+ };
110
+ emitResult(output, {
111
+ json: opts.json ?? false,
112
+ formatText: (o) => `Error: ${o.reason}\n→ ${o.nextAction}`,
113
+ });
114
+ process.exitCode = 1;
115
+ return;
116
+ }
117
+ // CLI Gate rule 6: workspace resolution inside try/catch so failures emit
118
+ // structured JSON with reason + nextAction instead of an uncaught stack trace.
119
+ let workspaceDir;
120
+ let filePath;
121
+ let dir;
122
+ try {
123
+ workspaceDir = resolveWorkspaceDir(opts.workspace);
124
+ filePath = getIntentFilePath(workspaceDir);
125
+ dir = path.dirname(filePath);
126
+ }
127
+ catch (err) {
128
+ const reason = err instanceof Error ? err.message : String(err);
129
+ const output = {
130
+ status: 'read_error',
131
+ path: '',
132
+ overwritten: false,
133
+ reason,
134
+ nextAction: 'Provide a valid --workspace <path> argument.',
135
+ };
136
+ emitResult(output, {
137
+ json: opts.json ?? false,
138
+ formatText: (o) => `Error: ${o.reason}\n→ ${o.nextAction}`,
139
+ });
140
+ process.exitCode = 1;
141
+ return;
142
+ }
143
+ // CLI Gate rule 4: state-mutating command defaults to dry-run unless --confirm.
144
+ const isDryRun = opts.dryRun === true || opts.confirm !== true;
145
+ try {
146
+ if (fs.existsSync(filePath) && !opts.force) {
147
+ const output = {
148
+ status: 'skipped',
149
+ path: filePath,
150
+ overwritten: false,
151
+ reason: 'file_exists',
152
+ nextAction: `Use --force to overwrite: pd intent init --force --confirm --workspace "${workspaceDir}"`,
153
+ };
154
+ emitResult(output, {
155
+ json: opts.json ?? false,
156
+ formatText: (o) => `INTENT.md already exists at ${o.path}\n→ ${o.nextAction}`,
157
+ });
158
+ process.exitCode = 1;
159
+ return;
160
+ }
161
+ if (isDryRun) {
162
+ const output = {
163
+ status: 'dry_run',
164
+ path: filePath,
165
+ overwritten: opts.force === true,
166
+ reason: 'dry_run',
167
+ nextAction: `Confirm write: pd intent init --confirm${opts.force ? ' --force' : ''} --workspace "${workspaceDir}"`,
168
+ };
169
+ emitResult(output, {
170
+ json: opts.json ?? false,
171
+ formatText: (o) => `[dry-run] Would create INTENT.md at ${o.path}${o.overwritten ? ' (overwritten)' : ''}\n→ ${o.nextAction}`,
172
+ });
173
+ return;
174
+ }
175
+ fs.mkdirSync(dir, { recursive: true });
176
+ fs.writeFileSync(filePath, INTENT_DOC_TEMPLATE, 'utf8');
177
+ const output = {
178
+ status: 'ok',
179
+ path: filePath,
180
+ overwritten: opts.force === true,
181
+ };
182
+ emitResult(output, {
183
+ json: opts.json ?? false,
184
+ formatText: (o) => `Created INTENT.md at ${o.path}${o.overwritten ? ' (overwritten)' : ''}\nNext: edit the file to declare your project intent, then run "pd intent show".`,
185
+ });
186
+ }
187
+ catch (err) {
188
+ const reason = err instanceof Error ? err.message : String(err);
189
+ // CLI Gate rule 1: route through emitResult for consistent IntentInitOutput shape.
190
+ const output = {
191
+ status: 'read_error',
192
+ path: filePath,
193
+ overwritten: false,
194
+ reason,
195
+ nextAction: `Check filesystem permissions for ${filePath}`,
196
+ };
197
+ emitResult(output, {
198
+ json: opts.json ?? false,
199
+ formatText: (o) => `Error: ${o.reason}\n→ ${o.nextAction}`,
200
+ });
201
+ process.exitCode = 1;
202
+ }
203
+ }
204
+ export async function handleIntentShow(opts) {
205
+ // CLI Gate rule 6: workspace resolution inside try/catch for structured errors.
206
+ let workspaceDir;
207
+ try {
208
+ workspaceDir = resolveWorkspaceDir(opts.workspace);
209
+ }
210
+ catch (err) {
211
+ const reason = err instanceof Error ? err.message : String(err);
212
+ const output = {
213
+ status: 'read_error',
214
+ flagEnabled: false,
215
+ found: false,
216
+ warnings: [],
217
+ reason,
218
+ nextAction: 'Provide a valid --workspace <path> argument.',
219
+ };
220
+ emitResult(output, {
221
+ json: opts.json ?? false,
222
+ formatText: (o) => `Error: ${o.reason}\n→ ${o.nextAction}`,
223
+ });
224
+ process.exitCode = 1;
225
+ return;
226
+ }
227
+ // Flag check — flag-off short-circuits without fs access
228
+ const configResult = loadPdConfig(workspaceDir);
229
+ const flagsResult = computeFlagsFromLoadResult(configResult);
230
+ const flagEnabled = isFeatureEnabled(flagsResult, 'intent_engineering');
231
+ if (!flagEnabled) {
232
+ const output = {
233
+ status: 'flag_disabled',
234
+ flagEnabled: false,
235
+ found: false,
236
+ warnings: [],
237
+ reason: 'flag_disabled',
238
+ nextAction: 'Enable the intent_engineering feature flag in .pd/config.yaml to read INTENT.md.',
239
+ };
240
+ emitResult(output, {
241
+ json: opts.json ?? false,
242
+ formatText: (o) => `Intent Engineering is disabled (flag off).\n→ ${o.nextAction}`,
243
+ });
244
+ return;
245
+ }
246
+ const filePath = getIntentFilePath(workspaceDir);
247
+ try {
248
+ if (!fs.existsSync(filePath)) {
249
+ const output = {
250
+ status: 'not_found',
251
+ flagEnabled: true,
252
+ found: false,
253
+ warnings: [],
254
+ reason: 'not_found',
255
+ nextAction: `Create INTENT.md: pd intent init --workspace "${workspaceDir}"`,
256
+ };
257
+ emitResult(output, {
258
+ json: opts.json ?? false,
259
+ formatText: (o) => `INTENT.md not found.\n→ ${o.nextAction}`,
260
+ });
261
+ return;
262
+ }
263
+ const stat = fs.statSync(filePath);
264
+ if (stat.size > INTENT_MAX_BYTES) {
265
+ const output = {
266
+ status: 'oversized',
267
+ flagEnabled: true,
268
+ found: true,
269
+ warnings: [],
270
+ reason: 'oversized',
271
+ nextAction: `INTENT.md exceeds ${INTENT_MAX_BYTES} bytes (${stat.size} bytes). Reduce content.`,
272
+ };
273
+ emitResult(output, {
274
+ json: opts.json ?? false,
275
+ formatText: (o) => `INTENT.md is too large.\n→ ${o.nextAction}`,
276
+ });
277
+ return;
278
+ }
279
+ const raw = fs.readFileSync(filePath, 'utf8');
280
+ const sections = parseIntentDocSections(raw);
281
+ const warnings = validateIntentDocSections(sections);
282
+ const contentHash = computeIntentContentHash(raw);
283
+ const output = {
284
+ status: 'ok',
285
+ flagEnabled: true,
286
+ found: true,
287
+ path: filePath,
288
+ contentHash,
289
+ lastEditedAt: stat.mtime.toISOString(),
290
+ sections: sectionsToRecord(sections),
291
+ warnings,
292
+ };
293
+ emitResult(output, {
294
+ json: opts.json ?? false,
295
+ formatText: (o) => formatIntentShowText(o),
296
+ });
297
+ }
298
+ catch (err) {
299
+ const reason = err instanceof Error ? err.message : String(err);
300
+ const output = {
301
+ status: 'read_error',
302
+ flagEnabled: true,
303
+ found: false,
304
+ warnings: [],
305
+ reason,
306
+ nextAction: `Check filesystem permissions for ${filePath}`,
307
+ };
308
+ emitResult(output, {
309
+ json: opts.json ?? false,
310
+ formatText: (o) => `Error reading INTENT.md: ${o.reason}\n→ ${o.nextAction}`,
311
+ });
312
+ process.exitCode = 1;
313
+ }
314
+ }
315
+ // ── Command registration ─────────────────────────────────────────────────────
316
+ export function registerIntentCommand(parentCmd) {
317
+ const intentCmd = parentCmd
318
+ .command('intent')
319
+ .description('Owner-authored INTENT.md management (init, show)');
320
+ intentCmd
321
+ .command('init')
322
+ .description('Create .principles/INTENT.md from the canonical template')
323
+ .option('-w, --workspace <path>', 'Workspace directory')
324
+ .option('--force', 'Overwrite existing INTENT.md')
325
+ .option('--dry-run', 'Show what would happen without writing (default)')
326
+ .option('--confirm', 'Actually write the file (required to create INTENT.md)')
327
+ .option('--json', 'Output raw JSON')
328
+ .action(async (opts) => {
329
+ await handleIntentInit({
330
+ workspace: opts.workspace,
331
+ force: opts.force === true,
332
+ json: opts.json === true,
333
+ dryRun: opts.dryRun === true,
334
+ confirm: opts.confirm === true,
335
+ });
336
+ });
337
+ intentCmd
338
+ .command('show')
339
+ .description('Display a read-only summary of INTENT.md (sections, hash, warnings)')
340
+ .option('-w, --workspace <path>', 'Workspace directory')
341
+ .option('--json', 'Output raw JSON')
342
+ .action(async (opts) => {
343
+ await handleIntentShow({
344
+ workspace: opts.workspace,
345
+ json: opts.json === true,
346
+ });
347
+ });
348
+ return intentCmd;
349
+ }
350
+ //# sourceMappingURL=intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent.js","sourceRoot":"","sources":["../../src/commands/intent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,gBAAgB,GACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO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AAE,qBAAqB,CAAC;SACvD,MAAM,CAAC,SAAS,EAAE,8BAA8B,CAAC;SACjD,MAAM,CAAC,WAAW,EAAE,kDAAkD,CAAC;SACvE,MAAM,CAAC,WAAW,EAAE,wDAAwD,CAAC;SAC7E,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,gBAAgB,CAAC;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,KAAK,EAAE,IAAI,CAAC,KAAK,KAAK,IAAI;YAC1B,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;YACxB,MAAM,EAAE,IAAI,CAAC,MAAM,KAAK,IAAI;YAC5B,OAAO,EAAE,IAAI,CAAC,OAAO,KAAK,IAAI;SAC/B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,SAAS;SACN,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,wBAAwB,EAAE,qBAAqB,CAAC;SACvD,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;SACnC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,MAAM,gBAAgB,CAAC;YACrB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,IAAI;SACzB,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEL,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/index.js CHANGED
@@ -52,6 +52,7 @@ import { handleRuntimeFeaturesStatus } from './commands/runtime-features.js';
52
52
  import { handleConfigDoctor } from './commands/config-doctor.js';
53
53
  import { registerMvpCommands } from './commands/mvp-smoke.js';
54
54
  import { registerRulecodeCommand } from './commands/rulecode.js';
55
+ import { registerIntentCommand } from './commands/intent.js';
55
56
  import { createRequire } from 'module';
56
57
  const require = createRequire(import.meta.url);
57
58
  const pkg = require('../package.json');
@@ -862,6 +863,9 @@ registerMvpCommands(program);
862
863
  // ─── RuleCode CLI (PRI-439 Phase 5) ─────────────────────────────────────────
863
864
  // Read-only commands: spec, validate, replay. No DB mutation, no artifact writes.
864
865
  registerRulecodeCommand(program);
866
+ // ─── Intent Engineering (PRI-466) ───────────────────────────────────────────
867
+ // Owner-authored INTENT.md management: init (create), show (read-only summary).
868
+ registerIntentCommand(program);
865
869
  const consoleCmd = program
866
870
  .command('console')
867
871
  .description('Start the pd-console web UI for principle review (default: fallback launcher)')