compound-agent 1.7.0 → 1.7.4
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.
- package/CHANGELOG.md +73 -1
- package/README.md +6 -1
- package/dist/cli.js +4979 -3976
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +36 -4
- package/dist/index.js +215 -21
- package/dist/index.js.map +1 -1
- package/docs/research/index.md +1 -1
- package/docs/research/software_architecture/01-science-of-decomposition.md +615 -0
- package/docs/research/software_architecture/02-architecture-under-uncertainty.md +649 -0
- package/docs/research/software_architecture/03-emergent-behavior-in-composed-systems.md +644 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2453,11 +2453,11 @@ type Preference = z.infer<typeof PreferenceItemSchema>;
|
|
|
2453
2453
|
type MemoryItemRecord = z.infer<typeof MemoryItemRecordSchema>;
|
|
2454
2454
|
/**
|
|
2455
2455
|
* Generate deterministic memory item ID from insight text.
|
|
2456
|
-
* Format: {prefix} +
|
|
2456
|
+
* Format: {prefix} + 16 hex characters from SHA-256 hash (64 bits of entropy).
|
|
2457
2457
|
*
|
|
2458
2458
|
* @param insight - The insight text to hash
|
|
2459
2459
|
* @param type - Memory item type (default: 'lesson' for backward compat)
|
|
2460
|
-
* @returns ID string like
|
|
2460
|
+
* @returns ID string like L1a2b3c4d5e6f7g8h
|
|
2461
2461
|
*/
|
|
2462
2462
|
declare function generateId(insight: string, type?: MemoryItemType): string;
|
|
2463
2463
|
|
|
@@ -2509,6 +2509,8 @@ interface ReadLessonsResult {
|
|
|
2509
2509
|
interface ReadMemoryItemsResult {
|
|
2510
2510
|
/** Successfully parsed memory items */
|
|
2511
2511
|
items: MemoryItem[];
|
|
2512
|
+
/** IDs that were tombstoned (deleted) */
|
|
2513
|
+
deletedIds: Set<string>;
|
|
2512
2514
|
/** Number of lines skipped due to errors */
|
|
2513
2515
|
skippedCount: number;
|
|
2514
2516
|
}
|
|
@@ -3409,7 +3411,7 @@ type EmbedStatus = {
|
|
|
3409
3411
|
};
|
|
3410
3412
|
/** Write embedding status to disk. Creates parent directories if needed. */
|
|
3411
3413
|
declare function writeEmbedStatus(repoRoot: string, status: EmbedStatus): void;
|
|
3412
|
-
/** Read embedding status from disk. Returns null on missing file or
|
|
3414
|
+
/** Read embedding status from disk. Returns null on missing file, parse error, or invalid shape. */
|
|
3413
3415
|
declare function readEmbedStatus(repoRoot: string): EmbedStatus | null;
|
|
3414
3416
|
|
|
3415
3417
|
/**
|
|
@@ -3695,4 +3697,34 @@ declare function writeCctPatterns(repoRoot: string, patterns: CctPattern[]): Pro
|
|
|
3695
3697
|
*/
|
|
3696
3698
|
declare function synthesizePattern(cluster: MemoryItem[], clusterId: string): CctPattern;
|
|
3697
3699
|
|
|
3698
|
-
|
|
3700
|
+
/**
|
|
3701
|
+
* Linter detection utility.
|
|
3702
|
+
*
|
|
3703
|
+
* Scans a directory for linter config files and returns
|
|
3704
|
+
* info about the first detected linter.
|
|
3705
|
+
*/
|
|
3706
|
+
|
|
3707
|
+
/** Supported linter identifiers. */
|
|
3708
|
+
declare const LinterNameSchema: z.ZodEnum<["eslint", "ruff", "clippy", "golangci-lint", "ast-grep", "semgrep", "unknown"]>;
|
|
3709
|
+
/** Result of linter detection. */
|
|
3710
|
+
declare const LinterInfoSchema: z.ZodObject<{
|
|
3711
|
+
linter: z.ZodEnum<["eslint", "ruff", "clippy", "golangci-lint", "ast-grep", "semgrep", "unknown"]>;
|
|
3712
|
+
configPath: z.ZodNullable<z.ZodString>;
|
|
3713
|
+
}, "strip", z.ZodTypeAny, {
|
|
3714
|
+
linter: "unknown" | "eslint" | "ruff" | "clippy" | "golangci-lint" | "ast-grep" | "semgrep";
|
|
3715
|
+
configPath: string | null;
|
|
3716
|
+
}, {
|
|
3717
|
+
linter: "unknown" | "eslint" | "ruff" | "clippy" | "golangci-lint" | "ast-grep" | "semgrep";
|
|
3718
|
+
configPath: string | null;
|
|
3719
|
+
}>;
|
|
3720
|
+
type LinterInfo = z.infer<typeof LinterInfoSchema>;
|
|
3721
|
+
type LinterName = z.infer<typeof LinterNameSchema>;
|
|
3722
|
+
/**
|
|
3723
|
+
* Detect the linter used in a repository by scanning for config files.
|
|
3724
|
+
*
|
|
3725
|
+
* Checks linters in priority order; first match wins.
|
|
3726
|
+
* Returns `{ linter: 'unknown', configPath: null }` if nothing found.
|
|
3727
|
+
*/
|
|
3728
|
+
declare function detectLinter(repoRoot: string): LinterInfo;
|
|
3729
|
+
|
|
3730
|
+
export { type ActionabilityResult, type AuditFinding, AuditFindingSchema, type AuditOptions, type AuditReport, AuditReportSchema, CANDIDATE_MULTIPLIER, CCT_PATTERNS_PATH, type CctPattern, CctPatternSchema, type ClusterResult, type Context, type CorrectionSignal, DB_PATH, DEFAULT_TEXT_WEIGHT, DEFAULT_VECTOR_WEIGHT, type DetectedCorrection, type DetectedSelfCorrection, type DetectedTestFailure, type EditEntry, type EditHistory, type EmbedChunksOptions, type EmbedChunksResult, type EmbedStatus, type HybridMergeOptions, type IndexOptions, type IndexResult, KNOWLEDGE_DB_PATH, KNOWLEDGE_SCHEMA_VERSION, type KnowledgeChunk, type KnowledgeDbOptions, type KnowledgeSearchOptions, LESSONS_PATH, type Lesson, LessonItemSchema, type LessonRecord, LessonSchema, type LessonType, type LinterInfo, LinterInfoSchema, type LinterName, LinterNameSchema, type LockResult, MODEL_FILENAME, MODEL_URI, type MemoryItem, type MemoryItemRecord, MemoryItemRecordSchema, MemoryItemSchema, type MemoryItemType, MemoryItemTypeSchema, type NoveltyOptions, type NoveltyResult, type ParseError, type PatternItem, PatternItemSchema, type PlanRetrievalResult, type Preference, PreferenceItemSchema, type ProposeResult, type RankedLesson, type ReadLessonsOptions, type ReadLessonsResult, type ReadMemoryItemsResult, type ScoredChunk, type ScoredKeywordResult, type ScoredLesson, type SearchVectorOptions, type Severity, type Solution, SolutionItemSchema, type Source, type SpawnEmbedResult, type SpecificityResult, type TestResult, type UsabilityResult, VERSION, acquireEmbedLock, appendLesson, appendMemoryItem, buildSimilarityMatrix, calculateScore, chunkFile, closeDb, closeKnowledgeDb, clusterBySimilarity, collectCachedChunkEmbeddings, confirmationBoost, cosineSimilarity, detectLinter, detectSelfCorrection, detectTestFailure, detectUserCorrection, embedChunks, embedText, embedTexts, formatLessonsCheck, generateId, getCachedChunkEmbedding, getEmbedding, getPrimeContext, getUnembeddedChunkCount, indexAndSpawnEmbed, indexDocs, isActionable, isEmbedLocked, isModelAvailable, isModelUsable, isNovel, isSpecific, loadSessionLessons, mergeHybridResults, normalizeBm25Rank, openKnowledgeDb, rankLessons, readCctPatterns, readEmbedStatus, readLessons, readMemoryItems, rebuildIndex, recencyBoost, resolveModel, retrieveForPlan, runAudit, runBackgroundEmbed, searchChunksKeywordScored, searchKeyword, searchKnowledge, searchKnowledgeVector, searchVector, setCachedChunkEmbedding, severityBoost, shouldPropose, spawnBackgroundEmbed, synthesizePattern, unloadEmbedding, writeCctPatterns, writeEmbedStatus };
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ var __export = (target, all) => {
|
|
|
22
22
|
function generateId(insight, type) {
|
|
23
23
|
const prefix = TYPE_PREFIXES[type ?? "lesson"];
|
|
24
24
|
const hash = createHash("sha256").update(insight).digest("hex");
|
|
25
|
-
return `${prefix}${hash.slice(0,
|
|
25
|
+
return `${prefix}${hash.slice(0, 16)}`;
|
|
26
26
|
}
|
|
27
27
|
var SourceSchema, ContextSchema, PatternSchema, CitationSchema, SeveritySchema, CompactionLevelSchema, LessonTypeSchema, MemoryItemTypeSchema, baseFields, LessonItemSchema, SolutionItemSchema, PatternItemSchema, PreferenceItemSchema, MemoryItemSchema, LegacyLessonSchema, LessonSchema, LegacyTombstoneSchema, LessonRecordSchema, MemoryItemRecordSchema, TYPE_PREFIXES;
|
|
28
28
|
var init_types = __esm({
|
|
@@ -185,9 +185,7 @@ function parseJsonLine(line, lineNumber, strict, onParseError) {
|
|
|
185
185
|
return result.data;
|
|
186
186
|
}
|
|
187
187
|
function toMemoryItem(record) {
|
|
188
|
-
if (record.deleted === true)
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
188
|
+
if (record.deleted === true) return null;
|
|
191
189
|
if (record.type === "quick" || record.type === "full") {
|
|
192
190
|
return { ...record, type: "lesson" };
|
|
193
191
|
}
|
|
@@ -201,11 +199,12 @@ async function readMemoryItems(repoRoot, options = {}) {
|
|
|
201
199
|
content = await readFile(filePath, "utf-8");
|
|
202
200
|
} catch (err) {
|
|
203
201
|
if (err.code === "ENOENT") {
|
|
204
|
-
return { items: [], skippedCount: 0 };
|
|
202
|
+
return { items: [], deletedIds: /* @__PURE__ */ new Set(), skippedCount: 0 };
|
|
205
203
|
}
|
|
206
204
|
throw err;
|
|
207
205
|
}
|
|
208
206
|
const items = /* @__PURE__ */ new Map();
|
|
207
|
+
const deletedIds = /* @__PURE__ */ new Set();
|
|
209
208
|
let skippedCount = 0;
|
|
210
209
|
const lines = content.split("\n");
|
|
211
210
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -218,6 +217,7 @@ async function readMemoryItems(repoRoot, options = {}) {
|
|
|
218
217
|
}
|
|
219
218
|
if (record.deleted === true) {
|
|
220
219
|
items.delete(record.id);
|
|
220
|
+
deletedIds.add(record.id);
|
|
221
221
|
} else {
|
|
222
222
|
const item = toMemoryItem(record);
|
|
223
223
|
if (item) {
|
|
@@ -225,7 +225,7 @@ async function readMemoryItems(repoRoot, options = {}) {
|
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
return { items: Array.from(items.values()), skippedCount };
|
|
228
|
+
return { items: Array.from(items.values()), deletedIds, skippedCount };
|
|
229
229
|
}
|
|
230
230
|
async function readLessons(repoRoot, options = {}) {
|
|
231
231
|
const result = await readMemoryItems(repoRoot, options);
|
|
@@ -271,12 +271,15 @@ var init_availability = __esm({
|
|
|
271
271
|
// src/memory/storage/sqlite/schema.ts
|
|
272
272
|
function createSchema(database) {
|
|
273
273
|
database.exec(SCHEMA_SQL);
|
|
274
|
-
database.pragma(
|
|
274
|
+
const current = database.pragma("user_version", { simple: true });
|
|
275
|
+
if (current !== SCHEMA_VERSION) {
|
|
276
|
+
database.pragma(`user_version = ${SCHEMA_VERSION}`);
|
|
277
|
+
}
|
|
275
278
|
}
|
|
276
279
|
var SCHEMA_VERSION, SCHEMA_SQL;
|
|
277
280
|
var init_schema = __esm({
|
|
278
281
|
"src/memory/storage/sqlite/schema.ts"() {
|
|
279
|
-
SCHEMA_VERSION =
|
|
282
|
+
SCHEMA_VERSION = 5;
|
|
280
283
|
SCHEMA_SQL = `
|
|
281
284
|
CREATE TABLE IF NOT EXISTS lessons (
|
|
282
285
|
id TEXT PRIMARY KEY,
|
|
@@ -325,7 +328,7 @@ var init_schema = __esm({
|
|
|
325
328
|
VALUES ('delete', old.rowid, old.id, old.trigger, old.insight, old.tags, old.pattern_bad, old.pattern_good);
|
|
326
329
|
END;
|
|
327
330
|
|
|
328
|
-
CREATE TRIGGER IF NOT EXISTS lessons_au AFTER UPDATE ON lessons BEGIN
|
|
331
|
+
CREATE TRIGGER IF NOT EXISTS lessons_au AFTER UPDATE OF id, trigger, insight, tags, pattern_bad, pattern_good ON lessons BEGIN
|
|
329
332
|
INSERT INTO lessons_fts(lessons_fts, rowid, id, trigger, insight, tags, pattern_bad, pattern_good)
|
|
330
333
|
VALUES ('delete', old.rowid, old.id, old.trigger, old.insight, old.tags, old.pattern_bad, old.pattern_good);
|
|
331
334
|
INSERT INTO lessons_fts(rowid, id, trigger, insight, tags, pattern_bad, pattern_good)
|
|
@@ -1009,8 +1012,16 @@ function clusterBySimilarity(items, embeddings, threshold = DEFAULT_THRESHOLD) {
|
|
|
1009
1012
|
}
|
|
1010
1013
|
group.push(items[i]);
|
|
1011
1014
|
}
|
|
1012
|
-
const clusters =
|
|
1013
|
-
|
|
1015
|
+
const clusters = [];
|
|
1016
|
+
const noise = [];
|
|
1017
|
+
for (const group of groups.values()) {
|
|
1018
|
+
if (group.length === 1) {
|
|
1019
|
+
noise.push(group[0]);
|
|
1020
|
+
} else {
|
|
1021
|
+
clusters.push(group);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
return { clusters, noise };
|
|
1014
1025
|
}
|
|
1015
1026
|
var DEFAULT_THRESHOLD;
|
|
1016
1027
|
var init_clustering = __esm({
|
|
@@ -1056,7 +1067,12 @@ async function readCctPatterns(repoRoot) {
|
|
|
1056
1067
|
for (const line of lines) {
|
|
1057
1068
|
const trimmed = line.trim();
|
|
1058
1069
|
if (!trimmed) continue;
|
|
1059
|
-
|
|
1070
|
+
let parsed;
|
|
1071
|
+
try {
|
|
1072
|
+
parsed = JSON.parse(trimmed);
|
|
1073
|
+
} catch {
|
|
1074
|
+
continue;
|
|
1075
|
+
}
|
|
1060
1076
|
const result = CctPatternSchema.safeParse(parsed);
|
|
1061
1077
|
if (result.success) {
|
|
1062
1078
|
patterns.push(result.data);
|
|
@@ -2076,15 +2092,20 @@ function writeEmbedStatus(repoRoot, status) {
|
|
|
2076
2092
|
function readEmbedStatus(repoRoot) {
|
|
2077
2093
|
try {
|
|
2078
2094
|
const raw = readFileSync(statusPath(repoRoot), "utf-8");
|
|
2079
|
-
|
|
2095
|
+
const parsed = JSON.parse(raw);
|
|
2096
|
+
if (!parsed || typeof parsed !== "object" || !VALID_STATES.has(parsed.state)) {
|
|
2097
|
+
return null;
|
|
2098
|
+
}
|
|
2099
|
+
return parsed;
|
|
2080
2100
|
} catch {
|
|
2081
2101
|
return null;
|
|
2082
2102
|
}
|
|
2083
2103
|
}
|
|
2084
|
-
var STATUS_FILE;
|
|
2104
|
+
var STATUS_FILE, VALID_STATES;
|
|
2085
2105
|
var init_embed_status = __esm({
|
|
2086
2106
|
"src/memory/knowledge/embed-status.ts"() {
|
|
2087
2107
|
STATUS_FILE = ".claude/.cache/embed-status.json";
|
|
2108
|
+
VALID_STATES = /* @__PURE__ */ new Set(["idle", "running", "completed", "failed"]);
|
|
2088
2109
|
}
|
|
2089
2110
|
});
|
|
2090
2111
|
function resolveCliInvocation() {
|
|
@@ -2598,9 +2619,6 @@ init_storage();
|
|
|
2598
2619
|
|
|
2599
2620
|
// src/commands/shared.ts
|
|
2600
2621
|
init_utils();
|
|
2601
|
-
|
|
2602
|
-
// src/commands/management-helpers.ts
|
|
2603
|
-
init_storage();
|
|
2604
2622
|
init_embeddings();
|
|
2605
2623
|
init_storage();
|
|
2606
2624
|
init_storage();
|
|
@@ -2609,9 +2627,78 @@ init_storage();
|
|
|
2609
2627
|
init_storage();
|
|
2610
2628
|
init_storage();
|
|
2611
2629
|
init_storage();
|
|
2630
|
+
init_storage();
|
|
2631
|
+
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
2632
|
+
var FETCH_TIMEOUT_MS = 3e3;
|
|
2633
|
+
var CACHE_FILENAME = "update-check.json";
|
|
2634
|
+
async function fetchLatestVersion(packageName = "compound-agent") {
|
|
2635
|
+
try {
|
|
2636
|
+
const res = await fetch(`https://registry.npmjs.org/${packageName}`, {
|
|
2637
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT_MS)
|
|
2638
|
+
});
|
|
2639
|
+
if (!res.ok) return null;
|
|
2640
|
+
const data = await res.json();
|
|
2641
|
+
const tags = data["dist-tags"];
|
|
2642
|
+
if (typeof tags !== "object" || tags === null) return null;
|
|
2643
|
+
const latest = tags["latest"];
|
|
2644
|
+
return typeof latest === "string" ? latest : null;
|
|
2645
|
+
} catch {
|
|
2646
|
+
return null;
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
async function checkForUpdate(cacheDir) {
|
|
2650
|
+
try {
|
|
2651
|
+
const cachePath = join(cacheDir, CACHE_FILENAME);
|
|
2652
|
+
const cached = readCache(cachePath);
|
|
2653
|
+
if (cached) {
|
|
2654
|
+
return {
|
|
2655
|
+
current: VERSION,
|
|
2656
|
+
latest: cached.latest,
|
|
2657
|
+
updateAvailable: semverGt(cached.latest, VERSION)
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
const latest = await fetchLatestVersion();
|
|
2661
|
+
if (latest === null) return null;
|
|
2662
|
+
try {
|
|
2663
|
+
mkdirSync(cacheDir, { recursive: true });
|
|
2664
|
+
const cacheData = { latest };
|
|
2665
|
+
writeFileSync(cachePath, JSON.stringify(cacheData));
|
|
2666
|
+
} catch {
|
|
2667
|
+
}
|
|
2668
|
+
return {
|
|
2669
|
+
current: VERSION,
|
|
2670
|
+
latest,
|
|
2671
|
+
updateAvailable: semverGt(latest, VERSION)
|
|
2672
|
+
};
|
|
2673
|
+
} catch {
|
|
2674
|
+
return null;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
function semverGt(a, b) {
|
|
2678
|
+
const parse = (v) => {
|
|
2679
|
+
const parts = v.split(".").map((n) => parseInt(n, 10) || 0);
|
|
2680
|
+
return [parts[0] ?? 0, parts[1] ?? 0, parts[2] ?? 0];
|
|
2681
|
+
};
|
|
2682
|
+
const [aMaj, aMin, aPat] = parse(a);
|
|
2683
|
+
const [bMaj, bMin, bPat] = parse(b);
|
|
2684
|
+
if (aMaj !== bMaj) return aMaj > bMaj;
|
|
2685
|
+
if (aMin !== bMin) return aMin > bMin;
|
|
2686
|
+
return aPat > bPat;
|
|
2687
|
+
}
|
|
2688
|
+
function readCache(cachePath) {
|
|
2689
|
+
try {
|
|
2690
|
+
const stat = statSync(cachePath);
|
|
2691
|
+
if (Date.now() - stat.mtimeMs > CACHE_TTL_MS) return null;
|
|
2692
|
+
const raw = readFileSync(cachePath, "utf-8");
|
|
2693
|
+
const data = JSON.parse(raw);
|
|
2694
|
+
if (!data.latest) return null;
|
|
2695
|
+
return data;
|
|
2696
|
+
} catch {
|
|
2697
|
+
return null;
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2612
2700
|
|
|
2613
2701
|
// src/commands/management-prime.ts
|
|
2614
|
-
init_storage();
|
|
2615
2702
|
var TRUST_LANGUAGE_TEMPLATE = `# Compound Agent Active
|
|
2616
2703
|
|
|
2617
2704
|
> **Context Recovery**: Run \`npx ca prime\` after compaction, clear, or new session
|
|
@@ -2723,6 +2810,19 @@ ${formattedLessons}
|
|
|
2723
2810
|
if (cookitSection !== null) {
|
|
2724
2811
|
output += cookitSection;
|
|
2725
2812
|
}
|
|
2813
|
+
if (!process.stdout.isTTY) {
|
|
2814
|
+
try {
|
|
2815
|
+
const updateResult = await checkForUpdate(join(root, ".claude", ".cache"));
|
|
2816
|
+
if (updateResult?.updateAvailable) {
|
|
2817
|
+
output += `
|
|
2818
|
+
---
|
|
2819
|
+
# Update Available
|
|
2820
|
+
compound-agent v${updateResult.latest} is available (current: v${updateResult.current}). Run \`pnpm update --latest compound-agent\` to update.
|
|
2821
|
+
`;
|
|
2822
|
+
}
|
|
2823
|
+
} catch {
|
|
2824
|
+
}
|
|
2825
|
+
}
|
|
2726
2826
|
return output;
|
|
2727
2827
|
}
|
|
2728
2828
|
|
|
@@ -2763,7 +2863,8 @@ var FileSizeCheckSchema = z.object({
|
|
|
2763
2863
|
var ScriptCheckSchema = z.object({
|
|
2764
2864
|
type: z.literal("script"),
|
|
2765
2865
|
command: z.string(),
|
|
2766
|
-
expectExitCode: z.number().int().optional()
|
|
2866
|
+
expectExitCode: z.number().int().optional(),
|
|
2867
|
+
timeout: z.number().int().positive().optional()
|
|
2767
2868
|
});
|
|
2768
2869
|
var RuleCheckSchema = z.discriminatedUnion("type", [
|
|
2769
2870
|
FilePatternCheckSchema,
|
|
@@ -2853,10 +2954,12 @@ function runFileSizeCheck(baseDir, check) {
|
|
|
2853
2954
|
}
|
|
2854
2955
|
return violations;
|
|
2855
2956
|
}
|
|
2957
|
+
var DEFAULT_SCRIPT_TIMEOUT = 3e4;
|
|
2856
2958
|
function runScriptCheck(check, baseDir) {
|
|
2857
2959
|
const expectedCode = check.expectExitCode ?? 0;
|
|
2960
|
+
const timeout = check.timeout ?? DEFAULT_SCRIPT_TIMEOUT;
|
|
2858
2961
|
try {
|
|
2859
|
-
execSync(check.command, { stdio: ["pipe", "pipe", "pipe"], cwd: baseDir });
|
|
2962
|
+
execSync(check.command, { stdio: ["pipe", "pipe", "pipe"], cwd: baseDir, timeout });
|
|
2860
2963
|
if (expectedCode !== 0) {
|
|
2861
2964
|
return [{ message: `Script exited with exit code 0, expected ${expectedCode}` }];
|
|
2862
2965
|
}
|
|
@@ -3039,8 +3142,99 @@ init_search2();
|
|
|
3039
3142
|
|
|
3040
3143
|
// src/index.ts
|
|
3041
3144
|
init_compound();
|
|
3145
|
+
var LinterNameSchema = z.enum([
|
|
3146
|
+
"eslint",
|
|
3147
|
+
"ruff",
|
|
3148
|
+
"clippy",
|
|
3149
|
+
"golangci-lint",
|
|
3150
|
+
"ast-grep",
|
|
3151
|
+
"semgrep",
|
|
3152
|
+
"unknown"
|
|
3153
|
+
]);
|
|
3154
|
+
var LinterInfoSchema = z.object({
|
|
3155
|
+
linter: LinterNameSchema,
|
|
3156
|
+
configPath: z.string().nullable()
|
|
3157
|
+
});
|
|
3158
|
+
var DETECTION_RULES = [
|
|
3159
|
+
{
|
|
3160
|
+
linter: "eslint",
|
|
3161
|
+
configs: [
|
|
3162
|
+
// Flat config (ESLint v9+)
|
|
3163
|
+
"eslint.config.js",
|
|
3164
|
+
"eslint.config.mjs",
|
|
3165
|
+
"eslint.config.cjs",
|
|
3166
|
+
"eslint.config.ts",
|
|
3167
|
+
"eslint.config.mts",
|
|
3168
|
+
"eslint.config.cts",
|
|
3169
|
+
// Legacy config
|
|
3170
|
+
".eslintrc.js",
|
|
3171
|
+
".eslintrc.cjs",
|
|
3172
|
+
".eslintrc.json",
|
|
3173
|
+
".eslintrc.yml",
|
|
3174
|
+
".eslintrc.yaml"
|
|
3175
|
+
]
|
|
3176
|
+
},
|
|
3177
|
+
{
|
|
3178
|
+
linter: "ruff",
|
|
3179
|
+
configs: ["ruff.toml", ".ruff.toml"]
|
|
3180
|
+
},
|
|
3181
|
+
{
|
|
3182
|
+
linter: "clippy",
|
|
3183
|
+
configs: ["clippy.toml", ".clippy.toml"]
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
linter: "golangci-lint",
|
|
3187
|
+
configs: [".golangci.yml", ".golangci.yaml", ".golangci.toml", ".golangci.json"]
|
|
3188
|
+
},
|
|
3189
|
+
{
|
|
3190
|
+
linter: "ast-grep",
|
|
3191
|
+
configs: ["sgconfig.yml"]
|
|
3192
|
+
},
|
|
3193
|
+
{
|
|
3194
|
+
linter: "semgrep",
|
|
3195
|
+
configs: [".semgrep.yml", ".semgrep.yaml"]
|
|
3196
|
+
}
|
|
3197
|
+
];
|
|
3198
|
+
function unknown() {
|
|
3199
|
+
return { linter: "unknown", configPath: null };
|
|
3200
|
+
}
|
|
3201
|
+
function isFile(filePath) {
|
|
3202
|
+
try {
|
|
3203
|
+
return statSync(filePath).isFile();
|
|
3204
|
+
} catch {
|
|
3205
|
+
return false;
|
|
3206
|
+
}
|
|
3207
|
+
}
|
|
3208
|
+
function pyprojectHasRuff(repoRoot) {
|
|
3209
|
+
const filePath = join(repoRoot, "pyproject.toml");
|
|
3210
|
+
try {
|
|
3211
|
+
const content = readFileSync(filePath, "utf-8");
|
|
3212
|
+
return /^\s*\[tool\.ruff\b/m.test(content);
|
|
3213
|
+
} catch {
|
|
3214
|
+
return false;
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
function detectLinter(repoRoot) {
|
|
3218
|
+
try {
|
|
3219
|
+
for (const rule of DETECTION_RULES) {
|
|
3220
|
+
for (const config of rule.configs) {
|
|
3221
|
+
if (isFile(join(repoRoot, config))) {
|
|
3222
|
+
return { linter: rule.linter, configPath: config };
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
if (rule.linter === "ruff" && pyprojectHasRuff(repoRoot)) {
|
|
3226
|
+
return { linter: "ruff", configPath: "pyproject.toml" };
|
|
3227
|
+
}
|
|
3228
|
+
}
|
|
3229
|
+
} catch {
|
|
3230
|
+
return unknown();
|
|
3231
|
+
}
|
|
3232
|
+
return unknown();
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
// src/index.ts
|
|
3042
3236
|
init_types();
|
|
3043
3237
|
|
|
3044
|
-
export { AuditFindingSchema, AuditReportSchema, CANDIDATE_MULTIPLIER, CCT_PATTERNS_PATH, CctPatternSchema, DB_PATH, DEFAULT_TEXT_WEIGHT, DEFAULT_VECTOR_WEIGHT, KNOWLEDGE_DB_PATH, KNOWLEDGE_SCHEMA_VERSION, LESSONS_PATH, LessonItemSchema, LessonSchema, MODEL_FILENAME, MODEL_URI, MemoryItemRecordSchema, MemoryItemSchema, MemoryItemTypeSchema, PatternItemSchema, PreferenceItemSchema, SolutionItemSchema, VERSION, acquireEmbedLock, appendLesson, appendMemoryItem, buildSimilarityMatrix, calculateScore, chunkFile, closeDb, closeKnowledgeDb, clusterBySimilarity, collectCachedChunkEmbeddings, confirmationBoost, cosineSimilarity, detectSelfCorrection, detectTestFailure, detectUserCorrection, embedChunks, embedText, embedTexts, formatLessonsCheck, generateId, getCachedChunkEmbedding, getEmbedding, getPrimeContext, getUnembeddedChunkCount, indexAndSpawnEmbed, indexDocs, isActionable, isEmbedLocked, isModelAvailable, isModelUsable, isNovel, isSpecific, loadSessionLessons, mergeHybridResults, normalizeBm25Rank, openKnowledgeDb, rankLessons, readCctPatterns, readEmbedStatus, readLessons, readMemoryItems, rebuildIndex, recencyBoost, resolveModel, retrieveForPlan, runAudit, runBackgroundEmbed, searchChunksKeywordScored, searchKeyword, searchKnowledge, searchKnowledgeVector, searchVector, setCachedChunkEmbedding, severityBoost, shouldPropose, spawnBackgroundEmbed, synthesizePattern, unloadEmbedding, writeCctPatterns, writeEmbedStatus };
|
|
3238
|
+
export { AuditFindingSchema, AuditReportSchema, CANDIDATE_MULTIPLIER, CCT_PATTERNS_PATH, CctPatternSchema, DB_PATH, DEFAULT_TEXT_WEIGHT, DEFAULT_VECTOR_WEIGHT, KNOWLEDGE_DB_PATH, KNOWLEDGE_SCHEMA_VERSION, LESSONS_PATH, LessonItemSchema, LessonSchema, LinterInfoSchema, LinterNameSchema, MODEL_FILENAME, MODEL_URI, MemoryItemRecordSchema, MemoryItemSchema, MemoryItemTypeSchema, PatternItemSchema, PreferenceItemSchema, SolutionItemSchema, VERSION, acquireEmbedLock, appendLesson, appendMemoryItem, buildSimilarityMatrix, calculateScore, chunkFile, closeDb, closeKnowledgeDb, clusterBySimilarity, collectCachedChunkEmbeddings, confirmationBoost, cosineSimilarity, detectLinter, detectSelfCorrection, detectTestFailure, detectUserCorrection, embedChunks, embedText, embedTexts, formatLessonsCheck, generateId, getCachedChunkEmbedding, getEmbedding, getPrimeContext, getUnembeddedChunkCount, indexAndSpawnEmbed, indexDocs, isActionable, isEmbedLocked, isModelAvailable, isModelUsable, isNovel, isSpecific, loadSessionLessons, mergeHybridResults, normalizeBm25Rank, openKnowledgeDb, rankLessons, readCctPatterns, readEmbedStatus, readLessons, readMemoryItems, rebuildIndex, recencyBoost, resolveModel, retrieveForPlan, runAudit, runBackgroundEmbed, searchChunksKeywordScored, searchKeyword, searchKnowledge, searchKnowledgeVector, searchVector, setCachedChunkEmbedding, severityBoost, shouldPropose, spawnBackgroundEmbed, synthesizePattern, unloadEmbedding, writeCctPatterns, writeEmbedStatus };
|
|
3045
3239
|
//# sourceMappingURL=index.js.map
|
|
3046
3240
|
//# sourceMappingURL=index.js.map
|