dreamteamer 0.39.1 → 0.40.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/package.json +1 -1
- package/skills/using-dreamteamer/references/collections.md +3 -0
- package/skills/using-dreamteamer/references/getting-started.md +4 -3
- package/src/cli.js +3 -1
- package/src/collections-cli.js +26 -7
- package/src/compile.js +13 -0
- package/src/descriptor-v2.js +1 -0
- package/src/presentation.js +6 -2
- package/src/records-api.d.ts +5 -1
- package/src/store.js +16 -0
- package/src/workspace.js +17 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dreamteamer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.40.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>",
|
|
@@ -158,6 +158,9 @@ display:
|
|
|
158
158
|
fields: [reason, patient, date, status]
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
+
A section may say `collapsed: true`: a surface draws it shut, after every other field, until it is
|
|
162
|
+
opened — for what a person rarely reads and an agent writes (a provenance block).
|
|
163
|
+
|
|
161
164
|
This block IS what a bare collection route renders and what `dt list` prints as columns. A
|
|
162
165
|
ui-view carries the same block and changes only what it states (`ui-views.md`). Every field it
|
|
163
166
|
names must exist — columns, sort, badge, color_by, sections — or compile names the position.
|
|
@@ -119,9 +119,10 @@ prefers. Nothing about the code moves; `check` and `compile` read only what desc
|
|
|
119
119
|
|
|
120
120
|
The VS Code-family extension is **`dreamteamer.dreamteamer-vscode`** (Marketplace and Open VSX). It
|
|
121
121
|
loads the engine the workspace pins, so the editor, the CLI and an agent session run the same code.
|
|
122
|
-
`init` writes `.vscode/extensions.json` recommending it
|
|
123
|
-
VS Code, Cursor or code-server window opened on
|
|
124
|
-
the intended path.
|
|
122
|
+
`init` writes `.vscode/extensions.json` recommending it, with Claude Code (`Anthropic.claude-code`)
|
|
123
|
+
beside it, and `compile` keeps that file current, so a VS Code, Cursor or code-server window opened on
|
|
124
|
+
the workspace offers to install both — that prompt is the intended path. An id listed under
|
|
125
|
+
`unwantedRecommendations` is never added back. From a terminal:
|
|
125
126
|
|
|
126
127
|
```bash
|
|
127
128
|
code --install-extension dreamteamer.dreamteamer-vscode # VS Code (on some machines `code` is Cursor)
|
package/src/cli.js
CHANGED
|
@@ -54,7 +54,9 @@ the longest DECLARED collection prefix, so finance/transactions/2026/03/coffee i
|
|
|
54
54
|
case-insensitive variants; date-times sort and
|
|
55
55
|
compare as instants, across offsets; an enum
|
|
56
56
|
sorts in its declared order)
|
|
57
|
-
get <collection>/<id> [--json]
|
|
57
|
+
get <collection>/<id> [--json] (--json, and each list --json row, adds $file and
|
|
58
|
+
$repo: where the record is read from and the repo
|
|
59
|
+
that commits it — null outside every repo here)
|
|
58
60
|
add <collection> ["<title>"] --<field> <value> … [--id <explicit-id>]
|
|
59
61
|
(ONE bare positional fills the collection's title
|
|
60
62
|
field — the one its record_title opens with — so
|
package/src/collections-cli.js
CHANGED
|
@@ -129,8 +129,10 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
129
129
|
|
|
130
130
|
switch (verb) {
|
|
131
131
|
case 'list': {
|
|
132
|
-
const { rows, narrowed } = narrowRows(store, d, collection, flags);
|
|
133
|
-
|
|
132
|
+
const { rows, narrowed, files } = narrowRows(store, d, collection, flags);
|
|
133
|
+
// each row says where it is read from and which repo commits it — `$`-keys, because a
|
|
134
|
+
// collection may author a field called `file` or `repo` (an issue tracker's `repo` is one)
|
|
135
|
+
if (flags.json) { emit(JSON.stringify(rows.map((r) => ({ ...r, ...whereKeys(store.locationOf(d, files.get(r.id))) })), null, 2)); return 0; }
|
|
134
136
|
const cols = listColumns(d);
|
|
135
137
|
for (const r of rows) console.log(cols.map((c) => fmtCell(r[c])).join(' '));
|
|
136
138
|
if (!rows.length) console.log(`(no ${collection}${narrowed ? ' matching' : ''})`);
|
|
@@ -142,7 +144,7 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
142
144
|
// descriptor v2: a record older than the `created` stamp still answers it — read, never written
|
|
143
145
|
const created = store.createdOf(collection, id, fields, file);
|
|
144
146
|
if (created !== undefined && fields.created === undefined) fields.created = created;
|
|
145
|
-
if (flags.json) { emit(JSON.stringify({ ...fields, id }, null, 2)); return 0; }
|
|
147
|
+
if (flags.json) { emit(JSON.stringify({ ...fields, id, ...whereKeys(store.locationOf(d, file)) }, null, 2)); return 0; }
|
|
146
148
|
console.log(dump(fields).trimEnd());
|
|
147
149
|
return 0;
|
|
148
150
|
}
|
|
@@ -190,8 +192,9 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
190
192
|
const changes = coerceArrays(d, pairs(pos.slice(1)));
|
|
191
193
|
Object.assign(changes, coerceArrays(d, stripMeta(flags)));
|
|
192
194
|
if (!Object.keys(changes).length) throw new Error('nothing to set — pass key=value pairs or --key value flags');
|
|
195
|
+
const where = store.ids(collection).has(id) ? store.locate(collection, id) : null; // a missing id is store.set's to refuse
|
|
193
196
|
store.set(collection, id, changes);
|
|
194
|
-
flags.json ? emit(JSON.stringify({ id })) : console.log(`✔ ${at}updated`);
|
|
197
|
+
flags.json ? emit(JSON.stringify({ id, ...(where ? whereKeys(where) : {}) })) : console.log(`✔ ${at}updated${landedIn(where)}`);
|
|
195
198
|
return 0;
|
|
196
199
|
}
|
|
197
200
|
// Manual ordering. ONE record is written per move — that is the entire feature; a dense
|
|
@@ -231,8 +234,9 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
231
234
|
case 'rm': {
|
|
232
235
|
const id = need(pos, 0, 'id');
|
|
233
236
|
if (flags['dry-run']) return dryRunPlan(`rm ${collection}/${id}`, { records: store.ids(collection).has(id) ? 1 : 0, refs: store.findInboundRefs(`${collection}/${id}`).length });
|
|
237
|
+
const where = store.ids(collection).has(id) ? store.locate(collection, id) : null; // a missing id is store.rm's to refuse
|
|
234
238
|
const { inboundIgnored } = store.rm(collection, id, { force: !!flags.force });
|
|
235
|
-
flags.json ? emit(JSON.stringify({ id, removed: true, inboundIgnored })) : console.log(`✔ ${at}removed${inboundIgnored ? ` (${inboundIgnored} inbound reference(s) left dangling — run \`dreamteamer check\`)` : ''}`);
|
|
239
|
+
flags.json ? emit(JSON.stringify({ id, removed: true, inboundIgnored })) : console.log(`✔ ${at}removed${landedIn(where)}${inboundIgnored ? ` (${inboundIgnored} inbound reference(s) left dangling — run \`dreamteamer check\`)` : ''}`);
|
|
236
240
|
return 0;
|
|
237
241
|
}
|
|
238
242
|
case 'rename': {
|
|
@@ -1211,17 +1215,32 @@ function narrowRows(store, d, collection, flags) {
|
|
|
1211
1215
|
const resolve = where ? recordResolver(store) : null;
|
|
1212
1216
|
const bf = bodyField(d);
|
|
1213
1217
|
const rows = [];
|
|
1214
|
-
|
|
1218
|
+
const files = new Map();
|
|
1219
|
+
for (const { id, fields, file } of store.readAll(collection)) { // ONE walk, not one per record
|
|
1215
1220
|
if (!filters.every(([k, v]) => String(fields[k] ?? '') === String(v))) continue;
|
|
1216
1221
|
if (where && !matchesFilter({ ...fields, id }, where, resolve)) continue;
|
|
1217
1222
|
if (bf) delete fields[bf]; // bodies don't belong in listings
|
|
1218
1223
|
rows.push({ ...fields, id }); // record id WINS over any schema field named "id"
|
|
1224
|
+
files.set(id, file);
|
|
1219
1225
|
}
|
|
1220
1226
|
// sorting was studio-only until now: the browse table ordered records and no CLI
|
|
1221
1227
|
// invocation could. Same `sortRows` the server and api.ts call, so `--sort -starts`
|
|
1222
1228
|
// orders date-times by INSTANT across mixed offsets rather than by string.
|
|
1223
1229
|
if (sort) sortRows(rows, sort, jsonSchemaOf(d));
|
|
1224
|
-
return { rows, narrowed: !!(filters.length || where) };
|
|
1230
|
+
return { rows, narrowed: !!(filters.length || where), files };
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/** A record's location as `--json` carries it: `$file` and `$repo` (null = outside every repo here). */
|
|
1234
|
+
const whereKeys = ({ file, repo }) => ({ $file: file, $repo: repo });
|
|
1235
|
+
|
|
1236
|
+
/** What a write on an EXISTING record adds to its `✔` line: nothing in the workspace's own repo; the
|
|
1237
|
+
* repo when it is another clone (a layer, a module's list); and that it is never committed when the
|
|
1238
|
+
* root is outside every repo here. The workspace name alone used to be printed wherever it landed. */
|
|
1239
|
+
function landedIn(where) {
|
|
1240
|
+
if (!where) return '';
|
|
1241
|
+
const { repo } = where;
|
|
1242
|
+
if (repo === null) return ' — outside every git repo here, never committed';
|
|
1243
|
+
return repo === '.' ? '' : ` in ${repo}`;
|
|
1225
1244
|
}
|
|
1226
1245
|
|
|
1227
1246
|
/** `id` first, then the descriptor's own columns — the shape every text listing prints. */
|
package/src/compile.js
CHANGED
|
@@ -796,6 +796,19 @@ export function compile(ws) {
|
|
|
796
796
|
console.warn(`⚠ module "${source.name}" (${rel(source.root)}) contributed no recognised sources — its folder names must match a known kind (${kinds.join(', ')}) or it must ship a UI bundle at ui/app.js`);
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
+
// An npm-installed module's `data/` is read by NOTHING: no root points into node_modules/, because
|
|
800
|
+
// records there could never be committed (owns_data and `storage.owner: module` are refused for npm
|
|
801
|
+
// above). A package shipping one — seed records, a stale copy — compiled ✔ and its records silently
|
|
802
|
+
// never appeared. Say so, naming the package and the folder. A module whose OWN script reads the
|
|
803
|
+
// folder (a workflow installer copying templates out of it) declares it: `"ignore": ["data"]`.
|
|
804
|
+
for (const source of sources) {
|
|
805
|
+
if (source.channel !== 'npm' || (moduleIgnores.get(source.name) ?? []).includes('data')) continue;
|
|
806
|
+
const data = path.join(source.root, 'data');
|
|
807
|
+
let holds = false;
|
|
808
|
+
try { holds = fs.readdirSync(data, { recursive: true, withFileTypes: true }).some((e) => e.isFile()); } catch { /* no data/ */ }
|
|
809
|
+
if (holds) console.warn(`⚠ module ${source.name} ships ${rel(data)}/ and nothing reads it — a module installed from npm cannot hold records (node_modules/ is never committed), so no collection reads that folder. Vendor the module into modules/ or install it as a git module to keep records in it; if one of its own scripts reads the folder, declare "dreamteamer": { "ignore": ["data"] } in its package.json.`);
|
|
810
|
+
}
|
|
811
|
+
|
|
799
812
|
// ---- mixins (descriptor v2): partial descriptors merged into the collections that list them ----
|
|
800
813
|
const mixinDocs = new Map(); // id -> doc (with `src` for staleness)
|
|
801
814
|
for (const [rt, entry] of entries) {
|
package/src/descriptor-v2.js
CHANGED
|
@@ -114,6 +114,7 @@ export function nameErrors(doc) {
|
|
|
114
114
|
const sectioned = new Set();
|
|
115
115
|
for (const [i, s] of (d.form?.sections ?? []).entries()) {
|
|
116
116
|
if (!s?.title) errors.push(`display.form.sections[${i}] has no title`);
|
|
117
|
+
if (s?.collapsed !== undefined && typeof s.collapsed !== 'boolean') errors.push(`display.form.sections "${s?.title ?? i}" has collapsed: ${JSON.stringify(s.collapsed)} — it is true or false`);
|
|
117
118
|
for (const f of s?.fields ?? []) {
|
|
118
119
|
if (!has(f)) errors.push(`display.form.sections "${s?.title ?? i}" names "${f}", which is not a field`);
|
|
119
120
|
else if (fields[f]?.display?.hidden?.includes('form')) errors.push(`display.form.sections "${s?.title ?? i}" lists "${f}", which is hidden from the form`);
|
package/src/presentation.js
CHANGED
|
@@ -94,8 +94,12 @@ function collectionRow(d, declared) {
|
|
|
94
94
|
sections: [...(form.sections ?? []).map((s) => s.title), ...Object.values(declared).map((f) => f.display?.form_section)]
|
|
95
95
|
.filter((t, i, all) => t !== undefined && all.indexOf(t) === i)
|
|
96
96
|
.map((title) => {
|
|
97
|
-
const
|
|
98
|
-
|
|
97
|
+
const section = (form.sections ?? []).find((s) => s.title === title);
|
|
98
|
+
const authored = section?.fields ?? [];
|
|
99
|
+
const fields = [...authored, ...Object.keys(declared).filter((n) => declared[n].display?.form_section === title && !authored.includes(n))].filter(drawn);
|
|
100
|
+
// `collapsed: true` — drawn shut, after every other field, until opened: what a person
|
|
101
|
+
// rarely reads and an agent writes (a provenance block). Absent unless authored.
|
|
102
|
+
return { title, fields, ...(section?.collapsed === true ? { collapsed: true } : {}) };
|
|
99
103
|
}),
|
|
100
104
|
},
|
|
101
105
|
...pick({ position_field: positionFieldOf(d), record_title: recordTitleOf(d) }, ['position_field', 'record_title']),
|
package/src/records-api.d.ts
CHANGED
|
@@ -61,6 +61,9 @@ export class Store {
|
|
|
61
61
|
/** id → record file, across every folder the collection's records sit in */
|
|
62
62
|
ids(collection: string): Map<string, string>;
|
|
63
63
|
read(collection: string, id: string): { fields: Fields; file: string };
|
|
64
|
+
/** Where a record is read from: `file` workspace-relative (absolute for a root outside every repo
|
|
65
|
+
* here) and `repo`, the workspace-relative repo root that commits it — null when none does. */
|
|
66
|
+
locate(collection: string, id: string): { file: string; repo: string | null };
|
|
64
67
|
readAll(collection: string): Iterable<{ id: string; fields: Fields; file: string }>;
|
|
65
68
|
/** A record's `created`: the stamp when present, else the date its id was made from, else the first commit holding the file. Undefined when the collection has no `created` field or no commit holds the file. */
|
|
66
69
|
createdOf(collection: string, id: string, fields: Fields, file: string): string | undefined;
|
|
@@ -188,7 +191,8 @@ export interface PresentationCollection {
|
|
|
188
191
|
nav: { icon?: string; order?: number; section?: string };
|
|
189
192
|
list: { layout: string; columns?: string[]; sort?: string; options?: Record<string, unknown> };
|
|
190
193
|
record: { layout: string; subtitle?: string; badge?: string; color_by?: string; options?: Record<string, unknown> };
|
|
191
|
-
|
|
194
|
+
/** `collapsed`: the section is drawn shut, after every other field, until a person opens it */
|
|
195
|
+
form: { sections: Array<{ title: string; fields: string[]; collapsed?: true }> };
|
|
192
196
|
position_field?: string;
|
|
193
197
|
record_title?: string;
|
|
194
198
|
record_type: string;
|
package/src/store.js
CHANGED
|
@@ -287,6 +287,22 @@ export class Store {
|
|
|
287
287
|
/** The git repo that owns a file of `d`, workspace-relative: a layer's when a layer holds it. */
|
|
288
288
|
repoOfFile(d, file) { return this.layerOfFile(d, file)?.repo ?? storageOf(d).repo; }
|
|
289
289
|
|
|
290
|
+
/** WHERE a record is read from, and which repo commits it — what `dt get --json` and `dt list
|
|
291
|
+
* --json` say as `$file` and `$repo`. `file` is workspace-relative, `repo` the workspace-relative
|
|
292
|
+
* repo root (`.`, `git_modules/<clone>`); a collection kept outside every repo here (an
|
|
293
|
+
* env-pointed root) answers its absolute file and `repo: null` — it is never committed. */
|
|
294
|
+
locate(collection, id) {
|
|
295
|
+
const file = this.ids(collection).get(id);
|
|
296
|
+
if (!file) throw new Error(`${collection}/${id}: no such record`);
|
|
297
|
+
return this.locationOf(this.descriptor(collection), file);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/** `locate` for a file already in hand — one row of a listing, without a second index lookup. */
|
|
301
|
+
locationOf(d, file) {
|
|
302
|
+
if (storageOf(d).external) return { file: path.resolve(file), repo: null };
|
|
303
|
+
return { file: path.relative(this.root, file).split(path.sep).join('/'), repo: this.repoOfFile(d, file) };
|
|
304
|
+
}
|
|
305
|
+
|
|
290
306
|
/** The file a record of `d` with these `fields` belongs at. For a placed collection the owner
|
|
291
307
|
* field decides the root — the parent's folder, or the fallback root when it is empty — so a
|
|
292
308
|
* caller that has no fields (a bare id) must go through the index instead (recordRoot). */
|
package/src/workspace.js
CHANGED
|
@@ -50,31 +50,37 @@ export function nestedAsModule(outer, inner) {
|
|
|
50
50
|
.some((seg) => MODULE_SEGMENTS.has(seg));
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
/** The VS Code-family
|
|
53
|
+
/** The VS Code-family extensions for this workspace, as the editor learns of them: recommendations
|
|
54
54
|
* in `.vscode/extensions.json`, which VS Code, Cursor and code-server all read on open and offer to
|
|
55
|
-
* install.
|
|
56
|
-
*
|
|
55
|
+
* install. The studio extension, and beside it Claude Code, the agent a workspace's harness files are
|
|
56
|
+
* compiled for. Written by `init` and kept current by `compile`, because a compiled workspace that
|
|
57
|
+
* never names its editor left a first-run agent searching a registry for the id (measured 2026-09-24:
|
|
57
58
|
* three install attempts, two of them into a directory the running editor did not read). An
|
|
58
|
-
* existing file is MERGED, never replaced:
|
|
59
|
-
*
|
|
60
|
-
*
|
|
59
|
+
* existing file is MERGED, never replaced: an id the file already names anywhere — recommended, or
|
|
60
|
+
* listed under `unwantedRecommendations` by an operator who declined it — counts as present, in any
|
|
61
|
+
* case (extension ids are case-insensitive); a file naming them all is left byte-for-byte alone; one
|
|
62
|
+
* missing some is re-read as JSON and gains them, and one that is not plain JSON is left with a
|
|
63
|
+
* warning rather than clobbered. */
|
|
61
64
|
export const EDITOR_EXTENSION_ID = 'dreamteamer.dreamteamer-vscode';
|
|
65
|
+
export const EDITOR_RECOMMENDATIONS = [EDITOR_EXTENSION_ID, 'Anthropic.claude-code'];
|
|
62
66
|
export function ensureEditorRecommendation(root, warn = console.warn) {
|
|
63
67
|
const file = path.join(root, '.vscode', 'extensions.json');
|
|
64
68
|
if (!fs.existsSync(file)) {
|
|
65
69
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
66
|
-
fs.writeFileSync(file, JSON.stringify({ recommendations:
|
|
70
|
+
fs.writeFileSync(file, JSON.stringify({ recommendations: EDITOR_RECOMMENDATIONS }, null, '\t') + '\n');
|
|
67
71
|
return 'written';
|
|
68
72
|
}
|
|
69
73
|
const text = fs.readFileSync(file, 'utf8');
|
|
70
|
-
|
|
74
|
+
const missing = EDITOR_RECOMMENDATIONS.filter((id) => !text.toLowerCase().includes(id.toLowerCase()));
|
|
75
|
+
if (!missing.length) return 'present';
|
|
76
|
+
const ids = missing.join(', ');
|
|
71
77
|
let parsed;
|
|
72
78
|
try { parsed = JSON.parse(text); } catch {
|
|
73
|
-
warn(`⚠ .vscode/extensions.json does not recommend ${
|
|
79
|
+
warn(`⚠ .vscode/extensions.json does not recommend ${ids} and is not plain JSON, so it was left alone — add ${missing.length > 1 ? 'the ids' : 'the id'} to its "recommendations" by hand`);
|
|
74
80
|
return 'left';
|
|
75
81
|
}
|
|
76
|
-
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) { warn(`⚠ .vscode/extensions.json is not an object — left alone; add ${
|
|
77
|
-
parsed.recommendations = [...(Array.isArray(parsed.recommendations) ? parsed.recommendations : []),
|
|
82
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) { warn(`⚠ .vscode/extensions.json is not an object — left alone; add ${ids} to "recommendations" by hand`); return 'left'; }
|
|
83
|
+
parsed.recommendations = [...(Array.isArray(parsed.recommendations) ? parsed.recommendations : []), ...missing];
|
|
78
84
|
fs.writeFileSync(file, JSON.stringify(parsed, null, '\t') + '\n');
|
|
79
85
|
return 'merged';
|
|
80
86
|
}
|