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 +1 -1
- package/dist/config.js +1 -1
- package/dist/index.d.ts +20 -2
- package/dist/index.js +10 -10
- package/dist/prompt.d.ts +3 -3
- package/dist/prompt.js +6 -1
- package/dist/scheduler.d.ts +1 -1
- package/dist/scheduler.js +2 -2
- package/dist/session-tracker.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -155,7 +155,7 @@ Disable specific features while keeping others:
|
|
|
155
155
|
|
|
156
156
|
## Dogfooding
|
|
157
157
|
|
|
158
|
-
This repository
|
|
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
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
|
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.
|
package/dist/scheduler.d.ts
CHANGED
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;
|
package/dist/session-tracker.js
CHANGED