@neocompose/cli 0.1.0 → 0.1.2
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/neo.mjs +14543 -9297
- package/package.json +1 -1
- package/skill/SKILL.md +0 -147
package/package.json
CHANGED
package/skill/SKILL.md
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: neo-schema-cli
|
|
3
|
-
description: >-
|
|
4
|
-
Edit a Neo Compose project's schema as C# files and sync bidirectionally
|
|
5
|
-
with the server using the `neo` CLI. Use when asked to add/change/remove
|
|
6
|
-
custom types, attributes, or enums in a Neo Compose project, to validate or
|
|
7
|
-
evaluate NeoScript, or to batch-edit values and localized strings. The
|
|
8
|
-
working copy lives in a `neo/` directory (neo.json + Attributes/ + Enums/);
|
|
9
|
-
commands are run via `node cli/bin/neo.mjs` (repo) or `npm run neo`.
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
# Neo Compose schema-as-code CLI (`neo`)
|
|
13
|
-
|
|
14
|
-
The `neo/` working copy is a **git-like checkout** of a Neo Compose project
|
|
15
|
-
version's schema: custom types and their attributes as one C# class per file
|
|
16
|
-
under `Attributes/`, enums under `Enums/`. The server is the source of truth;
|
|
17
|
-
files are a peer editor alongside the web UI. Spec:
|
|
18
|
-
`specs/schema-as-code-cli.md`.
|
|
19
|
-
|
|
20
|
-
## Core discipline
|
|
21
|
-
|
|
22
|
-
1. `neo pull` before editing (and before any push after time has passed).
|
|
23
|
-
2. Edit the C# files **within the constrained subset** (see below).
|
|
24
|
-
3. `neo status` / `neo diff` to review, `neo push --dry-run` to preview.
|
|
25
|
-
4. `neo push` to commit — atomically, with compare-and-swap base hashes.
|
|
26
|
-
5. **Pull → push with no edits is always a no-op.** If `neo status` reports
|
|
27
|
-
changes right after a pull, that is a bug — report it, don't push.
|
|
28
|
-
|
|
29
|
-
The CLI never guesses: anything outside the subset is a file:line:column
|
|
30
|
-
error. Conflict markers in a file make it unparseable until resolved.
|
|
31
|
-
|
|
32
|
-
## The C# subset
|
|
33
|
-
|
|
34
|
-
- One top-level `class` (custom type) or `enum` per file.
|
|
35
|
-
- Properties carry exactly one `Neo*` attribute: `NeoBool`, `NeoInt`
|
|
36
|
-
(`Min`/`Max`), `NeoFloat` (`+DecimalPoints`), `NeoString` (`Localizable`),
|
|
37
|
-
`NeoDictionary`/`NeoList` (entry chains), `NeoObject` (custom type),
|
|
38
|
-
`NeoEnum`, `NeoLookup` (`CollectionId`), `NeoGetter` (`Code`, `RetJson`),
|
|
39
|
-
`NeoSprite`/`NeoAudio` (`TemplateId`), `NeoFunction`.
|
|
40
|
-
- The positional string argument is the stable record id. **Omit it to
|
|
41
|
-
create**: `[NeoFloat(Min = 0)] public float? Weight { get; init; }` — push
|
|
42
|
-
assigns the id and rewrites the file canonically.
|
|
43
|
-
- Property nullability IS the `required` flag: `int?` optional, `int`
|
|
44
|
-
required. Property name is the schema key (`Key`/`Name` args override).
|
|
45
|
-
- Enum members: the member name is the option key (codegen symbol);
|
|
46
|
-
`[NeoEnumEntry(Text = "...")]` carries the display/localized-text id.
|
|
47
|
-
- `ExtraJson` holds fields the projection doesn't express — edit it as JSON,
|
|
48
|
-
never delete it casually.
|
|
49
|
-
- No method bodies, no initializers, no extra `using`s.
|
|
50
|
-
|
|
51
|
-
## Conflicts
|
|
52
|
-
|
|
53
|
-
Concurrent edits produce git-style `<<<<<<< local / ======= / >>>>>>> server`
|
|
54
|
-
markers at member granularity. **Edit the file to the desired final state and
|
|
55
|
-
push — the push IS the resolution** (it supersedes both sides). `neo resolve
|
|
56
|
-
--mine|--theirs` keeps one side wholesale. Markers break C# compilation on
|
|
57
|
-
purpose.
|
|
58
|
-
|
|
59
|
-
If push reports `base-hash-conflict`: run `neo pull` (merges or writes
|
|
60
|
-
markers), resolve, push again. Never bypass with `--force`-style flags.
|
|
61
|
-
|
|
62
|
-
If push reports `version-bump-required`: the server classified the change
|
|
63
|
-
(e.g. `requiredBump: major` for schema changes). Re-run with
|
|
64
|
-
`neo push --accept-bump` if the bump is intended.
|
|
65
|
-
|
|
66
|
-
## NeoScript
|
|
67
|
-
|
|
68
|
-
NeoScript is C#-flavored: typed declarations (`string x = ...;`, NOT `var`),
|
|
69
|
-
`this` = the containing type instance, `root.Assets` / `root.Save` /
|
|
70
|
-
`root.Session` roots. Validate before storing in a `NeoGetter` `Code` arg:
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
neo script check --this Outpost --returns string 'return $"{this.Name}!";'
|
|
74
|
-
neo script check --all # recompile every stored getter (run after schema edits!)
|
|
75
|
-
neo script eval --returns string 'return root.Assets.Outposts[0].FullDisplayText;'
|
|
76
|
-
neo script apply --mode action '...' # prints write intents; commits nothing
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
`eval` runs against authored values with the same evaluator the web UI uses.
|
|
80
|
-
`--json` everywhere for machine-readable output.
|
|
81
|
-
|
|
82
|
-
## Content (not in files)
|
|
83
|
-
|
|
84
|
-
Values, dialogue, and localized text are CLI verbs, not files:
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
neo records query [--kind <recordKind>] # every record head in the version
|
|
88
|
-
neo records get <kind> <id>
|
|
89
|
-
neo values list [attributeId] / get <valueId> / set <valueId> '<json>'
|
|
90
|
-
neo loc locales / list / set <textId> <locale> "text"
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Every `set` verb accepts a JSON-array batch on stdin or `--file` (e.g.
|
|
94
|
-
`[{"textId":"...","locale":"de-DE","value":"..."}]`) — use batches when
|
|
95
|
-
editing many records.
|
|
96
|
-
|
|
97
|
-
## Branches, merges, releases, migrations
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
neo branch list / create <name> [--from <ref>] / switch <nameOrId>
|
|
101
|
-
neo merge <branch> [--dry-run] # field-level 3-way; conflicts reject with per-record+field payload
|
|
102
|
-
neo release cut [--bump ...] [--dry-run] # bump floor DERIVED from transaction history; raise-only
|
|
103
|
-
neo migrate new <name> --target <Type> # creates Migrations/NNNN-name.neo
|
|
104
|
-
neo migrate list / check / run [--dry-run] [--skip-invalid]
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
Branches are copy-on-write forks (cheap; edits isolated until merged).
|
|
108
|
-
Migrations are NeoScript actions in `.neo` files: `/// @migration <id>`,
|
|
109
|
-
`/// @target <Type|project>` headers, then the action body; `this` = each
|
|
110
|
-
instance of the target type. The v1 runner applies `this.<Field> = ...`
|
|
111
|
-
assignments as one atomic CAS transaction and marks `appliedAt` per version
|
|
112
|
-
(idempotent, per-branch). Sparse instances abort unless `--skip-invalid`.
|
|
113
|
-
|
|
114
|
-
## Setup (once per machine/repo)
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
npm i -g @neocompose/cli # or run from the web repo: node cli/bin/neo.mjs
|
|
118
|
-
neo login [--api <url>] [--profile editor|release] [--save-project <id>]
|
|
119
|
-
neo init --project <id> [--version <id>] [--dir neo]
|
|
120
|
-
neo dev [--push] # live: auto-pull on server change; 'p' push, 's' status
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
Agents run non-interactively: always pass explicit flags/ids. (In a human
|
|
124
|
-
terminal the same commands prompt with pickers and confirms; with no TTY the
|
|
125
|
-
CLI never blocks on a prompt — missing arguments raise an error that names
|
|
126
|
-
the flag to pass, and confirms fall back to the pre-prompt behavior.)
|
|
127
|
-
|
|
128
|
-
Tokens land in the macOS Keychain when available (0600 file elsewhere;
|
|
129
|
-
`NEO_COMPOSE_TOKEN` / `--token-stdin` for CI). `--save-project` adds a
|
|
130
|
-
narrow per-project save-read scope for `script eval --save`.
|
|
131
|
-
|
|
132
|
-
## Implementation notes agents should know
|
|
133
|
-
|
|
134
|
-
- The CLI talks to **Convex directly** with typed `api.*` calls; pushes go
|
|
135
|
-
through the session-gated `commitFromSession` (same scope gates + CAS as
|
|
136
|
-
the web). `--json` is available on status/diff/branch list/migrate
|
|
137
|
-
list/script/records/values/loc.
|
|
138
|
-
- The working copy also projects `Templates/*.cs`, `Localization.cs`, and
|
|
139
|
-
`Migrations/*.neo`. Migration pushes **pin compiled IR** on the record;
|
|
140
|
-
`migrate run` replays the pinned IR (rename-proof). `migrate run --server`
|
|
141
|
-
executes in the server runner; `neo merge --migrate` chains migrations at
|
|
142
|
-
merge, and `release cut` refuses while any migration is pending.
|
|
143
|
-
- Pull short-circuits on the sync-signal head ("Already up to date") when
|
|
144
|
-
nothing changed server-side and the copy is clean.
|
|
145
|
-
|
|
146
|
-
The editor profile cannot publish releases; that requires `--profile release`
|
|
147
|
-
at login (server-enforced scopes — ZERO TRUST).
|