@spooky-sync/cli 0.0.1-canary.267 → 0.0.1-canary.268
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/AGENTS.md +46 -6
- package/package.json +6 -6
package/AGENTS.md
CHANGED
|
@@ -26,6 +26,28 @@ your-app/
|
|
|
26
26
|
|
|
27
27
|
`spky` finds `sp00ky.yml` in the current directory by default; pass `--config <path>` to override.
|
|
28
28
|
|
|
29
|
+
## Running it as an agent: always pass `-y`
|
|
30
|
+
|
|
31
|
+
You are almost certainly running on a **pseudo-terminal**. The CLI sees a terminal, renders its
|
|
32
|
+
prompt, and waits forever for a keypress you cannot send. Pass `-y` / `--yes` (any subcommand, any
|
|
33
|
+
position; `SPKY_YES=1` also works) and nothing blocks:
|
|
34
|
+
|
|
35
|
+
- **Consent prompts** ("Apply pending migrations to this PRODUCTION database?", "Restart SurrealDB?",
|
|
36
|
+
"Overwrite?") are answered **yes**, and the answer is printed so your log shows what you agreed to.
|
|
37
|
+
- **Preference prompts** ("Initialize git?", "Create a backup before resetting?") take their
|
|
38
|
+
**default**, never a blanket yes.
|
|
39
|
+
- **Menus** in `spky dev` (schema drift, pending migrations) take their unattended path: continue
|
|
40
|
+
with drift, auto-apply pending migrations.
|
|
41
|
+
- **Guided flows** (login, project picker, billing) do not open. They stop and print the exact
|
|
42
|
+
command or env var to use instead, e.g. `SP00KY_CLOUD_PROJECT` or `slug:` in `sp00ky.yml`.
|
|
43
|
+
|
|
44
|
+
Two operations are **not** covered by `-y`, on purpose, because they cannot be undone:
|
|
45
|
+
`spky project destroy` and `spky backup reset`. They need `--confirm <project-slug>`, spelled
|
|
46
|
+
correctly. Do not reach for these unless the user asked for exactly that, by name.
|
|
47
|
+
|
|
48
|
+
Without `-y` and without a terminal, a consent prompt **refuses** rather than proceeding, and the
|
|
49
|
+
error names the flag. If you see "No terminal to ask on", that is this.
|
|
50
|
+
|
|
29
51
|
## Subcommands an app developer/agent uses most
|
|
30
52
|
|
|
31
53
|
- **`spky generate` / `spky gen`** — read `sp00ky.yml`, parse all `.surql`, emit `schema.gen.ts` (and Dart equivalents per config). **Run this after every schema edit.**
|
|
@@ -55,11 +77,11 @@ Two that come up when a deployment misbehaves:
|
|
|
55
77
|
recreate containers. Targets are roles (`db`, `scheduler`, `ssp`, `frontend`) or an app
|
|
56
78
|
name; with none it restarts the scheduler and SSPs. `--upgrade` pulls the latest scheduler
|
|
57
79
|
and SSP images, `--clean` wipes the scheduler's volume (replica and WAL, not SurrealDB
|
|
58
|
-
data). `-y`
|
|
59
|
-
|
|
60
|
-
- **`spky migrate prod`** — apply pending migrations plus the internal Sp00ky schema to the
|
|
61
|
-
deployment, without a full deploy.
|
|
62
|
-
step times out.
|
|
80
|
+
data). `-y` (the global flag, see above) confirms the SurrealDB prompt; without it and without
|
|
81
|
+
a terminal the restart is refused.
|
|
82
|
+
- **`spky migrate prod -y`** — apply pending migrations plus the internal Sp00ky schema to the
|
|
83
|
+
deployment, without a full deploy. `-y` confirms the production gate, which otherwise refuses
|
|
84
|
+
when there is no terminal. Set `SPKY_DB_HTTP_TIMEOUT_SECS` if the internal schema step times out.
|
|
63
85
|
|
|
64
86
|
## Schema annotations the parser recognizes
|
|
65
87
|
|
|
@@ -89,7 +111,7 @@ DEFINE FIELD preview_png ON TABLE thread TYPE option<bytes>;
|
|
|
89
111
|
DEFINE TABLE audit_log SCHEMALESS;
|
|
90
112
|
```
|
|
91
113
|
|
|
92
|
-
A descriptor must sit directly above its statement (no blank line between). One that attaches to nothing is warned about, not silently dropped (`annotations::warn_unattached_annotations`).
|
|
114
|
+
A descriptor must sit directly above its statement (no blank line between). One that attaches to nothing is warned about, not silently dropped (`annotations::warn_unattached_annotations`). A descriptor is the marker alone plus at most one value token (`-- @crdt text`); a longer comment that merely starts with a marker name is prose, not an annotation, and `-- @nosync true` is refused with a warning.
|
|
93
115
|
|
|
94
116
|
## Docker dev apps (`type: docker`)
|
|
95
117
|
|
|
@@ -157,6 +179,24 @@ reader of the setting. The scheduler/SSP get `SPKY_INGEST_TRANSPORT` through
|
|
|
157
179
|
`deployment.env` (cloud) or the dev launch specs. Retention must be in
|
|
158
180
|
SurrealDB's rendered form (`1d`, not `24h`): `valid_changefeed_retention`.
|
|
159
181
|
|
|
182
|
+
"Synced" means every user table that is not `@nosync`, **including `TYPE RELATION`
|
|
183
|
+
tables**: `schema_builder::table_takes_changefeed` is the one predicate, and it has
|
|
184
|
+
to agree with `Replica::discover_sync_tables`, which clones and drift-checks every
|
|
185
|
+
table that does not carry the `sp00ky:nosync` marker. Relations used to be left out
|
|
186
|
+
of the events and the feed while staying in the replica and the SSP bootstrap, so a
|
|
187
|
+
live query over an edge table never updated. An edge's `in`/`out` are implicit (not
|
|
188
|
+
in `table.fields`), so `sp00ky::relation_endpoints` adds them to the ingest payload.
|
|
189
|
+
The same marker is re-asserted next to the changefeed ALTER
|
|
190
|
+
(`schema_builder::nosync_alter_statements`), for the same reason.
|
|
191
|
+
|
|
192
|
+
Both halves are also applied at the moment a migration defines a table, not only by the
|
|
193
|
+
pass after it: `migrate::SyncIdentity::complete` rewrites each migration's `DEFINE TABLE`
|
|
194
|
+
with the clause and the marker as `LegacyEngine` applies it (`migrate::apply_completing`).
|
|
195
|
+
Without that, rows written between a migration and the internal-schema pass landed in a
|
|
196
|
+
table with no feed. The ephemeral schema-diff replay still uses the verbatim
|
|
197
|
+
`migrate::apply`, so a completed clause never reads as drift, and the recorded checksum
|
|
198
|
+
is always the committed file's.
|
|
199
|
+
|
|
160
200
|
## Common gotchas
|
|
161
201
|
|
|
162
202
|
- **`schema.gen.ts` must be regenerated after every `.surql` change.** `spky generate`. CI typically asserts no drift.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spooky-sync/cli",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.268",
|
|
4
4
|
"description": "Generate TypeScript/Dart types from SurrealDB schema files",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/syncgen.cjs",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"vitest": "^1.0.0"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@spooky-sync/cli-darwin-arm64": "0.0.1-canary.
|
|
66
|
-
"@spooky-sync/cli-darwin-x64": "0.0.1-canary.
|
|
67
|
-
"@spooky-sync/cli-linux-arm64": "0.0.1-canary.
|
|
68
|
-
"@spooky-sync/cli-linux-x64": "0.0.1-canary.
|
|
69
|
-
"@spooky-sync/cli-win32-x64": "0.0.1-canary.
|
|
65
|
+
"@spooky-sync/cli-darwin-arm64": "0.0.1-canary.268",
|
|
66
|
+
"@spooky-sync/cli-darwin-x64": "0.0.1-canary.268",
|
|
67
|
+
"@spooky-sync/cli-linux-arm64": "0.0.1-canary.268",
|
|
68
|
+
"@spooky-sync/cli-linux-x64": "0.0.1-canary.268",
|
|
69
|
+
"@spooky-sync/cli-win32-x64": "0.0.1-canary.268"
|
|
70
70
|
}
|
|
71
71
|
}
|