gentle-pi 4.7.0 → 4.8.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/README.md +55 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +6 -6
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +746 -15
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +24 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +4 -4
- package/assets/orchestrator-full-delegation-card.md +4 -5
- package/assets/orchestrator-full-delegation.md +8 -8
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +18 -22
- package/bin/gentle-shell.mjs +128 -9
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +18 -2
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell.md +39 -16
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +76 -24
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +11 -1
- package/extensions/ask-user-question.ts +2 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +234 -33
- package/extensions/gentle-ai.ts +576 -135
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +105 -52
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/skill-registry.ts +248 -223
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +91 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- package/lib/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +79 -4
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +2 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/native-review-cli.mjs +79 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +4 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +40 -19
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +10 -2
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-question.test.ts +2 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/bounded-stop-contract.test.ts +9 -1
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -878
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +20 -29
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/full-delegation-closure.test.ts +29 -0
- package/tests/gentle-agents.test.ts +329 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +121 -6
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +118 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +19 -5
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +11 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +11 -3
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +30 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +11 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +11 -10
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller.test.ts +2 -1
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator.test.ts +271 -4
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +929 -306
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +42 -11
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +87 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +54 -11
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +184 -0
- package/tests/yolo-mode.test.ts +39 -0
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
package/tests/pi-update.test.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { bundledUpdatePlan, bundledUpdateNext } from '../runtime/gentle-shell-bu
|
|
|
5
5
|
|
|
6
6
|
const PI = '@earendil-works/pi-coding-agent';
|
|
7
7
|
const CLI = 'dist/bundle/cli.js';
|
|
8
|
+
const AGE = ['--config.minimum-release-age-exclude=existing-fixture', `--config.minimum-release-age-exclude=${PI}`];
|
|
8
9
|
|
|
9
10
|
// The layouts pnpm v11 and npm really produce. pnpm links each top-level
|
|
10
11
|
// package from its own global group into the linked store, where Shell's
|
|
@@ -12,7 +13,9 @@ const CLI = 'dist/bundle/cli.js';
|
|
|
12
13
|
// same store entry. npm nests the peer under the Shell package.
|
|
13
14
|
function fixture({windows = false, npm = false, runtime = 'adjacent', groups = 'both', peerAfter = '1.2.0', shellVersion = '4.1.0',
|
|
14
15
|
badManifest = false, failed = false, mismatch = false, linked = false, readback = true, unrelatedPeer = false, shim = '',
|
|
15
|
-
artifact = true, configHome = '', installFailure = undefined as undefined | {stdout?: string, stderrTail?: string}
|
|
16
|
+
artifact = true, configHome = '', latest = '1.2.0', installFailure = undefined as undefined | {stdout?: string, stderrTail?: string},
|
|
17
|
+
piDependencies = {} as Record<string, unknown>, manifestView = undefined as undefined | {code: number, stdout: string},
|
|
18
|
+
siblingDependencies = {} as Record<string, Record<string, unknown> | null>, excludeOutput = '["existing-fixture"]\n'} = {}) {
|
|
16
19
|
const base = windows ? 'C:/pnpm' : '/pnpm';
|
|
17
20
|
const home = windows ? 'C:/Users/u' : '/home/u';
|
|
18
21
|
// The tarball `gentle-shell upgrade --channel main` packs, named after its version.
|
|
@@ -33,6 +36,7 @@ function fixture({windows = false, npm = false, runtime = 'adjacent', groups = '
|
|
|
33
36
|
: shim === 'windows' ? `@"%~dp0\\..\\global\\v11\\g2\\node_modules\\@earendil-works\\pi-coding-agent\\dist\\bundle\\cli.js" %*\r\n`
|
|
34
37
|
: shim === 'two' ? `"$basedir/../a/dist/bundle/cli.js" "$basedir/../b/dist/bundle/cli.js"` : shim === 'none' ? '#!/bin/sh\nexec something\n' : '';
|
|
35
38
|
const mutations: string[][] = [];
|
|
39
|
+
const probes: string[][] = [];
|
|
36
40
|
const out: string[] = [];
|
|
37
41
|
const cwds: unknown[] = [];
|
|
38
42
|
const runOptions: unknown[] = [];
|
|
@@ -66,13 +70,24 @@ function fixture({windows = false, npm = false, runtime = 'adjacent', groups = '
|
|
|
66
70
|
if (n === shimFile) return shimText;
|
|
67
71
|
if (n === `${shell}/package.json`) return JSON.stringify({name: 'gentle-pi', ...(shellVersion ? {version: shellVersion} : {})});
|
|
68
72
|
if (n === `${g1}/unrelated-tool/package.json`) return JSON.stringify({name: 'unrelated-tool'});
|
|
69
|
-
const version = n.startsWith(nestedPeer) ? state.peer : /pi-coding-agent\/([\d.]+)\/h\//.exec(n)?.[1];
|
|
73
|
+
const version = n.startsWith(nestedPeer) ? state.peer : npm && n === `${g2}/${PI}/package.json` ? state.group : /pi-coding-agent\/([\d.]+)\/h\//.exec(n)?.[1];
|
|
70
74
|
if (badManifest || unrelatedPeer) return JSON.stringify({name: unrelatedPeer ? 'other' : PI, version});
|
|
71
75
|
return JSON.stringify({name: PI, version, bin: {pi: CLI}});
|
|
72
76
|
};
|
|
73
77
|
const run = async (_command: string, args: string[], options?: {cwd?: unknown}) => {
|
|
74
78
|
cwds.push(options?.cwd);
|
|
75
79
|
if (args.includes('list') || args.includes('ls')) return {code: failed ? 1 : 0, stdout: readback || mutations.length === 0 ? JSON.stringify(listing()) : '{'};
|
|
80
|
+
if (args.includes('view')) {
|
|
81
|
+
probes.push(args);
|
|
82
|
+
// `view <Pi>@<version> --json` reads the selected version's published manifest.
|
|
83
|
+
// A Pi-scope sibling resolves from siblingDependencies (null: the lookup fails).
|
|
84
|
+
const spec = args[args.indexOf('view') + 1], at = spec.lastIndexOf('@');
|
|
85
|
+
if (args.includes('--json') && spec.slice(0, at) !== PI) return siblingDependencies[spec] === null ? {code: 1, stdout: ''}
|
|
86
|
+
: {code: 0, stdout: JSON.stringify({name: spec.slice(0, at), version: spec.slice(at + 1), dependencies: siblingDependencies[spec] ?? {}})};
|
|
87
|
+
if (args.includes('--json')) return manifestView ?? {code: 0, stdout: JSON.stringify({name: PI, version: latest, dependencies: piDependencies})};
|
|
88
|
+
return {code: 0, stdout: `${latest}\n`};
|
|
89
|
+
}
|
|
90
|
+
if (args.includes('config')) { probes.push(args); return {code: 0, stdout: excludeOutput}; }
|
|
76
91
|
mutations.push(args);
|
|
77
92
|
runOptions.push(options);
|
|
78
93
|
if (installFailure) return {code: 1, stdout: installFailure.stdout ?? '', ...('stderrTail' in installFailure ? {stderrTail: installFailure.stderrTail} : {})};
|
|
@@ -80,13 +95,80 @@ function fixture({windows = false, npm = false, runtime = 'adjacent', groups = '
|
|
|
80
95
|
if (args.some(arg => arg.startsWith(PI + '@'))) state.group = peerAfter;
|
|
81
96
|
return {code: 0};
|
|
82
97
|
};
|
|
83
|
-
return {mutations, out, cwds, runOptions, state, shell, selectedCli, tarball, input: {platform: windows ? 'win32' : 'linux', packageRoot: `${g1}/gentle-pi`, currentVersion: '1.1.0', cwd: '/neutral',
|
|
98
|
+
return {mutations, probes, out, cwds, runOptions, state, shell, selectedCli, tarball, input: {platform: windows ? 'win32' : 'linux', packageRoot: `${g1}/gentle-pi`, currentVersion: '1.1.0', cwd: '/neutral',
|
|
84
99
|
home, env: configHome ? {GENTLE_PI_CONFIG_HOME: configHome} : {},
|
|
85
100
|
runtime: runtime === 'adjacent' ? {kind: 'bundled', command: 'node', args: [selectedCli]} : {kind: runtime, command: shim ? shimFile : selectedCli, args: []},
|
|
86
101
|
out: (line: string) => out.push(line),
|
|
87
102
|
adapters: {which: async (name: string) => name === (npm ? 'npm' : 'pnpm') ? `/fake/${name}` : null, fs: {realpath, readFile}, run}}};
|
|
88
103
|
}
|
|
89
104
|
|
|
105
|
+
// pnpm's listing has a stable aggregate path, while each dependency's global
|
|
106
|
+
// group and linked store root may both change. A second row models a decoy.
|
|
107
|
+
function supplierFixture({shell = false, decoyVersion = '1.0.0', selectedAfter = '2.0.0', shellVersion = '4.1.0',
|
|
108
|
+
replaceGroup = false, withDecoy = true, post = 'normal'} = {}) {
|
|
109
|
+
const pkg = shell ? 'gentle-pi' : PI;
|
|
110
|
+
const state = {decoy:decoyVersion, selected:'1.0.0'};
|
|
111
|
+
type Side = keyof typeof state;
|
|
112
|
+
let updated = false;
|
|
113
|
+
const group = (side: Side) => `/global/v11/${side}${side === 'selected' && updated && replaceGroup ? '-new' : ''}/node_modules`;
|
|
114
|
+
const link = (side: Side) => `${group(side)}/${pkg}`;
|
|
115
|
+
const shellModules = (side: Side) => `/store/${side}/shell/${shellVersion}/peer-${state[side]}/node_modules`;
|
|
116
|
+
const shellRoot = (side: Side) => `${shellModules(side)}/gentle-pi`;
|
|
117
|
+
const piRoot = (side: Side) => shell ? `${shellModules(side)}/${PI}` : `/store/${side}/pi/${state[side]}/node_modules/${PI}`;
|
|
118
|
+
const sides: Side[] = withDecoy ? ['decoy', 'selected'] : ['selected'];
|
|
119
|
+
const tarball = `/home/u/.pi/gentle-ai/main/packages/gentle-pi-${shellVersion}.tgz`;
|
|
120
|
+
const data = {policy:'minimumReleaseAge: 4320', unrelated:'do not change', artifact:'original tarball bytes'};
|
|
121
|
+
const listing = () => {
|
|
122
|
+
const rows = sides.map(side => ({path:updated && side === 'selected' && post === 'foreign-listing' ? '/foreign/v11' : '/global/v11', private:true,
|
|
123
|
+
dependencies:{[pkg]:{from:updated && side === 'selected' && post === 'wrong-from' ? 'other' : pkg,
|
|
124
|
+
version:shell ? updated && side === 'selected' && post === 'wrong-shell' ? '9.0.0' : shellVersion : state[side], path:link(side)}}}));
|
|
125
|
+
if (updated && post === 'multiple') rows.push({path:'/global/v11', private:true,
|
|
126
|
+
dependencies:{[pkg]:{from:pkg, version:shell ? shellVersion : '2.0.0', path:`/global/v11/extra/node_modules/${pkg}`}}});
|
|
127
|
+
if (updated && post === 'duplicate') rows.push(rows[rows.length - 1]);
|
|
128
|
+
if (updated && post === 'membership') Object.assign(rows[0].dependencies, {'other-tool':{path:`${group('decoy')}/other-tool`}});
|
|
129
|
+
if (updated && post === 'listed-version') rows[rows.length - 1].dependencies[pkg].version = '9.0.0';
|
|
130
|
+
return rows;
|
|
131
|
+
};
|
|
132
|
+
const mutations: string[][] = [];
|
|
133
|
+
const out: string[] = [];
|
|
134
|
+
const realpath = async (value: string) => {
|
|
135
|
+
for (const side of sides) {
|
|
136
|
+
if (value === link(side)) return shell ? shellRoot(side) : piRoot(side);
|
|
137
|
+
if ([group(side), shellRoot(side), piRoot(side), `${piRoot(side)}/${CLI}`].includes(value)) return value;
|
|
138
|
+
}
|
|
139
|
+
if (value === '/launcher' || value === tarball || (updated && value === '/global/v11/extra/node_modules')) return value;
|
|
140
|
+
throw Object.assign(new Error(`ENOENT ${value}`), {code:'ENOENT'});
|
|
141
|
+
};
|
|
142
|
+
const readFile = async (value: string) => {
|
|
143
|
+
if (value === tarball) return data.artifact;
|
|
144
|
+
for (const side of sides) {
|
|
145
|
+
if (value === `${shellRoot(side)}/package.json`) return JSON.stringify({name:'gentle-pi', version:updated && side === 'selected' && post === 'wrong-shell' ? '9.0.0' : shellVersion});
|
|
146
|
+
if (value === `${piRoot(side)}/package.json`) return JSON.stringify({name:updated && side === 'selected' && post === 'wrong-pi' ? 'other' : PI, version:state[side], bin:{pi:updated && side === 'selected' && post === 'wrong-bin' ? 'other.js' : CLI}});
|
|
147
|
+
}
|
|
148
|
+
throw Object.assign(new Error(`ENOENT ${value}`), {code:'ENOENT'});
|
|
149
|
+
};
|
|
150
|
+
const run = async (_command: string, args: string[]) => {
|
|
151
|
+
if (args.includes('list')) return {code:0, stdout:JSON.stringify(listing())};
|
|
152
|
+
if (args.includes('view')) return {code:0, stdout:args.includes('--json') ? JSON.stringify({name:PI, version:'2.0.0'}) : '2.0.0\n'};
|
|
153
|
+
if (args.includes('config')) return {code:0, stdout:'["existing-fixture"]\n'};
|
|
154
|
+
mutations.push(args);
|
|
155
|
+
state.selected = selectedAfter;
|
|
156
|
+
updated = true;
|
|
157
|
+
return {code:0};
|
|
158
|
+
};
|
|
159
|
+
return {state, data, mutations, out, group, piRoot, shellRoot, tarball, input:{platform:'linux', packageRoot:shell ? link('selected') : '/launcher', currentVersion:'1.0.0', cwd:'/neutral', home:'/home/u', env:{},
|
|
160
|
+
runtime:shell ? {kind:'bundled', command:'node', args:[`${piRoot('selected')}/${CLI}`]} : {kind:'path', command:`${piRoot('selected')}/${CLI}`, args:[]},
|
|
161
|
+
out:(line: string) => out.push(line), adapters:{which:async (name: string) => name === 'pnpm' ? '/fake/pnpm' : null, fs:{realpath, readFile}, run}}};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Match the launcher's success/throw handling while exercising updateSelectedPi.
|
|
165
|
+
async function captureUpdate(input: Parameters<typeof updateSelectedPi>[0], out: string[]) {
|
|
166
|
+
let exitCode, stderr = '';
|
|
167
|
+
try { exitCode = await updateSelectedPi(input); }
|
|
168
|
+
catch (error) { exitCode = 1; stderr = `${error instanceof Error ? error.message : String(error)}\n`; }
|
|
169
|
+
return {exitCode, stdout:out.map(line => `${line}\n`).join(''), stderr};
|
|
170
|
+
}
|
|
171
|
+
|
|
90
172
|
test('prefix distribution still redirects self update and forwards only extensions for all', () => {
|
|
91
173
|
assert.deepEqual(bundledUpdatePlan(['update']), {self: true});
|
|
92
174
|
assert.deepEqual(bundledUpdateNext(bundledUpdatePlan(['update']), 0), {exitCode: 0});
|
|
@@ -107,10 +189,37 @@ test('all strips only self update before forwarding extension flags', () => {
|
|
|
107
189
|
assert.deepEqual(managedUpdatePlan(['update', '--all', '--approve']), {self: true, piArgs: ['update', '--extensions', '--approve']});
|
|
108
190
|
});
|
|
109
191
|
|
|
192
|
+
for (const [name, options] of Object.entries({'pnpm global Pi': {runtime:'path'}, 'pnpm adjacent peer': {}, 'npm global Pi': {npm:true, runtime:'path'}, 'npm adjacent peer': {npm:true}})) test(`${name} resolves the stable latest tag before its owned update`, async () => {
|
|
193
|
+
const f = fixture(options);
|
|
194
|
+
assert.equal(await updateSelectedPi(f.input), 0);
|
|
195
|
+
const view = f.probes.find(args => args.includes('view'));
|
|
196
|
+
assert.ok(view?.includes(`${PI}@latest`));
|
|
197
|
+
if (!options.npm) assert.ok(view?.includes('--config.global=true'));
|
|
198
|
+
assert.equal(f.mutations.length, 1);
|
|
199
|
+
assert.equal(f.out.length, 1);
|
|
200
|
+
assert.match(f.out[0], /the selected Pi is now 1\.2\.0/);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('global pnpm keeps existing release-age exclusions and excludes only Pi additionally', async () => {
|
|
204
|
+
const f = fixture({runtime:'path'});
|
|
205
|
+
assert.equal(await updateSelectedPi(f.input), 0);
|
|
206
|
+
assert.ok(f.probes.some(args => args.includes('config') && args.includes('minimumReleaseAgeExclude')));
|
|
207
|
+
assert.ok(f.mutations[0].includes('--config.minimum-release-age-exclude=existing-fixture'));
|
|
208
|
+
assert.ok(f.mutations[0].includes(`--config.minimum-release-age-exclude=${PI}`));
|
|
209
|
+
assert.ok(!f.mutations[0].some(arg => /^--(?:config\.)?minimum-release-age=/.test(arg)));
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
for (const npm of [false, true]) test(`global ${npm ? 'npm' : 'pnpm'} refuses a nonstable latest tag without mutation`, async () => {
|
|
213
|
+
const f = fixture({npm, latest:'1.3.0-rc.1'});
|
|
214
|
+
await assert.rejects(updateSelectedPi(f.input), /latest published Pi.*rejected/);
|
|
215
|
+
assert.deepEqual(f.mutations, []);
|
|
216
|
+
assert.deepEqual(f.out, []);
|
|
217
|
+
});
|
|
218
|
+
|
|
110
219
|
for (const windows of [false, true]) test(`an adjacent peer is refreshed by reinstalling its Shell package at the same version, never the separate global Pi (windows: ${windows})`, async () => {
|
|
111
220
|
const f = fixture({windows});
|
|
112
221
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
113
|
-
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi']]);
|
|
222
|
+
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi', ...AGE]]);
|
|
114
223
|
assert.deepEqual(f.out, ['pnpm installed gentle-pi@4.1.0; the selected Pi is now 1.2.0 (was 1.1.0).']);
|
|
115
224
|
assert.equal(f.state.group, '1.1.0');
|
|
116
225
|
});
|
|
@@ -118,11 +227,44 @@ for (const windows of [false, true]) test(`an adjacent peer is refreshed by rein
|
|
|
118
227
|
for (const runtime of ['path', 'env']) test(`a ${runtime} runtime sharing the store entry is updated through its own global Pi package`, async () => {
|
|
119
228
|
const f = fixture({runtime});
|
|
120
229
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
121
|
-
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@
|
|
122
|
-
assert.deepEqual(f.out, [`pnpm installed ${PI}@
|
|
230
|
+
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@1.2.0`, ...AGE]]);
|
|
231
|
+
assert.deepEqual(f.out, [`pnpm installed ${PI}@1.2.0; the selected Pi is now 1.2.0 (was 1.1.0).`]);
|
|
123
232
|
assert.equal(f.state.peer, '1.1.0');
|
|
124
233
|
});
|
|
125
234
|
|
|
235
|
+
for (const shell of [false, true]) test(`same global supplier is read back after updating ${shell ? 'a Shell peer' : 'Pi directly'}`, async () => {
|
|
236
|
+
const f = supplierFixture({shell});
|
|
237
|
+
const decoyBefore = await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`);
|
|
238
|
+
const selectedRoot = shell ? f.shellRoot('selected') : f.piRoot('selected');
|
|
239
|
+
const result = await captureUpdate(f.input, f.out);
|
|
240
|
+
const spec = shell ? 'gentle-pi@4.1.0' : `${PI}@2.0.0`;
|
|
241
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, ...(shell ? ['--allow-build=gentle-pi'] : []), ...AGE]]);
|
|
242
|
+
assert.deepEqual(f.state, {decoy:'1.0.0', selected:'2.0.0'});
|
|
243
|
+
assert.equal(await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`), decoyBefore);
|
|
244
|
+
assert.notEqual(shell ? f.shellRoot('selected') : f.piRoot('selected'), selectedRoot);
|
|
245
|
+
assert.deepEqual(result, {exitCode:0, stdout:`pnpm installed ${spec}; the selected Pi is now 2.0.0 (was 1.0.0).\n`, stderr:''});
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
test('same global supplier still rejects a stale selected Pi when the decoy already has latest', async () => {
|
|
249
|
+
const f = supplierFixture({decoyVersion:'2.0.0', selectedAfter:'1.0.0'});
|
|
250
|
+
const decoyBefore = await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`);
|
|
251
|
+
const result = await captureUpdate(f.input, f.out);
|
|
252
|
+
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@2.0.0`, ...AGE]]);
|
|
253
|
+
assert.deepEqual(f.state, {decoy:'2.0.0', selected:'1.0.0'});
|
|
254
|
+
assert.equal(await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`), decoyBefore);
|
|
255
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: pnpm supplied Pi 1.0.0, not the latest published Pi 2.0.0; inspect the installation before retrying.\n'});
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
test('a single global Pi supplier still reports its new version after its store path changes', async () => {
|
|
259
|
+
const f = fixture({runtime:'path'});
|
|
260
|
+
const link = `/pnpm/global/v11/g2/node_modules/${PI}`;
|
|
261
|
+
const oldRoot = await f.input.adapters.fs.realpath(link);
|
|
262
|
+
const result = await captureUpdate(f.input, f.out);
|
|
263
|
+
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@1.2.0`, ...AGE]]);
|
|
264
|
+
assert.notEqual(await f.input.adapters.fs.realpath(link), oldRoot);
|
|
265
|
+
assert.deepEqual(result, {exitCode:0, stdout:`pnpm installed ${PI}@1.2.0; the selected Pi is now 1.2.0 (was 1.1.0).\n`, stderr:''});
|
|
266
|
+
});
|
|
267
|
+
|
|
126
268
|
test('npm nests the peer under Shell and reinstalls Shell for it', async () => {
|
|
127
269
|
const f = fixture({npm: true});
|
|
128
270
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
@@ -135,10 +277,70 @@ test('npm nests the peer under Shell and reinstalls Shell for it', async () => {
|
|
|
135
277
|
const MAIN = '4.2.0-main.fb5e731119a7';
|
|
136
278
|
const native = (path: string, windows: boolean) => windows ? path.replaceAll('/', '\\') : path;
|
|
137
279
|
|
|
280
|
+
for (const main of [false, true]) test(`pnpm reads a replaced ${main ? 'main artifact' : 'release Shell'} group through its optional Pi peer`, async () => {
|
|
281
|
+
const f = supplierFixture({shell:true, shellVersion:main ? MAIN : '4.1.0', replaceGroup:true, withDecoy:false});
|
|
282
|
+
const beforeGroup = f.group('selected');
|
|
283
|
+
const data = {...f.data};
|
|
284
|
+
const artifact = await f.input.adapters.fs.readFile(f.tarball);
|
|
285
|
+
const result = await captureUpdate(f.input, f.out);
|
|
286
|
+
const spec = main ? f.tarball : 'gentle-pi@4.1.0';
|
|
287
|
+
assert.notEqual(f.group('selected'), beforeGroup);
|
|
288
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, '--allow-build=gentle-pi', ...AGE]]);
|
|
289
|
+
assert.deepEqual(f.state, {decoy:'1.0.0', selected:'2.0.0'});
|
|
290
|
+
assert.deepEqual(f.data, data);
|
|
291
|
+
assert.equal(await f.input.adapters.fs.readFile(f.tarball), artifact);
|
|
292
|
+
assert.deepEqual(result, {exitCode:0, stdout:`pnpm installed ${spec}; the selected Pi is now 2.0.0 (was 1.0.0).\n`, stderr:''});
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
for (const shell of [false, true]) test(`a replaced ${shell ? 'Shell peer' : 'Pi'} group follows the selected second supplier, not a decoy`, async () => {
|
|
296
|
+
const f = supplierFixture({shell, replaceGroup:true});
|
|
297
|
+
const beforeGroup = f.group('selected');
|
|
298
|
+
const decoy = await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`);
|
|
299
|
+
const data = {...f.data};
|
|
300
|
+
const result = await captureUpdate(f.input, f.out);
|
|
301
|
+
const spec = shell ? 'gentle-pi@4.1.0' : `${PI}@2.0.0`;
|
|
302
|
+
assert.notEqual(f.group('selected'), beforeGroup);
|
|
303
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, ...(shell ? ['--allow-build=gentle-pi'] : []), ...AGE]]);
|
|
304
|
+
assert.deepEqual(f.state, {decoy:'1.0.0', selected:'2.0.0'});
|
|
305
|
+
assert.equal(await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`), decoy);
|
|
306
|
+
assert.deepEqual(f.data, data);
|
|
307
|
+
assert.deepEqual(result, {exitCode:0, stdout:`pnpm installed ${spec}; the selected Pi is now 2.0.0 (was 1.0.0).\n`, stderr:''});
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
for (const shell of [false, true]) test(`a replaced ${shell ? 'Shell peer' : 'Pi'} group rejects a stale selected supplier even when a decoy is latest`, async () => {
|
|
311
|
+
const f = supplierFixture({shell, replaceGroup:true, decoyVersion:'2.0.0', selectedAfter:'1.0.0'});
|
|
312
|
+
const decoy = await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`);
|
|
313
|
+
const data = {...f.data};
|
|
314
|
+
const result = await captureUpdate(f.input, f.out);
|
|
315
|
+
const spec = shell ? 'gentle-pi@4.1.0' : `${PI}@2.0.0`;
|
|
316
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, ...(shell ? ['--allow-build=gentle-pi'] : []), ...AGE]]);
|
|
317
|
+
assert.deepEqual(f.state, {decoy:'2.0.0', selected:'1.0.0'});
|
|
318
|
+
assert.equal(await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`), decoy);
|
|
319
|
+
assert.deepEqual(f.data, data);
|
|
320
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: pnpm supplied Pi 1.0.0, not the latest published Pi 2.0.0; inspect the installation before retrying.\n'});
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
for (const [post, shell, replaceGroup] of [
|
|
324
|
+
['multiple', true, true], ['foreign-listing', true, true], ['wrong-from', true, true],
|
|
325
|
+
['wrong-shell', true, true], ['membership', true, true], ['listed-version', true, true],
|
|
326
|
+
['duplicate', true, false], ['wrong-pi', false, false], ['wrong-bin', false, false],
|
|
327
|
+
] as const) test(`readback remains unknown when supplier continuity is unverified: ${post}`, async () => {
|
|
328
|
+
const f = supplierFixture({shell, replaceGroup, post});
|
|
329
|
+
const decoy = await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`);
|
|
330
|
+
const data = {...f.data};
|
|
331
|
+
const result = await captureUpdate(f.input, f.out);
|
|
332
|
+
const spec = shell ? 'gentle-pi@4.1.0' : `${PI}@2.0.0`;
|
|
333
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, ...(shell ? ['--allow-build=gentle-pi'] : []), ...AGE]]);
|
|
334
|
+
assert.deepEqual(f.state, {decoy:'1.0.0', selected:'2.0.0'});
|
|
335
|
+
assert.equal(await f.input.adapters.fs.readFile(`${f.piRoot('decoy')}/package.json`), decoy);
|
|
336
|
+
assert.deepEqual(f.data, data);
|
|
337
|
+
assert.deepEqual(result, {exitCode:0, stdout:`pnpm installed ${spec}. The Pi version it now supplies could not be read back; run 'gentle-shell --version' to check it.\n`, stderr:''});
|
|
338
|
+
});
|
|
339
|
+
|
|
138
340
|
for (const windows of [false, true]) test(`a main-channel Shell is reinstalled from its recorded tarball, never from the registry (windows: ${windows})`, async () => {
|
|
139
341
|
const f = fixture({windows, shellVersion: MAIN});
|
|
140
342
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
141
|
-
assert.deepEqual(f.mutations, [['add', '-g', native(f.tarball, windows), '--allow-build=gentle-pi']]);
|
|
343
|
+
assert.deepEqual(f.mutations, [['add', '-g', native(f.tarball, windows), '--allow-build=gentle-pi', ...AGE]]);
|
|
142
344
|
assert.deepEqual(f.out, [`pnpm installed ${native(f.tarball, windows)}; the selected Pi is now 1.2.0 (was 1.1.0).`]);
|
|
143
345
|
assert.equal(f.state.group, '1.1.0');
|
|
144
346
|
});
|
|
@@ -152,7 +354,75 @@ test('npm reinstalls a main-channel Shell from its recorded tarball', async () =
|
|
|
152
354
|
test('a main-channel tarball is found under GENTLE_PI_CONFIG_HOME', async () => {
|
|
153
355
|
const f = fixture({shellVersion: MAIN, configHome: '/custom/config'});
|
|
154
356
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
155
|
-
assert.deepEqual(f.mutations, [['add', '-g', '/custom/config/main/packages/gentle-pi-4.2.0-main.fb5e731119a7.tgz', '--allow-build=gentle-pi']]);
|
|
357
|
+
assert.deepEqual(f.mutations, [['add', '-g', '/custom/config/main/packages/gentle-pi-4.2.0-main.fb5e731119a7.tgz', '--allow-build=gentle-pi', ...AGE]]);
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// Pi 1.5.2 pins its co-published @earendil-works packages exactly; pnpm's
|
|
361
|
+
// strict release-age mode cannot approve them under --no-save.
|
|
362
|
+
const DEPENDENCIES = {'@earendil-works/pi-ai':'1.2.0', '@earendil-works/pi-tui':'1.2.0', '@earendil-works/pi-ranged':'^1.2.0',
|
|
363
|
+
'@earendil-works/pi-next':'1.3.0-rc.1', undici:'7.0.0', chalk:'^5.0.0'};
|
|
364
|
+
// pi-ai pins pi-schema, which pins pi-ai back: the closure follows each once.
|
|
365
|
+
const SIBLINGS = {'@earendil-works/pi-ai@1.2.0':{'@earendil-works/pi-schema':'1.2.0', openai:'7.19.0'}, '@earendil-works/pi-schema@1.2.0':{'@earendil-works/pi-ai':'1.2.0'}};
|
|
366
|
+
const SIBLING_AGE = [...AGE, ...['pi-ai@1.2.0', 'pi-tui@1.2.0', 'pi-schema@1.2.0'].map(entry => `--config.minimum-release-age-exclude=@earendil-works/${entry}`)];
|
|
367
|
+
|
|
368
|
+
for (const [name, options] of Object.entries({'global Pi': {runtime:'path'}, 'Shell peer': {}, 'main artifact': {shellVersion:MAIN}} as Record<string, {runtime?: string, shellVersion?: string}>)) test(`pnpm ${name} also exempts only the Pi-scope packages the selected Pi pins exactly`, async () => {
|
|
369
|
+
const f = fixture({...options, piDependencies:DEPENDENCIES, siblingDependencies:SIBLINGS});
|
|
370
|
+
assert.equal(await updateSelectedPi(f.input), 0);
|
|
371
|
+
assert.deepEqual(f.probes.filter(args => args.includes('view') && args.includes('--json')),
|
|
372
|
+
[PI, '@earendil-works/pi-ai', '@earendil-works/pi-tui', '@earendil-works/pi-schema'].map(name => ['view', `${name}@1.2.0`, '--json', '--config.global=true']));
|
|
373
|
+
const spec = options.runtime ? `${PI}@1.2.0` : options.shellVersion ? f.tarball : 'gentle-pi@4.1.0';
|
|
374
|
+
assert.deepEqual(f.mutations, [['add', '-g', spec, ...(options.runtime ? [] : ['--allow-build=gentle-pi']), ...SIBLING_AGE]]);
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
test('global pnpm merges each sibling into its configured exclusion instead of being shadowed by it', async () => {
|
|
378
|
+
// pnpm applies only the first rule naming a package, so a later CLI entry
|
|
379
|
+
// for an already listed name would be ignored.
|
|
380
|
+
const existing = ['existing-fixture', '@earendil-works/pi-ai@1.0.0', `${PI}@1.0.0`, '@earendil-works/pi-tui', '@earendil-works/*', '@earendil-works/pi-ai@0.9.0 || 1.1.0'];
|
|
381
|
+
const f = fixture({runtime:'path', piDependencies:DEPENDENCIES, siblingDependencies:SIBLINGS, excludeOutput:JSON.stringify(existing)});
|
|
382
|
+
assert.equal(await updateSelectedPi(f.input), 0);
|
|
383
|
+
assert.deepEqual(f.mutations[0].filter(arg => arg.startsWith('--config.minimum-release-age-exclude=')).map(arg => arg.slice(arg.indexOf('=') + 1)),
|
|
384
|
+
['existing-fixture', '@earendil-works/pi-ai@1.0.0 || 0.9.0 || 1.1.0 || 1.2.0', PI, '@earendil-works/pi-tui', '@earendil-works/*', '@earendil-works/pi-schema@1.2.0']);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
for (const existing of ['@earendil-works/pi-ai@^1.0.0', '@earendil-works/pi-ai@1.0.0 || latest', `${PI}@`]) test(`global pnpm refuses an exclusion it cannot merge safely: ${existing}`, async () => {
|
|
388
|
+
const f = fixture({runtime:'path', piDependencies:DEPENDENCIES, siblingDependencies:SIBLINGS, excludeOutput:JSON.stringify(['existing-fixture', existing])});
|
|
389
|
+
const result = await captureUpdate(f.input, f.out);
|
|
390
|
+
assert.deepEqual(f.mutations, []);
|
|
391
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: pnpm release-age exclusions could not be verified. No installation changed.\n'});
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
test('global pnpm refuses before installing when a pinned sibling manifest cannot be read', async () => {
|
|
395
|
+
const f = fixture({runtime:'path', piDependencies:DEPENDENCIES, siblingDependencies:{...SIBLINGS, '@earendil-works/pi-schema@1.2.0':null}});
|
|
396
|
+
const result = await captureUpdate(f.input, f.out);
|
|
397
|
+
assert.deepEqual(f.mutations, []);
|
|
398
|
+
assert.deepEqual(f.state, {peer:'1.1.0', group:'1.1.0'});
|
|
399
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: the published dependencies of @earendil-works/pi-schema@1.2.0 could not be verified. No installation changed.\n'});
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
test('global pnpm refuses an unbounded chain of pinned siblings without installing', async () => {
|
|
403
|
+
const chain = Object.fromEntries(Array.from({length:40}, (_, i) => [`@earendil-works/pi-chain-${i}@1.2.0`, {[`@earendil-works/pi-chain-${i + 1}`]:'1.2.0'}]));
|
|
404
|
+
const f = fixture({runtime:'path', piDependencies:{'@earendil-works/pi-chain-0':'1.2.0'}, siblingDependencies:chain});
|
|
405
|
+
const result = await captureUpdate(f.input, f.out);
|
|
406
|
+
assert.deepEqual(f.mutations, []);
|
|
407
|
+
assert.equal(f.probes.filter(args => args.includes('--json')).length, 33);
|
|
408
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: Pi 1.2.0 pins more than 32 @earendil-works packages; their release age could not be verified. No installation changed.\n'});
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
test('npm never reads the Pi manifest or passes pnpm release-age exclusions', async () => {
|
|
412
|
+
const f = fixture({npm:true, runtime:'path', piDependencies:DEPENDENCIES});
|
|
413
|
+
assert.equal(await updateSelectedPi(f.input), 0);
|
|
414
|
+
assert.deepEqual(f.probes.filter(args => args.includes('--json')), []);
|
|
415
|
+
assert.deepEqual(f.mutations, [['install', '-g', `${PI}@1.2.0`, '--ignore-scripts']]);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
for (const [name, manifestView] of Object.entries({'a failed lookup': {code:1, stdout:''}, 'unparsable output': {code:0, stdout:'{'},
|
|
419
|
+
'another package version': {code:0, stdout:JSON.stringify({name:PI, version:'1.1.0'})},
|
|
420
|
+
'malformed dependencies': {code:0, stdout:JSON.stringify({name:PI, version:'1.2.0', dependencies:{'@earendil-works/pi-ai':1}})}})) test(`pnpm refuses before installing when the selected Pi manifest has ${name}`, async () => {
|
|
421
|
+
const f = fixture({runtime:'path', manifestView});
|
|
422
|
+
const result = await captureUpdate(f.input, f.out);
|
|
423
|
+
assert.deepEqual(f.mutations, []);
|
|
424
|
+
assert.deepEqual(f.state, {peer:'1.1.0', group:'1.1.0'});
|
|
425
|
+
assert.deepEqual(result, {exitCode:1, stdout:'', stderr:'gentle-shell update: the published dependencies of Pi 1.2.0 could not be verified. No installation changed.\n'});
|
|
156
426
|
});
|
|
157
427
|
|
|
158
428
|
test('a missing main-channel tarball names the rebuild command and installs nothing', async () => {
|
|
@@ -181,27 +451,32 @@ test('a main-channel Shell without a home directory is refused without mutation'
|
|
|
181
451
|
for (const runtime of ['path', 'env']) test(`a main-channel Shell never redirects the update of a selected ${runtime} Pi`, async () => {
|
|
182
452
|
const f = fixture({runtime, shellVersion: MAIN, artifact: false});
|
|
183
453
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
184
|
-
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@
|
|
454
|
+
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@1.2.0`, ...AGE]]);
|
|
185
455
|
});
|
|
186
456
|
|
|
187
457
|
test('an npm PATH runtime updates the global Pi without its scripts', async () => {
|
|
188
458
|
const f = fixture({npm: true, runtime: 'path'});
|
|
189
459
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
190
|
-
assert.deepEqual(f.mutations, [['install', '-g', `${PI}@
|
|
460
|
+
assert.deepEqual(f.mutations, [['install', '-g', `${PI}@1.2.0`, '--ignore-scripts']]);
|
|
191
461
|
});
|
|
192
462
|
|
|
193
|
-
test('an unchanged pnpm result
|
|
194
|
-
const f = fixture({peerAfter: '1.1.0'});
|
|
463
|
+
test('an unchanged pnpm result reports the selected Pi without an obsolete release-age warning', async () => {
|
|
464
|
+
const f = fixture({peerAfter: '1.1.0', latest: '1.1.0'});
|
|
195
465
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
196
|
-
assert.
|
|
197
|
-
|
|
198
|
-
|
|
466
|
+
assert.deepEqual(f.out, ['pnpm installed gentle-pi@4.1.0, and the selected Pi is still 1.1.0.']);
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
test('a manager that supplies a different Pi does not silently claim the latest update succeeded', async () => {
|
|
470
|
+
const f = fixture({peerAfter:'1.1.0'});
|
|
471
|
+
await assert.rejects(updateSelectedPi(f.input), /supplied Pi 1\.1\.0, not the latest published Pi 1\.2\.0/);
|
|
472
|
+
assert.equal(f.mutations.length, 1);
|
|
473
|
+
assert.deepEqual(f.out, []);
|
|
199
474
|
});
|
|
200
475
|
|
|
201
476
|
test('every package manager call runs from the neutral directory, never the project cwd', async () => {
|
|
202
477
|
const f = fixture();
|
|
203
478
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
204
|
-
assert.deepEqual(f.cwds, ['/neutral', '/neutral', '/neutral']);
|
|
479
|
+
assert.deepEqual(f.cwds, ['/neutral', '/neutral', '/neutral', '/neutral', '/neutral', '/neutral']);
|
|
205
480
|
});
|
|
206
481
|
|
|
207
482
|
test('an unreadable readback is reported, not invented', async () => {
|
|
@@ -213,7 +488,7 @@ test('an unreadable readback is reported, not invented', async () => {
|
|
|
213
488
|
test('separate aggregated groups do not block the Shell reinstall', async () => {
|
|
214
489
|
const f = fixture({groups: 'separate'});
|
|
215
490
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
216
|
-
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi']]);
|
|
491
|
+
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi', ...AGE]]);
|
|
217
492
|
});
|
|
218
493
|
|
|
219
494
|
for (const [name, options] of Object.entries({
|
|
@@ -236,7 +511,7 @@ for (const [name, options] of Object.entries({
|
|
|
236
511
|
for (const [name, options] of Object.entries({'pnpm POSIX shim': {shim: 'posix', runtime: 'path'}, 'Windows .CMD shim': {shim: 'windows', runtime: 'path', windows: true}, 'GENTLE_SHELL_PI shim override': {shim: 'posix', runtime: 'env'}})) test(`a ${name} resolves to the global Pi it runs`, async () => {
|
|
237
512
|
const f = fixture(options);
|
|
238
513
|
assert.equal(await updateSelectedPi(f.input), 0);
|
|
239
|
-
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@
|
|
514
|
+
assert.deepEqual(f.mutations, [['add', '-g', `${PI}@1.2.0`, ...AGE]]);
|
|
240
515
|
});
|
|
241
516
|
|
|
242
517
|
for (const [name, shim] of Object.entries({'names several targets': 'two', 'is not a Pi entry': 'none'})) test(`a shim that ${name} is refused without mutation`, async () => {
|
|
@@ -271,7 +546,7 @@ test('a failed npm install shows its stderr error line before stdout', async ()
|
|
|
271
546
|
test('a failed install without output keeps the single line, naming the command it ran', async () => {
|
|
272
547
|
const f = fixture({installFailure: {}});
|
|
273
548
|
await assert.rejects(updateSelectedPi(f.input), {message: 'gentle-shell update: pnpm (/fake/pnpm) could not install gentle-pi@4.1.0'});
|
|
274
|
-
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi']]);
|
|
549
|
+
assert.deepEqual(f.mutations, [['add', '-g', 'gentle-pi@4.1.0', '--allow-build=gentle-pi', ...AGE]]);
|
|
275
550
|
});
|
|
276
551
|
|
|
277
552
|
test('a stderr warning never hides the ERR_PNPM line pnpm printed on stdout', async () => {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
|
|
6
|
+
// Owner decision (2026-11-11): Gentle Shell tracks Pi's latest release, so Pi's
|
|
7
|
+
// publisher scope is exempt from the release-age wait as a standing rule, not a
|
|
8
|
+
// per-version exception. Every other package still waits 72 hours.
|
|
9
|
+
|
|
10
|
+
const workspace = readFileSync(join(import.meta.dirname, "..", "pnpm-workspace.yaml"), "utf8");
|
|
11
|
+
|
|
12
|
+
// Every entry of a top-level YAML block list, up to the next top-level key. Comment
|
|
13
|
+
// and blank lines do not end the list; any other line inside it fails, so a form
|
|
14
|
+
// this scan does not understand can never hide an entry.
|
|
15
|
+
function listAfter(text: string, key: string): string[] {
|
|
16
|
+
const lines = text.split(/\r?\n/);
|
|
17
|
+
const start = lines.findIndex((line) => new RegExp(`^${key}:\\s*(?:#.*)?$`).test(line));
|
|
18
|
+
assert.ok(start >= 0, `${key} must be a YAML block list`);
|
|
19
|
+
const entries: string[] = [];
|
|
20
|
+
for (const line of lines.slice(start + 1)) {
|
|
21
|
+
if (/^\s*(?:#.*)?$/.test(line)) continue;
|
|
22
|
+
const entry = /^\s*-\s+(?:'([^']*)'|"([^"]*)"|([^\s#][^#]*?))\s*(?:#.*)?$/.exec(line);
|
|
23
|
+
if (entry) {
|
|
24
|
+
entries.push(entry[1] ?? entry[2] ?? entry[3]);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
assert.match(line, /^[^\s-]/, `unrecognized line inside ${key}: ${line}`);
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
return entries;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
test("the list scan reads entries after comments, blank lines and quotes up to the next key", () => {
|
|
34
|
+
const fixture = "minimumReleaseAgeExclude:\n - '@earendil-works/*'\n # a comment between entries\n\n - openai\n- \"x\" # trailing\ntrustPolicy: no-downgrade\n - not-in-the-list\n";
|
|
35
|
+
assert.deepEqual(listAfter(fixture, "minimumReleaseAgeExclude"), ["@earendil-works/*", "openai", "x"]);
|
|
36
|
+
assert.deepEqual(listAfter("minimumReleaseAgeExclude:\n - a\n # comment\n - b\n", "minimumReleaseAgeExclude"), ["a", "b"]);
|
|
37
|
+
assert.throws(() => listAfter("minimumReleaseAgeExclude:\n - a\n b: 1\n", "minimumReleaseAgeExclude"), /unrecognized line/);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("release age stays at 72 hours for every package", () => {
|
|
41
|
+
assert.deepEqual([...workspace.matchAll(/^minimumReleaseAge:\s*(\S+)\s*$/gm)].map((match) => match[1]), ["4320"]);
|
|
42
|
+
assert.doesNotMatch(workspace, /^minimumReleaseAgeStrict:/m);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("only Pi's publisher scope is exempt, for every version", () => {
|
|
46
|
+
assert.deepEqual(listAfter(workspace, "minimumReleaseAgeExclude"), ["@earendil-works/*"]);
|
|
47
|
+
});
|