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