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

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 (35) hide show
  1. package/dist/chunk-5JG4QJLO.js +64 -0
  2. package/dist/chunk-5SSNE5GM.js +301 -0
  3. package/dist/chunk-EOT63RDH.js +36 -0
  4. package/dist/{chunk-AOE6AYI7.js → chunk-F6ITRM7T.js} +2 -2
  5. package/dist/{chunk-WU6GAPKH.js → chunk-H3FE6VIK.js} +3 -5
  6. package/dist/chunk-XCBVSGCS.js +25 -0
  7. package/dist/{chunk-2R55HNVD.js → chunk-XHHCRDIR.js} +71 -6
  8. package/dist/{config-XYRBZJDU.js → config-VJMXCLXW.js} +1 -1
  9. package/dist/{doctor-YONYXDX6.js → doctor-U5W4CX5I.js} +118 -7
  10. package/dist/index.js +13 -12
  11. package/dist/{install-74ANPCCP.js → install-7XJ64WSC.js} +252 -246
  12. package/dist/{plan-context-hint-FC6P3WFE.js → plan-context-hint-CHVZGOZ5.js} +21 -8
  13. package/dist/{scope-explain-CDIZESP5.js → scope-explain-BWRWBCCP.js} +14 -4
  14. package/dist/{status-GLQWLWH6.js → status-7UFLWRX7.js} +17 -6
  15. package/dist/store-ZEZMQVG7.js +817 -0
  16. package/dist/{sync-UJ4BBCZJ.js → sync-EA5HZMXM.js} +165 -21
  17. package/dist/{uninstall-C3QXKOO6.js → uninstall-F75MPKQC.js} +27 -1
  18. package/dist/{whoami-2MLO4Y37.js → whoami-3FRWYGML.js} +16 -5
  19. package/package.json +3 -3
  20. package/templates/hooks/cite-policy-evict.cjs +412 -160
  21. package/templates/hooks/configs/claude-code.json +17 -2
  22. package/templates/hooks/configs/codex-hooks.json +14 -2
  23. package/templates/hooks/configs/cursor-hooks.json +14 -2
  24. package/templates/hooks/fabric-hint.cjs +151 -15
  25. package/templates/hooks/knowledge-hint-broad.cjs +12 -1
  26. package/templates/hooks/knowledge-hint-narrow.cjs +54 -1
  27. package/templates/hooks/post-tooluse-mutation.cjs +285 -0
  28. package/templates/hooks/session-end-marker.cjs +140 -0
  29. package/templates/skills/fabric-archive/SKILL.md +7 -1
  30. package/dist/chunk-4R2CYEA4.js +0 -116
  31. package/dist/chunk-L4Q55UC4.js +0 -52
  32. package/dist/chunk-LFIKMVY7.js +0 -27
  33. package/dist/chunk-RYAFBNES.js +0 -33
  34. package/dist/chunk-T5RPGCCM.js +0 -40
  35. package/dist/store-XB3ADT65.js +0 -144
@@ -56,16 +56,29 @@ async function runPlanContextHint(opts) {
56
56
  const targetPaths = all ? [ALL_PATHS_SENTINEL] : explicitPaths.length > 0 ? explicitPaths : [ALL_PATHS_SENTINEL];
57
57
  const resolution = resolveDevMode(opts.target, process.cwd());
58
58
  const result = await planContext(resolution.target, {
59
- paths: targetPaths
59
+ paths: targetPaths,
60
+ // lifecycle-refactor W3-T2 (§7 图谱消费 / §5): default-enable graph二阶召回 for
61
+ // the hint path. planContext appends the one-hop `related` neighbours that
62
+ // ranked outside top_k of the surfaced set and reports them in
63
+ // `related_appended` (appended id → source id). Honest no-op when the
64
+ // surfaced set declares no in-corpus related edge.
65
+ include_related: true
60
66
  });
61
67
  const candidates = result.candidates;
62
- const entries = candidates.map((item) => ({
63
- id: item.stable_id,
64
- type: item.description.knowledge_type ?? "",
65
- maturity: item.description.maturity ?? "",
66
- summary: item.description.summary,
67
- relevance_scope: item.description.relevance_scope ?? "broad"
68
- }));
68
+ const relatedAppended = result.related_appended ?? {};
69
+ const entries = candidates.map((item) => {
70
+ const relatedTo = relatedAppended[item.stable_id];
71
+ return {
72
+ id: item.stable_id,
73
+ type: item.description.knowledge_type ?? "",
74
+ maturity: item.description.maturity ?? "",
75
+ summary: item.description.summary,
76
+ relevance_scope: item.description.relevance_scope ?? "broad",
77
+ // Only set when this entry was pulled in via a graph edge — its presence
78
+ // is the honest signal, never synthesized for ordinarily-ranked entries.
79
+ ...typeof relatedTo === "string" ? { related_to: relatedTo } : {}
80
+ };
81
+ });
69
82
  let narrow_count = 0;
70
83
  let broad_only_count = 0;
71
84
  for (const e of entries) {
@@ -1,15 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  scopeExplain
4
- } from "./chunk-L4Q55UC4.js";
4
+ } from "./chunk-EOT63RDH.js";
5
5
  import {
6
6
  getProjectTranslator
7
7
  } from "./chunk-2CY4BMTH.js";
8
- import "./chunk-LFIKMVY7.js";
9
- import "./chunk-RYAFBNES.js";
10
8
 
11
9
  // src/commands/scope-explain.ts
12
10
  import { defineCommand } from "citty";
11
+ import { FabricError } from "@fenglimg/fabric-shared/errors";
13
12
  var scope_explain_default = defineCommand({
14
13
  meta: {
15
14
  name: "scope-explain",
@@ -24,7 +23,18 @@ var scope_explain_default = defineCommand({
24
23
  },
25
24
  run({ args }) {
26
25
  const projectRoot = process.cwd();
27
- const result = scopeExplain(projectRoot, args.scope);
26
+ let result;
27
+ try {
28
+ result = scopeExplain(projectRoot, args.scope);
29
+ } catch (error) {
30
+ if (error instanceof FabricError) {
31
+ console.error(`${error.message}
32
+ \u2192 ${error.actionHint}`);
33
+ process.exitCode = 1;
34
+ return;
35
+ }
36
+ throw error;
37
+ }
28
38
  if (result === null) {
29
39
  console.log(getProjectTranslator(projectRoot)("cli.cmd.no-global-config"));
30
40
  return;
@@ -1,18 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- projectStatus
4
- } from "./chunk-T5RPGCCM.js";
5
- import "./chunk-LFIKMVY7.js";
6
- import "./chunk-RYAFBNES.js";
3
+ projectStatus,
4
+ warnUnknownFlags
5
+ } from "./chunk-5JG4QJLO.js";
6
+ import "./chunk-5SSNE5GM.js";
7
+ import "./chunk-XCBVSGCS.js";
7
8
 
8
9
  // src/commands/status.ts
9
10
  import { defineCommand } from "citty";
10
11
  var status_default = defineCommand({
11
12
  meta: { name: "status", description: "Show this project's Fabric store status" },
12
- run() {
13
+ args: {
14
+ // F27: `--json` machine-readable output (was silently ignored pre-F27).
15
+ json: { type: "boolean", description: "Emit machine-readable JSON instead of text" }
16
+ },
17
+ run({ args }) {
18
+ warnUnknownFlags(["json"]);
13
19
  const status = projectStatus(process.cwd());
20
+ if (args.json === true) {
21
+ console.log(JSON.stringify(status, null, 2));
22
+ return;
23
+ }
14
24
  console.log(`uid: ${status.uid ?? "(no global config)"}`);
15
- console.log(`project_id: ${status.project_id ?? "(not a Fabric project)"}`);
25
+ const projectIdLabel = status.project_id ?? (status.is_fabric_project ? "(unset)" : "(not a Fabric project)");
26
+ console.log(`project_id: ${projectIdLabel}`);
16
27
  console.log(`mounted stores: ${status.mounted.length > 0 ? status.mounted.join(", ") : "(none)"}`);
17
28
  console.log(`required: ${status.required.length > 0 ? status.required.join(", ") : "(none)"}`);
18
29
  console.log(`active write: ${status.active_write_store ?? "(none \u2014 personal scope only)"}`);