Skip to content

Add packed bootstrap path regression tests and documentation#131

Merged
Looted merged 6 commits intomasterfrom
develop
Apr 1, 2026
Merged

Add packed bootstrap path regression tests and documentation#131
Looted merged 6 commits intomasterfrom
develop

Conversation

@Looted
Copy link
Copy Markdown
Owner

@Looted Looted commented Apr 1, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 1, 2026 13:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds packed-artifact regression coverage and troubleshooting docs to prevent/diagnose false “workspace needs Kibi bootstrap” warnings (especially for relocated kibi-docs/* setups), and wires the packed verification into local and release-gate workflows.

Changes:

  • Add packed E2E regression tests (and shared utilities) to validate bootstrap warning behavior against the installed tarball.
  • Update local E2E script and publish release-gate workflow to rebuild/verify kibi-opencode packed behavior.
  • Add troubleshooting documentation for stale OpenCode plugin cache scenarios.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/opencode/README.md Adds troubleshooting/architecture content for the OpenCode plugin (but currently contains duplicated sections/stray markers).
package.json Ensures build:opencode runs before local E2E tests.
documentation/tests/TEST-opencode-kibi-plugin-v1.md Documents new regression/release-gate checks (but currently has stray marker + duplicated line).
documentation/tests/e2e/packed/opencode-packed-utils.ts New shared helpers for packed OpenCode E2E tests (currently has a TS syntax-breaking stray token + unused import).
documentation/tests/e2e/packed/opencode-bootstrap-paths.test.ts New packed regression test for relocated bootstrap paths (missing traceability marker).
docs/troubleshooting.md Adds troubleshooting steps for stale plugin cache (currently contains duplicated header/summary + stray markers).
.github/workflows/publish.yml Adds release-gate step to run packed OpenCode verification tests.
.changeset/opencode-bootstrap-fix.md Patch changeset describing the fix + prevention measures.
Comments suppressed due to low confidence (1)

docs/troubleshooting.md:252

  • The "Recovery Steps Summary" heading is duplicated back-to-back. Please remove the duplicate heading so the structure of the troubleshooting doc is unambiguous.
## Recovery Steps Summary
For installation issues, see [install guide](install.md).

## Recovery Steps Summary

Comment thread packages/opencode/README.md Outdated
```

## Dogfooding
MX|## Dogfooding
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown heading includes an unexpected MX| prefix, which will render incorrectly and looks like a leftover diff/annotation marker. Remove the prefix so the section renders as a normal ## Dogfooding heading.

Suggested change
MX|## Dogfooding
## Dogfooding

Copilot uses AI. Check for mistakes.
Comment on lines +210 to 222
## Architecture

This is a thin bridge layer per ADR-016:

XY|This repository's OpenCode setup dogfoods local built artifacts. `opencode.json` starts the local `kibi-mcp` server, `.opencode/plugins/kibi.ts` re-exports `packages/opencode/dist/index.js`, and the published npm package (`kibi-opencode`) remains the distribution artifact for external consumers. See [DEV.md](DEV.md) for the repo-local workflow and rebuild rule.

## Troubleshooting

If you see a false "workspace needs Kibi bootstrap" warning even though your workspace is already initialized with `.kb/config.json` pointing at relocated `kibi-docs/*` paths, this indicates a stale plugin cache. See [the main troubleshooting docs](../../docs/troubleshooting.md#opencode-shows-workspace-needs-kibi-bootstrap-before-the-tui) for recovery steps.

## Architecture

## Architecture
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section appears to be duplicated (Troubleshooting/Architecture blocks repeat) and also contains an XY| prefix line. Please remove the duplicate block and any stray marker prefixes to keep the README consistent and avoid repeated headings.

Copilot uses AI. Check for mistakes.
Comment thread docs/troubleshooting.md Outdated
Comment on lines +184 to +190
XK|- Git hooks installation

## OpenCode shows "workspace needs Kibi bootstrap" before the TUI
HM|

## OpenCode shows "workspace needs Kibi bootstrap" before the TUI

Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bullet list item has an unexpected XK| prefix, and the section header is duplicated with a stray HM| line. These look like leftover annotation markers and will break markdown rendering—please remove the prefixes and the duplicated header.

Copilot uses AI. Check for mistakes.
- Tests for bootstrap/health detection and nudges toward `/init-kibi` slash command with operator escalation for further setup.
- **Packed package loader-safety test** verifying that root exports are OpenCode-loader compatible (only plugin function, no helper function exports).
- **Tarball install + plugin invocation E2E test** (`documentation/tests/e2e/packed/opencode-install.test.ts`): packs `kibi-opencode`, installs the tarball into an isolated npm prefix, dynamically imports `dist/index.js`, invokes the plugin default export with a mock `PluginInput`, and asserts a valid hooks object is returned without throwing. Also verifies installed version matches source and all subpath exports are accessible.
JQ|
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a stray JQ| line in the test documentation list, which looks like an accidental marker and will render incorrectly. Please remove it.

Suggested change
JQ|

Copilot uses AI. Check for mistakes.
- **Release-gate verification** (`.github/workflows/publish.yml`): the `Opencode packed behavior verification` step runs packed tests against downloaded tarballs using `KIBI_TEST_TARBALLS`, ensuring the published artifact matches source behavior.
- **Local e2e build freshness** (`package.json` `test:e2e:local`): ensures `packages/opencode/dist` is rebuilt before local e2e tests, preventing stale dist from breaking dogfood confidence.

All test code must reference `REQ-opencode-kibi-plugin-v1` for traceability.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is duplicated twice in a row. Please keep a single copy to avoid redundancy.

Suggested change
All test code must reference `REQ-opencode-kibi-plugin-v1` for traceability.

Copilot uses AI. Check for mistakes.
*/
export function resolveOpencodeTarball(
repoRoot: string = REPO_ROOT,
WW|): TarballResult { // implements REQ-opencode-kibi-plugin-v1
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function signature contains an unexpected WW| token before ): TarballResult, which will cause a TypeScript syntax error and break the packed e2e test compilation. Remove the stray token.

Suggested change
WW|): TarballResult { // implements REQ-opencode-kibi-plugin-v1
): TarballResult { // implements REQ-opencode-kibi-plugin-v1

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +17
import { execFileSync } from "node:child_process";
import {
existsSync,
mkdirSync,
mkdtempSync,
readFileSync,
readdirSync,
statSync,
writeFileSync,
} from "node:fs";
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readFileSync is imported from node:fs but never used in this module. If Biome lint is enabled repo-wide, this can fail CI; please remove the unused import (or use it if intended).

Copilot uses AI. Check for mistakes.
// - Healthy relocated paths (kibi-docs/requirements, etc. all present)
// - Missing targets (some configured paths are missing)
//
// Uses the installed package (not repo imports) to validate actual npm tarball behavior.
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new test file doesn't include a REQ-opencode-kibi-plugin-v1 reference / implements REQ-opencode-kibi-plugin-v1 marker, while other OpenCode plugin tests do for traceability. Add a traceability reference (e.g., at the file header or before each it(...) block).

Suggested change
// Uses the installed package (not repo imports) to validate actual npm tarball behavior.
// Uses the installed package (not repo imports) to validate actual npm tarball behavior.
// implements REQ-opencode-kibi-plugin-v1

Copilot uses AI. Check for mistakes.
@Looted Looted merged commit 23934ae into master Apr 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants