@modeldesk/cli 0.8.0 → 0.9.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 +114 -66
- package/THIRD-PARTY-NOTICES.txt +1 -1
- package/dist/modeldesk.js +260 -252
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -34,14 +34,17 @@ modeldesk bundle pull|templates
|
|
|
34
34
|
modeldesk note add <name>
|
|
35
35
|
modeldesk template lint <dir>
|
|
36
36
|
|
|
37
|
-
modeldesk model list [--metamodel <id>] [--owner <organization|me>]
|
|
37
|
+
modeldesk model list [--metamodel <id>] [--owner <organization|me>]
|
|
38
38
|
modeldesk model show <model[@ref]> identity at the ref; overview and releases are main's
|
|
39
39
|
modeldesk model tree <model[@ref]> [--depth <n>] [--type <type>] [--internal]
|
|
40
40
|
modeldesk model log <model[@ref]> [--include-system] [--changes]
|
|
41
41
|
modeldesk model create --name <name> --metamodel <metamodel[@release]>
|
|
42
42
|
[--extension <extension[@release]>]... [--owner <organization|me>]
|
|
43
|
-
[--kind model|metamodel] [--standard-version <version>]
|
|
44
43
|
modeldesk model delete <model>
|
|
44
|
+
modeldesk model rename <model> <name>
|
|
45
|
+
modeldesk model access <model> shared|individual
|
|
46
|
+
modeldesk model metamodel <model> [--version <version>] [--extension <id[@version]>]... [--no-extensions]
|
|
47
|
+
modeldesk model metadata show <model> | set <model> --record <json>
|
|
45
48
|
modeldesk model import [<file>] | --url <uri> --metamodel <metamodel[@release]> [--name <name>]
|
|
46
49
|
[--owner <organization>] [--extension <extension[@release]>]... [--loader <name>]
|
|
47
50
|
[--review] [--timeout <seconds>]
|
|
@@ -67,7 +70,29 @@ modeldesk el relate <model[@ref]> <element> <relation> <target> [--unowned]
|
|
|
67
70
|
modeldesk el unrelate <model[@ref]> <element> <relation> <target>
|
|
68
71
|
modeldesk el bulk <model[@ref]> --where <criterion>... [--set <attr=value>]... [--json-value <attr=json>]...
|
|
69
72
|
[--unset <attr>]... [--lang <tag>]
|
|
70
|
-
|
|
73
|
+
modeldesk el paste <model[@ref]> <element>... [--from-model <model>] [--parent <el> --relation <r>]
|
|
74
|
+
|
|
75
|
+
modeldesk namespace create <model[@ref]> --prefix <p> --uri <iri> [--default yes|no]
|
|
76
|
+
modeldesk namespace set <model[@ref]> <namespace> [--prefix <p>] [--uri <iri>] [--default yes|no]
|
|
77
|
+
modeldesk namespace rm <model[@ref]> <namespace>
|
|
78
|
+
modeldesk attr-template base <model[@ref]> --base-iri <iri>
|
|
79
|
+
modeldesk attr-template create <model[@ref]> --attribute <a> --flavor <flavor> [--element-type <t>]
|
|
80
|
+
[--source <a>] [--segment <text>] [--lang <tag>] [--casing <c>] [--short-form]
|
|
81
|
+
modeldesk attr-template set <model[@ref]> <entry> --attribute <a> --flavor <flavor> [the same flags]
|
|
82
|
+
modeldesk attr-template rm <model[@ref]> <entry>
|
|
83
|
+
modeldesk diagram create <model[@ref]> --name <name> [--description <text> [--lang <tag>]]
|
|
84
|
+
[--context <el>] [--diagram-type <id>]
|
|
85
|
+
modeldesk diagram set <model[@ref]> <diagram> [--name <name>] [--add <el>]... [--remove <el>]...
|
|
86
|
+
[--orientation <o>] [--hierarchy-orientation <o>] [--published yes|no]
|
|
87
|
+
modeldesk diagram rm <model[@ref]> <diagram>
|
|
88
|
+
modeldesk diagram materialize <model[@ref]> <root> --template <id> [--orientation <o>] [--published yes|no]
|
|
89
|
+
modeldesk diagram rule create <model[@ref]> <diagram> --element <el> --type <type> --ref-element <el>
|
|
90
|
+
modeldesk diagram rule rm|mv <model[@ref]> <diagram> <rule> [--position <n>]
|
|
91
|
+
modeldesk diagram group create <model[@ref]> <diagram> --root <el> [--max-left <n>] [--max-right <n>]
|
|
92
|
+
modeldesk diagram group set <model[@ref]> <diagram> <group> --root <el> [--max-left <n>] [--max-right <n>]
|
|
93
|
+
modeldesk diagram group rm|mv <model[@ref]> <diagram> <group> [--position <n>]
|
|
94
|
+
every el, namespace, attr-template and diagram write takes
|
|
95
|
+
-m <message> [--request-id <id>] [--commit [--with-staged]]
|
|
71
96
|
|
|
72
97
|
modeldesk search <model[@ref]> <text> [--type <type>] [--internal]
|
|
73
98
|
modeldesk describe <model[@ref]> [<type>] [--internal]
|
|
@@ -90,13 +115,13 @@ modeldesk branch merge <model@target> <source> [-m <message>] [--resolve <file|
|
|
|
90
115
|
[--take <element>[#<field>]=target|source]... [--take-others target|source]
|
|
91
116
|
[--expect <target-head>] [--expect-source <source-head>]
|
|
92
117
|
|
|
93
|
-
modeldesk release create
|
|
94
|
-
modeldesk release list
|
|
95
|
-
modeldesk release cascade <base> [--timeout <seconds>] [--instance-limit <n>] [--verify-all]
|
|
118
|
+
modeldesk release create <model[@commit]> --name <name> [--description <text>]
|
|
119
|
+
modeldesk release list <model>
|
|
96
120
|
modeldesk pin list <model[@ref]>
|
|
97
121
|
modeldesk pin set <model> <dependency@release|main>
|
|
98
122
|
modeldesk dependency add <model[@ref]> <target@release|main>
|
|
99
123
|
modeldesk dependency rm <model[@ref]> <dependency>
|
|
124
|
+
modeldesk dependency pin <model[@ref]> <dependency@release|main>
|
|
100
125
|
```
|
|
101
126
|
|
|
102
127
|
A listing also takes `--limit <n>`, `--cursor <cursor>` and `--all`. `<model[@ref]>` is a model's
|
|
@@ -423,25 +448,25 @@ is `/`-separated (`SHACL/NodeShape/severity`), with a `/` inside a label written
|
|
|
423
448
|
Each argument accepts some refs and gives a missing ref a meaning. **Working** means your draft
|
|
424
449
|
while it holds staged changes, and the head of your working branch otherwise.
|
|
425
450
|
|
|
426
|
-
| Argument of
|
|
427
|
-
|
|
|
428
|
-
| `model tree`, `el show`, `search`
|
|
429
|
-
| `model show`, `validate`, `describe`, `pin list`
|
|
430
|
-
| `model log`
|
|
431
|
-
| every `el` and `dependency` write, `model pull`
|
|
432
|
-
| `branch create` (the branch to start from), `branch diff`
|
|
433
|
-
| `draft open`, `branch delete`, `branch merge` (the target)
|
|
434
|
-
| the other `draft` commands
|
|
435
|
-
| `release create`
|
|
436
|
-
| `pin set` (the dependency), `dependency add` (the target)
|
|
437
|
-
| `--metamodel`, `--extension`
|
|
438
|
-
| the commands that read main
|
|
451
|
+
| Argument of | Accepts | Without a ref |
|
|
452
|
+
| --------------------------------------------------------------------------- | ------------------------------------- | ----------------------------------- |
|
|
453
|
+
| `model tree`, `el show`, `search` | `@draft`, `@head`, a branch, a commit | Working |
|
|
454
|
+
| `model show`, `validate`, `describe`, `pin list` | `@draft`, `@head`, a branch | Working |
|
|
455
|
+
| `model log` | `@draft`, `@head`, a branch | The working branch head |
|
|
456
|
+
| every `el` and `dependency` write, `model pull` | `@draft`, `@head`, a branch | Working |
|
|
457
|
+
| `branch create` (the branch to start from), `branch diff` | `@head`, a branch | The working branch head |
|
|
458
|
+
| `draft open`, `branch delete`, `branch merge` (the target) | a branch | Required |
|
|
459
|
+
| the other `draft` commands | a branch, as an assertion | Your draft, wherever it aims |
|
|
460
|
+
| `release create` | a commit, which must be main's head | Main's head |
|
|
461
|
+
| `pin set`, `dependency pin` (the dependency), `dependency add` (the target) | a release, or `@main` | Required |
|
|
462
|
+
| `--metamodel`, `--extension` | a release | The latest stable or newest release |
|
|
463
|
+
| the commands that read main | no ref | Main |
|
|
439
464
|
|
|
440
465
|
`model show` reads the model's identity and head at the ref. Its overview and releases are always
|
|
441
466
|
main's, and the result labels them so (`overview.ref`). The commands that read main are
|
|
442
|
-
`model export`, `model delete`, `branch list`, `release list
|
|
443
|
-
|
|
444
|
-
|
|
467
|
+
`model export`, `model delete`, `branch list`, `release list` and the model of `pin set`. They take
|
|
468
|
+
no ref at all, `@main` included: a ref there exits 2 (`ref-unsupported`), so nothing reads main
|
|
469
|
+
under an address that said otherwise. `model export`
|
|
445
470
|
encodes main only. When your draft aims at another branch, it says so in the `ref` block's `note`
|
|
446
471
|
(on stderr in text mode). `describe` reads the schema at its ref, since a dependency staged in your
|
|
447
472
|
draft brings the metamodel of its target into it, and the `el` writes plan against the schema at
|
|
@@ -545,12 +570,33 @@ working branch. They follow these rules:
|
|
|
545
570
|
the same one on every run, so `--request-id fix-42` and the id it reported retry alike. `model
|
|
546
571
|
create` has no idempotency key: after an exit 7, check `model list` before you retry.
|
|
547
572
|
|
|
548
|
-
###
|
|
573
|
+
### Stage the model's structure
|
|
574
|
+
|
|
575
|
+
The `namespace`, `attr-template` and `diagram` commands stage what a model holds besides its elements:
|
|
576
|
+
its namespaces, the base IRI and entries of its attribute templates, and its diagrams with their
|
|
577
|
+
layout rules and hierarchy groups. `el paste` stages a copy of elements, each with the subtree it
|
|
578
|
+
owns, from the model itself or from another model of the organization. Each follows the rules of
|
|
579
|
+
[a staged change](#stage-a-change) and takes `-m`, `--request-id`, `--commit` and `--with-staged` as
|
|
580
|
+
an `el` write does.
|
|
581
|
+
|
|
582
|
+
- **Addressing.** A namespace is named by its prefix or its id, a diagram by its name or its id, an
|
|
583
|
+
attribute template by the attribute it fills in or its id, and a layout rule or a hierarchy group
|
|
584
|
+
by its id. `search <model> <text> --internal --type @Diagram` finds the ids; the type names are
|
|
585
|
+
`@Namespace`, `@AttributeTemplate`, `@Diagram`, `@LayoutRule` and `@HierarchyGroup`. A layout rule
|
|
586
|
+
or a hierarchy group has no name, so search for `LayoutRule` or `HierarchyGroup`, the label it is
|
|
587
|
+
listed under.
|
|
588
|
+
- **A set replaces or merges as the server does.** `namespace set` and `diagram set` change what they
|
|
589
|
+
are given and keep the rest. `attr-template set` and `diagram group set` replace the whole entry or
|
|
590
|
+
group, so give every part it is to keep.
|
|
591
|
+
- **A copy from another model** names its elements by id; within the model a label path works too.
|
|
592
|
+
|
|
593
|
+
### Add, remove or re-pin a dependency
|
|
549
594
|
|
|
550
595
|
`dependency add <model[@ref]> <target>@<release|main>` stages a dependency on another model of the
|
|
551
|
-
organization,
|
|
552
|
-
|
|
553
|
-
|
|
596
|
+
organization, `dependency rm <model[@ref]> <dependency>` stages the removal of one, and
|
|
597
|
+
`dependency pin <model[@ref]> <dependency>@<release|main>` stages a move of one to another release
|
|
598
|
+
of its target, or to its head now. Each follows the rules of [a staged change](#stage-a-change) and
|
|
599
|
+
takes `-m`, `--request-id`, `--commit` and `--with-staged` as an `el` write does.
|
|
554
600
|
|
|
555
601
|
- **The pin.** `<target>@<release>` pins that release. `<target>@main` pins the target's head as it is
|
|
556
602
|
when the change is staged, and it moves again only when you re-pin.
|
|
@@ -559,9 +605,12 @@ the rules of [a staged change](#stage-a-change) and take `-m`, `--request-id`, `
|
|
|
559
605
|
elements that refer to it. The schema follows: `describe` and the `el` writes read it at the ref,
|
|
560
606
|
so what the target's metamodel brings is there as soon as the dependency is staged.
|
|
561
607
|
- **A target the model already depends on is refused** (exit 4, `dependency-exists`) before anything
|
|
562
|
-
is sent, naming the dependency and the `pin
|
|
563
|
-
|
|
564
|
-
|
|
608
|
+
is sent, naming the dependency and the `dependency pin` that stages a move of its pin. A target the
|
|
609
|
+
model reaches only through another dependency becomes a direct one in place and keeps its id
|
|
610
|
+
(`promoted: true`).
|
|
611
|
+
- **`pin` lands with the draft.** Where `pin set` commits a move to main directly, `dependency pin`
|
|
612
|
+
stages it, on any branch and for a dependency your draft added too. Managed, external and
|
|
613
|
+
transitive dependencies are refused with the reason.
|
|
565
614
|
- **`rm` names the dependency** by its id or its target model's id, from `pin list`. One whose content
|
|
566
615
|
the model's elements still refer to is refused (exit 4), with one entry per referring element in
|
|
567
616
|
`details.errors`. One that another dependency still brings along stays as a transitive dependency
|
|
@@ -1070,16 +1119,32 @@ Under an agent host the CLI leaves to a person what lands content on a shared br
|
|
|
1070
1119
|
person's review, and what destroys other users' work. Every command declares the **effect** it has
|
|
1071
1120
|
on the server, and one table (`POLICY` in `src/commands/policy.ts`) decides what each effect needs:
|
|
1072
1121
|
|
|
1073
|
-
| Effect | Under an agent host | Commands
|
|
1074
|
-
| ------------- | ---------------------------------------------------------------------------------------------- |
|
|
1075
|
-
| `read` | Runs | `auth status`, `bundle templates`, `model list`, `show`, `tree`, `log`, `export`, `diff`, `model imports list`, `show`, `el show`, `search`, `describe`, `validate`, `draft status`, `diff`, `branch list`, `diff`, `release list`, `pin list`, and every `--dry-run` |
|
|
1076
|
-
| `local` | Runs | `auth login`, `logout`, `bundle pull`, `note add`, `model pull`
|
|
1077
|
-
| `stage` | Runs | `el create`, `set`, `unset`, `rm`, `mv`, `relate`, `unrelate`, `bulk`, `dependency add`, `rm`, `model push`, `draft open`, `draft rebase`, `draft handoff`
|
|
1078
|
-
| `create` | Runs | `model create`, `model import`, `model imports complete`, `delete`, `branch create`
|
|
1079
|
-
| `unstage` | Runs on the agent's own changes only | `draft undo`, `draft discard`, `draft rebase --drop`
|
|
1080
|
-
| `land-draft` | Runs on a branch named `agent/…`; elsewhere needs `MODELDESK_ALLOW_COMMIT=1`. Own changes only | `draft commit`, `--commit` on an `el` or `dependency` write or `model push`
|
|
1081
|
-
| `land-direct` | Needs `MODELDESK_ALLOW_COMMIT=1` | `branch merge` (into or from any branch, `agent/…` included), `
|
|
1082
|
-
| `destroy` | Refused, with no override
|
|
1122
|
+
| Effect | Under an agent host | Commands |
|
|
1123
|
+
| ------------- | ---------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1124
|
+
| `read` | Runs | `auth status`, `bundle templates`, `model list`, `show`, `tree`, `log`, `export`, `diff`, `model metadata show`, `model imports list`, `show`, `el show`, `search`, `describe`, `validate`, `draft status`, `diff`, `branch list`, `diff`, `release list`, `pin list`, and every `--dry-run` |
|
|
1125
|
+
| `local` | Runs | `auth login`, `logout`, `bundle pull`, `note add`, `model pull` |
|
|
1126
|
+
| `stage` | Runs | `el create`, `set`, `unset`, `rm`, `mv`, `relate`, `unrelate`, `bulk`, `dependency add`, `rm`, `model push`, `draft open`, `draft rebase`, `draft handoff` |
|
|
1127
|
+
| `create` | Runs | `model create`, `model import`, `model imports complete`, `delete`, `branch create` |
|
|
1128
|
+
| `unstage` | Runs on the agent's own changes only | `draft undo`, `draft discard`, `draft rebase --drop` |
|
|
1129
|
+
| `land-draft` | Runs on a branch named `agent/…`; elsewhere needs `MODELDESK_ALLOW_COMMIT=1`. Own changes only | `draft commit`, `--commit` on an `el` or `dependency` write or `model push` |
|
|
1130
|
+
| `land-direct` | Needs `MODELDESK_ALLOW_COMMIT=1` | `branch merge` (into or from any branch, `agent/…` included), `pin set`, `model rename`, `access`, `metamodel`, `model metadata set` |
|
|
1131
|
+
| `destroy` | Refused, with no override; on the hosted server it needs `agent:commit` | `model delete`, `branch delete` |
|
|
1132
|
+
| `publish` | Needs `MODELDESK_ALLOW_COMMIT=1` | `release create` |
|
|
1133
|
+
|
|
1134
|
+
The hosted MCP server reads the same table as four levels, by who a change affects. A person grants
|
|
1135
|
+
a connected AI platform a level on the consent page, each level including the ones before it, and a
|
|
1136
|
+
new command joins the level of the effect it declares:
|
|
1137
|
+
|
|
1138
|
+
| Level | Who is affected | Taken back by | Effects | AI platform scope | Service account scope |
|
|
1139
|
+
| ------- | ------------------------------- | -------------------- | ------------------------------------------------------- | ----------------- | --------------------- |
|
|
1140
|
+
| Read | Nobody | Nothing to take back | `read` | `model:read` | `model:read` |
|
|
1141
|
+
| Propose | The person | The person | `stage`, `create`, `unstage`, `land-draft` on `agent/…` | `model:write` | no equivalent |
|
|
1142
|
+
| Act | The person's organization | A new commit | `land-draft` elsewhere, `land-direct`, `destroy` | `agent:commit` | `model:write` |
|
|
1143
|
+
| Publish | People outside the organization | Nobody | `publish` | `agent:publish` | `model:write` |
|
|
1144
|
+
|
|
1145
|
+
At a shell the gates above are all there is: `publish` needs `MODELDESK_ALLOW_COMMIT=1` as a direct
|
|
1146
|
+
landing does, and `destroy` is refused. The hosted server offers no tool for `destroy` or `publish`,
|
|
1147
|
+
and no connection can be granted `agent:publish`.
|
|
1083
1148
|
|
|
1084
1149
|
A refusal exits 6 with `type: agent-policy`, `details: {effect, gate}`, and a hint naming the way
|
|
1085
1150
|
out. `MODELDESK_ALLOW_COMMIT` counts only when it is exactly `1`. Outside an agent host none of this
|
|
@@ -1238,38 +1303,21 @@ and `src/exportFlow/`, each beside its tests:
|
|
|
1238
1303
|
`ModelImport.SUPPORTED_LOADERS` fails the table's unit test until it is mapped.
|
|
1239
1304
|
- Files written from server data go through `writeDocuments` or `writeFileThroughTemp`
|
|
1240
1305
|
(`src/exportFlow/documents.ts`): staged as temporary files, then renamed into place, files 0644 and
|
|
1241
|
-
created directories 0755 whatever the umask. `checkSafeNames` first accepts only portable
|
|
1242
|
-
(
|
|
1243
|
-
|
|
1244
|
-
|
|
1306
|
+
created directories 0755 whatever the umask. `checkSafeNames` first accepts only portable relative
|
|
1307
|
+
paths (`/`-separated segments, none empty, `.` or `..`, and none with a control character,
|
|
1308
|
+
Windows-forbidden character or device name, trailing dot or space; a backslash is refused), so a
|
|
1309
|
+
write never lands outside the directory the caller gave, and the subdirectories a name needs are
|
|
1310
|
+
created. `checkDistinctNames` refuses paths that differ only in case or Unicode normalization, and
|
|
1311
|
+
a document that is also a folder on the way to another. A document for stdout goes out through
|
|
1245
1312
|
`context.io.out`, never `print`, with control characters dropped only when `context.stdoutIsTTY`.
|
|
1246
1313
|
- Server text an import returns (problem details, error messages, log entries) passes through
|
|
1247
1314
|
`scrubberFor` (`src/importFlow/display.ts`), which replaces the `--url` and its secret-bearing
|
|
1248
1315
|
pieces with their redacted form.
|
|
1249
1316
|
|
|
1250
|
-
**Releases and pins.** `
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
super-admins only and no service account. `release create`, `pin set` and `release cascade` change
|
|
1255
|
-
committed state with no draft to review, so they declare the effect `land-direct`: under an agent host
|
|
1256
|
-
they exit 6 before any write unless `MODELDESK_ALLOW_COMMIT=1`, and `--yes` alone never confirms a
|
|
1257
|
-
cascade there. `--dry-run`, `release list` and `pin list` stay open.
|
|
1258
|
-
|
|
1259
|
-
- The cascade lives in `src/cascade/`: `read.ts` reads the family into a `CascadeGraph`, `plan.ts`
|
|
1260
|
-
decides from it as a pure function, `execute.ts` runs the steps and stops at the first failure,
|
|
1261
|
-
and `verify.ts` waits for the platform's instance re-pins through `pollUntil`. Resuming is
|
|
1262
|
-
re-planning: a finished step leaves a pin that is current and a release at its head, so it plans
|
|
1263
|
-
as a no-op. A planner case is a hand-built graph in `plan.test.ts`.
|
|
1264
|
-
- Before its first write the cascade re-reads the heads and releases the plan rests on and exits 5
|
|
1265
|
-
when one moved. Verification waits only on the instance models pinning a release this run moved
|
|
1266
|
-
in place (the platform re-pins nothing else), at most `READ_CONCURRENCY` reads at a time; an
|
|
1267
|
-
instance never read, or still behind, exits 7. `--verify-all` checks every release of the family.
|
|
1268
|
-
- A metamodel release is named after the standard version its head declares (`readStandardVersion`),
|
|
1269
|
-
so the release it overwrites is known before the call (`releaseOverwritten`), and its description
|
|
1270
|
-
is re-sent when none is given: the server stores what the request carries.
|
|
1271
|
-
- The repository side of a metamodel release (`regenerate.sh`, commit, `push-metamodels`) is printed
|
|
1272
|
-
as `nextSteps` by `repositorySteps`, and never run.
|
|
1317
|
+
**Releases and pins.** `pin set` changes committed state with no draft to review, so it declares the
|
|
1318
|
+
effect `land-direct`; `release create` reaches people outside the organization and cannot be taken
|
|
1319
|
+
back, so it declares `publish`. Under an agent host both exit 6 before any write unless
|
|
1320
|
+
`MODELDESK_ALLOW_COMMIT=1`. `--dry-run`, `release list` and `pin list` stay open.
|
|
1273
1321
|
|
|
1274
1322
|
**Model workspaces.** The engine is `src/workspace/`, pure apart from `files.ts` and `session.ts`:
|
|
1275
1323
|
`materialize.ts` writes the files, `parse.ts` reads them, `opDiff.ts` compares them with the target,
|
package/THIRD-PARTY-NOTICES.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Third-party notices for @modeldesk/cli 0.
|
|
1
|
+
Third-party notices for @modeldesk/cli 0.9.0
|
|
2
2
|
|
|
3
3
|
This product incorporates the open-source packages listed below. Each entry gives the package,
|
|
4
4
|
its version, its license, and the license and notice text the package ships. Copyright in each
|