@bitmagic/cli 0.1.17 → 0.1.19
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/README.md +47 -2
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/edit.d.ts +10 -0
- package/dist/commands/edit.js +142 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/upgrade.d.ts +10 -0
- package/dist/commands/upgrade.js +43 -0
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/editor/save.d.ts +57 -0
- package/dist/editor/save.js +144 -0
- package/dist/editor/save.js.map +1 -0
- package/dist/editor/server.d.ts +17 -0
- package/dist/editor/server.js +185 -0
- package/dist/editor/server.js.map +1 -0
- package/dist/editor/shell-page.d.ts +38 -0
- package/dist/editor/shell-page.js +339 -0
- package/dist/editor/shell-page.js.map +1 -0
- package/dist/project/context.d.ts +2 -0
- package/dist/project/context.js.map +1 -1
- package/dist/scaffold/agents-md.d.ts +51 -0
- package/dist/scaffold/agents-md.js +102 -0
- package/dist/scaffold/agents-md.js.map +1 -0
- package/dist/scaffold/project-files.d.ts +8 -0
- package/dist/scaffold/project-files.js +19 -2
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/scaffold/project.js +6 -2
- package/dist/scaffold/project.js.map +1 -1
- package/dist/scaffold/upgrade-project.d.ts +9 -2
- package/dist/scaffold/upgrade-project.js +16 -3
- package/dist/scaffold/upgrade-project.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const AGENTS_MD_FILE = "AGENTS.md";
|
|
2
|
+
/**
|
|
3
|
+
* Where the current template is written when the creator's own file is kept. Under `.bitmagic/`
|
|
4
|
+
* so it is gitignored and outside the publish fingerprint — a suggestion must not make a passing
|
|
5
|
+
* verify stale, or taking the suggestion would cost a re-verify.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AGENTS_MD_TEMPLATE_FILE: string;
|
|
8
|
+
export declare function hashAgentsMd(contents: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* The `## ` headings of a markdown document, in order.
|
|
11
|
+
*
|
|
12
|
+
* Section granularity is the level that survives ordinary editing: a creator who rewrites a
|
|
13
|
+
* paragraph, or appends notes of their own, still has the section. Comparing whole files would
|
|
14
|
+
* report "different" for every project that has ever been touched, which is noise rather than
|
|
15
|
+
* information. `#` (the title) and `###` (sub-points within a section) are deliberately ignored.
|
|
16
|
+
*/
|
|
17
|
+
export declare function sectionHeadings(markdown: string): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Sections the current template has that theirs does not.
|
|
20
|
+
*
|
|
21
|
+
* Matched on the heading text, so a renamed heading reads as missing. That is the right way to be
|
|
22
|
+
* wrong for a suggestion nobody is forced to act on: a false positive costs a line of output, a
|
|
23
|
+
* false negative silently withholds the guidance this exists to deliver.
|
|
24
|
+
*/
|
|
25
|
+
export declare function missingSections(theirs: string, ours: string): string[];
|
|
26
|
+
export type AgentsMdAction =
|
|
27
|
+
/** Did not exist — written fresh. */
|
|
28
|
+
'created'
|
|
29
|
+
/** Byte-identical to the stamp, so replaced with the current template. */
|
|
30
|
+
| 'rewritten'
|
|
31
|
+
/** Already the current template. Nothing to do, nothing to say. */
|
|
32
|
+
| 'current'
|
|
33
|
+
/** Carries edits (or predates stamping) — left exactly as it was. */
|
|
34
|
+
| 'kept';
|
|
35
|
+
export interface AgentsMdOutcome {
|
|
36
|
+
action: AgentsMdAction;
|
|
37
|
+
/** The stamp to record, or undefined to leave whatever is already there alone. */
|
|
38
|
+
hashToStore?: string;
|
|
39
|
+
/** Only for `kept`: sections of the current template their file does not have. */
|
|
40
|
+
missingSections: string[];
|
|
41
|
+
/** Only for `kept` with something to show: where the current template was written. */
|
|
42
|
+
templatePath?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Bring a project's AGENTS.md up to date as far as is provably safe, and report what to tell the
|
|
46
|
+
* creator. See the file header for the rule; this is where it is applied.
|
|
47
|
+
*
|
|
48
|
+
* `storedHash` is `bitmagic.json`'s `agentsMdHash` — absent for any project scaffolded before this
|
|
49
|
+
* existed, which is exactly the population that most needs the suggestion path.
|
|
50
|
+
*/
|
|
51
|
+
export declare function reconcileAgentsMd(root: string, storedHash: string | undefined): AgentsMdOutcome;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keeping a project's AGENTS.md current without ever destroying what its creator wrote.
|
|
3
|
+
*
|
|
4
|
+
* AGENTS.md is the file that decides what an agent working in a scaffolded project knows how to
|
|
5
|
+
* do, and the template grows: `bitmagic cover` is the case that exposed the problem, but the
|
|
6
|
+
* coordinate-system warning and the publish exit-code table arrived the same way. It is also the
|
|
7
|
+
* file a creator is most likely to have customised, so `upgrade` cannot simply overwrite it the
|
|
8
|
+
* way it overwrites the skills.
|
|
9
|
+
*
|
|
10
|
+
* The way out is to know whether it was edited at all, rather than guessing. `scaffoldProject` and
|
|
11
|
+
* every rewrite here stamp a hash of exactly what was written into `bitmagic.json`. On a later
|
|
12
|
+
* upgrade the file is re-hashed:
|
|
13
|
+
*
|
|
14
|
+
* - hash matches the stamp → the creator never touched it, so rewriting it can only replace our
|
|
15
|
+
* own words with our own newer words. Provably lossless, so just do it.
|
|
16
|
+
* - hash differs, or there is no stamp (every project scaffolded before this shipped) → their
|
|
17
|
+
* edits are in there. Keep the file, name the sections of the current template it does not
|
|
18
|
+
* have, and write the current template next to it for diffing.
|
|
19
|
+
*
|
|
20
|
+
* The fallback is the safe direction in every ambiguous case: an unstamped project is treated as
|
|
21
|
+
* edited, so the worst outcome is a suggestion the creator ignores.
|
|
22
|
+
*/
|
|
23
|
+
import { createHash } from 'crypto';
|
|
24
|
+
import * as fs from 'fs';
|
|
25
|
+
import * as path from 'path';
|
|
26
|
+
import { renderAgentsMd } from './project-files.js';
|
|
27
|
+
export const AGENTS_MD_FILE = 'AGENTS.md';
|
|
28
|
+
/**
|
|
29
|
+
* Where the current template is written when the creator's own file is kept. Under `.bitmagic/`
|
|
30
|
+
* so it is gitignored and outside the publish fingerprint — a suggestion must not make a passing
|
|
31
|
+
* verify stale, or taking the suggestion would cost a re-verify.
|
|
32
|
+
*/
|
|
33
|
+
export const AGENTS_MD_TEMPLATE_FILE = path.join('.bitmagic', 'AGENTS.md.latest');
|
|
34
|
+
export function hashAgentsMd(contents) {
|
|
35
|
+
return createHash('sha256').update(contents, 'utf-8').digest('hex');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The `## ` headings of a markdown document, in order.
|
|
39
|
+
*
|
|
40
|
+
* Section granularity is the level that survives ordinary editing: a creator who rewrites a
|
|
41
|
+
* paragraph, or appends notes of their own, still has the section. Comparing whole files would
|
|
42
|
+
* report "different" for every project that has ever been touched, which is noise rather than
|
|
43
|
+
* information. `#` (the title) and `###` (sub-points within a section) are deliberately ignored.
|
|
44
|
+
*/
|
|
45
|
+
export function sectionHeadings(markdown) {
|
|
46
|
+
return markdown
|
|
47
|
+
.split('\n')
|
|
48
|
+
.filter((line) => line.startsWith('## '))
|
|
49
|
+
.map((line) => line.slice(3).trim());
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Sections the current template has that theirs does not.
|
|
53
|
+
*
|
|
54
|
+
* Matched on the heading text, so a renamed heading reads as missing. That is the right way to be
|
|
55
|
+
* wrong for a suggestion nobody is forced to act on: a false positive costs a line of output, a
|
|
56
|
+
* false negative silently withholds the guidance this exists to deliver.
|
|
57
|
+
*/
|
|
58
|
+
export function missingSections(theirs, ours) {
|
|
59
|
+
const have = new Set(sectionHeadings(theirs));
|
|
60
|
+
return sectionHeadings(ours).filter((heading) => !have.has(heading));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Bring a project's AGENTS.md up to date as far as is provably safe, and report what to tell the
|
|
64
|
+
* creator. See the file header for the rule; this is where it is applied.
|
|
65
|
+
*
|
|
66
|
+
* `storedHash` is `bitmagic.json`'s `agentsMdHash` — absent for any project scaffolded before this
|
|
67
|
+
* existed, which is exactly the population that most needs the suggestion path.
|
|
68
|
+
*/
|
|
69
|
+
export function reconcileAgentsMd(root, storedHash) {
|
|
70
|
+
const target = path.join(root, AGENTS_MD_FILE);
|
|
71
|
+
const current = renderAgentsMd();
|
|
72
|
+
const currentHash = hashAgentsMd(current);
|
|
73
|
+
let existing;
|
|
74
|
+
try {
|
|
75
|
+
existing = fs.readFileSync(target, 'utf-8');
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Deleted, or a project assembled by hand. There is nothing to preserve, and a project with no
|
|
79
|
+
// agent guidance at all is worse off than one with ours.
|
|
80
|
+
fs.writeFileSync(target, current);
|
|
81
|
+
return { action: 'created', hashToStore: currentHash, missingSections: [] };
|
|
82
|
+
}
|
|
83
|
+
const existingHash = hashAgentsMd(existing);
|
|
84
|
+
if (existingHash === currentHash) {
|
|
85
|
+
// Already ours and already current — including the case where they were stamped long ago and
|
|
86
|
+
// the template has not moved since.
|
|
87
|
+
return { action: 'current', hashToStore: currentHash, missingSections: [] };
|
|
88
|
+
}
|
|
89
|
+
if (storedHash !== undefined && existingHash === storedHash) {
|
|
90
|
+
// Unmodified since we last wrote it: replacing our own words with our own newer ones.
|
|
91
|
+
fs.writeFileSync(target, current);
|
|
92
|
+
return { action: 'rewritten', hashToStore: currentHash, missingSections: [] };
|
|
93
|
+
}
|
|
94
|
+
// Theirs. Leave the stamp alone too — it still records the last thing WE wrote, which is what a
|
|
95
|
+
// future comparison needs.
|
|
96
|
+
const missing = missingSections(existing, current);
|
|
97
|
+
const templatePath = path.join(root, AGENTS_MD_TEMPLATE_FILE);
|
|
98
|
+
fs.mkdirSync(path.dirname(templatePath), { recursive: true });
|
|
99
|
+
fs.writeFileSync(templatePath, current);
|
|
100
|
+
return { action: 'kept', missingSections: missing, templatePath };
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=agents-md.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AuB,CAAC,CAAC;IAC9D,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC;AACpE,CAAC"}
|
|
@@ -30,6 +30,14 @@ export interface ProjectMetadata {
|
|
|
30
30
|
engineVersion: string;
|
|
31
31
|
genre: string;
|
|
32
32
|
template: string;
|
|
33
|
+
/**
|
|
34
|
+
* sha256 of the AGENTS.md the CLI last wrote, so `bitmagic upgrade` can tell an untouched file
|
|
35
|
+
* (safe to refresh) from one the creator edited (never overwritten — see scaffold/agents-md.ts).
|
|
36
|
+
*
|
|
37
|
+
* Optional: every project scaffolded before this existed has none, and those are treated as
|
|
38
|
+
* edited, which is the safe direction.
|
|
39
|
+
*/
|
|
40
|
+
agentsMdHash?: string;
|
|
33
41
|
}
|
|
34
42
|
export declare function renderBitmagicJson(metadata: ProjectMetadata): string;
|
|
35
43
|
export declare function renderAgentsMd(): string;
|
|
@@ -306,8 +306,13 @@ export function renderAgentsMd() {
|
|
|
306
306
|
but \`bitmagic cover\` generates the cover art from it, so it is not decoration.
|
|
307
307
|
- \`.claude/skills/generating-assets/\` — **shipped by the CLI, re-rendered by \`bitmagic upgrade\`.**
|
|
308
308
|
It documents the CLI's own commands, so it stays current with them; edits to it are lost. Skills
|
|
309
|
-
you add yourself are never touched.
|
|
310
|
-
|
|
309
|
+
you add yourself are never touched.
|
|
310
|
+
- \`AGENTS.md\` — this file. Yours to edit, and \`upgrade\` will never overwrite your edits. It
|
|
311
|
+
refreshes this file only while it is still byte-identical to what the CLI wrote; once you change
|
|
312
|
+
anything, it stops and instead tells you which sections of the current template you are missing,
|
|
313
|
+
leaving that template in \`.bitmagic/AGENTS.md.latest\` to diff against. **If you edit this file,
|
|
314
|
+
re-read that diff after an upgrade** — new CLI capabilities are documented here, and an edited
|
|
315
|
+
copy will not learn about them on its own.
|
|
311
316
|
|
|
312
317
|
\`engine/types/work-game.d.ts\` declares \`module 'work/Game.js'\`, which is how the engine
|
|
313
318
|
imports your game. Renaming or removing the \`VoxelGame\` export from \`src/work/Game.ts\` still
|
|
@@ -364,6 +369,18 @@ compile that dies on load — a missing asset, a bad \`world.json\` value, a nul
|
|
|
364
369
|
\`bitmagic verify\` after a change you cannot eyeball: it loads the game in a headless browser and
|
|
365
370
|
fails with what actually broke, leaving a console log and a screenshot in \`.bitmagic/verify/\`.
|
|
366
371
|
|
|
372
|
+
## The human may be moving objects too
|
|
373
|
+
|
|
374
|
+
\`bitmagic edit\` gives this project's owner a visual scene editor — they click an object and drag
|
|
375
|
+
a gizmo, and the new transform is written straight into \`src/work/world.json\`, one entry per
|
|
376
|
+
object touched. So \`world.json\` is shared ground, not yours alone:
|
|
377
|
+
|
|
378
|
+
- **Re-read \`src/work/world.json\` before editing it.** The copy you read earlier in the session
|
|
379
|
+
may be stale, and a whole-file rewrite from that copy silently reverts what they just placed.
|
|
380
|
+
- Prefer changing the entries you mean to change over regenerating \`environmentObjects\`
|
|
381
|
+
wholesale, so their placements survive your edit.
|
|
382
|
+
- \`git diff src/work/world.json\` shows what they moved; there is no separate edit history.
|
|
383
|
+
|
|
367
384
|
## Publishing
|
|
368
385
|
|
|
369
386
|
\`\`\`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-files.js","sourceRoot":"","sources":["../../src/scaffold/project-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,2BAA2B,EAAE,SAAS;IACtC,2BAA2B,EAAE,SAAS;IACtC,kBAAkB,EAAE,QAAQ;IAC5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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0NR,CAAC;AACF,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DR,CAAC;AACF,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAa;IAC9C,MAAM,KAAK,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC;IAC3B,OAAO;;EAEP,KAAK;QACH,CAAC,CAAC,8GAA8G;QAChH,CAAC,CAAC,0KAA0K;;;;EAI9K,KAAK,IAAI,iEAAiE;;;;;;;;;;;;;;CAc3E,CAAC;AACF,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO;;;;;;;;;;;;;;CAcR,CAAC;AACF,CAAC"}
|
package/dist/scaffold/project.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as path from 'path';
|
|
|
3
3
|
import { CliError } from '../errors.js';
|
|
4
4
|
import { aliasSourceDir } from './aliases.js';
|
|
5
5
|
import { renderPackageJson, renderTsconfig, renderIndexHtml, renderViteConfig, renderVitePublishConfig, renderGitignore, renderBitmagicJson, renderAgentsMd, renderGameDesignMd, renderClaudeMd, renderSkillsReadme, renderGenerateSkill, } from './project-files.js';
|
|
6
|
+
import { hashAgentsMd } from './agents-md.js';
|
|
6
7
|
/**
|
|
7
8
|
* Directories moved out of the extracted tree into the project's vendored engine/.
|
|
8
9
|
*
|
|
@@ -132,11 +133,14 @@ export function scaffoldProject(options) {
|
|
|
132
133
|
if (fs.existsSync(serviceWorker)) {
|
|
133
134
|
fs.cpSync(serviceWorker, path.join(targetDir, 'sw-cache-buster.js'));
|
|
134
135
|
}
|
|
136
|
+
// Stamped as it is written, so a later `bitmagic upgrade` can tell whether the creator has
|
|
137
|
+
// edited it since — see scaffold/agents-md.ts for what that decides.
|
|
138
|
+
const agentsMd = renderAgentsMd();
|
|
135
139
|
const files = [
|
|
136
140
|
['package.json', renderPackageJson(projectName)],
|
|
137
141
|
...PLATFORM_GENERATED_FILES.map((entry) => [entry[0], entry[1]()]),
|
|
138
|
-
['bitmagic.json', renderBitmagicJson(metadata)],
|
|
139
|
-
['AGENTS.md',
|
|
142
|
+
['bitmagic.json', renderBitmagicJson({ ...metadata, agentsMdHash: hashAgentsMd(agentsMd) })],
|
|
143
|
+
['AGENTS.md', agentsMd],
|
|
140
144
|
// Creator-owned from here on (see PLATFORM_GENERATED_FILES): the agent rewrites it as the
|
|
141
145
|
// game takes shape, and `bitmagic cover` reads whatever it says at the time.
|
|
142
146
|
['GAME-DESIGN.md', renderGameDesignMd(idea)],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/scaffold/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,GAEpB,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/scaffold/project.ts"],"names":[],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,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC,WAAW,EAAE,cAAc,EAAE,CAAC;QAC/B,CAAC,YAAY,EAAE,eAAe,EAAE,CAAC;KAClC,CAAC;IACF,KAAK,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAC5C,wFAAwF;QACxF,+EAA+E;QAC/E,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1D,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACvC,CAAC;AACH,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AgentsMdOutcome } from './agents-md.js';
|
|
1
2
|
export interface UpgradeOptions {
|
|
2
3
|
root: string;
|
|
3
4
|
/** Where extractEngine unpacked the new engine tree, same shape scaffoldProject reads from. */
|
|
@@ -10,6 +11,8 @@ export interface UpgradeResult {
|
|
|
10
11
|
previousEngineVersion: string;
|
|
11
12
|
/** Every top-level path this run actually rewrote, in the order it rewrote them. */
|
|
12
13
|
replaced: string[];
|
|
14
|
+
/** What happened to AGENTS.md, and what to suggest about it. See scaffold/agents-md.ts. */
|
|
15
|
+
agentsMd: AgentsMdOutcome;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Refreshes the platform-owned parts of a scaffolded project in place, and nothing else. This is
|
|
@@ -17,8 +20,12 @@ export interface UpgradeResult {
|
|
|
17
20
|
* sw-cache-buster.js are wholesale-replaced, the config files AND SHIPPED SKILLS in
|
|
18
21
|
* PLATFORM_GENERATED_FILES are re-rendered, and bitmagic.json is read-modified-written so only its
|
|
19
22
|
* engineVersion field changes. Everything else on disk — src/, world.json, game.json,
|
|
20
|
-
* package.json,
|
|
21
|
-
*
|
|
23
|
+
* package.json, GAME-DESIGN.md, CLAUDE.md, .gitignore, and any skill the creator wrote themselves
|
|
24
|
+
* — is never opened.
|
|
25
|
+
*
|
|
26
|
+
* AGENTS.md is the one conditional case, and never a destructive one: it is refreshed only when it
|
|
27
|
+
* still hashes to what the CLI itself last wrote, and otherwise left untouched with a suggestion.
|
|
28
|
+
* See scaffold/agents-md.ts for why that is worth the machinery.
|
|
22
29
|
*
|
|
23
30
|
* The skills are in that list on purpose (see PLATFORM_GENERATED_FILES): they describe the CLI, so
|
|
24
31
|
* a project that never receives an updated one has an agent that cannot discover anything the CLI
|
|
@@ -2,14 +2,19 @@ import * as fs from 'fs';
|
|
|
2
2
|
import * as path from 'path';
|
|
3
3
|
import { CliError } from '../errors.js';
|
|
4
4
|
import { VENDORED_DIRS, PLATFORM_GENERATED_FILES } from './project.js';
|
|
5
|
+
import { reconcileAgentsMd, AGENTS_MD_FILE } from './agents-md.js';
|
|
5
6
|
/**
|
|
6
7
|
* Refreshes the platform-owned parts of a scaffolded project in place, and nothing else. This is
|
|
7
8
|
* the file-boundary described in the task brief: `engine/` (every VENDORED_DIRS entry) and
|
|
8
9
|
* sw-cache-buster.js are wholesale-replaced, the config files AND SHIPPED SKILLS in
|
|
9
10
|
* PLATFORM_GENERATED_FILES are re-rendered, and bitmagic.json is read-modified-written so only its
|
|
10
11
|
* engineVersion field changes. Everything else on disk — src/, world.json, game.json,
|
|
11
|
-
* package.json,
|
|
12
|
-
*
|
|
12
|
+
* package.json, GAME-DESIGN.md, CLAUDE.md, .gitignore, and any skill the creator wrote themselves
|
|
13
|
+
* — is never opened.
|
|
14
|
+
*
|
|
15
|
+
* AGENTS.md is the one conditional case, and never a destructive one: it is refreshed only when it
|
|
16
|
+
* still hashes to what the CLI itself last wrote, and otherwise left untouched with a suggestion.
|
|
17
|
+
* See scaffold/agents-md.ts for why that is worth the machinery.
|
|
13
18
|
*
|
|
14
19
|
* The skills are in that list on purpose (see PLATFORM_GENERATED_FILES): they describe the CLI, so
|
|
15
20
|
* a project that never receives an updated one has an agent that cannot discover anything the CLI
|
|
@@ -70,8 +75,16 @@ export function upgradeProject(options) {
|
|
|
70
75
|
const meta = JSON.parse(fs.readFileSync(bitmagicJsonPath, 'utf-8'));
|
|
71
76
|
const previousEngineVersion = typeof meta.engineVersion === 'string' ? meta.engineVersion : '';
|
|
72
77
|
meta.engineVersion = engineVersion;
|
|
78
|
+
// AGENTS.md last, because it is the one file here whose treatment depends on reading the stamp
|
|
79
|
+
// out of the metadata above — and whose result is written back into it below.
|
|
80
|
+
const storedHash = typeof meta.agentsMdHash === 'string' ? meta.agentsMdHash : undefined;
|
|
81
|
+
const agentsMd = reconcileAgentsMd(root, storedHash);
|
|
82
|
+
if (agentsMd.hashToStore !== undefined)
|
|
83
|
+
meta.agentsMdHash = agentsMd.hashToStore;
|
|
84
|
+
if (agentsMd.action === 'created' || agentsMd.action === 'rewritten')
|
|
85
|
+
replaced.push(AGENTS_MD_FILE);
|
|
73
86
|
fs.writeFileSync(bitmagicJsonPath, `${JSON.stringify(meta, null, 2)}\n`);
|
|
74
87
|
replaced.push('bitmagic.json');
|
|
75
|
-
return { engineVersion, previousEngineVersion, replaced };
|
|
88
|
+
return { engineVersion, previousEngineVersion, replaced, agentsMd };
|
|
76
89
|
}
|
|
77
90
|
//# sourceMappingURL=upgrade-project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade-project.js","sourceRoot":"","sources":["../../src/scaffold/upgrade-project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"upgrade-project.js","sourceRoot":"","sources":["../../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CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/F,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IAEnC,+FAA+F;IAC/F,8EAA8E;IAC9E,MAAM,UAAU,GAAG,OAAO,IAAI,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC;IACzF,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACrD,IAAI,QAAQ,CAAC,WAAW,KAAK,SAAS;QAAE,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC,WAAW,CAAC;IACjF,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,KAAK,WAAW;QAAE,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAEpG,EAAE,CAAC,aAAa,CAAC,gBAAgB,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACzE,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE/B,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitmagic/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Build Bitmagic games from your own agent tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"citty": "^0.2.2",
|
|
20
20
|
"playwright-core": "^1.59.1",
|
|
21
21
|
"tar": "^7.4.3",
|
|
22
|
-
"@bitmagic/
|
|
23
|
-
"@bitmagic/
|
|
22
|
+
"@bitmagic/world-forger": "0.1.3",
|
|
23
|
+
"@bitmagic/asset-core": "0.1.1"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@eslint/js": "^9.38.0",
|