@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.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function run(argv: readonly string[]): number;
3
+ //# sourceMappingURL=change-init.d.ts.map
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { runChangeInit } from "@deftai/directive-core/task-surface";
5
+ function parseArgs(argv) {
6
+ let projectRoot = ".";
7
+ let name = "";
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 { projectRoot, name, error: "argument --project-root: expected one argument" };
14
+ }
15
+ projectRoot = value;
16
+ i += 1;
17
+ }
18
+ else if (arg.startsWith("--project-root=")) {
19
+ projectRoot = arg.slice("--project-root=".length);
20
+ }
21
+ else if (arg === "--name") {
22
+ const value = argv[i + 1];
23
+ if (value === undefined) {
24
+ return { projectRoot, name, error: "argument --name: expected one argument" };
25
+ }
26
+ name = value;
27
+ i += 1;
28
+ }
29
+ else if (arg.startsWith("--name=")) {
30
+ name = arg.slice("--name=".length);
31
+ }
32
+ else if (!arg.startsWith("-") && name.length === 0) {
33
+ name = arg;
34
+ }
35
+ else {
36
+ return { projectRoot, name, error: `unrecognized argument: ${arg}` };
37
+ }
38
+ }
39
+ return { projectRoot, name };
40
+ }
41
+ export function run(argv) {
42
+ const args = parseArgs(argv);
43
+ if (args.error !== undefined) {
44
+ process.stderr.write(`change-init: ${args.error}\n`);
45
+ return 2;
46
+ }
47
+ return runChangeInit(resolve(args.projectRoot), args.name, {
48
+ writeOut: (text) => {
49
+ process.stdout.write(text);
50
+ },
51
+ writeErr: (text) => {
52
+ process.stderr.write(text);
53
+ },
54
+ });
55
+ }
56
+ if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
57
+ process.exit(run(process.argv.slice(2)));
58
+ }
59
+ //# sourceMappingURL=change-init.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function run(argv: readonly string[]): number;
3
+ //# sourceMappingURL=changelog-check.d.ts.map
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { runChangelogCheck } 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(`changelog-check: ${args.error}\n`);
30
+ return 2;
31
+ }
32
+ return runChangelogCheck(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=changelog-check.js.map
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * CLI router entry: `directive <namespace> <verb>` → flat dispatcher (#1670 / #11 S3).
3
3
  */
4
- import { dispatch } from "../dispatch.js";
4
+ import { dispatch, runDirectiveBootstrap } from "../dispatch.js";
5
5
  import { runInit } from "../init-cli/init.js";
6
6
  import { runMigrate } from "../init-cli/migrate.js";
7
7
  import { runUpdate } from "../init-cli/update.js";
@@ -36,6 +36,9 @@ export async function routeAndDispatch(argv, io) {
36
36
  if (first === "migrate") {
37
37
  return runMigrate(rest, io ?? defaultIo());
38
38
  }
39
+ if (first === "bootstrap") {
40
+ return runDirectiveBootstrap(rest, io ?? defaultIo());
41
+ }
39
42
  return dispatch(routed.argv, io);
40
43
  }
41
44
  //# sourceMappingURL=index.js.map
@@ -17,7 +17,7 @@ export const TOP_LEVEL_UX_VERBS = [
17
17
  /** Stubbed until a later story lands the handler (#1670 / #11). */
18
18
  export const STUBBED_TOP_LEVEL_VERBS = new Set([]);
19
19
  /** Registered but not yet implemented as TS handlers. */
20
- export const DEFERRED_TOP_LEVEL_VERBS = new Set(["bootstrap", "feature"]);
20
+ export const DEFERRED_TOP_LEVEL_VERBS = new Set(["feature"]);
21
21
  /** scope:* lifecycle verbs routed through scope-lifecycle handler. */
22
22
  export const SCOPE_LIFECYCLE_VERBS = new Set([
23
23
  "promote",
@@ -91,7 +91,7 @@ function routeTopLevel(first, rest) {
91
91
  if (first === "check" || first === "doctor") {
92
92
  return { kind: "dispatch", argv: [first, ...rest] };
93
93
  }
94
- if (first === "init" || first === "update" || first === "migrate") {
94
+ if (first === "init" || first === "update" || first === "migrate" || first === "bootstrap") {
95
95
  return { kind: "dispatch", argv: [first, ...rest] };
96
96
  }
97
97
  if (STUBBED_TOP_LEVEL_VERBS.has(first)) {
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export declare function run(argv: readonly string[]): number;
3
+ //# sourceMappingURL=commit-lint.d.ts.map
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ import { resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { runCommitLint } 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(`commit-lint: ${args.error}\n`);
30
+ return 2;
31
+ }
32
+ return runCommitLint(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=commit-lint.js.map
@@ -2,17 +2,78 @@
2
2
  * Unified `directive <verb> [args]` dispatcher (#1828 s0).
3
3
  * Routes to ported command modules in packages/cli and packages/core.
4
4
  */
5
+ import { spawnSync } from "node:child_process";
6
+ import { type WhichFn } from "@deftai/directive-core/scm";
5
7
  export type CommandHandler = (argv: string[]) => number | Promise<number>;
6
8
  export interface DispatchIo {
7
9
  writeOut: (text: string) => void;
8
10
  writeErr: (text: string) => void;
9
11
  }
10
12
  /** CLI modules in packages/cli/src (excluding parity harnesses and bin/index). */
11
- export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "parity", "policy", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "verify-branch", "verify-encoding", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-bridge-drift", "verify-capacity", "verify-content-manifest", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-stubs", "rule-ownership-lint", "verify-story-ready", "verify-tools", "verify-wip-cap"];
13
+ export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "install-upgrade", "install-uninstall", "migrate-preflight", "changelog-check", "change-init", "commit-lint", "parity", "policy", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "session-start", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "verify-branch", "verify-encoding", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-bridge-drift", "verify-capacity", "verify-content-manifest", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-stubs", "rule-ownership-lint", "verify-story-ready", "verify-tools", "verify-wip-cap"];
12
14
  /** Core-only CLI entrypoints without a packages/cli wrapper. */
13
- export declare const CORE_MODULE_VERBS: readonly ["scm", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "project-render", "roadmap-render", "spec-render", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor"];
15
+ export declare const CORE_MODULE_VERBS: readonly ["scm", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "project-render", "roadmap-render", "spec-render", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor"];
14
16
  /** Task-style aliases (framework_commands / Taskfile names). */
15
17
  export declare const VERB_ALIASES: Readonly<Record<string, string>>;
18
+ /** Pinned ghx version — keep in lockstep with .github/workflows/ci.yml env.GHX_VERSION. */
19
+ export declare const GHX_VERSION = "v1.5.1";
20
+ export declare const INSTALL_PS1_URL = "https://raw.githubusercontent.com/brunoborges/ghx/v1.5.1/install.ps1";
21
+ export declare const INSTALL_SH_URL = "https://raw.githubusercontent.com/brunoborges/ghx/v1.5.1/install.sh";
22
+ export type SetupGhxHost = "windows" | "darwin" | "linux" | string;
23
+ export interface SetupGhxDeps {
24
+ whichFn?: WhichFn;
25
+ readConsentLine?: () => string;
26
+ runInstall?: (host: SetupGhxHost) => number;
27
+ }
28
+ export declare function ghxPresent(whichFn?: WhichFn): boolean;
29
+ export declare function detectSetupGhxHost(): SetupGhxHost;
30
+ export declare function promptSetupGhxConsent(io: DispatchIo, readLine?: () => string): boolean;
31
+ export declare function buildSetupGhxInstallCommand(host: SetupGhxHost, whichFn?: WhichFn): string[];
32
+ export declare function installSetupGhx(host: SetupGhxHost, whichFn?: WhichFn, runner?: typeof spawnSync): number;
33
+ /** Native `setup:ghx` handler (replaces scripts/setup_ghx.py shell-out, #2022 Phase 1). */
34
+ export declare function runSetupGhx(argv: string[], io: DispatchIo, deps?: SetupGhxDeps): number;
35
+ export declare const SETUP_SKILL_REL_PATH = ".deft/core/skills/deft-directive-setup/SKILL.md";
36
+ export type BootstrapPhaseLabel = "user" | "project" | "spec";
37
+ export type BootstrapReEntry = "none" | "prompt" | "reconfigure" | "force";
38
+ export interface DirectiveBootstrapArgs {
39
+ projectRoot: string;
40
+ jumpProject: boolean;
41
+ strategy: string | null;
42
+ reconfigure: boolean;
43
+ force: boolean;
44
+ json: boolean;
45
+ error?: string;
46
+ }
47
+ export interface DirectiveBootstrapPlan {
48
+ phase: 1 | 2 | 3;
49
+ phaseLabel: BootstrapPhaseLabel;
50
+ reEntry: BootstrapReEntry;
51
+ strategy: string | null;
52
+ }
53
+ export interface DirectiveBootstrapHandoff {
54
+ handoff: "deft-directive-setup";
55
+ skill_path: string;
56
+ project_root: string;
57
+ deposited: boolean;
58
+ phase: 1 | 2 | 3;
59
+ phase_label: BootstrapPhaseLabel;
60
+ re_entry: BootstrapReEntry;
61
+ strategy: string | null;
62
+ }
63
+ export interface DirectiveBootstrapDeps {
64
+ deftCorePresent?: (projectRoot: string) => boolean;
65
+ userMdPresent?: (projectRoot: string) => boolean;
66
+ projectDefPresent?: (projectRoot: string) => boolean;
67
+ runInitDeposit?: (projectRoot: string, io: DispatchIo) => Promise<number>;
68
+ }
69
+ /** Parse `directive bootstrap` argv (#2022 Phase 4). */
70
+ export declare function parseDirectiveBootstrapArgs(argv: readonly string[]): DirectiveBootstrapArgs;
71
+ /** Resolve phase intent and deliberate re-entry signal from parsed args + on-disk state. */
72
+ export declare function resolveDirectiveBootstrapPlan(args: DirectiveBootstrapArgs, deps: Required<DirectiveBootstrapDeps>): DirectiveBootstrapPlan;
73
+ /** Native `directive bootstrap` handler (#2022 Phase 4). */
74
+ export declare function runDirectiveBootstrap(argv: string[], io: DispatchIo, deps?: DirectiveBootstrapDeps): Promise<number>;
75
+ /** Native `policy-set` dispatcher (replaces the policy_set.py shell-out, #2022 Phase 1). */
76
+ export declare function runPolicySet(argv: string[], io: DispatchIo): number;
16
77
  /** Resolve a user-facing verb to its canonical handler key. */
17
78
  export declare function resolveCanonicalVerb(verb: string): string | null;
18
79
  /** Sorted list of all registered verb names (canonical + aliases). */