@hashicorp/kits 0.1.4 → 0.1.5
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 +173 -32
- package/dist/adapters/base-adapter.d.ts +2 -2
- package/dist/adapters/base-adapter.js +2 -2
- package/dist/adapters/claude-code/index.d.ts +1 -1
- package/dist/adapters/claude-code/index.js +1 -1
- package/dist/adapters/codex/index.d.ts +1 -1
- package/dist/adapters/codex/index.js +1 -1
- package/dist/adapters/gemini-cli/index.d.ts +1 -1
- package/dist/adapters/gemini-cli/index.js +1 -1
- package/dist/adapters/github-copilot/index.d.ts +1 -1
- package/dist/adapters/github-copilot/index.js +1 -1
- package/dist/adapters/opencode/index.d.ts +1 -1
- package/dist/adapters/opencode/index.js +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +29 -9
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +820 -161
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/list.d.ts.map +1 -1
- package/dist/cli/list.js +8 -6
- package/dist/cli/list.js.map +1 -1
- package/dist/cli/types.d.ts +17 -0
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +1 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +300 -38
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/upgrade.d.ts.map +1 -1
- package/dist/cli/upgrade.js +334 -105
- package/dist/cli/upgrade.js.map +1 -1
- package/dist/cli/validate.js +5 -5
- package/dist/cli/validate.js.map +1 -1
- package/dist/core/types.d.ts +5 -5
- package/dist/core/upgrade-executor.d.ts +7 -7
- package/dist/core/upgrade-executor.d.ts.map +1 -1
- package/dist/core/upgrade-executor.js +17 -17
- package/dist/core/upgrade-executor.js.map +1 -1
- package/dist/discovery/kit-scanner.d.ts +3 -3
- package/dist/discovery/kit-scanner.js +17 -17
- package/dist/discovery/kit-scanner.js.map +1 -1
- package/dist/discovery/types.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lockfile/index.d.ts +79 -0
- package/dist/lockfile/index.d.ts.map +1 -0
- package/dist/lockfile/index.js +203 -0
- package/dist/lockfile/index.js.map +1 -0
- package/dist/lockfile/read.d.ts +32 -0
- package/dist/lockfile/read.d.ts.map +1 -0
- package/dist/lockfile/read.js +88 -0
- package/dist/lockfile/read.js.map +1 -0
- package/dist/lockfile/types.d.ts +126 -0
- package/dist/lockfile/types.d.ts.map +1 -0
- package/dist/lockfile/types.js +44 -0
- package/dist/lockfile/types.js.map +1 -0
- package/dist/{manifest → lockfile}/upgrade-check.d.ts +5 -5
- package/dist/lockfile/upgrade-check.d.ts.map +1 -0
- package/dist/{manifest → lockfile}/upgrade-check.js +11 -9
- package/dist/lockfile/upgrade-check.js.map +1 -0
- package/dist/lockfile/utils.d.ts +35 -0
- package/dist/lockfile/utils.d.ts.map +1 -0
- package/dist/lockfile/utils.js +57 -0
- package/dist/lockfile/utils.js.map +1 -0
- package/dist/lockfile/write.d.ts +44 -0
- package/dist/lockfile/write.d.ts.map +1 -0
- package/dist/lockfile/write.js +77 -0
- package/dist/lockfile/write.js.map +1 -0
- package/dist/manifest/hash.d.ts +7 -0
- package/dist/manifest/hash.d.ts.map +1 -0
- package/dist/manifest/hash.js +30 -0
- package/dist/manifest/hash.js.map +1 -0
- package/dist/manifest/index.d.ts +8 -77
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +6 -197
- package/dist/manifest/index.js.map +1 -1
- package/dist/manifest/read.d.ts +4 -24
- package/dist/manifest/read.d.ts.map +1 -1
- package/dist/manifest/read.js +22 -46
- package/dist/manifest/read.js.map +1 -1
- package/dist/manifest/types.d.ts +17 -109
- package/dist/manifest/types.d.ts.map +1 -1
- package/dist/manifest/types.js +8 -37
- package/dist/manifest/types.js.map +1 -1
- package/dist/manifest/utils.d.ts +1 -27
- package/dist/manifest/utils.d.ts.map +1 -1
- package/dist/manifest/utils.js +1 -28
- package/dist/manifest/utils.js.map +1 -1
- package/dist/manifest/write.d.ts +3 -34
- package/dist/manifest/write.d.ts.map +1 -1
- package/dist/manifest/write.js +5 -45
- package/dist/manifest/write.js.map +1 -1
- package/dist/resolution/index.d.ts +7 -7
- package/dist/resolution/index.d.ts.map +1 -1
- package/dist/resolution/index.js +29 -19
- package/dist/resolution/index.js.map +1 -1
- package/dist/resolution/multi-kit-resolver.d.ts +2 -2
- package/dist/resolution/multi-kit-resolver.js +2 -2
- package/dist/resolution/primitives-registry.d.ts +1 -1
- package/dist/resolution/primitives-registry.js +2 -2
- package/dist/resolution/primitives-registry.js.map +1 -1
- package/dist/resolution/types.d.ts +1 -1
- package/dist/resolution/types.js +1 -1
- package/dist/tui/types.d.ts +1 -0
- package/dist/tui/types.d.ts.map +1 -1
- package/dist/tui/upgrade-select.d.ts +1 -1
- package/dist/tui/upgrade-select.d.ts.map +1 -1
- package/dist/tui/upgrade-select.js +15 -4
- package/dist/tui/upgrade-select.js.map +1 -1
- package/dist/validation/validate-kits.d.ts +1 -1
- package/dist/validation/validate-kits.js +5 -5
- package/dist/validation/validate-kits.js.map +1 -1
- package/package.json +1 -1
- package/schemas/{manifest.schema.json → kits-lock.schema.json} +34 -8
- package/schemas/kits-manifest.schema.json +95 -0
- package/schemas/{kits.schema.json → kits-registry.schema.json} +3 -3
- package/schemas/{primitives.schema.json → primitives-registry.schema.json} +2 -2
- package/dist/manifest/upgrade-check.d.ts.map +0 -1
- package/dist/manifest/upgrade-check.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for the lockfile module.
|
|
3
|
+
*/
|
|
4
|
+
import type { InstallationScope } from "../core/types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Expand ~ to home directory.
|
|
7
|
+
*
|
|
8
|
+
* @param pathStr - Path string that may contain ~
|
|
9
|
+
* @returns Expanded path string
|
|
10
|
+
*/
|
|
11
|
+
export declare function expandPath(pathStr: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Get the lockfile path for a given scope.
|
|
14
|
+
*
|
|
15
|
+
* @param scope - Installation scope (global or project)
|
|
16
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
17
|
+
* @returns Absolute path to the lockfile file
|
|
18
|
+
*/
|
|
19
|
+
export declare function getLockfilePath(scope: InstallationScope, projectRoot?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the lockfile directory path for a given scope.
|
|
22
|
+
*
|
|
23
|
+
* @param scope - Installation scope (global or project)
|
|
24
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
25
|
+
* @returns Absolute path to the lockfile directory
|
|
26
|
+
*/
|
|
27
|
+
export declare function getLockfileDir(scope: InstallationScope, projectRoot?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Ensure the lockfile directory exists for a given scope.
|
|
30
|
+
*
|
|
31
|
+
* @param scope - Installation scope (global or project)
|
|
32
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
33
|
+
*/
|
|
34
|
+
export declare function ensureLockfileDir(scope: InstallationScope, projectRoot?: string): Promise<void>;
|
|
35
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lockfile/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAO1D;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,iBAAiB,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAWR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,iBAAiB,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,iBAAiB,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for the lockfile module.
|
|
3
|
+
*/
|
|
4
|
+
import fs from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { GLOBAL_LOCKFILE_PATH, PROJECT_LOCKFILE_DIR, PROJECT_LOCKFILE_FILENAME, } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Expand ~ to home directory.
|
|
9
|
+
*
|
|
10
|
+
* @param pathStr - Path string that may contain ~
|
|
11
|
+
* @returns Expanded path string
|
|
12
|
+
*/
|
|
13
|
+
export function expandPath(pathStr) {
|
|
14
|
+
if (pathStr.startsWith("~")) {
|
|
15
|
+
const home = process.env["HOME"] || process.env["USERPROFILE"] || "";
|
|
16
|
+
return path.join(home, pathStr.slice(1));
|
|
17
|
+
}
|
|
18
|
+
return pathStr;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the lockfile path for a given scope.
|
|
22
|
+
*
|
|
23
|
+
* @param scope - Installation scope (global or project)
|
|
24
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
25
|
+
* @returns Absolute path to the lockfile file
|
|
26
|
+
*/
|
|
27
|
+
export function getLockfilePath(scope, projectRoot) {
|
|
28
|
+
if (scope === "global") {
|
|
29
|
+
return expandPath(GLOBAL_LOCKFILE_PATH);
|
|
30
|
+
}
|
|
31
|
+
// Project scope
|
|
32
|
+
if (!projectRoot) {
|
|
33
|
+
throw new Error("projectRoot is required for project scope");
|
|
34
|
+
}
|
|
35
|
+
return path.join(projectRoot, PROJECT_LOCKFILE_DIR, PROJECT_LOCKFILE_FILENAME);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get the lockfile directory path for a given scope.
|
|
39
|
+
*
|
|
40
|
+
* @param scope - Installation scope (global or project)
|
|
41
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
42
|
+
* @returns Absolute path to the lockfile directory
|
|
43
|
+
*/
|
|
44
|
+
export function getLockfileDir(scope, projectRoot) {
|
|
45
|
+
return path.dirname(getLockfilePath(scope, projectRoot));
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Ensure the lockfile directory exists for a given scope.
|
|
49
|
+
*
|
|
50
|
+
* @param scope - Installation scope (global or project)
|
|
51
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
52
|
+
*/
|
|
53
|
+
export async function ensureLockfileDir(scope, projectRoot) {
|
|
54
|
+
const lockfileDir = getLockfileDir(scope, projectRoot);
|
|
55
|
+
await fs.mkdir(lockfileDir, { recursive: true });
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lockfile/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,IAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;QACrE,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC7B,KAAwB,EACxB,WAAoB;IAEpB,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,UAAU,CAAC,oBAAoB,CAAC,CAAC;IAC1C,CAAC;IAED,gBAAgB;IAChB,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAoB,EAAE,yBAAyB,CAAC,CAAC;AACjF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAwB,EACxB,WAAoB;IAEpB,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAwB,EACxB,WAAoB;IAEpB,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockfile write operations.
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to write and update the kits lockfile.
|
|
5
|
+
*/
|
|
6
|
+
import type { InstallationScope } from "../core/types.js";
|
|
7
|
+
import type { KitsLockfile } from "./types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when lockfile write fails.
|
|
10
|
+
*/
|
|
11
|
+
export declare class LockfileWriteError extends Error {
|
|
12
|
+
readonly errorCause?: unknown;
|
|
13
|
+
constructor(message: string, cause?: unknown);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Write the kits lockfile to disk.
|
|
17
|
+
*
|
|
18
|
+
* Creates the lockfile directory if it doesn't exist.
|
|
19
|
+
* Updates the lastUpdated timestamp automatically.
|
|
20
|
+
* Ensures the scope field matches the write location.
|
|
21
|
+
*
|
|
22
|
+
* @param lockfile - The lockfile to write
|
|
23
|
+
* @param scope - Installation scope (global or project), defaults to lockfile.scope
|
|
24
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
25
|
+
* @throws LockfileWriteError if writing fails
|
|
26
|
+
*/
|
|
27
|
+
export declare function writeLockfile(lockfile: KitsLockfile, scope?: InstallationScope, projectRoot?: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Get the expanded lockfile path for a given scope.
|
|
30
|
+
*
|
|
31
|
+
* @param scope - Installation scope (global or project), defaults to global
|
|
32
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
33
|
+
* @returns The absolute path to the lockfile file
|
|
34
|
+
*/
|
|
35
|
+
export declare function getLockfilePathForScope(scope?: InstallationScope, projectRoot?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Get the lockfile directory path for a given scope.
|
|
38
|
+
*
|
|
39
|
+
* @param scope - Installation scope (global or project), defaults to global
|
|
40
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
41
|
+
* @returns The absolute path to the lockfile directory
|
|
42
|
+
*/
|
|
43
|
+
export declare function getLockfileDirForScope(scope?: InstallationScope, projectRoot?: string): string;
|
|
44
|
+
//# sourceMappingURL=write.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/lockfile/write.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,YAAY,EACtB,KAAK,CAAC,EAAE,iBAAiB,EACzB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CA+Bf;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,GAAE,iBAA4B,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,GAAE,iBAA4B,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAER"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lockfile write operations.
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to write and update the kits lockfile.
|
|
5
|
+
*/
|
|
6
|
+
import fs from "node:fs/promises";
|
|
7
|
+
import { getLockfilePath, getLockfileDir, ensureLockfileDir } from "./utils.js";
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when lockfile write fails.
|
|
10
|
+
*/
|
|
11
|
+
export class LockfileWriteError extends Error {
|
|
12
|
+
errorCause;
|
|
13
|
+
constructor(message, cause) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = "LockfileWriteError";
|
|
16
|
+
this.errorCause = cause;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Write the kits lockfile to disk.
|
|
21
|
+
*
|
|
22
|
+
* Creates the lockfile directory if it doesn't exist.
|
|
23
|
+
* Updates the lastUpdated timestamp automatically.
|
|
24
|
+
* Ensures the scope field matches the write location.
|
|
25
|
+
*
|
|
26
|
+
* @param lockfile - The lockfile to write
|
|
27
|
+
* @param scope - Installation scope (global or project), defaults to lockfile.scope
|
|
28
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
29
|
+
* @throws LockfileWriteError if writing fails
|
|
30
|
+
*/
|
|
31
|
+
export async function writeLockfile(lockfile, scope, projectRoot) {
|
|
32
|
+
// Use provided scope or fall back to lockfile's scope
|
|
33
|
+
const effectiveScope = scope ?? lockfile.scope;
|
|
34
|
+
const lockfilePath = getLockfilePath(effectiveScope, projectRoot);
|
|
35
|
+
try {
|
|
36
|
+
// Ensure directory exists
|
|
37
|
+
await ensureLockfileDir(effectiveScope, projectRoot);
|
|
38
|
+
// Update timestamp
|
|
39
|
+
lockfile.lastUpdated = new Date().toISOString();
|
|
40
|
+
// Ensure scope field is set correctly
|
|
41
|
+
lockfile.scope = effectiveScope;
|
|
42
|
+
// Set or clear projectRoot based on scope
|
|
43
|
+
if (effectiveScope === "project" && projectRoot) {
|
|
44
|
+
lockfile.projectRoot = projectRoot;
|
|
45
|
+
}
|
|
46
|
+
else if (effectiveScope === "global") {
|
|
47
|
+
delete lockfile.projectRoot;
|
|
48
|
+
}
|
|
49
|
+
// Write lockfile with pretty formatting
|
|
50
|
+
const content = JSON.stringify(lockfile, null, 2);
|
|
51
|
+
await fs.writeFile(lockfilePath, content, "utf-8");
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
throw new LockfileWriteError(`Failed to write lockfile to ${lockfilePath}`, error);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get the expanded lockfile path for a given scope.
|
|
59
|
+
*
|
|
60
|
+
* @param scope - Installation scope (global or project), defaults to global
|
|
61
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
62
|
+
* @returns The absolute path to the lockfile file
|
|
63
|
+
*/
|
|
64
|
+
export function getLockfilePathForScope(scope = "global", projectRoot) {
|
|
65
|
+
return getLockfilePath(scope, projectRoot);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Get the lockfile directory path for a given scope.
|
|
69
|
+
*
|
|
70
|
+
* @param scope - Installation scope (global or project), defaults to global
|
|
71
|
+
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
72
|
+
* @returns The absolute path to the lockfile directory
|
|
73
|
+
*/
|
|
74
|
+
export function getLockfileDirForScope(scope = "global", projectRoot) {
|
|
75
|
+
return getLockfileDir(scope, projectRoot);
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=write.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/lockfile/write.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAIlC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhF;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,UAAU,CAAW;IAE9B,YAAY,OAAe,EAAE,KAAe;QAC1C,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC1B,CAAC;CACF;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAsB,EACtB,KAAyB,EACzB,WAAoB;IAEpB,sDAAsD;IACtD,MAAM,cAAc,GAAG,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC;IAC/C,MAAM,YAAY,GAAG,eAAe,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;IAElE,IAAI,CAAC;QACH,0BAA0B;QAC1B,MAAM,iBAAiB,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QAErD,mBAAmB;QACnB,QAAQ,CAAC,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAEhD,sCAAsC;QACtC,QAAQ,CAAC,KAAK,GAAG,cAAc,CAAC;QAEhC,0CAA0C;QAC1C,IAAI,cAAc,KAAK,SAAS,IAAI,WAAW,EAAE,CAAC;YAChD,QAAQ,CAAC,WAAW,GAAG,WAAW,CAAC;QACrC,CAAC;aAAM,IAAI,cAAc,KAAK,QAAQ,EAAE,CAAC;YACvC,OAAO,QAAQ,CAAC,WAAW,CAAC;QAC9B,CAAC;QAED,wCAAwC;QACxC,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAClD,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,kBAAkB,CAC1B,+BAA+B,YAAY,EAAE,EAC7C,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CACrC,QAA2B,QAAQ,EACnC,WAAoB;IAEpB,OAAO,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,QAA2B,QAAQ,EACnC,WAAoB;IAEpB,OAAO,cAAc,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical hashing for kits manifests.
|
|
3
|
+
*/
|
|
4
|
+
import type { KitsManifest } from "./types.js";
|
|
5
|
+
export declare function canonicalizeManifest(manifest: KitsManifest): string;
|
|
6
|
+
export declare function hashManifest(manifest: KitsManifest): string;
|
|
7
|
+
//# sourceMappingURL=hash.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/manifest/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAmB/C,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAGnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAI3D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical hashing for kits manifests.
|
|
3
|
+
*/
|
|
4
|
+
import crypto from "node:crypto";
|
|
5
|
+
function sortObject(value) {
|
|
6
|
+
if (Array.isArray(value)) {
|
|
7
|
+
return value.map((item) => sortObject(item));
|
|
8
|
+
}
|
|
9
|
+
if (!value || typeof value !== "object") {
|
|
10
|
+
return value;
|
|
11
|
+
}
|
|
12
|
+
const entries = Object.entries(value)
|
|
13
|
+
.filter(([, v]) => v !== undefined)
|
|
14
|
+
.sort(([a], [b]) => a.localeCompare(b));
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const [key, val] of entries) {
|
|
17
|
+
result[key] = sortObject(val);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
export function canonicalizeManifest(manifest) {
|
|
22
|
+
const sorted = sortObject(manifest);
|
|
23
|
+
return JSON.stringify(sorted);
|
|
24
|
+
}
|
|
25
|
+
export function hashManifest(manifest) {
|
|
26
|
+
const canonical = canonicalizeManifest(manifest);
|
|
27
|
+
const hash = crypto.createHash("sha256").update(canonical).digest("hex");
|
|
28
|
+
return `sha256:${hash}`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=hash.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/manifest/hash.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAIjC,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;SAC7D,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC;SAClC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,MAAM,MAAM,GAA4B,EAAE,CAAC;IAC3C,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,QAAsB;IACzD,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAiB,CAAC;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAsB;IACjD,MAAM,SAAS,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACzE,OAAO,UAAU,IAAI,EAAE,CAAC;AAC1B,CAAC"}
|
package/dist/manifest/index.d.ts
CHANGED
|
@@ -1,79 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
export { MANIFEST_VERSION, GLOBAL_MANIFEST_PATH, PROJECT_MANIFEST_DIR, PROJECT_MANIFEST_FILENAME, createEmptyManifest, } from "./types.js";
|
|
11
|
-
export { readManifest, getOrCreateManifest, ManifestReadError } from "./read.js";
|
|
12
|
-
export { writeManifest, ManifestWriteError } from "./write.js";
|
|
13
|
-
export { getManifestPathForScope, getManifestDirForScope } from "./write.js";
|
|
14
|
-
export { checkForUpgrades, checkForUpgradesInScope, createUpgradeSummary, } from "./upgrade-check.js";
|
|
15
|
-
export { expandPath, getManifestPath, getManifestDir, ensureManifestDir, } from "./utils.js";
|
|
16
|
-
/**
|
|
17
|
-
* Record a kit installation in the manifest.
|
|
18
|
-
*
|
|
19
|
-
* @param harness - The harness name
|
|
20
|
-
* @param kit - The kit definition
|
|
21
|
-
* @param primitives - The resolved primitives that were installed
|
|
22
|
-
* @param source - The source repository
|
|
23
|
-
* @param scope - Installation scope (global or project)
|
|
24
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
25
|
-
*/
|
|
26
|
-
export declare function recordInstallation(harness: HarnessName, kit: KitManifest, primitives: ResolvedPrimitive[], source: string, scope?: InstallationScope, projectRoot?: string): Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Remove a kit installation from the manifest.
|
|
29
|
-
*
|
|
30
|
-
* @param harness - The harness name
|
|
31
|
-
* @param kitName - The kit name to remove
|
|
32
|
-
* @param scope - Installation scope (global or project)
|
|
33
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
34
|
-
* @returns The removed kit info or null if not found
|
|
35
|
-
*/
|
|
36
|
-
export declare function removeInstallation(harness: HarnessName, kitName: string, scope?: InstallationScope, projectRoot?: string): Promise<InstalledKit | null>;
|
|
37
|
-
/**
|
|
38
|
-
* Get all installed kits, optionally filtered by harness.
|
|
39
|
-
*
|
|
40
|
-
* @param scope - Installation scope (global or project)
|
|
41
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
42
|
-
* @param harness - Optional harness name to filter by
|
|
43
|
-
* @returns Array of installed kit info with harness context
|
|
44
|
-
*/
|
|
45
|
-
export declare function getInstalledKits(scope?: InstallationScope, projectRoot?: string, harness?: HarnessName): Promise<Array<{
|
|
46
|
-
harness: HarnessName;
|
|
47
|
-
kitName: string;
|
|
48
|
-
kit: InstalledKit;
|
|
49
|
-
}>>;
|
|
50
|
-
/**
|
|
51
|
-
* Check if a kit is installed in any harness.
|
|
52
|
-
*
|
|
53
|
-
* @param kitName - The kit name to check
|
|
54
|
-
* @param scope - Installation scope (global or project)
|
|
55
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
56
|
-
* @returns True if the kit is installed somewhere
|
|
57
|
-
*/
|
|
58
|
-
export declare function isKitInstalled(kitName: string, scope?: InstallationScope, projectRoot?: string): Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* Check if a kit is installed in a specific harness.
|
|
61
|
-
*
|
|
62
|
-
* @param harness - The harness name
|
|
63
|
-
* @param kitName - The kit name to check
|
|
64
|
-
* @param scope - Installation scope (global or project)
|
|
65
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
66
|
-
* @returns True if the kit is installed in the harness
|
|
67
|
-
*/
|
|
68
|
-
export declare function isKitInstalledInHarness(harness: HarnessName, kitName: string, scope?: InstallationScope, projectRoot?: string): Promise<boolean>;
|
|
69
|
-
/**
|
|
70
|
-
* Get a specific installed kit.
|
|
71
|
-
*
|
|
72
|
-
* @param harness - The harness name
|
|
73
|
-
* @param kitName - The kit name
|
|
74
|
-
* @param scope - Installation scope (global or project)
|
|
75
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
76
|
-
* @returns The installed kit or null if not found
|
|
77
|
-
*/
|
|
78
|
-
export declare function getInstalledKit(harness: HarnessName, kitName: string, scope?: InstallationScope, projectRoot?: string): Promise<InstalledKit | null>;
|
|
2
|
+
* Kits manifest (intent) module.
|
|
3
|
+
*/
|
|
4
|
+
export type { KitsManifest, KitsManifestSource, ManifestCompatibility } from "./types.js";
|
|
5
|
+
export { MANIFEST_SCHEMA_VERSION, GLOBAL_MANIFEST_PATH, PROJECT_MANIFEST_DIR, PROJECT_MANIFEST_FILENAME, createEmptyManifest, } from "./types.js";
|
|
6
|
+
export { ManifestReadError, readManifest, readManifestFile } from "./read.js";
|
|
7
|
+
export { ManifestWriteError, writeManifest, getManifestPathForScope, getManifestDirForScope } from "./write.js";
|
|
8
|
+
export { expandPath, getManifestPath, getManifestDir, ensureManifestDir } from "./utils.js";
|
|
9
|
+
export { canonicalizeManifest, hashManifest } from "./hash.js";
|
|
79
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/manifest/index.js
CHANGED
|
@@ -1,200 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* This module handles reading, writing, and managing the installation manifest
|
|
5
|
-
* that tracks installed kits and primitives across harnesses.
|
|
2
|
+
* Kits manifest (intent) module.
|
|
6
3
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
// Re-export write functions
|
|
13
|
-
export { writeManifest, ManifestWriteError } from "./write.js";
|
|
14
|
-
// Re-export scope-aware path functions (renamed for clarity)
|
|
15
|
-
export { getManifestPathForScope, getManifestDirForScope } from "./write.js";
|
|
16
|
-
// Re-export upgrade check functions
|
|
17
|
-
export { checkForUpgrades, checkForUpgradesInScope, createUpgradeSummary, } from "./upgrade-check.js";
|
|
18
|
-
// Re-export utils
|
|
19
|
-
export { expandPath, getManifestPath, getManifestDir, ensureManifestDir, } from "./utils.js";
|
|
20
|
-
/**
|
|
21
|
-
* Record a kit installation in the manifest.
|
|
22
|
-
*
|
|
23
|
-
* @param harness - The harness name
|
|
24
|
-
* @param kit - The kit definition
|
|
25
|
-
* @param primitives - The resolved primitives that were installed
|
|
26
|
-
* @param source - The source repository
|
|
27
|
-
* @param scope - Installation scope (global or project)
|
|
28
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
29
|
-
*/
|
|
30
|
-
export async function recordInstallation(harness, kit, primitives, source, scope = "global", projectRoot) {
|
|
31
|
-
const manifest = await getOrCreateManifest(scope, projectRoot);
|
|
32
|
-
// Ensure harness entry exists
|
|
33
|
-
if (!manifest.harnesses[harness]) {
|
|
34
|
-
manifest.harnesses[harness] = { kits: {} };
|
|
35
|
-
}
|
|
36
|
-
// Convert resolved primitives to installed primitives
|
|
37
|
-
const installedPrimitives = primitives.map((p) => {
|
|
38
|
-
const installed = {
|
|
39
|
-
name: p.name,
|
|
40
|
-
type: p.type,
|
|
41
|
-
namespacedName: `${kit.name}.${p.name}`,
|
|
42
|
-
isInline: p.isInline,
|
|
43
|
-
installedPath: p.sourcePath,
|
|
44
|
-
};
|
|
45
|
-
// Only add optional fields if they have values
|
|
46
|
-
if (p.resolvedVersion) {
|
|
47
|
-
installed.version = p.resolvedVersion;
|
|
48
|
-
}
|
|
49
|
-
const versionSpec = p.ref ? extractVersionSpec(p.ref) : undefined;
|
|
50
|
-
if (versionSpec) {
|
|
51
|
-
installed.versionSpec = versionSpec;
|
|
52
|
-
}
|
|
53
|
-
return installed;
|
|
54
|
-
});
|
|
55
|
-
// Record the kit installation
|
|
56
|
-
const harnessEntry = manifest.harnesses[harness];
|
|
57
|
-
if (harnessEntry) {
|
|
58
|
-
harnessEntry.kits[kit.name] = {
|
|
59
|
-
version: kit.version,
|
|
60
|
-
installedAt: new Date().toISOString(),
|
|
61
|
-
source,
|
|
62
|
-
primitives: installedPrimitives,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// Update source
|
|
66
|
-
manifest.source = source;
|
|
67
|
-
await writeManifest(manifest, scope, projectRoot);
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Remove a kit installation from the manifest.
|
|
71
|
-
*
|
|
72
|
-
* @param harness - The harness name
|
|
73
|
-
* @param kitName - The kit name to remove
|
|
74
|
-
* @param scope - Installation scope (global or project)
|
|
75
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
76
|
-
* @returns The removed kit info or null if not found
|
|
77
|
-
*/
|
|
78
|
-
export async function removeInstallation(harness, kitName, scope = "global", projectRoot) {
|
|
79
|
-
const manifest = await readManifest(scope, projectRoot);
|
|
80
|
-
if (!manifest) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const harnessEntry = manifest.harnesses[harness];
|
|
84
|
-
if (!harnessEntry) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
const kit = harnessEntry.kits[kitName];
|
|
88
|
-
if (!kit) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
// Remove the kit
|
|
92
|
-
delete harnessEntry.kits[kitName];
|
|
93
|
-
// Clean up empty harness entries
|
|
94
|
-
if (Object.keys(harnessEntry.kits).length === 0) {
|
|
95
|
-
delete manifest.harnesses[harness];
|
|
96
|
-
}
|
|
97
|
-
await writeManifest(manifest, scope, projectRoot);
|
|
98
|
-
return kit;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get all installed kits, optionally filtered by harness.
|
|
102
|
-
*
|
|
103
|
-
* @param scope - Installation scope (global or project)
|
|
104
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
105
|
-
* @param harness - Optional harness name to filter by
|
|
106
|
-
* @returns Array of installed kit info with harness context
|
|
107
|
-
*/
|
|
108
|
-
export async function getInstalledKits(scope = "global", projectRoot, harness) {
|
|
109
|
-
const manifest = await readManifest(scope, projectRoot);
|
|
110
|
-
if (!manifest) {
|
|
111
|
-
return [];
|
|
112
|
-
}
|
|
113
|
-
const result = [];
|
|
114
|
-
for (const [harnessName, harnessEntry] of Object.entries(manifest.harnesses)) {
|
|
115
|
-
if (harness && harnessName !== harness) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
if (harnessEntry) {
|
|
119
|
-
for (const [kitName, kit] of Object.entries(harnessEntry.kits)) {
|
|
120
|
-
result.push({
|
|
121
|
-
harness: harnessName,
|
|
122
|
-
kitName,
|
|
123
|
-
kit,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return result;
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Check if a kit is installed in any harness.
|
|
132
|
-
*
|
|
133
|
-
* @param kitName - The kit name to check
|
|
134
|
-
* @param scope - Installation scope (global or project)
|
|
135
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
136
|
-
* @returns True if the kit is installed somewhere
|
|
137
|
-
*/
|
|
138
|
-
export async function isKitInstalled(kitName, scope = "global", projectRoot) {
|
|
139
|
-
const manifest = await readManifest(scope, projectRoot);
|
|
140
|
-
if (!manifest) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
for (const harness of Object.values(manifest.harnesses)) {
|
|
144
|
-
if (harness && kitName in harness.kits) {
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Check if a kit is installed in a specific harness.
|
|
152
|
-
*
|
|
153
|
-
* @param harness - The harness name
|
|
154
|
-
* @param kitName - The kit name to check
|
|
155
|
-
* @param scope - Installation scope (global or project)
|
|
156
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
157
|
-
* @returns True if the kit is installed in the harness
|
|
158
|
-
*/
|
|
159
|
-
export async function isKitInstalledInHarness(harness, kitName, scope = "global", projectRoot) {
|
|
160
|
-
const manifest = await readManifest(scope, projectRoot);
|
|
161
|
-
if (!manifest) {
|
|
162
|
-
return false;
|
|
163
|
-
}
|
|
164
|
-
const harnessEntry = manifest.harnesses[harness];
|
|
165
|
-
return harnessEntry ? kitName in harnessEntry.kits : false;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Get a specific installed kit.
|
|
169
|
-
*
|
|
170
|
-
* @param harness - The harness name
|
|
171
|
-
* @param kitName - The kit name
|
|
172
|
-
* @param scope - Installation scope (global or project)
|
|
173
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
174
|
-
* @returns The installed kit or null if not found
|
|
175
|
-
*/
|
|
176
|
-
export async function getInstalledKit(harness, kitName, scope = "global", projectRoot) {
|
|
177
|
-
const manifest = await readManifest(scope, projectRoot);
|
|
178
|
-
if (!manifest) {
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
const harnessEntry = manifest.harnesses[harness];
|
|
182
|
-
if (!harnessEntry) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
return harnessEntry.kits[kitName] ?? null;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Extract version spec from a ref string.
|
|
189
|
-
*
|
|
190
|
-
* @param ref - The ref string (e.g., "tf-plan@^1.0.0")
|
|
191
|
-
* @returns The version spec portion or undefined
|
|
192
|
-
*/
|
|
193
|
-
function extractVersionSpec(ref) {
|
|
194
|
-
const atIndex = ref.indexOf("@");
|
|
195
|
-
if (atIndex === -1) {
|
|
196
|
-
return undefined;
|
|
197
|
-
}
|
|
198
|
-
return ref.slice(atIndex + 1);
|
|
199
|
-
}
|
|
4
|
+
export { MANIFEST_SCHEMA_VERSION, GLOBAL_MANIFEST_PATH, PROJECT_MANIFEST_DIR, PROJECT_MANIFEST_FILENAME, createEmptyManifest, } from "./types.js";
|
|
5
|
+
export { ManifestReadError, readManifest, readManifestFile } from "./read.js";
|
|
6
|
+
export { ManifestWriteError, writeManifest, getManifestPathForScope, getManifestDirForScope } from "./write.js";
|
|
7
|
+
export { expandPath, getManifestPath, getManifestDir, ensureManifestDir } from "./utils.js";
|
|
8
|
+
export { canonicalizeManifest, hashManifest } from "./hash.js";
|
|
200
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAChH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5F,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/manifest/read.d.ts
CHANGED
|
@@ -1,32 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides functionality to read and validate the installation manifest.
|
|
2
|
+
* Kits manifest (intent) read operations.
|
|
5
3
|
*/
|
|
6
4
|
import type { InstallationScope } from "../core/types.js";
|
|
7
|
-
import type {
|
|
8
|
-
/**
|
|
9
|
-
* Error thrown when manifest read fails.
|
|
10
|
-
*/
|
|
5
|
+
import type { KitsManifest } from "./types.js";
|
|
11
6
|
export declare class ManifestReadError extends Error {
|
|
12
7
|
readonly errorCause?: unknown;
|
|
13
8
|
constructor(message: string, cause?: unknown);
|
|
14
9
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
* @param scope - Installation scope (global or project)
|
|
19
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
20
|
-
* @returns The manifest or null if it doesn't exist
|
|
21
|
-
* @throws ManifestReadError if the file exists but cannot be read or parsed
|
|
22
|
-
*/
|
|
23
|
-
export declare function readManifest(scope?: InstallationScope, projectRoot?: string): Promise<InstallationManifest | null>;
|
|
24
|
-
/**
|
|
25
|
-
* Get or create the installation manifest.
|
|
26
|
-
*
|
|
27
|
-
* @param scope - Installation scope (global or project)
|
|
28
|
-
* @param projectRoot - Absolute path to project root (required for project scope)
|
|
29
|
-
* @returns The existing manifest or a new empty manifest
|
|
30
|
-
*/
|
|
31
|
-
export declare function getOrCreateManifest(scope?: InstallationScope, projectRoot?: string): Promise<InstallationManifest>;
|
|
10
|
+
export declare function readManifestFile(manifestPath: string): Promise<KitsManifest>;
|
|
11
|
+
export declare function readManifest(scope?: InstallationScope, projectRoot?: string): Promise<KitsManifest | null>;
|
|
32
12
|
//# sourceMappingURL=read.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/manifest/read.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/manifest/read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;gBAElB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAK7C;AAED,wBAAsB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CA0BlF;AAED,wBAAsB,YAAY,CAChC,KAAK,GAAE,iBAA4B,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAc9B"}
|