* feat(reconciliation): close the bank-feed loop on voucher links and re-tag mis-typed opening balances
Two related fixes to bank reconciliation correctness:
1. Auto-reconcile on voucher link. Linking an invoice or supplier invoice to
an existing voucher previously advanced only the invoice — the bank
transaction that paid it kept sitting in the Transactions inbox with a null
journal_entry_id. linkInvoiceToVoucher / linkSupplierInvoiceToVoucher now
call autoReconcileTransactionForLinkedVoucher (lib/reconciliation), which
links the bank transaction to the same verifikat when exactly one unbooked
line matches it. Best-effort and post-commit: a failure here never fails the
link. The result surfaces reconciledTransactionId; the inbox row leaves the
list and the UI shows link_success_tx_reconciled.
2. Re-tag mis-typed opening balances. getReconciliationStatus and the GL-line
matching RPCs identify a cash account's ingående balans solely by
journal_entries.source_type='opening_balance'. Companies migrated from other
systems often booked the bank IB as an ordinary voucher (source_type
'import' or 'manual'), so it was never excluded and surfaced as a phantom
reconciliation difference equal to the opening balance. Adds:
- migration mark_entry_as_opening_balance: a GUC-gated carve-out in the
immutability trigger plus a SECURITY DEFINER RPC that validates the entry
(balance-sheet lines only, dated on a fiscal-period boundary), flips the
source_type, and writes an audit row — no blanket data sweep.
- POST /api/reconciliation/bank/mark-opening-balance + MarkOpeningBalanceSchema.
- BankReconciliationView action to trigger it from the IB diff.
The gnubok_create_voucher executor now accepts a typed is_opening_balance flag
and derives source_type='opening_balance' only after validating class 1/2 lines
on the period start, so new IBs land correctly typed.
Covered by lib/reconciliation auto-reconcile tests, voucher-executors tests,
and a mark-entry-as-opening-balance pg-real test.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: rebrand gnubok → Accounted and prune swarm agent skills
Product rebrand and skills housekeeping. No runtime behaviour change.
Rebrand: replace user-visible "gnubok" with "Accounted" across docs, READMEs,
in-code comments, doc-site content, MCP skill/resource prose, and the
gnubok-mcp package description. The MCP resource URI scheme is moved gnubok://
→ Accounted:// consistently across resource registrations, the event-type
comment, and the resource/skill tests. Deliberately preserved as stable
identifiers (NOT rebranded): the gnubok-company-id cookie, gnubok_sk_ / gnubok_inv_
token prefixes, the gnubok-mcp npm bridge name, and the AGI <gem:Programnamn>
value (kept 'gnubok' per its source comment — it is the software identifier sent
to Skatteverket and must not churn across visual rebrands).
Skills: remove the 27 swarm-* agent SKILL.md atoms (no longer used; already
absent from the agent_atom_registry in prod), refresh the remaining skill docs,
add the .claude/rules/ path-scoped rule set, and regenerate the
seed_agent_atom_bodies migration + .skill-body-manifest.json via
`npm run skills:generate` so the DB-backed skill bodies match the trimmed set.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
88 lines
4.8 KiB
TypeScript
88 lines
4.8 KiB
TypeScript
/**
|
||
* Single source of truth for the /docs/api sidebar navigation.
|
||
*
|
||
* Stripe-pattern grouping: top-level sections (Getting started, Cookbooks,
|
||
* API reference, Concepts, Errors, Changelog) with nested links. Used by
|
||
* the DocsLayout sidebar AND by the landing page resource grid AND by the
|
||
* /llms-full.txt aggregator so additions land in every surface from one
|
||
* edit.
|
||
*/
|
||
|
||
export interface DocsNavLink {
|
||
label: string
|
||
href: string
|
||
/** Optional one-line summary shown on landing-page cards. */
|
||
summary?: string
|
||
}
|
||
|
||
export interface DocsNavSection {
|
||
label: string
|
||
links: DocsNavLink[]
|
||
}
|
||
|
||
export const DOCS_NAV: DocsNavSection[] = [
|
||
{
|
||
label: 'Getting started',
|
||
links: [
|
||
{ label: 'Introduction', href: '/docs/api', summary: 'What the Accounted REST API is and how to authenticate.' },
|
||
{ label: 'Quickstart', href: '/docs/api/cookbook/quickstart', summary: 'Send your first invoice in five minutes.' },
|
||
{ label: 'Authentication', href: '/docs/api#authentication', summary: 'API keys, scopes, test mode.' },
|
||
],
|
||
},
|
||
{
|
||
label: 'Cookbooks',
|
||
links: [
|
||
{ label: 'Send your first invoice', href: '/docs/api/cookbook/send-first-invoice', summary: 'Create a customer, draft an invoice, send it, mark it paid.' },
|
||
{ label: 'Ingest and categorise bank transactions', href: '/docs/api/cookbook/ingest-bank-transactions', summary: 'Push CSV/CAMT into the engine, get AI suggestions, commit.' },
|
||
{ label: 'Compute and review a VAT declaration', href: '/docs/api/cookbook/file-vat-declaration', summary: 'Compute momsdeklaration rutor 05–62 and reconcile before manual Skatteverket submission.' },
|
||
{ label: 'Run payroll and generate AGI', href: '/docs/api/cookbook/run-payroll-and-agi', summary: 'Calculate, approve, mark paid, book, generate AGI XML for manual Skatteverket upload.' },
|
||
{ label: 'Set up webhooks and verify signatures', href: '/docs/api/cookbook/webhooks', summary: 'Subscribe to events, verify HMAC, handle retries idempotently.' },
|
||
{ label: 'Year-end closing', href: '/docs/api/cookbook/year-end-closing', summary: 'Lock periods, run year-end, set opening balances.' },
|
||
],
|
||
},
|
||
{
|
||
label: 'Concepts',
|
||
links: [
|
||
{ label: 'Webhooks', href: '/docs/api/webhooks', summary: 'Event types, delivery model, retries, signature verification.' },
|
||
{ label: 'Versioning', href: '/docs/api/versioning', summary: 'How API versions are pinned, upgraded, and deprecated.' },
|
||
{ label: 'Idempotency', href: '/docs/api/versioning#idempotency', summary: 'Safe retries on every write via Idempotency-Key.' },
|
||
{ label: 'Dry-run', href: '/docs/api/versioning#dry-run', summary: 'Preview every write before committing.' },
|
||
],
|
||
},
|
||
{
|
||
label: 'API reference',
|
||
links: [
|
||
{ label: 'Overview', href: '/docs/api/reference', summary: 'All resources, grouped by domain.' },
|
||
{ label: 'Companies', href: '/docs/api/reference/companies' },
|
||
{ label: 'Customers', href: '/docs/api/reference/customers' },
|
||
{ label: 'Invoices', href: '/docs/api/reference/invoices' },
|
||
{ label: 'Suppliers', href: '/docs/api/reference/suppliers' },
|
||
{ label: 'Supplier invoices', href: '/docs/api/reference/supplier-invoices' },
|
||
{ label: 'Transactions', href: '/docs/api/reference/transactions' },
|
||
{ label: 'Journal entries', href: '/docs/api/reference/journal-entries' },
|
||
{ label: 'Fiscal periods', href: '/docs/api/reference/fiscal-periods' },
|
||
{ label: 'Accounts', href: '/docs/api/reference/accounts' },
|
||
{ label: 'Documents', href: '/docs/api/reference/documents' },
|
||
{ label: 'Employees', href: '/docs/api/reference/employees' },
|
||
{ label: 'Salary runs', href: '/docs/api/reference/salary-runs' },
|
||
{ label: 'Reports', href: '/docs/api/reference/reports' },
|
||
{ label: 'Imports', href: '/docs/api/reference/imports' },
|
||
{ label: 'Compliance check', href: '/docs/api/reference/compliance' },
|
||
{ label: 'Reconciliation', href: '/docs/api/reference/reconciliation' },
|
||
{ label: 'Webhooks', href: '/docs/api/reference/webhooks' },
|
||
{ label: 'Operations', href: '/docs/api/reference/operations' },
|
||
{ label: 'Voucher gap explanations', href: '/docs/api/reference/voucher-gap-explanations' },
|
||
],
|
||
},
|
||
{
|
||
label: 'Reference',
|
||
links: [
|
||
{ label: 'Errors', href: '/docs/api/errors', summary: 'Every stable error code, status, and remediation.' },
|
||
{ label: 'Changelog', href: '/docs/api/changelog', summary: 'Per-version release notes.' },
|
||
{ label: 'OpenAPI 3.1 spec', href: '/api/v1/openapi.json', summary: 'Machine-readable spec for client generation.' },
|
||
{ label: 'llms.txt', href: '/llms.txt', summary: 'Agent-discoverable index.' },
|
||
{ label: 'llms-full.txt', href: '/llms-full.txt', summary: 'Full docs concatenated for LLM ingestion.' },
|
||
],
|
||
},
|
||
]
|