dreamteamer 0.32.0 → 0.33.1
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 +4 -2
- package/collections/agents.collection.yaml +41 -32
- package/collections/collections.collection.yaml +68 -230
- package/collections/command-bindings.collection.yaml +37 -43
- package/collections/commands.collection.yaml +50 -35
- package/collections/mixins.collection.yaml +49 -0
- package/collections/modules.collection.yaml +76 -122
- package/collections/repos.collection.yaml +53 -56
- package/collections/skills.collection.yaml +32 -21
- package/collections/ui-views.collection.yaml +57 -46
- package/mixins/docs.mixin.yaml +21 -0
- package/mixins/entity.mixin.yaml +22 -0
- package/package.json +5 -3
- package/scripts/migrate-descriptors-v2.mjs +795 -0
- package/skills/using-dreamteamer/SKILL.md +27 -24
- package/skills/using-dreamteamer/references/agents.md +1 -1
- package/skills/using-dreamteamer/references/before-you-build.md +1 -5
- package/skills/using-dreamteamer/references/collections.md +450 -348
- package/skills/using-dreamteamer/references/commands.md +49 -35
- package/skills/using-dreamteamer/references/data-modeling.md +342 -319
- package/skills/using-dreamteamer/references/extensions.md +8 -5
- package/skills/using-dreamteamer/references/getting-started.md +6 -4
- package/skills/using-dreamteamer/references/records.md +43 -34
- package/skills/using-dreamteamer/references/skills.md +4 -3
- package/skills/using-dreamteamer/references/ui-components.md +30 -32
- package/skills/using-dreamteamer/references/ui-views.md +122 -124
- package/src/api.d.ts +22 -2
- package/src/api.js +16 -1
- package/src/check.js +55 -40
- package/src/checkout.js +14 -13
- package/src/cli.js +118 -71
- package/src/collections-cli.js +136 -144
- package/src/commit.js +9 -8
- package/src/compile-collections.js +346 -0
- package/src/compile.js +232 -1068
- package/src/descriptor-v2.js +165 -0
- package/src/descriptor.js +90 -0
- package/src/doctor.js +57 -0
- package/src/events.js +11 -10
- package/src/extensions.js +48 -10
- package/src/field-values.js +7 -6
- package/src/fields.js +254 -0
- package/src/filter.js +45 -1
- package/src/fractional-index.js +2 -2
- package/src/harnesses.js +80 -52
- package/src/history.js +3 -3
- package/src/init.js +74 -46
- package/src/namespace.js +23 -9
- package/src/placement.js +26 -16
- package/src/presentation.js +153 -299
- package/src/record-commands.js +12 -12
- package/src/records-api.d.ts +106 -7
- package/src/records-api.js +2 -1
- package/src/records.js +20 -14
- package/src/ref.js +3 -39
- package/src/relations.js +23 -24
- package/src/runtime.js +12 -35
- package/src/schema-ops.js +1181 -1275
- package/src/store.js +212 -82
- package/src/template.js +100 -24
- package/src/temporal.js +11 -3
- package/src/views.js +176 -0
- package/src/workspace.js +14 -0
- package/src/yaml.js +66 -5
- package/collection-templates/docs.collection-template.yaml +0 -17
- package/collection-templates/entity.collection-template.yaml +0 -20
- package/collections/collection-templates.collection.yaml +0 -20
|
@@ -5,366 +5,467 @@ One descriptor file: `modules/<module>/collections/<name>.collection.yaml`. The
|
|
|
5
5
|
|
|
6
6
|
Two references divide this territory: the *judgment* — grain, relations, enums vs vocabularies,
|
|
7
7
|
what deserves to be a collection at all — lives in `data-modeling.md`; the **mechanics** live
|
|
8
|
-
here.
|
|
9
|
-
reference
|
|
8
|
+
here. The meta-descriptor `.dreamteamer/collections/collections.collection.yaml` states every key
|
|
9
|
+
in one line each; this reference says how they behave:
|
|
10
10
|
|
|
11
11
|
| the question | read |
|
|
12
12
|
|---|---|
|
|
13
|
-
| what
|
|
13
|
+
| what a descriptor holds — keys, types, ids, display | the descriptor · fields · ids and templates · display |
|
|
14
|
+
| what compile does to my source, and what a message means | the pipeline · the message catalog |
|
|
14
15
|
| create or change shape with the CLI | the system and field verbs |
|
|
15
|
-
| a
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
| a module, the `package.json` block, a namespace | declaring a module · the workspace manifest · namespaces |
|
|
17
|
+
| records inside their parent's folder | relationship-based storage |
|
|
18
|
+
| shared fields, another module's collection, a cross-module reference | mixins · overlays · the reference contract |
|
|
19
|
+
| a data folder that already exists, or shape changing under records | registering an existing folder · evolving a schema |
|
|
20
|
+
|
|
21
|
+
## the descriptor
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
# modules/default/collections/people.collection.yaml
|
|
25
|
+
name: people
|
|
26
|
+
singular: person # the inflector leaves `people` as it is; `dt add person …` reads better
|
|
27
|
+
description: A person this workspace deals with — never the organisation, which is `companies`.
|
|
28
|
+
use_when: a person is named in a meeting, an email or a document — find or create them here first
|
|
29
|
+
storage:
|
|
30
|
+
suffix: person # <id>.person.md
|
|
31
|
+
fields:
|
|
32
|
+
name:
|
|
33
|
+
type: string
|
|
34
|
+
required: true
|
|
35
|
+
description: Full name, as they write it.
|
|
36
|
+
email:
|
|
37
|
+
type: email
|
|
38
|
+
unique: true
|
|
39
|
+
description: Where to write to them. Unique — two records with one address are one person.
|
|
40
|
+
notes:
|
|
41
|
+
type: markdown
|
|
42
|
+
body: true
|
|
43
|
+
description: Anything worth knowing, as prose.
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The top-level keys, closed (any other is a compile error naming the list):
|
|
47
|
+
|
|
48
|
+
| key | contract |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `name` | the id; equals the filename; carries the namespace (`health/visits`) |
|
|
51
|
+
| `title` | the human label; default the title-cased bare name |
|
|
52
|
+
| `singular` | the word the CLI also accepts (`dt add person`); default the inflected bare name, namespace kept. Compile warns when the inflector cannot singularise the name, and refuses two collections answering to one word |
|
|
53
|
+
| `record_title` | how one record is labelled wherever it is referenced — a template; default the first of `title` · `name` · `subject`, else `{{ id }}`. Its first token must be a `string` or `markdown` field: it is what `dt add <collection> "<title>"` fills |
|
|
54
|
+
| `description` · `use_when` | what one record IS (naming the neighbour it is not) · the situations that bring a session here. Both feed the orientation block (`data-modeling.md` §18) |
|
|
55
|
+
| `internal` | workspace plumbing, left out of the domain listing — the engine's collections and the workspace module's only |
|
|
56
|
+
| `sensitive` | records never leave through an export; the same key on a field keeps one field back |
|
|
57
|
+
| `storage` | `path` (default `data/<name>`) · `format: md \| yaml \| json \| binary` (default `md`) · `shape: file \| folder` · `entry` (folder shape: the file that IS the record) · `suffix` (default the inflected bare name — an authored `singular` does not change it) · `under` (below) · `max_bytes` · `accept` (binary only) |
|
|
58
|
+
| `ids` | `from` and `pattern` — ids and templates, below |
|
|
59
|
+
| `mixins` · `overlay` | below |
|
|
60
|
+
| `fields` | the fields, in form order. **Required to be present** — it is what marks a descriptor; a `format: binary` collection writes `fields: {}` |
|
|
61
|
+
| `constraints` | a list of JSON Schema combinators for a rule across fields. Every property named must be a field, and an `if` must name `required` or it passes vacuously on a record lacking the field |
|
|
62
|
+
| `display` | nav · list · record · form, below |
|
|
63
|
+
|
|
64
|
+
## fields
|
|
65
|
+
|
|
66
|
+
| `type` | stores | notes |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `string` · `markdown` | text | `markdown` with `body: true` is the record's prose, one per collection, kept last |
|
|
69
|
+
| `boolean` · `integer` · `number` | as named | |
|
|
70
|
+
| `date` · `datetime` | `2026-10-02` · an instant with its offset | the CLI stamps the local offset on `"2026-10-02 12:00"` |
|
|
71
|
+
| `url` · `email` | text, format-checked | |
|
|
72
|
+
| `<collection>` | a reference, `<collection>/<id>` | the foreign key |
|
|
73
|
+
| `[a, b]` | a reference to one of several | the stored prefix disambiguates |
|
|
74
|
+
| `reference` | a reference to any collection | existence checked only; no mirror; warns outside the workspace module |
|
|
75
|
+
| `object` | a nested map, with `fields:` | with `many: true`, rows labelled by `item_title` |
|
|
76
|
+
| `map` | key → value, typed by `values:` | `values` omitted: an open map |
|
|
77
|
+
| `position` | the manual-order key `dt reorder` writes | one per collection, never `many` |
|
|
78
|
+
|
|
79
|
+
`many: true` makes a list of any type but `position`; constraints on a `many` field (`pattern`, `minimum`,
|
|
80
|
+
`maxLength`…) apply to each item. A collection may not be named after a type.
|
|
81
|
+
|
|
82
|
+
The field keys, closed — the order a field is best written in:
|
|
83
|
+
|
|
84
|
+
| key | contract |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `type` · `title` | the type above · the label, default the title-cased name |
|
|
87
|
+
| `required` · `many` · `default` | as named; a default is filled in at `dt add` |
|
|
88
|
+
| `enum` | a list, or a map of value → `{ label, description, icon, color, background }`; on `type: string` only. Map order is band order. A value that is not kebab-case warns (`dt rename-value` renames one) |
|
|
89
|
+
| `unique` | no two records hold the same value, on any scalar field — enforced at write and by `check`, both claimants named; absent never claims |
|
|
90
|
+
| `mirror_of` | this field is the generated, read-only mirror of the named field on the `type` collection — the one relation spelling (`data-modeling.md` Part VI) |
|
|
91
|
+
| `on_delete` | `restrict` (the default on every reference) or `set-null`, refused on a required reference |
|
|
92
|
+
| `soft` | a reference whose target record — or collection — may not exist yet; `check` tolerates the miss, the stored value must still name an allowed collection |
|
|
93
|
+
| `sensitive` · `deprecated` | never exported · still validates, drawn nowhere, `dt add` warns on it |
|
|
94
|
+
| `body` | the prose field, `type: markdown` |
|
|
95
|
+
| `derived` · `virtual` | engine marks: stored but written only by the engine (`created`) · never stored (`id`, `last_modified`, a binary record's `ext` and `bytes`). A write naming either is refused |
|
|
96
|
+
| `passthrough` | the name keeps a harness's own spelling (`argument-hint`); without it a name that is not snake_case warns |
|
|
97
|
+
| `fields` · `values` · `item_title` | for `object`, `map`, rows of a `many` object |
|
|
98
|
+
| `examples` · `pattern` · `minimum` · `maximum` · `minItems` · `maxItems` · `minLength` · `maxLength` · `const` | passed to the validator; the first `examples` value is rendered into the orientation block's `write:` line |
|
|
99
|
+
| `display` | `editable` (`true` · `false` · `create`) · `hidden` (any of `list` · `form` · `record`) · `form_section` · `placeholder` · `unit` (`currency` · `percent` · `bytes` · a literal) · `unit_field` · `direction` · `width` · `viewer` · `editor` · `options` |
|
|
100
|
+
| `description` | what the value MEANS — the tooltip and the agent's guidance |
|
|
101
|
+
|
|
102
|
+
`display.editable: false` locks the surface and lets the CLI and syncs through; `mirror_of`,
|
|
103
|
+
`derived` and `virtual` refuse every writer. A required field with no default that is hidden from
|
|
104
|
+
the form or not editable is a compile error — nothing could create a record.
|
|
105
|
+
|
|
106
|
+
Every collection also carries three **injected** fields, never authored: `id` (virtual, the path),
|
|
107
|
+
`last_modified` (virtual, from git) and `created` — stamped into the frontmatter by `dt add`,
|
|
108
|
+
before the id is made, so `ids.from` may name it. A record written before the stamp existed reads
|
|
109
|
+
`created` from its id's date when `ids.from` names `created`, else from the commit that added the
|
|
110
|
+
file. A runtime kind (skills, agents…) has no `created`: compile writes those records.
|
|
111
|
+
|
|
112
|
+
## ids and templates
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
ids:
|
|
116
|
+
from: '{{ date | date:YYYY/MM }}/{{ date | date }}--{{ patient | basename }}'
|
|
117
|
+
pattern: '^\d{4}/\d{2}/\d{4}-\d{2}-\d{2}--[a-z0-9-]+$'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
- **`from`** is a template, or an ordered list of them: the first whose fields are all present
|
|
121
|
+
wins, so `['{{ code }}', '{{ name | slug }}']` reads "the code, else the slugged name". Without
|
|
122
|
+
`ids`, ids come from `{{ name | slug }}` — a collection with no `name` field declares `from`.
|
|
123
|
+
- **A collision at `dt add` is refused by name**; `--id` is the escape, for an id the operator chose.
|
|
124
|
+
- **`pattern`** must admit everything `from` produces, `/` included when the id shards.
|
|
125
|
+
- **The grammar is one, everywhere** — `ids.from`, `record_title`, `item_title`,
|
|
126
|
+
`display.record.subtitle` and the layout options that take a template: `{{ field }}`,
|
|
127
|
+
`{{ field | filter }}`, `{{ field | filter:arg }}`. A field is a declared one or `id` ·
|
|
128
|
+
`created` · `last_modified`; `{{ seq }}` (a running number, `| pad:3`) exists only in an id.
|
|
129
|
+
Filters: `date[:fmt]` · `datetime` · `slug` · `pad:n` · `basename` — nothing else. An unknown
|
|
130
|
+
filter or field is a compile error naming the position.
|
|
131
|
+
- **A reference renders differently by position**: in an id, as the id it holds (`basename` takes
|
|
132
|
+
the last segment); in a display template, through the target's `record_title`.
|
|
133
|
+
- **`slug` of a name with no Latin letters** falls back to a short hash; the write succeeds and says
|
|
134
|
+
so. Give such a collection a Latin field to slug, or pass `--id`.
|
|
135
|
+
|
|
136
|
+
## display — the collection's default view
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
display:
|
|
140
|
+
nav:
|
|
141
|
+
icon: pulse
|
|
142
|
+
order: 20
|
|
143
|
+
section: care # a free partition of the nav
|
|
144
|
+
list:
|
|
145
|
+
layout: table # the default; a surface's registered layout id
|
|
146
|
+
columns: [reason, patient, date, status]
|
|
147
|
+
sort: -date
|
|
148
|
+
options:
|
|
149
|
+
page_size: 50 # the layout's own keys
|
|
150
|
+
record:
|
|
151
|
+
layout: page # the default
|
|
152
|
+
subtitle: '{{ patient }} · {{ kind }}'
|
|
153
|
+
badge: status # drawn as a chip in the header
|
|
154
|
+
color_by: kind # a field whose enum map's colours tint rows and chips
|
|
155
|
+
form:
|
|
156
|
+
sections:
|
|
157
|
+
- title: Visit
|
|
158
|
+
fields: [reason, patient, date, status]
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
This block IS what a bare collection route renders and what `dt list` prints as columns. A
|
|
162
|
+
ui-view carries the same block and changes only what it states (`ui-views.md`). Every field it
|
|
163
|
+
names must exist — columns, sort, badge, color_by, sections — or compile names the position.
|
|
164
|
+
Layout options that take a field are named for the role (`group_by`, `lanes_by`, `color_by`,
|
|
165
|
+
`start`, `end`, `lat`, `lng`); those taking a template end in what they label (`card_title`,
|
|
166
|
+
`bar_title`, `group_title`, `group_summary`). Both kinds are checked; any other option key rides
|
|
167
|
+
through to the surface unchecked.
|
|
23
168
|
|
|
24
169
|
## the pipeline — what compile does to a descriptor
|
|
25
170
|
|
|
26
|
-
The compiled
|
|
27
|
-
order explains most "why does the compiled file say that" questions:
|
|
28
|
-
|
|
29
|
-
1.
|
|
30
|
-
|
|
31
|
-
2.
|
|
32
|
-
other
|
|
33
|
-
3. **
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
5. **
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
7. **Labels derive** — after relations, so generated mirrors get titles too: `title` (title-cased
|
|
48
|
-
bare name, namespace stripped), `title_template` (the `title`/`name`/`subject` probe, else
|
|
49
|
-
`{{ id }}` — which is a smell, see `data-modeling.md` Part VII §31), and a `title` per field.
|
|
50
|
-
Authored values always win; derivation never overwrites.
|
|
51
|
-
8. **Bytes dump** to `.dreamteamer/collections/<name>.collection.yaml`, with per-source hashes in
|
|
52
|
-
the manifest — which is what lets `dt status` say precisely which source went stale.
|
|
53
|
-
|
|
54
|
-
Consequence: **read the compiled file to know what IS; edit the source to change it.** They
|
|
55
|
-
differ by design, and diffing them is often the fastest way to see what compile decided for you.
|
|
171
|
+
The compiled file is the authored keys, resolved, plus one `compiled:` block holding everything
|
|
172
|
+
compile decided. The order explains most "why does the compiled file say that" questions:
|
|
173
|
+
|
|
174
|
+
1. **Mixins merge in**, in list order — fields before the body field; `storage`, `ids` and
|
|
175
|
+
`display` key by key where the descriptor is silent; `constraints` concatenate.
|
|
176
|
+
2. **Overlays merge onto the base** — new fields before the body, a field the base has merged key
|
|
177
|
+
by key, every other key overlay-wins (`display` per sub-block).
|
|
178
|
+
3. **Names are checked** — every field `display`, `ids.from`, `storage.under.parent` and every
|
|
179
|
+
template names; unknown keys in the closed blocks.
|
|
180
|
+
4. **Storage and fields resolve** — the storage defaults (an `owns_data` module's path prefixed
|
|
181
|
+
with its root); a `format: binary` collection gets `ext` and `bytes` and may declare nothing
|
|
182
|
+
else; titles, `on_delete`, the injected fields; then the validator's JSON Schema, which must
|
|
183
|
+
itself compile, and `ids.pattern`, which must be a valid regex.
|
|
184
|
+
5. **The reference contract**, then **relations** — every `mirror_of` checked against its owner
|
|
185
|
+
across ALL descriptors at once, because a relation spans two files — then placement.
|
|
186
|
+
6. **Bytes dump** to `.dreamteamer/collections/<name>.collection.yaml`. `compiled` holds `defaults`
|
|
187
|
+
(every value compile supplied), `module`, `repo`, `runtime`, `under_collection`, `mirrors`,
|
|
188
|
+
`overlaid_by`, `unresolved_peers`, `fields` (resolved) and `json_schema`.
|
|
189
|
+
|
|
190
|
+
**Read the compiled file to know what IS; edit the source to change it.** `compiled.defaults` is
|
|
191
|
+
the diff between what you wrote and what holds.
|
|
56
192
|
|
|
57
193
|
## the system and field verbs — writes through a compile gate
|
|
58
194
|
|
|
59
|
-
The
|
|
60
|
-
**compile gate**, so a change that would not compile is
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
(the overlay's `extends` names the old id), a collection shipped from `node_modules/`, a taken
|
|
92
|
-
name, and an undeclared target namespace; a refusal leaves nothing half-moved. It deliberately
|
|
93
|
-
does NOT overrule two authored choices: a hand-set `storage.path` (records stay put, and it
|
|
94
|
-
says so) and a `storage.suffix` that is not the singular of the old name.
|
|
95
|
-
- An **empty value removes** in dotted `set-view` writes just as it does in `dt set` — so a
|
|
96
|
-
setting whose meaningful value IS empty (`options.sort: ''`, see `ui-views.md`) is written
|
|
97
|
-
QUOTED, which is what says "the empty string is the value": `'options.sort=""'`.
|
|
195
|
+
The sanctioned way to write schema without hand-editing. Every verb round-trips through a
|
|
196
|
+
**compile gate**, so a change that would not compile is rolled back — and unlike a record write, a
|
|
197
|
+
schema verb **commits its source write itself**. The verbs and flags are `dt help` under "system
|
|
198
|
+
verbs" and "field verbs". What help cannot tell you:
|
|
199
|
+
|
|
200
|
+
- **The field verbs write the OWNING module's descriptor** — the source that declares the
|
|
201
|
+
collection, wherever it sits. `--module <m>` names another module, and the field then lands in an
|
|
202
|
+
`overlay: true` descriptor there, which compiles only when `m` depends on the owner or names the
|
|
203
|
+
collection in `peer_collections`; the refusal prints the `dt set modules/<m> dependencies=…` that
|
|
204
|
+
fixes it. A module installed from `node_modules/` is read-only — overlay it.
|
|
205
|
+
- **`--type <collection>` is a reference**; `--many`, `--enum a,b`, `--mirror-of <field>` (the
|
|
206
|
+
mirror of the `--type` collection's `<field>`) and `--soft` spell the keys above. `add-field`
|
|
207
|
+
inserts before the body field; `set-field` never reorders.
|
|
208
|
+
- **`rm-field` clears the values in the same write and reports the count**, prunes the field from
|
|
209
|
+
its own columns, sort, badge and sections, and **refuses while another position names it** — a
|
|
210
|
+
view, a binding, a template — listing each one.
|
|
211
|
+
- **`rename-field`** rewrites the key in every record and every position that names it — templates,
|
|
212
|
+
`ids.from`, `display`, constraints, `storage.under.parent`, a mirror's `mirror_of`, views and
|
|
213
|
+
bindings — in ONE commit. **`rename-value`** does the same for one enum value.
|
|
214
|
+
- **`dt rename collections/<old> <new>`** moves the descriptor and its overlays, plus the
|
|
215
|
+
records, the filenames and every inbound reference, in ONE commit. It refuses a runtime source,
|
|
216
|
+
a placed collection (`relocate --to-root` first), an overlay that sets `storage`, one shipped
|
|
217
|
+
from `node_modules/`, a taken name and an undeclared target namespace. It keeps a hand-set
|
|
218
|
+
`storage.path` (records stay put, and it says so) and an authored `storage.suffix`.
|
|
219
|
+
- **`dt fmt [<collection>]`** rewrites inline descriptor sources to block style and the canonical
|
|
220
|
+
top-level key order, keeps every comment and the order of `fields`, and commits through the same
|
|
221
|
+
gate; `--dry-run` names the files it would change. A second run changes nothing.
|
|
222
|
+
- **`dt set collections/<c>`** writes `display.list.layout`, `display.record.*` and one layout option
|
|
223
|
+
at a time (`display.list.options.page_size=25`, the value read as JSON where it parses).
|
|
224
|
+
- **An empty value removes** in dotted writes (`dt set ui-views/<id> display.list.sort=`); a
|
|
225
|
+
setting whose meaningful value IS empty is written QUOTED: `'display.list.sort=""'`. A value
|
|
226
|
+
holding `{{ }}` is quoted the same way.
|
|
98
227
|
|
|
99
228
|
## declaring a module
|
|
100
229
|
|
|
101
|
-
A module is a folder under `modules/<
|
|
102
|
-
`"dreamteamer": {}` is enough** — plus the kind folders it ships (`collections/`, `skills/`,
|
|
103
|
-
Without
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
230
|
+
A module is a folder under `modules/<id>/` whose `package.json` carries **a `dreamteamer` key —
|
|
231
|
+
`"dreamteamer": {}` is enough** — plus the kind folders it ships (`collections/`, `skills/`,
|
|
232
|
+
`agents/`, `commands/`, `command-bindings/`, `ui-views/`, `mixins/`). Without the key the folder is
|
|
233
|
+
**silently ignored**; an unknown folder inside is a compile error unless `dreamteamer.ignore`
|
|
234
|
+
lists it. What belongs in a module is judgment — `data-modeling.md` Part III §8. A module's
|
|
235
|
+
`dreamteamer` block reads, for example, `{ "description": "…", "namespaces": ["billing"],
|
|
236
|
+
"dependencies": ["clinic"] }`.
|
|
237
|
+
|
|
238
|
+
| module key | what it holds |
|
|
239
|
+
|---|---|
|
|
240
|
+
| `title` · `description` | what to call the module · what the AREA is for — it heads the module's group in the orientation block |
|
|
241
|
+
| `namespaces` | the namespaces this module owns |
|
|
242
|
+
| `dependencies` | modules this one cannot compile without — an overlay needs its base. Acyclic |
|
|
243
|
+
| `peer_collections` | collections this module references but does not own, which may be absent |
|
|
244
|
+
| `owns_data` | its records live in its own clone, not the workspace's `data/` |
|
|
245
|
+
| `engine` | the engine range it needs; outside it, the module is refused whole |
|
|
246
|
+
| `env` · `vars` | the `.env` keys it needs · the `${env:…}` names its records use (the workspace must allow each) |
|
|
247
|
+
| `extension` · `ignore` · `local_assets` | an extension entry (`extensions.md`) · folders that are not kinds · gitignored files a worktree links |
|
|
107
248
|
|
|
108
249
|
## the workspace manifest — the `dreamteamer` block in `package.json`
|
|
109
250
|
|
|
110
|
-
|
|
111
|
-
|
|
251
|
+
Keys are snake_case and closed: compile refuses an unknown one, naming the list. `dt init` writes
|
|
252
|
+
`workspace_module`, `data_path`, `harnesses`, `git_modules`, `disable` and `gitignore_runtime_folder`.
|
|
112
253
|
|
|
113
|
-
| key | what it holds |
|
|
114
|
-
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `namespaces` |
|
|
118
|
-
| `vars` | the `.env` keys records may reference as `${env:KEY}`
|
|
119
|
-
| `
|
|
120
|
-
| `harnesses` | which coding-agent adapters compile writes
|
|
121
|
-
| `
|
|
122
|
-
| `disable` |
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
254
|
+
| key | what it holds |
|
|
255
|
+
|---|---|
|
|
256
|
+
| `workspace_module` | which module under `modules/` is the workspace's own |
|
|
257
|
+
| `data_path` | where records live, workspace-relative |
|
|
258
|
+
| `namespaces` | namespaces declared at the workspace level (a module's own declaration is the one that travels) |
|
|
259
|
+
| `vars` | the `.env` keys records may reference as `${env:KEY}` (`records.md`) |
|
|
260
|
+
| `auto_commit` | whether a record write also commits (default off) |
|
|
261
|
+
| `harnesses` | which coding-agent adapters compile writes |
|
|
262
|
+
| `git_modules` | the lockfile map `dt install` restores into `git_modules/` |
|
|
263
|
+
| `disable` | what to drop from the compile: `modules/<id>` (a whole module, its code included) or `<kind>/<id>` (one entity) |
|
|
264
|
+
| `local_assets` · `postinstall` · `repos_path` · `gitignore_runtime_folder` | links a worktree gets · a script `dt install` runs · where `repos` records materialise · whether `.dreamteamer/` is gitignored |
|
|
265
|
+
|
|
266
|
+
The workspace's own instructions live in **`DREAMTEAMER.md`** at the root. Compile writes
|
|
267
|
+
`CLAUDE.md`, `AGENTS.md` and `GEMINI.md`: the generated orientation block first, then that file's
|
|
268
|
+
text, each in its own managed block. They are gitignored, so text written into them reaches no
|
|
269
|
+
other clone — edit `DREAMTEAMER.md`.
|
|
127
270
|
|
|
128
271
|
## namespaces — scoping a collection under a folder
|
|
129
272
|
|
|
130
|
-
A collection name may carry a slash-delimited namespace, and it becomes real directory nesting:
|
|
131
|
-
|
|
132
273
|
| declare in the OWNING MODULE's `package.json` | create it | lands in | referenced as |
|
|
133
274
|
|---|---|---|---|
|
|
134
275
|
| `"dreamteamer": {"namespaces": ["health"]}` | `dt add collections --name doctors --module clinic` | `data/health/doctors/` | `health/doctors/dana-levi` |
|
|
135
276
|
|
|
136
|
-
A module declaring exactly ONE namespace **infers** it, and the resolved name is
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
is
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
module's records live — but it made decision 130's own acceptance test, *"a module compiles alone
|
|
153
|
-
in a bare workspace"*, unpassable for any namespaced module: the consuming workspace had to edit
|
|
154
|
-
its manifest first, which is exactly the coupling that rule forbids.
|
|
155
|
-
- **One owner per namespace.** Two modules declaring it is a compile error naming both.
|
|
156
|
-
- **Using another module's namespace requires the dependency** — shipping `hr/<c>` while only
|
|
157
|
-
`hr` declares `hr` means listing `hr` in your `dreamteamer.dependencies`. Without this rule the
|
|
158
|
-
union would let you squat in another module's namespace silently.
|
|
159
|
-
- **A workspace-level declaration a module also declares is a WARNING**, not an error, and
|
|
160
|
-
`dt set modules/<m> namespaces=<ns>` removes the redundant workspace entry in the same write.
|
|
161
|
-
- **The set is a function of the INSTALLED MODULE SET.** Removing or disabling a namespace-owning
|
|
162
|
-
module re-splits every reference into it; `check` reports the dangle, and the compile error says
|
|
163
|
-
the namespace was declared by a module you just removed. `default` stays reserved.
|
|
164
|
-
- `--namespace health --name doctors` and `--name health/doctors` are the same thing. The
|
|
165
|
-
descriptor lands at `collections/health/doctors.collection.yaml` — `collections/` is enumerated
|
|
166
|
-
recursively, so the source tree mirrors the runtime — and the `suffix` comes off the bare name
|
|
167
|
-
(`<id>.doctor.md`).
|
|
168
|
-
- `x-reference: health/doctors`, `disable: "<module>/health/doctors"` and every record verb take
|
|
169
|
-
the QUALIFIED name — it is the collection's identity everywhere. Only its *label* drops the
|
|
170
|
-
prefix: the derived `title` comes from the bare name, because every surface already draws the
|
|
171
|
-
namespace as a folder around it.
|
|
172
|
-
- Nested namespaces work (`work/clients`); the longest declared prefix wins.
|
|
173
|
-
- ⚠ **No collection may store records inside another's folder** — a namespace folder cannot
|
|
174
|
-
itself be a collection root. Compile refuses it, because the outer collection would index the
|
|
175
|
-
inner one's records as its own. The one DECLARED exception is the next section: a collection
|
|
176
|
-
stored under the records of a folder-shape parent, where compile knows exactly which files
|
|
177
|
-
belong to whom.
|
|
277
|
+
A module declaring exactly ONE namespace **infers** it, and the resolved name is echoed. Two or more
|
|
278
|
+
and it refuses to guess: `--namespace health`. `--namespace ''` means none.
|
|
279
|
+
|
|
280
|
+
- **The default namespace is the empty prefix** — `tasks` stays `data/tasks/` and `tasks/kickoff`.
|
|
281
|
+
`default` is RESERVED, so there is never a second spelling for one collection.
|
|
282
|
+
- ⚠ **A namespace must be declared before its collection compiles.** An id is also a slash path, so
|
|
283
|
+
`a/b/c` is ambiguous without the declared set; an undeclared prefix is a compile error.
|
|
284
|
+
- **One owner per namespace** — two modules declaring it is a compile error naming both — and
|
|
285
|
+
**using another module's namespace requires that module in `dependencies`**. The workspace's set
|
|
286
|
+
is the union of every module's plus its own, so it follows the INSTALLED modules: removing a
|
|
287
|
+
namespace-owning module re-splits every reference into it, and compile names the namespace.
|
|
288
|
+
- The descriptor lands at `collections/health/doctors.collection.yaml`; `type: health/doctors`,
|
|
289
|
+
`disable: [collections/health/doctors]` and every record verb take the QUALIFIED name. Only the
|
|
290
|
+
derived `title` drops the prefix. Nested namespaces work; the longest declared prefix wins.
|
|
291
|
+
- ⚠ **No collection may store records inside another's folder.** The one declared exception is
|
|
292
|
+
the next section, where compile knows which files belong to whom.
|
|
178
293
|
|
|
179
294
|
## relationship-based storage — records beside the record they belong to
|
|
180
295
|
|
|
181
|
-
A collection can keep each record INSIDE the folder of
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
296
|
+
A collection can keep each record INSIDE the folder of its parent record, so a browse of
|
|
297
|
+
`data/companies/northwind/` shows the whole account. It is declared on the CHILD:
|
|
298
|
+
|
|
299
|
+
```yaml
|
|
300
|
+
# the parent, companies.collection.yaml — one folder per record
|
|
301
|
+
storage:
|
|
302
|
+
shape: folder
|
|
303
|
+
entry: company.md
|
|
304
|
+
```
|
|
185
305
|
|
|
186
306
|
```yaml
|
|
187
307
|
# modules/default/collections/meetings.collection.yaml
|
|
188
|
-
|
|
308
|
+
name: meetings
|
|
309
|
+
description: One calendar meeting — the event, never the company or the people in it.
|
|
310
|
+
use_when: anything with a date and attendees
|
|
311
|
+
storage:
|
|
312
|
+
under:
|
|
313
|
+
parent: company
|
|
314
|
+
subfolder: meetings
|
|
315
|
+
ids:
|
|
316
|
+
from: '{{ date | date:YYYY/MM }}/{{ name | slug }}'
|
|
317
|
+
pattern: '^\d{4}/\d{2}/[a-z0-9-]+$'
|
|
318
|
+
fields:
|
|
319
|
+
name:
|
|
320
|
+
type: string
|
|
321
|
+
required: true
|
|
322
|
+
description: The calendar title.
|
|
323
|
+
date:
|
|
324
|
+
type: date
|
|
325
|
+
required: true
|
|
326
|
+
description: The day it happens.
|
|
327
|
+
company:
|
|
328
|
+
type: companies
|
|
329
|
+
description: The account it belongs to — also which folder holds the file. Empty keeps it in data/meetings/.
|
|
189
330
|
```
|
|
190
331
|
|
|
191
332
|
```text
|
|
192
|
-
data/companies/northwind/company.md ← the parent: shape
|
|
333
|
+
data/companies/northwind/company.md ← the parent: shape folder, entry company.md
|
|
193
334
|
data/companies/northwind/meetings/2026/10/kickoff.meeting.md ← meetings/2026/10/kickoff, company: companies/northwind
|
|
194
335
|
data/meetings/2026/10/offsite.meeting.md ← meetings/2026/10/offsite, no company: the FALLBACK root
|
|
195
336
|
```
|
|
196
337
|
|
|
197
|
-
- **Still one
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
the
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
children of one parent need two different paths, and a path never equals the parent's entry.
|
|
215
|
-
- **The field is the owner; the folder is observed placement.** A file found under the wrong
|
|
216
|
-
company — moved by hand, or sitting in the fallback root from before the declaration existed — is
|
|
338
|
+
- **Still one collection.** `dt list meetings` is the union of every company folder and the
|
|
339
|
+
fallback root; `dt get meetings/2026/10/kickoff` finds the file wherever it sits; a reference is
|
|
340
|
+
`meetings/<id>` everywhere.
|
|
341
|
+
- **The id is independent of placement** (`under.id: independent`, the default).
|
|
342
|
+
`dt set meetings/<id> company=companies/harbor` MOVES the file and changes nothing else; clearing
|
|
343
|
+
the field moves it back. An id is unique across every root.
|
|
344
|
+
- **`under.id: nested`** makes the id BEGIN with the parent's id, for a collection whose identity
|
|
345
|
+
already leads with it — lab values per patient. Every `ids.from` must open with
|
|
346
|
+
`{{ <parent> | basename }}/`; the file drops that segment because the folder carries it
|
|
347
|
+
(`health/lab-values/dana-levi/2026-07-02--ldl` lives at
|
|
348
|
+
`data/health/patients/dana-levi/labs/2026-07-02--ldl.lab-value.yaml`). A change of parent is a
|
|
349
|
+
`dt rename`, never a `dt set`.
|
|
350
|
+
- **`parent`** is a scalar reference to exactly ONE collection, which must be `shape: folder`.
|
|
351
|
+
**`subfolder`** is a relative folder inside each parent record's folder, never its `entry`.
|
|
352
|
+
- **One level.** A placed collection cannot itself be a parent, and the child is a text record in
|
|
353
|
+
file shape. Two children of one parent need two subfolders.
|
|
354
|
+
- **The field is the owner; the folder is observed placement.** A file under the wrong parent is
|
|
217
355
|
`placed under … but <field> is …` in `check`, which changes nothing. `dt relocate <collection>`
|
|
218
|
-
(or `<collection>/<id>`, `--dry-run` first) moves files to where the
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
every reader seeing them. The order is
|
|
232
|
-
`dt relocate <collection> --to-root` (every placed record back into the collection's own folder,
|
|
233
|
-
ids unchanged, under the still-current declaration) → edit the descriptor → compile → `dt relocate
|
|
234
|
-
<collection>` to place them under the new path. The same order renames a placed collection.
|
|
235
|
-
- **`relocate` refuses before it moves anything**: a dangling or malformed owner field (fix the
|
|
236
|
-
field first — it never makes a folder for a parent that does not exist), an occupied destination,
|
|
237
|
-
a source with unpublished changes, or a destination behind a symlink. One problem refuses the
|
|
238
|
-
whole plan; `--dry-run` reports it.
|
|
239
|
-
- **Inside a parent's folder, only real entries count.** A symlink at a child root, on the way to
|
|
240
|
-
one, or anywhere beneath one — a folder or a file — is never written through and never read as a
|
|
241
|
-
record; `check` names it. The collection's own roots (`data/`, `storage.path`) are not subject to
|
|
242
|
-
this; the rule is about what a record folder may contain.
|
|
243
|
-
- **When NOT to use it.** A record several parents share equally, a record whose owner is usually
|
|
244
|
-
unknown, or a collection nobody browses as a folder — keep conventional storage and a plain
|
|
245
|
-
reference. Folder grouping is a browsing convenience, never a permission boundary.
|
|
246
|
-
|
|
247
|
-
## `templates:` — a live shared field set
|
|
356
|
+
(or `<collection>/<id>`, `--dry-run` first) moves files to where the field puts them, and
|
|
357
|
+
refuses whole on a dangling owner, an occupied destination, an unpublished source or a symlink.
|
|
358
|
+
- **A parent with records inside its folder cannot be removed** — not with `--force` either.
|
|
359
|
+
Renaming it carries the folder and rewrites the children's owner field.
|
|
360
|
+
- **Adopting it on existing data**: make the parent folder shape and `relocate` it; add `under`
|
|
361
|
+
to the child and compile (nothing moves at compile — `check` reports each mismatch); `relocate`
|
|
362
|
+
the child. **Removing or changing it** is the walk backwards — `dt relocate <collection>
|
|
363
|
+
--to-root`, edit, compile, `dt relocate <collection>` — and compile refuses the edit while records
|
|
364
|
+
would be stranded inside parent folders.
|
|
365
|
+
- **When NOT to use it**: a record several parents share equally, an owner usually unknown, a
|
|
366
|
+
collection nobody browses as a folder. It organises files; it grants nothing.
|
|
367
|
+
|
|
368
|
+
## mixins — a live shared field set
|
|
248
369
|
|
|
249
370
|
```yaml
|
|
250
|
-
|
|
251
|
-
|
|
371
|
+
# modules/clinic/mixins/clinic-provenance.mixin.yaml
|
|
372
|
+
name: clinic-provenance
|
|
373
|
+
description: Who made the record, from what, and how much to trust it.
|
|
374
|
+
use_when: every clinic collection an agent may write — list it rather than restating the three fields
|
|
375
|
+
fields:
|
|
376
|
+
author:
|
|
377
|
+
type: string
|
|
378
|
+
description: Which agent made this record. Absent when a person wrote it.
|
|
379
|
+
source:
|
|
380
|
+
type: string
|
|
381
|
+
description: Where the information came from.
|
|
382
|
+
confidence:
|
|
383
|
+
type: string
|
|
384
|
+
default: normal
|
|
385
|
+
enum: [low, normal, high]
|
|
386
|
+
description: How much to trust this record. When low, say why in `source`.
|
|
252
387
|
```
|
|
253
388
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
- **Precedence is template < base < overlay** — a descriptor always wins on a key it declares, so
|
|
258
|
-
a collection can tighten a templated field (add an enum, change a default) without touching the
|
|
259
|
-
template.
|
|
260
|
-
- **The template is a declared SOURCE of every consumer**, so editing it marks them stale and
|
|
261
|
-
`dt status` names them. Without that, the edit would apply to nothing and warn about nothing.
|
|
262
|
-
- **Template properties insert before the `x-body` field** — property order is form order, and a
|
|
263
|
-
record's body belongs last. Template `required` entries union in; other template keys apply
|
|
264
|
-
only where the descriptor is silent.
|
|
265
|
-
- ⚠ **A `templates:` ref must resolve inside the module that ships the descriptor**, or that
|
|
266
|
-
module cannot be installed or copied on its own. This is the single most expensive mistake in
|
|
267
|
-
the project's history: an extracted module whose every descriptor referenced a template living
|
|
268
|
-
in the *consuming* workspace could not compile into a bare workspace at all, and nobody noticed
|
|
269
|
-
for months. A collection-template id is an *identity* entity, so two modules cannot both ship
|
|
270
|
-
`provenance` — scope the id per module (`crm-provenance`).
|
|
271
|
-
- `--template X` at creation copies the fields in once. `templates:` is the live version; prefer
|
|
272
|
-
it for anything you will want to change in one place later.
|
|
273
|
-
|
|
274
|
-
## `extends:` — overlaying another module's collection
|
|
389
|
+
A collection lists it: `mixins: [clinic-provenance]`. A mixin is a partial descriptor — `fields`,
|
|
390
|
+
and `storage`, `ids`, `display`, `constraints` where it says so — merged at every compile (the
|
|
391
|
+
pipeline, step 1), and a declared SOURCE of each consumer, so editing it marks them stale.
|
|
275
392
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
Compile merges `schema.properties` per-property, unions `required`, and takes `storage`/`id` from
|
|
285
|
-
the base unless the overlay explicitly declares them. Two modules extending the same base are
|
|
286
|
-
applied in module-discovery order and the last wins on any shared key — so keep extenders
|
|
287
|
-
**disjoint** and never rely on the collision. Two same-name descriptors where neither declares
|
|
288
|
-
`extends` is a compile error; so is an `extends` value that does not name the actual base.
|
|
393
|
+
- **A descriptor cannot redeclare a mixin's field** — one source per field, a compile error naming
|
|
394
|
+
both. Tighten by writing the field in the descriptor and not listing the mixin, or by a second,
|
|
395
|
+
narrower mixin.
|
|
396
|
+
- ⚠ **A mixin id is global, so list only mixins your own module ships** (or the engine's): a
|
|
397
|
+
collection listing another module's mixin cannot be copied or installed without it, and compile
|
|
398
|
+
will not tell you. Scope the id per module (`clinic-provenance`, not `provenance`). The engine ships two every workspace has: `docs` (title · tags · content, a dated
|
|
399
|
+
id) and `entity` (name · tags · notes, a slug id). `dt add collections --mixins docs` lists one.
|
|
289
400
|
|
|
290
|
-
|
|
401
|
+
## overlays — adding fields to another module's collection
|
|
291
402
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
403
|
+
```yaml
|
|
404
|
+
# modules/billing/collections/health/visits.collection.yaml
|
|
405
|
+
name: health/visits
|
|
406
|
+
overlay: true
|
|
407
|
+
fields:
|
|
408
|
+
claim:
|
|
409
|
+
type: billing/claims
|
|
410
|
+
mirror_of: visit
|
|
411
|
+
description: The claim this visit was billed under. Set `visit` on the claim.
|
|
412
|
+
```
|
|
299
413
|
|
|
300
|
-
|
|
414
|
+
The base is the one source of `health/visits` without `overlay: true`; two bases are a name
|
|
415
|
+
collision. An overlay **compiles only when its module depends on the base's module, or names the
|
|
416
|
+
collection in `peer_collections`** — then it applies while the collection is installed and is
|
|
417
|
+
inert while it is not. The workspace module gets no exemption. Overlays from two modules apply in
|
|
418
|
+
discovery order; keep them **disjoint**. ⚠ **An overlay can add or tighten fields, never remove
|
|
419
|
+
one** — fix the base when the shape is wrong for the module rather than for this workspace.
|
|
301
420
|
|
|
302
|
-
|
|
303
|
-
draws the value. `x-choices` is an OPTIONAL sparse map, keyed by the value, that gives a surface
|
|
304
|
-
more to draw with — a board grouping by the field, a dropdown in a form, anything reading
|
|
305
|
-
`edit_options.choices`.
|
|
421
|
+
## enum maps — what a VALUE looks like
|
|
306
422
|
|
|
307
423
|
```yaml
|
|
308
|
-
|
|
424
|
+
kind:
|
|
309
425
|
type: string
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
label:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
icon: assets/icons/lucide/anchor # … OR a reference to a `codec: file` record
|
|
426
|
+
default: follow-up
|
|
427
|
+
enum:
|
|
428
|
+
intake:
|
|
429
|
+
label: Intake # what a surface shows; the stored value is still `intake`
|
|
430
|
+
icon: person-add
|
|
431
|
+
color: charts.blue # a theme colour id, never a hex
|
|
432
|
+
follow-up:
|
|
433
|
+
label: Follow-up
|
|
434
|
+
urgent: {}
|
|
320
435
|
```
|
|
321
436
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
The two declaration kinds are different on purpose. `dependencies` names MODULES, is hard (the
|
|
347
|
-
target must be installed), and must be acyclic — compile prints the ring when it isn't.
|
|
348
|
-
`peerDependencies` names COLLECTIONS and exists precisely for the ring case: two modules that
|
|
349
|
-
each reference a concept the other owns would be an unbreakable cycle as module deps, and are two
|
|
350
|
-
independent peer declarations instead. A peer that no installed module provides is recorded on
|
|
351
|
-
the compiled descriptor as `unresolved_peers`, so `check` can excuse its dangling references
|
|
352
|
-
without learning what a module is.
|
|
353
|
-
|
|
354
|
-
`x-reference: '*'` (the open-world evidence field) is warned about outside the workspace module —
|
|
355
|
-
an unverifiable cross-module surface — and tolerated inside it, because the workspace is the
|
|
356
|
-
orchestrating parent. A cross-module `x-inverse` needs the dependency declared too, since it
|
|
357
|
-
stamps a field onto the other module's collection.
|
|
437
|
+
A list (`enum: [a, b]`) and a map hold the same value set; the map adds, per value, any of
|
|
438
|
+
`label` · `description` · `icon` · `color` · `background`, each a string — anything else is dropped,
|
|
439
|
+
so a descriptor cannot inject keys into the contract every surface reads. **Map order is band
|
|
440
|
+
order**: a board grouped by the field draws its lanes in it. `icon` names an icon in the surface's
|
|
441
|
+
set, or is a reference to a record of a binary collection (a reference always holds a slash).
|
|
442
|
+
|
|
443
|
+
## the reference contract — references across the module graph
|
|
444
|
+
|
|
445
|
+
Every reference target must be one of: an **engine** collection (the entity kinds plus `repos`) ·
|
|
446
|
+
a collection **owned by this module** · owned by a module in **`dependencies`** · or named in
|
|
447
|
+
**`peer_collections`** — or, for the workspace module, any installed collection. It is judged per
|
|
448
|
+
source: the module whose descriptor or overlay declares the field — or lists the mixin carrying it
|
|
449
|
+
— is the one that declares the target. Anything else fails compile with the fix in the message.
|
|
450
|
+
|
|
451
|
+
`dependencies` names MODULES, is hard and must be acyclic — compile prints the ring.
|
|
452
|
+
`peer_collections` names COLLECTIONS and exists for the ring case: two modules referencing each
|
|
453
|
+
other's concepts are two peer declarations instead. A peer nothing installed provides compiles,
|
|
454
|
+
is recorded in `compiled.unresolved_peers`, and `check` warns once with the count of references it
|
|
455
|
+
cannot resolve rather than failing them.
|
|
456
|
+
|
|
457
|
+
`type: reference` (any collection) is warned about outside the workspace module — an unverifiable
|
|
458
|
+
cross-module surface — and accepted inside it. A `soft: true` reference names its collections and
|
|
459
|
+
tolerates a missing record — for a value that is a declaration ("referred by Dr. X") rather than a
|
|
460
|
+
link the workspace already holds.
|
|
358
461
|
|
|
359
462
|
## registering an existing data folder
|
|
360
463
|
|
|
361
|
-
1. Sample the files: derive `suffix
|
|
362
|
-
|
|
363
|
-
2. Collect frontmatter keys across files → `
|
|
364
|
-
`<collection>/<id>` are
|
|
365
|
-
|
|
366
|
-
3. Point `storage.path` at the folder — an authored path always wins over the derived default;
|
|
367
|
-
this is the first-class case it exists for.
|
|
464
|
+
1. Sample the files: derive `storage.suffix` and `format` from the filenames (`<id>.<suffix>.<ext>`)
|
|
465
|
+
and `ids.pattern` from the id shapes actually present.
|
|
466
|
+
2. Collect frontmatter keys across files → `fields`; infer types from values. Values shaped
|
|
467
|
+
`<collection>/<id>` are reference fields. No frontmatter at all → `fields` with only the body.
|
|
468
|
+
3. Point `storage.path` at the folder — an authored path always wins over the default.
|
|
368
469
|
4. **Never edit the records to fit an inferred schema.** Describe reality, compile, run `check`,
|
|
369
470
|
then decide which violations are worth fixing in the data.
|
|
370
471
|
|
|
@@ -372,62 +473,63 @@ stamps a field onto the other module's collection.
|
|
|
372
473
|
|
|
373
474
|
Widening (a new optional field, a new enum value) is always safe; narrowing (a new required
|
|
374
475
|
field, a removed enum value) needs the data cleaned FIRST — measure, clean, *then* narrow, or
|
|
375
|
-
every later `check` drowns
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
commit message what it did; that message is the only ledger.
|
|
476
|
+
every later `check` drowns. The judgment is `data-modeling.md` Part IX; the mechanics: renames are
|
|
477
|
+
verbs (`rename`, `rename-field`, `rename-value`), and any other shape change across records is a
|
|
478
|
+
**one-shot script you write, run once and commit with the records it rewrote** — there is no
|
|
479
|
+
migration framework. Say in the commit message what it did; that message is the ledger.
|
|
380
480
|
|
|
381
|
-
## the message catalog — what compile
|
|
481
|
+
## the message catalog — what compile and check are telling you
|
|
382
482
|
|
|
383
|
-
Compile fails closed and names its reasons
|
|
384
|
-
collection author actually meets. (⚠ = warning: it compiled, and you should still act.)
|
|
483
|
+
Compile fails closed and names its reasons. (⚠ = warning: it compiled, and you should still act.)
|
|
385
484
|
|
|
386
485
|
| the message says | it means | the move |
|
|
387
486
|
|---|---|---|
|
|
388
|
-
| `
|
|
389
|
-
| `
|
|
390
|
-
| `
|
|
391
|
-
|
|
|
392
|
-
| `
|
|
393
|
-
|
|
|
394
|
-
| `
|
|
395
|
-
| `
|
|
396
|
-
| `
|
|
397
|
-
| `
|
|
398
|
-
| `
|
|
399
|
-
| `
|
|
400
|
-
| `
|
|
401
|
-
|
|
|
402
|
-
|
|
|
403
|
-
|
|
|
404
|
-
| ⚠ `
|
|
405
|
-
| ⚠ `
|
|
406
|
-
| ⚠ `
|
|
407
|
-
| ⚠ `
|
|
408
|
-
|
|
409
|
-
`
|
|
487
|
+
| `source(s) are in the v1 descriptor format` | a source in the format this engine does not read | run the converter it names; `UPDATING.md` has the walk |
|
|
488
|
+
| `unknown key … — a descriptor's keys are …` (or a field's, a storage's, a display's) | the closed lists | fix the key; the message lists the legal ones |
|
|
489
|
+
| `name collision on collection "<c>"` | two bases — a second source must be an overlay | `overlay: true`, or rename |
|
|
490
|
+
| `name collision on <kind> "<id>"` | two modules ship one entity — never merged | rename yours, or add `<kind>/<id>` to `dreamteamer.disable` |
|
|
491
|
+
| `every source declares overlay: true — no base found` | the base's module is not installed | install it, or declare the collection in `peer_collections` |
|
|
492
|
+
| `an overlay of "<c>", but module "<m>" neither depends on … nor declares …` | the overlay gate, the field verbs' `--module` included | `dt set modules/<m> dependencies=modules/<owner>` |
|
|
493
|
+
| `references "X", which module … neither owns nor declares` | the reference contract | add the dependency or the peer, as printed |
|
|
494
|
+
| `cyclic module dependencies: a → b → a` | concept links declared as module deps | move one to `peer_collections` |
|
|
495
|
+
| `has folder(s) that are not a known kind` | a typo'd kind, or a package folder | fix the name, or list it in `dreamteamer.ignore` |
|
|
496
|
+
| `display.list.columns names "x", which is not a field` (or sort, badge, sections…) | a name that does not exist | fix it — the message names the position |
|
|
497
|
+
| `record_title opens with "<f>", a <type> field` | `dt add "<title>"` fills the first token | open it with a string field |
|
|
498
|
+
| `is a SCALAR mirror, so <owner>.<f> must be a unique scalar reference` | one-to-one needs `unique: true` on the foreign key | declare it, or make the mirror `many` |
|
|
499
|
+
| `is a mirror, but <c> declares no body field` (or is binary, runtime, another repo) | the target cannot hold a generated field | add a body field, or drop the mirror |
|
|
500
|
+
| `every ids.from template must open with {{ <parent> \| basename }}/` | `under.id: nested` | lead the id with the parent |
|
|
501
|
+
| `internal: true is reserved` | a module put a domain collection in the plumbing partition | drop the line |
|
|
502
|
+
| `module X needs engine "…"` | its `engine` range excludes this engine; refused whole | upgrade dreamteamer, or disable it |
|
|
503
|
+
| ⚠ `"<name>" is not a plural the inflector knows` | `singular` falls back to the name | set `singular` (and `storage.suffix`) if `dt add` should take another word |
|
|
504
|
+
| ⚠ `field "<f>": names are snake_case` · `enum value "<v>" is not kebab-case` | a convention, not a rule — a rename is a record change | `dt rename-field` · `dt rename-value` when you choose |
|
|
505
|
+
| ⚠ `is type: reference outside the workspace module` | an unverifiable cross-module surface | name the collections it may target |
|
|
506
|
+
| ⚠ `has no description` · `use_when restates its description` | the orientation block renders a bare name, or the same words twice | write the sentence (`data-modeling.md` §18) |
|
|
507
|
+
| ⚠ `module X reads ${env:NAME} — add it to the workspace's dreamteamer.vars` | a module requests a var the workspace has not allowed | add the name to `dreamteamer.vars` |
|
|
508
|
+
| ⚠ `module X: <channel> copy shadows <channel> copy` | one module delivered twice — the more local wins | intended for dev; otherwise remove one |
|
|
509
|
+
|
|
510
|
+
`check` reports, and never modifies:
|
|
410
511
|
|
|
411
512
|
| check reports | it means | the move |
|
|
412
513
|
|---|---|---|
|
|
413
|
-
| `<field>: stale
|
|
414
|
-
|
|
|
415
|
-
|
|
|
416
|
-
|
|
|
514
|
+
| `<field>: stale — run: dreamteamer relations rebuild <c>` | a mirror fell behind its owner — usually a hand edit | run it |
|
|
515
|
+
| `dangling reference "…" — no such record` | a deleted or hand-renamed target, or a typo | fix the ref, restore the target, or `dt rename` properly |
|
|
516
|
+
| `<field>: "<v>" is already taken by <c>/<id> (unique)` | two records claim one unique value | decide which is real; change the other |
|
|
517
|
+
| `placed under … but <field> is …` | a file in the wrong parent folder | `dt relocate <c>/<id>` |
|
|
518
|
+
| ⚠ `peer collection "<c>" is declared but not installed` | references into an absent peer, counted | expected when the module runs alone |
|
|
519
|
+
| a FLOOD of enum or required violations right after a schema change | the schema narrowed before the data was cleaned | widen back, clean, then narrow |
|
|
417
520
|
|
|
418
521
|
*(one failure has no message: a module folder whose `package.json` lacks a `dreamteamer` key is
|
|
419
|
-
silently not discovered
|
|
522
|
+
silently not discovered.)*
|
|
420
523
|
|
|
421
524
|
## common mistakes
|
|
422
525
|
|
|
423
526
|
| mistake | reality |
|
|
424
527
|
|---|---|
|
|
425
|
-
| editing the compiled descriptor
|
|
426
|
-
|
|
|
427
|
-
| a
|
|
428
|
-
| a
|
|
429
|
-
| a `
|
|
430
|
-
|
|
|
431
|
-
|
|
|
432
|
-
| hand-editing schema when a schema verb could express it | the verbs are compile-gated and commit their write; a hand edit can land uncompilable and sit unpublished |
|
|
528
|
+
| editing the compiled descriptor | `.dreamteamer/` is generated — edit the module source and compile |
|
|
529
|
+
| a second same-name descriptor without `overlay: true` | a name collision, by design |
|
|
530
|
+
| a plain string where a reference belongs | `type: <collection>` lets `check` and `rename` follow it |
|
|
531
|
+
| a `mixins:` id another module ships | that module can no longer be copied or installed alone |
|
|
532
|
+
| a `--module` field verb retried verbatim after the overlay refusal | declare the dependency it prints, or let the verb write the owning module |
|
|
533
|
+
| authored `singular` expecting the filenames to follow | `storage.suffix` is separate — set both |
|
|
534
|
+
| `storage.path` under an entity-kind name | it compiles as a runtime collection and becomes unwritable |
|
|
433
535
|
| ignoring a ⚠ because compile said ✔ | every warning above is a defect with a deferred bill |
|