harnesstap 1.2.0 → 1.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 (202) hide show
  1. package/README.md +28 -15
  2. package/dist/apply-QSS4242W.js +67 -0
  3. package/dist/apply-QSS4242W.js.map +1 -0
  4. package/dist/approve-CNYQY6DC.js +181 -0
  5. package/dist/approve-CNYQY6DC.js.map +1 -0
  6. package/dist/audit-V4SUV7KA.js +434 -0
  7. package/dist/audit-V4SUV7KA.js.map +1 -0
  8. package/dist/auth-63FOHIQ3.js +220 -0
  9. package/dist/auth-63FOHIQ3.js.map +1 -0
  10. package/dist/bin.js +166 -0
  11. package/dist/bin.js.map +1 -0
  12. package/dist/chunk-2H7UOFLK.js +11 -0
  13. package/dist/chunk-2H7UOFLK.js.map +1 -0
  14. package/dist/chunk-2NE3QYMP.js +103 -0
  15. package/dist/chunk-2NE3QYMP.js.map +1 -0
  16. package/dist/chunk-2P2EOYEW.js +1140 -0
  17. package/dist/chunk-2P2EOYEW.js.map +1 -0
  18. package/dist/chunk-37E5M4JX.js +34 -0
  19. package/dist/chunk-37E5M4JX.js.map +1 -0
  20. package/dist/chunk-37LQQWMF.js +496 -0
  21. package/dist/chunk-37LQQWMF.js.map +1 -0
  22. package/dist/chunk-3FIWOI3H.js +98 -0
  23. package/dist/chunk-3FIWOI3H.js.map +1 -0
  24. package/dist/chunk-3PGC6OA3.js +540 -0
  25. package/dist/chunk-3PGC6OA3.js.map +1 -0
  26. package/dist/chunk-4IHKBIY3.js +118 -0
  27. package/dist/chunk-4IHKBIY3.js.map +1 -0
  28. package/dist/chunk-4ZUBRLSP.js +17 -0
  29. package/dist/chunk-4ZUBRLSP.js.map +1 -0
  30. package/dist/chunk-5F3LNDZG.js +9 -0
  31. package/dist/chunk-5F3LNDZG.js.map +1 -0
  32. package/dist/chunk-5TXI6BI2.js +1359 -0
  33. package/dist/chunk-5TXI6BI2.js.map +1 -0
  34. package/dist/chunk-6P5IO4BX.js +235 -0
  35. package/dist/chunk-6P5IO4BX.js.map +1 -0
  36. package/dist/chunk-ABXUKHAU.js +571 -0
  37. package/dist/chunk-ABXUKHAU.js.map +1 -0
  38. package/dist/chunk-AOUDSNRK.js +1357 -0
  39. package/dist/chunk-AOUDSNRK.js.map +1 -0
  40. package/dist/chunk-BNDJJAEI.js +311 -0
  41. package/dist/chunk-BNDJJAEI.js.map +1 -0
  42. package/dist/chunk-C2IWSFF5.js +818 -0
  43. package/dist/chunk-C2IWSFF5.js.map +1 -0
  44. package/dist/chunk-CHQGE2HF.js +283 -0
  45. package/dist/chunk-CHQGE2HF.js.map +1 -0
  46. package/dist/chunk-DEJLP7QJ.js +681 -0
  47. package/dist/chunk-DEJLP7QJ.js.map +1 -0
  48. package/dist/chunk-DJ6FN6EW.js +532 -0
  49. package/dist/chunk-DJ6FN6EW.js.map +1 -0
  50. package/dist/chunk-E4WRTRMH.js +1173 -0
  51. package/dist/chunk-E4WRTRMH.js.map +1 -0
  52. package/dist/chunk-E5QXNU3K.js +238 -0
  53. package/dist/chunk-E5QXNU3K.js.map +1 -0
  54. package/dist/chunk-EMTBGOR3.js +2959 -0
  55. package/dist/chunk-EMTBGOR3.js.map +1 -0
  56. package/dist/chunk-FFWYIGQ4.js +18 -0
  57. package/dist/chunk-FFWYIGQ4.js.map +1 -0
  58. package/dist/chunk-I6XFZLTJ.js +9 -0
  59. package/dist/chunk-I6XFZLTJ.js.map +1 -0
  60. package/dist/chunk-IHWAOIAU.js +172 -0
  61. package/dist/chunk-IHWAOIAU.js.map +1 -0
  62. package/dist/chunk-IHZUYG66.js +583 -0
  63. package/dist/chunk-IHZUYG66.js.map +1 -0
  64. package/dist/chunk-JQOKQKQT.js +158 -0
  65. package/dist/chunk-JQOKQKQT.js.map +1 -0
  66. package/dist/chunk-JRFUTIEH.js +426 -0
  67. package/dist/chunk-JRFUTIEH.js.map +1 -0
  68. package/dist/chunk-KCBI6JQC.js +115 -0
  69. package/dist/chunk-KCBI6JQC.js.map +1 -0
  70. package/dist/chunk-KDUQMINL.js +60 -0
  71. package/dist/chunk-KDUQMINL.js.map +1 -0
  72. package/dist/chunk-KLR2DURP.js +656 -0
  73. package/dist/chunk-KLR2DURP.js.map +1 -0
  74. package/dist/chunk-KRI4R7EM.js +25 -0
  75. package/dist/chunk-KRI4R7EM.js.map +1 -0
  76. package/dist/chunk-LYQMK6SV.js +87 -0
  77. package/dist/chunk-LYQMK6SV.js.map +1 -0
  78. package/dist/chunk-MK3Q37ZN.js +183 -0
  79. package/dist/chunk-MK3Q37ZN.js.map +1 -0
  80. package/dist/chunk-MSGAGV7B.js +346 -0
  81. package/dist/chunk-MSGAGV7B.js.map +1 -0
  82. package/dist/chunk-MZQRSERO.js +430 -0
  83. package/dist/chunk-MZQRSERO.js.map +1 -0
  84. package/dist/chunk-N3WIJXXM.js +691 -0
  85. package/dist/chunk-N3WIJXXM.js.map +1 -0
  86. package/dist/chunk-NAGAJ5UM.js +145 -0
  87. package/dist/chunk-NAGAJ5UM.js.map +1 -0
  88. package/dist/chunk-NFYPBTKO.js +302 -0
  89. package/dist/chunk-NFYPBTKO.js.map +1 -0
  90. package/dist/chunk-NPO2IG6G.js +491 -0
  91. package/dist/chunk-NPO2IG6G.js.map +1 -0
  92. package/dist/chunk-OS6NUIBJ.js +38 -0
  93. package/dist/chunk-OS6NUIBJ.js.map +1 -0
  94. package/dist/chunk-PFUK3HJ4.js +296 -0
  95. package/dist/chunk-PFUK3HJ4.js.map +1 -0
  96. package/dist/chunk-PMQ55GDB.js +115 -0
  97. package/dist/chunk-PMQ55GDB.js.map +1 -0
  98. package/dist/chunk-QIVE2YFJ.js +514 -0
  99. package/dist/chunk-QIVE2YFJ.js.map +1 -0
  100. package/dist/chunk-QKXD3EUF.js +691 -0
  101. package/dist/chunk-QKXD3EUF.js.map +1 -0
  102. package/dist/chunk-RNQYUWF6.js +32 -0
  103. package/dist/chunk-RNQYUWF6.js.map +1 -0
  104. package/dist/chunk-S2E4SSQV.js +41 -0
  105. package/dist/chunk-S2E4SSQV.js.map +1 -0
  106. package/dist/chunk-SN4BXX3B.js +186 -0
  107. package/dist/chunk-SN4BXX3B.js.map +1 -0
  108. package/dist/chunk-SNVAMWB7.js +40 -0
  109. package/dist/chunk-SNVAMWB7.js.map +1 -0
  110. package/dist/chunk-T5VRREN4.js +696 -0
  111. package/dist/chunk-T5VRREN4.js.map +1 -0
  112. package/dist/chunk-TKBMHZTS.js +10945 -0
  113. package/dist/chunk-TKBMHZTS.js.map +1 -0
  114. package/dist/chunk-TNJPTUE4.js +35 -0
  115. package/dist/chunk-TNJPTUE4.js.map +1 -0
  116. package/dist/chunk-TQ2NA4Z4.js +24 -0
  117. package/dist/chunk-TQ2NA4Z4.js.map +1 -0
  118. package/dist/chunk-TXXDMDPN.js +998 -0
  119. package/dist/chunk-TXXDMDPN.js.map +1 -0
  120. package/dist/chunk-UWXUBU7V.js +184 -0
  121. package/dist/chunk-UWXUBU7V.js.map +1 -0
  122. package/dist/chunk-UYRK2H24.js +141 -0
  123. package/dist/chunk-UYRK2H24.js.map +1 -0
  124. package/dist/chunk-V4IXIM3C.js +806 -0
  125. package/dist/chunk-V4IXIM3C.js.map +1 -0
  126. package/dist/chunk-VFHVXXP4.js +6438 -0
  127. package/dist/chunk-VFHVXXP4.js.map +1 -0
  128. package/dist/chunk-VQVUJYYY.js +244 -0
  129. package/dist/chunk-VQVUJYYY.js.map +1 -0
  130. package/dist/chunk-VZQG2JDV.js +9 -0
  131. package/dist/chunk-VZQG2JDV.js.map +1 -0
  132. package/dist/chunk-W7HQ5X3S.js +610 -0
  133. package/dist/chunk-W7HQ5X3S.js.map +1 -0
  134. package/dist/chunk-WMSQAFK5.js +65 -0
  135. package/dist/chunk-WMSQAFK5.js.map +1 -0
  136. package/dist/chunk-WMYTBJPB.js +364 -0
  137. package/dist/chunk-WMYTBJPB.js.map +1 -0
  138. package/dist/chunk-WNLFNCOH.js +7795 -0
  139. package/dist/chunk-WNLFNCOH.js.map +1 -0
  140. package/dist/chunk-WRX7CB2M.js +6448 -0
  141. package/dist/chunk-WRX7CB2M.js.map +1 -0
  142. package/dist/chunk-XGTTOO4R.js +84 -0
  143. package/dist/chunk-XGTTOO4R.js.map +1 -0
  144. package/dist/chunk-YSXRBUR4.js +682 -0
  145. package/dist/chunk-YSXRBUR4.js.map +1 -0
  146. package/dist/chunk-YTC2EG64.js +1759 -0
  147. package/dist/chunk-YTC2EG64.js.map +1 -0
  148. package/dist/compile-J3UGQSS3.js +161 -0
  149. package/dist/compile-J3UGQSS3.js.map +1 -0
  150. package/dist/config-5BPSZND3.js +438 -0
  151. package/dist/config-5BPSZND3.js.map +1 -0
  152. package/dist/doctor-BVFKLJVO.js +111 -0
  153. package/dist/doctor-BVFKLJVO.js.map +1 -0
  154. package/dist/environment-3RI5H32O.js +2745 -0
  155. package/dist/environment-3RI5H32O.js.map +1 -0
  156. package/dist/github-YFJQVH5K.js +114 -0
  157. package/dist/github-YFJQVH5K.js.map +1 -0
  158. package/dist/harness-ECGHPEKA.js +746 -0
  159. package/dist/harness-ECGHPEKA.js.map +1 -0
  160. package/dist/help-ELPNPPEM.js +2079 -0
  161. package/dist/help-ELPNPPEM.js.map +1 -0
  162. package/dist/help-UL5XLY3I.js +1892 -0
  163. package/dist/help-UL5XLY3I.js.map +1 -0
  164. package/dist/index.d.ts +164 -1
  165. package/dist/index.js +50 -59246
  166. package/dist/index.js.map +1 -1
  167. package/dist/init-UJQTDHW7.js +873 -0
  168. package/dist/init-UJQTDHW7.js.map +1 -0
  169. package/dist/lock-XUMJ63NZ.js +455 -0
  170. package/dist/lock-XUMJ63NZ.js.map +1 -0
  171. package/dist/marketplace-ZUMOLVXE.js +495 -0
  172. package/dist/marketplace-ZUMOLVXE.js.map +1 -0
  173. package/dist/mcp-RZA5O2ND.js +202 -0
  174. package/dist/mcp-RZA5O2ND.js.map +1 -0
  175. package/dist/migrate-CYQI2FH6.js +1043 -0
  176. package/dist/migrate-CYQI2FH6.js.map +1 -0
  177. package/dist/open-AWOAWLKO.js +32 -0
  178. package/dist/open-AWOAWLKO.js.map +1 -0
  179. package/dist/pack-2QD5ZUIO.js +99 -0
  180. package/dist/pack-2QD5ZUIO.js.map +1 -0
  181. package/dist/plugin-GQSSSFX4.js +64 -0
  182. package/dist/plugin-GQSSSFX4.js.map +1 -0
  183. package/dist/plugin-from-project-SIQUFYIO.js +16 -0
  184. package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
  185. package/dist/policy-CT4JRCJI.js +105 -0
  186. package/dist/policy-CT4JRCJI.js.map +1 -0
  187. package/dist/profile-4JQ6LECP.js +1886 -0
  188. package/dist/profile-4JQ6LECP.js.map +1 -0
  189. package/dist/project-JG7QWXRG.js +1392 -0
  190. package/dist/project-JG7QWXRG.js.map +1 -0
  191. package/dist/resource-QRMR6CSD.js +555 -0
  192. package/dist/resource-QRMR6CSD.js.map +1 -0
  193. package/dist/version-LZ5POOXY.js +17 -0
  194. package/dist/version-LZ5POOXY.js.map +1 -0
  195. package/package.json +21 -14
  196. package/schemas/ap-package.v1.json +36 -0
  197. package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
  198. package/schemas/fixtures/confidence.ap.json +13 -0
  199. package/schemas/fixtures/context7.ap.json +13 -0
  200. package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
  201. package/schemas/fixtures/superpowers.ap.json +13 -0
  202. package/schemas/fixtures/third-party-skills.ap.json +13 -0
@@ -0,0 +1,65 @@
1
+ import {
2
+ openPathInSystemEditor,
3
+ resolveOpenableFilesystemPath
4
+ } from "./chunk-PMQ55GDB.js";
5
+ import {
6
+ renderCliError
7
+ } from "./chunk-37LQQWMF.js";
8
+ import {
9
+ initializeSchema
10
+ } from "./chunk-N3WIJXXM.js";
11
+ import {
12
+ COMMAND_HELP_REGISTRY
13
+ } from "./chunk-5TXI6BI2.js";
14
+ import {
15
+ parseOutputFormat,
16
+ printJson
17
+ } from "./chunk-TQ2NA4Z4.js";
18
+ import {
19
+ fail,
20
+ missingRequiredArg
21
+ } from "./chunk-NFYPBTKO.js";
22
+ import {
23
+ ui
24
+ } from "./chunk-ABXUKHAU.js";
25
+ import {
26
+ getDb
27
+ } from "./chunk-KLR2DURP.js";
28
+
29
+ // src/cli/commands/open.ts
30
+ function registerOpenCommand(root) {
31
+ COMMAND_HELP_REGISTRY.open = {
32
+ description: "Open a file or directory in your system editor",
33
+ examples: [
34
+ "open ~/.claude/CLAUDE.md",
35
+ "open .",
36
+ "open --format json ./AGENTS.md"
37
+ ]
38
+ };
39
+ root.command("open").argument("[path]", "File or directory to open").option("--format <mode>", "Output format: human or json", "human").description("Open a file or directory in your system editor").action(async (path, opts) => {
40
+ if (!path?.trim()) {
41
+ process.exitCode = 1;
42
+ renderCliError(missingRequiredArg("path", "open"));
43
+ return;
44
+ }
45
+ const db = getDb();
46
+ initializeSchema(db);
47
+ try {
48
+ const resolvedPath = resolveOpenableFilesystemPath(path);
49
+ openPathInSystemEditor(resolvedPath);
50
+ if (parseOutputFormat(opts.format) === "json") {
51
+ printJson({ path: resolvedPath });
52
+ return;
53
+ }
54
+ ui.success(`Opened ${resolvedPath}`);
55
+ } catch (error) {
56
+ process.exitCode = 1;
57
+ fail(error instanceof Error ? error.message : String(error));
58
+ }
59
+ });
60
+ }
61
+
62
+ export {
63
+ registerOpenCommand
64
+ };
65
+ //# sourceMappingURL=chunk-WMSQAFK5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/commands/open.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { missingRequiredArg } from \"../../services/cli-errors.js\";\nimport {\n COMMAND_HELP_REGISTRY,\n} from \"../../services/cli-help-registry.js\";\nimport * as openPath from \"../../services/open-path.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { fail } from \"../shared.js\";\n\nexport function registerOpenCommand(root: Command): void {\n COMMAND_HELP_REGISTRY.open = {\n description: \"Open a file or directory in your system editor\",\n examples: [\n \"open ~/.claude/CLAUDE.md\",\n \"open .\",\n \"open --format json ./AGENTS.md\",\n ],\n };\n\n root\n .command(\"open\")\n .argument(\"[path]\", \"File or directory to open\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Open a file or directory in your system editor\")\n .action(async (path: string | undefined, opts: { format?: string }) => {\n if (!path?.trim()) {\n process.exitCode = 1;\n renderCliError(missingRequiredArg(\"path\", \"open\"));\n return;\n }\n\n const db = getDb();\n initializeSchema(db);\n\n try {\n const resolvedPath = openPath.resolveOpenableFilesystemPath(path);\n openPath.openPathInSystemEditor(resolvedPath);\n if (parseOutputFormat(opts.format) === \"json\") {\n printJson({ path: resolvedPath });\n return;\n }\n ui.success(`Opened ${resolvedPath}`);\n } catch (error) {\n process.exitCode = 1;\n fail(error instanceof Error ? error.message : String(error));\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaO,SAAS,oBAAoB,MAAqB;AACvD,wBAAsB,OAAO;AAAA,IAC3B,aAAa;AAAA,IACb,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,OACG,QAAQ,MAAM,EACd,SAAS,UAAU,2BAA2B,EAC9C,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,YAAY,gDAAgD,EAC5D,OAAO,OAAO,MAA0B,SAA8B;AACrE,QAAI,CAAC,MAAM,KAAK,GAAG;AACjB,cAAQ,WAAW;AACnB,qBAAe,mBAAmB,QAAQ,MAAM,CAAC;AACjD;AAAA,IACF;AAEA,UAAM,KAAK,MAAM;AACjB,qBAAiB,EAAE;AAEnB,QAAI;AACF,YAAM,eAAwB,8BAA8B,IAAI;AAChE,MAAS,uBAAuB,YAAY;AAC5C,UAAI,kBAAkB,KAAK,MAAM,MAAM,QAAQ;AAC7C,kBAAU,EAAE,MAAM,aAAa,CAAC;AAChC;AAAA,MACF;AACA,SAAG,QAAQ,UAAU,YAAY,EAAE;AAAA,IACrC,SAAS,OAAO;AACd,cAAQ,WAAW;AACnB,WAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,IAC7D;AAAA,EACF,CAAC;AACL;","names":[]}
@@ -0,0 +1,364 @@
1
+ import {
2
+ addApplyCommandOptions,
3
+ explainPayload,
4
+ handleProjectApplyCommand,
5
+ renderExplain,
6
+ splitMcpRegistryIdentity,
7
+ validateApplyOnConflict
8
+ } from "./chunk-VFHVXXP4.js";
9
+ import {
10
+ printApplyPayload,
11
+ promptMaterializationConflict,
12
+ resolveApplyConflictPolicy,
13
+ resolveUserPath
14
+ } from "./chunk-AOUDSNRK.js";
15
+ import {
16
+ applyProfilePlugin,
17
+ useProfileCommand,
18
+ withProfileApplyLock
19
+ } from "./chunk-WNLFNCOH.js";
20
+ import {
21
+ initializeSchema
22
+ } from "./chunk-N3WIJXXM.js";
23
+ import {
24
+ isProfilePlugin
25
+ } from "./chunk-TNJPTUE4.js";
26
+ import {
27
+ APM_MANIFEST_FILENAME,
28
+ parseApmYamlDocument
29
+ } from "./chunk-W7HQ5X3S.js";
30
+ import {
31
+ CriticalUnicodeError
32
+ } from "./chunk-JRFUTIEH.js";
33
+ import {
34
+ parsePlatformFilter,
35
+ resolveRegisteredGlobalApplyHarnesses,
36
+ uniqueHarnessTargets
37
+ } from "./chunk-PFUK3HJ4.js";
38
+ import {
39
+ collectApmAndDevDependencies
40
+ } from "./chunk-DEJLP7QJ.js";
41
+ import {
42
+ getPlatform,
43
+ resolveHomeRoot,
44
+ resolvePluginSelector
45
+ } from "./chunk-TKBMHZTS.js";
46
+ import {
47
+ trackPluginApplied
48
+ } from "./chunk-NPO2IG6G.js";
49
+ import {
50
+ parseOutputFormat,
51
+ printJson
52
+ } from "./chunk-TQ2NA4Z4.js";
53
+ import {
54
+ CliUsageError,
55
+ fail,
56
+ formatCommand
57
+ } from "./chunk-NFYPBTKO.js";
58
+ import {
59
+ ui
60
+ } from "./chunk-ABXUKHAU.js";
61
+ import {
62
+ CLI_HINTS,
63
+ getDb
64
+ } from "./chunk-KLR2DURP.js";
65
+
66
+ // src/services/apply-scope.ts
67
+ function resolveApplyScope(input) {
68
+ if (input.global) {
69
+ const home = resolveHomeRoot();
70
+ const paths = input.platforms.map((id) => getPlatform(id)).filter((platform) => platform != null).map((platform) => topLevelGlobalPath(platform.globalPaths)).filter((path, index, all) => path !== "" && all.indexOf(path) === index);
71
+ return {
72
+ scope: "global",
73
+ root: home,
74
+ destinationLine: `\u2192 machine home ${paths.map((p) => `~/${p}`).join(", ")}`.trimEnd()
75
+ };
76
+ }
77
+ const root = resolveUserPath(input.project ?? ".", { mustExist: true });
78
+ return { scope: "project", root, destinationLine: `\u2192 project ${root}` };
79
+ }
80
+ function topLevelGlobalPath(paths) {
81
+ for (const value of Object.values(paths)) {
82
+ if (typeof value !== "string" || !value) continue;
83
+ const normalized = value.replace(/^~\//, "");
84
+ const segment = normalized.split("/")[0];
85
+ if (segment && segment.startsWith(".")) return segment;
86
+ }
87
+ return "";
88
+ }
89
+ function printDestination(resolved) {
90
+ console.log(ui.theme.muted(resolved.destinationLine));
91
+ }
92
+
93
+ // src/services/apm-mcp-manifest.ts
94
+ import { existsSync, readFileSync, writeFileSync } from "fs";
95
+ import { join } from "path";
96
+ import { stringify as stringifyYaml } from "yaml";
97
+ function isRecord(value) {
98
+ return value !== null && typeof value === "object" && !Array.isArray(value);
99
+ }
100
+ function apmManifestPath(projectRoot) {
101
+ return join(projectRoot, APM_MANIFEST_FILENAME);
102
+ }
103
+ function manifestHasMcpRegistryId(raw, registryId) {
104
+ const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);
105
+ const { name } = splitMcpRegistryIdentity(registryId);
106
+ const deps = collectApmAndDevDependencies(document);
107
+ return deps.mcp.some((entry) => {
108
+ if (entry.registryId === registryId || entry.registryId === name) {
109
+ return true;
110
+ }
111
+ return entry.raw === registryId || entry.raw === name;
112
+ });
113
+ }
114
+ function appendMcpRegistryIdToManifest(raw, registryId) {
115
+ if (manifestHasMcpRegistryId(raw, registryId)) {
116
+ return { next: raw, added: false };
117
+ }
118
+ const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);
119
+ const dependencies = isRecord(document.dependencies) ? { ...document.dependencies } : {};
120
+ const existing = dependencies.mcp;
121
+ const mcp = Array.isArray(existing) ? [...existing, registryId] : [registryId];
122
+ document.dependencies = { ...dependencies, mcp };
123
+ return {
124
+ next: stringifyYaml(document, {
125
+ indent: 2,
126
+ lineWidth: 0,
127
+ defaultKeyType: "PLAIN"
128
+ }),
129
+ added: true
130
+ };
131
+ }
132
+ async function withMcpManifestAppend(options) {
133
+ const path = apmManifestPath(options.projectRoot);
134
+ if (!existsSync(path)) {
135
+ throw new Error(
136
+ `No ${APM_MANIFEST_FILENAME} found under ${options.projectRoot}. Run ht config init first.`
137
+ );
138
+ }
139
+ const previous = readFileSync(path, "utf8");
140
+ const { next, added } = appendMcpRegistryIdToManifest(previous, options.registryId);
141
+ if (added) {
142
+ writeFileSync(path, next, "utf8");
143
+ }
144
+ const restore = () => {
145
+ if (added) {
146
+ writeFileSync(path, previous, "utf8");
147
+ }
148
+ };
149
+ try {
150
+ await options.run();
151
+ if ((process.exitCode ?? 0) !== 0 || options.dryRun) {
152
+ restore();
153
+ }
154
+ return { added };
155
+ } catch (error) {
156
+ restore();
157
+ throw error;
158
+ }
159
+ }
160
+
161
+ // src/cli/commands/apply.ts
162
+ function resolveDestinationPlatforms(harnessOption, forGlobal) {
163
+ if (forGlobal) {
164
+ return resolveRegisteredGlobalApplyHarnesses(harnessOption);
165
+ }
166
+ return uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);
167
+ }
168
+ async function handleGlobalApplyCommand(plugins, opts) {
169
+ const conflictError = validateApplyOnConflict(opts.onConflict);
170
+ if (conflictError) {
171
+ fail(conflictError);
172
+ return;
173
+ }
174
+ const db = getDb();
175
+ initializeSchema(db);
176
+ const outputFormat = parseOutputFormat(opts.format);
177
+ if (plugins.length === 0) {
178
+ process.exitCode = 1;
179
+ fail("Provide exactly one plugin name for --global apply.", {
180
+ hints: [formatCommand("apply <plugin> --global")]
181
+ });
182
+ return;
183
+ }
184
+ if (plugins.length > 1) {
185
+ process.exitCode = 1;
186
+ fail("Global apply accepts exactly one plugin.", {
187
+ hints: [formatCommand("apply <plugin> --global")]
188
+ });
189
+ return;
190
+ }
191
+ const selector = plugins[0];
192
+ if (!selector) {
193
+ process.exitCode = 1;
194
+ fail("Provide exactly one plugin name for --global apply.");
195
+ return;
196
+ }
197
+ const plugin = resolvePluginSelector(selector);
198
+ if (!plugin) {
199
+ process.exitCode = 1;
200
+ fail(`Plugin not found: ${selector}`);
201
+ return;
202
+ }
203
+ const conflictPolicy = resolveApplyConflictPolicy({
204
+ onConflict: opts.onConflict,
205
+ noInteractive: opts.noInteractive ?? outputFormat === "json"
206
+ });
207
+ const applyOptions = {
208
+ dryRun: opts.dryRun,
209
+ harness: opts.harness,
210
+ account: opts.account,
211
+ baseUrl: opts.baseUrl,
212
+ conflictPolicy,
213
+ ...conflictPolicy === "prompt" ? { conflictResolver: promptMaterializationConflict } : {},
214
+ ...opts.force ? { forceUnicode: true } : {}
215
+ };
216
+ try {
217
+ const recordActiveProfile = isProfilePlugin(plugin);
218
+ const payload = recordActiveProfile ? await useProfileCommand(selector, applyOptions) : await withProfileApplyLock(
219
+ () => applyProfilePlugin(selector, {
220
+ ...applyOptions,
221
+ recordActiveProfile: false
222
+ })
223
+ );
224
+ if (!recordActiveProfile && !payload.cancelled) {
225
+ console.warn(
226
+ ui.theme.warn(
227
+ `Applied to machine home, but no active profile was recorded because ${plugin.name} is not a profile plugin.`
228
+ )
229
+ );
230
+ }
231
+ if (!payload.cancelled && !payload.dry_run) {
232
+ trackPluginApplied({
233
+ pluginSlug: plugin.name,
234
+ harness: payload.harnesses[0]
235
+ });
236
+ }
237
+ if (outputFormat === "json") {
238
+ const { resolution, ...rest } = payload;
239
+ printJson({
240
+ scope: "global",
241
+ ...rest,
242
+ ...opts.explain && resolution ? { explain: explainPayload(resolution) } : {}
243
+ });
244
+ return;
245
+ }
246
+ if (payload.cancelled) {
247
+ fail("Apply cancelled due to file conflicts.", {
248
+ hint: CLI_HINTS.onConflictReplace
249
+ });
250
+ return;
251
+ }
252
+ if (opts.explain && payload.resolution) {
253
+ console.log(renderExplain(payload.resolution));
254
+ console.log("");
255
+ }
256
+ printApplyPayload(payload);
257
+ } catch (err) {
258
+ process.exitCode = 1;
259
+ if (err instanceof CriticalUnicodeError) {
260
+ fail(err.message, {
261
+ hints: [formatCommand("apply --global --force")]
262
+ });
263
+ return;
264
+ }
265
+ fail(err instanceof Error ? err.message : String(err));
266
+ }
267
+ }
268
+ async function handleApplyCommand(plugins, opts) {
269
+ const conflictError = validateApplyOnConflict(opts.onConflict);
270
+ if (conflictError) {
271
+ fail(conflictError);
272
+ return;
273
+ }
274
+ const outputFormat = parseOutputFormat(opts.format);
275
+ let platforms;
276
+ let resolved;
277
+ try {
278
+ platforms = resolveDestinationPlatforms(opts.harness, Boolean(opts.global));
279
+ resolved = resolveApplyScope({
280
+ global: opts.global,
281
+ project: opts.project,
282
+ platforms
283
+ });
284
+ } catch (error) {
285
+ if (error instanceof CliUsageError) {
286
+ fail(error.message, { hints: error.hints });
287
+ return;
288
+ }
289
+ fail(error instanceof Error ? error.message : String(error));
290
+ return;
291
+ }
292
+ if (outputFormat === "human") {
293
+ printDestination(resolved);
294
+ }
295
+ if (resolved.scope === "global") {
296
+ await handleGlobalApplyCommand(plugins, opts);
297
+ return;
298
+ }
299
+ await handleProjectApplyCommand(
300
+ plugins,
301
+ opts
302
+ );
303
+ }
304
+ function registerApplyCommand(root) {
305
+ const apply = root.command("apply").argument("[plugins...]", "Plugins to apply").option("--global", "Materialize into machine home instead of the project").description("Resolve a plugin's dependency graph and materialize it");
306
+ addApplyCommandOptions(apply);
307
+ apply.action(async (plugins, opts) => {
308
+ await handleApplyCommand(plugins, opts);
309
+ });
310
+ }
311
+ async function handleInstallCommand(extraArgs, opts) {
312
+ if (extraArgs.length > 0) {
313
+ process.exitCode = 1;
314
+ fail(
315
+ "ht install does not take a plugin selector. It reads repo-root apm.yml.",
316
+ {
317
+ hints: [formatCommand("install"), formatCommand("apply <plugin>")]
318
+ }
319
+ );
320
+ return;
321
+ }
322
+ const registryId = opts.mcp?.trim();
323
+ if (registryId) {
324
+ try {
325
+ const result = await withMcpManifestAppend({
326
+ projectRoot: resolveUserPath(opts.project, { mustExist: true }),
327
+ registryId,
328
+ dryRun: opts.dryRun,
329
+ run: () => handleApplyCommand([], opts)
330
+ });
331
+ if (opts.dryRun && result.added) {
332
+ ui.info(`Would add "${registryId}" to apm.yml dependencies.mcp.`);
333
+ } else if (result.added && (process.exitCode ?? 0) === 0) {
334
+ ui.info(`Added "${registryId}" to apm.yml dependencies.mcp.`);
335
+ }
336
+ } catch (error) {
337
+ process.exitCode = 1;
338
+ fail(error instanceof Error ? error.message : String(error));
339
+ }
340
+ return;
341
+ }
342
+ await handleApplyCommand([], opts);
343
+ }
344
+ function registerInstallCommand(root) {
345
+ const install = root.command("install").description(
346
+ "Onboard a project from apm.yml (same as apply with no plugin selector)"
347
+ ).allowExcessArguments(true);
348
+ addApplyCommandOptions(install);
349
+ install.option(
350
+ "--mcp <id>",
351
+ "Append an MCP Registry v0.1 identity to apm.yml dependencies.mcp, then install"
352
+ );
353
+ install.action(async (opts) => {
354
+ await handleInstallCommand(install.args, opts);
355
+ });
356
+ }
357
+
358
+ export {
359
+ handleApplyCommand,
360
+ registerApplyCommand,
361
+ handleInstallCommand,
362
+ registerInstallCommand
363
+ };
364
+ //# sourceMappingURL=chunk-WMYTBJPB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/services/apply-scope.ts","../src/services/apm-mcp-manifest.ts","../src/cli/commands/apply.ts"],"sourcesContent":["import type { PlatformPaths } from \"../types.js\";\nimport { getPlatform } from \"../platforms/registry.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { resolveUserPath } from \"../utils/user-path.js\";\nimport { ui } from \"../ui/index.js\";\n\nexport type ApplyScope = \"project\" | \"global\";\n\nexport interface ResolvedApplyScope {\n scope: ApplyScope;\n /** Project root for `project`, home root for `global`. */\n root: string;\n /** First line of output, printed in TTY and non-TTY runs alike. */\n destinationLine: string;\n}\n\nexport function resolveApplyScope(input: {\n global?: boolean;\n project?: string;\n platforms: string[];\n}): ResolvedApplyScope {\n if (input.global) {\n const home = resolveHomeRoot();\n const paths = input.platforms\n .map((id) => getPlatform(id))\n .filter((platform): platform is NonNullable<typeof platform> => platform != null)\n .map((platform) => topLevelGlobalPath(platform.globalPaths))\n .filter((path, index, all) => path !== \"\" && all.indexOf(path) === index);\n return {\n scope: \"global\",\n root: home,\n destinationLine: `→ machine home ${paths.map((p) => `~/${p}`).join(\", \")}`.trimEnd(),\n };\n }\n const root = resolveUserPath(input.project ?? \".\", { mustExist: true });\n return { scope: \"project\", root, destinationLine: `→ project ${root}` };\n}\n\nfunction topLevelGlobalPath(paths: PlatformPaths): string {\n for (const value of Object.values(paths)) {\n if (typeof value !== \"string\" || !value) continue;\n const normalized = value.replace(/^~\\//, \"\");\n const segment = normalized.split(\"/\")[0];\n if (segment && segment.startsWith(\".\")) return segment;\n }\n return \"\";\n}\n\nexport function printDestination(resolved: ResolvedApplyScope): void {\n console.log(ui.theme.muted(resolved.destinationLine));\n}\n","import { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { stringify as stringifyYaml } from \"yaml\";\nimport { APM_MANIFEST_FILENAME, parseApmYamlDocument } from \"./apm-manifest.js\";\nimport { collectApmAndDevDependencies } from \"./apm-dependencies.js\";\nimport { splitMcpRegistryIdentity } from \"./mcp-registry.js\";\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nexport function apmManifestPath(projectRoot: string): string {\n return join(projectRoot, APM_MANIFEST_FILENAME);\n}\n\nexport function manifestHasMcpRegistryId(raw: string, registryId: string): boolean {\n const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);\n const { name } = splitMcpRegistryIdentity(registryId);\n const deps = collectApmAndDevDependencies(document);\n return deps.mcp.some((entry) => {\n if (entry.registryId === registryId || entry.registryId === name) {\n return true;\n }\n return entry.raw === registryId || entry.raw === name;\n });\n}\n\nexport function appendMcpRegistryIdToManifest(\n raw: string,\n registryId: string,\n): { next: string; added: boolean } {\n if (manifestHasMcpRegistryId(raw, registryId)) {\n return { next: raw, added: false };\n }\n const document = parseApmYamlDocument(raw, APM_MANIFEST_FILENAME);\n const dependencies = isRecord(document.dependencies) ? { ...document.dependencies } : {};\n const existing = dependencies.mcp;\n const mcp = Array.isArray(existing) ? [...existing, registryId] : [registryId];\n document.dependencies = { ...dependencies, mcp };\n return {\n next: stringifyYaml(document, {\n indent: 2,\n lineWidth: 0,\n defaultKeyType: \"PLAIN\",\n }),\n added: true,\n };\n}\n\nexport async function withMcpManifestAppend(options: {\n projectRoot: string;\n registryId: string;\n dryRun?: boolean;\n run: () => Promise<void>;\n}): Promise<{ added: boolean }> {\n const path = apmManifestPath(options.projectRoot);\n if (!existsSync(path)) {\n throw new Error(\n `No ${APM_MANIFEST_FILENAME} found under ${options.projectRoot}. Run ht config init first.`,\n );\n }\n const previous = readFileSync(path, \"utf8\");\n const { next, added } = appendMcpRegistryIdToManifest(previous, options.registryId);\n if (added) {\n writeFileSync(path, next, \"utf8\");\n }\n const restore = (): void => {\n if (added) {\n writeFileSync(path, previous, \"utf8\");\n }\n };\n try {\n await options.run();\n if ((process.exitCode ?? 0) !== 0 || options.dryRun) {\n restore();\n }\n return { added };\n } catch (error) {\n restore();\n throw error;\n }\n}\n","import type { Command } from \"commander\";\nimport { resolveUserPath } from \"../../utils/user-path.js\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { isProfilePlugin } from \"../../constants/profile.js\";\nimport { resolvePluginSelector } from \"../../models/plugin-model.js\";\nimport {\n addApplyCommandOptions,\n validateApplyOnConflict,\n type ApplyCommandOpts,\n} from \"../../services/apply-command-options.js\";\nimport {\n printDestination,\n resolveApplyScope,\n} from \"../../services/apply-scope.js\";\nimport {\n parsePlatformFilter,\n resolveRegisteredGlobalApplyHarnesses,\n uniqueHarnessTargets,\n} from \"../../services/harness-targets.js\";\nimport { resolveApplyConflictPolicy, promptMaterializationConflict } from \"../../services/materialization-conflicts.js\";\nimport { applyProfilePlugin } from \"../../services/profile-apply.js\";\nimport { withProfileApplyLock } from \"../../services/profile-apply-lock.js\";\nimport { useProfileCommand } from \"../../services/profile-commands.js\";\nimport { CliUsageError } from \"../../services/cli-errors.js\";\nimport { explainPayload, renderExplain } from \"../../services/resolve/explain.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { CLI_HINTS } from \"../messages.js\";\nimport {\n fail,\n formatCommand,\n} from \"../shared.js\";\nimport { printApplyPayload } from \"../print-apply-summary.js\";\nimport { trackPluginApplied } from \"../../telemetry/index.js\";\nimport { CriticalUnicodeError } from \"../../services/unicode-scan.js\";\nimport { handleProjectApplyCommand } from \"./plugin.js\";\nimport { withMcpManifestAppend } from \"../../services/apm-mcp-manifest.js\";\n\nexport type ApplyCommandActionOpts = ApplyCommandOpts & {\n global?: boolean;\n};\n\nexport type InstallCommandActionOpts = ApplyCommandActionOpts & {\n mcp?: string;\n};\n\nfunction resolveDestinationPlatforms(\n harnessOption: string | undefined,\n forGlobal: boolean,\n): string[] {\n if (forGlobal) {\n return resolveRegisteredGlobalApplyHarnesses(harnessOption);\n }\n return uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n}\n\nasync function handleGlobalApplyCommand(\n plugins: string[],\n opts: ApplyCommandActionOpts,\n): Promise<void> {\n const conflictError = validateApplyOnConflict(opts.onConflict);\n if (conflictError) {\n fail(conflictError);\n return;\n }\n\n const db = getDb();\n initializeSchema(db);\n\n const outputFormat = parseOutputFormat(opts.format);\n if (plugins.length === 0) {\n process.exitCode = 1;\n fail(\"Provide exactly one plugin name for --global apply.\", {\n hints: [formatCommand(\"apply <plugin> --global\")],\n });\n return;\n }\n if (plugins.length > 1) {\n process.exitCode = 1;\n fail(\"Global apply accepts exactly one plugin.\", {\n hints: [formatCommand(\"apply <plugin> --global\")],\n });\n return;\n }\n\n const selector = plugins[0];\n if (!selector) {\n process.exitCode = 1;\n fail(\"Provide exactly one plugin name for --global apply.\");\n return;\n }\n\n const plugin = resolvePluginSelector(selector);\n if (!plugin) {\n process.exitCode = 1;\n fail(`Plugin not found: ${selector}`);\n return;\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? outputFormat === \"json\",\n });\n const applyOptions = {\n dryRun: opts.dryRun,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n ...(opts.force ? { forceUnicode: true } : {}),\n };\n\n try {\n const recordActiveProfile = isProfilePlugin(plugin);\n const payload = recordActiveProfile\n ? await useProfileCommand(selector, applyOptions)\n : await withProfileApplyLock(() =>\n applyProfilePlugin(selector, {\n ...applyOptions,\n recordActiveProfile: false,\n }),\n );\n\n if (!recordActiveProfile && !payload.cancelled) {\n console.warn(\n ui.theme.warn(\n `Applied to machine home, but no active profile was recorded because ${plugin.name} is not a profile plugin.`,\n ),\n );\n }\n\n if (!payload.cancelled && !payload.dry_run) {\n trackPluginApplied({\n pluginSlug: plugin.name,\n harness: payload.harnesses[0],\n });\n }\n\n if (outputFormat === \"json\") {\n const { resolution, ...rest } = payload;\n printJson({\n scope: \"global\",\n ...rest,\n ...(opts.explain && resolution ? { explain: explainPayload(resolution) } : {}),\n });\n return;\n }\n\n if (payload.cancelled) {\n fail(\"Apply cancelled due to file conflicts.\", {\n hint: CLI_HINTS.onConflictReplace,\n });\n return;\n }\n\n if (opts.explain && payload.resolution) {\n console.log(renderExplain(payload.resolution));\n console.log(\"\");\n }\n printApplyPayload(payload);\n } catch (err) {\n process.exitCode = 1;\n if (err instanceof CriticalUnicodeError) {\n fail(err.message, {\n hints: [formatCommand(\"apply --global --force\")],\n });\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n}\n\nexport async function handleApplyCommand(\n plugins: string[],\n opts: ApplyCommandActionOpts,\n): Promise<void> {\n const conflictError = validateApplyOnConflict(opts.onConflict);\n if (conflictError) {\n fail(conflictError);\n return;\n }\n\n const outputFormat = parseOutputFormat(opts.format);\n let platforms: string[];\n let resolved: ReturnType<typeof resolveApplyScope>;\n try {\n platforms = resolveDestinationPlatforms(opts.harness, Boolean(opts.global));\n resolved = resolveApplyScope({\n global: opts.global,\n project: opts.project,\n platforms,\n });\n } catch (error) {\n if (error instanceof CliUsageError) {\n fail(error.message, { hints: error.hints });\n return;\n }\n fail(error instanceof Error ? error.message : String(error));\n return;\n }\n\n if (outputFormat === \"human\") {\n printDestination(resolved);\n }\n\n if (resolved.scope === \"global\") {\n await handleGlobalApplyCommand(plugins, opts);\n return;\n }\n\n await handleProjectApplyCommand(\n plugins as [string, ...string[]] | [],\n opts,\n );\n}\n\nexport function registerApplyCommand(root: Command): void {\n const apply = root\n .command(\"apply\")\n .argument(\"[plugins...]\", \"Plugins to apply\")\n .option(\"--global\", \"Materialize into machine home instead of the project\")\n .description(\"Resolve a plugin's dependency graph and materialize it\");\n addApplyCommandOptions(apply);\n apply.action(async (plugins: string[], opts: ApplyCommandActionOpts) => {\n await handleApplyCommand(plugins, opts);\n });\n}\n\nexport async function handleInstallCommand(\n extraArgs: string[],\n opts: InstallCommandActionOpts,\n): Promise<void> {\n if (extraArgs.length > 0) {\n process.exitCode = 1;\n fail(\n \"ht install does not take a plugin selector. It reads repo-root apm.yml.\",\n {\n hints: [formatCommand(\"install\"), formatCommand(\"apply <plugin>\")],\n },\n );\n return;\n }\n\n const registryId = opts.mcp?.trim();\n if (registryId) {\n try {\n const result = await withMcpManifestAppend({\n projectRoot: resolveUserPath(opts.project, { mustExist: true }),\n registryId,\n dryRun: opts.dryRun,\n run: () => handleApplyCommand([], opts),\n });\n if (opts.dryRun && result.added) {\n ui.info(`Would add \"${registryId}\" to apm.yml dependencies.mcp.`);\n } else if (result.added && (process.exitCode ?? 0) === 0) {\n ui.info(`Added \"${registryId}\" to apm.yml dependencies.mcp.`);\n }\n } catch (error) {\n process.exitCode = 1;\n fail(error instanceof Error ? error.message : String(error));\n }\n return;\n }\n\n await handleApplyCommand([], opts);\n}\n\nexport function registerInstallCommand(root: Command): void {\n const install = root\n .command(\"install\")\n .description(\n \"Onboard a project from apm.yml (same as apply with no plugin selector)\",\n )\n .allowExcessArguments(true);\n addApplyCommandOptions(install);\n install.option(\n \"--mcp <id>\",\n \"Append an MCP Registry v0.1 identity to apm.yml dependencies.mcp, then install\",\n );\n install.action(async (opts: InstallCommandActionOpts) => {\n await handleInstallCommand(install.args, opts);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,SAAS,kBAAkB,OAIX;AACrB,MAAI,MAAM,QAAQ;AAChB,UAAM,OAAO,gBAAgB;AAC7B,UAAM,QAAQ,MAAM,UACjB,IAAI,CAAC,OAAO,YAAY,EAAE,CAAC,EAC3B,OAAO,CAAC,aAAuD,YAAY,IAAI,EAC/E,IAAI,CAAC,aAAa,mBAAmB,SAAS,WAAW,CAAC,EAC1D,OAAO,CAAC,MAAM,OAAO,QAAQ,SAAS,MAAM,IAAI,QAAQ,IAAI,MAAM,KAAK;AAC1E,WAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,MACN,iBAAiB,uBAAkB,MAAM,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,EAAE,KAAK,IAAI,C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