@deftai/directive 0.58.0 → 0.60.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/change-init.d.ts +3 -0
- package/dist/change-init.js +59 -0
- package/dist/changelog-check.d.ts +3 -0
- package/dist/changelog-check.js +44 -0
- package/dist/cli-router/index.js +4 -1
- package/dist/cli-router/route-argv.js +2 -2
- package/dist/commit-lint.d.ts +3 -0
- package/dist/commit-lint.js +44 -0
- package/dist/dispatch.d.ts +63 -2
- package/dist/dispatch.js +1560 -22
- package/dist/doc-cli-parity.js +1 -1
- package/dist/doctor-parity.d.ts +5 -1
- package/dist/doctor-parity.js +10 -4
- package/dist/doctor.js +11 -0
- package/dist/install-cli/coverage-map.js +3 -2
- package/dist/install-uninstall.d.ts +3 -0
- package/dist/install-uninstall.js +44 -0
- package/dist/install-upgrade.d.ts +9 -0
- package/dist/install-upgrade.js +67 -0
- package/dist/migrate-preflight.d.ts +10 -0
- package/dist/migrate-preflight.js +84 -0
- package/dist/orchestration-cli/coverage-map.js +1 -1
- package/dist/session-start.d.ts +13 -0
- package/dist/session-start.js +111 -0
- package/dist/toolchain-check.d.ts +1 -1
- package/dist/toolchain-check.js +3 -2
- package/package.json +3 -3
package/dist/doc-cli-parity.js
CHANGED
|
@@ -15,7 +15,7 @@ import { registeredVerbs, resolveCanonicalVerb, VERB_ALIASES } from "./dispatch.
|
|
|
15
15
|
export const LEGACY_DOC_VERB_KEYS = new Set(["setup", "upgrade", "relocate"]);
|
|
16
16
|
const CLI_PREFIX_RE = /^(?:directive|deft|npx @deftai\/directive)\s+/;
|
|
17
17
|
const BACKTICK_COMMAND_RE = /`((?:directive|deft|npx @deftai\/directive)\s+[^`]+)`/g;
|
|
18
|
-
const TOP_LEVEL_UX = new Set(["init", "update", "migrate"]);
|
|
18
|
+
const TOP_LEVEL_UX = new Set(["init", "update", "migrate", "bootstrap"]);
|
|
19
19
|
function repoRootFromModule() {
|
|
20
20
|
return resolve(import.meta.dirname, "..", "..", "..");
|
|
21
21
|
}
|
package/dist/doctor-parity.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface ParityScenario {
|
|
|
11
11
|
readonly cwd?: string;
|
|
12
12
|
readonly env?: Record<string, string | undefined>;
|
|
13
13
|
readonly setup?: (root: string) => void;
|
|
14
|
+
/** When true, stdout may diverge (TS-only consumer probes post #2022 Phase 3). */
|
|
15
|
+
readonly exitCodeOnly?: boolean;
|
|
14
16
|
}
|
|
15
17
|
export interface ParityResult {
|
|
16
18
|
readonly ok: boolean;
|
|
@@ -27,7 +29,9 @@ export interface ParityResult {
|
|
|
27
29
|
export declare const PARITY_SCENARIOS: readonly ParityScenario[];
|
|
28
30
|
/** Normalise volatile lines while preserving doctor semantics. */
|
|
29
31
|
export declare function normaliseStdout(text: string): string;
|
|
30
|
-
export declare function diffParity(python: ScenarioResult, ts: ScenarioResult
|
|
32
|
+
export declare function diffParity(python: ScenarioResult, ts: ScenarioResult, options?: {
|
|
33
|
+
exitCodeOnly?: boolean;
|
|
34
|
+
}): {
|
|
31
35
|
exitMismatch: boolean;
|
|
32
36
|
stdoutMismatch: boolean;
|
|
33
37
|
pythonStdout: string;
|
package/dist/doctor-parity.js
CHANGED
|
@@ -18,6 +18,7 @@ export const PARITY_SCENARIOS = [
|
|
|
18
18
|
{
|
|
19
19
|
name: "full-json-consumer-fixture",
|
|
20
20
|
argv: ["--full", "--json"],
|
|
21
|
+
exitCodeOnly: true,
|
|
21
22
|
setup(root) {
|
|
22
23
|
writeFileSync(join(root, "AGENTS.md"), "<!-- deft:managed-section v3 -->\nbody\n<!-- /deft:managed-section -->\n", "utf8");
|
|
23
24
|
mkdirSync(join(root, ".deft", "core"), { recursive: true });
|
|
@@ -59,7 +60,12 @@ export function normaliseStdout(text) {
|
|
|
59
60
|
.split("\n")
|
|
60
61
|
.filter((line) => !line.startsWith("Using CPython") &&
|
|
61
62
|
!line.startsWith("Creating virtual environment") &&
|
|
62
|
-
!line.startsWith("Installed ")
|
|
63
|
+
!line.startsWith("Installed ") &&
|
|
64
|
+
// #2022: the TS doctor emits a pre-cutover status line that the Python
|
|
65
|
+
// oracle (scripts/doctor.py) never had ("without a Python port"). Filter
|
|
66
|
+
// it so this intentional TS-only addition does not register as parity
|
|
67
|
+
// divergence. Removed when scripts/doctor.py is purged with the gate.
|
|
68
|
+
!line.startsWith("Pre-cutover:"))
|
|
63
69
|
.join("\n");
|
|
64
70
|
}
|
|
65
71
|
function runScenario(deftRoot, scenario) {
|
|
@@ -88,12 +94,12 @@ function runScenario(deftRoot, scenario) {
|
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
|
-
export function diffParity(python, ts) {
|
|
97
|
+
export function diffParity(python, ts, options = {}) {
|
|
92
98
|
const pythonStdout = normaliseStdout(python.stdout);
|
|
93
99
|
const tsStdout = normaliseStdout(ts.stdout);
|
|
94
100
|
return {
|
|
95
101
|
exitMismatch: python.exitCode !== ts.exitCode,
|
|
96
|
-
stdoutMismatch: pythonStdout !== tsStdout,
|
|
102
|
+
stdoutMismatch: options.exitCodeOnly ? false : pythonStdout !== tsStdout,
|
|
97
103
|
pythonStdout,
|
|
98
104
|
tsStdout,
|
|
99
105
|
};
|
|
@@ -107,7 +113,7 @@ export function runParity() {
|
|
|
107
113
|
name: scenario.name,
|
|
108
114
|
pythonExit: ran.python.exitCode,
|
|
109
115
|
tsExit: ran.ts.exitCode,
|
|
110
|
-
...diffParity(ran.python, ran.ts),
|
|
116
|
+
...diffParity(ran.python, ran.ts, { exitCodeOnly: scenario.exitCodeOnly }),
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
119
|
const ok = scenarios.every((s) => !s.exitMismatch && !s.stdoutMismatch);
|
package/dist/doctor.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { parseDoctorFlags } from "@deftai/directive-core/dist/doctor/flags.js";
|
|
3
4
|
import { cmdDoctor } from "@deftai/directive-core/dist/doctor/main.js";
|
|
5
|
+
import { renderPrecutoverLine } from "@deftai/directive-core/dist/vbrief-validate/precutover.js";
|
|
4
6
|
export function run(argv) {
|
|
7
|
+
// #2022: surface pre-cutover (pre-v0.20 document model) migration state alongside the
|
|
8
|
+
// core doctor report. Only emit on a valid, human-readable invocation: suppressed under
|
|
9
|
+
// --json (so the machine-readable report stays valid), on --help, and when unknown flags
|
|
10
|
+
// are present (so an invalid invocation still mirrors the core error path exactly).
|
|
11
|
+
const flags = parseDoctorFlags(argv);
|
|
12
|
+
if (!flags.json && !flags.help && flags.unknown.length === 0) {
|
|
13
|
+
const projectRoot = flags.projectRoot ?? process.cwd();
|
|
14
|
+
process.stdout.write(`${renderPrecutoverLine(projectRoot)}\n`);
|
|
15
|
+
}
|
|
5
16
|
return cmdDoctor(argv);
|
|
6
17
|
}
|
|
7
18
|
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
@@ -22,8 +22,9 @@ export const INSTALL_CLI_TAIL_COVERAGE_MAP = [
|
|
|
22
22
|
},
|
|
23
23
|
{
|
|
24
24
|
pythonTest: "tests/cli/test_migrate_preflight.py",
|
|
25
|
-
classification: "
|
|
26
|
-
rationale: "scripts/migrate_preflight.py agent-side migrate:vbrief gate —
|
|
25
|
+
classification: "retarget",
|
|
26
|
+
rationale: "scripts/migrate_preflight.py agent-side migrate:vbrief gate — retargeted to deft-ts migrate-preflight on consumer task path (#2022 Phase 2).",
|
|
27
|
+
vitestSpec: "packages/cli/src/migrate-task-surface.test.ts",
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
30
|
pythonTest: "tests/cli/test_precutover_guard.py",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { runInstallUninstall } from "@deftai/directive-core/task-surface";
|
|
5
|
+
function parseProjectRoot(argv) {
|
|
6
|
+
let projectRoot = ".";
|
|
7
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
8
|
+
const arg = argv[i] ?? "";
|
|
9
|
+
if (arg === "--project-root") {
|
|
10
|
+
const value = argv[i + 1];
|
|
11
|
+
if (value === undefined) {
|
|
12
|
+
return { projectRoot, error: "argument --project-root: expected one argument" };
|
|
13
|
+
}
|
|
14
|
+
projectRoot = value;
|
|
15
|
+
i += 1;
|
|
16
|
+
}
|
|
17
|
+
else if (arg.startsWith("--project-root=")) {
|
|
18
|
+
projectRoot = arg.slice("--project-root=".length);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return { projectRoot, error: `unrecognized argument: ${arg}` };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { projectRoot };
|
|
25
|
+
}
|
|
26
|
+
export function run(argv) {
|
|
27
|
+
const args = parseProjectRoot(argv);
|
|
28
|
+
if (args.error !== undefined) {
|
|
29
|
+
process.stderr.write(`install-uninstall: ${args.error}\n`);
|
|
30
|
+
return 2;
|
|
31
|
+
}
|
|
32
|
+
return runInstallUninstall(resolve(args.projectRoot), {
|
|
33
|
+
writeOut: (text) => {
|
|
34
|
+
process.stdout.write(text);
|
|
35
|
+
},
|
|
36
|
+
writeErr: (text) => {
|
|
37
|
+
process.stderr.write(text);
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
42
|
+
process.exit(run(process.argv.slice(2)));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=install-uninstall.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface ParsedInstallUpgradeArgs {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
frameworkRoot: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseArgs(argv: readonly string[]): ParsedInstallUpgradeArgs;
|
|
8
|
+
export declare function run(argv: readonly string[]): number;
|
|
9
|
+
//# sourceMappingURL=install-upgrade.d.ts.map
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { runInstallUpgrade } from "@deftai/directive-core/install-upgrade";
|
|
5
|
+
export function parseArgs(argv) {
|
|
6
|
+
let projectRoot = ".";
|
|
7
|
+
let frameworkRoot = resolve(import.meta.dirname, "..", "..", "..");
|
|
8
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
9
|
+
const arg = argv[i] ?? "";
|
|
10
|
+
if (arg === "--project-root") {
|
|
11
|
+
const value = argv[i + 1];
|
|
12
|
+
if (value === undefined) {
|
|
13
|
+
return {
|
|
14
|
+
projectRoot,
|
|
15
|
+
frameworkRoot,
|
|
16
|
+
error: "argument --project-root: expected one argument",
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
projectRoot = value;
|
|
20
|
+
i += 1;
|
|
21
|
+
}
|
|
22
|
+
else if (arg.startsWith("--project-root=")) {
|
|
23
|
+
projectRoot = arg.slice("--project-root=".length);
|
|
24
|
+
}
|
|
25
|
+
else if (arg === "--framework-root") {
|
|
26
|
+
const value = argv[i + 1];
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
return {
|
|
29
|
+
projectRoot,
|
|
30
|
+
frameworkRoot,
|
|
31
|
+
error: "argument --framework-root: expected one argument",
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
frameworkRoot = value;
|
|
35
|
+
i += 1;
|
|
36
|
+
}
|
|
37
|
+
else if (arg.startsWith("--framework-root=")) {
|
|
38
|
+
frameworkRoot = arg.slice("--framework-root=".length);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return { projectRoot, frameworkRoot, error: `unrecognized argument: ${arg}` };
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (process.env.DEFT_ROOT && process.env.DEFT_ROOT.length > 0) {
|
|
45
|
+
frameworkRoot = process.env.DEFT_ROOT;
|
|
46
|
+
}
|
|
47
|
+
return { projectRoot, frameworkRoot };
|
|
48
|
+
}
|
|
49
|
+
export function run(argv) {
|
|
50
|
+
const args = parseArgs(argv);
|
|
51
|
+
if (args.error !== undefined) {
|
|
52
|
+
process.stderr.write(`install-upgrade: ${args.error}\n`);
|
|
53
|
+
return 2;
|
|
54
|
+
}
|
|
55
|
+
return runInstallUpgrade({ projectRoot: args.projectRoot, frameworkRoot: args.frameworkRoot }, {
|
|
56
|
+
writeOut: (text) => {
|
|
57
|
+
process.stdout.write(text);
|
|
58
|
+
},
|
|
59
|
+
writeErr: (text) => {
|
|
60
|
+
process.stderr.write(text);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
65
|
+
process.exit(run(process.argv.slice(2)));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=install-upgrade.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface ParsedMigratePreflightArgs {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
deftRoot: string;
|
|
5
|
+
quiet: boolean;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseArgs(argv: readonly string[]): ParsedMigratePreflightArgs;
|
|
9
|
+
export declare function run(argv: readonly string[]): number;
|
|
10
|
+
//# sourceMappingURL=migrate-preflight.d.ts.map
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { emitMigratePreflight, runMigratePreflight, } from "@deftai/directive-core/migrate-preflight";
|
|
5
|
+
export function parseArgs(argv) {
|
|
6
|
+
let projectRoot = ".";
|
|
7
|
+
let deftRoot = resolve(import.meta.dirname, "..", "..", "..");
|
|
8
|
+
let quiet = false;
|
|
9
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
10
|
+
const arg = argv[i] ?? "";
|
|
11
|
+
if (arg === "--quiet") {
|
|
12
|
+
quiet = true;
|
|
13
|
+
}
|
|
14
|
+
else if (arg === "--project-root") {
|
|
15
|
+
const value = argv[i + 1];
|
|
16
|
+
if (value === undefined) {
|
|
17
|
+
return {
|
|
18
|
+
projectRoot,
|
|
19
|
+
deftRoot,
|
|
20
|
+
quiet,
|
|
21
|
+
error: "argument --project-root: expected one argument",
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
projectRoot = value;
|
|
25
|
+
i += 1;
|
|
26
|
+
}
|
|
27
|
+
else if (arg.startsWith("--project-root=")) {
|
|
28
|
+
projectRoot = arg.slice("--project-root=".length);
|
|
29
|
+
}
|
|
30
|
+
else if (arg === "--deft-root") {
|
|
31
|
+
const value = argv[i + 1];
|
|
32
|
+
if (value === undefined) {
|
|
33
|
+
return {
|
|
34
|
+
projectRoot,
|
|
35
|
+
deftRoot,
|
|
36
|
+
quiet,
|
|
37
|
+
error: "argument --deft-root: expected one argument",
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
deftRoot = value;
|
|
41
|
+
i += 1;
|
|
42
|
+
}
|
|
43
|
+
else if (arg.startsWith("--deft-root=")) {
|
|
44
|
+
deftRoot = arg.slice("--deft-root=".length);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
return { projectRoot, deftRoot, quiet, error: `unrecognized argument: ${arg}` };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (process.env.DEFT_ROOT &&
|
|
51
|
+
process.env.DEFT_ROOT.length > 0 &&
|
|
52
|
+
!argv.some((a) => a.startsWith("--deft-root"))) {
|
|
53
|
+
deftRoot = process.env.DEFT_ROOT;
|
|
54
|
+
}
|
|
55
|
+
return { projectRoot, deftRoot, quiet };
|
|
56
|
+
}
|
|
57
|
+
export function run(argv) {
|
|
58
|
+
const args = parseArgs(argv);
|
|
59
|
+
if (args.error !== undefined) {
|
|
60
|
+
process.stderr.write(`migrate-preflight: ${args.error}\n`);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
const outcome = runMigratePreflight({
|
|
64
|
+
projectRoot: args.projectRoot,
|
|
65
|
+
deftRoot: args.deftRoot,
|
|
66
|
+
quiet: args.quiet,
|
|
67
|
+
});
|
|
68
|
+
if (outcome.kind === "config") {
|
|
69
|
+
process.stderr.write(`migrate-preflight: ${outcome.message}\n`);
|
|
70
|
+
return 2;
|
|
71
|
+
}
|
|
72
|
+
return emitMigratePreflight(outcome, {
|
|
73
|
+
writeOut: (text) => {
|
|
74
|
+
process.stdout.write(text);
|
|
75
|
+
},
|
|
76
|
+
writeErr: (text) => {
|
|
77
|
+
process.stderr.write(text);
|
|
78
|
+
},
|
|
79
|
+
}, args.quiet);
|
|
80
|
+
}
|
|
81
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
82
|
+
process.exit(run(process.argv.slice(2)));
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=migrate-preflight.js.map
|
|
@@ -118,7 +118,7 @@ export const ORCHESTRATION_CLI_COVERAGE_MAP = [
|
|
|
118
118
|
{
|
|
119
119
|
pythonTest: "test_release_subprocess_path.py",
|
|
120
120
|
kind: "existing-coverage",
|
|
121
|
-
tsTarget: "packages/core/src/release/python-
|
|
121
|
+
tsTarget: "packages/core/src/release/python-steps.test.ts",
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
124
|
pythonTest: "test_release_summary.py",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface ParsedSessionStartArgs {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
deferValues: string[];
|
|
5
|
+
emitJson: boolean;
|
|
6
|
+
noHistory: boolean;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Parse session:start CLI args, mirroring scripts/session_start.py. */
|
|
10
|
+
export declare function parseArgs(argv: readonly string[]): ParsedSessionStartArgs;
|
|
11
|
+
/** Native session:start handler (#2032 — replaces framework-commands Python bridge). */
|
|
12
|
+
export declare function run(argv: readonly string[]): number;
|
|
13
|
+
//# sourceMappingURL=session-start.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { parseDeferrals, ritualStatePath, runSessionStart } from "@deftai/directive-core/session";
|
|
5
|
+
/** Parse session:start CLI args, mirroring scripts/session_start.py. */
|
|
6
|
+
export function parseArgs(argv) {
|
|
7
|
+
const parsed = {
|
|
8
|
+
projectRoot: ".",
|
|
9
|
+
deferValues: [],
|
|
10
|
+
emitJson: false,
|
|
11
|
+
noHistory: false,
|
|
12
|
+
};
|
|
13
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
14
|
+
const arg = argv[i];
|
|
15
|
+
if (arg === "--json") {
|
|
16
|
+
parsed.emitJson = true;
|
|
17
|
+
}
|
|
18
|
+
else if (arg === "--no-history") {
|
|
19
|
+
parsed.noHistory = true;
|
|
20
|
+
}
|
|
21
|
+
else if (arg === "--project-root") {
|
|
22
|
+
const value = argv[i + 1];
|
|
23
|
+
if (value === undefined) {
|
|
24
|
+
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
25
|
+
}
|
|
26
|
+
parsed.projectRoot = value;
|
|
27
|
+
i += 1;
|
|
28
|
+
}
|
|
29
|
+
else if (arg?.startsWith("--project-root=")) {
|
|
30
|
+
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
31
|
+
}
|
|
32
|
+
else if (arg === "--defer") {
|
|
33
|
+
const value = argv[i + 1];
|
|
34
|
+
if (value === undefined) {
|
|
35
|
+
return { ...parsed, error: "argument --defer: expected one argument" };
|
|
36
|
+
}
|
|
37
|
+
parsed.deferValues.push(value);
|
|
38
|
+
i += 1;
|
|
39
|
+
}
|
|
40
|
+
else if (arg?.startsWith("--defer=")) {
|
|
41
|
+
parsed.deferValues.push(arg.slice("--defer=".length));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return { ...parsed, error: `unrecognized argument: ${arg}` };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return parsed;
|
|
48
|
+
}
|
|
49
|
+
/** Native session:start handler (#2032 — replaces framework-commands Python bridge). */
|
|
50
|
+
export function run(argv) {
|
|
51
|
+
const args = parseArgs(argv);
|
|
52
|
+
if (args.error !== undefined) {
|
|
53
|
+
process.stderr.write(`session_start: ${args.error}\n`);
|
|
54
|
+
return 2;
|
|
55
|
+
}
|
|
56
|
+
const projectRoot = resolve(args.projectRoot);
|
|
57
|
+
const { deferrals, errors } = parseDeferrals(args.deferValues);
|
|
58
|
+
if (errors.length > 0) {
|
|
59
|
+
for (const error of errors) {
|
|
60
|
+
process.stderr.write(`${error}\n`);
|
|
61
|
+
}
|
|
62
|
+
return 2;
|
|
63
|
+
}
|
|
64
|
+
const capturedStdout = [];
|
|
65
|
+
const prevWrite = process.stdout.write.bind(process.stdout);
|
|
66
|
+
process.stdout.write = ((chunk, encoding, callback) => {
|
|
67
|
+
capturedStdout.push(String(chunk));
|
|
68
|
+
const cb = typeof encoding === "function" ? encoding : callback;
|
|
69
|
+
if (typeof cb === "function") {
|
|
70
|
+
cb();
|
|
71
|
+
}
|
|
72
|
+
return true;
|
|
73
|
+
});
|
|
74
|
+
let result;
|
|
75
|
+
try {
|
|
76
|
+
result = runSessionStart(projectRoot, {
|
|
77
|
+
deferrals,
|
|
78
|
+
writeHistory: !args.noHistory,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
process.stdout.write = prevWrite;
|
|
83
|
+
}
|
|
84
|
+
const lines = [...result.lines];
|
|
85
|
+
const stray = capturedStdout.join("").trim();
|
|
86
|
+
if (stray) {
|
|
87
|
+
lines.push(stray);
|
|
88
|
+
}
|
|
89
|
+
if (args.emitJson) {
|
|
90
|
+
const sorted = Object.keys(result.payload)
|
|
91
|
+
.sort()
|
|
92
|
+
.reduce((acc, key) => {
|
|
93
|
+
acc[key] = result.payload[key];
|
|
94
|
+
return acc;
|
|
95
|
+
}, {});
|
|
96
|
+
process.stdout.write(`${JSON.stringify(sorted)}\n`);
|
|
97
|
+
return result.code;
|
|
98
|
+
}
|
|
99
|
+
const sink = result.code === 0 ? process.stdout : process.stderr;
|
|
100
|
+
for (const line of lines) {
|
|
101
|
+
sink.write(`${line}\n`);
|
|
102
|
+
}
|
|
103
|
+
if (result.code === 0) {
|
|
104
|
+
process.stdout.write(`[deft] session ritual recorded at ${ritualStatePath(projectRoot)}\n`);
|
|
105
|
+
}
|
|
106
|
+
return result.code;
|
|
107
|
+
}
|
|
108
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
109
|
+
process.exit(run(process.argv.slice(2)));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=session-start.js.map
|
package/dist/toolchain-check.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { runToolchainCheck } from "@deftai/directive-core/verify-env";
|
|
4
|
-
export function run() {
|
|
5
|
-
const
|
|
4
|
+
export function run(argv = process.argv.slice(2)) {
|
|
5
|
+
const consumer = argv.includes("--consumer");
|
|
6
|
+
const result = runToolchainCheck(undefined, { consumer });
|
|
6
7
|
for (const line of result.lines) {
|
|
7
8
|
process.stdout.write(`${line}\n`);
|
|
8
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Directive CLI — npm install path for the Deft Directive framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"provenance": true
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@deftai/directive-core": "^0.
|
|
46
|
-
"@deftai/directive-content": "^0.
|
|
45
|
+
"@deftai/directive-core": "^0.60.0",
|
|
46
|
+
"@deftai/directive-content": "^0.60.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc -b"
|