@fenglimg/fabric-shared 2.0.0-rc.13 → 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-QZNUUIL3.js +39 -0
- package/dist/{chunk-WIH5HBKU.js → chunk-VKCXD6CI.js} +218 -114
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +305 -36
- package/dist/index.js +538 -339
- package/dist/templates/bootstrap-canonical.d.ts +56 -0
- package/dist/templates/bootstrap-canonical.js +18 -0
- package/dist/types/index.d.ts +0 -2
- package/package.json +7 -3
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Fabric bootstrap content + marker constants — single source of truth
|
|
3
|
+
* consumed by both `fab install` (writer) and the server-side doctor (drift
|
|
4
|
+
* comparator). Mirrors the rc.18 banner-i18n shared-module pattern: shared
|
|
5
|
+
* constants in `packages/shared` so the cross-package boundary stays clean
|
|
6
|
+
* (server has zero dep on cli).
|
|
7
|
+
*
|
|
8
|
+
* rc.19 bootstrap-consolidation TASK-001: hoisted from per-writer ad-hoc
|
|
9
|
+
* strings. The canonical body is fixed for all projects — no interpolation —
|
|
10
|
+
* and intentionally zh-CN-hybrid per locked clarification 3.
|
|
11
|
+
*
|
|
12
|
+
* IMPORTANT: the {@link BOOTSTRAP_CANONICAL} body is byte-locked. Do not edit
|
|
13
|
+
* casually — downstream drift detection asserts byte-identical equality, and
|
|
14
|
+
* the published-package version becomes the contract between Fabric CLI and
|
|
15
|
+
* any Fabric server.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* HTML-comment marker pair delimiting the managed Fabric bootstrap section.
|
|
19
|
+
* Both writer (idempotent in-place replace) and uninstall helper match these
|
|
20
|
+
* as plain substrings — keep byte-identical.
|
|
21
|
+
*/
|
|
22
|
+
declare const BOOTSTRAP_MARKER_BEGIN = "<!-- fabric:bootstrap:begin -->";
|
|
23
|
+
declare const BOOTSTRAP_MARKER_END = "<!-- fabric:bootstrap:end -->";
|
|
24
|
+
/**
|
|
25
|
+
* Legacy marker pair from rc.12-rc.18 era (when the managed section was
|
|
26
|
+
* branded "Fabric Knowledge Base"). Retained here for one-time migration
|
|
27
|
+
* detection only: rc.19 install path scans for legacy markers, strips the
|
|
28
|
+
* legacy region, and rewrites with the new bootstrap markers.
|
|
29
|
+
*/
|
|
30
|
+
declare const LEGACY_KB_MARKER_BEGIN = "<!-- fabric:knowledge-base:begin -->";
|
|
31
|
+
declare const LEGACY_KB_MARKER_END = "<!-- fabric:knowledge-base:end -->";
|
|
32
|
+
/**
|
|
33
|
+
* Regex matching the entire managed bootstrap section, markers inclusive,
|
|
34
|
+
* with an optional preceding blank-line separator (so re-install / uninstall
|
|
35
|
+
* don't leave orphan blank lines). Non-greedy body matches any content
|
|
36
|
+
* between the begin/end markers, including newlines. Mirrors the shape of
|
|
37
|
+
* the existing `FABRIC_SECTION_REGEX` in `packages/cli/src/install/skills-and-hooks.ts`.
|
|
38
|
+
*/
|
|
39
|
+
declare const BOOTSTRAP_REGEX: RegExp;
|
|
40
|
+
/**
|
|
41
|
+
* Legacy-marker variant used for one-time migration detection during rc.19
|
|
42
|
+
* install — same shape as {@link BOOTSTRAP_REGEX} but targets the older
|
|
43
|
+
* `knowledge-base` marker pair.
|
|
44
|
+
*/
|
|
45
|
+
declare const LEGACY_KB_REGEX: RegExp;
|
|
46
|
+
/**
|
|
47
|
+
* Canonical bootstrap body — byte-locked per rc.19 locked clarification 3.
|
|
48
|
+
* Rendered into the managed block between {@link BOOTSTRAP_MARKER_BEGIN} and
|
|
49
|
+
* {@link BOOTSTRAP_MARKER_END} by `fab install` across all three supported
|
|
50
|
+
* clients (Claude Code, Cursor, Codex CLI).
|
|
51
|
+
*
|
|
52
|
+
* Length guarantee: ≥ 400 bytes.
|
|
53
|
+
*/
|
|
54
|
+
declare const BOOTSTRAP_CANONICAL = "# Fabric Bootstrap\n\n\u672C\u9879\u76EE\u4F7F\u7528 Fabric \u7BA1\u7406\u8DE8\u5BA2\u6237\u7AEF AI \u77E5\u8BC6\u4E0E\u884C\u4E3A\u89C4\u5219\u3002\u672C\u6587\u4EF6\u7531 `fab install` \u540C\u6B65\u5230\u4E09\u7AEF managed block,**\u4E0D\u8981\u624B\u52A8\u7F16\u8F91\u4E09\u7AEF\u7684 block**,\u53EA\u6539\u8FD9\u91CC + \u91CD\u8DD1 `fab install`\u3002\n\n## \u884C\u4E3A\u89C4\u5219\n- **\u4FEE\u6539\u4EFB\u4F55\u6587\u4EF6\u524D**:\u5FC5\u987B\u5148\u8C03 `fab_plan_context(paths=[<\u88AB\u6539\u6587\u4EF6>])`,\u518D\u8C03 `fab_get_knowledge_sections` \u53D6\u76F8\u5173\u89C4\u5219\u6BB5\u843D\u3002\n- **`.fabric/agents.meta.json` \u4E25\u7981\u624B\u52A8\u7F16\u8F91**:baseline \u53D8\u66F4\u53EA\u80FD\u901A\u8FC7 `fabric doctor --fix` \u63A5\u53D7\u3002\n\n## \u77E5\u8BC6\u5E93(KB)\n- **Discovery**:SessionStart hook \u5217 broad-scoped \u6761\u76EE;edit \u6587\u4EF6\u65F6 PreToolUse hook \u53EF\u80FD\u89E6\u53D1 narrow hint\u3002\n- **Usage**:\u7528 `fab_get_knowledge_sections(id=...)` \u6309 id \u53D6\u6761\u76EE\u5168\u6587\u3002\n- **Write flows**:`fabric-archive` / `fabric-review` / `fabric-import` \u4E09\u4E2A Skills\u3002\n- **Language**:\u6E32\u67D3\u6309 `.fabric/fabric-config.json` \u7684 `fabric_language` \u5B57\u6BB5\u3002\n\n## Cite policy\n\n- **\u89E6\u53D1**: \u505A edit / decide / propose plan \u4E4B\u524D,**\u56DE\u590D\u9996\u884C**\u5FC5\u987B\u5199 `KB: <id> (<\u22648\u5B57 \u7528\u6CD5>) [planned|recalled|chained-from <id>|dismissed:<reason>]` \u6216 `KB: none`\u3002\n- **`[recalled]` \u9A8C\u8BC1**: \u5FC5\u987B\u7D27\u8DDF\u4E00\u6B21 `fab_get_knowledge_sections(id=...)`,\u9632\u6B62\u7F16\u9020 id\u3002\n- **\u7528\u6237\u53E3\u5934\u63D0\u89C4\u5219\u6CA1\u7ED9 id**: \u5148\u8C03 `fab_extract_knowledge` \u6216 `search_context` \u53CD\u67E5\u3002\n- **dismissed reason**: \u679A\u4E3E `scope-mismatch | outdated | not-applicable | other:<text>`\u3002\n- **\u7A3D\u6838**: `fab doctor --cite-coverage [--since=7d] [--client=cc|codex|all]` \u8F93\u51FA cite \u8986\u76D6\u7387\u3002\u672C\u89C4\u5219\u4E0D\u963B\u65AD\u4F60\u5DE5\u4F5C,\u53EA\u8BB0\u5F55\u3002\n";
|
|
55
|
+
|
|
56
|
+
export { BOOTSTRAP_CANONICAL, BOOTSTRAP_MARKER_BEGIN, BOOTSTRAP_MARKER_END, BOOTSTRAP_REGEX, LEGACY_KB_MARKER_BEGIN, LEGACY_KB_MARKER_END, LEGACY_KB_REGEX };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BOOTSTRAP_CANONICAL,
|
|
3
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
4
|
+
BOOTSTRAP_MARKER_END,
|
|
5
|
+
BOOTSTRAP_REGEX,
|
|
6
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
7
|
+
LEGACY_KB_MARKER_END,
|
|
8
|
+
LEGACY_KB_REGEX
|
|
9
|
+
} from "../chunk-QZNUUIL3.js";
|
|
10
|
+
export {
|
|
11
|
+
BOOTSTRAP_CANONICAL,
|
|
12
|
+
BOOTSTRAP_MARKER_BEGIN,
|
|
13
|
+
BOOTSTRAP_MARKER_END,
|
|
14
|
+
BOOTSTRAP_REGEX,
|
|
15
|
+
LEGACY_KB_MARKER_BEGIN,
|
|
16
|
+
LEGACY_KB_MARKER_END,
|
|
17
|
+
LEGACY_KB_REGEX
|
|
18
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -111,9 +111,7 @@ type FabricLanguage = "match-existing" | "zh-CN" | "en" | "zh-CN-hybrid";
|
|
|
111
111
|
type DefaultLayerFilter = "team" | "personal" | "both";
|
|
112
112
|
interface FabricConfig {
|
|
113
113
|
clientPaths?: ClientPaths;
|
|
114
|
-
externalFixturePath?: string;
|
|
115
114
|
scanIgnores?: string[];
|
|
116
|
-
auditMode?: AuditMode;
|
|
117
115
|
audit_mode?: AuditMode;
|
|
118
116
|
mcpPayloadLimits?: McpPayloadLimits;
|
|
119
117
|
fabric_language?: FabricLanguage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fenglimg/fabric-shared",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.21",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"./schemas/api-contracts": {
|
|
37
37
|
"types": "./dist/schemas/api-contracts.d.ts",
|
|
38
38
|
"import": "./dist/schemas/api-contracts.js"
|
|
39
|
+
},
|
|
40
|
+
"./templates/bootstrap-canonical": {
|
|
41
|
+
"types": "./dist/templates/bootstrap-canonical.d.ts",
|
|
42
|
+
"import": "./dist/templates/bootstrap-canonical.js"
|
|
39
43
|
}
|
|
40
44
|
},
|
|
41
45
|
"files": [
|
|
@@ -52,8 +56,8 @@
|
|
|
52
56
|
"vitest": "^3.2.4"
|
|
53
57
|
},
|
|
54
58
|
"scripts": {
|
|
55
|
-
"build": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts --format esm --dts --clean",
|
|
56
|
-
"dev": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts --format esm --dts --watch",
|
|
59
|
+
"build": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts src/templates/bootstrap-canonical.ts --format esm --dts --clean",
|
|
60
|
+
"dev": "tsup src/index.ts src/i18n/index.ts src/types/index.ts src/node.ts src/node/atomic-write.ts src/node/mcp-payload-guard.ts src/errors/index.ts src/schemas/api-contracts.ts src/templates/bootstrap-canonical.ts --format esm --dts --watch",
|
|
57
61
|
"test": "vitest run",
|
|
58
62
|
"test:coverage": "vitest run --coverage"
|
|
59
63
|
}
|