@arkveil/cli 1.0.0 → 1.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 -0
- package/dist/index.js +737 -19
- package/dist/index.js.map +1 -1
- package/package.json +11 -13
package/README.md
CHANGED
|
@@ -321,6 +321,55 @@ arkveil schemas get <user|context|action>
|
|
|
321
321
|
arkveil schemas set <user|context|action> --data @schema.json
|
|
322
322
|
```
|
|
323
323
|
|
|
324
|
+
The `user` and `context` schemas drive the SDK's typed attributes — see
|
|
325
|
+
`arkveil sdk info` for the recipe that turns them into typed SDK code.
|
|
326
|
+
|
|
327
|
+
### `sdk` — SDK install & usage (for AI agents and humans)
|
|
328
|
+
|
|
329
|
+
The Arkveil SDK is for **TypeScript / JavaScript** today, in three packages:
|
|
330
|
+
NestJS (`@arkveil/nest`), Node.js/Express (`@arkveil/node`), and the
|
|
331
|
+
runtime-agnostic core (`arkveil`). `arkveil sdk` documents how to install and
|
|
332
|
+
use them — so an AI coding agent can integrate the SDK from a single command.
|
|
333
|
+
|
|
334
|
+
```bash
|
|
335
|
+
arkveil sdk info # all targets: install + usage + typing recipe
|
|
336
|
+
arkveil sdk info <nest|node|core> # narrow to one package
|
|
337
|
+
arkveil sdk info --json # machine-readable catalog for tooling/agents
|
|
338
|
+
arkveil sdk install <nest|node|core> # just the npm install command
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
`arkveil sdk info --json` returns the supported language, every package with its
|
|
342
|
+
install command and a usage snippet, and the **typing recipe** — which is now a
|
|
343
|
+
single command, `arkveil generate typescript` (see below).
|
|
344
|
+
|
|
345
|
+
### `generate` — generate typed SDK code (TypeScript)
|
|
346
|
+
|
|
347
|
+
Generates a TypeScript file that types the SDK against **your** project. It reads
|
|
348
|
+
the project's permission codes (from the actions tree) and the user/context
|
|
349
|
+
attribute JSON Schemas, and writes one file that augments the SDK registries via
|
|
350
|
+
`declare module "arkveil"`. This emits **TypeScript only** — there is no codegen
|
|
351
|
+
for other languages yet.
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
arkveil generate typescript -o src/arkveil.generated.ts # write a file
|
|
355
|
+
arkveil gen ts > src/arkveil.generated.ts # alias; or pipe stdout
|
|
356
|
+
arkveil generate typescript --include user,context # skip the codes union
|
|
357
|
+
arkveil generate typescript --json # { language, include, code, … }
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
The generated file exports `ArkveilCodes`, `ArkveilUserAttributes`, and
|
|
361
|
+
`ArkveilContextAttributes`, and augments `ArkveilCodeRegistry`,
|
|
362
|
+
`ArkveilUserRegistry`, and `ArkveilContextRegistry`. Import it once (a
|
|
363
|
+
side-effect import is enough) and permission codes plus `getUserAttributes`,
|
|
364
|
+
`getContextAttributes`, and `checkPermission` are all type-checked. Re-run it
|
|
365
|
+
whenever your codes or schemas change. Without `--output`, the TypeScript is
|
|
366
|
+
written to stdout; status messages go to stderr, so the stream stays clean.
|
|
367
|
+
|
|
368
|
+
| Option | Description |
|
|
369
|
+
| ------------------- | ------------------------------------------------------ |
|
|
370
|
+
| `--include <items>` | Subset of `codes,user,context` (default: all three). |
|
|
371
|
+
| `-o, --output <f>` | Write to a file instead of stdout. |
|
|
372
|
+
|
|
324
373
|
### `formula` — formula DSL
|
|
325
374
|
|
|
326
375
|
```bash
|