@fenglimg/fabric-cli 2.0.0-rc.15 → 2.0.0-rc.21
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/chunk-4HC5ZK7H.js +598 -0
- package/dist/{chunk-AXIFEVAS.js → chunk-FNO7CQDG.js} +1 -1
- package/dist/chunk-KZ2YITOS.js +225 -0
- package/dist/{chunk-SKSYUHKK.js → chunk-MF3OTILQ.js} +0 -4
- package/dist/{chunk-OBQU6NHO.js → chunk-ZSESMG6L.js} +0 -6
- package/dist/{config-7YD365I3.js → config-AYP5F72E.js} +2 -2
- package/dist/{doctor-6XHLQJXB.js → doctor-L6TIXXIX.js} +129 -3
- package/dist/index.js +11 -8
- package/dist/{install-JLDCHAXV.js → install-DNZXGFHJ.js} +23 -25
- package/dist/{plan-context-hint-73U4FGKO.js → plan-context-hint-CFDGXHCA.js} +4 -4
- package/dist/{serve-L3X5UHG2.js → serve-6PPQX7AW.js} +1 -1
- package/dist/{uninstall-DD6FIFCI.js → uninstall-L2HEEOU3.js} +147 -55
- package/package.json +3 -3
- package/templates/hooks/fabric-hint.cjs +350 -21
- package/templates/hooks/knowledge-hint-broad.cjs +39 -14
- package/templates/hooks/knowledge-hint-narrow.cjs +31 -7
- package/templates/hooks/lib/banner-i18n.cjs +252 -0
- package/dist/chunk-AIB54QRT.js +0 -82
- package/dist/chunk-UTF4YBDN.js +0 -366
- package/templates/agents-md/AGENTS.md.template +0 -59
- package/templates/bootstrap/CLAUDE.md +0 -8
- package/templates/bootstrap/codex-AGENTS-header.md +0 -6
- package/templates/bootstrap/cursor-fabric-bootstrap.mdc +0 -10
package/dist/chunk-UTF4YBDN.js
DELETED
|
@@ -1,366 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
deepMerge
|
|
4
|
-
} from "./chunk-SKSYUHKK.js";
|
|
5
|
-
|
|
6
|
-
// src/install/skills-and-hooks.ts
|
|
7
|
-
import { chmodSync, existsSync, readFileSync } from "fs";
|
|
8
|
-
import { mkdir, readFile } from "fs/promises";
|
|
9
|
-
import { dirname, join, parse, resolve } from "path";
|
|
10
|
-
import { fileURLToPath } from "url";
|
|
11
|
-
import { atomicWriteJson, atomicWriteText } from "@fenglimg/fabric-shared/node/atomic-write";
|
|
12
|
-
var SKILL_TEMPLATE_REL = "skills/fabric-archive/SKILL.md";
|
|
13
|
-
var SKILL_REVIEW_TEMPLATE_REL = "skills/fabric-review/SKILL.md";
|
|
14
|
-
var SKILL_IMPORT_TEMPLATE_REL = "skills/fabric-import/SKILL.md";
|
|
15
|
-
var HOOK_SCRIPT_TEMPLATE_REL = "hooks/fabric-hint.cjs";
|
|
16
|
-
var HOOK_BROAD_SCRIPT_TEMPLATE_REL = "hooks/knowledge-hint-broad.cjs";
|
|
17
|
-
var HOOK_NARROW_SCRIPT_TEMPLATE_REL = "hooks/knowledge-hint-narrow.cjs";
|
|
18
|
-
var CLAUDE_HOOK_CONFIG_TEMPLATE_REL = "hooks/configs/claude-code.json";
|
|
19
|
-
var CODEX_HOOK_CONFIG_TEMPLATE_REL = "hooks/configs/codex-hooks.json";
|
|
20
|
-
var CURSOR_HOOK_CONFIG_TEMPLATE_REL = "hooks/configs/cursor-hooks.json";
|
|
21
|
-
var SKILL_DESTINATIONS = {
|
|
22
|
-
fabricArchive: [
|
|
23
|
-
".claude/skills/fabric-archive/SKILL.md",
|
|
24
|
-
".codex/skills/fabric-archive/SKILL.md"
|
|
25
|
-
],
|
|
26
|
-
fabricReview: [
|
|
27
|
-
".claude/skills/fabric-review/SKILL.md",
|
|
28
|
-
".codex/skills/fabric-review/SKILL.md"
|
|
29
|
-
],
|
|
30
|
-
fabricImport: [
|
|
31
|
-
".claude/skills/fabric-import/SKILL.md",
|
|
32
|
-
".codex/skills/fabric-import/SKILL.md"
|
|
33
|
-
]
|
|
34
|
-
};
|
|
35
|
-
var HOOK_SCRIPT_DESTINATIONS = {
|
|
36
|
-
fabricHint: [
|
|
37
|
-
".claude/hooks/fabric-hint.cjs",
|
|
38
|
-
".codex/hooks/fabric-hint.cjs",
|
|
39
|
-
".cursor/hooks/fabric-hint.cjs"
|
|
40
|
-
],
|
|
41
|
-
knowledgeHintBroad: [
|
|
42
|
-
".claude/hooks/knowledge-hint-broad.cjs",
|
|
43
|
-
".codex/hooks/knowledge-hint-broad.cjs",
|
|
44
|
-
".cursor/hooks/knowledge-hint-broad.cjs"
|
|
45
|
-
],
|
|
46
|
-
knowledgeHintNarrow: [
|
|
47
|
-
".claude/hooks/knowledge-hint-narrow.cjs",
|
|
48
|
-
".codex/hooks/knowledge-hint-narrow.cjs",
|
|
49
|
-
".cursor/hooks/knowledge-hint-narrow.cjs"
|
|
50
|
-
]
|
|
51
|
-
};
|
|
52
|
-
var HOOK_CONFIG_TARGETS = {
|
|
53
|
-
claudeCode: ".claude/settings.json",
|
|
54
|
-
codex: ".codex/hooks.json",
|
|
55
|
-
cursor: ".cursor/hooks.json"
|
|
56
|
-
};
|
|
57
|
-
var HOOK_CONFIG_ARRAY_PATHS = {
|
|
58
|
-
claudeCode: ["hooks.Stop", "hooks.SessionStart", "hooks.PreToolUse"],
|
|
59
|
-
codex: ["events.Stop", "events.SessionStart", "events.PreToolUse"],
|
|
60
|
-
cursor: ["hooks.stop", "hooks.sessionStart", "hooks.preToolUse"]
|
|
61
|
-
};
|
|
62
|
-
var FABRIC_HOOK_COMMAND_PATHS = {
|
|
63
|
-
claudeCode: {
|
|
64
|
-
fabricHint: ".claude/hooks/fabric-hint.cjs",
|
|
65
|
-
knowledgeHintBroad: ".claude/hooks/knowledge-hint-broad.cjs",
|
|
66
|
-
knowledgeHintNarrow: ".claude/hooks/knowledge-hint-narrow.cjs"
|
|
67
|
-
},
|
|
68
|
-
codex: {
|
|
69
|
-
fabricHint: ".codex/hooks/fabric-hint.cjs",
|
|
70
|
-
knowledgeHintBroad: ".codex/hooks/knowledge-hint-broad.cjs",
|
|
71
|
-
knowledgeHintNarrow: ".codex/hooks/knowledge-hint-narrow.cjs"
|
|
72
|
-
},
|
|
73
|
-
cursor: {
|
|
74
|
-
fabricHint: ".cursor/hooks/fabric-hint.cjs",
|
|
75
|
-
knowledgeHintBroad: ".cursor/hooks/knowledge-hint-broad.cjs",
|
|
76
|
-
knowledgeHintNarrow: ".cursor/hooks/knowledge-hint-narrow.cjs"
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
var SECTION_TARGETS = ["CLAUDE.md", "AGENTS.md", join(".cursor", "rules")];
|
|
80
|
-
var FABRIC_SECTION_BEGIN_MARKER = "<!-- fabric:knowledge-base:begin -->";
|
|
81
|
-
var FABRIC_SECTION_END_MARKER = "<!-- fabric:knowledge-base:end -->";
|
|
82
|
-
var FABRIC_SECTION_REGEX = /(?:\r?\n){0,2}<!-- fabric:knowledge-base:begin -->[\s\S]*?<!-- fabric:knowledge-base:end -->/;
|
|
83
|
-
function readFabricLanguagePreference(projectRoot) {
|
|
84
|
-
const configPath = join(projectRoot, ".fabric", "fabric-config.json");
|
|
85
|
-
if (!existsSync(configPath)) {
|
|
86
|
-
return "match-existing";
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
const raw = readFileSync(configPath, "utf8");
|
|
90
|
-
const parsed = JSON.parse(raw);
|
|
91
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
92
|
-
return "match-existing";
|
|
93
|
-
}
|
|
94
|
-
const value = parsed["fabric_language"];
|
|
95
|
-
return typeof value === "string" && value.length > 0 ? value : "match-existing";
|
|
96
|
-
} catch {
|
|
97
|
-
return "match-existing";
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function buildFabricKnowledgeBaseSection(fabricLanguage) {
|
|
101
|
-
return `${FABRIC_SECTION_BEGIN_MARKER}
|
|
102
|
-
|
|
103
|
-
## Fabric Knowledge Base
|
|
104
|
-
|
|
105
|
-
This project uses Fabric for persistent project knowledge under \`.fabric/knowledge/\`.
|
|
106
|
-
|
|
107
|
-
- **Discovery**: SessionStart lists available entries (broad menu); editing files may surface narrow hints
|
|
108
|
-
- **Usage**: call \`fab_get_knowledge_sections\` to fetch full content of any entry by id
|
|
109
|
-
- **Write flows**: see fabric-archive (record), fabric-review (validate), fabric-import (backfill) Skills
|
|
110
|
-
- **Language**: rendered per \`fabric_language\` in \`.fabric/fabric-config.json\` (current: \`${fabricLanguage}\`)
|
|
111
|
-
|
|
112
|
-
${FABRIC_SECTION_END_MARKER}`;
|
|
113
|
-
}
|
|
114
|
-
async function installFabricArchiveSkill(projectRoot, _options = {}) {
|
|
115
|
-
const source = await readTemplate(SKILL_TEMPLATE_REL);
|
|
116
|
-
const targets = SKILL_DESTINATIONS.fabricArchive.map((rel) => join(projectRoot, rel));
|
|
117
|
-
const results = [];
|
|
118
|
-
for (const target of targets) {
|
|
119
|
-
results.push(await copyTextIdempotent("skill", source, target));
|
|
120
|
-
}
|
|
121
|
-
return results;
|
|
122
|
-
}
|
|
123
|
-
async function installFabricReviewSkill(projectRoot, _options = {}) {
|
|
124
|
-
const source = await readTemplate(SKILL_REVIEW_TEMPLATE_REL);
|
|
125
|
-
const targets = SKILL_DESTINATIONS.fabricReview.map((rel) => join(projectRoot, rel));
|
|
126
|
-
const results = [];
|
|
127
|
-
for (const target of targets) {
|
|
128
|
-
results.push(await copyTextIdempotent("skill-review", source, target));
|
|
129
|
-
}
|
|
130
|
-
return results;
|
|
131
|
-
}
|
|
132
|
-
async function installFabricImportSkill(projectRoot, _options = {}) {
|
|
133
|
-
const source = await readTemplate(SKILL_IMPORT_TEMPLATE_REL);
|
|
134
|
-
const targets = SKILL_DESTINATIONS.fabricImport.map((rel) => join(projectRoot, rel));
|
|
135
|
-
const results = [];
|
|
136
|
-
for (const target of targets) {
|
|
137
|
-
results.push(await copyTextIdempotent("skill-import", source, target));
|
|
138
|
-
}
|
|
139
|
-
return results;
|
|
140
|
-
}
|
|
141
|
-
async function installArchiveHintHook(projectRoot, _options = {}) {
|
|
142
|
-
const source = await readTemplate(HOOK_SCRIPT_TEMPLATE_REL);
|
|
143
|
-
const targets = HOOK_SCRIPT_DESTINATIONS.fabricHint.map((rel) => join(projectRoot, rel));
|
|
144
|
-
const results = [];
|
|
145
|
-
for (const target of targets) {
|
|
146
|
-
const result = await copyTextIdempotent("hook-script", source, target);
|
|
147
|
-
if (result.status === "written" && process.platform !== "win32") {
|
|
148
|
-
try {
|
|
149
|
-
chmodSync(target, 493);
|
|
150
|
-
} catch {
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
results.push(result);
|
|
154
|
-
}
|
|
155
|
-
return results;
|
|
156
|
-
}
|
|
157
|
-
async function installKnowledgeHintBroadHook(projectRoot, _options = {}) {
|
|
158
|
-
const source = await readTemplate(HOOK_BROAD_SCRIPT_TEMPLATE_REL);
|
|
159
|
-
const targets = HOOK_SCRIPT_DESTINATIONS.knowledgeHintBroad.map((rel) => join(projectRoot, rel));
|
|
160
|
-
const results = [];
|
|
161
|
-
for (const target of targets) {
|
|
162
|
-
const result = await copyTextIdempotent("hook-broad-script", source, target);
|
|
163
|
-
if (result.status === "written" && process.platform !== "win32") {
|
|
164
|
-
try {
|
|
165
|
-
chmodSync(target, 493);
|
|
166
|
-
} catch {
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
results.push(result);
|
|
170
|
-
}
|
|
171
|
-
return results;
|
|
172
|
-
}
|
|
173
|
-
async function installKnowledgeHintNarrowHook(projectRoot, _options = {}) {
|
|
174
|
-
const source = await readTemplate(HOOK_NARROW_SCRIPT_TEMPLATE_REL);
|
|
175
|
-
const targets = HOOK_SCRIPT_DESTINATIONS.knowledgeHintNarrow.map((rel) => join(projectRoot, rel));
|
|
176
|
-
const results = [];
|
|
177
|
-
for (const target of targets) {
|
|
178
|
-
const result = await copyTextIdempotent("hook-narrow-script", source, target);
|
|
179
|
-
if (result.status === "written" && process.platform !== "win32") {
|
|
180
|
-
try {
|
|
181
|
-
chmodSync(target, 493);
|
|
182
|
-
} catch {
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
results.push(result);
|
|
186
|
-
}
|
|
187
|
-
return results;
|
|
188
|
-
}
|
|
189
|
-
async function mergeClaudeCodeHookConfig(projectRoot, _options = {}) {
|
|
190
|
-
const fragment = await readJsonTemplate(CLAUDE_HOOK_CONFIG_TEMPLATE_REL);
|
|
191
|
-
const targetPath = join(projectRoot, HOOK_CONFIG_TARGETS.claudeCode);
|
|
192
|
-
return mergeJsonIdempotent(
|
|
193
|
-
"claude-hook-config",
|
|
194
|
-
targetPath,
|
|
195
|
-
fragment,
|
|
196
|
-
[...HOOK_CONFIG_ARRAY_PATHS.claudeCode]
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
async function mergeCodexHookConfig(projectRoot, _options = {}) {
|
|
200
|
-
const fragment = await readJsonTemplate(CODEX_HOOK_CONFIG_TEMPLATE_REL);
|
|
201
|
-
const targetPath = join(projectRoot, HOOK_CONFIG_TARGETS.codex);
|
|
202
|
-
return mergeJsonIdempotent(
|
|
203
|
-
"codex-hook-config",
|
|
204
|
-
targetPath,
|
|
205
|
-
fragment,
|
|
206
|
-
[...HOOK_CONFIG_ARRAY_PATHS.codex]
|
|
207
|
-
);
|
|
208
|
-
}
|
|
209
|
-
async function mergeCursorHookConfig(projectRoot, _options = {}) {
|
|
210
|
-
const fragment = await readJsonTemplate(CURSOR_HOOK_CONFIG_TEMPLATE_REL);
|
|
211
|
-
const targetPath = join(projectRoot, HOOK_CONFIG_TARGETS.cursor);
|
|
212
|
-
return mergeJsonIdempotent(
|
|
213
|
-
"cursor-hook-config",
|
|
214
|
-
targetPath,
|
|
215
|
-
fragment,
|
|
216
|
-
[...HOOK_CONFIG_ARRAY_PATHS.cursor]
|
|
217
|
-
);
|
|
218
|
-
}
|
|
219
|
-
async function addFabricKnowledgeBaseSection(projectRoot, fabricLanguage, _options = {}) {
|
|
220
|
-
const sectionBody = buildFabricKnowledgeBaseSection(fabricLanguage);
|
|
221
|
-
const results = [];
|
|
222
|
-
for (const rel of SECTION_TARGETS) {
|
|
223
|
-
const target = join(projectRoot, rel);
|
|
224
|
-
if (!existsSync(target)) {
|
|
225
|
-
results.push({ step: "section", path: target, status: "skipped", message: "absent" });
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
let existing;
|
|
229
|
-
try {
|
|
230
|
-
existing = await readFile(target, "utf8");
|
|
231
|
-
} catch (error) {
|
|
232
|
-
results.push({
|
|
233
|
-
step: "section",
|
|
234
|
-
path: target,
|
|
235
|
-
status: "error",
|
|
236
|
-
message: error instanceof Error ? error.message : String(error)
|
|
237
|
-
});
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
let next;
|
|
241
|
-
const match = existing.match(FABRIC_SECTION_REGEX);
|
|
242
|
-
if (match !== null) {
|
|
243
|
-
const before = existing.slice(0, match.index ?? 0);
|
|
244
|
-
const after = existing.slice((match.index ?? 0) + match[0].length);
|
|
245
|
-
const stripped = `${before}${after.replace(/^\r?\n/, "")}`;
|
|
246
|
-
const trailingNewline = stripped.length === 0 || stripped.endsWith("\n") ? "" : "\n";
|
|
247
|
-
next = `${stripped}${trailingNewline}
|
|
248
|
-
${sectionBody}
|
|
249
|
-
`;
|
|
250
|
-
} else {
|
|
251
|
-
const trailingNewline = existing.length === 0 || existing.endsWith("\n") ? "" : "\n";
|
|
252
|
-
next = `${existing}${trailingNewline}
|
|
253
|
-
${sectionBody}
|
|
254
|
-
`;
|
|
255
|
-
}
|
|
256
|
-
if (next === existing) {
|
|
257
|
-
results.push({ step: "section", path: target, status: "skipped", message: "up-to-date" });
|
|
258
|
-
continue;
|
|
259
|
-
}
|
|
260
|
-
try {
|
|
261
|
-
await atomicWriteText(target, next);
|
|
262
|
-
results.push({ step: "section", path: target, status: "written" });
|
|
263
|
-
} catch (error) {
|
|
264
|
-
results.push({
|
|
265
|
-
step: "section",
|
|
266
|
-
path: target,
|
|
267
|
-
status: "error",
|
|
268
|
-
message: error instanceof Error ? error.message : String(error)
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return results;
|
|
273
|
-
}
|
|
274
|
-
async function copyTextIdempotent(step, source, target) {
|
|
275
|
-
if (existsSync(target)) {
|
|
276
|
-
try {
|
|
277
|
-
const existing = readFileSync(target, "utf8");
|
|
278
|
-
if (existing === source) {
|
|
279
|
-
return { step, path: target, status: "skipped", message: "up-to-date" };
|
|
280
|
-
}
|
|
281
|
-
} catch {
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
await mkdir(dirname(target), { recursive: true });
|
|
285
|
-
await atomicWriteText(target, source);
|
|
286
|
-
return { step, path: target, status: "written" };
|
|
287
|
-
}
|
|
288
|
-
async function mergeJsonIdempotent(step, target, fragment, arrayAppendPaths) {
|
|
289
|
-
const existing = await readJsonObjectOrEmpty(target);
|
|
290
|
-
const merged = deepMerge(existing, fragment, { arrayAppendPaths });
|
|
291
|
-
if (jsonEqual(existing, merged)) {
|
|
292
|
-
return { step, path: target, status: "skipped", message: "up-to-date" };
|
|
293
|
-
}
|
|
294
|
-
await mkdir(dirname(target), { recursive: true });
|
|
295
|
-
await atomicWriteJson(target, merged, { indent: 2 });
|
|
296
|
-
return { step, path: target, status: "written" };
|
|
297
|
-
}
|
|
298
|
-
async function readJsonObjectOrEmpty(path) {
|
|
299
|
-
try {
|
|
300
|
-
const raw = await readFile(path, "utf8");
|
|
301
|
-
if (raw.trim().length === 0) {
|
|
302
|
-
return {};
|
|
303
|
-
}
|
|
304
|
-
const parsed = JSON.parse(raw);
|
|
305
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
306
|
-
return {};
|
|
307
|
-
}
|
|
308
|
-
return parsed;
|
|
309
|
-
} catch (error) {
|
|
310
|
-
if (error instanceof Error && "code" in error && error.code === "ENOENT") {
|
|
311
|
-
return {};
|
|
312
|
-
}
|
|
313
|
-
throw error;
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function jsonEqual(a, b) {
|
|
317
|
-
return JSON.stringify(a) === JSON.stringify(b);
|
|
318
|
-
}
|
|
319
|
-
async function readTemplate(relativePath) {
|
|
320
|
-
const path = findTemplatePath(relativePath);
|
|
321
|
-
return readFile(path, "utf8");
|
|
322
|
-
}
|
|
323
|
-
async function readJsonTemplate(relativePath) {
|
|
324
|
-
const raw = await readTemplate(relativePath);
|
|
325
|
-
const parsed = JSON.parse(raw);
|
|
326
|
-
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
327
|
-
throw new Error(`Template at ${relativePath} is not a JSON object`);
|
|
328
|
-
}
|
|
329
|
-
return parsed;
|
|
330
|
-
}
|
|
331
|
-
function findTemplatePath(relativePath) {
|
|
332
|
-
const startDir = dirname(fileURLToPath(import.meta.url));
|
|
333
|
-
let current = resolve(startDir);
|
|
334
|
-
while (true) {
|
|
335
|
-
const candidate = join(current, "templates", relativePath);
|
|
336
|
-
if (existsSync(candidate)) {
|
|
337
|
-
return candidate;
|
|
338
|
-
}
|
|
339
|
-
const parent = dirname(current);
|
|
340
|
-
if (parent === current || parse(current).root === current) {
|
|
341
|
-
throw new Error(`Template not found: templates/${relativePath} (searched up from ${startDir})`);
|
|
342
|
-
}
|
|
343
|
-
current = parent;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export {
|
|
348
|
-
SKILL_DESTINATIONS,
|
|
349
|
-
HOOK_SCRIPT_DESTINATIONS,
|
|
350
|
-
HOOK_CONFIG_TARGETS,
|
|
351
|
-
HOOK_CONFIG_ARRAY_PATHS,
|
|
352
|
-
FABRIC_HOOK_COMMAND_PATHS,
|
|
353
|
-
SECTION_TARGETS,
|
|
354
|
-
FABRIC_SECTION_REGEX,
|
|
355
|
-
readFabricLanguagePreference,
|
|
356
|
-
installFabricArchiveSkill,
|
|
357
|
-
installFabricReviewSkill,
|
|
358
|
-
installFabricImportSkill,
|
|
359
|
-
installArchiveHintHook,
|
|
360
|
-
installKnowledgeHintBroadHook,
|
|
361
|
-
installKnowledgeHintNarrowHook,
|
|
362
|
-
mergeClaudeCodeHookConfig,
|
|
363
|
-
mergeCodexHookConfig,
|
|
364
|
-
mergeCursorHookConfig,
|
|
365
|
-
addFabricKnowledgeBaseSection
|
|
366
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# { projectName } — Fabric Bootstrap Protocol
|
|
2
|
-
|
|
3
|
-
## CORE RULES (DO NOT TRANSLATE)
|
|
4
|
-
|
|
5
|
-
MUST: Treat this file as the Fabric Protocol bootstrap for this repository.
|
|
6
|
-
MUST: Treat `.fabric/knowledge/` as the source of truth for all Fabric knowledge entries.
|
|
7
|
-
MUST: Before ANY code reading, architecture planning, or logic modification, call `fab_plan_context(paths=[<target file>])`, then call `fab_get_knowledge_sections`.
|
|
8
|
-
MUST: When creating or changing a knowledge entry, keep `.fabric/agents.meta.json` synchronized through Fabric tooling (never hand-edit).
|
|
9
|
-
MUST: Preserve protected tokens exactly: `AGENTS.md`, `.fabric/knowledge/`, `.fabric/agents.meta.json`, `fab_plan_context`, `fab_get_knowledge_sections`, `knowledge sources`, `MUST`, `NEVER`.
|
|
10
|
-
NEVER: Add import-style directive lines to this bootstrap file.
|
|
11
|
-
NEVER: Put domain knowledge bodies, framework rules, or repository specifics in this file.
|
|
12
|
-
NEVER: Create colocated `AGENTS.md` knowledge files under source directories.
|
|
13
|
-
NEVER: Hand-edit anything under `.fabric/knowledge/pending/` outside of the proposal/review workflow.
|
|
14
|
-
|
|
15
|
-
## 使用说明 / Explanation
|
|
16
|
-
|
|
17
|
-
- 本文件只负责启动 Fabric Bootstrap Protocol,不承载项目业务知识。
|
|
18
|
-
- 详细 bootstrap 说明位于 `.fabric/bootstrap/README.md`。
|
|
19
|
-
- Detected framework kind: `{ frameworkKind }`.
|
|
20
|
-
- This repository uses `knowledge mirroring`: source directories contain ZERO knowledge files, while `.fabric/knowledge/` holds all AI-facing constraints, organized by knowledge type.
|
|
21
|
-
- 跨领域、根级知识应放在对应的 `.fabric/knowledge/{type}/` 子目录下。
|
|
22
|
-
- If `.fabric/knowledge/` is empty after init, continue with the Fabric initialization flow before normal coding.
|
|
23
|
-
|
|
24
|
-
## Knowledge layer (v2)
|
|
25
|
-
|
|
26
|
-
Fabric v2 organises every AI-facing knowledge entry along three orthogonal axes: **type**, **maturity**, and **layer**. All entries live as flat markdown files with YAML frontmatter — no nesting, no implicit hierarchies.
|
|
27
|
-
|
|
28
|
-
### 5 knowledge types
|
|
29
|
-
|
|
30
|
-
Each entry lives in exactly one of these subdirectories of `.fabric/knowledge/`:
|
|
31
|
-
|
|
32
|
-
- `decisions/` — architectural / design decisions (the "why" behind a choice, with rejected alternatives)
|
|
33
|
-
- `pitfalls/` — known traps, footguns, and "do-not-do-X" lessons learned the hard way
|
|
34
|
-
- `guidelines/` — actionable rules and conventions the AI should follow when generating or modifying code
|
|
35
|
-
- `models/` — domain models, data shapes, and conceptual abstractions (entities, invariants)
|
|
36
|
-
- `processes/` — multi-step workflows, runbooks, and operational sequences
|
|
37
|
-
|
|
38
|
-
### 3 maturity levels
|
|
39
|
-
|
|
40
|
-
The `maturity` frontmatter field expresses how trusted an entry is:
|
|
41
|
-
|
|
42
|
-
- `draft` — newly captured, not yet reviewed; the AI may consult it but should treat it as provisional
|
|
43
|
-
- `verified` — reviewed and confirmed correct in the current codebase; safe to rely on
|
|
44
|
-
- `proven` — verified and battle-tested across multiple changes; treat as authoritative
|
|
45
|
-
|
|
46
|
-
Promotion is one-way (`draft` → `verified` → `proven`); demotion happens only via the review workflow.
|
|
47
|
-
|
|
48
|
-
### 2 layers (dual-root)
|
|
49
|
-
|
|
50
|
-
Knowledge lives in two physical roots that share the same schema:
|
|
51
|
-
|
|
52
|
-
- `~/.fabric/knowledge/` — **personal layer** (per-user, NOT committed). Entries here use the `KP-` stable_id prefix. Use this layer for individual preferences, scratch notes, and cross-project habits.
|
|
53
|
-
- `<repo>/.fabric/knowledge/` — **team layer** (committed to the repo). Entries here use the `KT-` stable_id prefix. Use this layer for anything every contributor (human or AI) should respect.
|
|
54
|
-
|
|
55
|
-
A given entry belongs to exactly one layer; layer-flip (KP ↔ KT) is the only legal mutation of stable_id.
|
|
56
|
-
|
|
57
|
-
### Proposal staging: `pending/`
|
|
58
|
-
|
|
59
|
-
`.fabric/knowledge/pending/` is the staging area for proposed entries awaiting review. The async-review workflow (`fabric-review` skill, rc.3) promotes pending entries into one of the 5 type subdirectories once accepted, or archives them on rejection. **Never** hand-edit files under `pending/` directly — use the proposal tooling.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Fabric Bootstrap
|
|
2
|
-
- 主说明文档已收敛到 `.fabric/bootstrap/README.md`。
|
|
3
|
-
- 项目级 bootstrap 入口仍然是 `AGENTS.md`。
|
|
4
|
-
- 修改任何文件前必须调用 `fab_plan_context(paths=[<被改文件>])`,再调用 `fab_get_knowledge_sections` 获取规则段落。
|
|
5
|
-
MCP 和 doctor 会写入 `.fabric/events.jsonl`。
|
|
6
|
-
- 规则 baseline 变更通过 `fabric doctor --fix` 接受。
|
|
7
|
-
|
|
8
|
-
@AGENTS.md
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# Fabric Bootstrap
|
|
2
|
-
- 主说明文档已收敛到 `.fabric/bootstrap/README.md`。
|
|
3
|
-
- 此 header 仅用于把 Codex 引导到 Fabric 项目级规则入口。
|
|
4
|
-
- 修改任何文件前必须调用 `fab_plan_context(paths=[<被改文件>])`,再调用 `fab_get_knowledge_sections` 获取规则段落。
|
|
5
|
-
MCP 和 doctor 会写入 `.fabric/events.jsonl`。
|
|
6
|
-
- 规则 baseline 变更通过 `fabric doctor --fix` 接受。
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
alwaysApply: true
|
|
3
|
-
description: Fabric Protocol bootstrap rules
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Fabric Bootstrap
|
|
7
|
-
- 本项目使用 Fabric Protocol 管理规则。
|
|
8
|
-
- **任何文件修改前**,必须先调 MCP tool `fab_plan_context(paths=[<被改文件>])`,再调 `fab_get_knowledge_sections` 获取规则段落。
|
|
9
|
-
- 新建或调整 L1/L2 节点时,修改规则源文件后运行 `fabric doctor --fix` 接受 baseline,**严禁**直接编辑 `.fabric/agents.meta.json`。
|
|
10
|
-
Fabric 会把 MCP 和 doctor 行为写入 `.fabric/events.jsonl`。
|