aspectcode 0.3.4 → 0.3.5

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 (53) hide show
  1. package/dist/ui/theme.d.ts +3 -3
  2. package/dist/ui/theme.js +3 -3
  3. package/dist/ui/theme.js.map +1 -1
  4. package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts +33 -0
  5. package/node_modules/@aspectcode/evaluator/dist/diagnosis.d.ts.map +1 -0
  6. package/node_modules/@aspectcode/evaluator/dist/diagnosis.js +172 -0
  7. package/node_modules/@aspectcode/evaluator/dist/diagnosis.js.map +1 -0
  8. package/node_modules/@aspectcode/evaluator/dist/harvest/aider.d.ts +23 -0
  9. package/node_modules/@aspectcode/evaluator/dist/harvest/aider.d.ts.map +1 -0
  10. package/node_modules/@aspectcode/evaluator/dist/harvest/aider.js +125 -0
  11. package/node_modules/@aspectcode/evaluator/dist/harvest/aider.js.map +1 -0
  12. package/node_modules/@aspectcode/evaluator/dist/harvest/claudeCode.d.ts +17 -0
  13. package/node_modules/@aspectcode/evaluator/dist/harvest/claudeCode.d.ts.map +1 -0
  14. package/node_modules/@aspectcode/evaluator/dist/harvest/claudeCode.js +223 -0
  15. package/node_modules/@aspectcode/evaluator/dist/harvest/claudeCode.js.map +1 -0
  16. package/node_modules/@aspectcode/evaluator/dist/harvest/cline.d.ts +17 -0
  17. package/node_modules/@aspectcode/evaluator/dist/harvest/cline.d.ts.map +1 -0
  18. package/node_modules/@aspectcode/evaluator/dist/harvest/cline.js +179 -0
  19. package/node_modules/@aspectcode/evaluator/dist/harvest/cline.js.map +1 -0
  20. package/node_modules/@aspectcode/evaluator/dist/harvest/common.d.ts +39 -0
  21. package/node_modules/@aspectcode/evaluator/dist/harvest/common.d.ts.map +1 -0
  22. package/node_modules/@aspectcode/evaluator/dist/harvest/common.js +170 -0
  23. package/node_modules/@aspectcode/evaluator/dist/harvest/common.js.map +1 -0
  24. package/node_modules/@aspectcode/evaluator/dist/harvest/export.d.ts +23 -0
  25. package/node_modules/@aspectcode/evaluator/dist/harvest/export.d.ts.map +1 -0
  26. package/node_modules/@aspectcode/evaluator/dist/harvest/export.js +98 -0
  27. package/node_modules/@aspectcode/evaluator/dist/harvest/export.js.map +1 -0
  28. package/node_modules/@aspectcode/evaluator/dist/harvest/index.d.ts +29 -0
  29. package/node_modules/@aspectcode/evaluator/dist/harvest/index.d.ts.map +1 -0
  30. package/node_modules/@aspectcode/evaluator/dist/harvest/index.js +94 -0
  31. package/node_modules/@aspectcode/evaluator/dist/harvest/index.js.map +1 -0
  32. package/node_modules/@aspectcode/evaluator/dist/harvest/vscodeDb.d.ts +37 -0
  33. package/node_modules/@aspectcode/evaluator/dist/harvest/vscodeDb.d.ts.map +1 -0
  34. package/node_modules/@aspectcode/evaluator/dist/harvest/vscodeDb.js +473 -0
  35. package/node_modules/@aspectcode/evaluator/dist/harvest/vscodeDb.js.map +1 -0
  36. package/node_modules/@aspectcode/evaluator/dist/index.d.ts +48 -0
  37. package/node_modules/@aspectcode/evaluator/dist/index.d.ts.map +1 -0
  38. package/node_modules/@aspectcode/evaluator/dist/index.js +75 -0
  39. package/node_modules/@aspectcode/evaluator/dist/index.js.map +1 -0
  40. package/node_modules/@aspectcode/evaluator/dist/probes.d.ts +38 -0
  41. package/node_modules/@aspectcode/evaluator/dist/probes.d.ts.map +1 -0
  42. package/node_modules/@aspectcode/evaluator/dist/probes.js +229 -0
  43. package/node_modules/@aspectcode/evaluator/dist/probes.js.map +1 -0
  44. package/node_modules/@aspectcode/evaluator/dist/runner.d.ts +34 -0
  45. package/node_modules/@aspectcode/evaluator/dist/runner.d.ts.map +1 -0
  46. package/node_modules/@aspectcode/evaluator/dist/runner.js +183 -0
  47. package/node_modules/@aspectcode/evaluator/dist/runner.js.map +1 -0
  48. package/node_modules/@aspectcode/evaluator/dist/types.d.ts +176 -0
  49. package/node_modules/@aspectcode/evaluator/dist/types.d.ts.map +1 -0
  50. package/node_modules/@aspectcode/evaluator/dist/types.js +9 -0
  51. package/node_modules/@aspectcode/evaluator/dist/types.js.map +1 -0
  52. package/node_modules/@aspectcode/evaluator/package.json +41 -0
  53. package/package.json +2 -1
@@ -3,9 +3,9 @@
3
3
  */
4
4
  export declare const COLORS: {
5
5
  /** Primary brand color */
6
- readonly primary: "#a855f7";
6
+ readonly primary: "#f9731c";
7
7
  /** Dimmed brand accent */
8
- readonly primaryDim: "#7e22ce";
8
+ readonly primaryDim: "#c85a12";
9
9
  /** Success / watching */
10
10
  readonly green: "#22c55e";
11
11
  /** Warnings */
@@ -18,7 +18,7 @@ export declare const COLORS: {
18
18
  readonly white: "#f9fafb";
19
19
  };
20
20
  /**
21
- * Return the banner as a single string, coloured with ANSI purple.
21
+ * Return the banner as a single string, coloured with ANSI orange.
22
22
  * For use in both ink and plain-text contexts.
23
23
  */
24
24
  export declare function getBannerText(): string;
package/dist/ui/theme.js CHANGED
@@ -8,9 +8,9 @@ exports.getBannerText = getBannerText;
8
8
  // ── Colors ───────────────────────────────────────────────────
9
9
  exports.COLORS = {
10
10
  /** Primary brand color */
11
- primary: '#a855f7', // purple-500
11
+ primary: '#f9731c', // orange (brand)
12
12
  /** Dimmed brand accent */
13
- primaryDim: '#7e22ce', // purple-700
13
+ primaryDim: '#c85a12', // orange (dark)
14
14
  /** Success / watching */
15
15
  green: '#22c55e',
16
16
  /** Warnings */
@@ -30,7 +30,7 @@ const BANNER_LINES = [
30
30
  ' |_|',
31
31
  ];
32
32
  /**
33
- * Return the banner as a single string, coloured with ANSI purple.
33
+ * Return the banner as a single string, coloured with ANSI orange.
34
34
  * For use in both ink and plain-text contexts.
35
35
  */
36
36
  function getBannerText() {
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/ui/theme.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAiCH,sCAEC;AAjCD,gEAAgE;AACnD,QAAA,MAAM,GAAG;IACpB,0BAA0B;IAC1B,OAAO,EAAE,SAAS,EAAQ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M,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Diagnosis engine — analyzes probe failures and proposes AGENTS.md edits.
3
+ *
4
+ * Takes failed probe results + current AGENTS.md, asks the LLM to identify
5
+ * which rules are missing/weak/wrong, and returns targeted edits.
6
+ */
7
+ import type { LlmProvider, OptLogger } from '@aspectcode/optimizer';
8
+ import type { ProbeResult, Diagnosis } from './types';
9
+ /**
10
+ * Build the diagnosis prompt from failed probe results.
11
+ */
12
+ declare function buildDiagnosisPrompt(failures: ProbeResult[], agentsContent: string): string;
13
+ /** Parse the structured diagnosis response. */
14
+ declare function parseDiagnosisResponse(response: string, failureCount: number): Diagnosis;
15
+ /**
16
+ * Diagnose AGENTS.md shortcomings from failed probe results.
17
+ *
18
+ * Sends the failures + current AGENTS.md to the LLM and asks it to
19
+ * identify what needs to change and propose specific edits.
20
+ */
21
+ export declare function diagnose(failures: ProbeResult[], agentsContent: string, provider: LlmProvider, log?: OptLogger, signal?: AbortSignal): Promise<Diagnosis>;
22
+ /**
23
+ * Apply diagnosis edits to AGENTS.md content.
24
+ *
25
+ * Uses the LLM to intelligently merge the proposed edits into the
26
+ * existing content, since edits reference sections by name (not line number).
27
+ */
28
+ export declare function applyDiagnosisEdits(agentsContent: string, diagnosis: Diagnosis, provider: LlmProvider, log?: OptLogger, signal?: AbortSignal): Promise<{
29
+ content: string;
30
+ appliedEdits: string[];
31
+ }>;
32
+ export { buildDiagnosisPrompt, parseDiagnosisResponse };
33
+ //# sourceMappingURL=diagnosis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnosis.d.ts","sourceRoot":"","sources":["../src/diagnosis.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAe,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAc,MAAM,SAAS,CAAC;AAElE;;GAEG;AACH,iBAAS,oBAAoB,CAC3B,QAAQ,EAAE,WAAW,EAAE,EACvB,aAAa,EAAE,MAAM,GACpB,MAAM,CAqCR;AAED,+CAA+C;AAC/C,iBAAS,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAoCjF;AAED;;;;;GAKG;AACH,wBAAsB,QAAQ,CAC5B,QAAQ,EAAE,WAAW,EAAE,EACvB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,WAAW,EACrB,GAAG,CAAC,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,SAAS,CAAC,CAiCpB;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,WAAW,EACrB,GAAG,CAAC,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAoDtD;AAGD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,CAAC"}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ /**
3
+ * Diagnosis engine — analyzes probe failures and proposes AGENTS.md edits.
4
+ *
5
+ * Takes failed probe results + current AGENTS.md, asks the LLM to identify
6
+ * which rules are missing/weak/wrong, and returns targeted edits.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.diagnose = diagnose;
10
+ exports.applyDiagnosisEdits = applyDiagnosisEdits;
11
+ exports.buildDiagnosisPrompt = buildDiagnosisPrompt;
12
+ exports.parseDiagnosisResponse = parseDiagnosisResponse;
13
+ /**
14
+ * Build the diagnosis prompt from failed probe results.
15
+ */
16
+ function buildDiagnosisPrompt(failures, agentsContent) {
17
+ const failureSummaries = failures.map((f, i) => {
18
+ const shortcomings = f.shortcomings.map((s) => ` - ${s}`).join('\n');
19
+ return `${i + 1}. Probe: ${f.probeId}\n Shortcomings:\n${shortcomings}`;
20
+ }).join('\n\n');
21
+ return `You are diagnosing why an AI coding assistant's AGENTS.md instructions
22
+ are failing to guide it correctly. Below are probe test results showing
23
+ specific scenarios where the AI fell short.
24
+
25
+ ## Failed Probes
26
+ ${failureSummaries}
27
+
28
+ ## Current AGENTS.md
29
+ ${agentsContent}
30
+
31
+ ## Task
32
+ Analyze the failures and identify what in AGENTS.md needs to change.
33
+ For each issue, propose a specific, actionable edit.
34
+
35
+ Respond in EXACTLY this format:
36
+
37
+ SUMMARY: <one paragraph overview of what's wrong>
38
+
39
+ EDIT_1:
40
+ SECTION: <which section/area of AGENTS.md>
41
+ ACTION: add|modify|strengthen|remove
42
+ CONTENT: <the proposed rule or change>
43
+ MOTIVATED_BY: <comma-separated probe IDs>
44
+
45
+ EDIT_2:
46
+ SECTION: ...
47
+ ACTION: ...
48
+ CONTENT: ...
49
+ MOTIVATED_BY: ...
50
+
51
+ (continue for each edit needed)`;
52
+ }
53
+ /** Parse the structured diagnosis response. */
54
+ function parseDiagnosisResponse(response, failureCount) {
55
+ // Parse summary
56
+ const summaryMatch = response.match(/SUMMARY:\s*(.+?)(?=\n\s*EDIT_\d|$)/is);
57
+ const summary = summaryMatch ? summaryMatch[1].trim() : 'Could not parse diagnosis summary.';
58
+ // Parse edits
59
+ const edits = [];
60
+ const editRegex = /EDIT_\d+:\s*\nSECTION:\s*(.+?)\nACTION:\s*(add|modify|strengthen|remove)\s*\nCONTENT:\s*(.+?)\nMOTIVATED_BY:\s*(.+?)(?=\n\s*EDIT_\d|$)/gis;
61
+ let match;
62
+ while ((match = editRegex.exec(response)) !== null) {
63
+ edits.push({
64
+ section: match[1].trim(),
65
+ action: match[2].trim().toLowerCase(),
66
+ content: match[3].trim(),
67
+ motivatedBy: match[4].trim().split(/,\s*/).filter(Boolean),
68
+ });
69
+ }
70
+ // Fallback: if regex didn't match cleanly, try a looser parse
71
+ if (edits.length === 0) {
72
+ const looseEditRegex = /SECTION:\s*(.+?)\n.*?ACTION:\s*(\w+)\n.*?CONTENT:\s*(.+?)\n.*?MOTIVATED_BY:\s*(.+?)(?=\n\s*(?:EDIT|SECTION)|$)/gis;
73
+ while ((match = looseEditRegex.exec(response)) !== null) {
74
+ const action = match[2].trim().toLowerCase();
75
+ if (['add', 'modify', 'strengthen', 'remove'].includes(action)) {
76
+ edits.push({
77
+ section: match[1].trim(),
78
+ action: action,
79
+ content: match[3].trim(),
80
+ motivatedBy: match[4].trim().split(/,\s*/).filter(Boolean),
81
+ });
82
+ }
83
+ }
84
+ }
85
+ return { edits, summary, failureCount };
86
+ }
87
+ /**
88
+ * Diagnose AGENTS.md shortcomings from failed probe results.
89
+ *
90
+ * Sends the failures + current AGENTS.md to the LLM and asks it to
91
+ * identify what needs to change and propose specific edits.
92
+ */
93
+ async function diagnose(failures, agentsContent, provider, log, signal) {
94
+ if (failures.length === 0) {
95
+ return { edits: [], summary: 'All probes passed.', failureCount: 0 };
96
+ }
97
+ if (signal?.aborted) {
98
+ return { edits: [], summary: 'Cancelled.', failureCount: failures.length };
99
+ }
100
+ log?.info(`Diagnosing ${failures.length} probe failure${failures.length === 1 ? '' : 's'}…`);
101
+ const prompt = buildDiagnosisPrompt(failures, agentsContent);
102
+ const messages = [
103
+ { role: 'user', content: prompt },
104
+ ];
105
+ let response;
106
+ try {
107
+ response = await provider.chat(messages);
108
+ }
109
+ catch (err) {
110
+ const msg = err instanceof Error ? err.message : String(err);
111
+ log?.error(`Diagnosis LLM call failed: ${msg}`);
112
+ return {
113
+ edits: [],
114
+ summary: `Diagnosis failed: ${msg}`,
115
+ failureCount: failures.length,
116
+ };
117
+ }
118
+ const diagnosis = parseDiagnosisResponse(response, failures.length);
119
+ log?.info(`Diagnosis: ${diagnosis.edits.length} edit${diagnosis.edits.length === 1 ? '' : 's'} proposed`);
120
+ return diagnosis;
121
+ }
122
+ /**
123
+ * Apply diagnosis edits to AGENTS.md content.
124
+ *
125
+ * Uses the LLM to intelligently merge the proposed edits into the
126
+ * existing content, since edits reference sections by name (not line number).
127
+ */
128
+ async function applyDiagnosisEdits(agentsContent, diagnosis, provider, log, signal) {
129
+ if (diagnosis.edits.length === 0) {
130
+ return { content: agentsContent, appliedEdits: [] };
131
+ }
132
+ if (signal?.aborted) {
133
+ return { content: agentsContent, appliedEdits: [] };
134
+ }
135
+ const editDescriptions = diagnosis.edits
136
+ .map((e, i) => `${i + 1}. [${e.action.toUpperCase()}] Section "${e.section}": ${e.content}`)
137
+ .join('\n');
138
+ const prompt = `Apply the following edits to the AGENTS.md instructions.
139
+ Each edit specifies a section, an action (add/modify/strengthen/remove), and content.
140
+
141
+ ## Edits to Apply
142
+ ${editDescriptions}
143
+
144
+ ## Current AGENTS.md
145
+ ${agentsContent}
146
+
147
+ ## Rules
148
+ - Apply ALL edits.
149
+ - Keep the same overall structure unless an edit requires restructuring.
150
+ - For "add": insert the new rule in the appropriate section.
151
+ - For "modify": find and replace the relevant rule.
152
+ - For "strengthen": make the existing rule more specific/forceful.
153
+ - For "remove": delete the rule.
154
+ - AGENTS.md must remain fully self-contained — no references to external documents.
155
+ - Output ONLY the full updated AGENTS.md content (no explanations or fences).`;
156
+ const messages = [
157
+ { role: 'user', content: prompt },
158
+ ];
159
+ let response;
160
+ try {
161
+ response = await provider.chat(messages);
162
+ }
163
+ catch (err) {
164
+ const msg = err instanceof Error ? err.message : String(err);
165
+ log?.error(`Edit application failed: ${msg}`);
166
+ return { content: agentsContent, appliedEdits: [] };
167
+ }
168
+ const appliedEdits = diagnosis.edits.map((e) => `[${e.action}] ${e.section}: ${e.content}`);
169
+ log?.info(`Applied ${appliedEdits.length} edit${appliedEdits.length === 1 ? '' : 's'} to AGENTS.md`);
170
+ return { content: response.trim(), appliedEdits };
171
+ }
172
+ //# sourceMappingURL=diagnosis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnosis.js","sourceRoot":"","sources":["../src/diagnosis.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA+FH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,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,GAAG,EAAE,KAAK,CAAC,4BAA4B,GAAG,EAAE,CAAC,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACtD,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CACtC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO,EAAE,CAClD,CAAC;IAEF,GAAG,EAAE,IAAI,CAAC,WAAW,YAAY,CAAC,MAAM,QAAQ,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,eAAe,CAAC,CAAC;IAErG,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,YAAY,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Aider prompt harvester.
3
+ *
4
+ * Parses `.aider.chat.history.md` — a markdown file where:
5
+ * - Sessions start with `# aider chat started at <timestamp>`
6
+ * - User turns are `#### <message>` (H4 headings)
7
+ * - Assistant turns are unprefixed text between H4 headings
8
+ */
9
+ import type { HarvestedPrompt } from '../types';
10
+ import type { OptLogger } from '../types';
11
+ /**
12
+ * Harvest prompts from Aider's chat history.
13
+ */
14
+ export declare function harvestAider(root: string, options?: {
15
+ max?: number;
16
+ since?: Date;
17
+ log?: OptLogger;
18
+ }): Promise<HarvestedPrompt[]>;
19
+ /**
20
+ * Parse aider markdown chat history into harvested prompts.
21
+ */
22
+ export declare function parseAiderHistory(content: string, root: string): HarvestedPrompt[];
23
+ //# sourceMappingURL=aider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aider.d.ts","sourceRoot":"","sources":["../../src/harvest/aider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAK1C;;GAEG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IAAC,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GACxD,OAAO,CAAC,eAAe,EAAE,CAAC,CAe5B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,EAAE,CAoDlF"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * Aider prompt harvester.
4
+ *
5
+ * Parses `.aider.chat.history.md` — a markdown file where:
6
+ * - Sessions start with `# aider chat started at <timestamp>`
7
+ * - User turns are `#### <message>` (H4 headings)
8
+ * - Assistant turns are unprefixed text between H4 headings
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.harvestAider = harvestAider;
45
+ exports.parseAiderHistory = parseAiderHistory;
46
+ const fs = __importStar(require("fs"));
47
+ const path = __importStar(require("path"));
48
+ const common_1 = require("./common");
49
+ /** Default history file name. */
50
+ const HISTORY_FILE = '.aider.chat.history.md';
51
+ /**
52
+ * Harvest prompts from Aider's chat history.
53
+ */
54
+ async function harvestAider(root, options) {
55
+ const log = options?.log ?? common_1.noopLogger;
56
+ const max = options?.max ?? common_1.DEFAULT_MAX_PER_SOURCE;
57
+ const historyPath = path.join(root, HISTORY_FILE);
58
+ if (!fs.existsSync(historyPath)) {
59
+ log.debug(`aider: no history file at ${historyPath}`);
60
+ return [];
61
+ }
62
+ const content = fs.readFileSync(historyPath, 'utf-8');
63
+ const prompts = parseAiderHistory(content, root);
64
+ log.debug(`aider: parsed ${prompts.length} conversation turns`);
65
+ return (0, common_1.filterRecent)(prompts, options?.since, max);
66
+ }
67
+ /**
68
+ * Parse aider markdown chat history into harvested prompts.
69
+ */
70
+ function parseAiderHistory(content, root) {
71
+ const prompts = [];
72
+ const lines = content.split('\n');
73
+ let currentTimestamp;
74
+ let currentUserPrompt;
75
+ let assistantLines = [];
76
+ function flush() {
77
+ if (currentUserPrompt !== undefined && assistantLines.length > 0) {
78
+ const assistantResponse = assistantLines.join('\n').trim();
79
+ if (assistantResponse) {
80
+ const allText = currentUserPrompt + '\n' + assistantResponse;
81
+ prompts.push({
82
+ source: 'aider',
83
+ timestamp: currentTimestamp,
84
+ userPrompt: currentUserPrompt,
85
+ assistantResponse,
86
+ filesReferenced: (0, common_1.extractFilePaths)(allText, root),
87
+ });
88
+ }
89
+ }
90
+ currentUserPrompt = undefined;
91
+ assistantLines = [];
92
+ }
93
+ for (const line of lines) {
94
+ // Session header: # aider chat started at 2025-06-14 10:23:45
95
+ const sessionMatch = line.match(/^# aider chat started at (.+)$/);
96
+ if (sessionMatch) {
97
+ flush();
98
+ currentTimestamp = parseAiderTimestamp(sessionMatch[1].trim());
99
+ continue;
100
+ }
101
+ // User turn: #### <message>
102
+ if (line.startsWith('#### ')) {
103
+ flush();
104
+ currentUserPrompt = line.slice(5).trim();
105
+ continue;
106
+ }
107
+ // Assistant text (anything between user turns)
108
+ if (currentUserPrompt !== undefined) {
109
+ assistantLines.push(line);
110
+ }
111
+ }
112
+ // Flush final turn
113
+ flush();
114
+ return prompts;
115
+ }
116
+ /**
117
+ * Parse aider's timestamp format (YYYY-MM-DD HH:MM:SS) to ISO-8601.
118
+ */
119
+ function parseAiderTimestamp(ts) {
120
+ // "2025-06-14 10:23:45" → "2025-06-14T10:23:45"
121
+ const isoish = ts.replace(' ', 'T');
122
+ const date = new Date(isoish);
123
+ return isNaN(date.getTime()) ? ts : date.toISOString();
124
+ }
125
+ //# sourceMappingURL=aider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aider.js","sourceRoot":"","sources":["../../src/harvest/aider.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcH,oCAkBC;AAKD,8CAoDC;AAvFD,uCAAyB;AACzB,2CAA6B;AAE7B,qCAA8F;AAG9F,iCAAiC;AACjC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAE9C;;GAEG;AACI,KAAK,UAAU,YAAY,CAChC,IAAY,EACZ,OAAyD;IAEzD,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,mBAAU,CAAC;IACvC,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,IAAI,+BAAsB,CAAC;IAEnD,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
+ /**
2
+ * Claude Code prompt harvester.
3
+ *
4
+ * Parses conversation JSONL files from `~/.claude/projects/<hash>/`.
5
+ * Each line is a JSON object with `type: "human" | "assistant" | "summary"`.
6
+ */
7
+ import type { HarvestedPrompt } from '../types';
8
+ import type { OptLogger } from '../types';
9
+ /**
10
+ * Harvest prompts from Claude Code's conversation history.
11
+ */
12
+ export declare function harvestClaudeCode(root: string, options?: {
13
+ max?: number;
14
+ since?: Date;
15
+ log?: OptLogger;
16
+ }): Promise<HarvestedPrompt[]>;
17
+ //# sourceMappingURL=claudeCode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claudeCode.d.ts","sourceRoot":"","sources":["../../src/harvest/claudeCode.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,IAAI,CAAC;IAAC,GAAG,CAAC,EAAE,SAAS,CAAA;CAAE,GACxD,OAAO,CAAC,eAAe,EAAE,CAAC,CAiC5B"}