kibi-opencode 0.14.0 → 0.15.1

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.
Files changed (62) hide show
  1. package/README.md +18 -12
  2. package/dist/config.d.ts +0 -3
  3. package/dist/config.js +0 -9
  4. package/dist/e2e-coverage-signals.js +1 -3
  5. package/dist/enforcement-policy.d.ts +2 -0
  6. package/dist/enforcement-policy.js +18 -3
  7. package/dist/enforcement-scope.js +1 -3
  8. package/dist/file-entity-links.js +2 -6
  9. package/dist/file-operation-reminders.d.ts +4 -4
  10. package/dist/file-operation-state.js +4 -2
  11. package/dist/init-kibi-alias.js +0 -1
  12. package/dist/init-kibi-capability.js +1 -5
  13. package/dist/kb-freshness-state.d.ts +62 -0
  14. package/dist/kb-freshness-state.js +215 -0
  15. package/dist/kibi-checkpoint-runner.d.ts +1 -1
  16. package/dist/kibi-checkpoint-runner.js +6 -3
  17. package/dist/knowledge-classifier.js +2 -1
  18. package/dist/meaningful-change-classifier.d.ts +30 -0
  19. package/dist/meaningful-change-classifier.js +103 -0
  20. package/dist/plugin-startup.js +0 -1
  21. package/dist/plugin.js +101 -391
  22. package/dist/prompt.d.ts +6 -5
  23. package/dist/prompt.js +48 -84
  24. package/dist/reconcile-engine.d.ts +15 -1
  25. package/dist/reconcile-engine.js +1 -3
  26. package/dist/scheduler.js +16 -4
  27. package/dist/session-edit-state.js +2 -1
  28. package/dist/source-linked-guidance.js +3 -1
  29. package/dist/startup-notifier.d.ts +7 -1
  30. package/dist/startup-notifier.js +51 -17
  31. package/dist/tui.js +1 -403
  32. package/dist/tui.jsx +1 -113
  33. package/dist/version-metadata.d.ts +13 -0
  34. package/dist/version-metadata.js +78 -0
  35. package/dist/version-metadata.json +1 -0
  36. package/package.json +5 -7
  37. package/dist/brief-delivery-reasons.d.ts +0 -12
  38. package/dist/brief-delivery-reasons.js +0 -132
  39. package/dist/brief-intent.d.ts +0 -41
  40. package/dist/brief-intent.js +0 -142
  41. package/dist/briefing-runtime.d.ts +0 -24
  42. package/dist/briefing-runtime.js +0 -277
  43. package/dist/graph-narrator.d.ts +0 -25
  44. package/dist/graph-narrator.js +0 -408
  45. package/dist/idle-brief-audit.d.ts +0 -36
  46. package/dist/idle-brief-audit.js +0 -186
  47. package/dist/idle-brief-paths.d.ts +0 -6
  48. package/dist/idle-brief-paths.js +0 -120
  49. package/dist/idle-brief-reader.d.ts +0 -37
  50. package/dist/idle-brief-reader.js +0 -163
  51. package/dist/idle-brief-runtime.d.ts +0 -55
  52. package/dist/idle-brief-runtime.js +0 -496
  53. package/dist/idle-brief-store.d.ts +0 -113
  54. package/dist/idle-brief-store.js +0 -262
  55. package/dist/session-fingerprint.d.ts +0 -11
  56. package/dist/session-fingerprint.js +0 -21
  57. package/dist/tui-brief-delivery.d.ts +0 -67
  58. package/dist/tui-brief-delivery.js +0 -279
  59. package/dist/tui-brief-view-model.d.ts +0 -63
  60. package/dist/tui-brief-view-model.js +0 -209
  61. package/dist/utils/brief-marker.d.ts +0 -19
  62. package/dist/utils/brief-marker.js +0 -101
@@ -0,0 +1,30 @@
1
+ import type { FileLifecycle } from "./file-operation-state.js";
2
+ import type { PathKind } from "./path-kind.js";
3
+ import type { RiskClass } from "./risk-classifier.js";
4
+ /**
5
+ * Classification for whether a file change requires KB freshness evidence.
6
+ *
7
+ * - "requires-kb-evidence": The change is meaningful for KB freshness — the KB
8
+ * snapshot should be considered stale and needs a re-sync.
9
+ * - "advisory": The change is low-risk (lockfiles, docs-only) — advisory only.
10
+ * - "ignored": The change is in a build artifact or third-party path — no KB
11
+ * impact.
12
+ */
13
+ export type MeaningfulChangeClass = "requires-kb-evidence" | "advisory" | "ignored";
14
+ /**
15
+ * Classify whether a file change requires KB freshness evidence.
16
+ *
17
+ * Rules (first match wins):
18
+ * 1. Ignored paths (build artifacts, vendor dirs) → `ignored`
19
+ * 2. Advisory paths (lockfiles) → `advisory`
20
+ * 3. Meaningful pathKinds (code, requirements, KB docs, etc.) → `requires-kb-evidence`
21
+ * 4. Risk-based upgrade (behavior/traceability/req_policy candidates) → `requires-kb-evidence`
22
+ * 5. `safe_docs_only` risk + `unknown` pathKind → `advisory`
23
+ * 6. Default → `requires-kb-evidence` (safety default)
24
+ */
25
+ export declare function classifyMeaningfulChange(params: {
26
+ normalizedPath: string;
27
+ pathKind: PathKind;
28
+ lifecycle: FileLifecycle;
29
+ riskClass?: RiskClass;
30
+ }): MeaningfulChangeClass;
@@ -0,0 +1,103 @@
1
+ // Directories whose contents are always ignored for KB freshness.
2
+ const IGNORED_DIRECTORIES = [
3
+ ".git",
4
+ ".sisyphus",
5
+ "node_modules",
6
+ "vendor",
7
+ "third_party",
8
+ "dist",
9
+ "coverage",
10
+ ];
11
+ // Filenames that are advisory-only (lockfiles).
12
+ const ADVISORY_FILENAMES = new Set([
13
+ "bun.lock",
14
+ "bun.lockb",
15
+ "package-lock.json",
16
+ "pnpm-lock.yaml",
17
+ "yarn.lock",
18
+ ]);
19
+ // PathKind values that always require KB evidence.
20
+ const MEANINGFUL_PATH_KINDS = new Set([
21
+ "code",
22
+ "requirement",
23
+ "scenario",
24
+ "test",
25
+ "adr",
26
+ "fact",
27
+ "flag",
28
+ "event",
29
+ "symbol",
30
+ "kb",
31
+ ]);
32
+ // Risk classes that upgrade the classification to requires-kb-evidence.
33
+ const UPGRADE_RISK_CLASSES = new Set([
34
+ "behavior_candidate",
35
+ "traceability_candidate",
36
+ "req_policy_candidate",
37
+ ]);
38
+ function isIgnoredPath(normalizedPath, pathKind) {
39
+ // Check extension-based ignored patterns.
40
+ if (normalizedPath.endsWith(".tsbuildinfo") ||
41
+ normalizedPath.endsWith(".map")) {
42
+ return true;
43
+ }
44
+ // Check directory-based ignored patterns.
45
+ for (const dir of IGNORED_DIRECTORIES) {
46
+ if (normalizedPath.startsWith(`${dir}/`) ||
47
+ normalizedPath.includes(`/${dir}/`)) {
48
+ return true;
49
+ }
50
+ }
51
+ // Special handling for .kb/ — only ignored when pathKind is NOT "kb".
52
+ // Actual KB entity files (pathKind=kb) should still require evidence.
53
+ if (pathKind !== "kb") {
54
+ if (normalizedPath.startsWith(".kb/") || normalizedPath.includes("/.kb/")) {
55
+ return true;
56
+ }
57
+ }
58
+ return false;
59
+ }
60
+ function getFilename(normalizedPath) {
61
+ const lastSlash = normalizedPath.lastIndexOf("/");
62
+ return lastSlash === -1
63
+ ? normalizedPath
64
+ : normalizedPath.slice(lastSlash + 1);
65
+ }
66
+ /**
67
+ * Classify whether a file change requires KB freshness evidence.
68
+ *
69
+ * Rules (first match wins):
70
+ * 1. Ignored paths (build artifacts, vendor dirs) → `ignored`
71
+ * 2. Advisory paths (lockfiles) → `advisory`
72
+ * 3. Meaningful pathKinds (code, requirements, KB docs, etc.) → `requires-kb-evidence`
73
+ * 4. Risk-based upgrade (behavior/traceability/req_policy candidates) → `requires-kb-evidence`
74
+ * 5. `safe_docs_only` risk + `unknown` pathKind → `advisory`
75
+ * 6. Default → `requires-kb-evidence` (safety default)
76
+ */
77
+ export function classifyMeaningfulChange(params) {
78
+ const { normalizedPath, pathKind, lifecycle: _lifecycle, riskClass } = params;
79
+ // 1. IGNORED paths (for freshness contract)
80
+ if (isIgnoredPath(normalizedPath, pathKind)) {
81
+ return "ignored";
82
+ }
83
+ // 2. ADVISORY paths (low-risk lockfiles)
84
+ const filename = getFilename(normalizedPath);
85
+ if (ADVISORY_FILENAMES.has(filename)) {
86
+ return "advisory";
87
+ }
88
+ // 3. REQUIRES-KB-EVIDENCE by pathKind
89
+ if (MEANINGFUL_PATH_KINDS.has(pathKind)) {
90
+ return "requires-kb-evidence";
91
+ }
92
+ // 4. RISK-BASED UPGRADE
93
+ if (riskClass) {
94
+ if (UPGRADE_RISK_CLASSES.has(riskClass)) {
95
+ return "requires-kb-evidence";
96
+ }
97
+ if (riskClass === "safe_docs_only" && pathKind === "unknown") {
98
+ return "advisory";
99
+ }
100
+ }
101
+ // 5. DEFAULT — safety default for unknown paths
102
+ return "requires-kb-evidence";
103
+ }
@@ -20,7 +20,6 @@ function isSmartEnforcementSyncReason(reason) {
20
20
  }
21
21
  const workspaceCacheState = new Map();
22
22
  export function resolveCurrentBranch(cwd) {
23
- // implements REQ-opencode-kibi-briefing-v3
24
23
  // 1. Check KIBI_BRANCH env var first (highest precedence)
25
24
  const envBranch = process.env.KIBI_BRANCH?.trim();
26
25
  if (envBranch && envBranch.length > 0) {