dreamteamer 0.50.0 → 0.51.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 +16 -148
- package/collections/modules.collection.yaml +1 -1
- package/collections/repos.collection.yaml +1 -1
- package/dist/api.d.ts +1 -2
- package/dist/api.js +0 -1
- package/dist/changes/commitPending.js +2 -12
- package/dist/changes/consts.d.ts +1 -1
- package/dist/changes/consts.js +1 -1
- package/dist/changes/deriveEvents.d.ts +1 -3
- package/dist/changes/deriveEvents.js +8 -11
- package/dist/changes/foldChanges.d.ts +1 -2
- package/dist/changes/foldChanges.js +2 -3
- package/dist/changes/groupChanges.d.ts +1 -4
- package/dist/changes/groupChanges.js +2 -6
- package/dist/changes/lib/reportLine.d.ts +1 -1
- package/dist/changes/lib/reportLine.js +2 -2
- package/dist/changes/printChanges.d.ts +1 -1
- package/dist/changes/printChanges.js +2 -2
- package/dist/changes/recordChanges.d.ts +0 -1
- package/dist/changes/recordChanges.js +0 -2
- package/dist/changes/rowChanges.js +0 -3
- package/dist/changes/types.d.ts +0 -2
- package/dist/check/check.js +82 -188
- package/dist/check/unreadData.js +1 -2
- package/dist/cli.js +1 -2
- package/dist/collections/renameCollection.js +0 -5
- package/dist/commands/compileCommand.js +2 -2
- package/dist/commands/exportsCommand.js +1 -4
- package/dist/commands/fmtCommand.js +1 -2
- package/dist/commands/lib/unknownVerb.js +1 -1
- package/dist/commands/relationsCommand.js +2 -7
- package/dist/commands/updateCommand.js +3 -11
- package/dist/compile/compile.js +21 -86
- package/dist/compile/consts.js +1 -2
- package/dist/compile/lib/compileCollections.d.ts +4 -8
- package/dist/compile/lib/compileCollections.js +5 -97
- package/dist/compile/types.d.ts +0 -9
- package/dist/exports/planExports.d.ts +2 -2
- package/dist/exports/planExports.js +9 -24
- package/dist/exports/runExports.d.ts +2 -3
- package/dist/exports/runExports.js +72 -81
- package/dist/extensions/declaredExtensions.d.ts +2 -3
- package/dist/extensions/declaredExtensions.js +2 -30
- package/dist/fmt/formatDescriptors.d.ts +1 -1
- package/dist/fmt/formatDescriptors.js +1 -1
- package/dist/init/init.js +0 -1
- package/dist/init/seedBlock.js +0 -1
- package/dist/install/applyInstall.js +3 -13
- package/dist/install/installCommand.js +0 -6
- package/dist/install/npmAndCompile.js +1 -1
- package/dist/install/observeState.d.ts +0 -1
- package/dist/install/observeState.js +0 -23
- package/dist/install/planInstall.js +0 -10
- package/dist/lib/consts.js +1 -1
- package/dist/modules/removeModule.js +0 -3
- package/dist/modules/renameModule.js +0 -7
- package/dist/modules/runModuleScript.d.ts +1 -2
- package/dist/modules/runModuleScript.js +1 -2
- package/dist/modules/setModule.js +1 -1
- package/dist/record/exportsContext.d.ts +2 -10
- package/dist/record/exportsContext.js +5 -33
- package/dist/record/pathToRecord.js +7 -8
- package/dist/record/regenerate.d.ts +4 -5
- package/dist/record/regenerate.js +5 -5
- package/dist/record/sees.d.ts +2 -2
- package/dist/record/sees.js +3 -3
- package/dist/record/storageOf.js +1 -7
- package/dist/record/types.d.ts +7 -10
- package/dist/records/history.d.ts +1 -1
- package/dist/records/history.js +1 -1
- package/dist/records/lib/landedIn.d.ts +1 -1
- package/dist/records/lib/landedIn.js +1 -1
- package/dist/records/recordsCommand.js +2 -2
- package/dist/repos/lib/relPath.js +3 -4
- package/dist/repos/materializeRepo.js +1 -1
- package/dist/runtime/exportsFacts.d.ts +1 -13
- package/dist/runtime/exportsFacts.js +2 -6
- package/dist/scripts/migrate-stubs.js +54 -72
- package/dist/statusCommand.js +2 -83
- package/dist/store/Store.d.ts +13 -31
- package/dist/store/Store.js +17 -51
- package/dist/store/add.js +1 -1
- package/dist/store/addedDates.js +5 -5
- package/dist/store/external.d.ts +1 -3
- package/dist/store/external.js +2 -12
- package/dist/store/lib/applyMirrorEdits.js +2 -3
- package/dist/store/lib/assertUnambiguous.js +1 -1
- package/dist/store/lib/checkRefs.d.ts +2 -5
- package/dist/store/lib/checkRefs.js +4 -7
- package/dist/store/lib/commit.js +3 -6
- package/dist/store/lib/idsKey.js +2 -3
- package/dist/store/lib/indexAdd.js +0 -2
- package/dist/store/lib/validate.d.ts +1 -2
- package/dist/store/lib/validate.js +2 -2
- package/dist/store/lib/walkIds.js +0 -23
- package/dist/store/recordFiles.js +1 -4
- package/dist/store/recordRoot.js +0 -7
- package/dist/store/rename.js +2 -11
- package/dist/store/revert.js +2 -2
- package/dist/store/set.js +1 -1
- package/dist/store/types.d.ts +0 -5
- package/dist/store/vouched.d.ts +2 -2
- package/dist/store/vouched.js +4 -5
- package/dist/types.d.ts +3 -37
- package/dist/usage.d.ts +1 -1
- package/dist/usage.js +18 -28
- package/dist/workspace/discoverModules.d.ts +2 -4
- package/dist/workspace/discoverModules.js +5 -43
- package/dist/workspace/findWorkspace.js +3 -3
- package/dist/workspace/lib/aheadCount.d.ts +1 -1
- package/dist/workspace/lib/aheadCount.js +1 -1
- package/dist/workspace/types.d.ts +2 -7
- package/package.json +1 -1
- package/skills/using-dreamteamer/SKILL.md +9 -10
- package/skills/using-dreamteamer/references/before-you-build.md +2 -2
- package/skills/using-dreamteamer/references/changes.md +6 -7
- package/skills/using-dreamteamer/references/collections.md +22 -91
- package/skills/using-dreamteamer/references/records.md +1 -2
- package/skills/using-dreamteamer/references/writing-a-module.md +2 -2
- package/dist/changes/layerOf.d.ts +0 -6
- package/dist/changes/layerOf.js +0 -12
- package/dist/install/buildClone.d.ts +0 -5
- package/dist/install/buildClone.js +0 -22
- package/dist/install/commitOf.d.ts +0 -1
- package/dist/install/commitOf.js +0 -2
- package/dist/install/install.d.ts +0 -8
- package/dist/install/install.js +0 -177
- package/dist/install/installClone.d.ts +0 -6
- package/dist/install/installClone.js +0 -32
- package/dist/install/isLink.d.ts +0 -1
- package/dist/install/isLink.js +0 -9
- package/dist/install/offRef.d.ts +0 -7
- package/dist/install/offRef.js +0 -19
- package/dist/record/ownersReadIn.d.ts +0 -9
- package/dist/record/ownersReadIn.js +0 -11
- package/dist/update/update.d.ts +0 -7
- package/dist/update/update.js +0 -57
- package/dist/workspace/declaredGitModules.d.ts +0 -51
- package/dist/workspace/declaredGitModules.js +0 -89
- package/dist/workspace/layerEntries.d.ts +0 -16
- package/dist/workspace/layerEntries.js +0 -36
|
@@ -262,7 +262,7 @@ naming both versions and the fix.
|
|
|
262
262
|
## the workspace manifest — the `dreamteamer` block in `package.json`
|
|
263
263
|
|
|
264
264
|
Keys are snake_case and closed: compile refuses an unknown one, naming the list. `dt init` writes
|
|
265
|
-
`workspace_module`, `data_path`, `harnesses`, `
|
|
265
|
+
`workspace_module`, `data_path`, `harnesses`, `disable` and `gitignore_runtime_folder`.
|
|
266
266
|
|
|
267
267
|
| key | what it holds |
|
|
268
268
|
|---|---|
|
|
@@ -275,7 +275,6 @@ Keys are snake_case and closed: compile refuses an unknown one, naming the list.
|
|
|
275
275
|
| `setup` | `{ "skipped": [<unit id>…] }`: the setup units `dt setup <unit> --skip` recorded as skipped (`setup.md`) |
|
|
276
276
|
| `auto_commit` | whether a record write also commits (default off) |
|
|
277
277
|
| `harnesses` | which coding-agent adapters compile writes |
|
|
278
|
-
| `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; what a clone NEEDS (the holders its `dreamteamer-exports.json` names) is installed here too, once at the top and linked under the clone (0.46.0) |
|
|
279
278
|
| `disable` | what to drop from the compile: `modules/<id>` (a whole module, its code included) or `<kind>/<id>` (one entity) |
|
|
280
279
|
| `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 |
|
|
281
280
|
|
|
@@ -319,13 +318,13 @@ rendered folder; `dt status` names it under `storage:`. Three rules follow from
|
|
|
319
318
|
- **An unset or empty var refuses, loudly, and never creates a literal folder.** Compile warns,
|
|
320
319
|
naming the collection and the var; every record verb on the collection then refuses with the same
|
|
321
320
|
names until the var is set and the workspace recompiled. `check` says once that the collection is
|
|
322
|
-
not read here and stays green
|
|
321
|
+
not read here and stays green.
|
|
323
322
|
- **A folder outside the workspace is outside every git repo here.** `dt commit` reports it on its
|
|
324
323
|
own line and never commits it — the records are kept, by design, on this machine only. A path
|
|
325
324
|
that renders inside the workspace is an ordinary root, committed like any other.
|
|
326
325
|
- **Declare the var** in the shipping module's `dreamteamer.vars` (or the workspace's), so
|
|
327
326
|
`.env.example` names it; one declared nowhere warns at compile and still renders. It combines with
|
|
328
|
-
neither `storage.owner: module` nor `storage.under
|
|
327
|
+
neither `storage.owner: module` nor `storage.under`.
|
|
329
328
|
|
|
330
329
|
## relationship-based storage — records beside the record they belong to
|
|
331
330
|
|
|
@@ -401,23 +400,22 @@ data/meetings/2026/10/offsite.meeting.md ← meetings/2026
|
|
|
401
400
|
- **When NOT to use it**: a record several parents share equally, an owner usually unknown, a
|
|
402
401
|
collection nobody browses as a folder. It organises files; it grants nothing.
|
|
403
402
|
|
|
404
|
-
## module-owned collections — records that live in the module's
|
|
403
|
+
## module-owned collections — records that live in the module's repo
|
|
405
404
|
|
|
406
405
|
A module usually ships SHAPE and the workspace holds the records. A collection can instead keep its
|
|
407
406
|
records beside the module's sources, so every workspace that installs the module shares ONE list:
|
|
408
407
|
|
|
409
408
|
```yaml
|
|
410
|
-
#
|
|
409
|
+
# modules/org/collections/people.collection.yaml
|
|
411
410
|
name: people
|
|
412
411
|
storage:
|
|
413
|
-
owner: module # records at
|
|
412
|
+
owner: module # records at modules/org/data/people/, committed to the module's repo
|
|
414
413
|
```
|
|
415
414
|
|
|
416
415
|
- **`owner: module`** roots the collection at `<module root>/data/<collection>` and sets its repo to
|
|
417
|
-
the module
|
|
418
|
-
`dt commit` publishes each side of a cross-repo write in its own repo.
|
|
419
|
-
|
|
420
|
-
is a compile error naming the fix.
|
|
416
|
+
the one holding the module: a write there commits in that repo (`ahead 1 — push when ready`), and
|
|
417
|
+
`dt commit` publishes each side of a cross-repo write in its own repo. A module under
|
|
418
|
+
`node_modules/` cannot hold records — that is a compile error naming the fix.
|
|
421
419
|
- **`owner: workspace`** is the default. **`owns_data: true` on the module** only changes the
|
|
422
420
|
default for the collections it ships, so one module can carry a shared `people` beside a
|
|
423
421
|
per-workspace `tasks`: flag nothing and mark `people`, or flag the module and mark `tasks`
|
|
@@ -426,90 +424,23 @@ storage:
|
|
|
426
424
|
or one workspace's copy would drift from the list every other workspace shares.
|
|
427
425
|
- A record in the workspace may reference an owned record like any other (`assignee: people/<id>`);
|
|
428
426
|
`check` validates across the two repos. Editing an owned record in one workspace reaches the
|
|
429
|
-
others
|
|
427
|
+
others when they pull the module's repo.
|
|
430
428
|
- `dt rm modules/<m>` refuses while an owned collection still has records inside the module folder.
|
|
431
429
|
|
|
432
|
-
##
|
|
430
|
+
## the exports manifest — references to records held elsewhere
|
|
433
431
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
A record may name an id no record here holds — a person another workspace keeps. **`dreamteamer-exports.json`**
|
|
433
|
+
at the workspace root vouches for such ids: per collection, per id, a display `label` and optionally the
|
|
434
|
+
package `from` holding it (ids and names only). `dt check` and every write name a reference no record here
|
|
435
|
+
answers **external**, not dangling, when the manifest lists it; where the manifest names this workspace as
|
|
436
|
+
the holder and the record is missing, the reference is dangling. `dt get <ref>` names an external id.
|
|
437
437
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
- **What the CLONE is decides it (0.41.0).** A clone whose own package.json names
|
|
447
|
-
`dreamteamer.workspace_module` is a workspace, so it is a layer: every collection both workspaces
|
|
448
|
-
have reads its data folder. A clone that names none is a bundle, and its `modules/` unpack as
|
|
449
|
-
before. `records:` is optional and NARROWS — only the listed collections are read — and it still
|
|
450
|
-
makes any clone a layer. A collection that cannot layer (below) is skipped with an `ℹ` when the
|
|
451
|
-
clone holds files for it; a data folder no collection here accounts for (a project's own domain
|
|
452
|
-
collections, read without their module) is a compile warning naming the folder and its file
|
|
453
|
-
count, never a failure.
|
|
454
|
-
- **A layer is never a bundle.** Its own `modules/` is not unpacked and it
|
|
455
|
-
is not an extension; the shapes are the modules both workspaces install. Its nested
|
|
456
|
-
`git_modules/` contribute no sources either — but what it NEEDS is installed here (0.46.0), the
|
|
457
|
-
npm way: the entries of its `git_modules` that provide a package its committed
|
|
458
|
-
`dreamteamer-exports.json` names as a holder, and only those. `dt install` clones each once at this
|
|
459
|
-
workspace's `git_modules/<name>` and links `<clone>/git_modules/<name>` to it; their records are read
|
|
460
|
-
here with the union of every declarer's `records` list, and `dt status` says `· via git_modules/<clone>`.
|
|
461
|
-
Your own declaration overrides a clone's (said in status); two clones that disagree get the second
|
|
462
|
-
copy nested under its declarer; nothing is refused.
|
|
463
|
-
- **`module: true` also compiles the clone's WORKSPACE module** — `modules/<workspace_module>`, as
|
|
464
|
-
the clone's own package.json names it — as a module source here, the way a bundle's module
|
|
465
|
-
compiles: its agents, skills, commands, command-bindings, ui-views, mixins and collections, with a
|
|
466
|
-
`modules/<id>` record whose `path` is inside the clone. That is how a project's own agent becomes
|
|
467
|
-
dispatchable from the workspace that oversees it. Only that one module, only its sources (an
|
|
468
|
-
extension entry in it is not loaded), and the records half is unchanged. Compile refuses, naming
|
|
469
|
-
the entry: a clone with no `workspace_module`; a module whose id is `default` (the role name every
|
|
470
|
-
workspace's own module carries — name the project's module after the project); an id another
|
|
471
|
-
module here already holds. `dt status` adds `· module <id>` to the layer's line.
|
|
472
|
-
- **Each layered collection gains the clone's data folder as a read root below the workspace's
|
|
473
|
-
own** — the compiled descriptor states them as `compiled.layers`, and `storageOf(d).roots` is the
|
|
474
|
-
write root first, then each layer. `dt list`, `get`, `check`, the inbound-reference guard of `rm`
|
|
475
|
-
and reference resolution read the union. An id two roots hold is a `check` violation naming both
|
|
476
|
-
files, and a write to it is refused until one is removed; the first root in order answers reads
|
|
477
|
-
meanwhile, never silently.
|
|
478
|
-
- **A workspace read as a layer stands alone, and `dreamteamer-exports.json` is how (0.45.0).** A
|
|
479
|
-
reader reads a layer WITHOUT that layer's own layers, so a reference a repo's records make to an id no
|
|
480
|
-
file of the repo holds — a person the reading HQ keeps, a record only the repo's own layer holds —
|
|
481
|
-
needs proof the id exists elsewhere. `dt exports` writes it: one generated, committed file at the
|
|
482
|
-
repo root listing, per such id, its display name and the package name of the workspace holding it
|
|
483
|
-
(ids and names only; never written by hand). `dt check` reads the manifest of the repo the referring
|
|
484
|
-
record sits in — never a layer's layers — and names a reference no root answers **external**, not
|
|
485
|
-
dangling, when the manifest lists it and its holder is not read here; where the holder IS read and
|
|
486
|
-
lacks the id, the reference is dangling. The live record always wins where it is read. A reference
|
|
487
|
-
this workspace's own records reach only through a layer, unlisted, is a `⚠ … dt exports` line, a
|
|
488
|
-
manifest `dt exports` would change or drop an entry of is named stale, and `dt check
|
|
489
|
-
--strict-export` makes both violations — the gate for a workspace others read. `dt exports --layer
|
|
490
|
-
<name>` writes a layer's manifest from this workspace's view (how a reader records the upward ids a
|
|
491
|
-
layer cannot see), and `dt get <ref> [--referrer <ref>]` names an external id. A conflicted manifest:
|
|
492
|
-
keep the union of both sides' lines, then `dt exports`. Stub records (0.41.0–0.44.x) are gone:
|
|
493
|
-
`node node_modules/dreamteamer/dist/scripts/migrate-stubs.js --root . [--layers] [--dry-run]` turns each
|
|
494
|
-
into a manifest entry.
|
|
495
|
-
- **A new record goes to the write root** (`storage.path` — this workspace, or the owning module's
|
|
496
|
-
clone for `storage.owner: module`). **An edit or removal of a layer's record lands in place** and
|
|
497
|
-
commits in the layer's repo; `dt commit` samples every layer and publishes one commit per repo.
|
|
498
|
-
`rename` and `relocate` refuse a layer's record: those are done in the layer's own workspace.
|
|
499
|
-
- **A layer's records are validated against THIS workspace's shape**, and their findings print under
|
|
500
|
-
a `layer <name>` heading rather than as this workspace's data — a value the project's own overlay
|
|
501
|
-
allows is the two workspaces having drifted, which is worth seeing and not worth hiding.
|
|
502
|
-
- **A mirror is kept only between records of one repo.** A task here naming a project a layer holds
|
|
503
|
-
writes no mirror into the layer, and `check` expects none; the project's own `tasks` mirror on that
|
|
504
|
-
record lists only its own tasks.
|
|
505
|
-
- **What may be layered:** a collection stored in this workspace. Not a `storage.owner: module`
|
|
506
|
-
collection (one shared list is read from the module's clone already), not a placed one
|
|
507
|
-
(`storage.under`), not an env-pointed one, not a compiled source. NAMING one of those in `records:`
|
|
508
|
-
is a compile error, as is a name no collection here answers to.
|
|
509
|
-
- **A layer whose clone is absent** — a fresh checkout before `dt install` — compiles; `check`
|
|
510
|
-
says its records are unread (only a `records:` or `module: true` entry is known to be a layer before
|
|
511
|
-
its clone exists). `dt status` lists layers after modules with the collections FOUND in each;
|
|
512
|
-
`dt update` pulls them like any clone, and a long-lived store re-indexes when a pull lands files.
|
|
438
|
+
`dt exports` keeps the manifest level with the records: it drops an entry for an id a record here now
|
|
439
|
+
holds, and — when every record under the data folder is read — one nothing references, then commits that
|
|
440
|
+
one file. `dt check` names a manifest `dt exports` would change as stale, and `--strict-export` makes that a
|
|
441
|
+
violation. A conflicted manifest: keep the union of both sides' lines, then `dt exports`. Stub records
|
|
442
|
+
(0.41.0–0.44.x) are gone: `node node_modules/dreamteamer/dist/scripts/migrate-stubs.js --root . [--dry-run]`
|
|
443
|
+
turns each into a manifest entry.
|
|
513
444
|
|
|
514
445
|
## mixins — a live shared field set
|
|
515
446
|
|
|
@@ -199,8 +199,7 @@ source_file: ${env:FILES_FOLDER}/2026/q3.pdf
|
|
|
199
199
|
work. the COLLECTION form publishes exactly what it names and prints the partners it left
|
|
200
200
|
pending — HEAD then fails `dt check` until they land.
|
|
201
201
|
- **one commit per REPO.** a module can own a collection's records (`storage.owner: module` on the
|
|
202
|
-
descriptor, or `owns_data` in its package.json for all of them),
|
|
203
|
-
in the layer's clone, and
|
|
202
|
+
descriptor, or `owns_data` in its package.json for all of them), and
|
|
204
203
|
git has no cross-repo commit — a rename whose inbound refs live in another repo is TWO commits;
|
|
205
204
|
`dt commit` prints both.
|
|
206
205
|
- when git is used directly (hand-edited markdown bodies), stage the specific files — never
|
|
@@ -38,13 +38,13 @@ is no `src/`. `dt compile && dt status` makes it live in this workspace.
|
|
|
38
38
|
types under `node_modules` — so the build writes `dist/skills/<id>/` (compiled scripts, copied
|
|
39
39
|
`SKILL.md`) and `skills/` is only its source. The staged path is unchanged
|
|
40
40
|
(`.dreamteamer/skills/<id>/…`). A folder that is missing or empty fails compile and says to run your
|
|
41
|
-
build: a
|
|
41
|
+
build: a copy is built before it compiles, and a published package lists the folder in `files`.
|
|
42
42
|
Without the key, `skills/` is staged as it is — a plain-JavaScript module needs no build.
|
|
43
43
|
- **`dreamteamer.scripts`** (optional, engine 0.50.0) maps a NAME to a file of the package —
|
|
44
44
|
`"scripts": { "check-records": "dist/bin/check-records.js" }` — and `dt run <module> <name> [args…]`
|
|
45
45
|
runs it: on the operator's node, at the workspace root, its arguments untouched, its exit code
|
|
46
46
|
returned, `argv[1]` its real path. The module is its package name or id, resolved as extensions are
|
|
47
|
-
(`modules/<id>`, then
|
|
47
|
+
(`modules/<id>`, then the installed package); `dt run <module>` lists
|
|
48
48
|
the scripts. This is how docs, command files and a consumer's `npm run check` call your code — never
|
|
49
49
|
`node node_modules/<pkg>/<path>`, which breaks the day your code moves.
|
|
50
50
|
- No new keys: `dreamteamer` is a closed set, and an unknown key fails compile on every engine.
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Descriptors } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* The record layer a repo is, by name — what a descriptor's root carries — or null for the workspace
|
|
4
|
-
* and for a module's clone that merely holds its own records.
|
|
5
|
-
*/
|
|
6
|
-
export declare function layerOf(descriptors: Descriptors, repo: string): string | null;
|
package/dist/changes/layerOf.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { storageOf } from "../record/storageOf.js";
|
|
2
|
-
/**
|
|
3
|
-
* The record layer a repo is, by name — what a descriptor's root carries — or null for the workspace
|
|
4
|
-
* and for a module's clone that merely holds its own records.
|
|
5
|
-
*/
|
|
6
|
-
export function layerOf(descriptors, repo) {
|
|
7
|
-
for (const d of descriptors.values())
|
|
8
|
-
for (const r of storageOf(d).roots)
|
|
9
|
-
if (r.repo === repo && r.layer)
|
|
10
|
-
return r.layer;
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
/**
|
|
5
|
-
* a fresh clone with deps or a prepare/build script needs `npm install` to be usable
|
|
6
|
-
* (deps land; `prepare` runs on install and builds dist). failure warns, never crashes.
|
|
7
|
-
*/
|
|
8
|
-
export function buildClone(dest, name) {
|
|
9
|
-
let cp;
|
|
10
|
-
try {
|
|
11
|
-
cp = JSON.parse(fs.readFileSync(path.join(dest, "package.json"), "utf8"));
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
if (!cp.dependencies && !cp.scripts?.prepare && !cp.scripts?.build)
|
|
17
|
-
return;
|
|
18
|
-
console.log(`… npm install in git_modules/${name}`);
|
|
19
|
-
const r = spawnSync("npm", ["install", "--no-fund", "--no-audit"], { cwd: dest, stdio: "inherit" });
|
|
20
|
-
if (r.status !== 0)
|
|
21
|
-
console.warn(`⚠ npm install failed in git_modules/${name} (exit ${r.status ?? r.error?.message}) — clone may be unbuilt; fix and re-run npm install there`);
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const commitOf: (dest: string, rev: string) => string | null;
|
package/dist/install/commitOf.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Workspace } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* dreamteamer install — restore git_modules/ working clones from the committed lockfile map, and what each
|
|
4
|
-
* restored clone NEEDS in turn (`declaredGitModules`, the npm model): a layer a clone's manifest names is
|
|
5
|
-
* cloned ONCE at the top level and linked under the clone — or, where it disagrees with what the top holds,
|
|
6
|
-
* cloned under the clone itself — to a fixpoint, since a clone just restored may need more. Never refuses.
|
|
7
|
-
*/
|
|
8
|
-
export declare function install({ root, pkg }: Pick<Workspace, "root" | "pkg">): number;
|
package/dist/install/install.js
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import { commitOf } from "./commitOf.js";
|
|
5
|
-
import { isLink } from "./isLink.js";
|
|
6
|
-
import { offRef } from "./offRef.js";
|
|
7
|
-
import { declaredGitModules } from "../workspace/declaredGitModules.js";
|
|
8
|
-
import { QUIET } from "../lib/consts.js";
|
|
9
|
-
import { appendMissing } from "../lib/appendMissing.js";
|
|
10
|
-
import { buildClone } from "./buildClone.js";
|
|
11
|
-
import { tryGit } from "../lib/git/tryGit.js";
|
|
12
|
-
/**
|
|
13
|
-
* dreamteamer install — restore git_modules/ working clones from the committed lockfile map, and what each
|
|
14
|
-
* restored clone NEEDS in turn (`declaredGitModules`, the npm model): a layer a clone's manifest names is
|
|
15
|
-
* cloned ONCE at the top level and linked under the clone — or, where it disagrees with what the top holds,
|
|
16
|
-
* cloned under the clone itself — to a fixpoint, since a clone just restored may need more. Never refuses.
|
|
17
|
-
*/
|
|
18
|
-
export function install({ root, pkg }) {
|
|
19
|
-
const unreachable = [], done = new Set();
|
|
20
|
-
let declared;
|
|
21
|
-
const clone = (url, ref, dest, name, note) => {
|
|
22
|
-
console.log(`… cloning ${url} → ${path.relative(root, dest)} (${ref})${note}`);
|
|
23
|
-
try {
|
|
24
|
-
execFileSync("git", ["clone", "--branch", ref, url, dest], { stdio: "inherit" });
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
// one unreachable clone must not abandon the rest. the lockfile is a map of PRIVATE
|
|
28
|
-
// repos as often as public ones, so "the current credentials cannot see this one" is
|
|
29
|
-
// ordinary — a fresh machine, a collaborator, a cloud sandbox. aborting there left a
|
|
30
|
-
// half-restored workspace and named only the first failure.
|
|
31
|
-
fs.rmSync(dest, { recursive: true, force: true }); // git leaves the partial dir behind
|
|
32
|
-
unreachable.push(name);
|
|
33
|
-
console.warn(`⚠ ${path.relative(root, dest)}: clone failed — skipped (${url})`);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
buildClone(dest, name);
|
|
37
|
-
};
|
|
38
|
-
for (;;) {
|
|
39
|
-
declared = declaredGitModules(pkg, root);
|
|
40
|
-
const top = [...declared.map]
|
|
41
|
-
.filter(([n]) => !done.has(n))
|
|
42
|
-
.map(([name, e]) => ({
|
|
43
|
-
...e,
|
|
44
|
-
name,
|
|
45
|
-
dest: path.join(root, "git_modules", name),
|
|
46
|
-
note: e.declarers.some(Boolean) ? ` — for ${e.declarers.filter(Boolean).join(", ")}` : "",
|
|
47
|
-
}));
|
|
48
|
-
const under = declared.nested
|
|
49
|
-
.filter(n => !done.has(`${n.by}/${n.name}`))
|
|
50
|
-
.map(n => ({
|
|
51
|
-
...n,
|
|
52
|
-
dest: path.join(root, n.by, "git_modules", n.name),
|
|
53
|
-
note: ` — nested: git_modules/${n.name} is ${n.top.url} (${n.top.ref})`,
|
|
54
|
-
}));
|
|
55
|
-
if (!top.length && !under.length)
|
|
56
|
-
break;
|
|
57
|
-
for (const t of [...top, ...under]) {
|
|
58
|
-
done.add(t.by ? `${t.by}/${t.name}` : t.name);
|
|
59
|
-
fs.mkdirSync(path.dirname(t.dest), { recursive: true });
|
|
60
|
-
// ⚠ A LINK IS NOT A CLONE. A declarer that agreed with the top at the first install was given a
|
|
61
|
-
// link; once its declaration diverges its copy is nested HERE, and the link standing where the
|
|
62
|
-
// nested clone goes must be replaced — never re-pointed through, which would move the shared
|
|
63
|
-
// top-level clone every other reader sits on (the first review of 0.46.0, finding eng-01).
|
|
64
|
-
if (t.by && isLink(t.dest))
|
|
65
|
-
fs.unlinkSync(t.dest);
|
|
66
|
-
if (fs.existsSync(t.dest)) {
|
|
67
|
-
if (!repoint(t.dest, path.relative(path.join(root, "git_modules"), t.dest), t.ref))
|
|
68
|
-
unreachable.push(t.name);
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
clone(t.url, t.ref, t.dest, t.name, t.note);
|
|
72
|
-
if (t.by)
|
|
73
|
-
excludeIn(path.join(root, t.by), `git_modules/${t.name}`);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!done.size) {
|
|
77
|
-
console.log("✔ no git_modules declared — nothing to restore");
|
|
78
|
-
return 0;
|
|
79
|
-
}
|
|
80
|
-
for (const [name, { declarers }] of declared.map)
|
|
81
|
-
for (const by of declarers)
|
|
82
|
-
if (by && !unreachable.includes(name))
|
|
83
|
-
linkLayer(root, by, name);
|
|
84
|
-
for (const [name, list] of declared.mismatches.reduce((g, m) => g.set(m.name, [...(g.get(m.name) ?? []), m]), new Map())) {
|
|
85
|
-
// Map.groupBy is Node 21+
|
|
86
|
-
console.warn(`⚠ git_modules/${name}: this workspace's declaration overrides ${list.map(m => `${m.by} (${m.what} ${m.theirs})`).join(", ")}`);
|
|
87
|
-
}
|
|
88
|
-
for (const u of declared.unmet)
|
|
89
|
-
console.warn(`⚠ ${u.by}: dreamteamer-exports.json names ${u.holder}, which no git_modules entry of the clone provides`);
|
|
90
|
-
// non-zero, because the workspace is NOT what the lockfile describes: modules are missing or off
|
|
91
|
-
// their ref, and `check` will report references into them as unknown collections.
|
|
92
|
-
if (unreachable.length)
|
|
93
|
-
console.error(`✖ ${unreachable.length} module(s) are not what the lockfile declares: ${unreachable.join(", ")}`);
|
|
94
|
-
return unreachable.length ? 1 : 0;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* The link a declarer finds its layer through — `<by>/git_modules/<name> -> ../../<name>`, the pnpm shape:
|
|
98
|
-
* explicit on disk, resolved by a tool that knows nothing of dreamteamer. A clone of its own standing there
|
|
99
|
-
* may hold work: left as it is, and said — `dt status` draws it too.
|
|
100
|
-
*/
|
|
101
|
-
function linkLayer(root, by, name) {
|
|
102
|
-
// relative from wherever the declarer sits — a nested copy's own needs link from two levels deeper
|
|
103
|
-
const at = path.join(root, by, "git_modules", name), want = path.relative(path.dirname(at), path.join(root, "git_modules", name));
|
|
104
|
-
let st = null;
|
|
105
|
-
try {
|
|
106
|
-
st = fs.lstatSync(at);
|
|
107
|
-
}
|
|
108
|
-
catch {
|
|
109
|
-
/* nothing there */
|
|
110
|
-
}
|
|
111
|
-
if (st && !st.isSymbolicLink()) {
|
|
112
|
-
console.log(`… ${by}/git_modules/${name} is a clone of its own — left as it is`);
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (st && fs.readlinkSync(at) === want)
|
|
116
|
-
return;
|
|
117
|
-
if (st)
|
|
118
|
-
fs.unlinkSync(at);
|
|
119
|
-
fs.mkdirSync(path.dirname(at), { recursive: true });
|
|
120
|
-
fs.symlinkSync(want, at);
|
|
121
|
-
excludeIn(path.join(root, by), `git_modules/${name}`);
|
|
122
|
-
console.log(`✔ ${by}/git_modules/${name} → git_modules/${name}`);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Ignore `rel` in a clone's own `.git/info/exclude` when its .gitignore does not already cover it — never
|
|
126
|
-
* in a tracked file, which would dirty the clone.
|
|
127
|
-
*/
|
|
128
|
-
function excludeIn(clone, rel) {
|
|
129
|
-
if (ran(clone, ["check-ignore", "-q", rel]))
|
|
130
|
-
return;
|
|
131
|
-
const exclude = path.resolve(clone, tryGit(clone, ["rev-parse", "--git-path", "info/exclude"]) ?? path.join(".git", "info", "exclude"));
|
|
132
|
-
fs.mkdirSync(path.dirname(exclude), { recursive: true });
|
|
133
|
-
appendMissing(exclude, rel);
|
|
134
|
-
}
|
|
135
|
-
const ran = (cwd, args, timeout) => {
|
|
136
|
-
try {
|
|
137
|
-
execFileSync("git", args, { cwd, stdio: QUIET, timeout });
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
/** Move a clone to its declared ref, or refuse and change nothing. Returns false on a refusal. */
|
|
145
|
-
function repoint(dest, name, ref) {
|
|
146
|
-
const at = `git_modules/${name}`;
|
|
147
|
-
if (!offRef(dest, ref)) {
|
|
148
|
-
console.log(`✔ ${at} present (${ref})`);
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
const refuse = (why) => {
|
|
152
|
-
console.error(`✖ ${at}: not on ${ref}, and ${why} — nothing was moved`);
|
|
153
|
-
return false;
|
|
154
|
-
};
|
|
155
|
-
if (tryGit(dest, ["status", "--porcelain"]))
|
|
156
|
-
return refuse(`it has uncommitted changes — commit or stash them in ${at}, then re-run dt install`);
|
|
157
|
-
const mine = ["HEAD", ...(commitOf(dest, `refs/heads/${ref}`) ? [`refs/heads/${ref}`] : [])];
|
|
158
|
-
const local = Number(tryGit(dest, ["rev-list", "--count", ...mine, "--not", "--remotes", "--tags"]) ?? 0);
|
|
159
|
-
if (local)
|
|
160
|
-
return refuse(`it holds ${local} commit(s) on no remote — push them from ${at} (or drop them), then re-run dt install`);
|
|
161
|
-
const before = commitOf(dest, "HEAD")?.slice(0, 7);
|
|
162
|
-
if (!ran(dest, ["fetch", "--quiet", "--tags", "origin"], 120_000))
|
|
163
|
-
return refuse("fetching origin failed");
|
|
164
|
-
if (!offRef(dest, ref)) {
|
|
165
|
-
console.log(`✔ ${at} present (${ref})`);
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
const branch = commitOf(dest, `refs/remotes/origin/${ref}`);
|
|
169
|
-
if (!branch && !commitOf(dest, ref))
|
|
170
|
-
return refuse(`origin has no branch, tag or commit "${ref}" — fix dreamteamer.git_modules.${name}.ref`);
|
|
171
|
-
const to = branch ? ["-B", ref, `origin/${ref}`] : commitOf(dest, `refs/heads/${ref}`) ? [ref] : ["--detach", ref];
|
|
172
|
-
if (!ran(dest, ["checkout", "--quiet", ...to], 60_000))
|
|
173
|
-
return refuse("the checkout failed");
|
|
174
|
-
console.log(`✔ ${at}: ${before} → ${ref} (${commitOf(dest, "HEAD").slice(0, 7)})`);
|
|
175
|
-
buildClone(dest, name);
|
|
176
|
-
return true;
|
|
177
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Workspace } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* dreamteamer install --clone <url> [name] — clone a module for development AND
|
|
4
|
-
* record it in the committed lockfile map (story 5.3)
|
|
5
|
-
*/
|
|
6
|
-
export declare function installClone(ws: Workspace, url: string, name?: string): number;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
|
-
import { buildClone } from "./buildClone.js";
|
|
5
|
-
import { tryGit } from "../lib/git/tryGit.js";
|
|
6
|
-
/**
|
|
7
|
-
* dreamteamer install --clone <url> [name] — clone a module for development AND
|
|
8
|
-
* record it in the committed lockfile map (story 5.3)
|
|
9
|
-
*/
|
|
10
|
-
export function installClone(ws, url, name) {
|
|
11
|
-
if (!url)
|
|
12
|
-
throw new Error("usage: dreamteamer install --clone <git-url> [name]");
|
|
13
|
-
name = name && !name.startsWith("--") ? name : path.basename(url, ".git");
|
|
14
|
-
const dest = path.join(ws.root, "git_modules", name);
|
|
15
|
-
if (fs.existsSync(dest))
|
|
16
|
-
throw new Error(`git_modules/${name} already exists`);
|
|
17
|
-
fs.mkdirSync(path.join(ws.root, "git_modules"), { recursive: true });
|
|
18
|
-
execFileSync("git", ["clone", url, dest], { stdio: "inherit" });
|
|
19
|
-
buildClone(dest, name);
|
|
20
|
-
const ref = tryGit(dest, ["rev-parse", "--abbrev-ref", "HEAD"]) ?? "main";
|
|
21
|
-
const pkgPath = path.join(ws.root, "package.json");
|
|
22
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
23
|
-
pkg.dreamteamer.git_modules = { ...pkg.dreamteamer.git_modules, [name]: { url, ref } };
|
|
24
|
-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, "\t") + "\n");
|
|
25
|
-
execFileSync("git", ["add", "package.json"], { cwd: ws.root });
|
|
26
|
-
execFileSync("git", ["commit", "--quiet", "-m", `dreamteamer: install ${name} (git module)`, "--", "package.json"], {
|
|
27
|
-
cwd: ws.root,
|
|
28
|
-
});
|
|
29
|
-
console.log(`✔ git_modules/${name} (ref ${ref})`);
|
|
30
|
-
console.log("✔ package.json dreamteamer.git_modules updated");
|
|
31
|
-
return 0;
|
|
32
|
-
}
|
package/dist/install/isLink.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isLink: (p: string) => boolean;
|
package/dist/install/isLink.js
DELETED
package/dist/install/offRef.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Is this clone somewhere other than its declared ref? A branch ref is met by being ON the branch —
|
|
3
|
-
* moving it forward is `dt update`'s job; a tag or a sha by HEAD being that commit. Answered from
|
|
4
|
-
* what the clone already knows, so a settled clone costs no fetch. A folder that is not itself a
|
|
5
|
-
* clone is never re-pointed: git would walk up and act on the workspace repo.
|
|
6
|
-
*/
|
|
7
|
-
export declare function offRef(dest: string, ref: string): boolean;
|
package/dist/install/offRef.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { commitOf } from "./commitOf.js";
|
|
4
|
-
import { isLink } from "./isLink.js";
|
|
5
|
-
import { tryGit } from "../lib/git/tryGit.js";
|
|
6
|
-
/**
|
|
7
|
-
* Is this clone somewhere other than its declared ref? A branch ref is met by being ON the branch —
|
|
8
|
-
* moving it forward is `dt update`'s job; a tag or a sha by HEAD being that commit. Answered from
|
|
9
|
-
* what the clone already knows, so a settled clone costs no fetch. A folder that is not itself a
|
|
10
|
-
* clone is never re-pointed: git would walk up and act on the workspace repo.
|
|
11
|
-
*/
|
|
12
|
-
export function offRef(dest, ref) {
|
|
13
|
-
if (isLink(dest) || !fs.existsSync(path.join(dest, ".git")))
|
|
14
|
-
return false; // never judged, never moved, through a link
|
|
15
|
-
if (tryGit(dest, ["symbolic-ref", "--quiet", "--short", "HEAD"]) === ref)
|
|
16
|
-
return false;
|
|
17
|
-
const branch = ["refs/heads/", "refs/remotes/origin/"].some(p => tryGit(dest, ["rev-parse", "--verify", "--quiet", p + ref]));
|
|
18
|
-
return branch || !commitOf(dest, ref) || commitOf(dest, ref) !== commitOf(dest, "HEAD");
|
|
19
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Descriptor } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Can this workspace JUDGE a mirror held in `repo`? A mirror is kept between records of one repo, so
|
|
4
|
-
* its truth is the owners in THAT repo — which a reader here sees only when it reads the owner
|
|
5
|
-
* collection from that repo too. A record layer that contributes `projects` but not `tasks` holds
|
|
6
|
-
* mirrors justified by tasks this workspace never reads: judged from here they all look stale, and
|
|
7
|
-
* `relations rebuild` once deleted them inside the layer's clone. Those are the layer's own check's.
|
|
8
|
-
*/
|
|
9
|
-
export declare function ownersReadIn(ownerDescriptor: Descriptor, repo: string): boolean;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { storageOf } from "./storageOf.js";
|
|
2
|
-
/**
|
|
3
|
-
* Can this workspace JUDGE a mirror held in `repo`? A mirror is kept between records of one repo, so
|
|
4
|
-
* its truth is the owners in THAT repo — which a reader here sees only when it reads the owner
|
|
5
|
-
* collection from that repo too. A record layer that contributes `projects` but not `tasks` holds
|
|
6
|
-
* mirrors justified by tasks this workspace never reads: judged from here they all look stale, and
|
|
7
|
-
* `relations rebuild` once deleted them inside the layer's clone. Those are the layer's own check's.
|
|
8
|
-
*/
|
|
9
|
-
export function ownersReadIn(ownerDescriptor, repo) {
|
|
10
|
-
return storageOf(ownerDescriptor).roots.some(r => r.repo === repo);
|
|
11
|
-
}
|
package/dist/update/update.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Workspace } from "../types.js";
|
|
2
|
-
/**
|
|
3
|
-
* dreamteamer update [<name>] — pull each lockfile-declared git_modules clone forward
|
|
4
|
-
* (ff-only on its recorded ref) and rebuild it. dirty clones are skipped, never touched.
|
|
5
|
-
* the caller (cli) runs compile afterwards — a pulled module may change sources.
|
|
6
|
-
*/
|
|
7
|
-
export declare function update({ root, pkg }: Pick<Workspace, "root" | "pkg">, only?: string | null): number;
|
package/dist/update/update.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import { execFileSync } from "node:child_process";
|
|
4
|
-
import { declaredGitModules } from "../workspace/declaredGitModules.js";
|
|
5
|
-
import { buildClone } from "../install/buildClone.js";
|
|
6
|
-
import { discoverModules } from "../workspace/discoverModules.js";
|
|
7
|
-
import { tryGit } from "../lib/git/tryGit.js";
|
|
8
|
-
/**
|
|
9
|
-
* dreamteamer update [<name>] — pull each lockfile-declared git_modules clone forward
|
|
10
|
-
* (ff-only on its recorded ref) and rebuild it. dirty clones are skipped, never touched.
|
|
11
|
-
* the caller (cli) runs compile afterwards — a pulled module may change sources.
|
|
12
|
-
*/
|
|
13
|
-
export function update({ root, pkg }, only) {
|
|
14
|
-
const map = Object.fromEntries(declaredGitModules(pkg, root).map); // a hoisted layer is pulled forward too
|
|
15
|
-
if (only && !map[only])
|
|
16
|
-
throw new Error(`"${only}" is not in dreamteamer.git_modules (known: ${Object.keys(map).join(", ") || "none"})`);
|
|
17
|
-
const names = only ? [only] : Object.keys(map);
|
|
18
|
-
if (!names.length) {
|
|
19
|
-
console.log("✔ no git_modules declared — nothing to update");
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
for (const name of names) {
|
|
23
|
-
const { ref } = map[name];
|
|
24
|
-
const dest = path.join(root, "git_modules", name);
|
|
25
|
-
if (!fs.existsSync(dest)) {
|
|
26
|
-
console.warn(`⚠ git_modules/${name} missing — run \`dreamteamer install\` first; skipped`);
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
if (tryGit(dest, ["status", "--porcelain"])) {
|
|
30
|
-
console.warn(`⚠ git_modules/${name} is dirty — skipped (commit or stash there, then re-run)`);
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
const before = tryGit(dest, ["rev-parse", "--short", "HEAD"]);
|
|
34
|
-
try {
|
|
35
|
-
execFileSync("git", ["pull", "--ff-only", "origin", ref], { cwd: dest, stdio: "inherit" });
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
console.warn(`⚠ git_modules/${name}: ff-only pull of origin/${ref} failed (diverged?) — left at ${before}`);
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
const after = tryGit(dest, ["rev-parse", "--short", "HEAD"]);
|
|
42
|
-
if (before === after) {
|
|
43
|
-
console.log(`✔ git_modules/${name} already up to date (${after})`);
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
buildClone(dest, name); // deps/dist may have moved with the pull
|
|
47
|
-
console.log(`✔ git_modules/${name} ${before} → ${after}`);
|
|
48
|
-
}
|
|
49
|
-
// dev-clone semantics: these clones SHADOW any node_modules copy of the same module —
|
|
50
|
-
// what just updated is what runs. npm-channel modules are updated via npm, not here.
|
|
51
|
-
console.log("… git_modules clones shadow node_modules copies — the updated clones win");
|
|
52
|
-
for (const m of discoverModules(root, pkg).modules) {
|
|
53
|
-
if (m.channel === "npm")
|
|
54
|
-
console.log(`… npm-channel module ${m.name} is not managed here — \`npm update ${m.name}\` to pull it forward`);
|
|
55
|
-
}
|
|
56
|
-
return 0;
|
|
57
|
-
}
|