dreamteamer 0.40.0 → 0.42.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/bin/dreamteamer.js +67 -12
- package/package.json +1 -1
- package/skills/using-dreamteamer/SKILL.md +37 -4
- package/skills/using-dreamteamer/references/changes.md +44 -25
- package/skills/using-dreamteamer/references/collections.md +38 -12
- package/skills/using-dreamteamer/references/extensions.md +1 -0
- package/skills/using-dreamteamer/references/records.md +1 -1
- package/skills/using-dreamteamer/references/ui-views.md +20 -0
- package/src/api.d.ts +6 -1
- package/src/api.js +2 -2
- package/src/check.js +43 -23
- package/src/cli.js +68 -38
- package/src/collections-cli.js +49 -14
- package/src/commit.js +38 -1
- package/src/compile-collections.js +56 -8
- package/src/compile.js +76 -32
- package/src/events.js +65 -0
- package/src/extensions.js +26 -4
- package/src/fields.js +8 -2
- package/src/harnesses.js +3 -0
- package/src/records.js +25 -0
- package/src/schema-ops.js +142 -12
- package/src/store.js +69 -10
- package/src/views.js +30 -0
- package/src/workspace.js +36 -0
package/bin/dreamteamer.js
CHANGED
|
@@ -13,7 +13,8 @@ const MODULE_SEGMENTS = new Set(['node_modules', 'git_modules', 'modules']);
|
|
|
13
13
|
|
|
14
14
|
const self = fileURLToPath(import.meta.url);
|
|
15
15
|
|
|
16
|
-
// `--
|
|
16
|
+
// `--workspace <name-or-path>` / `-w` — run the verb in ANOTHER workspace without leaving this one
|
|
17
|
+
// (`--vault <path>` is its pre-0.41.0 spelling, kept as a silent alias). Consumed HERE, before
|
|
17
18
|
// anything else resolves, because every verb downstream answers "which workspace am I in" from
|
|
18
19
|
// process.cwd(): changing the directory once IS the whole implementation, and it also points the
|
|
19
20
|
// dev-clone walk below at the TARGET's git_modules rather than the caller's.
|
|
@@ -22,22 +23,46 @@ const self = fileURLToPath(import.meta.url);
|
|
|
22
23
|
// branch re-enters this same file, and a flag left in place would be applied a SECOND time — the
|
|
23
24
|
// path resolving against the already-changed directory, i.e. at the wrong workspace, silently.
|
|
24
25
|
//
|
|
25
|
-
//
|
|
26
|
-
// relative path in the command then resolves against the target — the
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// A PATH resolves against the INVOKING directory, which is where the caller typed it; every other
|
|
27
|
+
// relative path in the command then resolves against the target — the rule a `cd` would give. A NAME
|
|
28
|
+
// with no such directory is a record layer this workspace DECLARES (`dreamteamer.git_modules`), and
|
|
29
|
+
// resolves to `git_modules/<name>` — the precedent is `npm -w <name-or-path>`. The target is PINNED
|
|
30
|
+
// for this process only: a clone under git_modules/ is otherwise climbed out of by discovery, which
|
|
31
|
+
// would run the verb in the workspace AROUND it — a write landing in the reader and printing ✔.
|
|
32
|
+
// `--workspace=<x>` (npm's spelling too) is the same flag in one argument.
|
|
33
|
+
const flagAt = process.argv.findIndex((a, i) => i >= 2 && /^(--workspace|-w|--vault)(=|$)/.test(a));
|
|
34
|
+
if (flagAt !== -1) {
|
|
35
|
+
const [flagWord, inline] = process.argv[flagAt].split(/=(.*)/s);
|
|
36
|
+
const flag = flagWord === '--vault' ? '--vault' : '--workspace';
|
|
37
|
+
const joined = inline !== undefined;
|
|
38
|
+
const target = joined ? inline : process.argv[flagAt + 1];
|
|
30
39
|
if (!target || target.startsWith('-')) {
|
|
31
|
-
console.error('
|
|
40
|
+
console.error(flag === '--vault'
|
|
41
|
+
? '\u2716 --vault needs a path to a workspace, e.g. `--vault ../another-workspace`'
|
|
42
|
+
: '\u2716 --workspace needs a layer name or a path, e.g. `-w project-alpha` or `-w ../another-workspace`');
|
|
32
43
|
process.exit(1);
|
|
33
44
|
}
|
|
34
|
-
const
|
|
45
|
+
const refuse = (why) => { console.error(`\u2716 ${flag} ${target} \u2014 ${why}`); process.exit(1); };
|
|
46
|
+
let resolved = path.resolve(process.cwd(), target);
|
|
35
47
|
if (!fs.existsSync(resolved)) {
|
|
36
|
-
|
|
37
|
-
process.
|
|
48
|
+
// a NAME: only a record layer this workspace declares — a bundle is modules, not a workspace
|
|
49
|
+
const here = findWorkspaceRoot(process.cwd());
|
|
50
|
+
const layers = here ? declaredLayers(here) : new Map();
|
|
51
|
+
if (/[\\/]/.test(target) || !layers.has(target)) refuse(`no such directory, and no layer of that name is declared here (declared layers: ${[...layers].filter(([, k]) => k === 'layer').map(([n]) => n).join(', ') || 'none'})`);
|
|
52
|
+
resolved = path.join(here, 'git_modules', target);
|
|
53
|
+
if (layers.get(target) === 'bundle') refuse(`git_modules/${target} is a bundle (its package.json names no workspace_module), not a workspace — there is nothing to run a verb in`);
|
|
54
|
+
if (!fs.existsSync(resolved)) refuse(`the layer is declared but not installed (${resolved}); run dreamteamer install`);
|
|
38
55
|
}
|
|
56
|
+
// the TARGET must be a workspace root: a plain folder (one that merely shares a layer's name, say)
|
|
57
|
+
// would be pinned, discovery would climb out of it, and the verb would run in the workspace around it
|
|
58
|
+
if (!isWorkspaceDir(resolved)) refuse(`${resolved} is not a workspace (no package.json with a "dreamteamer" section)`);
|
|
39
59
|
process.chdir(resolved);
|
|
40
|
-
|
|
60
|
+
// PROCESS-LOCAL, never an environment variable: the one reader that needs it is the dev-clone
|
|
61
|
+
// re-exec below, an `import()` into this same process. An env var reached every child — git hooks,
|
|
62
|
+
// an extension spawning dt — and a dt run inside the clone by any of them answered from the layer
|
|
63
|
+
// alone instead of the reader's union.
|
|
64
|
+
globalThis[Symbol.for('dreamteamer.workspace')] = process.cwd(); // the physical path, as discovery will see it
|
|
65
|
+
process.argv.splice(flagAt, joined ? 1 : 2);
|
|
41
66
|
}
|
|
42
67
|
|
|
43
68
|
const devBin = findDevClone(process.cwd());
|
|
@@ -67,7 +92,7 @@ function realpath(p) {
|
|
|
67
92
|
// same workspace rule as src/workspace.js (nearest package.json with a `dreamteamer` key, climbing
|
|
68
93
|
// out only of module nesting), duplicated here because the dev clone must be found BEFORE choosing
|
|
69
94
|
// which src/ to load. Keep the two in step — they must never disagree about which workspace this is.
|
|
70
|
-
function
|
|
95
|
+
function findWorkspaceRoot(start) {
|
|
71
96
|
let dir = path.resolve(start);
|
|
72
97
|
const candidates = []; // nearest → topmost
|
|
73
98
|
while (true) {
|
|
@@ -84,10 +109,40 @@ function findDevClone(start) {
|
|
|
84
109
|
if (!candidates.length) return null;
|
|
85
110
|
let workspace = candidates[0];
|
|
86
111
|
for (const higher of candidates.slice(1)) {
|
|
112
|
+
if (workspace === globalThis[Symbol.for('dreamteamer.workspace')]) break; // an explicitly targeted workspace is never climbed out of
|
|
87
113
|
const viaModule = path.relative(higher, workspace).split(path.sep).some((seg) => MODULE_SEGMENTS.has(seg));
|
|
88
114
|
if (!viaModule) break;
|
|
89
115
|
workspace = higher;
|
|
90
116
|
}
|
|
117
|
+
return workspace;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Does a directory's package.json carry a `dreamteamer` section — is it a workspace (or module) root? */
|
|
121
|
+
function isWorkspaceDir(dir) {
|
|
122
|
+
try { return 'dreamteamer' in JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')); } catch { return false; }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/** The git_modules entries a workspace declares, name -> 'layer' | 'bundle' — the rule of
|
|
126
|
+
* src/workspace.js layerEntries, restated because this file runs before any src/ is chosen: `records`
|
|
127
|
+
* or `module: true` declares a layer, a clone on disk is a layer when its manifest names
|
|
128
|
+
* `workspace_module`, and one not on disk is a layer not installed. */
|
|
129
|
+
function declaredLayers(root) {
|
|
130
|
+
const out = new Map();
|
|
131
|
+
let entries = {};
|
|
132
|
+
try { entries = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).dreamteamer?.git_modules ?? {}; } catch { /* none */ }
|
|
133
|
+
for (const [name, e] of Object.entries(entries)) {
|
|
134
|
+
const clone = path.join(root, 'git_modules', name);
|
|
135
|
+
let wm = null;
|
|
136
|
+
try { wm = JSON.parse(fs.readFileSync(path.join(clone, 'package.json'), 'utf8')).dreamteamer?.workspace_module ?? null; } catch { /* absent */ }
|
|
137
|
+
const layer = e?.records !== undefined || e?.module === true || !fs.existsSync(clone) || !!wm;
|
|
138
|
+
out.set(name, layer ? 'layer' : 'bundle');
|
|
139
|
+
}
|
|
140
|
+
return out;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function findDevClone(start) {
|
|
144
|
+
const workspace = findWorkspaceRoot(start);
|
|
145
|
+
if (!workspace) return null;
|
|
91
146
|
const bin = path.join(workspace, 'git_modules', 'dreamteamer', 'bin', 'dreamteamer.js');
|
|
92
147
|
return fs.existsSync(bin) ? bin : null;
|
|
93
148
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreamteamer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.42.0",
|
|
4
4
|
"description": "A workspace compiler for coding agents — schema-validated records as plain files over git, compiled into every harness",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Gilad Khen <giladkhen@gmail.com>",
|
|
@@ -91,13 +91,46 @@ the primary workspace's, whoever shipped the skill you are reading.
|
|
|
91
91
|
|
|
92
92
|
- **start a session in the workspace it is about.** it is the only thing that loads that workspace's
|
|
93
93
|
instructions, and it settles name collisions in its favour.
|
|
94
|
-
- **to touch another workspace from here,
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
- **to touch another workspace from here, `-w <name|path>` (`--workspace`) — not `cd`.** a record
|
|
95
|
+
layer is named by its git_modules name (`-w project-alpha`), any other workspace by path. the flag
|
|
96
|
+
resolves the target's schema, validates and commits there, and leaves the working directory alone;
|
|
97
|
+
a `cd` outlives the command. (`--vault <path>` is the deprecated spelling.)
|
|
97
98
|
- **every record write prints the workspace it landed in** — `✔ <workspace> · <path>`. a write to
|
|
98
99
|
the wrong workspace passes validation, because the collection usually exists in both, so that line
|
|
99
100
|
is what distinguishes them.
|
|
100
101
|
|
|
102
|
+
## a reply that wrote records ends with the record report
|
|
103
|
+
|
|
104
|
+
a write prints one `✔` line into a tool result the operator does not read. so any reply that
|
|
105
|
+
follows a write — a record verb, `dt commit`, a system verb, a script that called them, a
|
|
106
|
+
hand-edited record — ENDS with the record report, and nothing written, nothing appended.
|
|
107
|
+
|
|
108
|
+
**measure it, never recall it.** run `dt changes` before replying: it lists what is written and
|
|
109
|
+
not committed, in this workspace and every record layer it reads. if you committed during the turn,
|
|
110
|
+
`dt changes --since <the sha HEAD had before your first write>` (or fold what `dt commit` printed —
|
|
111
|
+
the same block). the report, for a turn that added a contact, set two, removed a meeting and added
|
|
112
|
+
an issue with `-w project-a`:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
records — contacts: 1 created, 2 updated · issues (project-a): 1 created · meetings: 1 deleted
|
|
116
|
+
[contacts/sam-diaz](data/contacts/sam-diaz.contact.md) (created) · [contacts/dana-oren](data/contacts/dana-oren.contact.md) (updated) · [contacts/harbor-mutual-desk](data/contacts/harbor-mutual-desk.contact.md) (updated) · [issues/login-times-out](git_modules/project-a/data/issues/login-times-out.issue.md) (created) · meetings/kickoff (deleted)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- **line one is `dt changes`'s first line, verbatim**: one entry per collection touched, counts per
|
|
120
|
+
verb; a write into a record layer shows as `<collection> (<layer>)`.
|
|
121
|
+
- **then every record as a link** — `[<ref>](<path>)`, the path column `dt changes` prints, which is
|
|
122
|
+
relative to the workspace root (a layer's record too) so the editor opens it. a deleted record has
|
|
123
|
+
no file: write its ref with `(deleted)`, unlinked. past twenty records, say `+ N more` and
|
|
124
|
+
point at `dt changes --json`.
|
|
125
|
+
- **measured, not attributed.** `dt changes` measures the shared state exactly but cannot say
|
|
126
|
+
whose: another session's pending records show too. a turn that committed by id reports
|
|
127
|
+
`dt commit`'s block unchanged — that IS this turn's writes, measured. otherwise report
|
|
128
|
+
`dt changes` whole; when you leave out rows that were pending before your first write, append
|
|
129
|
+
`(N pending rows left out — not this turn's)` and never drop a row silently. line one is verbatim
|
|
130
|
+
when every row is yours.
|
|
131
|
+
- **nothing written, nothing appended** — no empty report, no "no records changed" line. a system
|
|
132
|
+
write (`dt add-field` …) is reported the same way under its collection.
|
|
133
|
+
|
|
101
134
|
## two acts, one map
|
|
102
135
|
|
|
103
136
|
Act one is **working with data** — the records themselves. Act two is **modeling the workspace**
|
|
@@ -108,7 +141,7 @@ Load by the map; nothing here is loaded "just in case".
|
|
|
108
141
|
|---|---|
|
|
109
142
|
| a brand-new or empty workspace, dreamteamer over an existing pile of files, "help me set this up" | `references/getting-started.md` |
|
|
110
143
|
| read, create, update, rename, delete, commit — or UNDO — a record | `references/records.md` |
|
|
111
|
-
| "what changed while I was away" | `references/changes.md` |
|
|
144
|
+
| "what changed while I was away", what this turn changed, the record report | `references/changes.md` |
|
|
112
145
|
| the workspace seems unable to do something — a new kind of thing, a missing capability, "don't we already have this?" | `references/before-you-build.md` (look first); a new model then continues `references/data-modeling.md` (decide) → `references/collections.md` (write it) |
|
|
113
146
|
| a collection or field, mechanically — the descriptor and its field vocabulary, ids, `display`, the system and field verbs, mixins and overlays, the `package.json` block, a compile or check message | `references/collections.md` |
|
|
114
147
|
| "keep a company's meetings in the company's folder" — records stored beside the record they belong to, a `placed … but` check report, `dt relocate` | `references/collections.md` (declaring it) · `references/records.md` (working with it) |
|
|
@@ -1,41 +1,56 @@
|
|
|
1
|
-
# what changed —
|
|
1
|
+
# what changed — the uncommitted state and the commits, per record
|
|
2
2
|
|
|
3
|
-
**core principle:** record
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
**core principle:** record changes are never observed live — they are **read off git**: the
|
|
4
|
+
working tree against HEAD for what is written and not committed, and the history for what was
|
|
5
|
+
committed. a closed laptop loses nothing, every answer is auditable and replayable, and history IS
|
|
6
|
+
the queue: there is no events file, no mark file and no cursor, and there never should be.
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
|
-
dt changes # what
|
|
9
|
-
dt changes --since <sha|YYYY-MM-DD>
|
|
9
|
+
dt changes # what is written and not committed — every repo, each against its own HEAD
|
|
10
|
+
dt changes --since <sha|YYYY-MM-DD> # everything since then: the commits AND the uncommitted state
|
|
11
|
+
dt changes --since HEAD~1 # what 0.41.0's bare `dt changes` answered: the last commit, plus anything pending
|
|
10
12
|
dt changes --json
|
|
13
|
+
dt changes -w <layer> # the same, run IN a record layer (its own paths, its own HEAD)
|
|
11
14
|
```
|
|
12
15
|
|
|
13
|
-
per record it reports
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
+
per record it reports `change` — `created` / `updated` / `deleted` — the `ref`, the
|
|
17
|
+
workspace-relative `path`, the `repo` it lives in, the record `layer` it was read from (empty for
|
|
18
|
+
the workspace and for a module's own clone) and whether it is `committed`. the human output's FIRST
|
|
19
|
+
LINE is the report line a reply ends with (`SKILL.md`, "a reply that wrote records ends with the
|
|
20
|
+
record report"), then one row per record, then the count. `dt commit` prints the same block for
|
|
21
|
+
what it just published. **read-only by construction** — nothing stored, so running it twice is free
|
|
22
|
+
and running it wrong costs nothing.
|
|
23
|
+
|
|
24
|
+
`--json` is `{ since, head, events, collections }`: `events` one entry per record (carrying 0.41.0's
|
|
25
|
+
`type` — `item-added` / `item-updated` / `item-removed` — beside `change`, so an older reader keeps
|
|
26
|
+
working), `collections` one count row per collection and layer.
|
|
16
27
|
|
|
17
28
|
## when to use
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
a bulk rewrite; you want to know what a range
|
|
21
|
-
"show me the diff" questions — plain `git log` /
|
|
22
|
-
|
|
23
|
-
pending records are invisible to it (`dt commit --dry-run` shows those).
|
|
30
|
+
before replying after any write (the record report); the operator asks what changed or what they
|
|
31
|
+
missed; you are reconciling after a batch of edits or a bulk rewrite; you want to know what a range
|
|
32
|
+
of commits did to the *data*. **not for** ordinary "show me the diff" questions — plain `git log` /
|
|
33
|
+
`git diff` is better — and not for reading or writing individual records (`records.md`).
|
|
24
34
|
|
|
25
35
|
## the mechanism — enough to trust its edges
|
|
26
36
|
|
|
27
|
-
1. it covers **every repo that holds records**: each compiled descriptor's
|
|
28
|
-
grouped per repo (a module can own its records). a changed path that
|
|
29
|
-
**skipped** — source and runtime churn are not data events — and
|
|
30
|
-
appear.
|
|
31
|
-
2.
|
|
37
|
+
1. it covers **every repo that holds records**: each compiled descriptor's roots — the write root
|
|
38
|
+
and every record layer's — grouped per repo (a module can own its records). a changed path that
|
|
39
|
+
matches no descriptor is **skipped** — source and runtime churn are not data events — and
|
|
40
|
+
runtime entities never appear.
|
|
41
|
+
2. the uncommitted half is the same `git status` sample `dt commit` publishes from and `dt status`
|
|
42
|
+
counts, so the three can never disagree. it cannot say WHICH SESSION wrote a pending record —
|
|
43
|
+
git does not know — which is why the report rule says to keep only your own.
|
|
44
|
+
3. `--since` takes a sha or a date. a sha is resolved to its commit DATE in the workspace repo
|
|
32
45
|
(a sha means nothing in another repo), and each repo then resolves that date against its own
|
|
33
|
-
history; a repo younger than the date reports everything in it as
|
|
46
|
+
history; a repo younger than the date reports everything in it as created. ⚠ a bare date is
|
|
34
47
|
pinned to **midnight** deliberately — git's own approxidate fills missing fields from the
|
|
35
48
|
current clock, so the same command would answer differently morning and evening (measured).
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
49
|
+
4. the two halves fold per record: created then deleted inside the window is not reported (it
|
|
50
|
+
existed at neither end); created then edited is still created; deleted then re-created is an
|
|
51
|
+
update; a record moved inside one repo (`dt relocate`) is one update at its new path.
|
|
52
|
+
5. **a rename is deleted + created** — there is deliberately no `renamed`, because the id IS the
|
|
53
|
+
path and a moved record is a different record to any consumer.
|
|
39
54
|
|
|
40
55
|
## if you are ever asked to automate on top of this
|
|
41
56
|
|
|
@@ -43,13 +58,17 @@ this derivation is the surviving half of a removed automation layer (its run-rec
|
|
|
43
58
|
one workflow, nine runs, seven abandoned, in three days). the lessons it left: **never store an
|
|
44
59
|
event queue** — a queue drifts from reality, history cannot; make every evaluator **idempotent
|
|
45
60
|
over a range** (the old design keyed on `trigger + item + commit` — reuse that shape); and **a
|
|
46
|
-
migration is not a data event** — a bulk rewrite looks like N
|
|
61
|
+
migration is not a data event** — a bulk rewrite looks like N created records, so scope past it
|
|
47
62
|
rather than run over it.
|
|
48
63
|
|
|
49
64
|
## common mistakes
|
|
50
65
|
|
|
51
66
|
| mistake | reality |
|
|
52
67
|
|---|---|
|
|
53
|
-
|
|
|
68
|
+
| writing the record report from memory of your `✔` lines | `dt changes` measures it; memory misses a script's writes and a hand-edit |
|
|
69
|
+
| reporting every row `dt changes` prints | the uncommitted state is shared with other sessions — keep only your own writes |
|
|
70
|
+
| an empty report when nothing was written | nothing written, nothing appended |
|
|
71
|
+
| expecting bare `dt changes` to show the last commit | since 0.42.0 it is the uncommitted state; `--since HEAD~1` adds the last commit |
|
|
72
|
+
| hand-rolling the diff + path mapping | `dt changes` is the mechanism; a hand-roll misses folder-shape records, layers, per-repo HEADs and the rename split |
|
|
54
73
|
| writing an events file to "remember" what changed | history is the record; anything you write can drift from it |
|
|
55
74
|
| reading the output as a to-do list | it says what changed, not what it means — the judgment is yours |
|
|
@@ -249,6 +249,10 @@ lists it. What belongs in a module is judgment — `data-modeling.md` Part III
|
|
|
249
249
|
| `env` · `vars` | the `.env` keys it needs · the `${env:…}` names its records use (the workspace must allow each) |
|
|
250
250
|
| `extension` · `ignore` · `local_assets` | an extension entry (`extensions.md`) · folders that are not kinds · gitignored files a worktree links |
|
|
251
251
|
|
|
252
|
+
A version floor on another module is not a key of this block: it is npm's own peer-dependency range,
|
|
253
|
+
at the top level of the module's package.json. A present module outside the range fails compile,
|
|
254
|
+
naming both versions and the fix.
|
|
255
|
+
|
|
252
256
|
## the workspace manifest — the `dreamteamer` block in `package.json`
|
|
253
257
|
|
|
254
258
|
Keys are snake_case and closed: compile refuses an unknown one, naming the list. `dt init` writes
|
|
@@ -262,7 +266,7 @@ Keys are snake_case and closed: compile refuses an unknown one, naming the list.
|
|
|
262
266
|
| `vars` | the `.env` keys records may reference as `${env:KEY}` (`records.md`) |
|
|
263
267
|
| `auto_commit` | whether a record write also commits (default off) |
|
|
264
268
|
| `harnesses` | which coding-agent adapters compile writes |
|
|
265
|
-
| `git_modules` | the lockfile map `dt install` restores into `git_modules/` — `{ url, ref }` per clone;
|
|
269
|
+
| `git_modules` | the lockfile map `dt install` restores into `git_modules/` — `{ url, ref }` per clone; a clone whose own package.json names `workspace_module` is a RECORD LAYER (below), not a bundle, and `records: [<collection>…]` narrows it (or makes any clone a layer) — `module: true` adds its one workspace module |
|
|
266
270
|
| `disable` | what to drop from the compile: `modules/<id>` (a whole module, its code included) or `<kind>/<id>` (one entity) |
|
|
267
271
|
| `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 |
|
|
268
272
|
|
|
@@ -420,17 +424,25 @@ storage:
|
|
|
420
424
|
|
|
421
425
|
Several workspaces install one module for their shared shapes — an HQ and the projects it oversees
|
|
422
426
|
all take `tasks` from the same package — while each keeps its own task RECORDS in its own repo. The
|
|
423
|
-
HQ reads the projects' records by cloning each project under `git_modules
|
|
424
|
-
entry, which collections that clone contributes:
|
|
427
|
+
HQ reads the projects' records by cloning each project under `git_modules/`:
|
|
425
428
|
|
|
426
429
|
```json
|
|
427
430
|
"git_modules": {
|
|
428
431
|
"org": { "url": "…", "ref": "main" },
|
|
429
|
-
"project-alpha": { "url": "…", "ref": "main", "
|
|
432
|
+
"project-alpha": { "url": "…", "ref": "main", "module": true },
|
|
433
|
+
"project-beta": { "url": "…", "ref": "main", "records": ["tasks", "projects"] }
|
|
430
434
|
}
|
|
431
435
|
```
|
|
432
436
|
|
|
433
|
-
- **
|
|
437
|
+
- **What the CLONE is decides it (0.41.0).** A clone whose own package.json names
|
|
438
|
+
`dreamteamer.workspace_module` is a workspace, so it is a layer: every collection both workspaces
|
|
439
|
+
have reads its data folder. A clone that names none is a bundle, and its `modules/` unpack as
|
|
440
|
+
before. `records:` is optional and NARROWS — only the listed collections are read — and it still
|
|
441
|
+
makes any clone a layer. A collection that cannot layer (below) is skipped with an `ℹ` when the
|
|
442
|
+
clone holds files for it; a data folder no collection here accounts for (a project's own domain
|
|
443
|
+
collections, read without their module) is a compile warning naming the folder and its file
|
|
444
|
+
count, never a failure.
|
|
445
|
+
- **A layer is never a bundle.** Its own `modules/` is not unpacked and it
|
|
434
446
|
is not an extension; the shapes are the modules both workspaces install. Its nested
|
|
435
447
|
`git_modules/` are never read.
|
|
436
448
|
- **`module: true` also compiles the clone's WORKSPACE module** — `modules/<workspace_module>`, as
|
|
@@ -441,14 +453,26 @@ entry, which collections that clone contributes:
|
|
|
441
453
|
extension entry in it is not loaded), and the records half is unchanged. Compile refuses, naming
|
|
442
454
|
the entry: a clone with no `workspace_module`; a module whose id is `default` (the role name every
|
|
443
455
|
workspace's own module carries — name the project's module after the project); an id another
|
|
444
|
-
module here already holds
|
|
445
|
-
|
|
446
|
-
- **Each listed collection gains the clone's data folder as a read root below the workspace's
|
|
456
|
+
module here already holds. `dt status` adds `· module <id>` to the layer's line.
|
|
457
|
+
- **Each layered collection gains the clone's data folder as a read root below the workspace's
|
|
447
458
|
own** — the compiled descriptor states them as `compiled.layers`, and `storageOf(d).roots` is the
|
|
448
459
|
write root first, then each layer. `dt list`, `get`, `check`, the inbound-reference guard of `rm`
|
|
449
460
|
and reference resolution read the union. An id two roots hold is a `check` violation naming both
|
|
450
461
|
files, and a write to it is refused until one is removed; the first root in order answers reads
|
|
451
462
|
meanwhile, never silently.
|
|
463
|
+
- **A record carrying `stub: true` YIELDS (0.41.0).** A stub is a thin placeholder a workspace keeps
|
|
464
|
+
so its own references resolve standalone — a project's copy of a person the HQ holds in full. One
|
|
465
|
+
non-stub plus any stubs of one id: the non-stub answers, in whichever root it sits (either
|
|
466
|
+
direction), and `check` is clean with an `ℹ` counting the shadowed stubs. Two non-stubs are still
|
|
467
|
+
the violation above; stubs only, the first root answers. `stub` is an engine-owned field on every
|
|
468
|
+
collection that can be layered (hidden from lists and forms; a module may not declare one), and a stub still carries
|
|
469
|
+
its collection's required fields. `dt set` writes the answering record in its own repo; `dt add`
|
|
470
|
+
of an id only stubs hold is allowed and prints `shadows N stubs (<layer>…)` — that is how a stub
|
|
471
|
+
is promoted; `dt rm` of the answering record says which stub now shows, and is not refused for
|
|
472
|
+
references the stub keeps resolving. `dt get --json` carries
|
|
473
|
+
`$stub: true` on a stub and `$shadows: [<file>…]` on a record that answers over stubs. A shadowed
|
|
474
|
+
stub is still an owner in its own repo, so the mirrors it justifies there are expected by `check`
|
|
475
|
+
and kept by `relations rebuild`. Only ids more than one root claims have their files read.
|
|
452
476
|
- **A new record goes to the write root** (`storage.path` — this workspace, or the owning module's
|
|
453
477
|
clone for `storage.owner: module`). **An edit or removal of a layer's record lands in place** and
|
|
454
478
|
commits in the layer's repo; `dt commit` samples every layer and publishes one commit per repo.
|
|
@@ -459,12 +483,14 @@ entry, which collections that clone contributes:
|
|
|
459
483
|
- **A mirror is kept only between records of one repo.** A task here naming a project a layer holds
|
|
460
484
|
writes no mirror into the layer, and `check` expects none; the project's own `tasks` mirror on that
|
|
461
485
|
record lists only its own tasks.
|
|
462
|
-
- **What may be
|
|
486
|
+
- **What may be layered:** a collection stored in this workspace. Not a `storage.owner: module`
|
|
463
487
|
collection (one shared list is read from the module's clone already), not a placed one
|
|
464
|
-
(`storage.under`), not a compiled source.
|
|
488
|
+
(`storage.under`), not an env-pointed one, not a compiled source. NAMING one of those in `records:`
|
|
489
|
+
is a compile error, as is a name no collection here answers to.
|
|
465
490
|
- **A layer whose clone is absent** — a fresh checkout before `dreamteamer install` — compiles; `check`
|
|
466
|
-
says its records are unread
|
|
467
|
-
clone
|
|
491
|
+
says its records are unread (only a `records:` or `module: true` entry is known to be a layer before
|
|
492
|
+
its clone exists). `dt status` lists layers after modules with the collections FOUND in each;
|
|
493
|
+
`dt update` pulls them like any clone, and a long-lived store re-indexes when a pull lands files.
|
|
468
494
|
|
|
469
495
|
## mixins — a live shared field set
|
|
470
496
|
|
|
@@ -50,6 +50,7 @@ never disagree with the one the operator ran. It returns a contribution; every k
|
|
|
50
50
|
| `hooks` | `{ <ClaudeHookEvent>: '<dt verb args>' }` | merged into `dt install --print-adapters` |
|
|
51
51
|
| `check` | `({ root, ws, dt }) → [{ file, message }]` | `dt check` reports each as a violation after the schema's, attributed to the extension; a throw is a violation too |
|
|
52
52
|
| `doctor` | `({ root, ws, dt }) → [{ label, state: ok\|warn\|bad, detail?, fix? }]` | `dt doctor` renders the rows as one capability named after the extension: READY, DEGRADED (a warn) or UNAVAILABLE (a bad), each fix on its row |
|
|
53
|
+
| `next` | `({ root, ws, collection, ids }) → [{ id, text }]`, synchronous | `dt next <ref>` prints each line under the bound commands (`--json`: `notes`, attributed); a throw is one failure line, never a failed `dt next`. `contributedNotes(ws, collection, ids)` is the same call for a surface |
|
|
53
54
|
|
|
54
55
|
The `draft` is data only: the staged entries, the final merged descriptors, the modules, declared var
|
|
55
56
|
and env key NAMES, and the previous manifest. No writer, no Store, no environment values — an analysis
|
|
@@ -174,7 +174,7 @@ source_file: ${env:FILES_FOLDER}/2026/q3.pdf
|
|
|
174
174
|
|
|
175
175
|
## committing — publishing what you wrote
|
|
176
176
|
|
|
177
|
-
- **commit when a logical change is complete.** an uncommitted write is
|
|
177
|
+
- **commit when a logical change is complete.** an uncommitted write is what a bare `dt changes` lists, and it is invisible to every
|
|
178
178
|
other CLONE — while a session SHARING this tree sees it immediately, which is why the sweep
|
|
179
179
|
rules below exist — `auto_commit` off makes the commit a deliberate act, not a
|
|
180
180
|
forbidden one, and publishing what the operator asked you to write needs scope, not permission.
|
|
@@ -160,6 +160,26 @@ so a view saved from the CLI and one saved from a surface land on the **same rec
|
|
|
160
160
|
- **An empty value REMOVES the key**, so the setting whose meaningful value IS empty is written
|
|
161
161
|
QUOTED: `'display.list.sort=""'`. A value holding a template is quoted the same way:
|
|
162
162
|
`'display.list.options.card_title="{{ name }}"'`.
|
|
163
|
+
- **`dt set ui-views/<id> module=<m>` MOVES the view** to another module's `ui-views/` (bytes and
|
|
164
|
+
comments kept, one compile gate, one commit per repo — a linked clone's module commits there).
|
|
165
|
+
`--dry-run` shows the plan. A package's view never moves; save it under a new name and move that.
|
|
166
|
+
|
|
167
|
+
## a package's view, changed from here — `overlay: true`
|
|
168
|
+
|
|
169
|
+
A view an installed package ships is never written in `node_modules/`. A source in the workspace
|
|
170
|
+
module with the SAME id and `overlay: true` is merged onto it at compile: deep, the overlay wins at a
|
|
171
|
+
leaf, a list is replaced whole, `null` removes a key the package sets. The compiled view names
|
|
172
|
+
`compiled.module` and `compiled.overlaid_by`. `dt set` on a package's view writes exactly that
|
|
173
|
+
overlay — only what differs from the package — and setting it back removes it. A same-id view
|
|
174
|
+
WITHOUT the flag is still a name collision.
|
|
175
|
+
|
|
176
|
+
A COLLECTION overlay merges by a different, shallower rule — know which one you are writing: its
|
|
177
|
+
`display` is merged ONE key deep (`display.list` keeps the package's keys and takes yours, but a
|
|
178
|
+
`display.list.options` you write replaces the package's `options` whole), a list replaces whole, and
|
|
179
|
+
`null` is a value, not a removal — nothing can be deleted from the package's display. `dt set
|
|
180
|
+
collections/<c> display.…` on a package's collection writes the keys that differ into such an overlay
|
|
181
|
+
in the workspace module (writing `options` whole when one option changes, so none is dropped), says
|
|
182
|
+
when it also declares `<c>` in that module's `peer_collections`, and never writes the package.
|
|
163
183
|
|
|
164
184
|
## common mistakes
|
|
165
185
|
|
package/src/api.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export interface Contribution {
|
|
|
28
28
|
check?(ctx: ExtensionContext): { file?: string; message: string }[] | void | Promise<{ file?: string; message: string }[] | void>;
|
|
29
29
|
/** machine checks: `dt doctor` renders the rows as one capability named after the extension */
|
|
30
30
|
doctor?(ctx: ExtensionContext): DoctorRow[] | void | Promise<DoctorRow[] | void>;
|
|
31
|
+
/** a line about a record's state that `dt next` prints under the bound commands — synchronous */
|
|
32
|
+
next?(ctx: { root: string; ws: Workspace; collection: string; ids: string[] }): { id: string; text: string }[] | void;
|
|
31
33
|
}
|
|
32
34
|
export interface DoctorRow { label: string; state: 'ok' | 'warn' | 'bad'; detail?: string; fix?: string }
|
|
33
35
|
export interface ExtensionContext { root: string; ws: Workspace; dt: typeof import('./api.js') }
|
|
@@ -43,6 +45,7 @@ export interface LoadedExtension {
|
|
|
43
45
|
hooks: Record<string, string>;
|
|
44
46
|
check: Contribution['check'] | null;
|
|
45
47
|
doctor: Contribution['doctor'] | null;
|
|
48
|
+
next: Contribution['next'] | null;
|
|
46
49
|
}
|
|
47
50
|
export type Entry = { sources: { path: string; hash: string }[]; bytes: Buffer };
|
|
48
51
|
export interface CompileDraft {
|
|
@@ -70,6 +73,8 @@ export function openWorkspace(start?: string): Promise<Workspace & { extensions:
|
|
|
70
73
|
export function findWorkspace(start?: string): Workspace;
|
|
71
74
|
/** every extension's `check` contribution on `ws`, in the shape `check(ws, { extra })` takes */
|
|
72
75
|
export function contributedViolations(ws: Workspace): Promise<{ file: string; msg: string }[]>;
|
|
76
|
+
/** every extension's `next` lines about `ids` of `collection` — what `dt next` prints; a throw is one `error: true` line */
|
|
77
|
+
export function contributedNotes(ws: Workspace, collection: string, ids?: string[]): { id: string | null; text: string; by: string; error?: true }[];
|
|
73
78
|
export function declaredExtensions(ws: Workspace): { name: string; version: string; dir: string; entry: string }[];
|
|
74
79
|
export const engineBin: string;
|
|
75
80
|
export const engineRoot: string;
|
|
@@ -104,7 +109,7 @@ export const addField: SchemaOp, updateField: SchemaOp, removeField: SchemaOp, r
|
|
|
104
109
|
export const renameValue: SchemaOp, renameValuePlan: SchemaOp;
|
|
105
110
|
/** One v2 field from the field-verb flag vocabulary, applied over `previous` (the field as its source declares it). */
|
|
106
111
|
export function fieldFromFlags(store: Store, flags: Record<string, unknown>, previous?: Record<string, unknown>): Record<string, unknown>;
|
|
107
|
-
export const saveUiView: SchemaOp, removeUiView: SchemaOp;
|
|
112
|
+
export const saveUiView: SchemaOp, removeUiView: SchemaOp, moveUiView: SchemaOp;
|
|
108
113
|
export const createModule: SchemaOp, setModule: SchemaOp, renameModule: SchemaOp, removeModule: SchemaOp;
|
|
109
114
|
export const createSkill: SchemaOp, refuseHandAuthored: SchemaOp, removeEntity: SchemaOp, renameEntity: SchemaOp, setEntityFrontmatter: SchemaOp;
|
|
110
115
|
export function init(opts?: { flags?: Record<string, string> }): 0;
|
package/src/api.js
CHANGED
|
@@ -35,7 +35,7 @@ export async function openWorkspace(start = process.cwd()) {
|
|
|
35
35
|
return ws;
|
|
36
36
|
}
|
|
37
37
|
export { findWorkspace };
|
|
38
|
-
export { EXTENSION_API, declaredExtensions } from './extensions.js';
|
|
38
|
+
export { EXTENSION_API, declaredExtensions, contributedNotes } from './extensions.js';
|
|
39
39
|
|
|
40
40
|
/** What every extension's `check` reports on `ws`, as `check(ws, { extra })` takes it — attributed to
|
|
41
41
|
* the extension, a throw being a violation. `dt check` and an in-process caller get one verdict. */
|
|
@@ -66,7 +66,7 @@ export { MANAGED_BLOCKS } from './harnesses.js';
|
|
|
66
66
|
export {
|
|
67
67
|
createCollection, removeCollection, renameCollection, moveCollection, setCollectionScalars,
|
|
68
68
|
addField, updateField, removeField, removeFieldPlan, renameField, renameFieldPlan, renameValue, renameValuePlan, fieldFromFlags,
|
|
69
|
-
saveUiView, removeUiView,
|
|
69
|
+
saveUiView, removeUiView, moveUiView,
|
|
70
70
|
createModule, setModule, renameModule, removeModule,
|
|
71
71
|
createSkill, refuseHandAuthored, removeEntity, renameEntity, setEntityFrontmatter,
|
|
72
72
|
} from './schema-ops.js';
|