Prepare package CLI and workspace contract#151
Conversation
|
@copilot please re-review — fixes pushed since the last review |
There was a problem hiding this comment.
Pull request overview
This PR lays the groundwork for making the bot/ package installable and runnable via a packaged CLI, by introducing a centralized workspace/path contract resolver, structural (no-decrypt) workspace/config validators, and packaging-compatible Pi extension artifacts with cross-layout test coverage.
Changes:
- Added
minime-botCLI entrypoint plus workspace/config validation commands backed by a shared workspace contract resolver. - Implemented workspace contract + validator (effective-path diagnostics, schema allow-list parsing parity with the live guard, agent workspace containment checks).
- Updated build/packaging to generate
dist/and Pi extension artifacts fornpm pack/ installed execution, with fixtures and tests covering source/built/installed layouts.
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents new packaged CLI and workspace/config validation commands and path override semantics. |
| docs/plans/completed/2026-06-06-issue-148-package-cli-workspace-contract.md | Captures the implementation plan and acceptance criteria for Issue #148 groundwork. |
| config.local.yaml.example | Clarifies agent workspaceCwd containment expectations under the resolved workspace root. |
| CLAUDE.md | Records workspace contract defaults and packaging artifact expectations for contributors. |
| bot/test-fixtures/minimal-workspace/schema.md | Adds minimal workspace schema fixture for validator/guard parity tests. |
| bot/test-fixtures/minimal-workspace/crons.yaml | Adds minimal crons fixture for workspace validation. |
| bot/test-fixtures/minimal-workspace/config.yaml | Adds minimal config fixture (relative workspaceCwd) for workspace validation. |
| bot/test-fixtures/minimal-workspace/agent-workspace/.gitkeep | Ensures agent workspace directory exists in the minimal fixture. |
| bot/src/workspace-validator.ts | Introduces structural workspace contract validation (config/crons/schema/paths). |
| bot/src/workspace-contract.ts | Adds centralized path/workspace resolution with CLI/env/fallback precedence + diagnostics. |
| bot/src/session-store.ts | Routes default session store path through the workspace contract. |
| bot/src/pi-rpc-protocol.ts | Updates Pi spawn env + wrapper resolution to use the workspace contract and packaged wrapper artifacts. |
| bot/src/pi-extensions/write-allowlist-schema.ts | Adds a shared schema allow-list parser/resolver used by validator and live guard. |
| bot/src/pi-extensions/README.md | Documents wrapper vs helper split and the generated artifact strategy under dist/extensions/pi/. |
| bot/src/message-thread-cache.ts | Routes default cache path through workspace contract (source layout vs explicit workspace). |
| bot/src/message-content-index.ts | Routes default index path through workspace contract (source layout vs explicit workspace). |
| bot/src/cron-runner.ts | Switches default crons/config resolution to workspace contract and preserves guard/schema env in cron Pi spawns. |
| bot/src/config.ts | Switches default config resolution to workspace contract; resolves relative agent workspaces against workspace root; avoids side effects on import. |
| bot/src/cli.ts | Adds minime-bot CLI entrypoint with config validate and workspace validate. |
| bot/src/tests/workspace-validator.test.ts | Adds validator/guard schema parity and containment tests, including installed-package-like layout. |
| bot/src/tests/workspace-contract.test.ts | Adds resolver precedence/override/diagnostics tests across source/built/installed modes. |
| bot/src/tests/session-store.test.ts | Updates default session store path test to align with workspace-contract routing. |
| bot/src/tests/project-naming.test.ts | Updates expectations to reflect workspace-contract-based default config resolution. |
| bot/src/tests/pi-rpc-protocol.test.ts | Adds wrapper artifact relpath mapping tests and stricter workspace containment/schema propagation tests. |
| bot/src/tests/package-install.test.ts | Adds pack/install fixture test covering installed CLI execution and wrapper importability/resource discovery. |
| bot/src/tests/message-thread-cache.test.ts | Adds tests for default cache path behavior under source layout vs explicit workspace root. |
| bot/src/tests/message-content-index.test.ts | Adds tests for default index path behavior under source layout vs explicit workspace root. |
| bot/src/tests/cron-runner.test.ts | Adds tests for resolving relative agent workspaces against the config/workspace root. |
| bot/src/tests/cron-runner-pi.test.ts | Ensures guarded env is built before context assembly and preserves guard/schema env through hardened cron env. |
| bot/src/tests/cron-merge.test.ts | Adds tests for workspace-contract-driven default crons path and workspace-relative crons override. |
| bot/src/tests/config-defaults.test.ts | Adds tests for workspace-contract-driven config defaults and workspace-relative overrides (incl. SOPS path anchoring). |
| bot/src/tests/cli.test.ts | Adds CLI behavior tests for help, config/workspace validation, and bin-style shim execution. |
| bot/scripts/clean-package-dist.mjs | Adds dist cleanup step used by build/packaging. |
| bot/scripts/build-package-artifacts.mjs | Generates packaged Pi wrapper artifacts under dist/extensions/pi/ and ensures CLI is executable. |
| bot/package.json | Adds CLI bin mapping, build/prepare/prepack scripts, packaging files allowlist, and new dependencies. |
| bot/package-lock.json | Updates lockfile for new deps and bin metadata. |
| bot/.claude/extensions/guardian-protect-files.ts | Switches the guard wrapper to the shared schema resolver/parser to align with validator behavior. |
Files not reviewed (1)
- bot/package-lock.json: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot please re-review — fixes pushed since the last review |
87105e0 to
2c1ed89
Compare
|
@copilot please re-review — fixes pushed since the last review |
|
@copilot please re-review — fixes pushed since the last review |
Re-review completed. All previously identified issues have been properly addressed:
Tests pass (1540/1541, with 1 unrelated ffmpeg test failure), typecheck passes, and workspace validation CLI works correctly. |
|
@copilot please re-review — fixes pushed since the last review |
Re-review completed. All issues from the latest review have been properly addressed:
Tests pass (1542/1543, with 1 unrelated ffmpeg test failure). TypeScript compilation successful. |
Re-review completed on the latest head (
I also checked the recent failed workflow run ( |
|
@copilot please re-review — fixes pushed since the last review |
1 similar comment
|
@copilot please re-review — fixes pushed since the last review |
Re-review completed. All review issues have been properly addressed:
Validation results:
|
Re-review complete. All previously identified issues have been properly addressed in commits 5894383 and 9c696cf: Fixed issues:
Validation results:
The gitleaks failure mentioned in earlier comments was from commit 87105e0 and has been resolved in subsequent commits. |
|
@copilot please re-review — fixes pushed since the last review |
Re-review complete. The schema path propagation issue has been properly addressed in commit 6ece37c: Fixed issue:
Test coverage:
CI status: |
|
@copilot please re-review — fixes pushed since the last review |
e3ef2d4 to
6ece37c
Compare
Re-review complete on HEAD
Local validation:
|
Summary
npm pack/ installed execution--workspaceand env path overridesValidation
Ralphex completed successfully on this branch with:
cd bot && npm testcd bot && npm run typecheckcd bot && npm run validate-configcd bot && npm run buildcd bot && npm run workspace:validate -- --workspace ./test-fixtures/minimal-workspacecd bot && npm pack --dry-runNotes
This is package/workspace-contract groundwork only. Full
minime-botrepo creation and production workspace migration remain future work. A follow-up #148 continuation plan will reconcile the control-workspace vs agent-workspace semantics and retire schema/write-guard from the final package contract.Closes #148