@software-dlc/cli 0.157.2
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/CHANGELOG.md +11 -0
- package/LICENSE +105 -0
- package/README.md +31 -0
- package/dist/checkout.d.ts +43 -0
- package/dist/checkout.d.ts.map +1 -0
- package/dist/checkout.js +92 -0
- package/dist/checkout.js.map +1 -0
- package/dist/cli-arguments.d.ts +13 -0
- package/dist/cli-arguments.d.ts.map +1 -0
- package/dist/cli-arguments.js +67 -0
- package/dist/cli-arguments.js.map +1 -0
- package/dist/cli-branch-history.d.ts +48 -0
- package/dist/cli-branch-history.d.ts.map +1 -0
- package/dist/cli-branch-history.js +319 -0
- package/dist/cli-branch-history.js.map +1 -0
- package/dist/cli-branches.d.ts +22 -0
- package/dist/cli-branches.d.ts.map +1 -0
- package/dist/cli-branches.js +59 -0
- package/dist/cli-branches.js.map +1 -0
- package/dist/cli-deploy.d.ts +14 -0
- package/dist/cli-deploy.d.ts.map +1 -0
- package/dist/cli-deploy.js +164 -0
- package/dist/cli-deploy.js.map +1 -0
- package/dist/cli-health.d.ts +3 -0
- package/dist/cli-health.d.ts.map +1 -0
- package/dist/cli-health.js +73 -0
- package/dist/cli-health.js.map +1 -0
- package/dist/cli-help.d.ts +21 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +176 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/cli-login.d.ts +76 -0
- package/dist/cli-login.d.ts.map +1 -0
- package/dist/cli-login.js +634 -0
- package/dist/cli-login.js.map +1 -0
- package/dist/cli-operation.d.ts +2 -0
- package/dist/cli-operation.d.ts.map +1 -0
- package/dist/cli-operation.js +66 -0
- package/dist/cli-operation.js.map +1 -0
- package/dist/cli-org.d.ts +12 -0
- package/dist/cli-org.d.ts.map +1 -0
- package/dist/cli-org.js +218 -0
- package/dist/cli-org.js.map +1 -0
- package/dist/cli-rebuild.d.ts +20 -0
- package/dist/cli-rebuild.d.ts.map +1 -0
- package/dist/cli-rebuild.js +29 -0
- package/dist/cli-rebuild.js.map +1 -0
- package/dist/cli-reset.d.ts +27 -0
- package/dist/cli-reset.d.ts.map +1 -0
- package/dist/cli-reset.js +44 -0
- package/dist/cli-reset.js.map +1 -0
- package/dist/cli-snapshot.d.ts +398 -0
- package/dist/cli-snapshot.d.ts.map +1 -0
- package/dist/cli-snapshot.js +45 -0
- package/dist/cli-snapshot.js.map +1 -0
- package/dist/cli-task-context.d.ts +3 -0
- package/dist/cli-task-context.d.ts.map +1 -0
- package/dist/cli-task-context.js +112 -0
- package/dist/cli-task-context.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +1004 -0
- package/dist/cli.js.map +1 -0
- package/dist/graph-packages-lock.d.ts +169 -0
- package/dist/graph-packages-lock.d.ts.map +1 -0
- package/dist/graph-packages-lock.js +503 -0
- package/dist/graph-packages-lock.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/local/aggregate-preflight.d.ts +12 -0
- package/dist/local/aggregate-preflight.d.ts.map +1 -0
- package/dist/local/aggregate-preflight.js +22 -0
- package/dist/local/aggregate-preflight.js.map +1 -0
- package/dist/local/allow-mcp.d.ts +77 -0
- package/dist/local/allow-mcp.d.ts.map +1 -0
- package/dist/local/allow-mcp.js +394 -0
- package/dist/local/allow-mcp.js.map +1 -0
- package/dist/local/api-client.d.ts +15 -0
- package/dist/local/api-client.d.ts.map +1 -0
- package/dist/local/api-client.js +87 -0
- package/dist/local/api-client.js.map +1 -0
- package/dist/local/app-contract-readers.d.ts +229 -0
- package/dist/local/app-contract-readers.d.ts.map +1 -0
- package/dist/local/app-contract-readers.js +450 -0
- package/dist/local/app-contract-readers.js.map +1 -0
- package/dist/local/app-org-reader.d.ts +21 -0
- package/dist/local/app-org-reader.d.ts.map +1 -0
- package/dist/local/app-org-reader.js +66 -0
- package/dist/local/app-org-reader.js.map +1 -0
- package/dist/local/app-shell-readers.d.ts +96 -0
- package/dist/local/app-shell-readers.d.ts.map +1 -0
- package/dist/local/app-shell-readers.js +381 -0
- package/dist/local/app-shell-readers.js.map +1 -0
- package/dist/local/app-tasks-read.d.ts +202 -0
- package/dist/local/app-tasks-read.d.ts.map +1 -0
- package/dist/local/app-tasks-read.js +290 -0
- package/dist/local/app-tasks-read.js.map +1 -0
- package/dist/local/app-worktrees.d.ts +69 -0
- package/dist/local/app-worktrees.d.ts.map +1 -0
- package/dist/local/app-worktrees.js +554 -0
- package/dist/local/app-worktrees.js.map +1 -0
- package/dist/local/base-sync-manifest.d.ts +12 -0
- package/dist/local/base-sync-manifest.d.ts.map +1 -0
- package/dist/local/base-sync-manifest.js +57 -0
- package/dist/local/base-sync-manifest.js.map +1 -0
- package/dist/local/blast-radius.d.ts +191 -0
- package/dist/local/blast-radius.d.ts.map +1 -0
- package/dist/local/blast-radius.js +585 -0
- package/dist/local/blast-radius.js.map +1 -0
- package/dist/local/canonical.d.ts +2 -0
- package/dist/local/canonical.d.ts.map +1 -0
- package/dist/local/canonical.js +2 -0
- package/dist/local/canonical.js.map +1 -0
- package/dist/local/config.d.ts +22 -0
- package/dist/local/config.d.ts.map +1 -0
- package/dist/local/config.js +57 -0
- package/dist/local/config.js.map +1 -0
- package/dist/local/document-commands.d.ts +163 -0
- package/dist/local/document-commands.d.ts.map +1 -0
- package/dist/local/document-commands.js +620 -0
- package/dist/local/document-commands.js.map +1 -0
- package/dist/local/document-embeds.d.ts +21 -0
- package/dist/local/document-embeds.d.ts.map +1 -0
- package/dist/local/document-embeds.js +38 -0
- package/dist/local/document-embeds.js.map +1 -0
- package/dist/local/environment-context.d.ts +39 -0
- package/dist/local/environment-context.d.ts.map +1 -0
- package/dist/local/environment-context.js +193 -0
- package/dist/local/environment-context.js.map +1 -0
- package/dist/local/environment-exclude.d.ts +7 -0
- package/dist/local/environment-exclude.d.ts.map +1 -0
- package/dist/local/environment-exclude.js +82 -0
- package/dist/local/environment-exclude.js.map +1 -0
- package/dist/local/environment-sidecar.d.ts +126 -0
- package/dist/local/environment-sidecar.d.ts.map +1 -0
- package/dist/local/environment-sidecar.js +442 -0
- package/dist/local/environment-sidecar.js.map +1 -0
- package/dist/local/environment-switch.d.ts +22 -0
- package/dist/local/environment-switch.d.ts.map +1 -0
- package/dist/local/environment-switch.js +385 -0
- package/dist/local/environment-switch.js.map +1 -0
- package/dist/local/exact-remote-projection.d.ts +17 -0
- package/dist/local/exact-remote-projection.d.ts.map +1 -0
- package/dist/local/exact-remote-projection.js +53 -0
- package/dist/local/exact-remote-projection.js.map +1 -0
- package/dist/local/experimental/path-object-store.d.ts +66 -0
- package/dist/local/experimental/path-object-store.d.ts.map +1 -0
- package/dist/local/experimental/path-object-store.js +135 -0
- package/dist/local/experimental/path-object-store.js.map +1 -0
- package/dist/local/external-worktree-binding.d.ts +21 -0
- package/dist/local/external-worktree-binding.d.ts.map +1 -0
- package/dist/local/external-worktree-binding.js +56 -0
- package/dist/local/external-worktree-binding.js.map +1 -0
- package/dist/local/folder-members.d.ts +34 -0
- package/dist/local/folder-members.d.ts.map +1 -0
- package/dist/local/folder-members.js +168 -0
- package/dist/local/folder-members.js.map +1 -0
- package/dist/local/git-ref-authority.d.ts +11 -0
- package/dist/local/git-ref-authority.d.ts.map +1 -0
- package/dist/local/git-ref-authority.js +76 -0
- package/dist/local/git-ref-authority.js.map +1 -0
- package/dist/local/git.d.ts +88 -0
- package/dist/local/git.d.ts.map +1 -0
- package/dist/local/git.js +413 -0
- package/dist/local/git.js.map +1 -0
- package/dist/local/graph-read.d.ts +168 -0
- package/dist/local/graph-read.d.ts.map +1 -0
- package/dist/local/graph-read.js +360 -0
- package/dist/local/graph-read.js.map +1 -0
- package/dist/local/graph-sync.d.ts +39 -0
- package/dist/local/graph-sync.d.ts.map +1 -0
- package/dist/local/graph-sync.js +186 -0
- package/dist/local/graph-sync.js.map +1 -0
- package/dist/local/guide-commands.d.ts +79 -0
- package/dist/local/guide-commands.d.ts.map +1 -0
- package/dist/local/guide-commands.js +247 -0
- package/dist/local/guide-commands.js.map +1 -0
- package/dist/local/health-files.d.ts +24 -0
- package/dist/local/health-files.d.ts.map +1 -0
- package/dist/local/health-files.js +133 -0
- package/dist/local/health-files.js.map +1 -0
- package/dist/local/health-inspection.d.ts +12 -0
- package/dist/local/health-inspection.d.ts.map +1 -0
- package/dist/local/health-inspection.js +407 -0
- package/dist/local/health-inspection.js.map +1 -0
- package/dist/local/health-policy.d.ts +11 -0
- package/dist/local/health-policy.d.ts.map +1 -0
- package/dist/local/health-policy.js +257 -0
- package/dist/local/health-policy.js.map +1 -0
- package/dist/local/health-projection.d.ts +14 -0
- package/dist/local/health-projection.d.ts.map +1 -0
- package/dist/local/health-projection.js +102 -0
- package/dist/local/health-projection.js.map +1 -0
- package/dist/local/health-schema.d.ts +338 -0
- package/dist/local/health-schema.d.ts.map +1 -0
- package/dist/local/health-schema.js +213 -0
- package/dist/local/health-schema.js.map +1 -0
- package/dist/local/health-store.d.ts +61 -0
- package/dist/local/health-store.d.ts.map +1 -0
- package/dist/local/health-store.js +218 -0
- package/dist/local/health-store.js.map +1 -0
- package/dist/local/index.d.ts +66 -0
- package/dist/local/index.d.ts.map +1 -0
- package/dist/local/index.js +66 -0
- package/dist/local/index.js.map +1 -0
- package/dist/local/journey-commands.d.ts +65 -0
- package/dist/local/journey-commands.d.ts.map +1 -0
- package/dist/local/journey-commands.js +138 -0
- package/dist/local/journey-commands.js.map +1 -0
- package/dist/local/local-org-store.d.ts +46 -0
- package/dist/local/local-org-store.d.ts.map +1 -0
- package/dist/local/local-org-store.js +132 -0
- package/dist/local/local-org-store.js.map +1 -0
- package/dist/local/local-org.d.ts +389 -0
- package/dist/local/local-org.d.ts.map +1 -0
- package/dist/local/local-org.js +855 -0
- package/dist/local/local-org.js.map +1 -0
- package/dist/local/media-upload.d.ts +5 -0
- package/dist/local/media-upload.d.ts.map +1 -0
- package/dist/local/media-upload.js +41 -0
- package/dist/local/media-upload.js.map +1 -0
- package/dist/local/operation.d.ts +155 -0
- package/dist/local/operation.d.ts.map +1 -0
- package/dist/local/operation.js +340 -0
- package/dist/local/operation.js.map +1 -0
- package/dist/local/ownership-reader-schema.d.ts +117 -0
- package/dist/local/ownership-reader-schema.d.ts.map +1 -0
- package/dist/local/ownership-reader-schema.js +105 -0
- package/dist/local/ownership-reader-schema.js.map +1 -0
- package/dist/local/ownership-reader-worker.d.ts +2 -0
- package/dist/local/ownership-reader-worker.d.ts.map +1 -0
- package/dist/local/ownership-reader-worker.js +341 -0
- package/dist/local/ownership-reader-worker.js.map +1 -0
- package/dist/local/ownership-reader.d.ts +10 -0
- package/dist/local/ownership-reader.d.ts.map +1 -0
- package/dist/local/ownership-reader.js +93 -0
- package/dist/local/ownership-reader.js.map +1 -0
- package/dist/local/package-uses-check.d.ts +33 -0
- package/dist/local/package-uses-check.d.ts.map +1 -0
- package/dist/local/package-uses-check.js +62 -0
- package/dist/local/package-uses-check.js.map +1 -0
- package/dist/local/pending-recovery.d.ts +22 -0
- package/dist/local/pending-recovery.d.ts.map +1 -0
- package/dist/local/pending-recovery.js +171 -0
- package/dist/local/pending-recovery.js.map +1 -0
- package/dist/local/portable-commit-store.d.ts +28 -0
- package/dist/local/portable-commit-store.d.ts.map +1 -0
- package/dist/local/portable-commit-store.js +187 -0
- package/dist/local/portable-commit-store.js.map +1 -0
- package/dist/local/portable-commit.d.ts +109 -0
- package/dist/local/portable-commit.d.ts.map +1 -0
- package/dist/local/portable-commit.js +209 -0
- package/dist/local/portable-commit.js.map +1 -0
- package/dist/local/portable-remote.d.ts +432 -0
- package/dist/local/portable-remote.d.ts.map +1 -0
- package/dist/local/portable-remote.js +280 -0
- package/dist/local/portable-remote.js.map +1 -0
- package/dist/local/project-deleted.d.ts +4 -0
- package/dist/local/project-deleted.d.ts.map +1 -0
- package/dist/local/project-deleted.js +13 -0
- package/dist/local/project-deleted.js.map +1 -0
- package/dist/local/projection.d.ts +166 -0
- package/dist/local/projection.d.ts.map +1 -0
- package/dist/local/projection.js +709 -0
- package/dist/local/projection.js.map +1 -0
- package/dist/local/read-operation.d.ts +3 -0
- package/dist/local/read-operation.d.ts.map +1 -0
- package/dist/local/read-operation.js +19 -0
- package/dist/local/read-operation.js.map +1 -0
- package/dist/local/rebuild.d.ts +11 -0
- package/dist/local/rebuild.d.ts.map +1 -0
- package/dist/local/rebuild.js +42 -0
- package/dist/local/rebuild.js.map +1 -0
- package/dist/local/remote-base.d.ts +25 -0
- package/dist/local/remote-base.d.ts.map +1 -0
- package/dist/local/remote-base.js +68 -0
- package/dist/local/remote-base.js.map +1 -0
- package/dist/local/save-layout-worker.d.ts +19 -0
- package/dist/local/save-layout-worker.d.ts.map +1 -0
- package/dist/local/save-layout-worker.js +28 -0
- package/dist/local/save-layout-worker.js.map +1 -0
- package/dist/local/save-layout.d.ts +84 -0
- package/dist/local/save-layout.d.ts.map +1 -0
- package/dist/local/save-layout.js +221 -0
- package/dist/local/save-layout.js.map +1 -0
- package/dist/local/scope-impact.d.ts +31 -0
- package/dist/local/scope-impact.d.ts.map +1 -0
- package/dist/local/scope-impact.js +32 -0
- package/dist/local/scope-impact.js.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts +2 -0
- package/dist/local/source-evidence/filesystem-worker.d.ts.map +1 -0
- package/dist/local/source-evidence/filesystem-worker.js +139 -0
- package/dist/local/source-evidence/filesystem-worker.js.map +1 -0
- package/dist/local/source-evidence/processes.d.ts +20 -0
- package/dist/local/source-evidence/processes.d.ts.map +1 -0
- package/dist/local/source-evidence/processes.js +133 -0
- package/dist/local/source-evidence/processes.js.map +1 -0
- package/dist/local/source-evidence/protocol.d.ts +52 -0
- package/dist/local/source-evidence/protocol.d.ts.map +1 -0
- package/dist/local/source-evidence/protocol.js +72 -0
- package/dist/local/source-evidence/protocol.js.map +1 -0
- package/dist/local/source-evidence/reader.d.ts +14 -0
- package/dist/local/source-evidence/reader.d.ts.map +1 -0
- package/dist/local/source-evidence/reader.js +308 -0
- package/dist/local/source-evidence/reader.js.map +1 -0
- package/dist/local/source-evidence/schema.d.ts +2504 -0
- package/dist/local/source-evidence/schema.d.ts.map +1 -0
- package/dist/local/source-evidence/schema.js +99 -0
- package/dist/local/source-evidence/schema.js.map +1 -0
- package/dist/local/source-policy/loader.d.ts +29 -0
- package/dist/local/source-policy/loader.d.ts.map +1 -0
- package/dist/local/source-policy/loader.js +209 -0
- package/dist/local/source-policy/loader.js.map +1 -0
- package/dist/local/source-policy/process.d.ts +7 -0
- package/dist/local/source-policy/process.d.ts.map +1 -0
- package/dist/local/source-policy/process.js +53 -0
- package/dist/local/source-policy/process.js.map +1 -0
- package/dist/local/source-policy/protocol.d.ts +27 -0
- package/dist/local/source-policy/protocol.d.ts.map +1 -0
- package/dist/local/source-policy/protocol.js +48 -0
- package/dist/local/source-policy/protocol.js.map +1 -0
- package/dist/local/source-policy/worker.d.ts +2 -0
- package/dist/local/source-policy/worker.d.ts.map +1 -0
- package/dist/local/source-policy/worker.js +100 -0
- package/dist/local/source-policy/worker.js.map +1 -0
- package/dist/local/state-directory.d.ts +17 -0
- package/dist/local/state-directory.d.ts.map +1 -0
- package/dist/local/state-directory.js +68 -0
- package/dist/local/state-directory.js.map +1 -0
- package/dist/local/store-database.d.ts +13 -0
- package/dist/local/store-database.d.ts.map +1 -0
- package/dist/local/store-database.js +187 -0
- package/dist/local/store-database.js.map +1 -0
- package/dist/local/store.d.ts +181 -0
- package/dist/local/store.d.ts.map +1 -0
- package/dist/local/store.js +585 -0
- package/dist/local/store.js.map +1 -0
- package/dist/local/sync.d.ts +47 -0
- package/dist/local/sync.d.ts.map +1 -0
- package/dist/local/sync.js +518 -0
- package/dist/local/sync.js.map +1 -0
- package/dist/local/task-context-inspection.d.ts +23 -0
- package/dist/local/task-context-inspection.d.ts.map +1 -0
- package/dist/local/task-context-inspection.js +165 -0
- package/dist/local/task-context-inspection.js.map +1 -0
- package/dist/local/task-context-observations.d.ts +9553 -0
- package/dist/local/task-context-observations.d.ts.map +1 -0
- package/dist/local/task-context-observations.js +232 -0
- package/dist/local/task-context-observations.js.map +1 -0
- package/dist/local/task-context-provider.d.ts +18 -0
- package/dist/local/task-context-provider.d.ts.map +1 -0
- package/dist/local/task-context-provider.js +231 -0
- package/dist/local/task-context-provider.js.map +1 -0
- package/dist/local/task-context-schema.d.ts +847 -0
- package/dist/local/task-context-schema.d.ts.map +1 -0
- package/dist/local/task-context-schema.js +305 -0
- package/dist/local/task-context-schema.js.map +1 -0
- package/dist/local/task-context-source.d.ts +16 -0
- package/dist/local/task-context-source.d.ts.map +1 -0
- package/dist/local/task-context-source.js +45 -0
- package/dist/local/task-context-source.js.map +1 -0
- package/dist/local/task-context.d.ts +14 -0
- package/dist/local/task-context.d.ts.map +1 -0
- package/dist/local/task-context.js +570 -0
- package/dist/local/task-context.js.map +1 -0
- package/dist/local/test-commands.d.ts +71 -0
- package/dist/local/test-commands.d.ts.map +1 -0
- package/dist/local/test-commands.js +292 -0
- package/dist/local/test-commands.js.map +1 -0
- package/dist/local/tree-save.d.ts +117 -0
- package/dist/local/tree-save.d.ts.map +1 -0
- package/dist/local/tree-save.js +615 -0
- package/dist/local/tree-save.js.map +1 -0
- package/dist/local/variants.d.ts +125 -0
- package/dist/local/variants.d.ts.map +1 -0
- package/dist/local/variants.js +267 -0
- package/dist/local/variants.js.map +1 -0
- package/dist/local/workspace-admission.d.ts +61 -0
- package/dist/local/workspace-admission.d.ts.map +1 -0
- package/dist/local/workspace-admission.js +112 -0
- package/dist/local/workspace-admission.js.map +1 -0
- package/dist/local/workspace-authority-guard.d.ts +18 -0
- package/dist/local/workspace-authority-guard.d.ts.map +1 -0
- package/dist/local/workspace-authority-guard.js +69 -0
- package/dist/local/workspace-authority-guard.js.map +1 -0
- package/dist/local/workspace-authority.d.ts +33 -0
- package/dist/local/workspace-authority.d.ts.map +1 -0
- package/dist/local/workspace-authority.js +33 -0
- package/dist/local/workspace-authority.js.map +1 -0
- package/dist/local/workspace-branch-runtime.d.ts +61 -0
- package/dist/local/workspace-branch-runtime.d.ts.map +1 -0
- package/dist/local/workspace-branch-runtime.js +216 -0
- package/dist/local/workspace-branch-runtime.js.map +1 -0
- package/dist/local/workspace-built-content.d.ts +137 -0
- package/dist/local/workspace-built-content.d.ts.map +1 -0
- package/dist/local/workspace-built-content.js +393 -0
- package/dist/local/workspace-built-content.js.map +1 -0
- package/dist/local/workspace-claim-status-read.d.ts +53 -0
- package/dist/local/workspace-claim-status-read.d.ts.map +1 -0
- package/dist/local/workspace-claim-status-read.js +118 -0
- package/dist/local/workspace-claim-status-read.js.map +1 -0
- package/dist/local/workspace-claim-status.d.ts +172 -0
- package/dist/local/workspace-claim-status.d.ts.map +1 -0
- package/dist/local/workspace-claim-status.js +721 -0
- package/dist/local/workspace-claim-status.js.map +1 -0
- package/dist/local/workspace-claim-views.d.ts +45 -0
- package/dist/local/workspace-claim-views.d.ts.map +1 -0
- package/dist/local/workspace-claim-views.js +45 -0
- package/dist/local/workspace-claim-views.js.map +1 -0
- package/dist/local/workspace-cli.d.ts +46 -0
- package/dist/local/workspace-cli.d.ts.map +1 -0
- package/dist/local/workspace-cli.js +1524 -0
- package/dist/local/workspace-cli.js.map +1 -0
- package/dist/local/workspace-commit-resolver.d.ts +19 -0
- package/dist/local/workspace-commit-resolver.d.ts.map +1 -0
- package/dist/local/workspace-commit-resolver.js +47 -0
- package/dist/local/workspace-commit-resolver.js.map +1 -0
- package/dist/local/workspace-decision-store.d.ts +184 -0
- package/dist/local/workspace-decision-store.d.ts.map +1 -0
- package/dist/local/workspace-decision-store.js +510 -0
- package/dist/local/workspace-decision-store.js.map +1 -0
- package/dist/local/workspace-environment-runtime.d.ts +107 -0
- package/dist/local/workspace-environment-runtime.d.ts.map +1 -0
- package/dist/local/workspace-environment-runtime.js +135 -0
- package/dist/local/workspace-environment-runtime.js.map +1 -0
- package/dist/local/workspace-evidence-drop.d.ts +21 -0
- package/dist/local/workspace-evidence-drop.d.ts.map +1 -0
- package/dist/local/workspace-evidence-drop.js +58 -0
- package/dist/local/workspace-evidence-drop.js.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts +20 -0
- package/dist/local/workspace-evidence-sign-tool.d.ts.map +1 -0
- package/dist/local/workspace-evidence-sign-tool.js +85 -0
- package/dist/local/workspace-evidence-sign-tool.js.map +1 -0
- package/dist/local/workspace-evidence-status.d.ts +89 -0
- package/dist/local/workspace-evidence-status.d.ts.map +1 -0
- package/dist/local/workspace-evidence-status.js +141 -0
- package/dist/local/workspace-evidence-status.js.map +1 -0
- package/dist/local/workspace-evidence.d.ts +145 -0
- package/dist/local/workspace-evidence.d.ts.map +1 -0
- package/dist/local/workspace-evidence.js +347 -0
- package/dist/local/workspace-evidence.js.map +1 -0
- package/dist/local/workspace-graph-store.d.ts +32 -0
- package/dist/local/workspace-graph-store.d.ts.map +1 -0
- package/dist/local/workspace-graph-store.js +249 -0
- package/dist/local/workspace-graph-store.js.map +1 -0
- package/dist/local/workspace-handoff.d.ts +32 -0
- package/dist/local/workspace-handoff.d.ts.map +1 -0
- package/dist/local/workspace-handoff.js +144 -0
- package/dist/local/workspace-handoff.js.map +1 -0
- package/dist/local/workspace-history-journal.d.ts +70 -0
- package/dist/local/workspace-history-journal.d.ts.map +1 -0
- package/dist/local/workspace-history-journal.js +131 -0
- package/dist/local/workspace-history-journal.js.map +1 -0
- package/dist/local/workspace-history-store.d.ts +98 -0
- package/dist/local/workspace-history-store.d.ts.map +1 -0
- package/dist/local/workspace-history-store.js +632 -0
- package/dist/local/workspace-history-store.js.map +1 -0
- package/dist/local/workspace-history-types.d.ts +307 -0
- package/dist/local/workspace-history-types.d.ts.map +1 -0
- package/dist/local/workspace-history-types.js +2 -0
- package/dist/local/workspace-history-types.js.map +1 -0
- package/dist/local/workspace-integration-runtime.d.ts +48 -0
- package/dist/local/workspace-integration-runtime.d.ts.map +1 -0
- package/dist/local/workspace-integration-runtime.js +419 -0
- package/dist/local/workspace-integration-runtime.js.map +1 -0
- package/dist/local/workspace-lock.d.ts +7 -0
- package/dist/local/workspace-lock.d.ts.map +1 -0
- package/dist/local/workspace-lock.js +211 -0
- package/dist/local/workspace-lock.js.map +1 -0
- package/dist/local/workspace-merge.d.ts +77 -0
- package/dist/local/workspace-merge.d.ts.map +1 -0
- package/dist/local/workspace-merge.js +703 -0
- package/dist/local/workspace-merge.js.map +1 -0
- package/dist/local/workspace-mixed-history.d.ts +33 -0
- package/dist/local/workspace-mixed-history.d.ts.map +1 -0
- package/dist/local/workspace-mixed-history.js +107 -0
- package/dist/local/workspace-mixed-history.js.map +1 -0
- package/dist/local/workspace-overlap-allocation.d.ts +33 -0
- package/dist/local/workspace-overlap-allocation.d.ts.map +1 -0
- package/dist/local/workspace-overlap-allocation.js +69 -0
- package/dist/local/workspace-overlap-allocation.js.map +1 -0
- package/dist/local/workspace-overlap-impact.d.ts +46 -0
- package/dist/local/workspace-overlap-impact.d.ts.map +1 -0
- package/dist/local/workspace-overlap-impact.js +162 -0
- package/dist/local/workspace-overlap-impact.js.map +1 -0
- package/dist/local/workspace-overlap.d.ts +109 -0
- package/dist/local/workspace-overlap.d.ts.map +1 -0
- package/dist/local/workspace-overlap.js +327 -0
- package/dist/local/workspace-overlap.js.map +1 -0
- package/dist/local/workspace-paths.d.ts +4 -0
- package/dist/local/workspace-paths.d.ts.map +1 -0
- package/dist/local/workspace-paths.js +8 -0
- package/dist/local/workspace-paths.js.map +1 -0
- package/dist/local/workspace-pick-runtime.d.ts +70 -0
- package/dist/local/workspace-pick-runtime.d.ts.map +1 -0
- package/dist/local/workspace-pick-runtime.js +177 -0
- package/dist/local/workspace-pick-runtime.js.map +1 -0
- package/dist/local/workspace-pick-store.d.ts +33 -0
- package/dist/local/workspace-pick-store.d.ts.map +1 -0
- package/dist/local/workspace-pick-store.js +43 -0
- package/dist/local/workspace-pick-store.js.map +1 -0
- package/dist/local/workspace-pick.d.ts +73 -0
- package/dist/local/workspace-pick.d.ts.map +1 -0
- package/dist/local/workspace-pick.js +253 -0
- package/dist/local/workspace-pick.js.map +1 -0
- package/dist/local/workspace-portable-authoring.d.ts +43 -0
- package/dist/local/workspace-portable-authoring.d.ts.map +1 -0
- package/dist/local/workspace-portable-authoring.js +128 -0
- package/dist/local/workspace-portable-authoring.js.map +1 -0
- package/dist/local/workspace-prune.d.ts +63 -0
- package/dist/local/workspace-prune.d.ts.map +1 -0
- package/dist/local/workspace-prune.js +267 -0
- package/dist/local/workspace-prune.js.map +1 -0
- package/dist/local/workspace-remote-fetch.d.ts +82 -0
- package/dist/local/workspace-remote-fetch.d.ts.map +1 -0
- package/dist/local/workspace-remote-fetch.js +409 -0
- package/dist/local/workspace-remote-fetch.js.map +1 -0
- package/dist/local/workspace-remote-provider.d.ts +97 -0
- package/dist/local/workspace-remote-provider.d.ts.map +1 -0
- package/dist/local/workspace-remote-provider.js +400 -0
- package/dist/local/workspace-remote-provider.js.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts +49 -0
- package/dist/local/workspace-remote-pull-request-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request-journal.js +63 -0
- package/dist/local/workspace-remote-pull-request-journal.js.map +1 -0
- package/dist/local/workspace-remote-pull-request.d.ts +36 -0
- package/dist/local/workspace-remote-pull-request.d.ts.map +1 -0
- package/dist/local/workspace-remote-pull-request.js +158 -0
- package/dist/local/workspace-remote-pull-request.js.map +1 -0
- package/dist/local/workspace-remote-push.d.ts +88 -0
- package/dist/local/workspace-remote-push.d.ts.map +1 -0
- package/dist/local/workspace-remote-push.js +297 -0
- package/dist/local/workspace-remote-push.js.map +1 -0
- package/dist/local/workspace-remote-topic-journal.d.ts +56 -0
- package/dist/local/workspace-remote-topic-journal.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic-journal.js +121 -0
- package/dist/local/workspace-remote-topic-journal.js.map +1 -0
- package/dist/local/workspace-remote-topic.d.ts +45 -0
- package/dist/local/workspace-remote-topic.d.ts.map +1 -0
- package/dist/local/workspace-remote-topic.js +204 -0
- package/dist/local/workspace-remote-topic.js.map +1 -0
- package/dist/local/workspace-remote-transfer.d.ts +76 -0
- package/dist/local/workspace-remote-transfer.d.ts.map +1 -0
- package/dist/local/workspace-remote-transfer.js +270 -0
- package/dist/local/workspace-remote-transfer.js.map +1 -0
- package/dist/local/workspace-resolution.d.ts +145 -0
- package/dist/local/workspace-resolution.d.ts.map +1 -0
- package/dist/local/workspace-resolution.js +479 -0
- package/dist/local/workspace-resolution.js.map +1 -0
- package/dist/local/workspace-resolver-provider.d.ts +72 -0
- package/dist/local/workspace-resolver-provider.d.ts.map +1 -0
- package/dist/local/workspace-resolver-provider.js +312 -0
- package/dist/local/workspace-resolver-provider.js.map +1 -0
- package/dist/local/workspace-runtime-handoff.d.ts +52 -0
- package/dist/local/workspace-runtime-handoff.d.ts.map +1 -0
- package/dist/local/workspace-runtime-handoff.js +237 -0
- package/dist/local/workspace-runtime-handoff.js.map +1 -0
- package/dist/local/workspace-runtime-lease.d.ts +26 -0
- package/dist/local/workspace-runtime-lease.d.ts.map +1 -0
- package/dist/local/workspace-runtime-lease.js +123 -0
- package/dist/local/workspace-runtime-lease.js.map +1 -0
- package/dist/local/workspace-runtime.d.ts +690 -0
- package/dist/local/workspace-runtime.d.ts.map +1 -0
- package/dist/local/workspace-runtime.js +2124 -0
- package/dist/local/workspace-runtime.js.map +1 -0
- package/dist/local/workspace-scope.d.ts +70 -0
- package/dist/local/workspace-scope.d.ts.map +1 -0
- package/dist/local/workspace-scope.js +206 -0
- package/dist/local/workspace-scope.js.map +1 -0
- package/dist/local/workspace-sources.d.ts +159 -0
- package/dist/local/workspace-sources.d.ts.map +1 -0
- package/dist/local/workspace-sources.js +570 -0
- package/dist/local/workspace-sources.js.map +1 -0
- package/dist/local/workspace-store-database.d.ts +5 -0
- package/dist/local/workspace-store-database.d.ts.map +1 -0
- package/dist/local/workspace-store-database.js +726 -0
- package/dist/local/workspace-store-database.js.map +1 -0
- package/dist/local/workspace-store.d.ts +261 -0
- package/dist/local/workspace-store.d.ts.map +1 -0
- package/dist/local/workspace-store.js +831 -0
- package/dist/local/workspace-store.js.map +1 -0
- package/dist/local/workspace-topology-runtime.d.ts +27 -0
- package/dist/local/workspace-topology-runtime.d.ts.map +1 -0
- package/dist/local/workspace-topology-runtime.js +396 -0
- package/dist/local/workspace-topology-runtime.js.map +1 -0
- package/dist/local/workspace-topology.d.ts +140 -0
- package/dist/local/workspace-topology.d.ts.map +1 -0
- package/dist/local/workspace-topology.js +359 -0
- package/dist/local/workspace-topology.js.map +1 -0
- package/dist/local/workspace-upstream-inspection.d.ts +60 -0
- package/dist/local/workspace-upstream-inspection.d.ts.map +1 -0
- package/dist/local/workspace-upstream-inspection.js +189 -0
- package/dist/local/workspace-upstream-inspection.js.map +1 -0
- package/dist/local/workspace-upstream-runtime.d.ts +91 -0
- package/dist/local/workspace-upstream-runtime.d.ts.map +1 -0
- package/dist/local/workspace-upstream-runtime.js +270 -0
- package/dist/local/workspace-upstream-runtime.js.map +1 -0
- package/dist/local/workspace-upstream-store.d.ts +51 -0
- package/dist/local/workspace-upstream-store.d.ts.map +1 -0
- package/dist/local/workspace-upstream-store.js +475 -0
- package/dist/local/workspace-upstream-store.js.map +1 -0
- package/dist/local/workspace-viewer-server.d.ts +136 -0
- package/dist/local/workspace-viewer-server.d.ts.map +1 -0
- package/dist/local/workspace-viewer-server.js +1097 -0
- package/dist/local/workspace-viewer-server.js.map +1 -0
- package/dist/local/workspace-viewer-snapshot.d.ts +49 -0
- package/dist/local/workspace-viewer-snapshot.d.ts.map +1 -0
- package/dist/local/workspace-viewer-snapshot.js +91 -0
- package/dist/local/workspace-viewer-snapshot.js.map +1 -0
- package/dist/local/worktree-projection.d.ts +76 -0
- package/dist/local/worktree-projection.d.ts.map +1 -0
- package/dist/local/worktree-projection.js +470 -0
- package/dist/local/worktree-projection.js.map +1 -0
- package/dist/mcp/client-identity.d.ts +8 -0
- package/dist/mcp/client-identity.d.ts.map +1 -0
- package/dist/mcp/client-identity.js +33 -0
- package/dist/mcp/client-identity.js.map +1 -0
- package/dist/mcp/graph-to-code.d.ts +53 -0
- package/dist/mcp/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/graph-to-code.js +1624 -0
- package/dist/mcp/graph-to-code.js.map +1 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +3 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/stdio/graph-to-code.d.ts +3 -0
- package/dist/mcp/stdio/graph-to-code.d.ts.map +1 -0
- package/dist/mcp/stdio/graph-to-code.js +55 -0
- package/dist/mcp/stdio/graph-to-code.js.map +1 -0
- package/dist/mcp/stdio/worktree.d.ts +3 -0
- package/dist/mcp/stdio/worktree.d.ts.map +1 -0
- package/dist/mcp/stdio/worktree.js +67 -0
- package/dist/mcp/stdio/worktree.js.map +1 -0
- package/dist/mcp/worktree-claim-status.d.ts +162 -0
- package/dist/mcp/worktree-claim-status.d.ts.map +1 -0
- package/dist/mcp/worktree-claim-status.js +113 -0
- package/dist/mcp/worktree-claim-status.js.map +1 -0
- package/dist/mcp/worktree-dispatch.d.ts +13 -0
- package/dist/mcp/worktree-dispatch.d.ts.map +1 -0
- package/dist/mcp/worktree-dispatch.js +52 -0
- package/dist/mcp/worktree-dispatch.js.map +1 -0
- package/dist/mcp/worktree-errors.d.ts +15 -0
- package/dist/mcp/worktree-errors.d.ts.map +1 -0
- package/dist/mcp/worktree-errors.js +17 -0
- package/dist/mcp/worktree-errors.js.map +1 -0
- package/dist/mcp/worktree-health.d.ts +12 -0
- package/dist/mcp/worktree-health.d.ts.map +1 -0
- package/dist/mcp/worktree-health.js +32 -0
- package/dist/mcp/worktree-health.js.map +1 -0
- package/dist/mcp/worktree-results.d.ts +15 -0
- package/dist/mcp/worktree-results.d.ts.map +1 -0
- package/dist/mcp/worktree-results.js +12 -0
- package/dist/mcp/worktree-results.js.map +1 -0
- package/dist/mcp/worktree-task-context.d.ts +57 -0
- package/dist/mcp/worktree-task-context.d.ts.map +1 -0
- package/dist/mcp/worktree-task-context.js +45 -0
- package/dist/mcp/worktree-task-context.js.map +1 -0
- package/dist/mcp/worktree-tools.d.ts +2648 -0
- package/dist/mcp/worktree-tools.d.ts.map +1 -0
- package/dist/mcp/worktree-tools.js +192 -0
- package/dist/mcp/worktree-tools.js.map +1 -0
- package/dist/mcp/worktree.d.ts +33 -0
- package/dist/mcp/worktree.d.ts.map +1 -0
- package/dist/mcp/worktree.js +551 -0
- package/dist/mcp/worktree.js.map +1 -0
- package/dist/own-package.d.ts +13 -0
- package/dist/own-package.d.ts.map +1 -0
- package/dist/own-package.js +32 -0
- package/dist/own-package.js.map +1 -0
- package/dist/packages-browse.d.ts +107 -0
- package/dist/packages-browse.d.ts.map +1 -0
- package/dist/packages-browse.js +646 -0
- package/dist/packages-browse.js.map +1 -0
- package/dist/packages-cli.d.ts +8 -0
- package/dist/packages-cli.d.ts.map +1 -0
- package/dist/packages-cli.js +184 -0
- package/dist/packages-cli.js.map +1 -0
- package/dist/packages-uses.d.ts +46 -0
- package/dist/packages-uses.d.ts.map +1 -0
- package/dist/packages-uses.js +737 -0
- package/dist/packages-uses.js.map +1 -0
- package/dist/portable.d.ts +7 -0
- package/dist/portable.d.ts.map +1 -0
- package/dist/portable.js +14 -0
- package/dist/portable.js.map +1 -0
- package/dist/quiet-warnings.d.ts +3 -0
- package/dist/quiet-warnings.d.ts.map +1 -0
- package/dist/quiet-warnings.js +21 -0
- package/dist/quiet-warnings.js.map +1 -0
- package/dist/view-seam.d.ts +62 -0
- package/dist/view-seam.d.ts.map +1 -0
- package/dist/view-seam.js +70 -0
- package/dist/view-seam.js.map +1 -0
- package/generated/graph-packages/index.json +5 -0
- package/graph-packages.lock.json +4 -0
- package/package.json +81 -0
- package/viewer/assets/index-BZKGDARF.css +1 -0
- package/viewer/assets/index-DWu0CbZZ.js +272 -0
- package/viewer/index.html +13 -0
|
@@ -0,0 +1,737 @@
|
|
|
1
|
+
import { existsSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { checkFloors, compareSemver, diffPackageContent, graphPackageContentTypes, latestVersion, markChange, packageDiffView, rebaseOverrides, renderTextView, resolvePackageUse, resolveRebase } from '@software-dlc/graph/packages';
|
|
4
|
+
import { portable_graph_package_use_schema } from '@software-dlc/graph/schema';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { GraphPackagesLockError, defaultGraphPackagesCacheDir } from './graph-packages-lock.js';
|
|
7
|
+
import { stringifyCanonicalJson } from './local/canonical.js';
|
|
8
|
+
import { PACKAGE_USES_FILE } from './local/projection.js';
|
|
9
|
+
import { contentTypeFor, defaultGraphPackagesSnapshotDir, defaultHeldVersion, findLocalPackage, heldVersion, localPackageSource, parsePackageSpec, readLocalPackages, withdrawnOf } from './packages-browse.js';
|
|
10
|
+
/**
|
|
11
|
+
* A local graph's package uses (graph-packages.md, Local resolution): `sdlc packages use` adds,
|
|
12
|
+
* changes or removes one in the workspace's sdlc/package-uses.json, `preview` shows what a use
|
|
13
|
+
* would change, and `resolve` prints each use's resolved content. All read only the bundled
|
|
14
|
+
* snapshot and the download cache, so they work offline. A local workspace graph is a project
|
|
15
|
+
* graph; governance graphs come with the local governance graph.
|
|
16
|
+
*/
|
|
17
|
+
export const USE_ACTIONS = ['use', 'preview', 'resolve', 'upgrade'];
|
|
18
|
+
export const PACKAGES_USES_USAGE = 'Usage: sdlc packages use <coordinate>[@<version>] [--mode reference|extend|import] [--drop-overrides]\n' +
|
|
19
|
+
' sdlc packages use <coordinate> --remove\n' +
|
|
20
|
+
' sdlc packages preview <coordinate>[@<version>] [--mode reference|extend|import] [--json]\n' +
|
|
21
|
+
' sdlc packages resolve [<coordinate>] [--out <file>]\n' +
|
|
22
|
+
' sdlc packages upgrade [<coordinate>] [--to <version>] [--json]\n' +
|
|
23
|
+
' sdlc packages upgrade <coordinate> [--to <version>] --accept [--resolve <override>=keep_local|take_upstream|drop_override]...\n' +
|
|
24
|
+
"Use graph packages in this workspace's local graph, offline: run them in a workspace, where they read and write sdlc/package-uses.json; sdlc workspace commit records the change. " +
|
|
25
|
+
'use adds a use of a package held here (default: its newest held version that is not withdrawn, in reference mode), or changes the version or mode of the use the graph has; a withdrawn version is refused. ' +
|
|
26
|
+
'A use with overrides moves to another version only through an upgrade proposal, so use refuses that; a change to reference mode drops overrides only with --drop-overrides. ' +
|
|
27
|
+
'Overrides are edited by hand in sdlc/package-uses.json for now, and checked whenever the use resolves. --remove drops the use. ' +
|
|
28
|
+
"preview shows what using that version would change against the graph's current use (or against nothing), the overrides a version change would put in conflict, the content type's marks, and the floor findings. " +
|
|
29
|
+
'resolve prints the resolved content of each use, or the named one, as JSON with its use key, pinned content_hash and resolved hash; --out writes it to a file instead, outside sdlc/ (a path inside it is refused). ' +
|
|
30
|
+
'upgrade shows the upgrade proposal of each use, or the named one: its newest held version that is not withdrawn (or --to), with the upstream diff, the resolved diff, the overrides in conflict, the floor findings and the gates the marked changes need. ' +
|
|
31
|
+
'--accept moves the use to that version, resolving each conflicting override as --resolve says (every one needs a resolution); a floor finding refuses it. sdlc packages fetch downloads newer versions. ' +
|
|
32
|
+
'Exit 0: done; 1: refused, with the reason on stderr.';
|
|
33
|
+
/**
|
|
34
|
+
* The floor check on a use's resolved content. An authoring use's findings report and do not
|
|
35
|
+
* block: they block when the version is adopted (graph-packages.md, Use).
|
|
36
|
+
*/
|
|
37
|
+
export function useFloors(resolved, policyFor = () => null) {
|
|
38
|
+
if (!resolved.content || !resolved.content_type)
|
|
39
|
+
return { findings: [], blocking: false };
|
|
40
|
+
const checked = checkFloors({
|
|
41
|
+
content_type: resolved.content_type,
|
|
42
|
+
resolved: resolved.content,
|
|
43
|
+
policy: policyFor(resolved.content_type) ?? null
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
findings: checked.findings,
|
|
47
|
+
blocking: checked.blocking && !resolved.authoring
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export function describeFloor(finding) {
|
|
51
|
+
return `${finding.severity} ${finding.rule}: ${finding.message}`;
|
|
52
|
+
}
|
|
53
|
+
function refuseFloors(resolved, local, policyFor) {
|
|
54
|
+
const floors = useFloors(resolved, policyFor);
|
|
55
|
+
if (!floors.blocking)
|
|
56
|
+
return;
|
|
57
|
+
throw new GraphPackagesLockError(`${labelOf(local, resolved.use)} (${resolved.use.mode}) breaks the org's floors: ${floors.findings
|
|
58
|
+
.filter((finding) => finding.severity === 'floor')
|
|
59
|
+
.map(describeFloor)
|
|
60
|
+
.join('; ')}`);
|
|
61
|
+
}
|
|
62
|
+
const package_uses_schema = z.array(portable_graph_package_use_schema);
|
|
63
|
+
const MODES = ['reference', 'extend', 'import'];
|
|
64
|
+
/** The projection directory of the workspace the command runs in. */
|
|
65
|
+
function projectionDirOf(cwd) {
|
|
66
|
+
const dir = path.join(cwd, 'sdlc');
|
|
67
|
+
if (!existsSync(path.join(dir, 'tags.json')))
|
|
68
|
+
throw new GraphPackagesLockError(`no local graph projection at ${dir}; run this in a workspace (sdlc workspace status)`);
|
|
69
|
+
return dir;
|
|
70
|
+
}
|
|
71
|
+
export function readPackageUses(projection_dir) {
|
|
72
|
+
const file = path.join(projection_dir, PACKAGE_USES_FILE);
|
|
73
|
+
if (!existsSync(file))
|
|
74
|
+
return [];
|
|
75
|
+
const parsed = package_uses_schema.safeParse(JSON.parse(readFileSync(file, 'utf8')));
|
|
76
|
+
if (!parsed.success)
|
|
77
|
+
throw new GraphPackagesLockError(`${file} is not a valid list of package uses: ${parsed.error.issues
|
|
78
|
+
.map((issue) => `${issue.path.join('.') || '(uses)'}: ${issue.message}`)
|
|
79
|
+
.join('; ')}`);
|
|
80
|
+
const keys = new Set();
|
|
81
|
+
for (const use of parsed.data) {
|
|
82
|
+
const key = `${use.package_id}@${use.project_id ?? ''}`;
|
|
83
|
+
if (keys.has(key))
|
|
84
|
+
throw new GraphPackagesLockError(`${file} uses ${use.package_id}${use.project_id ? ` for project ${use.project_id}` : ''} more than once; a graph uses a package once`);
|
|
85
|
+
keys.add(key);
|
|
86
|
+
}
|
|
87
|
+
return parsed.data;
|
|
88
|
+
}
|
|
89
|
+
/** Written as the projection writes it; the file exists only while the graph uses a package. */
|
|
90
|
+
function writePackageUses(projection_dir, uses) {
|
|
91
|
+
const file = path.join(projection_dir, PACKAGE_USES_FILE);
|
|
92
|
+
if (uses.length === 0)
|
|
93
|
+
rmSync(file, { force: true });
|
|
94
|
+
else
|
|
95
|
+
writeFileSync(file, `${stringifyCanonicalJson(uses, 2)}\n`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A finding as a line, with what to do about it here. fetch finds a package by its id only while
|
|
99
|
+
* some version of it is held, so the remedy names its coordinate when that is known.
|
|
100
|
+
*/
|
|
101
|
+
export function describeUseFinding(finding, use, coordinate = null) {
|
|
102
|
+
if (finding.code === 'document_unavailable')
|
|
103
|
+
return coordinate
|
|
104
|
+
? `${finding.message} Download it with sdlc packages fetch ${coordinate}@${use.version}.`
|
|
105
|
+
: `${finding.message} No version of package ${use.package_id} is held here; download it with sdlc packages fetch <its coordinate>@${use.version}.`;
|
|
106
|
+
return finding.message;
|
|
107
|
+
}
|
|
108
|
+
/** Resolves a use of a project graph against what is held here. */
|
|
109
|
+
export function resolveLocalUse(use, source, registry) {
|
|
110
|
+
return resolvePackageUse({ use, graph: 'project', source, registry });
|
|
111
|
+
}
|
|
112
|
+
/** `sdlc packages use|preview|resolve`: the exit code. */
|
|
113
|
+
export async function runPackagesUsesCommand(args, context = {}) {
|
|
114
|
+
const stdout = context.stdout ?? process.stdout;
|
|
115
|
+
const stderr = context.stderr ?? process.stderr;
|
|
116
|
+
try {
|
|
117
|
+
const [action, ...rest] = args;
|
|
118
|
+
const options = parseUsesOptions(action, rest);
|
|
119
|
+
const env = context.env ?? process.env;
|
|
120
|
+
const cwd = context.cwd ?? process.cwd();
|
|
121
|
+
const projection_dir = projectionDirOf(cwd);
|
|
122
|
+
const local = readLocalPackages({
|
|
123
|
+
snapshotDir: context.snapshotDir ?? defaultGraphPackagesSnapshotDir(),
|
|
124
|
+
cacheDir: defaultGraphPackagesCacheDir(env)
|
|
125
|
+
});
|
|
126
|
+
for (const warning of local.warnings)
|
|
127
|
+
stderr.write(`warning: ${warning}\n`);
|
|
128
|
+
const registry = context.registry ?? graphPackageContentTypes;
|
|
129
|
+
let output;
|
|
130
|
+
if (action === 'use')
|
|
131
|
+
output = useCommand(projection_dir, local, registry, options, context);
|
|
132
|
+
else if (action === 'preview')
|
|
133
|
+
output = previewCommand(projection_dir, local, registry, options, context);
|
|
134
|
+
else if (action === 'upgrade')
|
|
135
|
+
output = upgradeCommand(projection_dir, local, registry, options, context);
|
|
136
|
+
else
|
|
137
|
+
output = resolveCommand(projection_dir, local, registry, {
|
|
138
|
+
...options,
|
|
139
|
+
out: options.out && path.resolve(cwd, options.out)
|
|
140
|
+
});
|
|
141
|
+
stdout.write(`${output}\n`);
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
stderr.write(`sdlc packages: ${error.message}\n`);
|
|
146
|
+
return 1;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
const FLAGS = {
|
|
150
|
+
use: ['--mode', '--remove', '--drop-overrides'],
|
|
151
|
+
preview: ['--mode', '--json'],
|
|
152
|
+
resolve: ['--out'],
|
|
153
|
+
upgrade: ['--to', '--json', '--accept', '--resolve']
|
|
154
|
+
};
|
|
155
|
+
const RESOLUTIONS = [
|
|
156
|
+
'keep_local',
|
|
157
|
+
'take_upstream',
|
|
158
|
+
'drop_override'
|
|
159
|
+
];
|
|
160
|
+
function parseResolution(value, into) {
|
|
161
|
+
const match = /^(\d+)=(.+)$/.exec(value);
|
|
162
|
+
if (!match || !RESOLUTIONS.includes(match[2]))
|
|
163
|
+
throw new GraphPackagesLockError(`--resolve takes <override>=${RESOLUTIONS.join('|')}, not ${value}`);
|
|
164
|
+
const index = Number(match[1]);
|
|
165
|
+
if (into.has(index))
|
|
166
|
+
throw new GraphPackagesLockError(`--resolve names override ${index} more than once`);
|
|
167
|
+
into.set(index, match[2]);
|
|
168
|
+
}
|
|
169
|
+
function parseUsesOptions(action, args) {
|
|
170
|
+
const options = {
|
|
171
|
+
spec: null,
|
|
172
|
+
mode: null,
|
|
173
|
+
remove: false,
|
|
174
|
+
drop_overrides: false,
|
|
175
|
+
json: false,
|
|
176
|
+
out: null,
|
|
177
|
+
to: null,
|
|
178
|
+
accept: false,
|
|
179
|
+
resolutions: new Map()
|
|
180
|
+
};
|
|
181
|
+
const allowed = FLAGS[action];
|
|
182
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
183
|
+
const arg = args[i];
|
|
184
|
+
if (arg.startsWith('--')) {
|
|
185
|
+
if (!allowed.includes(arg))
|
|
186
|
+
throw new GraphPackagesLockError(`unexpected option ${arg} for ${action}\n${PACKAGES_USES_USAGE}`);
|
|
187
|
+
if (arg === '--mode' ||
|
|
188
|
+
arg === '--out' ||
|
|
189
|
+
arg === '--to' ||
|
|
190
|
+
arg === '--resolve') {
|
|
191
|
+
const value = args[i + 1];
|
|
192
|
+
if (!value || value.startsWith('--'))
|
|
193
|
+
throw new GraphPackagesLockError(`${arg} needs a value`);
|
|
194
|
+
i += 1;
|
|
195
|
+
if (arg === '--out')
|
|
196
|
+
options.out = value;
|
|
197
|
+
else if (arg === '--to')
|
|
198
|
+
options.to = value;
|
|
199
|
+
else if (arg === '--resolve')
|
|
200
|
+
parseResolution(value, options.resolutions);
|
|
201
|
+
else if (MODES.includes(value))
|
|
202
|
+
options.mode = value;
|
|
203
|
+
else
|
|
204
|
+
throw new GraphPackagesLockError(`--mode is one of ${MODES.join(', ')}, not ${value}`);
|
|
205
|
+
}
|
|
206
|
+
else if (arg === '--remove')
|
|
207
|
+
options.remove = true;
|
|
208
|
+
else if (arg === '--drop-overrides')
|
|
209
|
+
options.drop_overrides = true;
|
|
210
|
+
else if (arg === '--accept')
|
|
211
|
+
options.accept = true;
|
|
212
|
+
else
|
|
213
|
+
options.json = true;
|
|
214
|
+
}
|
|
215
|
+
else if (options.spec !== null) {
|
|
216
|
+
throw new GraphPackagesLockError(`unexpected argument ${arg}\n${PACKAGES_USES_USAGE}`);
|
|
217
|
+
}
|
|
218
|
+
else
|
|
219
|
+
options.spec = arg;
|
|
220
|
+
}
|
|
221
|
+
if (action === 'upgrade') {
|
|
222
|
+
if (options.spec === null && (options.to || options.accept))
|
|
223
|
+
throw new GraphPackagesLockError(`--to and --accept need a package: sdlc packages upgrade <coordinate>\n${PACKAGES_USES_USAGE}`);
|
|
224
|
+
if (options.resolutions.size > 0 && !options.accept)
|
|
225
|
+
throw new GraphPackagesLockError('--resolve goes with --accept');
|
|
226
|
+
if (options.accept && options.json)
|
|
227
|
+
throw new GraphPackagesLockError('--accept takes no --json');
|
|
228
|
+
if (options.spec !== null && parsePackageSpec(options.spec).version)
|
|
229
|
+
throw new GraphPackagesLockError(`name the version with --to: sdlc packages upgrade ${parsePackageSpec(options.spec).coordinate} --to ${parsePackageSpec(options.spec).version}`);
|
|
230
|
+
}
|
|
231
|
+
else if (action !== 'resolve' && options.spec === null)
|
|
232
|
+
throw new GraphPackagesLockError(`name a package: <coordinate>[@<version>]\n${PACKAGES_USES_USAGE}`);
|
|
233
|
+
if (options.remove && (options.mode || options.drop_overrides))
|
|
234
|
+
throw new GraphPackagesLockError('--remove takes no --mode or --drop-overrides');
|
|
235
|
+
return options;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* The use of the package a name gives, by coordinate or id, among the graph's uses. A project
|
|
239
|
+
* graph's uses carry no project id (one that does is a finding), so only those are matched.
|
|
240
|
+
*/
|
|
241
|
+
function findUse(uses, local, name) {
|
|
242
|
+
const held = local.packages.find((entry) => entry.coordinate === name || entry.id === name);
|
|
243
|
+
return (uses.find((use) => use.project_id === undefined &&
|
|
244
|
+
(use.package_id === name || use.package_id === held?.id)) ?? null);
|
|
245
|
+
}
|
|
246
|
+
function coordinateOf(local, use) {
|
|
247
|
+
return (local.packages.find((entry) => entry.id === use.package_id)?.coordinate ??
|
|
248
|
+
null);
|
|
249
|
+
}
|
|
250
|
+
function labelOf(local, use) {
|
|
251
|
+
return `${coordinateOf(local, use) ?? use.package_id}@${use.version}`;
|
|
252
|
+
}
|
|
253
|
+
function refuseFindings(resolved, local) {
|
|
254
|
+
if (resolved.findings.length === 0)
|
|
255
|
+
return;
|
|
256
|
+
throw new GraphPackagesLockError(`${labelOf(local, resolved.use)} (${resolved.use.mode}) cannot be used: ${resolved.findings
|
|
257
|
+
.map((finding) => describeUseFinding(finding, resolved.use, coordinateOf(local, resolved.use)))
|
|
258
|
+
.join(' ')}`);
|
|
259
|
+
}
|
|
260
|
+
/** The use a `use` or `preview` would leave, before it is resolved. */
|
|
261
|
+
function proposedUse(uses, local, options) {
|
|
262
|
+
const { coordinate, version } = parsePackageSpec(options.spec);
|
|
263
|
+
const entry = findLocalPackage(local, coordinate);
|
|
264
|
+
const current = findUse(uses, local, entry.id);
|
|
265
|
+
const held = version
|
|
266
|
+
? heldVersion(entry, version)
|
|
267
|
+
: current
|
|
268
|
+
? heldVersion(entry, current.version)
|
|
269
|
+
: defaultHeldVersion(entry);
|
|
270
|
+
// The pin wins: a held document of the same version with another hash is not what the
|
|
271
|
+
// graph uses (graph-packages.md, Local resolution), so it is never re-pinned in passing.
|
|
272
|
+
const withdrawn = withdrawnOf(entry, held.version);
|
|
273
|
+
if (current &&
|
|
274
|
+
held.version === current.version &&
|
|
275
|
+
held.content_hash !== current.content_hash)
|
|
276
|
+
throw new GraphPackagesLockError(`${entry.coordinate}@${held.version} is pinned to ${current.content_hash}, but the copy held here hashes to ${held.content_hash}, so the graph's use does not resolve here. To keep the pin, this machine needs the pinned copy in place of the one it holds; ${withdrawn
|
|
277
|
+
? `the version is withdrawn, so it cannot be added again once removed: move the use to another version instead (sdlc packages use ${entry.coordinate}@<version>)`
|
|
278
|
+
: `to pin the held copy instead, remove the use and add it again (sdlc packages use ${entry.coordinate} --remove, then sdlc packages use ${entry.coordinate}@${held.version} --mode ${options.mode ?? current.mode})`}`);
|
|
279
|
+
if (withdrawn && held.version !== current?.version)
|
|
280
|
+
throw new GraphPackagesLockError(`${entry.coordinate}@${held.version} is withdrawn${withdrawn.withdrawn_reason ? `: ${withdrawn.withdrawn_reason}` : ''}`);
|
|
281
|
+
return {
|
|
282
|
+
current,
|
|
283
|
+
next: {
|
|
284
|
+
package_id: entry.id,
|
|
285
|
+
version: held.version,
|
|
286
|
+
content_hash: held.content_hash,
|
|
287
|
+
mode: options.mode ?? current?.mode ?? 'reference',
|
|
288
|
+
overrides: current?.overrides ?? []
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function useCommand(projection_dir, local, registry, options, context) {
|
|
293
|
+
const uses = readPackageUses(projection_dir);
|
|
294
|
+
if (options.remove) {
|
|
295
|
+
const { coordinate, version } = parsePackageSpec(options.spec);
|
|
296
|
+
if (version)
|
|
297
|
+
throw new GraphPackagesLockError(`--remove takes a package without a version: sdlc packages use ${coordinate} --remove`);
|
|
298
|
+
const current = findUse(uses, local, coordinate);
|
|
299
|
+
if (!current)
|
|
300
|
+
throw new GraphPackagesLockError(`this graph does not use ${coordinate}`);
|
|
301
|
+
writePackageUses(projection_dir, uses.filter((use) => use !== current));
|
|
302
|
+
return `removed the use of ${labelOf(local, current)}; record it with sdlc workspace commit`;
|
|
303
|
+
}
|
|
304
|
+
const { current, next } = proposedUse(uses, local, options);
|
|
305
|
+
if (current &&
|
|
306
|
+
current.overrides.length > 0 &&
|
|
307
|
+
(current.version !== next.version ||
|
|
308
|
+
current.content_hash !== next.content_hash)) {
|
|
309
|
+
const coordinate = coordinateOf(local, current) ?? current.package_id;
|
|
310
|
+
throw new GraphPackagesLockError(compareSemver(next.version, current.version) > 0
|
|
311
|
+
? `${labelOf(local, current)} has ${current.overrides.length} override(s); only an upgrade proposal moves a use with overrides to another version, rebasing them: sdlc packages upgrade ${coordinate} --to ${next.version}`
|
|
312
|
+
: `${labelOf(local, current)} has ${current.overrides.length} override(s), and an upgrade proposal only moves forward; to move it to ${next.version}, remove the use and add it again, which drops its overrides (sdlc packages use ${coordinate} --remove, then sdlc packages use ${coordinate}@${next.version} --mode ${next.mode})`);
|
|
313
|
+
}
|
|
314
|
+
if (next.mode === 'reference' && next.overrides.length > 0) {
|
|
315
|
+
if (!options.drop_overrides)
|
|
316
|
+
throw new GraphPackagesLockError(`${labelOf(local, next)} has ${next.overrides.length} override(s), which a reference use cannot carry; add --drop-overrides to drop them`);
|
|
317
|
+
next.overrides = [];
|
|
318
|
+
}
|
|
319
|
+
if (current &&
|
|
320
|
+
current.version === next.version &&
|
|
321
|
+
current.content_hash === next.content_hash &&
|
|
322
|
+
current.mode === next.mode &&
|
|
323
|
+
current.overrides.length === next.overrides.length) {
|
|
324
|
+
return `this graph already uses ${labelOf(local, next)} (${next.mode})`;
|
|
325
|
+
}
|
|
326
|
+
const resolved = resolveLocalUse(next, localPackageSource(local), registry);
|
|
327
|
+
refuseFindings(resolved, local);
|
|
328
|
+
refuseFloors(resolved, local, context.floorPolicy);
|
|
329
|
+
writePackageUses(projection_dir, current
|
|
330
|
+
? uses.map((use) => (use === current ? next : use))
|
|
331
|
+
: [...uses, next]);
|
|
332
|
+
const verb = current ? 'now uses' : 'uses';
|
|
333
|
+
const authoring = resolved.authoring
|
|
334
|
+
? '; authoring only: this graph never reads it as active'
|
|
335
|
+
: '';
|
|
336
|
+
return `this graph ${verb} ${labelOf(local, next)} (${next.mode}), resolved hash ${resolved.resolved_hash}${authoring}; record it with sdlc workspace commit`;
|
|
337
|
+
}
|
|
338
|
+
const EMPTY_CONTENT = {
|
|
339
|
+
root_manifest_node_ids: [],
|
|
340
|
+
nodes: [],
|
|
341
|
+
included_edges: [],
|
|
342
|
+
included_paths: [],
|
|
343
|
+
included_path_relations: []
|
|
344
|
+
};
|
|
345
|
+
/** A diff view's changed items only, as text. */
|
|
346
|
+
function changedText(view) {
|
|
347
|
+
const changed = view.sections
|
|
348
|
+
.map((section) => ({
|
|
349
|
+
...section,
|
|
350
|
+
items: section.items.filter((item) => item.change)
|
|
351
|
+
}))
|
|
352
|
+
.filter((section) => section.items.length);
|
|
353
|
+
return changed.length ? renderTextView({ sections: changed }) : 'No changes.';
|
|
354
|
+
}
|
|
355
|
+
function floorLines(floors, authoring) {
|
|
356
|
+
return floors.findings.map((finding) => `${describeFloor(finding)}${finding.severity !== 'floor'
|
|
357
|
+
? ''
|
|
358
|
+
: authoring
|
|
359
|
+
? ' (reported: authoring only)'
|
|
360
|
+
: ' (blocks it)'}`);
|
|
361
|
+
}
|
|
362
|
+
function previewCommand(projection_dir, local, registry, options, context) {
|
|
363
|
+
const uses = readPackageUses(projection_dir);
|
|
364
|
+
const { current, next } = proposedUse(uses, local, options);
|
|
365
|
+
const source = localPackageSource(local);
|
|
366
|
+
const before = current ? resolveLocalUse(current, source, registry) : null;
|
|
367
|
+
const pinned = source.document(next.package_id, next.version);
|
|
368
|
+
const { type, known } = contentTypeFor(registry, pinned.document.package.content_type);
|
|
369
|
+
// A version change rebases the overrides: those that carry over apply, the rest conflict.
|
|
370
|
+
const moving = current !== null &&
|
|
371
|
+
next.overrides.length > 0 &&
|
|
372
|
+
current.content_hash !== next.content_hash &&
|
|
373
|
+
before?.document !== null &&
|
|
374
|
+
before?.document !== undefined;
|
|
375
|
+
const rebase = moving
|
|
376
|
+
? rebaseOverrides({
|
|
377
|
+
from: before.document.content,
|
|
378
|
+
to: pinned.document.content,
|
|
379
|
+
overrides: next.overrides,
|
|
380
|
+
content_type: type,
|
|
381
|
+
registry
|
|
382
|
+
})
|
|
383
|
+
: null;
|
|
384
|
+
const candidate = rebase
|
|
385
|
+
? { ...next, overrides: rebase.carried.map((entry) => entry.override) }
|
|
386
|
+
: next;
|
|
387
|
+
const after = resolveLocalUse(candidate, source, registry);
|
|
388
|
+
const before_content = before?.content ?? EMPTY_CONTENT;
|
|
389
|
+
const after_content = after.content ?? EMPTY_CONTENT;
|
|
390
|
+
const change = markChange({
|
|
391
|
+
content_type: type,
|
|
392
|
+
before: before_content,
|
|
393
|
+
after: after_content
|
|
394
|
+
});
|
|
395
|
+
const view = packageDiffView({
|
|
396
|
+
content_type: type,
|
|
397
|
+
before: before_content,
|
|
398
|
+
after: after_content
|
|
399
|
+
});
|
|
400
|
+
const conflicts = (rebase?.conflicts ?? []).map((conflict) => ({
|
|
401
|
+
index: conflict.index,
|
|
402
|
+
id: conflict.id,
|
|
403
|
+
reason: conflict.reason
|
|
404
|
+
}));
|
|
405
|
+
const floors = useFloors(after, context.floorPolicy);
|
|
406
|
+
if (options.json) {
|
|
407
|
+
return JSON.stringify({
|
|
408
|
+
package: {
|
|
409
|
+
id: next.package_id,
|
|
410
|
+
coordinate: pinned.document.package.coordinate,
|
|
411
|
+
content_type: pinned.document.package.content_type,
|
|
412
|
+
content_type_known: known
|
|
413
|
+
},
|
|
414
|
+
current: current
|
|
415
|
+
? {
|
|
416
|
+
version: current.version,
|
|
417
|
+
mode: current.mode,
|
|
418
|
+
resolved_hash: before?.resolved_hash ?? null
|
|
419
|
+
}
|
|
420
|
+
: null,
|
|
421
|
+
proposed: {
|
|
422
|
+
version: next.version,
|
|
423
|
+
mode: next.mode,
|
|
424
|
+
content_hash: next.content_hash,
|
|
425
|
+
resolved_hash: after.resolved_hash,
|
|
426
|
+
authoring: after.authoring
|
|
427
|
+
},
|
|
428
|
+
findings: after.findings.map((finding) => ({
|
|
429
|
+
code: finding.code,
|
|
430
|
+
message: describeUseFinding(finding, candidate, coordinateOf(local, candidate))
|
|
431
|
+
})),
|
|
432
|
+
conflicts,
|
|
433
|
+
floors,
|
|
434
|
+
diff: change.diff,
|
|
435
|
+
marks: change.marks,
|
|
436
|
+
required_gates: change.required_gates,
|
|
437
|
+
view
|
|
438
|
+
}, null, 2);
|
|
439
|
+
}
|
|
440
|
+
const counts = `${change.diff.added.length} added, ${change.diff.modified.length} changed, ${change.diff.deleted.length} removed`;
|
|
441
|
+
const from = current
|
|
442
|
+
? `${labelOf(local, current)} (${current.mode})`
|
|
443
|
+
: 'no use';
|
|
444
|
+
const lines = [`${from} → ${labelOf(local, next)} (${next.mode}): ${counts}`];
|
|
445
|
+
if (after.authoring)
|
|
446
|
+
lines.push('authoring only: a use of this content type in a project graph is never read as active');
|
|
447
|
+
if (!known)
|
|
448
|
+
lines.push(`${pinned.document.package.content_type} is not known to this sdlc: drawn with the default view, with no marks`);
|
|
449
|
+
for (const finding of after.findings)
|
|
450
|
+
lines.push(`cannot be used: ${describeUseFinding(finding, candidate, coordinateOf(local, candidate))}`);
|
|
451
|
+
for (const conflict of conflicts)
|
|
452
|
+
lines.push(`override ${conflict.index} on ${conflict.id} conflicts: ${conflict.reason.replace('_', ' ')}`);
|
|
453
|
+
lines.push(...floorLines(floors, after.authoring));
|
|
454
|
+
if (change.required_gates.length)
|
|
455
|
+
lines.push(`gates the marked changes need: ${change.required_gates.join(', ')}`);
|
|
456
|
+
lines.push('', changedText(view));
|
|
457
|
+
return lines.join('\n');
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* The version a use's upgrade proposal offers: --to, or the newest held version newer than the
|
|
461
|
+
* pin that is not withdrawn. Withdrawn versions are never proposed (graph-packages.md, Withdrawal).
|
|
462
|
+
*/
|
|
463
|
+
function upgradeTarget(entry, current, to) {
|
|
464
|
+
if (to !== null) {
|
|
465
|
+
const held = heldVersion(entry, to);
|
|
466
|
+
const withdrawn = withdrawnOf(entry, to);
|
|
467
|
+
if (withdrawn)
|
|
468
|
+
throw new GraphPackagesLockError(`${entry.coordinate}@${to} is withdrawn${withdrawn.withdrawn_reason ? `: ${withdrawn.withdrawn_reason}` : ''}; it is never proposed`);
|
|
469
|
+
if (compareSemver(to, current.version) <= 0)
|
|
470
|
+
throw new GraphPackagesLockError(`${entry.coordinate}@${to} is not newer than the pinned ${current.version}; an upgrade moves forward (sdlc packages use moves a use without overrides to any version)`);
|
|
471
|
+
return held;
|
|
472
|
+
}
|
|
473
|
+
// The index's rule over the newer held versions: a release before any pre-release.
|
|
474
|
+
const newest = latestVersion(entry.held
|
|
475
|
+
.filter((held) => compareSemver(held.version, current.version) > 0)
|
|
476
|
+
.map((held) => ({
|
|
477
|
+
version: held.version,
|
|
478
|
+
withdrawn: Boolean(withdrawnOf(entry, held.version))
|
|
479
|
+
})));
|
|
480
|
+
return newest === null ? null : heldVersion(entry, newest);
|
|
481
|
+
}
|
|
482
|
+
function upgradeProposal(current, local, registry, to, policyFor) {
|
|
483
|
+
const entry = local.packages.find((held) => held.id === current.package_id);
|
|
484
|
+
if (!entry)
|
|
485
|
+
throw new GraphPackagesLockError(`no version of package ${current.package_id} is held here, so it has no upgrade proposal; download one with sdlc packages fetch <its coordinate>`);
|
|
486
|
+
const target = upgradeTarget(entry, current, to);
|
|
487
|
+
if (!target)
|
|
488
|
+
return null;
|
|
489
|
+
const source = localPackageSource(local);
|
|
490
|
+
const before = resolveLocalUse(current, source, registry);
|
|
491
|
+
// The rebase and the upstream diff start from the pinned version, so it must be held as pinned.
|
|
492
|
+
const pinned_issue = before.findings.find((finding) => finding.code === 'document_unavailable' ||
|
|
493
|
+
finding.code === 'hash_mismatch');
|
|
494
|
+
if (pinned_issue || !before.document)
|
|
495
|
+
throw new GraphPackagesLockError(`${entry.coordinate}@${current.version} (the pinned version) does not resolve here, so its upgrade cannot be worked out: ${describeUseFinding(pinned_issue, current, entry.coordinate)}`);
|
|
496
|
+
const { type } = contentTypeFor(registry, target.document.package.content_type);
|
|
497
|
+
const from_content = before.document.content;
|
|
498
|
+
const to_content = target.document.content;
|
|
499
|
+
const rebase = current.overrides.length > 0
|
|
500
|
+
? rebaseOverrides({
|
|
501
|
+
from: from_content,
|
|
502
|
+
to: to_content,
|
|
503
|
+
overrides: current.overrides,
|
|
504
|
+
content_type: type,
|
|
505
|
+
registry
|
|
506
|
+
})
|
|
507
|
+
: null;
|
|
508
|
+
const next = {
|
|
509
|
+
...current,
|
|
510
|
+
version: target.version,
|
|
511
|
+
content_hash: target.content_hash,
|
|
512
|
+
overrides: rebase
|
|
513
|
+
? rebase.carried.map((entry) => entry.override)
|
|
514
|
+
: current.overrides
|
|
515
|
+
};
|
|
516
|
+
const resolved = resolveLocalUse(next, source, registry);
|
|
517
|
+
const before_content = before.content ?? EMPTY_CONTENT;
|
|
518
|
+
const after_content = resolved.content ?? EMPTY_CONTENT;
|
|
519
|
+
return {
|
|
520
|
+
coordinate: entry.coordinate,
|
|
521
|
+
current,
|
|
522
|
+
next,
|
|
523
|
+
upstream: diffPackageContent(from_content, to_content),
|
|
524
|
+
change: markChange({
|
|
525
|
+
content_type: type,
|
|
526
|
+
before: before_content,
|
|
527
|
+
after: after_content
|
|
528
|
+
}),
|
|
529
|
+
view: packageDiffView({
|
|
530
|
+
content_type: type,
|
|
531
|
+
before: before_content,
|
|
532
|
+
after: after_content
|
|
533
|
+
}),
|
|
534
|
+
conflicts: rebase?.conflicts ?? [],
|
|
535
|
+
rebase,
|
|
536
|
+
resolved,
|
|
537
|
+
floors: useFloors(resolved, policyFor)
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
function diffCounts(diff) {
|
|
541
|
+
return `${diff.added.length} added, ${diff.modified.length} changed, ${diff.deleted.length} removed`;
|
|
542
|
+
}
|
|
543
|
+
function proposalJson(proposal, local) {
|
|
544
|
+
return {
|
|
545
|
+
package: {
|
|
546
|
+
id: proposal.current.package_id,
|
|
547
|
+
coordinate: proposal.coordinate
|
|
548
|
+
},
|
|
549
|
+
from: proposal.current.version,
|
|
550
|
+
to: proposal.next.version,
|
|
551
|
+
mode: proposal.current.mode,
|
|
552
|
+
authoring: proposal.resolved.authoring,
|
|
553
|
+
upstream_diff: proposal.upstream,
|
|
554
|
+
resolved_diff: proposal.change.diff,
|
|
555
|
+
conflicts: proposal.conflicts.map((conflict) => ({
|
|
556
|
+
index: conflict.index,
|
|
557
|
+
id: conflict.id,
|
|
558
|
+
reason: conflict.reason
|
|
559
|
+
})),
|
|
560
|
+
findings: proposal.resolved.findings.map((finding) => ({
|
|
561
|
+
code: finding.code,
|
|
562
|
+
message: describeUseFinding(finding, proposal.next, coordinateOf(local, proposal.next))
|
|
563
|
+
})),
|
|
564
|
+
floors: proposal.floors,
|
|
565
|
+
marks: proposal.change.marks,
|
|
566
|
+
required_gates: proposal.change.required_gates,
|
|
567
|
+
view: proposal.view
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function proposalText(proposal) {
|
|
571
|
+
const { coordinate, current, next } = proposal;
|
|
572
|
+
const lines = [
|
|
573
|
+
`${coordinate}@${current.version} → ${next.version} (${current.mode})`,
|
|
574
|
+
`upstream: ${diffCounts(proposal.upstream)}`,
|
|
575
|
+
`resolved: ${diffCounts(proposal.change.diff)}`
|
|
576
|
+
];
|
|
577
|
+
if (proposal.resolved.authoring)
|
|
578
|
+
lines.push('authoring only: a use of this content type in a project graph is never read as active');
|
|
579
|
+
for (const conflict of proposal.conflicts)
|
|
580
|
+
lines.push(`override ${conflict.index} on ${conflict.id} conflicts: ${conflict.reason.replace('_', ' ')}${conflict.reason === 'id_taken'
|
|
581
|
+
? ' (take_upstream or drop_override)'
|
|
582
|
+
: ''}`);
|
|
583
|
+
// Conflicting overrides are left out until resolved, so a finding here can come from that.
|
|
584
|
+
for (const finding of proposal.resolved.findings)
|
|
585
|
+
lines.push(`does not resolve as proposed: ${finding.message}`);
|
|
586
|
+
lines.push(...floorLines(proposal.floors, proposal.resolved.authoring));
|
|
587
|
+
if (proposal.change.required_gates.length)
|
|
588
|
+
lines.push(`gates the marked changes need: ${proposal.change.required_gates.join(', ')}`);
|
|
589
|
+
const resolve = proposal.conflicts
|
|
590
|
+
.map((conflict) => ` --resolve ${conflict.index}=<resolution>`)
|
|
591
|
+
.join('');
|
|
592
|
+
lines.push(`accept with: sdlc packages upgrade ${coordinate} --to ${next.version} --accept${resolve}`, '', changedText(proposal.view));
|
|
593
|
+
return lines.join('\n');
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* `sdlc packages upgrade` (graph-packages.md, Upgrade proposals): a proposal for each use with a
|
|
597
|
+
* newer held version, which nothing applies until the user accepts it. Accepting is an ordinary
|
|
598
|
+
* workspace change: it moves the pin and rebases the overrides as each conflict's resolution says.
|
|
599
|
+
*/
|
|
600
|
+
function upgradeCommand(projection_dir, local, registry, options, context) {
|
|
601
|
+
const uses = readPackageUses(projection_dir);
|
|
602
|
+
let selected = uses.filter((use) => use.project_id === undefined);
|
|
603
|
+
if (options.spec !== null) {
|
|
604
|
+
const use = findUse(uses, local, options.spec);
|
|
605
|
+
if (!use)
|
|
606
|
+
throw new GraphPackagesLockError(`this graph does not use ${options.spec}`);
|
|
607
|
+
selected = [use];
|
|
608
|
+
}
|
|
609
|
+
// Listing every use, one whose proposal cannot be worked out is noted, not fatal.
|
|
610
|
+
const notes = [];
|
|
611
|
+
const proposals = selected.flatMap((use) => {
|
|
612
|
+
try {
|
|
613
|
+
const proposal = upgradeProposal(use, local, registry, options.to, context.floorPolicy);
|
|
614
|
+
return proposal ? [proposal] : [];
|
|
615
|
+
}
|
|
616
|
+
catch (error) {
|
|
617
|
+
if (options.spec !== null)
|
|
618
|
+
throw error;
|
|
619
|
+
notes.push(`${labelOf(local, use)}: ${error.message}`);
|
|
620
|
+
return [];
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
for (const note of notes)
|
|
624
|
+
(context.stderr ?? process.stderr).write(`note: ${note}\n`);
|
|
625
|
+
if (options.accept) {
|
|
626
|
+
const proposal = proposals[0];
|
|
627
|
+
if (!proposal)
|
|
628
|
+
throw new GraphPackagesLockError(`${labelOf(local, selected[0])} has no newer held version that is not withdrawn; sdlc packages fetch downloads newer ones`);
|
|
629
|
+
return acceptUpgrade(projection_dir, uses, proposal, local, registry, options, context);
|
|
630
|
+
}
|
|
631
|
+
if (options.json)
|
|
632
|
+
return JSON.stringify({ proposals: proposals.map((proposal) => proposalJson(proposal, local)) }, null, 2);
|
|
633
|
+
if (proposals.length === 0)
|
|
634
|
+
return selected.length === 0
|
|
635
|
+
? 'this graph uses no packages'
|
|
636
|
+
: 'no upgrade proposals: each use is on its newest held version that is not withdrawn; sdlc packages fetch downloads newer ones';
|
|
637
|
+
return proposals.map(proposalText).join('\n\n');
|
|
638
|
+
}
|
|
639
|
+
function acceptUpgrade(projection_dir, uses, proposal, local, registry, options, context) {
|
|
640
|
+
const conflicting = new Set(proposal.conflicts.map((conflict) => conflict.index));
|
|
641
|
+
const unknown = [...options.resolutions.keys()].filter((index) => !conflicting.has(index));
|
|
642
|
+
if (unknown.length)
|
|
643
|
+
throw new GraphPackagesLockError(`--resolve names override(s) ${unknown.join(', ')}, which do not conflict; the conflicting ones are ${[...conflicting].join(', ') || 'none'}`);
|
|
644
|
+
const missing = proposal.conflicts.filter((conflict) => !options.resolutions.has(conflict.index));
|
|
645
|
+
if (missing.length)
|
|
646
|
+
throw new GraphPackagesLockError(`resolve each conflicting override: ${missing
|
|
647
|
+
.map((conflict) => `--resolve ${conflict.index}=keep_local|take_upstream|drop_override (${conflict.id}: ${conflict.reason.replace('_', ' ')})`)
|
|
648
|
+
.join(', ')}`);
|
|
649
|
+
let overrides;
|
|
650
|
+
try {
|
|
651
|
+
overrides = proposal.rebase
|
|
652
|
+
? resolveRebase(proposal.rebase, options.resolutions)
|
|
653
|
+
: proposal.current.overrides;
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
throw new GraphPackagesLockError(error.message);
|
|
657
|
+
}
|
|
658
|
+
const next = { ...proposal.next, overrides };
|
|
659
|
+
const resolved = resolveLocalUse(next, localPackageSource(local), registry);
|
|
660
|
+
refuseFindings(resolved, local);
|
|
661
|
+
refuseFloors(resolved, local, context.floorPolicy);
|
|
662
|
+
writePackageUses(projection_dir, uses.map((use) => (use === proposal.current ? next : use)));
|
|
663
|
+
const kept = [...options.resolutions.values()].filter((resolution) => resolution === 'keep_local').length;
|
|
664
|
+
return `this graph now uses ${proposal.coordinate}@${next.version} (${next.mode}), upgraded from ${proposal.current.version}${proposal.conflicts.length
|
|
665
|
+
? `; ${proposal.conflicts.length} conflict(s) resolved, ${kept} kept local`
|
|
666
|
+
: ''}, resolved hash ${resolved.resolved_hash}; record it with sdlc workspace commit`;
|
|
667
|
+
}
|
|
668
|
+
/** A path as the filesystem names it: the nearest existing ancestor's real path, plus the rest. */
|
|
669
|
+
function realPathOf(file) {
|
|
670
|
+
const rest = [];
|
|
671
|
+
let at = path.resolve(file);
|
|
672
|
+
while (!existsSync(at)) {
|
|
673
|
+
const parent = path.dirname(at);
|
|
674
|
+
if (parent === at)
|
|
675
|
+
break;
|
|
676
|
+
rest.unshift(path.basename(at));
|
|
677
|
+
at = parent;
|
|
678
|
+
}
|
|
679
|
+
return path.join(realpathSync.native(at), ...rest);
|
|
680
|
+
}
|
|
681
|
+
/**
|
|
682
|
+
* Whether a path is the directory or inside it. macOS and Windows filesystems ignore case by
|
|
683
|
+
* default, so there the comparison does too: SDLC/x is sdlc/x.
|
|
684
|
+
*/
|
|
685
|
+
export function isWithin(directory, file) {
|
|
686
|
+
const fold = (value) => process.platform === 'darwin' || process.platform === 'win32'
|
|
687
|
+
? value.toLowerCase()
|
|
688
|
+
: value;
|
|
689
|
+
const relative = path.relative(fold(realPathOf(directory)), fold(realPathOf(file)));
|
|
690
|
+
return (relative !== '..' &&
|
|
691
|
+
!relative.startsWith(`..${path.sep}`) &&
|
|
692
|
+
!path.isAbsolute(relative));
|
|
693
|
+
}
|
|
694
|
+
function resolveCommand(projection_dir, local, registry, options) {
|
|
695
|
+
// The resolved content is never part of the graph: --out stays outside the projection.
|
|
696
|
+
if (options.out) {
|
|
697
|
+
if (isWithin(projection_dir, options.out))
|
|
698
|
+
throw new GraphPackagesLockError(`--out ${options.out} is inside the graph's projection ${projection_dir}; write the resolved content outside it`);
|
|
699
|
+
}
|
|
700
|
+
const uses = readPackageUses(projection_dir);
|
|
701
|
+
let selected = uses;
|
|
702
|
+
if (options.spec !== null) {
|
|
703
|
+
const use = findUse(uses, local, options.spec);
|
|
704
|
+
if (!use)
|
|
705
|
+
throw new GraphPackagesLockError(`this graph does not use ${options.spec}`);
|
|
706
|
+
selected = [use];
|
|
707
|
+
}
|
|
708
|
+
const source = localPackageSource(local);
|
|
709
|
+
const resolved = selected.map((use) => {
|
|
710
|
+
const result = resolveLocalUse(use, source, registry);
|
|
711
|
+
return {
|
|
712
|
+
key: use.project_id === undefined
|
|
713
|
+
? use.package_id
|
|
714
|
+
: `${use.package_id}@${use.project_id}`,
|
|
715
|
+
package_id: use.package_id,
|
|
716
|
+
coordinate: result.document?.package.coordinate ?? null,
|
|
717
|
+
version: use.version,
|
|
718
|
+
mode: use.mode,
|
|
719
|
+
content_hash: use.content_hash,
|
|
720
|
+
resolved_hash: result.resolved_hash,
|
|
721
|
+
authoring: result.authoring,
|
|
722
|
+
findings: result.findings.map((finding) => ({
|
|
723
|
+
code: finding.code,
|
|
724
|
+
message: describeUseFinding(finding, use, coordinateOf(local, use))
|
|
725
|
+
})),
|
|
726
|
+
content: result.content
|
|
727
|
+
};
|
|
728
|
+
});
|
|
729
|
+
const text = JSON.stringify({ uses: resolved }, null, 2);
|
|
730
|
+
const unresolved = resolved.filter((entry) => entry.findings.length > 0);
|
|
731
|
+
if (options.out) {
|
|
732
|
+
writeFileSync(options.out, `${text}\n`);
|
|
733
|
+
return `wrote ${resolved.length} use(s) to ${options.out}${unresolved.length ? `; ${unresolved.length} unresolved` : ''}`;
|
|
734
|
+
}
|
|
735
|
+
return text;
|
|
736
|
+
}
|
|
737
|
+
//# sourceMappingURL=packages-uses.js.map
|