@fenglimg/fabric-cli 2.2.0 → 2.3.0-rc.1
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/README.md +2 -2
- package/dist/audit-PURSJJFH.js +734 -0
- package/dist/{chunk-QPAW6IYT.js → chunk-7V4XMLQ2.js} +3 -3
- package/dist/{chunk-7ZDXBOOU.js → chunk-ACSMNX3V.js} +44 -128
- package/dist/{chunk-PTGQAZEW.js → chunk-GGDVZCD6.js} +2 -4
- package/dist/{chunk-EOT63RDH.js → chunk-I5F5BHWI.js} +9 -0
- package/dist/chunk-PP7QVRXH.js +565 -0
- package/dist/chunk-SL77FXX7.js +54 -0
- package/dist/{chunk-3D7B2UAZ.js → chunk-VQKXTMWH.js} +44 -4
- package/dist/doctor-S6KPGS35.js +27 -0
- package/dist/index.js +90 -80
- package/dist/{info-7FKBTMVO.js → info-NJEY26H6.js} +91 -46
- package/dist/{context-UJCGYOT6.js → inspect-5YZMJPFM.js} +10 -10
- package/dist/{install-v2-3KJX3YRO.js → install-v2-KGIDII4H.js} +163 -364
- package/dist/{store-HOCORVL3.js → store-GF4SFBMJ.js} +155 -57
- package/dist/{sync-DT5UJMMR.js → sync-3XCIRDPK.js} +3 -4
- package/dist/{uninstall-IFN2KYBK.js → uninstall-BG4ML4FC.js} +39 -10
- package/package.json +3 -7
- package/templates/hooks/cite-policy-evict.cjs +1 -1
- package/templates/hooks/configs/claude-code.json +1 -5
- package/templates/hooks/configs/codex-hooks.json +1 -5
- package/templates/hooks/fabric-hint.cjs +67 -41
- package/templates/hooks/knowledge-hint-broad.cjs +82 -24
- package/templates/hooks/knowledge-hint-narrow.cjs +3 -3
- package/templates/hooks/knowledge-pretooluse.cjs +111 -0
- package/templates/hooks/lib/banner-i18n.cjs +12 -11
- package/templates/hooks/lib/bindings-snapshot-reader.cjs +1 -1
- package/templates/hooks/lib/event-writer.cjs +79 -0
- package/templates/hooks/lib/nudge-policy.cjs +11 -0
- package/templates/hooks/lib/theme.cjs +62 -0
- package/templates/hooks/post-tooluse-mutation.cjs +28 -39
- package/templates/skills/fabric-archive/SKILL.md +29 -12
- package/templates/skills/fabric-archive/ref/dry-run-scope.md +1 -1
- package/templates/skills/fabric-archive/ref/i18n-policy.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-1-5-onboard.md +5 -5
- package/templates/skills/fabric-archive/ref/phase-1-cross-session.md +2 -2
- package/templates/skills/fabric-archive/ref/phase-2-5-viability.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-3-5-scope.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-3-6-related-edges.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-3-classify.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-4-5-emit.md +1 -1
- package/templates/skills/fabric-archive/ref/phase-4-mcp-persist.md +6 -5
- package/templates/skills/{fabric-import/ref/checkpoint-state.md → fabric-archive/ref/source-checkpoint.md} +3 -3
- package/templates/skills/{fabric-import/ref/phase-3-dedup.md → fabric-archive/ref/source-dedup.md} +4 -4
- package/templates/skills/{fabric-import/ref/phase-2-mining.md → fabric-archive/ref/source-mining.md} +20 -20
- package/templates/skills/{fabric-import/ref/output-contract.md → fabric-archive/ref/source-output-contract.md} +3 -3
- package/templates/skills/{fabric-import/ref/state-recovery.md → fabric-archive/ref/source-state-recovery.md} +2 -2
- package/templates/skills/{fabric-import/ref/worked-examples.md → fabric-archive/ref/source-worked-examples.md} +10 -10
- package/templates/skills/fabric-archive/ref/worked-examples.md +3 -3
- package/templates/skills/fabric-review/SKILL.md +19 -15
- package/templates/skills/fabric-review/ref/cite-contract.md +2 -2
- package/templates/skills/fabric-review/ref/modify-flow.md +13 -1
- package/templates/skills/fabric-review/ref/per-mode-flows.md +5 -5
- package/templates/skills/fabric-review/ref/relate-mode.md +33 -0
- package/templates/skills/fabric-review/ref/retire-mode.md +47 -0
- package/templates/skills/fabric-review/ref/semantic-check.md +1 -1
- package/templates/skills/fabric-review/ref/worked-examples.md +5 -5
- package/templates/skills/fabric-store/SKILL.md +12 -27
- package/templates/skills/fabric-sync/SKILL.md +16 -35
- package/templates/skills/lib/shared-policy.md +6 -4
- package/dist/chunk-27HK6H5Y.js +0 -69
- package/dist/chunk-E7HJUU34.js +0 -1096
- package/dist/chunk-NLNH64A3.js +0 -43
- package/dist/chunk-QFIVFZRH.js +0 -13
- package/dist/doctor-MDTZWKBK.js +0 -24
- package/dist/metrics-HMFH4YHK.js +0 -135
- package/dist/scope-explain-HLJZ2M33.js +0 -48
- package/dist/status-4R3TM4FJ.js +0 -37
- package/dist/whoami-ITGEFWH4.js +0 -49
- package/templates/skills/fabric/SKILL.md +0 -100
- package/templates/skills/fabric-audit/SKILL.md +0 -63
- package/templates/skills/fabric-connect/SKILL.md +0 -48
- package/templates/skills/fabric-import/SKILL.md +0 -151
- package/templates/skills/fabric-import/ref/i18n-policy.md +0 -78
|
@@ -1,44 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fabric-store
|
|
3
|
-
description:
|
|
3
|
+
description: store 运维 thin shim — 把「创建/挂载/绑定/列出/切换写库/迁移」意图路由到 `fabric store …` CLI。CLI 是引擎与安全门;本 skill 只指路。Triggers store 运维/挂载 store/绑定知识库.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# fabric-store —
|
|
6
|
+
# fabric-store — store 运维 thin shim
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## When to use
|
|
11
|
-
|
|
12
|
-
- 「创建团队 store」「建个人知识 store」
|
|
13
|
-
- 「挂载团队 store」「这个项目要绑团队 store」
|
|
14
|
-
- 「列出挂了哪些 store?」「我的共享决策写到哪个 store?」
|
|
15
|
-
|
|
16
|
-
## When NOT to use
|
|
17
|
-
|
|
18
|
-
- git 同步用户自己的产品仓 (那是普通 `git`)。
|
|
19
|
-
- 同步知识 store (pull/push 冲突解决) → 用 `fabric-sync` skill。
|
|
20
|
-
- 写知识条目 → 用 `fabric-archive` / `fabric-review`。
|
|
8
|
+
「知识 store」操作的意图路由层:CLI (`fabric store …`) 是引擎(做事 + 守破坏性操作的 confirm 门),本 skill 只把意图映射到命令。*store* 是 `~/.fabric/stores/<uuid>/` 下的平行 git 仓,与用户产品仓无关;同步见 `fabric-sync`,写条目见 `fabric-archive`/`fabric-review`。
|
|
21
9
|
|
|
22
10
|
## 意图 → 命令映射
|
|
23
11
|
|
|
24
12
|
| 意图 | 命令 |
|
|
25
13
|
|---|---|
|
|
26
14
|
| 创建全新本地 store | `fabric store create --alias <a> [--remote <url>]` |
|
|
27
|
-
| 挂载已存在的磁盘 store | `fabric store
|
|
15
|
+
| 挂载已存在的磁盘 store | `fabric store mount --uuid <u> --alias <a> [--remote <url>]` |
|
|
28
16
|
| 本项目声明需要某 store | `fabric store bind <alias-or-uuid>` |
|
|
29
17
|
| 列出挂载的 store | `fabric store list` |
|
|
30
|
-
|
|
|
18
|
+
| 设置默认写库 | `fabric store switch-write <alias>` |
|
|
19
|
+
| 给某 scope 单独路由写库 | `fabric store switch-write <alias> --scope <semantic_scope>` |
|
|
31
20
|
| 解释某 alias 如何解析 | `fabric store explain <alias>` |
|
|
21
|
+
| 迁移知识条目坐标(改 scope / 提升 / 补全) | `fabric store migrate {scope,promote,backfill}`(破坏性 → CLI 跑 confirm 门,`--dry-run` 预览) |
|
|
32
22
|
| 同步 (pull+push) | 见 `fabric-sync` skill |
|
|
33
23
|
|
|
34
|
-
##
|
|
35
|
-
|
|
36
|
-
已 `fabric install --global` (存在 `~/.fabric` + 全局 store registry)。无全局配置 → 提示先 `fabric install --global`,停止。
|
|
37
|
-
|
|
38
|
-
## Constraints
|
|
24
|
+
## 红线(其余安全由 CLI 兜)
|
|
39
25
|
|
|
40
|
-
- `store remove`
|
|
41
|
-
- `store
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
- Hook/skill NEVER 直接解析 store 或执行 store 内文件 (S65 RCE 防线:store 是数据-only);所有 store 状态 MUST 经 CLI JSON 输出获取。
|
|
26
|
+
- `store remove` = detach ≠ delete:卸 registry,保留磁盘 git 树。
|
|
27
|
+
- `store mount` 拒绝幽灵挂载(磁盘无 store 树的 uuid)。
|
|
28
|
+
- 破坏性 `store migrate *` MUST 经 CLI 本身的 confirm-before-mutate 门(确定性来自 CLI 不靠本 skill 厚度);本 skill 不自行改 store `knowledge/` 或 counters(派生态)。
|
|
29
|
+
- Hook/skill NEVER 直接解析或执行 store 内文件(S65:store 是数据-only);store 状态一律经 CLI JSON 输出取。
|
|
@@ -1,46 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: fabric-sync
|
|
3
|
-
description: 多 store git
|
|
3
|
+
description: 多 store git 同步 thin shim — 路由到 `fabric sync` 引擎,仅 rebase 冲突时由 AI 辅助决断。Triggers 同步知识库/sync stores.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# fabric-sync
|
|
6
|
+
# fabric-sync — store 同步 thin shim
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
跨挂载知识 store 的 git 同步意图路由。CLI `fabric sync` 是事务/状态机引擎(遍历 store、rebase、push、persist session);本 skill 只在**冲突**时补上 AI 决断辅助 —— 其余全交 CLI。
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## 意图 → 命令映射
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
| 意图 | 命令 |
|
|
13
|
+
|---|---|
|
|
14
|
+
| 同步所有挂载 store | `fabric sync`(逐 store 报 `synced` / `offline`(defer,不报错) / `conflict`) |
|
|
15
|
+
| 冲突解决后继续 | `fabric sync --continue` |
|
|
16
|
+
| 放弃该 store 的本次同步 | `fabric sync --abort` |
|
|
17
|
+
| 列出挂载的 store | `fabric store list`(见 `fabric-store`) |
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## 唯一需 AI 的一步 — 冲突辅助(仅 `conflict` 时)
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
rebase 停在中途时:展示冲突文件的 `<<<<<<<`/`=======`/`>>>>>>>` 段,解释两侧(ours=本地草稿/晋升,theirs=远端协作者)并给合并建议(知识条目通常可并存或取更高 maturity)。**NEVER 擅自丢弃任一侧**;用户拍板后 `--continue`,放弃则 `--abort`。
|
|
18
22
|
|
|
19
|
-
##
|
|
23
|
+
## 红线
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- `conflict` — rebase 冲突,sync 暂停并持久化 session。进入 Phase 2。
|
|
25
|
-
|
|
26
|
-
## Phase 2 — AI-assisted conflict resolution (仅冲突时)
|
|
27
|
-
|
|
28
|
-
冲突 store 的工作区停在 rebase 中途。辅助用户:
|
|
29
|
-
1. 展示冲突文件 (store 知识树 `knowledge/<type>/*.md` 中的 `<<<<<<<`/`=======`/`>>>>>>>` 段)。
|
|
30
|
-
2. 对每个冲突,MUST 解释两侧 (ours = 本地草稿/晋升, theirs = 远端协作者) 并给出**合并建议**(知识条目通常可并存或取更成熟 maturity)。NEVER 擅自丢弃任一侧未经用户确认。
|
|
31
|
-
3. 用户解决后 → `fabric sync --continue` (git rebase --continue + 恢复遍历剩余 store)。
|
|
32
|
-
4. 用户选择放弃该 store → `fabric sync --abort` (git rebase --abort,该 store 留未同步,继续遍历其余)。
|
|
33
|
-
|
|
34
|
-
## Phase 3 — Settle
|
|
35
|
-
|
|
36
|
-
所有 store settled (无 pending/conflict) 后:CLI 自动清 session 并重生 `~/.fabric/state/bindings/<id>_resolved.json` 快照 (P3→P4 链)。汇报:已同步 store 数、deferred (offline) store 数、aborted store 数。
|
|
37
|
-
|
|
38
|
-
## UX i18n Policy
|
|
39
|
-
|
|
40
|
-
按 `.fabric/fabric-config.json` 的 `fabric_language` 渲染用户可见文案。Protected tokens (`fabric sync`, `--continue`, `--abort`, `git rebase`, store alias, enum) NEVER translate。
|
|
41
|
-
|
|
42
|
-
## Constraints
|
|
43
|
-
|
|
44
|
-
- Hook/skill **绝不**直接解析 store 或执行 store 内任何文件 (S65 RCE 防线:store 是数据-only)。
|
|
45
|
-
- 冲突合并建议是辅助,最终由用户拍板;不静默丢弃知识。
|
|
46
|
-
- promotion/CR 经普通 git commit,不跨 store 搬运条目。
|
|
25
|
+
- Hook/skill NEVER 直接解析或执行 store 内文件(S65:store 是数据-only);store 状态 MUST 经 CLI JSON 取。
|
|
26
|
+
- 仅 remote-backed store 参与同步;local-only 跳过并提示加 remote 备份。
|
|
27
|
+
- 冲突合并不静默丢知识;promotion 经普通 git commit,不跨 store 搬运条目。
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# Shared skill policy — cross-skill canonical core (rc.37 NEW-13)
|
|
2
2
|
|
|
3
|
-
> **Single source of truth** for the policy invariants that fabric-archive
|
|
4
|
-
>
|
|
3
|
+
> **Single source of truth** for the policy invariants that fabric-archive
|
|
4
|
+
> (incl. its source mode) and fabric-review (incl. its retire / relate
|
|
5
|
+
> sub-flows) depend on. Each skill's `ref/` keeps
|
|
5
6
|
> only its skill-specific examples and points here (`../../lib/shared-policy.md`)
|
|
6
7
|
> for the common rules. Edit invariants HERE — never fork them per skill.
|
|
7
8
|
|
|
@@ -10,7 +11,7 @@
|
|
|
10
11
|
When rendering bilingual (zh-CN ↔ en) output, prose is translated but the
|
|
11
12
|
following classes of token appear **verbatim in both variants**:
|
|
12
13
|
|
|
13
|
-
- **MCP tool + field names**: `
|
|
14
|
+
- **MCP tool + field names**: `fab_propose`, `fab_review`, `fab_pending`,
|
|
14
15
|
`fab_recall`, `fab_archive_scan`,
|
|
15
16
|
`relevance_scope`, `relevance_paths`, `source_sessions`, `proposed_reason`,
|
|
16
17
|
`session_context`, `intent_clues`, `tech_stack`, `impact`, `must_read_if`,
|
|
@@ -61,9 +62,10 @@ This block is itself a protected token sequence — render `强 team` /
|
|
|
61
62
|
Skills persist lifecycle via MCP tools (which emit the canonical events) —
|
|
62
63
|
they do NOT hand-write `.fabric/events.jsonl`:
|
|
63
64
|
|
|
64
|
-
- `
|
|
65
|
+
- `fab_propose` → `knowledge_proposed` (+ archive-attempt events).
|
|
65
66
|
- `fab_review` approve → `knowledge_promote_started` → `knowledge_promoted`.
|
|
66
67
|
- `fab_review` modify-layer → `knowledge_layer_changed` (+ id-redirect).
|
|
68
|
+
- `fab_pending` list/search → read-only browse/search (no events emitted).
|
|
67
69
|
|
|
68
70
|
Never instruct the user to delete or hand-edit the event ledger; it is the
|
|
69
71
|
append-only audit trail. Counter rollups live in `.fabric/metrics.jsonl`.
|
package/dist/chunk-27HK6H5Y.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
storeGitRemote
|
|
4
|
-
} from "./chunk-QPAW6IYT.js";
|
|
5
|
-
import {
|
|
6
|
-
loadProjectConfig
|
|
7
|
-
} from "./chunk-QFIVFZRH.js";
|
|
8
|
-
import {
|
|
9
|
-
loadGlobalConfig,
|
|
10
|
-
resolveGlobalRoot
|
|
11
|
-
} from "./chunk-FNHDQTPC.js";
|
|
12
|
-
|
|
13
|
-
// src/lib/unknown-flags.ts
|
|
14
|
-
function warnUnknownFlags(known) {
|
|
15
|
-
const knownSet = /* @__PURE__ */ new Set([...known, "help", "version"]);
|
|
16
|
-
const unknown = [];
|
|
17
|
-
for (const tok of process.argv.slice(2)) {
|
|
18
|
-
if (!tok.startsWith("--")) continue;
|
|
19
|
-
const name = tok.slice(2).split("=")[0].replace(/^no-/, "");
|
|
20
|
-
if (name.length === 0) continue;
|
|
21
|
-
if (!knownSet.has(name)) unknown.push(tok.split("=")[0]);
|
|
22
|
-
}
|
|
23
|
-
if (unknown.length > 0) {
|
|
24
|
-
process.stderr.write(`[fabric] ignored unknown flag(s): ${unknown.join(", ")}
|
|
25
|
-
`);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// src/store/info-ops.ts
|
|
30
|
-
function whoami(globalRoot = resolveGlobalRoot()) {
|
|
31
|
-
const config = loadGlobalConfig(globalRoot);
|
|
32
|
-
if (config === null) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
uid: config.uid,
|
|
37
|
-
stores: config.stores.map((s) => ({
|
|
38
|
-
alias: s.alias,
|
|
39
|
-
mount_name: s.mount_name ?? null,
|
|
40
|
-
store_uuid: s.store_uuid,
|
|
41
|
-
// F4: parity with `fabric store list` — local-only reflects the store
|
|
42
|
-
// repo's TRUE git remote (what sync actually pushes to), not the registry
|
|
43
|
-
// metadata. A store with a physical `origin` but no registry `remote`
|
|
44
|
-
// (e.g. the personal store) was misreported as local-only by whoami while
|
|
45
|
-
// `store list` honestly showed its remote. Both now read the same source.
|
|
46
|
-
local_only: storeGitRemote(s.alias, globalRoot) === void 0
|
|
47
|
-
}))
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function projectStatus(projectRoot, globalRoot = resolveGlobalRoot()) {
|
|
51
|
-
const global = loadGlobalConfig(globalRoot);
|
|
52
|
-
const project = loadProjectConfig(projectRoot);
|
|
53
|
-
return {
|
|
54
|
-
uid: global?.uid ?? null,
|
|
55
|
-
mounted: (global?.stores ?? []).map((s) => s.alias),
|
|
56
|
-
project_id: project?.project_id ?? null,
|
|
57
|
-
is_fabric_project: project !== null,
|
|
58
|
-
required: (project?.required_stores ?? []).map((r) => r.id),
|
|
59
|
-
active_write_store: project?.active_write_store ?? null,
|
|
60
|
-
default_write_store: project?.default_write_store ?? null,
|
|
61
|
-
write_routes: project?.write_routes ?? []
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export {
|
|
66
|
-
warnUnknownFlags,
|
|
67
|
-
whoami,
|
|
68
|
-
projectStatus
|
|
69
|
-
};
|