@dryvcode/cli 0.0.1 → 0.1.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 +49 -233
- package/dist/dryv.js +13198 -3743
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,253 +1,69 @@
|
|
|
1
1
|
# Dryv CLI
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
The API, engine, and template plugins do not receive ambient authority to access the user's real filesystem or Git credentials.
|
|
3
|
+
`dryv` turns software you describe once (schemas, operations, events) into real code, through reusable packs. It shows you a plan and a diff first, and only writes files when you approve.
|
|
6
4
|
|
|
7
5
|
## Install
|
|
8
6
|
|
|
9
|
-
The published package runs on **Node.js 22+** or **Bun 1.3+**, and installs with any package manager:
|
|
10
|
-
|
|
11
7
|
```bash
|
|
12
|
-
npm install --global @dryvcode/cli
|
|
13
|
-
|
|
14
|
-
yarn global add @dryvcode/cli
|
|
15
|
-
bun add --global @dryvcode/cli
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Or run it without installing: `npx @dryvcode/cli --help`, or `bunx @dryvcode/cli --help`.
|
|
19
|
-
|
|
20
|
-
The package ships one bundled file, `dist/dryv.js` (a `node` shebang, no runtime dependencies), built from the TypeScript source by `bun run build`. Process, `which` and sleep helpers live in `src/platform/process.ts` and behave the same on both runtimes.
|
|
21
|
-
|
|
22
|
-
## Development
|
|
23
|
-
|
|
24
|
-
Repository development uses Bun. `bin/dryv.ts` runs the TypeScript source directly.
|
|
25
|
-
|
|
26
|
-
Install dependencies:
|
|
27
|
-
|
|
28
|
-
```text
|
|
29
|
-
cd apps/cli
|
|
30
|
-
bun install
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
`bun install` creates/updates `bun.lock`; commit that lockfile for reproducible installs. CI or other frozen environments should use:
|
|
34
|
-
|
|
35
|
-
```text
|
|
36
|
-
bun install --frozen-lockfile
|
|
8
|
+
npm install --global @dryvcode/cli # or pnpm / yarn / bun add --global
|
|
9
|
+
dryv --help
|
|
37
10
|
```
|
|
38
11
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
```text
|
|
42
|
-
bun run start -- --help
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
or directly:
|
|
46
|
-
|
|
47
|
-
```text
|
|
48
|
-
bun ./bin/dryv.ts --help
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Run all checks:
|
|
52
|
-
|
|
53
|
-
```text
|
|
54
|
-
bun run check
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
This performs the TypeScript type-check through Bun and then runs the Bun test runner.
|
|
58
|
-
|
|
59
|
-
`bun run check` also builds `dist/dryv.js` and smoke-tests it with Node.
|
|
60
|
-
|
|
61
|
-
## Commands
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
dryv capabilities
|
|
65
|
-
dryv info
|
|
66
|
-
dryv build
|
|
67
|
-
dryv ir build
|
|
68
|
-
dryv validate
|
|
69
|
-
dryv plan
|
|
70
|
-
dryv generate
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
The API defaults to `http://127.0.0.1:8750`. Override it with either:
|
|
74
|
-
|
|
75
|
-
```text
|
|
76
|
-
dryv validate --api https://dryv.example.com
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
or `DRYV_API_URL`.
|
|
80
|
-
|
|
81
|
-
### `dryv capabilities`
|
|
82
|
-
|
|
83
|
-
Inspects the local environment only. It reports whether this client can read/write the workspace and whether native local/Git pack resolvers are available. A capability means the mechanism is available; it does not claim every referenced resource is accessible.
|
|
84
|
-
|
|
85
|
-
Native Git resolution uses the user's existing Git environment such as SSH agents and credential helpers. Dryv does not store Git credentials. Git subprocesses are launched through `Bun.spawn()` and inherit the user's environment.
|
|
86
|
-
|
|
87
|
-
### `dryv info`
|
|
88
|
-
|
|
89
|
-
Reads `GET /` and displays the Dryv API and engine capabilities.
|
|
90
|
-
|
|
91
|
-
### `dryv build`
|
|
92
|
-
|
|
93
|
-
Compiles an authored source into canonical Runtime IR through the selected author/compiler provider and Runtime ingestion pipeline. The completed build is validated by the Runtime but is not written to disk.
|
|
94
|
-
|
|
95
|
-
### `dryv ir build`
|
|
96
|
-
|
|
97
|
-
Compiles authored source and writes a portable canonical Runtime IR artifact. By default it writes:
|
|
98
|
-
|
|
99
|
-
```text
|
|
100
|
-
.dryv/ir/dryv.ir.yaml
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
Available formats:
|
|
104
|
-
|
|
105
|
-
```text
|
|
106
|
-
dryv ir build --format yaml
|
|
107
|
-
dryv ir build --format json
|
|
108
|
-
dryv ir build --format jsonl
|
|
109
|
-
dryv ir build --all
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
This command does not require a generation pack. An author-only usage document may use `packs: {}`.
|
|
113
|
-
|
|
114
|
-
### `dryv validate`
|
|
12
|
+
Needs Node.js 22+ or Bun 1.3+. Try without installing: `npx @dryvcode/cli --help`.
|
|
115
13
|
|
|
116
|
-
|
|
14
|
+
## Five-minute start
|
|
117
15
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
dryv
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
dryv
|
|
142
|
-
dryv
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
The older broad workspace loader remains temporarily for the existing API endpoints until the new operation protocol is connected.
|
|
148
|
-
|
|
149
|
-
## Local pack capabilities
|
|
150
|
-
|
|
151
|
-
The CLI can resolve explicit local pack resources without interpreting `dryv.yaml` itself. A future API/engine environment request supplies the typed pack source; the CLI fulfills it.
|
|
152
|
-
|
|
153
|
-
Local pack resolution:
|
|
154
|
-
|
|
155
|
-
- remains inside the project root;
|
|
156
|
-
- rejects symbolic links and non-regular files;
|
|
157
|
-
- has file-count, per-file-size, and total-size limits;
|
|
158
|
-
- includes text and binary resources;
|
|
159
|
-
- requires a UTF-8 `dryv.pack.yaml`;
|
|
160
|
-
- sorts files deterministically;
|
|
161
|
-
- computes SHA-256 file and resource digests.
|
|
162
|
-
|
|
163
|
-
## Native Git pack capability
|
|
164
|
-
|
|
165
|
-
The native Git resolver uses the installed `git` executable through Bun's process API and the user's normal Git authentication environment. It does not create a Dryv credential store.
|
|
166
|
-
|
|
167
|
-
Resolved Git packs record:
|
|
168
|
-
|
|
169
|
-
- requested repository;
|
|
170
|
-
- requested revision;
|
|
171
|
-
- concrete resolved commit;
|
|
172
|
-
- optional pack subpath;
|
|
173
|
-
- deterministic pack content digest;
|
|
174
|
-
- resolver provenance (`client.git-native`).
|
|
175
|
-
|
|
176
|
-
Git cache state is stored under `.dryv/.cache/git`. `.dryv/.cache` is reserved for disposable Dryv-owned operational state such as resolved resources, plans, sessions and digests. Repository URLs are not installed as persistent remotes in the cache, and HTTP(S) repository URLs containing embedded credentials are rejected.
|
|
177
|
-
|
|
178
|
-
## Resource bundles
|
|
179
|
-
|
|
180
|
-
Resolved packs can be converted into a self-describing ZIP transport bundle with media type:
|
|
181
|
-
|
|
182
|
-
```text
|
|
183
|
-
application/vnd.dryv.resource-bundle+zip
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
The archive contains:
|
|
187
|
-
|
|
188
|
-
```text
|
|
189
|
-
dryv.bundle.json
|
|
190
|
-
files/
|
|
191
|
-
dryv.pack.yaml
|
|
192
|
-
templates/...
|
|
193
|
-
resources/...
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
`dryv.bundle.json` uses `dryv.resource-bundle/v1alpha1` and records the resource request ID, pack identity, content digest, every file's path/kind/SHA-256/size/archive path, and normalized provenance.
|
|
197
|
-
|
|
198
|
-
ZIP is only a transport optimization. The semantic identity remains the typed resource manifest and content hashes; engine behavior must not depend on ZIP metadata or compression implementation.
|
|
199
|
-
|
|
200
|
-
Bundle file paths are canonical project-relative paths and are namespaced below `files/`, so resource entries cannot collide with the bundle manifest.
|
|
201
|
-
|
|
202
|
-
## Workspace loading compatibility path
|
|
203
|
-
|
|
204
|
-
Inside a Git repository the older workspace loader uses:
|
|
205
|
-
|
|
206
|
-
```text
|
|
207
|
-
git ls-files -z --cached --others --exclude-standard
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
This naturally honors Git's normal ignored-file rules. Outside Git, the CLI performs a deterministic recursive filesystem walk.
|
|
211
|
-
|
|
212
|
-
In both modes it also honors `.dryvignore` plus repeatable `--exclude <pattern>` options.
|
|
213
|
-
|
|
214
|
-
Default exclusions include:
|
|
16
|
+
```bash
|
|
17
|
+
cd my-project
|
|
18
|
+
npm install -D @dryvcode/author @dryvcode/compiler # or: uv add --dev dryv-author dryv-compiler
|
|
19
|
+
dryv init --author typescript --author-path dryv/contracts/index.ts --yes
|
|
20
|
+
dryv pack search nestjs
|
|
21
|
+
dryv pack add inject/backend/nestjs --activation server --destination src/server --yes
|
|
22
|
+
dryv plan # what would be generated? (writes nothing)
|
|
23
|
+
dryv generate --dry-run # the exact diff (writes nothing)
|
|
24
|
+
dryv generate # asks, then writes
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`dryv init` also writes `dryv/README.md` and a Dryv block in `AGENTS.md`, so people and AI agents opening the project know how it works.
|
|
28
|
+
|
|
29
|
+
## Everyday commands
|
|
30
|
+
|
|
31
|
+
| Command | Use it to |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `dryv validate` / `plan` | Check your definitions and preview the files |
|
|
34
|
+
| `dryv generate [--dry-run \| --check]` | Write files, preview them, or fail CI when stale |
|
|
35
|
+
| `dryv status` | See drift between generated files and your definitions |
|
|
36
|
+
| `dryv why <path>` | Learn why a generated file exists |
|
|
37
|
+
| `dryv explain change` | Learn what caused the latest change |
|
|
38
|
+
| `dryv undo` | Revert the last apply |
|
|
39
|
+
| `dryv pack search / describe / explain / add / remove / update` | Find, read about and manage packs from the registry |
|
|
40
|
+
| `dryv doctor` | Diagnose project, engine and pack problems |
|
|
41
|
+
| `dryv docs [topic]` | Read built-in guides: workflow, dryv-yaml, pack-yaml, authoring, errors, agents |
|
|
42
|
+
|
|
43
|
+
## Built-in help for people and agents
|
|
215
44
|
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
45
|
+
```bash
|
|
46
|
+
dryv docs # list guides
|
|
47
|
+
dryv docs dryv-yaml # how to write dryv.yaml
|
|
48
|
+
dryv docs errors # every error code and its fix
|
|
49
|
+
dryv docs --write # (re)write dryv/README.md and the AGENTS.md block
|
|
221
50
|
```
|
|
222
51
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
This broad upload behavior is transitional and will be removed from the normal engine workflow once environment requests are connected.
|
|
52
|
+
For scripts and agents add `--json --no-input`: output is one JSON document with a stable `status` and `code`. `dryv generate --check` exits 2 when output is out of date.
|
|
226
53
|
|
|
227
|
-
##
|
|
54
|
+
## Engine and sign-in
|
|
228
55
|
|
|
229
|
-
The CLI
|
|
230
|
-
|
|
231
|
-
```text
|
|
232
|
-
untrusted JSON
|
|
233
|
-
↓
|
|
234
|
-
API protocol parser
|
|
235
|
-
↓
|
|
236
|
-
typed TypeScript contract classes
|
|
237
|
-
↓
|
|
238
|
-
CLI/application logic
|
|
239
|
-
```
|
|
56
|
+
The CLI uses the hosted engine at `https://dryv-engine.alidantech.org`. Use your own with `--api <url>` or `DRYV_API_URL`, for example `docker run -p 8750:8750 ghcr.io/dryvcode/dryv-engine:latest`.
|
|
240
57
|
|
|
241
|
-
|
|
58
|
+
Store an API key in your OS credential store with `dryv login` (remove it with `dryv logout`), or set `DRYV_API_KEY` in CI. Keys are only sent in headers and never in URLs.
|
|
242
59
|
|
|
243
|
-
##
|
|
60
|
+
## Safety
|
|
244
61
|
|
|
245
|
-
|
|
62
|
+
- Only compiled Runtime IR leaves your machine; the CLI alone writes files.
|
|
63
|
+
- Running your author compiler or pack actions needs trust: `dryv trust`. CI never auto-trusts.
|
|
64
|
+
- If you edited a generated file and the definition changed too, Dryv stops. Choose `--conflicts keep` or `overwrite`.
|
|
65
|
+
- `dryv clean` removes plans, journals and caches stored outside your project.
|
|
246
66
|
|
|
247
|
-
|
|
248
|
-
- it cannot traverse outside the project root;
|
|
249
|
-
- it does not pass through a symbolic link;
|
|
250
|
-
- an existing output target is a regular file;
|
|
251
|
-
- a generation stream has not emitted the same output path twice.
|
|
67
|
+
## Learn more
|
|
252
68
|
|
|
253
|
-
|
|
69
|
+
Full docs: https://dryv.alidantech.org/docs · CLI reference: https://dryv.alidantech.org/docs/usage/cli
|