@fenglimg/fabric-cli 1.8.0-rc.3 → 2.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 (46) hide show
  1. package/README.md +6 -6
  2. package/dist/chunk-6ICJICVU.js +10 -0
  3. package/dist/chunk-74SZWYPH.js +658 -0
  4. package/dist/chunk-EYIDD2YS.js +1000 -0
  5. package/dist/{chunk-QPCRBQ5Y.js → chunk-OBQU6NHO.js} +1 -52
  6. package/dist/chunk-WWNXR34K.js +49 -0
  7. package/dist/doctor-T7JWODKG.js +282 -0
  8. package/dist/hooks-Y74Y5LQS.js +12 -0
  9. package/dist/index.js +7 -5
  10. package/dist/{init-7EYGUJNJ.js → init-BIRSIOXO.js} +312 -1022
  11. package/dist/plan-context-hint-QMUPAXIB.js +98 -0
  12. package/dist/scan-LMK3UCWL.js +22 -0
  13. package/dist/{serve-466QXQ5Q.js → serve-H554BHLG.js} +8 -4
  14. package/package.json +3 -3
  15. package/templates/agents-md/AGENTS.md.template +55 -17
  16. package/templates/bootstrap/CLAUDE.md +1 -1
  17. package/templates/bootstrap/codex-AGENTS-header.md +1 -1
  18. package/templates/bootstrap/cursor-fabric-bootstrap.mdc +1 -1
  19. package/templates/hooks/configs/README.md +73 -0
  20. package/templates/hooks/configs/claude-code.json +37 -0
  21. package/templates/hooks/configs/codex-hooks.json +20 -0
  22. package/templates/hooks/configs/cursor-hooks.json +20 -0
  23. package/templates/hooks/fabric-hint.cjs +1307 -0
  24. package/templates/hooks/knowledge-hint-broad.cjs +464 -0
  25. package/templates/hooks/knowledge-hint-narrow.cjs +826 -0
  26. package/templates/hooks/lib/session-digest-writer.cjs +172 -0
  27. package/templates/skills/fabric-archive/SKILL.md +486 -0
  28. package/templates/skills/fabric-import/SKILL.md +588 -0
  29. package/templates/skills/fabric-review/SKILL.md +382 -0
  30. package/dist/chunk-NMMUETVK.js +0 -216
  31. package/dist/doctor-F52XWWZC.js +0 -98
  32. package/dist/scan-NNBNGIZG.js +0 -12
  33. package/templates/agents-md/variants/cocos.md +0 -20
  34. package/templates/agents-md/variants/next.md +0 -20
  35. package/templates/agents-md/variants/vite.md +0 -20
  36. package/templates/bootstrap/GEMINI.md +0 -8
  37. package/templates/bootstrap/roo-fabric.md +0 -5
  38. package/templates/bootstrap/windsurf-fabric.md +0 -5
  39. package/templates/claude-hooks/fabric-init-reminder.cjs +0 -18
  40. package/templates/claude-skills/fabric-init/SKILL.md +0 -163
  41. package/templates/codex-hooks/fabric-session-start.cjs +0 -19
  42. package/templates/codex-hooks/fabric-stop-reminder.cjs +0 -18
  43. package/templates/codex-skills/fabric-init/SKILL.md +0 -162
  44. package/templates/husky/pre-commit +0 -9
  45. package/templates/skill-source/fabric-init/SOURCE.md +0 -157
  46. package/templates/skill-source/fabric-init/clients.json +0 -17
@@ -1,157 +0,0 @@
1
- # fabric-init — Canonical Skill Source
2
-
3
- > This file is the single source of truth for the fabric-init skill.
4
- > Do NOT edit the per-client SKILL.md files directly.
5
- > Run `packages/cli/scripts/derive-skills.ts` to regenerate them from this source.
6
-
7
- ## Precondition
8
-
9
- MUST: Read `.fabric/forensic.json` before taking any other action. If the file does not
10
- exist, stop immediately and tell the user: run `fab init` first to generate the evidence
11
- package.
12
-
13
- MUST: Check `.fabric/init-context.json`. If it already exists, stop and report that this
14
- repository appears to have completed initialization already.
15
-
16
- MUST: Treat `.fabric/bootstrap/README.md` as the authoritative initialization guide for
17
- the current repository.
18
-
19
- MUST: Use `.fabric/forensic.json` and repository structure as evidence when deciding what
20
- to do next.
21
-
22
- MUST: Preserve protected tokens exactly as written — see the Protected Tokens section.
23
-
24
- NEVER: Claim initialization is complete without having checked `.fabric/init-context.json`.
25
-
26
- NEVER: Rewrite or translate protected tokens.
27
-
28
- NEVER: Ignore `.fabric/bootstrap/README.md` when determining the next initialization step.
29
-
30
- Treat the following state as initialization pending:
31
-
32
- - `.fabric/forensic.json` exists
33
- - `.fabric/init-context.json` does not exist
34
-
35
- ## Execution Flow — 3 Phases / 3 Rounds
36
-
37
- ### Phase 1 — Framework Confirmation (1 round, efficient)
38
-
39
- Display a summary of `framework`, `topology.by_ext`, and `entry_points` from
40
- `.fabric/forensic.json`. Ask the user 1–2 clarifying questions about the framework
41
- architecture.
42
-
43
- Example (Cocos Creator 3.x):
44
-
45
- > I detected a Cocos Creator 3.8 project. Main scripts are in `assets/scripts` using the
46
- > `@ccclass + extends Component` pattern. Please confirm: (1) Is this a TypeScript project
47
- > (not JavaScript)? (2) Are node references injected mainly via `@property(Node)`, or via
48
- > `find/getChildByName`?
49
-
50
- Store the user's answers as verified framework assumptions before proceeding to Phase 2.
51
-
52
- ### Phase 2 — Invariant Extraction (1 round, critical)
53
-
54
- Based on the `recommendations_for_skill` list in `.fabric/forensic.json`, ask the user
55
- 3–5 invariant questions covering three categories:
56
-
57
- - `ban`: things that must never appear — e.g. `any`, `async` in `update()`, find-by-name
58
- - `require`: things that must always be present — e.g. strict TypeScript, `@ccclass`
59
- decorator, imports only from `cc`
60
- - `protect`: directories or files that AI must not modify — typically
61
- `assets/prefabs/**`, `assets/scenes/**`, `**/*.meta`
62
-
63
- Principles:
64
-
65
- - Ask only about invariants, not about preferences.
66
- - Each question accepts only yes / no / a concrete rule — never accept vague answers.
67
- - Do not auto-infer hard constraints the user has not confirmed.
68
-
69
- ### Phase 3 — Construction and Landing (1 round, automated)
70
-
71
- #### 3.1 Write `.fabric/init-context.json`
72
-
73
- Fields required:
74
-
75
- - `framework`
76
- - `architecture_patterns`
77
- - `invariants`
78
- - `domain_groups`
79
- - `interview_trail`
80
- - `forensic_ref`
81
-
82
- Writing rules:
83
-
84
- - `invariants[].type` MUST be one of `ban`, `require`, `protect`.
85
- - `domain_groups` is inferred from `entry_points` and interview results.
86
- - `interview_trail[]` MUST record the raw Q&A from Phase 1 and Phase 2.
87
- - `forensic_ref` MUST be `.fabric/forensic.json`.
88
-
89
- #### 3.2 Generate layered `AGENTS.md`
90
-
91
- Root `AGENTS.md` requirements:
92
-
93
- - MUST be within 300 lines.
94
- - Structure:
95
- - `# {projectName} — L0 AGENTS.md`
96
- - `<!-- fab:index -->`: populated with the `domain_groups` index
97
- - `## L0 AI Constraints`: derived from invariants, grouped by `ban`, `require`, `protect`
98
- - `## @HUMAN`: protect paths and any human-declared protection rules
99
- - `## L1 Candidate Notes`: candidate sub-module descriptions for each domain group
100
-
101
- If `domain_groups.length >= 2`, generate a `{group_path}/AGENTS.md` for each group.
102
- Maximum depth is L3; total nesting MUST NOT exceed 4 levels.
103
-
104
- #### 3.3 Update `.fabric/agents.meta.json`
105
-
106
- - The `nodes` tree MUST match the generated AGENTS hierarchy.
107
- - Update the hash of every AGENTS.md file that was written.
108
- - Maintain a consistent internal revision hash chain.
109
-
110
- #### 3.4 Final output
111
-
112
- List all generated files for the user and recommend running `fabric doctor --fix` for
113
- ongoing maintenance.
114
-
115
- ## Hard Rules
116
-
117
- - Zero TODO: never generate `TODO`, `TBD`, placeholders, or stubs in output files.
118
- - No YAML frontmatter in outputs: generated `AGENTS.md` files MUST NOT contain YAML
119
- frontmatter.
120
- - Root `AGENTS.md` MUST be <= 300 lines.
121
- - Total AGENTS nesting MUST be <= 4 levels.
122
- - Do not auto-infer invariants the user has not confirmed.
123
- - When content is uncertain, omit it — do not leave placeholders.
124
-
125
- ## Output Contract
126
-
127
- On successful completion the following files exist or are updated:
128
-
129
- | File | Action |
130
- |------|--------|
131
- | `.fabric/init-context.json` | Created with all required fields |
132
- | `AGENTS.md` | Created (root L0) |
133
- | `{group_path}/AGENTS.md` | Created for each domain group (when applicable) |
134
- | `.fabric/agents.meta.json` | Updated nodes tree + hashes |
135
-
136
- On failure or early termination the skill MUST leave no partial files. If a write fails
137
- mid-sequence, report the failure and the exact file that was not written.
138
-
139
- ## Protected Tokens
140
-
141
- The following tokens MUST be preserved exactly as shown — same casing, same punctuation,
142
- never translated:
143
-
144
- | Token | Type |
145
- |-------|------|
146
- | `AGENTS.md` | Filename |
147
- | `FABRIC.md` | Filename |
148
- | `.fabric/agents.meta.json` | Path |
149
- | `.fabric/init-context.json` | Path |
150
- | `.fabric/forensic.json` | Path |
151
- | `.fabric/bootstrap/README.md` | Path |
152
- | `MUST` | Keyword |
153
- | `NEVER` | Keyword |
154
- | `fab init` | CLI command |
155
- | `fabric doctor --fix` | CLI command |
156
- | `<!-- fab:index -->` | HTML comment marker |
157
- | `@HUMAN` | Section marker |
@@ -1,17 +0,0 @@
1
- {
2
- "claude": {
3
- "outputName": "fabric-init",
4
- "frontmatter": {
5
- "name": "fabric-init",
6
- "description": "Use this skill when fab init just completed, when forensic.json was generated, or when the user is asking to initialize AGENTS.md. This skill runs a 3-phase initialization interview, writes .fabric/init-context.json, generates layered AGENTS.md, and updates .fabric/agents.meta.json.",
7
- "allowed-tools": ["Read", "Write", "Glob", "Grep", "Bash"]
8
- }
9
- },
10
- "codex": {
11
- "outputName": "fabric-init",
12
- "frontmatter": {
13
- "name": "fabric-init",
14
- "description": "Use this skill when .fabric/forensic.json exists and this repository still needs the remaining Fabric initialization steps."
15
- }
16
- }
17
- }