@archastro/astroshot 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # `@archastro/astroshot`
2
2
 
3
- One command for deterministic React, Ink, and arbitrary terminal screenshots.
3
+ One command for deterministic React, Ink, and arbitrary terminal screenshots
4
+ plus **journey movies** into `.astroshot/`.
4
5
 
5
6
  ```bash
6
7
  npx --@archastro:registry=https://registry.npmjs.org \
@@ -18,6 +19,30 @@ npx --@archastro:registry=https://registry.npmjs.org \
18
19
  @archastro/astroshot pty ./pty.shot.yaml -o ./terminal.png
19
20
  ```
20
21
 
22
+ ## Movies (`astroshot movie`)
23
+
24
+ Same binary. Agents: **run `astroshot movie which-source "…"` first**.
25
+
26
+ | You need to record… | `--source` |
27
+ |---------------------|------------|
28
+ | Web / SPA / agent-browser | `browser` |
29
+ | TUI / CLI / truecolor terminal | `pty` (never desktop of Terminal.app) |
30
+ | Native macOS app window | `desktop.window` |
31
+ | Your own PNG sequence | `frames` |
32
+
33
+ ```bash
34
+ astroshot movie --help
35
+ astroshot movie which-source "ratatui truecolor dashboard"
36
+ astroshot movie run --source browser --feature web --slug home --url https://example.com
37
+ astroshot movie run --source desktop.window --feature app --slug onboard \
38
+ --bundle-id com.example.App --duration-ms 4000
39
+ astroshot movie list-windows # macOS
40
+ ```
41
+
42
+ `desktop.window` uses macOS `/usr/sbin/screencapture` (already on the system)
43
+ plus a Swift window list shipped in the package — no separate capture binary
44
+ download. Requires Screen Recording permission for your terminal/IDE.
45
+
21
46
  Use `react` for isolated browser components, `ink` for in-process Ink fixture
22
47
  trees, and `pty` for executable terminal applications such as Ratatui, Bubble
23
48
  Tea, Textual, and curses programs. `tui` remains an alias for `ink` for
package/bin/astroshot.mjs CHANGED
@@ -8,7 +8,7 @@ import path from "node:path";
8
8
  import { writeFixtureTemplate } from "./templates.mjs";
9
9
 
10
10
  function help() {
11
- console.log(`astroshot — one CLI for React, Ink, and PTY screenshots
11
+ console.log(`astroshot — one CLI for React, Ink, PTY stills, and movies
12
12
 
13
13
  Usage:
14
14
  astroshot init react [fixture.tsx] [--force]
@@ -20,15 +20,23 @@ Usage:
20
20
  astroshot ink <fixture.tsx> -o <out.png> [options]
21
21
  astroshot ink batch <manifest.yaml|json> [options]
22
22
  astroshot pty <fixture.yaml|json> -o <out.png> [options]
23
+ astroshot movie <command> [options]
23
24
  astroshot install-browser [--with-deps]
24
25
 
25
26
  Commands:
26
- react Capture an isolated React component
27
- ink Capture an Ink component fixture
28
- pty Capture any executable in a pseudoterminal
27
+ react Capture an isolated React component (still PNG)
28
+ ink Capture an Ink component fixture (still PNG)
29
+ pty Capture any executable in a pseudoterminal (still PNG)
30
+ movie Record a journey movie into .astroshot/ (poster + video)
29
31
  init Generate a React, Ink, or PTY fixture template
30
32
  install-browser Install the shared Chromium runtime
31
33
 
34
+ Movie sources (see "astroshot movie which-source"):
35
+ browser Web / agent-browser / Playwright viewport
36
+ pty Truecolor TUI/CLI (never screenshot Terminal.app)
37
+ desktop.window Native macOS app window (uses OS screencapture)
38
+ frames Push your own PNG/JPEG sequence
39
+
32
40
  Compatibility: "astroshot tui" remains an alias for "astroshot ink".
33
41
  Run "astroshot <mode> --help" for mode options.`);
34
42
  }
@@ -88,6 +96,12 @@ Options:
88
96
  }
89
97
 
90
98
  function engineBin(mode) {
99
+ if (mode === "movie") {
100
+ const entry = fileURLToPath(import.meta.resolve("@archastro/movie-harness"));
101
+ // package exports "." → dist/index.js → package root is two levels up from dist
102
+ const packageRoot = path.dirname(path.dirname(entry));
103
+ return path.join(packageRoot, "bin", "astroshot-movie.mjs");
104
+ }
91
105
  const packageName =
92
106
  mode === "react" ? "@archastro/react-shot" : "@archastro/tui-shot";
93
107
  const executable = mode === "react" ? "react-shot.mjs" : "tui-shot.mjs";
@@ -210,6 +224,23 @@ if (command === "react" || command === "ink" || command === "tui" || command ===
210
224
  runEngine(canonicalMode, arguments_);
211
225
  }
212
226
 
227
+ if (command === "movie") {
228
+ // Always forward to movie-harness (including --help / which-source).
229
+ const result = spawnSync(
230
+ process.execPath,
231
+ [engineBin("movie"), ...arguments_],
232
+ { stdio: "inherit" },
233
+ );
234
+ if (result.error) {
235
+ console.error(
236
+ `astroshot could not start movie harness: ${result.error.message}`,
237
+ );
238
+ process.exit(1);
239
+ }
240
+ if (result.signal) process.kill(process.pid, result.signal);
241
+ process.exit(result.status ?? 1);
242
+ }
243
+
213
244
  console.error(`Unknown command: ${command}`);
214
245
  help();
215
246
  process.exit(1);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@archastro/astroshot",
3
- "version": "0.1.0",
4
- "description": "One CLI for deterministic React and terminal UI screenshots",
3
+ "version": "0.2.0",
4
+ "description": "One CLI for deterministic React, terminal, and movie UI captures",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ink",
@@ -9,6 +9,8 @@
9
9
  "ratatui",
10
10
  "terminal",
11
11
  "screenshot",
12
+ "movie",
13
+ "screencast",
12
14
  "visual-testing"
13
15
  ],
14
16
  "license": "MIT",
@@ -56,7 +58,7 @@
56
58
  "README.md"
57
59
  ],
58
60
  "scripts": {
59
- "pretest": "npm run build --workspace @archastro/react-shot && npm run build --workspace @archastro/tui-shot",
61
+ "pretest": "npm run build --workspace @archastro/react-shot && npm run build --workspace @archastro/tui-shot && npm run build --workspace @archastro/movie-harness",
60
62
  "test": "node --test test/*.test.mjs"
61
63
  },
62
64
  "engines": {
@@ -68,7 +70,8 @@
68
70
  "registry": "https://registry.npmjs.org/"
69
71
  },
70
72
  "dependencies": {
71
- "@archastro/react-shot": "0.1.0",
72
- "@archastro/tui-shot": "0.1.0"
73
+ "@archastro/movie-harness": "0.2.0",
74
+ "@archastro/react-shot": "0.2.0",
75
+ "@archastro/tui-shot": "0.2.0"
73
76
  }
74
77
  }