@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
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safe USER.md Experimental Rules toggle (#46).
|
|
3
|
+
*
|
|
4
|
+
* Pure string helpers that add/remove only the three canonical meta-philosophy
|
|
5
|
+
* reference lines (SOUL / morals / code-field). Personal and Defaults section
|
|
6
|
+
* bodies are never rewritten — only the `## Experimental Rules` region changes.
|
|
7
|
+
*
|
|
8
|
+
* Detection matches lines under `## Experimental Rules` that contain the deposit
|
|
9
|
+
* path (`meta/SOUL.md`, …); enable writes the canonical setup-skill bullet.
|
|
10
|
+
* Custom bullets for other topics in the same section are preserved.
|
|
11
|
+
*/
|
|
12
|
+
/** Canonical Experimental Rules entries (setup Phase 1 steps 5a–5c). */
|
|
13
|
+
export const EXPERIMENTAL_META_ENTRIES = [
|
|
14
|
+
{
|
|
15
|
+
id: "soul",
|
|
16
|
+
path: "meta/SOUL.md",
|
|
17
|
+
line: "- ! Use meta/SOUL.md for strategic context and purpose-driven guidance",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "morals",
|
|
21
|
+
path: "meta/morals.md",
|
|
22
|
+
line: "- ! Use meta/morals.md for ethical AI development principles",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "code-field",
|
|
26
|
+
path: "meta/code-field.md",
|
|
27
|
+
line: "- ~ Use meta/code-field.md for advanced architecture patterns",
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
const SECTION_HEADING = "## Experimental Rules";
|
|
31
|
+
function detectNewline(text) {
|
|
32
|
+
return text.includes("\r\n") ? "\r\n" : "\n";
|
|
33
|
+
}
|
|
34
|
+
function lineMentionsPath(line, path) {
|
|
35
|
+
return line.includes(path);
|
|
36
|
+
}
|
|
37
|
+
function findExperimentalSection(text) {
|
|
38
|
+
const re = /^## Experimental Rules[ \t]*\r?\n?/m;
|
|
39
|
+
const match = re.exec(text);
|
|
40
|
+
if (!match || match.index === undefined) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const start = match.index;
|
|
44
|
+
const afterHeading = start + match[0].length;
|
|
45
|
+
const rest = text.slice(afterHeading);
|
|
46
|
+
// Next H2 or a horizontal rule at line start ends the section.
|
|
47
|
+
const next = /^(## |---[ \t]*$)/m.exec(rest);
|
|
48
|
+
const end = next && next.index !== undefined ? afterHeading + next.index : text.length;
|
|
49
|
+
return {
|
|
50
|
+
start,
|
|
51
|
+
end,
|
|
52
|
+
full: text.slice(start, end),
|
|
53
|
+
body: text.slice(afterHeading, end),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse on/off state for the three experimental meta entries.
|
|
58
|
+
* A path is ON only when a line under `## Experimental Rules` mentions it —
|
|
59
|
+
* mentions in Personal/Defaults/prose do not count (writes are section-scoped).
|
|
60
|
+
*/
|
|
61
|
+
export function parseExperimentalRulesState(userMdText) {
|
|
62
|
+
const state = {
|
|
63
|
+
soul: false,
|
|
64
|
+
morals: false,
|
|
65
|
+
"code-field": false,
|
|
66
|
+
};
|
|
67
|
+
const section = findExperimentalSection(userMdText);
|
|
68
|
+
if (!section) {
|
|
69
|
+
return state;
|
|
70
|
+
}
|
|
71
|
+
for (const line of section.body.split(/\r?\n/)) {
|
|
72
|
+
for (const entry of EXPERIMENTAL_META_ENTRIES) {
|
|
73
|
+
if (lineMentionsPath(line, entry.path)) {
|
|
74
|
+
state[entry.id] = true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return state;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Build section body lines: preserve non-meta custom bullets; apply desired
|
|
82
|
+
* on/off for the three canonical paths; stable order soul → morals → code-field.
|
|
83
|
+
*/
|
|
84
|
+
function buildSectionBody(existingBody, desired, nl) {
|
|
85
|
+
const rawLines = existingBody.split(/\r?\n/);
|
|
86
|
+
const custom = [];
|
|
87
|
+
for (const line of rawLines) {
|
|
88
|
+
if (line.trim() === "") {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const isMeta = EXPERIMENTAL_META_ENTRIES.some((e) => lineMentionsPath(line, e.path));
|
|
92
|
+
if (!isMeta) {
|
|
93
|
+
custom.push(line);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const metaLines = EXPERIMENTAL_META_ENTRIES.filter((e) => desired[e.id]).map((e) => e.line);
|
|
97
|
+
const bullets = [...metaLines, ...custom];
|
|
98
|
+
if (bullets.length === 0) {
|
|
99
|
+
return "";
|
|
100
|
+
}
|
|
101
|
+
// Heading + blank line + bullets + trailing blank line for clean separation.
|
|
102
|
+
return `${SECTION_HEADING}${nl}${nl}${bullets.join(nl)}${nl}`;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Insert a new Experimental Rules section before the trailing `---` / Note
|
|
106
|
+
* block when present; otherwise append after the last non-empty content.
|
|
107
|
+
*/
|
|
108
|
+
function insertSection(text, section, nl) {
|
|
109
|
+
// Prefer before the trailing horizontal rule that precedes the USER.md Note
|
|
110
|
+
// block (allow blank lines between `---` and `**Note**`).
|
|
111
|
+
const noteRe = /\r?\n---[ \t]*\r?\n(?:[ \t]*\r?\n)*[ \t]*\*\*Note\*\*/;
|
|
112
|
+
const noteMatch = noteRe.exec(text);
|
|
113
|
+
if (noteMatch && noteMatch.index !== undefined) {
|
|
114
|
+
const before = text.slice(0, noteMatch.index).replace(/[ \t]+$/u, "");
|
|
115
|
+
const after = text.slice(noteMatch.index);
|
|
116
|
+
const sep = before.endsWith(nl) ? nl : `${nl}${nl}`;
|
|
117
|
+
return `${before}${sep}${section.replace(/\s+$/u, "")}${after}`;
|
|
118
|
+
}
|
|
119
|
+
const trimmed = text.replace(/\s+$/u, "");
|
|
120
|
+
return `${trimmed}${nl}${nl}${section.replace(/\s+$/u, "")}${nl}`;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Apply desired Experimental Rules on/off state.
|
|
124
|
+
*
|
|
125
|
+
* - Only mutates the `## Experimental Rules` region (or inserts/removes it).
|
|
126
|
+
* - Personal / Defaults content is left byte-identical outside that region.
|
|
127
|
+
* - Enabling uses the canonical setup-skill lines; disabling drops path matches.
|
|
128
|
+
* - Custom non-meta bullets under the section are preserved.
|
|
129
|
+
* - When all three are off and no custom bullets remain, the section is removed.
|
|
130
|
+
*/
|
|
131
|
+
export function applyExperimentalRulesState(userMdText, desired) {
|
|
132
|
+
const nl = detectNewline(userMdText);
|
|
133
|
+
const sectionText = buildSectionBody(findExperimentalSection(userMdText)?.body ?? "", desired, nl);
|
|
134
|
+
const existing = findExperimentalSection(userMdText);
|
|
135
|
+
if (existing) {
|
|
136
|
+
if (!sectionText) {
|
|
137
|
+
// Remove section; tidy surrounding blank lines.
|
|
138
|
+
const before = userMdText.slice(0, existing.start).replace(/[ \t]+$/u, "");
|
|
139
|
+
let after = userMdText.slice(existing.end);
|
|
140
|
+
// Collapse to at most two newlines at the join.
|
|
141
|
+
const beforeCore = before.replace(/(\r?\n){2,}$/u, nl);
|
|
142
|
+
after = after.replace(/^(\r?\n)+/u, nl);
|
|
143
|
+
if (after.startsWith("---") || after.startsWith("## ")) {
|
|
144
|
+
return `${beforeCore.replace(/(\r?\n)+$/u, nl)}${nl}${after}`;
|
|
145
|
+
}
|
|
146
|
+
return `${beforeCore}${after}`;
|
|
147
|
+
}
|
|
148
|
+
return userMdText.slice(0, existing.start) + sectionText + userMdText.slice(existing.end);
|
|
149
|
+
}
|
|
150
|
+
if (!sectionText) {
|
|
151
|
+
return userMdText;
|
|
152
|
+
}
|
|
153
|
+
return insertSection(userMdText, sectionText, nl);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Toggle a single experimental meta entry; leave the other two unchanged.
|
|
157
|
+
*/
|
|
158
|
+
export function setExperimentalRule(userMdText, id, enabled) {
|
|
159
|
+
const current = parseExperimentalRulesState(userMdText);
|
|
160
|
+
return applyExperimentalRulesState(userMdText, { ...current, [id]: enabled });
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=experimental-rules.js.map
|
|
@@ -59,7 +59,7 @@ export const CONTAINED_WRITES_ALLOWLIST = [
|
|
|
59
59
|
"packages/core/src/intake/issue-ingest.ts",
|
|
60
60
|
"packages/core/src/intake/reconcile-issues.ts",
|
|
61
61
|
"packages/core/src/issue-sync/sync-from-xbrief.ts",
|
|
62
|
-
|
|
62
|
+
// probe-session.ts removed from allowlist after #3042 contained writeSession.
|
|
63
63
|
"packages/core/src/orchestration/verify-judgment-gates.ts",
|
|
64
64
|
"packages/core/src/platform/changelog-cli.ts",
|
|
65
65
|
"packages/core/src/release/gh.ts",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.92.0",
|
|
4
4
|
"description": "TypeScript engine core for the Directive framework.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -334,8 +334,8 @@
|
|
|
334
334
|
"provenance": true
|
|
335
335
|
},
|
|
336
336
|
"dependencies": {
|
|
337
|
-
"@deftai/directive-content": "^0.
|
|
338
|
-
"@deftai/directive-types": "^0.
|
|
337
|
+
"@deftai/directive-content": "^0.92.0",
|
|
338
|
+
"@deftai/directive-types": "^0.92.0",
|
|
339
339
|
"archiver": "^8.0.0"
|
|
340
340
|
},
|
|
341
341
|
"scripts": {
|