opencode-context-indicator 1.1.3 → 1.1.5
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 +60 -0
- package/index.js +710 -179
- package/lib/dedup.js +12 -3
- package/package.json +17 -4
- package/tui.tsx +3 -1
package/README.md
CHANGED
|
@@ -445,6 +445,66 @@ caller.
|
|
|
445
445
|
|
|
446
446
|
---
|
|
447
447
|
|
|
448
|
+
## Development / Testing
|
|
449
|
+
|
|
450
|
+
### Running tests
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
npm run test:prepublish # fast gate: tarball + tui.tsx + resolve + T1–T12 unit
|
|
454
|
+
npm run test:e2e # full E2E: isolated plugin load + one "Say OK" round-trip
|
|
455
|
+
npm run test:e2e:quick # E2E load-only, no LLM call
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
`prepublishOnly` runs **both** gates automatically on `npm publish`
|
|
459
|
+
(`node test/prepublish.mjs && node test/e2e-tui.mjs --full`) and is skipped with
|
|
460
|
+
`--ignore-scripts`. The whole chain takes roughly **1 minute** (fast gate ~20 s,
|
|
461
|
+
isolated E2E ~10 s warm / up to ~90 s cold); the E2E is bounded by INIT 45 s +
|
|
462
|
+
STEP 80 s, ~3 min total.
|
|
463
|
+
|
|
464
|
+
### What the gates check
|
|
465
|
+
|
|
466
|
+
**Fast gate — `test/prepublish.mjs`**
|
|
467
|
+
|
|
468
|
+
| Step | What | Why |
|
|
469
|
+
|---|---|---|
|
|
470
|
+
| (a) tarball composition | `package.json` `files[]` field expands to exactly 6 members | no test/node_modules/tsconfig in the tarball |
|
|
471
|
+
| (b) pragma regression | esbuild `--jsx=automatic` → `@opentui/solid/jsx-runtime` present, `react/jsx-runtime` absent | a removed/broken pragma kills the sidebar on npm install |
|
|
472
|
+
| (c) resolve chain | replica install → `import.meta.resolve` for all tui.tsx imports | broken peer/optional dep silently breaks the sidebar |
|
|
473
|
+
| (d) unit harness T1–T12 | all limit/agent/state fix assertions | regressions in modelLimits, writeStateFile, hydrate |
|
|
474
|
+
|
|
475
|
+
**Isolated E2E — `test/e2e-tui.mjs`** (requires the OpenCode CLI)
|
|
476
|
+
|
|
477
|
+
| Check | What | Why |
|
|
478
|
+
|---|---|---|
|
|
479
|
+
| A — plugin load | spins a private `opencode --standalone` PTY, asserts `msg="loading plugin" → opencode-context-indicator` and that the `file:///` entrypoint is **this checkout** | catches a plugin that no longer imports cleanly, or a config pointing at the published npm copy |
|
|
480
|
+
| B — live update | one `opencode run "Say OK" --standalone` round-trip; asserts the LLM answered **and** the isolated `state.json` gained a session with `ctx > 0` | catches a regression in the `session.idle` → `writeStateFile` path |
|
|
481
|
+
|
|
482
|
+
The E2E is fully **non-invasive** to your running OpenCode Desktop:
|
|
483
|
+
|
|
484
|
+
- `--standalone` starts a *private* server instead of the background service Desktop uses;
|
|
485
|
+
- `OPENCODE_DB` points at a throwaway DB in `%TEMP%` (your sessions are untouched);
|
|
486
|
+
- `OPENCODE_CONTEXT_INDICATOR_STATE_FILE` points at a throwaway state file in `%TEMP%`
|
|
487
|
+
— the live `opencode-context-indicator-state.json` is never read or written;
|
|
488
|
+
- `OPENCODE_DISABLE_PROJECT_CONFIG=1` avoids project-level config;
|
|
489
|
+
- exactly **one** minimal LLM call (`Say OK`) is made, in the isolated session.
|
|
490
|
+
|
|
491
|
+
The script prints `[e2e] running against ISOLATED opencode instance — your running
|
|
492
|
+
sessions are not touched` at start and reports the Desktop service/GUI PIDs before
|
|
493
|
+
and after the run. Override the binary with `OPENCODE_CLI`. The full run needs a
|
|
494
|
+
model for the one round-trip: set `OPENCODE_E2E_MODEL` to *your* `provider/model`
|
|
495
|
+
id (e.g. `OPENCODE_E2E_MODEL=myprovider/some-model`); it is **required** in full
|
|
496
|
+
mode and the script exits with an instruction if it is unset. `--quick` needs no
|
|
497
|
+
model.
|
|
498
|
+
|
|
499
|
+
### CI
|
|
500
|
+
|
|
501
|
+
`.github/workflows/ci.yml` runs `test/prepublish.mjs` on every push/PR and additionally
|
|
502
|
+
does a standalone esbuild transpile check (pragmas, no React). The Node-pty E2E is not
|
|
503
|
+
run in CI (requires the OpenCode Desktop binary) and is skipped gracefully when the CLI
|
|
504
|
+
is absent (`[SKIP] opencode CLI not found`).
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
448
508
|
## License
|
|
449
509
|
|
|
450
510
|
[MIT](./LICENSE)
|