@g3nomaly/core 0.3.1 → 0.3.3
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 +122 -0
- package/dist/cli/commands/add.d.ts +24 -4
- package/dist/cli/commands/add.d.ts.map +1 -1
- package/dist/cli/commands/add.js +37 -14
- package/dist/cli/commands/add.js.map +1 -1
- package/dist/cli/commands/conflict.d.ts +52 -0
- package/dist/cli/commands/conflict.d.ts.map +1 -0
- package/dist/cli/commands/conflict.js +88 -0
- package/dist/cli/commands/conflict.js.map +1 -0
- package/dist/cli/commands/installFromSources.d.ts +42 -13
- package/dist/cli/commands/installFromSources.d.ts.map +1 -1
- package/dist/cli/commands/installFromSources.js +68 -19
- package/dist/cli/commands/installFromSources.js.map +1 -1
- package/dist/cli/commands/ls.d.ts +13 -3
- package/dist/cli/commands/ls.d.ts.map +1 -1
- package/dist/cli/commands/ls.js +26 -6
- package/dist/cli/commands/ls.js.map +1 -1
- package/dist/cli/commands/remove.d.ts +7 -1
- package/dist/cli/commands/remove.d.ts.map +1 -1
- package/dist/cli/commands/remove.js +15 -1
- package/dist/cli/commands/remove.js.map +1 -1
- package/dist/cli/commands/sources.d.ts +34 -10
- package/dist/cli/commands/sources.d.ts.map +1 -1
- package/dist/cli/commands/sources.js +17 -3
- package/dist/cli/commands/sources.js.map +1 -1
- package/dist/cli/commands/update.d.ts +11 -4
- package/dist/cli/commands/update.d.ts.map +1 -1
- package/dist/cli/commands/update.js +32 -14
- package/dist/cli/commands/update.js.map +1 -1
- package/dist/cli/dialogue.d.ts +65 -13
- package/dist/cli/dialogue.d.ts.map +1 -1
- package/dist/cli/dialogue.js +46 -7
- package/dist/cli/dialogue.js.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/installDialogues.d.ts +11 -3
- package/dist/cli/installDialogues.d.ts.map +1 -1
- package/dist/cli/installDialogues.js +22 -5
- package/dist/cli/installDialogues.js.map +1 -1
- package/dist/cli/pick.d.ts +11 -2
- package/dist/cli/pick.d.ts.map +1 -1
- package/dist/cli/pick.js +11 -2
- package/dist/cli/pick.js.map +1 -1
- package/dist/cli/report.d.ts +32 -8
- package/dist/cli/report.d.ts.map +1 -1
- package/dist/cli/report.js +26 -5
- package/dist/cli/report.js.map +1 -1
- package/dist/cli/theme.d.ts +4 -0
- package/dist/cli/theme.d.ts.map +1 -1
- package/dist/cli/theme.js +4 -0
- package/dist/cli/theme.js.map +1 -1
- package/dist/cli/types.d.ts +56 -5
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/config/config.d.ts +32 -7
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +37 -7
- package/dist/config/config.js.map +1 -1
- package/dist/config/types.d.ts +58 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/config/types.js +0 -10
- package/dist/config/types.js.map +1 -1
- package/dist/hash/hash.d.ts +6 -8
- package/dist/hash/hash.d.ts.map +1 -1
- package/dist/hash/hash.js +7 -8
- package/dist/hash/hash.js.map +1 -1
- package/dist/hash/index.d.ts.map +1 -1
- package/dist/hash/index.js +1 -0
- package/dist/hash/index.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/installer/classify.d.ts +27 -1
- package/dist/installer/classify.d.ts.map +1 -1
- package/dist/installer/classify.js +36 -1
- package/dist/installer/classify.js.map +1 -1
- package/dist/installer/files.d.ts +10 -6
- package/dist/installer/files.d.ts.map +1 -1
- package/dist/installer/files.js +4 -3
- package/dist/installer/files.js.map +1 -1
- package/dist/installer/index.d.ts +1 -1
- package/dist/installer/index.d.ts.map +1 -1
- package/dist/installer/index.js +1 -1
- package/dist/installer/index.js.map +1 -1
- package/dist/installer/install.d.ts +18 -6
- package/dist/installer/install.d.ts.map +1 -1
- package/dist/installer/install.js +20 -7
- package/dist/installer/install.js.map +1 -1
- package/dist/installer/io.d.ts +6 -1
- package/dist/installer/io.d.ts.map +1 -1
- package/dist/installer/io.js +6 -1
- package/dist/installer/io.js.map +1 -1
- package/dist/installer/manifest.d.ts +29 -19
- package/dist/installer/manifest.d.ts.map +1 -1
- package/dist/installer/manifest.js +20 -10
- package/dist/installer/manifest.js.map +1 -1
- package/dist/installer/manifestSources.d.ts +18 -7
- package/dist/installer/manifestSources.d.ts.map +1 -1
- package/dist/installer/manifestSources.js +18 -7
- package/dist/installer/manifestSources.js.map +1 -1
- package/dist/installer/marketplace.d.ts +24 -12
- package/dist/installer/marketplace.d.ts.map +1 -1
- package/dist/installer/marketplace.js +18 -10
- package/dist/installer/marketplace.js.map +1 -1
- package/dist/installer/origin.d.ts +23 -7
- package/dist/installer/origin.d.ts.map +1 -1
- package/dist/installer/origin.js +14 -7
- package/dist/installer/origin.js.map +1 -1
- package/dist/installer/remove.d.ts +17 -5
- package/dist/installer/remove.d.ts.map +1 -1
- package/dist/installer/remove.js +17 -5
- package/dist/installer/remove.js.map +1 -1
- package/dist/installer/resolve.d.ts +80 -31
- package/dist/installer/resolve.d.ts.map +1 -1
- package/dist/installer/resolve.js +96 -29
- package/dist/installer/resolve.js.map +1 -1
- package/dist/installer/sourceRegistry.d.ts +59 -22
- package/dist/installer/sourceRegistry.d.ts.map +1 -1
- package/dist/installer/sourceRegistry.js +25 -10
- package/dist/installer/sourceRegistry.js.map +1 -1
- package/dist/installer/types.d.ts +72 -19
- package/dist/installer/types.d.ts.map +1 -1
- package/dist/installer/types.js +18 -8
- package/dist/installer/types.js.map +1 -1
- package/dist/registry/index.d.ts +0 -4
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -4
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/registry.handlers.d.ts +7 -0
- package/dist/registry/registry.handlers.d.ts.map +1 -1
- package/dist/registry/registry.handlers.js.map +1 -1
- package/dist/registry/registry.io.d.ts +23 -7
- package/dist/registry/registry.io.d.ts.map +1 -1
- package/dist/registry/registry.io.js +37 -14
- package/dist/registry/registry.io.js.map +1 -1
- package/dist/registry/registry.mutations.d.ts +10 -3
- package/dist/registry/registry.mutations.d.ts.map +1 -1
- package/dist/registry/registry.mutations.js +10 -3
- package/dist/registry/registry.mutations.js.map +1 -1
- package/dist/registry/registry.selectors.d.ts +41 -11
- package/dist/registry/registry.selectors.d.ts.map +1 -1
- package/dist/registry/registry.selectors.js +41 -11
- package/dist/registry/registry.selectors.js.map +1 -1
- package/dist/registry/registry.store.d.ts +22 -9
- package/dist/registry/registry.store.d.ts.map +1 -1
- package/dist/registry/registry.store.js +12 -3
- package/dist/registry/registry.store.js.map +1 -1
- package/dist/registry/registry.template.d.ts +12 -6
- package/dist/registry/registry.template.d.ts.map +1 -1
- package/dist/registry/registry.template.js +13 -6
- package/dist/registry/registry.template.js.map +1 -1
- package/dist/registry/types.d.ts +17 -3
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/types.js +16 -6
- package/dist/registry/types.js.map +1 -1
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +1 -0
- package/dist/security/index.js.map +1 -1
- package/dist/security/securityParser.d.ts +9 -8
- package/dist/security/securityParser.d.ts.map +1 -1
- package/dist/security/securityParser.js +12 -22
- package/dist/security/securityParser.js.map +1 -1
- package/dist/security/securityWorker.d.ts +11 -0
- package/dist/security/securityWorker.d.ts.map +1 -1
- package/dist/security/securityWorker.js +17 -38
- package/dist/security/securityWorker.js.map +1 -1
- package/dist/sources/checkout.d.ts +10 -4
- package/dist/sources/checkout.d.ts.map +1 -1
- package/dist/sources/checkout.js +10 -4
- package/dist/sources/checkout.js.map +1 -1
- package/dist/sources/git.d.ts +5 -3
- package/dist/sources/git.d.ts.map +1 -1
- package/dist/sources/git.js +5 -3
- package/dist/sources/git.js.map +1 -1
- package/dist/sources/local.d.ts +6 -4
- package/dist/sources/local.d.ts.map +1 -1
- package/dist/sources/local.js +6 -4
- package/dist/sources/local.js.map +1 -1
- package/dist/sources/npm.d.ts +10 -7
- package/dist/sources/npm.d.ts.map +1 -1
- package/dist/sources/npm.js +49 -15
- package/dist/sources/npm.js.map +1 -1
- package/dist/sources/parse.d.ts +24 -16
- package/dist/sources/parse.d.ts.map +1 -1
- package/dist/sources/parse.js +40 -18
- package/dist/sources/parse.js.map +1 -1
- package/dist/sources/process.d.ts +10 -7
- package/dist/sources/process.d.ts.map +1 -1
- package/dist/sources/process.js +10 -7
- package/dist/sources/process.js.map +1 -1
- package/dist/sources/register.d.ts +20 -5
- package/dist/sources/register.d.ts.map +1 -1
- package/dist/sources/register.js +20 -5
- package/dist/sources/register.js.map +1 -1
- package/dist/sources/types.d.ts +43 -8
- package/dist/sources/types.d.ts.map +1 -1
- package/dist/sources/types.js +21 -4
- package/dist/sources/types.js.map +1 -1
- package/dist/utils/errors.d.ts +6 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +6 -1
- package/dist/utils/errors.js.map +1 -1
- package/dist/utils/merge.d.ts +8 -2
- package/dist/utils/merge.d.ts.map +1 -1
- package/dist/utils/merge.js +9 -2
- package/dist/utils/merge.js.map +1 -1
- package/dist/utils/packageMeta.d.ts +16 -2
- package/dist/utils/packageMeta.d.ts.map +1 -1
- package/dist/utils/packageMeta.js +6 -2
- package/dist/utils/packageMeta.js.map +1 -1
- package/dist/utils/paths.d.ts +16 -5
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +16 -5
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/prompt.d.ts +6 -1
- package/dist/utils/prompt.d.ts.map +1 -1
- package/dist/utils/prompt.js +6 -1
- package/dist/utils/prompt.js.map +1 -1
- package/dist/utils/version.d.ts +7 -2
- package/dist/utils/version.d.ts.map +1 -1
- package/dist/utils/version.js +40 -3
- package/dist/utils/version.js.map +1 -1
- package/package.json +1 -1
package/dist/hash/hash.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hashes a file's contents using SHA-256.
|
|
2
|
+
* @brief Hashes a file's contents using SHA-256.
|
|
3
|
+
*
|
|
3
4
|
* Uses Bun's native file API + Web Crypto — no external dependencies.
|
|
4
5
|
*
|
|
5
6
|
* @param filePath - Absolute or relative path to the file
|
|
@@ -7,19 +8,16 @@
|
|
|
7
8
|
*/
|
|
8
9
|
export declare function hashFile(filePath: string): Promise<string>;
|
|
9
10
|
/**
|
|
10
|
-
* Hashes an arbitrary string using SHA-256.
|
|
11
|
+
* @brief Hashes an arbitrary string using SHA-256.
|
|
12
|
+
*
|
|
11
13
|
* Useful for hashing in-memory content before writing to disk.
|
|
12
14
|
*
|
|
13
15
|
* @param content - String to hash
|
|
14
16
|
* @returns Lowercase hex SHA-256 digest
|
|
15
17
|
*/
|
|
16
18
|
export declare function hashString(content: string): Promise<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Short (first 12 chars) SHA-256 hash of a file — for display purposes.
|
|
19
|
-
*/
|
|
19
|
+
/** Short (first 12 chars) SHA-256 hash of a file — for display purposes. */
|
|
20
20
|
export declare function hashFileShort(filePath: string): Promise<string>;
|
|
21
|
-
/**
|
|
22
|
-
* Short (first 12 chars) SHA-256 hash of a string — for display purposes.
|
|
23
|
-
*/
|
|
21
|
+
/** Short (first 12 chars) SHA-256 hash of a string — for display purposes. */
|
|
24
22
|
export declare function hashStringShort(content: string): Promise<string>;
|
|
25
23
|
//# sourceMappingURL=hash.d.ts.map
|
package/dist/hash/hash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMjE;AAED,4EAA4E;AAC5E,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAErE;AAED,8EAA8E;AAC9E,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtE"}
|
package/dist/hash/hash.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
// packages/core/src/hash/hash.ts
|
|
1
2
|
if ("window" in globalThis) {
|
|
2
3
|
throw new Error("@g3nomaly/core hash utilities are CLI-only");
|
|
3
4
|
}
|
|
4
5
|
/**
|
|
5
|
-
* Hashes a file's contents using SHA-256.
|
|
6
|
+
* @brief Hashes a file's contents using SHA-256.
|
|
7
|
+
*
|
|
6
8
|
* Uses Bun's native file API + Web Crypto — no external dependencies.
|
|
7
9
|
*
|
|
8
10
|
* @param filePath - Absolute or relative path to the file
|
|
@@ -16,7 +18,8 @@ export async function hashFile(filePath) {
|
|
|
16
18
|
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
|
-
* Hashes an arbitrary string using SHA-256.
|
|
21
|
+
* @brief Hashes an arbitrary string using SHA-256.
|
|
22
|
+
*
|
|
20
23
|
* Useful for hashing in-memory content before writing to disk.
|
|
21
24
|
*
|
|
22
25
|
* @param content - String to hash
|
|
@@ -29,15 +32,11 @@ export async function hashString(content) {
|
|
|
29
32
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
30
33
|
return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
31
34
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Short (first 12 chars) SHA-256 hash of a file — for display purposes.
|
|
34
|
-
*/
|
|
35
|
+
/** Short (first 12 chars) SHA-256 hash of a file — for display purposes. */
|
|
35
36
|
export async function hashFileShort(filePath) {
|
|
36
37
|
return (await hashFile(filePath)).substring(0, 12);
|
|
37
38
|
}
|
|
38
|
-
/**
|
|
39
|
-
* Short (first 12 chars) SHA-256 hash of a string — for display purposes.
|
|
40
|
-
*/
|
|
39
|
+
/** Short (first 12 chars) SHA-256 hash of a string — for display purposes. */
|
|
41
40
|
export async function hashStringShort(content) {
|
|
42
41
|
return (await hashString(content)).substring(0, 12);
|
|
43
42
|
}
|
package/dist/hash/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"AAAA,IAAI,QAAQ,IAAI,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAChE,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,IAAI,QAAQ,IAAI,UAAU,EAAE,CAAC;IAC3B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC7C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAe;IAC9C,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,QAAgB;IAClD,OAAO,CAAC,MAAM,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACrD,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,OAAe;IACnD,OAAO,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtD,CAAC"}
|
package/dist/hash/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hash/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hash/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/hash/index.js
CHANGED
package/dist/hash/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hash/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hash/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,6BAA6B"}
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
import type { BaseFileEntry, BaseRegistryEntry } from "../registry/types";
|
|
2
2
|
import type { FileClassification, InstallerIO } from "./types";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @brief Maps each file path of a manifest entry to the hash it was installed with.
|
|
5
|
+
*
|
|
6
|
+
* @param entry - Manifest entry to read. `undefined` when the package was never installed.
|
|
7
|
+
* @returns `path → hash` map, e.g. `{ "SKILL.md": "a1b2" }`. Empty when no file has a hash.
|
|
8
|
+
*/
|
|
4
9
|
export declare function recordedHashes(entry: Pick<BaseRegistryEntry, "files"> | undefined): Record<string, string>;
|
|
10
|
+
/**
|
|
11
|
+
* @brief Classifies one file against its copy on disk and the install-time record.
|
|
12
|
+
*
|
|
13
|
+
* @param file - Registry entry of the file. Its `hash` is the package's current hash, or `undefined` to resolve it.
|
|
14
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
15
|
+
* @param recordedHash - Hash recorded in the user manifest at install time. `undefined` when never installed.
|
|
16
|
+
* @param io - Filesystem boundary used to test for the file and hash it.
|
|
17
|
+
* @param resolveLatestHash - Looks up the package hash when `file.hash` is not set.
|
|
18
|
+
* @returns Classification that `applyClassifications` consumes.
|
|
19
|
+
* @throws {Error} When `file` has no hash and no `resolveLatestHash` is given.
|
|
20
|
+
*/
|
|
5
21
|
export declare function classifyFile<F extends BaseFileEntry>(file: F, installDir: string, recordedHash: string | undefined, io: InstallerIO, resolveLatestHash?: (file: F) => Promise<string>): Promise<FileClassification<F>>;
|
|
22
|
+
/**
|
|
23
|
+
* @brief Classifies every file in a registry entry, in the order given.
|
|
24
|
+
*
|
|
25
|
+
* @param files - Registry entries to classify.
|
|
26
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
27
|
+
* @param recorded - Install-time hashes by file path, e.g. `{ "SKILL.md": "a1b2" }`. Missing paths were never installed.
|
|
28
|
+
* @param io - Filesystem boundary used to test for each file and hash it.
|
|
29
|
+
* @param resolveLatestHash - Looks up the package hash for files whose `hash` is not set.
|
|
30
|
+
* @returns One classification per file, in the same order.
|
|
31
|
+
*/
|
|
6
32
|
export declare function classifyFiles<F extends BaseFileEntry>(files: readonly F[], installDir: string, recorded: Record<string, string | undefined>, io: InstallerIO, resolveLatestHash?: (file: F) => Promise<string>): Promise<FileClassification<F>[]>;
|
|
7
33
|
//# sourceMappingURL=classify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/installer/classify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE9D
|
|
1
|
+
{"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/installer/classify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE9D;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM1G;AA6BD;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAAC,CAAC,SAAS,aAAa,EACxD,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,EAAE,EAAE,WAAW,EACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAUhC;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,CAAC,SAAS,aAAa,EACzD,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EAC5C,EAAE,EAAE,WAAW,EACf,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,GAC/C,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAMlC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// packages/core/src/installer/classify.ts
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { FileState } from "./types";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @brief Maps each file path of a manifest entry to the hash it was installed with.
|
|
6
|
+
*
|
|
7
|
+
* @param entry - Manifest entry to read. `undefined` when the package was never installed.
|
|
8
|
+
* @returns `path → hash` map, e.g. `{ "SKILL.md": "a1b2" }`. Empty when no file has a hash.
|
|
9
|
+
*/
|
|
5
10
|
export function recordedHashes(entry) {
|
|
6
11
|
const map = {};
|
|
7
12
|
for (const file of entry?.files ?? []) {
|
|
@@ -10,6 +15,15 @@ export function recordedHashes(entry) {
|
|
|
10
15
|
}
|
|
11
16
|
return map;
|
|
12
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @brief Decides a file's state from what is on disk, what was recorded and what the package ships now.
|
|
20
|
+
*
|
|
21
|
+
* @param exists - Whether the file is on disk.
|
|
22
|
+
* @param currentHash - Hash of the file on disk. `null` when it does not exist.
|
|
23
|
+
* @param recordedHash - Hash recorded at install time. `undefined` when the file was never installed.
|
|
24
|
+
* @param latestHash - Hash of the package's current version of the file.
|
|
25
|
+
* @returns State that decides whether the file is written, kept or flagged as a conflict.
|
|
26
|
+
*/
|
|
13
27
|
function resolveState(exists, currentHash, recordedHash, latestHash) {
|
|
14
28
|
if (!exists)
|
|
15
29
|
return FileState.SafeUpdate;
|
|
@@ -26,6 +40,17 @@ function resolveState(exists, currentHash, recordedHash, latestHash) {
|
|
|
26
40
|
return FileState.UserOnly;
|
|
27
41
|
return FileState.Conflict;
|
|
28
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* @brief Classifies one file against its copy on disk and the install-time record.
|
|
45
|
+
*
|
|
46
|
+
* @param file - Registry entry of the file. Its `hash` is the package's current hash, or `undefined` to resolve it.
|
|
47
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
48
|
+
* @param recordedHash - Hash recorded in the user manifest at install time. `undefined` when never installed.
|
|
49
|
+
* @param io - Filesystem boundary used to test for the file and hash it.
|
|
50
|
+
* @param resolveLatestHash - Looks up the package hash when `file.hash` is not set.
|
|
51
|
+
* @returns Classification that `applyClassifications` consumes.
|
|
52
|
+
* @throws {Error} When `file` has no hash and no `resolveLatestHash` is given.
|
|
53
|
+
*/
|
|
29
54
|
export async function classifyFile(file, installDir, recordedHash, io, resolveLatestHash) {
|
|
30
55
|
const destPath = path.join(installDir, file.path);
|
|
31
56
|
const latestHash = file.hash ?? (await resolveLatestHash?.(file));
|
|
@@ -37,6 +62,16 @@ export async function classifyFile(file, installDir, recordedHash, io, resolveLa
|
|
|
37
62
|
const state = resolveState(exists, currentHash, recordedHash, latestHash);
|
|
38
63
|
return { file, destPath, state, exists, currentHash, recordedHash, latestHash };
|
|
39
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* @brief Classifies every file in a registry entry, in the order given.
|
|
67
|
+
*
|
|
68
|
+
* @param files - Registry entries to classify.
|
|
69
|
+
* @param installDir - Absolute folder the package is installed into.
|
|
70
|
+
* @param recorded - Install-time hashes by file path, e.g. `{ "SKILL.md": "a1b2" }`. Missing paths were never installed.
|
|
71
|
+
* @param io - Filesystem boundary used to test for each file and hash it.
|
|
72
|
+
* @param resolveLatestHash - Looks up the package hash for files whose `hash` is not set.
|
|
73
|
+
* @returns One classification per file, in the same order.
|
|
74
|
+
*/
|
|
40
75
|
export async function classifyFiles(files, installDir, recorded, io, resolveLatestHash) {
|
|
41
76
|
const classifications = [];
|
|
42
77
|
for (const file of files) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/installer/classify.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGnC
|
|
1
|
+
{"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/installer/classify.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGnC;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,KAAmD;IAChF,MAAM,GAAG,GAA2B,EAAE,CAAA;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,KAAK,IAAI,EAAE,EA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C,IAAI,qCAAqC,CAAC,CAAA;IACjF,CAAC;IACD,MAAM,MAAM,GAAQ,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IACvC,MAAM,WAAW,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC/D,MAAM,KAAK,GAAS,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;IAC/E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,CAAA;AACjF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAmB,EACnB,UAAkB,EAClB,QAA4C,EAC5C,EAAe,EACf,iBAAgD;IAEhD,MAAM,eAAe,GAA4B,EAAE,CAAA;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,eAAe,CAAC,IAAI,CAAC,MAAM,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAA;IACxG,CAAC;IACD,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* @brief What `listFiles` leaves out. `node_modules` and `.git` are always skipped.
|
|
3
|
+
*
|
|
4
|
+
* @property skipDirs - Folder names, or folder paths relative to the listed root, e.g. `tests` or `.claude-plugin/types`.
|
|
5
|
+
* @property skipFiles - Tested against each file name, e.g. `/\.test\.tsx?$/`.
|
|
6
|
+
*/
|
|
2
7
|
export interface FileFilter {
|
|
3
|
-
/** Folder names, or folder paths relative to the listed root, e.g. `tests` or `.claude-plugin/types` */
|
|
4
8
|
skipDirs?: readonly string[];
|
|
5
|
-
/** Tested against each file name, e.g. `/\.test\.tsx?$/` */
|
|
6
9
|
skipFiles?: RegExp;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
* folders and files `filter` names.
|
|
12
|
+
* @brief Lists every file below a folder, leaving out the folders and files `filter` names.
|
|
11
13
|
*
|
|
12
|
-
* @param dir - Absolute folder to list
|
|
14
|
+
* @param dir - Absolute folder to list.
|
|
15
|
+
* @param filter - Folders and files to skip.
|
|
16
|
+
* @returns Paths relative to `dir`, sorted.
|
|
13
17
|
*/
|
|
14
18
|
export declare function listFiles(dir: string, filter?: FileFilter): string[];
|
|
15
19
|
//# sourceMappingURL=files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/installer/files.ts"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/installer/files.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAG,SAAS,MAAM,EAAE,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAID;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,UAAe,GAAG,MAAM,EAAE,CAUxE"}
|
package/dist/installer/files.js
CHANGED
|
@@ -3,10 +3,11 @@ import fs from "node:fs";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
const ALWAYS_SKIPPED = ["node_modules", ".git"];
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* folders and files `filter` names.
|
|
6
|
+
* @brief Lists every file below a folder, leaving out the folders and files `filter` names.
|
|
8
7
|
*
|
|
9
|
-
* @param dir - Absolute folder to list
|
|
8
|
+
* @param dir - Absolute folder to list.
|
|
9
|
+
* @param filter - Folders and files to skip.
|
|
10
|
+
* @returns Paths relative to `dir`, sorted.
|
|
10
11
|
*/
|
|
11
12
|
export function listFiles(dir, filter = {}) {
|
|
12
13
|
const skipDirs = new Set([...ALWAYS_SKIPPED, ...(filter.skipDirs ?? [])]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/installer/files.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"files.js","sourceRoot":"","sources":["../../src/installer/files.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAa5B,MAAM,cAAc,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,MAAM,GAAe,EAAE;IAC5D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;IACzE,MAAM,IAAI,GAAG,CAAC,OAAe,EAAY,EAAE,CACzC,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAA;QACvC,MAAM,GAAG,GAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;QACrC,IAAI,CAAC,CAAC,WAAW,EAAE;YAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACvF,OAAO,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;IAC7D,CAAC,CAAC,CAAA;IACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;AACzB,CAAC"}
|
|
@@ -14,6 +14,6 @@ export type { InstallManifest } from "./manifest";
|
|
|
14
14
|
export { manifestSources, registerSource, unregisterSource } from "./manifestSources";
|
|
15
15
|
export { loadSourceRegistry, offers, offerRegistry, entrySource } from "./sourceRegistry";
|
|
16
16
|
export type { SourceRegistry, SourceEntries, SourceOffer, ReadSource, FailedSource } from "./sourceRegistry";
|
|
17
|
-
export { parseRequest, formatRequest, resolveDependencies, resolveRequests, resolveInstalled, resolveUpdates, installedOrigins } from "./resolve";
|
|
17
|
+
export { parseRequest, formatRequest, resolveDependencies, resolveRequests, resolveInstalled, resolveUpdates, installedOrigins, installedForks } from "./resolve";
|
|
18
18
|
export type { EntryRequest, Resolution, ResolvedDependencies } from "./resolve";
|
|
19
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,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EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAC/D,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC3F,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AACtD,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAC9G,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACzF,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC5G,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AACjK,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA"}
|
package/dist/installer/index.js
CHANGED
|
@@ -10,5 +10,5 @@ export { MANIFEST_DIRS, manifestFile, readMarketplace, resolveInside } from "./m
|
|
|
10
10
|
export { installManifestSchema, loadInstallManifest, installedEntries, saveInstallManifest } from "./manifest";
|
|
11
11
|
export { manifestSources, registerSource, unregisterSource } from "./manifestSources";
|
|
12
12
|
export { loadSourceRegistry, offers, offerRegistry, entrySource } from "./sourceRegistry";
|
|
13
|
-
export { parseRequest, formatRequest, resolveDependencies, resolveRequests, resolveInstalled, resolveUpdates, installedOrigins } from "./resolve";
|
|
13
|
+
export { parseRequest, formatRequest, resolveDependencies, resolveRequests, resolveInstalled, resolveUpdates, installedOrigins, installedForks } from "./resolve";
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE9G,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEzF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/installer/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxE,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE3F,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAE9G,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEzF,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA"}
|
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import type { BaseFileEntry } from "../registry/types";
|
|
2
2
|
import type { ApplyOptions, ApplyResult, FileClassification, FileSource, InstallerIO } from "./types";
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* @brief Builds a `FileSource` that copies each file from the package source tree.
|
|
5
|
+
*
|
|
6
|
+
* @param resolveSourcePath - Maps a file's relative path to its absolute path in the source tree.
|
|
7
|
+
* @returns Source that returns a `copy` content for every file.
|
|
8
|
+
*/
|
|
4
9
|
export declare function copySource<F extends BaseFileEntry>(resolveSourcePath: (relPath: string) => string): FileSource<F>;
|
|
5
10
|
/**
|
|
6
|
-
* Writes the files an install
|
|
7
|
-
*
|
|
8
|
-
* `
|
|
9
|
-
* `
|
|
10
|
-
*
|
|
11
|
+
* @brief Writes the files an install or update decision allows and reports the result per file.
|
|
12
|
+
*
|
|
13
|
+
* `SafeUpdate` files are always written. `UserOnly` and `Conflict` files are written only when
|
|
14
|
+
* `opts.decision` is `Overwrite` or `opts.force` is set. The result's `files` is what the caller
|
|
15
|
+
* registers in the user manifest. A kept file keeps the hash it was installed with, so its local
|
|
16
|
+
* change stays visible to every later run instead of becoming the new baseline.
|
|
17
|
+
*
|
|
18
|
+
* @param classifications - Per-file states from `classifyFiles`.
|
|
19
|
+
* @param source - Produces each file's content when it is written.
|
|
20
|
+
* @param opts - Conflict decision, `force` and `dryRun` flags.
|
|
21
|
+
* @param io - Filesystem boundary used to write and hash files.
|
|
22
|
+
* @returns Written, kept and missing-source paths, and the manifest entries to register.
|
|
11
23
|
*/
|
|
12
24
|
export declare function applyClassifications<F extends BaseFileEntry>(classifications: readonly FileClassification<F>[], source: FileSource<F>, opts: ApplyOptions, io: InstallerIO): Promise<ApplyResult<F>>;
|
|
13
25
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/installer/install.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErG
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/installer/install.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErG;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAEjH;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CAAC,CAAC,SAAS,aAAa,EAChE,eAAe,EAAE,SAAS,kBAAkB,CAAC,CAAC,CAAC,EAAE,EACjD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EACrB,IAAI,EAAE,YAAY,EAClB,EAAE,EAAE,WAAW,GACd,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CA4CzB"}
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
// packages/core/src/installer/install.ts
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { ConflictDecision, FileState } from "./types";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @brief Builds a `FileSource` that copies each file from the package source tree.
|
|
6
|
+
*
|
|
7
|
+
* @param resolveSourcePath - Maps a file's relative path to its absolute path in the source tree.
|
|
8
|
+
* @returns Source that returns a `copy` content for every file.
|
|
9
|
+
*/
|
|
5
10
|
export function copySource(resolveSourcePath) {
|
|
6
11
|
return (file) => ({ kind: "copy", sourcePath: resolveSourcePath(file.path) });
|
|
7
12
|
}
|
|
8
13
|
/**
|
|
9
|
-
* Writes the files an install
|
|
10
|
-
*
|
|
11
|
-
* `
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
+
* @brief Writes the files an install or update decision allows and reports the result per file.
|
|
15
|
+
*
|
|
16
|
+
* `SafeUpdate` files are always written. `UserOnly` and `Conflict` files are written only when
|
|
17
|
+
* `opts.decision` is `Overwrite` or `opts.force` is set. The result's `files` is what the caller
|
|
18
|
+
* registers in the user manifest. A kept file keeps the hash it was installed with, so its local
|
|
19
|
+
* change stays visible to every later run instead of becoming the new baseline.
|
|
20
|
+
*
|
|
21
|
+
* @param classifications - Per-file states from `classifyFiles`.
|
|
22
|
+
* @param source - Produces each file's content when it is written.
|
|
23
|
+
* @param opts - Conflict decision, `force` and `dryRun` flags.
|
|
24
|
+
* @param io - Filesystem boundary used to write and hash files.
|
|
25
|
+
* @returns Written, kept and missing-source paths, and the manifest entries to register.
|
|
14
26
|
*/
|
|
15
27
|
export async function applyClassifications(classifications, source, opts, io) {
|
|
16
28
|
const result = { written: [], kept: [], missingSource: [], files: [] };
|
|
@@ -51,7 +63,8 @@ export async function applyClassifications(classifications, source, opts, io) {
|
|
|
51
63
|
}
|
|
52
64
|
else {
|
|
53
65
|
result.kept.push(cl.file.path);
|
|
54
|
-
|
|
66
|
+
// An untracked file has no install-time hash; the source version is the baseline it differs from.
|
|
67
|
+
result.files.push({ ...cl.file, hash: cl.recordedHash ?? cl.latestHash });
|
|
55
68
|
}
|
|
56
69
|
break;
|
|
57
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/installer/install.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGrD
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/installer/install.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGrD;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAA0B,iBAA8C;IAChG,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,CAAC,IAAI,CAAC,IA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AC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/installer/io.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { InstallerIO } from "./types";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* @brief Builds the real-filesystem `InstallerIO`, with any field replaced by `overrides`.
|
|
4
|
+
*
|
|
5
|
+
* @param overrides - Fields to replace, such as stubs in tests. Empty by default.
|
|
6
|
+
* @returns Filesystem boundary backed by `node:fs` and `hashFile`, except for the overridden fields.
|
|
7
|
+
*/
|
|
3
8
|
export declare function createInstallerIO(overrides?: Partial<InstallerIO>): InstallerIO;
|
|
4
9
|
//# sourceMappingURL=io.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/installer/io.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../../src/installer/io.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAYnF"}
|
package/dist/installer/io.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// packages/core/src/installer/io.ts
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { hashFile } from "../hash/hash";
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* @brief Builds the real-filesystem `InstallerIO`, with any field replaced by `overrides`.
|
|
6
|
+
*
|
|
7
|
+
* @param overrides - Fields to replace, such as stubs in tests. Empty by default.
|
|
8
|
+
* @returns Filesystem boundary backed by `node:fs` and `hashFile`, except for the overridden fields.
|
|
9
|
+
*/
|
|
5
10
|
export function createInstallerIO(overrides = {}) {
|
|
6
11
|
return {
|
|
7
12
|
exists: (path) => fs.existsSync(path),
|
package/dist/installer/io.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/installer/io.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGvC
|
|
1
|
+
{"version":3,"file":"io.js","sourceRoot":"","sources":["../../src/installer/io.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAGvC;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAS,GAAyB,EAAE;IACpE,OAAO;QACL,MAAM,EAAM,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;QACzC,SAAS,EAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA,CAAC,CAAC;QAC/D,QAAQ,EAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA,CAAC,CAAC;QACzD,SAAS,EAAG,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA,CAAC,CAAC;QAC1E,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;QACzC,OAAO,EAAK,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC;QACxC,SAAS,EAAG,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA,CAAC,CAAC;QAC5D,QAAQ;QACR,GAAG,SAAS;KACb,CAAA;AACH,CAAC"}
|
|
@@ -3,23 +3,28 @@ import { type RegistryStore } from "../registry/registry.store";
|
|
|
3
3
|
import type { BaseRegistryEntry } from "../registry/types";
|
|
4
4
|
import { type SourceRecord } from "../sources/types";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* the entries installed into it, as `{ "sources": {...}, "entries": {...} }`
|
|
8
|
-
* on disk.
|
|
6
|
+
* @brief Install manifest: the sources registered for an install target and the entries installed into it.
|
|
9
7
|
*
|
|
10
|
-
* Created by `loadInstallManifest` in each
|
|
11
|
-
* (`skills.json`, `mods.json`, the g3nui manifest). The installer changes
|
|
12
|
-
* `sources` directly and hands `store` to the core `add`, `update` and
|
|
13
|
-
* `
|
|
8
|
+
* On disk it is `{ "sources": {...}, "entries": {...} }`. Created by `loadInstallManifest` in each
|
|
9
|
+
* installer's project setup (`skills.json`, `mods.json`, the g3nui manifest). The installer changes
|
|
10
|
+
* `sources` directly and hands `store` to the core `add`, `update` and `remove` commands.
|
|
11
|
+
* `saveInstallManifest` writes both back.
|
|
12
|
+
*
|
|
13
|
+
* @property filePath - Absolute path of the file, e.g. `/home/me/app/.claude/skills.json`.
|
|
14
|
+
* @property sources - Sources registered for this target, by name.
|
|
15
|
+
* @property store - Installed entries by key.
|
|
14
16
|
*/
|
|
15
17
|
export interface InstallManifest {
|
|
16
|
-
/** Absolute path of the file, e.g. `/home/me/app/.claude/skills.json` */
|
|
17
18
|
filePath: string;
|
|
18
19
|
sources: SourceRecord;
|
|
19
|
-
/** Installed entries by key */
|
|
20
20
|
store: RegistryStore<BaseRegistryEntry>;
|
|
21
21
|
}
|
|
22
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* @brief Builds the zod schema of a manifest file whose entries match `entrySchema`.
|
|
24
|
+
*
|
|
25
|
+
* @param entrySchema - Schema each value of `entries` must match.
|
|
26
|
+
* @returns Strict object schema with `sources` and `entries`, both defaulting to empty.
|
|
27
|
+
*/
|
|
23
28
|
export declare function installManifestSchema<S extends z.ZodType>(entrySchema: S): z.ZodObject<{
|
|
24
29
|
sources: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
25
30
|
kind: z.ZodLiteral<"git">;
|
|
@@ -36,24 +41,29 @@ export declare function installManifestSchema<S extends z.ZodType>(entrySchema:
|
|
|
36
41
|
entries: z.ZodDefault<z.ZodRecord<z.ZodString, S>>;
|
|
37
42
|
}, z.core.$strict>;
|
|
38
43
|
/**
|
|
39
|
-
* Reads a manifest file and checks every entry against `entrySchema
|
|
40
|
-
* missing file reads as no sources and no entries.
|
|
44
|
+
* @brief Reads a manifest file and checks every entry against `entrySchema`. A missing file reads as no sources and no entries.
|
|
41
45
|
*
|
|
42
|
-
* @param filePath - Absolute path of the manifest
|
|
43
|
-
* @
|
|
46
|
+
* @param filePath - Absolute path of the manifest, e.g. `/home/me/app/.claude/skills.json`.
|
|
47
|
+
* @param entrySchema - Schema each installed entry must match.
|
|
48
|
+
* @returns The manifest, with its entries loaded into `store`.
|
|
49
|
+
* @throws {Error} Naming the file when it is not JSON or does not match the schema.
|
|
44
50
|
*/
|
|
45
51
|
export declare function loadInstallManifest(filePath: string, entrySchema: z.ZodType<BaseRegistryEntry>): InstallManifest;
|
|
46
52
|
/**
|
|
47
|
-
*
|
|
53
|
+
* @brief Reads the installed entries of a manifest, each checked against `entrySchema`.
|
|
48
54
|
*
|
|
49
|
-
* @
|
|
55
|
+
* @param manifest - Manifest whose `store` is read.
|
|
56
|
+
* @param entrySchema - Schema each entry must match.
|
|
57
|
+
* @returns Entries by key.
|
|
58
|
+
* @throws {ZodError} When an entry the install commands wrote does not match the schema.
|
|
50
59
|
*/
|
|
51
60
|
export declare function installedEntries<T extends BaseRegistryEntry>(manifest: InstallManifest, entrySchema: z.ZodType<T>): Record<string, T>;
|
|
52
61
|
/**
|
|
53
|
-
* Writes sources and entries back
|
|
54
|
-
* entry against `entrySchema`.
|
|
62
|
+
* @brief Writes sources and entries back to `manifest.filePath`, each sorted by name, after checking every entry against `entrySchema`.
|
|
55
63
|
*
|
|
56
|
-
* @
|
|
64
|
+
* @param manifest - Manifest to write.
|
|
65
|
+
* @param entrySchema - Schema each entry must match.
|
|
66
|
+
* @throws {ZodError} When an entry does not match the schema. Nothing is written then.
|
|
57
67
|
*/
|
|
58
68
|
export declare function saveInstallManifest(manifest: InstallManifest, entrySchema: z.ZodType<BaseRegistryEntry>): void;
|
|
59
69
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/installer/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGxE
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/installer/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAuB,KAAK,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAEpF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAGxE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAG,YAAY,CAAA;IACtB,KAAK,E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