apphx 2.0.0 → 2.1.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 (51) hide show
  1. package/README.md +11 -9
  2. package/dist/cli.js +41 -11
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config.js +4 -2
  5. package/dist/config.js.map +1 -1
  6. package/dist/integrations.js +177 -91
  7. package/dist/integrations.js.map +1 -1
  8. package/dist/notify.js +267 -0
  9. package/dist/notify.js.map +1 -0
  10. package/dist/policy.js +3 -16
  11. package/dist/policy.js.map +1 -1
  12. package/dist/runner.js +119 -20
  13. package/dist/runner.js.map +1 -1
  14. package/dist/schemas.js +57 -2
  15. package/dist/schemas.js.map +1 -1
  16. package/dist/vendor/obfuscator/dist/config.js +119 -6
  17. package/dist/vendor/obfuscator/dist/config.js.map +1 -1
  18. package/dist/vendor/obfuscator/dist/dfa.js +528 -0
  19. package/dist/vendor/obfuscator/dist/dfa.js.map +1 -0
  20. package/dist/vendor/obfuscator/dist/flutter.js +3266 -0
  21. package/dist/vendor/obfuscator/dist/flutter.js.map +1 -0
  22. package/dist/vendor/obfuscator/dist/image-utils.js +335 -0
  23. package/dist/vendor/obfuscator/dist/image-utils.js.map +1 -0
  24. package/dist/vendor/obfuscator/dist/junk.js +1501 -0
  25. package/dist/vendor/obfuscator/dist/junk.js.map +1 -0
  26. package/dist/vendor/obfuscator/dist/lexicon-data.js +972 -0
  27. package/dist/vendor/obfuscator/dist/lexicon-data.js.map +1 -0
  28. package/dist/vendor/obfuscator/dist/obfuscate.js +51 -2
  29. package/dist/vendor/obfuscator/dist/obfuscate.js.map +1 -1
  30. package/dist/vendor/obfuscator/dist/objc-symbols.js +1819 -0
  31. package/dist/vendor/obfuscator/dist/objc-symbols.js.map +1 -0
  32. package/dist/vendor/obfuscator/dist/project-identity.js +852 -0
  33. package/dist/vendor/obfuscator/dist/project-identity.js.map +1 -0
  34. package/dist/vendor/obfuscator/dist/string-encrypt.js +330 -0
  35. package/dist/vendor/obfuscator/dist/string-encrypt.js.map +1 -0
  36. package/examples/android-java.factory.json +40 -5
  37. package/examples/expo.factory.json +68 -5
  38. package/examples/flutter.factory.json +40 -4
  39. package/examples/luggage.json +1 -0
  40. package/examples/multi-role-agents.md +129 -0
  41. package/examples/mygo.factory.json +54 -4
  42. package/examples/queue-loop-demo.md +146 -0
  43. package/examples/react-native.factory.json +58 -5
  44. package/examples/roles.example.json +31 -0
  45. package/examples/swift.factory.json +60 -5
  46. package/examples/uni-app.factory.json +58 -5
  47. package/package.json +1 -1
  48. package/skills/apphx/SKILL.md +39 -4
  49. package/skills/apphx/resources/requirement.json +1 -0
  50. package/skills/apphx-obfuscator/LICENSE +21 -0
  51. package/skills/apphx-obfuscator/SKILL.md +72 -0
@@ -5,10 +5,13 @@ import { homedir } from "node:os";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import { createHash } from "node:crypto";
7
7
  // src/integrations.ts
8
- const skill = "apphx";
8
+ const skills = ["apphx", "apphx-obfuscator"];
9
9
  const marker = ".apphx-install.json";
10
10
  const owner = "apphx";
11
- const bundledDirectory = fileURLToPath(new URL("../skills/apphx/", import.meta.url));
11
+ const bundledDirectories = {
12
+ apphx: fileURLToPath(new URL("../skills/apphx/", import.meta.url)),
13
+ "apphx-obfuscator": fileURLToPath(new URL("../skills/apphx-obfuscator/", import.meta.url))
14
+ };
12
15
  const packageFile = fileURLToPath(new URL("../package.json", import.meta.url));
13
16
  const hosts = Object.freeze([
14
17
  {
@@ -18,7 +21,9 @@ const hosts = Object.freeze([
18
21
  projectDirectory: ".agents/skills",
19
22
  globalDirectory: "~/.agents/skills",
20
23
  source: "https://developers.openai.com/codex/skills",
21
- instructions: "Use $apphx in Codex CLI or the IDE extension; /skills lists skills. Restart if discovery has not refreshed."
24
+ instructions: "Use $apphx in Codex CLI or the IDE extension; /skills lists skills. Restart if discovery has not refreshed.",
25
+ delegation: "Native subagents/agents exist: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.",
26
+ obfuscatorInvocation: "$apphx-obfuscator"
22
27
  },
23
28
  {
24
29
  id: "claude",
@@ -27,7 +32,9 @@ const hosts = Object.freeze([
27
32
  projectDirectory: ".claude/skills",
28
33
  globalDirectory: "$CLAUDE_CONFIG_DIR/skills (default ~/.claude/skills)",
29
34
  source: "https://code.claude.com/docs/en/skills",
30
- instructions: "Use /apphx in a local Claude Code session. Start a new session if the skill is not listed. Cloud sessions do not inherit local user skills."
35
+ instructions: "Use /apphx in a local Claude Code session. Start a new session if the skill is not listed. Cloud sessions do not inherit local user skills.",
36
+ delegation: "Native subagents exist: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.",
37
+ obfuscatorInvocation: "/apphx-obfuscator"
31
38
  },
32
39
  {
33
40
  id: "cursor",
@@ -36,7 +43,9 @@ const hosts = Object.freeze([
36
43
  projectDirectory: ".cursor/skills",
37
44
  globalDirectory: "~/.cursor/skills",
38
45
  source: "https://cursor.com/docs/skills",
39
- instructions: "In Agent chat, type / and select apphx. Restart or reopen the project if necessary. Global installation is local, not a Cloud Agent sync."
46
+ instructions: "In Agent chat, type / and select apphx. Restart or reopen the project if necessary. Global installation is local, not a Cloud Agent sync.",
47
+ delegation: "Multi-agent support varies by version: fall back to separate fresh sessions per role when subagents are unavailable.",
48
+ obfuscatorInvocation: "/apphx-obfuscator"
40
49
  },
41
50
  {
42
51
  id: "pi",
@@ -45,7 +54,9 @@ const hosts = Object.freeze([
45
54
  projectDirectory: ".pi/skills",
46
55
  globalDirectory: "$PI_CODING_AGENT_DIR/skills (default ~/.pi/agent/skills)",
47
56
  source: "https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/skills.md",
48
- instructions: "Grant project trust before using project skills, then /reload and /skill:apphx. Stock Pi has no native subagents: use a separate human-started reviewer session, not a spawned coding-agent CLI."
57
+ instructions: "Grant project trust before using project skills, then /reload and /skill:apphx. Stock Pi has no native subagents: use a separate human-started reviewer session, not a spawned coding-agent CLI.",
58
+ delegation: "Stock Pi has no native subagents: run each role in its own human-started fresh session.",
59
+ obfuscatorInvocation: "/skill:apphx-obfuscator"
49
60
  },
50
61
  {
51
62
  id: "gemini",
@@ -54,7 +65,9 @@ const hosts = Object.freeze([
54
65
  projectDirectory: ".gemini/skills",
55
66
  globalDirectory: "$GEMINI_CLI_HOME/.gemini/skills (default ~/.gemini/skills)",
56
67
  source: "https://geminicli.com/docs/cli/skills/",
57
- instructions: "Run /skills reload and /skills list, then ask: Use the apphx skill. Gemini calls activate_skill; approve its consent prompt. This is not a /apphx command."
68
+ instructions: "Run /skills reload and /skills list, then ask: Use the apphx skill. Gemini calls activate_skill; approve its consent prompt. This is not a /apphx command.",
69
+ delegation: "No native subagent delegation documented: run roles sequentially in fresh sessions.",
70
+ obfuscatorInvocation: "Use the apphx-obfuscator skill"
58
71
  },
59
72
  {
60
73
  id: "opencode",
@@ -63,7 +76,9 @@ const hosts = Object.freeze([
63
76
  projectDirectory: ".opencode/skills",
64
77
  globalDirectory: "$XDG_CONFIG_HOME/opencode/skills (default ~/.config/opencode/skills)",
65
78
  source: "https://opencode.ai/docs/skills/",
66
- instructions: "Ask OpenCode to use apphx; the agent loads it with its native skill({ name: \"apphx\" }) tool. Skill permissions must permit loading. Restart if necessary; no custom slash command is installed."
79
+ instructions: "Ask OpenCode to use apphx; the agent loads it with its native skill({ name: \"apphx\" }) tool. Skill permissions must permit loading. Restart if necessary; no custom slash command is installed.",
80
+ delegation: "Subagent support varies by version: fall back to separate fresh sessions per role when subagents are unavailable.",
81
+ obfuscatorInvocation: "Use the apphx-obfuscator skill"
67
82
  },
68
83
  {
69
84
  id: "deepseek",
@@ -72,7 +87,9 @@ const hosts = Object.freeze([
72
87
  projectDirectory: ".dsh/skills (nearest Git root, otherwise selected project)",
73
88
  globalDirectory: "$DSH_HOME/skills (default ~/.dsh/skills)",
74
89
  source: "https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/skills",
75
- instructions: "Ask DeepSeek Harness to use apphx; its native skill({ name: \"apphx\" }) tool loads it. Requires the shipped filesystem skill provider and skill tool, with default roots enabled. Custom provider configurations are not modified."
90
+ instructions: "Ask DeepSeek Harness to use apphx; its native skill({ name: \"apphx\" }) tool loads it. Requires the shipped filesystem skill provider and skill tool, with default roots enabled. Custom provider configurations are not modified.",
91
+ delegation: "The harness supports delegated agents; verify your provider exposes them, else use fresh sessions per role.",
92
+ obfuscatorInvocation: "Use the apphx-obfuscator skill"
76
93
  },
77
94
  {
78
95
  id: "hermes",
@@ -81,7 +98,42 @@ const hosts = Object.freeze([
81
98
  projectDirectory: ".hermes/skills",
82
99
  globalDirectory: "$HERMES_HOME/skills (default ~/.hermes/skills)",
83
100
  source: "https://hermes-agent.nousresearch.com/docs/user-guide/features/skills",
84
- instructions: "Use /apphx. Project installation requires a Git root and a separate owner-approved hermes skills trust decision; this installer never grants trust. For non-Git projects or profile-wide cron use --global in the same HERMES_HOME as Hermes. Confirm discovery with hermes skills list; cron must attach the skill and an absolute workdir."
101
+ instructions: "Use /apphx. Project installation requires a Git root and a separate owner-approved hermes skills trust decision; this installer never grants trust. For non-Git projects or profile-wide cron use --global in the same HERMES_HOME as Hermes. Confirm discovery with hermes skills list; cron must attach the skill and an absolute workdir.",
102
+ delegation: "Native subagents and cron exist: run design and review roles as parallel or serial fresh contexts; the scheduler handles unattended wakes. Verify against your installed host version.",
103
+ obfuscatorInvocation: "/apphx-obfuscator"
104
+ },
105
+ {
106
+ id: "qoder",
107
+ name: "Qoder",
108
+ invocation: "/apphx",
109
+ projectDirectory: ".qoder/skills",
110
+ globalDirectory: "~/.qoder/skills",
111
+ source: "https://docs.qoder.com/cli/Skills",
112
+ instructions: "Use /apphx manually or let the model auto-trigger the skill. Run /skills reload in a running session to refresh discovery. User-level skills override project-level skills with the same name.",
113
+ delegation: "No native subagent delegation documented: run roles sequentially in fresh sessions.",
114
+ obfuscatorInvocation: "/apphx-obfuscator"
115
+ },
116
+ {
117
+ id: "oh-my-pi",
118
+ name: "Oh My Pi",
119
+ invocation: "/skill:apphx",
120
+ projectDirectory: ".omp/skills",
121
+ globalDirectory: "~/.omp/profiles/<name>/agent/skills when OMP_PROFILE/PI_PROFILE selects a profile, else ~/.omp/agent/skills",
122
+ source: "https://github.com/can1357/oh-my-pi/blob/main/docs/skills.md",
123
+ instructions: "Use /skill:apphx. Skills are discovered one level under skills/ with SKILL.md; description frontmatter is required by the native .omp provider. Restart the session if discovery has not refreshed.",
124
+ delegation: "IDE-wired agent with extension tools; run roles in separate fresh sessions when subagents are unavailable.",
125
+ obfuscatorInvocation: "/skill:apphx-obfuscator"
126
+ },
127
+ {
128
+ id: "dimagent",
129
+ name: "DimAgent",
130
+ invocation: "/skill:apphx",
131
+ projectDirectory: ".dimcode/skills",
132
+ globalDirectory: "~/.dimcode/v2/skills",
133
+ source: "https://github.com/daguanren21/apple-app-factory",
134
+ instructions: "Use /skill:apphx or describe the requirement to trigger the apphx skill. Restart the session after installation so the skill is discovered.",
135
+ delegation: "Native subagent delegation exists: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.",
136
+ obfuscatorInvocation: "/skill:apphx-obfuscator"
85
137
  }
86
138
  ].map((host) => Object.freeze(host)));
87
139
  const digest = (bytes) => createHash("sha256").update(bytes).digest("hex");
@@ -90,7 +142,7 @@ const digestSchema = z.string().regex(/^[a-f0-9]{64}$/);
90
142
  const manifestSchema = z.strictObject({
91
143
  format: z.literal(1),
92
144
  owner: z.literal(owner),
93
- skill: z.literal(skill),
145
+ skill: z.enum(["apphx", "apphx-obfuscator"]),
94
146
  host: z.string(),
95
147
  version: z.string().regex(/^\d+\.\d+\.\d+(?:-[\w.-]+)?(?:\+[\w.-]+)?$/),
96
148
  files: z.record(z.string().refine(safeRelative), digestSchema),
@@ -193,7 +245,7 @@ function environmentDirectory(name, fallback) {
193
245
  if (!isAbsolute(expanded)) throw new Error(`${name} must be an absolute directory for installation`);
194
246
  return resolve(expanded);
195
247
  }
196
- function location(id, options) {
248
+ function location(id, options, name = "apphx") {
197
249
  const host = selectedHost(id);
198
250
  if (options.global && options.project !== void 0) throw new Error("Choose either project or global installation, not both");
199
251
  if (options.global) {
@@ -208,6 +260,24 @@ function location(id, options) {
208
260
  case "pi":
209
261
  directory = join(environmentDirectory("PI_CODING_AGENT_DIR", join(homedir(), ".pi", "agent")), "skills");
210
262
  break;
263
+ case "oh-my-pi": {
264
+ const omp = process.env.OMP_PROFILE?.trim();
265
+ const pi = process.env.PI_PROFILE?.trim();
266
+ const selected = new Set([omp, pi].filter((value) => Boolean(value)));
267
+ if (selected.size > 1) throw new Error(`OMP_PROFILE (${JSON.stringify(omp)}) and PI_PROFILE (${JSON.stringify(pi)}) select different profiles; unset one before a global install`);
268
+ const profile = [...selected][0];
269
+ if (profile) {
270
+ if (!/^[a-zA-Z0-9._-]+$/.test(profile)) throw new Error(`Oh My Pi profile ${JSON.stringify(profile)} is not a usable profile name; use only letters, digits, '.', '_' or '-', or unset OMP_PROFILE/PI_PROFILE`);
271
+ directory = join(homedir(), ".omp", "profiles", profile, "agent", "skills");
272
+ } else directory = join(homedir(), ".omp", "agent", "skills");
273
+ break;
274
+ }
275
+ case "qoder":
276
+ directory = join(homedir(), ".qoder", "skills");
277
+ break;
278
+ case "dimagent":
279
+ directory = join(homedir(), ".dimcode", "v2", "skills");
280
+ break;
211
281
  case "opencode":
212
282
  directory = join(environmentDirectory("XDG_CONFIG_HOME", join(homedir(), ".config")), "opencode", "skills");
213
283
  break;
@@ -222,7 +292,8 @@ function location(id, options) {
222
292
  return {
223
293
  host,
224
294
  scope: "global",
225
- path: join(directory, skill)
295
+ skill: name,
296
+ path: join(directory, name)
226
297
  };
227
298
  }
228
299
  if (options.project !== void 0 && !options.project.trim()) throw new Error("Project directory must not be empty");
@@ -244,30 +315,32 @@ function location(id, options) {
244
315
  return {
245
316
  host,
246
317
  scope: "project",
247
- path: join(project, id === "deepseek" ? ".dsh/skills" : host.projectDirectory, skill)
318
+ skill: name,
319
+ path: join(project, id === "deepseek" ? ".dsh/skills" : host.projectDirectory, name)
248
320
  };
249
321
  }
250
322
  function details(target) {
251
323
  return {
252
324
  host: target.host.id,
253
325
  name: target.host.name,
326
+ skill: target.skill,
254
327
  scope: target.scope,
255
328
  path: target.path,
256
- invocation: target.host.invocation,
329
+ invocation: target.skill === "apphx" ? target.host.invocation : target.host.obfuscatorInvocation,
257
330
  instructions: target.host.instructions,
258
331
  source: target.host.source
259
332
  };
260
333
  }
261
- function bundle(host) {
262
- const tree = readTree(bundledDirectory, true);
263
- if (!tree.files["SKILL.md"] || tree.files[marker]) throw new Error("Invalid bundled apphx skill");
334
+ function bundle(host, name) {
335
+ const tree = readTree(bundledDirectories[name], true);
336
+ if (!tree.files["SKILL.md"] || tree.files[marker]) throw new Error(`Invalid bundled ${name} skill`);
264
337
  const files = fileDigests(tree);
265
338
  if (!Object.keys(files).every(safeRelative) || JSON.stringify(tree.directories.sort()) !== JSON.stringify(directoriesFor(files))) throw new Error("Invalid bundled skill resource paths");
266
339
  const version = JSON.parse(readRegular(packageFile, true).toString("utf8")).version;
267
340
  const value = {
268
341
  format: 1,
269
342
  owner,
270
- skill,
343
+ skill: name,
271
344
  host,
272
345
  version,
273
346
  files
@@ -282,8 +355,8 @@ function bundle(host) {
282
355
  manifest
283
356
  };
284
357
  }
285
- function inspectIntegration(host, options = {}) {
286
- const target = location(host, options);
358
+ function inspectIntegration(host, options = {}, name = "apphx") {
359
+ const target = location(host, options, name);
287
360
  const result = details(target);
288
361
  try {
289
362
  assertPath(target.path);
@@ -293,7 +366,7 @@ function inspectIntegration(host, options = {}) {
293
366
  status: "missing"
294
367
  };
295
368
  const manifest = readOwned(target.path, host);
296
- const current = bundle(host).manifest.metadataDigest === manifest.metadataDigest;
369
+ const current = bundle(host, name).manifest.metadataDigest === manifest.metadataDigest;
297
370
  return {
298
371
  ...result,
299
372
  installed: true,
@@ -329,73 +402,83 @@ function withLock(target, action) {
329
402
  unlinkSync(lock);
330
403
  }
331
404
  }
332
- function applyIntegration(host, options, operation) {
333
- const target = location(host, options);
334
- const next = bundle(host);
405
+ /** Stage and swap one owned skill directory; `previous` is the validated installed manifest or undefined. */
406
+ function replaceSkill(target, host, next, previous) {
335
407
  assertPath(target.path);
336
- if (operation === "update" && !lstatSync(target.path, { throwIfNoEntry: false })) throw new Error(`No installation at ${target.path}; run apphx install ${host} first with the same scope`);
337
- return withLock(target, () => {
408
+ const parent = dirname(target.path);
409
+ mkdirSync(parent, { recursive: true });
410
+ const staging = mkdtempSync(join(dirname(parent), ".apphx-stage-"));
411
+ const replacement = join(staging, target.skill);
412
+ const backup = join(staging, "previous");
413
+ let moved = false;
414
+ try {
415
+ mkdirSync(replacement);
416
+ for (const [file, bytes] of Object.entries(next.tree.files)) {
417
+ const path = join(replacement, file);
418
+ mkdirSync(dirname(path), { recursive: true });
419
+ writeFileSync(path, bytes, {
420
+ flag: "wx",
421
+ mode: 420
422
+ });
423
+ }
338
424
  assertPath(target.path);
339
- const previous = lstatSync(target.path, { throwIfNoEntry: false }) ? readOwned(target.path, host) : void 0;
340
- if (operation === "update" && !previous) throw new Error(`No installation at ${target.path}; run apphx install ${host} first with the same scope`);
425
+ if (previous) {
426
+ if (readOwned(target.path, host).metadataDigest !== previous.metadataDigest) throw new Error("Installation changed during upgrade");
427
+ renameSync(target.path, backup);
428
+ moved = true;
429
+ } else if (lstatSync(target.path, { throwIfNoEntry: false })) throw new Error("Skill appeared during installation; refusing overwrite");
430
+ try {
431
+ renameSync(replacement, target.path);
432
+ } catch (error) {
433
+ if (moved) {
434
+ renameSync(backup, target.path);
435
+ moved = false;
436
+ }
437
+ throw error;
438
+ }
439
+ if (moved) {
440
+ readOwned(backup, host);
441
+ rmSync(backup, { recursive: true });
442
+ moved = false;
443
+ }
444
+ } finally {
445
+ if (!moved) rmSync(staging, {
446
+ recursive: true,
447
+ force: true
448
+ });
449
+ }
450
+ }
451
+ function applyIntegration(host, options, operation) {
452
+ const targets = skills.map((name) => location(host, options, name));
453
+ const bundles = Object.fromEntries(skills.map((name) => [name, bundle(host, name)]));
454
+ const primary = targets[0];
455
+ for (const target of targets) assertPath(target.path);
456
+ if (operation === "update" && !lstatSync(primary.path, { throwIfNoEntry: false })) throw new Error(`No installation at ${primary.path}; run apphx install ${host} first with the same scope`);
457
+ return withLock(primary, () => {
458
+ for (const target of targets) assertPath(target.path);
459
+ const previous = targets.map((target) => lstatSync(target.path, { throwIfNoEntry: false }) ? readOwned(target.path, host) : void 0);
460
+ if (operation === "update" && !previous[0]) throw new Error(`No installation at ${primary.path}; run apphx install ${host} first with the same scope`);
341
461
  const result = {
342
- ...details(target),
462
+ ...details(primary),
343
463
  installed: true,
344
464
  status: "installed",
345
- version: next.manifest.version,
465
+ version: bundles.apphx.manifest.version,
346
466
  current: true
347
467
  };
348
- if (previous?.metadataDigest === next.manifest.metadataDigest) return {
468
+ if (!targets.some((target, index) => previous[index]?.metadataDigest !== bundles[target.skill].manifest.metadataDigest)) return {
349
469
  ...result,
350
470
  changed: false
351
471
  };
352
- if (operation === "install" && previous) throw new Error(`An older or different workflow is installed at ${target.path}; use apphx update ${host} with the same scope`);
353
- const parent = dirname(target.path);
354
- mkdirSync(parent, { recursive: true });
355
- const staging = mkdtempSync(join(dirname(parent), ".apphx-stage-"));
356
- const replacement = join(staging, skill);
357
- const backup = join(staging, "previous");
358
- let moved = false;
359
- try {
360
- mkdirSync(replacement);
361
- for (const [file, bytes] of Object.entries(next.tree.files)) {
362
- const path = join(replacement, file);
363
- mkdirSync(dirname(path), { recursive: true });
364
- writeFileSync(path, bytes, {
365
- flag: "wx",
366
- mode: 420
367
- });
368
- }
369
- assertPath(target.path);
370
- if (previous) {
371
- if (readOwned(target.path, host).metadataDigest !== previous.metadataDigest) throw new Error("Installation changed during upgrade");
372
- renameSync(target.path, backup);
373
- moved = true;
374
- } else if (lstatSync(target.path, { throwIfNoEntry: false })) throw new Error("Skill appeared during installation; refusing overwrite");
375
- try {
376
- renameSync(replacement, target.path);
377
- } catch (error) {
378
- if (moved) {
379
- renameSync(backup, target.path);
380
- moved = false;
381
- }
382
- throw error;
383
- }
384
- if (moved) {
385
- readOwned(backup, host);
386
- rmSync(backup, { recursive: true });
387
- moved = false;
388
- }
389
- return {
390
- ...result,
391
- changed: true
392
- };
393
- } finally {
394
- if (!moved) rmSync(staging, {
395
- recursive: true,
396
- force: true
397
- });
472
+ if (operation === "install" && previous[0]) throw new Error(`An older or different workflow is installed at ${primary.path}; use apphx update ${host} with the same scope`);
473
+ for (let index = 0; index < targets.length; index++) {
474
+ const target = targets[index];
475
+ if (previous[index]?.metadataDigest === bundles[target.skill].manifest.metadataDigest) continue;
476
+ replaceSkill(target, host, bundles[target.skill], previous[index]);
398
477
  }
478
+ return {
479
+ ...result,
480
+ changed: true
481
+ };
399
482
  });
400
483
  }
401
484
  function installIntegration(host, options = {}) {
@@ -405,28 +488,31 @@ function updateIntegration(host, options = {}) {
405
488
  return applyIntegration(host, options, "update");
406
489
  }
407
490
  function uninstallIntegration(host, options = {}) {
408
- const target = location(host, options);
409
- assertPath(target.path);
491
+ const targets = skills.map((name) => location(host, options, name));
492
+ const primary = targets[0];
493
+ for (const target of targets) assertPath(target.path);
410
494
  const result = {
411
- ...details(target),
495
+ ...details(primary),
412
496
  installed: false,
413
497
  status: "missing"
414
498
  };
415
- if (!lstatSync(target.path, { throwIfNoEntry: false })) return {
499
+ if (!targets.some((target) => lstatSync(target.path, { throwIfNoEntry: false }))) return {
416
500
  ...result,
417
501
  changed: false
418
502
  };
419
- return withLock(target, () => {
420
- assertPath(target.path);
421
- if (!lstatSync(target.path, { throwIfNoEntry: false })) return {
422
- ...result,
423
- changed: false
424
- };
425
- readOwned(target.path, host);
426
- rmSync(target.path, { recursive: true });
503
+ return withLock(primary, () => {
504
+ for (const target of targets) assertPath(target.path);
505
+ for (const target of targets) if (lstatSync(target.path, { throwIfNoEntry: false })) readOwned(target.path, host);
506
+ let changed = false;
507
+ for (const target of targets) {
508
+ if (!lstatSync(target.path, { throwIfNoEntry: false })) continue;
509
+ readOwned(target.path, host);
510
+ rmSync(target.path, { recursive: true });
511
+ changed = true;
512
+ }
427
513
  return {
428
514
  ...result,
429
- changed: true
515
+ changed
430
516
  };
431
517
  });
432
518
  }
@@ -1 +1 @@
1
- {"version":3,"file":"integrations.js","names":[],"sources":["../src/integrations.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { closeSync, constants, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join, parse, resolve, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\nconst skill = 'apphx';\nconst marker = '.apphx-install.json';\nconst owner = 'apphx';\nconst bundledDirectory = fileURLToPath(new URL('../skills/apphx/', import.meta.url));\nconst packageFile = fileURLToPath(new URL('../package.json', import.meta.url));\n\nexport const hosts = Object.freeze([\n { id: 'codex', name: 'Codex', invocation: '$apphx', projectDirectory: '.agents/skills', globalDirectory: '~/.agents/skills', source: 'https://developers.openai.com/codex/skills', instructions: 'Use $apphx in Codex CLI or the IDE extension; /skills lists skills. Restart if discovery has not refreshed.' },\n { id: 'claude', name: 'Claude Code', invocation: '/apphx', projectDirectory: '.claude/skills', globalDirectory: '$CLAUDE_CONFIG_DIR/skills (default ~/.claude/skills)', source: 'https://code.claude.com/docs/en/skills', instructions: 'Use /apphx in a local Claude Code session. Start a new session if the skill is not listed. Cloud sessions do not inherit local user skills.' },\n { id: 'cursor', name: 'Cursor', invocation: '/apphx', projectDirectory: '.cursor/skills', globalDirectory: '~/.cursor/skills', source: 'https://cursor.com/docs/skills', instructions: 'In Agent chat, type / and select apphx. Restart or reopen the project if necessary. Global installation is local, not a Cloud Agent sync.' },\n { id: 'pi', name: 'Pi', invocation: '/skill:apphx', projectDirectory: '.pi/skills', globalDirectory: '$PI_CODING_AGENT_DIR/skills (default ~/.pi/agent/skills)', source: 'https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/skills.md', instructions: 'Grant project trust before using project skills, then /reload and /skill:apphx. Stock Pi has no native subagents: use a separate human-started reviewer session, not a spawned coding-agent CLI.' },\n { id: 'gemini', name: 'Gemini CLI', invocation: 'Use the apphx skill', projectDirectory: '.gemini/skills', globalDirectory: '$GEMINI_CLI_HOME/.gemini/skills (default ~/.gemini/skills)', source: 'https://geminicli.com/docs/cli/skills/', instructions: 'Run /skills reload and /skills list, then ask: Use the apphx skill. Gemini calls activate_skill; approve its consent prompt. This is not a /apphx command.' },\n { id: 'opencode', name: 'OpenCode', invocation: 'Use the apphx skill', projectDirectory: '.opencode/skills', globalDirectory: '$XDG_CONFIG_HOME/opencode/skills (default ~/.config/opencode/skills)', source: 'https://opencode.ai/docs/skills/', instructions: 'Ask OpenCode to use apphx; the agent loads it with its native skill({ name: \"apphx\" }) tool. Skill permissions must permit loading. Restart if necessary; no custom slash command is installed.' },\n { id: 'deepseek', name: 'DeepSeek Harness', invocation: 'Use the apphx skill', projectDirectory: '.dsh/skills (nearest Git root, otherwise selected project)', globalDirectory: '$DSH_HOME/skills (default ~/.dsh/skills)', source: 'https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/skills', instructions: 'Ask DeepSeek Harness to use apphx; its native skill({ name: \"apphx\" }) tool loads it. Requires the shipped filesystem skill provider and skill tool, with default roots enabled. Custom provider configurations are not modified.' },\n { id: 'hermes', name: 'Hermes Agent', invocation: '/apphx', projectDirectory: '.hermes/skills', globalDirectory: '$HERMES_HOME/skills (default ~/.hermes/skills)', source: 'https://hermes-agent.nousresearch.com/docs/user-guide/features/skills', instructions: 'Use /apphx. Project installation requires a Git root and a separate owner-approved hermes skills trust decision; this installer never grants trust. For non-Git projects or profile-wide cron use --global in the same HERMES_HOME as Hermes. Confirm discovery with hermes skills list; cron must attach the skill and an absolute workdir.' },\n].map(host => Object.freeze(host)));\n\nexport type IntegrationOptions = { project?: string; global?: boolean };\ntype Host = (typeof hosts)[number];\ntype Location = { host: Host; scope: 'project' | 'global'; path: string };\nexport type IntegrationInspection = {\n host: string; name: string; scope: 'project' | 'global'; path: string;\n invocation: string; instructions: string; source: string;\n installed: boolean; status: 'missing' | 'installed' | 'conflict';\n version?: string; current?: boolean; reason?: string;\n};\n\ntype Tree = { files: Record<string, Buffer>; directories: string[] };\nconst digest = (bytes: string | Buffer) => createHash('sha256').update(bytes).digest('hex');\nconst safeRelative = (path: string) => /^[a-zA-Z0-9][a-zA-Z0-9._/-]*$/.test(path) && path.split('/').every(part => part !== '.' && part !== '..' && part.length > 0) && path !== marker;\nconst digestSchema = z.string().regex(/^[a-f0-9]{64}$/);\nconst manifestSchema = z.strictObject({\n format: z.literal(1), owner: z.literal(owner), skill: z.literal(skill), host: z.string(),\n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+(?:-[\\w.-]+)?(?:\\+[\\w.-]+)?$/),\n files: z.record(z.string().refine(safeRelative), digestSchema), metadataDigest: digestSchema,\n});\ntype Manifest = z.infer<typeof manifestSchema>;\n\n// Never follow a symlink, including an existing ancestor of a not-yet-created target.\nfunction assertPath(path: string): void {\n const absolute = resolve(path);\n let current = parse(absolute).root;\n const parts = absolute.slice(current.length).split(sep).filter(Boolean);\n for (let i = 0; i < parts.length; i++) {\n current = join(current, parts[i]!);\n const info = lstatSync(current, { throwIfNoEntry: false });\n if (!info) return;\n if (info.isSymbolicLink()) throw new Error(`Refusing symlink path: ${current}. Select its real directory explicitly.`);\n if (i < parts.length - 1 && !info.isDirectory()) throw new Error(`Not a directory: ${current}`);\n }\n}\n\nfunction readRegular(path: string, packageSource = false): Buffer {\n assertPath(path);\n const descriptor = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n try {\n const info = fstatSync(descriptor);\n if (!info.isFile() || (!packageSource && info.nlink !== 1)) throw new Error(`Refusing non-regular or hard-linked installation file: ${path}`);\n return readFileSync(descriptor);\n } finally { closeSync(descriptor); }\n}\n\nfunction readTree(root: string, packageSource = false): Tree {\n assertPath(root);\n if (!lstatSync(root).isDirectory()) throw new Error(`Not a skill directory: ${root}`);\n const tree: Tree = { files: Object.create(null), directories: [] };\n function visit(directory: string, prefix: string): void {\n for (const name of readdirSync(directory).sort()) {\n const path = join(directory, name);\n const relative = prefix ? `${prefix}/${name}` : name;\n const info = lstatSync(path);\n if (info.isSymbolicLink()) throw new Error(`Refusing symlink installation entry: ${path}`);\n if (info.isDirectory()) { tree.directories.push(relative); visit(path, relative); }\n else tree.files[relative] = readRegular(path, packageSource);\n }\n }\n visit(root, '');\n return tree;\n}\n\nfunction fileDigests(tree: Tree): Record<string, string> {\n return Object.fromEntries(Object.entries(tree.files).filter(([path]) => path !== marker).map(([path, bytes]) => [path, digest(bytes)]));\n}\n\nfunction metadataDigest(value: Omit<Manifest, 'metadataDigest'>): string {\n return digest(JSON.stringify([value.format, value.owner, value.skill, value.host, value.version, Object.entries(value.files).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)]));\n}\n\nfunction directoriesFor(files: Record<string, unknown>): string[] {\n const directories = new Set<string>();\n for (const file of Object.keys(files)) {\n let parent = file.slice(0, file.lastIndexOf('/'));\n if (!file.includes('/')) continue;\n while (parent) { directories.add(parent); parent = parent.includes('/') ? parent.slice(0, parent.lastIndexOf('/')) : ''; }\n }\n return [...directories].sort();\n}\n\nfunction readOwned(path: string, host: string): Manifest {\n const tree = readTree(path);\n if (!tree.files[marker]) throw new Error(`Foreign skill directory has no ${marker}: ${path}`);\n let manifest: Manifest;\n try { manifest = manifestSchema.parse(JSON.parse(tree.files[marker].toString('utf8'))); }\n catch { throw new Error(`Invalid ownership metadata: ${path}`); }\n if (manifest.host !== host || manifest.metadataDigest !== metadataDigest(manifest)) throw new Error(`Foreign or edited ownership metadata: ${path}`);\n if (!manifest.files['SKILL.md'] || JSON.stringify(Object.keys(tree.files).filter(file => file !== marker).sort()) !== JSON.stringify(Object.keys(manifest.files).sort())) throw new Error(`Added or missing files in owned skill: ${path}`);\n for (const [file, expected] of Object.entries(manifest.files)) {\n if (digest(tree.files[file]!) !== expected) throw new Error(`User-edited skill file: ${join(path, file)}`);\n }\n if (JSON.stringify(tree.directories.sort()) !== JSON.stringify(directoriesFor(manifest.files))) throw new Error(`Unowned directories in skill: ${path}`);\n return manifest;\n}\n\nfunction selectedHost(id: string): Host {\n const host = hosts.find(value => value.id === id);\n if (!host) throw new Error(`Unsupported host ${JSON.stringify(id)}. Supported hosts: ${hosts.map(value => value.id).join(', ')}`);\n return host;\n}\n\nfunction environmentDirectory(name: string, fallback: string): string {\n const configured = process.env[name];\n if (!configured) return fallback;\n const expanded = configured === '~' ? homedir() : configured.startsWith('~/') ? join(homedir(), configured.slice(2)) : configured;\n if (!isAbsolute(expanded)) throw new Error(`${name} must be an absolute directory for installation`);\n return resolve(expanded);\n}\n\nfunction location(id: string, options: IntegrationOptions): Location {\n const host = selectedHost(id);\n if (options.global && options.project !== undefined) throw new Error('Choose either project or global installation, not both');\n if (options.global) {\n let directory: string;\n switch (id) {\n case 'claude': directory = join(environmentDirectory('CLAUDE_CONFIG_DIR', join(homedir(), '.claude')), 'skills'); break;\n case 'gemini': directory = join(environmentDirectory('GEMINI_CLI_HOME', homedir()), '.gemini', 'skills'); break;\n case 'pi': directory = join(environmentDirectory('PI_CODING_AGENT_DIR', join(homedir(), '.pi', 'agent')), 'skills'); break;\n case 'opencode': directory = join(environmentDirectory('XDG_CONFIG_HOME', join(homedir(), '.config')), 'opencode', 'skills'); break;\n case 'deepseek': directory = join(environmentDirectory('DSH_HOME', join(homedir(), '.dsh')), 'skills'); break;\n case 'hermes': directory = join(environmentDirectory('HERMES_HOME', join(homedir(), '.hermes')), 'skills'); break;\n default: directory = join(homedir(), host.projectDirectory);\n }\n return { host, scope: 'global', path: join(directory, skill) };\n }\n if (options.project !== undefined && !options.project.trim()) throw new Error('Project directory must not be empty');\n let project = resolve(options.project ?? process.cwd());\n assertPath(project);\n if (!lstatSync(project, { throwIfNoEntry: false })?.isDirectory()) throw new Error(`Project directory does not exist: ${project}`);\n if (id === 'deepseek' || id === 'hermes') {\n let found = false;\n for (let candidate = project; ; candidate = dirname(candidate)) {\n if (lstatSync(join(candidate, '.git'), { throwIfNoEntry: false })) { project = candidate; found = true; break; }\n if (dirname(candidate) === candidate) break;\n }\n if (id === 'hermes' && !found) throw new Error('Hermes project skills require a Git root; use --global for a profile-level installation instead');\n }\n return { host, scope: 'project', path: join(project, id === 'deepseek' ? '.dsh/skills' : host.projectDirectory, skill) };\n}\n\nfunction details(target: Location) {\n return { host: target.host.id, name: target.host.name, scope: target.scope, path: target.path, invocation: target.host.invocation, instructions: target.host.instructions, source: target.host.source };\n}\n\nfunction bundle(host: string): { tree: Tree; manifest: Manifest } {\n // Package stores may hard-link read-only resources; owned installation targets may not.\n const tree = readTree(bundledDirectory, true);\n if (!tree.files['SKILL.md'] || tree.files[marker]) throw new Error('Invalid bundled apphx skill');\n const files = fileDigests(tree);\n if (!Object.keys(files).every(safeRelative) || JSON.stringify(tree.directories.sort()) !== JSON.stringify(directoriesFor(files))) throw new Error('Invalid bundled skill resource paths');\n const version = JSON.parse(readRegular(packageFile, true).toString('utf8')).version;\n const value: Omit<Manifest, 'metadataDigest'> = { format: 1, owner, skill, host, version, files };\n const manifest = manifestSchema.parse({ ...value, metadataDigest: metadataDigest(value) });\n tree.files[marker] = Buffer.from(`${JSON.stringify(manifest, null, 2)}\\n`);\n return { tree, manifest };\n}\n\nexport function inspectIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection {\n const target = location(host, options);\n const result = details(target);\n try {\n assertPath(target.path);\n if (!lstatSync(target.path, { throwIfNoEntry: false })) return { ...result, installed: false, status: 'missing' };\n const manifest = readOwned(target.path, host);\n const current = bundle(host).manifest.metadataDigest === manifest.metadataDigest;\n return { ...result, installed: true, status: 'installed', version: manifest.version, current };\n } catch (error) {\n return { ...result, installed: false, status: 'conflict', reason: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction withLock<T>(target: Location, action: () => T): T {\n const directory = dirname(dirname(target.path));\n assertPath(directory);\n mkdirSync(directory, { recursive: true });\n assertPath(directory);\n const lock = join(directory, '.apphx-install.lock');\n let descriptor: number;\n try { descriptor = openSync(lock, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600); }\n catch { throw new Error(`Installation is locked at ${lock}; if an earlier installer stopped, inspect it before removing its lock`); }\n try { return action(); }\n finally { closeSync(descriptor); unlinkSync(lock); }\n}\n\nfunction applyIntegration(host: string, options: IntegrationOptions, operation: 'install' | 'update'): IntegrationInspection & { changed: boolean } {\n const target = location(host, options);\n const next = bundle(host);\n assertPath(target.path);\n if (operation === 'update' && !lstatSync(target.path, { throwIfNoEntry: false })) throw new Error(`No installation at ${target.path}; run apphx install ${host} first with the same scope`);\n return withLock(target, () => {\n assertPath(target.path);\n const previous = lstatSync(target.path, { throwIfNoEntry: false }) ? readOwned(target.path, host) : undefined;\n if (operation === 'update' && !previous) throw new Error(`No installation at ${target.path}; run apphx install ${host} first with the same scope`);\n const result = { ...details(target), installed: true, status: 'installed' as const, version: next.manifest.version, current: true };\n if (previous?.metadataDigest === next.manifest.metadataDigest) return { ...result, changed: false };\n if (operation === 'install' && previous) throw new Error(`An older or different workflow is installed at ${target.path}; use apphx update ${host} with the same scope`);\n const parent = dirname(target.path);\n mkdirSync(parent, { recursive: true });\n const staging = mkdtempSync(join(dirname(parent), '.apphx-stage-'));\n const replacement = join(staging, skill);\n const backup = join(staging, 'previous');\n let moved = false;\n try {\n mkdirSync(replacement);\n for (const [file, bytes] of Object.entries(next.tree.files)) {\n const path = join(replacement, file);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, bytes, { flag: 'wx', mode: 0o644 });\n }\n assertPath(target.path);\n if (previous) {\n if (readOwned(target.path, host).metadataDigest !== previous.metadataDigest) throw new Error('Installation changed during upgrade');\n renameSync(target.path, backup);\n moved = true;\n } else if (lstatSync(target.path, { throwIfNoEntry: false })) throw new Error('Skill appeared during installation; refusing overwrite');\n try { renameSync(replacement, target.path); }\n catch (error) { if (moved) { renameSync(backup, target.path); moved = false; } throw error; }\n if (moved) { readOwned(backup, host); rmSync(backup, { recursive: true }); moved = false; }\n return { ...result, changed: true };\n } finally {\n // Keep a displaced install intact if rollback or cleanup was interrupted.\n if (!moved) rmSync(staging, { recursive: true, force: true });\n }\n });\n}\n\nexport function installIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n return applyIntegration(host, options, 'install');\n}\n\nexport function updateIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n return applyIntegration(host, options, 'update');\n}\n\nexport function uninstallIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n const target = location(host, options);\n assertPath(target.path);\n const result = { ...details(target), installed: false, status: 'missing' as const };\n if (!lstatSync(target.path, { throwIfNoEntry: false })) return { ...result, changed: false };\n return withLock(target, () => {\n assertPath(target.path);\n if (!lstatSync(target.path, { throwIfNoEntry: false })) return { ...result, changed: false };\n readOwned(target.path, host);\n rmSync(target.path, { recursive: true });\n return { ...result, changed: true };\n });\n}\n"],"mappings":";;;;;;;AAOA,MAAM,QAAQ;AACd,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,mBAAmB,cAAc,IAAI,IAAI,oBAAoB,YAAY,GAAG,CAAC;AACnF,MAAM,cAAc,cAAc,IAAI,IAAI,mBAAmB,YAAY,GAAG,CAAC;AAE7E,MAAa,QAAQ,OAAO,OAAO;CACjC;EAAE,IAAI;EAAS,MAAM;EAAS,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAoB,QAAQ;EAA8C,cAAc;CAA8G;CAC/S;EAAE,IAAI;EAAU,MAAM;EAAe,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAwD,QAAQ;EAA0C,cAAc;CAA8I;CACtX;EAAE,IAAI;EAAU,MAAM;EAAU,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAoB,QAAQ;EAAkC,cAAc;CAA4I;CACnU;E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QAAQ;CAAmB;CAClF,IAAI,CAAC,UAAU,OAAO,MAAM,EAAE,gBAAgB,MAAM,CAAC,GAAG,OAAO;EAAE,GAAG;EAAQ,SAAS;CAAM;CAC3F,OAAO,SAAS,cAAc;EAC5B,WAAW,OAAO,IAAI;EACtB,IAAI,CAAC,UAAU,OAAO,MAAM,EAAE,gBAAgB,MAAM,CAAC,GAAG,OAAO;GAAE,GAAG;GAAQ,SAAS;EAAM;EAC3F,UAAU,OAAO,MAAM,IAAI;EAC3B,OAAO,OAAO,MAAM,EAAE,WAAW,KAAK,CAAC;EACvC,OAAO;GAAE,GAAG;GAAQ,SAAS;EAAK;CACpC,CAAC;AACH"}
1
+ {"version":3,"file":"integrations.js","names":[],"sources":["../src/integrations.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { closeSync, constants, fstatSync, lstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, renameSync, rmSync, unlinkSync, writeFileSync } from 'node:fs';\nimport { homedir } from 'node:os';\nimport { dirname, isAbsolute, join, parse, resolve, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { z } from 'zod';\n\nconst skills = ['apphx', 'apphx-obfuscator'] as const;\ntype SkillName = (typeof skills)[number];\nconst marker = '.apphx-install.json';\nconst owner = 'apphx';\nconst bundledDirectories: Record<SkillName, string> = {\n apphx: fileURLToPath(new URL('../skills/apphx/', import.meta.url)),\n 'apphx-obfuscator': fileURLToPath(new URL('../skills/apphx-obfuscator/', import.meta.url)),\n};\nconst packageFile = fileURLToPath(new URL('../package.json', import.meta.url));\n\nexport const hosts = Object.freeze([\n{ id: 'codex', name: 'Codex', invocation: '$apphx', projectDirectory: '.agents/skills', globalDirectory: '~/.agents/skills', source: 'https://developers.openai.com/codex/skills', instructions: 'Use $apphx in Codex CLI or the IDE extension; /skills lists skills. Restart if discovery has not refreshed.' , delegation: 'Native subagents/agents exist: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.' , obfuscatorInvocation: '$apphx-obfuscator' },\n { id: 'claude', name: 'Claude Code', invocation: '/apphx', projectDirectory: '.claude/skills', globalDirectory: '$CLAUDE_CONFIG_DIR/skills (default ~/.claude/skills)', source: 'https://code.claude.com/docs/en/skills', instructions: 'Use /apphx in a local Claude Code session. Start a new session if the skill is not listed. Cloud sessions do not inherit local user skills.' , delegation: 'Native subagents exist: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.' , obfuscatorInvocation: '/apphx-obfuscator' },\n { id: 'cursor', name: 'Cursor', invocation: '/apphx', projectDirectory: '.cursor/skills', globalDirectory: '~/.cursor/skills', source: 'https://cursor.com/docs/skills', instructions: 'In Agent chat, type / and select apphx. Restart or reopen the project if necessary. Global installation is local, not a Cloud Agent sync.' , delegation: 'Multi-agent support varies by version: fall back to separate fresh sessions per role when subagents are unavailable.' , obfuscatorInvocation: '/apphx-obfuscator' },\n { id: 'pi', name: 'Pi', invocation: '/skill:apphx', projectDirectory: '.pi/skills', globalDirectory: '$PI_CODING_AGENT_DIR/skills (default ~/.pi/agent/skills)', source: 'https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/skills.md', instructions: 'Grant project trust before using project skills, then /reload and /skill:apphx. Stock Pi has no native subagents: use a separate human-started reviewer session, not a spawned coding-agent CLI.' , delegation: 'Stock Pi has no native subagents: run each role in its own human-started fresh session.' , obfuscatorInvocation: '/skill:apphx-obfuscator' },\n { id: 'gemini', name: 'Gemini CLI', invocation: 'Use the apphx skill', projectDirectory: '.gemini/skills', globalDirectory: '$GEMINI_CLI_HOME/.gemini/skills (default ~/.gemini/skills)', source: 'https://geminicli.com/docs/cli/skills/', instructions: 'Run /skills reload and /skills list, then ask: Use the apphx skill. Gemini calls activate_skill; approve its consent prompt. This is not a /apphx command.' , delegation: 'No native subagent delegation documented: run roles sequentially in fresh sessions.' , obfuscatorInvocation: 'Use the apphx-obfuscator skill' },\n { id: 'opencode', name: 'OpenCode', invocation: 'Use the apphx skill', projectDirectory: '.opencode/skills', globalDirectory: '$XDG_CONFIG_HOME/opencode/skills (default ~/.config/opencode/skills)', source: 'https://opencode.ai/docs/skills/', instructions: 'Ask OpenCode to use apphx; the agent loads it with its native skill({ name: \"apphx\" }) tool. Skill permissions must permit loading. Restart if necessary; no custom slash command is installed.' , delegation: 'Subagent support varies by version: fall back to separate fresh sessions per role when subagents are unavailable.' , obfuscatorInvocation: 'Use the apphx-obfuscator skill' },\n { id: 'deepseek', name: 'DeepSeek Harness', invocation: 'Use the apphx skill', projectDirectory: '.dsh/skills (nearest Git root, otherwise selected project)', globalDirectory: '$DSH_HOME/skills (default ~/.dsh/skills)', source: 'https://deepseek-harness.github.io/deepseek-harness/en/reference/subsystems/skills', instructions: 'Ask DeepSeek Harness to use apphx; its native skill({ name: \"apphx\" }) tool loads it. Requires the shipped filesystem skill provider and skill tool, with default roots enabled. Custom provider configurations are not modified.' , delegation: 'The harness supports delegated agents; verify your provider exposes them, else use fresh sessions per role.' , obfuscatorInvocation: 'Use the apphx-obfuscator skill' },\n { id: 'hermes', name: 'Hermes Agent', invocation: '/apphx', projectDirectory: '.hermes/skills', globalDirectory: '$HERMES_HOME/skills (default ~/.hermes/skills)', source: 'https://hermes-agent.nousresearch.com/docs/user-guide/features/skills', instructions: 'Use /apphx. Project installation requires a Git root and a separate owner-approved hermes skills trust decision; this installer never grants trust. For non-Git projects or profile-wide cron use --global in the same HERMES_HOME as Hermes. Confirm discovery with hermes skills list; cron must attach the skill and an absolute workdir.' , delegation: 'Native subagents and cron exist: run design and review roles as parallel or serial fresh contexts; the scheduler handles unattended wakes. Verify against your installed host version.' , obfuscatorInvocation: '/apphx-obfuscator' },\n { id: 'qoder', name: 'Qoder', invocation: '/apphx', projectDirectory: '.qoder/skills', globalDirectory: '~/.qoder/skills', source: 'https://docs.qoder.com/cli/Skills', instructions: 'Use /apphx manually or let the model auto-trigger the skill. Run /skills reload in a running session to refresh discovery. User-level skills override project-level skills with the same name.' , delegation: 'No native subagent delegation documented: run roles sequentially in fresh sessions.' , obfuscatorInvocation: '/apphx-obfuscator' },\n { id: 'oh-my-pi', name: 'Oh My Pi', invocation: '/skill:apphx', projectDirectory: '.omp/skills', globalDirectory: '~/.omp/profiles/<name>/agent/skills when OMP_PROFILE/PI_PROFILE selects a profile, else ~/.omp/agent/skills', source: 'https://github.com/can1357/oh-my-pi/blob/main/docs/skills.md', instructions: 'Use /skill:apphx. Skills are discovered one level under skills/ with SKILL.md; description frontmatter is required by the native .omp provider. Restart the session if discovery has not refreshed.' , delegation: 'IDE-wired agent with extension tools; run roles in separate fresh sessions when subagents are unavailable.' , obfuscatorInvocation: '/skill:apphx-obfuscator' },\n { id: 'dimagent', name: 'DimAgent', invocation: '/skill:apphx', projectDirectory: '.dimcode/skills', globalDirectory: '~/.dimcode/v2/skills', source: 'https://github.com/daguanren21/apple-app-factory', instructions: 'Use /skill:apphx or describe the requirement to trigger the apphx skill. Restart the session after installation so the skill is discovered.' , delegation: 'Native subagent delegation exists: run design and review roles as parallel or serial fresh contexts. Verify against your installed host version.' , obfuscatorInvocation: '/skill:apphx-obfuscator' },\n].map(host => Object.freeze(host)));\n\nexport type IntegrationOptions = { project?: string; global?: boolean };\ntype Host = (typeof hosts)[number];\ntype Location = { host: Host; scope: 'project' | 'global'; path: string; skill: SkillName };\nexport type IntegrationInspection = {\n host: string; name: string; skill: SkillName; scope: 'project' | 'global'; path: string;\n invocation: string; instructions: string; source: string;\n installed: boolean; status: 'missing' | 'installed' | 'conflict';\n version?: string; current?: boolean; reason?: string;\n};\n\ntype Tree = { files: Record<string, Buffer>; directories: string[] };\nconst digest = (bytes: string | Buffer) => createHash('sha256').update(bytes).digest('hex');\nconst safeRelative = (path: string) => /^[a-zA-Z0-9][a-zA-Z0-9._/-]*$/.test(path) && path.split('/').every(part => part !== '.' && part !== '..' && part.length > 0) && path !== marker;\nconst digestSchema = z.string().regex(/^[a-f0-9]{64}$/);\nconst manifestSchema = z.strictObject({\n format: z.literal(1), owner: z.literal(owner), skill: z.enum(['apphx', 'apphx-obfuscator']), host: z.string(),\n version: z.string().regex(/^\\d+\\.\\d+\\.\\d+(?:-[\\w.-]+)?(?:\\+[\\w.-]+)?$/),\n files: z.record(z.string().refine(safeRelative), digestSchema), metadataDigest: digestSchema,\n});\ntype Manifest = z.infer<typeof manifestSchema>;\n\n// Never follow a symlink, including an existing ancestor of a not-yet-created target.\nfunction assertPath(path: string): void {\n const absolute = resolve(path);\n let current = parse(absolute).root;\n const parts = absolute.slice(current.length).split(sep).filter(Boolean);\n for (let i = 0; i < parts.length; i++) {\n current = join(current, parts[i]!);\n const info = lstatSync(current, { throwIfNoEntry: false });\n if (!info) return;\n if (info.isSymbolicLink()) throw new Error(`Refusing symlink path: ${current}. Select its real directory explicitly.`);\n if (i < parts.length - 1 && !info.isDirectory()) throw new Error(`Not a directory: ${current}`);\n }\n}\n\nfunction readRegular(path: string, packageSource = false): Buffer {\n assertPath(path);\n const descriptor = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);\n try {\n const info = fstatSync(descriptor);\n if (!info.isFile() || (!packageSource && info.nlink !== 1)) throw new Error(`Refusing non-regular or hard-linked installation file: ${path}`);\n return readFileSync(descriptor);\n } finally { closeSync(descriptor); }\n}\n\nfunction readTree(root: string, packageSource = false): Tree {\n assertPath(root);\n if (!lstatSync(root).isDirectory()) throw new Error(`Not a skill directory: ${root}`);\n const tree: Tree = { files: Object.create(null), directories: [] };\n function visit(directory: string, prefix: string): void {\n for (const name of readdirSync(directory).sort()) {\n const path = join(directory, name);\n const relative = prefix ? `${prefix}/${name}` : name;\n const info = lstatSync(path);\n if (info.isSymbolicLink()) throw new Error(`Refusing symlink installation entry: ${path}`);\n if (info.isDirectory()) { tree.directories.push(relative); visit(path, relative); }\n else tree.files[relative] = readRegular(path, packageSource);\n }\n }\n visit(root, '');\n return tree;\n}\n\nfunction fileDigests(tree: Tree): Record<string, string> {\n return Object.fromEntries(Object.entries(tree.files).filter(([path]) => path !== marker).map(([path, bytes]) => [path, digest(bytes)]));\n}\n\nfunction metadataDigest(value: Omit<Manifest, 'metadataDigest'>): string {\n return digest(JSON.stringify([value.format, value.owner, value.skill, value.host, value.version, Object.entries(value.files).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)]));\n}\n\nfunction directoriesFor(files: Record<string, unknown>): string[] {\n const directories = new Set<string>();\n for (const file of Object.keys(files)) {\n let parent = file.slice(0, file.lastIndexOf('/'));\n if (!file.includes('/')) continue;\n while (parent) { directories.add(parent); parent = parent.includes('/') ? parent.slice(0, parent.lastIndexOf('/')) : ''; }\n }\n return [...directories].sort();\n}\n\nfunction readOwned(path: string, host: string): Manifest {\n const tree = readTree(path);\n if (!tree.files[marker]) throw new Error(`Foreign skill directory has no ${marker}: ${path}`);\n let manifest: Manifest;\n try { manifest = manifestSchema.parse(JSON.parse(tree.files[marker].toString('utf8'))); }\n catch { throw new Error(`Invalid ownership metadata: ${path}`); }\n if (manifest.host !== host || manifest.metadataDigest !== metadataDigest(manifest)) throw new Error(`Foreign or edited ownership metadata: ${path}`);\n if (!manifest.files['SKILL.md'] || JSON.stringify(Object.keys(tree.files).filter(file => file !== marker).sort()) !== JSON.stringify(Object.keys(manifest.files).sort())) throw new Error(`Added or missing files in owned skill: ${path}`);\n for (const [file, expected] of Object.entries(manifest.files)) {\n if (digest(tree.files[file]!) !== expected) throw new Error(`User-edited skill file: ${join(path, file)}`);\n }\n if (JSON.stringify(tree.directories.sort()) !== JSON.stringify(directoriesFor(manifest.files))) throw new Error(`Unowned directories in skill: ${path}`);\n return manifest;\n}\n\nfunction selectedHost(id: string): Host {\n const host = hosts.find(value => value.id === id);\n if (!host) throw new Error(`Unsupported host ${JSON.stringify(id)}. Supported hosts: ${hosts.map(value => value.id).join(', ')}`);\n return host;\n}\n\nfunction environmentDirectory(name: string, fallback: string): string {\n const configured = process.env[name];\n if (!configured) return fallback;\n const expanded = configured === '~' ? homedir() : configured.startsWith('~/') ? join(homedir(), configured.slice(2)) : configured;\n if (!isAbsolute(expanded)) throw new Error(`${name} must be an absolute directory for installation`);\n return resolve(expanded);\n}\n\nfunction location(id: string, options: IntegrationOptions, name: SkillName = 'apphx'): Location {\n const host = selectedHost(id);\n if (options.global && options.project !== undefined) throw new Error('Choose either project or global installation, not both');\n if (options.global) {\n let directory: string;\n switch (id) {\n case 'claude': directory = join(environmentDirectory('CLAUDE_CONFIG_DIR', join(homedir(), '.claude')), 'skills'); break;\n case 'gemini': directory = join(environmentDirectory('GEMINI_CLI_HOME', homedir()), '.gemini', 'skills'); break;\n case 'pi': directory = join(environmentDirectory('PI_CODING_AGENT_DIR', join(homedir(), '.pi', 'agent')), 'skills'); break;\n case 'oh-my-pi': {\n // Oh My Pi resolves its global skill root from the selected profile and\n // its agent directory; install where the host reads or reject loudly.\n const omp = process.env.OMP_PROFILE?.trim();\n const pi = process.env.PI_PROFILE?.trim();\n const selected = new Set([omp, pi].filter((value): value is string => Boolean(value)));\n if (selected.size > 1) throw new Error(`OMP_PROFILE (${JSON.stringify(omp)}) and PI_PROFILE (${JSON.stringify(pi)}) select different profiles; unset one before a global install`);\n const profile = [...selected][0];\n if (profile) {\n if (!/^[a-zA-Z0-9._-]+$/.test(profile)) throw new Error(`Oh My Pi profile ${JSON.stringify(profile)} is not a usable profile name; use only letters, digits, '.', '_' or '-', or unset OMP_PROFILE/PI_PROFILE`);\n directory = join(homedir(), '.omp', 'profiles', profile, 'agent', 'skills');\n } else {\n directory = join(homedir(), '.omp', 'agent', 'skills');\n }\n break;\n }\n case 'qoder': directory = join(homedir(), '.qoder', 'skills'); break;\n case 'dimagent': directory = join(homedir(), '.dimcode', 'v2', 'skills'); break;\n case 'opencode': directory = join(environmentDirectory('XDG_CONFIG_HOME', join(homedir(), '.config')), 'opencode', 'skills'); break;\n case 'deepseek': directory = join(environmentDirectory('DSH_HOME', join(homedir(), '.dsh')), 'skills'); break;\n case 'hermes': directory = join(environmentDirectory('HERMES_HOME', join(homedir(), '.hermes')), 'skills'); break;\n default: directory = join(homedir(), host.projectDirectory);\n }\n return { host, scope: 'global', skill: name, path: join(directory, name) };\n }\n if (options.project !== undefined && !options.project.trim()) throw new Error('Project directory must not be empty');\n let project = resolve(options.project ?? process.cwd());\n assertPath(project);\n if (!lstatSync(project, { throwIfNoEntry: false })?.isDirectory()) throw new Error(`Project directory does not exist: ${project}`);\n if (id === 'deepseek' || id === 'hermes') {\n let found = false;\n for (let candidate = project; ; candidate = dirname(candidate)) {\n if (lstatSync(join(candidate, '.git'), { throwIfNoEntry: false })) { project = candidate; found = true; break; }\n if (dirname(candidate) === candidate) break;\n }\n if (id === 'hermes' && !found) throw new Error('Hermes project skills require a Git root; use --global for a profile-level installation instead');\n }\n return { host, scope: 'project', skill: name, path: join(project, id === 'deepseek' ? '.dsh/skills' : host.projectDirectory, name) };\n}\n\nfunction details(target: Location) {\n return { host: target.host.id, name: target.host.name, skill: target.skill, scope: target.scope, path: target.path, invocation: target.skill === 'apphx' ? target.host.invocation : target.host.obfuscatorInvocation, instructions: target.host.instructions, source: target.host.source };\n}\n\nfunction bundle(host: string, name: SkillName): { tree: Tree; manifest: Manifest } {\n // Package stores may hard-link read-only resources; owned installation targets may not.\n const tree = readTree(bundledDirectories[name], true);\n if (!tree.files['SKILL.md'] || tree.files[marker]) throw new Error(`Invalid bundled ${name} skill`);\n const files = fileDigests(tree);\n if (!Object.keys(files).every(safeRelative) || JSON.stringify(tree.directories.sort()) !== JSON.stringify(directoriesFor(files))) throw new Error('Invalid bundled skill resource paths');\n const version = JSON.parse(readRegular(packageFile, true).toString('utf8')).version;\n const value: Omit<Manifest, 'metadataDigest'> = { format: 1, owner, skill: name, host, version, files };\n const manifest = manifestSchema.parse({ ...value, metadataDigest: metadataDigest(value) });\n tree.files[marker] = Buffer.from(`${JSON.stringify(manifest, null, 2)}\\n`);\n return { tree, manifest };\n}\n\nexport function inspectIntegration(host: string, options: IntegrationOptions = {}, name: SkillName = 'apphx'): IntegrationInspection {\n const target = location(host, options, name);\n const result = details(target);\n try {\n assertPath(target.path);\n if (!lstatSync(target.path, { throwIfNoEntry: false })) return { ...result, installed: false, status: 'missing' };\n const manifest = readOwned(target.path, host);\n const current = bundle(host, name).manifest.metadataDigest === manifest.metadataDigest;\n return { ...result, installed: true, status: 'installed', version: manifest.version, current };\n } catch (error) {\n return { ...result, installed: false, status: 'conflict', reason: error instanceof Error ? error.message : String(error) };\n }\n}\n\nfunction withLock<T>(target: Location, action: () => T): T {\n const directory = dirname(dirname(target.path));\n assertPath(directory);\n mkdirSync(directory, { recursive: true });\n assertPath(directory);\n const lock = join(directory, '.apphx-install.lock');\n let descriptor: number;\n try { descriptor = openSync(lock, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600); }\n catch { throw new Error(`Installation is locked at ${lock}; if an earlier installer stopped, inspect it before removing its lock`); }\n try { return action(); }\n finally { closeSync(descriptor); unlinkSync(lock); }\n}\n\n/** Stage and swap one owned skill directory; `previous` is the validated installed manifest or undefined. */\nfunction replaceSkill(target: Location, host: string, next: { tree: Tree; manifest: Manifest }, previous: Manifest | undefined): void {\n assertPath(target.path);\n const parent = dirname(target.path);\n mkdirSync(parent, { recursive: true });\n const staging = mkdtempSync(join(dirname(parent), '.apphx-stage-'));\n const replacement = join(staging, target.skill);\n const backup = join(staging, 'previous');\n let moved = false;\n try {\n mkdirSync(replacement);\n for (const [file, bytes] of Object.entries(next.tree.files)) {\n const path = join(replacement, file);\n mkdirSync(dirname(path), { recursive: true });\n writeFileSync(path, bytes, { flag: 'wx', mode: 0o644 });\n }\n assertPath(target.path);\n if (previous) {\n if (readOwned(target.path, host).metadataDigest !== previous.metadataDigest) throw new Error('Installation changed during upgrade');\n renameSync(target.path, backup);\n moved = true;\n } else if (lstatSync(target.path, { throwIfNoEntry: false })) throw new Error('Skill appeared during installation; refusing overwrite');\n try { renameSync(replacement, target.path); }\n catch (error) { if (moved) { renameSync(backup, target.path); moved = false; } throw error; }\n if (moved) { readOwned(backup, host); rmSync(backup, { recursive: true }); moved = false; }\n } finally {\n // Keep a displaced install intact if rollback or cleanup was interrupted.\n if (!moved) rmSync(staging, { recursive: true, force: true });\n }\n}\n\nfunction applyIntegration(host: string, options: IntegrationOptions, operation: 'install' | 'update'): IntegrationInspection & { changed: boolean } {\n // Both bundled skills install together so every host gains the /$ apphx workflow and the\n // /$ apphx-obfuscator trigger. The apphx skill is the primary result; its absence gates update.\n const targets = skills.map(name => location(host, options, name));\n const bundles = Object.fromEntries(skills.map(name => [name, bundle(host, name)])) as Record<SkillName, { tree: Tree; manifest: Manifest }>;\n const primary = targets[0]!;\n for (const target of targets) assertPath(target.path);\n if (operation === 'update' && !lstatSync(primary.path, { throwIfNoEntry: false })) throw new Error(`No installation at ${primary.path}; run apphx install ${host} first with the same scope`);\n return withLock(primary, () => {\n for (const target of targets) assertPath(target.path);\n // Validate every existing owned dir up front so foreign content is never adopted or displaced.\n const previous = targets.map(target => lstatSync(target.path, { throwIfNoEntry: false }) ? readOwned(target.path, host) : undefined);\n if (operation === 'update' && !previous[0]) throw new Error(`No installation at ${primary.path}; run apphx install ${host} first with the same scope`);\n const result = { ...details(primary), installed: true, status: 'installed' as const, version: bundles.apphx.manifest.version, current: true };\n const changedAny = targets.some((target, index) => previous[index]?.metadataDigest !== bundles[target.skill].manifest.metadataDigest);\n if (!changedAny) return { ...result, changed: false };\n if (operation === 'install' && previous[0]) throw new Error(`An older or different workflow is installed at ${primary.path}; use apphx update ${host} with the same scope`);\n for (let index = 0; index < targets.length; index++) {\n const target = targets[index]!;\n if (previous[index]?.metadataDigest === bundles[target.skill].manifest.metadataDigest) continue;\n replaceSkill(target, host, bundles[target.skill], previous[index]);\n }\n return { ...result, changed: true };\n });\n}\n\nexport function installIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n return applyIntegration(host, options, 'install');\n}\n\nexport function updateIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n return applyIntegration(host, options, 'update');\n}\n\nexport function uninstallIntegration(host: string, options: IntegrationOptions = {}): IntegrationInspection & { changed: boolean } {\n const targets = skills.map(name => location(host, options, name));\n const primary = targets[0]!;\n for (const target of targets) assertPath(target.path);\n const result = { ...details(primary), installed: false, status: 'missing' as const };\n if (!targets.some(target => lstatSync(target.path, { throwIfNoEntry: false }))) return { ...result, changed: false };\n return withLock(primary, () => {\n for (const target of targets) assertPath(target.path);\n // Validate ownership before deleting anything so a foreign sibling never breaks uninstall halfway.\n for (const target of targets) {\n if (lstatSync(target.path, { throwIfNoEntry: false })) readOwned(target.path, host);\n }\n let changed = false;\n for (const target of targets) {\n if (!lstatSync(target.path, { throwIfNoEntry: false })) continue;\n readOwned(target.path, host);\n rmSync(target.path, { recursive: true });\n changed = true;\n }\n return { ...result, changed };\n });\n}\n"],"mappings":";;;;;;;AAOA,MAAM,SAAS,CAAC,SAAS,kBAAkB;AAE3C,MAAM,SAAS;AACf,MAAM,QAAQ;AACd,MAAM,qBAAgD;CACpD,OAAO,cAAc,IAAI,IAAI,oBAAoB,YAAY,GAAG,CAAC;CACjE,oBAAoB,cAAc,IAAI,IAAI,+BAA+B,YAAY,GAAG,CAAC;AAC3F;AACA,MAAM,cAAc,cAAc,IAAI,IAAI,mBAAmB,YAAY,GAAG,CAAC;AAE7E,MAAa,QAAQ,OAAO,OAAO;CACnC;EAAE,IAAI;EAAS,MAAM;EAAS,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAoB,QAAQ;EAA8C,cAAc;EAAgH,YAAY;EAAiJ,sBAAsB;CAAoB;CACtf;EAAE,IAAI;EAAU,MAAM;EAAe,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAwD,QAAQ;EAA0C,cAAc;EAAgJ,YAAY;EAA0I,sBAAsB;CAAoB;CACxjB;EAAE,IAAI;EAAU,MAAM;EAAU,YAAY;EAAU,kBAAkB;EAAkB,iBAAiB;EAAoB,QAAQ;EAAkC,cAAc;EAA8I,YAAY;EAAyH,sBAAsB;CAAoB;CACpf;EAAE,IAAI;EAAM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