@fenglimg/fabric-cli 0.1.3 → 1.0.0

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 (29) hide show
  1. package/dist/{bootstrap-BBFPEJQP.js → bootstrap-PMIA4W6G.js} +16 -12
  2. package/dist/{chunk-ZW4M4WZB.js → chunk-5BSTO745.js} +9 -6
  3. package/dist/chunk-6ICJICVU.js +10 -0
  4. package/dist/chunk-AEOYCVBG.js +0 -0
  5. package/dist/{chunk-SC4A43WR.js → chunk-DKQ3HOTK.js} +59 -89
  6. package/dist/{chunk-PJ4J4377.js → chunk-F2BXHPM5.js} +11 -7
  7. package/dist/{chunk-YHIKLBTB.js → chunk-L43IGJ6X.js} +17 -7
  8. package/dist/chunk-P4KVFB2T.js +0 -0
  9. package/dist/{chunk-3FZPYATY.js → chunk-VMYPJPKV.js} +11 -4
  10. package/dist/chunk-WWNXR34K.js +49 -0
  11. package/dist/{config-TNY6BCQ2.js → config-PXEEXWLM.js} +14 -11
  12. package/dist/{hooks-QWVCECWF.js → hooks-5S5IRVQE.js} +36 -11
  13. package/dist/human-lint-YSFOZHZ7.js +13 -0
  14. package/dist/index.js +15 -11
  15. package/dist/init-G6Q3OOMC.js +601 -0
  16. package/dist/{ledger-append-KYPMIAM4.js → ledger-append-XZ5SX4O5.js} +2 -1
  17. package/dist/{pre-commit-ICTZBF6F.js → pre-commit-IEIXHKOD.js} +13 -7
  18. package/dist/{scan-COKVYPOH.js → scan-6CURGC3D.js} +3 -1
  19. package/dist/serve-4J2CQY25.js +112 -0
  20. package/dist/{sync-meta-YIB7IBHK.js → sync-meta-L6M4AEUT.js} +2 -1
  21. package/package.json +12 -8
  22. package/templates/agents-md/AGENTS.md.template +17 -11
  23. package/templates/agents-md/variants/cocos.md +37 -0
  24. package/templates/agents-md/variants/next.md +37 -0
  25. package/templates/agents-md/variants/vite.md +37 -0
  26. package/templates/claude-hooks/agents-md-init-reminder.cjs +18 -0
  27. package/templates/claude-skills/agents-md-init/SKILL.md +86 -0
  28. package/dist/human-lint-SV4D5LQ7.js +0 -9
  29. package/dist/init-VR43EQRO.js +0 -149
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  resolveClients
4
- } from "./chunk-3FZPYATY.js";
4
+ } from "./chunk-VMYPJPKV.js";
5
+ import {
6
+ t
7
+ } from "./chunk-6ICJICVU.js";
5
8
 
6
9
  // src/commands/config.ts
7
10
  import { existsSync } from "fs";
@@ -37,7 +40,7 @@ function parseClientFilter(value) {
37
40
  const alias = rawClient.trim().toLowerCase();
38
41
  const clientKind = CLIENT_ALIASES[alias];
39
42
  if (clientKind === void 0) {
40
- throw new Error(`Unknown client "${rawClient}". Use a comma-separated list such as cursor,codex,gemini.`);
43
+ throw new Error(t("cli.config.errors.unknown-client", { client: rawClient }));
41
44
  }
42
45
  clients.add(clientKind);
43
46
  }
@@ -50,7 +53,7 @@ async function loadFabricConfig(workspaceRoot) {
50
53
  }
51
54
  const parsed = JSON.parse(await readFile(configPath, "utf8"));
52
55
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
53
- throw new Error(`Expected object in ${configPath}`);
56
+ throw new Error(t("cli.config.errors.expected-object", { path: configPath }));
54
57
  }
55
58
  return parsed;
56
59
  }
@@ -65,22 +68,22 @@ function writeStderr(message) {
65
68
  var configCmd = defineCommand({
66
69
  meta: {
67
70
  name: "config",
68
- description: "Manage Fabric MCP client configuration."
71
+ description: t("cli.config.description")
69
72
  },
70
73
  subCommands: {
71
74
  install: defineCommand({
72
75
  meta: {
73
76
  name: "install",
74
- description: "Install Fabric MCP server entries into detected client configs."
77
+ description: t("cli.config.install.description")
75
78
  },
76
79
  args: {
77
80
  clients: {
78
81
  type: "string",
79
- description: "Optional comma-separated client filter, e.g. cursor,codex,gemini."
82
+ description: t("cli.config.install.args.clients.description")
80
83
  },
81
84
  "dry-run": {
82
85
  type: "boolean",
83
- description: "Print detected writes without changing files.",
86
+ description: t("cli.config.install.args.dry-run.description"),
84
87
  default: false
85
88
  }
86
89
  },
@@ -93,21 +96,21 @@ var configCmd = defineCommand({
93
96
  (writer) => selectedClients === null ? true : selectedClients.has(writer.clientKind)
94
97
  );
95
98
  if (writers.length === 0) {
96
- writeStderr("No Fabric MCP client configs detected. Create a client directory or set fabric.config.json clientPaths.");
99
+ writeStderr(t("cli.config.install.no-configs"));
97
100
  return;
98
101
  }
99
102
  for (const writer of writers) {
100
103
  const configPath = await writer.detect(workspaceRoot);
101
104
  if (configPath === null) {
102
- writeStderr(`Skipping ${writer.clientKind}: no config path detected.`);
105
+ writeStderr(t("cli.config.install.no-config-path", { client: writer.clientKind }));
103
106
  continue;
104
107
  }
105
108
  if (args["dry-run"]) {
106
- writeStderr(`[dry-run] ${writer.clientKind}: would write ${configPath}`);
109
+ writeStderr(t("cli.config.install.dry-run", { client: writer.clientKind, path: configPath }));
107
110
  continue;
108
111
  }
109
112
  await writer.write(serverPath, workspaceRoot);
110
- writeStderr(`${writer.clientKind}: wrote ${configPath}`);
113
+ writeStderr(t("cli.config.install.wrote", { client: writer.clientKind, path: configPath }));
111
114
  }
112
115
  }
113
116
  })
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ t
4
+ } from "./chunk-6ICJICVU.js";
2
5
 
3
6
  // src/commands/hooks.ts
4
7
  import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
@@ -8,18 +11,18 @@ import { defineCommand } from "citty";
8
11
  var hooksCommand = defineCommand({
9
12
  meta: {
10
13
  name: "hooks",
11
- description: "Manage Fabric git hook templates."
14
+ description: t("cli.hooks.description")
12
15
  },
13
16
  subCommands: {
14
17
  install: defineCommand({
15
18
  meta: {
16
19
  name: "install",
17
- description: "Install the Fabric Husky pre-commit hook template."
20
+ description: t("cli.hooks.install.description")
18
21
  },
19
22
  args: {
20
23
  target: {
21
24
  type: "string",
22
- description: "Target project path. Defaults to the current working directory.",
25
+ description: t("cli.hooks.install.args.target.description"),
23
26
  default: process.cwd()
24
27
  }
25
28
  },
@@ -30,10 +33,26 @@ var hooksCommand = defineCommand({
30
33
  const hookPath = join(huskyDir, "pre-commit");
31
34
  const packageJsonPath = join(target, "package.json");
32
35
  if (!existsSync(packageJsonPath)) {
33
- throw new Error(`package.json is required to install hooks: ${packageJsonPath}`);
36
+ throw new Error(t("cli.hooks.errors.package-json-required", { path: packageJsonPath }));
34
37
  }
35
38
  mkdirSync(huskyDir, { recursive: true });
36
- writeFileSync(hookPath, readFileSync(findTemplatePath("templates/husky/pre-commit"), "utf8"), "utf8");
39
+ const templateContent = readFileSync(findTemplatePath("templates/husky/pre-commit"), "utf8");
40
+ let hookAction;
41
+ if (existsSync(hookPath)) {
42
+ const existing = readFileSync(hookPath, "utf8");
43
+ if (existing.includes("FAB_BIN=")) {
44
+ hookAction = "skipped";
45
+ } else {
46
+ const fabricBlock = templateContent.replace(/^#!\/bin\/sh\n/, "");
47
+ const separator = existing.endsWith("\n") ? "\n" : "\n\n";
48
+ writeFileSync(hookPath, `${existing}${separator}# --- Fabric ---
49
+ ${fabricBlock}`, "utf8");
50
+ hookAction = "appended";
51
+ }
52
+ } else {
53
+ writeFileSync(hookPath, templateContent, "utf8");
54
+ hookAction = "created";
55
+ }
37
56
  chmodSync(hookPath, 493);
38
57
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
39
58
  const scripts = packageJson.scripts && typeof packageJson.scripts === "object" && !Array.isArray(packageJson.scripts) ? packageJson.scripts : {};
@@ -44,11 +63,17 @@ var hooksCommand = defineCommand({
44
63
  writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
45
64
  `, "utf8");
46
65
  }
47
- writeStderr(`Installed ${hookPath}`);
66
+ if (hookAction === "skipped") {
67
+ writeStderr(t("cli.hooks.install.hook-skipped", { path: hookPath }));
68
+ } else if (hookAction === "appended") {
69
+ writeStderr(t("cli.hooks.install.hook-appended", { path: hookPath }));
70
+ } else {
71
+ writeStderr(t("cli.hooks.install.hook-created", { path: hookPath }));
72
+ }
48
73
  if (hadPrepare) {
49
- writeStderr(`Left existing prepare script unchanged in ${packageJsonPath}`);
74
+ writeStderr(t("cli.hooks.install.prepare-left", { path: packageJsonPath }));
50
75
  } else {
51
- writeStderr(`Added prepare script to ${packageJsonPath}`);
76
+ writeStderr(t("cli.hooks.install.prepare-added", { path: packageJsonPath }));
52
77
  }
53
78
  }
54
79
  })
@@ -60,7 +85,7 @@ function normalizeTarget(targetInput) {
60
85
  }
61
86
  function assertExistingDirectory(target) {
62
87
  if (!existsSync(target) || !statSync(target).isDirectory()) {
63
- throw new Error(`Target must be an existing directory: ${target}`);
88
+ throw new Error(t("cli.shared.target-invalid", { target }));
64
89
  }
65
90
  }
66
91
  function findTemplatePath(relativePath) {
@@ -74,7 +99,7 @@ function findTemplatePath(relativePath) {
74
99
  return candidate;
75
100
  }
76
101
  }
77
- throw new Error(`Template not found: ${relativePath}`);
102
+ throw new Error(t("cli.shared.template-not-found", { path: relativePath }));
78
103
  }
79
104
  function templateCandidatesFrom(start, relativePath) {
80
105
  const candidates = [];
@@ -87,7 +112,7 @@ function templateCandidatesFrom(start, relativePath) {
87
112
  }
88
113
  current = parent;
89
114
  }
90
- return candidates;
115
+ return candidates.reverse();
91
116
  }
92
117
  function writeStderr(message) {
93
118
  process.stderr.write(`${message}
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ humanLintCommand,
4
+ humanLockEntrySchema,
5
+ human_lint_default
6
+ } from "./chunk-L43IGJ6X.js";
7
+ import "./chunk-WWNXR34K.js";
8
+ import "./chunk-6ICJICVU.js";
9
+ export {
10
+ human_lint_default as default,
11
+ humanLintCommand,
12
+ humanLockEntrySchema
13
+ };
package/dist/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ t
4
+ } from "./chunk-6ICJICVU.js";
2
5
 
3
6
  // src/index.ts
4
7
  import { realpathSync } from "fs";
@@ -8,23 +11,24 @@ import { defineCommand, runMain } from "citty";
8
11
 
9
12
  // src/commands/index.ts
10
13
  var allCommands = {
11
- bootstrap: () => import("./bootstrap-BBFPEJQP.js").then((module) => module.default),
12
- init: () => import("./init-VR43EQRO.js").then((module) => module.default),
13
- scan: () => import("./scan-COKVYPOH.js").then((module) => module.default),
14
- "sync-meta": () => import("./sync-meta-YIB7IBHK.js").then((module) => module.default),
15
- "human-lint": () => import("./human-lint-SV4D5LQ7.js").then((module) => module.default),
16
- "ledger-append": () => import("./ledger-append-KYPMIAM4.js").then((module) => module.default),
17
- hooks: () => import("./hooks-QWVCECWF.js").then((module) => module.default),
18
- config: () => import("./config-TNY6BCQ2.js").then((module) => module.configCmd),
19
- "pre-commit": () => import("./pre-commit-ICTZBF6F.js").then((module) => module.default)
14
+ bootstrap: () => import("./bootstrap-PMIA4W6G.js").then((module) => module.default),
15
+ init: () => import("./init-G6Q3OOMC.js").then((module) => module.default),
16
+ scan: () => import("./scan-6CURGC3D.js").then((module) => module.default),
17
+ serve: () => import("./serve-4J2CQY25.js").then((module) => module.default),
18
+ "sync-meta": () => import("./sync-meta-L6M4AEUT.js").then((module) => module.default),
19
+ "human-lint": () => import("./human-lint-YSFOZHZ7.js").then((module) => module.default),
20
+ "ledger-append": () => import("./ledger-append-XZ5SX4O5.js").then((module) => module.default),
21
+ hooks: () => import("./hooks-5S5IRVQE.js").then((module) => module.default),
22
+ config: () => import("./config-PXEEXWLM.js").then((module) => module.configCmd),
23
+ "pre-commit": () => import("./pre-commit-IEIXHKOD.js").then((module) => module.default)
20
24
  };
21
25
 
22
26
  // src/index.ts
23
27
  var main = defineCommand({
24
28
  meta: {
25
29
  name: "fab",
26
- version: "0.0.0",
27
- description: "Fabric CLI"
30
+ version: "1.0.0",
31
+ description: t("cli.main.description")
28
32
  },
29
33
  subCommands: allCommands
30
34
  });