@fuzzle/opencode-accountant 0.0.15-next.1 → 0.0.15
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/index.js +0 -32
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17701,20 +17701,6 @@ function extractTransactionYears(hledgerOutput) {
|
|
|
17701
17701
|
}
|
|
17702
17702
|
return years;
|
|
17703
17703
|
}
|
|
17704
|
-
async function validateLedger(mainJournalPath, executor = defaultHledgerExecutor) {
|
|
17705
|
-
const errors3 = [];
|
|
17706
|
-
const checkResult = await executor(["check", "--strict", "-f", mainJournalPath]);
|
|
17707
|
-
if (checkResult.exitCode !== 0) {
|
|
17708
|
-
const errorMsg = checkResult.stderr.trim() || checkResult.stdout.trim();
|
|
17709
|
-
errors3.push(`hledger check --strict failed: ${errorMsg}`);
|
|
17710
|
-
}
|
|
17711
|
-
const balResult = await executor(["bal", "-f", mainJournalPath]);
|
|
17712
|
-
if (balResult.exitCode !== 0) {
|
|
17713
|
-
const errorMsg = balResult.stderr.trim() || balResult.stdout.trim();
|
|
17714
|
-
errors3.push(`hledger bal failed: ${errorMsg}`);
|
|
17715
|
-
}
|
|
17716
|
-
return { valid: errors3.length === 0, errors: errors3 };
|
|
17717
|
-
}
|
|
17718
17704
|
|
|
17719
17705
|
// src/utils/rulesParser.ts
|
|
17720
17706
|
function parseSkipRows(rulesContent) {
|
|
@@ -18212,24 +18198,6 @@ async function importStatementsCore(directory, agent, options, configLoader = lo
|
|
|
18212
18198
|
}
|
|
18213
18199
|
importedFiles.push(csvFile);
|
|
18214
18200
|
}
|
|
18215
|
-
const mainJournalPath = path6.join(directory, ".hledger.journal");
|
|
18216
|
-
const validationResult = await validateLedger(mainJournalPath, hledgerExecutor);
|
|
18217
|
-
if (!validationResult.valid) {
|
|
18218
|
-
return JSON.stringify({
|
|
18219
|
-
success: false,
|
|
18220
|
-
files: fileResults,
|
|
18221
|
-
summary: {
|
|
18222
|
-
filesProcessed: csvFiles.length,
|
|
18223
|
-
filesWithErrors: 1,
|
|
18224
|
-
filesWithoutRules,
|
|
18225
|
-
totalTransactions,
|
|
18226
|
-
matched: totalMatched,
|
|
18227
|
-
unknown: totalUnknown
|
|
18228
|
-
},
|
|
18229
|
-
error: `Ledger validation failed after import: ${validationResult.errors.join("; ")}`,
|
|
18230
|
-
hint: "The import created invalid transactions. Check your rules file configuration (e.g., balance vs balance2 for balance assertions). CSV files have NOT been moved to done."
|
|
18231
|
-
});
|
|
18232
|
-
}
|
|
18233
18201
|
for (const csvFile of importedFiles) {
|
|
18234
18202
|
const relativePath = path6.relative(pendingDir, csvFile);
|
|
18235
18203
|
const destPath = path6.join(doneDir, relativePath);
|