@deftai/directive-core 0.90.0 → 0.92.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/cache/fetch.js +3 -2
- package/dist/cache/io.d.ts +13 -2
- package/dist/cache/io.js +36 -7
- package/dist/cache/operations.js +5 -3
- package/dist/doctor/main.js +37 -0
- package/dist/doctor/openclaw-skills.d.ts +42 -8
- package/dist/doctor/openclaw-skills.js +281 -38
- package/dist/eval/health.d.ts +10 -1
- package/dist/eval/health.js +16 -16
- package/dist/hooks/dispatcher.d.ts +6 -1
- package/dist/hooks/dispatcher.js +30 -0
- package/dist/init-deposit/gitignore.js +3 -0
- package/dist/init-deposit/hygiene.d.ts +43 -1
- package/dist/init-deposit/hygiene.js +112 -7
- package/dist/init-deposit/init-deposit.d.ts +5 -0
- package/dist/init-deposit/init-deposit.js +37 -2
- package/dist/init-deposit/scaffold.js +3 -1
- package/dist/intake/github-auth-modes.d.ts +1 -1
- package/dist/intake/github-auth-modes.js +25 -3
- package/dist/intake/issue-ingest-cli.js +13 -0
- package/dist/intake/reconcile-issues-cli.js +13 -0
- package/dist/orchestration/probe-session.d.ts +5 -1
- package/dist/orchestration/probe-session.js +24 -13
- package/dist/platform/agents-md.js +1 -1
- package/dist/policy/deft-directive-disable.d.ts +86 -0
- package/dist/policy/deft-directive-disable.js +167 -0
- package/dist/policy/delivery-branch.d.ts +33 -0
- package/dist/policy/delivery-branch.js +124 -0
- package/dist/policy/index.d.ts +2 -0
- package/dist/policy/index.js +17 -1
- package/dist/policy/plan-extensions.d.ts +10 -0
- package/dist/policy/plan-extensions.js +16 -0
- package/dist/pr-closing-keywords/detect.d.ts +13 -0
- package/dist/pr-closing-keywords/detect.js +73 -8
- package/dist/pr-closing-keywords/index.d.ts +2 -2
- package/dist/pr-closing-keywords/index.js +1 -1
- package/dist/pr-closing-keywords/main.js +119 -90
- package/dist/pr-closing-keywords/types.d.ts +10 -0
- package/dist/render/constants.d.ts +16 -0
- package/dist/render/constants.js +16 -1
- package/dist/render/export-spec.d.ts +7 -1
- package/dist/render/export-spec.js +51 -5
- package/dist/render/index.d.ts +3 -2
- package/dist/render/index.js +2 -2
- package/dist/render/roadmap-render.js +164 -60
- package/dist/render/scope-outlook.d.ts +5 -0
- package/dist/render/scope-outlook.js +3 -0
- package/dist/render/spec-render.d.ts +28 -2
- package/dist/render/spec-render.js +111 -14
- package/dist/render/text-utils.d.ts +6 -0
- package/dist/render/text-utils.js +23 -0
- package/dist/scm/binary.d.ts +3 -0
- package/dist/scm/binary.js +10 -2
- package/dist/scm/call.d.ts +5 -0
- package/dist/scm/call.js +5 -0
- package/dist/scm/index.d.ts +1 -0
- package/dist/scm/index.js +1 -0
- package/dist/scm/main.d.ts +5 -0
- package/dist/scm/main.js +27 -0
- package/dist/scm/readiness-cli.d.ts +24 -0
- package/dist/scm/readiness-cli.js +85 -0
- package/dist/scm/readiness.d.ts +104 -0
- package/dist/scm/readiness.js +421 -0
- package/dist/scope/batch-promote.d.ts +26 -0
- package/dist/scope/batch-promote.js +167 -0
- package/dist/scope/brief-io.d.ts +3 -1
- package/dist/scope/brief-io.js +5 -3
- package/dist/scope/delivery-evidence.d.ts +112 -0
- package/dist/scope/delivery-evidence.js +419 -0
- package/dist/scope/index.d.ts +2 -0
- package/dist/scope/index.js +2 -0
- package/dist/scope/main.d.ts +7 -0
- package/dist/scope/main.js +155 -9
- package/dist/scope/registry-artifact-sync.js +4 -1
- package/dist/scope/transition.d.ts +11 -1
- package/dist/scope/transition.js +30 -4
- package/dist/scope/wip-cap-check.d.ts +6 -0
- package/dist/scope/wip-cap-check.js +14 -2
- package/dist/session/ritual-sentinel.js +21 -12
- package/dist/session/session-start-hook.d.ts +3 -0
- package/dist/session/session-start-hook.js +21 -0
- package/dist/session/session-start.d.ts +7 -0
- package/dist/session/session-start.js +85 -0
- package/dist/swarm/complete-cohort.d.ts +20 -1
- package/dist/swarm/complete-cohort.js +56 -9
- package/dist/swarm/finalize-cohort-cli.js +9 -0
- package/dist/swarm/finalize-cohort.d.ts +8 -0
- package/dist/swarm/finalize-cohort.js +217 -21
- package/dist/triage/welcome/index.d.ts +1 -1
- package/dist/triage/welcome/index.js +1 -1
- package/dist/triage/welcome/onboard.js +7 -1
- package/dist/triage/welcome/prior-state.d.ts +7 -0
- package/dist/triage/welcome/prior-state.js +16 -2
- package/dist/triage/welcome/writers.d.ts +10 -0
- package/dist/triage/welcome/writers.js +72 -2
- package/dist/user-config/experimental-rules.d.ts +43 -0
- package/dist/user-config/experimental-rules.js +162 -0
- package/dist/user-config/index.d.ts +1 -0
- package/dist/user-config/index.js +1 -0
- package/dist/verify-source/contained-writes.js +1 -1
- package/package.json +3 -3
package/dist/scm/main.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export interface MainOptions {
|
|
|
3
3
|
readonly whichFn?: Parameters<typeof import("./binary.js").resolveBinary>[0];
|
|
4
4
|
/** Subprocess seam threaded through the `--rest` path for test isolation. */
|
|
5
5
|
readonly runGhApiFn?: GhRestSeams["runGhApiFn"];
|
|
6
|
+
/**
|
|
7
|
+
* Skip the #2275 readiness probe (tests that inject REST seams / binary mocks).
|
|
8
|
+
* Production CLI always probes.
|
|
9
|
+
*/
|
|
10
|
+
readonly skipReadiness?: boolean;
|
|
6
11
|
}
|
|
7
12
|
/**
|
|
8
13
|
* CLI entry point. Returns the underlying binary's exit code (or 2 on arg error).
|
package/dist/scm/main.js
CHANGED
|
@@ -3,7 +3,26 @@ import { extractFlag } from "./argv.js";
|
|
|
3
3
|
import { buildCommand } from "./build-command.js";
|
|
4
4
|
import { REST_OPT_IN_VERBS } from "./constants.js";
|
|
5
5
|
import { ScmStubError } from "./errors.js";
|
|
6
|
+
import { requireScmReady } from "./readiness.js";
|
|
6
7
|
import { runRestList, runRestView } from "./rest-dispatch.js";
|
|
8
|
+
/**
|
|
9
|
+
* #2275 fail-loud gate after argv validation, before network/binary work.
|
|
10
|
+
*/
|
|
11
|
+
function guardScmReady(options) {
|
|
12
|
+
if (options.skipReadiness)
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
requireScmReady({ whichFn: options.whichFn });
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
if (err instanceof ScmStubError) {
|
|
20
|
+
process.stderr.write(`error: ${err.message}\n`);
|
|
21
|
+
return 2;
|
|
22
|
+
}
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
7
26
|
/**
|
|
8
27
|
* CLI entry point. Returns the underlying binary's exit code (or 2 on arg error).
|
|
9
28
|
* Mirrors `scripts/scm.py::main`.
|
|
@@ -29,6 +48,10 @@ export function main(argv, options = {}) {
|
|
|
29
48
|
"REST migration.\n");
|
|
30
49
|
return 2;
|
|
31
50
|
}
|
|
51
|
+
// Argv-valid REST path: still fail loud when SCM is unusable (#2275).
|
|
52
|
+
const blocked = guardScmReady(options);
|
|
53
|
+
if (blocked !== null)
|
|
54
|
+
return blocked;
|
|
32
55
|
const seams = {
|
|
33
56
|
whichFn: options.whichFn,
|
|
34
57
|
runGhApiFn: options.runGhApiFn,
|
|
@@ -43,7 +66,11 @@ export function main(argv, options = {}) {
|
|
|
43
66
|
return result.exitCode;
|
|
44
67
|
}
|
|
45
68
|
try {
|
|
69
|
+
// Build/validate argv first so unknown namespace errors surface before readiness.
|
|
46
70
|
const cmd = buildCommand(namespace, verb, extra, { whichFn: options.whichFn });
|
|
71
|
+
const blocked = guardScmReady(options);
|
|
72
|
+
if (blocked !== null)
|
|
73
|
+
return blocked;
|
|
47
74
|
const binary = cmd[0];
|
|
48
75
|
if (binary === undefined) {
|
|
49
76
|
throw new ScmStubError("internal error: empty command argv");
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI entry for `scm:status` / `scm-readiness` (#2275).
|
|
3
|
+
*
|
|
4
|
+
* Reports SCM binary + auth readiness in the current execution env.
|
|
5
|
+
* Exit 0 when ready; exit 1 when not ready (loud diagnostic); exit 2 on bad flags.
|
|
6
|
+
*/
|
|
7
|
+
import { probeScmReadiness, type ScmProbeDepth } from "./readiness.js";
|
|
8
|
+
export interface ScmReadinessCliArgs {
|
|
9
|
+
readonly json?: boolean;
|
|
10
|
+
readonly deep?: boolean;
|
|
11
|
+
readonly depth?: ScmProbeDepth;
|
|
12
|
+
readonly help?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function parseScmReadinessArgs(argv: readonly string[]): {
|
|
15
|
+
args: ScmReadinessCliArgs;
|
|
16
|
+
error: string | null;
|
|
17
|
+
};
|
|
18
|
+
export declare function scmReadinessMain(args: ScmReadinessCliArgs, options?: {
|
|
19
|
+
writeOut?: (s: string) => void;
|
|
20
|
+
writeErr?: (s: string) => void;
|
|
21
|
+
probe?: typeof probeScmReadiness;
|
|
22
|
+
}): number;
|
|
23
|
+
export declare function mainEntry(argv?: string[]): number;
|
|
24
|
+
//# sourceMappingURL=readiness-cli.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI entry for `scm:status` / `scm-readiness` (#2275).
|
|
3
|
+
*
|
|
4
|
+
* Reports SCM binary + auth readiness in the current execution env.
|
|
5
|
+
* Exit 0 when ready; exit 1 when not ready (loud diagnostic); exit 2 on bad flags.
|
|
6
|
+
*/
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { clearScmReadyCache, formatScmReadinessLines, probeScmReadiness, scmReadinessToDict, } from "./readiness.js";
|
|
9
|
+
export function parseScmReadinessArgs(argv) {
|
|
10
|
+
const out = {};
|
|
11
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
12
|
+
const arg = argv[i];
|
|
13
|
+
if (arg === "--json") {
|
|
14
|
+
out.json = true;
|
|
15
|
+
}
|
|
16
|
+
else if (arg === "--deep") {
|
|
17
|
+
out.deep = true;
|
|
18
|
+
out.depth = "deep";
|
|
19
|
+
}
|
|
20
|
+
else if (arg === "--shallow") {
|
|
21
|
+
out.depth = "shallow";
|
|
22
|
+
}
|
|
23
|
+
else if (arg === "--depth") {
|
|
24
|
+
const value = argv[++i];
|
|
25
|
+
if (value !== "shallow" && value !== "deep") {
|
|
26
|
+
return {
|
|
27
|
+
args: out,
|
|
28
|
+
error: `--depth expects shallow|deep, got ${JSON.stringify(value ?? "")}`,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
out.depth = value;
|
|
32
|
+
}
|
|
33
|
+
else if (arg === "--help" || arg === "-h") {
|
|
34
|
+
out.help = true;
|
|
35
|
+
}
|
|
36
|
+
else if (arg.startsWith("-")) {
|
|
37
|
+
return { args: out, error: `unknown flag ${JSON.stringify(arg)}` };
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return { args: out, error: `unexpected argument ${JSON.stringify(arg)}` };
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return { args: out, error: null };
|
|
44
|
+
}
|
|
45
|
+
const USAGE = "usage: deft scm:status [--json] [--deep|--shallow|--depth shallow|deep]\n" +
|
|
46
|
+
" Report SCM (gh/ghx) availability + auth state in this execution env (#2275).\n" +
|
|
47
|
+
" Exit 0 ready / 1 not ready / 2 config error.\n";
|
|
48
|
+
export function scmReadinessMain(args, options = {}) {
|
|
49
|
+
const writeOut = options.writeOut ?? ((s) => process.stdout.write(s));
|
|
50
|
+
const writeErr = options.writeErr ?? ((s) => process.stderr.write(s));
|
|
51
|
+
if (args.help) {
|
|
52
|
+
writeOut(USAGE);
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
const depth = args.depth ?? (args.deep ? "deep" : "shallow");
|
|
56
|
+
// Explicit probe always re-evaluates (credentials may have changed since
|
|
57
|
+
// session:start). Clears the process-scoped requireScmReady cache too.
|
|
58
|
+
clearScmReadyCache();
|
|
59
|
+
const probe = options.probe ?? probeScmReadiness;
|
|
60
|
+
const report = probe({ depth });
|
|
61
|
+
if (args.json) {
|
|
62
|
+
writeOut(`${JSON.stringify(scmReadinessToDict(report), null, 2)}\n`);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
for (const line of formatScmReadinessLines(report)) {
|
|
66
|
+
writeOut(`${line}\n`);
|
|
67
|
+
}
|
|
68
|
+
if (!report.ready && report.remediation) {
|
|
69
|
+
writeErr(`${report.remediation}\n`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return report.ready ? 0 : 1;
|
|
73
|
+
}
|
|
74
|
+
export function mainEntry(argv = process.argv.slice(2)) {
|
|
75
|
+
const { args, error } = parseScmReadinessArgs(argv);
|
|
76
|
+
if (error) {
|
|
77
|
+
process.stderr.write(`error: ${error}\n${USAGE}`);
|
|
78
|
+
return 2;
|
|
79
|
+
}
|
|
80
|
+
return scmReadinessMain(args);
|
|
81
|
+
}
|
|
82
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
83
|
+
process.exit(mainEntry());
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=readiness-cli.js.map
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SCM tooling + auth readiness probe for mismatched / headless envs (#2275).
|
|
3
|
+
*
|
|
4
|
+
* Framework-local gates (session:start, verify:*, xbrief:preflight, doctor,
|
|
5
|
+
* scope:*) run without GitHub credentials. SCM-dependent gates (triage:queue,
|
|
6
|
+
* issue:ingest, pr:*, reconcile:issues, cache:fetch-all, scm:*) need `gh`/`ghx`
|
|
7
|
+
* on PATH and either host credential store auth or an injected token
|
|
8
|
+
* (`GH_TOKEN` / `GITHUB_TOKEN` / `GH_ENTERPRISE_TOKEN`).
|
|
9
|
+
*
|
|
10
|
+
* This module:
|
|
11
|
+
* 1. Detects binary + auth state in the *current* execution env (not the
|
|
12
|
+
* install host).
|
|
13
|
+
* 2. Emits a clear one-line diagnostic for session-start and CLI surfaces.
|
|
14
|
+
* 3. Lists which SCM-dependent gates are skipped when readiness is false.
|
|
15
|
+
* 4. Supplies fail-loud error text so SCM verbs never fail opaquely.
|
|
16
|
+
*
|
|
17
|
+
* Hot-path rule (#2991): the default "shallow" probe is local-only (PATH +
|
|
18
|
+
* env token presence + optional short `gh auth status`). Deep API validation
|
|
19
|
+
* is opt-in via `deep: true` (session:start --with-network).
|
|
20
|
+
*/
|
|
21
|
+
import { findInjectedToken, type GhRunner, GITHUB_AUTH_MODE_HOST_GH, GITHUB_AUTH_MODE_INJECTED_TOKEN } from "../intake/github-auth-modes.js";
|
|
22
|
+
import { type RuntimeCapabilityReport } from "../intake/platform-capabilities.js";
|
|
23
|
+
import { type WhichFn } from "./binary.js";
|
|
24
|
+
import { BINARY_PREFERENCE } from "./constants.js";
|
|
25
|
+
import { ScmStubError } from "./errors.js";
|
|
26
|
+
/** Named SCM-dependent surfaces that need gh/ghx + auth (#2275). */
|
|
27
|
+
export declare const SCM_DEPENDENT_GATES: readonly ["triage:queue", "triage:welcome (network hydrate)", "issue:ingest", "reconcile:issues", "pr:*", "cache:fetch-all", "scm:*", "github-auth-modes (deep)", "umbrella:current-shape"];
|
|
28
|
+
export type ScmBinaryName = (typeof BINARY_PREFERENCE)[number];
|
|
29
|
+
export type ScmAuthState = "authenticated" | "unauthenticated" | "missing-token" | "binary-absent" | "unknown";
|
|
30
|
+
export type ScmProbeDepth = "shallow" | "deep";
|
|
31
|
+
export interface ScmReadinessReport {
|
|
32
|
+
/** True when a binary is on PATH and auth is usable for SCM gates. */
|
|
33
|
+
readonly ready: boolean;
|
|
34
|
+
/** Preferred binary name when present (`ghx` > `gh`). */
|
|
35
|
+
readonly binary: ScmBinaryName | null;
|
|
36
|
+
/** Absolute path from PATH lookup, when known. */
|
|
37
|
+
readonly binaryPath: string | null;
|
|
38
|
+
/** Auth usability classification. */
|
|
39
|
+
readonly authState: ScmAuthState;
|
|
40
|
+
/** Inferred or explicit github_auth_mode label (never a secret). */
|
|
41
|
+
readonly githubAuthMode: string;
|
|
42
|
+
/** Runtime mode from the #1557a probe. */
|
|
43
|
+
readonly runtimeMode: string;
|
|
44
|
+
/** Whether an injected token env var is present (value never reported). */
|
|
45
|
+
readonly injectedTokenPresent: boolean;
|
|
46
|
+
/** Probe depth used for this report. */
|
|
47
|
+
readonly depth: ScmProbeDepth;
|
|
48
|
+
/** One-line human diagnostic (no secrets). */
|
|
49
|
+
readonly detail: string;
|
|
50
|
+
/** Multi-line remediation when not ready; null when ready. */
|
|
51
|
+
readonly remediation: string | null;
|
|
52
|
+
/** Named SCM-dependent gates skipped when not ready (empty when ready). */
|
|
53
|
+
readonly skippedGates: readonly string[];
|
|
54
|
+
/** Login from deep validation when available. */
|
|
55
|
+
readonly login: string | null;
|
|
56
|
+
/** failure_kind from deep validation when applicable. */
|
|
57
|
+
readonly failureKind: string | null;
|
|
58
|
+
}
|
|
59
|
+
export interface ProbeScmReadinessOptions {
|
|
60
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
61
|
+
readonly whichFn?: WhichFn;
|
|
62
|
+
/** `shallow` (default) = PATH + token + optional auth status; `deep` = full auth validation. */
|
|
63
|
+
readonly depth?: ScmProbeDepth;
|
|
64
|
+
readonly runtimeReport?: RuntimeCapabilityReport;
|
|
65
|
+
readonly githubAuthMode?: string | null;
|
|
66
|
+
readonly repo?: string;
|
|
67
|
+
readonly runGh?: GhRunner;
|
|
68
|
+
/** When false, skip even `gh auth status` on the shallow path (tests / pure PATH). */
|
|
69
|
+
readonly checkAuthStatus?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Probe SCM binary + auth readiness in the current execution environment.
|
|
73
|
+
*
|
|
74
|
+
* Never throws. Never echoes token values. Suitable for session:start.
|
|
75
|
+
*/
|
|
76
|
+
export declare function probeScmReadiness(options?: ProbeScmReadinessOptions): ScmReadinessReport;
|
|
77
|
+
/** JSON-friendly snake_case dict for session:start --json / CLI. */
|
|
78
|
+
export declare function scmReadinessToDict(report: ScmReadinessReport): Record<string, unknown>;
|
|
79
|
+
/**
|
|
80
|
+
* Format human lines for session:start (and similar orientation surfaces).
|
|
81
|
+
* First line is always the one-line status; when not ready, adds skipped gates
|
|
82
|
+
* and a short remediation pointer.
|
|
83
|
+
*/
|
|
84
|
+
export declare function formatScmReadinessLines(report: ScmReadinessReport): string[];
|
|
85
|
+
/**
|
|
86
|
+
* Fail-loud error for SCM-dependent entry points when readiness is false.
|
|
87
|
+
* Includes named reason + skipped-gate list so agents never see an opaque failure.
|
|
88
|
+
*/
|
|
89
|
+
export declare function scmNotReadyError(report?: ScmReadinessReport): ScmStubError;
|
|
90
|
+
/**
|
|
91
|
+
* Assert SCM binary presence for call sites that only need PATH resolution.
|
|
92
|
+
* Throws ScmStubError with #2275 diagnostic (not the bare "neither ghx nor gh" text alone).
|
|
93
|
+
*/
|
|
94
|
+
export declare function assertScmBinaryPresent(whichFn?: WhichFn): ScmBinaryName;
|
|
95
|
+
export declare function requireScmReady(options?: ProbeScmReadinessOptions & {
|
|
96
|
+
force?: boolean;
|
|
97
|
+
}): ScmReadinessReport;
|
|
98
|
+
/**
|
|
99
|
+
* Clear the process-scoped readiness cache.
|
|
100
|
+
* Used by tests and by long-running processes after credential injection.
|
|
101
|
+
*/
|
|
102
|
+
export declare function clearScmReadyCache(): void;
|
|
103
|
+
export { findInjectedToken, GITHUB_AUTH_MODE_HOST_GH, GITHUB_AUTH_MODE_INJECTED_TOKEN };
|
|
104
|
+
//# sourceMappingURL=readiness.d.ts.map
|