dreamteamer 0.48.1 → 0.49.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -39
- package/collections/modules.collection.yaml +11 -0
- package/package.json +1 -1
- package/skills/using-dreamteamer/SKILL.md +8 -6
- package/skills/using-dreamteamer/references/before-you-build.md +8 -6
- package/skills/using-dreamteamer/references/collections.md +16 -7
- package/skills/using-dreamteamer/references/commands.md +4 -3
- package/skills/using-dreamteamer/references/data-modeling.md +3 -2
- package/skills/using-dreamteamer/references/extensions.md +13 -12
- package/skills/using-dreamteamer/references/getting-started.md +4 -3
- package/skills/using-dreamteamer/references/records.md +4 -4
- package/skills/using-dreamteamer/references/setup.md +7 -5
- package/skills/using-dreamteamer/references/ui-components.md +1 -1
- package/skills/using-dreamteamer/references/ui-views.md +39 -1
- package/skills/using-dreamteamer/references/writing-a-module.md +3 -2
- package/src/api.d.ts +18 -0
- package/src/api.js +7 -0
- package/src/check-alone.js +58 -8
- package/src/check.js +10 -0
- package/src/cli.js +36 -18
- package/src/collections-cli.js +9 -41
- package/src/compile-collections.js +20 -3
- package/src/compile.js +59 -8
- package/src/extensions.js +1 -1
- package/src/init.js +1 -1
- package/src/install-modules.js +113 -46
- package/src/nav-fragments.js +190 -0
- package/src/nav.js +185 -0
- package/src/schema-ops.js +4 -4
- package/src/semver.js +4 -0
- package/src/setup.js +6 -3
- package/src/store.js +35 -11
- package/src/unread-data.js +74 -0
- package/src/update-setup.js +6 -5
- package/src/update.js +43 -12
- package/src/workspace.js +52 -13
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
// The shipped nav fragments (cr-dt-008, design §3–4): a module names a nav.yaml of its own in
|
|
2
|
+
// `dreamteamer.nav`, and after an install or an update the workspace's nav.yaml gains the rows that
|
|
3
|
+
// fragment places and the document does not — never a row the operator already placed, hid or moved.
|
|
4
|
+
//
|
|
5
|
+
// Workspace layer: which package a fragment comes from, and whether it may place a collection, is a
|
|
6
|
+
// question about modules. The rule is owns-or-overlays — a module places only collections it owns or
|
|
7
|
+
// overlays, a module preset only its members' — so a fragment can never draw another module's rows in
|
|
8
|
+
// its own folder. A name no installed module owns is dropped without a word: it is a preset member the
|
|
9
|
+
// operator removed, and it is placed once its owner is installed again.
|
|
10
|
+
//
|
|
11
|
+
// Old nav settings (`dreamteamer.navGroups` / `navOrder` / `navHidden` in .vscode/settings.json) with no
|
|
12
|
+
// nav.yaml mean the workspace still draws by those: the merge skips, and install and update refuse
|
|
13
|
+
// before npm (`navGuard`) until the settings are migrated or `--allow nav-reset` says to start fresh.
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { discoverModules, moduleIdOf } from './compile.js';
|
|
17
|
+
import { loadDescriptors } from './runtime.js';
|
|
18
|
+
import { moduleOf, overlaidByOf } from './descriptor.js';
|
|
19
|
+
import { findWorkspace } from './workspace.js';
|
|
20
|
+
import { parseNavDoc, readNavDoc, writeNavDoc, placedNames, mergeFragment, NavDocError, NAV_FILE } from './nav.js';
|
|
21
|
+
|
|
22
|
+
export const NAV_SETTINGS_LINE = 'nav: settings found, migrated on the next open of the editor or dt web';
|
|
23
|
+
export const NAV_GUARD_LINE = 'your nav settings are not saved to nav.yaml yet — run: npx -p @dreamteamer/protocol@0.3 dt-nav migrate (or open this workspace once in the editor 0.27 or later), then run this again; --allow nav-reset skips it';
|
|
24
|
+
const NAV_KEYS = ['dreamteamer.navGroups', 'dreamteamer.navOrder', 'dreamteamer.navHidden'];
|
|
25
|
+
|
|
26
|
+
export class NavFragmentRefusal extends Error {
|
|
27
|
+
constructor(message) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = 'NavFragmentRefusal';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** JSON with comments and trailing commas (what VS Code writes) as plain JSON text. Strings are kept
|
|
34
|
+
* whole: a `//` or a `,]` inside one is data. */
|
|
35
|
+
function stripJsonc(text) {
|
|
36
|
+
const scan = (src, step) => {
|
|
37
|
+
let out = '';
|
|
38
|
+
for (let i = 0; i < src.length; i++) {
|
|
39
|
+
if (src[i] === '"') {
|
|
40
|
+
let j = i + 1;
|
|
41
|
+
while (j < src.length && src[j] !== '"') j += src[j] === '\\' ? 2 : 1;
|
|
42
|
+
out += src.slice(i, j + 1);
|
|
43
|
+
i = j;
|
|
44
|
+
} else {
|
|
45
|
+
const r = step(src, i);
|
|
46
|
+
out += r.text;
|
|
47
|
+
i = r.at;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return out;
|
|
51
|
+
};
|
|
52
|
+
const noComments = scan(text, (src, i) => {
|
|
53
|
+
if (src[i] === '/' && src[i + 1] === '/') { let j = i; while (j < src.length && src[j] !== '\n') j++; return { text: '\n', at: j }; }
|
|
54
|
+
if (src[i] === '/' && src[i + 1] === '*') { const end = src.indexOf('*/', i + 2); return { text: ' ', at: end === -1 ? src.length : end + 1 }; }
|
|
55
|
+
return { text: src[i], at: i };
|
|
56
|
+
});
|
|
57
|
+
return scan(noComments, (src, i) => (src[i] === ',' && /^\s*[}\]]/.test(src.slice(i + 1)) ? { text: '', at: i } : { text: src[i], at: i }));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** The old nav settings this workspace still sets — the names among navGroups, navOrder and navHidden
|
|
61
|
+
* whose value is a non-empty list or map — or null. An absent or unparseable file is null;
|
|
62
|
+
* `layersFolder` is never one of them. */
|
|
63
|
+
export function navSettings(root) {
|
|
64
|
+
let settings;
|
|
65
|
+
try {
|
|
66
|
+
settings = JSON.parse(stripJsonc(fs.readFileSync(path.join(root, '.vscode', 'settings.json'), 'utf8')));
|
|
67
|
+
} catch { return null; }
|
|
68
|
+
if (!settings || typeof settings !== 'object' || Array.isArray(settings)) return null;
|
|
69
|
+
const set = NAV_KEYS.filter((k) => {
|
|
70
|
+
const v = settings[k];
|
|
71
|
+
if (Array.isArray(v)) return v.length > 0;
|
|
72
|
+
return v !== null && typeof v === 'object' && Object.keys(v).length > 0;
|
|
73
|
+
});
|
|
74
|
+
return set.length ? set : null;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** The refusal install and update print before npm, or null: nav.yaml absent and old nav settings set. */
|
|
78
|
+
export function navGuard(root) {
|
|
79
|
+
if (fs.existsSync(path.join(root, NAV_FILE))) return null;
|
|
80
|
+
return navSettings(root) ? NAV_GUARD_LINE : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The refusal install and update print before npm when the workspace's nav.yaml does not read, or null.
|
|
85
|
+
* Asked only when a package of the call ships a fragment (`shipsFragment`): a call that ships none merges
|
|
86
|
+
* nothing and never reads the file, so a malformed nav.yaml blocks only the installs that would merge into it.
|
|
87
|
+
*/
|
|
88
|
+
export function navDocGuard(root) {
|
|
89
|
+
try { readNavDoc(root); return null; } catch (e) {
|
|
90
|
+
if (e instanceof NavDocError) return e.message;
|
|
91
|
+
throw e;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Whether any package of a resolved list ships a nav fragment (`dreamteamer.nav`). */
|
|
96
|
+
export const shipsFragment = (list) => list.some((e) => e.manifest?.dreamteamer?.nav);
|
|
97
|
+
|
|
98
|
+
const readPkg = (dir) => { try { return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')); } catch { return null; } };
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The merged document install and update write — or a refusal. `ws` is a compiled handle; `names` are
|
|
102
|
+
* package names (default every discovered module). Every fragment is judged before anything merges,
|
|
103
|
+
* so one bad fragment refuses the whole call. Returns `{ doc, placed, changed }`, or
|
|
104
|
+
* `{ doc: null, placed: [], changed: false, skipped: 'settings' }` while old nav settings stand.
|
|
105
|
+
*/
|
|
106
|
+
export function planNavFragments(ws, { names, ignoreSettings = false } = {}) {
|
|
107
|
+
const { modules } = discoverModules(ws.root, ws.pkg);
|
|
108
|
+
const byName = new Map();
|
|
109
|
+
for (const m of modules) byName.set(m.name, { ...m, manifest: readPkg(m.root) ?? {} });
|
|
110
|
+
const byId = new Map([...byName.values()].map((m) => [moduleIdOf(m.name), m.name]));
|
|
111
|
+
|
|
112
|
+
// a preset's reach: its members, flattened through nested presets (a seen-set stops a ring)
|
|
113
|
+
const membersOf = (name, seen = new Set()) => {
|
|
114
|
+
if (seen.has(name)) return [];
|
|
115
|
+
seen.add(name);
|
|
116
|
+
const preset = byName.get(name)?.manifest?.dreamteamer?.preset;
|
|
117
|
+
if (!preset || typeof preset !== 'object') return [];
|
|
118
|
+
return Object.keys(preset).flatMap((m) => [m, ...membersOf(m, seen)]);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const wanted = (names ?? [...byName.keys()]).filter((n) => byName.get(n)?.manifest?.dreamteamer?.nav);
|
|
122
|
+
const isPreset = (n) => !!byName.get(n).manifest.dreamteamer.preset;
|
|
123
|
+
const ordered = [...wanted.filter(isPreset), ...wanted.filter((n) => !isPreset(n))];
|
|
124
|
+
|
|
125
|
+
const descriptors = loadDescriptors(ws.root) ?? new Map();
|
|
126
|
+
const kept = [];
|
|
127
|
+
for (const pkgName of ordered) {
|
|
128
|
+
const m = byName.get(pkgName);
|
|
129
|
+
const reach = isPreset(pkgName) ? membersOf(pkgName) : [pkgName];
|
|
130
|
+
const allowed = new Set(reach.map(moduleIdOf));
|
|
131
|
+
const declared = new Set(reach.flatMap((n) => byName.get(n)?.manifest?.dreamteamer?.namespaces ?? []));
|
|
132
|
+
let fragment;
|
|
133
|
+
try {
|
|
134
|
+
fragment = parseNavDoc(fs.readFileSync(path.join(m.root, m.manifest.dreamteamer.nav), 'utf8'));
|
|
135
|
+
} catch (e) {
|
|
136
|
+
if (e instanceof NavDocError) throw new NavFragmentRefusal(`nav.yaml of ${pkgName}: ${e.message}`);
|
|
137
|
+
throw new NavFragmentRefusal(`nav.yaml of ${pkgName}: ${m.manifest.dreamteamer.nav} could not be read — ${e.code === 'ENOENT' ? 'the package does not ship it' : e.message}`);
|
|
138
|
+
}
|
|
139
|
+
const judge = (items) => {
|
|
140
|
+
const out = [];
|
|
141
|
+
for (const e of Array.isArray(items) ? items : []) {
|
|
142
|
+
const c = typeof e === 'string' ? e : (e && typeof e.collection === 'string' ? e.collection : null);
|
|
143
|
+
if (c !== null) {
|
|
144
|
+
const d = descriptors.get(c);
|
|
145
|
+
if (!d) continue; // nothing installed owns it — a removed member; placed once it is back
|
|
146
|
+
if (!allowed.has(moduleOf(d)) && !overlaidByOf(d).some((id) => allowed.has(id))) {
|
|
147
|
+
const owner = byId.get(moduleOf(d)) ?? 'the engine';
|
|
148
|
+
throw new NavFragmentRefusal(`nav.yaml of ${pkgName} places ${c}, which ${owner} owns`);
|
|
149
|
+
}
|
|
150
|
+
out.push(e);
|
|
151
|
+
} else if (e && typeof e.folder === 'string') {
|
|
152
|
+
out.push({ ...e, items: judge(e.items) });
|
|
153
|
+
} else if (e && typeof e.namespace === 'string') {
|
|
154
|
+
if (!declared.has(e.namespace)) throw new NavFragmentRefusal(`nav.yaml of ${pkgName} places namespace ${e.namespace}, which ${pkgName} does not declare`);
|
|
155
|
+
out.push(Array.isArray(e.items) ? { ...e, items: judge(e.items) } : e);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return out;
|
|
159
|
+
};
|
|
160
|
+
kept.push({ tree: judge(fragment.tree), hidden: [] });
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!ignoreSettings && !fs.existsSync(path.join(ws.root, NAV_FILE)) && navSettings(ws.root)) {
|
|
164
|
+
return { doc: null, placed: [], changed: false, skipped: 'settings' };
|
|
165
|
+
}
|
|
166
|
+
// no fragment among the packages: nothing merges, and the workspace's nav.yaml is never read
|
|
167
|
+
if (!kept.length) return { doc: null, placed: [], changed: false };
|
|
168
|
+
const start = readNavDoc(ws.root) ?? { tree: [], hidden: [] };
|
|
169
|
+
let doc = start;
|
|
170
|
+
const placed = [];
|
|
171
|
+
for (const f of kept) {
|
|
172
|
+
const r = mergeFragment(doc, f, { placed: placedNames(doc) });
|
|
173
|
+
doc = r.doc;
|
|
174
|
+
placed.push(...r.placedNow);
|
|
175
|
+
}
|
|
176
|
+
return { doc, placed, changed: doc !== start };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The installed fragments merged into `<root>/nav.yaml`, written when anything was placed. What a host
|
|
181
|
+
* calls after its own settings migration; install and update run the same plan inside their compile
|
|
182
|
+
* step. Throws NavFragmentRefusal (and a NavDocError for a nav.yaml it cannot read) and writes nothing.
|
|
183
|
+
*/
|
|
184
|
+
export function applyNavFragments(root, { names, ignoreSettings = false } = {}) {
|
|
185
|
+
const found = findWorkspace(root);
|
|
186
|
+
const plan = planNavFragments({ root: found.root, pkg: found.pkg }, { names, ignoreSettings });
|
|
187
|
+
if (plan.skipped) return { written: false, placed: [], skipped: plan.skipped };
|
|
188
|
+
if (plan.changed) writeNavDoc(found.root, plan.doc);
|
|
189
|
+
return { written: plan.changed, placed: plan.placed };
|
|
190
|
+
}
|
package/src/nav.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
// The nav document — `nav.yaml` at the workspace root (cr-dt-008, design §3). One tracked file says how
|
|
2
|
+
// the left nav draws: folders, namespace folders and rows in the operator's order, plus the rows not
|
|
3
|
+
// drawn at all. Every host (the editor, dt web, install's merge) reads and writes it through these
|
|
4
|
+
// functions, so there is one grammar and one writer.
|
|
5
|
+
//
|
|
6
|
+
// Record layer: a file under the root, parsed and validated against names the caller passes in. It
|
|
7
|
+
// never learns what a module or a package is — which module a fragment comes from, and whether it may
|
|
8
|
+
// place a name, is judged in nav-fragments.js on the workspace side.
|
|
9
|
+
//
|
|
10
|
+
// NavDoc = { tree: Entry[], hidden: string[] }
|
|
11
|
+
// Entry = string a collection by name
|
|
12
|
+
// | { collection, icon? } the long form, when the icon is overridden
|
|
13
|
+
// | { folder, icon?, hidden?, items: Entry[] } a folder; folders nest
|
|
14
|
+
// | { namespace, icon?, hidden?, items?: Entry[] } a namespace folder; no items = wholly unplaced
|
|
15
|
+
import fs from 'node:fs';
|
|
16
|
+
import path from 'node:path';
|
|
17
|
+
import { load, dump } from './yaml.js';
|
|
18
|
+
import { atomicWrite } from './store.js';
|
|
19
|
+
|
|
20
|
+
export const NAV_FILE = 'nav.yaml';
|
|
21
|
+
const HEADER = '# The left nav of this workspace. Drag and drop writes this file; so may you.';
|
|
22
|
+
|
|
23
|
+
export class NavDocError extends Error {
|
|
24
|
+
constructor(message) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = 'NavDocError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const isObject = (v) => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
31
|
+
/** 'collection' · 'folder' · 'namespace', or null for an entry of none of the four shapes. */
|
|
32
|
+
const kindOf = (e) => (typeof e === 'string' || typeof e?.collection === 'string' ? 'collection'
|
|
33
|
+
: typeof e?.folder === 'string' ? 'folder'
|
|
34
|
+
: typeof e?.namespace === 'string' ? 'namespace' : null);
|
|
35
|
+
const nameOf = (e) => (typeof e === 'string' ? e : e.collection);
|
|
36
|
+
|
|
37
|
+
/** Every entry of a tree level and the levels inside it, depth first, with its kind. */
|
|
38
|
+
function eachEntry(items, visit) {
|
|
39
|
+
if (!Array.isArray(items)) return;
|
|
40
|
+
for (const e of items) {
|
|
41
|
+
const kind = kindOf(e);
|
|
42
|
+
visit(e, kind);
|
|
43
|
+
if (kind === 'folder' || kind === 'namespace') eachEntry(e.items, visit);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The text of a nav.yaml, as a NavDoc. Pure. An empty file, or one with neither key, is an empty document. */
|
|
48
|
+
export function parseNavDoc(text) {
|
|
49
|
+
let raw;
|
|
50
|
+
try {
|
|
51
|
+
raw = load(String(text));
|
|
52
|
+
} catch (e) {
|
|
53
|
+
throw new NavDocError(`nav.yaml is not valid YAML — ${e.message}`);
|
|
54
|
+
}
|
|
55
|
+
if (raw === undefined || raw === null) return { tree: [], hidden: [] };
|
|
56
|
+
if (!isObject(raw)) throw new NavDocError('nav.yaml is not a mapping');
|
|
57
|
+
const tree = raw.tree ?? [];
|
|
58
|
+
const hidden = raw.hidden ?? [];
|
|
59
|
+
if (!Array.isArray(tree)) throw new NavDocError('nav.yaml: tree must be a list');
|
|
60
|
+
if (!Array.isArray(hidden)) throw new NavDocError('nav.yaml: hidden must be a list');
|
|
61
|
+
return { tree, hidden };
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** A NavDoc as the text of a nav.yaml: the header line, `tree`, and `hidden` only when it holds a name. Pure. */
|
|
65
|
+
export function serializeNavDoc(doc) {
|
|
66
|
+
const body = { tree: doc.tree };
|
|
67
|
+
if (doc.hidden.length) body.hidden = doc.hidden;
|
|
68
|
+
return `${HEADER}\n${dump(body).replace(/\n+$/, '')}\n`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** `<root>/nav.yaml` parsed, or null when there is none. Any other read failure is a NavDocError. */
|
|
72
|
+
export function readNavDoc(root) {
|
|
73
|
+
let text;
|
|
74
|
+
try {
|
|
75
|
+
text = fs.readFileSync(path.join(root, NAV_FILE), 'utf8');
|
|
76
|
+
} catch (e) {
|
|
77
|
+
if (e.code === 'ENOENT') return null;
|
|
78
|
+
throw new NavDocError(`nav.yaml could not be read — ${e.message}`);
|
|
79
|
+
}
|
|
80
|
+
return parseNavDoc(text);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The one writer every host uses: the whole document, atomically. */
|
|
84
|
+
export function writeNavDoc(root, doc) {
|
|
85
|
+
return atomicWrite(path.join(root, NAV_FILE), serializeNavDoc(doc));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** What `dt check` reports about a document: names that resolve to nothing, names listed twice. Never throws. */
|
|
89
|
+
export function validateNavDoc(doc, { collections, namespaces = [] }) {
|
|
90
|
+
const declared = new Set(namespaces);
|
|
91
|
+
const warnings = [];
|
|
92
|
+
const warn = (warning) => warnings.push({ warning });
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
const twice = new Set();
|
|
95
|
+
const count = (name) => {
|
|
96
|
+
if (seen.has(name) && !twice.has(name)) { twice.add(name); warn(`"${name}" is listed twice — it draws at its first place`); }
|
|
97
|
+
seen.add(name);
|
|
98
|
+
};
|
|
99
|
+
eachEntry(doc.tree, (e, kind) => {
|
|
100
|
+
if (kind === 'collection') {
|
|
101
|
+
if (!collections.has(nameOf(e))) warn(`unknown collection "${nameOf(e)}"`);
|
|
102
|
+
count(nameOf(e));
|
|
103
|
+
} else if (kind === 'namespace') {
|
|
104
|
+
if (!declared.has(e.namespace)) warn(`unknown namespace "${e.namespace}"`);
|
|
105
|
+
count(e.namespace);
|
|
106
|
+
} else if (kind === 'folder') {
|
|
107
|
+
if (!Array.isArray(e.items)) warn(`folder "${e.folder}" has no items list`);
|
|
108
|
+
} else warn(`${JSON.stringify(e)} is not a collection, a folder or a namespace`);
|
|
109
|
+
});
|
|
110
|
+
for (const name of doc.hidden) {
|
|
111
|
+
if (typeof name !== 'string') { warn(`hidden holds ${JSON.stringify(name)}, which is not a name`); continue; }
|
|
112
|
+
// a hidden name is a row or a whole namespace folder
|
|
113
|
+
if (!collections.has(name) && !declared.has(name)) warn(`unknown collection "${name}"`);
|
|
114
|
+
count(name);
|
|
115
|
+
}
|
|
116
|
+
return warnings;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** The names of one kind of entry in the tree, at any depth, plus every hidden name. */
|
|
120
|
+
function namesIn(doc, wanted) {
|
|
121
|
+
const out = new Set();
|
|
122
|
+
eachEntry(doc.tree, (e, kind) => { if (kind === wanted) out.add(kind === 'collection' ? nameOf(e) : e.namespace); });
|
|
123
|
+
for (const name of doc.hidden) if (typeof name === 'string') out.add(name);
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** Every collection the document places: named in the tree at any depth, or hidden. A namespace entry
|
|
128
|
+
* places nothing by itself (design §3 rule 3) — its collections are placed only by name. */
|
|
129
|
+
export const placedNames = (doc) => namesIn(doc, 'collection');
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A module's fragment merged into the document: it only ever ADDS what the document does not place yet,
|
|
133
|
+
* and never moves what is placed. Pure — neither input is mutated, and when nothing is placed the SAME
|
|
134
|
+
* `doc` object comes back, so a caller can tell "nothing to write" by identity. The fragment's `hidden`
|
|
135
|
+
* is ignored: a module never hides a row.
|
|
136
|
+
*
|
|
137
|
+
* Per fragment level, against the document level at the same depth: a row not placed is appended; a
|
|
138
|
+
* folder merges into the same-label folder AT THE SAME LEVEL, else into a new one appended only when it
|
|
139
|
+
* placed something; a namespace merges into the same namespace's entry at the same level, else — when
|
|
140
|
+
* the document names that namespace nowhere — into a new entry; named at another level, nothing is
|
|
141
|
+
* created and its rows stay unplaced (the drawing puts them inside that namespace's folder).
|
|
142
|
+
*/
|
|
143
|
+
export function mergeFragment(doc, fragment, { placed = placedNames(doc) } = {}) {
|
|
144
|
+
const taken = new Set(placed);
|
|
145
|
+
const named = namesIn(doc, 'namespace');
|
|
146
|
+
const placedNow = [];
|
|
147
|
+
// one tree level: `level` is copied on its first change, so an untouched level comes back as itself
|
|
148
|
+
const mergeLevel = (level, items) => {
|
|
149
|
+
let out = level;
|
|
150
|
+
const own = () => { if (out === level) out = [...level]; return out; };
|
|
151
|
+
const into = (i, e) => { // merge e's items into out[i]'s
|
|
152
|
+
const current = Array.isArray(out[i].items) ? out[i].items : [];
|
|
153
|
+
const merged = mergeLevel(current, e.items);
|
|
154
|
+
if (merged !== current) own()[i] = { ...out[i], items: merged };
|
|
155
|
+
};
|
|
156
|
+
for (const f of Array.isArray(items) ? items : []) {
|
|
157
|
+
const kind = kindOf(f);
|
|
158
|
+
if (kind === 'collection') {
|
|
159
|
+
const c = nameOf(f);
|
|
160
|
+
if (taken.has(c)) continue;
|
|
161
|
+
taken.add(c);
|
|
162
|
+
placedNow.push(c);
|
|
163
|
+
own().push(f.icon == null ? c : { collection: c, icon: f.icon });
|
|
164
|
+
} else if (kind === 'folder') {
|
|
165
|
+
const i = out.findIndex((e) => kindOf(e) === 'folder' && e.folder === f.folder);
|
|
166
|
+
if (i >= 0) { into(i, f); continue; }
|
|
167
|
+
const merged = mergeLevel([], f.items);
|
|
168
|
+
if (merged.length) own().push({ folder: f.folder, ...decor(f), items: merged });
|
|
169
|
+
} else if (kind === 'namespace') {
|
|
170
|
+
const i = out.findIndex((e) => kindOf(e) === 'namespace' && e.namespace === f.namespace);
|
|
171
|
+
if (i >= 0) { into(i, f); continue; }
|
|
172
|
+
if (named.has(f.namespace)) continue; // named at another level: its rows draw inside it
|
|
173
|
+
const merged = mergeLevel([], f.items);
|
|
174
|
+
if (!merged.length && f.items?.length) continue;
|
|
175
|
+
named.add(f.namespace);
|
|
176
|
+
own().push({ namespace: f.namespace, ...decor(f), ...(merged.length ? { items: merged } : {}) });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return out;
|
|
180
|
+
};
|
|
181
|
+
const merged = mergeLevel(doc.tree, fragment.tree);
|
|
182
|
+
return { doc: merged === doc.tree ? doc : { tree: merged, hidden: [...doc.hidden] }, placedNow };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const decor = (e) => ({ ...(e.icon != null ? { icon: e.icon } : {}), ...(e.hidden === true ? { hidden: true } : {}) });
|
package/src/schema-ops.js
CHANGED
|
@@ -607,7 +607,7 @@ export function renameModule(ws, store, oldId, newId) {
|
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
// ---- moving a collection between modules -------------------------------------------------------
|
|
610
|
-
// §7. `dt set collections/teams module=hr` — NOT `move
|
|
610
|
+
// §7. `dt set collections/teams module=hr` — NOT `move`/`reorder` (the nav's order is nav.yaml since 0.49). The descriptor
|
|
611
611
|
// SOURCE relocates; the RECORDS do not, because a namespace and a `storage.path` are properties of
|
|
612
612
|
// the collection rather than of the module, so a move never changes an id and never touches data.
|
|
613
613
|
|
|
@@ -766,9 +766,9 @@ export function moveCollection(ws, store, name, toModule, { dryRun = false } = {
|
|
|
766
766
|
|
|
767
767
|
/**
|
|
768
768
|
* The collection-level keys `dt set collections/<c>` writes, each by its v2 path, and how each
|
|
769
|
-
* parses. A dotted key is a position inside a block (`display.nav.icon=pulse`).
|
|
770
|
-
*
|
|
771
|
-
*
|
|
769
|
+
* parses. A dotted key is a position inside a block (`display.nav.icon=pulse`). `display.nav.order`
|
|
770
|
+
* stays settable and compiles, but since 0.49 it moves no row — the nav's order is nav.yaml, and
|
|
771
|
+
* `dt reorder collections/<c>` is refused saying so.
|
|
772
772
|
*
|
|
773
773
|
* ⚠ `name` is deliberately absent, and so are `fields`, `storage` and `ids`. Renaming a
|
|
774
774
|
* collection moves its descriptor, its records, their filenames and every inbound reference in one
|
package/src/semver.js
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
// x-ranges (1.2.x), combined comparators (">=1.0.0 <2.0.0"), <, <=, >,
|
|
5
5
|
// prerelease/build tags. callers treat null as "warn, don't guess".
|
|
6
6
|
|
|
7
|
+
/** An exact version — what a module preset pins and `--save-exact` writes. Here, not in
|
|
8
|
+
* install-modules.js, because compile reads it and install-modules imports compile. */
|
|
9
|
+
export const EXACT = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
|
|
10
|
+
|
|
7
11
|
const parse = (v) => {
|
|
8
12
|
const m = /^(\d+)\.(\d+)\.(\d+)$/.exec(String(v).trim());
|
|
9
13
|
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
|
package/src/setup.js
CHANGED
|
@@ -42,13 +42,16 @@ export function parseInputFlags(argv) {
|
|
|
42
42
|
return out;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
/** `--allow <kind>`, repeated; an unknown kind is a usage error naming the vocabulary.
|
|
46
|
-
|
|
45
|
+
/** `--allow <kind>`, repeated; an unknown kind is a usage error naming the vocabulary. `also` adds kinds
|
|
46
|
+
* a verb takes beyond the setup effects (`dt install`'s `nav-reset`) — the caller removes them before a
|
|
47
|
+
* unit sees the set, and `dt setup` passes none. */
|
|
48
|
+
export function parseAllow(argv, { also = [] } = {}) {
|
|
47
49
|
const allow = new Set();
|
|
50
|
+
const kinds = [...EFFECTS_ALLOWED, ...also];
|
|
48
51
|
for (let i = 0; i < argv.length; i++) {
|
|
49
52
|
if (argv[i] !== '--allow') continue;
|
|
50
53
|
const kind = argv[++i];
|
|
51
|
-
if (!
|
|
54
|
+
if (!kinds.includes(kind)) throw usage(`--allow takes one of ${kinds.join(', ')} (got ${JSON.stringify(kind)}); an account step is \`dt setup <unit> --authorize\``);
|
|
52
55
|
allow.add(kind);
|
|
53
56
|
}
|
|
54
57
|
return allow;
|
package/src/store.js
CHANGED
|
@@ -135,7 +135,8 @@ export class Store {
|
|
|
135
135
|
* against — the two read the same relation rows, so they cannot disagree about what a mirror holds.
|
|
136
136
|
*
|
|
137
137
|
* Runs INSIDE withWriteLock, after the owner file is on disk. Nothing is validated here: an attach
|
|
138
|
-
* was proved
|
|
138
|
+
* was proved by `checkRefs` before the lock — to exist, or to be external (vouched for by an exports
|
|
139
|
+
* manifest, no record here to mirror onto) — and a detach is removal, which cannot dangle.
|
|
139
140
|
*
|
|
140
141
|
* ⚠ ALL-OR-NOTHING, by its own hand. The one refusal it can raise (a unique owner) is discoverable only
|
|
141
142
|
* ON a target, i.e. partway through a loop that may already have rewritten other targets — so a
|
|
@@ -193,8 +194,10 @@ export class Store {
|
|
|
193
194
|
// A DETACH can name a target that is already gone: the owner outlived it (a `--force`
|
|
194
195
|
// rm), and its FK is the dangling reference `check` reports. There is no mirror left
|
|
195
196
|
// to edit and `read` would throw, turning someone else's stale data into a refusal of
|
|
196
|
-
// this write. An attach
|
|
197
|
-
|
|
197
|
+
// this write. An attach lands here missing only when checkRefs accepted it as external
|
|
198
|
+
// (an exports manifest vouches for it): nothing here holds it, so there is no mirror to write.
|
|
199
|
+
// A target whose env-pointed root cannot render here is unread: no mirror either.
|
|
200
|
+
if (storageOf(td).unavailable || !this.ids(rel.target).has(parsed.id)) return;
|
|
198
201
|
// another repo answers: no mirror there (see above) — mirrors stay per repo
|
|
199
202
|
const file = this.mirrorFileFor(rel.target, parsed.id, ownerRepo);
|
|
200
203
|
if (!file) return;
|
|
@@ -635,11 +638,21 @@ export class Store {
|
|
|
635
638
|
if (!f) throw new Error(`${referrer}: no such record here — a referrer is a record this workspace reads`);
|
|
636
639
|
repo = this.layerOfFile(rd, f)?.layer ?? null;
|
|
637
640
|
}
|
|
641
|
+
const v = this.vouched(collection, id, repo);
|
|
642
|
+
if (!v || v.seen) return null;
|
|
643
|
+
return { label: v.label, ...(v.from ? { from: v.from } : {}), manifest: v.manifest };
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
/** The entry the exports manifest of `repo` (a layer name; null: the write root) holds for an id —
|
|
647
|
+
* `{ label, from?, manifest, seen }`, `seen` when its holder is read here (so the entry vouches for
|
|
648
|
+
* nothing: the holder answers, and lacks it) — or null. The one reading `external` and `checkRefs`
|
|
649
|
+
* share, so a write and `check` (src/check.js checkRef) reach one verdict on identical bytes. */
|
|
650
|
+
vouched(collection, id, repo = null) {
|
|
638
651
|
const facts = exportsFacts(this.root);
|
|
639
652
|
const ctx = exportsContext({ root: this.root, descriptors: this.descriptors, own: facts.own, layers: facts.layers, dataPath: facts.data });
|
|
640
653
|
const e = readExports(ctx.rootOf(repo))?.[collection]?.[id];
|
|
641
|
-
if (!e
|
|
642
|
-
return { label: e.label, ...(e.from ? { from: e.from } : {}), manifest: path.relative(this.root, path.join(ctx.rootOf(repo), EXPORTS_FILE)) };
|
|
654
|
+
if (!e) return null;
|
|
655
|
+
return { label: e.label, ...(e.from ? { from: e.from } : {}), manifest: path.relative(this.root, path.join(ctx.rootOf(repo), EXPORTS_FILE)), seen: sees(e, collection, ctx) };
|
|
643
656
|
}
|
|
644
657
|
|
|
645
658
|
read(collection, id) {
|
|
@@ -742,7 +755,7 @@ export class Store {
|
|
|
742
755
|
// is the whole point of a revert — because `check` re-reads that file and expects a mirror only
|
|
743
756
|
// for a ref it can parse. Qualifying `after` here would attach a mirror check then calls stale.
|
|
744
757
|
const restored = { ...tmpFields };
|
|
745
|
-
this.validate(d, tmpFields);
|
|
758
|
+
this.validate(d, tmpFields, { repo: this.layerOfFile(d, file)?.layer ?? null });
|
|
746
759
|
// Restoring an owner field restores its PLACEMENT too — the historical record lived where its
|
|
747
760
|
// historical owner put it, and writing it into whatever folder the record sits in today would
|
|
748
761
|
// leave a file `check` reports the moment it lands. Same rule as `set`: only the owner moves it.
|
|
@@ -886,7 +899,7 @@ export class Store {
|
|
|
886
899
|
|
|
887
900
|
// ---- validation (hard) ---------------------------------------------------
|
|
888
901
|
|
|
889
|
-
validate(d, fields, { skipRefs = false } = {}) {
|
|
902
|
+
validate(d, fields, { skipRefs = false, repo = null } = {}) {
|
|
890
903
|
// hard at the tools includes UNKNOWN fields: a typo'd key must never land on disk
|
|
891
904
|
const unknown = unknownFields(d, fields);
|
|
892
905
|
if (unknown.length) throw new Error(`unknown field(s) for this collection: ${unknown.join(', ')} — nothing was written.`);
|
|
@@ -910,7 +923,7 @@ export class Store {
|
|
|
910
923
|
const remedy = mirrorRemedy(d, validate.errors.map((e) => e.instancePath.split('/')[1]));
|
|
911
924
|
throw new Error(`validation failed:\n${msgs.join('\n')}${remedy}\nnothing was written.`);
|
|
912
925
|
}
|
|
913
|
-
if (!skipRefs) this.checkRefs(d, fields);
|
|
926
|
+
if (!skipRefs) this.checkRefs(d, fields, [], repo);
|
|
914
927
|
return fields;
|
|
915
928
|
}
|
|
916
929
|
|
|
@@ -941,7 +954,9 @@ export class Store {
|
|
|
941
954
|
}
|
|
942
955
|
}
|
|
943
956
|
|
|
944
|
-
|
|
957
|
+
/** `repo` is the referring record's: the layer that holds it, null for the write root — whose exports
|
|
958
|
+
* manifest may vouch for an id no root here holds, exactly as `check` reads it. */
|
|
959
|
+
checkRefs(d, fields, prefix = [], repo = null) {
|
|
945
960
|
for (const [key, f] of Object.entries(fieldsOf(d))) {
|
|
946
961
|
const targets = targetsOf(f);
|
|
947
962
|
if (!targets) continue;
|
|
@@ -975,7 +990,16 @@ export class Store {
|
|
|
975
990
|
if (soft) continue;
|
|
976
991
|
throw new Error(`${key}: reference "${value}" targets unknown collection "${coll}" — nothing was written.`);
|
|
977
992
|
}
|
|
978
|
-
if (
|
|
993
|
+
if (soft) continue;
|
|
994
|
+
// a collection whose env-pointed root cannot render here is unread, not empty — `check` passes it
|
|
995
|
+
if (storageOf(this.descriptors.get(coll)).unavailable) continue;
|
|
996
|
+
if (this.ids(coll).has(id)) continue;
|
|
997
|
+
// an id no root here holds, vouched for by the referring repo's exports manifest, is
|
|
998
|
+
// external (cr-dt-004) — accepted, as `check` accepts it. The manifest is read only here,
|
|
999
|
+
// on the way to a refusal, so a write naming a held id never pays for it.
|
|
1000
|
+
const v = this.vouched(coll, id, repo);
|
|
1001
|
+
if (v && !v.seen) continue;
|
|
1002
|
+
throw new Error(`${key}: dangling reference "${value}" — no such record${v ? ` (its holder ${v.from} is read here and does not have it)` : ''}. nothing was written.${mirrorRemedy(d, [key])}`);
|
|
979
1003
|
}
|
|
980
1004
|
}
|
|
981
1005
|
}
|
|
@@ -1106,7 +1130,7 @@ export class Store {
|
|
|
1106
1130
|
const previous = fs.readFileSync(file, 'utf8');
|
|
1107
1131
|
const next = { ...fields, ...changes };
|
|
1108
1132
|
for (const [k, v] of Object.entries(changes)) if (v === null || v === '') delete next[k];
|
|
1109
|
-
this.validate(d, next);
|
|
1133
|
+
this.validate(d, next, { repo: this.layerOfFile(d, file)?.layer ?? null });
|
|
1110
1134
|
this.refuseDuplicateValues(d, collection, id, next, Object.keys(changes));
|
|
1111
1135
|
// A placed record FOLLOWS ITS OWNER FIELD: changing it moves the file to the new parent's folder
|
|
1112
1136
|
// (or back to the fallback root) in this same write, id unchanged. Only a change to THAT field
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Record files under the workspace's own data/ that no compiled collection reads (cr-dt-008 test stage).
|
|
2
|
+
//
|
|
3
|
+
// A collection that leaves a module — notebooks and wikis composed out of rnd — leaves its records on disk
|
|
4
|
+
// with nothing reading them, and `dt check` said "0 violations". Compile has warned about the same thing for
|
|
5
|
+
// a record layer's clone since cr-dt-004 ("no collection here reads it"); this is the workspace's own data/,
|
|
6
|
+
// read at check time against the compiled descriptors. A warning, never a violation: the files are not
|
|
7
|
+
// wrong, they are unread — and the remedy is usually one install.
|
|
8
|
+
//
|
|
9
|
+
// Workspace layer: naming the package that would read a folder is a question about packages.
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { load } from './yaml.js';
|
|
13
|
+
import { loadDescriptors, exportsFacts } from './runtime.js';
|
|
14
|
+
import { storageOf } from './descriptor.js';
|
|
15
|
+
import { defaultStoragePath } from './namespace.js';
|
|
16
|
+
import { walk } from './records.js';
|
|
17
|
+
import { discoverModules, kindDir } from './compile.js';
|
|
18
|
+
|
|
19
|
+
/** `<id>.<suffix>.<ext>` — the shape every text record file has (a dotfile never is one). */
|
|
20
|
+
const RECORD_FILE = /^[^.][^/]*\.[A-Za-z][\w-]*\.(md|ya?ml|json)$/;
|
|
21
|
+
const subdirs = (abs) => { try { return fs.readdirSync(abs, { withFileTypes: true }).filter((e) => e.isDirectory() && !e.name.startsWith('.')).map((e) => e.name).sort(); } catch { return []; } };
|
|
22
|
+
|
|
23
|
+
/** `[folder, files]` per folder under `dataDir` no claimed path accounts for and holding record files:
|
|
24
|
+
* a claimed folder is skipped, a prefix of one (a namespace folder) is descended into. `/`-joined. */
|
|
25
|
+
export function unreadRecordFolders(root, dataDir, claimed) {
|
|
26
|
+
const out = [];
|
|
27
|
+
const visit = (rel) => {
|
|
28
|
+
for (const name of subdirs(path.join(root, rel))) {
|
|
29
|
+
const p = `${rel}/${name}`;
|
|
30
|
+
if (claimed.has(p)) continue;
|
|
31
|
+
if ([...claimed].some((c) => c.startsWith(`${p}/`))) { visit(p); continue; }
|
|
32
|
+
const files = [...walk(path.join(root, p))].map((f) => path.relative(path.join(root, p), f).split(path.sep).join('/')).filter((f) => RECORD_FILE.test(path.posix.basename(f))).sort();
|
|
33
|
+
if (files.length) out.push([p, files]);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
visit(dataDir);
|
|
37
|
+
return out;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The folder each collection of a package in node_modules that this workspace does not compile would
|
|
41
|
+
* store its records in, as `folder → "<package> defines <collection>"` — where an unread folder's reader is. */
|
|
42
|
+
function definedFolders(ws, dataDir) {
|
|
43
|
+
const nm = path.join(ws.root, 'node_modules');
|
|
44
|
+
const compiled = new Set(discoverModules(ws.root, ws.pkg).modules.map((m) => m.name));
|
|
45
|
+
const at = new Map();
|
|
46
|
+
for (const top of subdirs(nm)) {
|
|
47
|
+
for (const dir of top.startsWith('@') ? subdirs(path.join(nm, top)).map((s) => path.join(nm, top, s)) : [path.join(nm, top)]) {
|
|
48
|
+
let m;
|
|
49
|
+
try { m = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')); } catch { continue; }
|
|
50
|
+
if (!m.dreamteamer || compiled.has(m.name) || !fs.existsSync(kindDir(dir, 'collections'))) continue;
|
|
51
|
+
for (const f of [...walk(kindDir(dir, 'collections'))].filter((x) => x.endsWith('.collection.yaml'))) {
|
|
52
|
+
let d;
|
|
53
|
+
try { d = load(fs.readFileSync(f, 'utf8')); } catch { continue; }
|
|
54
|
+
const literal = typeof d?.storage?.path === 'string' && !d.storage.path.includes('${');
|
|
55
|
+
if (typeof d?.name === 'string') at.set(literal ? d.storage.path.replace(/\/+$/, '') : defaultStoragePath(d.name, m.dreamteamer.namespaces ?? [], dataDir), `${m.name} defines ${d.name}: dt install ${m.name}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return at;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** The ⚠ lines `dt check` prints, as `{ file, msg, warning: true }` items (src/api.js contributedViolations). */
|
|
63
|
+
export function unreadDataWarnings(ws) {
|
|
64
|
+
const descriptors = loadDescriptors(ws.root) ?? new Map();
|
|
65
|
+
const dataDir = exportsFacts(ws.root).data;
|
|
66
|
+
const roots = [...descriptors.values()].map(storageOf).filter((s) => !s.runtime && !s.external && !s.unavailable && !path.isAbsolute(s.path));
|
|
67
|
+
const unread = unreadRecordFolders(ws.root, dataDir, new Set(roots.map((s) => s.path.replace(/\/+$/, ''))));
|
|
68
|
+
const known = unread.length ? definedFolders(ws, dataDir) : new Map();
|
|
69
|
+
return unread.map(([folder, files]) => {
|
|
70
|
+
const shown = files.length > 3 ? [...files.slice(0, 3), `+${files.length - 3} more`] : files;
|
|
71
|
+
const msg = `${files.length} record file${files.length === 1 ? '' : 's'} no collection here reads (${shown.join(', ')}) — ${known.get(folder) ?? 'install the module that defines it to read them'}`;
|
|
72
|
+
return { file: `${folder}/`, msg, warning: true };
|
|
73
|
+
});
|
|
74
|
+
}
|
package/src/update-setup.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
// The process that ran npm imported every extension when it opened the workspace, and ESM caches an
|
|
3
3
|
// entry and all it imports by path — so it can only ever run the version being replaced. This file is
|
|
4
4
|
// started by updateModules with `process.execPath`: it opens the workspace fresh (the new version's
|
|
5
|
-
// files), runs the named units' safe part
|
|
6
|
-
//
|
|
7
|
-
//
|
|
5
|
+
// files), runs the named units' safe part, writes the nav document the parent merged (when it placed
|
|
6
|
+
// something) and makes the one scoped commit, and writes the result as JSON to the file it is given —
|
|
7
|
+
// never to stdout, which a unit's own output may share. Exit 0 means the result file holds the outcome
|
|
8
|
+
// (its `code` is the update's); anything else means it does not.
|
|
8
9
|
import fs from 'node:fs';
|
|
9
10
|
import { openWorkspace } from './api.js';
|
|
10
11
|
import { setupAndCommit } from './install-modules.js';
|
|
11
12
|
|
|
12
|
-
const { root, names, subject, noCommit, out } = JSON.parse(process.argv[2]);
|
|
13
|
+
const { root, names, subject, noCommit, out, nav = null } = JSON.parse(process.argv[2]);
|
|
13
14
|
try {
|
|
14
15
|
const ws = await openWorkspace(root);
|
|
15
|
-
const r = await setupAndCommit(ws, ws, names, { subject, noCommit, processEnv: process.env });
|
|
16
|
+
const r = await setupAndCommit(ws, ws, names, { subject, noCommit, processEnv: process.env, nav });
|
|
16
17
|
fs.writeFileSync(out, JSON.stringify(r));
|
|
17
18
|
} catch (e) {
|
|
18
19
|
// one line, as the CLI reports a failure — never Node's trace; the parent names how to finish
|