@fenglimg/fabric-cli 2.0.0-rc.11 → 2.0.0-rc.15
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 +6 -4
- package/dist/chunk-AIB54QRT.js +82 -0
- package/dist/{chunk-5MQ52F42.js → chunk-AXIFEVAS.js} +16 -219
- package/dist/{chunk-WWNXR34K.js → chunk-G2CIOLD4.js} +16 -1
- package/dist/{chunk-HQLEHH4O.js → chunk-SKSYUHKK.js} +267 -40
- package/dist/chunk-UTF4YBDN.js +366 -0
- package/dist/config-7YD365I3.js +13 -0
- package/dist/{doctor-RILCO5OG.js → doctor-6XHLQJXB.js} +67 -50
- package/dist/index.js +8 -9
- package/dist/{init-C56PWHID.js → install-JLDCHAXV.js} +409 -416
- package/dist/{plan-context-hint-QMUPAXIB.js → plan-context-hint-73U4FGKO.js} +6 -1
- package/dist/{serve-NGLXHDYC.js → serve-L3X5UHG2.js} +15 -10
- package/dist/{uninstall-DBAR2JBS.js → uninstall-DD6FIFCI.js} +81 -179
- package/package.json +3 -3
- package/templates/hooks/configs/README.md +10 -6
- package/templates/hooks/configs/cursor-hooks.json +7 -10
- package/templates/hooks/knowledge-hint-broad.cjs +28 -107
- package/templates/skills/fabric-archive/SKILL.md +15 -15
- package/templates/skills/fabric-import/SKILL.md +26 -26
- package/templates/skills/fabric-review/SKILL.md +19 -19
- package/dist/chunk-AW3G7ZH5.js +0 -576
- package/dist/chunk-WPTA74BY.js +0 -184
- package/dist/hooks-NX32PPEN.js +0 -13
- package/dist/scan-66EKMNAY.js +0 -24
package/dist/chunk-WPTA74BY.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
addArchiveSkillPointer,
|
|
4
|
-
installArchiveHintHook,
|
|
5
|
-
installFabricArchiveSkill,
|
|
6
|
-
installFabricImportSkill,
|
|
7
|
-
installFabricReviewSkill,
|
|
8
|
-
installKnowledgeHintBroadHook,
|
|
9
|
-
installKnowledgeHintNarrowHook,
|
|
10
|
-
mergeClaudeCodeHookConfig,
|
|
11
|
-
mergeCodexHookConfig,
|
|
12
|
-
mergeCursorHookConfig
|
|
13
|
-
} from "./chunk-AW3G7ZH5.js";
|
|
14
|
-
import {
|
|
15
|
-
t
|
|
16
|
-
} from "./chunk-6ICJICVU.js";
|
|
17
|
-
|
|
18
|
-
// src/commands/hooks.ts
|
|
19
|
-
import { existsSync, statSync } from "fs";
|
|
20
|
-
import { isAbsolute, join, resolve } from "path";
|
|
21
|
-
import { defineCommand } from "citty";
|
|
22
|
-
var hooksCommand = defineCommand({
|
|
23
|
-
meta: {
|
|
24
|
-
name: "hooks",
|
|
25
|
-
description: t("cli.hooks.description")
|
|
26
|
-
},
|
|
27
|
-
subCommands: {
|
|
28
|
-
install: defineCommand({
|
|
29
|
-
meta: {
|
|
30
|
-
name: "install",
|
|
31
|
-
description: t("cli.hooks.install.description")
|
|
32
|
-
},
|
|
33
|
-
args: {
|
|
34
|
-
target: {
|
|
35
|
-
type: "string",
|
|
36
|
-
description: t("cli.hooks.install.args.target.description"),
|
|
37
|
-
default: process.cwd()
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
async run({ args }) {
|
|
41
|
-
const result = await installHooks(args.target);
|
|
42
|
-
for (const path of result.installed) {
|
|
43
|
-
console.log(`installed ${path}`);
|
|
44
|
-
}
|
|
45
|
-
for (const path of result.skipped) {
|
|
46
|
-
console.log(`skipped ${path}`);
|
|
47
|
-
}
|
|
48
|
-
for (const message of result.errors) {
|
|
49
|
-
console.error(`error ${message}`);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
var hooks_default = hooksCommand;
|
|
56
|
-
async function installHooks(target, _options = {}) {
|
|
57
|
-
const normalizedTarget = normalizeTarget(target);
|
|
58
|
-
assertExistingDirectory(normalizedTarget);
|
|
59
|
-
const results = [];
|
|
60
|
-
results.push(...await runStep(() => installFabricArchiveSkill(normalizedTarget)));
|
|
61
|
-
results.push(...await runStep(() => installFabricReviewSkill(normalizedTarget)));
|
|
62
|
-
results.push(...await runStep(() => installFabricImportSkill(normalizedTarget)));
|
|
63
|
-
results.push(...await runStep(() => installArchiveHintHook(normalizedTarget)));
|
|
64
|
-
results.push(...await runStep(() => installKnowledgeHintBroadHook(normalizedTarget)));
|
|
65
|
-
results.push(...await runStep(() => installKnowledgeHintNarrowHook(normalizedTarget)));
|
|
66
|
-
results.push(await runSingleStep("claude-hook-config", () => mergeClaudeCodeHookConfig(normalizedTarget)));
|
|
67
|
-
results.push(await runSingleStep("codex-hook-config", () => mergeCodexHookConfig(normalizedTarget)));
|
|
68
|
-
results.push(await runSingleStep("cursor-hook-config", () => mergeCursorHookConfig(normalizedTarget)));
|
|
69
|
-
results.push(...await runStep(() => addArchiveSkillPointer(normalizedTarget)));
|
|
70
|
-
results.push(...validateHookPaths(normalizedTarget));
|
|
71
|
-
return summarizeResults(results);
|
|
72
|
-
}
|
|
73
|
-
function validateHookPaths(projectRoot) {
|
|
74
|
-
const scripts = [
|
|
75
|
-
{ stepSuffix: "", hookFile: "fabric-hint.cjs" },
|
|
76
|
-
{ stepSuffix: "-broad", hookFile: "knowledge-hint-broad.cjs" },
|
|
77
|
-
{ stepSuffix: "-narrow", hookFile: "knowledge-hint-narrow.cjs" }
|
|
78
|
-
];
|
|
79
|
-
const clients = [
|
|
80
|
-
{
|
|
81
|
-
client: "claude",
|
|
82
|
-
configRel: join(".claude", "settings.json"),
|
|
83
|
-
hookDir: join(".claude", "hooks")
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
client: "codex",
|
|
87
|
-
configRel: join(".codex", "hooks.json"),
|
|
88
|
-
hookDir: join(".codex", "hooks")
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
client: "cursor",
|
|
92
|
-
configRel: join(".cursor", "hooks.json"),
|
|
93
|
-
hookDir: join(".cursor", "hooks")
|
|
94
|
-
}
|
|
95
|
-
];
|
|
96
|
-
const results = [];
|
|
97
|
-
for (const { client, configRel, hookDir } of clients) {
|
|
98
|
-
const configPath = resolve(projectRoot, configRel);
|
|
99
|
-
if (!existsSync(configPath)) {
|
|
100
|
-
results.push({
|
|
101
|
-
step: `hook-validate-${client}`,
|
|
102
|
-
path: configPath,
|
|
103
|
-
status: "skipped",
|
|
104
|
-
message: "missing-config"
|
|
105
|
-
});
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
for (const { stepSuffix, hookFile } of scripts) {
|
|
109
|
-
const expectedHookPath = resolve(projectRoot, hookDir, hookFile);
|
|
110
|
-
const expectedHookRel = join(hookDir, hookFile);
|
|
111
|
-
const step = `hook-validate-${client}${stepSuffix}`;
|
|
112
|
-
if (!existsSync(expectedHookPath)) {
|
|
113
|
-
results.push({
|
|
114
|
-
step,
|
|
115
|
-
path: expectedHookPath,
|
|
116
|
-
status: "error",
|
|
117
|
-
message: `hook script missing: ${expectedHookRel}`
|
|
118
|
-
});
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
results.push({ step, path: expectedHookPath, status: "skipped", message: "ok" });
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return results;
|
|
125
|
-
}
|
|
126
|
-
async function runStep(fn) {
|
|
127
|
-
try {
|
|
128
|
-
return await fn();
|
|
129
|
-
} catch (error) {
|
|
130
|
-
return [
|
|
131
|
-
{
|
|
132
|
-
step: "hook-install",
|
|
133
|
-
path: "",
|
|
134
|
-
status: "error",
|
|
135
|
-
message: error instanceof Error ? error.message : String(error)
|
|
136
|
-
}
|
|
137
|
-
];
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
async function runSingleStep(step, fn) {
|
|
141
|
-
try {
|
|
142
|
-
return await fn();
|
|
143
|
-
} catch (error) {
|
|
144
|
-
return {
|
|
145
|
-
step,
|
|
146
|
-
path: "",
|
|
147
|
-
status: "error",
|
|
148
|
-
message: error instanceof Error ? error.message : String(error)
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
function summarizeResults(results) {
|
|
153
|
-
const installed = [];
|
|
154
|
-
const skipped = [];
|
|
155
|
-
const errors = [];
|
|
156
|
-
for (const r of results) {
|
|
157
|
-
switch (r.status) {
|
|
158
|
-
case "written":
|
|
159
|
-
installed.push(r.path);
|
|
160
|
-
break;
|
|
161
|
-
case "skipped":
|
|
162
|
-
skipped.push(r.path);
|
|
163
|
-
break;
|
|
164
|
-
case "error":
|
|
165
|
-
errors.push(`${r.step} ${r.path}: ${r.message ?? "unknown error"}`);
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return { installed, skipped, errors };
|
|
170
|
-
}
|
|
171
|
-
function normalizeTarget(targetInput) {
|
|
172
|
-
return isAbsolute(targetInput) ? targetInput : resolve(process.cwd(), targetInput);
|
|
173
|
-
}
|
|
174
|
-
function assertExistingDirectory(target) {
|
|
175
|
-
if (!existsSync(target) || !statSync(target).isDirectory()) {
|
|
176
|
-
throw new Error(t("cli.shared.target-invalid", { target }));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export {
|
|
181
|
-
hooksCommand,
|
|
182
|
-
hooks_default,
|
|
183
|
-
installHooks
|
|
184
|
-
};
|
package/dist/hooks-NX32PPEN.js
DELETED
package/dist/scan-66EKMNAY.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
__testing__,
|
|
4
|
-
createScanReport,
|
|
5
|
-
deriveTagsFromForensic,
|
|
6
|
-
detectExistingLanguage,
|
|
7
|
-
formatKnowledgeId,
|
|
8
|
-
runInitScan,
|
|
9
|
-
scanCommand,
|
|
10
|
-
scan_default
|
|
11
|
-
} from "./chunk-5MQ52F42.js";
|
|
12
|
-
import "./chunk-WWNXR34K.js";
|
|
13
|
-
import "./chunk-OBQU6NHO.js";
|
|
14
|
-
import "./chunk-6ICJICVU.js";
|
|
15
|
-
export {
|
|
16
|
-
__testing__,
|
|
17
|
-
createScanReport,
|
|
18
|
-
scan_default as default,
|
|
19
|
-
deriveTagsFromForensic,
|
|
20
|
-
detectExistingLanguage,
|
|
21
|
-
formatKnowledgeId,
|
|
22
|
-
runInitScan,
|
|
23
|
-
scanCommand
|
|
24
|
-
};
|