dreamteamer 0.49.0 → 0.50.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 +163 -87
- package/collections/modules.collection.yaml +4 -0
- package/dist/api.d.ts +89 -0
- package/dist/api.js +139 -0
- package/dist/changes/commitPending.d.ts +28 -0
- package/dist/changes/commitPending.js +658 -0
- package/dist/changes/composeSubject.d.ts +9 -0
- package/dist/changes/composeSubject.js +19 -0
- package/dist/changes/consts.d.ts +11 -0
- package/dist/changes/consts.js +19 -0
- package/dist/changes/deriveEvents.d.ts +19 -0
- package/dist/changes/deriveEvents.js +118 -0
- package/dist/changes/foldChanges.d.ts +13 -0
- package/dist/changes/foldChanges.js +47 -0
- package/dist/changes/groupChanges.d.ts +6 -0
- package/dist/changes/groupChanges.js +23 -0
- package/dist/changes/layerOf.d.ts +6 -0
- package/dist/changes/layerOf.js +12 -0
- package/dist/changes/lib/reportLine.d.ts +7 -0
- package/dist/changes/lib/reportLine.js +14 -0
- package/dist/changes/printChanges.d.ts +11 -0
- package/dist/changes/printChanges.js +20 -0
- package/dist/changes/recordChanges.d.ts +21 -0
- package/dist/changes/recordChanges.js +32 -0
- package/dist/changes/rowChanges.d.ts +7 -0
- package/dist/changes/rowChanges.js +27 -0
- package/dist/changes/types.d.ts +28 -0
- package/dist/changes/types.js +1 -0
- package/dist/check/check.d.ts +11 -0
- package/dist/check/check.js +555 -0
- package/dist/check/checkAlone.d.ts +9 -0
- package/dist/check/checkAlone.js +200 -0
- package/dist/check/consts.d.ts +1 -0
- package/dist/check/consts.js +3 -0
- package/dist/check/engineRun.d.ts +3 -0
- package/dist/check/engineRun.js +20 -0
- package/dist/check/freshWorkspace.d.ts +5 -0
- package/dist/check/freshWorkspace.js +24 -0
- package/dist/check/isStale.d.ts +3 -0
- package/dist/check/isStale.js +2 -0
- package/dist/check/symlinkedChildRoots.d.ts +3 -0
- package/dist/check/symlinkedChildRoots.js +13 -0
- package/dist/check/unreadData.d.ts +7 -0
- package/dist/check/unreadData.js +113 -0
- package/dist/cli.d.ts +21 -0
- package/dist/cli.js +151 -0
- package/dist/collections/addField.d.ts +23 -0
- package/dist/collections/addField.js +28 -0
- package/dist/collections/collectionsCommand.d.ts +7 -0
- package/dist/collections/collectionsCommand.js +357 -0
- package/dist/collections/createCollection.d.ts +21 -0
- package/dist/collections/createCollection.js +134 -0
- package/dist/collections/lib/applyRewrites.d.ts +4 -0
- package/dist/collections/lib/applyRewrites.js +26 -0
- package/dist/collections/lib/consts.d.ts +18 -0
- package/dist/collections/lib/consts.js +56 -0
- package/dist/collections/lib/declaringSource.d.ts +18 -0
- package/dist/collections/lib/declaringSource.js +44 -0
- package/dist/collections/lib/descriptorSources.d.ts +4 -0
- package/dist/collections/lib/descriptorSources.js +16 -0
- package/dist/collections/lib/fieldRenameWalk.d.ts +10 -0
- package/dist/collections/lib/fieldRenameWalk.js +50 -0
- package/dist/collections/lib/mixinDeclaring.d.ts +7 -0
- package/dist/collections/lib/mixinDeclaring.js +13 -0
- package/dist/collections/lib/mixinSources.d.ts +6 -0
- package/dist/collections/lib/mixinSources.js +18 -0
- package/dist/collections/lib/mixinsListedBy.d.ts +3 -0
- package/dist/collections/lib/mixinsListedBy.js +14 -0
- package/dist/collections/lib/placeField.d.ts +7 -0
- package/dist/collections/lib/placeField.js +19 -0
- package/dist/collections/lib/positionLines.d.ts +10 -0
- package/dist/collections/lib/positionLines.js +7 -0
- package/dist/collections/lib/qualify.d.ts +2 -0
- package/dist/collections/lib/qualify.js +5 -0
- package/dist/collections/lib/recordRewrites.d.ts +5 -0
- package/dist/collections/lib/recordRewrites.js +27 -0
- package/dist/collections/lib/removeFieldPlan.d.ts +26 -0
- package/dist/collections/lib/removeFieldPlan.js +57 -0
- package/dist/collections/lib/renameFieldPlan.d.ts +12 -0
- package/dist/collections/lib/renameFieldPlan.js +18 -0
- package/dist/collections/lib/renameInConstraint.d.ts +2 -0
- package/dist/collections/lib/renameInConstraint.js +45 -0
- package/dist/collections/lib/renameInDisplay.d.ts +2 -0
- package/dist/collections/lib/renameInDisplay.js +52 -0
- package/dist/collections/lib/renameInTemplate.d.ts +3 -0
- package/dist/collections/lib/renameInTemplate.js +12 -0
- package/dist/collections/lib/renameKeys.d.ts +13 -0
- package/dist/collections/lib/renameKeys.js +31 -0
- package/dist/collections/lib/renameMirrorOf.d.ts +3 -0
- package/dist/collections/lib/renameMirrorOf.js +10 -0
- package/dist/collections/lib/renameOwnField.d.ts +3 -0
- package/dist/collections/lib/renameOwnField.js +30 -0
- package/dist/collections/lib/renameValueInCondition.d.ts +4 -0
- package/dist/collections/lib/renameValueInCondition.js +42 -0
- package/dist/collections/lib/renameValueInConstraint.d.ts +3 -0
- package/dist/collections/lib/renameValueInConstraint.js +19 -0
- package/dist/collections/lib/renameValueInSubschema.d.ts +3 -0
- package/dist/collections/lib/renameValueInSubschema.js +24 -0
- package/dist/collections/lib/renameValuePlan.d.ts +13 -0
- package/dist/collections/lib/renameValuePlan.js +33 -0
- package/dist/collections/lib/reportMirror.d.ts +8 -0
- package/dist/collections/lib/reportMirror.js +19 -0
- package/dist/collections/lib/types.d.ts +36 -0
- package/dist/collections/lib/types.js +1 -0
- package/dist/collections/lib/upsertField.d.ts +22 -0
- package/dist/collections/lib/upsertField.js +39 -0
- package/dist/collections/lib/valueRenameWalk.d.ts +4 -0
- package/dist/collections/lib/valueRenameWalk.js +60 -0
- package/dist/collections/lib/viewSources.d.ts +6 -0
- package/dist/collections/lib/viewSources.js +20 -0
- package/dist/collections/lib/walkFilter.d.ts +3 -0
- package/dist/collections/lib/walkFilter.js +25 -0
- package/dist/collections/lib/walkSources.d.ts +17 -0
- package/dist/collections/lib/walkSources.js +80 -0
- package/dist/collections/moveCollection.d.ts +42 -0
- package/dist/collections/moveCollection.js +176 -0
- package/dist/collections/removeCollection.d.ts +8 -0
- package/dist/collections/removeCollection.js +40 -0
- package/dist/collections/removeField.d.ts +30 -0
- package/dist/collections/removeField.js +150 -0
- package/dist/collections/renameCollection.d.ts +55 -0
- package/dist/collections/renameCollection.js +492 -0
- package/dist/collections/renameField.d.ts +32 -0
- package/dist/collections/renameField.js +49 -0
- package/dist/collections/renameValue.d.ts +29 -0
- package/dist/collections/renameValue.js +35 -0
- package/dist/collections/setCollectionScalars.d.ts +32 -0
- package/dist/collections/setCollectionScalars.js +248 -0
- package/dist/collections/updateField.d.ts +27 -0
- package/dist/collections/updateField.js +20 -0
- package/dist/commands/addCommand.d.ts +1 -0
- package/dist/commands/addCommand.js +2 -0
- package/dist/commands/addFieldCommand.d.ts +1 -0
- package/dist/commands/addFieldCommand.js +2 -0
- package/dist/commands/changesCommand.d.ts +10 -0
- package/dist/commands/changesCommand.js +37 -0
- package/dist/commands/checkCommand.d.ts +1 -0
- package/dist/commands/checkCommand.js +22 -0
- package/dist/commands/commitCommand.d.ts +6 -0
- package/dist/commands/commitCommand.js +89 -0
- package/dist/commands/compileCommand.d.ts +2 -0
- package/dist/commands/compileCommand.js +35 -0
- package/dist/commands/diffCommand.d.ts +1 -0
- package/dist/commands/diffCommand.js +2 -0
- package/dist/commands/doctorCommand.d.ts +1 -0
- package/dist/commands/doctorCommand.js +14 -0
- package/dist/commands/exportsCommand.d.ts +1 -0
- package/dist/commands/exportsCommand.js +10 -0
- package/dist/commands/fmtCommand.d.ts +1 -0
- package/dist/commands/fmtCommand.js +27 -0
- package/dist/commands/getCommand.d.ts +1 -0
- package/dist/commands/getCommand.js +2 -0
- package/dist/commands/helpCommand.d.ts +5 -0
- package/dist/commands/helpCommand.js +27 -0
- package/dist/commands/historyCommand.d.ts +1 -0
- package/dist/commands/historyCommand.js +2 -0
- package/dist/commands/initCommand.d.ts +2 -0
- package/dist/commands/initCommand.js +17 -0
- package/dist/commands/installCommand.d.ts +1 -0
- package/dist/commands/installCommand.js +12 -0
- package/dist/commands/lib/fieldVerb.d.ts +12 -0
- package/dist/commands/lib/fieldVerb.js +26 -0
- package/dist/commands/lib/recordVerb.d.ts +2 -0
- package/dist/commands/lib/recordVerb.js +53 -0
- package/dist/commands/lib/unknownVerb.d.ts +14 -0
- package/dist/commands/lib/unknownVerb.js +74 -0
- package/dist/commands/lib/verify.d.ts +3 -0
- package/dist/commands/lib/verify.js +4 -0
- package/dist/commands/listCommand.d.ts +1 -0
- package/dist/commands/listCommand.js +2 -0
- package/dist/commands/nextCommand.d.ts +1 -0
- package/dist/commands/nextCommand.js +2 -0
- package/dist/commands/relationsCommand.d.ts +11 -0
- package/dist/commands/relationsCommand.js +186 -0
- package/dist/commands/relocateCommand.d.ts +1 -0
- package/dist/commands/relocateCommand.js +39 -0
- package/dist/commands/renameCommand.d.ts +1 -0
- package/dist/commands/renameCommand.js +2 -0
- package/dist/commands/renameFieldCommand.d.ts +1 -0
- package/dist/commands/renameFieldCommand.js +2 -0
- package/dist/commands/renameValueCommand.d.ts +1 -0
- package/dist/commands/renameValueCommand.js +2 -0
- package/dist/commands/reorderCommand.d.ts +1 -0
- package/dist/commands/reorderCommand.js +2 -0
- package/dist/commands/resolveCommand.d.ts +15 -0
- package/dist/commands/resolveCommand.js +69 -0
- package/dist/commands/revertCommand.d.ts +1 -0
- package/dist/commands/revertCommand.js +2 -0
- package/dist/commands/rmCommand.d.ts +1 -0
- package/dist/commands/rmCommand.js +2 -0
- package/dist/commands/rmFieldCommand.d.ts +1 -0
- package/dist/commands/rmFieldCommand.js +2 -0
- package/dist/commands/runCommand.d.ts +5 -0
- package/dist/commands/runCommand.js +9 -0
- package/dist/commands/setCommand.d.ts +1 -0
- package/dist/commands/setCommand.js +2 -0
- package/dist/commands/setFieldCommand.d.ts +1 -0
- package/dist/commands/setFieldCommand.js +2 -0
- package/dist/commands/setupCommand.d.ts +5 -0
- package/dist/commands/setupCommand.js +196 -0
- package/dist/commands/statusCommand.d.ts +1 -0
- package/dist/commands/statusCommand.js +16 -0
- package/dist/commands/updateCommand.d.ts +1 -0
- package/dist/commands/updateCommand.js +18 -0
- package/dist/commands/valuesCommand.d.ts +1 -0
- package/dist/commands/valuesCommand.js +2 -0
- package/dist/commands/versionCommand.d.ts +2 -0
- package/dist/commands/versionCommand.js +7 -0
- package/dist/compile/compile.d.ts +24 -0
- package/dist/compile/compile.js +1553 -0
- package/dist/compile/consts.d.ts +52 -0
- package/dist/compile/consts.js +120 -0
- package/dist/compile/ensureEditorRecommendation.d.ts +1 -0
- package/dist/compile/ensureEditorRecommendation.js +31 -0
- package/dist/compile/isV2.d.ts +2 -0
- package/dist/compile/isV2.js +1 -0
- package/dist/compile/kindDir.d.ts +11 -0
- package/dist/compile/kindDir.js +19 -0
- package/dist/compile/lib/bindingErrors.d.ts +11 -0
- package/dist/compile/lib/bindingErrors.js +47 -0
- package/dist/compile/lib/buildCollectionsIndex.d.ts +8 -0
- package/dist/compile/lib/buildCollectionsIndex.js +49 -0
- package/dist/compile/lib/buildModulesIndex.d.ts +9 -0
- package/dist/compile/lib/buildModulesIndex.js +54 -0
- package/dist/compile/lib/compileCollections.d.ts +74 -0
- package/dist/compile/lib/compileCollections.js +614 -0
- package/dist/compile/lib/consts.d.ts +5 -0
- package/dist/compile/lib/consts.js +10 -0
- package/dist/compile/lib/ensureEnvExample.d.ts +28 -0
- package/dist/compile/lib/ensureEnvExample.js +79 -0
- package/dist/compile/lib/ensureGitignored.d.ts +6 -0
- package/dist/compile/lib/ensureGitignored.js +16 -0
- package/dist/compile/lib/filterFields.d.ts +5 -0
- package/dist/compile/lib/filterFields.js +17 -0
- package/dist/compile/lib/harnessMarkers.d.ts +2 -0
- package/dist/compile/lib/harnessMarkers.js +4 -0
- package/dist/compile/lib/mergeMixins.d.ts +14 -0
- package/dist/compile/lib/mergeMixins.js +55 -0
- package/dist/compile/lib/mergeOverlays.d.ts +6 -0
- package/dist/compile/lib/mergeOverlays.js +37 -0
- package/dist/compile/lib/nameErrors.d.ts +6 -0
- package/dist/compile/lib/nameErrors.js +57 -0
- package/dist/compile/lib/namespaceProblems.d.ts +8 -0
- package/dist/compile/lib/namespaceProblems.js +34 -0
- package/dist/compile/lib/overlayView.d.ts +2 -0
- package/dist/compile/lib/overlayView.js +17 -0
- package/dist/compile/lib/renderContributions.d.ts +14 -0
- package/dist/compile/lib/renderContributions.js +50 -0
- package/dist/compile/lib/resolveFields.d.ts +21 -0
- package/dist/compile/lib/resolveFields.js +232 -0
- package/dist/compile/lib/runHarnessAdapters.d.ts +19 -0
- package/dist/compile/lib/runHarnessAdapters.js +590 -0
- package/dist/compile/lib/shapeErrors.d.ts +3 -0
- package/dist/compile/lib/shapeErrors.js +64 -0
- package/dist/compile/lib/storageOverlaps.d.ts +17 -0
- package/dist/compile/lib/storageOverlaps.js +26 -0
- package/dist/compile/lib/subpathProblem.d.ts +6 -0
- package/dist/compile/lib/subpathProblem.js +14 -0
- package/dist/compile/lib/toJsonSchema.d.ts +9 -0
- package/dist/compile/lib/toJsonSchema.js +100 -0
- package/dist/compile/lib/types.d.ts +46 -0
- package/dist/compile/lib/types.js +1 -0
- package/dist/compile/lib/unqualifiedProblems.d.ts +6 -0
- package/dist/compile/lib/unqualifiedProblems.js +18 -0
- package/dist/compile/lib/viewDisplay.d.ts +6 -0
- package/dist/compile/lib/viewDisplay.js +21 -0
- package/dist/compile/lib/viewErrors.d.ts +20 -0
- package/dist/compile/lib/viewErrors.js +143 -0
- package/dist/compile/lib/writeLine.d.ts +12 -0
- package/dist/compile/lib/writeLine.js +31 -0
- package/dist/compile/sha256.d.ts +1 -0
- package/dist/compile/sha256.js +2 -0
- package/dist/compile/stagedKindDir.d.ts +18 -0
- package/dist/compile/stagedKindDir.js +32 -0
- package/dist/compile/staleness.d.ts +11 -0
- package/dist/compile/staleness.js +118 -0
- package/dist/compile/toPosix.d.ts +2 -0
- package/dist/compile/toPosix.js +3 -0
- package/dist/compile/types.d.ts +39 -0
- package/dist/compile/types.js +1 -0
- package/dist/compile/v1ManifestRefusal.d.ts +8 -0
- package/dist/compile/v1ManifestRefusal.js +16 -0
- package/dist/compile/v1Refusal.d.ts +2 -0
- package/dist/compile/v1Refusal.js +5 -0
- package/dist/compile/views.d.ts +2 -0
- package/dist/compile/views.js +3 -0
- package/dist/compile/warnIfStale.d.ts +3 -0
- package/dist/compile/warnIfStale.js +10 -0
- package/dist/coreVerbs.d.ts +6 -0
- package/dist/coreVerbs.js +50 -0
- package/dist/doctor/consts.d.ts +10 -0
- package/dist/doctor/consts.js +10 -0
- package/dist/doctor/doctorBoard.d.ts +7 -0
- package/dist/doctor/doctorBoard.js +97 -0
- package/dist/doctor/renderBoard.d.ts +2 -0
- package/dist/doctor/renderBoard.js +9 -0
- package/dist/doctor/types.d.ts +7 -0
- package/dist/doctor/types.js +1 -0
- package/dist/entities/createSkill.d.ts +12 -0
- package/dist/entities/createSkill.js +56 -0
- package/dist/entities/entitiesCommand.d.ts +7 -0
- package/dist/entities/entitiesCommand.js +97 -0
- package/dist/entities/lib/consts.d.ts +2 -0
- package/dist/entities/lib/consts.js +2 -0
- package/dist/entities/lib/entitySource.d.ts +10 -0
- package/dist/entities/lib/entitySource.js +17 -0
- package/dist/entities/lib/refuseBuiltSkill.d.ts +9 -0
- package/dist/entities/lib/refuseBuiltSkill.js +23 -0
- package/dist/entities/lib/refuseHandAuthored.d.ts +7 -0
- package/dist/entities/lib/refuseHandAuthored.js +15 -0
- package/dist/entities/lib/setFrontmatterKey.d.ts +8 -0
- package/dist/entities/lib/setFrontmatterKey.js +21 -0
- package/dist/entities/removeEntity.d.ts +7 -0
- package/dist/entities/removeEntity.js +35 -0
- package/dist/entities/renameEntity.d.ts +11 -0
- package/dist/entities/renameEntity.js +51 -0
- package/dist/entities/setEntityFrontmatter.d.ts +9 -0
- package/dist/entities/setEntityFrontmatter.js +58 -0
- package/dist/exports/planExports.d.ts +10 -0
- package/dist/exports/planExports.js +72 -0
- package/dist/exports/runExports.d.ts +7 -0
- package/dist/exports/runExports.js +95 -0
- package/dist/exports/serializeExports.d.ts +6 -0
- package/dist/exports/serializeExports.js +17 -0
- package/dist/extensions/consts.d.ts +1 -0
- package/dist/extensions/consts.js +1 -0
- package/dist/extensions/declaredExtensions.d.ts +17 -0
- package/dist/extensions/declaredExtensions.js +85 -0
- package/dist/extensions/extensions.d.ts +21 -0
- package/dist/extensions/extensions.js +24 -0
- package/dist/extensions/lib/consts.d.ts +2 -0
- package/dist/extensions/lib/consts.js +2 -0
- package/dist/extensions/lib/validateSetup.d.ts +15 -0
- package/dist/extensions/lib/validateSetup.js +128 -0
- package/dist/extensions/loadExtensions.d.ts +14 -0
- package/dist/extensions/loadExtensions.js +146 -0
- package/dist/extensions/manifestViolations.d.ts +11 -0
- package/dist/extensions/manifestViolations.js +17 -0
- package/dist/fmt/formatDescriptors.d.ts +20 -0
- package/dist/fmt/formatDescriptors.js +67 -0
- package/dist/fmt/formatSource.d.ts +7 -0
- package/dist/fmt/formatSource.js +50 -0
- package/dist/init/consts.d.ts +1 -0
- package/dist/init/consts.js +1 -0
- package/dist/init/escapes.d.ts +2 -0
- package/dist/init/escapes.js +64 -0
- package/dist/init/init.d.ts +7 -0
- package/dist/init/init.js +152 -0
- package/dist/init/initCommand.d.ts +30 -0
- package/dist/init/initCommand.js +407 -0
- package/dist/init/initFootprint.d.ts +6 -0
- package/dist/init/initFootprint.js +19 -0
- package/dist/init/seedBlock.d.ts +7 -0
- package/dist/init/seedBlock.js +37 -0
- package/dist/install/applyInstall.d.ts +15 -0
- package/dist/install/applyInstall.js +190 -0
- package/dist/install/buildClone.d.ts +5 -0
- package/dist/install/buildClone.js +22 -0
- package/dist/install/commitOf.d.ts +1 -0
- package/dist/install/commitOf.js +2 -0
- package/dist/install/declaredDeps.d.ts +3 -0
- package/dist/install/declaredDeps.js +2 -0
- package/dist/install/indexFolder.d.ts +6 -0
- package/dist/install/indexFolder.js +32 -0
- package/dist/install/install.d.ts +8 -0
- package/dist/install/install.js +177 -0
- package/dist/install/installCheckout.d.ts +15 -0
- package/dist/install/installCheckout.js +142 -0
- package/dist/install/installClone.d.ts +6 -0
- package/dist/install/installClone.js +32 -0
- package/dist/install/installCommand.d.ts +15 -0
- package/dist/install/installCommand.js +61 -0
- package/dist/install/installModules.d.ts +17 -0
- package/dist/install/installModules.js +208 -0
- package/dist/install/installedModules.d.ts +12 -0
- package/dist/install/installedModules.js +27 -0
- package/dist/install/isLink.d.ts +1 -0
- package/dist/install/isLink.js +9 -0
- package/dist/install/lib/readTarballManifest.d.ts +6 -0
- package/dist/install/lib/readTarballManifest.js +27 -0
- package/dist/install/npmAndCompile.d.ts +35 -0
- package/dist/install/npmAndCompile.js +151 -0
- package/dist/install/observeState.d.ts +29 -0
- package/dist/install/observeState.js +98 -0
- package/dist/install/offRef.d.ts +7 -0
- package/dist/install/offRef.js +19 -0
- package/dist/install/planInstall.d.ts +9 -0
- package/dist/install/planInstall.js +73 -0
- package/dist/install/presetMembers.d.ts +17 -0
- package/dist/install/presetMembers.js +25 -0
- package/dist/install/readHookInput.d.ts +17 -0
- package/dist/install/readHookInput.js +29 -0
- package/dist/install/readSpecManifest.d.ts +12 -0
- package/dist/install/readSpecManifest.js +55 -0
- package/dist/install/readStdin.d.ts +12 -0
- package/dist/install/readStdin.js +25 -0
- package/dist/install/resolveClosure.d.ts +21 -0
- package/dist/install/resolveClosure.js +69 -0
- package/dist/install/resolves.d.ts +8 -0
- package/dist/install/resolves.js +9 -0
- package/dist/install/types.d.ts +26 -0
- package/dist/install/types.js +1 -0
- package/dist/install/versions.d.ts +12 -0
- package/dist/install/versions.js +25 -0
- package/dist/lib/alreadyThat.d.ts +5 -0
- package/dist/lib/alreadyThat.js +8 -0
- package/dist/lib/appendMissing.d.ts +1 -0
- package/dist/lib/appendMissing.js +7 -0
- package/dist/lib/atomicWrite.d.ts +1 -0
- package/dist/lib/atomicWrite.js +9 -0
- package/dist/lib/baseDescriptorSource.d.ts +18 -0
- package/dist/lib/baseDescriptorSource.js +52 -0
- package/dist/lib/childEnv.d.ts +12 -0
- package/dist/lib/childEnv.js +16 -0
- package/dist/lib/collectionSourceFile.d.ts +26 -0
- package/dist/lib/collectionSourceFile.js +56 -0
- package/dist/lib/consts.d.ts +93 -0
- package/dist/lib/consts.js +180 -0
- package/dist/lib/dryRunPlan.d.ts +21 -0
- package/dist/lib/dryRunPlan.js +23 -0
- package/dist/lib/editWorkspacePkg.d.ts +8 -0
- package/dist/lib/editWorkspacePkg.js +19 -0
- package/dist/lib/emit.d.ts +32 -0
- package/dist/lib/emit.js +46 -0
- package/dist/lib/emitDocument.d.ts +6 -0
- package/dist/lib/emitDocument.js +61 -0
- package/dist/lib/endOf.d.ts +11 -0
- package/dist/lib/endOf.js +25 -0
- package/dist/lib/escapeRe.d.ts +2 -0
- package/dist/lib/escapeRe.js +2 -0
- package/dist/lib/fieldFromFlags.d.ts +13 -0
- package/dist/lib/fieldFromFlags.js +195 -0
- package/dist/lib/gatedTreeOp.d.ts +30 -0
- package/dist/lib/gatedTreeOp.js +59 -0
- package/dist/lib/git/commitArg.d.ts +1 -0
- package/dist/lib/git/commitArg.js +13 -0
- package/dist/lib/git/defaultGit.d.ts +1 -0
- package/dist/lib/git/defaultGit.js +20 -0
- package/dist/lib/git/describeCheckout.d.ts +9 -0
- package/dist/lib/git/describeCheckout.js +45 -0
- package/dist/lib/git/gitOk.d.ts +2 -0
- package/dist/lib/git/gitOk.js +11 -0
- package/dist/lib/git/inProgress.d.ts +5 -0
- package/dist/lib/git/inProgress.js +28 -0
- package/dist/lib/git/repoRootOf.d.ts +6 -0
- package/dist/lib/git/repoRootOf.js +20 -0
- package/dist/lib/git/tryGit.d.ts +1 -0
- package/dist/lib/git/tryGit.js +10 -0
- package/dist/lib/isEntityKind.d.ts +2 -0
- package/dist/lib/isEntityKind.js +3 -0
- package/dist/lib/nearest.d.ts +5 -0
- package/dist/lib/nearest.js +21 -0
- package/dist/lib/need.d.ts +1 -0
- package/dist/lib/need.js +5 -0
- package/dist/lib/npm/exact.d.ts +5 -0
- package/dist/lib/npm/exact.js +5 -0
- package/dist/lib/npm/npmFloor.d.ts +2 -0
- package/dist/lib/npm/npmFloor.js +18 -0
- package/dist/lib/npm/resolveNpm.d.ts +10 -0
- package/dist/lib/npm/resolveNpm.js +35 -0
- package/dist/lib/npm/satisfies.d.ts +11 -0
- package/dist/lib/npm/satisfies.js +66 -0
- package/dist/lib/oneValue.d.ts +7 -0
- package/dist/lib/oneValue.js +12 -0
- package/dist/lib/pairs.d.ts +5 -0
- package/dist/lib/pairs.js +15 -0
- package/dist/lib/parseArgs.d.ts +17 -0
- package/dist/lib/parseArgs.js +36 -0
- package/dist/lib/refuseUnknownFlags.d.ts +3 -0
- package/dist/lib/refuseUnknownFlags.js +53 -0
- package/dist/lib/rel.d.ts +1 -0
- package/dist/lib/rel.js +3 -0
- package/dist/lib/schema-ops.d.ts +105 -0
- package/dist/lib/schema-ops.js +177 -0
- package/dist/lib/singular.d.ts +1 -0
- package/dist/lib/singular.js +23 -0
- package/dist/lib/stripMeta.d.ts +2 -0
- package/dist/lib/stripMeta.js +2 -0
- package/dist/lib/symlinkBelow.d.ts +13 -0
- package/dist/lib/symlinkBelow.js +33 -0
- package/dist/lib/types.d.ts +22 -0
- package/dist/lib/types.js +1 -0
- package/dist/lib/walk.d.ts +5 -0
- package/dist/lib/walk.js +21 -0
- package/dist/lib/writeSource.d.ts +7 -0
- package/dist/lib/writeSource.js +77 -0
- package/dist/lib/yaml.d.ts +18 -0
- package/dist/lib/yaml.js +26 -0
- package/dist/modules/createModule.d.ts +16 -0
- package/dist/modules/createModule.js +136 -0
- package/dist/modules/lib/consts.d.ts +10 -0
- package/dist/modules/lib/consts.js +17 -0
- package/dist/modules/lib/extensionText.d.ts +3 -0
- package/dist/modules/lib/extensionText.js +36 -0
- package/dist/modules/lib/readmeText.d.ts +6 -0
- package/dist/modules/lib/readmeText.js +25 -0
- package/dist/modules/lib/scaffoldKey.d.ts +2 -0
- package/dist/modules/lib/scaffoldKey.js +2 -0
- package/dist/modules/lib/testText.d.ts +7 -0
- package/dist/modules/lib/testText.js +19 -0
- package/dist/modules/modulesCommand.d.ts +4 -0
- package/dist/modules/modulesCommand.js +121 -0
- package/dist/modules/removeModule.d.ts +25 -0
- package/dist/modules/removeModule.js +94 -0
- package/dist/modules/renameModule.d.ts +15 -0
- package/dist/modules/renameModule.js +109 -0
- package/dist/modules/runModuleScript.d.ts +17 -0
- package/dist/modules/runModuleScript.js +100 -0
- package/dist/modules/setModule.d.ts +9 -0
- package/dist/modules/setModule.js +88 -0
- package/dist/openWorkspace.d.ts +12 -0
- package/dist/openWorkspace.js +22 -0
- package/dist/record/bodyField.d.ts +2 -0
- package/dist/record/bodyField.js +4 -0
- package/dist/record/collectRefFields.d.ts +3 -0
- package/dist/record/collectRefFields.js +16 -0
- package/dist/record/consts.d.ts +43 -0
- package/dist/record/consts.js +85 -0
- package/dist/record/descriptor.d.ts +44 -0
- package/dist/record/descriptor.js +56 -0
- package/dist/record/displayOf.d.ts +3 -0
- package/dist/record/displayOf.js +13 -0
- package/dist/record/expectedMirrors.d.ts +10 -0
- package/dist/record/expectedMirrors.js +27 -0
- package/dist/record/exportsContext.d.ts +17 -0
- package/dist/record/exportsContext.js +62 -0
- package/dist/record/fields.d.ts +9 -0
- package/dist/record/fields.js +30 -0
- package/dist/record/idFromRecordPath.d.ts +16 -0
- package/dist/record/idFromRecordPath.js +28 -0
- package/dist/record/lib/applyFilter.d.ts +5 -0
- package/dist/record/lib/applyFilter.js +32 -0
- package/dist/record/lib/consts.d.ts +7 -0
- package/dist/record/lib/consts.js +7 -0
- package/dist/record/lib/enumChoices.d.ts +2 -0
- package/dist/record/lib/enumChoices.js +16 -0
- package/dist/record/lib/fmtDate.d.ts +1 -0
- package/dist/record/lib/fmtDate.js +18 -0
- package/dist/record/lib/placedChildAt.d.ts +10 -0
- package/dist/record/lib/placedChildAt.js +25 -0
- package/dist/record/lib/rootRecords.d.ts +8 -0
- package/dist/record/lib/rootRecords.js +37 -0
- package/dist/record/lib/types.d.ts +6 -0
- package/dist/record/lib/types.js +1 -0
- package/dist/record/namespace.d.ts +22 -0
- package/dist/record/namespace.js +36 -0
- package/dist/record/nav.d.ts +41 -0
- package/dist/record/nav.js +237 -0
- package/dist/record/normalizeNamespaces.d.ts +8 -0
- package/dist/record/normalizeNamespaces.js +20 -0
- package/dist/record/outsideRefs.d.ts +19 -0
- package/dist/record/outsideRefs.js +34 -0
- package/dist/record/ownerIdOf.d.ts +11 -0
- package/dist/record/ownerIdOf.js +12 -0
- package/dist/record/ownersReadIn.d.ts +9 -0
- package/dist/record/ownersReadIn.js +11 -0
- package/dist/record/parentFolders.d.ts +6 -0
- package/dist/record/parentFolders.js +18 -0
- package/dist/record/parseRecordText.d.ts +2 -0
- package/dist/record/parseRecordText.js +19 -0
- package/dist/record/parseRef.d.ts +11 -0
- package/dist/record/parseRef.js +27 -0
- package/dist/record/parseTemplate.d.ts +3 -0
- package/dist/record/parseTemplate.js +24 -0
- package/dist/record/pathToRecord.d.ts +9 -0
- package/dist/record/pathToRecord.js +39 -0
- package/dist/record/placedRecords.d.ts +8 -0
- package/dist/record/placedRecords.js +22 -0
- package/dist/record/placement.d.ts +15 -0
- package/dist/record/placement.js +19 -0
- package/dist/record/presentation.d.ts +3 -0
- package/dist/record/presentation.js +236 -0
- package/dist/record/readExports.d.ts +2 -0
- package/dist/record/readExports.js +14 -0
- package/dist/record/records.d.ts +15 -0
- package/dist/record/records.js +53 -0
- package/dist/record/ref.d.ts +12 -0
- package/dist/record/ref.js +26 -0
- package/dist/record/regenerate.d.ts +18 -0
- package/dist/record/regenerate.js +56 -0
- package/dist/record/relationsOf.d.ts +3 -0
- package/dist/record/relationsOf.js +33 -0
- package/dist/record/renderDisplay.d.ts +13 -0
- package/dist/record/renderDisplay.js +33 -0
- package/dist/record/sees.d.ts +6 -0
- package/dist/record/sees.js +7 -0
- package/dist/record/serialize.d.ts +2 -0
- package/dist/record/serialize.js +35 -0
- package/dist/record/splitRef.d.ts +10 -0
- package/dist/record/splitRef.js +23 -0
- package/dist/record/storageOf.d.ts +3 -0
- package/dist/record/storageOf.js +40 -0
- package/dist/record/template.d.ts +12 -0
- package/dist/record/template.js +28 -0
- package/dist/record/temporal.d.ts +2 -0
- package/dist/record/temporal.js +8 -0
- package/dist/record/types.d.ts +76 -0
- package/dist/record/types.js +1 -0
- package/dist/record/unknownOperators.d.ts +5 -0
- package/dist/record/unknownOperators.js +25 -0
- package/dist/record/unknownTokens.d.ts +5 -0
- package/dist/record/unknownTokens.js +17 -0
- package/dist/record/validateTemplate.d.ts +14 -0
- package/dist/record/validateTemplate.js +36 -0
- package/dist/record/valuesAt.d.ts +2 -0
- package/dist/record/valuesAt.js +11 -0
- package/dist/records/commandsFor.d.ts +18 -0
- package/dist/records/commandsFor.js +65 -0
- package/dist/records/distinctValues.d.ts +16 -0
- package/dist/records/distinctValues.js +63 -0
- package/dist/records/history.d.ts +19 -0
- package/dist/records/history.js +35 -0
- package/dist/records/historyDiff.d.ts +7 -0
- package/dist/records/historyDiff.js +14 -0
- package/dist/records/lib/coerceArrays.d.ts +3 -0
- package/dist/records/lib/coerceArrays.js +26 -0
- package/dist/records/lib/compareValues.d.ts +8 -0
- package/dist/records/lib/compareValues.js +21 -0
- package/dist/records/lib/consts.d.ts +3 -0
- package/dist/records/lib/consts.js +3 -0
- package/dist/records/lib/contributedNotes.d.ts +14 -0
- package/dist/records/lib/contributedNotes.js +28 -0
- package/dist/records/lib/fmtCell.d.ts +1 -0
- package/dist/records/lib/fmtCell.js +1 -0
- package/dist/records/lib/keyBetween.d.ts +2 -0
- package/dist/records/lib/keyBetween.js +4 -0
- package/dist/records/lib/landedIn.d.ts +9 -0
- package/dist/records/lib/landedIn.js +13 -0
- package/dist/records/lib/listColumns.d.ts +3 -0
- package/dist/records/lib/listColumns.js +6 -0
- package/dist/records/lib/looseEq.d.ts +6 -0
- package/dist/records/lib/looseEq.js +6 -0
- package/dist/records/lib/matchesFilter.d.ts +2 -0
- package/dist/records/lib/matchesFilter.js +151 -0
- package/dist/records/lib/narrowRows.d.ts +16 -0
- package/dist/records/lib/narrowRows.js +79 -0
- package/dist/records/lib/parseTemporal.d.ts +9 -0
- package/dist/records/lib/parseTemporal.js +27 -0
- package/dist/records/lib/placementKey.d.ts +12 -0
- package/dist/records/lib/placementKey.js +31 -0
- package/dist/records/lib/recordResolver.d.ts +8 -0
- package/dist/records/lib/recordResolver.js +35 -0
- package/dist/records/lib/sortRows.d.ts +6 -0
- package/dist/records/lib/sortRows.js +20 -0
- package/dist/records/lib/sourceHintFor.d.ts +3 -0
- package/dist/records/lib/sourceHintFor.js +12 -0
- package/dist/records/lib/tokenValue.d.ts +3 -0
- package/dist/records/lib/tokenValue.js +17 -0
- package/dist/records/lib/trackedPaths.d.ts +14 -0
- package/dist/records/lib/trackedPaths.js +29 -0
- package/dist/records/lib/whereKeys.d.ts +8 -0
- package/dist/records/lib/whereKeys.js +2 -0
- package/dist/records/nextCommand.d.ts +4 -0
- package/dist/records/nextCommand.js +53 -0
- package/dist/records/recordsCommand.d.ts +7 -0
- package/dist/records/recordsCommand.js +291 -0
- package/dist/records-api.d.ts +42 -0
- package/dist/records-api.js +41 -0
- package/dist/repos/lib/relPath.d.ts +1 -0
- package/dist/repos/lib/relPath.js +6 -0
- package/dist/repos/lib/repoPath.d.ts +3 -0
- package/dist/repos/lib/repoPath.js +11 -0
- package/dist/repos/listRepos.d.ts +12 -0
- package/dist/repos/listRepos.js +28 -0
- package/dist/repos/materializeRepo.d.ts +9 -0
- package/dist/repos/materializeRepo.js +26 -0
- package/dist/repos/repos.d.ts +14 -0
- package/dist/repos/repos.js +17 -0
- package/dist/repos/reposCommand.d.ts +4 -0
- package/dist/repos/reposCommand.js +28 -0
- package/dist/repos/types.d.ts +29 -0
- package/dist/repos/types.js +1 -0
- package/dist/runtime/consts.d.ts +12 -0
- package/dist/runtime/consts.js +12 -0
- package/dist/runtime/exportsFacts.d.ts +17 -0
- package/dist/runtime/exportsFacts.js +10 -0
- package/dist/runtime/loadDescriptors.d.ts +8 -0
- package/dist/runtime/loadDescriptors.js +46 -0
- package/dist/runtime/runtime.d.ts +35 -0
- package/dist/runtime/runtime.js +66 -0
- package/dist/runtime/sourceRoots.d.ts +10 -0
- package/dist/runtime/sourceRoots.js +22 -0
- package/dist/scripts/migrate-descriptors-v2.js +1248 -0
- package/dist/scripts/migrate-stubs.js +170 -0
- package/dist/setup/consts.d.ts +2 -0
- package/dist/setup/consts.js +2 -0
- package/dist/setup/fillInputs.d.ts +28 -0
- package/dist/setup/fillInputs.js +142 -0
- package/dist/setup/fold.d.ts +6 -0
- package/dist/setup/fold.js +30 -0
- package/dist/setup/lib/consent.d.ts +9 -0
- package/dist/setup/lib/consent.js +14 -0
- package/dist/setup/lib/env-write.d.ts +6 -0
- package/dist/setup/lib/env-write.js +10 -0
- package/dist/setup/lib/envSpans.d.ts +17 -0
- package/dist/setup/lib/envSpans.js +27 -0
- package/dist/setup/lib/fingerprint.d.ts +2 -0
- package/dist/setup/lib/fingerprint.js +21 -0
- package/dist/setup/lib/gitExposure.d.ts +8 -0
- package/dist/setup/lib/gitExposure.js +50 -0
- package/dist/setup/lib/judgeEnvAction.d.ts +25 -0
- package/dist/setup/lib/judgeEnvAction.js +60 -0
- package/dist/setup/lib/leftoverTemps.d.ts +2 -0
- package/dist/setup/lib/leftoverTemps.js +15 -0
- package/dist/setup/lib/redact.d.ts +7 -0
- package/dist/setup/lib/redact.js +28 -0
- package/dist/setup/lib/secretPathProblem.d.ts +2 -0
- package/dist/setup/lib/secretPathProblem.js +16 -0
- package/dist/setup/lib/setEnvValues.d.ts +12 -0
- package/dist/setup/lib/setEnvValues.js +57 -0
- package/dist/setup/lib/setup-contract.d.ts +5 -0
- package/dist/setup/lib/setup-contract.js +2 -0
- package/dist/setup/lib/validateEnvAction.d.ts +16 -0
- package/dist/setup/lib/validateEnvAction.js +25 -0
- package/dist/setup/lib/writeEnvAtomic.d.ts +7 -0
- package/dist/setup/lib/writeEnvAtomic.js +60 -0
- package/dist/setup/parseAllow.d.ts +8 -0
- package/dist/setup/parseAllow.js +20 -0
- package/dist/setup/parseInputFlags.d.ts +3 -0
- package/dist/setup/parseInputFlags.js +17 -0
- package/dist/setup/printUnitResults.d.ts +3 -0
- package/dist/setup/printUnitResults.js +23 -0
- package/dist/setup/renderStatusLines.d.ts +2 -0
- package/dist/setup/renderStatusLines.js +14 -0
- package/dist/setup/runUnit.d.ts +21 -0
- package/dist/setup/runUnit.js +204 -0
- package/dist/setup/safeInspect.d.ts +7 -0
- package/dist/setup/safeInspect.js +28 -0
- package/dist/setup/setup.d.ts +14 -0
- package/dist/setup/setup.js +28 -0
- package/dist/setup/setupAndCommit.d.ts +28 -0
- package/dist/setup/setupAndCommit.js +103 -0
- package/dist/setup/statusLines.d.ts +6 -0
- package/dist/setup/statusLines.js +90 -0
- package/dist/setup/ttyIO.d.ts +5 -0
- package/dist/setup/ttyIO.js +25 -0
- package/dist/setup/types.d.ts +65 -0
- package/dist/setup/types.js +1 -0
- package/dist/setup/unitEnvFor.d.ts +11 -0
- package/dist/setup/unitEnvFor.js +29 -0
- package/dist/setup/units.d.ts +4 -0
- package/dist/setup/units.js +7 -0
- package/dist/statusCommand.d.ts +2 -0
- package/dist/statusCommand.js +249 -0
- package/dist/store/Store.d.ts +561 -0
- package/dist/store/Store.js +744 -0
- package/dist/store/add.d.ts +14 -0
- package/dist/store/add.js +92 -0
- package/dist/store/addFile.d.ts +7 -0
- package/dist/store/addFile.js +43 -0
- package/dist/store/addedDates.d.ts +2 -0
- package/dist/store/addedDates.js +44 -0
- package/dist/store/createdOf.d.ts +3 -0
- package/dist/store/createdOf.js +20 -0
- package/dist/store/external.d.ts +8 -0
- package/dist/store/external.js +18 -0
- package/dist/store/findInboundRefs.d.ts +2 -0
- package/dist/store/findInboundRefs.js +13 -0
- package/dist/store/gitHead.d.ts +2 -0
- package/dist/store/gitHead.js +13 -0
- package/dist/store/ids.d.ts +2 -0
- package/dist/store/ids.js +19 -0
- package/dist/store/lib/applyMirrorEdits.d.ts +7 -0
- package/dist/store/lib/applyMirrorEdits.js +125 -0
- package/dist/store/lib/assertUnambiguous.d.ts +2 -0
- package/dist/store/lib/assertUnambiguous.js +11 -0
- package/dist/store/lib/checkRefs.d.ts +7 -0
- package/dist/store/lib/checkRefs.js +65 -0
- package/dist/store/lib/commit.d.ts +3 -0
- package/dist/store/lib/commit.js +40 -0
- package/dist/store/lib/commitIn.d.ts +3 -0
- package/dist/store/lib/commitIn.js +37 -0
- package/dist/store/lib/dirTreeStamps.d.ts +7 -0
- package/dist/store/lib/dirTreeStamps.js +33 -0
- package/dist/store/lib/filePath.d.ts +3 -0
- package/dist/store/lib/filePath.js +32 -0
- package/dist/store/lib/generateId.d.ts +4 -0
- package/dist/store/lib/generateId.js +72 -0
- package/dist/store/lib/gitDateToStamp.d.ts +6 -0
- package/dist/store/lib/gitDateToStamp.js +8 -0
- package/dist/store/lib/idsKey.d.ts +3 -0
- package/dist/store/lib/idsKey.js +23 -0
- package/dist/store/lib/indexAdd.d.ts +5 -0
- package/dist/store/lib/indexAdd.js +41 -0
- package/dist/store/lib/mirrorRemedy.d.ts +19 -0
- package/dist/store/lib/mirrorRemedy.js +24 -0
- package/dist/store/lib/moveRecord.d.ts +4 -0
- package/dist/store/lib/moveRecord.js +29 -0
- package/dist/store/lib/normalizeRecord.d.ts +2 -0
- package/dist/store/lib/normalizeRecord.js +28 -0
- package/dist/store/lib/normalizeTemporal.d.ts +10 -0
- package/dist/store/lib/normalizeTemporal.js +38 -0
- package/dist/store/lib/pathAt.d.ts +3 -0
- package/dist/store/lib/pathAt.js +29 -0
- package/dist/store/lib/placedChildrenIn.d.ts +8 -0
- package/dist/store/lib/placedChildrenIn.js +18 -0
- package/dist/store/lib/placementOfFile.d.ts +11 -0
- package/dist/store/lib/placementOfFile.js +20 -0
- package/dist/store/lib/pruneEmptyDirs.d.ts +8 -0
- package/dist/store/lib/pruneEmptyDirs.js +20 -0
- package/dist/store/lib/qualifyBareRefs.d.ts +3 -0
- package/dist/store/lib/qualifyBareRefs.js +16 -0
- package/dist/store/lib/recordFileName.d.ts +3 -0
- package/dist/store/lib/recordFileName.js +6 -0
- package/dist/store/lib/refuseDuplicateValues.d.ts +3 -0
- package/dist/store/lib/refuseDuplicateValues.js +16 -0
- package/dist/store/lib/refuseEngineWrites.d.ts +3 -0
- package/dist/store/lib/refuseEngineWrites.js +12 -0
- package/dist/store/lib/refuseMirrorWrites.d.ts +2 -0
- package/dist/store/lib/refuseMirrorWrites.js +8 -0
- package/dist/store/lib/snapshot.d.ts +17 -0
- package/dist/store/lib/snapshot.js +60 -0
- package/dist/store/lib/validate.d.ts +6 -0
- package/dist/store/lib/validate.js +33 -0
- package/dist/store/lib/walkIds.d.ts +3 -0
- package/dist/store/lib/walkIds.js +54 -0
- package/dist/store/lib/walkRoot.d.ts +3 -0
- package/dist/store/lib/walkRoot.js +24 -0
- package/dist/store/lib/writableDescriptor.d.ts +3 -0
- package/dist/store/lib/writableDescriptor.js +15 -0
- package/dist/store/recordFiles.d.ts +2 -0
- package/dist/store/recordFiles.js +27 -0
- package/dist/store/recordRoot.d.ts +3 -0
- package/dist/store/recordRoot.js +26 -0
- package/dist/store/relocate.d.ts +9 -0
- package/dist/store/relocate.js +52 -0
- package/dist/store/relocatePlan.d.ts +5 -0
- package/dist/store/relocatePlan.js +79 -0
- package/dist/store/rename.d.ts +8 -0
- package/dist/store/rename.js +95 -0
- package/dist/store/revert.d.ts +7 -0
- package/dist/store/revert.js +86 -0
- package/dist/store/rewriteRefsBatch.d.ts +3 -0
- package/dist/store/rewriteRefsBatch.js +142 -0
- package/dist/store/rm.d.ts +7 -0
- package/dist/store/rm.js +187 -0
- package/dist/store/set.d.ts +6 -0
- package/dist/store/set.js +80 -0
- package/dist/store/types.d.ts +40 -0
- package/dist/store/types.js +1 -0
- package/dist/store/vouched.d.ts +13 -0
- package/dist/store/vouched.js +31 -0
- package/dist/store/withWriteLock.d.ts +2 -0
- package/dist/store/withWriteLock.js +40 -0
- package/dist/store/writeLockPath.d.ts +2 -0
- package/dist/store/writeLockPath.js +20 -0
- package/dist/targetCommand.d.ts +2 -0
- package/dist/targetCommand.js +45 -0
- package/dist/testing.d.ts +23 -0
- package/dist/testing.js +85 -0
- package/dist/types.d.ts +699 -0
- package/dist/types.js +1 -0
- package/dist/ui-views/lib/assignPath.d.ts +17 -0
- package/dist/ui-views/lib/assignPath.js +34 -0
- package/dist/ui-views/lib/assignViewValue.d.ts +5 -0
- package/dist/ui-views/lib/assignViewValue.js +9 -0
- package/dist/ui-views/lib/consts.d.ts +21 -0
- package/dist/ui-views/lib/consts.js +27 -0
- package/dist/ui-views/lib/parseViewValue.d.ts +6 -0
- package/dist/ui-views/lib/parseViewValue.js +50 -0
- package/dist/ui-views/lib/viewOverlayOf.d.ts +2 -0
- package/dist/ui-views/lib/viewOverlayOf.js +19 -0
- package/dist/ui-views/moveUiView.d.ts +31 -0
- package/dist/ui-views/moveUiView.js +56 -0
- package/dist/ui-views/removeUiView.d.ts +6 -0
- package/dist/ui-views/removeUiView.js +17 -0
- package/dist/ui-views/saveUiView.d.ts +25 -0
- package/dist/ui-views/saveUiView.js +80 -0
- package/dist/ui-views/uiViewsCommand.d.ts +4 -0
- package/dist/ui-views/uiViewsCommand.js +118 -0
- package/dist/update/parseUpdateArgs.d.ts +9 -0
- package/dist/update/parseUpdateArgs.js +32 -0
- package/dist/update/update.d.ts +7 -0
- package/dist/update/update.js +57 -0
- package/dist/update/updateModules.d.ts +19 -0
- package/dist/update/updateModules.js +221 -0
- package/dist/update-setup.d.ts +1 -0
- package/dist/update-setup.js +14 -0
- package/dist/usage.d.ts +1 -0
- package/dist/usage.js +281 -0
- package/dist/workspace/commitByRepo.d.ts +4 -0
- package/dist/workspace/commitByRepo.js +51 -0
- package/dist/workspace/declaredGitModules.d.ts +51 -0
- package/dist/workspace/declaredGitModules.js +89 -0
- package/dist/workspace/discoverModules.d.ts +23 -0
- package/dist/workspace/discoverModules.js +123 -0
- package/dist/workspace/envContext.d.ts +3 -0
- package/dist/workspace/envContext.js +11 -0
- package/dist/workspace/findWorkspace.d.ts +2 -0
- package/dist/workspace/findWorkspace.js +49 -0
- package/dist/workspace/layerEntries.d.ts +16 -0
- package/dist/workspace/layerEntries.js +36 -0
- package/dist/workspace/lib/aheadCount.d.ts +6 -0
- package/dist/workspace/lib/aheadCount.js +29 -0
- package/dist/workspace/lib/assertCommentsKept.d.ts +16 -0
- package/dist/workspace/lib/assertCommentsKept.js +27 -0
- package/dist/workspace/lib/isTracked.d.ts +2 -0
- package/dist/workspace/lib/isTracked.js +14 -0
- package/dist/workspace/lib/shortHead.d.ts +1 -0
- package/dist/workspace/lib/shortHead.js +10 -0
- package/dist/workspace/moduleRows.d.ts +7 -0
- package/dist/workspace/moduleRows.js +9 -0
- package/dist/workspace/navFragments.d.ts +54 -0
- package/dist/workspace/navFragments.js +223 -0
- package/dist/workspace/parseEnvValues.d.ts +1 -0
- package/dist/workspace/parseEnvValues.js +13 -0
- package/dist/workspace/renderTemplate.d.ts +2 -0
- package/dist/workspace/renderTemplate.js +26 -0
- package/dist/workspace/reportCommits.d.ts +10 -0
- package/dist/workspace/reportCommits.js +18 -0
- package/dist/workspace/types.d.ts +90 -0
- package/dist/workspace/types.js +1 -0
- package/dist/workspace/writeGated.d.ts +9 -0
- package/dist/workspace/writeGated.js +128 -0
- package/package.json +45 -22
- package/skills/using-dreamteamer/SKILL.md +1 -1
- package/skills/using-dreamteamer/references/collections.md +1 -1
- package/skills/using-dreamteamer/references/skills.md +7 -0
- package/skills/using-dreamteamer/references/ui-views.md +2 -2
- package/skills/using-dreamteamer/references/writing-a-module.md +14 -0
- package/scripts/migrate-descriptors-v2.mjs +0 -795
- package/scripts/migrate-stubs.mjs +0 -98
- package/src/api.d.ts +0 -154
- package/src/api.js +0 -109
- package/src/check-alone.js +0 -171
- package/src/check.js +0 -427
- package/src/checkout.js +0 -705
- package/src/cli.js +0 -1000
- package/src/collections-cli.js +0 -1352
- package/src/commit.js +0 -611
- package/src/compile-collections.js +0 -481
- package/src/compile.js +0 -1498
- package/src/descriptor-v2.js +0 -167
- package/src/descriptor.js +0 -99
- package/src/doctor.js +0 -69
- package/src/env-vars.js +0 -59
- package/src/env-write.js +0 -162
- package/src/events.js +0 -204
- package/src/exports-cli.js +0 -91
- package/src/exports.js +0 -162
- package/src/extensions.js +0 -228
- package/src/field-values.js +0 -70
- package/src/fields.js +0 -255
- package/src/filter.js +0 -154
- package/src/fractional-index.js +0 -44
- package/src/harnesses.js +0 -649
- package/src/history.js +0 -90
- package/src/init.js +0 -473
- package/src/install-modules.js +0 -430
- package/src/namespace.js +0 -215
- package/src/nav-fragments.js +0 -190
- package/src/nav.js +0 -185
- package/src/placement.js +0 -219
- package/src/presentation.js +0 -182
- package/src/record-commands.js +0 -94
- package/src/records-api.d.ts +0 -210
- package/src/records-api.js +0 -41
- package/src/records.js +0 -109
- package/src/ref.js +0 -39
- package/src/relations.js +0 -62
- package/src/runtime.js +0 -160
- package/src/scaffold-templates.js +0 -85
- package/src/schema-ops.js +0 -2959
- package/src/semver.js +0 -36
- package/src/setup-contract.js +0 -101
- package/src/setup.js +0 -518
- package/src/store.js +0 -1940
- package/src/template.js +0 -201
- package/src/temporal.js +0 -157
- package/src/testing.d.ts +0 -29
- package/src/testing.js +0 -86
- package/src/unread-data.js +0 -74
- package/src/update-setup.js +0 -22
- package/src/update.js +0 -138
- package/src/views.js +0 -206
- package/src/workspace.js +0 -214
- package/src/yaml.js +0 -251
package/src/checkout.js
DELETED
|
@@ -1,705 +0,0 @@
|
|
|
1
|
-
// src/checkout.js — which checkout am I, and how does it become ready.
|
|
2
|
-
// WORKSPACE layer: knows git and the compiler, never the harness.
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import fs, { realpathSync } from 'node:fs';
|
|
5
|
-
import { execFileSync, spawnSync } from 'node:child_process';
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { staleness, compile, discoverModules } from './compile.js';
|
|
8
|
-
import { init, initFootprint, seedBlock, install as restoreGitModules, offRef } from './init.js';
|
|
9
|
-
import { declaredGitModules } from './workspace.js';
|
|
10
|
-
import { engineVersion, readManifest, RUNTIME_DIR } from './runtime.js';
|
|
11
|
-
import { satisfies } from './semver.js';
|
|
12
|
-
|
|
13
|
-
export const defaultGit = (args, cwd) => {
|
|
14
|
-
try {
|
|
15
|
-
return execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim();
|
|
16
|
-
} catch (e) {
|
|
17
|
-
// ⚠ GIT'S REASON LEADS. execFileSync does append the child's stderr to its message, but
|
|
18
|
-
// BEHIND `Command failed: git <argv>` — and every summary in this file reads
|
|
19
|
-
// `message.split('\n')[0]` (describeCheckout's parenthetical, applyInstall's per-step ✖), so
|
|
20
|
-
// the one line that survived was the command line and never the explanation. `dt rm` on a
|
|
21
|
-
// LOCKED worktree led with the argv and mentioned the lock underneath it.
|
|
22
|
-
const why = String(e.stderr ?? '').trim().split('\n').filter(Boolean);
|
|
23
|
-
if (why.length) e.message = [...why, `(git ${args.join(' ')})`].join('\n ');
|
|
24
|
-
throw e;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// Git answers --git-common-dir as a REALPATH, so the two sides of the insideRoot test must be
|
|
29
|
-
// spelled the same way or a checkout reached through a symlink reads as outside its own primary
|
|
30
|
-
// (macOS /tmp → /private/tmp is the everyday case). A unit test's git is a fake and its paths need
|
|
31
|
-
// not exist, so a path that cannot be resolved on disk keeps the spelling it came with.
|
|
32
|
-
const real = (p) => { try { return realpathSync(p); } catch { return p; } };
|
|
33
|
-
|
|
34
|
-
/** Primary vs linked, derived from git — never configured. `primary` is the common dir's parent. */
|
|
35
|
-
export function describeCheckout(rootArg, git = defaultGit) {
|
|
36
|
-
const root = path.resolve(rootArg);
|
|
37
|
-
let gitDir, commonDir;
|
|
38
|
-
try {
|
|
39
|
-
gitDir = git(['rev-parse', '--git-dir'], root);
|
|
40
|
-
commonDir = git(['rev-parse', '--git-common-dir'], root);
|
|
41
|
-
} catch (e) {
|
|
42
|
-
throw new Error(`${root} is not a git checkout — dreamteamer install needs one (${e.message.split('\n')[0]})`);
|
|
43
|
-
}
|
|
44
|
-
const abs = (p) => path.resolve(root, p);
|
|
45
|
-
const linked = abs(gitDir) !== abs(commonDir);
|
|
46
|
-
// The common dir's parent is the primary checkout whichever kind this is — and unlike `root` it
|
|
47
|
-
// stays the primary when the caller hands us a SUBDIRECTORY of one.
|
|
48
|
-
const primary = path.dirname(abs(commonDir));
|
|
49
|
-
const rel = path.relative(real(primary), real(root));
|
|
50
|
-
return { root, kind: linked ? 'linked' : 'primary', gitDir: abs(gitDir), commonDir: abs(commonDir), primary,
|
|
51
|
-
insideRoot: !rel.startsWith('..') && !path.isAbsolute(rel) };
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** The install plan as DATA: every step names what it found and what it would do, so the same
|
|
55
|
-
* decisions are testable without a disk and printable without being run. Task 3 observes the state
|
|
56
|
-
* and executes the steps; nothing here touches fs or git. */
|
|
57
|
-
export function planInstall(state, opts = {}) {
|
|
58
|
-
const { checkout: c } = state;
|
|
59
|
-
const steps = [];
|
|
60
|
-
// ⚠ EVERY declared direct dependency, not just the engine. A worktree whose engine is a mirrored dev
|
|
61
|
-
// LINK used to read as ready while an installed extension was missing — so
|
|
62
|
-
// npm never ran, and compile then refused the extension's source folder as an unknown kind.
|
|
63
|
-
const missing = state.missingDeps ?? [];
|
|
64
|
-
steps.push(missing.length
|
|
65
|
-
? { id: 'dependencies', label: `dependencies: ${missing.join(', ')} missing — npm ci --prefer-offline (package-lock.json) or npm install; a linked one is kept`, state: 'todo' }
|
|
66
|
-
: { id: 'dependencies', label: 'dependencies: every declared package present', state: 'already' });
|
|
67
|
-
if (c.kind === 'primary') steps.push({ id: 'env', label: '.env: primary checkout — nothing to link', state: 'skip' });
|
|
68
|
-
else if (state.hasEnv && !state.envIsLink) steps.push({ id: 'env', label: '.env: this worktree carries its own .env — left alone', state: 'already' });
|
|
69
|
-
else if (state.hasEnv && state.envIsLink) steps.push({ id: 'env', label: '.env: linked to the primary', state: 'already' });
|
|
70
|
-
else if (!state.primaryHasEnv) steps.push({ id: 'env', label: '.env: the primary has none — nothing to link', state: 'skip' });
|
|
71
|
-
else if (!c.insideRoot && !opts.linkEnv) steps.push({ id: 'env', label: '.env: NOT linked', state: 'skip',
|
|
72
|
-
why: 'this worktree lies outside the primary root — credentials are not linked there by default; pass --link-env to override for this run' });
|
|
73
|
-
else steps.push({ id: 'env', label: `.env: link → ${c.primary}/.env`, state: 'todo' });
|
|
74
|
-
for (const a of state.localAssets) {
|
|
75
|
-
const id = `asset:${a.rel}`;
|
|
76
|
-
if (a.presentHere && !a.isLinkHere) steps.push({ id, label: `${a.rel}: a real directory is here — left alone`, state: 'already' });
|
|
77
|
-
else if (a.isLinkHere) steps.push({ id, label: `${a.rel}: linked`, state: 'already' });
|
|
78
|
-
else if (c.kind === 'primary') steps.push({ id, label: `${a.rel}: primary checkout — nothing to link`, state: 'skip' });
|
|
79
|
-
else if (!a.presentInPrimary) steps.push({ id, label: `${a.rel}: absent in the primary — skipped (the doctor reports the capability degraded)`, state: 'skip' });
|
|
80
|
-
else steps.push({ id, label: `${a.rel}: link → ${c.primary}/${a.rel}`, state: 'todo' });
|
|
81
|
-
}
|
|
82
|
-
// gitModules carries the declared clones that are MISSING on this checkout or off their declared
|
|
83
|
-
// ref, not every declared one — the observer narrows it, which is what makes an empty array mean "nothing to restore"
|
|
84
|
-
// rather than "none declared", and what lets a settled checkout plan with nothing todo.
|
|
85
|
-
steps.push({ id: 'git_modules', label: state.gitModules.length ? `git modules: restore or re-point ${state.gitModules.join(', ')}` : 'git modules: nothing to restore', state: state.gitModules.length ? 'todo' : 'skip' });
|
|
86
|
-
steps.push({ id: 'compile', label: state.stale ? 'compile: runtime missing or stale' : 'compile: fresh', state: state.stale ? 'todo' : 'already' });
|
|
87
|
-
steps.push(state.postinstall
|
|
88
|
-
? { id: 'postinstall', label: `postinstall: ${state.postinstall}`, state: 'todo' }
|
|
89
|
-
: { id: 'postinstall', label: 'postinstall: none declared', state: 'skip' });
|
|
90
|
-
return steps;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// ---- the impure half: observe this checkout, run the plan, print the board -----------------
|
|
94
|
-
|
|
95
|
-
// ⚠ BOTH OF THESE FOLLOW SYMLINKS, and that is the whole point. A DANGLING link is exactly what a
|
|
96
|
-
// moved or deleted primary leaves behind, and it is the one state where "there is a symlink here"
|
|
97
|
-
// and "this checkout has the file" disagree. Reading it as present would print `✔ linked to the
|
|
98
|
-
// primary` over a file that cannot be opened — the board lying about the one step nobody eyeballs.
|
|
99
|
-
// So: present means it RESOLVES, and a link counts as a link only when it resolves too.
|
|
100
|
-
const resolves = (p) => fs.existsSync(p);
|
|
101
|
-
const isLink = (p) => { try { return fs.lstatSync(p).isSymbolicLink() && fs.existsSync(p); } catch { return false; } };
|
|
102
|
-
|
|
103
|
-
/** Every declared local asset, workspace-level (root-relative) and module-level (module-relative),
|
|
104
|
-
* DEDUPED by rel with the first declaration winning: a step's id is `asset:<rel>`, so two modules
|
|
105
|
-
* declaring the same path would plan two steps under one id and the second would be dropped
|
|
106
|
-
* silently by any id-keyed read of the board. */
|
|
107
|
-
export function declaredLocalAssets(ws) {
|
|
108
|
-
const seen = new Map(); // rel → {rel, module}
|
|
109
|
-
const add = (raw, module) => {
|
|
110
|
-
// ⚠ A REL MAY NOT CLIMB OUT OF THE WORKSPACE. `placeLink` writes wherever the rel points, so
|
|
111
|
-
// `local_assets: ['../../x']` in a careless module declaration would drop a symlink beside
|
|
112
|
-
// the workspace with nothing consulted. Refused when the plan is BUILT, so the board never
|
|
113
|
-
// prints a step it must not run. (Task 4 teaches compile the same rule; a runtime that
|
|
114
|
-
// writes outside the root should not wait for the compiler to be run.)
|
|
115
|
-
const rel = path.normalize(raw);
|
|
116
|
-
if (path.isAbsolute(rel) || rel === '..' || rel.startsWith(`..${path.sep}`)) {
|
|
117
|
-
throw new Error(`local_assets: "${raw}"${module ? ` (declared by module ${module})` : ''} resolves outside the workspace root — a local asset must be a path INSIDE the workspace`);
|
|
118
|
-
}
|
|
119
|
-
if (!seen.has(rel)) seen.set(rel, { rel, module });
|
|
120
|
-
};
|
|
121
|
-
for (const rel of ws.pkg.dreamteamer?.local_assets ?? []) add(rel, null);
|
|
122
|
-
for (const m of discoverModules(ws.root, ws.pkg).modules) {
|
|
123
|
-
let mp = {};
|
|
124
|
-
try { mp = JSON.parse(fs.readFileSync(path.join(m.root, 'package.json'), 'utf8')); } catch { /* no package.json */ }
|
|
125
|
-
for (const rel of mp.dreamteamer?.local_assets ?? []) add(path.relative(ws.root, path.join(m.root, rel)), m.name);
|
|
126
|
-
}
|
|
127
|
-
return [...seen.values()];
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** What is true of this checkout right now — the only function here that reads the disk, so
|
|
131
|
-
* `planInstall` stays pure and the whole board is decidable from this one object. */
|
|
132
|
-
export function observeState(ws) {
|
|
133
|
-
const checkout = describeCheckout(ws.root);
|
|
134
|
-
const here = (rel) => path.join(ws.root, rel), there = (rel) => path.join(checkout.primary, rel);
|
|
135
|
-
const s = staleness(ws.root);
|
|
136
|
-
return {
|
|
137
|
-
checkout,
|
|
138
|
-
missingDeps: declaredDeps(ws).filter((d) => !resolves(here(path.join('node_modules', d)))),
|
|
139
|
-
hasEnv: resolves(here('.env')), envIsLink: isLink(here('.env')), primaryHasEnv: resolves(there('.env')),
|
|
140
|
-
localAssets: declaredLocalAssets(ws).map((a) => ({ ...a, presentHere: resolves(here(a.rel)), isLinkHere: isLink(here(a.rel)), presentInPrimary: resolves(there(a.rel)) })),
|
|
141
|
-
// ⚠ THE MISSING clones and the ones off their declared ref, not every declared one. A settled
|
|
142
|
-
// worktree would otherwise print `▶ git modules: …` for ever, and this is the step whose result
|
|
143
|
-
// nobody looks at — so the narrowing here is what makes the empty case mean "nothing to do".
|
|
144
|
-
// … and the ones a clone on disk NEEDS (`declaredGitModules`): missing, off their ref, nothing yet under
|
|
145
|
-
// a declarer (a clone of its own there is satisfied), or a nested copy missing or off its ref. Before
|
|
146
|
-
// the first install only this workspace's own are visible.
|
|
147
|
-
gitModules: [...new Set([
|
|
148
|
-
...[...declaredGitModules(ws.pkg, ws.root).map].filter(([n, m]) => !resolves(here(path.join('git_modules', n))) || offRef(here(path.join('git_modules', n)), m.ref) || m.declarers.some((by) => by && !resolves(here(path.join(by, 'git_modules', n))))).map(([n]) => n),
|
|
149
|
-
// a nested copy that is still a LINK (laid while the declarer agreed with the top) is work to do
|
|
150
|
-
...declaredGitModules(ws.pkg, ws.root).nested.filter((c) => isLink(here(path.join(c.by, 'git_modules', c.name))) || !resolves(here(path.join(c.by, 'git_modules', c.name))) || offRef(here(path.join(c.by, 'git_modules', c.name)), c.ref)).map((c) => c.name),
|
|
151
|
-
])],
|
|
152
|
-
stale: !s.compiled || s.stale.length > 0,
|
|
153
|
-
postinstall: ws.pkg.dreamteamer?.postinstall ?? null,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** Every top-level package in node_modules that is a SYMLINK (scoped ones included), as
|
|
158
|
-
* `[path, raw link target]` — declared or not: the engine a checkout was cut to test is often an
|
|
159
|
-
* undeclared link, and it is exactly the one npm's pruning would delete. */
|
|
160
|
-
function linkedPackages(root) {
|
|
161
|
-
const nm = path.join(root, 'node_modules');
|
|
162
|
-
const out = [];
|
|
163
|
-
const scan = (dir) => {
|
|
164
|
-
let names = [];
|
|
165
|
-
try { names = fs.readdirSync(dir); } catch { return; }
|
|
166
|
-
for (const n of names) {
|
|
167
|
-
if (n.startsWith('.')) continue;
|
|
168
|
-
const p = path.join(dir, n);
|
|
169
|
-
let st;
|
|
170
|
-
try { st = fs.lstatSync(p); } catch { continue; }
|
|
171
|
-
if (st.isSymbolicLink()) out.push([p, fs.readlinkSync(p)]);
|
|
172
|
-
else if (n.startsWith('@') && dir === nm && st.isDirectory()) scan(p);
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
scan(nm);
|
|
176
|
-
return out;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/** The workspace's direct dependencies, sorted — what `npm install` is responsible for. */
|
|
180
|
-
const declaredDeps = (ws) => Object.keys({ ...ws.pkg?.dependencies, ...ws.pkg?.devDependencies }).sort();
|
|
181
|
-
|
|
182
|
-
/** Place a symlink, replacing a dangling one. A step only reaches here because the observer read
|
|
183
|
-
* the path as absent, which a broken link is — so the leftover has to be cleared, never trusted. */
|
|
184
|
-
function placeLink(target, at) {
|
|
185
|
-
fs.mkdirSync(path.dirname(at), { recursive: true });
|
|
186
|
-
try { if (fs.lstatSync(at).isSymbolicLink()) fs.unlinkSync(at); } catch { /* nothing there */ }
|
|
187
|
-
fs.symlinkSync(target, at);
|
|
188
|
-
return 0;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** ⚠ EVERY EXECUTOR ANSWERS WITH A CODE, NEVER A THROW. The board's contract is that one failure
|
|
192
|
-
* names itself and the remaining steps still run — and under `--json` a throw out of here would
|
|
193
|
-
* abandon the payload as well as the rest of the plan. `compile` throws on a source error, and fs
|
|
194
|
-
* throws on everything from EACCES to a primary that vanished mid-run, so the guard is the rule
|
|
195
|
-
* here rather than the exception. */
|
|
196
|
-
const guard = (name, fn) => (...a) => {
|
|
197
|
-
try { return fn(...a) ?? 0; } catch (e) { console.error(`✖ ${name}: ${e.message.split('\n')[0]}`); return 1; }
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
/** npm, resolved BESIDE the running node first and on PATH second.
|
|
201
|
-
*
|
|
202
|
-
* ⚠ THE ORDER IS THE MEASUREMENT (spec §15). A hook runs under `sh`, which reads no startup file,
|
|
203
|
-
* so PATH may carry nothing at all — while `process.execPath` is an absolute path to the node that
|
|
204
|
-
* is running this line, and every installer that ships node ships npm beside it. Trusting PATH
|
|
205
|
-
* first would pick a stale global npm on a machine that has both, and find nothing on a machine
|
|
206
|
-
* reached through the shim. Returns null when neither resolves, which is a board line, not a throw.
|
|
207
|
-
*/
|
|
208
|
-
export function resolveNpm(execPath = process.execPath, env = process.env) {
|
|
209
|
-
const bin = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
210
|
-
// ⚠ EXECUTABLE, not merely present. `resolves` is `existsSync`, which is true of a DIRECTORY
|
|
211
|
-
// called `npm` and of a file nobody may run — and this path is then spawned, so the difference
|
|
212
|
-
// between "it is there" and "it can be executed" is the difference between a named board line
|
|
213
|
-
// and an EACCES nobody planned for. A proof runner's `requires: { bin: … }` learned the same.
|
|
214
|
-
const runnable = (p) => { try { fs.accessSync(p, fs.constants.X_OK); return fs.statSync(p).isFile(); } catch { return false; } };
|
|
215
|
-
const beside = path.join(path.dirname(execPath), bin);
|
|
216
|
-
if (runnable(beside)) return beside;
|
|
217
|
-
for (const dir of (env.PATH ?? '').split(path.delimiter)) {
|
|
218
|
-
if (dir && runnable(path.join(dir, bin))) return path.join(dir, bin);
|
|
219
|
-
}
|
|
220
|
-
return null;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/** The environment a shelled-out step gets: this process's, plus the directory of the node that is
|
|
224
|
-
* running it, at the FRONT of PATH.
|
|
225
|
-
*
|
|
226
|
-
* ⚠ MEASURED, and it is the other half of `resolveNpm`. Resolving npm absolutely is not enough:
|
|
227
|
-
* npm's own shebang is `#!/usr/bin/env node`, so under a hook's environment
|
|
228
|
-
* (`env -i PATH=/usr/bin:/bin`) the resolved npm was found, spawned, and died at exit 127 with
|
|
229
|
-
* `env: node: No such file or directory` — the interpreter lookup, one level below the one the
|
|
230
|
-
* shim fixes. A declared `postinstall` has exactly the same problem for exactly the same reason,
|
|
231
|
-
* so both steps are handed the same environment. */
|
|
232
|
-
export const childEnv = () => ({ ...process.env, PATH: [path.dirname(process.execPath), process.env.PATH ?? ''].filter(Boolean).join(path.delimiter) });
|
|
233
|
-
|
|
234
|
-
// One executor per step id, keyed by the id's kind. None decides ANYTHING — whether a step runs at
|
|
235
|
-
// all was settled by `planInstall`. `stdio` is the caller's, so a `--json` run can send a
|
|
236
|
-
// subprocess's chatter to stderr and keep stdout for the payload.
|
|
237
|
-
const RUN = {
|
|
238
|
-
// ⚠ `npm` ARRIVES AS AN ARGUMENT rather than being resolved here, and that is what makes the
|
|
239
|
-
// refusal below testable at all: with the resolution inlined, deleting the guard left the suite
|
|
240
|
-
// green, because no fixture can make npm unresolvable beside the node running the test.
|
|
241
|
-
dependencies: guard('dependencies', (ws, st, rel, stdio, npm) => {
|
|
242
|
-
// ⚠ THE HONEST BOARD LINE, not a crash. `npm` is missing far more often than `node` is —
|
|
243
|
-
// a hook's `sh` finds neither, and the shim resolves only node — so the step has to say
|
|
244
|
-
// WHICH of the two it could not find. `✖ dependencies:` is prepended by the guard.
|
|
245
|
-
if (!npm) throw new Error('cannot install — node found, npm not on PATH');
|
|
246
|
-
// ⚠ A DELIBERATE DEVELOPMENT LINK SURVIVES. `npm ci` deletes node_modules and `npm install`
|
|
247
|
-
// re-points a linked package at the registry, so a dev engine (or a linked extension) would be
|
|
248
|
-
// silently replaced by the published copy — a checkout running a different engine than the one
|
|
249
|
-
// it was cut to test. Every linked direct dependency is recorded here and put back after npm.
|
|
250
|
-
// ⚠ WORKING links only. A DANGLING one (a moved checkout, a deleted vendor folder) is exactly the
|
|
251
|
-
// broken entry this step exists to repair — restoring it undid npm's repair and failed the install.
|
|
252
|
-
const links = linkedPackages(ws.root).filter(([p]) => resolves(p));
|
|
253
|
-
const status = spawnSync(npm, [fs.existsSync(path.join(ws.root, 'package-lock.json')) ? 'ci' : 'install', '--prefer-offline', '--no-audit', '--no-fund'], { cwd: ws.root, stdio, env: childEnv(), timeout: 600_000 }).status ?? 1;
|
|
254
|
-
for (const [p, target] of links) {
|
|
255
|
-
let same = false;
|
|
256
|
-
try { same = fs.lstatSync(p).isSymbolicLink() && fs.readlinkSync(p) === target; } catch { /* gone */ }
|
|
257
|
-
if (same) continue;
|
|
258
|
-
fs.rmSync(p, { recursive: true, force: true });
|
|
259
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
260
|
-
fs.symlinkSync(target, p);
|
|
261
|
-
console.error(`… kept the development link ${path.relative(ws.root, p)} → ${target}`);
|
|
262
|
-
}
|
|
263
|
-
if (status !== 0) return status;
|
|
264
|
-
// ⚠ npm's exit code is not the answer: a `file:` dependency whose folder does not exist is
|
|
265
|
-
// "added" as a DANGLING link at exit 0. Ready means every declared package now resolves.
|
|
266
|
-
const still = declaredDeps(ws).filter((d) => !resolves(path.join(ws.root, 'node_modules', d)));
|
|
267
|
-
if (still.length) throw new Error(`npm exited 0, but ${still.join(', ')} still do${still.length === 1 ? 'es' : ''} not resolve in node_modules`);
|
|
268
|
-
return 0;
|
|
269
|
-
}),
|
|
270
|
-
env: guard('.env', (ws, st) => placeLink(path.join(st.checkout.primary, '.env'), path.join(ws.root, '.env'))),
|
|
271
|
-
asset: guard('asset', (ws, st, rel) => placeLink(path.join(st.checkout.primary, rel), path.join(ws.root, rel))),
|
|
272
|
-
'git_modules': guard('git modules', (ws) => restoreGitModules(ws)),
|
|
273
|
-
compile: guard('compile', (ws) => compile(ws)), // `ws` is REOPENED first — see applyInstall
|
|
274
|
-
postinstall: guard('postinstall', (ws, st, rel, stdio) => spawnSync(st.postinstall, { cwd: ws.root, shell: true, stdio, env: { ...childEnv(), DT_PRIMARY: st.checkout.primary } }).status ?? 1),
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
/** Print the board and run the todo steps in order. `dryRun` prints and runs nothing. Returns 1 if
|
|
278
|
-
* any step errored — one failure never abandons the rest, because a checkout half-made-ready with
|
|
279
|
-
* a named failure is more useful than one that stopped at the first thing it could not do. */
|
|
280
|
-
export async function applyInstall(ws, state, steps, { dryRun = false, log = console.log, stdio = 'inherit', npm = resolveNpm(), open = null } = {}) {
|
|
281
|
-
let failed = 0, installed = false, restored = false;
|
|
282
|
-
for (const s of steps) {
|
|
283
|
-
// ⚠ NEW PACKAGES ARE NEW SOURCES. The plan judged the runtime fresh BEFORE npm put a module (or an
|
|
284
|
-
// extension) into node_modules, so a compiled workspace that just gained a dependency kept the
|
|
285
|
-
// old runtime at exit 0. Once dependencies were installed, the compile runs whatever the plan said.
|
|
286
|
-
// ⚠ A RESTORED LAYER IS A NEW INPUT TOO: compile bakes a layer's package name and data path into the
|
|
287
|
-
// runtime, and staleness hashes sources only — so a layer the git_modules step just cloned left
|
|
288
|
-
// `✔ compile: fresh` and a runtime that did not know it (the first review of 0.46.0, finding eng-03).
|
|
289
|
-
if (s.id === 'compile' && (installed || restored) && s.state === 'already') Object.assign(s, { label: installed ? 'compile: dependencies were just installed' : 'compile: git modules were just restored', state: 'todo' });
|
|
290
|
-
const glyph = s.state === 'todo' ? '▶' : s.state === 'already' ? '✔' : '—';
|
|
291
|
-
log(`${glyph} ${s.label}${s.why ? `\n ${s.why}` : ''}`);
|
|
292
|
-
if (s.state !== 'todo' || dryRun) continue;
|
|
293
|
-
const [kind, rel] = s.id.split(/:(.+)/);
|
|
294
|
-
// ⚠ COMPILE WITH WHAT WAS JUST INSTALLED. The handle was opened before npm ran, so its
|
|
295
|
-
// extension list predates the packages npm just put in node_modules: a first install compiled an
|
|
296
|
-
// extension's collection as an ordinary one (`storage.base: workspace`) and left the manifest
|
|
297
|
-
// without the provider, and only a second, manual compile repaired it. Reopened here, once.
|
|
298
|
-
if (kind === 'compile' && open) {
|
|
299
|
-
try { ws = await open(ws.root); } catch (e) { failed++; log(`✖ compile: the workspace would not reopen after installing — ${e.message.split('\n')[0]}`); continue; }
|
|
300
|
-
}
|
|
301
|
-
const code = RUN[kind](ws, state, rel, stdio, npm);
|
|
302
|
-
if (code !== 0) { failed++; log(`✖ ${s.id} failed (exit ${code})`); }
|
|
303
|
-
else if (kind === 'dependencies') installed = true;
|
|
304
|
-
else if (kind === 'git_modules') restored = true;
|
|
305
|
-
}
|
|
306
|
-
return failed ? 1 : 0;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// ---- the harness hook forms ----------------------------------------------------------------
|
|
310
|
-
//
|
|
311
|
-
// A hook is not a person: it does not type a target, it hands the engine a JSON object on stdin and
|
|
312
|
-
// reads whatever comes back on stdout. Two of this file's verbs grow that form, and one function
|
|
313
|
-
// parses the payload for both.
|
|
314
|
-
|
|
315
|
-
/** The hook's payload, read to EOF. fd 0 rather than a stream, because every caller here is
|
|
316
|
-
* synchronous and a hook's stdin is a pipe that the harness closes.
|
|
317
|
-
*
|
|
318
|
-
* ⚠ A TTY DOES NOT COME BACK EMPTY — IT BLOCKS FOREVER (measured). `readFileSync(0)` on a terminal
|
|
319
|
-
* waits for an EOF the operator has no reason to know he must send, so `dt install --hook` typed
|
|
320
|
-
* by hand hung silently with no prompt and no output: the worst failure shape a CLI has, because
|
|
321
|
-
* there is nothing to read and nothing to search for. So the terminal case is refused BEFORE the
|
|
322
|
-
* read. `isTTY` is a parameter so the refusal can be tested without a pty. A closed or unreadable
|
|
323
|
-
* descriptor still comes back empty, and `readHookInput` names that one. */
|
|
324
|
-
export function readStdin(isTTY = process.stdin.isTTY) {
|
|
325
|
-
if (isTTY) throw new Error('--hook reads the harness\'s JSON on stdin — nothing is piped');
|
|
326
|
-
try { return fs.readFileSync(0, 'utf8'); } catch { return ''; }
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
/** What the harness said, as `{ cwd, name, raw }`. Exported through the public API because an
|
|
330
|
-
* extension's own hook form (`worktree add --hook`) parses the same payload.
|
|
331
|
-
*
|
|
332
|
-
* ⚠ THE FIELD NAMES ARE THE HARNESS'S. Claude Code's hooks reference documents every event as
|
|
333
|
-
* carrying `cwd`, and the two worktree events as additionally carrying `worktree_name` and
|
|
334
|
-
* `worktree_path` — so `worktree_name` is the primary spelling here and a bare `name` is only the
|
|
335
|
-
* fallback, not the other way round. `raw` is kept whole because a later verb reads a field these
|
|
336
|
-
* three do not name (`land` wants `worktree_path`), and because the KEYS are the whole diagnostic
|
|
337
|
-
* when a hook has been wired to the wrong event: a well-formed payload of the wrong shape is
|
|
338
|
-
* indistinguishable from a broken one until you can see what it did carry. */
|
|
339
|
-
export function readHookInput(stdinText) {
|
|
340
|
-
let raw;
|
|
341
|
-
try { raw = JSON.parse(stdinText); } catch { throw new Error('hook input is not JSON'); }
|
|
342
|
-
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error('hook input is not JSON');
|
|
343
|
-
const cwd = raw.cwd ?? raw.worktree_path ?? null;
|
|
344
|
-
const name = raw.worktree_name ?? raw.name ?? null;
|
|
345
|
-
if (!cwd && !name) {
|
|
346
|
-
throw new Error(`hook input carries neither a cwd nor a worktree_name — keys received: ${Object.keys(raw).join(', ') || '(none)'}`);
|
|
347
|
-
}
|
|
348
|
-
return { cwd, name, raw };
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// The hook events and the verb each one runs. Core owns ONE — making the checkout a session opens in
|
|
352
|
-
// ready — and an installed extension adds its own (`hooks:` in its contribution; the worktree
|
|
353
|
-
// lifecycle belongs to a worktree extension). NO MATCHER on any of them (spec §13.9): bootstrap is
|
|
354
|
-
// idempotent precisely so the session-start hook may fire on every event — `startup` alone would
|
|
355
|
-
// silence it on resume, clear, compact and fork, which is most of what a long session actually does.
|
|
356
|
-
const CLAUDE_HOOKS = { SessionStart: 'install --hook' };
|
|
357
|
-
|
|
358
|
-
/** Print the harness snippets for this workspace's declared harnesses.
|
|
359
|
-
*
|
|
360
|
-
* ⚠ NO ABSOLUTE MACHINE PATH IS EVER RENDERED, and the command is `sh <script>` rather than a bare
|
|
361
|
-
* `npm`/`npx`/`node` — the two constraints that between them decide every character of the line.
|
|
362
|
-
* `$CLAUDE_PROJECT_DIR` is documented to stay at the MAIN checkout even inside a worktree, which is
|
|
363
|
-
* exactly the engine wanted: the primary's pinned one, never whatever a fresh worktree lacks. The
|
|
364
|
-
* worktree's own cwd arrives in the hook's stdin instead.
|
|
365
|
-
*
|
|
366
|
-
* ⚠ AND THE ENGINE NEVER WRITES A HARNESS SETTINGS FILE. `.claude/settings.json` is the operator's,
|
|
367
|
-
* reviewed like any config change; a fifth harness channel writing into a user-owned file is a
|
|
368
|
-
* decision this engine has not made (spec §13.7). So this verb PRINTS — snippets on stdout, so the
|
|
369
|
-
* output can be piped, and everything else on stderr so it stays parseable. */
|
|
370
|
-
export function printAdapters(ws, { harnesses = ws.pkg.dreamteamer?.harnesses ?? ['claude-code'], extensions = ws.extensions ?? [] } = {}) {
|
|
371
|
-
// ⚠ AN EMPTY RENDER IS A REFUSAL, NOT A SUCCESS. The whole point of this verb is that its stdout
|
|
372
|
-
// is redirected into a settings file — so printing nothing at exit 0 writes an EMPTY hooks.json
|
|
373
|
-
// over whatever was there, silently, on the one workspace that never declared the harness.
|
|
374
|
-
if (!harnesses.includes('claude-code')) {
|
|
375
|
-
console.error('no claude-code harness declared — nothing to render');
|
|
376
|
-
return 1;
|
|
377
|
-
}
|
|
378
|
-
for (const h of harnesses) {
|
|
379
|
-
// `claude-code` is the ONLY spelling: it is what KNOWN_HARNESSES holds and what every real
|
|
380
|
-
// package.json carries. The design doc's shorter `claude` names no harness this engine
|
|
381
|
-
// compiles for, so accepting it would only ever mask a misspelling.
|
|
382
|
-
if (h !== 'claude-code') {
|
|
383
|
-
console.error(`${h}: adapter not yet shipped (decision 315)`);
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
const hooks = {};
|
|
387
|
-
const events = { ...CLAUDE_HOOKS };
|
|
388
|
-
for (const e of extensions) {
|
|
389
|
-
for (const [event, verb] of Object.entries(e.hooks ?? {})) {
|
|
390
|
-
if (events[event]) throw new Error(`extension ${e.name} and ${Object.keys(CLAUDE_HOOKS).includes(event) ? 'the engine' : 'another extension'} both hook ${event} — uninstall or disable one`);
|
|
391
|
-
events[event] = verb;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
for (const [event, verb] of Object.entries(events)) {
|
|
395
|
-
hooks[event] = [{ hooks: [{ type: 'command', command: `sh "$CLAUDE_PROJECT_DIR/node_modules/dreamteamer/bin/dt-hook.sh" ${verb}`, timeout: 600 }] }];
|
|
396
|
-
}
|
|
397
|
-
console.error('# merge into .claude/settings.json — writing it is the operator\'s act, never the engine\'s');
|
|
398
|
-
console.log(JSON.stringify({ hooks }, null, 2));
|
|
399
|
-
}
|
|
400
|
-
return 0;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/** `dt install` on THIS checkout.
|
|
404
|
-
*
|
|
405
|
-
* ⚠ `--json` IS NOT A DRY RUN: it applies the plan and then reports it as data. Which means the
|
|
406
|
-
* run that most needs to be parseable — the FIRST install in a fresh worktree — is also the one
|
|
407
|
-
* with the most to say: `compile` logs its summary through console.log, and the shelled-out steps
|
|
408
|
-
* write to whatever handles they inherit. So under `--json` stdout carries the payload and
|
|
409
|
-
* NOTHING else: the board goes to stderr (a human watching a piped run still wants it),
|
|
410
|
-
* console.log is pointed at stderr for the duration, and each subprocess is handed stderr for its
|
|
411
|
-
* own stdout. A `--json` that only parses on an already-settled checkout is not an interface. */
|
|
412
|
-
export async function installCommand(ws, rest, { open } = {}) {
|
|
413
|
-
// ⚠ THE OPENER IS REQUIRED, and it must ACTIVATE extensions: the compile step reopens with it (see
|
|
414
|
-
// applyInstall), so a raw `findWorkspace` default compiled an extension's kind as an unknown folder.
|
|
415
|
-
// The public export (api.js) supplies `openWorkspace`; this layer cannot import it.
|
|
416
|
-
if (typeof open !== 'function') throw new Error('installCommand: opts.open (an extension-activating opener, e.g. openWorkspace) is required');
|
|
417
|
-
const flags = new Set(rest.filter((a) => a.startsWith('--')));
|
|
418
|
-
if (flags.has('--print-adapters')) return printAdapters(ws, {});
|
|
419
|
-
const hook = flags.has('--hook');
|
|
420
|
-
// ⚠ NEVER `process.chdir`. The hook runs in the PRIMARY (that is what $CLAUDE_PROJECT_DIR
|
|
421
|
-
// resolves to, worktree or not), and the checkout it is about is the one named on stdin — so the
|
|
422
|
-
// workspace is rebuilt from that path and everything downstream is unchanged. Installing
|
|
423
|
-
// `process.cwd()` instead would print a green board about the wrong checkout on every spawn.
|
|
424
|
-
if (hook) {
|
|
425
|
-
const input = readHookInput(readStdin());
|
|
426
|
-
if (!input.cwd) throw new Error(`hook input carries no cwd — keys received: ${Object.keys(input.raw).join(', ')}`);
|
|
427
|
-
// the checkout the payload names, opened the way the caller opens one (the CLI passes
|
|
428
|
-
// `openWorkspace`, so ITS extensions load — their hooks and kinds are part of that checkout)
|
|
429
|
-
ws = await open(input.cwd);
|
|
430
|
-
}
|
|
431
|
-
const json = flags.has('--json');
|
|
432
|
-
const state = observeState(ws);
|
|
433
|
-
const steps = planInstall(state, { linkEnv: flags.has('--link-env') });
|
|
434
|
-
const board = [];
|
|
435
|
-
const log = (l) => { board.push(l); (json ? console.error : console.log)(l); };
|
|
436
|
-
log(state.checkout.kind === 'linked'
|
|
437
|
-
? `linked worktree of ${state.checkout.primary}${state.checkout.insideRoot ? '' : ' (outside its root)'}`
|
|
438
|
-
: 'primary checkout');
|
|
439
|
-
const stdout = console.log;
|
|
440
|
-
if (json) console.log = console.error; // compile() and the git-modules restore report through it
|
|
441
|
-
let code;
|
|
442
|
-
try {
|
|
443
|
-
code = await applyInstall(ws, state, steps, { dryRun: flags.has('--dry-run'), log, stdio: json ? ['ignore', 2, 2] : 'inherit', open });
|
|
444
|
-
} finally {
|
|
445
|
-
console.log = stdout;
|
|
446
|
-
}
|
|
447
|
-
if (json) { console.log(JSON.stringify({ checkout: state.checkout, steps, log: board, code }, null, 2)); return code; }
|
|
448
|
-
// ⚠ THE BOARD IS THE SESSION'S CONTEXT when a session-start hook runs it, so its LAST line says
|
|
449
|
-
// the one thing a session in a linked worktree cannot work out for itself: its records are
|
|
450
|
-
// invisible from the primary until they are committed here.
|
|
451
|
-
if (state.checkout.kind === 'linked') {
|
|
452
|
-
log(`\nthis is linked worktree ${path.basename(ws.root)} of ${state.checkout.primary}; before you finish, dt commit your records here — they are invisible from the primary until you do.`);
|
|
453
|
-
}
|
|
454
|
-
return code;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
// ---- `dt init` — one command from a folder to a compiled, checked, committed workspace ------------
|
|
458
|
-
|
|
459
|
-
const EXACT = /^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;
|
|
460
|
-
const readJson = (f) => { try { return JSON.parse(fs.readFileSync(f, 'utf8')); } catch { return null; } };
|
|
461
|
-
|
|
462
|
-
/** Where a write to `p` actually lands: every component resolved in order, a link's target spliced in
|
|
463
|
-
* and resolved in turn — so a link whose leaf does not exist yet is still followed through each link
|
|
464
|
-
* among its ancestors, and `..` means the parent of what was REACHED, never the lexical parent. A
|
|
465
|
-
* missing component ends resolution (nothing below it can be a link). Null past 40 links: a loop. */
|
|
466
|
-
function landing(p) {
|
|
467
|
-
// the root (`/`, or `C:\` on Windows — never a segment to join, which made every path land at `C:\C:\…`)
|
|
468
|
-
// is the starting point; the segments after it are walked, either separator accepted
|
|
469
|
-
// the separator is the platform's ONLY: a backslash is a legal character in a POSIX name, and a link named
|
|
470
|
-
// `a\\b` that points out of the folder must be followed as one segment, never read as `a/b`; Windows takes both
|
|
471
|
-
const segments = (q) => q.slice(path.parse(q).root.length).split(process.platform === 'win32' ? /[\\/]/ : path.sep);
|
|
472
|
-
const pending = segments(p);
|
|
473
|
-
let at = path.parse(p).root, hops = 0;
|
|
474
|
-
while (pending.length) {
|
|
475
|
-
const seg = pending.shift();
|
|
476
|
-
if (!seg || seg === '.') continue;
|
|
477
|
-
if (seg === '..') { at = path.dirname(at); continue; }
|
|
478
|
-
const next = path.join(at, seg);
|
|
479
|
-
let st = null;
|
|
480
|
-
try { st = fs.lstatSync(next); } catch { /* absent: created where it is named */ }
|
|
481
|
-
if (!st?.isSymbolicLink()) { at = next; continue; }
|
|
482
|
-
if (++hops > 40) return null;
|
|
483
|
-
const to = fs.readlinkSync(next);
|
|
484
|
-
pending.unshift(...segments(to));
|
|
485
|
-
if (path.isAbsolute(to)) at = path.parse(to).root;
|
|
486
|
-
}
|
|
487
|
-
return at;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/** Would a write to `rel` (root-relative, unnormalised — `a/../b` resolves through `a`) land outside `root`? */
|
|
491
|
-
export function escapes(root, rel) {
|
|
492
|
-
// the native realpath: on Windows the JS one leaves an 8.3 short name (RUNNER~1) that the walk below
|
|
493
|
-
// expands, and the two spellings of one folder would read as different places; case is folded there too
|
|
494
|
-
const canon = (q) => { try { return fs.realpathSync.native(q); } catch { return fs.realpathSync(q); } };
|
|
495
|
-
const fold = (q) => (process.platform === 'win32' ? q.toLowerCase() : q);
|
|
496
|
-
const base = canon(root), to = landing(`${base}${path.sep}${rel}`);
|
|
497
|
-
if (to === null) return true;
|
|
498
|
-
const r = path.relative(fold(base), fold(to));
|
|
499
|
-
return r.startsWith('..') || path.isAbsolute(r);
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
/** The links under `rel` (lstat, never descending through one) — compile writes and prunes whole
|
|
503
|
-
* trees there, so a link anywhere below is a place it writes through. */
|
|
504
|
-
function linksUnder(root, rel, out = []) {
|
|
505
|
-
let entries = [];
|
|
506
|
-
try { entries = fs.readdirSync(path.join(root, rel), { withFileTypes: true }); } catch { return out; }
|
|
507
|
-
for (const e of entries) {
|
|
508
|
-
const r = path.join(rel, e.name);
|
|
509
|
-
if (e.isSymbolicLink()) out.push(r);
|
|
510
|
-
else if (e.isDirectory()) linksUnder(root, r, out);
|
|
511
|
-
}
|
|
512
|
-
return out;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// compile's built-in outputs: the runtime and the harness trees it writes AND prunes (harnesses.js)
|
|
516
|
-
const OUTPUT_TREES = [RUNTIME_DIR, '.claude/skills', '.claude/agents', '.claude/commands', '.agents/skills', '.cursor/rules'];
|
|
517
|
-
|
|
518
|
-
/** Every DIRECTORY link at or under an output tree — the tree's own root included — wherever it points.
|
|
519
|
-
* ⚠ FAIL CLOSED, not "follow and judge": a link to a folder INSIDE the workspace is harmless as a path
|
|
520
|
-
* and still hides what is below it (`linksUnder` never descends through a link), so a file link in the
|
|
521
|
-
* aliased folder carried compile's write outside (third review). Compile makes none of these itself. */
|
|
522
|
-
function aliasedOutputDirs(root) {
|
|
523
|
-
const isDirLink = (rel) => { try { return fs.lstatSync(path.join(root, rel)).isSymbolicLink() && fs.statSync(path.join(root, rel)).isDirectory(); } catch { return false; } };
|
|
524
|
-
return OUTPUT_TREES.flatMap((t) => [t, ...linksUnder(root, t)]).filter(isDirLink);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/** Every path `init --ready` may write, as init and compile will compute them — the effective block,
|
|
528
|
-
* the built-in output trees with every link inside them, the managed-block files the last compile
|
|
529
|
-
* recorded, and any top-level file-position link (a contributed harness writes its block at the root).
|
|
530
|
-
* `.env` is exempt: never written here, and a worktree's is a link to its primary by design. A folder
|
|
531
|
-
* link in an output tree never reaches here — `aliasedOutputDirs` refuses it first. NOT covered: a
|
|
532
|
-
* nested file a newly installed extension's harness writes that no earlier compile recorded. */
|
|
533
|
-
function writeFootprint(root, block, flags) {
|
|
534
|
-
let prev = {};
|
|
535
|
-
try { prev = readManifest(root) ?? {}; } catch { /* unreadable: the walk below still judges .dreamteamer/ */ }
|
|
536
|
-
const top = fs.readdirSync(root, { withFileTypes: true }).filter((e) => e.isSymbolicLink() && e.name !== '.env')
|
|
537
|
-
.filter((e) => { try { return !fs.statSync(path.join(root, e.name)).isDirectory(); } catch { return true; } }).map((e) => e.name);
|
|
538
|
-
return [...new Set([...initFootprint(block, flags), 'package-lock.json', 'node_modules',
|
|
539
|
-
'CLAUDE.md', 'AGENTS.md', 'GEMINI.md', ...(prev['adapter-blocks'] ?? []), ...(prev['adapter-outputs'] ?? []),
|
|
540
|
-
...OUTPUT_TREES, ...OUTPUT_TREES.flatMap((t) => linksUnder(root, t)), ...top].map(String))];
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
/**
|
|
544
|
-
* `dt init [--no-git] [--git <url>] [--no-compile] [--from <dir>] [--input k=v]… [--allow <kind>]… [--no-input]`
|
|
545
|
-
* — from a folder (empty, or a cloned preset, or an existing repo) to a workspace that is pinned to the
|
|
546
|
-
* RUNNING engine, compiled, checked, set up as far as its modules' safe actions go, and committed.
|
|
547
|
-
*
|
|
548
|
-
* - every path it or compile writes is judged BEFORE the first write (links out of the folder, aliased
|
|
549
|
-
* output trees, a configured path climbing out), as `init --ready` did
|
|
550
|
-
* - an engine of another version — declared, locked or installed — is the workspace's choice: refused,
|
|
551
|
-
* never upgraded (`dt update --engine` is the deliberate move)
|
|
552
|
-
* - npm runs once: `--save-exact dreamteamer@<this version>` from nothing, or a plain `install` that
|
|
553
|
-
* restores a preset's lockfile and every module it selected; with `--from <dir>` a missing declared
|
|
554
|
-
* package comes from that folder of tarballs (`npm install --no-save`), so package.json is untouched
|
|
555
|
-
* - git: no repository → `git init` and one commit of what init wrote; inside one → the same scoped
|
|
556
|
-
* commit, the operator's staged work untouched; `--no-git` or no git on PATH → written, not committed,
|
|
557
|
-
* and the last line says so; `--git <url>` adds `origin` and never pushes
|
|
558
|
-
* - re-running changes nothing: every step re-checks what is already done
|
|
559
|
-
*/
|
|
560
|
-
export async function initCommand(flags, { root = process.cwd(), open, verify, npm = resolveNpm(), stdio = 'inherit', log = console.log, processEnv = process.env, tty = !!(process.stdin.isTTY && process.stdout.isTTY), argv = [] } = {}) {
|
|
561
|
-
const want = engineVersion();
|
|
562
|
-
const pkgPath = path.join(root, 'package.json');
|
|
563
|
-
const pkg = fs.existsSync(pkgPath) ? readJson(pkgPath) : {};
|
|
564
|
-
if (!pkg || typeof pkg !== 'object') throw new Error('package.json is not a JSON object — nothing was written');
|
|
565
|
-
// ⚠ EVERY PATH THIS RUN WRITES IS JUDGED BEFORE THE FIRST WRITE. init and compile write through
|
|
566
|
-
// whatever stands at a path, so a `.gitignore` (or `.claude/skills`, or `modules/`) linked out of the
|
|
567
|
-
// folder would have been rewritten wherever it points, and the run would have said ✔. The block is
|
|
568
|
-
// init's OWN merge (`seedBlock`): a safe flag can never hide an unsafe stored value.
|
|
569
|
-
const block = seedBlock(flags, pkg.dreamteamer);
|
|
570
|
-
for (const k of ['workspace_module', 'data_path']) {
|
|
571
|
-
if (block[k] != null && block[k] !== false && typeof block[k] !== 'string') throw new Error(`dreamteamer.${k} must be a path (got ${JSON.stringify(block[k])}) — nothing was written`);
|
|
572
|
-
}
|
|
573
|
-
const aliased = aliasedOutputDirs(root);
|
|
574
|
-
if (aliased.length) throw new Error(`${aliased.join(', ')}: a folder link inside compile's output — compile writes through it, so nothing was written. Replace it with a real folder (or remove it; compile regenerates what it holds)`);
|
|
575
|
-
const out = writeFootprint(root, block, flags).filter((rel) => escapes(root, rel));
|
|
576
|
-
if (out.length) throw new Error(`${out.join(', ')} ${out.length > 1 ? 'resolve' : 'resolves'} outside this workspace — init writes there, so nothing was written. Replace the link (or the configured path) with one inside the folder`);
|
|
577
|
-
|
|
578
|
-
// ⚠ THE DECLARATION, THE LOCKFILE AND THE INSTALLED COPY ARE JUDGED EACH ON ITS OWN. Reading only the
|
|
579
|
-
// installed copy let a package.json still declaring an older engine pass — the next clone installs that one.
|
|
580
|
-
const specs = [...new Set(['dependencies', 'devDependencies'].map((k) => pkg[k]?.dreamteamer).filter(Boolean))];
|
|
581
|
-
const locked = readJson(path.join(root, 'package-lock.json'))?.packages?.['node_modules/dreamteamer']?.version ?? null;
|
|
582
|
-
const installed = () => readJson(path.join(root, 'node_modules', 'dreamteamer', 'package.json'))?.version ?? null;
|
|
583
|
-
const upgrade = `init never changes an existing engine — run that version itself (npx dreamteamer@<version> init), or upgrade on purpose: dt update --engine`;
|
|
584
|
-
if (specs.length > 1) throw new Error(`package.json declares dreamteamer twice, differently (${specs.join(' and ')}) — keep one declaration`);
|
|
585
|
-
if (specs[0] && (EXACT.test(specs[0]) ? specs[0] !== want : satisfies(want, specs[0]) === false)) throw new Error(`package.json declares dreamteamer "${specs[0]}", which ${want} is not — ${upgrade}`);
|
|
586
|
-
if (locked && locked !== want) throw new Error(`package-lock.json locks dreamteamer ${locked}, not ${want} — ${upgrade}`);
|
|
587
|
-
if (installed() && installed() !== want) throw new Error(`node_modules holds dreamteamer ${installed()}, not ${want} — ${upgrade}`);
|
|
588
|
-
const fromDir = flags.from ? path.resolve(root, flags.from) : null;
|
|
589
|
-
const fail = (why) => { log(`✖ ${why}\n the steps after this one did not run — fix it, then run the same command again: every step re-checks what is already done`); return 1; };
|
|
590
|
-
|
|
591
|
-
// --from: every package this init will need is looked for in the folder BEFORE anything is written —
|
|
592
|
-
// a folder lacking one is refused with the folder untouched (no skeleton, no registry call)
|
|
593
|
-
if (fromDir) {
|
|
594
|
-
const { indexFolder } = await import('./install-modules.js');
|
|
595
|
-
let index;
|
|
596
|
-
try { index = indexFolder(fromDir); } catch (e) { return fail(e.message); }
|
|
597
|
-
const pkg0 = readJson(pkgPath) ?? {};
|
|
598
|
-
const declared0 = !!(pkg0.dependencies?.dreamteamer ?? pkg0.devDependencies?.dreamteamer);
|
|
599
|
-
const missing0 = Object.keys({ ...pkg0.dependencies, ...pkg0.devDependencies }).sort().filter((d) => !fs.existsSync(path.join(root, 'node_modules', d, 'package.json')));
|
|
600
|
-
for (const n of declared0 ? missing0 : ['dreamteamer', ...missing0]) {
|
|
601
|
-
const hit = n === 'dreamteamer' ? (index.get('dreamteamer') ?? []).find((c) => c.version === want) : (index.get(n) ?? [])[0];
|
|
602
|
-
if (!hit) return fail(`--from ${fromDir}: no ${n === 'dreamteamer' ? `dreamteamer@${want}` : n} in it — nothing was written`);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
init({ flags, root, commit: false });
|
|
606
|
-
log('✔ skeleton: the package.json dreamteamer block, the workspace module, .gitignore, .env.example — kept where present');
|
|
607
|
-
// EVERY declared package, not just the engine: a preset whose npm install was interrupted holds the
|
|
608
|
-
// engine and lacks the modules it selected, and compile then succeeds without them (`planInstall`'s lesson).
|
|
609
|
-
const now = () => readJson(pkgPath) ?? {};
|
|
610
|
-
const missing = () => Object.keys({ ...now().dependencies, ...now().devDependencies }).sort().filter((d) => !fs.existsSync(path.join(root, 'node_modules', d, 'package.json')));
|
|
611
|
-
const declared = !!(now().dependencies?.dreamteamer ?? now().devDependencies?.dreamteamer);
|
|
612
|
-
let fresh = false;
|
|
613
|
-
if (declared && !missing().length) log(`✔ dependencies: dreamteamer@${want} and every declared package installed`);
|
|
614
|
-
else {
|
|
615
|
-
if (!npm) return fail('cannot install — node found, npm not on PATH');
|
|
616
|
-
let args;
|
|
617
|
-
if (fromDir) {
|
|
618
|
-
// offline: every missing declared package (the engine too, from nothing) comes from the folder
|
|
619
|
-
const { indexFolder } = await import('./install-modules.js');
|
|
620
|
-
let index;
|
|
621
|
-
try { index = indexFolder(fromDir); } catch (e) { return fail(e.message); }
|
|
622
|
-
const need = declared ? missing() : ['dreamteamer', ...missing()];
|
|
623
|
-
const files = [];
|
|
624
|
-
for (const n of need) {
|
|
625
|
-
const hit = n === 'dreamteamer' ? (index.get('dreamteamer') ?? []).find((c) => c.version === want) : (index.get(n) ?? [])[0];
|
|
626
|
-
if (!hit) return fail(`--from ${fromDir}: no ${n === 'dreamteamer' ? `dreamteamer@${want}` : n} in it — nothing was installed`);
|
|
627
|
-
files.push(hit.file);
|
|
628
|
-
}
|
|
629
|
-
args = declared ? ['install', '--no-save', '--no-audit', '--no-fund', ...files] : ['install', '--save-exact', '--no-audit', '--no-fund', ...files];
|
|
630
|
-
} else args = declared ? ['install', '--no-audit', '--no-fund'] : ['install', '--save-exact', '--no-audit', '--no-fund', `dreamteamer@${want}`];
|
|
631
|
-
log(`▶ dependencies: npm ${args.join(' ')}${missing().length ? ` — missing ${missing().join(', ')}` : ''} — downloads packages and runs their npm lifecycle scripts`);
|
|
632
|
-
const r = spawnSync(npm, args, { cwd: root, stdio, env: childEnv(), timeout: 600_000 });
|
|
633
|
-
if (r.status !== 0) return fail(`npm exited ${r.status ?? r.error?.message}`);
|
|
634
|
-
if (missing().length) return fail(`npm finished, but ${missing().join(', ')} ${missing().length > 1 ? 'are' : 'is'} still not installed`);
|
|
635
|
-
if (installed() !== want) return fail(`npm finished, but node_modules/dreamteamer is ${installed() ?? 'missing'}, not ${want}`);
|
|
636
|
-
fresh = true;
|
|
637
|
-
}
|
|
638
|
-
let ws = null;
|
|
639
|
-
let code = 0;
|
|
640
|
-
if (flags['no-compile']) log('— compile: skipped (--no-compile) — run dt compile before a session reads this workspace');
|
|
641
|
-
else {
|
|
642
|
-
try {
|
|
643
|
-
ws = await open(root);
|
|
644
|
-
const s = staleness(root);
|
|
645
|
-
if (fresh || !s.compiled || s.stale.length) { log('▶ compile'); compile(ws); } else log('✔ compile: fresh');
|
|
646
|
-
} catch (e) { return fail(`compile: ${e.message.split('\n')[0]}`); }
|
|
647
|
-
if (await verify(ws)) return fail('check: the violations above');
|
|
648
|
-
// a preset's modules: the safe part of every unit's setup, exactly as `dt install` runs it
|
|
649
|
-
const { units, runUnit, fillInputs, parseInputFlags, parseAllow, skippedUnits, fold, SetupUsage, ttyIO, unitEnv, EXIT, droppedKeys } = await import('./setup.js');
|
|
650
|
-
const skipped = new Set(skippedUnits(ws));
|
|
651
|
-
const all = units(ws).filter((u) => !skipped.has(u.id));
|
|
652
|
-
if (all.length) {
|
|
653
|
-
const noInput = !!flags['no-input'];
|
|
654
|
-
const term = tty && !noInput ? ttyIO() : null;
|
|
655
|
-
try {
|
|
656
|
-
const filled = await fillInputs(all, { flags: parseInputFlags(argv), env: unitEnv(ws, processEnv), tty, noInput, prompt: term?.prompt ?? null, lenient: true });
|
|
657
|
-
for (const text of filled.ignored) log(`⚠ ${text} — ignored`);
|
|
658
|
-
const allow = parseAllow(argv);
|
|
659
|
-
const written = new Map(); // one run never lets two units disagree on a key (he3)
|
|
660
|
-
for (const u of all) {
|
|
661
|
-
const r = await runUnit(ws, u, { inputs: filled.inputs.get(u.id) ?? {}, allow, tty, ask: term?.ask ?? null, processEnv, drop: droppedKeys(filled.problems, u.id), written });
|
|
662
|
-
const problems = filled.problems.filter((m) => m.unit === u.id);
|
|
663
|
-
const miss = [...filled.missing.filter((m) => m.unit === u.id).map((m) => m.id), ...problems.filter((m) => m.required).map((m) => m.id)];
|
|
664
|
-
const f = fold(r.checks, {});
|
|
665
|
-
log(`${f.state === 'ready' ? '✔' : '—'} ${u.id}: ${f.state}${f.detail ? ` — ${f.detail}` : ''}`);
|
|
666
|
-
for (const a of r.applied) log(` ✔ ${a.id}${a.message ? ` — ${a.message}` : ''}`);
|
|
667
|
-
for (const x of r.failed) log(` ✖ ${x.id} — ${x.message}`);
|
|
668
|
-
if (r.failed.length && code === 0) code = 1; // D57: a failed apply is a failure; the workspace itself stands
|
|
669
|
-
for (const x of problems) log(` ✖ ${x.id} — ${x.reason}`);
|
|
670
|
-
for (const pnd of r.pending) log(` … ${pnd.id} (${pnd.why})${pnd.reason ? ` — ${pnd.reason}` : ''}`);
|
|
671
|
-
if (miss.length) { log(` needs input: ${miss.join(', ')} — dt setup ${u.id} --input ${miss[0]}=<value>`); code = 3; }
|
|
672
|
-
if (r.pending.some((p) => p.runBy === 'owner' || (p.effects ?? []).some((e) => e.kind === 'account'))) log(` the owner's step (opens a browser): dt setup ${u.id}${miss.map((n) => ` --input ${n}=<value>`).join('')} --authorize`);
|
|
673
|
-
}
|
|
674
|
-
} catch (e) {
|
|
675
|
-
if (e instanceof SetupUsage) { fail(e.message); return EXIT.usage; }
|
|
676
|
-
throw e;
|
|
677
|
-
} finally { term?.close(); }
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
// git — a repository, a remote, one scoped commit; never the operator's own staged work
|
|
681
|
-
const hasGit = spawnSync('git', ['--version'], { stdio: 'ignore' }).status === 0;
|
|
682
|
-
const isRepo = () => hasGit && spawnSync('git', ['rev-parse', '--git-dir'], { cwd: root, stdio: 'ignore' }).status === 0;
|
|
683
|
-
if (flags['no-git']) log('— git: skipped (--no-git) — `git status` shows what init wrote');
|
|
684
|
-
else if (!hasGit) log('— git: not on PATH — nothing was committed; `git status` shows what init wrote once it is');
|
|
685
|
-
else {
|
|
686
|
-
if (!isRepo()) { spawnSync('git', ['init', '--quiet'], { cwd: root, stdio: 'ignore' }); log('✔ git: repository created (local, no account)'); }
|
|
687
|
-
if (flags.git) {
|
|
688
|
-
const has = spawnSync('git', ['remote', 'get-url', 'origin'], { cwd: root, stdio: 'ignore' }).status === 0;
|
|
689
|
-
if (!has) { spawnSync('git', ['remote', 'add', 'origin', flags.git], { cwd: root, stdio: 'ignore' }); log(`✔ git: origin → ${flags.git} (never pushed)`); } else log('✔ git: origin already set — left as it is');
|
|
690
|
-
}
|
|
691
|
-
const wm = now().dreamteamer?.workspace_module;
|
|
692
|
-
const paths = ['package.json', 'package-lock.json', '.gitignore', '.env.example', '.vscode/extensions.json', ...(wm ? [`modules/${wm}/package.json`, `modules/${wm}/collections/notes.collection.yaml`] : ['collections/notes.collection.yaml'])].filter((rel) => fs.existsSync(path.join(root, rel)));
|
|
693
|
-
const r = spawnSync('git', ['add', '--', ...paths], { cwd: root, stdio: 'ignore' });
|
|
694
|
-
const c = r.status === 0 ? spawnSync('git', ['commit', '--quiet', '-m', `dreamteamer: init workspace ${now().name ?? path.basename(root)}`, '--', ...paths], { cwd: root, encoding: 'utf8' }) : r;
|
|
695
|
-
if (c.status === 0) log(`✔ git: committed ${paths.join(', ')}`);
|
|
696
|
-
else if (/nothing to commit|no changes added/.test(`${c.stdout ?? ''}${c.stderr ?? ''}`)) log('✔ git: nothing new to commit');
|
|
697
|
-
else log(`⚠ git: commit did not happen (${(c.stderr ?? '').trim().split('\n')[0] || `exit ${c.status}`}) — \`git status\` shows what init wrote`);
|
|
698
|
-
}
|
|
699
|
-
if (ws) {
|
|
700
|
-
const { statusLines, renderStatusLines } = await import('./setup.js');
|
|
701
|
-
try { for (const line of renderStatusLines(statusLines(ws, { processEnv }))) log(line); } catch { /* status is a courtesy here */ }
|
|
702
|
-
}
|
|
703
|
-
log(`\nready: dreamteamer@${want}${flags['no-compile'] ? ' (not compiled)' : ', compiled and checked'}. Next: dt install <package> adds a module; dt status says what works here.`);
|
|
704
|
-
return code;
|
|
705
|
-
}
|