gentle-pi 4.6.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 +65 -55
- package/assets/agents/gentle-ai-explore.md +4 -3
- package/assets/agents/gentle-ai-verify.md +23 -6
- package/assets/agents/gentle-ai-worker.md +9 -6
- package/assets/agents/jd-fix-agent.md +1 -0
- package/assets/agents/jd-judge-a.md +2 -3
- package/assets/agents/jd-judge-b.md +2 -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 +759 -16
- package/assets/design-canvas/canvas.js +2 -1497
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +6 -1
- package/assets/migrations/agent-body-history.json +40 -1
- package/assets/orchestrator-delegation-reference.md +10 -16
- package/assets/orchestrator-delegation.md +5 -5
- package/assets/orchestrator-full-delegation-card.md +64 -0
- package/assets/orchestrator-full-delegation.md +34 -0
- package/assets/orchestrator-memory.md +5 -5
- package/assets/orchestrator-prompts.md +2 -2
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +14 -13
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +12 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +21 -25
- package/bin/gentle-shell.mjs +292 -65
- 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/agent-status.md +61 -0
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +20 -10
- package/docs/delegated-verification.md +46 -8
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +40 -0
- package/docs/gentle-shell.md +91 -30
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +17 -4
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +142 -45
- package/docs/render-cache-performance.md +11 -1
- package/docs/review-coordinator.md +53 -0
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/review-request-context.md +19 -0
- package/docs/review-windows-acl.md +18 -0
- package/docs/voice.md +6 -3
- package/docs/work-continuity.md +11 -1
- package/docs/yolo-mode.md +5 -5
- package/extensions/ask-user-choice.ts +1 -0
- package/extensions/ask-user-question.ts +3 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/child-safety.ts +3 -0
- package/extensions/gentle-agent-status.ts +99 -0
- package/extensions/gentle-agents.ts +559 -66
- package/extensions/gentle-ai.ts +2001 -518
- 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 +398 -115
- package/extensions/gentle-todo.ts +66 -27
- package/extensions/gentle-tps.ts +48 -0
- package/extensions/quiet-tools.ts +38 -8
- package/extensions/skill-registry.ts +349 -167
- package/extensions/startup-banner.ts +30 -3
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-profile-pin.ts +3 -3
- package/lib/agent-profiles.ts +160 -2
- package/lib/agent-status.ts +105 -0
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +93 -6
- package/lib/agents-history.ts +24 -5
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +55 -7
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +272 -16
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-runtime.ts +1 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +197 -32
- package/lib/card-content-policy.ts +8 -6
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/command-palette.ts +133 -17
- package/lib/context-backstop.ts +14 -5
- 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 +236 -17
- package/lib/execution-surface-guard.ts +20 -0
- package/lib/exploration-budget.ts +4 -2
- package/lib/gentle-ai-binary.ts +1 -1
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +204 -14
- package/lib/gentle-shell-bundled.ts +106 -28
- package/lib/gentle-shell-launcher.ts +43 -8
- package/lib/herdr-activity.ts +14 -2
- package/lib/herdr-busy.ts +45 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/image-attachments.ts +33 -0
- package/lib/image-disk-cache.ts +137 -0
- package/lib/inprocess-reviewer.ts +358 -144
- package/lib/jobs-view.ts +198 -11
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +31 -4
- package/lib/nan-provider.ts +42 -28
- package/lib/native-choice-list.ts +20 -2
- package/lib/native-review-cli.ts +172 -20
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/orchestrator-mode-policy.ts +105 -0
- package/lib/questionnaire/questionnaire-view.ts +105 -12
- package/lib/rdd-mode-control.ts +32 -0
- package/lib/reply-language-anchor.ts +129 -0
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-blocker.ts +92 -0
- package/lib/review-candidate-symlink-scan.ts +136 -0
- package/lib/review-candidate-view-owner.ts +81 -44
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +116 -0
- package/lib/review-coordinator.ts +407 -0
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-failure-facts.ts +49 -0
- package/lib/review-host-relay.ts +51 -11
- package/lib/review-integration-v2.ts +63 -4
- package/lib/review-relay-phase-timing.ts +45 -0
- package/lib/review-start-context.ts +17 -0
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +4 -2
- package/lib/shell-bar.ts +140 -58
- package/lib/shell-changes.ts +2 -0
- package/lib/shell-panel.ts +17 -3
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-sidebar-layout.ts +112 -40
- package/lib/shell-sidebar.ts +7 -0
- package/lib/shell-todo.ts +10 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/verifier-admission.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/visual-customization-policy.ts +36 -16
- package/lib/visual-customize-view.ts +216 -21
- package/lib/visual-layout-preview.ts +9 -5
- package/lib/visual-profiles.ts +2 -2
- package/lib/windows-session-transport.ts +53 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +46 -16
- package/package.json +3 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-ai-binary.mjs +1 -1
- package/runtime/gentle-shell-bundled.mjs +106 -28
- package/runtime/gentle-shell-launcher.mjs +42 -7
- package/runtime/native-review-cli.mjs +169 -17
- package/runtime/review-integration-v2.mjs +63 -4
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +179 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/bundled-install.mjs +38 -8
- package/scripts/download-progress.mjs +68 -0
- package/scripts/gentle-ai-installer.mjs +41 -18
- package/scripts/gentle-ai-proxy.mjs +294 -0
- package/scripts/install-gentle-ai.mjs +14 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +33 -22
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-runner.mjs +27 -12
- package/scripts/installer-server.mjs +46 -16
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/render-cache-host.mjs +72 -0
- package/scripts/render-cache-performance-worker.mjs +5 -4
- package/scripts/render-cache-performance.mjs +6 -1
- package/scripts/run-test-suite.mjs +40 -28
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +50 -19
- package/scripts/voice-worker.cjs +32 -6
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +16 -13
- package/skills/gentle-ai/SKILL.md +7 -7
- package/skills/gentle-ui-design/SKILL.md +46 -0
- package/skills/gentle-ui-design/references/adaptive-interfaces.md +46 -0
- package/skills/gentle-ui-design/references/browse-and-compare.md +62 -0
- package/skills/gentle-ui-design/references/composition-and-feedback.md +56 -0
- package/skills/gentle-ui-design/references/task-and-content.md +60 -0
- 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 -11
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +10 -11
- package/tests/agent-home.test.ts +28 -9
- package/tests/agent-profiles-workflow.test.ts +163 -0
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-risk-escalation.test.ts +1 -1
- package/tests/agent-status.test.ts +143 -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 +106 -1
- package/tests/agents-history.test.ts +31 -0
- package/tests/agents-jobs-frames.test.ts +93 -0
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-prompt-lifecycle-runtime.test.ts +376 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner-drain.test.ts +193 -0
- package/tests/agents-runner.test.ts +215 -3
- 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 +12 -1
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +4 -3
- package/tests/ask-user-question.test.ts +99 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-runtime.test.ts +1 -1
- package/tests/autonomous-guard.test.ts +346 -10
- package/tests/bounded-stop-contract.test.ts +51 -3
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bridge-cost.test.ts +19 -4
- package/tests/bundled-install.test.ts +31 -6
- package/tests/card-content-policy.test.ts +3 -3
- package/tests/chained-pr-skill.test.ts +8 -6
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-safety.test.ts +11 -0
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codegraph-tools.test.ts +11 -5
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/command-palette.test.ts +284 -1
- package/tests/delegate-for-reason-contract.test.ts +32 -10
- 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 -695
- 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/destructive-command-guard.test.ts +52 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/download-progress.test.ts +71 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/execution-surface-guard.test.ts +55 -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 +26 -31
- package/tests/fixtures/proxy-tls/proxy.crt +19 -0
- package/tests/fixtures/proxy-tls/proxy.key +28 -0
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/gentle-ai-reviewer.ts +89 -0
- package/tests/fixtures/session-profile-v1/replay.ts +53 -6
- package/tests/full-delegation-closure.test.ts +160 -0
- package/tests/full-delegation-notices.test.ts +76 -0
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agent-status.test.ts +74 -0
- package/tests/gentle-agents-child-jobs.test.ts +237 -0
- package/tests/gentle-agents.test.ts +1403 -20
- package/tests/gentle-ai-binary.test.ts +3 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-elapsed-store.test.ts +19 -0
- package/tests/gentle-ai-exploration-budget.test.ts +18 -2
- package/tests/gentle-ai-installer.test.ts +135 -51
- package/tests/gentle-ai-proxy.test.ts +434 -0
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +233 -43
- package/tests/gentle-design.test.ts +386 -1
- package/tests/gentle-herdr-activity.test.ts +9 -6
- package/tests/gentle-shell-bin.test.ts +123 -0
- package/tests/gentle-shell-bundled.test.ts +293 -31
- package/tests/gentle-shell-launcher.test.ts +78 -11
- package/tests/gentle-shell.test.ts +1017 -146
- package/tests/gentle-todo.test.ts +51 -11
- package/tests/gentle-tps.test.ts +123 -0
- package/tests/gentle-ui-design-skill.test.ts +59 -0
- package/tests/herdr-busy.test.ts +59 -0
- package/tests/herdr-task-summary-policy.test.ts +8 -4
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/image-disk-cache.test.ts +163 -0
- package/tests/independent-recovery-delivery.test.ts +97 -0
- package/tests/inprocess-reviewer.test.ts +249 -4
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +115 -14
- package/tests/installer-preflight.test.ts +54 -5
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-runner.test.ts +79 -44
- package/tests/installer-server.test.ts +215 -13
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/jobs-view.test.ts +260 -6
- 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/modal-mouse-boundaries.test.ts +136 -0
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/model-routing-authority.test.ts +178 -2
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-choice-list.test.ts +77 -2
- package/tests/native-review-capability-contract.test.ts +17 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-cli.test.ts +269 -1
- 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 +13 -2
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +3 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +35 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +154 -0
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-mode-policy.test.ts +175 -0
- package/tests/orchestrator-prompt-budget.test.ts +13 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +4 -3
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +16 -13
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +372 -0
- 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 +25 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-config.test.ts +58 -0
- 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/primary-session-prompt.test.ts +13 -0
- package/tests/profile-pin.test.ts +29 -2
- package/tests/profile-tier-footer.test.ts +5 -0
- package/tests/profiles-panel-delegation-mode.test.ts +422 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/questionnaire-view.test.ts +115 -0
- package/tests/quiet-bash-runtime.test.ts +1 -1
- package/tests/quiet-tool-rendering.test.ts +48 -0
- package/tests/rdd-aware-verification-contract.test.ts +17 -12
- package/tests/rdd-customize.test.ts +287 -0
- package/tests/rdd-mode-cache.test.ts +450 -0
- package/tests/rdd-mode-control.test.ts +407 -0
- package/tests/rdd-mode-scope-regression.test.ts +137 -0
- package/tests/rdd-off-independent-regression.test.ts +69 -0
- package/tests/rdd-status-line.test.ts +112 -1
- package/tests/render-cache-performance.test.ts +171 -2
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +189 -0
- 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 +80 -2
- package/tests/review-blocker.test.ts +193 -0
- package/tests/review-candidate-owner-retry.test.ts +1 -1
- package/tests/review-candidate-symlink-scan.test.ts +157 -0
- package/tests/review-candidate-view.test.ts +66 -1
- package/tests/review-candidate-windows-boundary.test.ts +131 -0
- package/tests/review-candidate-windows-probe.test.ts +63 -0
- package/tests/review-committed-restart-ack.test.ts +129 -0
- package/tests/review-continuation-registry.test.ts +107 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller-native-routing.test.ts +261 -5
- package/tests/review-controller-workspace-root.test.ts +230 -3
- package/tests/review-controller.test.ts +98 -12
- 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-runtime.test.ts +117 -0
- package/tests/review-coordinator.test.ts +462 -0
- 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-failure-facts.test.ts +87 -0
- package/tests/review-host-relay-routing.test.ts +258 -4
- package/tests/review-host-relay.test.ts +39 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-integration-v2.test.ts +46 -3
- package/tests/review-json-arguments.test.ts +105 -11
- package/tests/review-last-event-closure.test.ts +68 -0
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +95 -32
- 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-owner-identity.test.ts +60 -24
- package/tests/review-relay-phase-timing.test.ts +128 -0
- package/tests/review-relay-transport-agent.test.ts +39 -2
- package/tests/review-reviewer-evidence.test.ts +223 -0
- package/tests/review-risk-assessment.test.ts +126 -8
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +53 -3
- package/tests/review-start-context.test.ts +19 -0
- package/tests/review-tool-prose-budget.test.ts +122 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/run-test-suite.test.ts +122 -1
- package/tests/runtime-harness.mjs +4 -1
- package/tests/sensitive-path-tools.test.ts +181 -5
- package/tests/session-profile-append-controller-pi.test.ts +60 -31
- package/tests/session-profile-binding.test.ts +19 -1
- package/tests/session-profile-disk-reader-pi.test.ts +58 -16
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/session-profile-v1-compat.test.ts +35 -1
- package/tests/shell-bar.test.ts +186 -42
- package/tests/shell-panel.test.ts +50 -22
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-sidebar-fullscreen.test.ts +5 -5
- package/tests/shell-sidebar-layout.test.ts +294 -23
- package/tests/shell-sidebar-scroll-benchmark.test.ts +1 -1
- package/tests/shell-surface-transparent.test.ts +89 -0
- package/tests/shell-todo.test.ts +12 -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 +1461 -5
- package/tests/startup-banner.test.ts +152 -1
- package/tests/startup-home-repo.test.ts +2 -0
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +264 -0
- package/tests/task-size-routing-contract.test.ts +45 -12
- 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-admission.test.ts +49 -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 +162 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/visual-customization-policy.test.ts +39 -6
- package/tests/visual-customize-view.test.ts +573 -9
- package/tests/visual-layout-preview.test.ts +15 -1
- package/tests/visual-profiles.test.ts +11 -0
- package/tests/voice-worker.test.ts +73 -2
- package/tests/windows-session-transport.test.ts +126 -0
- package/tests/work-continuity-contract.test.ts +77 -6
- 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 +276 -0
- package/tests/yolo-customize.test.ts +27 -4
- package/tests/yolo-mode.test.ts +62 -18
- package/tests/yolo-session-policy.test.ts +270 -1
- 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
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import childProcess, { execFileSync } from "node:child_process";
|
|
3
|
+
import { syncBuiltinESMExports } from "node:module";
|
|
4
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import test from "node:test";
|
|
8
|
+
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
9
|
+
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
10
|
+
|
|
11
|
+
// Markers are assembled at runtime so no line of this file starts with one.
|
|
12
|
+
const OPEN = "<".repeat(7), MID = "=".repeat(7), CLOSE = ">".repeat(7);
|
|
13
|
+
const CONFLICT = ["base", `${OPEN} ours`, "left", MID, "right", `${CLOSE} theirs`, ""].join("\n");
|
|
14
|
+
|
|
15
|
+
function fixture(t: { after(fn: () => void): void }) {
|
|
16
|
+
const scratch = mkdtempSync(join(tmpdir(), "conflict-markers-"));
|
|
17
|
+
t.after(() => rmSync(scratch, { recursive: true, force: true }));
|
|
18
|
+
const previousConfig = process.env.GENTLE_PI_CONFIG_HOME;
|
|
19
|
+
process.env.GENTLE_PI_CONFIG_HOME = join(scratch, "config");
|
|
20
|
+
mkdirSync(process.env.GENTLE_PI_CONFIG_HOME);
|
|
21
|
+
t.after(() => { if (previousConfig === undefined) delete process.env.GENTLE_PI_CONFIG_HOME; else process.env.GENTLE_PI_CONFIG_HOME = previousConfig; });
|
|
22
|
+
const repo = (name: string) => {
|
|
23
|
+
const root = join(scratch, name);
|
|
24
|
+
mkdirSync(root);
|
|
25
|
+
const git = (...args: string[]) => execFileSync("git", ["-c", "user.name=Fixture", "-c", "user.email=fixture@example.com", "-c", "commit.gpgsign=false", ...args],
|
|
26
|
+
{ cwd: root, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
27
|
+
git("init", "-q", "-b", "main");
|
|
28
|
+
writeFileSync(join(root, "app.txt"), "base\n");
|
|
29
|
+
git("add", "."); git("commit", "-qm", "base");
|
|
30
|
+
return { root, git, write: (path: string, content: string | Buffer) => writeFileSync(join(root, path), content) };
|
|
31
|
+
};
|
|
32
|
+
return { scratch, repo };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Mode = "on" | "off" | "unknown";
|
|
36
|
+
function hook(cwd: string, options: { mode?: Mode; child?: boolean } = {}) {
|
|
37
|
+
const handlers = new Map<string, Function>();
|
|
38
|
+
const cli = options.mode === "unknown" ? null : {
|
|
39
|
+
reviewMode: async () => ({ status: { effective: options.mode ?? "off", global: options.mode ?? "off", cloneLocal: "", source: "global" } }),
|
|
40
|
+
assess: async () => { throw new Error("no assessment in this fixture"); },
|
|
41
|
+
};
|
|
42
|
+
const pi = { on: (name: string, handler: Function) => handlers.set(name, handler), events: { emit() {} }, registerCommand() {}, registerTool() {} };
|
|
43
|
+
createGentleAiExtension({ nativeReviewCli: cli as never, processEnv: { GENTLE_AI_TELEMETRY: "0", ...(options.child ? { GENTLE_PI_AGENTS_CHILD: "1" } : {}) } })(pi as never);
|
|
44
|
+
const ctx = { cwd, hasUI: true, sessionManager: { getSessionId: () => "markers", getCwd: () => cwd, getBranch: () => [], getEntries: () => [] }, ui: { notify() {}, confirm: async () => true } };
|
|
45
|
+
return async (command: string) => (await handlers.get("tool_call")!({ toolName: "bash", toolCallId: command, input: { command } }, ctx)) as { block?: boolean; reason?: string } | undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
test("P9: a staged conflict triple denies the commit with path:line, in every RDD mode", async t => {
|
|
49
|
+
const { repo } = fixture(t);
|
|
50
|
+
const { root, git, write } = repo("repo");
|
|
51
|
+
write("conflict.txt", CONFLICT); git("add", "conflict.txt");
|
|
52
|
+
for (const mode of ["off", "on", "unknown"] as const) {
|
|
53
|
+
const result = await hook(root, { mode })("git commit -m resolve");
|
|
54
|
+
assert.equal(result?.block, true, mode);
|
|
55
|
+
assert.match(result!.reason!, /^Conflict markers: this commit would add unresolved conflict markers .* at conflict\.txt:2\. This command was not run\. Resolve the markers and stage the result, then retry\. A file that holds markers on purpose is exempted by a `conflict-marker-size` attribute in `\.gitattributes`\.$/, mode);
|
|
56
|
+
}
|
|
57
|
+
const heredoc = await hook(root)("git commit -F - <<'EOF'\nresolve\nEOF");
|
|
58
|
+
assert.equal(heredoc?.block, true, "a heredoc message does not hide the commit");
|
|
59
|
+
assert.equal((await hook(root)("git merge --continue"))?.block, true, "a merge continuation records the index");
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test("P9: worktree-only markers pass a plain commit and deny commit -a", async t => {
|
|
63
|
+
const { repo } = fixture(t);
|
|
64
|
+
const { root, git, write } = repo("repo");
|
|
65
|
+
write("app.txt", CONFLICT);
|
|
66
|
+
const run = hook(root);
|
|
67
|
+
assert.equal(await run("git commit -m nothing-staged"), undefined);
|
|
68
|
+
for (const command of ["git commit -am resolve", "git commit -a -m resolve", "git commit --all -m resolve"]) {
|
|
69
|
+
const result = await run(command);
|
|
70
|
+
assert.equal(result?.block, true, command);
|
|
71
|
+
assert.match(result!.reason!, /app\.txt:2/, command);
|
|
72
|
+
}
|
|
73
|
+
git("add", "app.txt");
|
|
74
|
+
assert.equal((await run("git commit -m staged"))?.block, true);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("P9: a lone ======= underline, a binary file and an incomplete set are not conflicts", async t => {
|
|
78
|
+
const { repo } = fixture(t);
|
|
79
|
+
const { root, git, write } = repo("repo");
|
|
80
|
+
write("README.md", `Title\n${MID}\n\nBody\n`);
|
|
81
|
+
write("blob.bin", Buffer.concat([Buffer.from([0, 1, 2, 0]), Buffer.from(`\n${CONFLICT}`)]));
|
|
82
|
+
write("half.txt", `${MID}\n${CLOSE} theirs\n`);
|
|
83
|
+
git("add", ".");
|
|
84
|
+
assert.equal(await hook(root)("git commit -m docs"), undefined);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
test("P9: only added lines count, and conflict-marker-size is the on-purpose escape", async t => {
|
|
88
|
+
const { repo } = fixture(t);
|
|
89
|
+
const { root, git, write } = repo("repo");
|
|
90
|
+
write("fixture.txt", CONFLICT); git("add", "fixture.txt"); git("commit", "-qm", "pre-existing"); // recorded before this commit
|
|
91
|
+
write("fixture.txt", `${CONFLICT}tail\n`); git("add", "fixture.txt");
|
|
92
|
+
assert.equal(await hook(root)("git commit -m 'edit around existing markers'"), undefined, "markers already recorded are not added by this commit");
|
|
93
|
+
write("docs-conflict.md", `# Example\n\n${CONFLICT}`); git("add", ".");
|
|
94
|
+
assert.match((await hook(root)("git commit -m 'document a conflict'"))?.reason ?? "", /docs-conflict\.md:4/, "without the attribute the example is a conflict");
|
|
95
|
+
write(".gitattributes", "docs-conflict.md conflict-marker-size=32\n"); git("add", ".");
|
|
96
|
+
assert.equal(await hook(root)("git commit -m 'document a conflict'"), undefined, "the attribute changes the marker size for that file");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
test("P9: guard errors fail open and the directory forms check the right repository", async t => {
|
|
100
|
+
const { scratch, repo } = fixture(t);
|
|
101
|
+
const plain = join(scratch, "plain");
|
|
102
|
+
mkdirSync(plain);
|
|
103
|
+
assert.equal(await hook(plain)("git commit -m x"), undefined, "not a repository: the guard says nothing");
|
|
104
|
+
const dirty = repo("dirty"), clean = repo("clean");
|
|
105
|
+
dirty.write("conflict.txt", CONFLICT); dirty.git("add", ".");
|
|
106
|
+
const fromPlain = hook(plain);
|
|
107
|
+
for (const command of [`git -C ${dirty.root} commit -m x`, `cd ${dirty.root} && git commit -m x`, `cd ${dirty.root} && git add . && git commit -m x`]) {
|
|
108
|
+
const result = await fromPlain(command);
|
|
109
|
+
assert.equal(result?.block, true, command);
|
|
110
|
+
assert.match(result!.reason!, /conflict\.txt:2/, command);
|
|
111
|
+
}
|
|
112
|
+
const fromDirty = hook(dirty.root);
|
|
113
|
+
assert.equal(await fromDirty(`git -C ${clean.root} commit -m x`), undefined, "-C selects the clean repository");
|
|
114
|
+
assert.equal(await fromDirty(`cd ${clean.root} && git commit -m x`), undefined, "cd selects the clean repository");
|
|
115
|
+
assert.equal(await hook(dirty.root, { child: true })("git commit -m x"), undefined, "subagent sessions keep today's behavior");
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Verifier blocker 1: Git appends a TAB to `+++ b/<path>` when the path has spaces and C-quotes special names.
|
|
119
|
+
test("P9: paths with spaces, quotes and non-ASCII are read exactly, so the attribute escape works", async t => {
|
|
120
|
+
const { repo } = fixture(t);
|
|
121
|
+
const { root, git, write } = repo("repo");
|
|
122
|
+
mkdirSync(join(root, "tests"));
|
|
123
|
+
write("tests/a b.fixture", CONFLICT); git("add", ".");
|
|
124
|
+
const denied = await hook(root)("git commit -m x");
|
|
125
|
+
assert.equal(denied?.block, true);
|
|
126
|
+
assert.match(denied!.reason!, / at tests\/a b\.fixture:2\. /, "a clean path:line");
|
|
127
|
+
write(".gitattributes", "*.fixture conflict-marker-size=32\n"); git("add", ".");
|
|
128
|
+
assert.equal(await hook(root)("git commit -m x"), undefined, "the attribute applies to a path with a space");
|
|
129
|
+
for (const name of ["tests/café.txt", "tests/say \"hi\".txt"]) {
|
|
130
|
+
write(name, CONFLICT); git("add", "--", name);
|
|
131
|
+
const result = await hook(root)("git commit -m x");
|
|
132
|
+
assert.equal(result?.block, true, name);
|
|
133
|
+
assert.ok(result!.reason!.includes(` at ${name}:2. `), result!.reason!);
|
|
134
|
+
git("rm", "-q", "--cached", "--", name);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// Verifier blocker 2: staging in the same command runs after the hook, so predict what it would add.
|
|
139
|
+
test("P9: git add before git commit in the same command is checked", async t => {
|
|
140
|
+
const { repo } = fixture(t);
|
|
141
|
+
const { root, write } = repo("repo");
|
|
142
|
+
write("app.txt", CONFLICT);
|
|
143
|
+
const run = hook(root);
|
|
144
|
+
for (const command of ["git add app.txt && git commit -m y", "git add -A && git commit -m fix", "git add .; git commit -m y", "git add --all\ngit commit -m y", "git stage app.txt && git commit -m y", `git -C ${root} add -u && git -C ${root} commit -m y`, `cd ${root} && git add app.txt && git commit -m y`]) {
|
|
145
|
+
const result = await run(command);
|
|
146
|
+
assert.equal(result?.block, true, command);
|
|
147
|
+
assert.match(result!.reason!, / at app\.txt:2\. /, command);
|
|
148
|
+
}
|
|
149
|
+
write("clean.txt", "fine\n");
|
|
150
|
+
assert.equal(await run("git add clean.txt && git commit -m y"), undefined, "another unstaged file with markers is not added");
|
|
151
|
+
assert.equal(await run("git add -p && git commit -m y"), undefined, "an interactive add cannot be predicted: fail open");
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("P9: git add of an untracked file with markers is denied; add -u ignores untracked files", async t => {
|
|
155
|
+
const { repo } = fixture(t);
|
|
156
|
+
const { root, git, write } = repo("repo");
|
|
157
|
+
write("new.txt", CONFLICT);
|
|
158
|
+
const run = hook(root);
|
|
159
|
+
assert.match((await run("git add new.txt && git commit -m y"))?.reason ?? "", / at new\.txt:2\. /);
|
|
160
|
+
assert.match((await run("git add -A && git commit -m y"))?.reason ?? "", / at new\.txt:2\. /);
|
|
161
|
+
assert.equal(await run("git add -u && git commit -m y"), undefined);
|
|
162
|
+
write(".gitignore", "new.txt\n"); git("add", ".gitignore"); git("commit", "-qm", "ignore");
|
|
163
|
+
assert.equal(await run("git add -A && git commit -m y"), undefined, "ignored files are not added");
|
|
164
|
+
// A staged version with markers that the named add replaces with clean content is not counted.
|
|
165
|
+
write("app.txt", CONFLICT); git("add", "app.txt"); write("app.txt", "base\nfixed\n");
|
|
166
|
+
assert.equal(await run("git add app.txt && git commit -m y"), undefined);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
test("P9: builtin cd and command cd select the directory, never the session cwd", async t => {
|
|
170
|
+
const { scratch, repo } = fixture(t);
|
|
171
|
+
const dirty = repo("dirty"), clean = repo("clean");
|
|
172
|
+
dirty.write("conflict.txt", CONFLICT); dirty.git("add", ".");
|
|
173
|
+
const fromDirty = hook(dirty.root);
|
|
174
|
+
assert.equal(await fromDirty(`builtin cd ${clean.root} && git commit -m x`), undefined);
|
|
175
|
+
assert.equal(await fromDirty(`command cd ${clean.root} && git commit -m x`), undefined);
|
|
176
|
+
assert.equal(await fromDirty(`command -p cd ${clean.root} && git commit -m x`), undefined);
|
|
177
|
+
assert.equal((await hook(scratch)(`builtin cd ${dirty.root} && git commit -m x`))?.block, true);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
// Verifier advisory: content that came whole from the merged branch is not this commit's addition.
|
|
181
|
+
test("P9: concluding a merge counts only markers added against both parents", async t => {
|
|
182
|
+
const { repo } = fixture(t);
|
|
183
|
+
const { root, git, write } = repo("repo");
|
|
184
|
+
git("switch", "-q", "-c", "other");
|
|
185
|
+
write("example.md", `# Example\n\n${CONFLICT}`); write("app.txt", "theirs\n"); git("add", "."); git("commit", "-qm", "intentional example");
|
|
186
|
+
git("switch", "-q", "main");
|
|
187
|
+
write("app.txt", "ours\n"); git("commit", "-qam", "ours");
|
|
188
|
+
try { git("merge", "-q", "other"); } catch { /* conflict on app.txt */ }
|
|
189
|
+
write("app.txt", "resolved\n"); git("add", "app.txt");
|
|
190
|
+
const run = hook(root);
|
|
191
|
+
assert.equal(await run("git commit -m merge"), undefined, "a clean resolution of a merge that brings an intentional example");
|
|
192
|
+
assert.equal(await run("git merge --continue"), undefined);
|
|
193
|
+
write("app.txt", CONFLICT); git("add", "app.txt");
|
|
194
|
+
const unresolved = await run("git commit -m merge");
|
|
195
|
+
assert.equal(unresolved?.block, true);
|
|
196
|
+
assert.match(unresolved!.reason!, / at app\.txt:2\. /);
|
|
197
|
+
assert.doesNotMatch(unresolved!.reason!, /example\.md/);
|
|
198
|
+
assert.equal((await run("git merge --continue"))?.block, true);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
// The same both-sides rule with REBASE_HEAD: a picked commit that brings an intentional marker file is not
|
|
202
|
+
// this commit's addition; unresolved markers in the stopped file are.
|
|
203
|
+
test("P9: continuing a rebase counts only markers added against HEAD and the picked commit", async t => {
|
|
204
|
+
const { repo } = fixture(t);
|
|
205
|
+
const { root, git, write } = repo("repo");
|
|
206
|
+
git("switch", "-q", "-c", "side");
|
|
207
|
+
write("fx.txt", CONFLICT); write("app.txt", "side\n"); git("add", "."); git("commit", "-qm", "side with fixture");
|
|
208
|
+
git("switch", "-q", "main");
|
|
209
|
+
write("app.txt", "main\n"); git("commit", "-qam", "main change");
|
|
210
|
+
git("switch", "-q", "side");
|
|
211
|
+
try { git("rebase", "main"); } catch { /* stops on the app.txt conflict */ }
|
|
212
|
+
git("rev-parse", "-q", "--verify", "REBASE_HEAD");
|
|
213
|
+
const run = hook(root);
|
|
214
|
+
write("app.txt", "resolved\n"); git("add", "app.txt");
|
|
215
|
+
assert.equal(await run("git rebase --continue"), undefined, "case A: the fixture came whole from the picked commit");
|
|
216
|
+
write("app.txt", CONFLICT); git("add", "app.txt");
|
|
217
|
+
const unresolved = await run("git rebase --continue");
|
|
218
|
+
assert.equal(unresolved?.block, true, "case B: unresolved markers are denied");
|
|
219
|
+
assert.match(unresolved!.reason!, / at app\.txt:2\. /);
|
|
220
|
+
assert.doesNotMatch(unresolved!.reason!, /fx\.txt/);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
test("P9: pushes are not checked", async t => {
|
|
224
|
+
const { scratch, repo } = fixture(t);
|
|
225
|
+
const remote = join(scratch, "remote.git");
|
|
226
|
+
execFileSync("git", ["init", "-q", "--bare", remote]);
|
|
227
|
+
const { root, git, write } = repo("repo");
|
|
228
|
+
git("remote", "add", "origin", remote); git("push", "-q", "-u", "origin", "main");
|
|
229
|
+
write("conflict.txt", CONFLICT); git("add", "."); git("commit", "-qm", "bad resolution");
|
|
230
|
+
for (const command of ["git push", "git push origin main", "git push origin HEAD", "git push -u origin main"]) assert.equal(await hook(root)(command), undefined, command);
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("P9 preservation: a clean commit passes and RDD preflight denials keep their text and precedence", async t => {
|
|
234
|
+
const { scratch, repo } = fixture(t);
|
|
235
|
+
const { root, git, write } = repo("repo");
|
|
236
|
+
write("app.txt", "changed\n"); git("add", ".");
|
|
237
|
+
assert.equal(await hook(root)("git commit -m clean"), undefined);
|
|
238
|
+
const remote = join(scratch, "remote.git");
|
|
239
|
+
execFileSync("git", ["init", "-q", "--bare", remote]);
|
|
240
|
+
git("remote", "add", "origin", remote); git("commit", "-qm", "clean"); git("push", "-q", "-u", "origin", "main");
|
|
241
|
+
write("conflict.txt", CONFLICT); git("add", "."); git("commit", "-qm", "markers");
|
|
242
|
+
const result = await hook(root, { mode: "on" })("git push origin HEAD");
|
|
243
|
+
assert.equal(result?.block, true);
|
|
244
|
+
assert.match(result!.reason!, /^RDD pre-delivery: Select the actual committed range/, "the RDD denial runs first and is unchanged");
|
|
245
|
+
assert.equal(await hook(root, { mode: "off" })("git status && echo 'git commit'"), undefined, "non-delivery commands are untouched");
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// PR #3113 review: a redirection's `&` is not a command separator, so a preceding `cd` keeps its directory.
|
|
249
|
+
test("P9: redirections such as 2>&1 keep the cd and -C targets", async t => {
|
|
250
|
+
const { scratch, repo } = fixture(t);
|
|
251
|
+
const plain = join(scratch, "plain");
|
|
252
|
+
mkdirSync(plain);
|
|
253
|
+
const dirty = repo("dirty"), clean = repo("clean");
|
|
254
|
+
dirty.write("conflict.txt", CONFLICT); dirty.git("add", ".");
|
|
255
|
+
const run = hook(plain);
|
|
256
|
+
const forms = (root: string) => [`cd ${root} && git commit -m x 2>&1`, `git -C ${root} commit -am x > /dev/null 2>&1`,
|
|
257
|
+
`cd ${root} && git commit -m x >&2`, `cd ${root} && git commit -m x &>${join(scratch, "out.log")}`, `cd ${root} && git commit -m x 2>/dev/null </dev/null`];
|
|
258
|
+
for (const command of forms(dirty.root)) {
|
|
259
|
+
const result = await run(command);
|
|
260
|
+
assert.equal(result?.block, true, command);
|
|
261
|
+
assert.match(result!.reason!, / at conflict\.txt:2\. /, command);
|
|
262
|
+
}
|
|
263
|
+
for (const command of forms(clean.root)) assert.equal(await run(command), undefined, command);
|
|
264
|
+
assert.equal(await run(`cd ${dirty.root} && git commit -m x &`), undefined, "a trailing background & still ends the cd scope");
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
// PR #3113 review: a backslash-newline continues the command, so flags and paths on the next line belong to it.
|
|
268
|
+
test("P9: line continuations keep -a and git add paths with their command", async t => {
|
|
269
|
+
const { repo } = fixture(t);
|
|
270
|
+
const { root, write } = repo("repo");
|
|
271
|
+
write("app.txt", CONFLICT);
|
|
272
|
+
const run = hook(root);
|
|
273
|
+
for (const command of ["git commit \\\n-a -m x", "git commit -m \"fix \\\n\" -a", "git add \\\napp.txt && git commit -m x", "git add app.txt \\\n&& git commit -m x"]) {
|
|
274
|
+
const result = await run(command);
|
|
275
|
+
assert.equal(result?.block, true, JSON.stringify(command));
|
|
276
|
+
assert.match(result!.reason!, / at app\.txt:2\. /, JSON.stringify(command));
|
|
277
|
+
}
|
|
278
|
+
assert.equal(await run("git commit -m 'a \\\n' -m y"), undefined, "inside single quotes the backslash is literal and the commit records only the index");
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// PR #3113 review (security): no asynchronous work may run between the permission-mode epoch recheck and the
|
|
282
|
+
// hook's return; a mode change while the marker check is pending must not yield a stale allow.
|
|
283
|
+
test("P9: a permission-mode change while the marker check runs blocks instead of allowing", async t => {
|
|
284
|
+
const { repo, scratch } = fixture(t);
|
|
285
|
+
const { root } = repo("repo");
|
|
286
|
+
const manager = SessionManager.inMemory(root);
|
|
287
|
+
manager.appendCustomEntry("probe-anchor", {});
|
|
288
|
+
const handlers = new Map<string, Function[]>(), commands = new Map<string, any>();
|
|
289
|
+
const pi = { on: (name: string, fn: Function) => handlers.set(name, [...handlers.get(name) ?? [], fn]), events: { on() { return () => {}; }, emit() {} },
|
|
290
|
+
registerCommand: (name: string, value: unknown) => commands.set(name, value), registerTool() {}, registerFlag() {}, registerMessageRenderer() {},
|
|
291
|
+
getActiveTools: () => [], appendEntry() {} };
|
|
292
|
+
createGentleAiExtension({ nativeReviewCli: { reviewMode: async () => ({ status: { effective: "off", global: "off", cloneLocal: "", source: "global" } }), assess: async () => { throw new Error("none"); } } as never,
|
|
293
|
+
processEnv: { GENTLE_AI_TELEMETRY: "0", GENTLE_PI_CONFIG_HOME: join(scratch, "config") }, candidateViews: null,
|
|
294
|
+
resolveTelemetryTriggerBinary: () => { throw new Error("disabled"); } } as never)(pi as never);
|
|
295
|
+
const ctx = { cwd: root, mode: "tui", hasUI: true, sessionManager: manager, signal: new AbortController().signal,
|
|
296
|
+
ui: { notify() {}, setStatus() {}, setWidget() {}, confirm: async () => true } };
|
|
297
|
+
const call = async (command: string) => {
|
|
298
|
+
let output: any;
|
|
299
|
+
for (const fn of handlers.get("tool_call") ?? []) { const next = await fn({ toolName: "bash", toolCallId: "probe", input: { command } }, ctx); if (next !== undefined) output = next; }
|
|
300
|
+
return output as { block?: boolean; reason?: string } | undefined;
|
|
301
|
+
};
|
|
302
|
+
await commands.get("gentle:mode").handler("yolo", ctx);
|
|
303
|
+
assert.equal(await call("git commit -m clean"), undefined, "stable mode: a clean commit is allowed");
|
|
304
|
+
// Hold the marker check's first diff (its candidate pathspec is unique to the guard) and change the mode meanwhile.
|
|
305
|
+
const original = childProcess.execFile;
|
|
306
|
+
let held!: () => void, release!: () => void, holding = true;
|
|
307
|
+
const reached = new Promise<void>(resolve => { held = resolve; });
|
|
308
|
+
t.mock.method(childProcess, "execFile", (...args: any[]) => {
|
|
309
|
+
if (holding && Array.isArray(args[1]) && args[1].includes("-G^[<>][<>]")) {
|
|
310
|
+
holding = false; held();
|
|
311
|
+
void new Promise<void>(resolve => { release = resolve; }).then(() => (original as Function)(...args));
|
|
312
|
+
return undefined;
|
|
313
|
+
}
|
|
314
|
+
return (original as Function)(...args);
|
|
315
|
+
});
|
|
316
|
+
syncBuiltinESMExports();
|
|
317
|
+
t.after(() => { t.mock.restoreAll(); syncBuiltinESMExports(); });
|
|
318
|
+
const pending = call("git commit -m clean");
|
|
319
|
+
await Promise.race([reached, new Promise((_, reject) => setTimeout(() => reject(new Error("marker check never reached")), 3000))]);
|
|
320
|
+
await commands.get("gentle:mode").handler("normal", ctx);
|
|
321
|
+
release();
|
|
322
|
+
const result = await pending;
|
|
323
|
+
assert.equal(result?.block, true, "a decision made under the earlier mode must not be returned");
|
|
324
|
+
assert.match(result!.reason!, /^Permission mode changed during delivery preflight\. This action was not run; retry under the current mode\.$/);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
// PR #3113 review: only an UNQUOTED operator is a redirection; a quoted argument that starts with `<` or `>` is a word.
|
|
328
|
+
test("P9: quoted words that start with < or > are arguments, not redirections", async t => {
|
|
329
|
+
const { scratch, repo } = fixture(t);
|
|
330
|
+
const { root, write } = repo("repo");
|
|
331
|
+
write("app.txt", CONFLICT);
|
|
332
|
+
const run = hook(root);
|
|
333
|
+
for (const command of [`git commit -m "<type>: msg" -a`, `git commit -a -m ">= 2 fixes"`, `git commit -m 'x > y' -a`, `git commit -m ">" -a`, `git commit -m \\> -a`]) {
|
|
334
|
+
const result = await run(command);
|
|
335
|
+
assert.equal(result?.block, true, command);
|
|
336
|
+
assert.match(result!.reason!, / at app\.txt:2\. /, command);
|
|
337
|
+
}
|
|
338
|
+
const named = repo("named");
|
|
339
|
+
named.write("<name>.txt", CONFLICT);
|
|
340
|
+
const added = await hook(named.root)(`git add "<name>.txt" && git commit -m x`);
|
|
341
|
+
assert.equal(added?.block, true, "a quoted path that starts with < is staged");
|
|
342
|
+
assert.match(added!.reason!, / at <name>\.txt:2\. /);
|
|
343
|
+
const target = join(scratch, "out file.txt");
|
|
344
|
+
const redirected = await run(`git commit -m x > "${target}" -a`);
|
|
345
|
+
assert.equal(redirected?.block, true, "the quoted word is the target of the unquoted operator");
|
|
346
|
+
assert.match(redirected!.reason!, / at app\.txt:2\. /);
|
|
347
|
+
assert.equal(await run(`git commit -m x > "${target}"`), undefined, "an unquoted operator still takes its quoted target");
|
|
348
|
+
});
|