@fenglimg/fabric-cli 2.2.0-rc.1 → 2.2.0-rc.11

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.
Files changed (83) hide show
  1. package/README.md +8 -5
  2. package/dist/chunk-27HK6H5Y.js +69 -0
  3. package/dist/{chunk-AOE6AYI7.js → chunk-2KBCTMID.js} +31 -8
  4. package/dist/chunk-3D7B2UAZ.js +149 -0
  5. package/dist/{chunk-XC5RUHLK.js → chunk-3IOLS5EK.js} +23 -38
  6. package/dist/{plan-context-hint-FC6P3WFE.js → chunk-722JU5BP.js} +52 -12
  7. package/dist/{chunk-2R55HNVD.js → chunk-7ZDXBOOU.js} +234 -206
  8. package/dist/{doctor-YONYXDX6.js → chunk-E7HJUU34.js} +215 -52
  9. package/dist/chunk-EOT63RDH.js +36 -0
  10. package/dist/chunk-FNHDQTPC.js +16 -0
  11. package/dist/{chunk-2CY4BMTH.js → chunk-HORSMSZL.js} +9 -5
  12. package/dist/{chunk-BO4XIZWZ.js → chunk-NLNH64A3.js} +5 -18
  13. package/dist/{chunk-WU6GAPKH.js → chunk-PTGQAZEW.js} +12 -4
  14. package/dist/chunk-QFIVFZRH.js +13 -0
  15. package/dist/chunk-QPAW6IYT.js +387 -0
  16. package/dist/{chunk-COI5VDFU.js → chunk-WA3DYGSY.js} +1 -2
  17. package/dist/{config-XYRBZJDU.js → config-A3LTECAY.js} +4 -3
  18. package/dist/context-UJCGYOT6.js +117 -0
  19. package/dist/doctor-MDTZWKBK.js +24 -0
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +133 -22
  22. package/dist/info-7FKBTMVO.js +139 -0
  23. package/dist/install-v2-WLEJ5XHT.js +3279 -0
  24. package/dist/{metrics-RER6NLFC.js → metrics-HMFH4YHK.js} +1 -1
  25. package/dist/{onboard-coverage-JWQWDZW7.js → onboard-coverage-XSG77LL3.js} +48 -27
  26. package/dist/plan-context-hint-5TNGH3R4.js +12 -0
  27. package/dist/{scope-explain-CDIZESP5.js → scope-explain-HLJZ2M33.js} +17 -6
  28. package/dist/status-4R3TM4FJ.js +37 -0
  29. package/dist/store-HOCORVL3.js +563 -0
  30. package/dist/{sync-UJ4BBCZJ.js → sync-DT5UJMMR.js} +197 -30
  31. package/dist/{uninstall-C3QXKOO6.js → uninstall-IFN2KYBK.js} +97 -140
  32. package/dist/whoami-ITGEFWH4.js +49 -0
  33. package/package.json +7 -5
  34. package/templates/hooks/cite-policy-evict.cjs +412 -160
  35. package/templates/hooks/configs/README.md +14 -27
  36. package/templates/hooks/configs/claude-code.json +17 -2
  37. package/templates/hooks/configs/codex-hooks.json +15 -3
  38. package/templates/hooks/fabric-hint.cjs +742 -259
  39. package/templates/hooks/knowledge-hint-broad.cjs +577 -274
  40. package/templates/hooks/knowledge-hint-narrow.cjs +113 -73
  41. package/templates/hooks/lib/banner-i18n.cjs +50 -1
  42. package/templates/hooks/lib/bindings-snapshot-reader.cjs +118 -7
  43. package/templates/hooks/lib/cite-line-parser.cjs +12 -20
  44. package/templates/hooks/lib/client-adapter.cjs +66 -7
  45. package/templates/hooks/lib/nudge-policy.cjs +117 -0
  46. package/templates/hooks/lib/state-store.cjs +60 -0
  47. package/templates/hooks/post-tooluse-mutation.cjs +386 -0
  48. package/templates/hooks/session-end-marker.cjs +140 -0
  49. package/templates/skills/fabric/SKILL.md +100 -0
  50. package/templates/skills/fabric-archive/SKILL.md +47 -24
  51. package/templates/skills/fabric-archive/ref/dry-run-scope.md +1 -1
  52. package/templates/skills/fabric-archive/ref/i18n-policy.md +2 -3
  53. package/templates/skills/fabric-archive/ref/phase-1-5-onboard.md +2 -3
  54. package/templates/skills/fabric-archive/ref/phase-1-cross-session.md +1 -1
  55. package/templates/skills/fabric-archive/ref/phase-2-5-viability.md +1 -1
  56. package/templates/skills/fabric-archive/ref/phase-3-6-related-edges.md +18 -0
  57. package/templates/skills/fabric-archive/ref/phase-3-7-semantic-scope.md +47 -0
  58. package/templates/skills/fabric-audit/SKILL.md +13 -3
  59. package/templates/skills/fabric-connect/SKILL.md +3 -3
  60. package/templates/skills/fabric-import/SKILL.md +7 -7
  61. package/templates/skills/fabric-import/ref/i18n-policy.md +2 -3
  62. package/templates/skills/fabric-import/ref/state-recovery.md +1 -2
  63. package/templates/skills/fabric-review/SKILL.md +14 -5
  64. package/templates/skills/fabric-review/ref/cite-contract.md +1 -1
  65. package/templates/skills/fabric-review/ref/i18n-policy.md +2 -3
  66. package/templates/skills/fabric-review/ref/output-contract.md +1 -1
  67. package/templates/skills/fabric-review/ref/per-mode-flows.md +2 -2
  68. package/templates/skills/fabric-review/ref/worked-examples.md +1 -1
  69. package/templates/skills/fabric-store/SKILL.md +1 -1
  70. package/templates/skills/fabric-sync/SKILL.md +1 -1
  71. package/templates/skills/lib/shared-policy.md +2 -2
  72. package/dist/chunk-4R2CYEA4.js +0 -116
  73. package/dist/chunk-L4Q55UC4.js +0 -52
  74. package/dist/chunk-LFIKMVY7.js +0 -27
  75. package/dist/chunk-RYAFBNES.js +0 -33
  76. package/dist/chunk-T5RPGCCM.js +0 -40
  77. package/dist/install-74ANPCCP.js +0 -2737
  78. package/dist/status-GLQWLWH6.js +0 -23
  79. package/dist/store-XB3ADT65.js +0 -144
  80. package/dist/whoami-2MLO4Y37.js +0 -36
  81. package/templates/hooks/configs/cursor-hooks.json +0 -18
  82. package/templates/hooks/lib/cite-contract-reminder.cjs +0 -179
  83. package/templates/hooks/lib/summary-fallback.cjs +0 -210
@@ -4,7 +4,7 @@ These JSON files are **fragment templates** consumed by `fabric install` and
4
4
  `fabric hooks install`. They are not standalone client config files.
5
5
 
6
6
  The supported clients are pinned by `packages/shared/src/schemas/fabric-config.ts`
7
- to Claude Code, Cursor, and Codex CLI. Adding a new client requires extending
7
+ to Claude Code and Codex CLI. Adding a new client requires extending
8
8
  that schema first.
9
9
 
10
10
  ## claude-code.json
@@ -25,45 +25,32 @@ Written to (or merged into) the user repo's `.codex/hooks.json`. NOTE: Codex
25
25
  project-level hooks file is JSON, **not** TOML — only the user-level Codex MCP
26
26
  config (`~/.codex/config.toml`) is TOML.
27
27
 
28
- ## cursor-hooks.json
29
-
30
- Written to (or merged into) the user repo's `.cursor/hooks.json`. Schema
31
- authoritative source: https://cursor.com/cn/docs/hooks. Top-level requires
32
- `version: 1` (number literal, NOT string) and a `hooks` object (NOT `events`)
33
- keyed by camelCase event names: `stop`, `sessionStart`, `preToolUse`. Per-entry
34
- shape stays flat (Codex-style): `{command, matcher?, type?, timeout?,
35
- loop_limit?, failClosed?}`. rc.14 TASK-001 corrected rc.13's wrong top-level
36
- envelope (was `{events: {Stop, SessionStart, PreToolUse}}` PascalCase, which
37
- Cursor rejects with "Config version must be a number; Config hooks must be an
38
- object").
39
-
40
28
  ## Per-client schema comparison (v2.0.0-rc.37 NEW-29)
41
29
 
42
30
  Each host program enforces its own wire format — `fabric install` cannot
43
- serialize one shared shape across all three. Differences are pinned here
44
- side-by-side so anyone editing one config knows what the others require.
45
-
46
- | Axis | Claude Code | Codex CLI | Cursor |
47
- | -------------------- | ---------------------------------------- | -------------------------------------------------- | ----------------------------------------------- |
48
- | Settings file | `.claude/settings.json` | `.codex/hooks.json` | `.cursor/hooks.json` |
49
- | Top-level envelope | `hooks: { ... }` (no version) | `events: { ... }` (no version) | `{ version: 1, hooks: { ... } }` (number, not string) |
50
- | Event-name case | PascalCase: `Stop`, `SessionStart`, `PreToolUse`, `UserPromptSubmit` | PascalCase: `Stop`, `SessionStart`, `PreToolUse` | camelCase: `stop`, `sessionStart`, `preToolUse` |
51
- | Per-entry shape | Nested matcher: `[{matcher, hooks:[{type:"command", command}]}]` | Flat: `[{command, matcher?}]` | Flat: `[{command, matcher?, type?, timeout?, loop_limit?, failClosed?}]` |
52
- | Path interpolation | `${CLAUDE_PROJECT_DIR}` (env var) | `"$(git rev-parse --show-toplevel)"` (shell expansion) | project-relative (resolved by Cursor) |
53
- | Cite-policy event | `UserPromptSubmit` (per-prompt) | `SessionStart` 2nd entry (rc.37 NEW-21 parity) | `sessionStart` 2nd entry (rc.37 NEW-21 parity) |
31
+ serialize one shared shape across both. Differences are pinned here
32
+ side-by-side so anyone editing one config knows what the other requires.
33
+
34
+ | Axis | Claude Code | Codex CLI |
35
+ | -------------------- | ---------------------------------------- | -------------------------------------------------- |
36
+ | Settings file | `.claude/settings.json` | `.codex/hooks.json` |
37
+ | Top-level envelope | `hooks: { ... }` (no version) | `events: { ... }` (no version) |
38
+ | Event-name case | PascalCase: `Stop`, `SessionStart`, `PreToolUse`, `UserPromptSubmit` | PascalCase: `Stop`, `SessionStart`, `PreToolUse` |
39
+ | Per-entry shape | Nested matcher: `[{matcher, hooks:[{type:"command", command}]}]` | Flat: `[{command, matcher?}]` |
40
+ | Path interpolation | `${CLAUDE_PROJECT_DIR}` (env var) | `"$(git rev-parse --show-toplevel)"` (shell expansion) |
41
+ | Cite-policy event | `UserPromptSubmit` (per-prompt) | `SessionStart` 2nd entry (rc.37 NEW-21 parity) |
54
42
 
55
43
  Whenever a hook is added to one config, walk this table and add the equivalent
56
- entry to the other two — `fabric install` merges each into its respective
44
+ entry to the other — `fabric install` merges each into its respective
57
45
  target verbatim, so missing entries silently degrade the cross-client surface.
58
46
 
59
47
  ## fabric-hint.cjs script paths
60
48
 
61
49
  - Claude: `.claude/hooks/fabric-hint.cjs` (project-relative)
62
50
  - Codex: `.codex/hooks/fabric-hint.cjs` (project-relative)
63
- - Cursor: `.cursor/hooks/fabric-hint.cjs` (project-relative)
64
51
 
65
52
  The single shared script lives at `packages/cli/templates/hooks/fabric-hint.cjs`
66
- in this repo and is copied into all three `<client>/hooks/` destinations by the
53
+ in this repo and is copied into both `<client>/hooks/` destinations by the
67
54
  install wiring. The script emits stdout JSON
68
55
  `{decision:"block", reason, signal, recommended_skill}` with exit 0 when one of
69
56
  three signals trips:
@@ -29,17 +29,32 @@
29
29
  {
30
30
  "type": "command",
31
31
  "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/knowledge-hint-narrow.cjs"
32
+ },
33
+ {
34
+ "type": "command",
35
+ "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/cite-policy-evict.cjs"
36
+ }
37
+ ]
38
+ }
39
+ ],
40
+ "PostToolUse": [
41
+ {
42
+ "matcher": "Edit|Write|MultiEdit|Read",
43
+ "hooks": [
44
+ {
45
+ "type": "command",
46
+ "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/post-tooluse-mutation.cjs"
32
47
  }
33
48
  ]
34
49
  }
35
50
  ],
36
- "UserPromptSubmit": [
51
+ "SessionEnd": [
37
52
  {
38
53
  "matcher": "*",
39
54
  "hooks": [
40
55
  {
41
56
  "type": "command",
42
- "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/cite-policy-evict.cjs"
57
+ "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/session-end-marker.cjs"
43
58
  }
44
59
  ]
45
60
  }
@@ -8,15 +8,27 @@
8
8
  "SessionStart": [
9
9
  {
10
10
  "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/knowledge-hint-broad.cjs\""
11
+ }
12
+ ],
13
+ "PreToolUse": [
14
+ {
15
+ "matcher": "Edit|Write|MultiEdit|apply_patch",
16
+ "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/knowledge-hint-narrow.cjs\""
11
17
  },
12
18
  {
19
+ "matcher": "Edit|Write|MultiEdit|apply_patch",
13
20
  "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/cite-policy-evict.cjs\""
14
21
  }
15
22
  ],
16
- "PreToolUse": [
23
+ "PostToolUse": [
17
24
  {
18
- "matcher": "Edit|Write|MultiEdit",
19
- "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/knowledge-hint-narrow.cjs\""
25
+ "matcher": "Edit|Write|MultiEdit|apply_patch|Read",
26
+ "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/post-tooluse-mutation.cjs\""
27
+ }
28
+ ],
29
+ "SessionEnd": [
30
+ {
31
+ "command": "\"$(git rev-parse --show-toplevel)/.codex/hooks/session-end-marker.cjs\""
20
32
  }
21
33
  ]
22
34
  }