@kb-labs/core-sys 1.0.0 → 1.2.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/fs/__tests__/fs.spec.d.ts +2 -0
- package/dist/fs/__tests__/fs.spec.d.ts.map +1 -0
- package/dist/fs/__tests__/fs.spec.js +22 -0
- package/dist/fs/__tests__/fs.spec.js.map +1 -0
- package/dist/fs/fs.d.ts +6 -0
- package/dist/fs/fs.d.ts.map +1 -0
- package/dist/fs/fs.js +12 -0
- package/dist/fs/fs.js.map +1 -0
- package/dist/fs/index.d.ts +2 -0
- package/dist/fs/index.d.ts.map +1 -0
- package/dist/fs/index.js +2 -0
- package/dist/fs/index.js.map +1 -0
- package/dist/index.d.ts +5 -166
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -347
- package/dist/index.js.map +1 -1
- package/dist/output/factory.d.ts +20 -0
- package/dist/output/factory.d.ts.map +1 -0
- package/dist/output/factory.js +101 -0
- package/dist/output/factory.js.map +1 -0
- package/dist/output/index.d.ts +8 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +7 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output-impl.d.ts +40 -0
- package/dist/output/output-impl.d.ts.map +1 -0
- package/dist/output/output-impl.js +241 -0
- package/dist/output/output-impl.js.map +1 -0
- package/dist/output/types.d.ts +122 -0
- package/dist/output/types.d.ts.map +1 -0
- package/dist/output/types.js +6 -0
- package/dist/output/types.js.map +1 -0
- package/dist/repo/__tests__/repo.spec.d.ts +2 -0
- package/dist/repo/__tests__/repo.spec.d.ts.map +1 -0
- package/dist/repo/__tests__/repo.spec.js +25 -0
- package/dist/repo/__tests__/repo.spec.js.map +1 -0
- package/dist/repo/index.d.ts +2 -0
- package/dist/repo/index.d.ts.map +1 -0
- package/dist/repo/index.js +2 -0
- package/dist/repo/index.js.map +1 -0
- package/dist/repo/repo.d.ts +11 -0
- package/dist/repo/repo.d.ts.map +1 -0
- package/dist/repo/repo.js +36 -0
- package/dist/repo/repo.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/types.d.ts +6 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/types/types.js +2 -0
- package/dist/types/types.js.map +1 -0
- package/package.json +13 -13
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @kb-labs/core/sys/repo
|
|
3
|
+
* Repository root discovery. Pure infrastructure, no domain keys.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Find repository root by searching for markers in priority order.
|
|
7
|
+
* First searches entire tree for pnpm-workspace.yaml (monorepo root),
|
|
8
|
+
* then .git, then package.json as fallback.
|
|
9
|
+
*/
|
|
10
|
+
export declare function findRepoRoot(startDir?: string): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=repo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/repo/repo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,QAAQ,SAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAyB5E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @kb-labs/core/sys/repo
|
|
3
|
+
* Repository root discovery. Pure infrastructure, no domain keys.
|
|
4
|
+
*/
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { promises as fsp } from "node:fs";
|
|
7
|
+
/**
|
|
8
|
+
* Find repository root by searching for markers in priority order.
|
|
9
|
+
* First searches entire tree for pnpm-workspace.yaml (monorepo root),
|
|
10
|
+
* then .git, then package.json as fallback.
|
|
11
|
+
*/
|
|
12
|
+
export async function findRepoRoot(startDir = process.cwd()) {
|
|
13
|
+
const markersPriority = ["pnpm-workspace.yaml", ".git", "package.json"];
|
|
14
|
+
// Try each marker in priority order, searching entire tree each time
|
|
15
|
+
for (const marker of markersPriority) {
|
|
16
|
+
let dir = path.resolve(startDir);
|
|
17
|
+
while (true) {
|
|
18
|
+
try {
|
|
19
|
+
await fsp.access(path.join(dir, marker));
|
|
20
|
+
return dir; // Found it!
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// Continue searching upward
|
|
24
|
+
}
|
|
25
|
+
const parent = path.dirname(dir);
|
|
26
|
+
if (parent === dir) {
|
|
27
|
+
// Reached filesystem root without finding this marker
|
|
28
|
+
break;
|
|
29
|
+
}
|
|
30
|
+
dir = parent;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Fallback: return current directory if nothing found
|
|
34
|
+
return path.resolve(startDir);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=repo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repo.js","sourceRoot":"","sources":["../../src/repo/repo.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;IACvD,MAAM,eAAe,GAAG,CAAC,qBAAqB,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IAExE,qEAAqE;IACrE,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,CAAC;QACnC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,OAAO,IAAI,EAAE,CAAC;YACV,IAAI,CAAC;gBACD,MAAM,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;gBACzC,OAAO,GAAG,CAAC,CAAC,YAAY;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACL,4BAA4B;YAChC,CAAC;YAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACjC,IAAI,MAAM,KAAK,GAAG,EAAE,CAAC;gBACjB,sDAAsD;gBACtD,MAAM;YACV,CAAC;YACD,GAAG,GAAG,MAAM,CAAC;QACjB,CAAC;IACL,CAAC;IAED,sDAAsD;IACtD,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kb-labs/core-sys",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Core system utilities for KB Labs, including file system operations and path resolution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -23,6 +23,16 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": false,
|
|
26
|
+
"scripts": {
|
|
27
|
+
"clean": "rimraf dist",
|
|
28
|
+
"build": "pnpm clean && tsup --config tsup.config.ts",
|
|
29
|
+
"dev": "tsup --config tsup.config.ts --watch",
|
|
30
|
+
"type-check": "tsc --noEmit",
|
|
31
|
+
"test": "vitest run --passWithNoTests",
|
|
32
|
+
"lint": "eslint . --ignore-pattern 'dist/**' --ignore-pattern 'coverage/**' --ignore-pattern 'tsup.config.bundled_*.mjs'",
|
|
33
|
+
"lint:fix": "eslint . --fix --ignore-pattern 'dist/**' --ignore-pattern 'coverage/**' --ignore-pattern 'tsup.config.bundled_*.mjs'",
|
|
34
|
+
"test:watch": "vitest"
|
|
35
|
+
},
|
|
26
36
|
"dependencies": {
|
|
27
37
|
"@kb-labs/shared-cli-ui": "link:../../../kb-labs-shared/packages/shared-cli-ui"
|
|
28
38
|
},
|
|
@@ -33,7 +43,7 @@
|
|
|
33
43
|
"tsup": "^8.5.0",
|
|
34
44
|
"typescript": "^5.6.3",
|
|
35
45
|
"vitest": "^3.2.4",
|
|
36
|
-
"@kb-labs/devkit": "
|
|
46
|
+
"@kb-labs/devkit": "^1.0.0"
|
|
37
47
|
},
|
|
38
48
|
"module": "./dist/index.js",
|
|
39
49
|
"engines": {
|
|
@@ -42,15 +52,5 @@
|
|
|
42
52
|
},
|
|
43
53
|
"publishConfig": {
|
|
44
54
|
"access": "public"
|
|
45
|
-
},
|
|
46
|
-
"scripts": {
|
|
47
|
-
"clean": "rimraf dist",
|
|
48
|
-
"build": "pnpm clean && tsup --config tsup.config.ts",
|
|
49
|
-
"dev": "tsup --config tsup.config.ts --watch",
|
|
50
|
-
"type-check": "tsc --noEmit",
|
|
51
|
-
"test": "vitest run --passWithNoTests",
|
|
52
|
-
"lint": "eslint . --ignore-pattern 'dist/**' --ignore-pattern 'coverage/**'",
|
|
53
|
-
"lint:fix": "eslint . --fix --ignore-pattern 'dist/**' --ignore-pattern 'coverage/**'",
|
|
54
|
-
"test:watch": "vitest"
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
}
|