@intutic/cli 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/dist/cli.d.ts +14 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +348 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/benchmark.d.ts +31 -0
  8. package/dist/commands/benchmark.d.ts.map +1 -0
  9. package/dist/commands/benchmark.js +211 -0
  10. package/dist/commands/benchmark.js.map +1 -0
  11. package/dist/commands/budget.d.ts +7 -0
  12. package/dist/commands/budget.d.ts.map +1 -0
  13. package/dist/commands/budget.js +68 -0
  14. package/dist/commands/budget.js.map +1 -0
  15. package/dist/commands/budgetCompatibility.test.d.ts +2 -0
  16. package/dist/commands/budgetCompatibility.test.d.ts.map +1 -0
  17. package/dist/commands/budgetCompatibility.test.js +19 -0
  18. package/dist/commands/budgetCompatibility.test.js.map +1 -0
  19. package/dist/commands/connect.d.ts +20 -0
  20. package/dist/commands/connect.d.ts.map +1 -0
  21. package/dist/commands/connect.js +1010 -0
  22. package/dist/commands/connect.js.map +1 -0
  23. package/dist/commands/doctor.d.ts +23 -0
  24. package/dist/commands/doctor.d.ts.map +1 -0
  25. package/dist/commands/doctor.js +429 -0
  26. package/dist/commands/doctor.js.map +1 -0
  27. package/dist/commands/enterprise-install.d.ts +36 -0
  28. package/dist/commands/enterprise-install.d.ts.map +1 -0
  29. package/dist/commands/enterprise-install.js +289 -0
  30. package/dist/commands/enterprise-install.js.map +1 -0
  31. package/dist/commands/eval.d.ts +13 -0
  32. package/dist/commands/eval.d.ts.map +1 -0
  33. package/dist/commands/eval.js +67 -0
  34. package/dist/commands/eval.js.map +1 -0
  35. package/dist/commands/exec.d.ts +34 -0
  36. package/dist/commands/exec.d.ts.map +1 -0
  37. package/dist/commands/exec.js +114 -0
  38. package/dist/commands/exec.js.map +1 -0
  39. package/dist/commands/exec.test.d.ts +2 -0
  40. package/dist/commands/exec.test.d.ts.map +1 -0
  41. package/dist/commands/exec.test.js +29 -0
  42. package/dist/commands/exec.test.js.map +1 -0
  43. package/dist/commands/export.d.ts +21 -0
  44. package/dist/commands/export.d.ts.map +1 -0
  45. package/dist/commands/export.js +116 -0
  46. package/dist/commands/export.js.map +1 -0
  47. package/dist/commands/init.d.ts +13 -0
  48. package/dist/commands/init.d.ts.map +1 -0
  49. package/dist/commands/init.js +110 -0
  50. package/dist/commands/init.js.map +1 -0
  51. package/dist/commands/install-daemon.d.ts +61 -0
  52. package/dist/commands/install-daemon.d.ts.map +1 -0
  53. package/dist/commands/install-daemon.js +696 -0
  54. package/dist/commands/install-daemon.js.map +1 -0
  55. package/dist/commands/install-daemon.test.d.ts +2 -0
  56. package/dist/commands/install-daemon.test.d.ts.map +1 -0
  57. package/dist/commands/install-daemon.test.js +93 -0
  58. package/dist/commands/install-daemon.test.js.map +1 -0
  59. package/dist/commands/login.d.ts +14 -0
  60. package/dist/commands/login.d.ts.map +1 -0
  61. package/dist/commands/login.js +121 -0
  62. package/dist/commands/login.js.map +1 -0
  63. package/dist/commands/logout.d.ts +8 -0
  64. package/dist/commands/logout.d.ts.map +1 -0
  65. package/dist/commands/logout.js +13 -0
  66. package/dist/commands/logout.js.map +1 -0
  67. package/dist/commands/mdm.d.ts +23 -0
  68. package/dist/commands/mdm.d.ts.map +1 -0
  69. package/dist/commands/mdm.js +134 -0
  70. package/dist/commands/mdm.js.map +1 -0
  71. package/dist/commands/policy.d.ts +19 -0
  72. package/dist/commands/policy.d.ts.map +1 -0
  73. package/dist/commands/policy.js +232 -0
  74. package/dist/commands/policy.js.map +1 -0
  75. package/dist/commands/prompt.d.ts +11 -0
  76. package/dist/commands/prompt.d.ts.map +1 -0
  77. package/dist/commands/prompt.js +71 -0
  78. package/dist/commands/prompt.js.map +1 -0
  79. package/dist/commands/skill.d.ts +31 -0
  80. package/dist/commands/skill.d.ts.map +1 -0
  81. package/dist/commands/skill.js +349 -0
  82. package/dist/commands/skill.js.map +1 -0
  83. package/dist/commands/sop-audit.d.ts +17 -0
  84. package/dist/commands/sop-audit.d.ts.map +1 -0
  85. package/dist/commands/sop-audit.js +136 -0
  86. package/dist/commands/sop-audit.js.map +1 -0
  87. package/dist/commands/sops.d.ts +4 -0
  88. package/dist/commands/sops.d.ts.map +1 -0
  89. package/dist/commands/sops.js +88 -0
  90. package/dist/commands/sops.js.map +1 -0
  91. package/dist/commands/status.d.ts +11 -0
  92. package/dist/commands/status.d.ts.map +1 -0
  93. package/dist/commands/status.js +107 -0
  94. package/dist/commands/status.js.map +1 -0
  95. package/dist/commands/syncContext.d.ts +18 -0
  96. package/dist/commands/syncContext.d.ts.map +1 -0
  97. package/dist/commands/syncContext.js +37 -0
  98. package/dist/commands/syncContext.js.map +1 -0
  99. package/dist/commands/traces.d.ts +32 -0
  100. package/dist/commands/traces.d.ts.map +1 -0
  101. package/dist/commands/traces.js +207 -0
  102. package/dist/commands/traces.js.map +1 -0
  103. package/dist/commands/whoami.d.ts +12 -0
  104. package/dist/commands/whoami.d.ts.map +1 -0
  105. package/dist/commands/whoami.js +34 -0
  106. package/dist/commands/whoami.js.map +1 -0
  107. package/dist/config/keychain.d.ts +28 -0
  108. package/dist/config/keychain.d.ts.map +1 -0
  109. package/dist/config/keychain.js +98 -0
  110. package/dist/config/keychain.js.map +1 -0
  111. package/dist/config/paths.d.ts +30 -0
  112. package/dist/config/paths.d.ts.map +1 -0
  113. package/dist/config/paths.js +53 -0
  114. package/dist/config/paths.js.map +1 -0
  115. package/dist/config/store.d.ts +25 -0
  116. package/dist/config/store.d.ts.map +1 -0
  117. package/dist/config/store.js +93 -0
  118. package/dist/config/store.js.map +1 -0
  119. package/dist/harness/aider.d.ts +13 -0
  120. package/dist/harness/aider.d.ts.map +1 -0
  121. package/dist/harness/aider.js +48 -0
  122. package/dist/harness/aider.js.map +1 -0
  123. package/dist/harness/antigravity.d.ts +12 -0
  124. package/dist/harness/antigravity.d.ts.map +1 -0
  125. package/dist/harness/antigravity.js +69 -0
  126. package/dist/harness/antigravity.js.map +1 -0
  127. package/dist/harness/base.d.ts +20 -0
  128. package/dist/harness/base.d.ts.map +1 -0
  129. package/dist/harness/base.js +73 -0
  130. package/dist/harness/base.js.map +1 -0
  131. package/dist/harness/claudeCode.d.ts +2 -0
  132. package/dist/harness/claudeCode.d.ts.map +1 -0
  133. package/dist/harness/claudeCode.js +9 -0
  134. package/dist/harness/claudeCode.js.map +1 -0
  135. package/dist/harness/claudeDesktop.d.ts +18 -0
  136. package/dist/harness/claudeDesktop.d.ts.map +1 -0
  137. package/dist/harness/claudeDesktop.js +69 -0
  138. package/dist/harness/claudeDesktop.js.map +1 -0
  139. package/dist/harness/cline.d.ts +13 -0
  140. package/dist/harness/cline.d.ts.map +1 -0
  141. package/dist/harness/cline.js +75 -0
  142. package/dist/harness/cline.js.map +1 -0
  143. package/dist/harness/codex.d.ts +13 -0
  144. package/dist/harness/codex.d.ts.map +1 -0
  145. package/dist/harness/codex.js +86 -0
  146. package/dist/harness/codex.js.map +1 -0
  147. package/dist/harness/continue.d.ts +14 -0
  148. package/dist/harness/continue.d.ts.map +1 -0
  149. package/dist/harness/continue.js +97 -0
  150. package/dist/harness/continue.js.map +1 -0
  151. package/dist/harness/cursor.d.ts +14 -0
  152. package/dist/harness/cursor.d.ts.map +1 -0
  153. package/dist/harness/cursor.js +65 -0
  154. package/dist/harness/cursor.js.map +1 -0
  155. package/dist/harness/detector.d.ts +29 -0
  156. package/dist/harness/detector.d.ts.map +1 -0
  157. package/dist/harness/detector.js +81 -0
  158. package/dist/harness/detector.js.map +1 -0
  159. package/dist/harness/githubCopilot.d.ts +12 -0
  160. package/dist/harness/githubCopilot.d.ts.map +1 -0
  161. package/dist/harness/githubCopilot.js +54 -0
  162. package/dist/harness/githubCopilot.js.map +1 -0
  163. package/dist/harness/goose.d.ts +13 -0
  164. package/dist/harness/goose.d.ts.map +1 -0
  165. package/dist/harness/goose.js +45 -0
  166. package/dist/harness/goose.js.map +1 -0
  167. package/dist/harness/hermes.d.ts +12 -0
  168. package/dist/harness/hermes.d.ts.map +1 -0
  169. package/dist/harness/hermes.js +51 -0
  170. package/dist/harness/hermes.js.map +1 -0
  171. package/dist/harness/n8n.d.ts +17 -0
  172. package/dist/harness/n8n.d.ts.map +1 -0
  173. package/dist/harness/n8n.js +125 -0
  174. package/dist/harness/n8n.js.map +1 -0
  175. package/dist/harness/openWebUI.d.ts +13 -0
  176. package/dist/harness/openWebUI.d.ts.map +1 -0
  177. package/dist/harness/openWebUI.js +25 -0
  178. package/dist/harness/openWebUI.js.map +1 -0
  179. package/dist/harness/openclaw.d.ts +12 -0
  180. package/dist/harness/openclaw.d.ts.map +1 -0
  181. package/dist/harness/openclaw.js +51 -0
  182. package/dist/harness/openclaw.js.map +1 -0
  183. package/dist/harness/openhands.d.ts +12 -0
  184. package/dist/harness/openhands.d.ts.map +1 -0
  185. package/dist/harness/openhands.js +67 -0
  186. package/dist/harness/openhands.js.map +1 -0
  187. package/dist/harness/pi.d.ts +12 -0
  188. package/dist/harness/pi.d.ts.map +1 -0
  189. package/dist/harness/pi.js +51 -0
  190. package/dist/harness/pi.js.map +1 -0
  191. package/dist/harness/rooCode.d.ts +14 -0
  192. package/dist/harness/rooCode.d.ts.map +1 -0
  193. package/dist/harness/rooCode.js +77 -0
  194. package/dist/harness/rooCode.js.map +1 -0
  195. package/dist/harness/types.d.ts +30 -0
  196. package/dist/harness/types.d.ts.map +1 -0
  197. package/dist/harness/types.js +32 -0
  198. package/dist/harness/types.js.map +1 -0
  199. package/dist/harness/vscodeSettingsWriter.d.ts +40 -0
  200. package/dist/harness/vscodeSettingsWriter.d.ts.map +1 -0
  201. package/dist/harness/vscodeSettingsWriter.js +116 -0
  202. package/dist/harness/vscodeSettingsWriter.js.map +1 -0
  203. package/dist/harness/windsurf.d.ts +14 -0
  204. package/dist/harness/windsurf.d.ts.map +1 -0
  205. package/dist/harness/windsurf.js +64 -0
  206. package/dist/harness/windsurf.js.map +1 -0
  207. package/dist/lib/api.d.ts +48 -0
  208. package/dist/lib/api.d.ts.map +1 -0
  209. package/dist/lib/api.js +128 -0
  210. package/dist/lib/api.js.map +1 -0
  211. package/dist/lib/envInjector.d.ts +24 -0
  212. package/dist/lib/envInjector.d.ts.map +1 -0
  213. package/dist/lib/envInjector.js +149 -0
  214. package/dist/lib/envInjector.js.map +1 -0
  215. package/dist/lib/envInjector.test.d.ts +2 -0
  216. package/dist/lib/envInjector.test.d.ts.map +1 -0
  217. package/dist/lib/envInjector.test.js +32 -0
  218. package/dist/lib/envInjector.test.js.map +1 -0
  219. package/dist/lib/gitHooks.d.ts +19 -0
  220. package/dist/lib/gitHooks.d.ts.map +1 -0
  221. package/dist/lib/gitHooks.js +58 -0
  222. package/dist/lib/gitHooks.js.map +1 -0
  223. package/dist/lib/hash.d.ts +11 -0
  224. package/dist/lib/hash.d.ts.map +1 -0
  225. package/dist/lib/hash.js +18 -0
  226. package/dist/lib/hash.js.map +1 -0
  227. package/dist/lib/logger.d.ts +18 -0
  228. package/dist/lib/logger.d.ts.map +1 -0
  229. package/dist/lib/logger.js +33 -0
  230. package/dist/lib/logger.js.map +1 -0
  231. package/dist/lib/onboarding.d.ts +10 -0
  232. package/dist/lib/onboarding.d.ts.map +1 -0
  233. package/dist/lib/onboarding.js +178 -0
  234. package/dist/lib/onboarding.js.map +1 -0
  235. package/dist/lib/process.d.ts +53 -0
  236. package/dist/lib/process.d.ts.map +1 -0
  237. package/dist/lib/process.js +181 -0
  238. package/dist/lib/process.js.map +1 -0
  239. package/dist/lib/process.test.d.ts +2 -0
  240. package/dist/lib/process.test.d.ts.map +1 -0
  241. package/dist/lib/process.test.js +44 -0
  242. package/dist/lib/process.test.js.map +1 -0
  243. package/package.json +55 -0
@@ -0,0 +1,75 @@
1
+ /**
2
+ * cline.ts — Cline adapter (full implementation).
3
+ *
4
+ * Detects the Cline VS Code extension, writes Intutic governance rules
5
+ * as .clinerules (flat file), injects the PreToolUse blocking hook into .cline/hooks/,
6
+ * and configures the proxy base URL via VS Code settings + .env.intutic sidecar.
7
+ *
8
+ * HLD §3.14 — Harness Onboarding Matrix
9
+ * @module
10
+ */
11
+ import { access, readdir, writeFile, rename, mkdir } from 'node:fs/promises';
12
+ import { join, dirname } from 'node:path';
13
+ import { homedir } from 'node:os';
14
+ import { HarnessType } from '@intutic/shared-types';
15
+ import { hashFile } from '../lib/hash.js';
16
+ import { newIso } from '@intutic/id';
17
+ import { writeClineHooks } from '@intutic/sync-daemon/harness/clineHooks';
18
+ import { injectClineProxySettings } from './vscodeSettingsWriter.js';
19
+ const CONFIG_FILE = '.clinerules';
20
+ export const clineAdapter = {
21
+ type: HarnessType.CLINE,
22
+ configFileName: CONFIG_FILE,
23
+ async detect(workspaceRoot) {
24
+ // Check for .clinerules in workspace
25
+ try {
26
+ await access(join(workspaceRoot, CONFIG_FILE));
27
+ return true;
28
+ }
29
+ catch {
30
+ // fall through
31
+ }
32
+ // Check for VS Code extension directory
33
+ try {
34
+ const extensionsDir = join(homedir(), '.vscode', 'extensions');
35
+ const entries = await readdir(extensionsDir);
36
+ return entries.some((entry) => entry.startsWith('saoudrizwan.claude-dev-'));
37
+ }
38
+ catch {
39
+ return false;
40
+ }
41
+ },
42
+ async writeConfig(workspaceRoot, sops, proxyUrl) {
43
+ // 1. Write .clinerules text rules
44
+ const filePath = join(workspaceRoot, CONFIG_FILE);
45
+ const instructions = sops.length > 0
46
+ ? sops.map((sop) => `## ${sop.title}\n\n${sop.content}`).join('\n\n---\n\n')
47
+ : '# Intutic governance active — no SOP rules configured yet.';
48
+ const content = [
49
+ '# Intutic Governance Rules (auto-generated)',
50
+ '# DO NOT EDIT — managed by intutic sync daemon',
51
+ `# Last sync: ${newIso()}`,
52
+ '',
53
+ instructions,
54
+ '',
55
+ ].join('\n');
56
+ await mkdir(dirname(filePath), { recursive: true });
57
+ const tmp = filePath + '.intutic-tmp';
58
+ await writeFile(tmp, content, 'utf-8');
59
+ await rename(tmp, filePath);
60
+ // 2. Write PreToolUse blocking hooks into .cline/hooks/
61
+ await writeClineHooks(workspaceRoot, proxyUrl);
62
+ // 3. Inject proxy URL into VS Code settings + .env.intutic sidecar
63
+ await injectClineProxySettings(workspaceRoot, proxyUrl);
64
+ return filePath;
65
+ },
66
+ async readCurrentHash(workspaceRoot) {
67
+ try {
68
+ return await hashFile(join(workspaceRoot, CONFIG_FILE));
69
+ }
70
+ catch {
71
+ return null;
72
+ }
73
+ },
74
+ };
75
+ //# sourceMappingURL=cline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cline.js","sourceRoot":"","sources":["../../src/harness/cline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC5E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAA;AACzE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEpE,MAAM,WAAW,GAAG,aAAa,CAAA;AAEjC,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,IAAI,EAAE,WAAW,CAAC,KAAK;IACvB,cAAc,EAAE,WAAW;IAE3B,KAAK,CAAC,MAAM,CAAC,aAAqB;QAChC,qCAAqC;QACrC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;YAC9C,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,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;QAE3B,wDAAwD;QACxD,MAAM,eAAe,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;QAE9C,mEAAmE;QACnE,MAAM,wBAAwB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAA;QAEvD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,aAAqB;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * codex.ts — Codex adapter (updated: also writes ~/.codex/config.toml).
3
+ *
4
+ * In addition to the workspace .env.intutic file, writes
5
+ * ~/.codex/config.toml with model_providers.litellm.base_url so Codex
6
+ * routes LLM calls through the Intutic proxy even without env var sourcing.
7
+ *
8
+ * HLD §3.14 — Harness Onboarding Matrix
9
+ * @module
10
+ */
11
+ import type { IHarnessAdapter } from './types.js';
12
+ export declare const codexAdapter: IHarnessAdapter;
13
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/harness/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAOjD,eAAO,MAAM,YAAY,EAAE,eAkE1B,CAAA"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * codex.ts — Codex adapter (updated: also writes ~/.codex/config.toml).
3
+ *
4
+ * In addition to the workspace .env.intutic file, writes
5
+ * ~/.codex/config.toml with model_providers.litellm.base_url so Codex
6
+ * routes LLM calls through the Intutic proxy even without env var sourcing.
7
+ *
8
+ * HLD §3.14 — Harness Onboarding Matrix
9
+ * @module
10
+ */
11
+ import { join, dirname } from 'node:path';
12
+ import { writeFile, rename, mkdir } from 'node:fs/promises';
13
+ import { homedir } from 'node:os';
14
+ import { HarnessType } from '@intutic/shared-types';
15
+ import { hashFile } from '../lib/hash.js';
16
+ import { newIso } from '@intutic/id';
17
+ const CONFIG_FILE = '.env.intutic';
18
+ const CODEX_CONFIG = join(homedir(), '.codex', 'config.toml');
19
+ export const codexAdapter = {
20
+ type: HarnessType.CODEX,
21
+ configFileName: CONFIG_FILE,
22
+ async detect(_workspaceRoot) {
23
+ if (process.env.CODEX_HOME)
24
+ return true;
25
+ const pathDirs = (process.env.PATH ?? '').split(process.platform === 'win32' ? ';' : ':');
26
+ try {
27
+ const { accessSync } = await import('node:fs');
28
+ for (const dir of pathDirs) {
29
+ try {
30
+ accessSync(join(dir, 'codex'));
31
+ return true;
32
+ }
33
+ catch { /* not here */ }
34
+ }
35
+ }
36
+ catch { /* ignore */ }
37
+ return false;
38
+ },
39
+ async writeConfig(workspaceRoot, sops, proxyUrl) {
40
+ // 1. Workspace .env.intutic
41
+ const filePath = join(workspaceRoot, CONFIG_FILE);
42
+ const envContent = [
43
+ '# Intutic Governance Rules (auto-generated)',
44
+ '# DO NOT EDIT — managed by intutic sync daemon',
45
+ `# Last sync: ${newIso()}`,
46
+ '# Source this file: source .env.intutic',
47
+ '',
48
+ `export ANTHROPIC_BASE_URL="${proxyUrl}"`,
49
+ `export OPENAI_BASE_URL="${proxyUrl}"`,
50
+ `export INTUTIC_PROXY_URL="${proxyUrl}"`,
51
+ `export INTUTIC_SOP_COUNT=${sops.length}`,
52
+ '',
53
+ ].join('\n');
54
+ await mkdir(dirname(filePath), { recursive: true });
55
+ const tmpEnv = filePath + '.intutic-tmp';
56
+ await writeFile(tmpEnv, envContent, 'utf-8');
57
+ await rename(tmpEnv, filePath);
58
+ // 2. ~/.codex/config.toml — persists proxy across sessions without env sourcing
59
+ const codexToml = [
60
+ '# Intutic proxy config (auto-generated)',
61
+ '# DO NOT EDIT — managed by intutic sync daemon',
62
+ `# Last sync: ${newIso()}`,
63
+ '',
64
+ '[model_providers.litellm]',
65
+ `base_url = "${proxyUrl}"`,
66
+ '',
67
+ '[model_providers.openai]',
68
+ `base_url = "${proxyUrl}"`,
69
+ '',
70
+ ].join('\n');
71
+ await mkdir(dirname(CODEX_CONFIG), { recursive: true });
72
+ const tmpToml = CODEX_CONFIG + '.intutic-tmp';
73
+ await writeFile(tmpToml, codexToml, 'utf-8');
74
+ await rename(tmpToml, CODEX_CONFIG);
75
+ return filePath;
76
+ },
77
+ async readCurrentHash(workspaceRoot) {
78
+ try {
79
+ return await hashFile(join(workspaceRoot, CONFIG_FILE));
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ },
85
+ };
86
+ //# sourceMappingURL=codex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/harness/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,WAAW,GAAG,cAAc,CAAA;AAClC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAA;AAE7D,MAAM,CAAC,MAAM,YAAY,GAAoB;IAC3C,IAAI,EAAE,WAAW,CAAC,KAAK;IACvB,cAAc,EAAE,WAAW;IAE3B,KAAK,CAAC,MAAM,CAAC,cAAsB;QACjC,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU;YAAE,OAAO,IAAI,CAAA;QACvC,MAAM,QAAQ,GAA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MAAM,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAE9B,gFAAgF;QAChF,MAAM,SAAS,GAAG;YAChB,yCAAyC;YACzC,gDAAgD;YAChD,gBAAgB,MAAM,EAAE,EAAE;YAC1B,EAAE;YACF,2BAA2B;YAC3B,eAAe,QAAQ,GAAG;YAC1B,EAAE;YACF,0BAA0B;YAC1B,eAAe,QAAQ,GAAG;YAC1B,EAAE;SACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAEZ,MAAM,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QACvD,MAAM,OAAO,GAAG,YAAY,GAAG,cAAc,CAAA;QAC7C,MAAM,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC5C,MAAM,MAAM,CAAC,OAAO,EAAE,YAAY,CAAC,CAAA;QAEnC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,aAAqB;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * continue.ts — Continue adapter (proxy URL injection).
3
+ *
4
+ * Detects the Continue AI coding assistant and merges the Intutic
5
+ * proxy URL as apiBase into each model entry in ~/.continue/config.yaml.
6
+ * Continue has no hook system so proxy routing (Vector B) is the only
7
+ * available governance mechanism.
8
+ *
9
+ * HLD §3.14 — Harness Onboarding Matrix
10
+ * @module
11
+ */
12
+ import type { IHarnessAdapter } from './types.js';
13
+ export declare const continueAdapter: IHarnessAdapter;
14
+ //# sourceMappingURL=continue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../src/harness/continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,eAAO,MAAM,eAAe,EAAE,eAgE7B,CAAA"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * continue.ts — Continue adapter (proxy URL injection).
3
+ *
4
+ * Detects the Continue AI coding assistant and merges the Intutic
5
+ * proxy URL as apiBase into each model entry in ~/.continue/config.yaml.
6
+ * Continue has no hook system so proxy routing (Vector B) is the only
7
+ * available governance mechanism.
8
+ *
9
+ * HLD §3.14 — Harness Onboarding Matrix
10
+ * @module
11
+ */
12
+ import { access, readdir, readFile, writeFile, rename, mkdir } from 'node:fs/promises';
13
+ import { join } from 'node:path';
14
+ import { homedir } from 'node:os';
15
+ import { HarnessType } from '@intutic/shared-types';
16
+ import { hashFile } from '../lib/hash.js';
17
+ import { newIso } from '@intutic/id';
18
+ const home = homedir();
19
+ const CONTINUE_DIR = join(home, '.continue');
20
+ const CONFIG_YAML = join(CONTINUE_DIR, 'config.yaml');
21
+ const CONFIG_JSON = join(CONTINUE_DIR, 'config.json');
22
+ export const continueAdapter = {
23
+ type: HarnessType.CONTINUE,
24
+ configFileName: CONFIG_YAML,
25
+ async detect(_workspaceRoot) {
26
+ for (const p of [CONFIG_YAML, CONFIG_JSON]) {
27
+ try {
28
+ await access(p);
29
+ return true;
30
+ }
31
+ catch { /* fall through */ }
32
+ }
33
+ try {
34
+ const entries = await readdir(join(home, '.vscode', 'extensions'));
35
+ return entries.some((e) => e.startsWith('continue.continue-'));
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ },
41
+ async writeConfig(_workspaceRoot, _sops, proxyUrl) {
42
+ // Merge apiBase into each model entry in config.yaml
43
+ let raw = '';
44
+ try {
45
+ raw = await readFile(CONFIG_YAML, 'utf-8');
46
+ }
47
+ catch {
48
+ raw = '';
49
+ }
50
+ // Inject apiBase under each `- name:` model entry.
51
+ // Simple line-based approach that handles the common config.yaml structure.
52
+ const lines = raw.split('\n');
53
+ const result = [];
54
+ let inModels = false;
55
+ for (let i = 0; i < lines.length; i++) {
56
+ const line = lines[i];
57
+ result.push(line);
58
+ if (line.trim() === 'models:') {
59
+ inModels = true;
60
+ continue;
61
+ }
62
+ if (inModels && line.trim().startsWith('- name:')) {
63
+ // After each model entry start, inject apiBase if not already present
64
+ const next = lines[i + 1] ?? '';
65
+ if (!next.trim().startsWith('apiBase:')) {
66
+ result.push(` apiBase: "${proxyUrl}"`);
67
+ }
68
+ }
69
+ if (inModels && line.trim() && !line.startsWith(' ') && !line.trim().startsWith('-') && !line.trim().startsWith('models:')) {
70
+ inModels = false;
71
+ }
72
+ }
73
+ // If config.yaml is empty or has no models section yet, write a minimal config
74
+ if (!raw.includes('models:')) {
75
+ result.push('# Intutic proxy config (auto-generated)');
76
+ result.push(`# Last sync: ${newIso()}`);
77
+ result.push('models:');
78
+ result.push(' - name: "Intutic Governed Model"');
79
+ result.push(` apiBase: "${proxyUrl}"`);
80
+ }
81
+ const content = result.join('\n');
82
+ await mkdir(CONTINUE_DIR, { recursive: true });
83
+ const tmp = CONFIG_YAML + '.intutic-tmp';
84
+ await writeFile(tmp, content, 'utf-8');
85
+ await rename(tmp, CONFIG_YAML);
86
+ return CONFIG_YAML;
87
+ },
88
+ async readCurrentHash(_workspaceRoot) {
89
+ try {
90
+ return await hashFile(CONFIG_YAML);
91
+ }
92
+ catch {
93
+ return null;
94
+ }
95
+ },
96
+ };
97
+ //# sourceMappingURL=continue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.js","sourceRoot":"","sources":["../../src/harness/continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OA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,CAAC,EAAE,CAAC;gBAC3H,QAAQ,GAAG,KAAK,CAAA;YAClB,CAAC;QACH,CAAC;QAED,+EAA+E;QAC/E,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,MAAM,CAAC,IAAI,CAAC,yCAAyC,CAAC,CAAA;YACtD,MAAM,CAAC,IAAI,CAAC,gBAAgB,MAAM,EAAE,EAAE,CAAC,CAAA;YACvC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YACtB,MAAM,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAA;YACjD,MAAM,CAAC,IAAI,CAAC,iBAAiB,QAAQ,GAAG,CAAC,CAAA;QAC3C,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjC,MAAM,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,GAAG,GAAG,WAAW,GAAG,cAAc,CAAA;QACxC,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;QACtC,MAAM,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,CAAA;QAC9B,OAAO,WAAW,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,cAAsB;QAC1C,IAAI,CAAC;YAAC,OAAO,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,IAAI,CAAA;QAAC,CAAC;IAClE,CAAC;CACF,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * cursor.ts — Cursor adapter (full implementation with 3-level hooks).
3
+ *
4
+ * Replaces the minimal createMarkdownAdapter stub with a full adapter that:
5
+ * - Writes .cursorrules governance text (existing behaviour, kept)
6
+ * - Injects hooks.json at project-level AND user-level
7
+ * - Enterprise system-level (/etc/cursor) is handled by the system administrator
8
+ *
9
+ * HLD §3.14 — Harness Onboarding Matrix
10
+ * @module
11
+ */
12
+ import type { IHarnessAdapter } from './types.js';
13
+ export declare const cursorAdapter: IHarnessAdapter;
14
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/harness/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,eAAO,MAAM,aAAa,EAAE,eAgC3B,CAAA"}
@@ -0,0 +1,65 @@
1
+ /**
2
+ * cursor.ts — Cursor adapter (full implementation with 3-level hooks).
3
+ *
4
+ * Replaces the minimal createMarkdownAdapter stub with a full adapter that:
5
+ * - Writes .cursorrules governance text (existing behaviour, kept)
6
+ * - Injects hooks.json at project-level AND user-level
7
+ * - Enterprise system-level (/etc/cursor) is handled by the system administrator
8
+ *
9
+ * HLD §3.14 — Harness Onboarding Matrix
10
+ * @module
11
+ */
12
+ import { access } from 'node:fs/promises';
13
+ import { join } from 'node:path';
14
+ import { homedir } from 'node:os';
15
+ import { HarnessType } from '@intutic/shared-types';
16
+ import { hashFile } from '../lib/hash.js';
17
+ import { buildMarkdownContent } from './base.js';
18
+ import { writeCursorHooks } from '@intutic/sync-daemon/harness/cursorHooks';
19
+ import { writeFile, rename, mkdir } from 'node:fs/promises';
20
+ import { dirname } from 'node:path';
21
+ const CONFIG_FILE = '.cursorrules';
22
+ export const cursorAdapter = {
23
+ type: HarnessType.CURSOR,
24
+ configFileName: CONFIG_FILE,
25
+ async detect(workspaceRoot) {
26
+ // .cursorrules or .cursor/ directory
27
+ for (const marker of [CONFIG_FILE, '.cursor']) {
28
+ try {
29
+ await access(join(workspaceRoot, marker));
30
+ return true;
31
+ }
32
+ catch { /* fall through */ }
33
+ }
34
+ // ~/.cursor directory (user has Cursor installed)
35
+ try {
36
+ await access(join(homedir(), '.cursor'));
37
+ return true;
38
+ }
39
+ catch {
40
+ return false;
41
+ }
42
+ },
43
+ async writeConfig(workspaceRoot, sops, proxyUrl) {
44
+ // 1. Write .cursorrules markdown governance text
45
+ const filePath = join(workspaceRoot, CONFIG_FILE);
46
+ const content = buildMarkdownContent(sops, proxyUrl);
47
+ await mkdir(dirname(filePath), { recursive: true });
48
+ const tmp = filePath + '.intutic-tmp';
49
+ await writeFile(tmp, content, 'utf-8');
50
+ await rename(tmp, filePath);
51
+ // 2. Inject hooks.json at project + user level (writeSystemLevel=false;
52
+ // system level requires sudo execution)
53
+ await writeCursorHooks(workspaceRoot, proxyUrl, '', false);
54
+ return filePath;
55
+ },
56
+ async readCurrentHash(workspaceRoot) {
57
+ try {
58
+ return await hashFile(join(workspaceRoot, CONFIG_FILE));
59
+ }
60
+ catch {
61
+ return null;
62
+ }
63
+ },
64
+ };
65
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/harness/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,WAAW,GAAG,cAAc,CAAA;AAElC,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,IAAI,EAAE,WAAW,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QACzC,IAAI,CAAC;YAAC,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;QAAC,CAAC;QAAC,MAAM,CAAC;YAAC,OAAO,IAAI,CAAA;QAAC,CAAC;IACvF,CAAC;CACF,CAAA"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Harness detector — auto-detect which AI harnesses are present.
3
+ *
4
+ * Instantiates all 14 adapters and checks each for presence in
5
+ * the workspace. Returns a DetectedHarness array for reporting.
6
+ *
7
+ * HLD §3.14 — Harness Onboarding Matrix
8
+ * LLD #8 — Sync Daemon / CLI
9
+ * @module
10
+ */
11
+ import type { DetectedHarness } from '@intutic/shared-types';
12
+ import type { IHarnessAdapter } from './types.js';
13
+ /** All registered harness adapters. */
14
+ export declare const ALL_ADAPTERS: IHarnessAdapter[];
15
+ /**
16
+ * Detect which harnesses are present in a workspace.
17
+ *
18
+ * @param workspaceRoot - Absolute path to workspace root
19
+ * @returns Array of DetectedHarness results
20
+ */
21
+ export declare function detectHarnesses(workspaceRoot: string): Promise<DetectedHarness[]>;
22
+ /**
23
+ * Get adapter for a specific harness type.
24
+ *
25
+ * @param type - Harness type to look up
26
+ * @returns The adapter, or undefined if not found
27
+ */
28
+ export declare function getAdapter(type: string): IHarnessAdapter | undefined;
29
+ //# sourceMappingURL=detector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/harness/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAqBjD,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAAE,eAAe,EAmBzC,CAAA;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAgBvF;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEpE"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Harness detector — auto-detect which AI harnesses are present.
3
+ *
4
+ * Instantiates all 14 adapters and checks each for presence in
5
+ * the workspace. Returns a DetectedHarness array for reporting.
6
+ *
7
+ * HLD §3.14 — Harness Onboarding Matrix
8
+ * LLD #8 — Sync Daemon / CLI
9
+ * @module
10
+ */
11
+ import { cursorAdapter } from './cursor.js';
12
+ import { claudeCodeAdapter } from './claudeCode.js';
13
+ import { antigravityAdapter } from './antigravity.js';
14
+ import { windsurfAdapter } from './windsurf.js';
15
+ import { aiderAdapter } from './aider.js';
16
+ import { openhandsAdapter } from './openhands.js';
17
+ import { codexAdapter } from './codex.js';
18
+ import { n8nAdapter } from './n8n.js';
19
+ import { clineAdapter } from './cline.js';
20
+ import { rooCodeAdapter } from './rooCode.js';
21
+ import { continueAdapter } from './continue.js';
22
+ import { claudeDesktopAdapter } from './claudeDesktop.js';
23
+ import { gooseAdapter } from './goose.js';
24
+ import { openWebUIAdapter } from './openWebUI.js';
25
+ import { openclawAdapter } from './openclaw.js';
26
+ import { piAdapter } from './pi.js';
27
+ import { hermesAdapter } from './hermes.js';
28
+ import { githubCopilotAdapter } from './githubCopilot.js';
29
+ import { join } from 'node:path';
30
+ /** All registered harness adapters. */
31
+ export const ALL_ADAPTERS = [
32
+ cursorAdapter,
33
+ claudeCodeAdapter,
34
+ antigravityAdapter,
35
+ windsurfAdapter,
36
+ aiderAdapter,
37
+ openhandsAdapter,
38
+ codexAdapter,
39
+ n8nAdapter,
40
+ clineAdapter,
41
+ rooCodeAdapter,
42
+ continueAdapter,
43
+ claudeDesktopAdapter,
44
+ gooseAdapter,
45
+ openWebUIAdapter,
46
+ openclawAdapter,
47
+ piAdapter,
48
+ hermesAdapter,
49
+ githubCopilotAdapter,
50
+ ];
51
+ /**
52
+ * Detect which harnesses are present in a workspace.
53
+ *
54
+ * @param workspaceRoot - Absolute path to workspace root
55
+ * @returns Array of DetectedHarness results
56
+ */
57
+ export async function detectHarnesses(workspaceRoot) {
58
+ const results = [];
59
+ for (const adapter of ALL_ADAPTERS) {
60
+ const detected = await adapter.detect(workspaceRoot);
61
+ results.push({
62
+ type: adapter.type,
63
+ configPath: adapter.configFileName
64
+ ? join(workspaceRoot, adapter.configFileName)
65
+ : '',
66
+ detected,
67
+ lastWriteAt: null,
68
+ });
69
+ }
70
+ return results;
71
+ }
72
+ /**
73
+ * Get adapter for a specific harness type.
74
+ *
75
+ * @param type - Harness type to look up
76
+ * @returns The adapter, or undefined if not found
77
+ */
78
+ export function getAdapter(type) {
79
+ return ALL_ADAPTERS.find((a) => a.type === type);
80
+ }
81
+ //# sourceMappingURL=detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/harness/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,EAAE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AC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AAClD,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * githubCopilot.ts — GitHub Copilot adapter.
3
+ *
4
+ * Detects GitHub Copilot presence (.git, .github, or .github/copilot-instructions.md)
5
+ * and writes Markdown rules to `.github/copilot-instructions.md`.
6
+ *
7
+ * HLD §3.14 — Harness Onboarding Matrix
8
+ * @module
9
+ */
10
+ import type { IHarnessAdapter } from './types.js';
11
+ export declare const githubCopilotAdapter: IHarnessAdapter;
12
+ //# sourceMappingURL=githubCopilot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"githubCopilot.d.ts","sourceRoot":"","sources":["../../src/harness/githubCopilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD,eAAO,MAAM,oBAAoB,EAAE,eAmClC,CAAA"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * githubCopilot.ts — GitHub Copilot adapter.
3
+ *
4
+ * Detects GitHub Copilot presence (.git, .github, or .github/copilot-instructions.md)
5
+ * and writes Markdown rules to `.github/copilot-instructions.md`.
6
+ *
7
+ * HLD §3.14 — Harness Onboarding Matrix
8
+ * @module
9
+ */
10
+ import { join, dirname } from 'node:path';
11
+ import { access, mkdir, writeFile, rename } from 'node:fs/promises';
12
+ import { existsSync } from 'node:fs';
13
+ import { HarnessType } from '@intutic/shared-types';
14
+ import { hashFile } from '../lib/hash.js';
15
+ import { buildMarkdownContent } from './base.js';
16
+ const CONFIG_FILE = '.github/copilot-instructions.md';
17
+ export const githubCopilotAdapter = {
18
+ type: HarnessType.GITHUB_COPILOT,
19
+ configFileName: CONFIG_FILE,
20
+ async detect(workspaceRoot) {
21
+ const gitFolder = join(workspaceRoot, '.git');
22
+ const githubFolder = join(workspaceRoot, '.github');
23
+ const configFile = join(workspaceRoot, CONFIG_FILE);
24
+ try {
25
+ if (existsSync(gitFolder) || existsSync(githubFolder))
26
+ return true;
27
+ await access(configFile);
28
+ return true;
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ },
34
+ async writeConfig(workspaceRoot, sops, proxyUrl) {
35
+ if (sops.length === 0)
36
+ return null;
37
+ const filePath = join(workspaceRoot, CONFIG_FILE);
38
+ const tmpPath = filePath + '.intutic-tmp';
39
+ const content = buildMarkdownContent(sops, proxyUrl);
40
+ await mkdir(dirname(filePath), { recursive: true });
41
+ await writeFile(tmpPath, content, 'utf-8');
42
+ await rename(tmpPath, filePath);
43
+ return filePath;
44
+ },
45
+ async readCurrentHash(workspaceRoot) {
46
+ try {
47
+ return await hashFile(join(workspaceRoot, CONFIG_FILE));
48
+ }
49
+ catch {
50
+ return null;
51
+ }
52
+ },
53
+ };
54
+ //# sourceMappingURL=githubCopilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"githubCopilot.js","sourceRoot":"","sources":["../../src/harness/githubCopilot.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAEhD,MAAM,WAAW,GAAG,iCAAiC,CAAA;AAErD,MAAM,CAAC,MAAM,oBAAoB,GAAoB;IACnD,IAAI,EAAE,WAAW,CAAC,cAAc;IAChC,cAAc,EAAE,WAAW;IAE3B,KAAK,CAAC,MAAM,CAAC,aAAqB;QAChC,MAAM,SAAS,GAAG,IAAI,CAAC,aAAa,EAAE,M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ts — Goose adapter (full implementation).
3
+ *
4
+ * Detects the Goose CLI agent, writes SOP rules, injects the Intutic
5
+ * governance plugin (PreToolUse hooks + immutable flags), and merges
6
+ * the proxy URL into ~/.config/goose/config.yaml.
7
+ *
8
+ * HLD §3.14 — Harness Onboarding Matrix
9
+ * @module
10
+ */
11
+ import type { IHarnessAdapter } from './types.js';
12
+ export declare const gooseAdapter: IHarnessAdapter;
13
+ //# sourceMappingURL=goose.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"goose.d.ts","sourceRoot":"","sources":["../../src/harness/goose.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAQjD,eAAO,MAAM,YAAY,EAAE,eA0B1B,CAAA"}