@g3nomaly/core 0.2.0 → 0.3.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.
Files changed (151) hide show
  1. package/README.md +3 -0
  2. package/package.json +3 -60
  3. package/LICENSE +0 -95
  4. package/dist/cli/commands/add.d.ts +0 -17
  5. package/dist/cli/commands/add.d.ts.map +0 -1
  6. package/dist/cli/commands/add.js +0 -76
  7. package/dist/cli/commands/add.js.map +0 -1
  8. package/dist/cli/commands/ls.d.ts +0 -5
  9. package/dist/cli/commands/ls.d.ts.map +0 -1
  10. package/dist/cli/commands/ls.js +0 -22
  11. package/dist/cli/commands/ls.js.map +0 -1
  12. package/dist/cli/commands/remove.d.ts +0 -13
  13. package/dist/cli/commands/remove.d.ts.map +0 -1
  14. package/dist/cli/commands/remove.js +0 -109
  15. package/dist/cli/commands/remove.js.map +0 -1
  16. package/dist/cli/commands/update.d.ts +0 -10
  17. package/dist/cli/commands/update.d.ts.map +0 -1
  18. package/dist/cli/commands/update.js +0 -92
  19. package/dist/cli/commands/update.js.map +0 -1
  20. package/dist/cli/dialogue.d.ts +0 -74
  21. package/dist/cli/dialogue.d.ts.map +0 -1
  22. package/dist/cli/dialogue.js +0 -117
  23. package/dist/cli/dialogue.js.map +0 -1
  24. package/dist/cli/index.d.ts +0 -10
  25. package/dist/cli/index.d.ts.map +0 -1
  26. package/dist/cli/index.js +0 -10
  27. package/dist/cli/index.js.map +0 -1
  28. package/dist/cli/theme.d.ts +0 -23
  29. package/dist/cli/theme.d.ts.map +0 -1
  30. package/dist/cli/theme.js +0 -25
  31. package/dist/cli/theme.js.map +0 -1
  32. package/dist/cli/types.d.ts +0 -45
  33. package/dist/cli/types.d.ts.map +0 -1
  34. package/dist/cli/types.js +0 -2
  35. package/dist/cli/types.js.map +0 -1
  36. package/dist/config/config.d.ts +0 -30
  37. package/dist/config/config.d.ts.map +0 -1
  38. package/dist/config/config.js +0 -77
  39. package/dist/config/config.js.map +0 -1
  40. package/dist/config/index.d.ts +0 -4
  41. package/dist/config/index.d.ts.map +0 -1
  42. package/dist/config/index.js +0 -3
  43. package/dist/config/index.js.map +0 -1
  44. package/dist/config/types.d.ts +0 -140
  45. package/dist/config/types.d.ts.map +0 -1
  46. package/dist/config/types.js +0 -63
  47. package/dist/config/types.js.map +0 -1
  48. package/dist/hash/hash.d.ts +0 -25
  49. package/dist/hash/hash.d.ts.map +0 -1
  50. package/dist/hash/hash.js +0 -44
  51. package/dist/hash/hash.js.map +0 -1
  52. package/dist/hash/index.d.ts +0 -2
  53. package/dist/hash/index.d.ts.map +0 -1
  54. package/dist/hash/index.js +0 -2
  55. package/dist/hash/index.js.map +0 -1
  56. package/dist/index.d.ts +0 -1
  57. package/dist/index.d.ts.map +0 -1
  58. package/dist/index.js +0 -2
  59. package/dist/index.js.map +0 -1
  60. package/dist/installer/classify.d.ts +0 -7
  61. package/dist/installer/classify.d.ts.map +0 -1
  62. package/dist/installer/classify.js +0 -47
  63. package/dist/installer/classify.js.map +0 -1
  64. package/dist/installer/index.d.ts +0 -6
  65. package/dist/installer/index.d.ts.map +0 -1
  66. package/dist/installer/index.js +0 -7
  67. package/dist/installer/index.js.map +0 -1
  68. package/dist/installer/install.d.ts +0 -13
  69. package/dist/installer/install.d.ts.map +0 -1
  70. package/dist/installer/install.js +0 -61
  71. package/dist/installer/install.js.map +0 -1
  72. package/dist/installer/io.d.ts +0 -4
  73. package/dist/installer/io.d.ts.map +0 -1
  74. package/dist/installer/io.js +0 -18
  75. package/dist/installer/io.js.map +0 -1
  76. package/dist/installer/remove.d.ts +0 -14
  77. package/dist/installer/remove.d.ts.map +0 -1
  78. package/dist/installer/remove.js +0 -37
  79. package/dist/installer/remove.js.map +0 -1
  80. package/dist/installer/types.d.ts +0 -80
  81. package/dist/installer/types.d.ts.map +0 -1
  82. package/dist/installer/types.js +0 -21
  83. package/dist/installer/types.js.map +0 -1
  84. package/dist/registry/index.d.ts +0 -12
  85. package/dist/registry/index.d.ts.map +0 -1
  86. package/dist/registry/index.js +0 -12
  87. package/dist/registry/index.js.map +0 -1
  88. package/dist/registry/registry.handlers.d.ts +0 -9
  89. package/dist/registry/registry.handlers.d.ts.map +0 -1
  90. package/dist/registry/registry.handlers.js +0 -13
  91. package/dist/registry/registry.handlers.js.map +0 -1
  92. package/dist/registry/registry.io.d.ts +0 -22
  93. package/dist/registry/registry.io.d.ts.map +0 -1
  94. package/dist/registry/registry.io.js +0 -78
  95. package/dist/registry/registry.io.js.map +0 -1
  96. package/dist/registry/registry.mutations.d.ts +0 -12
  97. package/dist/registry/registry.mutations.d.ts.map +0 -1
  98. package/dist/registry/registry.mutations.js +0 -22
  99. package/dist/registry/registry.mutations.js.map +0 -1
  100. package/dist/registry/registry.selectors.d.ts +0 -38
  101. package/dist/registry/registry.selectors.d.ts.map +0 -1
  102. package/dist/registry/registry.selectors.js +0 -61
  103. package/dist/registry/registry.selectors.js.map +0 -1
  104. package/dist/registry/registry.store.d.ts +0 -34
  105. package/dist/registry/registry.store.d.ts.map +0 -1
  106. package/dist/registry/registry.store.js +0 -27
  107. package/dist/registry/registry.store.js.map +0 -1
  108. package/dist/registry/registry.template.d.ts +0 -23
  109. package/dist/registry/registry.template.d.ts.map +0 -1
  110. package/dist/registry/registry.template.js +0 -63
  111. package/dist/registry/registry.template.js.map +0 -1
  112. package/dist/registry/types.d.ts +0 -33
  113. package/dist/registry/types.d.ts.map +0 -1
  114. package/dist/registry/types.js +0 -25
  115. package/dist/registry/types.js.map +0 -1
  116. package/dist/security/index.d.ts +0 -2
  117. package/dist/security/index.d.ts.map +0 -1
  118. package/dist/security/index.js +0 -2
  119. package/dist/security/index.js.map +0 -1
  120. package/dist/security/securityParser.d.ts +0 -14
  121. package/dist/security/securityParser.d.ts.map +0 -1
  122. package/dist/security/securityParser.js +0 -89
  123. package/dist/security/securityParser.js.map +0 -1
  124. package/dist/security/securityWorker.d.ts +0 -8
  125. package/dist/security/securityWorker.d.ts.map +0 -1
  126. package/dist/security/securityWorker.js +0 -158
  127. package/dist/security/securityWorker.js.map +0 -1
  128. package/dist/utils/index.d.ts +0 -6
  129. package/dist/utils/index.d.ts.map +0 -1
  130. package/dist/utils/index.js +0 -6
  131. package/dist/utils/index.js.map +0 -1
  132. package/dist/utils/merge.d.ts +0 -6
  133. package/dist/utils/merge.d.ts.map +0 -1
  134. package/dist/utils/merge.js +0 -21
  135. package/dist/utils/merge.js.map +0 -1
  136. package/dist/utils/packageMeta.d.ts +0 -12
  137. package/dist/utils/packageMeta.d.ts.map +0 -1
  138. package/dist/utils/packageMeta.js +0 -20
  139. package/dist/utils/packageMeta.js.map +0 -1
  140. package/dist/utils/paths.d.ts +0 -16
  141. package/dist/utils/paths.d.ts.map +0 -1
  142. package/dist/utils/paths.js +0 -40
  143. package/dist/utils/paths.js.map +0 -1
  144. package/dist/utils/prompt.d.ts +0 -3
  145. package/dist/utils/prompt.d.ts.map +0 -1
  146. package/dist/utils/prompt.js +0 -8
  147. package/dist/utils/prompt.js.map +0 -1
  148. package/dist/utils/version.d.ts +0 -9
  149. package/dist/utils/version.d.ts.map +0 -1
  150. package/dist/utils/version.js +0 -103
  151. package/dist/utils/version.js.map +0 -1
@@ -1,63 +0,0 @@
1
- // packages/core/src/config/types.ts
2
- import { z } from "zod";
3
- // ---------------------------------------------------------------------------
4
- // Per-package section schemas — settings only. Package metadata (version,
5
- // description, license) lives in each package's package.json and is read at
6
- // runtime via `readPackageMeta`, never persisted here.
7
- // ---------------------------------------------------------------------------
8
- export const G3nuiSettingsSchema = z.object({
9
- /** Where components are installed in the user's project */
10
- componentsDir: z.string().default("src/components/ui"),
11
- /** Whether to copy .debug.ts files alongside components */
12
- includeDebugFiles: z.boolean().default(false),
13
- /** Whether to copy .meta.ts files alongside components */
14
- includeMetaFiles: z.boolean().default(false),
15
- /** Format of the user manifest file: json (default) or ts */
16
- manifestFormat: z.enum(["json", "ts"]).default("json"),
17
- /** External package adapters to load (e.g. ["shadcn"]) */
18
- registeredPackages: z.array(z.string()).default([]),
19
- });
20
- export const G3nuiConfigSchema = z.object({
21
- settings: G3nuiSettingsSchema.default(() => G3nuiSettingsSchema.parse({})),
22
- });
23
- export const G3nerateSettingsSchema = z.object({
24
- /** Output directory for generated files */
25
- outputDir: z.string().default("src/generated"),
26
- });
27
- export const G3nerateConfigSchema = z.object({
28
- settings: G3nerateSettingsSchema.default(() => G3nerateSettingsSchema.parse({})),
29
- });
30
- export const SkillTargetSchema = z.enum(["claude", "codex"]);
31
- export const SkillsInstallDirsSchema = z.object({
32
- /** Skill install directory for Claude Code, relative to the project root */
33
- claude: z.string().default(".claude/skills"),
34
- /** Skill install directory for Codex (`.agents/skills`), relative to the project root */
35
- codex: z.string().default(".agents/skills"),
36
- });
37
- export const SkillsSettingsSchema = z.object({
38
- /** Where the plan, phase and task tree lives, relative to the project root */
39
- filetreeRoot: z.string().default("docs/task-manager"),
40
- /** Which agent harnesses skills are installed for */
41
- targets: z.array(SkillTargetSchema).min(1).default(["claude"]),
42
- /** Install directory per target; the skills.json registry sits next to each */
43
- installDirs: SkillsInstallDirsSchema.default(() => SkillsInstallDirsSchema.parse({})),
44
- });
45
- export const SkillsConfigSchema = z.object({
46
- settings: SkillsSettingsSchema.default(() => SkillsSettingsSchema.parse({})),
47
- });
48
- // ---------------------------------------------------------------------------
49
- // Root config schemas
50
- // ---------------------------------------------------------------------------
51
- /** What `.g3n.config.json` holds on disk: only the sections a package's init has written. */
52
- export const G3nConfigFileSchema = z.object({
53
- g3nui: G3nuiConfigSchema.optional(),
54
- g3nerate: G3nerateConfigSchema.optional(),
55
- skills: SkillsConfigSchema.optional(),
56
- });
57
- /** The fully-defaulted view every consumer reads through `loadConfig`. */
58
- export const G3nConfigSchema = z.object({
59
- g3nui: G3nuiConfigSchema.default(() => G3nuiConfigSchema.parse({})),
60
- g3nerate: G3nerateConfigSchema.default(() => G3nerateConfigSchema.parse({})),
61
- skills: SkillsConfigSchema.default(() => SkillsConfigSchema.parse({})),
62
- });
63
- //# sourceMapp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AAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAK,iBAAiB,CAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,oBAAoB,CAAC,QAAQ,EAAE;IACzC,MAAM,EAAI,kBAAkB,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAC;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAK,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtE,QAAQ,EAAE,oBAAoB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5E,MAAM,EAAI,kBAAkB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;CACzE,CAAC,CAAC"}
@@ -1,25 +0,0 @@
1
- /**
2
- * Hashes a file's contents using SHA-256.
3
- * Uses Bun's native file API + Web Crypto — no external dependencies.
4
- *
5
- * @param filePath - Absolute or relative path to the file
6
- * @returns Lowercase hex SHA-256 digest
7
- */
8
- export declare function hashFile(filePath: string): Promise<string>;
9
- /**
10
- * Hashes an arbitrary string using SHA-256.
11
- * Useful for hashing in-memory content before writing to disk.
12
- *
13
- * @param content - String to hash
14
- * @returns Lowercase hex SHA-256 digest
15
- */
16
- export declare function hashString(content: string): Promise<string>;
17
- /**
18
- * Short (first 12 chars) SHA-256 hash of a file — for display purposes.
19
- */
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
- */
24
- export declare function hashStringShort(content: string): Promise<string>;
25
- //# sourceMappingURL=hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/hash/hash.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhE;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAMjE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAErE;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtE"}
package/dist/hash/hash.js DELETED
@@ -1,44 +0,0 @@
1
- if ("window" in globalThis) {
2
- throw new Error("@g3nomaly/core hash utilities are CLI-only");
3
- }
4
- /**
5
- * Hashes a file's contents using SHA-256.
6
- * Uses Bun's native file API + Web Crypto — no external dependencies.
7
- *
8
- * @param filePath - Absolute or relative path to the file
9
- * @returns Lowercase hex SHA-256 digest
10
- */
11
- export async function hashFile(filePath) {
12
- const file = Bun.file(filePath);
13
- const buffer = await file.arrayBuffer();
14
- const hashBuffer = await crypto.subtle.digest("SHA-256", buffer);
15
- const hashArray = Array.from(new Uint8Array(hashBuffer));
16
- return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
17
- }
18
- /**
19
- * Hashes an arbitrary string using SHA-256.
20
- * Useful for hashing in-memory content before writing to disk.
21
- *
22
- * @param content - String to hash
23
- * @returns Lowercase hex SHA-256 digest
24
- */
25
- export async function hashString(content) {
26
- const encoder = new TextEncoder();
27
- const buffer = encoder.encode(content);
28
- const hashBuffer = await crypto.subtle.digest("SHA-256", buffer);
29
- const hashArray = Array.from(new Uint8Array(hashBuffer));
30
- return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
31
- }
32
- /**
33
- * Short (first 12 chars) SHA-256 hash of a file — for display purposes.
34
- */
35
- export async function hashFileShort(filePath) {
36
- return (await hashFile(filePath)).substring(0, 12);
37
- }
38
- /**
39
- * Short (first 12 chars) SHA-256 hash of a string — for display purposes.
40
- */
41
- export async function hashStringShort(content) {
42
- return (await hashString(content)).substring(0, 12);
43
- }
44
- //# sourceMappingURL=hash.js.map
@@ -1 +0,0 @@
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;;;;;;GAMG;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;;;;;;GAMG;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;;GAEG;AACH,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;;GAEG;AACH,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"}
@@ -1,2 +0,0 @@
1
- export { hashFile, hashString, hashFileShort, hashStringShort } from "./hash";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hash/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC"}
@@ -1,2 +0,0 @@
1
- export { hashFile, hashString, hashFileShort, hashStringShort } from "./hash";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"}
package/dist/index.d.ts DELETED
@@ -1 +0,0 @@
1
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
@@ -1,7 +0,0 @@
1
- import type { BaseFileEntry, BaseRegistryEntry } from "../registry/types";
2
- import type { FileClassification, InstallerIO } from "./types";
3
- /** `path → hash` map of a manifest entry's files; empty when never installed. */
4
- export declare function recordedHashes(entry: Pick<BaseRegistryEntry, "files"> | undefined): Record<string, string>;
5
- export declare function classifyFile<F extends BaseFileEntry>(file: F, installDir: string, recordedHash: string | undefined, io: InstallerIO, resolveLatestHash?: (file: F) => Promise<string>): Promise<FileClassification<F>>;
6
- 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
- //# sourceMappingURL=classify.d.ts.map
@@ -1 +0,0 @@
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,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,iBAAiB,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAM1G;AAoBD,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,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,47 +0,0 @@
1
- // packages/core/src/installer/classify.ts
2
- import path from "node:path";
3
- import { FileState } from "./types";
4
- /** `path → hash` map of a manifest entry's files; empty when never installed. */
5
- export function recordedHashes(entry) {
6
- const map = {};
7
- for (const file of entry?.files ?? []) {
8
- if (file.hash)
9
- map[file.path] = file.hash;
10
- }
11
- return map;
12
- }
13
- function resolveState(exists, currentHash, recordedHash, latestHash) {
14
- if (!exists)
15
- return FileState.SafeUpdate;
16
- if (recordedHash === undefined) {
17
- return currentHash === latestHash ? FileState.UpToDate : FileState.Conflict;
18
- }
19
- const userModified = currentHash !== recordedHash;
20
- const registryChanged = latestHash !== recordedHash;
21
- if (!userModified && !registryChanged)
22
- return FileState.UpToDate;
23
- if (!userModified)
24
- return FileState.SafeUpdate;
25
- if (!registryChanged)
26
- return FileState.UserOnly;
27
- return FileState.Conflict;
28
- }
29
- export async function classifyFile(file, installDir, recordedHash, io, resolveLatestHash) {
30
- const destPath = path.join(installDir, file.path);
31
- const latestHash = file.hash ?? (await resolveLatestHash?.(file));
32
- if (latestHash === undefined) {
33
- throw new Error(`no hash for "${file.path}" and no resolveLatestHash provided`);
34
- }
35
- const exists = io.exists(destPath);
36
- const currentHash = exists ? await io.hashFile(destPath) : null;
37
- const state = resolveState(exists, currentHash, recordedHash, latestHash);
38
- return { file, destPath, state, exists, currentHash, recordedHash, latestHash };
39
- }
40
- export async function classifyFiles(files, installDir, recorded, io, resolveLatestHash) {
41
- const classifications = [];
42
- for (const file of files) {
43
- classifications.push(await classifyFile(file, installDir, recorded[file.path], io, resolveLatestHash));
44
- }
45
- return classifications;
46
- }
47
- //# sourceMappingURL=classify.js.map
@@ -1 +0,0 @@
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,iFAAiF;AACjF,MAAM,UAAU,cAAc,CAAC,KAAmD;IAChF,MAAM,GAAG,GAA2B,EAAE,CAAA;IACtC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,KAAK,IAAI,EAAE,EAAE,CAAC;QACtC,IAAI,IAAI,CAAC,IAAI;YAAE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC3C,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,YAAY,CACnB,MAAe,EACf,WAA0B,EAC1B,YAAgC,EAChC,UAAkB;IAElB,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC,UAAU,CAAA;IACxC,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,WAAW,KAAK,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAA;IAC7E,CAAC;IACD,MAAM,YAAY,GAAM,WAAW,KAAK,YAAY,CAAA;IACpD,MAAM,eAAe,GAAG,UAAU,KAAM,YAAY,CAAA;IACpD,IAAI,CAAC,YAAY,IAAI,CAAC,eAAe;QAAE,OAAO,SAAS,CAAC,QAAQ,CAAA;IAChE,IAAI,CAAC,YAAY;QA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,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAAA;IACxG,CAAC;IACD,OAAO,eAAe,CAAA;AACxB,CAAC"}
@@ -1,6 +0,0 @@
1
- export * from "./types";
2
- export { createInstallerIO } from "./io";
3
- export { classifyFile, classifyFiles, recordedHashes } from "./classify";
4
- export { applyClassifications, copySource } from "./install";
5
- export { removeInstalledFiles, pruneEmptyDirs } from "./remove";
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,7 +0,0 @@
1
- // packages/core/src/installer/index.ts
2
- export * from "./types";
3
- export { createInstallerIO } from "./io";
4
- export { classifyFile, classifyFiles, recordedHashes } from "./classify";
5
- export { applyClassifications, copySource } from "./install";
6
- export { removeInstalledFiles, pruneEmptyDirs } from "./remove";
7
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"}
@@ -1,13 +0,0 @@
1
- import type { BaseFileEntry } from "../registry/types";
2
- import type { ApplyOptions, ApplyResult, FileClassification, FileSource, InstallerIO } from "./types";
3
- /** Local default: copy each file from the package source tree at its relative path. */
4
- export declare function copySource<F extends BaseFileEntry>(resolveSourcePath: (relPath: string) => string): FileSource<F>;
5
- /**
6
- * Writes the files an install/update decision allows and reports what
7
- * happened per file. `SafeUpdate` files are always written; `UserOnly` and
8
- * `Conflict` files only when `decision` is Overwrite or `force` is set.
9
- * `files` in the result mirrors the on-disk state afterwards so the caller
10
- * can register it in the user manifest.
11
- */
12
- export declare function applyClassifications<F extends BaseFileEntry>(classifications: readonly FileClassification<F>[], source: FileSource<F>, opts: ApplyOptions, io: InstallerIO): Promise<ApplyResult<F>>;
13
- //# sourceMappingURL=install.d.ts.map
@@ -1 +0,0 @@
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,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,CAAC,SAAS,aAAa,EAAE,iBAAiB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAEjH;AAED;;;;;;GAMG;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,CA2CzB"}
@@ -1,61 +0,0 @@
1
- // packages/core/src/installer/install.ts
2
- import path from "node:path";
3
- import { ConflictDecision, FileState } from "./types";
4
- /** Local default: copy each file from the package source tree at its relative path. */
5
- export function copySource(resolveSourcePath) {
6
- return (file) => ({ kind: "copy", sourcePath: resolveSourcePath(file.path) });
7
- }
8
- /**
9
- * Writes the files an install/update decision allows and reports what
10
- * happened per file. `SafeUpdate` files are always written; `UserOnly` and
11
- * `Conflict` files only when `decision` is Overwrite or `force` is set.
12
- * `files` in the result mirrors the on-disk state afterwards so the caller
13
- * can register it in the user manifest.
14
- */
15
- export async function applyClassifications(classifications, source, opts, io) {
16
- const result = { written: [], kept: [], missingSource: [], files: [] };
17
- const overwrite = opts.force === true || opts.decision === ConflictDecision.Overwrite;
18
- const write = async (cl) => {
19
- const content = await source(cl.file);
20
- if (content === null) {
21
- result.missingSource.push(cl.file.path);
22
- if (cl.exists)
23
- result.files.push({ ...cl.file, hash: cl.currentHash ?? undefined });
24
- return;
25
- }
26
- if (opts.dryRun === true) {
27
- result.files.push({ ...cl.file, hash: cl.latestHash });
28
- }
29
- else {
30
- io.ensureDir(path.dirname(cl.destPath));
31
- if (content.kind === "copy")
32
- io.copyFile(content.sourcePath, cl.destPath);
33
- else
34
- io.writeFile(cl.destPath, content.content);
35
- result.files.push({ ...cl.file, hash: await io.hashFile(cl.destPath) });
36
- }
37
- result.written.push(cl.file.path);
38
- };
39
- for (const cl of classifications) {
40
- switch (cl.state) {
41
- case FileState.UpToDate:
42
- result.files.push({ ...cl.file, hash: cl.currentHash ?? cl.latestHash });
43
- break;
44
- case FileState.SafeUpdate:
45
- await write(cl);
46
- break;
47
- case FileState.UserOnly:
48
- case FileState.Conflict:
49
- if (overwrite) {
50
- await write(cl);
51
- }
52
- else {
53
- result.kept.push(cl.file.path);
54
- result.files.push({ ...cl.file, hash: cl.currentHash ?? undefined });
55
- }
56
- break;
57
- }
58
- }
59
- return result;
60
- }
61
- //# sourceMappingURL=install.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceR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,CAAA;gBACjB,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;oBAC9B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,WAAW,IAAI,SAAS,EAAE,CAAC,CAAA;gBACtE,CAAC;gBACD,MAAK;QACT,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { InstallerIO } from "./types";
2
- /** Real-filesystem `InstallerIO`; any field can be overridden for tests. */
3
- export declare function createInstallerIO(overrides?: Partial<InstallerIO>): InstallerIO;
4
- //# sourceMappingURL=io.d.ts.map
@@ -1 +0,0 @@
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,4EAA4E;AAC5E,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAYnF"}
@@ -1,18 +0,0 @@
1
- // packages/core/src/installer/io.ts
2
- import fs from "node:fs";
3
- import { hashFile } from "../hash/hash";
4
- /** Real-filesystem `InstallerIO`; any field can be overridden for tests. */
5
- export function createInstallerIO(overrides = {}) {
6
- return {
7
- exists: (path) => fs.existsSync(path),
8
- ensureDir: (dir) => { fs.mkdirSync(dir, { recursive: true }); },
9
- copyFile: (src, dest) => { fs.copyFileSync(src, dest); },
10
- writeFile: (dest, content) => { fs.writeFileSync(dest, content, "utf8"); },
11
- removeFile: (path) => { fs.rmSync(path); },
12
- listDir: (dir) => fs.readdirSync(dir),
13
- removeDir: (dir) => { fs.rmSync(dir, { recursive: true }); },
14
- hashFile,
15
- ...overrides,
16
- };
17
- }
18
- //# sourceMappingURL=io.js.map
@@ -1 +0,0 @@
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,4EAA4E;AAC5E,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"}
@@ -1,14 +0,0 @@
1
- import type { BaseFileEntry } from "../registry/types";
2
- import type { InstallerIO, RemoveResult } from "./types";
3
- /**
4
- * Removes a manifest entry's files from `installDir`. A file whose on-disk
5
- * hash differs from the hash recorded at install time is kept unless `force`
6
- * is set. Directories left empty by the removals are pruned up to
7
- * `installDir`.
8
- */
9
- export declare function removeInstalledFiles(files: readonly BaseFileEntry[], installDir: string, opts: {
10
- force?: boolean;
11
- }, io: InstallerIO): Promise<RemoveResult>;
12
- /** Removes `dir` and its parents while they exist and are empty, stopping at `stopAt`. */
13
- export declare function pruneEmptyDirs(dir: string, stopAt: string, io: InstallerIO): void;
14
- //# sourceMappingURL=remove.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove.d.ts","sourceRoot":"","sources":["../../src/installer/remove.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAExD;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,EACzB,EAAE,EAAE,WAAW,GACd,OAAO,CAAC,YAAY,CAAC,CAsBvB;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,IAAI,CAMjF"}
@@ -1,37 +0,0 @@
1
- // packages/core/src/installer/remove.ts
2
- import path from "node:path";
3
- /**
4
- * Removes a manifest entry's files from `installDir`. A file whose on-disk
5
- * hash differs from the hash recorded at install time is kept unless `force`
6
- * is set. Directories left empty by the removals are pruned up to
7
- * `installDir`.
8
- */
9
- export async function removeInstalledFiles(files, installDir, opts, io) {
10
- const result = { removed: [], kept: [], missing: [] };
11
- for (const file of files) {
12
- const destPath = path.join(installDir, file.path);
13
- if (!io.exists(destPath)) {
14
- result.missing.push(file.path);
15
- continue;
16
- }
17
- if (file.hash && opts.force !== true && (await io.hashFile(destPath)) !== file.hash) {
18
- result.kept.push(file.path);
19
- continue;
20
- }
21
- io.removeFile(destPath);
22
- result.removed.push(file.path);
23
- }
24
- for (const relPath of result.removed) {
25
- pruneEmptyDirs(path.dirname(path.join(installDir, relPath)), installDir, io);
26
- }
27
- return result;
28
- }
29
- /** Removes `dir` and its parents while they exist and are empty, stopping at `stopAt`. */
30
- export function pruneEmptyDirs(dir, stopAt, io) {
31
- let current = dir;
32
- while (current !== stopAt && io.exists(current) && io.listDir(current).length === 0) {
33
- io.removeDir(current);
34
- current = path.dirname(current);
35
- }
36
- }
37
- //# sourceMappingURL=remove.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remove.js","sourceRoot":"","sources":["../../src/installer/remove.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAA+B,EAC/B,UAAkB,EAClB,IAAyB,EACzB,EAAe;IAEf,MAAM,MAAM,GAAiB,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;IAEnE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;QACjD,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC9B,SAAQ;QACV,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC;YACpF,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YAC3B,SAAQ;QACV,CAAC;QACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAA;QACvB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAChC,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACrC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC,CAAA;IAC9E,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,cAAc,CAAC,GAAW,EAAE,MAAc,EAAE,EAAe;IACzE,IAAI,OAAO,GAAG,GAAG,CAAA;IACjB,OAAO,OAAO,KAAK,MAAM,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpF,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QACrB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;AACH,CAAC"}
@@ -1,80 +0,0 @@
1
- import type { BaseFileEntry } from "../registry/types";
2
- /**
3
- * How one installed file relates to its package version. Ordered by
4
- * severity: everything >= UserOnly carries local changes.
5
- * (Const-object enum — the `enum` keyword is barred by `erasableSyntaxOnly`.)
6
- */
7
- export declare const FileState: {
8
- /** On disk and identical to the package file */
9
- readonly UpToDate: 0;
10
- /** Missing, or unmodified while the package file changed; writable without data loss */
11
- readonly SafeUpdate: 1;
12
- /** Modified locally while the package file is unchanged */
13
- readonly UserOnly: 2;
14
- /** Modified locally and the package file changed too */
15
- readonly Conflict: 3;
16
- };
17
- export type FileState = (typeof FileState)[keyof typeof FileState];
18
- /** What to do with `UserOnly` and `Conflict` files when applying. */
19
- export declare const ConflictDecision: {
20
- readonly Keep: 0;
21
- readonly Overwrite: 1;
22
- };
23
- export type ConflictDecision = (typeof ConflictDecision)[keyof typeof ConflictDecision];
24
- /** Classification of one file, produced by `classifyFiles` and consumed by `applyClassifications`. */
25
- export interface FileClassification<F extends BaseFileEntry = BaseFileEntry> {
26
- file: F;
27
- destPath: string;
28
- state: FileState;
29
- exists: boolean;
30
- /** Hash of the file currently on disk, null when it does not exist */
31
- currentHash: string | null;
32
- /** Hash recorded in the user manifest at install time, undefined when never installed */
33
- recordedHash: string | undefined;
34
- /** Hash of the package's current version of the file */
35
- latestHash: string;
36
- }
37
- /** Where a file's content comes from when it is written. `null` skips the file. */
38
- export type FileContent = {
39
- kind: "copy";
40
- sourcePath: string;
41
- } | {
42
- kind: "write";
43
- content: string;
44
- } | null;
45
- export type FileSource<F extends BaseFileEntry = BaseFileEntry> = (file: F) => FileContent | Promise<FileContent>;
46
- /**
47
- * Filesystem boundary for the installer. `createInstallerIO` supplies the
48
- * real implementation; tests inject stubs per field.
49
- */
50
- export interface InstallerIO {
51
- exists: (path: string) => boolean;
52
- ensureDir: (dir: string) => void;
53
- copyFile: (src: string, dest: string) => void;
54
- writeFile: (dest: string, content: string) => void;
55
- removeFile: (path: string) => void;
56
- listDir: (dir: string) => string[];
57
- removeDir: (dir: string) => void;
58
- hashFile: (path: string) => Promise<string>;
59
- }
60
- export interface ApplyOptions {
61
- decision: ConflictDecision;
62
- force?: boolean;
63
- dryRun?: boolean;
64
- }
65
- export interface ApplyResult<F extends BaseFileEntry = BaseFileEntry> {
66
- /** Relative paths written (or that would be written under dryRun) */
67
- written: string[];
68
- /** Relative paths with local changes that were left alone */
69
- kept: string[];
70
- /** Relative paths whose source produced no content */
71
- missingSource: string[];
72
- /** Manifest entries reflecting the on-disk state after the apply */
73
- files: F[];
74
- }
75
- export interface RemoveResult {
76
- removed: string[];
77
- kept: string[];
78
- missing: string[];
79
- }
80
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,SAAS;IACpB,gDAAgD;aAChD,QAAQ,EAAI,CAAC;IACb,wFAAwF;aACxF,UAAU,EAAE,CAAC;IACb,2DAA2D;aAC3D,QAAQ,EAAI,CAAC;IACb,wDAAwD;aACxD,QAAQ,EAAI,CAAC;CACL,CAAA;AACV,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAA;AAElE,qEAAqE;AACrE,eAAO,MAAM,gBAAgB;aAC3B,IAAI,EAAO,CAAC;aACZ,SAAS,EAAE,CAAC;CACJ,CAAA;AACV,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAA;AAEvF,sGAAsG;AACtG,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa;IACzE,IAAI,EAAU,CAAC,CAAA;IACf,QAAQ,EAAM,MAAM,CAAA;IACpB,KAAK,EAAS,SAAS,CAAA;IACvB,MAAM,EAAQ,OAAO,CAAA;IACrB,sEAAsE;IACtE,WAAW,EAAG,MAAM,GAAG,IAAI,CAAA;IAC3B,yFAAyF;IACzF,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,wDAAwD;IACxD,UAAU,EAAI,MAAM,CAAA;CACrB;AAED,mFAAmF;AACnF,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACpC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE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B,IAAI,EAAK,MAAM,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB"}
@@ -1,21 +0,0 @@
1
- /**
2
- * How one installed file relates to its package version. Ordered by
3
- * severity: everything >= UserOnly carries local changes.
4
- * (Const-object enum — the `enum` keyword is barred by `erasableSyntaxOnly`.)
5
- */
6
- export const FileState = {
7
- /** On disk and identical to the package file */
8
- UpToDate: 0,
9
- /** Missing, or unmodified while the package file changed; writable without data loss */
10
- SafeUpdate: 1,
11
- /** Modified locally while the package file is unchanged */
12
- UserOnly: 2,
13
- /** Modified locally and the package file changed too */
14
- Conflict: 3,
15
- };
16
- /** What to do with `UserOnly` and `Conflict` files when applying. */
17
- export const ConflictDecision = {
18
- Keep: 0,
19
- Overwrite: 1,
20
- };
21
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/installer/types.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,gDAAgD;IAChD,QAAQ,EAAI,CAAC;IACb,wFAAwF;IACxF,UAAU,EAAE,CAAC;IACb,2DAA2D;IAC3D,QAAQ,EAAI,CAAC;IACb,wDAAwD;IACxD,QAAQ,EAAI,CAAC;CACL,CAAA;AAGV,qEAAqE;AACrE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAO,CAAC;IACZ,SAAS,EAAE,CAAC;CACJ,CAAA"}
@@ -1,12 +0,0 @@
1
- export * from "./types";
2
- export * from "./registry.handlers";
3
- export * from "./registry.store";
4
- export * from "./registry.mutations";
5
- export * from "./registry.selectors";
6
- export * from "./registry.template";
7
- export * from "./registry.io";
8
- /**
9
- * Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
10
- * Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
11
- */
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAE7B;;;GAGG"}
@@ -1,12 +0,0 @@
1
- export * from "./types";
2
- export * from "./registry.handlers";
3
- export * from "./registry.store";
4
- export * from "./registry.mutations";
5
- export * from "./registry.selectors";
6
- export * from "./registry.template";
7
- export * from "./registry.io";
8
- /**
9
- * Purposfully a custom registry store. To reduce dependencies. Still follows the same pattern as the tanstack store design skill. Though it could still be improved since it is still missing a lot of default operators.
10
- * Nevertheless, this stores doesn't need reactive updates. Hence, once more the, part of why it is a custom store.
11
- */
12
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/registry/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,kBAAkB,CAAA;AAChC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAE7B;;;GAGG"}
@@ -1,9 +0,0 @@
1
- import type { BaseRegistry, BaseRegistryEntry } from "./types";
2
- export interface RegistryHandler<T extends BaseRegistryEntry = BaseRegistryEntry> {
3
- extensions: string[];
4
- serialize: (data: BaseRegistry<T>) => string;
5
- deserialize: (raw: string) => BaseRegistry<T>;
6
- }
7
- export declare const tsHandler: RegistryHandler<any>;
8
- export declare const jsonHandler: RegistryHandler<any>;
9
- //# sourceMappingURL=registry.handlers.d.ts.map