castle-web-cli 0.4.158 → 0.4.160

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/init.js CHANGED
@@ -5,7 +5,7 @@ import { installDeps } from './install.js';
5
5
  import { deckMainFile, deckStarterScene, STARTER_STYLE_FILES } from './castleJson.js';
6
6
  import { addImportTo, IMPORTS_DIR, lockImportTree, restoreMissingImports, syncImportDependencies, } from './imports.js';
7
7
  import { discardParentSource, fetchParentSource, unpackParentSource, writeRemixIdentity, } from './remix.js';
8
- import { getCliEntryPath, getKitsDir, getSdkPackagePath, toPosixPath, } from './localPaths.js';
8
+ import { getCliEntryPath, getKitsDir, getSdkPackagePath, toPosixPath } from './localPaths.js';
9
9
  import { serve } from './serve.js';
10
10
  import { createVersion } from './versions.js';
11
11
  // Default kit imported by `init` when no --kit is given. `none`/`bare` skips the
@@ -357,15 +357,29 @@ Do not edit anything under \`${IMPORTS_DIR}/\`: those files belong to the deck t
357
357
  came from, and are replaced wholesale when the import is updated.
358
358
  `;
359
359
  }
360
- function makeImportedKitClaudeMd(alias) {
360
+ // Whether the scaffolded deck runs a server, read back from the copied import so
361
+ // that adopting a kit later describes the deck the same way scaffolding from it
362
+ // does.
363
+ function kitShipsServer(deckDir, alias) {
364
+ const config = readJsonFile(path.join(deckDir, IMPORTS_DIR, alias, 'castle.json')) ?? {};
365
+ return !!config.server;
366
+ }
367
+ function makeImportedKitClaudeMd(alias, hasServer) {
368
+ const server = hasServer
369
+ ? `
370
+ This deck has a server. \`castle.json\`'s \`server.main\` points at the kit's, which
371
+ runs in the session process and decides what is true for everyone playing
372
+ together. The kit's guide says what a deck adds to it, and when to write its own
373
+ instead.
374
+ `
375
+ : '';
361
376
  return `# Castle deck
362
377
 
363
- The engine, editors and built-in behaviors come from the **${alias}** kit, imported
364
- at \`${IMPORTS_DIR}/${alias}/\` and read-only. Read \`${IMPORTS_DIR}/${alias}/CLAUDE.md\`
365
- for the authoring guide: how scenes, blueprints, drawings and behaviors work.
366
- The Castle SDK and the rules every deck shares come from \`${BASE_ALIAS}\`,
367
- imported alongside it.
368
-
378
+ This deck is built on the **${alias}** kit, imported at \`${IMPORTS_DIR}/${alias}/\`
379
+ and read-only. Read \`${IMPORTS_DIR}/${alias}/CLAUDE.md\` first: it is the authoring
380
+ guide, and it says what this kit adds over the kits imported beside it. The Castle
381
+ SDK and the rules every deck shares come from \`${BASE_ALIAS}\`.
382
+ ${server}
369
383
  This deck holds only its own content -- \`scenes/\`, \`drawings/\`,
370
384
  \`blueprints/\`, \`behaviors/\` -- plus \`index.html\` (which points at the kit's
371
385
  entry point) and \`castle.json\` (editor config and the import pin).
@@ -391,7 +405,7 @@ export function retargetBareClaudeMd(deckDir, alias) {
391
405
  catch {
392
406
  return;
393
407
  }
394
- fs.writeFileSync(claudePath, makeImportedKitClaudeMd(alias));
408
+ fs.writeFileSync(claudePath, makeImportedKitClaudeMd(alias, kitShipsServer(deckDir, alias)));
395
409
  appendPlatformSection(deckDir);
396
410
  }
397
411
  // How the deck names the kit it was built on. `scripts/publish-kits.mjs` stamps
@@ -540,7 +554,7 @@ function scaffoldFromKitImport(kit, projectDir) {
540
554
  scripts: makeKitDeckScripts(kitDir, alias, cliCommand),
541
555
  dependencies,
542
556
  });
543
- fs.writeFileSync(path.join(projectDir, 'CLAUDE.md'), makeImportedKitClaudeMd(alias));
557
+ fs.writeFileSync(path.join(projectDir, 'CLAUDE.md'), makeImportedKitClaudeMd(alias, !!kitConfig.server));
544
558
  appendPlatformSection(projectDir);
545
559
  ensureAgentsSymlink(projectDir);
546
560
  for (const importedAlias of copied.keys()) {