castle-web-cli 0.4.97 → 0.4.99

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/index.js CHANGED
@@ -6,7 +6,7 @@ import { serve } from './serve.js';
6
6
  import { saveDeck } from './save-deck.js';
7
7
  import { getDeck } from './get-deck.js';
8
8
  import { addImport, updateImport } from './imports.js';
9
- import { init } from './init.js';
9
+ import { getCliVersion, init } from './init.js';
10
10
  import { install } from './install.js';
11
11
  import { connectWS, savePreviewImage, savePreviewIfNeeded, takeScreenshot } from './preview.js';
12
12
  const args = process.argv.slice(2);
@@ -86,6 +86,7 @@ function usage() {
86
86
  castle-web update-import [alias] [dir] [--check] [--revert] (re-fetches imports; no alias means all)
87
87
  castle-web install [dir]
88
88
  castle-web login
89
+ castle-web --version
89
90
 
90
91
  Kits:
91
92
  basic-2d Actor / behavior / scene framework for 2D games. Includes an editor and Layout / Drawing / Collider / Camera built-ins. Default if --kit is omitted.
@@ -95,6 +96,13 @@ After init, read the scaffolded deck's CLAUDE.md (also AGENTS.md) for the kit's
95
96
  process.exit(1);
96
97
  }
97
98
  async function main() {
99
+ // Before the switch: `--version` is a flag, not a command, and it has to work
100
+ // when there is no command at all. Which version is installed is the first
101
+ // thing anyone asks when a sandbox behaves like an older build.
102
+ if (command === '--version' || command === '-v' || command === 'version') {
103
+ console.log(getCliVersion());
104
+ return;
105
+ }
98
106
  switch (command) {
99
107
  case 'init': {
100
108
  const dir = findPositionalDir();
package/dist/init.d.ts CHANGED
@@ -5,6 +5,7 @@ export declare function resolveScaffoldRefs(): {
5
5
  cliDistAbs: string | null;
6
6
  sdkPathPosix: string | null;
7
7
  };
8
+ export declare function getCliVersion(): string;
8
9
  export declare function init(dir: string, opts?: {
9
10
  kit?: string;
10
11
  serve?: boolean;
package/dist/init.js CHANGED
@@ -237,7 +237,7 @@ function readJsonFile(file) {
237
237
  function writeJsonFile(file, value) {
238
238
  fs.writeFileSync(file, JSON.stringify(value, null, 2) + "\n", "utf8");
239
239
  }
240
- function getCliVersion() {
240
+ export function getCliVersion() {
241
241
  const pkg = readJsonFile(path.join(getKitsDir(), "..", "package.json"));
242
242
  return typeof pkg?.version === "string" ? pkg.version : "0.0.0";
243
243
  }
@@ -28,5 +28,5 @@
28
28
  "deckId": "5R39TxaRfLLQ",
29
29
  "cardId": "AZk0PWHTrFcT",
30
30
  "title": "basic-2d",
31
- "publishedVersion": "2026-07-28T17:52:37.298Z"
31
+ "publishedVersion": "2026-07-28T19:19:13.421Z"
32
32
  }
@@ -28,5 +28,5 @@
28
28
  "deckId": "ckRZGFW4iPrx",
29
29
  "cardId": "_oBFbAW6DxsO",
30
30
  "title": "physics-2d",
31
- "publishedVersion": "2026-07-28T17:50:39.741Z"
31
+ "publishedVersion": "2026-07-28T19:19:14.734Z"
32
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "castle-web-cli",
3
- "version": "0.4.97",
3
+ "version": "0.4.99",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "castle-web": "./dist/index.js"