kibi-opencode 0.4.1 → 0.4.2

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 CHANGED
@@ -155,7 +155,7 @@ Disable specific features while keeping others:
155
155
 
156
156
  ## Dogfooding
157
157
 
158
- This repository uses a local shim at `.opencode/plugins/kibi.ts` for development. The npm package (`kibi-opencode`) is the public distribution artifact.
158
+ 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.
159
159
 
160
160
  ## Architecture
161
161
 
package/dist/config.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
- import * as logger from "./logger";
4
+ import * as logger from "./logger.js";
5
5
  const DEFAULTS = {
6
6
  enabled: true,
7
7
  prompt: { enabled: true, hookMode: "auto" },
package/dist/index.d.ts CHANGED
@@ -1,4 +1,22 @@
1
- import type { Hooks, Plugin, PluginInput } from "@opencode-ai/plugin";
2
- export type { Plugin, PluginInput, Hooks };
1
+ export interface PluginInput {
2
+ worktree: string;
3
+ directory: string;
4
+ }
5
+ interface OpencodeEventPayload {
6
+ type: string;
7
+ properties?: Record<string, unknown>;
8
+ }
9
+ interface EventHookInput {
10
+ event: OpencodeEventPayload;
11
+ }
12
+ interface SystemTransformOutput {
13
+ system: string[];
14
+ }
15
+ export interface Hooks {
16
+ event?: (input: EventHookInput) => void | Promise<void>;
17
+ "experimental.chat.system.transform"?: (input: unknown, output: SystemTransformOutput) => void | Promise<void>;
18
+ "chat.params"?: (input: unknown, output: unknown) => void | Promise<void>;
19
+ }
20
+ export type Plugin = (input: PluginInput) => Hooks | Promise<Hooks>;
3
21
  declare const kibiOpencodePlugin: Plugin;
4
22
  export default kibiOpencodePlugin;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import * as config from "./config";
2
- import * as fileFilter from "./file-filter";
3
- import * as logger from "./logger";
4
- import { analyzePath } from "./path-kind";
5
- import { injectPrompt } from "./prompt";
6
- import { createSyncScheduler } from "./scheduler";
7
- import { getSessionTracker } from "./session-tracker";
8
- import { checkWorkspaceHealth } from "./workspace-health";
1
+ import * as config from "./config.js";
2
+ import * as fileFilter from "./file-filter.js";
3
+ import * as logger from "./logger.js";
4
+ import { analyzePath } from "./path-kind.js";
5
+ import { injectPrompt } from "./prompt.js";
6
+ import { createSyncScheduler } from "./scheduler.js";
7
+ import { getSessionTracker } from "./session-tracker.js";
8
+ import { checkWorkspaceHealth } from "./workspace-health.js";
9
9
  import * as fs from "node:fs";
10
10
  /**
11
11
  * Lint requirement document for anti-patterns.
@@ -17,8 +17,8 @@ function lintRequirementDoc(filePath, worktree) {
17
17
  ? `${worktree}/${filePath}`
18
18
  : filePath;
19
19
  const content = fs.readFileSync(resolvedPath, "utf-8");
20
- // Check for embedded scenarios (Given/When/Then patterns)
21
- if (/given\s+.*when\s+.*then/i.test(content)) {
20
+ // Check for embedded scenarios (Given/When/Then patterns) - implements REQ-opencode-kibi-plugin-v1
21
+ if (/given\s+[\s\S]*?when\s+[\s\S]*?then/i.test(content)) {
22
22
  warnings.push({
23
23
  category: "embedded-scenario-in-req",
24
24
  message: `Requirement file ${filePath} appears to contain embedded scenario (Given/When/Then). Consider extracting to a separate SCEN entity.`,
package/dist/prompt.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { KibiConfig } from "./config";
2
- import type { PathKind } from "./path-kind";
3
- import type { WorkspaceHealth } from "./workspace-health";
1
+ import type { KibiConfig } from "./config.js";
2
+ import type { PathKind } from "./path-kind.js";
3
+ import type { WorkspaceHealth } from "./workspace-health.js";
4
4
  declare const SENTINEL = "<!-- kibi-opencode -->";
5
5
  export interface PromptContext {
6
6
  recentEdits: Array<{
package/dist/prompt.js CHANGED
@@ -1,8 +1,9 @@
1
- import { isPluginEnabled } from "./config";
1
+ import { isPluginEnabled } from "./config.js";
2
2
  const SENTINEL = "<!-- kibi-opencode -->";
3
3
  /**
4
4
  * Build prompt guidance block based on path kind.
5
5
  */
6
+ // implements REQ-opencode-kibi-plugin-v1
6
7
  function buildContextualGuidance(context) {
7
8
  const parts = [SENTINEL];
8
9
  // 1. Check for recent .kb edits (loud warning)
@@ -88,6 +89,8 @@ Keep changed symbols traceable: add \`// implements REQ-xxx\` to every new or mo
88
89
 
89
90
  Run kb_check after KB mutations.
90
91
 
92
+ Dogfood note for this repo: OpenCode here uses local built \`kibi-mcp\` and \`kibi-opencode\` artifacts. If you change package versions or local package wiring, run \`bun run build\` before relying on OpenCode in this workspace.
93
+
91
94
  **Kibi-first workflow:**
92
95
  1. **Discover**: Run kb_query with filters (sourceFile, type, tags) to find related requirements, ADRs, tests, and symbols.
93
96
  2. **Document intent**: If you are about to explain code, STOP. Route that explanation to kb_upsert instead of inline comments.
@@ -112,6 +115,8 @@ Keep changed symbols traceable: add \`// implements REQ-xxx\` to every new or mo
112
115
 
113
116
  Run kb_check after KB mutations.
114
117
 
118
+ Dogfood note for this repo: OpenCode here uses local built \`kibi-mcp\` and \`kibi-opencode\` artifacts. If you change package versions or local package wiring, run \`bun run build\` before relying on OpenCode in this workspace.
119
+
115
120
  **Kibi-first workflow:**
116
121
  1. **Discover**: Run kb_query with filters (sourceFile, type, tags) to find related requirements, ADRs, tests, and symbols.
117
122
  2. **Document intent**: If you are about to explain code, STOP. Route that explanation to kb_upsert instead of inline comments.
@@ -1,4 +1,4 @@
1
- import type { KibiConfig } from "./config";
1
+ import type { KibiConfig } from "./config.js";
2
2
  export type TimeoutHandle = ReturnType<typeof setTimeout>;
3
3
  export interface SyncRunMetadata {
4
4
  reason: string;
package/dist/scheduler.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { exec } from "node:child_process";
2
2
  import path from "node:path";
3
- import { shouldHandleFile } from "./file-filter";
4
- import * as logger from "./logger";
3
+ import { shouldHandleFile } from "./file-filter.js";
4
+ import * as logger from "./logger.js";
5
5
  class WorktreeSyncScheduler {
6
6
  worktree;
7
7
  now;
@@ -1,5 +1,5 @@
1
1
  // implements REQ-opencode-kibi-plugin-v1
2
- import * as logger from "./logger";
2
+ import * as logger from "./logger.js";
3
3
  const WARNING_THRESHOLD_REPEAT = 3;
4
4
  const SESSION_DURATION_MS = 30 * 60 * 1000; // 30 minutes
5
5
  class SessionTracker {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-opencode",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "Kibi OpenCode plugin - thin adapter to integrate Kibi with OpenCode sessions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",