Skip to content

Commit 1841b0b

Browse files
committed
Update package metadata, scripts, and contributing docs for test suite
1 parent 47f3e5e commit 1841b0b

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

CONTRIBUTING.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ Welcome! This project welcomes focused, well-validated contributions. Use coding
77
- **Use code research first** — understand the surrounding module responsibilities before editing.
88
- **Make minimal changes** — prefer targeted edits that reuse existing mechanisms.
99
- **Match existing patterns** — keep naming, lifecycle hooks, tool contracts, and TUI behavior consistent with the current code.
10-
- **Preserve context-management semantics** — changes to `spawn`, `ledger`, or `handoff` should keep the agent workflow predictable across session resets and compaction.
10+
- **Preserve context-management semantics** — changes to `spawn`, `notebook`, or `handoff` should keep the agent workflow predictable across session resets and compaction.
11+
- **Use static imports only for `spawn/renderer.ts`** — it registers the frame scheduler into the singleton container at module evaluation time. Switching to `await import()` will silently break test isolation because the test harness cannot overwrite the singleton before registration.
1112
- **AI-agent generated contributions are welcome** — include enough human intent and validation context in the PR for reviewers to trust the result.
1213

1314
## Suggested Workflow
1415

1516
1. **Research the area**
16-
- Identify the relevant primitive: spawn, ledger, handoff, watchdog, or extension wiring.
17-
- Read nearby tests in `agenticoding.test.ts` before changing behavior.
17+
- Identify the relevant primitive: spawn, notebook, handoff, watchdog, or extension wiring.
18+
- Read the relevant suite in `tests/unit/` before changing behavior.
1819

1920
2. **Plan the smallest safe change**
2021
- Reuse existing state and lifecycle hooks when possible.
@@ -38,6 +39,13 @@ Before submitting, check that your change:
3839
- Handles reset, cancellation, and stale-session cases where relevant.
3940
- Keeps docs aligned with the package version and installed behavior.
4041

42+
## Tests
43+
44+
- `npm test` — runs the unit suite under `tests/unit/` via the in-repo Node test runner.
45+
- `npm run test:snapshots:check` — runs only the render-snapshot tests; fails on any drift in `tests/__snapshots__/`.
46+
- `npm run test:snapshots:update` — rewrites the golden files in `tests/__snapshots__/` after an intentional render change. Review the diff carefully: snapshot updates are the only signal that catches unintended UI regressions.
47+
- `npm run test:e2e` — runs the process-isolated end-to-end suite under `tests/e2e/`.
48+
4149
## Community
4250

4351
Use GitHub Issues for bug reports and feature requests. Keep discussions concrete: describe the agent workflow you expected, what happened instead, and any reproduction steps.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pi-agenticoding",
33
"version": "0.3.0",
44
"type": "module",
5-
"description": "Context management primitives for the pi coding agent — spawn, ledger, handoff",
5+
"description": "Context management primitives for the pi coding agent — spawn, notebook, handoff",
66
"license": "MIT",
77
"keywords": [
88
"pi-package"
@@ -17,7 +17,15 @@
1717
"@earendil-works/pi-tui": "*",
1818
"typebox": "*"
1919
},
20+
"scripts": {
21+
"test": "node ./scripts/run-node-test.mjs tests/unit/**/*.test.ts",
22+
"test:e2e": "node ./scripts/run-node-test.mjs tests/e2e/**/*.test.ts",
23+
"test:all": "npm run test && npm run test:e2e",
24+
"test:snapshots:check": "node ./scripts/run-node-test.mjs tests/unit/render-snapshots.test.ts",
25+
"test:snapshots:update": "node ./scripts/run-node-test.mjs --update-snapshots tests/unit/render-snapshots.test.ts"
26+
},
2027
"devDependencies": {
28+
"fast-check": "^4.8.0",
2129
"typescript": "^6.0.3"
2230
},
2331
"pi": {

0 commit comments

Comments
 (0)