kibi-mcp 1.0.0 → 2.1.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/dist/workspace.js CHANGED
@@ -13,32 +13,17 @@
13
13
  GNU Affero General Public License for more details.
14
14
 
15
15
  You should have received a copy of the GNU Affero General Public License
16
- along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
- import fs from "node:fs";
19
18
  import path from "node:path";
20
- import { branchStorePath } from "kibi-runtime";
21
- const WORKSPACE_ENV_KEYS = [
22
- "KIBI_WORKSPACE",
23
- "KIBI_PROJECT_ROOT",
24
- "KIBI_ROOT",
25
- ];
19
+ import { branchStorePath, resolveKibiWorkspaceRoot } from "kibi-runtime";
26
20
  const KB_PATH_ENV_KEYS = ["KIBI_KB_PATH", "KB_PATH"];
27
- // implements REQ-002, REQ-012
21
+ /**
22
+ * Canonical workspace root — delegates to shared resolveKibiWorkspaceRoot.
23
+ */
24
+ // implements REQ-002, REQ-012, REQ-kibi-env-bootstrap
28
25
  export function resolveWorkspaceRoot(startDir = process.cwd()) {
29
- const envRoot = readFirstEnv(WORKSPACE_ENV_KEYS);
30
- if (envRoot) {
31
- return path.resolve(envRoot);
32
- }
33
- const kbRoot = findUpwards(startDir, ".kb");
34
- if (kbRoot) {
35
- return kbRoot;
36
- }
37
- const gitRoot = findUpwards(startDir, ".git");
38
- if (gitRoot) {
39
- return gitRoot;
40
- }
41
- return path.resolve(startDir);
26
+ return resolveKibiWorkspaceRoot(startDir);
42
27
  }
43
28
  // implements REQ-002, REQ-012
44
29
  export function resolveKbPath(workspaceRoot, branch) {
@@ -68,19 +53,9 @@ function readFirstEnv(keys) {
68
53
  }
69
54
  return null;
70
55
  }
71
- function findUpwards(startDir, marker) {
72
- let current = path.resolve(startDir);
73
- while (true) {
74
- const candidate = path.join(current, marker);
75
- if (fs.existsSync(candidate)) {
76
- return current;
77
- }
78
- const parent = path.dirname(current);
79
- if (parent === current) {
80
- return null;
81
- }
82
- current = parent;
83
- }
56
+ export function nextAncestorDirectory(current) {
57
+ const parent = path.dirname(current);
58
+ return parent === current ? undefined : parent;
84
59
  }
85
60
  function isBranchPath(p) {
86
61
  const parent = path.basename(path.dirname(p));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kibi-mcp",
3
- "version": "1.0.0",
3
+ "version": "2.1.0",
4
4
  "dependencies": {
5
5
  "@modelcontextprotocol/sdk": "^1.30.0",
6
6
  "ajv": "^8.18.0",
@@ -9,10 +9,9 @@
9
9
  "fast-glob": "^3.2.12",
10
10
  "gray-matter": "^4.0.3",
11
11
  "js-yaml": "^4.1.0",
12
- "kibi-runtime": "^1.0.1",
13
- "kibi-core": "^0.11.0",
12
+ "kibi-runtime": "^2.0.1",
13
+ "kibi-core": "^0.13.0",
14
14
  "mcpcat": "^0.1.12",
15
- "ts-morph": "^23.0.0",
16
15
  "zod": "^4.3.6"
17
16
  },
18
17
  "type": "module",
@@ -24,14 +23,12 @@
24
23
  "scripts": {
25
24
  "test": "bun test",
26
25
  "dev": "bun run bin/kibi-mcp",
27
- "build": "tsc -p tsconfig.json",
26
+ "clean": "rm -rf dist",
27
+ "build": "npm run clean && tsc -p tsconfig.json",
28
28
  "typecheck": "tsc -p tsconfig.json --noEmit",
29
29
  "prepack": "npm run build && node ../../scripts/verify-package-contract.mjs kibi-mcp"
30
30
  },
31
- "files": [
32
- "dist",
33
- "bin"
34
- ],
31
+ "files": ["dist", "bin"],
35
32
  "engines": {
36
33
  "node": ">=22"
37
34
  },