@fuzzle/opencode-accountant 0.10.7-next.1 → 0.10.7

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 +13 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4258,19 +4258,6 @@ var require_brace_expansion = __commonJS((exports, module) => {
4258
4258
  }
4259
4259
  });
4260
4260
 
4261
- // src/utils/journalMatchers.ts
4262
- function extractAccount(line, pattern) {
4263
- const match2 = line.match(pattern);
4264
- return match2 ? match2[1].trim() : null;
4265
- }
4266
- var JOURNAL_ACCOUNT_DECL, RULES_ACCOUNT_DIRECTIVE, RULES_ACCOUNT2_DIRECTIVE, TX_HEADER_PATTERN;
4267
- var init_journalMatchers = __esm(() => {
4268
- JOURNAL_ACCOUNT_DECL = /^account\s+(.+)$/;
4269
- RULES_ACCOUNT_DIRECTIVE = /^account\d+\s+(.+)$/;
4270
- RULES_ACCOUNT2_DIRECTIVE = /^\s*account2\s+(.+)$/;
4271
- TX_HEADER_PATTERN = /^(\d{4})-(\d{2}-\d{2})(\s+(.+))?$/;
4272
- });
4273
-
4274
4261
  // src/utils/accountSuggester.ts
4275
4262
  var exports_accountSuggester = {};
4276
4263
  __export(exports_accountSuggester, {
@@ -4300,9 +4287,9 @@ function loadExistingAccounts(yearJournalPath) {
4300
4287
  for (const line of lines) {
4301
4288
  const trimmed = line.trim();
4302
4289
  if (trimmed.startsWith("account ")) {
4303
- const accountName = extractAccount(trimmed, JOURNAL_ACCOUNT_DECL);
4304
- if (accountName) {
4305
- accounts.push(accountName);
4290
+ const match2 = trimmed.match(/^account\s+(.+?)(?:\s+|$)/);
4291
+ if (match2) {
4292
+ accounts.push(match2[1].trim());
4306
4293
  }
4307
4294
  }
4308
4295
  }
@@ -4327,11 +4314,11 @@ function extractRulePatternsFromFile(rulesPath) {
4327
4314
  currentCondition = ifMatch[1].trim();
4328
4315
  continue;
4329
4316
  }
4330
- const account2Name = extractAccount(trimmed, RULES_ACCOUNT2_DIRECTIVE);
4331
- if (account2Name && currentCondition) {
4317
+ const account2Match = trimmed.match(/^\s*account2\s+(.+?)(?:\s+|$)/);
4318
+ if (account2Match && currentCondition) {
4332
4319
  patterns.push({
4333
4320
  condition: currentCondition,
4334
- account: account2Name
4321
+ account: account2Match[1].trim()
4335
4322
  });
4336
4323
  currentCondition = null;
4337
4324
  continue;
@@ -4517,7 +4504,6 @@ function generateMockSuggestions(postings) {
4517
4504
  var EXAMPLE_PATTERN_SAMPLE_SIZE = 10, suggestionCache, RESPONSE_FORMAT_SECTION;
4518
4505
  var init_accountSuggester = __esm(() => {
4519
4506
  init_agentLoader();
4520
- init_journalMatchers();
4521
4507
  suggestionCache = {};
4522
4508
  RESPONSE_FORMAT_SECTION = [
4523
4509
  `## Task
@@ -23137,7 +23123,7 @@ function findRulesForCsv(csvPath, mapping) {
23137
23123
 
23138
23124
  // src/utils/hledgerExecutor.ts
23139
23125
  var {$: $2 } = globalThis.Bun;
23140
- init_journalMatchers();
23126
+ var TX_HEADER_PATTERN = /^(\d{4})-(\d{2}-\d{2})(\s+(.+))?$/;
23141
23127
  async function defaultHledgerExecutor(cmdArgs) {
23142
23128
  try {
23143
23129
  const result = await $2`hledger ${cmdArgs}`.quiet().nothrow();
@@ -24164,7 +24150,6 @@ import * as fs20 from "fs";
24164
24150
  import * as path14 from "path";
24165
24151
 
24166
24152
  // src/utils/accountDeclarations.ts
24167
- init_journalMatchers();
24168
24153
  import * as fs12 from "fs";
24169
24154
  function extractAccountsFromRulesFile(rulesPath) {
24170
24155
  const accounts = new Set;
@@ -24179,9 +24164,9 @@ function extractAccountsFromRulesFile(rulesPath) {
24179
24164
  if (trimmed.startsWith("#") || trimmed.startsWith(";") || trimmed === "") {
24180
24165
  continue;
24181
24166
  }
24182
- const accountName = extractAccount(trimmed, RULES_ACCOUNT_DIRECTIVE);
24183
- if (accountName) {
24184
- accounts.add(accountName);
24167
+ const accountMatch = trimmed.match(/^account\d+\s+(.+?)(?:\s+|$)/);
24168
+ if (accountMatch) {
24169
+ accounts.add(accountMatch[1].trim());
24185
24170
  continue;
24186
24171
  }
24187
24172
  }
@@ -24216,9 +24201,9 @@ function parseJournalSections(content) {
24216
24201
  }
24217
24202
  if (trimmed.startsWith("account ")) {
24218
24203
  inAccountSection = true;
24219
- const accountName = extractAccount(trimmed, JOURNAL_ACCOUNT_DECL);
24220
- if (accountName) {
24221
- existingAccounts.add(accountName);
24204
+ const accountMatch = trimmed.match(/^account\s+(.+?)(?:\s+|$)/);
24205
+ if (accountMatch) {
24206
+ existingAccounts.add(accountMatch[1].trim());
24222
24207
  }
24223
24208
  continue;
24224
24209
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fuzzle/opencode-accountant",
3
- "version": "0.10.7-next.1",
3
+ "version": "0.10.7",
4
4
  "description": "An OpenCode accounting agent, specialized in double-entry-bookkepping with hledger",
5
5
  "author": {
6
6
  "name": "ali bengali",