aspectcode 0.4.0 → 1.0.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 (242) hide show
  1. package/README.md +13 -0
  2. package/dist/agentsMdRenderer.d.ts +16 -0
  3. package/dist/agentsMdRenderer.d.ts.map +1 -0
  4. package/dist/agentsMdRenderer.js +137 -0
  5. package/dist/agentsMdRenderer.js.map +1 -0
  6. package/dist/auth.d.ts +31 -0
  7. package/dist/auth.d.ts.map +1 -0
  8. package/dist/auth.js +385 -0
  9. package/dist/auth.js.map +1 -0
  10. package/dist/autoResolve.d.ts +41 -0
  11. package/dist/autoResolve.d.ts.map +1 -0
  12. package/dist/autoResolve.js +196 -0
  13. package/dist/autoResolve.js.map +1 -0
  14. package/dist/changeEvaluator.d.ts +56 -0
  15. package/dist/changeEvaluator.d.ts.map +1 -0
  16. package/dist/changeEvaluator.js +674 -0
  17. package/dist/changeEvaluator.js.map +1 -0
  18. package/dist/cli.d.ts +12 -1
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +1 -1
  21. package/dist/cli.js.map +1 -1
  22. package/dist/config.d.ts +37 -17
  23. package/dist/config.d.ts.map +1 -1
  24. package/dist/config.js +50 -2
  25. package/dist/config.js.map +1 -1
  26. package/dist/dreamCycle.d.ts +57 -0
  27. package/dist/dreamCycle.d.ts.map +1 -0
  28. package/dist/dreamCycle.js +334 -0
  29. package/dist/dreamCycle.js.map +1 -0
  30. package/dist/kbBuilder.d.ts +1 -2
  31. package/dist/kbBuilder.d.ts.map +1 -1
  32. package/dist/kbBuilder.js +1 -2
  33. package/dist/kbBuilder.js.map +1 -1
  34. package/dist/main.d.ts +2 -1
  35. package/dist/main.d.ts.map +1 -1
  36. package/dist/main.js +149 -8
  37. package/dist/main.js.map +1 -1
  38. package/dist/optimize.d.ts +13 -6
  39. package/dist/optimize.d.ts.map +1 -1
  40. package/dist/optimize.js +433 -142
  41. package/dist/optimize.js.map +1 -1
  42. package/dist/pipeline.d.ts +21 -18
  43. package/dist/pipeline.d.ts.map +1 -1
  44. package/dist/pipeline.js +1139 -162
  45. package/dist/pipeline.js.map +1 -1
  46. package/dist/preferences.d.ts +80 -0
  47. package/dist/preferences.d.ts.map +1 -0
  48. package/dist/preferences.js +238 -0
  49. package/dist/preferences.js.map +1 -0
  50. package/dist/runtimeState.d.ts +30 -0
  51. package/dist/runtimeState.d.ts.map +1 -0
  52. package/dist/runtimeState.js +39 -0
  53. package/dist/runtimeState.js.map +1 -0
  54. package/dist/scopedRules.d.ts +84 -0
  55. package/dist/scopedRules.d.ts.map +1 -0
  56. package/dist/scopedRules.js +449 -0
  57. package/dist/scopedRules.js.map +1 -0
  58. package/dist/ui/Dashboard.d.ts +4 -16
  59. package/dist/ui/Dashboard.d.ts.map +1 -1
  60. package/dist/ui/Dashboard.js +339 -141
  61. package/dist/ui/Dashboard.js.map +1 -1
  62. package/dist/ui/MemoryMap.d.ts +16 -0
  63. package/dist/ui/MemoryMap.d.ts.map +1 -0
  64. package/dist/ui/MemoryMap.js +266 -0
  65. package/dist/ui/MemoryMap.js.map +1 -0
  66. package/dist/ui/SettingsPanel.d.ts +18 -0
  67. package/dist/ui/SettingsPanel.d.ts.map +1 -0
  68. package/dist/ui/SettingsPanel.js +241 -0
  69. package/dist/ui/SettingsPanel.js.map +1 -0
  70. package/dist/ui/prompts.d.ts +7 -0
  71. package/dist/ui/prompts.d.ts.map +1 -1
  72. package/dist/ui/prompts.js +63 -0
  73. package/dist/ui/prompts.js.map +1 -1
  74. package/dist/ui/store.d.ts +154 -18
  75. package/dist/ui/store.d.ts.map +1 -1
  76. package/dist/ui/store.js +154 -24
  77. package/dist/ui/store.js.map +1 -1
  78. package/dist/ui/theme.d.ts +1 -8
  79. package/dist/ui/theme.d.ts.map +1 -1
  80. package/dist/ui/theme.js +2 -20
  81. package/dist/ui/theme.js.map +1 -1
  82. package/dist/updateChecker.d.ts +13 -0
  83. package/dist/updateChecker.d.ts.map +1 -0
  84. package/dist/updateChecker.js +66 -0
  85. package/dist/updateChecker.js.map +1 -0
  86. package/dist/usageTracker.d.ts +12 -0
  87. package/dist/usageTracker.d.ts.map +1 -0
  88. package/dist/usageTracker.js +89 -0
  89. package/dist/usageTracker.js.map +1 -0
  90. package/dist/writer.d.ts +1 -7
  91. package/dist/writer.d.ts.map +1 -1
  92. package/dist/writer.js +1 -11
  93. package/dist/writer.js.map +1 -1
  94. package/node_modules/@aspectcode/core/dist/analysis/repo.d.ts.map +1 -1
  95. package/node_modules/@aspectcode/core/dist/analysis/repo.js +13 -2
  96. package/node_modules/@aspectcode/core/dist/analysis/repo.js.map +1 -1
  97. package/node_modules/@aspectcode/core/dist/index.d.ts +1 -3
  98. package/node_modules/@aspectcode/core/dist/index.d.ts.map +1 -1
  99. package/node_modules/@aspectcode/core/dist/index.js +1 -3
  100. package/node_modules/@aspectcode/core/dist/index.js.map +1 -1
  101. package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.d.ts +14 -0
  102. package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.d.ts.map +1 -0
  103. package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.js +191 -0
  104. package/node_modules/@aspectcode/core/dist/parsers/genericExtractors.js.map +1 -0
  105. package/node_modules/@aspectcode/core/dist/parsers/index.d.ts +1 -0
  106. package/node_modules/@aspectcode/core/dist/parsers/index.d.ts.map +1 -1
  107. package/node_modules/@aspectcode/core/dist/parsers/index.js +6 -1
  108. package/node_modules/@aspectcode/core/dist/parsers/index.js.map +1 -1
  109. package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts +20 -0
  110. package/node_modules/@aspectcode/core/dist/parsers/languages.d.ts.map +1 -1
  111. package/node_modules/@aspectcode/core/dist/parsers/languages.js +25 -0
  112. package/node_modules/@aspectcode/core/dist/parsers/languages.js.map +1 -1
  113. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.d.ts.map +1 -1
  114. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js +4 -1
  115. package/node_modules/@aspectcode/core/dist/parsers/tsJsExtractors.js.map +1 -1
  116. package/node_modules/@aspectcode/core/package.json +2 -2
  117. package/node_modules/@aspectcode/core/parsers/cpp.wasm +0 -0
  118. package/node_modules/@aspectcode/core/parsers/go.wasm +0 -0
  119. package/node_modules/@aspectcode/core/parsers/php.wasm +0 -0
  120. package/node_modules/@aspectcode/core/parsers/ruby.wasm +0 -0
  121. package/node_modules/@aspectcode/core/parsers/rust.wasm +0 -0
  122. package/node_modules/@aspectcode/emitters/dist/index.d.ts +1 -17
  123. package/node_modules/@aspectcode/emitters/dist/index.d.ts.map +1 -1
  124. package/node_modules/@aspectcode/emitters/dist/index.js +2 -89
  125. package/node_modules/@aspectcode/emitters/dist/index.js.map +1 -1
  126. package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts +0 -2
  127. package/node_modules/@aspectcode/emitters/dist/instructions/index.d.ts.map +1 -1
  128. package/node_modules/@aspectcode/emitters/dist/instructions/index.js +1 -7
  129. package/node_modules/@aspectcode/emitters/dist/instructions/index.js.map +1 -1
  130. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts +0 -18
  131. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.d.ts.map +1 -1
  132. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js +0 -57
  133. package/node_modules/@aspectcode/emitters/dist/kb/analyzers.js.map +1 -1
  134. package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts +0 -18
  135. package/node_modules/@aspectcode/emitters/dist/kb/conventions.d.ts.map +1 -1
  136. package/node_modules/@aspectcode/emitters/dist/kb/conventions.js +0 -130
  137. package/node_modules/@aspectcode/emitters/dist/kb/conventions.js.map +1 -1
  138. package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts +2 -4
  139. package/node_modules/@aspectcode/emitters/dist/kb/index.d.ts.map +1 -1
  140. package/node_modules/@aspectcode/emitters/dist/kb/index.js +1 -11
  141. package/node_modules/@aspectcode/emitters/dist/kb/index.js.map +1 -1
  142. package/node_modules/@aspectcode/emitters/package.json +3 -3
  143. package/node_modules/@aspectcode/evaluator/dist/apply.d.ts +55 -0
  144. package/node_modules/@aspectcode/evaluator/dist/apply.d.ts.map +1 -0
  145. package/node_modules/@aspectcode/evaluator/dist/apply.js +368 -0
  146. package/node_modules/@aspectcode/evaluator/dist/apply.js.map +1 -0
  147. package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts +16 -25
  148. package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts.map +1 -1
  149. package/node_modules/@aspectcode/evaluator/dist/diagnosis.js +115 -138
  150. package/node_modules/@aspectcode/evaluator/dist/diagnosis.js.map +1 -1
  151. package/node_modules/@aspectcode/evaluator/dist/index.d.ts +8 -43
  152. package/node_modules/@aspectcode/evaluator/dist/index.d.ts.map +1 -1
  153. package/node_modules/@aspectcode/evaluator/dist/index.js +15 -61
  154. package/node_modules/@aspectcode/evaluator/dist/index.js.map +1 -1
  155. package/node_modules/@aspectcode/evaluator/dist/judge.d.ts +32 -0
  156. package/node_modules/@aspectcode/evaluator/dist/judge.d.ts.map +1 -0
  157. package/node_modules/@aspectcode/evaluator/dist/judge.js +165 -0
  158. package/node_modules/@aspectcode/evaluator/dist/judge.js.map +1 -0
  159. package/node_modules/@aspectcode/evaluator/dist/llmUtil.d.ts +15 -0
  160. package/node_modules/@aspectcode/evaluator/dist/llmUtil.d.ts.map +1 -0
  161. package/node_modules/@aspectcode/evaluator/dist/llmUtil.js +41 -0
  162. package/node_modules/@aspectcode/evaluator/dist/llmUtil.js.map +1 -0
  163. package/node_modules/@aspectcode/evaluator/dist/probes.d.ts +20 -29
  164. package/node_modules/@aspectcode/evaluator/dist/probes.d.ts.map +1 -1
  165. package/node_modules/@aspectcode/evaluator/dist/probes.js +188 -204
  166. package/node_modules/@aspectcode/evaluator/dist/probes.js.map +1 -1
  167. package/node_modules/@aspectcode/evaluator/dist/runner.d.ts +7 -32
  168. package/node_modules/@aspectcode/evaluator/dist/runner.d.ts.map +1 -1
  169. package/node_modules/@aspectcode/evaluator/dist/runner.js +21 -146
  170. package/node_modules/@aspectcode/evaluator/dist/runner.js.map +1 -1
  171. package/node_modules/@aspectcode/evaluator/dist/types.d.ts +141 -99
  172. package/node_modules/@aspectcode/evaluator/dist/types.d.ts.map +1 -1
  173. package/node_modules/@aspectcode/evaluator/dist/types.js +10 -2
  174. package/node_modules/@aspectcode/evaluator/dist/types.js.map +1 -1
  175. package/node_modules/@aspectcode/evaluator/package.json +4 -4
  176. package/node_modules/@aspectcode/optimizer/dist/index.d.ts +3 -10
  177. package/node_modules/@aspectcode/optimizer/dist/index.d.ts.map +1 -1
  178. package/node_modules/@aspectcode/optimizer/dist/index.js +1 -19
  179. package/node_modules/@aspectcode/optimizer/dist/index.js.map +1 -1
  180. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.d.ts.map +1 -1
  181. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js +40 -0
  182. package/node_modules/@aspectcode/optimizer/dist/providers/anthropic.js.map +1 -1
  183. package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.d.ts +9 -0
  184. package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.d.ts.map +1 -0
  185. package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.js +83 -0
  186. package/node_modules/@aspectcode/optimizer/dist/providers/aspectcode.js.map +1 -0
  187. package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts +4 -3
  188. package/node_modules/@aspectcode/optimizer/dist/providers/index.d.ts.map +1 -1
  189. package/node_modules/@aspectcode/optimizer/dist/providers/index.js +24 -10
  190. package/node_modules/@aspectcode/optimizer/dist/providers/index.js.map +1 -1
  191. package/node_modules/@aspectcode/optimizer/dist/providers/openai.d.ts.map +1 -1
  192. package/node_modules/@aspectcode/optimizer/dist/providers/openai.js +22 -0
  193. package/node_modules/@aspectcode/optimizer/dist/providers/openai.js.map +1 -1
  194. package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts +14 -0
  195. package/node_modules/@aspectcode/optimizer/dist/providers/retry.d.ts.map +1 -1
  196. package/node_modules/@aspectcode/optimizer/dist/providers/retry.js +1 -0
  197. package/node_modules/@aspectcode/optimizer/dist/providers/retry.js.map +1 -1
  198. package/node_modules/@aspectcode/optimizer/dist/types.d.ts +14 -0
  199. package/node_modules/@aspectcode/optimizer/dist/types.d.ts.map +1 -1
  200. package/node_modules/@aspectcode/optimizer/dist/types.js.map +1 -1
  201. package/node_modules/@aspectcode/optimizer/package.json +2 -2
  202. package/package.json +6 -7
  203. package/dist/complaintProcessor.d.ts +0 -16
  204. package/dist/complaintProcessor.d.ts.map +0 -1
  205. package/dist/complaintProcessor.js +0 -134
  206. package/dist/complaintProcessor.js.map +0 -1
  207. package/node_modules/@aspectcode/emitters/dist/emitter.d.ts +0 -72
  208. package/node_modules/@aspectcode/emitters/dist/emitter.d.ts.map +0 -1
  209. package/node_modules/@aspectcode/emitters/dist/emitter.js +0 -10
  210. package/node_modules/@aspectcode/emitters/dist/emitter.js.map +0 -1
  211. package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts +0 -15
  212. package/node_modules/@aspectcode/emitters/dist/instructions/content.d.ts.map +0 -1
  213. package/node_modules/@aspectcode/emitters/dist/instructions/content.js +0 -289
  214. package/node_modules/@aspectcode/emitters/dist/instructions/content.js.map +0 -1
  215. package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts +0 -13
  216. package/node_modules/@aspectcode/emitters/dist/instructions/detection.d.ts.map +0 -1
  217. package/node_modules/@aspectcode/emitters/dist/instructions/detection.js +0 -55
  218. package/node_modules/@aspectcode/emitters/dist/instructions/detection.js.map +0 -1
  219. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts +0 -9
  220. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.d.ts.map +0 -1
  221. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js +0 -30
  222. package/node_modules/@aspectcode/emitters/dist/instructions/instructionsEmitter.js.map +0 -1
  223. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts +0 -21
  224. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.d.ts.map +0 -1
  225. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js +0 -125
  226. package/node_modules/@aspectcode/emitters/dist/kb/kbEmitter.js.map +0 -1
  227. package/node_modules/@aspectcode/emitters/dist/manifest.d.ts +0 -37
  228. package/node_modules/@aspectcode/emitters/dist/manifest.d.ts.map +0 -1
  229. package/node_modules/@aspectcode/emitters/dist/manifest.js +0 -50
  230. package/node_modules/@aspectcode/emitters/dist/manifest.js.map +0 -1
  231. package/node_modules/@aspectcode/emitters/dist/report.d.ts +0 -22
  232. package/node_modules/@aspectcode/emitters/dist/report.d.ts.map +0 -1
  233. package/node_modules/@aspectcode/emitters/dist/report.js +0 -3
  234. package/node_modules/@aspectcode/emitters/dist/report.js.map +0 -1
  235. package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts +0 -14
  236. package/node_modules/@aspectcode/emitters/dist/stableJson.d.ts.map +0 -1
  237. package/node_modules/@aspectcode/emitters/dist/stableJson.js +0 -40
  238. package/node_modules/@aspectcode/emitters/dist/stableJson.js.map +0 -1
  239. package/node_modules/@aspectcode/emitters/dist/transaction.d.ts +0 -29
  240. package/node_modules/@aspectcode/emitters/dist/transaction.d.ts.map +0 -1
  241. package/node_modules/@aspectcode/emitters/dist/transaction.js +0 -104
  242. package/node_modules/@aspectcode/emitters/dist/transaction.js.map +0 -1
@@ -1,134 +0,0 @@
1
- "use strict";
2
- /**
3
- * Complaint processor — takes queued user complaints, calls the
4
- * complaint agent to update AGENTS.md, and reports changes via the store.
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || (function () {
23
- var ownKeys = function(o) {
24
- ownKeys = Object.getOwnPropertyNames || function (o) {
25
- var ar = [];
26
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
- return ar;
28
- };
29
- return ownKeys(o);
30
- };
31
- return function (mod) {
32
- if (mod && mod.__esModule) return mod;
33
- var result = {};
34
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
- __setModuleDefault(result, mod);
36
- return result;
37
- };
38
- })();
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.processComplaints = processComplaints;
41
- const fs = __importStar(require("fs"));
42
- const path = __importStar(require("path"));
43
- const optimizer_1 = require("@aspectcode/optimizer");
44
- const emitters_1 = require("@aspectcode/emitters");
45
- const config_1 = require("./config");
46
- const writer_1 = require("./writer");
47
- const store_1 = require("./ui/store");
48
- /**
49
- * Drain the complaint queue and apply each batch of complaints to AGENTS.md.
50
- *
51
- * Reads the current AGENTS.md, sends complaints + KB context to the LLM,
52
- * writes the updated file, and surfaces changes in the dashboard.
53
- *
54
- * @returns true if at least one complaint was processed, false otherwise.
55
- */
56
- async function processComplaints(ctx, ownership, kbContent) {
57
- const { root, flags, log } = ctx;
58
- // ── Collect all queued complaints ─────────────────────────
59
- const complaints = [];
60
- let next;
61
- while ((next = store_1.store.shiftComplaint()) !== undefined) {
62
- complaints.push(next);
63
- }
64
- if (complaints.length === 0)
65
- return false;
66
- // ── Resolve LLM provider ─────────────────────────────────
67
- const config = (0, config_1.loadConfig)(root);
68
- const optConfig = config?.optimize;
69
- const model = flags.model ?? optConfig?.model;
70
- const providerName = flags.provider ?? optConfig?.provider;
71
- const maxTokens = optConfig?.maxTokens;
72
- const temperature = flags.temperature ?? optConfig?.temperature;
73
- let env;
74
- try {
75
- env = (0, optimizer_1.loadEnvFile)(root);
76
- }
77
- catch {
78
- env = {};
79
- }
80
- if (providerName && !env['LLM_PROVIDER']) {
81
- env['LLM_PROVIDER'] = providerName;
82
- }
83
- const providerOptions = {};
84
- if (model)
85
- providerOptions.model = model;
86
- if (temperature !== undefined)
87
- providerOptions.temperature = temperature;
88
- if (maxTokens !== undefined)
89
- providerOptions.maxTokens = maxTokens;
90
- let provider;
91
- try {
92
- provider = (0, optimizer_1.resolveProvider)(env, providerOptions);
93
- }
94
- catch {
95
- store_1.store.setWarning('No API key — cannot process complaints.');
96
- return false;
97
- }
98
- // ── Read current AGENTS.md ────────────────────────────────
99
- let currentInstructions;
100
- try {
101
- const agentsPath = path.join(root, 'AGENTS.md');
102
- currentInstructions = fs.readFileSync(agentsPath, 'utf-8');
103
- }
104
- catch {
105
- store_1.store.setWarning('AGENTS.md not found — run the pipeline first.');
106
- return false;
107
- }
108
- // ── Run complaint agent ───────────────────────────────────
109
- store_1.store.setProcessingComplaint(true);
110
- store_1.store.clearComplaintChanges();
111
- log.info(`Processing ${complaints.length} complaint${complaints.length === 1 ? '' : 's'}…`);
112
- const result = await (0, optimizer_1.runComplaintAgent)({
113
- currentInstructions,
114
- kb: kbContent,
115
- complaints,
116
- provider,
117
- log: flags.quiet ? undefined : {
118
- info: (msg) => log.info(msg),
119
- warn: (msg) => log.warn(msg),
120
- error: (msg) => log.error(msg),
121
- debug: (msg) => log.debug(msg),
122
- },
123
- });
124
- // ── Write updated AGENTS.md ───────────────────────────────
125
- if (!flags.dryRun) {
126
- const host = (0, emitters_1.createNodeEmitterHost)();
127
- await (0, writer_1.writeAgentsMd)(host, root, result.optimizedInstructions, ownership);
128
- log.success('AGENTS.md updated from complaints');
129
- }
130
- store_1.store.setComplaintChanges(result.changes);
131
- store_1.store.setProcessingComplaint(false);
132
- return true;
133
- }
134
- //# sourceMappingURL=complaintProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"complaintProcessor.js","sourceRoot":"","sources":["../src/complaintProcessor.ts"],"names":[],"mappings":"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"}
@@ -1,72 +0,0 @@
1
- /**
2
- * Emitter interface — the contract for all artifact generators.
3
- *
4
- * Each emitter takes an AnalysisModel + options and writes files
5
- * via the EmitterHost abstraction. Emitters MUST produce deterministic
6
- * output for the same input (modulo `generatedAt` timestamps).
7
- */
8
- import type { AnalysisModel } from '@aspectcode/core';
9
- import type { EmitterHost } from './host';
10
- /** Mode for instruction content generation. */
11
- export type InstructionsMode = 'safe' | 'permissive' | 'custom' | 'off';
12
- /** Options passed to every emitter. */
13
- export interface EmitOptions {
14
- /** Absolute path to the workspace root. */
15
- workspaceRoot: string;
16
- /**
17
- * Absolute path to the output root where generated artifacts are written.
18
- *
19
- * Defaults to `workspaceRoot`.
20
- *
21
- * This allows generating into a temp directory (tests/CLI/GitHub Action)
22
- * without depending on CWD or VS Code workspace filesystem roots.
23
- */
24
- outDir?: string;
25
- /**
26
- * ISO-8601 timestamp to embed in outputs.
27
- * Defaults to `new Date().toISOString()` if omitted.
28
- * Pass a fixed value in tests for determinism.
29
- */
30
- generatedAt?: string;
31
- /** Instruction content mode. */
32
- instructionsMode?: InstructionsMode;
33
- /** Pre-loaded file contents (avoids re-reading from disk). */
34
- fileContents?: Map<string, string>;
35
- /**
36
- * Whether to generate the KB file (`kb.md`).
37
- *
38
- * Defaults to `false`. When `false`, only instruction files are emitted.
39
- * Set to `true` to generate the knowledge base.
40
- */
41
- generateKb?: boolean;
42
- /**
43
- * List of output format IDs to emit instruction files for.
44
- *
45
- * When omitted or empty, only `AGENTS.md` is written (the universal target).
46
- * Supported values: 'agents', 'copilot', 'cursor', 'claudeCode',
47
- * 'windsurf', 'cline', 'gemini', 'aider', 'amazonq', 'codex'.
48
- *
49
- * AGENTS.md is always written regardless of this list.
50
- */
51
- outputFormats?: string[];
52
- }
53
- /** Result returned by an emitter after writing artifacts. */
54
- export interface EmitResult {
55
- /** Absolute paths of all files written or updated. */
56
- filesWritten: string[];
57
- }
58
- /** A named artifact generator. */
59
- export interface Emitter {
60
- /** Human-readable name (e.g. "aspect-kb", "instructions"). */
61
- readonly name: string;
62
- /**
63
- * Generate and write artifacts.
64
- *
65
- * @param model The analysis model to consume.
66
- * @param host File I/O abstraction.
67
- * @param options Generation options.
68
- * @returns Paths of all files written.
69
- */
70
- emit(model: AnalysisModel, host: EmitterHost, options: EmitOptions): Promise<EmitResult>;
71
- }
72
- //# sourceMappingURL=emitter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAI1C,+CAA+C;AAC/C,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,CAAC;AAExE,uCAAuC;AACvC,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,gCAAgC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IAEpC,8DAA8D;IAC9D,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEnC;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAID,6DAA6D;AAC7D,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAID,kCAAkC;AAClC,MAAM,WAAW,OAAO;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;;;;OAOG;IACH,IAAI,CACF,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAAC;CACxB"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- /**
3
- * Emitter interface — the contract for all artifact generators.
4
- *
5
- * Each emitter takes an AnalysisModel + options and writes files
6
- * via the EmitterHost abstraction. Emitters MUST produce deterministic
7
- * output for the same input (modulo `generatedAt` timestamps).
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- //# sourceMappingURL=emitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"emitter.js","sourceRoot":"","sources":["../src/emitter.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -1,15 +0,0 @@
1
- import type { InstructionsMode } from '../emitter';
2
- /**
3
- * Generates the canonical instruction content.
4
- *
5
- * When `kbAvailable` is true, the content references the `kb.md` knowledge
6
- * base file. When false, it provides standalone rules and guidelines only.
7
- *
8
- * All assistant-specific exports are derived from this single source.
9
- */
10
- export declare function generateCanonicalContentForMode(mode: InstructionsMode, kbAvailable?: boolean): string;
11
- export declare function generateCanonicalContentSafe(): string;
12
- export declare function generateCanonicalContentPermissive(): string;
13
- export declare function generateCanonicalContentSafeKB(): string;
14
- export declare function generateCanonicalContentPermissiveKB(): string;
15
- //# sourceMappingURL=content.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/instructions/content.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAUnD;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,gBAAgB,EACtB,WAAW,UAAQ,GAClB,MAAM,CAOR;AAMD,wBAAgB,4BAA4B,IAAI,MAAM,CAsDrD;AAED,wBAAgB,kCAAkC,IAAI,MAAM,CA4C3D;AAMD,wBAAgB,8BAA8B,IAAI,MAAM,CAkGvD;AAED,wBAAgB,oCAAoC,IAAI,MAAM,CAoD7D"}
@@ -1,289 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateCanonicalContentForMode = generateCanonicalContentForMode;
4
- exports.generateCanonicalContentSafe = generateCanonicalContentSafe;
5
- exports.generateCanonicalContentPermissive = generateCanonicalContentPermissive;
6
- exports.generateCanonicalContentSafeKB = generateCanonicalContentSafeKB;
7
- exports.generateCanonicalContentPermissiveKB = generateCanonicalContentPermissiveKB;
8
- // ─────────────────────────────────────────────────────────────────────────────
9
- // Canonical instruction content - all exports derive from this
10
- //
11
- // Two tiers:
12
- // 1. Rules-only (no KB references) — default when kb.md is not generated
13
- // 2. KB-aware (references kb.md) — used when generateKb is enabled
14
- // ─────────────────────────────────────────────────────────────────────────────
15
- /**
16
- * Generates the canonical instruction content.
17
- *
18
- * When `kbAvailable` is true, the content references the `kb.md` knowledge
19
- * base file. When false, it provides standalone rules and guidelines only.
20
- *
21
- * All assistant-specific exports are derived from this single source.
22
- */
23
- function generateCanonicalContentForMode(mode, kbAvailable = false) {
24
- if (mode === 'permissive') {
25
- return kbAvailable
26
- ? generateCanonicalContentPermissiveKB()
27
- : generateCanonicalContentPermissive();
28
- }
29
- return kbAvailable ? generateCanonicalContentSafeKB() : generateCanonicalContentSafe();
30
- }
31
- // ─────────────────────────────────────────────────────────────────────────────
32
- // Rules-only content (no KB references)
33
- // ─────────────────────────────────────────────────────────────────────────────
34
- function generateCanonicalContentSafe() {
35
- return `## Aspect Code — Coding Guidelines
36
-
37
- **Aspect Code** provides coding guidelines to help you make safer, more informed code changes.
38
-
39
- ## Golden Rules
40
-
41
- 1. **Read before you write.** Open and read the relevant files before multi-file edits.
42
- 2. **Think step-by-step.** Break complex tasks into smaller steps; reason through each before coding.
43
- 3. **Prefer minimal, local changes.** Small patches are safer than large refactors, especially in widely-imported files.
44
- 4. **Never truncate code.** Don't use placeholders like \`// ...rest\` or \`# existing code...\`. Provide complete implementations.
45
- 5. **Don't touch tests, migrations, or third-party code** unless the user explicitly asks you to.
46
- 6. **Never remove referenced logic.** Check all callers before deleting a function, class, or symbol.
47
- 7. **Understand blast radius.** Trace relationships and dependents before refactoring.
48
- 8. **Follow existing naming patterns.** Match the project's existing naming patterns and import styles.
49
- 9. **When unsure, go small.** Propose a minimal, reversible change instead of a sweeping refactor.
50
-
51
- ## Recommended Workflow
52
-
53
- 1. **Understand the task.** Parse requirements; note which files or endpoints are involved.
54
- 2. **Find relevant code.** Locate data models, symbols, and naming conventions.
55
- 3. **Understand relationships.** See which files are commonly edited together and how they connect.
56
- 4. **Trace impact.** Review callers and dependents to gauge the blast radius of changes.
57
- 5. **Gather evidence.** If behavior is unclear, add targeted logging or traces to confirm assumptions.
58
- 6. **Make minimal edits.** Implement the smallest change that solves the task; run tests.
59
-
60
- ## When Changing Code
61
-
62
- - **Read the COMPLETE file** before modifying it. Preserve all existing exports/functions.
63
- - **Add, don't reorganize.** Unless the task says "refactor", avoid moving code around.
64
- - **Check widely-imported files** before editing them — changes ripple to all dependents.
65
- - **Avoid renaming** widely-used symbols without updating all callers.
66
- - **No new dependency cycles.** Before adding an import, verify it won't create a circular dependency.
67
- - **Match conventions.** Follow existing naming patterns (naming, imports, frameworks).
68
- - **Prefer small, localized changes** in the most relevant module.
69
-
70
- ## When Things Go Wrong
71
-
72
- If you encounter repeated errors or unexpected behavior:
73
-
74
- 1. **Use git** to see what changed: \`git diff\`, \`git status\`
75
- 2. **Restore lost code** with \`git checkout -- <file>\` if needed
76
- 3. **Re-read the complete file** before making more changes
77
- 4. **Trace data flows** to understand execution paths
78
- 5. **Run actual tests** to verify behavior before assuming something works
79
-
80
- ## General Guidelines
81
-
82
- - **Start with the most relevant file.** Understand the area before changing it.
83
- - **Check widely-imported modules.** Know which files have many dependents before editing.
84
- - **Follow existing conventions.** Match existing naming patterns and coding styles exactly.
85
- - **Minimal changes.** Make the smallest change that solves the problem correctly.
86
- - **Acknowledge risk.** If editing a widely-imported file, note the elevated risk.
87
- `.trim();
88
- }
89
- function generateCanonicalContentPermissive() {
90
- return `## Aspect Code — Coding Guidelines
91
-
92
- **Aspect Code** provides coding guidelines to help you make informed code changes.
93
-
94
- Use these guidelines as orientation — not as constraints.
95
-
96
- ### Operating Rules (Pragmatic, Not Rigid)
97
-
98
- - Read relevant code before large edits; understand boundaries, flows, and ownership
99
- - If your change creates a conflict with existing structure, either:
100
- - update the code in a way that keeps the existing intent valid, or
101
- - explicitly state the mismatch and proceed with a coherent new structure
102
-
103
- ### You May (Explicitly Allowed)
104
-
105
- - Refactor for clarity: extract functions, split files, consolidate duplicates
106
- - Reorganize modules/folders when it improves cohesion and discoverability
107
- - Touch multiple files when the change is conceptually one improvement
108
- - Change public/internal APIs when it simplifies the design (with follow-through updates)
109
- - Rename symbols for consistency (types, functions, modules) and update references
110
-
111
- ### You Should
112
-
113
- - Explain the new structure in terms of the existing architecture
114
- - Keep changes "conceptually tight": one goal, end-to-end, fully wired
115
- - Update call sites and imports immediately when you move/rename things
116
- - Prefer simplification over novelty; remove unnecessary layers when justified
117
- - Validate that referenced symbols still exist and are still reachable from call sites
118
-
119
- ### Avoid
120
-
121
- - Deleting or renaming referenced symbols without updating all usages
122
- - Unnecessary scope creep (adding features unrelated to the request)
123
- - Blind rewrites that ignore the project's dependency structure and entry points
124
- - "Rebuild everything" refactors when a targeted restructure achieves the goal
125
- - Cosmetic churn that obscures meaningful changes
126
-
127
- ## Suggested Workflow
128
-
129
- 1. Read the relevant code for orientation.
130
- 2. Implement the change end-to-end.
131
- 3. Run tests / build.
132
- `.trim();
133
- }
134
- // ─────────────────────────────────────────────────────────────────────────────
135
- // KB-aware content (references kb.md)
136
- // ─────────────────────────────────────────────────────────────────────────────
137
- function generateCanonicalContentSafeKB() {
138
- return `## Aspect Code Knowledge Base
139
-
140
- **Aspect Code** is a static-analysis tool that generates a Knowledge Base (KB) for your codebase. The KB is in \`kb.md\` at the workspace root and contains these sections:
141
-
142
- | Section | Purpose |
143
- |---------|---------|
144
- | **Architecture** | **Read first.** High-risk hubs, directory layout, entry points—the "Do Not Break" zones |
145
- | **Map** | Data models with signatures, symbol index, naming conventions |
146
- | **Context** | Module clusters (co-edited files), external integrations, data flow paths |
147
-
148
- **Key architectural intelligence:**
149
- - **High-Risk Hubs** in the Architecture section: Files with many dependents—changes here ripple widely
150
- - **Entry Points** in the Architecture section: HTTP handlers, CLI commands, event listeners
151
- - **External Integrations** in the Context section: API clients, database connections, message queues
152
- - **Data Models** in the Map section: ORM models, dataclasses, TypeScript interfaces with signatures
153
-
154
- Read the relevant sections of \`kb.md\` **before** making multi-file changes.
155
-
156
- ## Golden Rules
157
-
158
- 1. **Read the KB as a map, not a checklist.** Use \`kb.md\` to understand architecture, not as a to-do list.
159
- 2. **Read before you write.** Open the relevant KB sections before multi-file edits.
160
- 3. **Check architecture first.** Review the Architecture section to understand high-risk zones before coding.
161
- 4. **Think step-by-step.** Break complex tasks into smaller steps; reason through each before coding.
162
- 5. **Prefer minimal, local changes.** Small patches are safer than large refactors, especially in hub files.
163
- 6. **Never truncate code.** Don't use placeholders like \`// ...rest\` or \`# existing code...\`. Provide complete implementations.
164
- 7. **Don't touch tests, migrations, or third-party code** unless the user explicitly asks you to.
165
- 8. **Never remove referenced logic.** If a symbol appears in the Map section, check all callers before deleting.
166
- 9. **Understand blast radius.** Use the Context and Map sections to trace relationships before refactors.
167
- 10. **Follow naming patterns in the Map section.** Match the project's existing naming patterns and import styles.
168
- 11. **When unsure, go small.** Propose a minimal, reversible change instead of a sweeping refactor.
169
-
170
- ## Recommended Workflow
171
-
172
- 1. **Understand the task.** Parse requirements; note which files or endpoints are involved.
173
- 2. **Check architecture.** Open \`kb.md\` → review the Architecture section for high-risk hubs and entry points.
174
- 3. **Find relevant code.** Review the Map section → locate data models, symbols, and naming conventions.
175
- 4. **Understand relationships.** Review the Context section → see module clusters (co-edited files) and integrations.
176
- 5. **Trace impact.** Review "Called by" in the Map section to gauge the blast radius of changes.
177
- 6. **Gather evidence.** If behavior is unclear, add targeted logging or traces to confirm assumptions.
178
- 7. **Make minimal edits.** Implement the smallest change that solves the task; run tests.
179
-
180
- ## When Changing Code
181
-
182
- - **Read the COMPLETE file** before modifying it. Preserve all existing exports/functions.
183
- - **Add, don't reorganize.** Unless the task says "refactor", avoid moving code around.
184
- - **Check high-risk hubs** (Architecture section) before editing widely-imported files.
185
- - **Avoid renaming** widely-used symbols listed in the Map section without updating all callers.
186
- - **No new cycles.** Before adding an import, verify it won't create a circular dependency (Architecture section).
187
- - **Match conventions.** Follow naming patterns shown in the Map section (naming, imports, frameworks).
188
- - **Check module clusters** (Context section) to understand which files are commonly edited together.
189
- - **Prefer small, localized changes** in the most relevant app module identified by the KB.
190
- - **Use the Architecture, Map, and Context sections** to locate the smallest, safest place to make a change.
191
-
192
- ## How to Use kb.md
193
-
194
- | Section | When to Open | What to Look For |
195
- |---------|--------------|------------------|
196
- | Architecture | **First, always** | High-risk hubs, directory layout, entry points, circular dependencies |
197
- | Map | Before modifying a function | Data models with signatures, symbol index, naming conventions |
198
- | Context | Before architectural changes | Module clusters, external integrations, data flow patterns |
199
-
200
- ### Quick Reference
201
-
202
- - **High-risk hubs** → Files with 3+ dependents listed in the Architecture section—changes ripple widely
203
- - **Entry points** → HTTP handlers, CLI commands, event listeners in the Architecture section
204
- - **External integrations** → HTTP clients, DB connections, message queues in the Context section
205
- - **Data models** → ORM models, dataclasses, interfaces with signatures in the Map section
206
- - **Module clusters** → Files commonly edited together in the Context section
207
- - **High-impact symbol** → 5+ callers in the Map section "Called by" column
208
-
209
- ## When Things Go Wrong
210
-
211
- If you encounter repeated errors or unexpected behavior:
212
-
213
- 1. **Use git** to see what changed: \`git diff\`, \`git status\`
214
- 2. **Restore lost code** with \`git checkout -- <file>\` if needed
215
- 3. **Re-read the complete file** before making more changes
216
- 4. **Trace data flows** using the Context section to understand execution paths
217
- 5. **Run actual tests** to verify behavior before assuming something works
218
- 6. **Check module clusters** in the Context section for related files that may need updates
219
-
220
- ## General Guidelines
221
-
222
- - **Read kb.md first.** Before making changes, consult the relevant knowledge base sections.
223
- - **Start with the Architecture section.** Understand high-risk hubs and entry points.
224
- - **Check hub modules.** Know which files have many dependents before editing.
225
- - **Follow Map section conventions.** Match existing naming patterns and coding styles exactly.
226
- - **Minimal changes.** Make the smallest change that solves the problem correctly.
227
- - **Acknowledge risk.** If editing a hub module or high-impact file, note the elevated risk.
228
-
229
- ## Section Headers (Pattern-Matching)
230
-
231
- **Architecture:** \`## High-Risk Architectural Hubs\`, \`## Directory Layout\`, \`## Entry Points\`, \`## Circular Dependencies\`
232
- **Map:** \`## Data Models\` (with signatures), \`## Symbol Index\` (with Called By), \`## Conventions\`
233
- **Context:** \`## Module Clusters\` (co-edited files), \`## External Integrations\`, \`## Critical Flows\`
234
- `.trim();
235
- }
236
- function generateCanonicalContentPermissiveKB() {
237
- return `## Aspect Code Knowledge Base
238
-
239
- **Aspect Code** is a static-analysis tool that generates a Knowledge Base (KB) for your codebase. The KB is in \`kb.md\` at the workspace root and contains these sections:
240
-
241
- | Section | Purpose |
242
- |---------|---------|
243
- | **Architecture** | Hubs, directory layout, entry points |
244
- | **Map** | Data models with signatures, symbol index, naming conventions |
245
- | **Context** | Module clusters (co-edited files), external integrations, data flow paths |
246
-
247
- Use the Knowledge Base (KB) as orientation and ground truth for architecture and dependencies—not as a constraint.
248
-
249
- ### Operating Rules (KB-First, Not KB-Locked)
250
-
251
- - Read \`kb.md\` before large edits; use it to understand boundaries, flows, and ownership
252
- - Treat the KB as the source of "what connects to what" (entry points, hubs, key types)
253
- - If your change conflicts with the KB, either:
254
- - update the code in a way that keeps the KB's intent valid, or
255
- - explicitly state the mismatch and proceed with a coherent new structure
256
-
257
- ### You May (Explicitly Allowed)
258
-
259
- - Refactor for clarity: extract functions, split files, consolidate duplicates
260
- - Reorganize modules/folders when it improves cohesion and discoverability
261
- - Touch multiple files when the change is conceptually one improvement
262
- - Change public/internal APIs when it simplifies the design (with follow-through updates)
263
- - Edit high-risk hubs when needed—do it deliberately, with dependency awareness
264
- - Rename symbols for consistency (types, functions, modules) and update references
265
-
266
- ### You Should
267
-
268
- - Explain the new structure in terms of the existing architecture
269
- - Keep changes "conceptually tight": one goal, end-to-end, fully wired
270
- - Update call sites and imports immediately when you move/rename things
271
- - Prefer simplification over novelty; remove unnecessary layers when justified
272
- - Validate that referenced symbols still exist and are still reachable from call sites
273
-
274
- ### Avoid
275
-
276
- - Deleting or renaming referenced symbols without updating all usages
277
- - Unnecessary scope creep (adding features unrelated to the request)
278
- - Blind rewrites that ignore \`kb.md\`'s dependency map and entry points
279
- - "Rebuild everything" refactors when a targeted restructure achieves the goal
280
- - Cosmetic churn that obscures meaningful changes
281
-
282
- ## Suggested Workflow
283
-
284
- 1. Skim the relevant sections of \`kb.md\` for orientation.
285
- 2. Implement the change end-to-end.
286
- 3. Run tests / build.
287
- `.trim();
288
- }
289
- //# sourceMappingURL=content.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/instructions/content.ts"],"names":[],"mappings":";;AAkBA,0EAUC;AAMD,oEAsDC;AAED,gFA4CC;AAMD,wEAkGC;AAED,oFAoDC;AAlSD,gFAAgF;AAChF,+DAA+D;AAC/D,EAAE;AACF,aAAa;AACb,2EAA2E;AAC3E,qEAAqE;AACrE,gFAAgF;AAEhF;;;;;;;GAOG;AACH,SAAgB,+BAA+B,CAC7C,IAAsB,EACtB,WAAW,GAAG,KAAK;IAEnB,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QAC1B,OAAO,WAAW;YAChB,CAAC,CAAC,oCAAoC,EAAE;YACxC,CAAC,CAAC,kCAAkC,EAAE,CAAC;IAC3C,CAAC;IACD,OAAO,WAAW,CAAC,CAAC,CAAC,8BAA8B,EAAE,CAAC,CAAC,CAAC,4BAA4B,EAAE,CAAC;AACzF,CAAC;AAED,gFAAgF;AAChF,wCAAwC;AACxC,gFAAgF;AAEhF,SAAgB,4BAA4B;IAC1C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED,SAAgB,kCAAkC;IAChD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED,gFAAgF;AAChF,sCAAsC;AACtC,gFAAgF;AAEhF,SAAgB,8BAA8B;IAC5C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED,SAAgB,oCAAoC;IAClD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDR,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
@@ -1,13 +0,0 @@
1
- import type { EmitterHost } from '../host';
2
- import type { AiToolId } from './formats';
3
- export type AssistantId = 'aspectKB' | 'agentsMd';
4
- /**
5
- * Detects which Aspect Code artifacts exist (KB, instructions).
6
- */
7
- export declare function detectAssistants(host: EmitterHost, workspaceRoot: string): Promise<Set<AssistantId>>;
8
- /**
9
- * Detects which AI coding tools are present in the workspace by checking
10
- * for their config/instruction files on disk.
11
- */
12
- export declare function detectAiTools(host: EmitterHost, workspaceRoot: string): Promise<Set<AiToolId>>;
13
- //# sourceMappingURL=detection.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/instructions/detection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAK1C,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,UAAU,CAAC;AAOlD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAuB3B;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,WAAW,EACjB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAuBxB"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.detectAssistants = detectAssistants;
4
- exports.detectAiTools = detectAiTools;
5
- const formats_1 = require("./formats");
6
- const ASSISTANT_DETECTION_PATHS = [
7
- { id: 'aspectKB', paths: ['.aspect'] },
8
- { id: 'agentsMd', paths: ['AGENTS.md'] },
9
- ];
10
- /**
11
- * Detects which Aspect Code artifacts exist (KB, instructions).
12
- */
13
- async function detectAssistants(host, workspaceRoot) {
14
- const detected = new Set();
15
- const allPromises = ASSISTANT_DETECTION_PATHS.flatMap((check) => check.paths.map(async (p) => {
16
- const abs = host.join(workspaceRoot, p);
17
- try {
18
- return (await host.exists(abs)) ? check.id : null;
19
- }
20
- catch {
21
- return null;
22
- }
23
- }));
24
- const results = await Promise.allSettled(allPromises);
25
- for (const result of results) {
26
- if (result.status === 'fulfilled' && result.value) {
27
- detected.add(result.value);
28
- }
29
- }
30
- return detected;
31
- }
32
- /**
33
- * Detects which AI coding tools are present in the workspace by checking
34
- * for their config/instruction files on disk.
35
- */
36
- async function detectAiTools(host, workspaceRoot) {
37
- const detected = new Set();
38
- const allPromises = formats_1.AI_TOOL_DETECTION_PATHS.flatMap((check) => check.paths.map(async (p) => {
39
- const abs = host.join(workspaceRoot, p);
40
- try {
41
- return (await host.exists(abs)) ? check.id : null;
42
- }
43
- catch {
44
- return null;
45
- }
46
- }));
47
- const results = await Promise.allSettled(allPromises);
48
- for (const result of results) {
49
- if (result.status === 'fulfilled' && result.value) {
50
- detected.add(result.value);
51
- }
52
- }
53
- return detected;
54
- }
55
- //# sourceMappingURL=detection.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"detection.js","sourceRoot":"","sources":["../../src/instructions/detection.ts"],"names":[],"mappings":";;AAgBA,4CA0BC;AAMD,sCA0BC;AAxED,uCAAoD;AAMpD,MAAM,yBAAyB,GAAwD;IACrF,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE;IACtC,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE;CACzC,CAAC;AAEF;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,IAAiB,EACjB,aAAqB;IAErB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAe,CAAC;IAExC,MAAM,WAAW,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC9D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEtD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAClD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,aAAa,CACjC,IAAiB,EACjB,aAAqB;IAErB,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAY,CAAC;IAErC,MAAM,WAAW,GAAG,iCAAuB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAC5D,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC;YACH,OAAO,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;QACpD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAEtD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YAClD,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Instructions emitter — writes AGENTS.md with full-file ownership.
3
- *
4
- * No markers, no merge logic. The entire file is owned by AspectCode.
5
- * Content comes from the static generator or from the optimizer.
6
- */
7
- import type { Emitter } from '../emitter';
8
- export declare function createInstructionsEmitter(): Emitter;
9
- //# sourceMappingURL=instructionsEmitter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instructionsEmitter.d.ts","sourceRoot":"","sources":["../../src/instructions/instructionsEmitter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAA2B,MAAM,YAAY,CAAC;AAInE,wBAAgB,yBAAyB,IAAI,OAAO,CAuBnD"}