@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
doctorCommand,
|
|
4
|
+
doctor_default,
|
|
5
|
+
renderDoctorChecks,
|
|
6
|
+
renderDoctorFilteredHelp,
|
|
7
|
+
renderDoctorHeader,
|
|
8
|
+
renderDoctorStoreHealth,
|
|
9
|
+
renderTldrHeader
|
|
10
|
+
} from "./chunk-PP7QVRXH.js";
|
|
11
|
+
import "./chunk-VQKXTMWH.js";
|
|
12
|
+
import "./chunk-WA3DYGSY.js";
|
|
13
|
+
import "./chunk-SL77FXX7.js";
|
|
14
|
+
import "./chunk-GGDVZCD6.js";
|
|
15
|
+
import "./chunk-7V4XMLQ2.js";
|
|
16
|
+
import "./chunk-I5F5BHWI.js";
|
|
17
|
+
import "./chunk-FNHDQTPC.js";
|
|
18
|
+
import "./chunk-HORSMSZL.js";
|
|
19
|
+
export {
|
|
20
|
+
doctor_default as default,
|
|
21
|
+
doctorCommand,
|
|
22
|
+
renderDoctorChecks,
|
|
23
|
+
renderDoctorFilteredHelp,
|
|
24
|
+
renderDoctorHeader,
|
|
25
|
+
renderDoctorStoreHealth,
|
|
26
|
+
renderTldrHeader
|
|
27
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
renderDoctorFilteredHelp
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-PP7QVRXH.js";
|
|
5
|
+
import "./chunk-VQKXTMWH.js";
|
|
6
6
|
import "./chunk-WA3DYGSY.js";
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import "./chunk-
|
|
7
|
+
import {
|
|
8
|
+
paint,
|
|
9
|
+
symbol
|
|
10
|
+
} from "./chunk-SL77FXX7.js";
|
|
11
|
+
import "./chunk-GGDVZCD6.js";
|
|
12
|
+
import "./chunk-7V4XMLQ2.js";
|
|
13
|
+
import "./chunk-I5F5BHWI.js";
|
|
12
14
|
import "./chunk-FNHDQTPC.js";
|
|
13
15
|
import {
|
|
14
16
|
t
|
|
@@ -23,30 +25,32 @@ import { defineCommand, renderUsage, runCommand, runMain } from "citty";
|
|
|
23
25
|
// src/commands/index.ts
|
|
24
26
|
var allCommands = {
|
|
25
27
|
// v2.2.0-rc.5: pipeline-based install with TUI renderer (EPIC-005/006/007/008)
|
|
26
|
-
install: () => import("./install-v2-
|
|
28
|
+
install: () => import("./install-v2-KGIDII4H.js").then((module) => module.installCommand),
|
|
27
29
|
// v2.1.0-rc.1 P3: multi-store lifecycle command group (list/add/remove/explain).
|
|
28
|
-
store: () => import("./store-
|
|
30
|
+
store: () => import("./store-GF4SFBMJ.js").then((module) => module.default),
|
|
29
31
|
// v2.1.0-rc.1 P3 (S9/S17/S37): multi-store pull --rebase + push, conflict resume.
|
|
30
|
-
sync: () => import("./sync-
|
|
31
|
-
// EPIC-010: Unified info command (replaces whoami/status
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"scope-explain": () => import("./scope-explain-HLJZ2M33.js").then((module) => module.default),
|
|
38
|
-
doctor: () => import("./doctor-MDTZWKBK.js").then((module) => module.default),
|
|
39
|
-
uninstall: () => import("./uninstall-IFN2KYBK.js").then((module) => module.default),
|
|
32
|
+
sync: () => import("./sync-3XCIRDPK.js").then((module) => module.default),
|
|
33
|
+
// EPIC-010: Unified info command (replaces the retired whoami/status aliases).
|
|
34
|
+
// W3-F: `info scope <coord>` is now a real subcommand (was the retired
|
|
35
|
+
// top-level `scope-explain` command); skills call `fabric info scope`.
|
|
36
|
+
info: () => import("./info-NJEY26H6.js").then((module) => module.default),
|
|
37
|
+
doctor: () => import("./doctor-S6KPGS35.js").then((module) => module.default),
|
|
38
|
+
uninstall: () => import("./uninstall-BG4ML4FC.js").then((module) => module.default),
|
|
40
39
|
config: () => import("./config-A3LTECAY.js").then((module) => module.default),
|
|
41
40
|
"plan-context-hint": () => import("./plan-context-hint-5TNGH3R4.js").then((module) => module.default),
|
|
42
41
|
// v2.0.0-rc.23 TASK-014 (F8c): S5 onboard-slot coverage. Used by the
|
|
43
42
|
// fabric-archive Skill's first-run phase to detect unclaimed slots.
|
|
44
43
|
"onboard-coverage": () => import("./onboard-coverage-XSG77LL3.js").then((module) => module.default),
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
44
|
+
// W3-D (UX northstar): knowledge & telemetry audit group — the surfaces that
|
|
45
|
+
// used to ride on `fabric doctor --<flag>` (cite / conflicts / history /
|
|
46
|
+
// descriptions / metrics / retired). doctor now keeps only health + fix.
|
|
47
|
+
// W3-F: the metrics dashboard is reachable ONLY as `fabric audit metrics`
|
|
48
|
+
// (top-level `metrics` alias retired — metrics.ts lives on as that subcommand).
|
|
49
|
+
audit: () => import("./audit-PURSJJFH.js").then((module) => module.default),
|
|
50
|
+
// Block 5 (Option X) / W3-F: show what SessionStart injects (shared renderer
|
|
51
|
+
// with the hook → byte-identical). Renamed from `context`. --explain for
|
|
52
|
+
// per-entry provenance.
|
|
53
|
+
inspect: () => import("./inspect-5YZMJPFM.js").then((module) => module.default)
|
|
50
54
|
};
|
|
51
55
|
|
|
52
56
|
// src/lib/error-render.ts
|
|
@@ -64,59 +68,68 @@ function renderTopLevelError(err, stream = process.stderr) {
|
|
|
64
68
|
}
|
|
65
69
|
return "other";
|
|
66
70
|
}
|
|
71
|
+
function renderUnexpectedError(err, showStack, stream = process.stderr) {
|
|
72
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
73
|
+
stream.write(`${symbol.error} ${paint.error(message)}
|
|
74
|
+
`);
|
|
75
|
+
if (showStack && err instanceof Error && err.stack) {
|
|
76
|
+
stream.write(`${err.stack}
|
|
77
|
+
`);
|
|
78
|
+
} else if (!showStack) {
|
|
79
|
+
stream.write(
|
|
80
|
+
`${paint.muted(" Run with --debug (or FABRIC_DEBUG=1) for the full stack trace.")}
|
|
81
|
+
`
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
67
85
|
|
|
68
86
|
// src/lib/grouped-help.ts
|
|
87
|
+
var GROUP_ORDER = ["Knowledge", "Project", "Maintain"];
|
|
88
|
+
var DEFAULT_GROUP = "Project";
|
|
89
|
+
var COMMAND_META = {
|
|
90
|
+
// Knowledge — the store/sync heart of Fabric.
|
|
91
|
+
store: { group: "Knowledge", descriptionKey: "cli.help.group.knowledge.store" },
|
|
92
|
+
sync: { group: "Knowledge", descriptionKey: "cli.help.group.knowledge.sync" },
|
|
93
|
+
// Project — single-repo onboarding, config, status, and injection inspection.
|
|
94
|
+
install: { group: "Project", descriptionKey: "cli.help.group.project.install" },
|
|
95
|
+
uninstall: { group: "Project" },
|
|
96
|
+
config: { group: "Project", descriptionKey: "cli.help.group.project.config" },
|
|
97
|
+
info: { group: "Project", descriptionKey: "cli.help.group.project.info" },
|
|
98
|
+
inspect: { group: "Project", descriptionKey: "cli.help.group.project.inspect" },
|
|
99
|
+
// Maintain — health + telemetry, kept cleanly separate (D1).
|
|
100
|
+
doctor: { group: "Maintain", descriptionKey: "cli.help.group.maintain.doctor" },
|
|
101
|
+
audit: { group: "Maintain", descriptionKey: "cli.help.group.maintain.audit" },
|
|
102
|
+
// Internal RPCs — hidden from human help, invoked by hooks/skills.
|
|
103
|
+
"plan-context-hint": { internal: true },
|
|
104
|
+
"onboard-coverage": { internal: true }
|
|
105
|
+
};
|
|
106
|
+
function describe(name, meta) {
|
|
107
|
+
if (name === "uninstall") {
|
|
108
|
+
return t("cli.uninstall.description").split("\n")[0] ?? "Uninstall Fabric";
|
|
109
|
+
}
|
|
110
|
+
if (meta?.descriptionKey) {
|
|
111
|
+
return t(meta.descriptionKey);
|
|
112
|
+
}
|
|
113
|
+
return name;
|
|
114
|
+
}
|
|
69
115
|
function getGroupedCommands() {
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
name: "Daily",
|
|
81
|
-
commands: [
|
|
82
|
-
{ name: "sync", description: t("cli.help.group.daily.sync") },
|
|
83
|
-
{ name: "info", description: t("cli.help.group.daily.info") }
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: "Diagnostic",
|
|
88
|
-
commands: [
|
|
89
|
-
{ name: "doctor", description: t("cli.help.group.diagnostic.doctor") }
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: "Advanced",
|
|
94
|
-
commands: [
|
|
95
|
-
{ name: "store", description: t("cli.help.group.advanced.store") },
|
|
96
|
-
{
|
|
97
|
-
name: "whoami",
|
|
98
|
-
description: t("cli.help.group.advanced.whoami"),
|
|
99
|
-
deprecated: true,
|
|
100
|
-
deprecatedNote: t("cli.help.group.advanced.whoami.deprecated")
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
name: "status",
|
|
104
|
-
description: t("cli.help.group.advanced.status"),
|
|
105
|
-
deprecated: true,
|
|
106
|
-
deprecatedNote: t("cli.help.group.advanced.status.deprecated")
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
name: "scope-explain",
|
|
110
|
-
description: t("cli.help.group.advanced.scope-explain"),
|
|
111
|
-
deprecated: true,
|
|
112
|
-
deprecatedNote: t("cli.help.group.advanced.scope-explain.deprecated")
|
|
113
|
-
}
|
|
114
|
-
]
|
|
116
|
+
const byGroup = /* @__PURE__ */ new Map();
|
|
117
|
+
for (const group of GROUP_ORDER) {
|
|
118
|
+
byGroup.set(group, []);
|
|
119
|
+
}
|
|
120
|
+
for (const name of Object.keys(allCommands)) {
|
|
121
|
+
const meta = COMMAND_META[name];
|
|
122
|
+
if (meta?.internal) {
|
|
123
|
+
continue;
|
|
115
124
|
}
|
|
116
|
-
|
|
117
|
-
|
|
125
|
+
const group = meta?.group ?? DEFAULT_GROUP;
|
|
126
|
+
byGroup.get(group)?.push({ name, description: describe(name, meta) });
|
|
127
|
+
}
|
|
128
|
+
return GROUP_ORDER.map((name) => ({ name, commands: byGroup.get(name) ?? [] })).filter(
|
|
129
|
+
(g) => g.commands.length > 0
|
|
130
|
+
);
|
|
118
131
|
}
|
|
119
|
-
function renderGroupedHelp(
|
|
132
|
+
function renderGroupedHelp(_cmd, _version) {
|
|
120
133
|
const groups = getGroupedCommands();
|
|
121
134
|
const lines = [];
|
|
122
135
|
lines.push("fabric - Cross-client AI knowledge layer");
|
|
@@ -127,11 +140,7 @@ function renderGroupedHelp(cmd, version) {
|
|
|
127
140
|
lines.push(`${group.name}:`);
|
|
128
141
|
for (const command of group.commands) {
|
|
129
142
|
const name = command.name.padEnd(14);
|
|
130
|
-
|
|
131
|
-
if (command.deprecated) {
|
|
132
|
-
line += ` (${command.deprecatedNote})`;
|
|
133
|
-
}
|
|
134
|
-
lines.push(line);
|
|
143
|
+
lines.push(` ${name}${command.description}`);
|
|
135
144
|
}
|
|
136
145
|
lines.push("");
|
|
137
146
|
}
|
|
@@ -153,7 +162,7 @@ async function customShowUsageGrouped(cmd, parent, version) {
|
|
|
153
162
|
var main = defineCommand({
|
|
154
163
|
meta: {
|
|
155
164
|
name: "fabric",
|
|
156
|
-
version: "2.
|
|
165
|
+
version: "2.3.0-rc.1",
|
|
157
166
|
description: t("cli.main.description")
|
|
158
167
|
},
|
|
159
168
|
subCommands: allCommands
|
|
@@ -165,7 +174,7 @@ async function customShowUsage(cmd, parent) {
|
|
|
165
174
|
return;
|
|
166
175
|
}
|
|
167
176
|
if (cmdMeta?.name === "fabric" && parent === void 0) {
|
|
168
|
-
await customShowUsageGrouped(cmd, parent, "2.
|
|
177
|
+
await customShowUsageGrouped(cmd, parent, "2.3.0-rc.1");
|
|
169
178
|
return;
|
|
170
179
|
}
|
|
171
180
|
console.log(await renderUsage(cmd, parent) + "\n");
|
|
@@ -190,7 +199,8 @@ async function run() {
|
|
|
190
199
|
await runMain(main, { rawArgs });
|
|
191
200
|
return;
|
|
192
201
|
}
|
|
193
|
-
|
|
202
|
+
const showStack = rawArgs.includes("--debug") || process.env.FABRIC_DEBUG === "1";
|
|
203
|
+
renderUnexpectedError(err, showStack);
|
|
194
204
|
process.exit(1);
|
|
195
205
|
}
|
|
196
206
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
storeGitRemote
|
|
4
|
+
} from "./chunk-7V4XMLQ2.js";
|
|
5
|
+
import {
|
|
6
|
+
loadProjectConfig,
|
|
3
7
|
scopeExplain
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-I5F5BHWI.js";
|
|
5
9
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "./chunk-27HK6H5Y.js";
|
|
10
|
-
import "./chunk-QPAW6IYT.js";
|
|
11
|
-
import "./chunk-QFIVFZRH.js";
|
|
12
|
-
import "./chunk-FNHDQTPC.js";
|
|
10
|
+
loadGlobalConfig,
|
|
11
|
+
resolveGlobalRoot
|
|
12
|
+
} from "./chunk-FNHDQTPC.js";
|
|
13
13
|
import {
|
|
14
14
|
getProjectTranslator
|
|
15
15
|
} from "./chunk-HORSMSZL.js";
|
|
@@ -17,24 +17,88 @@ import {
|
|
|
17
17
|
// src/commands/info.ts
|
|
18
18
|
import { defineCommand } from "citty";
|
|
19
19
|
import { FabricError } from "@fenglimg/fabric-shared/errors";
|
|
20
|
+
|
|
21
|
+
// src/lib/unknown-flags.ts
|
|
22
|
+
function warnUnknownFlags(known) {
|
|
23
|
+
const knownSet = /* @__PURE__ */ new Set([...known, "help", "version"]);
|
|
24
|
+
const unknown = [];
|
|
25
|
+
for (const tok of process.argv.slice(2)) {
|
|
26
|
+
if (!tok.startsWith("--")) continue;
|
|
27
|
+
const name = tok.slice(2).split("=")[0].replace(/^no-/, "");
|
|
28
|
+
if (name.length === 0) continue;
|
|
29
|
+
if (!knownSet.has(name)) unknown.push(tok.split("=")[0]);
|
|
30
|
+
}
|
|
31
|
+
if (unknown.length > 0) {
|
|
32
|
+
process.stderr.write(`[fabric] ignored unknown flag(s): ${unknown.join(", ")}
|
|
33
|
+
`);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/store/info-ops.ts
|
|
38
|
+
function whoami(globalRoot = resolveGlobalRoot()) {
|
|
39
|
+
const config = loadGlobalConfig(globalRoot);
|
|
40
|
+
if (config === null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
uid: config.uid,
|
|
45
|
+
stores: config.stores.map((s) => ({
|
|
46
|
+
alias: s.alias,
|
|
47
|
+
mount_name: s.mount_name ?? null,
|
|
48
|
+
store_uuid: s.store_uuid,
|
|
49
|
+
// F4: parity with `fabric store list` — local-only reflects the store
|
|
50
|
+
// repo's TRUE git remote (what sync actually pushes to), not the registry
|
|
51
|
+
// metadata. A store with a physical `origin` but no registry `remote`
|
|
52
|
+
// (e.g. the personal store) was misreported as local-only by whoami while
|
|
53
|
+
// `store list` honestly showed its remote. Both now read the same source.
|
|
54
|
+
local_only: storeGitRemote(s.alias, globalRoot) === void 0
|
|
55
|
+
}))
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function projectStatus(projectRoot, globalRoot = resolveGlobalRoot()) {
|
|
59
|
+
const global = loadGlobalConfig(globalRoot);
|
|
60
|
+
const project = loadProjectConfig(projectRoot);
|
|
61
|
+
return {
|
|
62
|
+
uid: global?.uid ?? null,
|
|
63
|
+
mounted: (global?.stores ?? []).map((s) => s.alias),
|
|
64
|
+
project_id: project?.project_id ?? null,
|
|
65
|
+
is_fabric_project: project !== null,
|
|
66
|
+
required: (project?.required_stores ?? []).map((r) => r.id),
|
|
67
|
+
active_write_store: project?.active_write_store ?? null,
|
|
68
|
+
default_write_store: project?.default_write_store ?? null,
|
|
69
|
+
write_routes: project?.write_routes ?? []
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/commands/info.ts
|
|
74
|
+
var scopeCommand = defineCommand({
|
|
75
|
+
meta: {
|
|
76
|
+
name: "scope",
|
|
77
|
+
description: "Resolve a scope coordinate's read-set + write target (JSON)"
|
|
78
|
+
},
|
|
79
|
+
args: {
|
|
80
|
+
coord: {
|
|
81
|
+
type: "positional",
|
|
82
|
+
required: true,
|
|
83
|
+
description: "Scope coordinate (e.g. team, project:x, personal)"
|
|
84
|
+
},
|
|
85
|
+
// Accepted for symmetry with other commands; scope output is always JSON.
|
|
86
|
+
json: {
|
|
87
|
+
type: "boolean",
|
|
88
|
+
description: "Emit machine-readable JSON (scope always emits JSON)"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
run({ args }) {
|
|
92
|
+
warnUnknownFlags(["json"]);
|
|
93
|
+
runScopeExplain(args.coord);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
20
96
|
var info_default = defineCommand({
|
|
21
97
|
meta: {
|
|
22
98
|
name: "info",
|
|
23
99
|
description: "Unified information command for Fabric identity, project status, and scope resolution"
|
|
24
100
|
},
|
|
25
101
|
args: {
|
|
26
|
-
// Subcommand detection
|
|
27
|
-
subcommand: {
|
|
28
|
-
type: "positional",
|
|
29
|
-
required: false,
|
|
30
|
-
description: "Subcommand: 'scope' for scope explanation"
|
|
31
|
-
},
|
|
32
|
-
scope: {
|
|
33
|
-
type: "positional",
|
|
34
|
-
required: false,
|
|
35
|
-
description: "Scope coordinate (used with 'scope' subcommand)"
|
|
36
|
-
},
|
|
37
|
-
// Flags
|
|
38
102
|
global: {
|
|
39
103
|
type: "boolean",
|
|
40
104
|
description: "Show global identity (whoami) instead of project status",
|
|
@@ -45,37 +109,18 @@ var info_default = defineCommand({
|
|
|
45
109
|
description: "Emit machine-readable JSON instead of text"
|
|
46
110
|
}
|
|
47
111
|
},
|
|
112
|
+
subCommands: {
|
|
113
|
+
scope: scopeCommand
|
|
114
|
+
},
|
|
48
115
|
run({ args }) {
|
|
49
116
|
warnUnknownFlags(["global", "g", "json"]);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
runWhoami(args.json);
|
|
54
|
-
break;
|
|
55
|
-
case "scope-explain":
|
|
56
|
-
if (typeof args.scope !== "string" || args.scope.length === 0) {
|
|
57
|
-
console.error("Usage: fabric info scope <scope>");
|
|
58
|
-
process.exitCode = 1;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
runScopeExplain(args.scope);
|
|
62
|
-
break;
|
|
63
|
-
case "status":
|
|
64
|
-
default:
|
|
65
|
-
runStatus(args.json);
|
|
66
|
-
break;
|
|
117
|
+
if (args.global === true) {
|
|
118
|
+
runWhoami(args.json);
|
|
119
|
+
return;
|
|
67
120
|
}
|
|
121
|
+
runStatus(args.json);
|
|
68
122
|
}
|
|
69
123
|
});
|
|
70
|
-
function resolveMode(args) {
|
|
71
|
-
if (args.subcommand === "scope") {
|
|
72
|
-
return "scope-explain";
|
|
73
|
-
}
|
|
74
|
-
if (args.global === true) {
|
|
75
|
-
return "whoami";
|
|
76
|
-
}
|
|
77
|
-
return "status";
|
|
78
|
-
}
|
|
79
124
|
function runWhoami(json) {
|
|
80
125
|
const info = whoami();
|
|
81
126
|
if (json === true) {
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-722JU5BP.js";
|
|
5
5
|
import "./chunk-WA3DYGSY.js";
|
|
6
6
|
|
|
7
|
-
// src/commands/
|
|
7
|
+
// src/commands/inspect.ts
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
9
|
import { createRequire } from "module";
|
|
10
10
|
import { dirname, join, parse, resolve } from "path";
|
|
@@ -59,7 +59,7 @@ function renderExplain(sinks) {
|
|
|
59
59
|
}
|
|
60
60
|
return lines.join("\n");
|
|
61
61
|
}
|
|
62
|
-
async function
|
|
62
|
+
async function runInspect(opts) {
|
|
63
63
|
const cwd = opts.target ? resolve(opts.target) : process.cwd();
|
|
64
64
|
const payload = opts.payload !== void 0 ? opts.payload : await runPlanContextHint({ all: true, target: opts.target });
|
|
65
65
|
const renderer = loadHookRenderer();
|
|
@@ -75,9 +75,9 @@ async function runContext(opts) {
|
|
|
75
75
|
if (base.length === 0 && !sinks.hasRenderedContent) return "";
|
|
76
76
|
return opts.explain === true ? base + "\n" + renderExplain(sinks) : base;
|
|
77
77
|
}
|
|
78
|
-
var
|
|
78
|
+
var inspectCommand = defineCommand({
|
|
79
79
|
meta: {
|
|
80
|
-
name: "
|
|
80
|
+
name: "inspect",
|
|
81
81
|
description: "Show what Fabric injects at SessionStart (the knowledge spine). --explain for per-entry provenance."
|
|
82
82
|
},
|
|
83
83
|
args: {
|
|
@@ -98,20 +98,20 @@ var contextCommand = defineCommand({
|
|
|
98
98
|
async run({ args }) {
|
|
99
99
|
try {
|
|
100
100
|
const render = args.render === "human" || args.render === "ai" ? args.render : void 0;
|
|
101
|
-
const out = await
|
|
101
|
+
const out = await runInspect({ render, explain: args.explain === true, target: args.target });
|
|
102
102
|
if (out.length > 0) process.stdout.write(`${out}
|
|
103
103
|
`);
|
|
104
104
|
} catch (error) {
|
|
105
105
|
const message = error instanceof Error ? error.message : String(error);
|
|
106
|
-
process.stderr.write(`
|
|
106
|
+
process.stderr.write(`inspect failed: ${message}
|
|
107
107
|
`);
|
|
108
108
|
process.exitCode = 1;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
});
|
|
112
|
-
var
|
|
112
|
+
var inspect_default = inspectCommand;
|
|
113
113
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
inspect_default as default,
|
|
115
|
+
inspectCommand,
|
|
116
|
+
runInspect
|
|
117
117
|
};
|