dreamteamer 0.39.1 → 0.41.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 +4 -3
- package/skills/using-dreamteamer/references/collections.md +37 -12
- package/skills/using-dreamteamer/references/getting-started.md +4 -3
- package/src/check.js +43 -23
- package/src/cli.js +27 -15
- package/src/collections-cli.js +45 -14
- package/src/compile-collections.js +56 -8
- package/src/compile.js +30 -30
- package/src/descriptor-v2.js +1 -0
- package/src/extensions.js +2 -1
- package/src/fields.js +8 -2
- package/src/presentation.js +6 -2
- package/src/records-api.d.ts +5 -1
- package/src/records.js +25 -0
- package/src/schema-ops.js +3 -3
- package/src/store.js +85 -10
- package/src/workspace.js +53 -11
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.41.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,9 +91,10 @@ 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.
|
|
@@ -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.
|
|
@@ -259,7 +262,7 @@ Keys are snake_case and closed: compile refuses an unknown one, naming the list.
|
|
|
259
262
|
| `vars` | the `.env` keys records may reference as `${env:KEY}` (`records.md`) |
|
|
260
263
|
| `auto_commit` | whether a record write also commits (default off) |
|
|
261
264
|
| `harnesses` | which coding-agent adapters compile writes |
|
|
262
|
-
| `git_modules` | the lockfile map `dt install` restores into `git_modules/` — `{ url, ref }` per clone;
|
|
265
|
+
| `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 |
|
|
263
266
|
| `disable` | what to drop from the compile: `modules/<id>` (a whole module, its code included) or `<kind>/<id>` (one entity) |
|
|
264
267
|
| `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
268
|
|
|
@@ -417,17 +420,25 @@ storage:
|
|
|
417
420
|
|
|
418
421
|
Several workspaces install one module for their shared shapes — an HQ and the projects it oversees
|
|
419
422
|
all take `tasks` from the same package — while each keeps its own task RECORDS in its own repo. The
|
|
420
|
-
HQ reads the projects' records by cloning each project under `git_modules
|
|
421
|
-
entry, which collections that clone contributes:
|
|
423
|
+
HQ reads the projects' records by cloning each project under `git_modules/`:
|
|
422
424
|
|
|
423
425
|
```json
|
|
424
426
|
"git_modules": {
|
|
425
427
|
"org": { "url": "…", "ref": "main" },
|
|
426
|
-
"project-alpha": { "url": "…", "ref": "main", "
|
|
428
|
+
"project-alpha": { "url": "…", "ref": "main", "module": true },
|
|
429
|
+
"project-beta": { "url": "…", "ref": "main", "records": ["tasks", "projects"] }
|
|
427
430
|
}
|
|
428
431
|
```
|
|
429
432
|
|
|
430
|
-
- **
|
|
433
|
+
- **What the CLONE is decides it (0.41.0).** A clone whose own package.json names
|
|
434
|
+
`dreamteamer.workspace_module` is a workspace, so it is a layer: every collection both workspaces
|
|
435
|
+
have reads its data folder. A clone that names none is a bundle, and its `modules/` unpack as
|
|
436
|
+
before. `records:` is optional and NARROWS — only the listed collections are read — and it still
|
|
437
|
+
makes any clone a layer. A collection that cannot layer (below) is skipped with an `ℹ` when the
|
|
438
|
+
clone holds files for it; a data folder no collection here accounts for (a project's own domain
|
|
439
|
+
collections, read without their module) is a compile warning naming the folder and its file
|
|
440
|
+
count, never a failure.
|
|
441
|
+
- **A layer is never a bundle.** Its own `modules/` is not unpacked and it
|
|
431
442
|
is not an extension; the shapes are the modules both workspaces install. Its nested
|
|
432
443
|
`git_modules/` are never read.
|
|
433
444
|
- **`module: true` also compiles the clone's WORKSPACE module** — `modules/<workspace_module>`, as
|
|
@@ -438,14 +449,26 @@ entry, which collections that clone contributes:
|
|
|
438
449
|
extension entry in it is not loaded), and the records half is unchanged. Compile refuses, naming
|
|
439
450
|
the entry: a clone with no `workspace_module`; a module whose id is `default` (the role name every
|
|
440
451
|
workspace's own module carries — name the project's module after the project); an id another
|
|
441
|
-
module here already holds
|
|
442
|
-
|
|
443
|
-
- **Each listed collection gains the clone's data folder as a read root below the workspace's
|
|
452
|
+
module here already holds. `dt status` adds `· module <id>` to the layer's line.
|
|
453
|
+
- **Each layered collection gains the clone's data folder as a read root below the workspace's
|
|
444
454
|
own** — the compiled descriptor states them as `compiled.layers`, and `storageOf(d).roots` is the
|
|
445
455
|
write root first, then each layer. `dt list`, `get`, `check`, the inbound-reference guard of `rm`
|
|
446
456
|
and reference resolution read the union. An id two roots hold is a `check` violation naming both
|
|
447
457
|
files, and a write to it is refused until one is removed; the first root in order answers reads
|
|
448
458
|
meanwhile, never silently.
|
|
459
|
+
- **A record carrying `stub: true` YIELDS (0.41.0).** A stub is a thin placeholder a workspace keeps
|
|
460
|
+
so its own references resolve standalone — a project's copy of a person the HQ holds in full. One
|
|
461
|
+
non-stub plus any stubs of one id: the non-stub answers, in whichever root it sits (either
|
|
462
|
+
direction), and `check` is clean with an `ℹ` counting the shadowed stubs. Two non-stubs are still
|
|
463
|
+
the violation above; stubs only, the first root answers. `stub` is an engine-owned field on every
|
|
464
|
+
collection that can be layered (hidden from lists and forms; a module may not declare one), and a stub still carries
|
|
465
|
+
its collection's required fields. `dt set` writes the answering record in its own repo; `dt add`
|
|
466
|
+
of an id only stubs hold is allowed and prints `shadows N stubs (<layer>…)` — that is how a stub
|
|
467
|
+
is promoted; `dt rm` of the answering record says which stub now shows, and is not refused for
|
|
468
|
+
references the stub keeps resolving. `dt get --json` carries
|
|
469
|
+
`$stub: true` on a stub and `$shadows: [<file>…]` on a record that answers over stubs. A shadowed
|
|
470
|
+
stub is still an owner in its own repo, so the mirrors it justifies there are expected by `check`
|
|
471
|
+
and kept by `relations rebuild`. Only ids more than one root claims have their files read.
|
|
449
472
|
- **A new record goes to the write root** (`storage.path` — this workspace, or the owning module's
|
|
450
473
|
clone for `storage.owner: module`). **An edit or removal of a layer's record lands in place** and
|
|
451
474
|
commits in the layer's repo; `dt commit` samples every layer and publishes one commit per repo.
|
|
@@ -456,12 +479,14 @@ entry, which collections that clone contributes:
|
|
|
456
479
|
- **A mirror is kept only between records of one repo.** A task here naming a project a layer holds
|
|
457
480
|
writes no mirror into the layer, and `check` expects none; the project's own `tasks` mirror on that
|
|
458
481
|
record lists only its own tasks.
|
|
459
|
-
- **What may be
|
|
482
|
+
- **What may be layered:** a collection stored in this workspace. Not a `storage.owner: module`
|
|
460
483
|
collection (one shared list is read from the module's clone already), not a placed one
|
|
461
|
-
(`storage.under`), not a compiled source.
|
|
484
|
+
(`storage.under`), not an env-pointed one, not a compiled source. NAMING one of those in `records:`
|
|
485
|
+
is a compile error, as is a name no collection here answers to.
|
|
462
486
|
- **A layer whose clone is absent** — a fresh checkout before `dreamteamer install` — compiles; `check`
|
|
463
|
-
says its records are unread
|
|
464
|
-
clone
|
|
487
|
+
says its records are unread (only a `records:` or `module: true` entry is known to be a layer before
|
|
488
|
+
its clone exists). `dt status` lists layers after modules with the collections FOUND in each;
|
|
489
|
+
`dt update` pulls them like any clone, and a long-lived store re-indexes when a pull lands files.
|
|
465
490
|
|
|
466
491
|
## mixins — a live shared field set
|
|
467
492
|
|
|
@@ -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/check.js
CHANGED
|
@@ -6,7 +6,7 @@ import fs from 'node:fs';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import Ajv from 'ajv';
|
|
8
8
|
import addFormats from 'ajv-formats';
|
|
9
|
-
import { parseRecord, patternRe, fmtAjvError, unknownFields, walk, idFromRecordPath, MAX_RECORD_BYTES } from './records.js';
|
|
9
|
+
import { parseRecord, patternRe, fmtAjvError, unknownFields, walk, idFromRecordPath, MAX_RECORD_BYTES, isStubRecord, resolveClaims } from './records.js';
|
|
10
10
|
import { NO_RUNTIME, loadDescriptors, runtimeDir, namespaces as compiledNamespaces } from './runtime.js';
|
|
11
11
|
import { parseRef } from './namespace.js';
|
|
12
12
|
import { relationsOf, expectedMirrors, ownersReadIn } from './relations.js';
|
|
@@ -48,6 +48,7 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
48
48
|
const fileRepo = new Map();
|
|
49
49
|
const fileLayer = new Map();
|
|
50
50
|
const layerNotes = new Map(); // layer name -> note, printed once
|
|
51
|
+
const shadowedStubs = []; // { name, id, f, repo, layer } — a placeholder another root's real record answers for
|
|
51
52
|
for (const [name, d] of descriptors) {
|
|
52
53
|
const ids = new Map();
|
|
53
54
|
index.set(name, ids);
|
|
@@ -101,8 +102,11 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
101
102
|
}
|
|
102
103
|
continue;
|
|
103
104
|
}
|
|
104
|
-
// every root: the write root, then each record layer
|
|
105
|
-
// the store indexes
|
|
105
|
+
// every root: the write root, then each record layer. Claimants are GATHERED first and then
|
|
106
|
+
// resolved exactly as the store indexes (records.js resolveClaims): a stub yields to a non-stub
|
|
107
|
+
// wherever it sits, and only a second non-stub is the duplicate reported above.
|
|
108
|
+
const offers = new Map(); // id -> [{ f, repo, layer }], root order
|
|
109
|
+
const offer = (id, f, repo, layer) => { const o = offers.get(id); if (o) o.push({ f, repo, layer }); else offers.set(id, [{ f, repo, layer }]); };
|
|
106
110
|
for (const r of storageOf(d).roots) {
|
|
107
111
|
const rootDir = r.layer ? path.join(root, r.path) : dir;
|
|
108
112
|
if (!fs.existsSync(rootDir)) {
|
|
@@ -125,29 +129,36 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
125
129
|
continue;
|
|
126
130
|
}
|
|
127
131
|
const main = path.join(p, storageOf(d).entry ?? 'SKILL.md');
|
|
128
|
-
if (fs.existsSync(main))
|
|
132
|
+
if (fs.existsSync(main)) offer(entry, main, r.repo, r.layer);
|
|
129
133
|
else strays.push({ collection: name, file: rel(p), note: `missing entry file ${storageOf(d).entry}` });
|
|
130
134
|
}
|
|
131
135
|
continue;
|
|
132
136
|
}
|
|
133
|
-
const opaque = storageOf(d).format === 'binary';
|
|
134
|
-
const allowed = storageOf(d).accept; // undefined = any
|
|
135
|
-
const max = storageOf(d).max_bytes ?? MAX_RECORD_BYTES;
|
|
136
137
|
for (const f of walk(rootDir)) {
|
|
137
138
|
const id = idFromRecordPath(d, path.relative(rootDir, f));
|
|
138
139
|
if (id === null) { strays.push({ collection: name, file: rel(f) }); continue; }
|
|
139
140
|
// One id is one file. Under a fixed-extension format this cannot happen within one root;
|
|
140
141
|
// under `binary` it can, and across roots it is a layer and this workspace disagreeing.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
offer(id, f, r.repo, r.layer);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const opaque = storageOf(d).format === 'binary';
|
|
146
|
+
const allowed = storageOf(d).accept; // undefined = any
|
|
147
|
+
const max = storageOf(d).max_bytes ?? MAX_RECORD_BYTES;
|
|
148
|
+
for (const [id, list] of offers) {
|
|
149
|
+
const { winner, conflicts, shadowed } = resolveClaims(list, (c) => isStubRecord(c.f, d));
|
|
150
|
+
claim(id, winner.f, winner.repo, winner.layer);
|
|
151
|
+
for (const c of conflicts.slice(1)) claim(id, c.f, c.repo, c.layer); // reported as the duplicate
|
|
152
|
+
for (const c of shadowed) shadowedStubs.push({ name, id, ...c });
|
|
153
|
+
if (!opaque) continue;
|
|
154
|
+
const f = winner.f;
|
|
155
|
+
const ext = path.extname(f).slice(1).toLowerCase();
|
|
156
|
+
if (allowed && !allowed.includes(ext)) {
|
|
157
|
+
violations.push({ file: rel(f), layer: winner.layer, msg: `collection "${name}" does not accept .${ext} — its declared extensions are ${allowed.join(', ')}` });
|
|
158
|
+
}
|
|
159
|
+
const size = fs.statSync(f).size;
|
|
160
|
+
if (size > max) {
|
|
161
|
+
violations.push({ file: rel(f), layer: winner.layer, msg: `is ${size} bytes, over collection "${name}"'s max_bytes of ${max} — a record is a small file; a big one belongs outside the vault` });
|
|
151
162
|
}
|
|
152
163
|
}
|
|
153
164
|
}
|
|
@@ -166,7 +177,12 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
166
177
|
const bodyField = bodyFieldOf(d);
|
|
167
178
|
parsed.set(name, new Map());
|
|
168
179
|
|
|
169
|
-
|
|
180
|
+
// a stub THIS workspace holds is validated here even while a layer's record answers its id: no
|
|
181
|
+
// other workspace reads that file, and it must stand on its own the moment the layer's record goes.
|
|
182
|
+
// (A layer's shadowed stub is its own workspace's to validate.)
|
|
183
|
+
const ownStubs = shadowedStubs.filter((x) => x.name === name && !x.layer).map((x) => [x.id, x.f, true]);
|
|
184
|
+
for (const [id, file, shadow] of [...[...index.get(name)].map(([i, f]) => [i, f, false]), ...ownStubs]) {
|
|
185
|
+
if (shadow) fileRepo.set(file, storageOf(d).repo);
|
|
170
186
|
if (idsOf(d).pattern && !patternRe(idsOf(d).pattern).test(id)) {
|
|
171
187
|
flag(file, `id "${id}" does not match pattern ${idsOf(d).pattern}`);
|
|
172
188
|
}
|
|
@@ -213,7 +229,7 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
213
229
|
flag(file, `placed ${where} but ${should} — the file is not where its owner puts it. Run: dreamteamer relocate ${name}/${id}`);
|
|
214
230
|
}
|
|
215
231
|
}
|
|
216
|
-
parsed.get(name).set(id, fields);
|
|
232
|
+
if (!shadow) parsed.get(name).set(id, fields);
|
|
217
233
|
}
|
|
218
234
|
// descriptor v2: `unique: true` on a scalar field — the second record holding a value is the
|
|
219
235
|
// one reported, naming the first. Null and absent never claim.
|
|
@@ -236,13 +252,16 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
236
252
|
// therefore mechanical (`relations rebuild`), which is what the message says, rather than a
|
|
237
253
|
// judgement call about which side is right.
|
|
238
254
|
for (const relation of relationsOf(descriptors)) {
|
|
239
|
-
const owners = [...(parsed.get(relation.owner) ?? [])].map(([id, fields]) => ({ id, fields }));
|
|
255
|
+
const owners = [...(parsed.get(relation.owner) ?? [])].map(([id, fields]) => ({ id, fields, repo: fileRepo.get(index.get(relation.owner).get(id)) }));
|
|
240
256
|
// PER REPO: a mirror is kept only between records of one repo (store.js applyMirrorEdits), so
|
|
241
257
|
// the expectation on a target is computed from the owners in ITS repo — an owner in this
|
|
242
|
-
// workspace naming a target a layer holds is not a link the layer's own check could see.
|
|
243
|
-
|
|
258
|
+
// workspace naming a target a layer holds is not a link the layer's own check could see. A
|
|
259
|
+
// shadowed STUB is still an owner in its own repo: the mirrors it justifies there are expected.
|
|
260
|
+
const stubOwners = shadowedStubs.filter((s) => s.name === relation.owner).flatMap((s) => {
|
|
261
|
+
try { return [{ id: s.id, fields: parseRecord(s.f, descriptors.get(s.name), bodyFieldOf(descriptors.get(s.name))), repo: s.repo }]; } catch { return []; }
|
|
262
|
+
});
|
|
244
263
|
const byRepo = new Map();
|
|
245
|
-
for (const o of owners) {
|
|
264
|
+
for (const o of [...owners, ...stubOwners]) { if (!byRepo.has(o.repo)) byRepo.set(o.repo, []); byRepo.get(o.repo).push(o); }
|
|
246
265
|
const expByRepo = new Map([...byRepo].map(([r, os]) => [r, expectedMirrors(relation, os)]));
|
|
247
266
|
|
|
248
267
|
// a unique owner reference is one-to-one, so two owners naming one target is a conflict the mirror
|
|
@@ -318,6 +337,7 @@ export function check({ root }, { extra = [] } = {}) {
|
|
|
318
337
|
for (const [coll, n] of [...softRefs].sort()) {
|
|
319
338
|
console.log(`⚠ peer collection "${coll}" is declared but not installed — ${n} reference${n === 1 ? '' : 's'} unresolvable`);
|
|
320
339
|
}
|
|
340
|
+
if (shadowedStubs.length) console.log(`ℹ ${shadowedStubs.length} stub record${shadowedStubs.length === 1 ? '' : 's'} shadowed by a real record of ${shadowedStubs.length === 1 ? 'its' : 'their'} id`);
|
|
321
341
|
if (violations.length === 0) {
|
|
322
342
|
console.log(`✔ 0 violations (${[...index.values()].reduce((n, m) => n + m.size, 0)} records across ${descriptors.size} collections)`);
|
|
323
343
|
return 0;
|
package/src/cli.js
CHANGED
|
@@ -14,7 +14,7 @@ import path from 'node:path';
|
|
|
14
14
|
import { execFileSync } from 'node:child_process';
|
|
15
15
|
import * as api from './api.js';
|
|
16
16
|
import { openWorkspace } from './api.js';
|
|
17
|
-
import { compile, staleness, warnIfStale, discoverModules, CHANNEL_LABEL, locationOf, kindsOf, moduleIdOf } from './compile.js';
|
|
17
|
+
import { compile, staleness, warnIfStale, discoverModules, CHANNEL_LABEL, locationOf, kindsOf, moduleIdOf, layerEntries } from './compile.js';
|
|
18
18
|
import { check } from './check.js';
|
|
19
19
|
import { collectionCommand, emit, relationsCommand, reportCommits } from './collections-cli.js';
|
|
20
20
|
import { formatDescriptors } from './schema-ops.js';
|
|
@@ -36,9 +36,13 @@ const QUIET = ['ignore', 'pipe', 'ignore'];
|
|
|
36
36
|
|
|
37
37
|
export const USAGE = `usage: dreamteamer <verb> [<target>] [flags]
|
|
38
38
|
|
|
39
|
-
--
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
--workspace, -w <name|path>
|
|
40
|
+
run the verb in another workspace: a record layer this workspace declares, by
|
|
41
|
+
its git_modules name, or any workspace by path. A path resolves from the
|
|
42
|
+
directory you typed it in; every other path in the command resolves inside the
|
|
43
|
+
target. The working directory is unchanged, and the flag reaches this command
|
|
44
|
+
only: a process it starts resolves its own workspace from its own directory.
|
|
45
|
+
--vault <path> deprecated — the old spelling of --workspace, still honoured.
|
|
42
46
|
|
|
43
47
|
record verbs (hard validation — invalid writes are rejected before disk).
|
|
44
48
|
A <target> is either a collection name or a <collection>/<id> reference; the reference splits at
|
|
@@ -54,7 +58,9 @@ the longest DECLARED collection prefix, so finance/transactions/2026/03/coffee i
|
|
|
54
58
|
case-insensitive variants; date-times sort and
|
|
55
59
|
compare as instants, across offsets; an enum
|
|
56
60
|
sorts in its declared order)
|
|
57
|
-
get <collection>/<id> [--json]
|
|
61
|
+
get <collection>/<id> [--json] (--json, and each list --json row, adds $file and
|
|
62
|
+
$repo: where the record is read from and the repo
|
|
63
|
+
that commits it — null outside every repo here)
|
|
58
64
|
add <collection> ["<title>"] --<field> <value> … [--id <explicit-id>]
|
|
59
65
|
(ONE bare positional fills the collection's title
|
|
60
66
|
field — the one its record_title opens with — so
|
|
@@ -266,10 +272,11 @@ const FIELD_VERBS = ['add-field', 'set-field', 'rm-field', 'rename-field', 'rena
|
|
|
266
272
|
//
|
|
267
273
|
// ⚠ Listing one here EXEMPTS it from the "documented flags are accepted by some verb" guard, which
|
|
268
274
|
// exists because 0.19.0 shipped a flag that was documented and silently swallowed. The exemption is
|
|
269
|
-
// only safe while the behaviour is pinned somewhere else: `--
|
|
270
|
-
// test/integration/cross-workspace-targeting.test.js. A global
|
|
271
|
-
// defect that guard was written to catch \u2014 add the coverage,
|
|
272
|
-
|
|
275
|
+
// only safe while the behaviour is pinned somewhere else: `--workspace` / `-w` is covered end-to-end in
|
|
276
|
+
// test/integration/workspace-flag.test.js and `--vault` in cross-workspace-targeting.test.js. A global
|
|
277
|
+
// flag with no such file is the exact defect that guard was written to catch \u2014 add the coverage,
|
|
278
|
+
// not the entry.
|
|
279
|
+
export const GLOBAL_FLAGS = ['workspace', 'vault'];
|
|
273
280
|
|
|
274
281
|
export const WORKSPACE_FLAGS = {
|
|
275
282
|
init: ['name', 'data_path', 'harnesses', 'workspace_module'], update: [],
|
|
@@ -519,15 +526,20 @@ export async function run(argv) {
|
|
|
519
526
|
if (sh) line += ` — shadows ${CHANNEL_LABEL[sh.loser]} copy`;
|
|
520
527
|
console.log(line);
|
|
521
528
|
}
|
|
522
|
-
// record layers: other workspaces cloned here for their records
|
|
523
|
-
|
|
529
|
+
// record layers: other workspaces cloned here for their records. The collections listed are
|
|
530
|
+
// the ones FOUND — compiled with this layer as a root and holding a folder in the clone —
|
|
531
|
+
// never the declared `records:`, which narrows and may name a folder that does not exist.
|
|
532
|
+
const layers = layerEntries(ws.pkg, ws.root);
|
|
524
533
|
if (layers.length) {
|
|
525
534
|
console.log('layers:');
|
|
526
|
-
|
|
527
|
-
|
|
535
|
+
let descriptors = [];
|
|
536
|
+
try { descriptors = [...new Store(ws).descriptors.values()]; } catch { /* no runtime yet */ }
|
|
537
|
+
for (const l of layers) {
|
|
538
|
+
const dir = path.join(ws.root, 'git_modules', l.name);
|
|
528
539
|
const ref = fs.existsSync(dir) ? tryGit(dir, ['rev-parse', '--short', 'HEAD']) : null;
|
|
529
|
-
const mod =
|
|
530
|
-
|
|
540
|
+
const mod = l.module ? modules.find((m) => m.layer === l.name) : null;
|
|
541
|
+
const found = descriptors.filter((d) => storageOf(d).roots.some((r) => r.layer === l.name && fs.existsSync(path.join(ws.root, r.path)))).map((d) => d.name).sort();
|
|
542
|
+
console.log(` ${l.name.padEnd(20)} ${ref ? `git_modules @ ${ref}${tryGit(dir, ['status', '--porcelain']) ? ' (dirty)' : ''}` : 'not installed — dreamteamer install'} · records: ${found.join(', ') || '(none found)'}${l.module ? ` · module ${mod ? moduleIdOf(mod.name) : '-'}` : ''}`);
|
|
531
543
|
}
|
|
532
544
|
}
|
|
533
545
|
// env-pointed roots (`storage.path: ${env:NAME}/…`), rendered per machine by compile: the
|
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,9 @@ 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
|
-
|
|
147
|
+
// stubs (0.41.0): `$stub` on a placeholder, `$shadows` on whatever answers over placeholders
|
|
148
|
+
const shadows = store.shadowedStubs(collection, id).map((f) => store.locationOf(d, f).file);
|
|
149
|
+
if (flags.json) { emit(JSON.stringify({ ...fields, id, ...whereKeys(store.locationOf(d, file)), ...(fields.stub === true ? { $stub: true } : {}), ...(shadows.length ? { $shadows: shadows } : {}) }, null, 2)); return 0; }
|
|
146
150
|
console.log(dump(fields).trimEnd());
|
|
147
151
|
return 0;
|
|
148
152
|
}
|
|
@@ -168,11 +172,13 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
168
172
|
flags[titleField] = pos[0];
|
|
169
173
|
}
|
|
170
174
|
const fields = coerceArrays(d, stripMeta(flags));
|
|
171
|
-
const { id, file, idFallback, deprecated } = store.add(collection, fields, { id: flags.id });
|
|
175
|
+
const { id, file, idFallback, deprecated, shadows } = store.add(collection, fields, { id: flags.id });
|
|
172
176
|
for (const k of deprecated ?? []) console.warn(`⚠ ${k} is deprecated on ${collection} — it still validates, and nothing draws it. Check the collection's description for what replaced it.`);
|
|
177
|
+
// promoting a stub is a choice the operator should see made: name every placeholder it now covers
|
|
178
|
+
const covers = (shadows ?? []).map((f) => store.layerOfFile(d, f)?.layer ?? 'this workspace');
|
|
173
179
|
flags.json
|
|
174
|
-
? emit(JSON.stringify({ id, path: rel(ws.root, file), ...(idFallback ? { idFallback } : {}) }))
|
|
175
|
-
: console.log(`✔ ${at}${rel(ws.root, file)}`);
|
|
180
|
+
? emit(JSON.stringify({ id, path: rel(ws.root, file), ...(idFallback ? { idFallback } : {}), ...(shadows?.length ? { $shadows: shadows.map((f) => store.locationOf(d, f).file) } : {}) }))
|
|
181
|
+
: console.log(`✔ ${at}${rel(ws.root, file)}${covers.length ? ` — shadows ${covers.length} stub${covers.length === 1 ? '' : 's'} (${covers.join(', ')})` : ''}`);
|
|
176
182
|
// ⚠ SAY IT, EVERY TIME. The id was derived from a hash because the value it is generated
|
|
177
183
|
// from carries no a-z0-9 — the write succeeded and the record is fine, but the id is
|
|
178
184
|
// unreadable and unguessable, and nobody finds that out until they try to type it. By
|
|
@@ -190,8 +196,9 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
190
196
|
const changes = coerceArrays(d, pairs(pos.slice(1)));
|
|
191
197
|
Object.assign(changes, coerceArrays(d, stripMeta(flags)));
|
|
192
198
|
if (!Object.keys(changes).length) throw new Error('nothing to set — pass key=value pairs or --key value flags');
|
|
199
|
+
const where = store.ids(collection).has(id) ? store.locate(collection, id) : null; // a missing id is store.set's to refuse
|
|
193
200
|
store.set(collection, id, changes);
|
|
194
|
-
flags.json ? emit(JSON.stringify({ id })) : console.log(`✔ ${at}updated`);
|
|
201
|
+
flags.json ? emit(JSON.stringify({ id, ...(where ? whereKeys(where) : {}) })) : console.log(`✔ ${at}updated${landedIn(where)}`);
|
|
195
202
|
return 0;
|
|
196
203
|
}
|
|
197
204
|
// Manual ordering. ONE record is written per move — that is the entire feature; a dense
|
|
@@ -231,8 +238,13 @@ export function collectionCommand(ws, collection, verb, args) {
|
|
|
231
238
|
case 'rm': {
|
|
232
239
|
const id = need(pos, 0, 'id');
|
|
233
240
|
if (flags['dry-run']) return dryRunPlan(`rm ${collection}/${id}`, { records: store.ids(collection).has(id) ? 1 : 0, refs: store.findInboundRefs(`${collection}/${id}`).length });
|
|
234
|
-
const
|
|
235
|
-
|
|
241
|
+
const where = store.ids(collection).has(id) ? store.locate(collection, id) : null; // a missing id is store.rm's to refuse
|
|
242
|
+
const { inboundIgnored, inboundResolveToStub } = store.rm(collection, id, { force: !!flags.force });
|
|
243
|
+
// the id does not vanish when a stub was shadowed by what was just removed — say which now answers
|
|
244
|
+
const next = store.ids(collection).get(id);
|
|
245
|
+
const showing = next ? store.layerOfFile(d, next) : null;
|
|
246
|
+
const nowShows = next ? `${inboundResolveToStub ? ` — ${inboundResolveToStub} inbound reference(s) now resolve to the stub` : ''}; stub ${showing ? `in layer ${showing.layer}` : 'in this workspace'} now shows (${store.locationOf(d, next).file})` : '';
|
|
247
|
+
flags.json ? emit(JSON.stringify({ id, removed: true, inboundIgnored, ...(next ? { $now: store.locationOf(d, next).file } : {}) })) : console.log(`✔ ${at}removed${landedIn(where)}${inboundIgnored ? ` (${inboundIgnored} inbound reference(s) left dangling — run \`dreamteamer check\`)` : ''}${nowShows}`);
|
|
236
248
|
return 0;
|
|
237
249
|
}
|
|
238
250
|
case 'rename': {
|
|
@@ -1002,7 +1014,7 @@ function relationsRebuild(store, flags, pos) {
|
|
|
1002
1014
|
// workspace against a module-owned target) implies no mirror on a target it cannot be committed with
|
|
1003
1015
|
const perRepo = (r) => {
|
|
1004
1016
|
const groups = new Map();
|
|
1005
|
-
for (const o of parseEach(store, r.owner, (f) => unreadableOwners.push(rel(store.root, f)))) {
|
|
1017
|
+
for (const o of parseEach(store, r.owner, (f) => unreadableOwners.push(rel(store.root, f)), { withStubs: true })) {
|
|
1006
1018
|
const repo = store.repoOfFile(store.descriptor(r.owner), o.file);
|
|
1007
1019
|
if (!groups.has(repo)) groups.set(repo, []);
|
|
1008
1020
|
groups.get(repo).push(o);
|
|
@@ -1066,10 +1078,14 @@ function relationsRebuild(store, flags, pos) {
|
|
|
1066
1078
|
* mid-walk cannot be resumed past — and rebuild is the one reader that has already written by the
|
|
1067
1079
|
* time a later record blows up, so an abort leaves a partial sweep behind an error naming no file
|
|
1068
1080
|
* at all. Here the bad record is handed to `onError` and skipped, and the walk finishes. */
|
|
1069
|
-
function* parseEach(store, collection, onError) {
|
|
1081
|
+
function* parseEach(store, collection, onError, { withStubs = false } = {}) {
|
|
1070
1082
|
const d = store.descriptor(collection);
|
|
1071
1083
|
const bf = bodyField(d);
|
|
1072
|
-
|
|
1084
|
+
// `withStubs`: a shadowed stub still OWNS references in its own repo, and the mirrors it justifies
|
|
1085
|
+
// there are not this workspace's to delete
|
|
1086
|
+
const rows = [...store.ids(collection)].map(([id, file]) => ({ id, file }));
|
|
1087
|
+
if (withStubs) rows.push(...store.shadowedStubRecords(collection));
|
|
1088
|
+
for (const { id, file } of rows) {
|
|
1073
1089
|
let fields;
|
|
1074
1090
|
try {
|
|
1075
1091
|
fields = parseRecord(file, d, bf);
|
|
@@ -1211,17 +1227,32 @@ function narrowRows(store, d, collection, flags) {
|
|
|
1211
1227
|
const resolve = where ? recordResolver(store) : null;
|
|
1212
1228
|
const bf = bodyField(d);
|
|
1213
1229
|
const rows = [];
|
|
1214
|
-
|
|
1230
|
+
const files = new Map();
|
|
1231
|
+
for (const { id, fields, file } of store.readAll(collection)) { // ONE walk, not one per record
|
|
1215
1232
|
if (!filters.every(([k, v]) => String(fields[k] ?? '') === String(v))) continue;
|
|
1216
1233
|
if (where && !matchesFilter({ ...fields, id }, where, resolve)) continue;
|
|
1217
1234
|
if (bf) delete fields[bf]; // bodies don't belong in listings
|
|
1218
1235
|
rows.push({ ...fields, id }); // record id WINS over any schema field named "id"
|
|
1236
|
+
files.set(id, file);
|
|
1219
1237
|
}
|
|
1220
1238
|
// sorting was studio-only until now: the browse table ordered records and no CLI
|
|
1221
1239
|
// invocation could. Same `sortRows` the server and api.ts call, so `--sort -starts`
|
|
1222
1240
|
// orders date-times by INSTANT across mixed offsets rather than by string.
|
|
1223
1241
|
if (sort) sortRows(rows, sort, jsonSchemaOf(d));
|
|
1224
|
-
return { rows, narrowed: !!(filters.length || where) };
|
|
1242
|
+
return { rows, narrowed: !!(filters.length || where), files };
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/** A record's location as `--json` carries it: `$file` and `$repo` (null = outside every repo here). */
|
|
1246
|
+
const whereKeys = ({ file, repo }) => ({ $file: file, $repo: repo });
|
|
1247
|
+
|
|
1248
|
+
/** What a write on an EXISTING record adds to its `✔` line: nothing in the workspace's own repo; the
|
|
1249
|
+
* repo when it is another clone (a layer, a module's list); and that it is never committed when the
|
|
1250
|
+
* root is outside every repo here. The workspace name alone used to be printed wherever it landed. */
|
|
1251
|
+
function landedIn(where) {
|
|
1252
|
+
if (!where) return '';
|
|
1253
|
+
const { repo } = where;
|
|
1254
|
+
if (repo === null) return ' — outside every git repo here, never committed';
|
|
1255
|
+
return repo === '.' ? '' : ` in ${repo}`;
|
|
1225
1256
|
}
|
|
1226
1257
|
|
|
1227
1258
|
/** `id` first, then the descriptor's own columns — the shape every text listing prints. */
|