Skip to content

Enhance local workflow and fix OpenCode path and sync issues#94

Merged
Looted merged 9 commits intomasterfrom
develop
Mar 20, 2026
Merged

Enhance local workflow and fix OpenCode path and sync issues#94
Looted merged 9 commits intomasterfrom
develop

Conversation

@Looted
Copy link
Copy Markdown
Owner

@Looted Looted commented Mar 20, 2026

No description provided.

Looted added 9 commits March 20, 2026 16:37
Keep this repo on local kibi-mcp and kibi-opencode builds, document the rebuild rule after version changes, and lock the wiring with tests to prevent drift.
Start the dogfood MCP server through a repo-root wrapper so OpenCode can launch it from nested working directories like packages/opencode, and cover the behavior with a regression test.
Treat plain string frontmatter links as generic relates_to edges so documented authoring patterns and packed consumers keep their traceability graph.
Bind known relationship types before querying Prolog so --relationships reports synced edges and the issue #93 regression is fully covered.
Qualify staged traceability overlay predicates and Node ESM imports so packed consumers behave correctly, and align brittle packed tests with actual hook and MCP behavior.
Record the latest generated symbol coordinate metadata after validation and e2e runs so the workspace is clean.
Inline the minimal plugin type surface so npm pack can build kibi-opencode in isolated environments without depending on external type declarations.
Record the latest generated symbol coordinate metadata after the opencode packaging fix and verification runs.
Copilot AI review requested due to automatic review settings March 20, 2026 18:45
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

Updates local development (OpenCode dogfooding + MCP startup) and tightens KB sync/query/traceability behavior so workflows behave consistently from nested working directories and in packed consumers.

Changes:

  • Make repo-local OpenCode/MCP wiring resilient to being launched from subdirectories, and document the “rebuild before dogfood” rule.
  • Import plain-string Markdown links as generic relates_to relationships during kibi sync, and ensure kibi query --relationships reliably returns outgoing edges.
  • Improve staged-traceability handling for git -z output and move staged overlay predicates into the kb Prolog module namespace.

Reviewed changes

Copilot reviewed 43 out of 43 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Reworks installation docs; adds OpenCode plugin + VS Code MCP setup instructions and removes root-level dogfooding section.
packages/opencode/tests/prompt.test.ts Adds coverage asserting the dogfood rebuild note appears in injected guidance.
packages/opencode/tests/dogfood-config.test.ts Adds regression tests to lock repo dogfood config (local MCP command + local plugin shim).
packages/opencode/src/session-tracker.ts Fixes ESM import specifier (.js) for Node ESM compatibility in packed installs.
packages/opencode/src/scheduler.ts Fixes ESM import specifiers (.js) for Node ESM compatibility in packed installs.
packages/opencode/src/prompt.ts Adds repo dogfood rebuild guidance to prompt content and fixes ESM import specifiers.
packages/opencode/src/index.ts Switches to .js specifiers and makes exported plugin typings self-contained.
packages/opencode/src/config.ts Fixes ESM import specifier (.js).
packages/opencode/README.md Documents repo dogfooding behavior and points to DEV.md for rebuild rule.
packages/opencode/DEV.md Updates dogfood workflow docs, emphasizing rebuild triggers and repo-local wiring.
packages/cli/tests/traceability/traceability.test.ts Adds tests for null-delimited git output parsing and updated kb:-namespaced overlay facts.
packages/cli/tests/extractors/markdown.test.ts Adds/updates tests for FrontmatterError formatting and mixed typed + string link extraction.
packages/cli/tests/commands/sync.test.ts Adds an integration test ensuring plain-string links are imported as relates_to via sync.
packages/cli/tests/commands/query.test.ts Strengthens relationship-query assertions and checks relates_to is returned.
packages/cli/src/traceability/validate.ts Qualifies staged-traceability Prolog predicates with kb: and cleans up bindings access.
packages/cli/src/traceability/temp-kb.ts Emits kb:-qualified overlay facts for staged-traceability predicates.
packages/cli/src/traceability/git-staged.ts Adds robust parsing for git diff --name-status -z output and tags functions with REQ-014.
packages/cli/src/extractors/markdown.ts Treats plain-string links entries as relates_to relationships during extraction.
packages/cli/src/commands/query.ts Fixes --relationships query by enumerating relationship types (instantiating Type).
package.json Ensures local packed e2e run builds CLI/MCP before compiling/running packed tests.
opencode.json Switches local MCP command to resolve repo root via git rev-parse --show-toplevel.
documentation/tests/TEST-015.md Adds KB test entity for the markdown string-link regression coverage.
documentation/tests/TEST-003.md Updates test description to include outgoing relationship querying.
documentation/tests/e2e/packed/traceability-gate.test.ts Makes packed staged-traceability setup deterministic and seeds a requirement before syncing.
documentation/tests/e2e/packed/mcp-crud.test.ts Updates assertion to match the new status rendering/format.
documentation/tests/e2e/packed/issue-93-regression.test.ts Adds packed regression test ensuring string links survive sync and appear in relationship query output.
documentation/tests/e2e/packed/hook-integration.test.ts Ensures initial sync happens and normalizes timestamps for KB comparison.
documentation/symbols.yaml Updates symbol coordinate snapshots to current values.
documentation/scenarios/SCEN-012.md Adds scenario describing expected behavior for string-link sync as relates_to.
documentation/requirements/REQ-020.md Updates release requirement to include the OpenCode plugin among release-managed npm packages.
documentation/requirements/REQ-007.md Extends extractor requirement to cover plain-string + typed markdown links behavior.
documentation/facts/FACT-POL-027.md Adds fact documenting repo dogfooding of local MCP/plugin artifacts and rebuild rule.
documentation/facts/FACT-034.md Updates package matrix fact to include kibi-opencode.
documentation/facts/FACT-009.md Updates publishing workflow fact to include all release-managed npm packages.
documentation/facts/FACT-008.md Updates npm package naming fact to include kibi-opencode and repo dogfooding note.
documentation/adr/ADR-014.md Updates ADR to include opencode in Changesets-managed release scope.
documentation/adr/ADR-013.md Updates package matrix/versioning model to include kibi-opencode and dogfood implications.
docs/prompts/llm-rules.md Clarifies typed vs string links, and documents rebuild requirement for repo dogfood flow.
docs/entity-schema.md Updates schema examples to typed links and documents string-link shorthand importing as relates_to.
AGENTS.md Adds explicit “Dogfood Rebuild Rule” to contributor guidelines.
.opencode/config.json Updates MCP server launch command to resolve repo root and enable diagnostic mode.
.changeset/opencode-dogfood-workflow.md Changeset for dogfood workflow docs/config/tests.
.changeset/fix-markdown-string-links.md Changeset for markdown string-link import + relationship query fix + opencode ESM/type fixes.

Comment on lines 132 to 142
for (const symbol of symbols) {
lines.push(`changed_symbol(${escapePrologAtom(symbol.id)}).`);
lines.push(`kb:changed_symbol(${escapePrologAtom(symbol.id)}).`);
lines.push(
`changed_symbol_loc(${escapePrologAtom(symbol.id)}, ${escapePrologAtom(symbol.location.file)}, ${symbol.location.startLine}, 0, ${escapePrologAtom(symbol.name)}).`,
`kb:changed_symbol_loc(${escapePrologAtom(symbol.id)}, ${escapePrologAtom(symbol.location.file)}, ${symbol.location.startLine}, 0, ${escapePrologAtom(symbol.name)}).`,
);

// Emit overlay facts for requirement links from code-comment directives.
for (const reqId of symbol.reqLinks) {
lines.push(
`changed_symbol_req(${escapePrologAtom(symbol.id)}, ${escapePrologAtom(reqId)}).`,
`kb:changed_symbol_req(${escapePrologAtom(symbol.id)}, ${escapePrologAtom(reqId)}).`,
);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

createOverlayFacts now emits module-qualified overlay facts (kb:changed_symbol/1, kb:changed_symbol_loc/5, kb:changed_symbol_req/2). The existing unit tests in packages/cli/tests/traceability/temp-kb.test.ts still assert the old unqualified fact strings (e.g. changed_symbol('...').), so CI will fail unless those expectations are updated to the kb:-qualified forms (and similarly for changed_symbol_loc / changed_symbol_req).

Copilot uses AI. Check for mistakes.
@Looted Looted merged commit 1680f67 into master Mar 20, 2026
9 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