@fuzzle/opencode-accountant 0.10.2 → 0.10.3-next.1

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 (2) hide show
  1. package/dist/index.js +10 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -23078,19 +23078,12 @@ function findRulesForCsv(csvPath, mapping) {
23078
23078
 
23079
23079
  // src/utils/hledgerExecutor.ts
23080
23080
  var {$: $2 } = globalThis.Bun;
23081
- var STDERR_TRUNCATE_LENGTH = 500;
23082
23081
  var TX_HEADER_PATTERN = /^(\d{4})-(\d{2}-\d{2})(\s+(.+))?$/;
23083
23082
  async function defaultHledgerExecutor(cmdArgs) {
23084
23083
  try {
23085
23084
  const result = await $2`hledger ${cmdArgs}`.quiet().nothrow();
23086
23085
  const stdout = result.stdout.toString();
23087
23086
  const stderr = result.stderr.toString();
23088
- if (result.exitCode !== 0 && stderr) {
23089
- process.stderr.write(`[hledger] command failed (exit ${result.exitCode}): hledger ${cmdArgs.join(" ")}
23090
- `);
23091
- process.stderr.write(`[hledger] stderr: ${stderr.slice(0, STDERR_TRUNCATE_LENGTH)}
23092
- `);
23093
- }
23094
23087
  return {
23095
23088
  stdout,
23096
23089
  stderr,
@@ -23098,8 +23091,6 @@ async function defaultHledgerExecutor(cmdArgs) {
23098
23091
  };
23099
23092
  } catch (error45) {
23100
23093
  const errorMessage = error45 instanceof Error ? error45.message : String(error45);
23101
- process.stderr.write(`[hledger] exception: ${errorMessage}
23102
- `);
23103
23094
  return {
23104
23095
  stdout: "",
23105
23096
  stderr: errorMessage,
@@ -24814,6 +24805,11 @@ Got:
24814
24805
  import * as fs18 from "fs";
24815
24806
  import * as path13 from "path";
24816
24807
 
24808
+ // src/utils/symbolNormalizer.ts
24809
+ function normalizeSymbol(symbol2) {
24810
+ return symbol2.toLowerCase().replace(/\./g, "-");
24811
+ }
24812
+
24817
24813
  // src/utils/swissquoteLotTracker.ts
24818
24814
  import * as fs17 from "fs";
24819
24815
  import * as path12 from "path";
@@ -25338,7 +25334,7 @@ var MERGER_LIKE_TYPES = new Set([
25338
25334
  ]);
25339
25335
  function processCorporateActions(actions, inventory, lotInventoryPath, projectDir, logger) {
25340
25336
  const entries = [];
25341
- actions.sort((a, b) => a.date.localeCompare(b.date));
25337
+ actions.sort((a, b) => formatDate(a.date).localeCompare(formatDate(b.date)));
25342
25338
  const mergerActions = [];
25343
25339
  const otherActions = [];
25344
25340
  for (const action of actions) {
@@ -25588,6 +25584,9 @@ async function preprocessSwissquote(csvPath, projectDir, currency, year, lotInve
25588
25584
  if (hasSymbolMap && txn.symbol) {
25589
25585
  txn.symbol = symbolMap[txn.symbol] ?? txn.symbol;
25590
25586
  }
25587
+ if (txn.symbol) {
25588
+ txn.symbol = normalizeSymbol(txn.symbol);
25589
+ }
25591
25590
  transactions.push(txn);
25592
25591
  }
25593
25592
  }
@@ -25643,7 +25642,7 @@ async function preprocessSwissquote(csvPath, projectDir, currency, year, lotInve
25643
25642
  const journalEntries = [];
25644
25643
  if (trades.length > 0) {
25645
25644
  logger?.startSection("Trade Processing", 2);
25646
- trades.sort((a, b) => a.date.localeCompare(b.date));
25645
+ trades.sort((a, b) => formatDate(a.date).localeCompare(formatDate(b.date)));
25647
25646
  for (const trade of trades) {
25648
25647
  try {
25649
25648
  if (trade.type === "Buy") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzzle/opencode-accountant",
3
- "version": "0.10.2",
3
+ "version": "0.10.3-next.1",
4
4
  "description": "An OpenCode accounting agent, specialized in double-entry-bookkepping with hledger",
5
5
  "author": {
6
6
  "name": "ali bengali",