the-frame-ai 0.12.0 → 0.13.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.
- package/package.json +1 -1
- package/templates/commands/frame:init.md +105 -26
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# /frame:init -- Project Initialization
|
|
1
|
+
# /frame:init -- Project Initialization & Refresh
|
|
2
2
|
|
|
3
3
|
> **This is a slash command** — run it inside Claude Code after `npx the-frame init` has already installed the framework.
|
|
4
4
|
> It scans your codebase and fills MAP.md, CLAUDE.md, and CONTEXT.md.
|
|
@@ -6,9 +6,48 @@
|
|
|
6
6
|
|
|
7
7
|
Scans the project and fills MAP.md, CLAUDE.md, and CONTEXT.md with a complete project map.
|
|
8
8
|
|
|
9
|
+
**Re-runnable.** Run it again any time the project grows — new stack, new modules, new
|
|
10
|
+
dependencies. On a second run it works in **REFRESH mode**: it updates the auto-generated
|
|
11
|
+
sections and leaves your hand-written content untouched (see Step 0).
|
|
12
|
+
|
|
9
13
|
## Instructions
|
|
10
14
|
|
|
11
|
-
### Step 0:
|
|
15
|
+
### Step 0: Detect run mode (FIRST RUN vs REFRESH)
|
|
16
|
+
|
|
17
|
+
Check whether the project has already been mapped:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
grep -l "filled by /frame:init\|to be filled after /frame:init" \
|
|
21
|
+
.planning/MAP.md CLAUDE.md .planning/CONTEXT.md 2>/dev/null
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
- **Placeholders still present** → **FIRST RUN**. Fill everything (Steps 6–10 as written).
|
|
25
|
+
- **No placeholders** (files already have real content) → **REFRESH**. Follow the
|
|
26
|
+
**Refresh rules** below. Announce: "Project already mapped — running in REFRESH mode."
|
|
27
|
+
|
|
28
|
+
#### Refresh rules (apply only in REFRESH mode)
|
|
29
|
+
|
|
30
|
+
Sections are split into two groups. Never cross the line.
|
|
31
|
+
|
|
32
|
+
| File | Auto-owned (regenerate) | User-owned (NEVER overwrite) |
|
|
33
|
+
|------|-------------------------|------------------------------|
|
|
34
|
+
| `CLAUDE.md` | Tech Stack, Architecture, Key Patterns | Code Conventions, Rules, Anti-Patterns, FRAME Framework |
|
|
35
|
+
| `MAP.md` | Quick Facts, Architecture Pattern, Entry Points, Key Layers, Data Flow, Key Patterns, File Inventory | Tech Debt / Notes (append only — keep existing lines) |
|
|
36
|
+
| `CONTEXT.md` | `## Technical Context` section only | everything else |
|
|
37
|
+
| `STATE.md` | — | **DO NOT touch Phase/Status.** Only append a refresh note (Step 9). |
|
|
38
|
+
| `memory/conventions.md` | — | merge/append only (Step 10) |
|
|
39
|
+
| `memory/dependencies.md` | — | merge/append only (Step 10) |
|
|
40
|
+
|
|
41
|
+
Before overwriting any auto-owned section, **back up the files once**:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
mkdir -p .planning/.backup && cp CLAUDE.md .planning/MAP.md .planning/CONTEXT.md .planning/.backup/ 2>/dev/null
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
When you rewrite an auto-owned section, replace ONLY that section (match on its `##` heading,
|
|
48
|
+
stop at the next `##`). Do not reflow or reword neighbouring user-owned sections.
|
|
49
|
+
|
|
50
|
+
### Step 1: Auto-detect Stack
|
|
12
51
|
|
|
13
52
|
Identify the project type by checking for these files:
|
|
14
53
|
- `package.json` → Node.js/JS/TS (check framework: Next.js, Express, NestJS, Vue, Svelte, React)
|
|
@@ -23,7 +62,7 @@ Run: `ls -la` and `cat README.md 2>/dev/null | head -30`
|
|
|
23
62
|
|
|
24
63
|
Record: **stack**, **language**, **framework**, **project type** (web/api/cli/library/mobile).
|
|
25
64
|
|
|
26
|
-
### Step
|
|
65
|
+
### Step 2: Surface Scan
|
|
27
66
|
|
|
28
67
|
Read the project config files (those that exist):
|
|
29
68
|
- `package.json` / `go.mod` / `Cargo.toml` / `pyproject.toml` — dependencies, versions
|
|
@@ -32,7 +71,7 @@ Read the project config files (those that exist):
|
|
|
32
71
|
- `Dockerfile` / `docker-compose.yml` — deployment
|
|
33
72
|
- `README.md` — project description
|
|
34
73
|
|
|
35
|
-
### Step
|
|
74
|
+
### Step 3: Structure Scan
|
|
36
75
|
|
|
37
76
|
Adapt commands to the detected stack:
|
|
38
77
|
|
|
@@ -64,7 +103,7 @@ find . -type d -not -path "*/node_modules/*" -not -path "*/.git/*" \
|
|
|
64
103
|
-not -path "*/target/*" -not -path "*/__pycache__/*" | head -40
|
|
65
104
|
```
|
|
66
105
|
|
|
67
|
-
### Step
|
|
106
|
+
### Step 4: Patterns Scan
|
|
68
107
|
|
|
69
108
|
Look for patterns relevant to the detected stack:
|
|
70
109
|
|
|
@@ -93,7 +132,7 @@ find . -name "*_test.*" -o -name "*.test.*" -o -name "*.spec.*" \
|
|
|
93
132
|
| grep -v node_modules | head -15
|
|
94
133
|
```
|
|
95
134
|
|
|
96
|
-
### Step
|
|
135
|
+
### Step 5: Dependencies & Dynamics Scan
|
|
97
136
|
|
|
98
137
|
Determine inter-module dependencies:
|
|
99
138
|
|
|
@@ -105,8 +144,6 @@ grep -r "^import\|^from\|^require\|^use " . \
|
|
|
105
144
|
|
|
106
145
|
Check for: database, cache, queues, external APIs.
|
|
107
146
|
|
|
108
|
-
### Step 5: Dynamics Scan
|
|
109
|
-
|
|
110
147
|
Determine data flow and async patterns:
|
|
111
148
|
|
|
112
149
|
```
|
|
@@ -115,9 +152,11 @@ grep -r "async\|await\|goroutine\|channel\|Promise\|Observable\|WebSocket\|Event
|
|
|
115
152
|
-l 2>/dev/null | head -10
|
|
116
153
|
```
|
|
117
154
|
|
|
118
|
-
### Step 6: Fill MAP.md
|
|
155
|
+
### Step 6: Fill / refresh MAP.md
|
|
119
156
|
|
|
120
|
-
Write results to `.planning/MAP.md
|
|
157
|
+
Write results to `.planning/MAP.md`. In REFRESH mode regenerate only the auto-owned
|
|
158
|
+
sections (see Step 0) and **keep every existing line under `## Tech Debt / Notes`** —
|
|
159
|
+
append new findings below them, don't replace.
|
|
121
160
|
|
|
122
161
|
```markdown
|
|
123
162
|
# Project Map -- {Project Name}
|
|
@@ -159,46 +198,58 @@ Write results to `.planning/MAP.md`:
|
|
|
159
198
|
|
|
160
199
|
### Step 7: Update CLAUDE.md
|
|
161
200
|
|
|
162
|
-
Fill
|
|
201
|
+
Fill / refresh **only** these three sections — this is the main file Claude reads on every run:
|
|
163
202
|
|
|
164
|
-
- **Tech Stack** — specific stack from
|
|
165
|
-
- **Architecture** — brief description from
|
|
203
|
+
- **Tech Stack** — specific stack from Step 1
|
|
204
|
+
- **Architecture** — brief description from Step 6
|
|
166
205
|
- **Key Patterns** — 3-5 patterns from the code
|
|
167
206
|
|
|
207
|
+
In REFRESH mode, **do not touch** `Code Conventions`, `Rules`, `Anti-Patterns`, or
|
|
208
|
+
`FRAME Framework` — the user may have customised them.
|
|
209
|
+
|
|
168
210
|
### Step 8: Update CONTEXT.md
|
|
169
211
|
|
|
170
|
-
Fill
|
|
212
|
+
Fill / refresh the `## Technical Context` section in `.planning/CONTEXT.md`:
|
|
171
213
|
- Project type and stack
|
|
172
214
|
- Main entry points
|
|
173
215
|
- Key dependencies
|
|
174
216
|
|
|
217
|
+
Leave all other sections of CONTEXT.md untouched.
|
|
218
|
+
|
|
175
219
|
### Step 9: Update STATE.md
|
|
176
220
|
|
|
177
|
-
|
|
178
|
-
```markdown
|
|
179
|
-
## Current Position
|
|
180
|
-
- Phase: SETUP
|
|
181
|
-
- Status: MAP.md filled, project ready to work
|
|
182
|
-
```
|
|
221
|
+
- **FIRST RUN** — set the starting position:
|
|
222
|
+
```markdown
|
|
223
|
+
## Current Position
|
|
224
|
+
- Phase: SETUP
|
|
225
|
+
- Status: MAP.md filled, project ready to work
|
|
226
|
+
```
|
|
227
|
+
- **REFRESH** — **do not change Phase or Status** (the user may be mid-feature).
|
|
228
|
+
Only append one line to the activity/log section:
|
|
229
|
+
```markdown
|
|
230
|
+
- {date}: project map refreshed via /frame:init
|
|
231
|
+
```
|
|
183
232
|
|
|
184
|
-
### Step 10: Fill memory from scan results
|
|
233
|
+
### Step 10: Fill / merge memory from scan results
|
|
185
234
|
|
|
186
|
-
Using data already gathered in
|
|
235
|
+
Using data already gathered in Steps 2-5, update two memory files. **Merge, never
|
|
236
|
+
overwrite** — read the existing file first, keep all current lines, add only what's new.
|
|
187
237
|
|
|
188
|
-
**`.planning/memory/conventions.md`** — add
|
|
238
|
+
**`.planning/memory/conventions.md`** — add/confirm:
|
|
189
239
|
- File naming pattern (kebab-case, camelCase, etc.)
|
|
190
240
|
- Import style (named vs default, path aliases)
|
|
191
241
|
- Git commit format (if `.gitmessage` or recent commits reveal a pattern)
|
|
192
242
|
|
|
193
|
-
**`.planning/memory/dependencies.md`** — add:
|
|
243
|
+
**`.planning/memory/dependencies.md`** — add/confirm:
|
|
194
244
|
- Core dependencies (from package.json / go.mod / etc.)
|
|
195
245
|
- Dev tools (test runner, linter, bundler)
|
|
196
246
|
- Any "avoid" patterns spotted (e.g., deprecated packages)
|
|
197
247
|
|
|
198
|
-
Only
|
|
248
|
+
Only add what was actually found — no placeholders. If a line is already present, leave it.
|
|
199
249
|
|
|
200
250
|
### Step 11: Output completion checklist
|
|
201
251
|
|
|
252
|
+
**FIRST RUN:**
|
|
202
253
|
```
|
|
203
254
|
╔══════════════════════════════════════════╗
|
|
204
255
|
║ FRAME INIT — Complete ║
|
|
@@ -221,11 +272,39 @@ Only fill what was actually found — no placeholders.
|
|
|
221
272
|
╚══════════════════════════════════════════╝
|
|
222
273
|
```
|
|
223
274
|
|
|
275
|
+
**REFRESH** — print a changelog of what actually changed, so the user can eyeball it:
|
|
276
|
+
```
|
|
277
|
+
╔══════════════════════════════════════════╗
|
|
278
|
+
║ FRAME INIT — Refresh complete ║
|
|
279
|
+
╠══════════════════════════════════════════╣
|
|
280
|
+
║ Changes detected since last scan: ║
|
|
281
|
+
║ • Stack: {what changed, or "—"} ║
|
|
282
|
+
║ • Deps: {added / removed, or "—"}║
|
|
283
|
+
║ • Structure: {new modules, or "—"} ║
|
|
284
|
+
║ • Patterns: {new patterns, or "—"} ║
|
|
285
|
+
╠══════════════════════════════════════════╣
|
|
286
|
+
║ Updated (auto sections only): ║
|
|
287
|
+
║ ✓ MAP.md ✓ CLAUDE.md ✓ CONTEXT.md ║
|
|
288
|
+
║ Preserved: your Conventions / Rules / ║
|
|
289
|
+
║ Anti-Patterns / STATE phase / notes. ║
|
|
290
|
+
║ Backup: .planning/.backup/ ║
|
|
291
|
+
╚══════════════════════════════════════════╝
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
If nothing meaningful changed, say so plainly: "No significant changes since the last scan."
|
|
295
|
+
|
|
224
296
|
## Result
|
|
225
297
|
|
|
226
298
|
- `.planning/MAP.md` — complete project map
|
|
227
299
|
- `CLAUDE.md` — stack and architecture sections filled
|
|
228
300
|
- `.planning/CONTEXT.md` — technical context filled
|
|
229
|
-
- `.planning/STATE.md` — status updated
|
|
301
|
+
- `.planning/STATE.md` — status updated (FIRST RUN only)
|
|
230
302
|
- `.planning/memory/conventions.md` — conventions from scan
|
|
231
303
|
- `.planning/memory/dependencies.md` — dependencies from scan
|
|
304
|
+
|
|
305
|
+
## Rules
|
|
306
|
+
|
|
307
|
+
- Re-runnable: REFRESH mode never overwrites user-authored sections or resets STATE phase.
|
|
308
|
+
- Back up auto-owned files to `.planning/.backup/` before rewriting them on refresh.
|
|
309
|
+
- When refreshing a section, replace only that `##` block — leave neighbours byte-for-byte intact.
|
|
310
|
+
- Only write what was actually found in the scan — no placeholders, no invented content.
|