@spooky-sync/cli 0.0.0-canary.1 → 0.0.1-canary.100

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.
Files changed (37) hide show
  1. package/AGENTS.md +129 -0
  2. package/README.md +9 -9
  3. package/devtools-mcp/bridge.d.ts +23 -0
  4. package/devtools-mcp/bridge.js +155 -0
  5. package/devtools-mcp/dist/bridge.d.ts +23 -0
  6. package/devtools-mcp/dist/bridge.js +155 -0
  7. package/devtools-mcp/dist/index.d.ts +2 -0
  8. package/devtools-mcp/dist/index.js +37 -0
  9. package/devtools-mcp/dist/protocol.d.ts +34 -0
  10. package/devtools-mcp/dist/protocol.js +37 -0
  11. package/devtools-mcp/dist/server.d.ts +4 -0
  12. package/devtools-mcp/dist/server.js +319 -0
  13. package/devtools-mcp/dist/surreal.d.ts +13 -0
  14. package/devtools-mcp/dist/surreal.js +27 -0
  15. package/devtools-mcp/index.d.ts +2 -0
  16. package/devtools-mcp/index.js +37 -0
  17. package/devtools-mcp/protocol.d.ts +34 -0
  18. package/devtools-mcp/protocol.js +37 -0
  19. package/devtools-mcp/server.d.ts +4 -0
  20. package/devtools-mcp/server.js +290 -0
  21. package/devtools-mcp/surreal.d.ts +13 -0
  22. package/devtools-mcp/surreal.js +27 -0
  23. package/dist/cli.cjs +1 -1
  24. package/dist/cli.js +5 -40
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/resolve-binary-J8VAJRMF.cjs +8 -0
  27. package/dist/resolve-binary-kH1Jwk0z.js +60 -0
  28. package/dist/resolve-binary.d.ts +2 -0
  29. package/dist/resolve-binary.d.ts.map +1 -0
  30. package/dist/syncgen.cjs +1 -4
  31. package/dist/syncgen.js +11 -33
  32. package/package.json +17 -8
  33. package/templates/cookbook/INDEX.md +31 -0
  34. package/templates/cookbook/crdt-text-field.tsx +36 -0
  35. package/templates/cookbook/live-list.tsx +22 -0
  36. package/templates/cookbook/optimistic-mutation.tsx +33 -0
  37. package/target/release/spooky +0 -0
@@ -0,0 +1,36 @@
1
+ // Recipe: crdt-text-field
2
+ // Wire a CRDT text column (`{{table}}.{{field}}` annotated `-- @crdt text` in the schema)
3
+ // to a textarea. Concurrent edits from multiple clients merge via Loro.
4
+
5
+ import { useDb, useQuery, useCrdtField } from '@spooky-sync/client-solid';
6
+ import { schema } from '../schema.gen';
7
+
8
+ export function {{TablePascal}}{{FieldPascal}}Editor(props: { id: string }) {
9
+ const db = useDb<typeof schema>();
10
+
11
+ // Pull the surrounding row so we know the field is loaded.
12
+ const rowResult = useQuery(() =>
13
+ db.query('{{table}}').where({ id: props.id } as any).build()
14
+ );
15
+ const row = () => rowResult.data()?.[0];
16
+
17
+ // Bind the CRDT field. All four args take accessor functions for SolidJS tracking.
18
+ const field = useCrdtField(
19
+ '{{table}}',
20
+ () => row()?.id,
21
+ '{{field}}',
22
+ () => row()?.{{field}}
23
+ );
24
+
25
+ const handleInput = async (e: InputEvent) => {
26
+ const next = (e.currentTarget as HTMLTextAreaElement).value;
27
+ const r = row();
28
+ if (!r?.id) return;
29
+ // `debounced` coalesces rapid keystrokes into a single mutation.
30
+ await db.update('{{table}}', r.id, { {{field}}: next }, { debounced: true });
31
+ };
32
+
33
+ return (
34
+ <textarea value={field.value() ?? ''} onInput={handleInput} />
35
+ );
36
+ }
@@ -0,0 +1,22 @@
1
+ // Recipe: live-list
2
+ // Reactive, sorted list of `{{table}}` rows. Re-runs automatically as records change.
3
+
4
+ import { For } from 'solid-js';
5
+ import { useQuery, useDb } from '@spooky-sync/client-solid';
6
+ import { schema } from '../schema.gen';
7
+
8
+ export function {{TablePascal}}List() {
9
+ const db = useDb<typeof schema>();
10
+
11
+ const result = useQuery(() =>
12
+ db.query('{{table}}').orderBy('id', 'asc').limit(50).build()
13
+ );
14
+
15
+ return (
16
+ <ul>
17
+ <For each={result.data() ?? []}>
18
+ {(row) => <li>{row.id}</li>}
19
+ </For>
20
+ </ul>
21
+ );
22
+ }
@@ -0,0 +1,33 @@
1
+ // Recipe: optimistic-mutation
2
+ // Insert a new `{{table}}` row from a UI action. Local cache updates immediately;
3
+ // the mutation drains to the remote in the background.
4
+
5
+ import { createSignal } from 'solid-js';
6
+ import { Uuid, useDb } from '@spooky-sync/client-solid';
7
+ import { schema } from '../schema.gen';
8
+
9
+ export function Create{{TablePascal}}Form() {
10
+ const db = useDb<typeof schema>();
11
+ const [submitting, setSubmitting] = createSignal(false);
12
+
13
+ const handleSubmit = async (e: SubmitEvent) => {
14
+ e.preventDefault();
15
+ setSubmitting(true);
16
+ try {
17
+ const id = new Uuid().toString();
18
+ await db.create(`{{table}}:${id}`, {
19
+ // TODO: fill in the fields your `{{table}}` schema requires.
20
+ });
21
+ } finally {
22
+ setSubmitting(false);
23
+ }
24
+ };
25
+
26
+ return (
27
+ <form onSubmit={handleSubmit}>
28
+ <button type="submit" disabled={submitting()}>
29
+ {submitting() ? 'Creating…' : 'Create {{table}}'}
30
+ </button>
31
+ </form>
32
+ );
33
+ }
Binary file