statelyai 0.3.1 → 0.4.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,38 +1,67 @@
1
1
  # statelyai
2
2
 
3
- <!-- package.json#name and #description — top-level summary -->
3
+ CLI implementation for Stately.
4
4
 
5
- Command-line tools for Stately.
5
+ This package contains the `statelyai` command implementation.
6
6
 
7
- ## Usage
7
+ <!-- happy-path CLI usage and statelyai.json shape derived from packages/cli/src/cli.ts#COMMANDS and packages/cli/src/projectConfig.ts -->
8
+ ## Happy Path
8
9
 
9
- <!-- package.json#bin and delegated SDK CLI commands from ../sdk/src/cli.ts#COMMANDS -->
10
+ 1. Get an API key from [Stately API Key settings](https://stately.ai/registry/user/my-settings?tab=API+Key).
11
+ 2. Log in once:
10
12
 
11
- Run the Stately CLI without installing it globally:
13
+ ```bash
14
+ statelyai login
15
+ ```
16
+
17
+ 3. Initialize the current repo:
12
18
 
13
19
  ```bash
14
- npx statelyai open ./checkout.machine.ts
20
+ statelyai init
15
21
  ```
16
22
 
17
- The `statelyai` package delegates to the CLI implementation in `@statelyai/sdk`.
23
+ 4. Optionally scan the repo and save suggested source globs:
18
24
 
19
- Available commands:
25
+ ```bash
26
+ statelyai init --scan
27
+ ```
20
28
 
21
- | Command | Description |
22
- | --- | --- |
23
- | `statelyai init` | Create or reuse a Studio project for the current directory and write `statelyai.json` with an empty `sources` array |
24
- | `statelyai login` | Store an API key for future CLI use |
25
- | `statelyai logout` | Remove a stored API key |
26
- | `statelyai auth status` | Show whether the CLI would use an environment variable or stored credential |
27
- | `statelyai plan <source> <target>` | Print a semantic sync summary |
28
- | `statelyai diff <source> <target>` | Diff two locators and optionally fail on changes |
29
- | `statelyai push [file]` | Discover local machine sources, create remote Studio machines for unlabeled files, update linked ones, and persist returned ids |
30
- | `statelyai pull <source> <target>` | Materialize a source into a local target file |
31
- | `statelyai pull <linked-file>` | Refresh a linked local file from the `@statelyai id=...` pragma |
32
- | `statelyai open <file>` | Open a local file in a browser-backed visual editor session |
29
+ That writes a `statelyai.json` like:
33
30
 
34
- The CLI resolves credentials in this order: `--api-key`, then `STATELY_API_KEY`/`NEXT_PUBLIC_STATELY_API_KEY`, then the key stored by `statelyai login`.
31
+ ```json
32
+ {
33
+ "$schema": "https://stately.ai/schemas/statelyai.json",
34
+ "version": "1.0.0",
35
+ "projectId": "project_123",
36
+ "studioUrl": "https://stately.ai",
37
+ "defaultXStateVersion": 5,
38
+ "include": ["src/**/*.ts"],
39
+ "exclude": ["**/*.test.*", "**/*.spec.*"]
40
+ }
41
+ ```
35
42
 
36
- Pass `--api-key`, set `STATELY_API_KEY`, or run `statelyai login` when the editor server requires auth. Self-hosted editor servers can disable editor-sync API-key checks with `EDITOR_SYNC_AUTH_REQUIRED=false`.
43
+ 5. Push local machines:
37
44
 
38
- Run `statelyai init --scan` to detect local machine-bearing files from their contents and save suggested `sources` globs into `statelyai.json`.
45
+ ```bash
46
+ statelyai push
47
+ ```
48
+
49
+ Preview what `push` would do without updating Studio or local files:
50
+
51
+ ```bash
52
+ statelyai push --dry-run
53
+ ```
54
+
55
+ 6. Pull remote changes back into linked local files:
56
+
57
+ ```bash
58
+ statelyai pull
59
+ ```
60
+
61
+ `pull` skips locally modified files unless you pass `--force`.
62
+
63
+ Run it without installing it globally:
64
+
65
+ ```bash
66
+ npx statelyai --help
67
+ ```
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };
package/dist/bin.mjs ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { u as run } from "./cli-DvtWVXpM.mjs";
3
+
4
+ //#region src/bin.ts
5
+ run();
6
+
7
+ //#endregion
8
+ export { };