@getripple/core 1.0.6 → 1.0.8

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/dist/audit.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { ChangeIntent, ChangeIntentValidationSummary, ControlMode, IntentDriftRepairPlan, RippleAgentHandoffVerdict, StagedCheckWithIntentSummary } from "./change-intent";
2
+ import { RippleRiskSummary } from "./risk";
2
3
  import type { AgentRuntimeNextPhaseId } from "./agent-workflow";
3
4
  import type { RipplePolicyExplanation } from "./policy";
4
5
  import { RippleApprovalStatus } from "./approval";
@@ -35,6 +36,7 @@ export type RippleAuditSummary = {
35
36
  nextSteps: string[];
36
37
  changedFiles: string[];
37
38
  verificationTargets: string[];
39
+ risk: RippleRiskSummary;
38
40
  handoff: RippleAgentHandoffVerdict;
39
41
  };
40
42
  export type RippleGateSummary = {
@@ -65,6 +67,7 @@ export type RippleGateSummary = {
65
67
  fixNow: string[];
66
68
  askHuman: string[];
67
69
  commands: RippleAgentHandoffVerdict["commands"];
70
+ risk: RippleRiskSummary;
68
71
  };
69
72
  export declare function buildRippleAuditSummary(input: {
70
73
  workspaceRoot: string;
package/dist/audit.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rippleAuditNextRequiredAction = exports.rippleAuditNextRequiredPhase = exports.rippleAuditRecommendedAction = exports.rippleAuditDecision = exports.rippleAuditStatus = exports.buildRippleGateSummary = exports.buildRippleAuditSummary = void 0;
4
4
  const change_intent_1 = require("./change-intent");
5
+ const risk_1 = require("./risk");
5
6
  const approval_1 = require("./approval");
6
7
  function buildRippleAuditSummary(input) {
7
8
  const validation = input.stagedCheck.intentValidation;
@@ -52,6 +53,19 @@ function buildRippleAuditSummary(input) {
52
53
  nextSteps,
53
54
  changedFiles: input.stagedCheck.files.map((file) => file.file),
54
55
  verificationTargets: input.repairPlan.verificationTargets,
56
+ risk: (0, risk_1.buildRippleRiskSummary)({
57
+ boundaryRisk: input.intent.boundaryRisk,
58
+ allowedFiles: validation.editableFiles,
59
+ allowedSymbols: validation.allowedSymbols,
60
+ changedFiles: input.stagedCheck.files.map((file) => file.file),
61
+ changedOutsideBoundaryFiles: validation.boundaryVerdict.changedOutsideBoundaryFiles,
62
+ changedOutsideBoundarySymbols: validation.boundaryVerdict.changedOutsideBoundarySymbols,
63
+ unplannedFiles: validation.unplannedFiles,
64
+ unplannedSymbols: validation.unplannedSymbols,
65
+ verificationTargets: input.repairPlan.verificationTargets,
66
+ nextSteps,
67
+ stagedFiles: input.stagedCheck.files,
68
+ }),
55
69
  };
56
70
  return {
57
71
  ...audit,
@@ -90,6 +104,7 @@ function buildRippleGateSummary(audit) {
90
104
  fixNow: handoff.fixNow,
91
105
  askHuman: handoff.askHuman,
92
106
  commands: handoff.commands,
107
+ risk: audit.risk,
93
108
  };
94
109
  }
95
110
  exports.buildRippleGateSummary = buildRippleGateSummary;
package/dist/audit.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"audit.js","sourceRoot":"","sources":["../src/audit.ts"],"names":[],"mappings":";;;AASA,mDAA2D;AAG3D,yCAGoB;AAqEpB,SAAgB,uBAAuB,CAAC,KASvC;IACC,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC;IACtD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc;QACzC,IAAA,sCAA2B,EAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,iBAAiB,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAC/E,MAAM,QAAQ,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAC7C,MAAM,iBAAiB,GAAG,4B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AAgF,CAAC;IAC1F,CAAC;IACD,IAAI,KAAK,KAAK,eAAe,EAAE,CAAC;QAC9B,OAAO,0FAA0F,CAAC;IACpG,CAAC;IACD,IAAI,KAAK,KAAK,mBAAmB,EAAE,CAAC;QAClC,OAAO,mGAAmG,CAAC;IAC7G,CAAC;IACD,IAAI,KAAK,KAAK,oBAAoB,EAAE,CAAC;QACnC,OAAO,gEAAgE,CAAC;IAC1E,CAAC;IACD,IAAI,KAAK,KAAK,kBAAkB,EAAE,CAAC;QACjC,OAAO,4CAA4C,CAAC;IACtD,CAAC;IACD,IAAI,KAAK,KAAK,sBAAsB,EAAE,CAAC;QACrC,OAAO,yDAAyD,CAAC;IACnE,CAAC;IACD,OAAO,0EAA0E,CAAC;AACpF,CAAC;AApBD,sEAoBC;AAED,SAAS,WAAW,CAAC,KAAe;IAClC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QAC3B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/graph.js CHANGED
@@ -1332,135 +1332,135 @@ class GraphPersistence {
1332
1332
  const createDirs = safeToCreateIn.slice(0, 4).join(", ") ||
1333
1333
  "existing source directories after checking project structure";
1334
1334
  const stylingRule = stylingApproach[0] ?? "the existing styling approach";
1335
- const content = `# ${projectName} — Ripple Workflow
1336
- *Auto-generated by Ripple v${rippleVersion} — always current*
1337
- *Use the setup panel to copy this into AGENTS.md, CLAUDE.md, or .cursorrules. Ripple keeps its managed section updated.*
1338
-
1339
- ---
1340
-
1341
- ## YOUR AUTOMATIC PROTOCOL
1342
-
1343
- Run this before every task — automatically:
1344
-
1345
- **Step 1:** Classify the task: targeted edit, new file, debugging, or broad refactor.
1346
- **Step 2:** If a file is involved, open \`.ripple/.cache/context.json\` and resolve the target before reading or editing:
1347
- - If the user gave a relative path, look it up in \`availableFocusFilesByPath\`.
1348
- - If the user gave only a basename such as \`options.ts\`, check \`availableFocusFilesByBasename\`.
1349
- - If that basename is \`"ambiguous"\`, STOP and ask which listed path they mean.
1350
- - Do not choose among ambiguous basenames using top focus files, risk, recency, or project importance.
1351
- - Do not guess focus filenames. Collision-safe keys can include a hash suffix.
1352
- - Use \`availableFocusFiles\` only for unique basename shortcuts.
1353
- **Step 3:** Read the target focus file before editing.
1354
- **Step 4:** Check \`risk.modificationRisk\`:
1355
- - \`"safe"\` -> proceed with targeted checks
1356
- - \`"caution"\` -> inspect callers/importers first
1357
- - \`"dangerous"\` -> announce importer count and proceed only if the target path is exact, the edit stays single-file, and public contracts are preserved
1358
- **Step 5:** For every edited symbol, check \`calledBy\`, \`layer\`, and \`containsLayers\`.
1359
- **Step 6:** Preserve public exports, function signatures, return shapes, and import style unless the user explicitly asks for a contract change.
1360
-
1361
- ---
1362
-
1363
- ## DANGEROUS FILE PROTOCOL
1364
-
1365
- Dangerous files need informed autonomy, not a blanket permission stop:
1366
-
1367
- 1. **Ambiguous path** — if the user gave only a basename and multiple files match, STOP and ask which listed path they mean.
1368
- 2. **Exact path, dangerous file** — announce the blast radius, then proceed without waiting only when the edit is single-file and contract-preserving:
1369
- - No public export changes
1370
- - No function or type signature changes
1371
- - No return-shape or type-structure changes
1372
- - No runtime behavior changes
1373
- - No caller updates required
1374
- 3. **Contract change required** — STOP before editing. Tell the user exactly which contract, behavior, caller, or multi-file change is required and ask whether to proceed.
1375
-
1376
- After any dangerous-file edit, run the narrowest relevant compile/test check, verify the listed importedBy files still satisfy the contract, and report residual risk when verification is missing or incomplete.
1377
-
1378
- ---
1379
-
1380
- ## PLANNING FOR COMPLEX TASKS
1381
-
1382
- For any task touching more than one file, BEFORE writing any code:
1383
-
1384
- **Step 1 — Find the starting file.** Read its focus file.
1385
- **Step 2 — Chain exploration (1-2 levels).** Look at imports and importedBy. Read focus files for relevant neighbors.
1386
- **Step 3 — Formulate the plan:**
1387
- \`\`\`
1388
- To implement [task]:
1389
- 1. types/auth.ts — add type [caution, 3 importers]
1390
- 2. lib/authService.ts — update logic [dangerous, 7 importers]
1391
- 3. components/LoginButton.tsx — update UI [safe, 0 importers]
1392
- Shall I proceed?
1393
- \`\`\`
1394
- **Step 4 — Wait for confirmation before writing any code.**
1395
-
1396
- ---
1397
-
1398
- ## TASK ROUTING
1399
-
1400
- | User intent | First context to read | Then |
1401
- |-------------|----------------------|------|
1402
- | Modify one file | Target focus file | Verify \`calledBy\` and importedBy |
1403
- | Add a file | \`.ripple/.cache/context.json\` | Check \`safeToCreateIn\`, \`publicApi\`, existing patterns |
1404
- | Debug behavior | \`lastChangeGroup\` and warnings | Trace \`.ripple/.cache/context.symbols.json\` |
1405
- | Refactor shared code | Focus file + neighbor focus files | Announce danger; stop only for ambiguity, contract, behavior, caller, or multi-file changes |
1406
-
1407
- ---
1408
-
1409
- ## THIS PROJECT
1410
-
1411
- ${projectDescription ? `**What this project does:** ${projectDescription}\n` : ""}\
1412
- **Files tracked:** ${graph.files.size}
1413
- **Framework:** ${techStack.hasNextJs ? "Next.js" : techStack.hasVite ? "Vite" : techStack.hasReactRouter ? "React Router" : "Unknown"}
1414
- **Import style:** ${importAlias ? `Use '${importAlias}/...'` : "Use relative imports"}
1415
- **State management:** ${stateManagement.join(", ")}
1416
- **Styling:** ${stylingApproach.join(", ") || "see .ripple/.cache/context.files.json"}
1417
- **Testing:** ${testingFramework.length > 0 ? testingFramework.join(", ") : "none detected"}
1418
- **New files go in:** ${createDirs}${dangerousFiles.length > 0 ? `
1419
- **Top high-blast files (announce + guard contracts):** ${dangerousFiles.slice(0, 10).join(", ")}` : ""}
1420
-
1421
- ---
1422
-
1423
- ## TOP FOCUS FILES IN THIS PROJECT
1424
-
1335
+ const content = `# ${projectName} — Ripple Workflow
1336
+ *Auto-generated by Ripple v${rippleVersion} — always current*
1337
+ *Use the setup panel to copy this into AGENTS.md, CLAUDE.md, or .cursorrules. Ripple keeps its managed section updated.*
1338
+
1339
+ ---
1340
+
1341
+ ## YOUR AUTOMATIC PROTOCOL
1342
+
1343
+ Run this before every task — automatically:
1344
+
1345
+ **Step 1:** Classify the task: targeted edit, new file, debugging, or broad refactor.
1346
+ **Step 2:** If a file is involved, open \`.ripple/.cache/context.json\` and resolve the target before reading or editing:
1347
+ - If the user gave a relative path, look it up in \`availableFocusFilesByPath\`.
1348
+ - If the user gave only a basename such as \`options.ts\`, check \`availableFocusFilesByBasename\`.
1349
+ - If that basename is \`"ambiguous"\`, STOP and ask which listed path they mean.
1350
+ - Do not choose among ambiguous basenames using top focus files, risk, recency, or project importance.
1351
+ - Do not guess focus filenames. Collision-safe keys can include a hash suffix.
1352
+ - Use \`availableFocusFiles\` only for unique basename shortcuts.
1353
+ **Step 3:** Read the target focus file before editing.
1354
+ **Step 4:** Check \`risk.modificationRisk\`:
1355
+ - \`"safe"\` -> proceed with targeted checks
1356
+ - \`"caution"\` -> inspect callers/importers first
1357
+ - \`"dangerous"\` -> announce importer count and proceed only if the target path is exact, the edit stays single-file, and public contracts are preserved
1358
+ **Step 5:** For every edited symbol, check \`calledBy\`, \`layer\`, and \`containsLayers\`.
1359
+ **Step 6:** Preserve public exports, function signatures, return shapes, and import style unless the user explicitly asks for a contract change.
1360
+
1361
+ ---
1362
+
1363
+ ## DANGEROUS FILE PROTOCOL
1364
+
1365
+ Dangerous files need informed autonomy, not a blanket permission stop:
1366
+
1367
+ 1. **Ambiguous path** — if the user gave only a basename and multiple files match, STOP and ask which listed path they mean.
1368
+ 2. **Exact path, dangerous file** — announce the blast radius, then proceed without waiting only when the edit is single-file and contract-preserving:
1369
+ - No public export changes
1370
+ - No function or type signature changes
1371
+ - No return-shape or type-structure changes
1372
+ - No runtime behavior changes
1373
+ - No caller updates required
1374
+ 3. **Contract change required** — STOP before editing. Tell the user exactly which contract, behavior, caller, or multi-file change is required and ask whether to proceed.
1375
+
1376
+ After any dangerous-file edit, run the narrowest relevant compile/test check, verify the listed importedBy files still satisfy the contract, and report residual risk when verification is missing or incomplete.
1377
+
1378
+ ---
1379
+
1380
+ ## PLANNING FOR COMPLEX TASKS
1381
+
1382
+ For any task touching more than one file, BEFORE writing any code:
1383
+
1384
+ **Step 1 — Find the starting file.** Read its focus file.
1385
+ **Step 2 — Chain exploration (1-2 levels).** Look at imports and importedBy. Read focus files for relevant neighbors.
1386
+ **Step 3 — Formulate the plan:**
1387
+ \`\`\`
1388
+ To implement [task]:
1389
+ 1. types/auth.ts — add type [caution, 3 importers]
1390
+ 2. lib/authService.ts — update logic [dangerous, 7 importers]
1391
+ 3. components/LoginButton.tsx — update UI [safe, 0 importers]
1392
+ Shall I proceed?
1393
+ \`\`\`
1394
+ **Step 4 — Wait for confirmation before writing any code.**
1395
+
1396
+ ---
1397
+
1398
+ ## TASK ROUTING
1399
+
1400
+ | User intent | First context to read | Then |
1401
+ |-------------|----------------------|------|
1402
+ | Modify one file | Target focus file | Verify \`calledBy\` and importedBy |
1403
+ | Add a file | \`.ripple/.cache/context.json\` | Check \`safeToCreateIn\`, \`publicApi\`, existing patterns |
1404
+ | Debug behavior | \`lastChangeGroup\` and warnings | Trace \`.ripple/.cache/context.symbols.json\` |
1405
+ | Refactor shared code | Focus file + neighbor focus files | Announce danger; stop only for ambiguity, contract, behavior, caller, or multi-file changes |
1406
+
1407
+ ---
1408
+
1409
+ ## THIS PROJECT
1410
+
1411
+ ${projectDescription ? `**What this project does:** ${projectDescription}\n` : ""}\
1412
+ **Files tracked:** ${graph.files.size}
1413
+ **Framework:** ${techStack.hasNextJs ? "Next.js" : techStack.hasVite ? "Vite" : techStack.hasReactRouter ? "React Router" : "Unknown"}
1414
+ **Import style:** ${importAlias ? `Use '${importAlias}/...'` : "Use relative imports"}
1415
+ **State management:** ${stateManagement.join(", ")}
1416
+ **Styling:** ${stylingApproach.join(", ") || "see .ripple/.cache/context.files.json"}
1417
+ **Testing:** ${testingFramework.length > 0 ? testingFramework.join(", ") : "none detected"}
1418
+ **New files go in:** ${createDirs}${dangerousFiles.length > 0 ? `
1419
+ **Top high-blast files (announce + guard contracts):** ${dangerousFiles.slice(0, 10).join(", ")}` : ""}
1420
+
1421
+ ---
1422
+
1423
+ ## TOP FOCUS FILES IN THIS PROJECT
1424
+
1425
1425
  ${focusExamples.length > 0
1426
1426
  ? focusExamples.map(e => `- ${e}`).join("\n")
1427
- : "- Save any file to generate focus files"}
1428
-
1429
- ${ambiguousBasenameExamples.length > 0 ? `## AMBIGUOUS FILE NAMES
1430
-
1431
- If the user names only one of these basenames, ask which path they mean before reading or editing:
1432
- ${ambiguousBasenameExamples.map(e => `- ${e}`).join("\n")}` : ""}
1433
-
1434
- ---
1435
-
1436
- ## LAYER TARGETING
1437
-
1438
- | Layer | Touch when |
1439
- |-------|-----------|
1440
- | \`logic\` | "change the logic/algorithm" |
1441
- | \`ui\` | "update the UI/design/layout" |
1442
- | \`handler\` | "change what happens on click/submit" |
1443
- | \`state\` | "update the state management" |
1444
- | \`data\` | "change the data fetching" |
1445
- | \`mixed\` | ASK user before touching |
1446
-
1447
- ---
1448
-
1449
- ## ABSOLUTE RULES
1450
-
1451
- 1. Never modify \`.ripple/\` files
1452
- 2. Never change a function signature without checking ALL calledBy callers
1453
- 3. Never create files outside: ${createDirs}
1427
+ : "- Save any file to generate focus files"}
1428
+
1429
+ ${ambiguousBasenameExamples.length > 0 ? `## AMBIGUOUS FILE NAMES
1430
+
1431
+ If the user names only one of these basenames, ask which path they mean before reading or editing:
1432
+ ${ambiguousBasenameExamples.map(e => `- ${e}`).join("\n")}` : ""}
1433
+
1434
+ ---
1435
+
1436
+ ## LAYER TARGETING
1437
+
1438
+ | Layer | Touch when |
1439
+ |-------|-----------|
1440
+ | \`logic\` | "change the logic/algorithm" |
1441
+ | \`ui\` | "update the UI/design/layout" |
1442
+ | \`handler\` | "change what happens on click/submit" |
1443
+ | \`state\` | "update the state management" |
1444
+ | \`data\` | "change the data fetching" |
1445
+ | \`mixed\` | ASK user before touching |
1446
+
1447
+ ---
1448
+
1449
+ ## ABSOLUTE RULES
1450
+
1451
+ 1. Never modify \`.ripple/\` files
1452
+ 2. Never change a function signature without checking ALL calledBy callers
1453
+ 3. Never create files outside: ${createDirs}
1454
1454
  4. ${hasMobX
1455
1455
  ? "New state goes in a MobX store — never introduce useState for shared state"
1456
1456
  : stateManagement[0] === "useState"
1457
1457
  ? "Never introduce Redux, Zustand, or Jotai without user confirmation"
1458
- : `Use ${stateManagement.join(", ")} for state`}
1459
- 5. Always use ${stylingRule} for new UI
1460
- 6. If tests are missing, say what you verified manually and what risk remains
1461
-
1462
- ---
1463
- *Auto-generated by Ripple v${rippleVersion} — updates on every save*
1458
+ : `Use ${stateManagement.join(", ")} for state`}
1459
+ 5. Always use ${stylingRule} for new UI
1460
+ 6. If tests are missing, say what you verified manually and what risk remains
1461
+
1462
+ ---
1463
+ *Auto-generated by Ripple v${rippleVersion} — updates on every save*
1464
1464
  `;
1465
1465
  fs.writeFileSync(workflowPath, content);
1466
1466
  // Section-based sync preserves user content outside Ripple markers.
@@ -1928,76 +1928,38 @@ class GraphEngine {
1928
1928
  }
1929
1929
  else {
1930
1930
  const newFilesOnDisk = validFiles.filter((f) => !this.graph.files.has(f));
1931
- const newFilesOnDiskSet = new Set(newFilesOnDisk);
1932
- const repairSet = new Set([...staleFiles, ...newFilesOnDisk]);
1933
- // Expand to the connected neighborhood until stable. Partial repair is
1934
- // risky because reverse edges can become stale if only one side is parsed.
1935
- let expanded = true;
1936
- while (expanded) {
1937
- expanded = false;
1938
- Array.from(repairSet).forEach((filePath) => {
1939
- const node = this.graph.files.get(filePath);
1940
- if (!node) {
1941
- return;
1942
- }
1943
- node.importedBy.forEach((importerPath) => {
1944
- if (!repairSet.has(importerPath)) {
1945
- repairSet.add(importerPath);
1946
- expanded = true;
1947
- }
1948
- });
1949
- node.imports.forEach((importedPath) => {
1950
- if (this.graph.files.has(importedPath) && !repairSet.has(importedPath)) {
1951
- repairSet.add(importedPath);
1952
- expanded = true;
1953
- }
1954
- });
1955
- });
1956
- }
1957
- repairSet.forEach((filePath) => {
1958
- const node = this.graph.files.get(filePath);
1959
- if (!node) {
1960
- return;
1961
- }
1962
- this.removeFileEdges(filePath, true);
1963
- node.importedBy.forEach((importerPath) => {
1964
- this.graph.files.get(importerPath)?.imports.delete(filePath);
1965
- });
1966
- node.importedBy.clear();
1967
- });
1968
- const repairArray = Array.from(repairSet).filter((f) => fs.existsSync(f));
1969
- console.log(`[Ripple] Cache repair: ${staleFiles.length} stale + expanded to ${repairArray.length} files`);
1970
- const knownFilePaths = new Set(this.history.events
1971
- .filter(e => e.type === "file_created")
1972
- .map(e => e.source));
1931
+ const deletedFiles = Array.from(this.graph.files.keys()).filter((fp) => !fs.existsSync(fp));
1932
+ console.log(`[Ripple] Cache repair: ${staleFiles.length} stale + ${newFilesOnDisk.length} new + ${deletedFiles.length} deleted`);
1933
+ // Cached scans must still flow through the same incremental mutation
1934
+ // paths as file watchers and editor integrations. updateFile/addFile/
1935
+ // removeFile are the only paths that compute semantic history events;
1936
+ // direct reparsing refreshes the cache but silently skips history.json.
1937
+ this.isScanning = false;
1973
1938
  let scanned = 0;
1974
- const total = repairArray.length * 2;
1975
- for (const fp of repairArray) {
1976
- this.ensureFileNode(fp);
1977
- }
1978
- for (const fp of repairArray) {
1979
- try {
1980
- const isNew = newFilesOnDiskSet.has(fp) && !knownFilePaths.has(fp);
1981
- this.parseImportsAndExports(fp, isNew);
1939
+ const total = staleFiles.length + newFilesOnDisk.length + deletedFiles.length;
1940
+ for (const fp of staleFiles) {
1941
+ if (fs.existsSync(fp)) {
1942
+ this.updateFile(fp);
1982
1943
  }
1983
- catch {
1984
- console.warn("[Ripple] Repair parse error:", fp);
1944
+ else {
1945
+ this.removeFile(fp);
1985
1946
  }
1986
1947
  scanned++;
1987
1948
  onProgress?.(scanned, total);
1988
1949
  }
1989
- for (const fp of repairArray) {
1990
- try {
1991
- this.parseCallsOnly(fp);
1992
- }
1993
- catch {
1994
- console.warn("[Ripple] Repair call error:", fp);
1950
+ for (const fp of newFilesOnDisk) {
1951
+ if (fs.existsSync(fp)) {
1952
+ this.addFile(fp);
1995
1953
  }
1996
1954
  scanned++;
1997
1955
  onProgress?.(scanned, total);
1998
1956
  }
1999
- const deleted = Array.from(this.graph.files.keys()).filter((fp) => !fs.existsSync(fp));
2000
- deleted.forEach((fp) => this.removeFile(fp));
1957
+ for (const fp of deletedFiles) {
1958
+ this.removeFile(fp);
1959
+ scanned++;
1960
+ onProgress?.(scanned, total);
1961
+ }
1962
+ this.isScanning = true;
2001
1963
  }
2002
1964
  this.isScanning = false;
2003
1965
  this.processPendingChanges();