@fenglimg/fabric-cli 1.0.0 → 1.2.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.
@@ -1,18 +1,17 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- resolveDevModeTarget
4
- } from "./chunk-AEOYCVBG.js";
5
2
  import {
6
3
  sync_meta_default
7
- } from "./chunk-5BSTO745.js";
8
- import "./chunk-P4KVFB2T.js";
4
+ } from "./chunk-6UUPKSDE.js";
9
5
  import {
10
6
  human_lint_default
11
7
  } from "./chunk-L43IGJ6X.js";
12
- import "./chunk-WWNXR34K.js";
13
8
  import {
14
9
  ledger_append_default
15
10
  } from "./chunk-F2BXHPM5.js";
11
+ import "./chunk-WWNXR34K.js";
12
+ import {
13
+ resolveDevModeTarget
14
+ } from "./chunk-AEOYCVBG.js";
16
15
  import {
17
16
  t
18
17
  } from "./chunk-6ICJICVU.js";
@@ -3,10 +3,9 @@ import {
3
3
  createScanReport,
4
4
  scanCommand,
5
5
  scan_default
6
- } from "./chunk-DKQ3HOTK.js";
7
- import "./chunk-AEOYCVBG.js";
8
- import "./chunk-P4KVFB2T.js";
6
+ } from "./chunk-N4DCTOXW.js";
9
7
  import "./chunk-WWNXR34K.js";
8
+ import "./chunk-AEOYCVBG.js";
10
9
  import "./chunk-6ICJICVU.js";
11
10
  export {
12
11
  createScanReport,
@@ -1,13 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  computeAgentsMeta,
4
+ deriveLayer,
5
+ deriveTopologyType,
4
6
  syncMetaCommand,
5
7
  sync_meta_default
6
- } from "./chunk-5BSTO745.js";
7
- import "./chunk-P4KVFB2T.js";
8
+ } from "./chunk-6UUPKSDE.js";
8
9
  import "./chunk-6ICJICVU.js";
9
10
  export {
10
11
  computeAgentsMeta,
11
12
  sync_meta_default as default,
13
+ deriveLayer,
14
+ deriveTopologyType,
12
15
  syncMetaCommand
13
16
  };
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@fenglimg/fabric-cli",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "type": "module",
5
5
  "bin": {
6
- "fab": "dist/index.js"
6
+ "fab": "dist/index.js",
7
+ "fabric": "dist/index.js"
7
8
  },
8
9
  "main": "./dist/index.js",
9
10
  "types": "./dist/index.d.ts",
@@ -16,8 +17,8 @@
16
17
  "citty": "^0.2.2",
17
18
  "picocolors": "^1.1.1",
18
19
  "string-width": "^7.2.0",
19
- "@fenglimg/fabric-shared": "1.0.0",
20
- "@fenglimg/fabric-server": "1.0.0"
20
+ "@fenglimg/fabric-shared": "1.2.0",
21
+ "@fenglimg/fabric-server": "1.2.0"
21
22
  },
22
23
  "devDependencies": {
23
24
  "@types/iarna__toml": "^2.0.5",
@@ -1,35 +1,20 @@
1
- # { projectName } — L0 AGENTS.md
2
-
3
- <!-- This is the fallback template. If you have Claude Code, run the agents-md-init skill for a semantically richer AGENTS.md. -->
4
-
5
- This file is the non-AI fallback scaffold for repositories that have not gone through semantic AGENTS initialization yet.
6
-
7
- <!-- fab:index -->
8
- <!-- /fab:index -->
9
-
10
- ## Human Documentation References
11
-
12
- - `README.md` is the source of truth for setup, scripts, runtime expectations, and product behavior.
13
- - `CONTRIBUTING.md`, if present, overrides local assumptions for branching, review, and release workflow.
14
- - When documentation and code disagree, pause and ask a human before rewriting either source.
15
-
16
- ## L0 AI Constraints
17
-
18
- - Keep changes small, reversible, and validated with the narrowest relevant command before broader builds.
19
- - Match existing repository patterns before introducing new abstractions, tooling, or file structure.
20
- - Avoid modifying secrets, deployment configuration, lockfiles, or generated artifacts unless the task explicitly requires it.
21
-
22
- ## Framework Baseline
23
-
24
- - Fabric did not match this repository to a first-class scaffold. Detected framework kind: `{ frameworkKind }`.
25
- - Treat the current source tree and existing docs as the primary evidence before writing new rules.
26
- - Add L1 AGENTS.md files only for directories that have clearly different runtime, build, or safety constraints.
27
-
28
- ## @HUMAN
29
-
30
- - Human-owned decisions belong in this section or `.fabric/human-lock.json`; AI must pause before changing them.
31
- - Record release gates, product invariants, or directories that need explicit approval here.
32
-
33
- ## L1 Candidate Notes
34
-
35
- - Promote a directory to L1 only when it has its own commands, deployment surface, or irreversible side effects.
1
+ # { projectName } — Fabric Bootstrap Protocol
2
+
3
+ ## CORE RULES (DO NOT TRANSLATE)
4
+
5
+ MUST: Treat this file as the Fabric Protocol bootstrap for this repository.
6
+ MUST: Treat `.fabric/agents/` as the authoritative home for all AI shadow constraints.
7
+ MUST: Before ANY code reading, architecture planning, or logic modification, call `fab_get_rules(path=<target file>)`.
8
+ MUST: When creating or changing an L1/L2 rule node, keep `.fabric/agents.meta.json` synchronized through Fabric tooling.
9
+ MUST: Preserve protected tokens exactly: `AGENTS.md`, `.fabric/agents/`, `.fabric/agents.meta.json`, `fab_get_rules`, `shadow constraints`, `Shadow Mirroring`, `MUST`, `NEVER`.
10
+ NEVER: Add import-style directive lines to this bootstrap file.
11
+ NEVER: Put framework, domain, repository rule bodies, or submodule rules in this file.
12
+ NEVER: Create colocated `AGENTS.md` rule files under source directories.
13
+
14
+ ## 使用说明 / Explanation
15
+
16
+ - 本文件只负责启动 Fabric Bootstrap Protocol,不承载项目业务规则。
17
+ - Detected framework kind: `{ frameworkKind }`.
18
+ - This repository uses `Shadow Mirroring`: source directories contain ZERO rule files, while `.fabric/agents/` mirrors source paths for AI constraints.
19
+ - 根级规则应放在 `.fabric/agents/root.md`;跨领域规则应放在 `.fabric/agents/_cross/`。
20
+ - If `.fabric/agents/root.md` is missing, stop normal coding and run the initialization flow that creates shadow constraints.
@@ -1,37 +1,20 @@
1
- # { projectName } — L0 AGENTS.md
2
-
3
- <!-- This is the fallback template. If you have Claude Code, run the agents-md-init skill for a semantically richer AGENTS.md. -->
4
-
5
- This file is the non-AI fallback scaffold for a Cocos Creator codebase. Prefer conservative edits and preserve editor-generated assets.
6
-
7
- <!-- fab:index -->
8
- <!-- /fab:index -->
9
-
10
- ## Human Documentation References
11
-
12
- - `README.md` is the source of truth for gameplay intent, scene flow, setup, and packaging steps.
13
- - Cocos Editor settings, prefab wiring, and scene structure are human-reviewed surfaces; ask before broad refactors.
14
- - When code and editor data disagree, inspect both before changing either side.
15
-
16
- ## L0 AI Constraints
17
-
18
- - Component scripts must follow the existing Cocos pattern: import from `cc`, destructure decorators from `_decorator`, apply `@ccclass`, and extend `Component`.
19
- - Respect Cocos lifecycle order. Put initialization in `onLoad` or `start`, cleanup in `onDestroy`, and keep `update` lightweight and frame-safe.
20
- - Do not mark `update()` as `async` and do not introduce blocking or network-heavy work into frame callbacks.
21
- - Preserve `.meta` files, prefab references, scene bindings, and asset UUID relationships unless the task explicitly requires coordinated editor changes.
22
- - Prefer targeted script edits over renaming assets, moving prefab trees, or restructuring `assets/` folders.
23
-
24
- ## Cocos Baseline
25
-
26
- - Keep gameplay logic inside component boundaries or small helpers that are already imported by components.
27
- - When adding new nodes or serialized fields, match the repository's existing decorator and property style.
28
- - Validate with the smallest relevant TypeScript or project command first; only ask for editor-side verification when asset wiring changes.
29
-
30
- ## @HUMAN
31
-
32
- - Human-owned decisions belong in this section or `.fabric/human-lock.json`; AI must pause before changing them.
33
- - Record protected scenes, prefabs, release assets, or multiplayer protocol invariants here.
34
-
35
- ## L1 Candidate Notes
36
-
37
- - Add scoped AGENTS.md files only for large subtrees such as `assets/scripts`, `assets/prefabs`, or `assets/scenes` when they gain distinct local rules.
1
+ # { projectName } — Fabric Bootstrap Protocol
2
+
3
+ ## CORE RULES (DO NOT TRANSLATE)
4
+
5
+ MUST: Treat this file as the Fabric Protocol bootstrap for this repository.
6
+ MUST: Treat `.fabric/agents/` as the authoritative home for all AI shadow constraints.
7
+ MUST: Before ANY code reading, architecture planning, or logic modification, call `fab_get_rules(path=<target file>)`.
8
+ MUST: When creating or changing an L1/L2 rule node, keep `.fabric/agents.meta.json` synchronized through Fabric tooling.
9
+ MUST: Preserve protected tokens exactly: `AGENTS.md`, `.fabric/agents/`, `.fabric/agents.meta.json`, `fab_get_rules`, `shadow constraints`, `Shadow Mirroring`, `MUST`, `NEVER`.
10
+ NEVER: Add import-style directive lines to this bootstrap file.
11
+ NEVER: Put Cocos, asset, prefab, scene, repository rule bodies, or submodule rules in this file.
12
+ NEVER: Create colocated `AGENTS.md` rule files under source directories.
13
+
14
+ ## 使用说明 / Explanation
15
+
16
+ - 本文件只负责启动 Fabric Bootstrap Protocol,不承载 Cocos 业务或编辑器规则。
17
+ - Detected framework kind: `cocos-creator`.
18
+ - This repository uses `Shadow Mirroring`: source directories contain ZERO rule files, while `.fabric/agents/` mirrors source paths for AI constraints.
19
+ - 根级规则应放在 `.fabric/agents/root.md`;跨领域规则应放在 `.fabric/agents/_cross/`。
20
+ - If `.fabric/agents/root.md` is missing, stop normal coding and run the initialization flow that creates shadow constraints.
@@ -1,37 +1,20 @@
1
- # { projectName } — L0 AGENTS.md
2
-
3
- <!-- This is the fallback template. If you have Claude Code, run the agents-md-init skill for a semantically richer AGENTS.md. -->
4
-
5
- This file is the non-AI fallback scaffold for a Next.js application using the App Router by default.
6
-
7
- <!-- fab:index -->
8
- <!-- /fab:index -->
9
-
10
- ## Human Documentation References
11
-
12
- - `README.md` is the source of truth for product flows, local setup, and deployment expectations.
13
- - Operational behavior for routes, caching, auth, or background jobs should be verified against code and docs together before refactoring.
14
- - If `CONTRIBUTING.md` exists, follow its review and release gates over local assumptions.
15
-
16
- ## L0 AI Constraints
17
-
18
- - Treat `app/` as App Router unless the repository clearly uses another convention.
19
- - Keep React Server Components on the server side by default. Add `"use client"` only for components that need browser APIs, local state, effects, or event handlers.
20
- - Do not import server-only modules into client components, and do not access browser-only globals from server components or route handlers.
21
- - Keep data fetching, cache behavior, and mutations aligned with existing route, server action, and API handler patterns.
22
- - Prefer small route-local changes over broad restructuring of layouts, middleware, or caching policy.
23
-
24
- ## Next Baseline
25
-
26
- - Preserve the server/client boundary at file level so the bundle stays predictable and hydration issues stay local.
27
- - Reuse existing patterns for route handlers, metadata, and loading or error states before creating new abstractions.
28
- - Validate the narrowest route or package command first, then run the broader build once local behavior is stable.
29
-
30
- ## @HUMAN
31
-
32
- - Human-owned decisions belong in this section or `.fabric/human-lock.json`; AI must pause before changing them.
33
- - Record protected routes, auth assumptions, cache invariants, or SEO requirements here.
34
-
35
- ## L1 Candidate Notes
36
-
37
- - Add scoped AGENTS.md files only for areas such as `app`, `components`, or `lib` when they gain strong local conventions.
1
+ # { projectName } — Fabric Bootstrap Protocol
2
+
3
+ ## CORE RULES (DO NOT TRANSLATE)
4
+
5
+ MUST: Treat this file as the Fabric Protocol bootstrap for this repository.
6
+ MUST: Treat `.fabric/agents/` as the authoritative home for all AI shadow constraints.
7
+ MUST: Before ANY code reading, architecture planning, or logic modification, call `fab_get_rules(path=<target file>)`.
8
+ MUST: When creating or changing an L1/L2 rule node, keep `.fabric/agents.meta.json` synchronized through Fabric tooling.
9
+ MUST: Preserve protected tokens exactly: `AGENTS.md`, `.fabric/agents/`, `.fabric/agents.meta.json`, `fab_get_rules`, `shadow constraints`, `Shadow Mirroring`, `MUST`, `NEVER`.
10
+ NEVER: Add import-style directive lines to this bootstrap file.
11
+ NEVER: Put Next.js, route, repository rule bodies, or submodule rules in this file.
12
+ NEVER: Create colocated `AGENTS.md` rule files under source directories.
13
+
14
+ ## 使用说明 / Explanation
15
+
16
+ - 本文件只负责启动 Fabric Bootstrap Protocol,不承载 Next.js 业务或路由规则。
17
+ - Detected framework kind: `next`.
18
+ - This repository uses `Shadow Mirroring`: source directories contain ZERO rule files, while `.fabric/agents/` mirrors source paths for AI constraints.
19
+ - 根级规则应放在 `.fabric/agents/root.md`;跨领域规则应放在 `.fabric/agents/_cross/`。
20
+ - If `.fabric/agents/root.md` is missing, stop normal coding and run the initialization flow that creates shadow constraints.
@@ -1,37 +1,20 @@
1
- # { projectName } — L0 AGENTS.md
2
-
3
- <!-- This is the fallback template. If you have Claude Code, run the agents-md-init skill for a semantically richer AGENTS.md. -->
4
-
5
- This file is the non-AI fallback scaffold for a Vite application. Treat the repository as a client-rendered app unless the code clearly establishes another pattern.
6
-
7
- <!-- fab:index -->
8
- <!-- /fab:index -->
9
-
10
- ## Human Documentation References
11
-
12
- - `README.md` is the source of truth for setup, scripts, environment variables, and deployment assumptions.
13
- - Product behavior and UX expectations should be taken from shipped screens and existing docs before introducing new architecture.
14
- - If `CONTRIBUTING.md` exists, follow its branch, review, and validation rules over local defaults.
15
-
16
- ## L0 AI Constraints
17
-
18
- - Keep browser code on the client side. Assume SSR is off unless the repository already contains an explicit server rendering path.
19
- - Preserve clear module boundaries: UI components stay presentation-focused, shared utilities stay framework-agnostic, and side effects remain close to the feature that needs them.
20
- - Match the repo's TypeScript strictness and import style; do not weaken types or introduce `any` to move faster.
21
- - Use `import.meta.env` for Vite environment access and avoid Node-only APIs in browser bundles.
22
- - Prefer incremental feature-local edits over sweeping alias, build, or routing changes.
23
-
24
- ## Vite Baseline
25
-
26
- - Keep module scope cheap; avoid eager side effects that run on import when they can live in explicit startup code.
27
- - Reuse existing state and styling patterns before adding new stores, plugin layers, or CSS systems.
28
- - Validate with the narrowest app command first, then run the broader build only after local checks pass.
29
-
30
- ## @HUMAN
31
-
32
- - Human-owned decisions belong in this section or `.fabric/human-lock.json`; AI must pause before changing them.
33
- - Record protected environment contracts, analytics events, or release-specific UI constraints here.
34
-
35
- ## L1 Candidate Notes
36
-
37
- - Add scoped AGENTS.md files only when areas such as `src/features`, `src/components`, or `src/lib` accumulate their own rules.
1
+ # { projectName } — Fabric Bootstrap Protocol
2
+
3
+ ## CORE RULES (DO NOT TRANSLATE)
4
+
5
+ MUST: Treat this file as the Fabric Protocol bootstrap for this repository.
6
+ MUST: Treat `.fabric/agents/` as the authoritative home for all AI shadow constraints.
7
+ MUST: Before ANY code reading, architecture planning, or logic modification, call `fab_get_rules(path=<target file>)`.
8
+ MUST: When creating or changing an L1/L2 rule node, keep `.fabric/agents.meta.json` synchronized through Fabric tooling.
9
+ MUST: Preserve protected tokens exactly: `AGENTS.md`, `.fabric/agents/`, `.fabric/agents.meta.json`, `fab_get_rules`, `shadow constraints`, `Shadow Mirroring`, `MUST`, `NEVER`.
10
+ NEVER: Add import-style directive lines to this bootstrap file.
11
+ NEVER: Put Vite, browser, repository rule bodies, or submodule rules in this file.
12
+ NEVER: Create colocated `AGENTS.md` rule files under source directories.
13
+
14
+ ## 使用说明 / Explanation
15
+
16
+ - 本文件只负责启动 Fabric Bootstrap Protocol,不承载 Vite 业务或浏览器规则。
17
+ - Detected framework kind: `vite`.
18
+ - This repository uses `Shadow Mirroring`: source directories contain ZERO rule files, while `.fabric/agents/` mirrors source paths for AI constraints.
19
+ - 根级规则应放在 `.fabric/agents/root.md`;跨领域规则应放在 `.fabric/agents/_cross/`。
20
+ - If `.fabric/agents/root.md` is missing, stop normal coding and run the initialization flow that creates shadow constraints.
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/scanner/ignores.ts
4
- var DEFAULT_IGNORES = [
5
- "**/*.meta",
6
- "library/**",
7
- "temp/**",
8
- "build/**",
9
- "settings/**",
10
- "profiles/**",
11
- "node_modules/**",
12
- "dist/**",
13
- ".git/**",
14
- ".fabric/**"
15
- ];
16
- function resolveIgnores(fabricConfig) {
17
- return [...DEFAULT_IGNORES, ...fabricConfig?.scanIgnores ?? []];
18
- }
19
-
20
- export {
21
- resolveIgnores
22
- };
@@ -1,124 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- t
4
- } from "./chunk-6ICJICVU.js";
5
-
6
- // src/commands/hooks.ts
7
- import { chmodSync, existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "fs";
8
- import { dirname, isAbsolute, join, parse, resolve } from "path";
9
- import { fileURLToPath } from "url";
10
- import { defineCommand } from "citty";
11
- var hooksCommand = defineCommand({
12
- meta: {
13
- name: "hooks",
14
- description: t("cli.hooks.description")
15
- },
16
- subCommands: {
17
- install: defineCommand({
18
- meta: {
19
- name: "install",
20
- description: t("cli.hooks.install.description")
21
- },
22
- args: {
23
- target: {
24
- type: "string",
25
- description: t("cli.hooks.install.args.target.description"),
26
- default: process.cwd()
27
- }
28
- },
29
- async run({ args }) {
30
- const target = normalizeTarget(args.target);
31
- assertExistingDirectory(target);
32
- const huskyDir = join(target, ".husky");
33
- const hookPath = join(huskyDir, "pre-commit");
34
- const packageJsonPath = join(target, "package.json");
35
- if (!existsSync(packageJsonPath)) {
36
- throw new Error(t("cli.hooks.errors.package-json-required", { path: packageJsonPath }));
37
- }
38
- mkdirSync(huskyDir, { recursive: true });
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
- }
56
- chmodSync(hookPath, 493);
57
- const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
58
- const scripts = packageJson.scripts && typeof packageJson.scripts === "object" && !Array.isArray(packageJson.scripts) ? packageJson.scripts : {};
59
- const hadPrepare = typeof scripts.prepare === "string" && scripts.prepare.trim().length > 0;
60
- if (!hadPrepare) {
61
- scripts.prepare = "husky install";
62
- packageJson.scripts = scripts;
63
- writeFileSync(packageJsonPath, `${JSON.stringify(packageJson, null, 2)}
64
- `, "utf8");
65
- }
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
- }
73
- if (hadPrepare) {
74
- writeStderr(t("cli.hooks.install.prepare-left", { path: packageJsonPath }));
75
- } else {
76
- writeStderr(t("cli.hooks.install.prepare-added", { path: packageJsonPath }));
77
- }
78
- }
79
- })
80
- }
81
- });
82
- var hooks_default = hooksCommand;
83
- function normalizeTarget(targetInput) {
84
- return isAbsolute(targetInput) ? targetInput : resolve(process.cwd(), targetInput);
85
- }
86
- function assertExistingDirectory(target) {
87
- if (!existsSync(target) || !statSync(target).isDirectory()) {
88
- throw new Error(t("cli.shared.target-invalid", { target }));
89
- }
90
- }
91
- function findTemplatePath(relativePath) {
92
- const currentModuleDir = dirname(fileURLToPath(import.meta.url));
93
- const candidates = [
94
- ...templateCandidatesFrom(process.cwd(), relativePath),
95
- ...templateCandidatesFrom(currentModuleDir, relativePath)
96
- ];
97
- for (const candidate of candidates) {
98
- if (existsSync(candidate)) {
99
- return candidate;
100
- }
101
- }
102
- throw new Error(t("cli.shared.template-not-found", { path: relativePath }));
103
- }
104
- function templateCandidatesFrom(start, relativePath) {
105
- const candidates = [];
106
- let current = resolve(start);
107
- while (true) {
108
- candidates.push(join(current, ...relativePath.split("/")));
109
- const parent = dirname(current);
110
- if (parent === current || parse(current).root === current) {
111
- break;
112
- }
113
- current = parent;
114
- }
115
- return candidates.reverse();
116
- }
117
- function writeStderr(message) {
118
- process.stderr.write(`${message}
119
- `);
120
- }
121
- export {
122
- hooks_default as default,
123
- hooksCommand
124
- };