create-ledgit-repo 0.1.2 → 0.2.2

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 +32 -42
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -17016,8 +17016,9 @@ var DEFAULT_GITIGNORE = `# Environment files with secrets
17016
17016
  .env
17017
17017
  .env.*
17018
17018
 
17019
- # CLI cache
17020
- .kvitton/
17019
+ # Tokens and cache (sensitive data)
17020
+ .ledgit/tokens/
17021
+ .ledgit/cache/
17021
17022
 
17022
17023
  # OS files
17023
17024
  .DS_Store
@@ -17060,14 +17061,9 @@ This is an accounting data repository for {{COMPANY_NAME}} (Swedish company), st
17060
17061
  │ ├── entry.yaml
17061
17062
  │ └── *.pdf # Supporting documents
17062
17063
 
17063
- ├── inbox/ # Raw incoming documents (no entry yet)
17064
- └── [DATE]-[NAME]/
17065
- │ ├── documents.yaml
17066
- │ └── *.pdf
17067
- └── drafts/ # Documents with entries, ready to post
17068
- └── [DATE]-[NAME]/ # e.g., "2025-12-24-anthropic"
17064
+ └── inbox/ # Raw incoming documents (no entry yet)
17065
+ └── [DATE]-[NAME]/
17069
17066
  ├── documents.yaml
17070
- ├── entry.yaml
17071
17067
  └── *.pdf
17072
17068
  \`\`\`
17073
17069
 
@@ -17081,10 +17077,10 @@ npx ledgit-cli sync-journal # Sync journal entries from accounting prov
17081
17077
  npx ledgit-cli sync-inbox # Download inbox files from accounting provider
17082
17078
  npx ledgit-cli company-info # Display company information
17083
17079
 
17084
- # Create journal entries
17080
+ # Create journal entries (entry number auto-detected, git branch created if on main)
17085
17081
  npx ledgit-cli create-entry --path <inbox-dir-or-file> \\
17086
17082
  --tax-code <code> --base-account <acc> --balancing-account <acc> \\
17087
- --series <A-K> --entry-number <num>
17083
+ --series <A-K>
17088
17084
 
17089
17085
  # For raw files (not from inbox), also provide:
17090
17086
  # --description "Vendor name" --document-date 2025-01-15 --amount 1234.50
@@ -17115,26 +17111,36 @@ npx ledgit-cli update # Update AGENTS.md to latest version
17115
17111
  ## Workflow Overview
17116
17112
 
17117
17113
  \`\`\`
17118
- inbox/ → (create-entry) → drafts/ → (user confirms) journal-entries/ → (sync-journal) → Provider
17114
+ inbox/ → (create-entry) → journal-entries/ → (git review & commit) → (sync-journal) → Provider
17119
17115
  \`\`\`
17120
17116
 
17121
- ## Bookkeeping New Entries
17117
+ When you run \`create-entry\` on main branch, a new git branch is automatically created (e.g., \`book/V-189-2025-10-15-anthropic\`). Review changes with \`git diff\`, commit, and sync to provider.
17122
17118
 
17123
- **Important:** Always ask the user for clarification if anything is unclear about the transaction before creating an entry.
17119
+ ## Bookkeeping New Entries
17124
17120
 
17125
17121
  To create a journal entry from an inbox document:
17126
17122
 
17127
- 1. **Read the document** - Use \`npx ledgit-cli parse-pdf\` for PDFs to understand the content
17128
- 2. **Update documents.yaml** - After parsing, populate missing metadata in \`documents.yaml\`:
17123
+ 1. **Read the document** - You can read PDFs directly, or use \`npx ledgit-cli parse-pdf\` to extract text
17124
+ 2. **Update documents.yaml** - Populate missing metadata in \`documents.yaml\`:
17129
17125
  - \`documentDate\`: Invoice/receipt date (YYYY-MM-DD)
17130
17126
  - \`description\`: Vendor or document name
17131
17127
  - \`totalAmount\`: With \`amount\` (string) and \`currency\` (e.g., EUR, SEK)
17132
- 3. **Look for similar entries** - Search \`journal-entries/\` and \`drafts/\` for entries from the same vendor or similar transaction types to learn which accounts and tax codes were used previously
17128
+ 3. **Look for similar entries** - Search \`journal-entries/\` for entries from the same vendor or similar transaction types to learn which accounts and tax codes were used previously
17133
17129
  4. **Check accounts** - Review \`accounts.yaml\` for appropriate expense/revenue accounts
17134
- 5. **Determine tax code** - Based on vendor location and transaction type (see Tax Codes below). Explain your reasoning and describe the tax code meaning to the user
17135
- 6. **Ask for confirmation** - Before creating, confirm with the user: vendor, amount, accounts (with names), and tax code (with description)
17136
- 7. **Create entry** - Run \`npx ledgit-cli create-entry\` with the appropriate parameters
17137
- 8. **Files moved to drafts** - The inbox item is automatically moved to \`drafts/\` with \`entry.yaml\`
17130
+ 5. **Determine tax code** - Based on vendor location and transaction type (see Tax Codes below)
17131
+ 6. **Create entry** - Run \`npx ledgit-cli create-entry\` with the appropriate parameters
17132
+ 7. **Review and sync** - The entry is created in \`journal-entries/\`. Review with \`git diff\`, commit, and run \`npx ledgit-cli sync-journal\` to post to {{PROVIDER}}
17133
+
17134
+ ### GitHub Actions / CI Mode
17135
+
17136
+ When running in GitHub Actions (automated bookkeeping):
17137
+ - **Always proceed** with creating entries using your best judgment
17138
+ - **Always end** by creating or updating a PR
17139
+ - If anything is unclear, include your questions in the PR description
17140
+ - The user will respond via PR comments, which triggers another workflow run
17141
+ - Group related entries (same vendor, same week) in one PR when sensible
17142
+
17143
+ **Never stop and wait for confirmation in CI mode** - the user can't respond until you create a PR.
17138
17144
 
17139
17145
  To discard unwanted inbox items:
17140
17146
  \`\`\`bash
@@ -17142,22 +17148,6 @@ npx ledgit-cli discard inbox/2025-01-15-spam-document
17142
17148
  \`\`\`
17143
17149
  This removes the directory and marks the item for deletion from the provider on next sync.
17144
17150
 
17145
- ## Posting Entries
17146
-
17147
- **Important:** Moving entries to \`journal-entries/\` posts them to the real ledger. Always confirm with the user before posting.
17148
-
17149
- When the user confirms draft entries are ready to post:
17150
-
17151
- 1. **Determine entry number** - Check existing entries in \`journal-entries/FY-YYYY/\` for the series to find the next available number
17152
- 2. **Move to journal-entries** - Rename the draft directory to the proper format:
17153
- \`\`\`
17154
- drafts/2025-01-15-anthropic/
17155
- → journal-entries/FY-2025/A-042-2025-01-15-anthropic/
17156
- \`\`\`
17157
- Format: \`{SERIES}-{NUM}-{DATE}-{DESC}/\`
17158
- 3. **Update entry.yaml** - Ensure \`entryNumber\` matches the directory and \`status\` is set appropriately
17159
- 4. **Sync to provider** - Run \`npx ledgit-cli sync-journal\` to post the entries to {{PROVIDER}}
17160
-
17161
17151
  ## Tax Codes
17162
17152
 
17163
17153
  ### Common Tax Code Patterns
@@ -17258,9 +17248,9 @@ function renderAgentsTemplate(options) {
17258
17248
  }
17259
17249
  // ../bookkeeping/dist/utils/paths.js
17260
17250
  import * as path3 from "node:path";
17261
- var KVITTON_DIR = ".kvitton";
17251
+ var LEDGIT_DIR = ".ledgit";
17262
17252
  function getTokensDir(cwd) {
17263
- return path3.join(cwd, KVITTON_DIR, "tokens");
17253
+ return path3.join(cwd, LEDGIT_DIR, "tokens");
17264
17254
  }
17265
17255
  // ../bookkeeping/dist/services/journal.service.js
17266
17256
  class JournalService {
@@ -18376,7 +18366,7 @@ async function loginFortnox(options) {
18376
18366
  onStatus("Exchanging authorization code for token...");
18377
18367
  const tokenResponse = await exchangeCodeForToken(config, callbackResult.code);
18378
18368
  const storedToken = saveFortnoxToken(cwd, tokenResponse);
18379
- onStatus("Token saved to .kvitton/tokens/fortnox.json");
18369
+ onStatus("Token saved to .ledgit/tokens/fortnox.json");
18380
18370
  return storedToken;
18381
18371
  } finally {
18382
18372
  stop();
@@ -22482,8 +22472,8 @@ async function createBookkeepingRepo(name, options = {}) {
22482
22472
  await createEnvFile(targetDir, {
22483
22473
  PROVIDER: "fortnox"
22484
22474
  });
22485
- const sourcePath = path8.join(fortnoxTempDir, KVITTON_DIR, "tokens");
22486
- const targetPath = path8.join(targetDir, KVITTON_DIR, "tokens");
22475
+ const sourcePath = path8.join(fortnoxTempDir, LEDGIT_DIR, "tokens");
22476
+ const targetPath = path8.join(targetDir, LEDGIT_DIR, "tokens");
22487
22477
  await fs11.mkdir(path8.dirname(targetPath), { recursive: true });
22488
22478
  await fs11.cp(sourcePath, targetPath, { recursive: true });
22489
22479
  await fs11.rm(fortnoxTempDir, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-ledgit-repo",
3
- "version": "0.1.2",
3
+ "version": "0.2.2",
4
4
  "description": "Create a new ledgit bookkeeping repository",
5
5
  "repository": {
6
6
  "type": "git",