@runcofactor/cli 0.28.0 → 0.29.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 (115) hide show
  1. package/dist/{account-6FPITX2M.js → account-QWQP6YCY.js} +3 -3
  2. package/dist/{alert-PWERXHCP.js → alert-65FH7P74.js} +4 -4
  3. package/dist/{api-catalog-HCSSHOFY.js → api-catalog-WM6R37CA.js} +3 -3
  4. package/dist/{attachment-A7JAZWWH.js → attachment-FTQTZUTA.js} +3 -3
  5. package/dist/{augmentor-MIEBKJUK.js → augmentor-IQMT6NFX.js} +3 -3
  6. package/dist/{chunk-3VHY375S.js → chunk-3VIBXXNX.js} +2 -2
  7. package/dist/{chunk-IFZ72FZV.js → chunk-3X3TSH2B.js} +2 -2
  8. package/dist/{chunk-ZP3RP4IK.js → chunk-6AJLNMHB.js} +2 -2
  9. package/dist/{chunk-44NI5IDC.js → chunk-6QGUAITE.js} +15 -1
  10. package/dist/{chunk-44NI5IDC.js.map → chunk-6QGUAITE.js.map} +1 -1
  11. package/dist/{chunk-5N4OZPFQ.js → chunk-DECTGV4O.js} +2 -2
  12. package/dist/{chunk-6BAMC77N.js → chunk-E22PSTUP.js} +2 -2
  13. package/dist/{chunk-4ZNTGBJR.js → chunk-EHKHZ5UR.js} +23 -23
  14. package/dist/chunk-EHKHZ5UR.js.map +1 -0
  15. package/dist/{chunk-DHL4O7MG.js → chunk-MBMFYGKN.js} +2 -2
  16. package/dist/{chunk-YBX5BIKL.js → chunk-PK5UICGR.js} +2 -2
  17. package/dist/{chunk-4SV3CGNM.js → chunk-SFRUUIIC.js} +2 -2
  18. package/dist/{chunk-LSL2M7O6.js → chunk-WTMSRIDK.js} +2 -2
  19. package/dist/{credential-KSLGCJU7.js → credential-CKO4ZBMU.js} +3 -3
  20. package/dist/{credential-template-WECUNR4X.js → credential-template-XOZ2FJ6Z.js} +3 -3
  21. package/dist/{dist-5PKCAL5N.js → dist-YPK2RMUK.js} +3 -3
  22. package/dist/{docs-PRUI4LAD.js → docs-WZCQ6GP7.js} +3 -3
  23. package/dist/{environment-ATT4UQCY.js → environment-KO3JUX3V.js} +3 -3
  24. package/dist/{feature-flag-MWIHVJER.js → feature-flag-4YPPF27F.js} +63 -5
  25. package/dist/feature-flag-4YPPF27F.js.map +1 -0
  26. package/dist/index.js +38 -38
  27. package/dist/{init-QBMKWGHZ.js → init-RXWDJV5I.js} +3 -3
  28. package/dist/{install-BHYIXK6G.js → install-Z7EGAEEW.js} +3 -3
  29. package/dist/{issues-JO3OVOV7.js → issues-XOU54YKP.js} +3 -3
  30. package/dist/{knobs-4LLJ4LCU.js → knobs-7MB2O5SW.js} +3 -3
  31. package/dist/{list-JVJSIK52.js → list-5CJZY5BC.js} +3 -3
  32. package/dist/{local-VCZGHODB.js → local-XLBE4JIT.js} +5 -5
  33. package/dist/{login-UBNUPK2H.js → login-6GDATX4X.js} +3 -3
  34. package/dist/{mcp-2BBNDVZI.js → mcp-52UNMEF3.js} +4 -4
  35. package/dist/{metrics-4YOSDGIG.js → metrics-4Z5IJZ7U.js} +3 -3
  36. package/dist/{product-T2PVBVZ4.js → product-N2R3MWZS.js} +3 -3
  37. package/dist/{prompts-MI4QK2ZM.js → prompts-X6FNI6NZ.js} +3 -3
  38. package/dist/{property-EKASZCO7.js → property-VUKL5IFR.js} +3 -3
  39. package/dist/{record-Z4NY75FM.js → record-AVGKVJK7.js} +4 -4
  40. package/dist/{release-Z7WKFMBS.js → release-4QOZ4IP6.js} +3 -3
  41. package/dist/{sandbox-YOODBA5Q.js → sandbox-4ZR6XRIQ.js} +14 -3
  42. package/dist/sandbox-4ZR6XRIQ.js.map +1 -0
  43. package/dist/{scenarios-ABYCUJ4O.js → scenarios-UZBDO3XR.js} +3 -3
  44. package/dist/{schedule-ZRHOCT5Q.js → schedule-XCSZ6NLT.js} +4 -4
  45. package/dist/{session-T7BV73AC.js → session-QXHDS5GP.js} +5 -5
  46. package/dist/{skill-VLCWQJHG.js → skill-FXNE77RE.js} +166 -159
  47. package/dist/skill-FXNE77RE.js.map +1 -0
  48. package/dist/{spec-QPWXRPAG.js → spec-TOUOP4TC.js} +3 -3
  49. package/dist/{src-BH5O6Z3E.js → src-YZGG5ZSL.js} +3 -3
  50. package/dist/{start-5BADZ65B.js → start-JDLIIBPC.js} +3 -3
  51. package/dist/{tag-CIR6U5LL.js → tag-LSS3IOUA.js} +4 -4
  52. package/dist/{task-4YKONXJI.js → task-KCNDIT4A.js} +3 -3
  53. package/dist/{test-suite-PRJ2PGMN.js → test-suite-MOVN2XL5.js} +5 -5
  54. package/dist/{trace-XVB47RLY.js → trace-7OZNMAKV.js} +4 -4
  55. package/dist/{triage-L5WR65KW.js → triage-BRSUW4Z7.js} +4 -4
  56. package/dist/{utilities-LBKWREPU.js → utilities-TXQGGH37.js} +3 -3
  57. package/dist/{workflow-GCZCXPGA.js → workflow-2TVSFQXK.js} +310 -302
  58. package/dist/workflow-2TVSFQXK.js.map +1 -0
  59. package/dist/{workflow-cache-XWTLXIHE.js → workflow-cache-LRH5CAPS.js} +6 -6
  60. package/dist/{workflow-debug-XHR4552F.js → workflow-debug-IWXZXSL2.js} +5 -5
  61. package/dist/{workflow-proposals-VWLKW352.js → workflow-proposals-76D2MM6G.js} +3 -3
  62. package/package.json +1 -1
  63. package/dist/chunk-4ZNTGBJR.js.map +0 -1
  64. package/dist/feature-flag-MWIHVJER.js.map +0 -1
  65. package/dist/sandbox-YOODBA5Q.js.map +0 -1
  66. package/dist/skill-VLCWQJHG.js.map +0 -1
  67. package/dist/workflow-GCZCXPGA.js.map +0 -1
  68. /package/dist/{account-6FPITX2M.js.map → account-QWQP6YCY.js.map} +0 -0
  69. /package/dist/{alert-PWERXHCP.js.map → alert-65FH7P74.js.map} +0 -0
  70. /package/dist/{api-catalog-HCSSHOFY.js.map → api-catalog-WM6R37CA.js.map} +0 -0
  71. /package/dist/{attachment-A7JAZWWH.js.map → attachment-FTQTZUTA.js.map} +0 -0
  72. /package/dist/{augmentor-MIEBKJUK.js.map → augmentor-IQMT6NFX.js.map} +0 -0
  73. /package/dist/{chunk-3VHY375S.js.map → chunk-3VIBXXNX.js.map} +0 -0
  74. /package/dist/{chunk-IFZ72FZV.js.map → chunk-3X3TSH2B.js.map} +0 -0
  75. /package/dist/{chunk-ZP3RP4IK.js.map → chunk-6AJLNMHB.js.map} +0 -0
  76. /package/dist/{chunk-5N4OZPFQ.js.map → chunk-DECTGV4O.js.map} +0 -0
  77. /package/dist/{chunk-6BAMC77N.js.map → chunk-E22PSTUP.js.map} +0 -0
  78. /package/dist/{chunk-DHL4O7MG.js.map → chunk-MBMFYGKN.js.map} +0 -0
  79. /package/dist/{chunk-YBX5BIKL.js.map → chunk-PK5UICGR.js.map} +0 -0
  80. /package/dist/{chunk-4SV3CGNM.js.map → chunk-SFRUUIIC.js.map} +0 -0
  81. /package/dist/{chunk-LSL2M7O6.js.map → chunk-WTMSRIDK.js.map} +0 -0
  82. /package/dist/{credential-KSLGCJU7.js.map → credential-CKO4ZBMU.js.map} +0 -0
  83. /package/dist/{credential-template-WECUNR4X.js.map → credential-template-XOZ2FJ6Z.js.map} +0 -0
  84. /package/dist/{dist-5PKCAL5N.js.map → dist-YPK2RMUK.js.map} +0 -0
  85. /package/dist/{docs-PRUI4LAD.js.map → docs-WZCQ6GP7.js.map} +0 -0
  86. /package/dist/{environment-ATT4UQCY.js.map → environment-KO3JUX3V.js.map} +0 -0
  87. /package/dist/{init-QBMKWGHZ.js.map → init-RXWDJV5I.js.map} +0 -0
  88. /package/dist/{install-BHYIXK6G.js.map → install-Z7EGAEEW.js.map} +0 -0
  89. /package/dist/{issues-JO3OVOV7.js.map → issues-XOU54YKP.js.map} +0 -0
  90. /package/dist/{knobs-4LLJ4LCU.js.map → knobs-7MB2O5SW.js.map} +0 -0
  91. /package/dist/{list-JVJSIK52.js.map → list-5CJZY5BC.js.map} +0 -0
  92. /package/dist/{local-VCZGHODB.js.map → local-XLBE4JIT.js.map} +0 -0
  93. /package/dist/{login-UBNUPK2H.js.map → login-6GDATX4X.js.map} +0 -0
  94. /package/dist/{mcp-2BBNDVZI.js.map → mcp-52UNMEF3.js.map} +0 -0
  95. /package/dist/{metrics-4YOSDGIG.js.map → metrics-4Z5IJZ7U.js.map} +0 -0
  96. /package/dist/{product-T2PVBVZ4.js.map → product-N2R3MWZS.js.map} +0 -0
  97. /package/dist/{prompts-MI4QK2ZM.js.map → prompts-X6FNI6NZ.js.map} +0 -0
  98. /package/dist/{property-EKASZCO7.js.map → property-VUKL5IFR.js.map} +0 -0
  99. /package/dist/{record-Z4NY75FM.js.map → record-AVGKVJK7.js.map} +0 -0
  100. /package/dist/{release-Z7WKFMBS.js.map → release-4QOZ4IP6.js.map} +0 -0
  101. /package/dist/{scenarios-ABYCUJ4O.js.map → scenarios-UZBDO3XR.js.map} +0 -0
  102. /package/dist/{schedule-ZRHOCT5Q.js.map → schedule-XCSZ6NLT.js.map} +0 -0
  103. /package/dist/{session-T7BV73AC.js.map → session-QXHDS5GP.js.map} +0 -0
  104. /package/dist/{spec-QPWXRPAG.js.map → spec-TOUOP4TC.js.map} +0 -0
  105. /package/dist/{src-BH5O6Z3E.js.map → src-YZGG5ZSL.js.map} +0 -0
  106. /package/dist/{start-5BADZ65B.js.map → start-JDLIIBPC.js.map} +0 -0
  107. /package/dist/{tag-CIR6U5LL.js.map → tag-LSS3IOUA.js.map} +0 -0
  108. /package/dist/{task-4YKONXJI.js.map → task-KCNDIT4A.js.map} +0 -0
  109. /package/dist/{test-suite-PRJ2PGMN.js.map → test-suite-MOVN2XL5.js.map} +0 -0
  110. /package/dist/{trace-XVB47RLY.js.map → trace-7OZNMAKV.js.map} +0 -0
  111. /package/dist/{triage-L5WR65KW.js.map → triage-BRSUW4Z7.js.map} +0 -0
  112. /package/dist/{utilities-LBKWREPU.js.map → utilities-TXQGGH37.js.map} +0 -0
  113. /package/dist/{workflow-cache-XWTLXIHE.js.map → workflow-cache-LRH5CAPS.js.map} +0 -0
  114. /package/dist/{workflow-debug-XHR4552F.js.map → workflow-debug-IWXZXSL2.js.map} +0 -0
  115. /package/dist/{workflow-proposals-VWLKW352.js.map → workflow-proposals-76D2MM6G.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
2
2
  import {
3
3
  apiRequest
4
- } from "./chunk-LSL2M7O6.js";
4
+ } from "./chunk-WTMSRIDK.js";
5
5
  import "./chunk-H3LWYSKY.js";
6
6
  import {
7
7
  getArgValue,
@@ -9,7 +9,7 @@ import {
9
9
  resolveConfig
10
10
  } from "./chunk-YBYOOXMK.js";
11
11
  import "./chunk-S3Q7MDCS.js";
12
- import "./chunk-4ZNTGBJR.js";
12
+ import "./chunk-EHKHZ5UR.js";
13
13
  import "./chunk-ZSOAFMES.js";
14
14
  import "./chunk-ICKB3EOT.js";
15
15
 
@@ -278,4 +278,4 @@ async function handleReject(argv, apiUrl, token) {
278
278
  export {
279
279
  runScenarios
280
280
  };
281
- //# sourceMappingURL=scenarios-ABYCUJ4O.js.map
281
+ //# sourceMappingURL=scenarios-UZBDO3XR.js.map
@@ -12,8 +12,8 @@ import {
12
12
  handleRuns,
13
13
  hasTimingFlags,
14
14
  updateRule
15
- } from "./chunk-6BAMC77N.js";
16
- import "./chunk-LSL2M7O6.js";
15
+ } from "./chunk-E22PSTUP.js";
16
+ import "./chunk-WTMSRIDK.js";
17
17
  import "./chunk-H3LWYSKY.js";
18
18
  import {
19
19
  getArgValue,
@@ -21,7 +21,7 @@ import {
21
21
  resolveConfig
22
22
  } from "./chunk-YBYOOXMK.js";
23
23
  import "./chunk-S3Q7MDCS.js";
24
- import "./chunk-4ZNTGBJR.js";
24
+ import "./chunk-EHKHZ5UR.js";
25
25
  import "./chunk-ZSOAFMES.js";
26
26
  import "./chunk-ICKB3EOT.js";
27
27
 
@@ -208,4 +208,4 @@ async function runSchedule(argv) {
208
208
  export {
209
209
  runSchedule
210
210
  };
211
- //# sourceMappingURL=schedule-ZRHOCT5Q.js.map
211
+ //# sourceMappingURL=schedule-XCSZ6NLT.js.map
@@ -2,7 +2,7 @@ import { createRequire as __cr } from "module"; import { fileURLToPath as __fup
2
2
  import {
3
3
  LocalBrowserHost,
4
4
  USER_PAUSED_ERROR
5
- } from "./chunk-DHL4O7MG.js";
5
+ } from "./chunk-MBMFYGKN.js";
6
6
  import "./chunk-JHPFIFRB.js";
7
7
  import {
8
8
  INTERACTION_CAPTURE_SCRIPT
@@ -27,7 +27,7 @@ import {
27
27
  downloadStorageState,
28
28
  selectCredential,
29
29
  uploadStorageState
30
- } from "./chunk-LSL2M7O6.js";
30
+ } from "./chunk-WTMSRIDK.js";
31
31
  import "./chunk-H3LWYSKY.js";
32
32
  import {
33
33
  getArgValue,
@@ -41,9 +41,9 @@ import {
41
41
  consoleLogger,
42
42
  dispatchBrowserTool,
43
43
  dispatchBrowserToolWithTimeout
44
- } from "./chunk-IFZ72FZV.js";
44
+ } from "./chunk-3X3TSH2B.js";
45
45
  import "./chunk-S3Q7MDCS.js";
46
- import "./chunk-4ZNTGBJR.js";
46
+ import "./chunk-EHKHZ5UR.js";
47
47
  import "./chunk-2EHYDUHX.js";
48
48
  import "./chunk-ZSOAFMES.js";
49
49
  import "./chunk-ICKB3EOT.js";
@@ -2543,4 +2543,4 @@ export {
2543
2543
  buildToolArgs,
2544
2544
  runSession
2545
2545
  };
2546
- //# sourceMappingURL=session-T7BV73AC.js.map
2546
+ //# sourceMappingURL=session-QXHDS5GP.js.map
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __cr } from "module"; import { fileURLToPath as __fup } from "url"; import { dirname as __dn } from "path"; const require = __cr(import.meta.url); const __filename = __fup(import.meta.url); const __dirname = __dn(__filename);
2
2
  import {
3
3
  WORKFLOW_GUIDE_CONCEPT_SECTIONS
4
- } from "./chunk-44NI5IDC.js";
4
+ } from "./chunk-6QGUAITE.js";
5
5
  import {
6
6
  brandSkillContentFor,
7
7
  command
@@ -9,9 +9,158 @@ import {
9
9
  import "./chunk-ICKB3EOT.js";
10
10
 
11
11
  // src/skill.ts
12
- import { existsSync, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
12
+ import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
13
+ import { homedir as homedir2 } from "os";
14
+ import { join as join3 } from "path";
15
+
16
+ // src/skill-identity.ts
17
+ var SKILL_SOURCE_KEY = "skill-source";
18
+ function splitFrontmatter(content) {
19
+ const lines = content.split("\n");
20
+ if (lines[0] !== "---") return null;
21
+ for (let i = 1; i < lines.length; i++) {
22
+ if (lines[i] === "---") {
23
+ return {
24
+ frontmatter: lines.slice(1, i).join("\n"),
25
+ // Keep the closing `---` and everything after it in the body so a
26
+ // round-trip with `applyInstallIdentity` reproduces the file exactly.
27
+ body: lines.slice(i).join("\n")
28
+ };
29
+ }
30
+ }
31
+ return null;
32
+ }
33
+ function readFrontmatterField(frontmatter, key) {
34
+ for (const line of frontmatter.split("\n")) {
35
+ const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
36
+ if (match && match[1] === key) return match[2].trim();
37
+ }
38
+ return null;
39
+ }
40
+ function installedSourceKey(content) {
41
+ const parts = splitFrontmatter(content);
42
+ if (!parts) return null;
43
+ return readFrontmatterField(parts.frontmatter, SKILL_SOURCE_KEY) ?? readFrontmatterField(parts.frontmatter, "name");
44
+ }
45
+ function applyInstallIdentity(content, installName, templateKey) {
46
+ if (installName === templateKey) return content;
47
+ const parts = splitFrontmatter(content);
48
+ if (!parts) return content;
49
+ const out = [];
50
+ let wroteName = false;
51
+ let wroteSource = false;
52
+ for (const line of parts.frontmatter.split("\n")) {
53
+ const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
54
+ const key = match?.[1];
55
+ if (key === "name") {
56
+ out.push(`name: ${installName}`);
57
+ out.push(`${SKILL_SOURCE_KEY}: ${templateKey}`);
58
+ wroteName = true;
59
+ wroteSource = true;
60
+ } else if (key === SKILL_SOURCE_KEY) {
61
+ if (!wroteSource) {
62
+ out.push(`${SKILL_SOURCE_KEY}: ${templateKey}`);
63
+ wroteSource = true;
64
+ }
65
+ } else {
66
+ out.push(line);
67
+ }
68
+ }
69
+ if (!wroteName) out.unshift(`name: ${installName}`);
70
+ if (!wroteSource) {
71
+ const nameIdx = out.findIndex((l) => l.startsWith("name:"));
72
+ out.splice(nameIdx >= 0 ? nameIdx + 1 : 0, 0, `${SKILL_SOURCE_KEY}: ${templateKey}`);
73
+ }
74
+ return `---
75
+ ${out.join("\n")}
76
+ ${parts.body}`;
77
+ }
78
+
79
+ // src/skill-install-helpers.ts
80
+ import { existsSync } from "fs";
13
81
  import { homedir } from "os";
14
- import { join as join2 } from "path";
82
+ import { join } from "path";
83
+ var SUPPORTED_AGENTS = ["claude", "codex", "copilot"];
84
+ function isAgentType(value) {
85
+ return value === "claude" || value === "codex" || value === "copilot";
86
+ }
87
+ function detectAgent(options = {}) {
88
+ const env = options.env ?? process.env;
89
+ const cwd = options.cwd ?? process.cwd();
90
+ const pathExists = options.exists ?? existsSync;
91
+ if (env.CLAUDE) return "claude";
92
+ if (env.CODEX || env.CODEX_CI || env.CODEX_THREAD_ID || env.CODEX_MANAGED_PACKAGE_ROOT || env.AGENT_MODE === "codex")
93
+ return "codex";
94
+ if (env.GITHUB_COPILOT || env.COPILOT_AGENT || env.AGENT_MODE === "copilot")
95
+ return "copilot";
96
+ const foundAgents = SUPPORTED_AGENTS.filter(
97
+ (agent) => pathExists(join(cwd, agent === "copilot" ? ".github" : `.${agent}`))
98
+ );
99
+ if (foundAgents.length === 1) return foundAgents[0] ?? null;
100
+ return null;
101
+ }
102
+ function resolveInstallDir(skillName, agent, personal, options = {}) {
103
+ const base = personal ? options.home ?? homedir() : options.cwd ?? process.cwd();
104
+ switch (agent) {
105
+ case "claude":
106
+ return join(base, ".claude", "skills", skillName);
107
+ case "codex":
108
+ return join(base, ".codex", "skills", skillName);
109
+ case "copilot":
110
+ return personal ? join(base, ".copilot", "skills", skillName) : join(base, ".github", "skills", skillName);
111
+ }
112
+ }
113
+ function errorField(error, key) {
114
+ if (typeof error !== "object" || error === null) return void 0;
115
+ const value = error[key];
116
+ return typeof value === "string" ? value : void 0;
117
+ }
118
+ function isInstallPermissionError(error) {
119
+ const code = errorField(error, "code");
120
+ return code === "EACCES" || code === "EPERM" || code === "EROFS";
121
+ }
122
+ function formatErrorSummary(error) {
123
+ const code = errorField(error, "code");
124
+ const message = errorField(error, "message");
125
+ if (code && message) return `${code}: ${message}`;
126
+ if (message) return message;
127
+ if (error instanceof Error) return error.message;
128
+ return String(error);
129
+ }
130
+ function formatInstallWriteFailure(context) {
131
+ const lines = [
132
+ `Could not install ${context.templateName} skill for ${context.agent} at ${context.filePath}.`,
133
+ "",
134
+ isInstallPermissionError(context.error) ? "The destination is not writable from the current shell." : "The CLI could not create or write the destination file.",
135
+ `Failure: ${formatErrorSummary(context.error)}`,
136
+ ""
137
+ ];
138
+ const nameFlag = context.installName === context.templateName ? "" : ` --name ${context.installName}`;
139
+ if (context.personal) {
140
+ lines.push(
141
+ `Personal installs write under your home directory. Check permissions for ${context.dir}.`,
142
+ "",
143
+ "Try again after fixing permissions:",
144
+ ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent} --personal`,
145
+ "",
146
+ "Or run from a writable project directory and install without --personal."
147
+ );
148
+ } else {
149
+ lines.push(
150
+ `Project installs write under the current directory (${context.cwd}).`,
151
+ "Run from a writable project folder, or use --personal to install under your home directory.",
152
+ "",
153
+ "Try:",
154
+ " cd <writable-project>",
155
+ ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent}`,
156
+ ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent} --personal`
157
+ );
158
+ }
159
+ return lines.join("\n");
160
+ }
161
+ function isValidInstallName(value) {
162
+ return /^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value);
163
+ }
15
164
 
16
165
  // src/skill-templates/issue-log-xref.ts
17
166
  var issueLogXrefTemplate = {
@@ -1782,21 +1931,21 @@ var testCasesTemplate = {
1782
1931
 
1783
1932
  // src/skill-templates/debug-run.ts
1784
1933
  import { readFileSync, readdirSync } from "fs";
1785
- import { dirname, join } from "path";
1934
+ import { dirname, join as join2 } from "path";
1786
1935
  import { fileURLToPath } from "url";
1787
1936
  var HERE = dirname(fileURLToPath(import.meta.url));
1788
1937
  function resolveSkillDir() {
1789
1938
  const candidates = [
1790
- join(HERE, "..", "..", "skills", "debug-run"),
1939
+ join2(HERE, "..", "..", "skills", "debug-run"),
1791
1940
  // source tree
1792
- join(HERE, "skills", "debug-run"),
1941
+ join2(HERE, "skills", "debug-run"),
1793
1942
  // dist
1794
- join(HERE, "..", "skills", "debug-run")
1943
+ join2(HERE, "..", "skills", "debug-run")
1795
1944
  // dist split-chunk variant
1796
1945
  ];
1797
1946
  for (const c of candidates) {
1798
1947
  try {
1799
- readFileSync(join(c, "version.json"), "utf-8");
1948
+ readFileSync(join2(c, "version.json"), "utf-8");
1800
1949
  return c;
1801
1950
  } catch {
1802
1951
  }
@@ -1806,12 +1955,12 @@ function resolveSkillDir() {
1806
1955
  );
1807
1956
  }
1808
1957
  var SKILL_DIR = resolveSkillDir();
1809
- var HISTORY_DIR = join(SKILL_DIR, "history");
1958
+ var HISTORY_DIR = join2(SKILL_DIR, "history");
1810
1959
  var versionMeta = JSON.parse(
1811
- readFileSync(join(SKILL_DIR, "version.json"), "utf-8")
1960
+ readFileSync(join2(SKILL_DIR, "version.json"), "utf-8")
1812
1961
  );
1813
1962
  function readVersion(version) {
1814
- return readFileSync(join(HISTORY_DIR, `${version}.md`), "utf-8");
1963
+ return readFileSync(join2(HISTORY_DIR, `${version}.md`), "utf-8");
1815
1964
  }
1816
1965
  function listVersionsOnDisk() {
1817
1966
  return readdirSync(HISTORY_DIR).filter((f) => f.endsWith(".md")).map((f) => f.slice(0, -3));
@@ -1992,148 +2141,9 @@ var SKILL_TEMPLATES = {
1992
2141
  };
1993
2142
 
1994
2143
  // src/skill.ts
1995
- var SKILL_SOURCE_KEY = "skill-source";
1996
2144
  function renderForActiveBrand(template) {
1997
2145
  return brandSkillContentFor(template.render(), command);
1998
2146
  }
1999
- function splitFrontmatter(content) {
2000
- const lines = content.split("\n");
2001
- if (lines[0] !== "---") return null;
2002
- for (let i = 1; i < lines.length; i++) {
2003
- if (lines[i] === "---") {
2004
- return {
2005
- frontmatter: lines.slice(1, i).join("\n"),
2006
- // Keep the closing `---` and everything after it in the body so a
2007
- // round-trip with `applyInstallIdentity` reproduces the file exactly.
2008
- body: lines.slice(i).join("\n")
2009
- };
2010
- }
2011
- }
2012
- return null;
2013
- }
2014
- function readFrontmatterField(frontmatter, key) {
2015
- for (const line of frontmatter.split("\n")) {
2016
- const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
2017
- if (match && match[1] === key) return match[2].trim();
2018
- }
2019
- return null;
2020
- }
2021
- function installedSourceKey(content) {
2022
- const parts = splitFrontmatter(content);
2023
- if (!parts) return null;
2024
- return readFrontmatterField(parts.frontmatter, SKILL_SOURCE_KEY) ?? readFrontmatterField(parts.frontmatter, "name");
2025
- }
2026
- function applyInstallIdentity(content, installName, templateKey) {
2027
- if (installName === templateKey) return content;
2028
- const parts = splitFrontmatter(content);
2029
- if (!parts) return content;
2030
- const out = [];
2031
- let wroteName = false;
2032
- let wroteSource = false;
2033
- for (const line of parts.frontmatter.split("\n")) {
2034
- const match = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/);
2035
- const key = match?.[1];
2036
- if (key === "name") {
2037
- out.push(`name: ${installName}`);
2038
- out.push(`${SKILL_SOURCE_KEY}: ${templateKey}`);
2039
- wroteName = true;
2040
- wroteSource = true;
2041
- } else if (key === SKILL_SOURCE_KEY) {
2042
- if (!wroteSource) {
2043
- out.push(`${SKILL_SOURCE_KEY}: ${templateKey}`);
2044
- wroteSource = true;
2045
- }
2046
- } else {
2047
- out.push(line);
2048
- }
2049
- }
2050
- if (!wroteName) out.unshift(`name: ${installName}`);
2051
- if (!wroteSource) {
2052
- const nameIdx = out.findIndex((l) => l.startsWith("name:"));
2053
- out.splice(nameIdx >= 0 ? nameIdx + 1 : 0, 0, `${SKILL_SOURCE_KEY}: ${templateKey}`);
2054
- }
2055
- return `---
2056
- ${out.join("\n")}
2057
- ${parts.body}`;
2058
- }
2059
- var SUPPORTED_AGENTS = ["claude", "codex", "copilot"];
2060
- function isAgentType(value) {
2061
- return value === "claude" || value === "codex" || value === "copilot";
2062
- }
2063
- function detectAgent(options = {}) {
2064
- const env = options.env ?? process.env;
2065
- const cwd = options.cwd ?? process.cwd();
2066
- const pathExists = options.exists ?? existsSync;
2067
- if (env.CLAUDE) return "claude";
2068
- if (env.CODEX || env.CODEX_CI || env.CODEX_THREAD_ID || env.CODEX_MANAGED_PACKAGE_ROOT || env.AGENT_MODE === "codex")
2069
- return "codex";
2070
- if (env.GITHUB_COPILOT || env.COPILOT_AGENT || env.AGENT_MODE === "copilot")
2071
- return "copilot";
2072
- const foundAgents = SUPPORTED_AGENTS.filter(
2073
- (agent) => pathExists(join2(cwd, agent === "copilot" ? ".github" : `.${agent}`))
2074
- );
2075
- if (foundAgents.length === 1) return foundAgents[0] ?? null;
2076
- return null;
2077
- }
2078
- function resolveInstallDir(skillName, agent, personal, options = {}) {
2079
- const base = personal ? options.home ?? homedir() : options.cwd ?? process.cwd();
2080
- switch (agent) {
2081
- case "claude":
2082
- return join2(base, ".claude", "skills", skillName);
2083
- case "codex":
2084
- return join2(base, ".codex", "skills", skillName);
2085
- case "copilot":
2086
- return personal ? join2(base, ".copilot", "skills", skillName) : join2(base, ".github", "skills", skillName);
2087
- }
2088
- }
2089
- function errorField(error, key) {
2090
- if (typeof error !== "object" || error === null) return void 0;
2091
- const value = error[key];
2092
- return typeof value === "string" ? value : void 0;
2093
- }
2094
- function isInstallPermissionError(error) {
2095
- const code = errorField(error, "code");
2096
- return code === "EACCES" || code === "EPERM" || code === "EROFS";
2097
- }
2098
- function formatErrorSummary(error) {
2099
- const code = errorField(error, "code");
2100
- const message = errorField(error, "message");
2101
- if (code && message) return `${code}: ${message}`;
2102
- if (message) return message;
2103
- if (error instanceof Error) return error.message;
2104
- return String(error);
2105
- }
2106
- function formatInstallWriteFailure(context) {
2107
- const lines = [
2108
- `Could not install ${context.templateName} skill for ${context.agent} at ${context.filePath}.`,
2109
- "",
2110
- isInstallPermissionError(context.error) ? "The destination is not writable from the current shell." : "The CLI could not create or write the destination file.",
2111
- `Failure: ${formatErrorSummary(context.error)}`,
2112
- ""
2113
- ];
2114
- const nameFlag = context.installName === context.templateName ? "" : ` --name ${context.installName}`;
2115
- if (context.personal) {
2116
- lines.push(
2117
- `Personal installs write under your home directory. Check permissions for ${context.dir}.`,
2118
- "",
2119
- "Try again after fixing permissions:",
2120
- ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent} --personal`,
2121
- "",
2122
- "Or run from a writable project directory and install without --personal."
2123
- );
2124
- } else {
2125
- lines.push(
2126
- `Project installs write under the current directory (${context.cwd}).`,
2127
- "Run from a writable project folder, or use --personal to install under your home directory.",
2128
- "",
2129
- "Try:",
2130
- " cd <writable-project>",
2131
- ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent}`,
2132
- ` ${command} skill install ${context.templateName}${nameFlag} --agent ${context.agent} --personal`
2133
- );
2134
- }
2135
- return lines.join("\n");
2136
- }
2137
2147
  function printSkillHelp() {
2138
2148
  const lines = [
2139
2149
  "Usage:",
@@ -2331,11 +2341,11 @@ function runSync() {
2331
2341
  knownVersions: knownVersions(key),
2332
2342
  installedPaths: {
2333
2343
  claudeProject: `.claude/skills/${key}/SKILL.md`,
2334
- claudePersonal: join2(homedir(), ".claude", "skills", key, "SKILL.md"),
2344
+ claudePersonal: join3(homedir2(), ".claude", "skills", key, "SKILL.md"),
2335
2345
  codexProject: `.codex/skills/${key}/SKILL.md`,
2336
- codexPersonal: join2(homedir(), ".codex", "skills", key, "SKILL.md"),
2346
+ codexPersonal: join3(homedir2(), ".codex", "skills", key, "SKILL.md"),
2337
2347
  copilotProject: `.github/skills/${key}/SKILL.md`,
2338
- copilotPersonal: join2(homedir(), ".copilot", "skills", key, "SKILL.md")
2348
+ copilotPersonal: join3(homedir2(), ".copilot", "skills", key, "SKILL.md")
2339
2349
  }
2340
2350
  }));
2341
2351
  const instructions = `# Canary Skill Sync \u2014 Instructions for the Agent
@@ -2423,9 +2433,6 @@ ${JSON.stringify({ skills: manifest }, null, 2)}
2423
2433
  `;
2424
2434
  process.stdout.write(instructions);
2425
2435
  }
2426
- function isValidInstallName(value) {
2427
- return /^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(value);
2428
- }
2429
2436
  function parseInstallArgs(argv) {
2430
2437
  let templateName;
2431
2438
  let installName;
@@ -2504,8 +2511,8 @@ async function runInstall(argv) {
2504
2511
  process.exit(1);
2505
2512
  }
2506
2513
  const dir = resolveInstallDir(installName, agent, personal);
2507
- const filePath = join2(dir, "SKILL.md");
2508
- if (existsSync(filePath) && !force) {
2514
+ const filePath = join3(dir, "SKILL.md");
2515
+ if (existsSync2(filePath) && !force) {
2509
2516
  const existingSource = installedSourceKey(readFileSync2(filePath, "utf-8"));
2510
2517
  if (existingSource && existingSource !== templateName) {
2511
2518
  console.error(
@@ -2583,4 +2590,4 @@ export {
2583
2590
  resolveInstallDir,
2584
2591
  runSkill
2585
2592
  };
2586
- //# sourceMappingURL=skill-VLCWQJHG.js.map
2593
+ //# sourceMappingURL=skill-FXNE77RE.js.map