dreamteamer 0.49.1 → 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/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 -1511
- 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 -450
- 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 -1964
- 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 -139
- package/src/views.js +0 -206
- package/src/workspace.js +0 -253
- package/src/yaml.js +0 -251
package/src/compile.js
DELETED
|
@@ -1,1511 +0,0 @@
|
|
|
1
|
-
// dreamteamer compile — materialize (modules × workspace sources) into .dreamteamer,
|
|
2
|
-
// the single runtime read surface: copies + provenance manifest, then harness adapters.
|
|
3
|
-
// explicit only; nothing rebuilds implicitly.
|
|
4
|
-
import { execFileSync } from 'node:child_process';
|
|
5
|
-
import { createHash } from 'node:crypto';
|
|
6
|
-
import fs from 'node:fs';
|
|
7
|
-
import path from 'node:path';
|
|
8
|
-
import { load, dump } from './yaml.js';
|
|
9
|
-
import { slug } from './template.js';
|
|
10
|
-
import { walk } from './records.js';
|
|
11
|
-
import { placedRecords } from './placement.js';
|
|
12
|
-
import { viewErrors, viewDisplay, bindingErrors, overlayView } from './views.js';
|
|
13
|
-
import {
|
|
14
|
-
normalizeNamespaces, namespaceProblems, unqualifiedProblems, defaultStoragePath, storageOverlaps,
|
|
15
|
-
baseNameOf, singular, namespaceOf } from './namespace.js';
|
|
16
|
-
// circular on paper in earlier versions — safe: both sides only
|
|
17
|
-
// call at run time, same pattern as store.js ↔ compile.js.
|
|
18
|
-
import { runHarnessAdapters, renderContributions, BEGIN, END, INSTRUCTIONS_BEGIN, INSTRUCTIONS_END } from './harnesses.js';
|
|
19
|
-
import { ensureEditorRecommendation, ensureEnvExample, ensureGitignored, layerEntries } from './workspace.js';
|
|
20
|
-
import { satisfies, EXACT } from './semver.js';
|
|
21
|
-
import { parseEnvValues } from './env-vars.js';
|
|
22
|
-
import { DERIVED_KINDS, readManifest, runtimeDir, engineId, engineVersion, loadDescriptors as loadCompiledDescriptors, STALE_RUNTIME } from './runtime.js';
|
|
23
|
-
import { excludedFromKind, disablesPackage, isPackageEntry, MANIFEST_KEYS, v1ManifestRefusal } from './extensions.js';
|
|
24
|
-
import { compileCollections, v1Refusal } from './compile-collections.js';
|
|
25
|
-
import { storageOf, fieldsOf, displayOf, targetsOf } from './descriptor.js';
|
|
26
|
-
export { engineId, engineVersion, readManifest };
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Identifier → display label: `finance-accounts` → "Finance Accounts".
|
|
30
|
-
*
|
|
31
|
-
* The ONE derivation of a label from an id. compile resolves it INTO the descriptor so that no
|
|
32
|
-
* surface re-implements it — the same lesson as `storage.base`, which lived as a re-derived path
|
|
33
|
-
* test in five places before it became a field. An authored `title` always wins over this.
|
|
34
|
-
*
|
|
35
|
-
* `/` is a separator because a collection id may contain one (`titles.ts` splits routes on that
|
|
36
|
-
* assumption). Field names cannot, which is why the extension's browser-side copy of this rule
|
|
37
|
-
* (`webview/src/lib/format-title.ts`, which cannot import node code) stays byte-compatible for the
|
|
38
|
-
* only comparison that matters — the round-trip guard in schema-ops.js.
|
|
39
|
-
*/
|
|
40
|
-
export function titleCase(id) {
|
|
41
|
-
return String(id)
|
|
42
|
-
.split(/[_\-\s/]+/)
|
|
43
|
-
.filter(Boolean)
|
|
44
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
45
|
-
.join(' ');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/** The source kinds the compiler itself stages. An installed extension may add more
|
|
58
|
-
* (`sourceKinds`, src/extensions.js) — every enumeration below reads `kindsOf(ws)`, never this alone. */
|
|
59
|
-
export { MANIFEST_KEYS } from './extensions.js';
|
|
60
|
-
|
|
61
|
-
export const KINDS = ['collections', 'skills', 'agents', 'commands', 'command-bindings', 'ui-views', 'mixins'];
|
|
62
|
-
const FOLDER_KINDS = new Set(['skills']); // folder-shape entities: copy the whole record folder
|
|
63
|
-
|
|
64
|
-
/** Every contributed kind of the workspace's loaded extensions, as `{ kind, exclude, extension }`. */
|
|
65
|
-
export const contributedKinds = (ws) => (ws.extensions ?? []).flatMap((e) => e.sourceKinds ?? []);
|
|
66
|
-
/** Built-in kinds, then contributed ones. */
|
|
67
|
-
export const kindsOf = (ws) => [...KINDS, ...contributedKinds(ws).map((k) => k.kind)];
|
|
68
|
-
// DERIVED_KINDS (projected, not staged) lives in runtime.js — the boundary both halves read. Not in
|
|
69
|
-
// KINDS on purpose: a module folder named `modules/` would be nonsense, and `isSystem` below keys
|
|
70
|
-
// off KINDS to decide `storage.base`, so a `modules` collection landing on `base: workspace` would
|
|
71
|
-
// point the store at the SOURCE directory and read every module folder as a record.
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* A module's source folder for one kind. The layout is FLAT — `<module>/skills`, beside `data/` —
|
|
75
|
-
* because KINDS is already the allowlist and the extra `system/` level named nothing the engine
|
|
76
|
-
* reads. `<module>/system/<kind>` is still accepted so a module can be moved independently of the
|
|
77
|
-
* engine that reads it (they are separate repos on separate pins).
|
|
78
|
-
*
|
|
79
|
-
* Returns the FLAT path when neither exists, so a caller that creates the folder creates it in the
|
|
80
|
-
* layout we want. `bothLayouts` reports the split case, which compile warns about — a module with
|
|
81
|
-
* half its sources in each place compiles the flat half and silently drops the rest otherwise.
|
|
82
|
-
*/
|
|
83
|
-
export function kindDir(root, kind) {
|
|
84
|
-
const flat = path.join(root, kind);
|
|
85
|
-
if (fs.existsSync(flat)) return flat;
|
|
86
|
-
const nested = path.join(root, 'system', kind);
|
|
87
|
-
return fs.existsSync(nested) ? nested : flat;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function bothLayouts(root, kind) {
|
|
91
|
-
return fs.existsSync(path.join(root, kind)) && fs.existsSync(path.join(root, 'system', kind));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Folders a module may hold that are not sources. With kinds at the module root, "not a kind" can no
|
|
96
|
-
* longer mean "ignore it" — that is precisely how a kind the engine stopped knowing (`workflows`,
|
|
97
|
-
* removed 2026-07-31) sat in a module for two days while compile reported ✔ and a README described a
|
|
98
|
-
* pipeline nothing read (decision 156).
|
|
99
|
-
*
|
|
100
|
-
* So the root is ENUMERATED and an unrecognised folder is an ERROR. This list covers what a package
|
|
101
|
-
* generically contains; anything else the module declares in its own package.json
|
|
102
|
-
* (`dreamteamer.ignore`). That is real per-module variance — `services` has `dashboard/`, `agentlog`
|
|
103
|
-
* has `data/` — not a layout knob every module would set identically.
|
|
104
|
-
*/
|
|
105
|
-
/** `bin/*` files of a module root, module-relative and sorted — dotfiles and subfolders (lib/,
|
|
106
|
-
* parsers/) excluded. Empty when there is no bin/. */
|
|
107
|
-
function binEntries(moduleRoot) {
|
|
108
|
-
const dir = path.join(moduleRoot, 'bin');
|
|
109
|
-
if (!fs.existsSync(dir)) return [];
|
|
110
|
-
return fs.readdirSync(dir, { withFileTypes: true })
|
|
111
|
-
.filter((e) => e.isFile() && !e.name.startsWith('.'))
|
|
112
|
-
.map((e) => `bin/${e.name}`).sort();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const NON_SOURCE_DIRS = new Set([
|
|
116
|
-
'node_modules', 'data', 'state', 'media', 'bin', 'src', 'lib', 'scripts',
|
|
117
|
-
'ui', 'studio', // the module's UI bundle — 'studio' is the pre-archive name, kept as a fallback
|
|
118
|
-
'docs', 'dist', 'build', 'test', 'tests', 'coverage', 'system', // 'system': the pre-flatten layout
|
|
119
|
-
]);
|
|
120
|
-
|
|
121
|
-
/** Unrecognised source-root folders in a module, or [] for the workspace root (a vault legitimately
|
|
122
|
-
* holds arbitrary directories — this gate is about PACKAGES, whose folders all mean something).
|
|
123
|
-
*
|
|
124
|
-
* ⚠ `system/` is enumerated TOO, under the same rule. It is in NON_SOURCE_DIRS so the root pass
|
|
125
|
-
* waves it through, and that waved through everything BELOW it — so `system/gizmos/probe.gizmo.yaml`
|
|
126
|
-
* compiled ✔ in silence while the identical folder at the module root hard-errored. That is exactly
|
|
127
|
-
* the decision-156 shape the root gate exists to prevent, surviving one level down: `kindDir` still
|
|
128
|
-
* reads `system/<kind>` as the pre-flatten fallback, so a kind the engine stopped knowing is just as
|
|
129
|
-
* invisible there as it ever was at the root, and the half-migrated module is the likeliest place
|
|
130
|
-
* for one to be. Known kinds under `system/` keep compiling — the fallback is deliberate and stays
|
|
131
|
-
* (CLAUDE.md); only UNKNOWN folders become errors, and `dreamteamer.ignore` excuses them in both
|
|
132
|
-
* places with one entry. */
|
|
133
|
-
function strayKindDirs(source, wsRoot, declaredIgnore, kinds) {
|
|
134
|
-
if (path.resolve(source.root) === path.resolve(wsRoot)) return [];
|
|
135
|
-
const allow = new Set([...kinds, ...NON_SOURCE_DIRS, ...declaredIgnore]);
|
|
136
|
-
const dirsIn = (dir, prefix = '') => (fs.existsSync(dir) ? fs.readdirSync(dir, { withFileTypes: true }) : [])
|
|
137
|
-
.filter((e) => e.isDirectory() && !e.name.startsWith('.') && !allow.has(e.name))
|
|
138
|
-
.map((e) => `${prefix}${e.name}`);
|
|
139
|
-
return [
|
|
140
|
-
...dirsIn(source.root),
|
|
141
|
-
// The SAME allow set one level down — a generic package folder reads the same wherever the
|
|
142
|
-
// module put it, and one `ignore` entry covers both spellings rather than two.
|
|
143
|
-
...dirsIn(path.join(source.root, 'system'), 'system/'),
|
|
144
|
-
].sort();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const sha256 = (buf) => 'sha256:' + createHash('sha256').update(buf).digest('hex');
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// channel -> the directory the operator knows it by (used in shadow warnings, and it IS the
|
|
151
|
-
// `location` field's vocabulary — see collections/modules.collection.yaml. Keeping the export name
|
|
152
|
-
// on purpose: renaming a symbol under src/ is a cross-repo change, and this one buys nothing.)
|
|
153
|
-
export const CHANNEL_LABEL = { inline: 'modules', git: 'git_modules', npm: 'node_modules' };
|
|
154
|
-
|
|
155
|
-
/** A module's record id: its package name with the npm scope stripped, so `@dreamteamer/crm` is `crm`. */
|
|
156
|
-
export const moduleIdOf = (n) => slug(String(n).replace(/^@[^/]+\//, ''));
|
|
157
|
-
|
|
158
|
-
/** A module's `location` — the folder its sources sit in. `root` is the classic layout, where the
|
|
159
|
-
* workspace's own sources are at its root rather than under `modules/<id>/`; discovery reports that
|
|
160
|
-
* as the `inline` channel with `root === '.'`, which is the one case the label table cannot see. */
|
|
161
|
-
export const locationOf = (source, wsRoot) =>
|
|
162
|
-
(path.resolve(source.root) === path.resolve(wsRoot) ? 'root' : (CHANNEL_LABEL[source.channel] ?? source.channel));
|
|
163
|
-
|
|
164
|
-
// module discovery, three channels in precedence order: inline modules/* >
|
|
165
|
-
// git_modules/* > npm deps (declared in package.json, NOT a node_modules scan).
|
|
166
|
-
// same NAME in two channels = the same module delivered twice — the more local
|
|
167
|
-
// copy wins (npm-link semantics); shadows are returned for warning/status, never
|
|
168
|
-
// compiled. different-name identity collisions stay hard errors downstream.
|
|
169
|
-
export function discoverModules(root, pkg) {
|
|
170
|
-
const byName = new Map(); // name -> {name, root, channel}
|
|
171
|
-
const shadows = []; // {name, winner, loser} — channels
|
|
172
|
-
// A BARE `dreamteamer.disable` entry names a whole module; `<module>/<entity>` names one entity and
|
|
173
|
-
// is applied per source at compile time. The bare form is what lets a workspace take a PACKAGE of
|
|
174
|
-
// modules and keep only the ones it wants — a disabled module is simply never discovered, so every
|
|
175
|
-
// caller (compile, status, install) sees the same set.
|
|
176
|
-
const disable = pkg?.dreamteamer?.disable ?? [];
|
|
177
|
-
const disabledHits = new Set();
|
|
178
|
-
// A clone that is a WORKSPACE (its own manifest names `workspace_module`), or whose entry lists
|
|
179
|
-
// `records`, is a RECORD LAYER — another workspace's data read here — never a bundle: its own
|
|
180
|
-
// modules/ would otherwise unpack and collide with ours. With `module: true` its ONE workspace
|
|
181
|
-
// module is a source too (below).
|
|
182
|
-
const layerList = layerEntries(pkg, root);
|
|
183
|
-
const layers = new Set(layerList.map((l) => l.name));
|
|
184
|
-
// the same rule the extension loader applies (full package name, or its scope-stripped id), so a
|
|
185
|
-
// disabled package loses its content AND its code together
|
|
186
|
-
const disabled = (name) => {
|
|
187
|
-
const hit = disable.find((d) => isPackageEntry(d) && disablesPackage([d], name));
|
|
188
|
-
if (hit) disabledHits.add(hit);
|
|
189
|
-
return !!hit;
|
|
190
|
-
};
|
|
191
|
-
const tryAdd = (name, srcRoot, channel) => {
|
|
192
|
-
if (disabled(name)) return;
|
|
193
|
-
const existing = byName.get(name);
|
|
194
|
-
if (existing) { shadows.push({ name, winner: existing.channel, loser: channel }); return; }
|
|
195
|
-
byName.set(name, { name, root: srcRoot, channel });
|
|
196
|
-
};
|
|
197
|
-
const readPkg = (dir) => {
|
|
198
|
-
try {
|
|
199
|
-
const mpkg = JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8'));
|
|
200
|
-
return 'dreamteamer' in mpkg ? mpkg : null;
|
|
201
|
-
} catch { return null; } // no package.json, or unparseable — not a module
|
|
202
|
-
};
|
|
203
|
-
// A PACKAGE OF MODULES: a dependency or a git clone whose root carries `modules/` bundles several
|
|
204
|
-
// modules — its sub-modules are the modules, and the root itself is never compiled. One
|
|
205
|
-
// `npm install` (or one clone) then delivers a whole family, and `disable` cherry-picks from it.
|
|
206
|
-
// Inline `modules/*` never nest: a `modules/` folder at an inline module root stays the
|
|
207
|
-
// unknown-folder compile error it always was, because the workspace's own tree has no reason to
|
|
208
|
-
// bundle.
|
|
209
|
-
const scanDir = (dir, channel, unpack) => {
|
|
210
|
-
if (!fs.existsSync(dir)) return;
|
|
211
|
-
for (const name of fs.readdirSync(dir).sort()) {
|
|
212
|
-
const srcRoot = path.join(dir, name);
|
|
213
|
-
const mpkg = readPkg(srcRoot);
|
|
214
|
-
if (mpkg) (unpack ? tryAddOrUnpack : tryAdd)(mpkg.name ?? name, srcRoot, channel);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
const tryAddOrUnpack = (name, srcRoot, channel) => {
|
|
218
|
-
// ⚠ THE PACKAGE FIRST: disabling a bundle disables every module in it. Only the children used to
|
|
219
|
-
// be checked, so `disable: ['@x/bundle']` stopped its code and compiled all of its content.
|
|
220
|
-
if (disabled(name)) return;
|
|
221
|
-
// A MODULE PRESET is never a bundle: it lists modules and ships none, so a `modules/` folder in
|
|
222
|
-
// one is the package pass's refusal to make, not a family to unpack.
|
|
223
|
-
const bundle = path.join(srcRoot, 'modules');
|
|
224
|
-
if (!readPkg(srcRoot)?.dreamteamer?.preset && fs.existsSync(bundle) && fs.statSync(bundle).isDirectory()) { scanDir(bundle, channel, false); return; }
|
|
225
|
-
tryAdd(name, srcRoot, channel);
|
|
226
|
-
};
|
|
227
|
-
scanDir(path.join(root, 'modules'), 'inline', false);
|
|
228
|
-
const gitDir = path.join(root, 'git_modules');
|
|
229
|
-
if (fs.existsSync(gitDir)) {
|
|
230
|
-
for (const name of fs.readdirSync(gitDir).sort()) {
|
|
231
|
-
if (layers.has(name)) continue;
|
|
232
|
-
const srcRoot = path.join(gitDir, name);
|
|
233
|
-
const mpkg = readPkg(srcRoot);
|
|
234
|
-
if (mpkg) tryAddOrUnpack(mpkg.name ?? name, srcRoot, 'git');
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (const dep of Object.keys({ ...pkg.dependencies, ...pkg.devDependencies }).sort()) {
|
|
238
|
-
const srcRoot = path.join(root, 'node_modules', dep);
|
|
239
|
-
const mpkg = readPkg(srcRoot);
|
|
240
|
-
if (mpkg) tryAddOrUnpack(mpkg.name ?? dep, srcRoot, 'npm');
|
|
241
|
-
}
|
|
242
|
-
// A layer with `module: true` contributes the clone's WORKSPACE module — `modules/<workspace_module>`
|
|
243
|
-
// as its own manifest names it — as a git-channel source, the way a bundle contributes its modules.
|
|
244
|
-
// Kept out of `byName` on purpose: a name another channel holds must be REFUSED, never shadowed, and
|
|
245
|
-
// compile does that, naming the entry. A clone not on disk contributes nothing, like any layer.
|
|
246
|
-
const layerModules = [];
|
|
247
|
-
const layerRefusals = [];
|
|
248
|
-
for (const l of layerList) {
|
|
249
|
-
const clone = path.join(gitDir, l.name);
|
|
250
|
-
if (!l.module || !fs.existsSync(clone)) continue;
|
|
251
|
-
const wm = readPkg(clone)?.dreamteamer?.workspace_module;
|
|
252
|
-
const srcRoot = wm ? path.join(clone, 'modules', wm) : null;
|
|
253
|
-
const mpkg = srcRoot ? readPkg(srcRoot) : null;
|
|
254
|
-
if (!mpkg) {
|
|
255
|
-
layerRefusals.push(`git_modules.${l.name}.module: ${wm ? `the clone names workspace_module "${wm}", but modules/${wm}/ holds no module package.json` : 'the clone names no dreamteamer.workspace_module'} — there is no module to contribute. Drop \`module\`, or give the clone a workspace module.`);
|
|
256
|
-
} else if (!disabled(mpkg.name ?? wm)) {
|
|
257
|
-
layerModules.push({ name: mpkg.name ?? wm, root: srcRoot, channel: 'git', layer: l.name });
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return { modules: [...byName.values(), ...layerModules], shadows, disabledModules: [...disabledHits], layerRefusals };
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// ---- module-owned data ----------------------------------------------------------
|
|
264
|
-
// A module with `owns-data: true` keeps its records BESIDE ITSELF rather than in the
|
|
265
|
-
// workspace's data/. The descriptor still says `data/<collection>`; compile is what turns
|
|
266
|
-
// that into a path, so the module never names its host.
|
|
267
|
-
|
|
268
|
-
/** Why a module's clone could NOT hold records, or null when it can. Decided from the CHANNEL, never
|
|
269
|
-
* by asking git — compile shells out to git nowhere and must keep working in a freshly-`init`ed
|
|
270
|
-
* directory that is not a repo yet. Asked by the module flag and by a descriptor's `storage.owner`
|
|
271
|
-
* alike, so an npm module shipping an owned collection fails the same way. */
|
|
272
|
-
export function unownableBecause(source, rel) {
|
|
273
|
-
if (source.channel === 'npm') return `module "${source.name}" is installed under node_modules/ — that path is never committed, so its records could not be saved. Vendor it into modules/ or install it as a git module.`;
|
|
274
|
-
if (source.channel === 'git' && !fs.existsSync(path.join(source.root, '.git'))) return `${rel(source.root)} is not a git clone — git_modules/ is gitignored by the workspace, so its records could never be committed.`;
|
|
275
|
-
return null;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
/** modules whose collections default to `storage.owner: module` (`owns_data: true`), by module
|
|
279
|
-
* name → {root, channel}. Records that could never be committed are a compile ERROR, not a silent zero. */
|
|
280
|
-
function dataOwningModules(sources, fail, rel) {
|
|
281
|
-
const owners = new Map();
|
|
282
|
-
for (const s of sources) {
|
|
283
|
-
let mpkg;
|
|
284
|
-
try { mpkg = JSON.parse(fs.readFileSync(path.join(s.root, 'package.json'), 'utf8')); } catch { continue; }
|
|
285
|
-
const flag = mpkg.dreamteamer?.owns_data;
|
|
286
|
-
if (flag === undefined || flag === false) continue;
|
|
287
|
-
if (flag !== true) fail(`module "${s.name}": "owns_data" must be true or false (got ${JSON.stringify(flag)})`);
|
|
288
|
-
const why = unownableBecause(s, rel);
|
|
289
|
-
if (why) fail(`module "${s.name}" sets owns_data, but ${why}`);
|
|
290
|
-
owners.set(s.name, { root: s.root, channel: s.channel });
|
|
291
|
-
}
|
|
292
|
-
return owners;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
/** A relative path spelled with `/` on every OS — Windows' `path.relative` and `path.join` use `\`. */
|
|
296
|
-
const toPosix = (p) => p.split(path.sep).join('/');
|
|
297
|
-
|
|
298
|
-
// ---- record layers ----------------------------------------------------------------
|
|
299
|
-
// A `git_modules` clone that is itself a WORKSPACE (its manifest names `workspace_module`) — or an
|
|
300
|
-
// entry that lists `records:` — is a record layer: every collection both have reads that clone's data
|
|
301
|
-
// folder as a root below this workspace's own, `records:` narrowing the set when present. The clone
|
|
302
|
-
// contributes no sources — its shapes are the modules both workspaces install.
|
|
303
|
-
|
|
304
|
-
// `layerEntries` lives in workspace.js — compile, status and the extension loader all ask it, and the
|
|
305
|
-
// loader cannot import this file (compile imports the loader). Re-exported under its old address.
|
|
306
|
-
export { layerEntries };
|
|
307
|
-
|
|
308
|
-
/** A layer's data folder, from the clone's own manifest (its `data_path`), default `data`. The clone
|
|
309
|
-
* may be absent — a fresh checkout before `dreamteamer install` — and then the default stands. */
|
|
310
|
-
function layerDataPath(root, name) {
|
|
311
|
-
try { return JSON.parse(fs.readFileSync(path.join(root, 'git_modules', name, 'package.json'), 'utf8')).dreamteamer?.data_path ?? 'data'; }
|
|
312
|
-
catch { return 'data'; }
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/** The git repo that will hold a module's records: nearest `.git` at or above the module root,
|
|
316
|
-
* as a workspace-relative path (`.` = the workspace itself). `.git` may be a FILE — worktrees
|
|
317
|
-
* and submodules write a pointer file rather than a directory — so existsSync, not isDirectory. */
|
|
318
|
-
export function repoRootOf(moduleRoot, wsRoot) {
|
|
319
|
-
const stop = path.resolve(wsRoot);
|
|
320
|
-
let dir = path.resolve(moduleRoot);
|
|
321
|
-
while (dir.startsWith(stop)) {
|
|
322
|
-
if (fs.existsSync(path.join(dir, '.git'))) return toPosix(path.relative(stop, dir)) || '.';
|
|
323
|
-
if (dir === stop) break;
|
|
324
|
-
dir = path.dirname(dir);
|
|
325
|
-
}
|
|
326
|
-
return '.';
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
export function shadowWarning({ name, winner, loser }) {
|
|
330
|
-
return `⚠ module ${name}: ${CHANNEL_LABEL[winner]} copy shadows ${CHANNEL_LABEL[loser]} copy`;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/** The `name` in a folder's package.json, or null — an absent clone or an unreadable file is unknown. */
|
|
334
|
-
function pkgNameAt(dir) {
|
|
335
|
-
try { return JSON.parse(fs.readFileSync(path.join(dir, 'package.json'), 'utf8')).name ?? null; } catch { return null; }
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function compile(ws) {
|
|
339
|
-
const { root, pkg } = ws;
|
|
340
|
-
const extensions = ws.extensions ?? [];
|
|
341
|
-
const contributed = contributedKinds(ws);
|
|
342
|
-
const kinds = kindsOf(ws);
|
|
343
|
-
const RUNTIME = runtimeDir(root);
|
|
344
|
-
// read BEFORE anything below replaces the runtime: an extension's analysis compares against it,
|
|
345
|
-
// and the harness pass prunes what it listed
|
|
346
|
-
const prevManifest = readManifest(root);
|
|
347
|
-
const config = pkg.dreamteamer ?? {};
|
|
348
|
-
const harnesses = config.harnesses ?? ['claude-code'];
|
|
349
|
-
// workspace-relative and POSIX on every OS: these paths are stored (manifest sources, module
|
|
350
|
-
// records, storage paths) and compared with `/`-joined prefixes — see addEntry
|
|
351
|
-
const rel = (p) => toPosix(path.relative(root, p));
|
|
352
|
-
|
|
353
|
-
/** ⚠ YAML, WITH THE FILE IN THE MESSAGE. js-yaml reports `line:column` and a snippet and never a
|
|
354
|
-
* path, so one stray tab in a workspace of a hundred sources was an mtime bisect. Every parse of
|
|
355
|
-
* a MODULE SOURCE goes through here; the projected records compile dumps itself do not need it. */
|
|
356
|
-
const loadSource = (text, srcPath) => {
|
|
357
|
-
try {
|
|
358
|
-
return load(text);
|
|
359
|
-
} catch (e) {
|
|
360
|
-
return fail(`${srcPath}: ${e.message}`);
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
|
|
364
|
-
/** An EMPTY source is never intentional, and every reader indexes straight into what it parses.
|
|
365
|
-
* The collection case died with a bare "Cannot read properties of undefined" naming no file; a
|
|
366
|
-
* 0-byte ui-view was worse — compile said ✔ and `check` caught it one gate later, naming the
|
|
367
|
-
* COMPILED artifact under `.dreamteamer/`, which nobody can edit and the next compile overwrites.
|
|
368
|
-
* Refuse here, the last layer that still knows which module file the bytes came from.
|
|
369
|
-
* ⚠ ENTITY FILES ONLY. A skill is a FOLDER: its `SKILL.md` is the entity and is covered, while a
|
|
370
|
-
* placeholder under `references/` is the author's business, not the compiler's. */
|
|
371
|
-
const refuseEmptySource = (srcPath) => {
|
|
372
|
-
if (fs.readFileSync(srcPath, 'utf8').trim() === '') {
|
|
373
|
-
fail(`${rel(srcPath)}: source is empty — there is nothing to compile. Delete the file, or write one.`);
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
// ---- discover sources: channel modules then the workspace's own -----------------
|
|
378
|
-
const { modules: discovered, shadows, disabledModules, layerRefusals } = discoverModules(root, pkg);
|
|
379
|
-
for (const r of layerRefusals) fail(r);
|
|
380
|
-
for (const s of shadows) console.warn(shadowWarning(s));
|
|
381
|
-
const sources = [...discovered];
|
|
382
|
-
// workspace-owned sources: either at the root (classic layout) or in the designated
|
|
383
|
-
// workspace module under modules/ (config `workspace-module` — "the workspace is itself a
|
|
384
|
-
// module", made literal). when the key is set the root is NOT read, so the two layouts can
|
|
385
|
-
// never fork — and a stray source folder up there is a loud error rather than a silent drop.
|
|
386
|
-
if (!config.workspace_module) {
|
|
387
|
-
sources.push({ name: pkg.name, root, channel: 'inline' });
|
|
388
|
-
} else {
|
|
389
|
-
const strays = [];
|
|
390
|
-
if (fs.existsSync(path.join(root, 'system')) && [...walk(path.join(root, 'system'))].length) strays.push('system/');
|
|
391
|
-
for (const kind of kinds) {
|
|
392
|
-
const dir = path.join(root, kind);
|
|
393
|
-
if (fs.existsSync(dir) && [...walk(dir)].length) strays.push(`${kind}/`);
|
|
394
|
-
}
|
|
395
|
-
if (strays.length) {
|
|
396
|
-
fail(`the workspace root contains sources (${strays.join(', ')}) but workspace_module="${config.workspace_module}" is set — they would be silently ignored.\n move them into modules/${config.workspace_module}/ (decision 22).`);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// ---- engine floors: a module whose `dreamteamer.engine` excludes this engine is REFUSED whole —
|
|
401
|
-
// none of its content compiles, since it may use what this engine cannot read; the rest does
|
|
402
|
-
const engineVer = engineVersion();
|
|
403
|
-
const refused = new Map(); // module name -> the range it declares
|
|
404
|
-
for (const source of [...sources]) {
|
|
405
|
-
if (source.root === root) continue;
|
|
406
|
-
let range;
|
|
407
|
-
try { range = JSON.parse(fs.readFileSync(path.join(source.root, 'package.json'), 'utf8')).dreamteamer?.engine; } catch { continue; }
|
|
408
|
-
if (!range || satisfies(engineVer, range) !== false) continue;
|
|
409
|
-
refused.set(source.name, range);
|
|
410
|
-
sources.splice(sources.indexOf(source), 1);
|
|
411
|
-
console.warn(`✖ module ${source.name} needs engine "${range}" — this is ${engineVer}, so none of its content is compiled. Upgrade dreamteamer, or disable the module.`);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
// ---- module package pass: env declarations; a missing secret warns, never fails ---------
|
|
415
|
-
// A module's record id: the npm scope stripped, so `@dreamteamer/crm` reads as `crm` — which is
|
|
416
|
-
// what every message in this engine already calls it. Defined HERE, above the namespace pass,
|
|
417
|
-
// because a namespace error has to name the module by the id the fix is typed with.
|
|
418
|
-
const moduleId = moduleIdOf;
|
|
419
|
-
// A layer's workspace module (`module: true`) must answer to an id of its own: `default` is the ROLE
|
|
420
|
-
// every workspace's own module carries, and an id another module holds would merge two modules' records.
|
|
421
|
-
for (const s of sources.filter((x) => x.layer)) {
|
|
422
|
-
const at = `git_modules.${s.layer}.module`;
|
|
423
|
-
const id = moduleId(s.name);
|
|
424
|
-
if (id === 'default') fail(`${at}: the clone's workspace module is "default" — the role name every workspace's own module carries, so it cannot be told apart from this one's. Name the project's module after the project (its workspace_module, and the folder under modules/).`);
|
|
425
|
-
const other = sources.find((o) => o !== s && moduleId(o.name) === id);
|
|
426
|
-
if (other) fail(`${at}: the clone's workspace module "${id}" collides with module "${other.name}" at ${rel(other.root) || '.'} — a module id names one module. Rename one of them.`);
|
|
427
|
-
}
|
|
428
|
-
const channelOf = new Map(sources.map((s) => [s.name, s.channel]));
|
|
429
|
-
const declaredEnv = new Map(); // env key -> [module names]
|
|
430
|
-
const requestedVars = new Map(); // var a module READS through ${env:…} -> [module names]
|
|
431
|
-
const envMeta = new Map(); // env key or var -> { description, example } — the first module to say wins
|
|
432
|
-
const moduleIgnores = new Map(); // module name -> non-source folders it declares (strayKindDirs)
|
|
433
|
-
const moduleDeps = new Map(); // module name -> [module names] — HARD, must be acyclic
|
|
434
|
-
const modulePeers = new Map(); // module name -> [collection names] — SOFT, cannot cycle
|
|
435
|
-
const moduleNamespaces = new Map(); // module name -> [namespaces it DECLARES] (§8, option A)
|
|
436
|
-
const moduleVersions = new Map(); // module name -> its package.json version
|
|
437
|
-
const moduleFloors = new Map(); // module name -> npm `peerDependencies` — a version floor on a sibling module
|
|
438
|
-
const modulePresets = new Map(); // module preset name -> { member name: exact version } (CR-dt-008)
|
|
439
|
-
const moduleLocalAssets = []; // {rel, owner, base} — validated with the workspace's own, below
|
|
440
|
-
// the package.json `dreamteamer` block is a closed set of snake_case keys, the workspace's and
|
|
441
|
-
// every module's alike — a key outside it is a typo or a spelling this engine does not read
|
|
442
|
-
const refuseUnknownKeys = (block, where) => {
|
|
443
|
-
const bad = Object.keys(block ?? {}).filter((k) => !MANIFEST_KEYS.includes(k));
|
|
444
|
-
// a kebab-case spelling of a key this engine reads is the v1 manifest: the converter rewrites it
|
|
445
|
-
const v1 = v1ManifestRefusal(block, where);
|
|
446
|
-
if (v1) fail(v1);
|
|
447
|
-
if (bad.length) fail(`${where}: unknown dreamteamer key(s) ${bad.join(', ')} — the keys are ${MANIFEST_KEYS.join(' · ')}`);
|
|
448
|
-
};
|
|
449
|
-
refuseUnknownKeys(config, 'package.json');
|
|
450
|
-
if (config.preset !== undefined || config.nav !== undefined) fail('package.json: dreamteamer.preset and dreamteamer.nav belong to a module package, not the workspace');
|
|
451
|
-
for (const source of sources) {
|
|
452
|
-
let mpkg;
|
|
453
|
-
try { mpkg = JSON.parse(fs.readFileSync(path.join(source.root, 'package.json'), 'utf8')); } catch { continue; }
|
|
454
|
-
if (source.root !== root && mpkg.dreamteamer) refuseUnknownKeys(mpkg.dreamteamer, rel(path.join(source.root, 'package.json')));
|
|
455
|
-
const ignore = mpkg.dreamteamer?.ignore;
|
|
456
|
-
if (ignore !== undefined) {
|
|
457
|
-
if (!Array.isArray(ignore)) fail(`module "${source.name}": "ignore" must be a list of folder names (got ${JSON.stringify(ignore)})`);
|
|
458
|
-
moduleIgnores.set(source.name, ignore.map(String));
|
|
459
|
-
}
|
|
460
|
-
// npm's TERMINOLOGY, deliberately not npm's namespace: these live under `dreamteamer` so
|
|
461
|
-
// npm's own resolver never tries to fetch an inline or git-channel module.
|
|
462
|
-
for (const [key, sink] of [['dependencies', moduleDeps], ['peer_collections', modulePeers]]) {
|
|
463
|
-
const decl = mpkg.dreamteamer?.[key];
|
|
464
|
-
if (decl === undefined) continue;
|
|
465
|
-
if (!Array.isArray(decl) || decl.some((v) => typeof v !== 'string')) {
|
|
466
|
-
fail(`module "${source.name}": dreamteamer.${key} must be a list of ${key === 'dependencies' ? 'module names' : 'collection names'} (got ${JSON.stringify(decl)})`);
|
|
467
|
-
}
|
|
468
|
-
sink.set(source.name, decl);
|
|
469
|
-
}
|
|
470
|
-
// §8: A MODULE DECLARES THE NAMESPACES IT OWNS. Reversed from "the workspace only, never a
|
|
471
|
-
// module", whose real reason (a module could rename where another module's records live) is
|
|
472
|
-
// kept by the single-owner rule and the use-requires-dependency rule below — while the rule it
|
|
473
|
-
// replaces made decision 130's own acceptance test unpassable for any namespaced module.
|
|
474
|
-
const ns = mpkg.dreamteamer?.namespaces;
|
|
475
|
-
if (ns !== undefined) {
|
|
476
|
-
if (!Array.isArray(ns) || ns.some((v) => typeof v !== 'string')) {
|
|
477
|
-
fail(`module "${source.name}": dreamteamer.namespaces must be a list of namespace names (got ${JSON.stringify(ns)})`);
|
|
478
|
-
}
|
|
479
|
-
moduleNamespaces.set(source.name, ns);
|
|
480
|
-
}
|
|
481
|
-
// A MODULE PRESET (CR-dt-008): `preset` maps member module names to EXACT versions — the set
|
|
482
|
-
// `dt install` pins and `dt update` moves. It lists modules and ships no sources of its own.
|
|
483
|
-
// `nav` names the package's nav fragment, a path inside the package.
|
|
484
|
-
if (source.root !== root) {
|
|
485
|
-
const preset = mpkg.dreamteamer?.preset;
|
|
486
|
-
if (preset !== undefined) {
|
|
487
|
-
if (!preset || typeof preset !== 'object' || Array.isArray(preset)) fail(`module "${source.name}": dreamteamer.preset must map module names to exact versions (got ${JSON.stringify(preset)})`);
|
|
488
|
-
for (const [member, v] of Object.entries(preset)) {
|
|
489
|
-
if (typeof v !== 'string' || !EXACT.test(v)) fail(`module "${source.name}": dreamteamer.preset["${member}"] must be an exact version (got ${JSON.stringify(v)})`);
|
|
490
|
-
}
|
|
491
|
-
// every folder compile would read from a package: the kind folders (an extension's kinds
|
|
492
|
-
// too), a modules/ bundle, and a UI bundle (ui/, or its pre-archive name studio/)
|
|
493
|
-
const shipped = [...new Set([...KINDS, ...kinds]), 'modules', 'ui', 'studio'].find((k) => fs.existsSync(k === 'modules' || k === 'ui' || k === 'studio' ? path.join(source.root, k) : kindDir(source.root, k)));
|
|
494
|
-
if (shipped) fail(`module "${source.name}": a module preset lists modules; it ships none (found ${shipped}/)`);
|
|
495
|
-
modulePresets.set(source.name, preset);
|
|
496
|
-
}
|
|
497
|
-
const nav = mpkg.dreamteamer?.nav;
|
|
498
|
-
if (nav !== undefined && (typeof nav !== 'string' || !nav || path.isAbsolute(nav) || path.posix.isAbsolute(nav) || nav.split(/[\\/]/).includes('..'))) {
|
|
499
|
-
fail(`module "${source.name}": dreamteamer.nav must be a relative path inside the package (got ${JSON.stringify(nav)})`);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
if (source.root !== root) {
|
|
503
|
-
moduleVersions.set(source.name, mpkg.version);
|
|
504
|
-
if (mpkg.peerDependencies && typeof mpkg.peerDependencies === 'object') moduleFloors.set(source.name, mpkg.peerDependencies);
|
|
505
|
-
}
|
|
506
|
-
const range = mpkg.dreamteamer?.engine;
|
|
507
|
-
if (range && satisfies(engineVer, range) === null) console.warn(`⚠ module ${source.name}: engine range "${range}" not understood by the built-in checker (see src/semver.js) — not verified`);
|
|
508
|
-
// `dreamteamer.env` (keys the module needs) and, in a module, `dreamteamer.vars` (the
|
|
509
|
-
// `${env:…}` vars it reads): each entry a bare name or `{ name, description, example }`, so
|
|
510
|
-
// `.env.example` says what a value looks like. A module only REQUESTS a var — the workspace's
|
|
511
|
-
// own list is the allow-list, so a module can never add a key to what `dt resolve` renders.
|
|
512
|
-
for (const key of source.root === root ? ['env'] : ['env', 'vars']) {
|
|
513
|
-
const decl = mpkg.dreamteamer?.[key] ?? [];
|
|
514
|
-
const sink = key === 'env' ? declaredEnv : requestedVars;
|
|
515
|
-
if (!Array.isArray(decl)) fail(`module "${source.name}": dreamteamer.${key} must be a list of key names or { name, description, example } objects (got ${JSON.stringify(decl)})`);
|
|
516
|
-
for (const entry of decl) {
|
|
517
|
-
const k = typeof entry === 'string' ? entry : entry?.name;
|
|
518
|
-
if (typeof k !== 'string' || !/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) fail(`module "${source.name}": dreamteamer.${key} entry ${JSON.stringify(entry)} — a key is an identifier (A-Z, 0-9, _) as a string or as { name, description, example }`);
|
|
519
|
-
if (!sink.has(k)) sink.set(k, []);
|
|
520
|
-
sink.get(k).push(source.name);
|
|
521
|
-
if (typeof entry === 'object' && !envMeta.has(k)) envMeta.set(k, { description: entry.description ? String(entry.description) : undefined, example: entry.example !== undefined ? String(entry.example) : undefined });
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
// Gathered here because mpkg is already parsed; refused below, next to the workspace's own
|
|
525
|
-
// declaration. The classic layout pushes the ROOT itself as an inline source, whose
|
|
526
|
-
// package.json IS `config` — reading it here too would report every workspace-level
|
|
527
|
-
// declaration twice, under the wrong owner.
|
|
528
|
-
if (source.root !== root) {
|
|
529
|
-
for (const rel of mpkg.dreamteamer?.local_assets ?? []) moduleLocalAssets.push({ rel, owner: source.name, base: source.root });
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
// `dreamteamer.vars` is the WORKSPACE's own declaration (root package.json, not a module's): the
|
|
533
|
-
// keys a `${env:NAME}` template is allowed to name. Same missing-key question as
|
|
534
|
-
// `dreamteamer.env`, one .env parse, two warnings — a module needs its key to RUN, a var is
|
|
535
|
-
// needed the moment someone calls `dt resolve`, and only the workspace can declare one.
|
|
536
|
-
if (config.vars !== undefined && (!Array.isArray(config.vars) || config.vars.some((v) => typeof v !== 'string'))) {
|
|
537
|
-
fail(`dreamteamer.vars must be a list of env key names (got ${JSON.stringify(config.vars)})`);
|
|
538
|
-
}
|
|
539
|
-
const declaredVars = config.vars ?? [];
|
|
540
|
-
for (const [k, mods] of requestedVars) {
|
|
541
|
-
if (!declaredVars.includes(k)) for (const mod of mods) console.warn(`⚠ module ${mod} reads \${env:${k}} — add it to the workspace's dreamteamer.vars`);
|
|
542
|
-
}
|
|
543
|
-
// ⚠ THE ONE PARSE of .env, shared with the collections pass: an env-pointed `storage.path`
|
|
544
|
-
// renders against exactly the values the warnings below name keys from. Values never reach any
|
|
545
|
-
// output or the manifest; a rendered storage path is the one thing a value becomes, and it lands
|
|
546
|
-
// only in the gitignored runtime. `declared` is the workspace's own list plus every module's
|
|
547
|
-
// request — the descriptor that names a var is the request to render it (compile-collections).
|
|
548
|
-
const envPath = path.join(root, '.env');
|
|
549
|
-
const parsedEnv = parseEnvValues(fs.existsSync(envPath) ? fs.readFileSync(envPath, 'utf8') : '');
|
|
550
|
-
const storageVars = { env: parsedEnv, workspaceFolder: root, declared: new Set([...declaredVars, ...requestedVars.keys()]) };
|
|
551
|
-
if (declaredEnv.size || declaredVars.length) {
|
|
552
|
-
// .env is parsed for KEY names ONLY — values never reach any output or the manifest
|
|
553
|
-
if (!fs.existsSync(envPath)) {
|
|
554
|
-
if (declaredEnv.size) console.warn(`⚠ no .env — modules declare env keys: ${[...declaredEnv.keys()].join(', ')} (see .env.example)`);
|
|
555
|
-
if (declaredVars.length) console.warn(`⚠ no .env — dreamteamer.vars declares ${declaredVars.join(', ')}, so no \${env:…} template can render here (see .env.example)`);
|
|
556
|
-
} else {
|
|
557
|
-
// ⚠ THE ONE PARSER, not a key regex of our own. This used to hand-roll
|
|
558
|
-
// `/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/`, which accepted two lines
|
|
559
|
-
// `parseEnvValues` deliberately drops (`KEY =value`, and an indented key) and scanned a
|
|
560
|
-
// quoted value's continuation lines for keys. Either disagreement produces the worst
|
|
561
|
-
// pairing there is: compile says nothing and then `dt resolve` answers "no value in
|
|
562
|
-
// .env" about a line the operator is looking straight at. Values are read here and
|
|
563
|
-
// never printed — the warnings below name keys only.
|
|
564
|
-
// A key present with an EMPTY (or whitespace-only) value is treated as absent, same as
|
|
565
|
-
// resolve's renderTemplate — `FILES_FOLDER=` must warn here exactly as `FILES_FOLDER`
|
|
566
|
-
// missing entirely would, or compile says nothing and resolve fails on the same line.
|
|
567
|
-
const present = new Set([...parsedEnv].filter(([, v]) => v.trim() !== '').map(([k]) => k));
|
|
568
|
-
for (const [k, mods] of declaredEnv) {
|
|
569
|
-
if (present.has(k)) continue;
|
|
570
|
-
const about = envMeta.get(k)?.description ? ` (${envMeta.get(k).description})` : '';
|
|
571
|
-
for (const mod of mods) console.warn(`⚠ module ${mod} declares env key ${k}${about} — missing from .env (see .env.example)`);
|
|
572
|
-
}
|
|
573
|
-
for (const k of declaredVars) {
|
|
574
|
-
if (present.has(k)) continue;
|
|
575
|
-
console.warn(`⚠ dreamteamer.vars declares ${k} — missing from .env, so \${env:${k}} cannot render on this machine`);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
// Two root files kept current on every compile, both cheap and both about the FIRST run of a
|
|
581
|
-
// stranger: `.env.example` lists every declared key with its description, so the warning above
|
|
582
|
-
// points at a file that actually names them; `.vscode/extensions.json` recommends the editor
|
|
583
|
-
// extension, so the first window offers it. Both are append/merge-only — nothing authored moves.
|
|
584
|
-
{
|
|
585
|
-
// one entry per key: a key one package declares as env and another requests as a var is one block
|
|
586
|
-
const byKey = new Map();
|
|
587
|
-
for (const [key, mods] of [...declaredEnv, ...requestedVars]) {
|
|
588
|
-
const e = byKey.get(key) ?? byKey.set(key, { key, modules: [], ...(envMeta.get(key) ?? {}) }).get(key);
|
|
589
|
-
for (const m of mods) if (!e.modules.includes(m)) e.modules.push(m);
|
|
590
|
-
}
|
|
591
|
-
// the workspace's own declarations are never dropped; and a declared module not on disk yet (a git
|
|
592
|
-
// module before `dt install`, a dependency before `npm install`) would drop keys it still declares
|
|
593
|
-
const keep = [...declaredVars, ...(config.env ?? []).map((e) => (typeof e === 'string' ? e : e?.name))];
|
|
594
|
-
const complete = !Object.keys(config.git_modules ?? {}).some((n) => !fs.existsSync(path.join(root, 'git_modules', n)))
|
|
595
|
-
&& !Object.keys(pkg.dependencies ?? {}).some((n) => !fs.existsSync(path.join(root, 'node_modules', n, 'package.json')));
|
|
596
|
-
const env = ensureEnvExample(root, [...byKey.values()],
|
|
597
|
-
'# secrets for skills and modules go here (copy to .env; .env is never committed).\n# modules declare the env keys they require in their package.json dreamteamer.env list.\n', { keep, complete });
|
|
598
|
-
if (env.added.length) console.log(`✔ .env.example now names ${env.added.join(', ')}`);
|
|
599
|
-
for (const k of env.moved) console.log(`✔ .env.example re-attributes ${k} (now declared by ${byKey.get(k).modules.join(', ')})`);
|
|
600
|
-
for (const k of env.dropped) console.log(`✔ .env.example drops ${k} — no installed package declares it`);
|
|
601
|
-
ensureEditorRecommendation(root);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
// ---- local-assets and postinstall: what `dt install` will do to a checkout -------
|
|
605
|
-
// `local-assets` are the gitignored heavy folders a checkout SHARES by symlink instead of
|
|
606
|
-
// duplicating — a browser profile dir, a model cache. Declared, never discovered. Every
|
|
607
|
-
// refusal below is something the installer would otherwise hit at RUN time, on a machine nobody
|
|
608
|
-
// is watching; the compiler is where a declaration is cheap to fix. (`src/checkout.js` refuses
|
|
609
|
-
// the escaping rel a second time when the plan is built — a runtime that writes a symlink
|
|
610
|
-
// outside the root must not wait for the compiler to be run.)
|
|
611
|
-
const ENGINE_OWNED = new Set(['.env', 'node_modules', '.dreamteamer', '.git']);
|
|
612
|
-
const gitQ = (args) => { try { execFileSync('git', args, { cwd: root, stdio: 'ignore' }); return true; } catch { return false; } };
|
|
613
|
-
for (const a of [...(config.local_assets ?? []).map((rel) => ({ rel, owner: 'workspace', base: root })), ...moduleLocalAssets]) {
|
|
614
|
-
const abs = path.resolve(a.base, a.rel), rel = path.relative(root, abs);
|
|
615
|
-
if (a.owner !== 'workspace' && path.relative(a.base, abs).startsWith('..')) fail(`local_assets: "${a.rel}" (module ${a.owner}) escapes its module with .. — declare it at the workspace level instead`);
|
|
616
|
-
// The workspace-level twin, and it earns its own line: a rel that climbs out of the ROOT
|
|
617
|
-
// otherwise reached the gitignore check below, which cannot see a path outside the repo and
|
|
618
|
-
// so told the operator to ignore something git will never match. `checkout.js` refuses the
|
|
619
|
-
// same shape when the plan is built.
|
|
620
|
-
if (rel.startsWith('..')) fail(`local_assets: "${a.rel}" escapes the workspace root with .. — a local asset must be a path INSIDE the workspace`);
|
|
621
|
-
if (ENGINE_OWNED.has(rel.split(path.sep)[0])) fail(`local_assets: "${rel}" is engine-owned — install links .env and installs node_modules itself; never declare them`);
|
|
622
|
-
if (gitQ(['ls-files', '--error-unmatch', rel])) fail(`local_assets: "${rel}" is tracked — a tracked path needs no link and a link would shadow it`);
|
|
623
|
-
// ⚠ WITHOUT a trailing slash, and the message has to say so: a dir-only pattern (`.profiles/`)
|
|
624
|
-
// matches neither a symlink nor a path that does not exist yet (measured, git 2.50) — and a
|
|
625
|
-
// shared asset is exactly those two shapes, a symlink in every non-primary checkout and
|
|
626
|
-
// absent before the first install.
|
|
627
|
-
if (!gitQ(['check-ignore', '-q', rel])) fail(`local_assets: "${rel}" is not gitignored — add it to .gitignore WITHOUT a trailing slash (a worktree holds it as a symlink, and a dir-only pattern ignores neither a symlink nor an absent path); a shared asset must never be committed`);
|
|
628
|
-
}
|
|
629
|
-
if (config.postinstall != null && typeof config.postinstall !== 'string') fail('dreamteamer.postinstall must be a single shell string');
|
|
630
|
-
|
|
631
|
-
// ---- the module dependency graph -------------------------------------------------
|
|
632
|
-
// `dependencies` names MODULES and must be acyclic. `peer_collections` names COLLECTIONS and
|
|
633
|
-
// therefore cannot cycle at all — which is the whole reason it exists: two modules that each
|
|
634
|
-
// reference a concept the other owns (crm needs `products`, rnd needs `contacts`) would be an
|
|
635
|
-
// unbreakable ring under module-named deps, and are two independent peer declarations here.
|
|
636
|
-
const moduleNames = new Set(sources.map((s) => s.name));
|
|
637
|
-
for (const [mod, deps] of moduleDeps) {
|
|
638
|
-
for (const dep of deps) {
|
|
639
|
-
if (dep === mod) fail(`module "${mod}" declares itself as a dependency`);
|
|
640
|
-
if (refused.has(dep)) fail(`module "${mod}" depends on "${dep}", which needs engine "${refused.get(dep)}" — this is ${engineVer}. Upgrade dreamteamer, or disable both.`);
|
|
641
|
-
if (!moduleNames.has(dep)) {
|
|
642
|
-
fail(`module "${mod}" depends on "${dep}", which is not installed — modules present: ${[...moduleNames].sort().join(', ')}\n run: dt install ${dep}`);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
// A module preset's absent member is a WARNING, never a failure: the preset is a list, and the
|
|
647
|
-
// operator may have uninstalled a member on purpose.
|
|
648
|
-
for (const [mod, members] of modulePresets) {
|
|
649
|
-
for (const [member, v] of Object.entries(members)) {
|
|
650
|
-
if (!moduleNames.has(member)) console.warn(`⚠ module preset ${moduleId(mod)} names ${member} ${v}, which is not installed — dt install ${member}`);
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
// npm's `peerDependencies` naming ANOTHER discovered module is a VERSION FLOOR: npm refuses the install
|
|
654
|
-
// below it, and this refuses the channels npm never saw — a git_modules clone, an inline copy, an
|
|
655
|
-
// install that went around the peer check. An absent sibling is `dependencies`' business, not this one's.
|
|
656
|
-
{
|
|
657
|
-
const byName = new Map(sources.map((s) => [s.name, s]));
|
|
658
|
-
const misses = [];
|
|
659
|
-
for (const [mod, floors] of moduleFloors) for (const [dep, range] of Object.entries(floors)) {
|
|
660
|
-
const sib = byName.get(dep), have = moduleVersions.get(dep);
|
|
661
|
-
if (!sib || dep === mod) continue;
|
|
662
|
-
const ok = satisfies(have, range);
|
|
663
|
-
if (ok === null) console.warn(`⚠ module ${mod}: peerDependencies range "${range}" for "${dep}" (${have ?? 'no version'}) not understood by the built-in checker (see src/semver.js) — not verified`);
|
|
664
|
-
else if (!ok) misses.push(`module "${mod}" ${moduleVersions.get(mod)} needs "${dep}" ${range} (its peerDependencies) — this workspace has ${have}, from ${CHANNEL_LABEL[sib.channel]}.\n fix: ${dep === 'dreamteamer' ? `dt update --engine (the engine is the workspace's pin; init and install never change it)` : sib.channel === 'npm' ? `npm install "${dep}@${range}"` : `bring ${rel(sib.root)} to a version in ${range}`}`);
|
|
665
|
-
}
|
|
666
|
-
if (misses.length) fail(misses.join('\n'));
|
|
667
|
-
}
|
|
668
|
-
// DFS with an explicit path so the error can print the ring rather than just naming one module
|
|
669
|
-
{
|
|
670
|
-
const state = new Map(); // name -> 'open' | 'done'
|
|
671
|
-
const visit = (mod, trail) => {
|
|
672
|
-
if (state.get(mod) === 'done') return;
|
|
673
|
-
if (state.get(mod) === 'open') {
|
|
674
|
-
const ring = [...trail.slice(trail.indexOf(mod)), mod];
|
|
675
|
-
fail(`cyclic module dependencies: ${ring.join(' → ')}\n a reference to a CONCEPT another module owns belongs in dreamteamer.peer_collections (a collection name), which cannot cycle.`);
|
|
676
|
-
}
|
|
677
|
-
state.set(mod, 'open');
|
|
678
|
-
for (const dep of moduleDeps.get(mod) ?? []) visit(dep, [...trail, mod]);
|
|
679
|
-
state.set(mod, 'done');
|
|
680
|
-
};
|
|
681
|
-
for (const mod of moduleDeps.keys()) visit(mod, []);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
const dataOwners = dataOwningModules(sources, fail, rel);
|
|
685
|
-
let layers;
|
|
686
|
-
try { layers = layerEntries(pkg, root).map((l) => ({ ...l, root: path.posix.join('git_modules', l.name), dataPath: layerDataPath(root, l.name) })); }
|
|
687
|
-
catch (e) { fail(e.message); }
|
|
688
|
-
for (const l of layers) if (!fs.existsSync(path.join(root, l.root))) console.warn(`⚠ layer ${l.name} (${l.root}) is not installed — its records are not read; run dreamteamer install`);
|
|
689
|
-
|
|
690
|
-
const disabled = new Set(config.disable ?? []);
|
|
691
|
-
const disabledHits = new Set(disabledModules); // bare entries were applied at discovery
|
|
692
|
-
|
|
693
|
-
/** entries: runtime-relative path -> { sources: [workspace-relative], bytes } */
|
|
694
|
-
const entries = new Map();
|
|
695
|
-
/** ui-view sources carrying `overlay: true` — merged onto their base after discovery */
|
|
696
|
-
const viewOverlays = [];
|
|
697
|
-
const isViewOverlay = (srcPath) => {
|
|
698
|
-
const text = fs.readFileSync(srcPath, 'utf8');
|
|
699
|
-
// the regex is only a cheap pre-filter, so it must not be stricter than YAML: a trailing comment
|
|
700
|
-
// or space on the flag line still carries the flag (the parsed value is what decides)
|
|
701
|
-
return /^overlay:\s*true\b/m.test(text) && loadSource(text, rel(srcPath))?.overlay === true;
|
|
702
|
-
};
|
|
703
|
-
const counts = {};
|
|
704
|
-
/** collection descriptors collected per name, a base and its overlays: name -> [{src, doc, moduleName}] */
|
|
705
|
-
const descriptorGroups = new Map();
|
|
706
|
-
|
|
707
|
-
// ⚠ A runtime key is a POSIX path on every OS. Every reader of `entries` — the mixin, skill,
|
|
708
|
-
// command and ui-view passes below, the harness adapters, extensions — matches it with `/`, and
|
|
709
|
-
// `path.join` spells it with `\` on Windows, where no mixin loaded and the collections and skills
|
|
710
|
-
// indexes came out empty.
|
|
711
|
-
function addEntry(runtimePath, srcPath) {
|
|
712
|
-
runtimePath = toPosix(runtimePath);
|
|
713
|
-
if (entries.has(runtimePath)) {
|
|
714
|
-
const [, kind, entity] = /^([^/]+)\/([^/]+)/.exec(runtimePath) ?? [];
|
|
715
|
-
const entityId = (entity ?? '').replace(/\.[^.]+\.(yaml|md|json)$/, '');
|
|
716
|
-
const prev = entries.get(runtimePath).sources[0].path;
|
|
717
|
-
fail(`name collision on ${kind?.replace(/s$/, '') ?? 'entity'} "${entityId}"
|
|
718
|
-
- ${prev}
|
|
719
|
-
- ${rel(srcPath)}
|
|
720
|
-
identity entities are never merged or shadowed (a collection declares \`overlay: true\` to add to another module's).
|
|
721
|
-
either rename yours, or disable one: add "${kind}/${entityId}" to dreamteamer.disable in package.json.`);
|
|
722
|
-
}
|
|
723
|
-
const bytes = fs.readFileSync(srcPath);
|
|
724
|
-
entries.set(runtimePath, { sources: [{ path: rel(srcPath), hash: sha256(bytes) }], bytes });
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
/** module names that actually put something into the compiled runtime — see the warning below */
|
|
728
|
-
const contributedBy = new Set();
|
|
729
|
-
|
|
730
|
-
for (const source of sources) {
|
|
731
|
-
// an unrecognised folder at a module root is a typo'd kind or a kind the engine dropped —
|
|
732
|
-
// both of which used to compile ✔ and contribute nothing (see NON_SOURCE_DIRS)
|
|
733
|
-
const strays = strayKindDirs(source, root, moduleIgnores.get(source.name) ?? [], kinds);
|
|
734
|
-
if (strays.length) {
|
|
735
|
-
// `ignore` matches a FOLDER NAME, at the root and under `system/` alike, so the remedy has
|
|
736
|
-
// to quote the bare name — suggesting "system/gizmos" would print an entry that matches
|
|
737
|
-
// nothing and send the reader back for a second compile to find that out.
|
|
738
|
-
const ignorable = [...new Set(strays.map((s) => s.replace(/^system\//, '')))];
|
|
739
|
-
fail(`module "${source.name}" (${rel(source.root)}) has folder(s) that are not a known kind: ${strays.join(', ')}
|
|
740
|
-
known kinds: ${kinds.join(', ')}${contributed.length ? '' : `\n a kind an extension adds (proofs/, for one) is known only while that extension is installed or its module is present`}
|
|
741
|
-
if these are not sources, declare them: "dreamteamer": { "ignore": [${ignorable.map((s) => `"${s}"`).join(', ')}] } in ${rel(path.join(source.root, 'package.json'))}`);
|
|
742
|
-
}
|
|
743
|
-
for (const kind of kinds) {
|
|
744
|
-
// a half-moved module compiles its flat half and drops the rest — say so rather than
|
|
745
|
-
// reporting ✔ over a silent partial read (the decision-156 failure shape)
|
|
746
|
-
if (bothLayouts(source.root, kind)) {
|
|
747
|
-
console.warn(`⚠ module ${source.name}: both ${kind}/ and system/${kind}/ exist — the flat copy wins and system/${kind}/ is NOT compiled. finish the move.`);
|
|
748
|
-
}
|
|
749
|
-
const srcDir = kindDir(source.root, kind);
|
|
750
|
-
if (!fs.existsSync(srcDir)) continue;
|
|
751
|
-
counts[kind] ??= 0;
|
|
752
|
-
// `collections/` is enumerated RECURSIVELY, so a namespaced descriptor can be authored at
|
|
753
|
-
// `collections/health/doctors.collection.yaml` — mirroring where it lands in the runtime and
|
|
754
|
-
// letting a workspace group its descriptors the same way its data is grouped.
|
|
755
|
-
//
|
|
756
|
-
// ⚠ This is load-bearing, not cosmetic. `schema-ops` derives a descriptor's source path from
|
|
757
|
-
// its name, so `add-field` on `health/doctors` writes the nested path; with a flat readdir
|
|
758
|
-
// that file was written, silently skipped, and the verb reported ✔ while changing nothing —
|
|
759
|
-
// the decision-156 shape again. Every other kind stays flat: their ids are single segments.
|
|
760
|
-
const names = kind === 'collections'
|
|
761
|
-
? [...walk(srcDir)].map((f) => path.relative(srcDir, f).split(path.sep).join('/'))
|
|
762
|
-
: fs.readdirSync(srcDir).sort();
|
|
763
|
-
for (const name of names) {
|
|
764
|
-
if (name.startsWith('.')) continue;
|
|
765
|
-
if (excludedFromKind(contributed, kind, name)) continue;
|
|
766
|
-
const entityId = name.replace(/\.[^.]+\.(yaml|md|json)$/, '');
|
|
767
|
-
// an entity entry is `<kind>/<id>` — a record reference — and names that entity in any module
|
|
768
|
-
if (disabled.has(`${kind}/${entityId}`)) { disabledHits.add(`${kind}/${entityId}`); continue; }
|
|
769
|
-
const srcPath = path.join(srcDir, name);
|
|
770
|
-
const isDir = fs.statSync(srcPath).isDirectory();
|
|
771
|
-
if (kind === 'collections' && !isDir) {
|
|
772
|
-
// a base and its overlays merge — collect per collection name
|
|
773
|
-
const bytes = fs.readFileSync(srcPath);
|
|
774
|
-
// A `touch`ed file on the way to writing one is the ordinary way to arrive here. The
|
|
775
|
-
// descriptor keeps its own wording — it is the one kind that can say what is missing.
|
|
776
|
-
if (bytes.toString('utf8').trim() === '') {
|
|
777
|
-
fail(`${rel(srcPath)}: collection source is empty — a descriptor needs at least 'name' and 'fields'. Delete the file, or write one.`);
|
|
778
|
-
}
|
|
779
|
-
const doc = loadSource(bytes.toString('utf8'), rel(srcPath));
|
|
780
|
-
// a scalar or a list parses fine and then reads as undefined on every key below
|
|
781
|
-
if (doc == null || typeof doc !== 'object' || Array.isArray(doc)) {
|
|
782
|
-
fail(`${rel(srcPath)}: collection source is not a mapping — a descriptor needs at least 'name' and 'fields'.`);
|
|
783
|
-
}
|
|
784
|
-
// a v1 source is refused with every other one, in one message (compile-collections.js)
|
|
785
|
-
if (!doc.name) fail(`${rel(srcPath)}: descriptor needs 'name'`);
|
|
786
|
-
if (!descriptorGroups.has(doc.name)) descriptorGroups.set(doc.name, []);
|
|
787
|
-
descriptorGroups.get(doc.name).push({ src: { path: rel(srcPath), hash: sha256(bytes) }, doc, moduleName: source.name });
|
|
788
|
-
contributedBy.add(source.name);
|
|
789
|
-
} else if (FOLDER_KINDS.has(kind) && isDir) {
|
|
790
|
-
// the folder's ENTITY file, not its payload — see refuseEmptySource
|
|
791
|
-
const entityFile = path.join(srcPath, 'SKILL.md');
|
|
792
|
-
if (fs.existsSync(entityFile)) refuseEmptySource(entityFile);
|
|
793
|
-
for (const file of walk(srcPath)) {
|
|
794
|
-
addEntry(path.join(kind, name, path.relative(srcPath, file)), file);
|
|
795
|
-
contributedBy.add(source.name);
|
|
796
|
-
}
|
|
797
|
-
counts[kind]++;
|
|
798
|
-
} else if (!isDir) {
|
|
799
|
-
refuseEmptySource(srcPath);
|
|
800
|
-
// a view OVERLAY is merged onto the view it names once every source is in (below), so
|
|
801
|
-
// discovery order between the two modules never decides which is the base
|
|
802
|
-
if (kind === 'ui-views' && isViewOverlay(srcPath)) {
|
|
803
|
-
viewOverlays.push({ runtimePath: toPosix(path.join(kind, name)), srcPath, moduleName: source.name });
|
|
804
|
-
contributedBy.add(source.name);
|
|
805
|
-
continue;
|
|
806
|
-
}
|
|
807
|
-
addEntry(path.join(kind, name), srcPath);
|
|
808
|
-
contributedBy.add(source.name);
|
|
809
|
-
counts[kind]++;
|
|
810
|
-
} else {
|
|
811
|
-
// nested dirs for file-shape kinds (e.g. date-partitioned) — recurse
|
|
812
|
-
for (const file of walk(srcPath)) {
|
|
813
|
-
refuseEmptySource(file);
|
|
814
|
-
addEntry(path.join(kind, path.relative(srcDir, file)), file);
|
|
815
|
-
contributedBy.add(source.name);
|
|
816
|
-
counts[kind]++;
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
// ---- ui-view overlays: a same-id view carrying `overlay: true` MERGES onto the shipped one --------
|
|
824
|
-
// The way a collection overlay refines a descriptor it does not own, so a workspace changes a
|
|
825
|
-
// package's view in the few lines that differ instead of copying it (and losing every later fix
|
|
826
|
-
// the package ships). DEEP, overlay wins at the leaves, a list is replaced whole, and `null`
|
|
827
|
-
// REMOVES the key — the one spelling an overlay has for "the package sets this; I do not". A
|
|
828
|
-
// view without the flag and the same id is still the collision `addEntry` names.
|
|
829
|
-
const ownerOf = (file) => sources.map((s) => ({ s, at: rel(s.root) })).filter(({ at }) => !at || file.startsWith(`${at}/`)).sort((a, b) => b.at.length - a.at.length)[0]?.s;
|
|
830
|
-
for (const o of viewOverlays) {
|
|
831
|
-
const e = entries.get(o.runtimePath);
|
|
832
|
-
const id = path.posix.basename(o.runtimePath).replace(/\.ui-view\.yaml$/, '');
|
|
833
|
-
if (!e) fail(`${rel(o.srcPath)}: an overlay of ui-view "${id}" (overlay: true), but no module ships a view "${id}" — drop \`overlay: true\` to make it a view of its own, or install the module that ships it.`);
|
|
834
|
-
const bytes = fs.readFileSync(o.srcPath);
|
|
835
|
-
const { overlay: _flag, ...ov } = loadSource(bytes.toString('utf8'), rel(o.srcPath)) ?? {};
|
|
836
|
-
const merged = overlayView(loadSource(e.bytes.toString('utf8'), e.sources[0].path) ?? {}, ov);
|
|
837
|
-
e.bytes = Buffer.from(dump(merged));
|
|
838
|
-
e.sources.push({ path: rel(o.srcPath), hash: sha256(bytes) });
|
|
839
|
-
e.module ??= moduleId(ownerOf(e.sources[0].path)?.name ?? '');
|
|
840
|
-
(e.overlaidBy ??= []).push(moduleId(o.moduleName));
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
// ---- stage module UI bundles ---------------------------------------------------
|
|
844
|
-
// modules ship a PRE-BUILT app.js that registers components/layouts against the surface's
|
|
845
|
-
// registry (design "the UI": components are module code, never records). staged under
|
|
846
|
-
// .dreamteamer/ui/<module>/app.js; the VS Code extension reads it off disk (decision 48) and
|
|
847
|
-
// the legacy server served it at /ui. `dist/app.js` (a built bundle) wins over `app.js`
|
|
848
|
-
// (plain-JS, host-provided Vue).
|
|
849
|
-
//
|
|
850
|
-
// `ui/` is the name — it matches where the bundle STAGES and what it is. `studio/` is the
|
|
851
|
-
// original name and stays a fallback: the studio it referred to is archived (decisions 51, 93),
|
|
852
|
-
// so the folder was named after a surface that no longer exists. Both are in NON_SOURCE_DIRS,
|
|
853
|
-
// so neither trips the unknown-folder gate (decision 179).
|
|
854
|
-
const uiModules = [];
|
|
855
|
-
const uiOwners = new Map(); // shortName -> module name, for a readable collision error
|
|
856
|
-
for (const source of sources) {
|
|
857
|
-
const cand = ['ui/dist/app.js', 'ui/app.js', 'studio/dist/app.js', 'studio/app.js']
|
|
858
|
-
.map((p) => path.join(source.root, p))
|
|
859
|
-
.find((p) => fs.existsSync(p));
|
|
860
|
-
if (!cand) continue;
|
|
861
|
-
// short name = full package name, url-safe: "@" stripped, "/" → "--"
|
|
862
|
-
// (@a/crm and @b/crm used to both stage ui/crm — audit finding 4). unscoped
|
|
863
|
-
// names are unchanged, so existing /ui/<name>/app.js paths survive.
|
|
864
|
-
const shortName = source.name.replace(/^@/, '').replace(/\//g, '--');
|
|
865
|
-
const prevOwner = uiOwners.get(shortName);
|
|
866
|
-
if (prevOwner) fail(`ui bundle collision: modules "${prevOwner}" and "${source.name}" both stage ui/${shortName}/app.js — rename one package.`);
|
|
867
|
-
uiOwners.set(shortName, source.name);
|
|
868
|
-
addEntry(path.join('ui', shortName, 'app.js'), cand);
|
|
869
|
-
uiModules.push(shortName);
|
|
870
|
-
// A UI bundle IS a contribution. Counting it here is what keeps the warning below honest —
|
|
871
|
-
// a module whose whole purpose is a layout used to be told it "contributed no recognised
|
|
872
|
-
// sources" while its layout was rendering in the app.
|
|
873
|
-
contributedBy.add(source.name);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
|
-
// A module that ships only folders the engine does not recognise compiles ✔ and contributes
|
|
877
|
-
// NOTHING. Warn; do not fail, since a module that is temporarily source-free is the
|
|
878
|
-
// operator's business, not the compiler's. Runs AFTER UI staging so a UI-only module counts.
|
|
879
|
-
// ⚠ A module with a scaffolded-but-EMPTY kind folder is a module being AUTHORED, not a mistake.
|
|
880
|
-
// `add modules` creates exactly that shape — eight empty kind folders — and a verb whose own
|
|
881
|
-
// output triggers a warning reads as a broken install. The warning's remaining job is the case it
|
|
882
|
-
// was written for: a module that ships nothing the engine recognises AT ALL, which is what
|
|
883
|
-
// decision 156 cost two days. `kindDir` returns the flat path when neither layout exists, so this
|
|
884
|
-
// is a genuine existence test on either spelling.
|
|
885
|
-
const extensionNames = new Set(extensions.map((e) => e.name));
|
|
886
|
-
for (const source of sources) {
|
|
887
|
-
if (contributedBy.has(source.name) || extensionNames.has(source.name) || modulePresets.has(source.name)) continue;
|
|
888
|
-
if (kinds.some((k) => fs.existsSync(kindDir(source.root, k)))) continue;
|
|
889
|
-
console.warn(`⚠ module "${source.name}" (${rel(source.root)}) contributed no recognised sources — its folder names must match a known kind (${kinds.join(', ')}) or it must ship a UI bundle at ui/app.js`);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
// An npm-installed module's `data/` is read by NOTHING: no root points into node_modules/, because
|
|
893
|
-
// records there could never be committed (owns_data and `storage.owner: module` are refused for npm
|
|
894
|
-
// above). A package shipping one — seed records, a stale copy — compiled ✔ and its records silently
|
|
895
|
-
// never appeared. Say so, naming the package and the folder. A module whose OWN script reads the
|
|
896
|
-
// folder (a workflow installer copying templates out of it) declares it: `"ignore": ["data"]`.
|
|
897
|
-
for (const source of sources) {
|
|
898
|
-
if (source.channel !== 'npm' || (moduleIgnores.get(source.name) ?? []).includes('data')) continue;
|
|
899
|
-
const data = path.join(source.root, 'data');
|
|
900
|
-
let holds = false;
|
|
901
|
-
try { holds = fs.readdirSync(data, { recursive: true, withFileTypes: true }).some((e) => e.isFile()); } catch { /* no data/ */ }
|
|
902
|
-
if (holds) console.warn(`⚠ module ${source.name} ships ${rel(data)}/ and nothing reads it — a module installed from npm cannot hold records (node_modules/ is never committed), so no collection reads that folder. Vendor the module into modules/ or install it as a git module to keep records in it; if one of its own scripts reads the folder, declare "dreamteamer": { "ignore": ["data"] } in its package.json.`);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
// ---- mixins (descriptor v2): partial descriptors merged into the collections that list them ----
|
|
906
|
-
const mixinDocs = new Map(); // id -> doc (with `src` for staleness)
|
|
907
|
-
for (const [rt, entry] of entries) {
|
|
908
|
-
const m = /^mixins\/(.+)\.mixin\.yaml$/.exec(rt);
|
|
909
|
-
if (!m) continue;
|
|
910
|
-
const doc = loadSource(entry.bytes.toString('utf8'), entry.sources[0].path);
|
|
911
|
-
if (!doc || typeof doc !== 'object') fail(`${entry.sources[0].path}: a mixin is a mapping`);
|
|
912
|
-
const bad = Object.keys(doc).filter((k) => !['name', 'description', 'use_when', 'fields', 'storage', 'ids', 'display', 'constraints'].includes(k));
|
|
913
|
-
if (bad.length) fail(`${entry.sources[0].path}: unknown key(s) ${bad.join(', ')} — a mixin carries name · description · use_when · fields · storage · ids · display · constraints`);
|
|
914
|
-
if (doc.name !== m[1]) fail(`${entry.sources[0].path}: name "${doc.name}" must equal the file's id "${m[1]}"`);
|
|
915
|
-
if (!String(doc.description ?? '').trim()) console.warn(`⚠ mixin ${m[1]} has no description — it renders as a bare name in the orientation block every session loads`);
|
|
916
|
-
mixinDocs.set(m[1], { ...doc, src: entry.sources[0] });
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
// ---- namespaces: the UNION of every module's declaration plus the workspace's (§8) ----------
|
|
920
|
-
//
|
|
921
|
-
// This used to be "the workspace package.json only, never per-module", and the reason was real: a
|
|
922
|
-
// module that can declare a namespace can rename where another module's records live. What it
|
|
923
|
-
// cost was decision 130's own acceptance test — "a module compiles alone in a bare workspace" —
|
|
924
|
-
// which no NAMESPACED module could ever pass, because the consuming workspace had to edit its
|
|
925
|
-
// manifest before the module would compile. That is precisely the coupling the rule forbids.
|
|
926
|
-
//
|
|
927
|
-
// Three rules keep the protection:
|
|
928
|
-
// 1. ONE OWNER per namespace. Two modules declaring it is a hard error naming both.
|
|
929
|
-
// 2. USING one requires the dependency (checked per collection, below) — otherwise the union
|
|
930
|
-
// would let a second module squat in the first's namespace silently. Before the union, B
|
|
931
|
-
// alone simply failed loudly, and that accident was the safer behaviour.
|
|
932
|
-
// 3. A WORKSPACE declaration duplicating a module's is a WARNING. Every existing workspace
|
|
933
|
-
// declares at the workspace level, and an upgrade must not brick compile.
|
|
934
|
-
//
|
|
935
|
-
// The resolved set is STAMPED INTO THE MANIFEST, so `namespace.js`, `parseRef`, the store, `check`
|
|
936
|
-
// and the extension are all unchanged — they read the artifact, exactly as they read
|
|
937
|
-
// `storage.base`. Config rather than records for the same bootstrap reason `git-modules` is: a
|
|
938
|
-
// reference has to be parseable before anything has been compiled.
|
|
939
|
-
const nsOwners = new Map(); // namespace -> the module NAME that declares it
|
|
940
|
-
for (const source of sources) {
|
|
941
|
-
for (const ns of normalizeNamespaces(moduleNamespaces.get(source.name))) {
|
|
942
|
-
const prev = nsOwners.get(ns);
|
|
943
|
-
if (prev && prev !== source.name) {
|
|
944
|
-
fail(`namespace "${ns}" is declared by ${moduleId(prev)} AND ${moduleId(source.name)} — one owner. Remove it from one (dt set modules/<m> namespaces=…).`);
|
|
945
|
-
}
|
|
946
|
-
nsOwners.set(ns, source.name);
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
for (const ns of normalizeNamespaces(config.namespaces)) {
|
|
950
|
-
const owner = nsOwners.get(ns);
|
|
951
|
-
if (!owner) continue;
|
|
952
|
-
console.warn(`⚠ namespace "${ns}" is declared both by module ${moduleId(owner)} and at the workspace level — the module's declaration is the one that TRAVELS, so the workspace copy is redundant. Drop it: dt set modules/${moduleId(owner)} namespaces=${ns}`);
|
|
953
|
-
}
|
|
954
|
-
const namespaces = normalizeNamespaces([...nsOwners.keys(), ...(config.namespaces ?? [])]);
|
|
955
|
-
const collectionNames = [...descriptorGroups.keys()];
|
|
956
|
-
for (const p of namespaceProblems(namespaces, collectionNames)) fail(p);
|
|
957
|
-
// The silent failure this whole feature had to fix: a slash in a collection name used to compile
|
|
958
|
-
// clean, land at `.dreamteamer/collections/<ns>/<name>.collection.yaml`, and then vanish — the
|
|
959
|
-
// descriptor loader read one directory level, so the collection was simply absent from the
|
|
960
|
-
// runtime while compile reported ✔ (the same shape as decision 156).
|
|
961
|
-
// ⚠ THE STATED TRADE (§8): the namespace set is now a function of the INSTALLED MODULE SET, so
|
|
962
|
-
// removing or disabling a namespace-owning module re-splits every reference into it. The record
|
|
963
|
-
// layer's sentence is correct and cannot know that — `namespace.js` is pure and must stay so — so
|
|
964
|
-
// the module half is appended here, where the module set is in hand.
|
|
965
|
-
for (const p of unqualifiedProblems(collectionNames, namespaces)) {
|
|
966
|
-
const guess = /but "([^"]+)" is not declared/.exec(p)?.[1];
|
|
967
|
-
const gone = guess && prevManifestNamespaces(root).includes(guess) ? guess : null;
|
|
968
|
-
fail(gone
|
|
969
|
-
? `${p}\n ⚠ "${gone}" WAS declared in the previous compile — by a module you just removed or disabled. Re-install it, or declare the namespace where the collection now lives: dt set modules/<m> namespaces=${gone}`
|
|
970
|
-
: p);
|
|
971
|
-
}
|
|
972
|
-
|
|
973
|
-
// ---- collections: descriptor format v2, the only format read ---------------------------
|
|
974
|
-
// The engine's own collections are an implicit dependency of every module: the entity kinds the
|
|
975
|
-
// compiler materializes, plus `repos` (because `install repos/<id>` clones them).
|
|
976
|
-
const CORE_COLLECTIONS = new Set([...kinds, ...DERIVED_KINDS, 'repos']);
|
|
977
|
-
const engineName = engineId().replace(/@[^@]*$/, '');
|
|
978
|
-
const wsDir = config.workspace_module;
|
|
979
|
-
const wsModuleName = wsDir
|
|
980
|
-
? sources.find((s) => rel(s.root) === path.posix.join('modules', wsDir))?.name
|
|
981
|
-
: pkg.name;
|
|
982
|
-
// a declared git module whose clone is absent is an UNINSTALLED workspace (a fresh clone), so a
|
|
983
|
-
// collection error there is named with the install, not left reading as a broken reference
|
|
984
|
-
const uninstalled = Object.keys(config.git_modules ?? {}).filter((n) => !fs.existsSync(path.join(root, 'git_modules', n)));
|
|
985
|
-
const collectionsFail = (msg) => fail(uninstalled.length
|
|
986
|
-
? `${msg}\n run \`dreamteamer install\` first — dreamteamer.git_modules declares ${uninstalled.join(', ')}, and no clone of ${uninstalled.length === 1 ? 'it' : 'them'} is on disk yet`
|
|
987
|
-
: msg);
|
|
988
|
-
const { compiled: compiledColls, inert: inertSources, moduleColls, layerReads } = compileCollections({
|
|
989
|
-
groups: descriptorGroups, mixins: mixinDocs, namespaces, nsOwners,
|
|
990
|
-
runtimeKinds: new Set([...kinds, ...DERIVED_KINDS]), core: CORE_COLLECTIONS,
|
|
991
|
-
moduleDeps, modulePresets, modulePeers, channelOf, wsModuleName, engineName, dataOwners,
|
|
992
|
-
moduleSources: new Map(sources.map((s) => [s.name, s])), unownableBecause, layers,
|
|
993
|
-
repoOf: (moduleRoot) => repoRootOf(moduleRoot, root), rel, root, dataPath: config.data_path ?? 'data', vars: storageVars,
|
|
994
|
-
moduleId, fail: collectionsFail, warn: (m) => console.warn(m),
|
|
995
|
-
});
|
|
996
|
-
refusePlacementTransitions(root, compiledColls);
|
|
997
|
-
counts.collections = 0;
|
|
998
|
-
const mergedCount = [...compiledColls.values()].filter((c) => c.compiled.overlaid_by.length).length;
|
|
999
|
-
for (const [name, c] of compiledColls) {
|
|
1000
|
-
entries.set(path.posix.join('collections', `${name}.collection.yaml`), { sources: c.sources, bytes: Buffer.from(dump(c.doc, { noRefs: true })) });
|
|
1001
|
-
counts.collections++;
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
// ---- modules, projected ---------------------------------------------------------
|
|
1005
|
-
// One record per discovered module, written from what discovery and the package pass already
|
|
1006
|
-
// established. `package.json` remains the source of truth and compile keeps reading it — this
|
|
1007
|
-
// is a photograph, never an input (see collections/modules.collection.yaml for why it earns a
|
|
1008
|
-
// place in core at all).
|
|
1009
|
-
//
|
|
1010
|
-
// The id strips an npm scope so `@dreamteamer/crm` reads as `crm`, which is what every message
|
|
1011
|
-
// in this engine already calls it. A collision is a hard failure rather than a silent overwrite:
|
|
1012
|
-
// two modules answering to one id would make `dependencies` ambiguous, and an ambiguous edge is
|
|
1013
|
-
// worse than no diagram.
|
|
1014
|
-
const idByModule = new Map();
|
|
1015
|
-
for (const source of sources) {
|
|
1016
|
-
const id = moduleId(source.name);
|
|
1017
|
-
const clash = idByModule.get(id);
|
|
1018
|
-
if (clash && clash !== source.name) fail(`modules "${clash}" and "${source.name}" both resolve to the id "${id}" — rename one.`);
|
|
1019
|
-
idByModule.set(id, source.name);
|
|
1020
|
-
}
|
|
1021
|
-
const presetProjection = (names) => {
|
|
1022
|
-
const installed = names.filter((n) => sources.some((s) => s.name === n)).length;
|
|
1023
|
-
return { preset: true, members: names.map((n) => `modules/${moduleId(n)}`), preset_summary: `preset · ${names.length} members · ${installed} installed` };
|
|
1024
|
-
};
|
|
1025
|
-
for (const source of sources) {
|
|
1026
|
-
const id = moduleId(source.name);
|
|
1027
|
-
let pkg = {};
|
|
1028
|
-
try { pkg = JSON.parse(fs.readFileSync(path.join(source.root, 'package.json'), 'utf8')); } catch { /* inline workspace source */ }
|
|
1029
|
-
const mpkg = pkg.dreamteamer ?? {};
|
|
1030
|
-
// What this module is FOR, in one line. `dreamteamer.description` wins; npm's own top-level
|
|
1031
|
-
// `description` is the fallback, because it is the one place a package author already writes
|
|
1032
|
-
// that sentence — six modules on one dogfood workspace had authored it THERE and every
|
|
1033
|
-
// `dt list modules` row read `-` for description. There is no derivation past that and there
|
|
1034
|
-
// should not be: a module is the only place that knows.
|
|
1035
|
-
const description = [mpkg.description, pkg.description].find((s) => typeof s === 'string' && s.trim());
|
|
1036
|
-
// A module with no sentence renders as a bare title at the head of its section in the
|
|
1037
|
-
// orientation block — the one place a session learns what an AREA of the workspace is for.
|
|
1038
|
-
// Same shape as the per-collection warning: non-blocking, named per offender.
|
|
1039
|
-
if (!description) console.warn(`⚠ module ${source.name} has no description — set "description" in its package.json; it heads its own section in the orientation block every session loads`);
|
|
1040
|
-
const record = {
|
|
1041
|
-
name: source.name,
|
|
1042
|
-
// Authored wins; the derived fallback title-cases the id the same way a collection's
|
|
1043
|
-
// `title` is derived. `@dreamteamer/crm` -> "Crm" until crm declares "CRM" — which is
|
|
1044
|
-
// the point: the module is the only place that knows.
|
|
1045
|
-
title: typeof mpkg.title === 'string' && mpkg.title ? mpkg.title : titleCase(id),
|
|
1046
|
-
...(description ? { description } : {}),
|
|
1047
|
-
// §8: the namespaces THIS module declares — projected from its package.json, so
|
|
1048
|
-
// `dt list modules` answers "who owns hr?" without reading seven package.json files.
|
|
1049
|
-
...(normalizeNamespaces(mpkg.namespaces).length ? { namespaces: normalizeNamespaces(mpkg.namespaces) } : {}),
|
|
1050
|
-
// §10: the folder name, not an internal channel word. `dt status` then reads
|
|
1051
|
-
// `hr git_modules @ 3f2a1c (dirty)` and needs no legend.
|
|
1052
|
-
location: locationOf(source, root),
|
|
1053
|
-
path: rel(source.root) || '.',
|
|
1054
|
-
// The module's RUNNABLE entry points — `bin/<file>`, the folder NON_SOURCE_DIRS waves through.
|
|
1055
|
-
// Skills and commands render into the orientation block; a module whose procedure is a
|
|
1056
|
-
// script did not, so a session planned `dt add` writes the tooling forbids. This is the
|
|
1057
|
-
// POINTER that the procedure exists, never its arguments — those stay in the skill.
|
|
1058
|
-
...(binEntries(source.root).length ? { bin: binEntries(source.root) } : {}),
|
|
1059
|
-
...(mpkg.owns_data === true ? { owns_data: true } : {}),
|
|
1060
|
-
// Declared module names become record IDS here, because that is what a reference
|
|
1061
|
-
// resolves against. An undeclared/unknown name would dangle, and `check` would say so —
|
|
1062
|
-
// but compile has already failed on that case (the acyclicity pass resolves every one).
|
|
1063
|
-
// ⚠ A reference VALUE is `<collection>/<id>`, never a bare id — `check` rejects the bare
|
|
1064
|
-
// form, which is exactly what it did to the first pass of this projection (63 violations).
|
|
1065
|
-
...(moduleDeps.get(source.name)?.length
|
|
1066
|
-
? { dependencies: moduleDeps.get(source.name).map((n) => `modules/${moduleId(n)}`) }
|
|
1067
|
-
: {}),
|
|
1068
|
-
...(modulePeers.get(source.name)?.length
|
|
1069
|
-
? { peer_collections: modulePeers.get(source.name).map((c) => `collections/${c}`) }
|
|
1070
|
-
: {}),
|
|
1071
|
-
...(moduleColls.get(source.name)?.size
|
|
1072
|
-
? { collections: [...moduleColls.get(source.name)].sort().map((c) => `collections/${c}`) }
|
|
1073
|
-
: {}),
|
|
1074
|
-
// A MODULE PRESET (CR-dt-008): its members as references, and how many of them are here.
|
|
1075
|
-
...(modulePresets.has(source.name) ? presetProjection(Object.keys(modulePresets.get(source.name))) : {}),
|
|
1076
|
-
};
|
|
1077
|
-
const bytes = Buffer.from(dump(record));
|
|
1078
|
-
// ⚠ The source hash is the hash of the SOURCE FILE, not of the projected record. Hashing the
|
|
1079
|
-
// output made every source "differ" on the next run, so `staleness` reported the workspace
|
|
1080
|
-
// stale immediately after a clean compile — the one signal that has to stay trustworthy.
|
|
1081
|
-
const pkgPath = path.join(source.root, 'package.json');
|
|
1082
|
-
const pkgBytes = fs.existsSync(pkgPath) ? fs.readFileSync(pkgPath) : bytes;
|
|
1083
|
-
entries.set(path.posix.join('modules', `${id}.module.yaml`), {
|
|
1084
|
-
sources: [{ path: rel(pkgPath), hash: sha256(pkgBytes) }],
|
|
1085
|
-
bytes,
|
|
1086
|
-
});
|
|
1087
|
-
counts.modules = (counts.modules ?? 0) + 1;
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
// ---- the workspace's own hand-written instructions -------------------------------
|
|
1091
|
-
// ONE source, rendered verbatim into every harness's instruction file. It is registered as a
|
|
1092
|
-
// manifest entry for exactly one reason: `staleness` walks manifest sources, so a file that is
|
|
1093
|
-
// not one can be edited forever without `dt status` ever saying the harness files lag it — and a
|
|
1094
|
-
// silent lag on the file carrying the operator's rules is the worst possible thing to be silent
|
|
1095
|
-
// about. The runtime copy is never read by anything; the manifest ENTRY is the whole point.
|
|
1096
|
-
// uppercase, like the harness files it feeds; the readdir — not existsSync — because on a
|
|
1097
|
-
// case-insensitive filesystem `dreamteamer.md` and `DREAMTEAMER.md` are one path
|
|
1098
|
-
if (fs.readdirSync(root).includes('dreamteamer.md')) fail(`the instructions source is DREAMTEAMER.md, and dreamteamer.md is not read — rename it (git mv dreamteamer.md DREAMTEAMER.md; on a case-insensitive filesystem go through a temporary name), then compile.`);
|
|
1099
|
-
const instructionsPath = path.join(root, INSTRUCTIONS_SOURCE);
|
|
1100
|
-
if (fs.existsSync(instructionsPath)) {
|
|
1101
|
-
const bytes = fs.readFileSync(instructionsPath);
|
|
1102
|
-
refuseManagedMarkers(bytes.toString('utf8'), rel(instructionsPath));
|
|
1103
|
-
entries.set('instructions.md', { sources: [{ path: rel(instructionsPath), hash: sha256(bytes) }], bytes });
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
// ---- unresolved references are compile errors (an agent's declared skills)
|
|
1107
|
-
const skillIds = new Set([...entries.keys()].filter((k) => k.startsWith('skills/')).map((k) => k.split('/')[1]));
|
|
1108
|
-
for (const [rt, e] of entries) {
|
|
1109
|
-
// A SKILL whose frontmatter is not YAML compiled ✔ and was refused one gate later by `check`,
|
|
1110
|
-
// naming the compiled copy under .dreamteamer/ that nobody can edit — found when an installed
|
|
1111
|
-
// package shipped a description holding `: `. Parsed here, where the source path is known.
|
|
1112
|
-
if (/^skills\/[^/]+\/SKILL\.md$/.test(rt)) {
|
|
1113
|
-
const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(e.bytes.toString('utf8'));
|
|
1114
|
-
if (fm) loadSource(fm[1], e.sources[0].path);
|
|
1115
|
-
}
|
|
1116
|
-
if (rt.startsWith('agents/')) {
|
|
1117
|
-
const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(e.bytes.toString('utf8'));
|
|
1118
|
-
const doc = fm ? loadSource(fm[1], e.sources[0].path) : {};
|
|
1119
|
-
for (const sk of doc.skills ?? []) {
|
|
1120
|
-
if (!skillIds.has(String(sk).replace(/^skills\//, ''))) fail(`${rt}: references unknown skill "${sk}"`);
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
if (disabledHits.size < disabled.size) {
|
|
1125
|
-
for (const d of disabled) if (!disabledHits.has(d)) console.warn(`⚠ dreamteamer.disable entry "${d}" matched nothing`);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
// ---- ui-views and command-bindings: validated against the collection each one names ----------
|
|
1129
|
-
// `layout` is not validated: the engine validates a value only where it interprets it, and a layout
|
|
1130
|
-
// id is opaque payload for whichever surface renders it (an unregistered one degrades there). Filter
|
|
1131
|
-
// operators, field names and templates the engine does interpret, so a typo fails here rather than
|
|
1132
|
-
// as a view that draws nothing or a gate that never opens. A view's compiled file is its source plus
|
|
1133
|
-
// `compiled.display`: its display merged over its collection's.
|
|
1134
|
-
const collectionOf = (ref) => {
|
|
1135
|
-
const name = String(ref ?? '').replace(/^collections\//, '');
|
|
1136
|
-
const e = name && entries.get(path.posix.join('collections', `${name}.collection.yaml`));
|
|
1137
|
-
return e ? load(e.bytes.toString('utf8')) : null;
|
|
1138
|
-
};
|
|
1139
|
-
const fieldsKnown = (d) => (d ? fieldsOf(d) : undefined);
|
|
1140
|
-
// a module declaring a peer that is not installed may name a field that peer's overlay adds
|
|
1141
|
-
const lenientFor = (file) => {
|
|
1142
|
-
const owner = sources.map((s) => ({ s, at: rel(s.root) })).filter(({ at }) => !at || file.startsWith(`${at}/`)).sort((a, b) => b.at.length - a.at.length)[0]?.s;
|
|
1143
|
-
return (modulePeers.get(owner?.name) ?? []).some((p) => !descriptorGroups.has(p));
|
|
1144
|
-
};
|
|
1145
|
-
const v1Sources = [];
|
|
1146
|
-
for (const [rt, e] of entries) {
|
|
1147
|
-
if (!rt.startsWith('ui-views/')) continue;
|
|
1148
|
-
const file = e.sources[0].path;
|
|
1149
|
-
const view = loadSource(e.bytes.toString('utf8'), file);
|
|
1150
|
-
const d = view?.collection ? collectionOf(view.collection) : null;
|
|
1151
|
-
const groupFields = (f) => { const t = d && f ? targetsOf(fieldsOf(d)[f]) : null; return Array.isArray(t) && t.length === 1 ? fieldsKnown(collectionOf(`collections/${t[0]}`)) : undefined; };
|
|
1152
|
-
const { errors, warnings, v1 } = viewErrors(view, { file, fields: fieldsKnown(d), groupFields, lenient: lenientFor(file) });
|
|
1153
|
-
if (v1) { v1Sources.push(file); continue; }
|
|
1154
|
-
if (errors.length) fail(errors.join('\n '));
|
|
1155
|
-
for (const w of warnings) console.warn(`⚠ ${w}`);
|
|
1156
|
-
const text = e.bytes.toString('utf8');
|
|
1157
|
-
const provenance = e.overlaidBy ? { module: e.module, overlaid_by: e.overlaidBy } : {};
|
|
1158
|
-
e.bytes = Buffer.from(`${text}${text.endsWith('\n') ? '' : '\n'}${dump({ compiled: { display: viewDisplay(d ? displayOf(d) : {}, view), ...provenance } })}`);
|
|
1159
|
-
}
|
|
1160
|
-
// a command's id is its path under commands/, folders included: `commands/rnd/design.command.md` is
|
|
1161
|
-
// `rnd/design`, typed as `/rnd:design` — the folder is the namespace, as claude-code already reads it
|
|
1162
|
-
const commandIds = new Set([...entries.keys()].filter((k) => k.startsWith('commands/')).map((k) => k.slice('commands/'.length).replace(/\.command\.md$/, '')));
|
|
1163
|
-
for (const [rt, e] of entries) {
|
|
1164
|
-
if (!rt.startsWith('command-bindings/')) continue;
|
|
1165
|
-
const file = e.sources[0].path;
|
|
1166
|
-
const b = loadSource(e.bytes.toString('utf8'), file);
|
|
1167
|
-
if (bindingErrors(b, { file }).v1) { v1Sources.push(file); continue; }
|
|
1168
|
-
const cmd = String(b?.command ?? '').replace(/^commands\//, '');
|
|
1169
|
-
if (!cmd || !commandIds.has(cmd)) fail(`${rt}: references unknown command "${b?.command ?? ''}"`);
|
|
1170
|
-
const coll = String(b?.collection ?? '').replace(/^collections\//, '');
|
|
1171
|
-
if (!coll || !descriptorGroups.has(coll)) fail(`${rt}: references unknown collection "${b?.collection ?? ''}"`);
|
|
1172
|
-
const { errors, warnings } = bindingErrors(b, { file, fields: fieldsKnown(collectionOf(coll)), lenient: lenientFor(file) });
|
|
1173
|
-
if (errors.length) fail(errors.join('\n '));
|
|
1174
|
-
for (const w of warnings) console.warn(`⚠ ${w}`);
|
|
1175
|
-
}
|
|
1176
|
-
if (v1Sources.length) fail(v1Refusal(v1Sources.sort()));
|
|
1177
|
-
|
|
1178
|
-
// ---- extension analysis ------------------------------------------------------------
|
|
1179
|
-
// After the whole compile is assembled and BEFORE any output is replaced: an extension that owns a
|
|
1180
|
-
// source kind judges its entries against the final merged schemas (proofs name artifacts and filter
|
|
1181
|
-
// on fields, so only the assembled workspace can say whether they mean anything). The draft is data
|
|
1182
|
-
// only — no filesystem writer, no Store, no environment VALUES, key names only. An error fails the
|
|
1183
|
-
// compile exactly like a built-in check; notes print after the summary.
|
|
1184
|
-
const notes = [];
|
|
1185
|
-
if (extensions.some((e) => e.analyze)) {
|
|
1186
|
-
const descriptors = new Map();
|
|
1187
|
-
for (const [rt, e] of entries) {
|
|
1188
|
-
if (!rt.startsWith('collections/')) continue;
|
|
1189
|
-
const doc = load(e.bytes.toString('utf8'));
|
|
1190
|
-
if (doc?.name) descriptors.set(doc.name, doc);
|
|
1191
|
-
}
|
|
1192
|
-
const draft = Object.freeze({
|
|
1193
|
-
entries,
|
|
1194
|
-
descriptors,
|
|
1195
|
-
modules: sources.map((s) => ({ id: moduleId(s.name), name: s.name, root: rel(s.root) || '.', channel: s.channel })),
|
|
1196
|
-
declaredVars: [...declaredVars],
|
|
1197
|
-
declaredEnv: [...declaredEnv.keys()],
|
|
1198
|
-
previousManifest: prevManifest,
|
|
1199
|
-
parse: (rt) => loadSource(entries.get(rt).bytes.toString('utf8'), entries.get(rt).sources[0].path),
|
|
1200
|
-
});
|
|
1201
|
-
for (const ext of extensions) {
|
|
1202
|
-
if (!ext.analyze) continue;
|
|
1203
|
-
const out = ext.analyze(draft) ?? {};
|
|
1204
|
-
if (out.errors?.length) fail(out.errors.join('\n '));
|
|
1205
|
-
for (const w of out.warnings ?? []) console.warn(`⚠ ${w}`);
|
|
1206
|
-
notes.push(...(out.notes ?? []));
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1209
|
-
|
|
1210
|
-
// ---- extension code for the harness pass, run BEFORE anything is replaced ------------
|
|
1211
|
-
// A contributed renderer that throws must leave the last good runtime and every harness file
|
|
1212
|
-
// byte-for-byte as they were — so it runs here, on data, and the write pass below only writes.
|
|
1213
|
-
let contributions;
|
|
1214
|
-
try { contributions = renderContributions({ entries, harnesses, version: engineVer, extensions }); }
|
|
1215
|
-
catch (e) { fail(e.message); }
|
|
1216
|
-
|
|
1217
|
-
// ---- materialize .dreamteamer ------------------------------------------------
|
|
1218
|
-
// mkdir the runtime ROOT unconditionally: with zero entries nothing below created it, so the
|
|
1219
|
-
// manifest write at the end failed ENOENT — `init` followed by `compile` in a fresh workspace
|
|
1220
|
-
// crashed on the one path a new user takes first.
|
|
1221
|
-
fs.mkdirSync(RUNTIME, { recursive: true });
|
|
1222
|
-
// clear each kind's folder, plus `system/` — a runtime compiled by a pre-flatten engine has the
|
|
1223
|
-
// whole tree under there, and leaving it would keep stale descriptors on disk beside the fresh
|
|
1224
|
-
// ones. Never `rm -rf` the runtime root itself: it also holds the write lock.
|
|
1225
|
-
// ⚠ DERIVED_KINDS too, not just KINDS. `modules/` is projected rather than staged, so it was not
|
|
1226
|
-
// in this loop and never got cleared — a module that was RENAMED or REMOVED left its old record
|
|
1227
|
-
// behind forever, listing collections that no longer exist. `check` reads those records like any
|
|
1228
|
-
// other, so it surfaced as a dangling reference in a file nobody had touched, twice in one day
|
|
1229
|
-
// (the workspace module's own record after it was renamed, and a domain module's after it was
|
|
1230
|
-
// folded into another). The
|
|
1231
|
-
// runtime is build output; stale build output is the compiler's problem, not the reader's.
|
|
1232
|
-
// ⚠ AND every kind the PREVIOUS compile staged: an extension uninstalled since then leaves its
|
|
1233
|
-
// compiled folder behind otherwise, read by nothing and listed by `dt list` for ever.
|
|
1234
|
-
const prevKinds = (prevManifest?.['source-kinds'] ?? []).map((k) => k.kind).filter((k) => typeof k === 'string' && /^[a-z][a-z0-9-]*$/.test(k));
|
|
1235
|
-
for (const kind of new Set([...kinds, ...DERIVED_KINDS, ...prevKinds])) fs.rmSync(path.join(RUNTIME, kind), { recursive: true, force: true });
|
|
1236
|
-
fs.rmSync(path.join(RUNTIME, 'system'), { recursive: true, force: true });
|
|
1237
|
-
fs.rmSync(path.join(RUNTIME, 'ui'), { recursive: true, force: true });
|
|
1238
|
-
for (const [rt, e] of entries) {
|
|
1239
|
-
const dest = path.join(RUNTIME, rt);
|
|
1240
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
1241
|
-
fs.writeFileSync(dest, e.bytes);
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
// ---- harness adapters (dispatch table lives in harnesses.js) -------------------
|
|
1245
|
-
// What the harness blocks should TELL an agent about where sources live — measured, not assumed.
|
|
1246
|
-
// A workspace still on the nested layout was being handed prose naming the flat one, and that
|
|
1247
|
-
// block is the first thing a session reads.
|
|
1248
|
-
const anyFlat = sources.some((s) => kinds.some((k) => fs.existsSync(path.join(s.root, k))));
|
|
1249
|
-
const anyNested = sources.some((s) => kinds.some((k) => fs.existsSync(path.join(s.root, 'system', k))));
|
|
1250
|
-
const sourceLayout = anyFlat && anyNested ? 'mixed' : anyNested ? 'nested' : 'flat';
|
|
1251
|
-
const { outputs: adapterOutputs, blocks: adapterBlocks, summary: harnessSummary } = runHarnessAdapters({ root, entries, harnesses, prevManifest, sourceLayout, namespaces, version: engineVer, workspaceModule: config.workspace_module ?? '', extensions, kinds: contributed.map((k) => k.kind), contributions });
|
|
1252
|
-
// the root harness files are build output: gitignored, so a bare clone gets them from `compile`
|
|
1253
|
-
{
|
|
1254
|
-
const added = ensureGitignored(root, [...new Set(adapterBlocks)].filter((f) => !f.includes('/')));
|
|
1255
|
-
if (added.length) console.log(`✔ .gitignore now ignores ${added.join(', ')} — generated by compile; \`git rm --cached\` them once if they were tracked`);
|
|
1256
|
-
}
|
|
1257
|
-
|
|
1258
|
-
// ---- provenance manifest ------------------------------------------------------
|
|
1259
|
-
const manifest = {
|
|
1260
|
-
compiled: new Date().toISOString(),
|
|
1261
|
-
host: engineId(),
|
|
1262
|
-
// ⚠ THE VERSION AS A PLAIN SEMVER, beside `host`, for a consumer that has to COMPARE it.
|
|
1263
|
-
//
|
|
1264
|
-
// The VS Code extension pins a HARD MINIMUM engine version and refuses to load below it with
|
|
1265
|
-
// a clear message — a version check rather than a capability handshake, because a handshake
|
|
1266
|
-
// answers "can you do X" one capability at a time and the failure it has to prevent is
|
|
1267
|
-
// structural: an extension built against this wave's exports calling into a 0.17 engine
|
|
1268
|
-
// throws out of `activate()` before the tree view exists, which VS Code renders as its
|
|
1269
|
-
// `viewsWelcome` text — the symptom naming the one thing that is definitely fine.
|
|
1270
|
-
//
|
|
1271
|
-
// `host` cannot serve: it is `name@version` and needs parsing, and a consumer that parses a
|
|
1272
|
-
// display string is a consumer that breaks when the display changes. The other two pin
|
|
1273
|
-
// surfaces are `engineVersion()` (in-process) and `dt --version` (a subprocess).
|
|
1274
|
-
engine: engineVer,
|
|
1275
|
-
// The declared namespace list, carried across the boundary so the RECORD layer can split a
|
|
1276
|
-
// reference without importing the compiler or re-reading package.json — the same reason
|
|
1277
|
-
// `storage.base` is a field instead of a path test. An older runtime has no key here, which
|
|
1278
|
-
// reads as "no namespaces", which is exactly right for a workspace that never declared any.
|
|
1279
|
-
namespaces,
|
|
1280
|
-
// What the record layer needs to judge an exports manifest (cr-dt-004) without reading package.json:
|
|
1281
|
-
// this workspace's package name, and per layer its package name, data folder, the folders read from
|
|
1282
|
-
// it and whether `records:` narrows it — completeness itself is judged at run time, on the disk.
|
|
1283
|
-
package: pkg.name ?? null,
|
|
1284
|
-
data_path: config.data_path ?? 'data',
|
|
1285
|
-
layers: layers.map((l) => ({ name: l.name, root: l.root, data: path.posix.join(l.root, l.dataPath), package: pkgNameAt(path.join(root, l.root)), reads: layerReads.get(l.name) ?? [], narrowed: !!l.records || !!l.skipsSome })),
|
|
1286
|
-
// The extensions this runtime was compiled WITH, and the source kinds they staged — so the next
|
|
1287
|
-
// compile can prune a kind whose extension is gone, and `staleness` can walk a contributed kind
|
|
1288
|
-
// without loading any extension code.
|
|
1289
|
-
...(extensions.length ? { extensions: extensions.map((e) => ({ name: e.name, version: e.version })) } : {}),
|
|
1290
|
-
...(contributed.length ? { 'source-kinds': contributed.map((k) => ({ kind: k.kind, exclude: k.exclude, extension: k.extension })) } : {}),
|
|
1291
|
-
// ⚠ BOTH KEYS FOR ONE RELEASE. `location` is the new spelling; `channel` stays so a reader
|
|
1292
|
-
// that has not moved — `runtime.sourceRoots`'s npm filter, and the extension — keeps working
|
|
1293
|
-
// against a runtime this engine compiled. Removed in 0.20.0.
|
|
1294
|
-
modules: sources.map((s) => ({
|
|
1295
|
-
name: s.name,
|
|
1296
|
-
location: locationOf(s, root),
|
|
1297
|
-
channel: s.channel,
|
|
1298
|
-
root: rel(s.root) || '.',
|
|
1299
|
-
})),
|
|
1300
|
-
ui: uiModules.sort(),
|
|
1301
|
-
// modules refused for their engine floor — staleness does not report their files as new
|
|
1302
|
-
...(refused.size ? { refused: [...refused].map(([name, engine]) => ({ name, engine })) } : {}),
|
|
1303
|
-
// overlays of a peer nobody installed: compiled into nothing, still sources — staleness knows them
|
|
1304
|
-
...(inertSources.length ? { inert: inertSources } : {}),
|
|
1305
|
-
'adapter-outputs': adapterOutputs.sort(),
|
|
1306
|
-
// the root files whose managed BLOCK this compile rewrote — never pruned
|
|
1307
|
-
'adapter-blocks': adapterBlocks.sort(),
|
|
1308
|
-
entries: Object.fromEntries(
|
|
1309
|
-
[...entries].map(([rt, e]) => [rt, { sources: e.sources, hash: sha256(e.bytes) }]) // sources: [{path, hash}] — per-SOURCE hashes power staleness
|
|
1310
|
-
),
|
|
1311
|
-
};
|
|
1312
|
-
fs.writeFileSync(path.join(RUNTIME, 'manifest.yaml'), dump(manifest));
|
|
1313
|
-
|
|
1314
|
-
const summary = kinds.filter((k) => counts[k]).map((k) => `${counts[k]} ${k}${k === 'collections' && mergedCount ? ` (${mergedCount} merged)` : ''}`).join(', ');
|
|
1315
|
-
const sourceLabel = config.workspace_module
|
|
1316
|
-
? `${sources.length} module(s) (workspace_module: ${config.workspace_module})`
|
|
1317
|
-
: `${sources.length - 1} module(s) + workspace`;
|
|
1318
|
-
console.log(`✔ compiled ${summary || 'nothing'} from ${sourceLabel} → .dreamteamer`);
|
|
1319
|
-
for (const line of harnessSummary) console.log(`✔ harness ${line}`);
|
|
1320
|
-
|
|
1321
|
-
for (const n of notes) console.log(n);
|
|
1322
|
-
return 0;
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
/** What the PREVIOUS compile resolved, for the one message that needs to know a namespace has just
|
|
1326
|
-
* disappeared rather than never existing. Read off the runtime on disk, which at this point in
|
|
1327
|
-
* compile is still the old one. */
|
|
1328
|
-
function prevManifestNamespaces(root) {
|
|
1329
|
-
return normalizeNamespaces(readManifest(root)?.namespaces);
|
|
1330
|
-
}
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
// staleness: does any manifest entry's SOURCE differ from what was compiled, or is a
|
|
1334
|
-
// source file missing/new? used by `status` and warned about at every tool entry.
|
|
1335
|
-
export function staleness(root) {
|
|
1336
|
-
const manifest = readManifest(root);
|
|
1337
|
-
if (!manifest) return { compiled: false, stale: [], message: 'no compiled runtime — run `dreamteamer compile`' };
|
|
1338
|
-
const stale = [];
|
|
1339
|
-
for (const [rt, e] of Object.entries(manifest.entries ?? {})) {
|
|
1340
|
-
for (const src of e.sources) {
|
|
1341
|
-
// sources are {path, hash}; tolerate the pre-merge string form
|
|
1342
|
-
const srcPath = typeof src === 'string' ? src : src.path;
|
|
1343
|
-
const srcHash = typeof src === 'string' ? e.hash : src.hash;
|
|
1344
|
-
const p = path.join(root, srcPath);
|
|
1345
|
-
if (!fs.existsSync(p)) stale.push(`${srcPath} (removed)`);
|
|
1346
|
-
else if (sha256(fs.readFileSync(p)) !== srcHash) stale.push(`${srcPath} (changed)`);
|
|
1347
|
-
}
|
|
1348
|
-
}
|
|
1349
|
-
// new source files not present in the manifest — scan winning module roots across
|
|
1350
|
-
// ALL channels (shadowed copies were not compiled, so their files are not "new")
|
|
1351
|
-
const known = new Set([
|
|
1352
|
-
...Object.values(manifest.entries ?? {}).flatMap((e) => e.sources.map((s) => (typeof s === 'string' ? s : s.path))),
|
|
1353
|
-
...(manifest.inert ?? []).map((s) => s.path),
|
|
1354
|
-
]);
|
|
1355
|
-
for (const src of manifest.inert ?? []) {
|
|
1356
|
-
const p = path.join(root, src.path);
|
|
1357
|
-
if (!fs.existsSync(p)) stale.push(`${src.path} (removed)`);
|
|
1358
|
-
else if (sha256(fs.readFileSync(p)) !== src.hash) stale.push(`${src.path} (changed)`);
|
|
1359
|
-
}
|
|
1360
|
-
let pkg = {};
|
|
1361
|
-
try { pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')); } catch { /* no pkg */ }
|
|
1362
|
-
const wm = pkg.dreamteamer?.workspace_module;
|
|
1363
|
-
const found = discoverModules(root, pkg);
|
|
1364
|
-
// ⚠ A DISABLED ENTITY IS NOT A NEW ONE, AND THIS IS THE DIFFERENCE BETWEEN A WARNING AND A LIE.
|
|
1365
|
-
// `compile` skips every source named by an ENTITY-LEVEL `dreamteamer.disable` entry
|
|
1366
|
-
// (`<module>/<entity>`) before `addEntry`, so that file's path never becomes a manifest source.
|
|
1367
|
-
// This scan used to have no knowledge of that filter, so it found the file on disk, found it
|
|
1368
|
-
// absent from `known`, and reported it `(new, uncompiled)` — permanently, because every future
|
|
1369
|
-
// compile skips it exactly the same way. The workspace was told to run a compile that could not
|
|
1370
|
-
// possibly clear the warning, at every tool entry, for as long as the disable stood.
|
|
1371
|
-
//
|
|
1372
|
-
// Two consuming workspaces were sitting in that state when this was found, one of them with a
|
|
1373
|
-
// clean compile seconds earlier. The MODULE-level form (a bare name) needs no handling here:
|
|
1374
|
-
// `discoverModules` drops the whole module, so its files are never walked at all.
|
|
1375
|
-
//
|
|
1376
|
-
// The root itself, when a workspace declares no `workspace-module`, is not a named module, so no
|
|
1377
|
-
// `<module>/<entity>` entry can address its sources — it is walked unfiltered, as before.
|
|
1378
|
-
const disabledEntities = new Set((pkg.dreamteamer?.disable ?? []).filter((d) => typeof d === 'string' && !isPackageEntry(d)));
|
|
1379
|
-
const refused = new Set((manifest.refused ?? []).map((r) => r.name));
|
|
1380
|
-
const roots = [...(wm ? [] : [{ name: null, root }]), ...found.modules.filter((m) => !refused.has(m.name)).map((m) => ({ name: m.name, root: m.root }))];
|
|
1381
|
-
// the kinds the last compile STAGED, read off its manifest — staleness loads no extension code
|
|
1382
|
-
const contributedKinds = (manifest['source-kinds'] ?? []).map((k) => ({ kind: k.kind, exclude: k.exclude ?? [] }));
|
|
1383
|
-
for (const { name: moduleName, root: r } of roots) {
|
|
1384
|
-
for (const kind of [...KINDS, ...contributedKinds.map((k) => k.kind)]) {
|
|
1385
|
-
const dir = kindDir(r, kind);
|
|
1386
|
-
if (!fs.existsSync(dir)) continue;
|
|
1387
|
-
for (const f of walk(dir)) {
|
|
1388
|
-
const rel = path.relative(dir, f).split(path.sep).join('/');
|
|
1389
|
-
if (excludedFromKind(contributedKinds, kind, rel)) continue;
|
|
1390
|
-
// The SAME id derivation `compile` uses, so the two can never disagree about which
|
|
1391
|
-
// file a disable entry names.
|
|
1392
|
-
//
|
|
1393
|
-
// ⚠ AND THE TWO KINDS DERIVE IT DIFFERENTLY. `compile` walks collections recursively,
|
|
1394
|
-
// so a collection's id is its whole relative path (it may carry a namespace segment,
|
|
1395
|
-
// `<ns>/<name>`); every other kind it reads with a flat `readdirSync`, so the entity
|
|
1396
|
-
// is the TOP-LEVEL entry and a folder-shaped one — a skill is a directory holding
|
|
1397
|
-
// `SKILL.md` — is named by the folder alone. Matching the full path for those meant a
|
|
1398
|
-
// disabled SKILL still counted as stale, because `working-with-tasks/SKILL.md` is not
|
|
1399
|
-
// `working-with-tasks`. Caught against a real workspace whose disable list held one
|
|
1400
|
-
// of each: the ui-view cleared and the skill did not.
|
|
1401
|
-
if (moduleName) {
|
|
1402
|
-
const relEntity = kind === 'collections' ? rel : rel.split('/')[0];
|
|
1403
|
-
const entityId = relEntity.replace(/\.[^.]+\.(yaml|md|json)$/, '');
|
|
1404
|
-
if (disabledEntities.has(`${kind}/${entityId}`)) continue;
|
|
1405
|
-
}
|
|
1406
|
-
const relPath = toPosix(path.relative(root, f));
|
|
1407
|
-
if (!known.has(relPath)) stale.push(`${relPath} (new, uncompiled)`);
|
|
1408
|
-
}
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
// ⚠ `dreamteamer.md` is a compile source that is NOT under a KIND directory, so the walk above
|
|
1412
|
-
// cannot reach it — and its CREATION is the one moment that matters most: day one in an adopting
|
|
1413
|
-
// workspace, when no harness file carries an instructions block yet. Every later EDIT was already
|
|
1414
|
-
// caught by the manifest-source walk at the top of this function; only the first write was silent,
|
|
1415
|
-
// and it reported `.dreamteamer is fresh` while the rules reached no agent at all.
|
|
1416
|
-
if (fs.existsSync(path.join(root, INSTRUCTIONS_SOURCE)) && !known.has(INSTRUCTIONS_SOURCE)) {
|
|
1417
|
-
stale.push(`${INSTRUCTIONS_SOURCE} (new, uncompiled)`);
|
|
1418
|
-
}
|
|
1419
|
-
return { compiled: true, stale, manifest };
|
|
1420
|
-
}
|
|
1421
|
-
|
|
1422
|
-
export function warnIfStale(root) {
|
|
1423
|
-
const s = staleness(root);
|
|
1424
|
-
if (!s.compiled) console.warn(`⚠ ${s.message}`);
|
|
1425
|
-
else if (s.stale.length) console.warn(`⚠ .dreamteamer is stale (${s.stale.length} source(s) differ) — run \`dreamteamer compile\``);
|
|
1426
|
-
return s;
|
|
1427
|
-
}
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
/**
|
|
1434
|
-
* A `storage.under` that is REMOVED or CHANGED while records still sit under the old declaration is
|
|
1435
|
-
* refused. The compiled descriptor is the only thing that knows where those records are: the moment it
|
|
1436
|
-
* is rewritten, listing, check and relocate all read the new layout and the old child folders fall out
|
|
1437
|
-
* of every walk. So the runtime about to be replaced is read first, and a transition with records in
|
|
1438
|
-
* the way names the safe order: `relocate --to-root` under the OLD declaration, then compile, then
|
|
1439
|
-
* `relocate`. Adding `under` moves nothing out of sight and is not refused.
|
|
1440
|
-
*/
|
|
1441
|
-
function refusePlacementTransitions(root, compiledColls) {
|
|
1442
|
-
// a runtime an older engine wrote has no `compiled` blocks to compare against; the converter carries
|
|
1443
|
-
// placement over unchanged, so there is no transition to refuse
|
|
1444
|
-
let previous;
|
|
1445
|
-
try { previous = loadCompiledDescriptors(root); } catch (e) { if (e.message === STALE_RUNTIME) return; throw e; }
|
|
1446
|
-
if (!previous) return;
|
|
1447
|
-
for (const [name, c] of compiledColls) {
|
|
1448
|
-
const prev = previous.get(name);
|
|
1449
|
-
const was = storageOf(prev).under;
|
|
1450
|
-
if (!was?.collection || !was.subfolder) continue;
|
|
1451
|
-
const parent = previous.get(was.collection);
|
|
1452
|
-
if (!parent) continue;
|
|
1453
|
-
const now = c.storage.under ? { ...c.storage.under, collection: c.compiled.under_collection } : null;
|
|
1454
|
-
const newParentPath = now ? compiledColls.get(now.collection)?.storage.path : null;
|
|
1455
|
-
const parentPath = storageOf(parent).path;
|
|
1456
|
-
const same = now && now.collection === was.collection && now.subfolder === was.subfolder && newParentPath === parentPath;
|
|
1457
|
-
if (same) continue;
|
|
1458
|
-
let n = 0;
|
|
1459
|
-
for (const r of placedRecords(prev, path.join(root, storageOf(prev).path), path.join(root, parentPath))) if (r.parentId !== null) n++;
|
|
1460
|
-
if (!n) continue;
|
|
1461
|
-
const what = !now ? 'storage.under was removed'
|
|
1462
|
-
: now.collection !== was.collection || now.subfolder !== was.subfolder ? `storage.under changed (${was.subfolder} → ${now.subfolder})`
|
|
1463
|
-
: `${was.collection}'s storage.path changed (${parentPath} → ${newParentPath})`;
|
|
1464
|
-
fail(`collection "${name}": ${what}, but ${n} ${name} record(s) still sit inside ${was.collection} folders (${parentPath}/<id>/${was.subfolder}/) — compiling would stop every reader seeing them. First move them out under the CURRENT declaration: dreamteamer relocate ${name} --to-root, then compile${now ? `, then dreamteamer relocate ${name} to place them again` : ''}.`);
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
// a bad source THROWS (review finding 8: process.exit killed --watch on the first typo
|
|
1469
|
-
// and made server-triggered recompiles impossible). the CLI boundary prints and exits.
|
|
1470
|
-
export class CompileError extends Error {}
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
// ⚠ A MANAGED MARKER INSIDE `dreamteamer.md` IS A REFUSAL, not something to escape around.
|
|
1474
|
-
// The file is rendered VERBATIM into a managed block, and `writeBlock` finds that block by the FIRST
|
|
1475
|
-
// occurrence of its begin marker anywhere in the file — so a marker quoted inside the rendered text
|
|
1476
|
-
// is found before the real delimiter. Both directions were measured on a fixture:
|
|
1477
|
-
//
|
|
1478
|
-
// - quoting the ORIENTATION pair: the orientation pass rewrites the quoted region, the instructions
|
|
1479
|
-
// pass that runs immediately after restores it from source, and the real orientation block is
|
|
1480
|
-
// never touched again. It silently keeps describing the schema of the day it was written, while
|
|
1481
|
-
// `compile` exits 0 and `status` reports the runtime fresh.
|
|
1482
|
-
// - quoting the INSTRUCTIONS end marker: the block is closed at the quote and a second end line is
|
|
1483
|
-
// appended, so all three committed root files grow by ~40 bytes and one duplicated line per
|
|
1484
|
-
// compile, without ever reaching a fixed point.
|
|
1485
|
-
//
|
|
1486
|
-
// Escaping the markers on the way out is the alternative, and it is not one: the whole promise of
|
|
1487
|
-
// this file is that what was written is what every agent reads, and an escaped marker is not that.
|
|
1488
|
-
// A rule ABOUT the block describes it instead of quoting it.
|
|
1489
|
-
/** The one hand-written root source. Named once: `compile` reads it and `staleness` looks for it. */
|
|
1490
|
-
export const INSTRUCTIONS_SOURCE = 'DREAMTEAMER.md';
|
|
1491
|
-
|
|
1492
|
-
const MANAGED_MARKERS = [
|
|
1493
|
-
['the orientation block', BEGIN],
|
|
1494
|
-
['the orientation block', END],
|
|
1495
|
-
['the instructions block', INSTRUCTIONS_BEGIN],
|
|
1496
|
-
['the instructions block', INSTRUCTIONS_END],
|
|
1497
|
-
];
|
|
1498
|
-
|
|
1499
|
-
function refuseManagedMarkers(text, srcPath) {
|
|
1500
|
-
const lines = text.split('\n');
|
|
1501
|
-
for (const [i, line] of lines.entries()) {
|
|
1502
|
-
for (const [which, marker] of MANAGED_MARKERS) {
|
|
1503
|
-
if (!line.includes(marker)) continue;
|
|
1504
|
-
fail(`${srcPath}:${i + 1}: contains the managed marker ${marker}, which delimits ${which} in the harness files. This source is rendered verbatim into that block, so the quoted copy is found before the real delimiter and the block is rewritten around the wrong place. Describe the block instead of quoting its marker.`);
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1508
|
-
|
|
1509
|
-
function fail(msg) {
|
|
1510
|
-
throw new CompileError(`compile error: ${msg}`);
|
|
1511
|
-
}
|