kibi-opencode 0.8.0 → 0.10.0
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 +37 -12
- package/dist/brief-intent.d.ts +41 -0
- package/dist/brief-intent.js +127 -0
- package/dist/briefing-runtime.d.ts +24 -0
- package/dist/briefing-runtime.js +277 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +9 -0
- package/dist/e2e-coverage-signals.d.ts +6 -0
- package/dist/e2e-coverage-signals.js +186 -0
- package/dist/file-entity-links.d.ts +15 -0
- package/dist/file-entity-links.js +254 -0
- package/dist/file-operation-reminders.d.ts +24 -0
- package/dist/file-operation-reminders.js +55 -0
- package/dist/file-operation-state.d.ts +29 -0
- package/dist/file-operation-state.js +113 -0
- package/dist/idle-brief-audit.d.ts +36 -0
- package/dist/idle-brief-audit.js +186 -0
- package/dist/idle-brief-paths.d.ts +6 -0
- package/dist/idle-brief-paths.js +120 -0
- package/dist/idle-brief-reader.d.ts +25 -0
- package/dist/idle-brief-reader.js +142 -0
- package/dist/idle-brief-runtime.d.ts +48 -0
- package/dist/idle-brief-runtime.js +443 -0
- package/dist/idle-brief-store.d.ts +96 -0
- package/dist/idle-brief-store.js +209 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.js +645 -22
- package/dist/init-kibi-alias.d.ts +14 -0
- package/dist/init-kibi-alias.js +38 -0
- package/dist/init-kibi-capability.d.ts +32 -0
- package/dist/init-kibi-capability.js +202 -0
- package/dist/logger.js +9 -3
- package/dist/plugin-startup.d.ts +1 -0
- package/dist/plugin-startup.js +11 -2
- package/dist/prompt.d.ts +18 -3
- package/dist/prompt.js +176 -50
- package/dist/reconcile-engine.d.ts +15 -0
- package/dist/reconcile-engine.js +112 -0
- package/dist/scheduler.d.ts +1 -0
- package/dist/scheduler.js +37 -1
- package/dist/session-edit-state.d.ts +25 -0
- package/dist/session-edit-state.js +177 -0
- package/dist/session-fingerprint.d.ts +11 -0
- package/dist/session-fingerprint.js +21 -0
- package/dist/source-linked-guidance.d.ts +1 -2
- package/dist/source-linked-guidance.js +5 -168
- package/dist/startup-notifier.d.ts +3 -18
- package/dist/startup-notifier.js +42 -36
- package/dist/toast.d.ts +31 -0
- package/dist/toast.js +40 -0
- package/dist/tui-brief-delivery.d.ts +47 -0
- package/dist/tui-brief-delivery.js +138 -0
- package/package.json +4 -3
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the canonical native alias for the Kibi MCP bootstrap workflow.
|
|
3
|
+
* This is a thin wrapper over the MCP-defined workflow, preserving all
|
|
4
|
+
* semantic markers while removing namespacing and keeping text concise.
|
|
5
|
+
*
|
|
6
|
+
* Markers (MUST PRESERVE):
|
|
7
|
+
* - "at most 4 bounded questions"
|
|
8
|
+
* - "kb_autopilot_generate"
|
|
9
|
+
* - "preview" or "approval"
|
|
10
|
+
* - "kb_upsert"
|
|
11
|
+
* - "kb_check"
|
|
12
|
+
* - "sequential" or similar ordering language
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildInitKibiAlias(): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds the canonical native alias for the Kibi MCP bootstrap workflow.
|
|
3
|
+
* This is a thin wrapper over the MCP-defined workflow, preserving all
|
|
4
|
+
* semantic markers while removing namespacing and keeping text concise.
|
|
5
|
+
*
|
|
6
|
+
* Markers (MUST PRESERVE):
|
|
7
|
+
* - "at most 4 bounded questions"
|
|
8
|
+
* - "kb_autopilot_generate"
|
|
9
|
+
* - "preview" or "approval"
|
|
10
|
+
* - "kb_upsert"
|
|
11
|
+
* - "kb_check"
|
|
12
|
+
* - "sequential" or similar ordering language
|
|
13
|
+
*/
|
|
14
|
+
// implements REQ-opencode-kibi-briefing-v2
|
|
15
|
+
export function buildInitKibiAlias() {
|
|
16
|
+
const lines = [
|
|
17
|
+
"# /init-kibi: Interactive Activation",
|
|
18
|
+
"",
|
|
19
|
+
"Use this workflow to onboard a new or empty repository into Kibi through interactive discovery.",
|
|
20
|
+
"",
|
|
21
|
+
"## 1. Gather Declared Context",
|
|
22
|
+
"Ask at most 4 bounded questions to gather intent: Project Summary, Source of Truth, Priority Root, and Verification Anchors.",
|
|
23
|
+
"",
|
|
24
|
+
"## 2. Synthesize Candidates",
|
|
25
|
+
"Call `kb_autopilot_generate` with the gathered context to synthesize candidate entities. This tool is **read-only**.",
|
|
26
|
+
"",
|
|
27
|
+
"## 3. Preview and Approval",
|
|
28
|
+
"Present the `promptBlock` and a summary of synthesized `candidates` to the user. **Wait for explicit approval** before proceeding to writes.",
|
|
29
|
+
"",
|
|
30
|
+
"## 4. Apply Approved Candidates",
|
|
31
|
+
"Apply approved candidates sequentially using `kb_upsert` (following ascending phase order). Confirm success of each write before moving to the next. Run `kb_check` after the batch to verify KB integrity.",
|
|
32
|
+
"",
|
|
33
|
+
"## Rules",
|
|
34
|
+
"- Never apply changes without a user-facing preview and approval.",
|
|
35
|
+
"- Guidance must stay MCP-only; do not suggest `kibi` CLI commands.",
|
|
36
|
+
];
|
|
37
|
+
return lines.join("\n");
|
|
38
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const INIT_KIBI_COMMAND_NAME = "init-kibi";
|
|
2
|
+
export declare const INIT_KIBI_COMMAND_TEMPLATE: string;
|
|
3
|
+
export declare const INIT_KIBI_COMMAND_DESCRIPTION = "Run the Kibi interactive activation workflow.";
|
|
4
|
+
export interface OpenCodeCommandDefinition {
|
|
5
|
+
template: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
agent?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
subtask?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface OpenCodeConfigHookInput {
|
|
12
|
+
command?: Record<string, OpenCodeCommandDefinition>;
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
}
|
|
15
|
+
export type InitKibiCommandCapability = {
|
|
16
|
+
supported: true;
|
|
17
|
+
pluginVersion: string;
|
|
18
|
+
} | {
|
|
19
|
+
supported: false;
|
|
20
|
+
reason: string;
|
|
21
|
+
pluginVersion?: string;
|
|
22
|
+
};
|
|
23
|
+
interface InitKibiCapabilityDetectionInput {
|
|
24
|
+
pluginVersion?: string;
|
|
25
|
+
pluginHooksDts?: string;
|
|
26
|
+
sdkTypesDts?: string;
|
|
27
|
+
}
|
|
28
|
+
export declare function findSdkPackageJsonForPluginRoot(pluginRoot: string): string | undefined;
|
|
29
|
+
export declare function detectInitKibiCommandCapability(input: InitKibiCapabilityDetectionInput): InitKibiCommandCapability;
|
|
30
|
+
export declare function getInitKibiCommandCapability(): InitKibiCommandCapability;
|
|
31
|
+
export declare function registerInitKibiCommand(configInput: unknown, capability?: InitKibiCommandCapability): InitKibiCommandCapability;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { buildInitKibiAlias } from "./init-kibi-alias.js";
|
|
6
|
+
export const INIT_KIBI_COMMAND_NAME = "init-kibi";
|
|
7
|
+
export const INIT_KIBI_COMMAND_TEMPLATE = buildInitKibiAlias();
|
|
8
|
+
export const INIT_KIBI_COMMAND_DESCRIPTION = "Run the Kibi interactive activation workflow."; // implements REQ-001
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
let cachedCapability = null;
|
|
11
|
+
const initialProcessCwd = process.cwd();
|
|
12
|
+
const initialEnvPwd = process.env.PWD;
|
|
13
|
+
const initialGithubWorkspace = process.env.GITHUB_WORKSPACE;
|
|
14
|
+
function* candidateHostRoots(startDir) {
|
|
15
|
+
let current = path.resolve(startDir);
|
|
16
|
+
while (true) {
|
|
17
|
+
yield current;
|
|
18
|
+
const parent = path.dirname(current);
|
|
19
|
+
if (parent === current) {
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
current = parent;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function resolveDogfoodHostCapabilityInputs(startDirs) {
|
|
26
|
+
const seenRoots = new Set();
|
|
27
|
+
for (const startDir of startDirs) {
|
|
28
|
+
for (const root of candidateHostRoots(startDir)) {
|
|
29
|
+
if (seenRoots.has(root)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
seenRoots.add(root);
|
|
33
|
+
const pluginPackageJsonPath = path.join(root, ".opencode", "node_modules", "@opencode-ai", "plugin", "package.json");
|
|
34
|
+
if (!fs.existsSync(pluginPackageJsonPath)) {
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const pluginRoot = path.dirname(pluginPackageJsonPath);
|
|
38
|
+
const sdkPackageJsonCandidates = [
|
|
39
|
+
path.join(root, ".opencode", "node_modules", "@opencode-ai", "sdk", "package.json"),
|
|
40
|
+
path.join(pluginRoot, "node_modules", "@opencode-ai", "sdk", "package.json"),
|
|
41
|
+
];
|
|
42
|
+
const sdkPackageJsonPath = sdkPackageJsonCandidates.find((candidate) => fs.existsSync(candidate));
|
|
43
|
+
if (!sdkPackageJsonPath) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const sdkRoot = path.dirname(sdkPackageJsonPath);
|
|
47
|
+
const pluginVersion = readPackageVersion(pluginPackageJsonPath);
|
|
48
|
+
const pluginHooksDts = readTextIfExists(path.join(pluginRoot, "dist", "index.d.ts"));
|
|
49
|
+
const sdkTypesDts = readTextIfExists(path.join(sdkRoot, "dist", "v2", "gen", "types.gen.d.ts"));
|
|
50
|
+
// Dogfood host artifacts can be partially installed (package.json present, dist d.ts absent).
|
|
51
|
+
// In that case we should keep probing/fallback instead of hard-failing capability detection.
|
|
52
|
+
if (typeof pluginHooksDts !== "string" ||
|
|
53
|
+
pluginHooksDts.length === 0 ||
|
|
54
|
+
typeof sdkTypesDts !== "string" ||
|
|
55
|
+
sdkTypesDts.length === 0) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
...(pluginVersion ? { pluginVersion } : {}),
|
|
60
|
+
pluginHooksDts,
|
|
61
|
+
sdkTypesDts,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
function buildUnsupportedReason(pluginVersion, detail) {
|
|
68
|
+
const prefix = pluginVersion
|
|
69
|
+
? `@opencode-ai/plugin@${pluginVersion}`
|
|
70
|
+
: "@opencode-ai/plugin";
|
|
71
|
+
return pluginVersion
|
|
72
|
+
? {
|
|
73
|
+
supported: false,
|
|
74
|
+
pluginVersion,
|
|
75
|
+
reason: `${prefix} ${detail}`,
|
|
76
|
+
}
|
|
77
|
+
: {
|
|
78
|
+
supported: false,
|
|
79
|
+
reason: `${prefix} ${detail}`,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function readTextIfExists(filePath) {
|
|
83
|
+
try {
|
|
84
|
+
return fs.readFileSync(filePath, "utf8");
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function readPackageVersion(filePath) {
|
|
91
|
+
try {
|
|
92
|
+
const raw = fs.readFileSync(filePath, "utf8");
|
|
93
|
+
const parsed = JSON.parse(raw);
|
|
94
|
+
return typeof parsed.version === "string" ? parsed.version : undefined;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
// implements REQ-opencode-kibi-briefing-v2
|
|
101
|
+
export function findSdkPackageJsonForPluginRoot(pluginRoot) {
|
|
102
|
+
const scopeRoot = path.dirname(pluginRoot);
|
|
103
|
+
const candidates = [
|
|
104
|
+
path.join(pluginRoot, "node_modules", "@opencode-ai", "sdk", "package.json"),
|
|
105
|
+
path.join(scopeRoot, "sdk", "package.json"),
|
|
106
|
+
];
|
|
107
|
+
return candidates.find((candidate) => fs.existsSync(candidate));
|
|
108
|
+
}
|
|
109
|
+
function hasConfigHook(pluginHooksDts) {
|
|
110
|
+
return /\bconfig\??:\s*\(input:\s*Config\)\s*=>\s*Promise<void>\s*;/.test(pluginHooksDts);
|
|
111
|
+
}
|
|
112
|
+
function hasConfigCommandField(sdkTypesDts) {
|
|
113
|
+
return /\bcommand\??:\s*\{[\s\S]*?\[key:\s*string\]:\s*\{[\s\S]*?\btemplate:\s*string\s*;/.test(sdkTypesDts);
|
|
114
|
+
}
|
|
115
|
+
function resolveHostCapabilityInputs() {
|
|
116
|
+
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
117
|
+
const dogfoodHost = resolveDogfoodHostCapabilityInputs([
|
|
118
|
+
process.cwd(),
|
|
119
|
+
process.env.PWD,
|
|
120
|
+
process.env.GITHUB_WORKSPACE,
|
|
121
|
+
initialProcessCwd,
|
|
122
|
+
initialEnvPwd,
|
|
123
|
+
initialGithubWorkspace,
|
|
124
|
+
moduleDir,
|
|
125
|
+
].filter((value) => typeof value === "string" && value.length > 0));
|
|
126
|
+
if (dogfoodHost) {
|
|
127
|
+
return dogfoodHost;
|
|
128
|
+
}
|
|
129
|
+
try {
|
|
130
|
+
const pluginPackageJsonPath = require.resolve("@opencode-ai/plugin/package.json");
|
|
131
|
+
const pluginRoot = path.dirname(pluginPackageJsonPath);
|
|
132
|
+
const sdkPackageJsonPath = findSdkPackageJsonForPluginRoot(pluginRoot) ??
|
|
133
|
+
require.resolve("@opencode-ai/sdk/package.json");
|
|
134
|
+
const sdkRoot = path.dirname(sdkPackageJsonPath);
|
|
135
|
+
const pluginVersion = readPackageVersion(pluginPackageJsonPath);
|
|
136
|
+
const pluginHooksDts = readTextIfExists(path.join(pluginRoot, "dist", "index.d.ts"));
|
|
137
|
+
const sdkTypesDts = readTextIfExists(path.join(sdkRoot, "dist", "v2", "gen", "types.gen.d.ts"));
|
|
138
|
+
return {
|
|
139
|
+
...(pluginVersion ? { pluginVersion } : {}),
|
|
140
|
+
...(pluginHooksDts ? { pluginHooksDts } : {}),
|
|
141
|
+
...(sdkTypesDts ? { sdkTypesDts } : {}),
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function isRecord(value) {
|
|
149
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
150
|
+
}
|
|
151
|
+
function isCommandMap(value) {
|
|
152
|
+
return isRecord(value);
|
|
153
|
+
}
|
|
154
|
+
// implements REQ-opencode-kibi-briefing-v2
|
|
155
|
+
export function detectInitKibiCommandCapability(input) {
|
|
156
|
+
const { pluginVersion, pluginHooksDts, sdkTypesDts } = input;
|
|
157
|
+
if (typeof pluginHooksDts !== "string" || pluginHooksDts.length === 0) {
|
|
158
|
+
return buildUnsupportedReason(pluginVersion, "host Hooks definition is unavailable for config hook inspection.");
|
|
159
|
+
}
|
|
160
|
+
if (!hasConfigHook(pluginHooksDts)) {
|
|
161
|
+
return buildUnsupportedReason(pluginVersion, "Hooks interface does not expose the config hook needed for native command injection.");
|
|
162
|
+
}
|
|
163
|
+
if (typeof sdkTypesDts !== "string" || sdkTypesDts.length === 0) {
|
|
164
|
+
return buildUnsupportedReason(pluginVersion, "SDK Config definition is unavailable for command surface inspection.");
|
|
165
|
+
}
|
|
166
|
+
if (!hasConfigCommandField(sdkTypesDts)) {
|
|
167
|
+
return buildUnsupportedReason(pluginVersion, "SDK Config type does not expose the command field needed for native command injection.");
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
supported: true,
|
|
171
|
+
pluginVersion: pluginVersion ?? "unknown",
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
// implements REQ-opencode-kibi-briefing-v2
|
|
175
|
+
export function getInitKibiCommandCapability() {
|
|
176
|
+
if (cachedCapability?.supported) {
|
|
177
|
+
return cachedCapability;
|
|
178
|
+
}
|
|
179
|
+
cachedCapability = detectInitKibiCommandCapability(resolveHostCapabilityInputs());
|
|
180
|
+
return cachedCapability;
|
|
181
|
+
}
|
|
182
|
+
// implements REQ-opencode-kibi-briefing-v2
|
|
183
|
+
export function registerInitKibiCommand(configInput, capability = getInitKibiCommandCapability()) {
|
|
184
|
+
if (!capability.supported) {
|
|
185
|
+
return capability;
|
|
186
|
+
}
|
|
187
|
+
if (!isRecord(configInput)) {
|
|
188
|
+
return buildUnsupportedReason(capability.pluginVersion, "config hook input is not an object.");
|
|
189
|
+
}
|
|
190
|
+
const existingCommands = configInput.command;
|
|
191
|
+
if (existingCommands !== undefined && !isCommandMap(existingCommands)) {
|
|
192
|
+
return buildUnsupportedReason(capability.pluginVersion, "config hook input.command is not an object.");
|
|
193
|
+
}
|
|
194
|
+
configInput.command = {
|
|
195
|
+
...(existingCommands ?? {}),
|
|
196
|
+
[INIT_KIBI_COMMAND_NAME]: {
|
|
197
|
+
template: INIT_KIBI_COMMAND_TEMPLATE,
|
|
198
|
+
description: INIT_KIBI_COMMAND_DESCRIPTION,
|
|
199
|
+
},
|
|
200
|
+
};
|
|
201
|
+
return capability;
|
|
202
|
+
}
|
package/dist/logger.js
CHANGED
|
@@ -23,7 +23,9 @@ export function info(msg, metadata) {
|
|
|
23
23
|
.log({
|
|
24
24
|
body: buildBody("info", msg, metadata),
|
|
25
25
|
})
|
|
26
|
-
.catch(
|
|
26
|
+
.catch(() => {
|
|
27
|
+
// Advisory logging stays silent even on transport failure
|
|
28
|
+
});
|
|
27
29
|
return;
|
|
28
30
|
}
|
|
29
31
|
// Fallback when no client is available (e.g. during tests or early init)
|
|
@@ -35,7 +37,9 @@ export function warn(msg, metadata) {
|
|
|
35
37
|
.log({
|
|
36
38
|
body: buildBody("warn", msg, metadata),
|
|
37
39
|
})
|
|
38
|
-
.catch(
|
|
40
|
+
.catch(() => {
|
|
41
|
+
// Advisory logging stays silent even on transport failure
|
|
42
|
+
});
|
|
39
43
|
return;
|
|
40
44
|
}
|
|
41
45
|
// Fallback when no client is available
|
|
@@ -66,6 +70,8 @@ export function error(msg, metadata) {
|
|
|
66
70
|
.log({
|
|
67
71
|
body: buildBody("error", msg, metadata),
|
|
68
72
|
})
|
|
69
|
-
.catch(
|
|
73
|
+
.catch(() => {
|
|
74
|
+
// Structured log rejection is silent; operational error already reported above
|
|
75
|
+
});
|
|
70
76
|
}
|
|
71
77
|
}
|
package/dist/plugin-startup.d.ts
CHANGED
|
@@ -24,5 +24,6 @@ export interface PluginStartupContext {
|
|
|
24
24
|
getEffectiveMode: () => EffectiveMode;
|
|
25
25
|
latchRuntimeDegraded: (cause: NonNullable<RuntimeDegradedOverlay["primaryCause"]>) => void;
|
|
26
26
|
}
|
|
27
|
+
export declare function resolveCurrentBranch(cwd: string): string;
|
|
27
28
|
export declare function runPluginStartup(input: PluginInput): Promise<PluginStartupContext | null>;
|
|
28
29
|
export {};
|
package/dist/plugin-startup.js
CHANGED
|
@@ -19,13 +19,22 @@ function isSmartEnforcementSyncReason(reason) {
|
|
|
19
19
|
return normalizedReason.startsWith("smart-enforcement.");
|
|
20
20
|
}
|
|
21
21
|
const workspaceCacheState = new Map();
|
|
22
|
-
function resolveCurrentBranch(cwd) {
|
|
22
|
+
export function resolveCurrentBranch(cwd) {
|
|
23
|
+
// implements REQ-opencode-kibi-briefing-v3
|
|
24
|
+
// 1. Check KIBI_BRANCH env var first (highest precedence)
|
|
25
|
+
const envBranch = process.env.KIBI_BRANCH?.trim();
|
|
26
|
+
if (envBranch && envBranch.length > 0) {
|
|
27
|
+
return envBranch === "master" ? "main" : envBranch;
|
|
28
|
+
}
|
|
29
|
+
// 2. Fall back to git branch
|
|
23
30
|
try {
|
|
24
|
-
|
|
31
|
+
const branch = execSync("git branch --show-current", {
|
|
25
32
|
cwd,
|
|
26
33
|
encoding: "utf8",
|
|
27
34
|
stdio: ["ignore", "pipe", "ignore"],
|
|
35
|
+
timeout: 5000,
|
|
28
36
|
}).trim();
|
|
37
|
+
return branch === "master" ? "main" : branch;
|
|
29
38
|
}
|
|
30
39
|
catch {
|
|
31
40
|
return "unknown";
|
package/dist/prompt.d.ts
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import type { CommentAnalysisResult } from "./comment-analysis.js";
|
|
2
|
+
import type { BriefingRuntimeResult } from "./briefing-runtime.js";
|
|
2
3
|
import type { KibiConfig } from "./config.js";
|
|
4
|
+
import { type InitKibiCommandCapability } from "./init-kibi-capability.js";
|
|
3
5
|
import type { GuidanceCache } from "./guidance-cache.js";
|
|
4
6
|
import type { PathKind } from "./path-kind.js";
|
|
5
7
|
import type { RepoPosture } from "./repo-posture.js";
|
|
6
8
|
import type { RiskClass } from "./risk-classifier.js";
|
|
7
9
|
import type { WorkspaceHealth } from "./workspace-health.js";
|
|
8
10
|
declare const SENTINEL = "<!-- kibi-opencode -->";
|
|
11
|
+
export declare function buildAutoBriefingGuidance(autoBriefResult: BriefingRuntimeResult | undefined, completionReminder: boolean): string | null;
|
|
9
12
|
export interface PromptContext {
|
|
10
13
|
recentEdits: Array<{
|
|
11
14
|
path: string;
|
|
12
15
|
kind: PathKind;
|
|
13
16
|
}>;
|
|
17
|
+
focusEdit?: {
|
|
18
|
+
path: string;
|
|
19
|
+
kind: PathKind;
|
|
20
|
+
} | null;
|
|
14
21
|
workspaceHealth?: WorkspaceHealth;
|
|
15
22
|
hasRecentKbEdit?: boolean;
|
|
16
23
|
recentCommentSuggestion?: CommentAnalysisResult | null;
|
|
@@ -32,14 +39,22 @@ export interface PromptContext {
|
|
|
32
39
|
degradedMode?: "warn-once" | "structured-only";
|
|
33
40
|
/** Whether to show the degraded advisory block this invocation */
|
|
34
41
|
showDegradedAdvisory?: boolean;
|
|
42
|
+
/** Stored auto-brief runtime result for the current fingerprint */
|
|
43
|
+
autoBriefResult?: BriefingRuntimeResult;
|
|
44
|
+
/** File-operation reminder from lifecycle and e2e coverage signals */
|
|
45
|
+
fileOperationReminder?: {
|
|
46
|
+
path: string;
|
|
47
|
+
lifecycleReminder: string | null;
|
|
48
|
+
e2eReminder: string | null;
|
|
49
|
+
};
|
|
35
50
|
}
|
|
36
|
-
export declare function postureGuidance(posture: RepoPosture): string | null;
|
|
51
|
+
export declare function postureGuidance(posture: RepoPosture, capability?: InitKibiCommandCapability): string | null;
|
|
37
52
|
/**
|
|
38
53
|
* Build prompt with contextual guidance based on posture, risk class, and cache state.
|
|
39
54
|
*/
|
|
40
|
-
export declare function buildPrompt(context?: PromptContext): string;
|
|
55
|
+
export declare function buildPrompt(context?: PromptContext, capability?: InitKibiCommandCapability): string;
|
|
41
56
|
/**
|
|
42
57
|
* Inject prompt guidance if not already present.
|
|
43
58
|
*/
|
|
44
|
-
export declare function injectPrompt(current: string, config: KibiConfig, context?: PromptContext): string;
|
|
59
|
+
export declare function injectPrompt(current: string, config: KibiConfig, context?: PromptContext, capability?: InitKibiCommandCapability): string;
|
|
45
60
|
export { SENTINEL };
|