@deftai/directive-core 0.91.0 → 0.93.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/index.d.ts +1 -0
- package/dist/doctor/index.js +1 -0
- package/dist/doctor/main.js +49 -0
- package/dist/doctor/openclaw-l2-adapter.d.ts +26 -0
- package/dist/doctor/openclaw-l2-adapter.js +199 -0
- package/dist/hooks/dispatcher.d.ts +6 -1
- package/dist/hooks/dispatcher.js +30 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/init-deposit/gitignore.js +3 -0
- package/dist/init-deposit/hygiene.d.ts +43 -1
- package/dist/init-deposit/hygiene.js +134 -10
- package/dist/init-deposit/index.d.ts +3 -0
- package/dist/init-deposit/index.js +3 -0
- package/dist/init-deposit/init-deposit.js +10 -0
- package/dist/init-deposit/refresh.js +11 -0
- package/dist/init-deposit/scaffold.js +6 -134
- package/dist/init-deposit/skill-discovery-deposit.d.ts +65 -0
- package/dist/init-deposit/skill-discovery-deposit.js +287 -0
- package/dist/init-deposit/skill-discovery-hosts.d.ts +94 -0
- package/dist/init-deposit/skill-discovery-hosts.js +217 -0
- package/dist/init-deposit/slash-deposit.d.ts +46 -0
- package/dist/init-deposit/slash-deposit.js +174 -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/host-slash-commands.d.ts +28 -0
- package/dist/policy/host-slash-commands.js +103 -0
- package/dist/policy/index.d.ts +3 -0
- package/dist/policy/index.js +61 -5
- 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 +1 -0
- package/dist/scope/index.js +1 -0
- package/dist/scope/main.d.ts +5 -0
- package/dist/scope/main.js +98 -3
- 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/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.js +31 -0
- package/dist/slash/emitters.d.ts +102 -0
- package/dist/slash/emitters.js +148 -0
- package/dist/slash/generator.d.ts +98 -0
- package/dist/slash/generator.js +145 -0
- package/dist/slash/index.d.ts +16 -0
- package/dist/slash/index.js +16 -0
- package/dist/slash/openclaw-adapter.d.ts +64 -0
- package/dist/slash/openclaw-adapter.js +198 -0
- package/dist/slash/openclaw-deposit.d.ts +73 -0
- package/dist/slash/openclaw-deposit.js +279 -0
- package/dist/slash/openclaw-slugs.d.ts +52 -0
- package/dist/slash/openclaw-slugs.js +126 -0
- package/dist/slash/product-set.d.ts +50 -0
- package/dist/slash/product-set.js +142 -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/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/vbrief-validate/plan-hooks.d.ts +4 -0
- package/dist/vbrief-validate/plan-hooks.js +50 -0
- package/dist/verify-source/contained-writes.js +1 -1
- package/dist/xbrief/create.d.ts +36 -0
- package/dist/xbrief/create.js +285 -0
- package/dist/xbrief/index.d.ts +14 -0
- package/dist/xbrief/index.js +42 -0
- package/dist/xbrief/paths.d.ts +37 -0
- package/dist/xbrief/paths.js +123 -0
- package/dist/xbrief/styles.d.ts +36 -0
- package/dist/xbrief/styles.js +235 -0
- package/dist/xbrief/types.d.ts +50 -0
- package/dist/xbrief/types.js +17 -0
- package/dist/xbrief/verify.d.ts +30 -0
- package/dist/xbrief/verify.js +251 -0
- package/package.json +11 -3
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
* Scoped staging + installer-managed allowlist for TS-native init/update (#1453).
|
|
3
3
|
*
|
|
4
4
|
* Mirrors cmd/deft-install/hygiene.go + deposit.go installerManagedMatchers.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* CRITICAL (#1430 / #3030): the allowlist MUST honor the SPEC consumer-path
|
|
7
|
+
* denylist (`CONSUMER_GUARD_MUST_FIRE`). Consumer-authored PROJECT-DEFINITION
|
|
8
|
+
* and scope briefs are never installer-managed; if they reappear in
|
|
9
|
+
* `installerManagedMatchers()`, unit tests and deposit-time assert fail closed.
|
|
10
|
+
*
|
|
11
|
+
* Refs #1576, #1453, #1430, #3029, #3030.
|
|
6
12
|
*/
|
|
7
13
|
import { execFileSync } from "node:child_process";
|
|
8
14
|
import { existsSync, readdirSync, rmSync } from "node:fs";
|
|
@@ -10,21 +16,63 @@ import { readdir, rm, stat } from "node:fs/promises";
|
|
|
10
16
|
import { dirname, join, relative } from "node:path";
|
|
11
17
|
import { gitPorcelain } from "../story-ready/git.js";
|
|
12
18
|
import { CANONICAL_INSTALL_ROOT } from "./constants.js";
|
|
19
|
+
import { CONSUMER_SKILL_DISCOVERY_INVENTORY } from "./skill-discovery-deposit.js";
|
|
20
|
+
import { hostSkillRelativePath, listSkillDiscoveryHosts } from "./skill-discovery-hosts.js";
|
|
21
|
+
import { slashCommandManagedExactPaths } from "./slash-deposit.js";
|
|
13
22
|
export const CODEQL_CONFIG_REL = ".github/codeql/codeql-config.yml";
|
|
14
23
|
export const CORE_GUARD_WORKFLOW_REL = ".github/workflows/deft-core-guard.yml";
|
|
15
24
|
// The lifecycle dir names are identical across the legacy `vbrief/` tree and the
|
|
16
25
|
// post-#2034 / #2110 `xbrief/` tree, so both allowlist families reuse this list.
|
|
17
26
|
const VBRIEF_LIFECYCLE_DIRS = ["proposed", "pending", "active", "completed", "cancelled"];
|
|
27
|
+
/**
|
|
28
|
+
* Consumer paths that MUST trip no-mixed-core-and-app when mixed with
|
|
29
|
+
* `.deft/core/**` (#1430 SPEC). These probe paths must never match
|
|
30
|
+
* `installerManagedMatchers()` / the deposited guard ERE.
|
|
31
|
+
*
|
|
32
|
+
* Legitimate installer scaffolding (xbrief/.deft-version, lifecycle .gitkeep,
|
|
33
|
+
* schemas/, migration/, xbrief.md) is NOT in this denylist — see #2277.
|
|
34
|
+
* Init may still *create* PROJECT-DEFINITION (#3013); create ≠ allowlist.
|
|
35
|
+
*
|
|
36
|
+
* Refs #3030, #3029, #1430.
|
|
37
|
+
*/
|
|
38
|
+
export const CONSUMER_GUARD_MUST_FIRE = [
|
|
39
|
+
"xbrief/PROJECT-DEFINITION.xbrief.json",
|
|
40
|
+
"vbrief/PROJECT-DEFINITION.vbrief.json",
|
|
41
|
+
// Representative consumer scope briefs (not scaffolding markers).
|
|
42
|
+
"xbrief/active/example-scope.xbrief.json",
|
|
43
|
+
"vbrief/active/example-scope.vbrief.json",
|
|
44
|
+
"xbrief/proposed/example-scope.xbrief.json",
|
|
45
|
+
"vbrief/pending/example-scope.vbrief.json",
|
|
46
|
+
];
|
|
47
|
+
/** Exact managed multi-host skill pointer paths only (#75 Greptile P1). */
|
|
48
|
+
function multiHostSkillDiscoveryManagedMatchers() {
|
|
49
|
+
// Exact SKILL.md paths only so consumer-authored siblings under the same
|
|
50
|
+
// host skills tree stay app-owned (not staged / not guard-exempt).
|
|
51
|
+
const matchers = [];
|
|
52
|
+
for (const host of listSkillDiscoveryHosts()) {
|
|
53
|
+
for (const skill of CONSUMER_SKILL_DISCOVERY_INVENTORY) {
|
|
54
|
+
matchers.push({ exact: hostSkillRelativePath(host, skill.dir) });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return matchers;
|
|
58
|
+
}
|
|
18
59
|
/** Single source of truth for installer-managed paths (#1440 / #1576). */
|
|
19
60
|
export function installerManagedMatchers() {
|
|
20
61
|
return [
|
|
21
62
|
{ exact: "AGENTS.md" },
|
|
22
63
|
{ prefix: ".agents/" },
|
|
64
|
+
// Multi-host skill discovery thin pointers (#75 residual) — not slash commands (#55).
|
|
65
|
+
// Exact inventory paths only; never claim the whole host skills tree.
|
|
66
|
+
...multiHostSkillDiscoveryManagedMatchers(),
|
|
23
67
|
{ prefix: ".githooks/" },
|
|
24
68
|
{ exact: ".claude/settings.json" },
|
|
25
69
|
{ exact: ".grok/hooks/deft.json" },
|
|
26
70
|
{ exact: ".cursor/hooks.json" },
|
|
27
71
|
{ exact: ".codex/hooks.json" },
|
|
72
|
+
// Multi-host slash product files only (#3054 / L8 prefer commit).
|
|
73
|
+
// Exact paths — not directory prefixes — so consumer custom commands under
|
|
74
|
+
// the same host dirs stay app-owned for staging + no-mixed-core-and-app.
|
|
75
|
+
...slashCommandManagedExactPaths().map((exact) => ({ exact })),
|
|
28
76
|
{ exact: ".gitattributes" },
|
|
29
77
|
{ exact: ".gitignore" },
|
|
30
78
|
// Installer-deposited Prettier gate exclusion (#2534); must be allowlisted or
|
|
@@ -45,9 +93,10 @@ export function installerManagedMatchers() {
|
|
|
45
93
|
// `deft update` framework-deposit PR trips no-mixed-core-and-app (#2277).
|
|
46
94
|
{ exact: "xbrief/.deft-version" },
|
|
47
95
|
{ exact: "xbrief/xbrief.md" },
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
96
|
+
// CRITICAL (#1430 / #3029 / #3030): do NOT allowlist consumer-authored
|
|
97
|
+
// PROJECT-DEFINITION (xbrief/ or vbrief/) or consumer scope briefs.
|
|
98
|
+
// Init may still seed PD (#3013); the seed is app-owned for guard classification
|
|
99
|
+
// so core+PD mixed PRs fail no-mixed-core-and-app. See CONSUMER_GUARD_MUST_FIRE.
|
|
51
100
|
{ prefix: "xbrief/schemas/" },
|
|
52
101
|
{ prefix: "xbrief/migration/" },
|
|
53
102
|
...VBRIEF_LIFECYCLE_DIRS.map((sub) => ({ exact: `xbrief/${sub}/.gitkeep` })),
|
|
@@ -61,12 +110,6 @@ function matcherToEre(matcher) {
|
|
|
61
110
|
return `^${escapeEre(matcher.exact)}$`;
|
|
62
111
|
return `^${escapeEre(matcher.prefix ?? "")}`;
|
|
63
112
|
}
|
|
64
|
-
/** POSIX ERE alternation embedded in the deposited deft-core-guard workflow. */
|
|
65
|
-
export function installerManagedGuardEre() {
|
|
66
|
-
return installerManagedMatchers()
|
|
67
|
-
.map((matcher) => matcherToEre(matcher))
|
|
68
|
-
.join("|");
|
|
69
|
-
}
|
|
70
113
|
function matchesInstallerManaged(path, matchers) {
|
|
71
114
|
for (const matcher of matchers) {
|
|
72
115
|
if (matcher.exact && path === matcher.exact)
|
|
@@ -76,9 +119,90 @@ function matchesInstallerManaged(path, matchers) {
|
|
|
76
119
|
}
|
|
77
120
|
return false;
|
|
78
121
|
}
|
|
122
|
+
/** Consumer scope-brief filenames under lifecycle dirs (not scaffolding). */
|
|
123
|
+
const CONSUMER_SCOPE_BRIEF_EXACT = /^(xbrief|vbrief)\/(proposed|pending|active|completed|cancelled)\/.+\.(x|v)brief\.json$/;
|
|
124
|
+
/** PROJECT-DEFINITION exact paths (xbrief or legacy vbrief). */
|
|
125
|
+
const CONSUMER_PROJECT_DEFINITION_EXACT = /^(xbrief|vbrief)\/PROJECT-DEFINITION\.(x|v)brief\.json$/;
|
|
126
|
+
/**
|
|
127
|
+
* Prefixes that would exempt entire consumer lifecycle trees or the whole
|
|
128
|
+
* xbrief/vbrief tree — never installer-managed (#1430).
|
|
129
|
+
*/
|
|
130
|
+
const FORBIDDEN_CONSUMER_PREFIXES = new Set([
|
|
131
|
+
"xbrief/",
|
|
132
|
+
"vbrief/",
|
|
133
|
+
...VBRIEF_LIFECYCLE_DIRS.flatMap((sub) => [`xbrief/${sub}/`, `vbrief/${sub}/`]),
|
|
134
|
+
]);
|
|
135
|
+
/**
|
|
136
|
+
* Fail closed when the installer-managed allowlist would exempt consumer
|
|
137
|
+
* PROJECT-DEFINITION or scope briefs (#3030 / #1430). Pure over `matchers` so
|
|
138
|
+
* tests can inject a bad matcher without mutating production state.
|
|
139
|
+
*
|
|
140
|
+
* Checks both:
|
|
141
|
+
* 1. Explicit probe paths in {@link CONSUMER_GUARD_MUST_FIRE}
|
|
142
|
+
* 2. Structural patterns (any exact consumer scope brief / PD; forbidden prefixes)
|
|
143
|
+
* so an unlisted `xbrief/active/another-scope.xbrief.json` matcher still fails.
|
|
144
|
+
*/
|
|
145
|
+
export function assertInstallerAllowlistHonors1430(matchers = installerManagedMatchers()) {
|
|
146
|
+
for (const path of CONSUMER_GUARD_MUST_FIRE) {
|
|
147
|
+
if (matchesInstallerManaged(path, matchers)) {
|
|
148
|
+
throw new Error(`#1430 violation: ${path} must not be installer-managed (SPEC consumer denylist; see CONSUMER_GUARD_MUST_FIRE / #3030)`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
for (const matcher of matchers) {
|
|
152
|
+
if (matcher.exact) {
|
|
153
|
+
if (CONSUMER_PROJECT_DEFINITION_EXACT.test(matcher.exact) ||
|
|
154
|
+
CONSUMER_SCOPE_BRIEF_EXACT.test(matcher.exact)) {
|
|
155
|
+
throw new Error(`#1430 violation: exact matcher ${matcher.exact} must not be installer-managed (consumer brief denylist / #3030)`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (matcher.prefix) {
|
|
159
|
+
const normalized = matcher.prefix.endsWith("/") ? matcher.prefix : `${matcher.prefix}/`;
|
|
160
|
+
if (FORBIDDEN_CONSUMER_PREFIXES.has(normalized)) {
|
|
161
|
+
throw new Error(`#1430 violation: prefix matcher ${matcher.prefix} must not cover consumer brief trees (#3030)`);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
/** POSIX ERE alternation embedded in the deposited deft-core-guard workflow. */
|
|
167
|
+
export function installerManagedGuardEre() {
|
|
168
|
+
const matchers = installerManagedMatchers();
|
|
169
|
+
// Refuse to emit a guard workflow that would exempt consumer denylist paths.
|
|
170
|
+
assertInstallerAllowlistHonors1430(matchers);
|
|
171
|
+
return matchers.map((matcher) => matcherToEre(matcher)).join("|");
|
|
172
|
+
}
|
|
79
173
|
export function isInstallerManagedPath(path) {
|
|
80
174
|
return matchesInstallerManaged(path, installerManagedMatchers());
|
|
81
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* TS twin of Go `classifyChangedPaths` / deposited shell guard (#1430).
|
|
178
|
+
* Core = `.deft/core/**`; installer-managed = allowlist; app = everything else.
|
|
179
|
+
* Guard fails iff both core and app are non-empty.
|
|
180
|
+
*/
|
|
181
|
+
export function classifyMixedCoreAndApp(changedPaths, matchers = installerManagedMatchers()) {
|
|
182
|
+
const core = [];
|
|
183
|
+
const installerManaged = [];
|
|
184
|
+
const app = [];
|
|
185
|
+
for (const raw of changedPaths) {
|
|
186
|
+
const path = raw.replace(/\\/g, "/");
|
|
187
|
+
if (!path)
|
|
188
|
+
continue;
|
|
189
|
+
if (path === ".deft/core" || path.startsWith(".deft/core/")) {
|
|
190
|
+
core.push(path);
|
|
191
|
+
}
|
|
192
|
+
else if (matchesInstallerManaged(path, matchers)) {
|
|
193
|
+
installerManaged.push(path);
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
app.push(path);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return {
|
|
200
|
+
core,
|
|
201
|
+
installerManaged,
|
|
202
|
+
app,
|
|
203
|
+
wouldFail: core.length > 0 && app.length > 0,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
82
206
|
export function frameworkStagePaths(projectDir, deftDir, options = {}) {
|
|
83
207
|
const paths = [];
|
|
84
208
|
const seen = new Set();
|
|
@@ -6,5 +6,8 @@ export * from "./legacy-detect.js";
|
|
|
6
6
|
export * from "./migrate.js";
|
|
7
7
|
export * from "./refresh.js";
|
|
8
8
|
export * from "./scaffold.js";
|
|
9
|
+
export * from "./skill-discovery-deposit.js";
|
|
10
|
+
export * from "./skill-discovery-hosts.js";
|
|
11
|
+
export * from "./slash-deposit.js";
|
|
9
12
|
export * from "./untrack-core.js";
|
|
10
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,5 +6,8 @@ export * from "./legacy-detect.js";
|
|
|
6
6
|
export * from "./migrate.js";
|
|
7
7
|
export * from "./refresh.js";
|
|
8
8
|
export * from "./scaffold.js";
|
|
9
|
+
export * from "./skill-discovery-deposit.js";
|
|
10
|
+
export * from "./skill-discovery-hosts.js";
|
|
11
|
+
export * from "./slash-deposit.js";
|
|
9
12
|
export * from "./untrack-core.js";
|
|
10
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -14,6 +14,7 @@ import { prunePythonArtifactsFromDeposit } from "../deposit/python-free.js";
|
|
|
14
14
|
import { resolveInstalledContentRoot } from "../deposit/resolve-content.js";
|
|
15
15
|
import { readCorePackageVersion } from "../engine-version.js";
|
|
16
16
|
import { renderProjectDefinition } from "../render/project-render.js";
|
|
17
|
+
import { depositOpenClawL2ProductCommands } from "../slash/openclaw-deposit.js";
|
|
17
18
|
import { removeStaleMigratedFrameworkNarrative } from "../xbrief-migrate/migrate-project.js";
|
|
18
19
|
import { writeAgentHookDeposit } from "./agent-hooks.js";
|
|
19
20
|
import { ensureInitGitignoreLines, reconstituteDepositFromContent } from "./gitignore.js";
|
|
@@ -22,6 +23,8 @@ import { buildLegacyRefusalJson, buildLegacyRefusalMessage, detectLegacyLayout,
|
|
|
22
23
|
import { printMigrateNudgeIfNeeded } from "./migrate.js";
|
|
23
24
|
import { ensurePrettierIgnoreLines } from "./prettierignore.js";
|
|
24
25
|
import { CANONICAL_INSTALL_ROOT, depositNeutralization, ensureTaskfile, writeAgentsMd, writeAgentsSkills, writeConsumerGitHooks, writeConsumerVbrief, writeInstallManifest, } from "./scaffold.js";
|
|
26
|
+
import { writeMultiHostSkillDiscovery } from "./skill-discovery-deposit.js";
|
|
27
|
+
import { writeSlashCommandDeposit } from "./slash-deposit.js";
|
|
25
28
|
import { syncBareVersionMarker } from "./xbrief-projections.js";
|
|
26
29
|
export function parseInitArgv(canonicalArgv, userArgv = []) {
|
|
27
30
|
const args = [...canonicalArgv, ...userArgv];
|
|
@@ -181,6 +184,7 @@ export async function runInitDeposit(args, io, seams = {}) {
|
|
|
181
184
|
writeInstallManifest(projectDir, deftDir, manifestFields);
|
|
182
185
|
writeAgentsMd(projectDir, deftDir, io);
|
|
183
186
|
const skillsCreated = writeAgentsSkills(projectDir, io);
|
|
187
|
+
writeMultiHostSkillDiscovery(projectDir, io);
|
|
184
188
|
await depositNeutralization(projectDir, io);
|
|
185
189
|
await writeConsumerVbrief(projectDir, deftDir, io);
|
|
186
190
|
seedMinimalProjectDefinition(projectDir, io);
|
|
@@ -191,6 +195,12 @@ export async function runInitDeposit(args, io, seams = {}) {
|
|
|
191
195
|
removeStaleMigratedFrameworkNarrative(projectDir);
|
|
192
196
|
writeConsumerGitHooks(projectDir, deftDir, io, seams.gitHooks);
|
|
193
197
|
writeAgentHookDeposit(projectDir, io);
|
|
198
|
+
writeSlashCommandDeposit(projectDir, io);
|
|
199
|
+
// #3064: OpenClaw L2 product-command skills when OC signals present (fail-closed otherwise).
|
|
200
|
+
depositOpenClawL2ProductCommands({
|
|
201
|
+
projectRoot: projectDir,
|
|
202
|
+
printf: (t) => io.printf(t),
|
|
203
|
+
});
|
|
194
204
|
let taskfileWired = false;
|
|
195
205
|
if (args.nonInteractive) {
|
|
196
206
|
taskfileWired = ensureTaskfile(projectDir, io);
|
|
@@ -21,6 +21,7 @@ import { resolveLifecycleRoot } from "../layout/resolve.js";
|
|
|
21
21
|
import { detectNoDeftDirective, NO_DEFT_DIRECTIVE_DISABLED_MESSAGE, NO_DEFT_DIRECTIVE_FLAG_NAME, NO_DEFT_DIRECTIVE_INCONSISTENT_MESSAGE, NO_DEFT_DIRECTIVE_INCONSISTENT_POLICY, } from "../policy/no-deft-directive.js";
|
|
22
22
|
import { runOrgForceOnMigration } from "../policy/org-force-on-migration.js";
|
|
23
23
|
import { checkLocalEngineIntegrity, classify, ENGINE_PACKAGE, plan, renderGlobalInstall, resolveEngine, } from "../resolution/index.js";
|
|
24
|
+
import { depositOpenClawL2ProductCommands } from "../slash/openclaw-deposit.js";
|
|
24
25
|
import { gitPorcelain } from "../story-ready/git.js";
|
|
25
26
|
import { removeStaleMigratedFrameworkNarrative } from "../xbrief-migrate/migrate-project.js";
|
|
26
27
|
import { writeAgentHookDeposit } from "./agent-hooks.js";
|
|
@@ -31,6 +32,8 @@ import { buildLegacyRefusalJson, buildLegacyRefusalMessage, detectLegacyLayout,
|
|
|
31
32
|
import { printMigrateNudgeIfNeeded } from "./migrate.js";
|
|
32
33
|
import { ensurePrettierIgnoreLines } from "./prettierignore.js";
|
|
33
34
|
import { CANONICAL_INSTALL_ROOT, depositNeutralization, ensureTaskfile, writeAgentsMd, writeConsumerGitHooks, writeInstallManifest, } from "./scaffold.js";
|
|
35
|
+
import { writeMultiHostSkillDiscovery } from "./skill-discovery-deposit.js";
|
|
36
|
+
import { writeSlashCommandDeposit } from "./slash-deposit.js";
|
|
34
37
|
import { syncBareVersionMarker, syncConsumerXbriefSchemas, syncExistingBareVersionMarker, } from "./xbrief-projections.js";
|
|
35
38
|
function hasCanonicalXbriefLifecycle(projectDir) {
|
|
36
39
|
try {
|
|
@@ -464,6 +467,14 @@ export async function runRefreshDeposit(args, io, seams = {}) {
|
|
|
464
467
|
}
|
|
465
468
|
const agentsMdUpdated = writeAgentsMd(projectDir, deftDir, io);
|
|
466
469
|
writeAgentHookDeposit(projectDir, io);
|
|
470
|
+
// #75 residual: multi-host thin skill discovery (mirror `.agents/skills` inventory).
|
|
471
|
+
writeMultiHostSkillDiscovery(projectDir, io);
|
|
472
|
+
writeSlashCommandDeposit(projectDir, io);
|
|
473
|
+
// #3064: OpenClaw L2 product-command skills when OC signals present (fail-closed otherwise).
|
|
474
|
+
depositOpenClawL2ProductCommands({
|
|
475
|
+
projectRoot: projectDir,
|
|
476
|
+
printf: (t) => io.printf(t),
|
|
477
|
+
});
|
|
467
478
|
// #2530: root `.githooks/` is a consumer derivative like #2595 marker/schemas —
|
|
468
479
|
// repair on every refresh, including the already-current no-op path.
|
|
469
480
|
writeConsumerGitHooks(projectDir, deftDir, io, seams.gitHooks);
|
|
@@ -14,7 +14,8 @@ import { assertDestinationNotSymlink, ProjectionContainmentError, } from "../fs/
|
|
|
14
14
|
import { agentsRefreshPlan } from "../platform/agents-md.js";
|
|
15
15
|
import { MIGRATED_ARTIFACT_DIR } from "../xbrief-migrate/constants.js";
|
|
16
16
|
import { CANONICAL_INSTALL_ROOT } from "./constants.js";
|
|
17
|
-
import { installerManagedGuardEre } from "./hygiene.js";
|
|
17
|
+
import { assertInstallerAllowlistHonors1430, installerManagedGuardEre } from "./hygiene.js";
|
|
18
|
+
import { writeAgentsSkillsFromInventory } from "./skill-discovery-deposit.js";
|
|
18
19
|
import { syncConsumerXbriefSchemas } from "./xbrief-projections.js";
|
|
19
20
|
export { CANONICAL_INSTALL_ROOT };
|
|
20
21
|
export const CORE_GLOB = ".deft/core/**";
|
|
@@ -90,125 +91,6 @@ const DEFT_INCLUDE_CHILD_BLOCK = " # Added by deft-install --yes (Epic-4)\n" +
|
|
|
90
91
|
" deft:\n" +
|
|
91
92
|
" taskfile: ./.deft/core/Taskfile.yml\n" +
|
|
92
93
|
" optional: true\n";
|
|
93
|
-
const AGENTS_SKILLS = [
|
|
94
|
-
{
|
|
95
|
-
dir: "deft",
|
|
96
|
-
content: `---
|
|
97
|
-
name: deft
|
|
98
|
-
description: Apply deft framework standards for AI-assisted development. Use when starting projects, writing code, running tests, making commits, or when the user references deft, project standards, or coding guidelines.
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
Read and follow: .deft/core/SKILL.md
|
|
102
|
-
`,
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
dir: "deft-directive-setup",
|
|
106
|
-
content: `---
|
|
107
|
-
name: deft-directive-setup
|
|
108
|
-
description: >-
|
|
109
|
-
Set up a new project with Deft framework standards. Use when the user wants
|
|
110
|
-
to bootstrap user preferences, configure a project, or generate a project
|
|
111
|
-
specification. Walks through setup conversationally — no separate CLI needed.
|
|
112
|
-
---
|
|
113
|
-
|
|
114
|
-
Read and follow: .deft/core/skills/deft-directive-setup/SKILL.md
|
|
115
|
-
`,
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
dir: "deft-directive-build",
|
|
119
|
-
content: `---
|
|
120
|
-
name: deft-directive-build
|
|
121
|
-
description: >-
|
|
122
|
-
Build a project from scope vBRIEFs following Deft framework standards.
|
|
123
|
-
Use after deft-directive-setup has generated the project definition, or when
|
|
124
|
-
the user has scope vBRIEFs ready to implement. Handles scaffolding,
|
|
125
|
-
implementation, testing, and quality checks phase by phase.
|
|
126
|
-
---
|
|
127
|
-
|
|
128
|
-
Read and follow: .deft/core/skills/deft-directive-build/SKILL.md
|
|
129
|
-
`,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
dir: "deft-directive-review-cycle",
|
|
133
|
-
content: `---
|
|
134
|
-
name: deft-directive-review-cycle
|
|
135
|
-
description: >-
|
|
136
|
-
Greptile bot reviewer response workflow. Use when running a review cycle
|
|
137
|
-
on a PR — to audit process prerequisites, fetch bot findings, fix all
|
|
138
|
-
issues in a single batch commit, and exit cleanly when no P0/P1 issues
|
|
139
|
-
remain. Enables cloud agents to run autonomous PR review cycles.
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
Read and follow: .deft/core/skills/deft-directive-review-cycle/SKILL.md
|
|
143
|
-
`,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
dir: "deft-directive-refinement",
|
|
147
|
-
content: `---
|
|
148
|
-
name: deft-directive-refinement
|
|
149
|
-
description: >-
|
|
150
|
-
Structured refinement workflow. Compares open GitHub issues against
|
|
151
|
-
the roadmap, triages new issues one-at-a-time with human review, and updates
|
|
152
|
-
the roadmap with phase placement, analysis comments, and index entries.
|
|
153
|
-
---
|
|
154
|
-
|
|
155
|
-
Read and follow: .deft/core/skills/deft-directive-refinement/SKILL.md
|
|
156
|
-
`,
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
dir: "deft-directive-swarm",
|
|
160
|
-
content: `---
|
|
161
|
-
name: deft-directive-swarm
|
|
162
|
-
description: >-
|
|
163
|
-
Parallel local agent orchestration. Use when running multiple agents
|
|
164
|
-
on roadmap items simultaneously — to select non-overlapping tasks, set up
|
|
165
|
-
isolated worktrees, launch agents with proven prompts, monitor progress,
|
|
166
|
-
handle stalled review cycles, and close out PRs cleanly.
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
Read and follow: .deft/core/skills/deft-directive-swarm/SKILL.md
|
|
170
|
-
`,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
dir: "deft-directive-interview",
|
|
174
|
-
content: `---
|
|
175
|
-
name: deft-directive-interview
|
|
176
|
-
description: >-
|
|
177
|
-
Deterministic structured Q&A interview skill. Use when a skill or workflow
|
|
178
|
-
needs to collect structured answers from the user — one question per turn,
|
|
179
|
-
numbered options, default acceptance, and a confirmation gate.
|
|
180
|
-
---
|
|
181
|
-
|
|
182
|
-
Read and follow: .deft/core/skills/deft-directive-interview/SKILL.md
|
|
183
|
-
`,
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
dir: "deft-directive-pre-pr",
|
|
187
|
-
content: `---
|
|
188
|
-
name: deft-directive-pre-pr
|
|
189
|
-
description: >-
|
|
190
|
-
Iterative pre-PR quality loop (Read-Write-Lint-Diff-Loop). Use before
|
|
191
|
-
pushing a branch for PR creation — structured self-review that agents run
|
|
192
|
-
to catch issues before they reach the bot reviewer.
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
Read and follow: .deft/core/skills/deft-directive-pre-pr/SKILL.md
|
|
196
|
-
`,
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
dir: "deft-directive-sync",
|
|
200
|
-
content: `---
|
|
201
|
-
name: deft-directive-sync
|
|
202
|
-
description: >-
|
|
203
|
-
Session-start framework sync skill. Use at the beginning of a session to
|
|
204
|
-
pull latest framework updates, validate project files, and confirm alignment
|
|
205
|
-
before starting work.
|
|
206
|
-
---
|
|
207
|
-
|
|
208
|
-
Read and follow: .deft/core/skills/deft-directive-sync/SKILL.md
|
|
209
|
-
`,
|
|
210
|
-
},
|
|
211
|
-
];
|
|
212
94
|
const BARE_SEMVER = /^\d+\.\d+\.\d+([-+][0-9A-Za-z.-]+)?$/;
|
|
213
95
|
export function buildInstallManifestText(fields) {
|
|
214
96
|
let effectiveTag = fields.tag;
|
|
@@ -376,20 +258,8 @@ export async function writeConsumerVbrief(projectDir, deftDir, io) {
|
|
|
376
258
|
return true;
|
|
377
259
|
}
|
|
378
260
|
export function writeAgentsSkills(projectDir, io) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
if (allExist) {
|
|
382
|
-
io.printf(".agents/skills/ already present — skipping.\n");
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
for (const skill of AGENTS_SKILLS) {
|
|
386
|
-
const path = projectionTarget(projectDir, ".agents", "skills", skill.dir, "SKILL.md");
|
|
387
|
-
if (existsSync(path))
|
|
388
|
-
continue;
|
|
389
|
-
containedProjectWrite(projectDir, path, skill.content);
|
|
390
|
-
}
|
|
391
|
-
io.printf(".agents/skills/ created — deft skills will be auto-discovered.\n");
|
|
392
|
-
return true;
|
|
261
|
+
// Shared inventory with multi-host skill discovery (#75 residual).
|
|
262
|
+
return writeAgentsSkillsFromInventory(projectDir, io);
|
|
393
263
|
}
|
|
394
264
|
function hasTopLevelIncludes(content) {
|
|
395
265
|
if (!content)
|
|
@@ -632,6 +502,8 @@ export function mergeCoreGuardWorkflowRefresh(existing, desired) {
|
|
|
632
502
|
return desired.slice(0, idx) + existingCheckout + desired.slice(idx + desiredCheckout.length);
|
|
633
503
|
}
|
|
634
504
|
function coreGuardWorkflowContent() {
|
|
505
|
+
// Fail closed before emitting guard ERE if allowlist violates #1430 denylist (#3030).
|
|
506
|
+
assertInstallerAllowlistHonors1430();
|
|
635
507
|
const baseSha = githubActionsExpr("github.event.pull_request.base.sha");
|
|
636
508
|
const headSha = githubActionsExpr("github.event.pull_request.head.sha");
|
|
637
509
|
return ("name: deft-core-guard\n\n" +
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-host thin skill discovery deposit (#75 residual).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the consumer skill inventory already written to `.agents/skills/`
|
|
5
|
+
* into additional host paths (`.claude/skills/`, `.codex/skills/`,
|
|
6
|
+
* `.github/skills/`, `.cursor/skills/`). Thin pointers only — no full skill
|
|
7
|
+
* body copies. Windows-safe file writes (no elevated symlink requirement).
|
|
8
|
+
*
|
|
9
|
+
* Distinct from epic #55 slash-command deposit (#3054).
|
|
10
|
+
*/
|
|
11
|
+
import type { InitDepositIo } from "./constants.js";
|
|
12
|
+
import { type HostSkillDiscoveryPolicy, type SkillDiscoveryHostId } from "./skill-discovery-hosts.js";
|
|
13
|
+
export type { InitDepositIo };
|
|
14
|
+
/**
|
|
15
|
+
* Consumer skill discovery inventory shared by `.agents/skills/` and multi-host
|
|
16
|
+
* deposit. Each entry is a thin SKILL.md pointer into `.deft/core/…` — never a
|
|
17
|
+
* full skill body. Keep this list the single SoT for install-time discovery.
|
|
18
|
+
*/
|
|
19
|
+
export declare const CONSUMER_SKILL_DISCOVERY_INVENTORY: ReadonlyArray<{
|
|
20
|
+
dir: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}>;
|
|
23
|
+
/** Max bytes for a thin pointer body — fat full-skill copies fail this guard. */
|
|
24
|
+
export declare const MAX_THIN_SKILL_POINTER_BYTES = 1200;
|
|
25
|
+
/**
|
|
26
|
+
* True when content is a thin discovery pointer (not an inlined skill body).
|
|
27
|
+
* Managed deposit must stay pointer-shaped so updates do not rot full copies.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isThinSkillPointer(content: string): boolean;
|
|
30
|
+
export interface MultiHostSkillDiscoveryDepositResult {
|
|
31
|
+
readonly changed: boolean;
|
|
32
|
+
/** Repo-relative posix paths written or rewritten. */
|
|
33
|
+
readonly changedPaths: string[];
|
|
34
|
+
/** Hosts that received at least one write. */
|
|
35
|
+
readonly hostsTouched: SkillDiscoveryHostId[];
|
|
36
|
+
/** Hosts skipped because `plan.policy.hostSkillDiscovery.<host>` is false. */
|
|
37
|
+
readonly hostsSkipped: SkillDiscoveryHostId[];
|
|
38
|
+
}
|
|
39
|
+
export interface WriteMultiHostSkillDiscoveryOptions {
|
|
40
|
+
/** Override policy (tests); default loads from PROJECT-DEFINITION. */
|
|
41
|
+
policy?: HostSkillDiscoveryPolicy;
|
|
42
|
+
/**
|
|
43
|
+
* Skill inventory to deposit. Defaults to the shared consumer inventory
|
|
44
|
+
* (same set as `.agents/skills/`).
|
|
45
|
+
*/
|
|
46
|
+
inventory?: ReadonlyArray<{
|
|
47
|
+
dir: string;
|
|
48
|
+
content: string;
|
|
49
|
+
}>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Deposit thin skill discovery pointers into enabled multi-host paths.
|
|
53
|
+
* Idempotent: skips write when on-disk content already matches. Never creates
|
|
54
|
+
* symlinks (Windows-safe without elevation).
|
|
55
|
+
*/
|
|
56
|
+
export declare function writeMultiHostSkillDiscovery(projectDir: string, io: InitDepositIo, options?: WriteMultiHostSkillDiscoveryOptions): MultiHostSkillDiscoveryDepositResult;
|
|
57
|
+
/**
|
|
58
|
+
* Shared inventory helper for `.agents/skills/` (canonical) deposit.
|
|
59
|
+
* Returns true when any pointer was created (matching writeAgentsSkills).
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeAgentsSkillsFromInventory(projectDir: string, io: InitDepositIo, inventory?: ReadonlyArray<{
|
|
62
|
+
dir: string;
|
|
63
|
+
content: string;
|
|
64
|
+
}>): boolean;
|
|
65
|
+
//# sourceMappingURL=skill-discovery-deposit.d.ts.map
|