jaz-cli 2.6.0 → 2.8.0

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 (62) hide show
  1. package/assets/skills/api/SKILL.md +12 -2
  2. package/assets/skills/api/references/dependencies.md +3 -2
  3. package/assets/skills/api/references/endpoints.md +78 -0
  4. package/assets/skills/api/references/feature-glossary.md +4 -4
  5. package/assets/skills/api/references/field-map.md +17 -0
  6. package/assets/skills/api/references/full-api-surface.md +1 -1
  7. package/assets/skills/conversion/SKILL.md +1 -1
  8. package/assets/skills/jobs/SKILL.md +104 -0
  9. package/assets/skills/jobs/references/audit-prep.md +319 -0
  10. package/assets/skills/jobs/references/bank-recon.md +234 -0
  11. package/assets/skills/jobs/references/building-blocks.md +135 -0
  12. package/assets/skills/jobs/references/credit-control.md +273 -0
  13. package/assets/skills/jobs/references/fa-review.md +267 -0
  14. package/assets/skills/jobs/references/gst-vat-filing.md +250 -0
  15. package/assets/skills/jobs/references/month-end-close.md +308 -0
  16. package/assets/skills/jobs/references/payment-run.md +246 -0
  17. package/assets/skills/jobs/references/quarter-end-close.md +268 -0
  18. package/assets/skills/jobs/references/supplier-recon.md +330 -0
  19. package/assets/skills/jobs/references/year-end-close.md +341 -0
  20. package/assets/skills/transaction-recipes/SKILL.md +1 -1
  21. package/dist/__tests__/amortization.test.js +101 -0
  22. package/dist/__tests__/asset-disposal.test.js +249 -0
  23. package/dist/__tests__/blueprint.test.js +72 -0
  24. package/dist/__tests__/depreciation.test.js +125 -0
  25. package/dist/__tests__/ecl.test.js +134 -0
  26. package/dist/__tests__/fixed-deposit.test.js +214 -0
  27. package/dist/__tests__/fx-reval.test.js +115 -0
  28. package/dist/__tests__/jobs-audit-prep.test.js +125 -0
  29. package/dist/__tests__/jobs-bank-recon.test.js +108 -0
  30. package/dist/__tests__/jobs-credit-control.test.js +98 -0
  31. package/dist/__tests__/jobs-fa-review.test.js +104 -0
  32. package/dist/__tests__/jobs-gst-vat.test.js +113 -0
  33. package/dist/__tests__/jobs-month-end.test.js +162 -0
  34. package/dist/__tests__/jobs-payment-run.test.js +106 -0
  35. package/dist/__tests__/jobs-quarter-end.test.js +155 -0
  36. package/dist/__tests__/jobs-supplier-recon.test.js +115 -0
  37. package/dist/__tests__/jobs-validate.test.js +181 -0
  38. package/dist/__tests__/jobs-year-end.test.js +149 -0
  39. package/dist/__tests__/lease.test.js +96 -0
  40. package/dist/__tests__/loan.test.js +80 -0
  41. package/dist/__tests__/provision.test.js +141 -0
  42. package/dist/__tests__/validate.test.js +81 -0
  43. package/dist/calc/asset-disposal.js +17 -13
  44. package/dist/calc/fixed-deposit.js +26 -17
  45. package/dist/calc/lease.js +7 -3
  46. package/dist/commands/jobs.js +184 -0
  47. package/dist/index.js +2 -0
  48. package/dist/jobs/audit-prep.js +211 -0
  49. package/dist/jobs/bank-recon.js +163 -0
  50. package/dist/jobs/credit-control.js +126 -0
  51. package/dist/jobs/fa-review.js +121 -0
  52. package/dist/jobs/format.js +102 -0
  53. package/dist/jobs/gst-vat.js +187 -0
  54. package/dist/jobs/month-end.js +232 -0
  55. package/dist/jobs/payment-run.js +199 -0
  56. package/dist/jobs/quarter-end.js +135 -0
  57. package/dist/jobs/supplier-recon.js +132 -0
  58. package/dist/jobs/types.js +36 -0
  59. package/dist/jobs/validate.js +115 -0
  60. package/dist/jobs/year-end.js +153 -0
  61. package/dist/types/index.js +2 -1
  62. package/package.json +5 -2
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Year-end close blueprint generator.
3
+ * Builds on quarter-end phases with additional annual review and audit steps.
4
+ * Supports standalone (full) and incremental (annual extras only) modes.
5
+ */
6
+ import { parseYearPeriod } from './validate.js';
7
+ import { generateQuarterEndBlueprint } from './quarter-end.js';
8
+ import { buildSummary } from './types.js';
9
+ /**
10
+ * Build the annual extras phase (Phase 8).
11
+ * Year-end only steps: final depreciation, true-ups, dividends, retained
12
+ * earnings rollover, full-year GST reconciliation, audit prep, and final lock.
13
+ */
14
+ function buildAnnualExtrasPhase(startDate, endDate, startOrder) {
15
+ let order = startOrder;
16
+ const step = (partial) => ({
17
+ order: ++order,
18
+ ...partial,
19
+ });
20
+ return {
21
+ name: 'Phase 8: Annual Extras',
22
+ description: 'Year-end specific adjustments, filings, and audit preparation.',
23
+ steps: [
24
+ step({
25
+ description: 'Final depreciation run for all fixed assets',
26
+ category: 'verify',
27
+ recipeRef: 'declining-balance',
28
+ calcCommand: 'jaz calc depreciation',
29
+ verification: 'NBV per register matches GL balances',
30
+ notes: 'Reconcile fixed asset register to general ledger',
31
+ }),
32
+ step({
33
+ description: 'Year-end true-ups (leave, bonus, provisions)',
34
+ category: 'adjust',
35
+ recipeRef: 'employee-accruals',
36
+ notes: 'True-up leave accrual to actual entitlement, bonus accrual to board-approved pool, and provision estimates to year-end reassessment',
37
+ }),
38
+ step({
39
+ description: 'Dividend declaration and payment',
40
+ category: 'adjust',
41
+ recipeRef: 'dividend',
42
+ conditional: 'If declaring dividends',
43
+ notes: 'Requires board resolution. Record declaration (DR Retained Earnings, CR Dividends Payable) then payment separately.',
44
+ }),
45
+ step({
46
+ description: 'Retained earnings rollover verification',
47
+ category: 'verify',
48
+ notes: 'Platform-managed. Verify via equity movement report that opening retained earnings equals prior year closing balance plus current year net income.',
49
+ }),
50
+ step({
51
+ description: 'Final GST/VAT reconciliation for the full year',
52
+ category: 'verify',
53
+ apiCall: 'POST /generate-reports/vat-ledger',
54
+ apiBody: { startDate, endDate },
55
+ verification: 'Full-year VAT ledger reconciles to quarterly filings',
56
+ notes: 'Sum of quarterly GST submissions should match full-year ledger totals',
57
+ }),
58
+ step({
59
+ description: 'Audit preparation and documentation',
60
+ category: 'export',
61
+ notes: 'See audit-prep job for full detail. Prepare trial balance, aged schedules, bank confirmations, and supporting journals for auditor.',
62
+ }),
63
+ step({
64
+ description: `Set final lock date to ${endDate}`,
65
+ category: 'lock',
66
+ notes: `Lock the full financial year by setting the accounting lock date to ${endDate}. No further postings to this year after lock.`,
67
+ }),
68
+ ],
69
+ };
70
+ }
71
+ /**
72
+ * Build the annual verification phase (Phase 9).
73
+ * Full-year financial reports for board and statutory filing.
74
+ */
75
+ function buildAnnualVerificationPhase(startDate, endDate, label, startOrder) {
76
+ let order = startOrder;
77
+ const step = (partial) => ({
78
+ order: ++order,
79
+ ...partial,
80
+ });
81
+ return {
82
+ name: 'Phase 9: Annual Verification',
83
+ description: `Full-year financial report review for ${label}.`,
84
+ steps: [
85
+ step({
86
+ description: `Review trial balance for ${label}`,
87
+ category: 'report',
88
+ apiCall: 'POST /generate-reports/trial-balance',
89
+ apiBody: { startDate, endDate },
90
+ verification: 'Total debits equal total credits',
91
+ }),
92
+ step({
93
+ description: `Generate P&L for ${label}`,
94
+ category: 'report',
95
+ apiCall: 'POST /generate-reports/profit-and-loss',
96
+ apiBody: { primarySnapshotDate: endDate, secondarySnapshotDate: startDate },
97
+ }),
98
+ step({
99
+ description: `Generate balance sheet as at ${endDate}`,
100
+ category: 'report',
101
+ apiCall: 'POST /generate-reports/balance-sheet',
102
+ apiBody: { primarySnapshotDate: endDate },
103
+ verification: 'Assets = Liabilities + Equity',
104
+ }),
105
+ ],
106
+ };
107
+ }
108
+ /**
109
+ * Generate a year-end close blueprint.
110
+ *
111
+ * @param opts.period Year in YYYY format (e.g. "2025")
112
+ * @param opts.currency Optional base currency code (e.g. "SGD")
113
+ * @param opts.incremental If true, generate only the annual extras (skip quarter/month phases)
114
+ */
115
+ export function generateYearEndBlueprint(opts) {
116
+ const parsed = parseYearPeriod(opts.period);
117
+ const mode = opts.incremental ? 'incremental' : 'standalone';
118
+ const phases = [];
119
+ if (!opts.incremental) {
120
+ // Standalone: include quarter-end phases for each of the 4 quarters
121
+ for (const quarter of parsed.quarters) {
122
+ const qBp = generateQuarterEndBlueprint({
123
+ period: `${parsed.year}-Q${quarter.quarter}`,
124
+ currency: opts.currency,
125
+ incremental: false,
126
+ });
127
+ // Prefix each phase name with the quarter label for clarity
128
+ for (const phase of qBp.phases) {
129
+ if (!phase.name.startsWith(quarter.label)) {
130
+ phase.name = `${quarter.label} — ${phase.name}`;
131
+ }
132
+ phases.push(phase);
133
+ }
134
+ }
135
+ }
136
+ // Count the highest step order from existing phases
137
+ const maxOrder = phases.reduce((max, phase) => phase.steps.reduce((m, s) => Math.max(m, s.order), max), 0);
138
+ // Add annual extras (Phase 8)
139
+ const extras = buildAnnualExtrasPhase(parsed.startDate, parsed.endDate, maxOrder);
140
+ phases.push(extras);
141
+ // Add annual verification (Phase 9)
142
+ const lastExtraOrder = extras.steps.reduce((max, s) => Math.max(max, s.order), 0);
143
+ const verification = buildAnnualVerificationPhase(parsed.startDate, parsed.endDate, parsed.label, lastExtraOrder);
144
+ phases.push(verification);
145
+ return {
146
+ jobType: 'year-end-close',
147
+ period: parsed.label,
148
+ currency: opts.currency ?? 'SGD',
149
+ mode,
150
+ phases,
151
+ summary: buildSummary(phases),
152
+ };
153
+ }
@@ -1,6 +1,7 @@
1
- export const SKILL_TYPES = ['api', 'conversion', 'transaction-recipes', 'all'];
1
+ export const SKILL_TYPES = ['api', 'conversion', 'transaction-recipes', 'jobs', 'all'];
2
2
  export const SKILL_DESCRIPTIONS = {
3
3
  api: 'Jaz/Juan REST API reference — 55 rules, endpoint catalog, error catalog, field mapping',
4
4
  conversion: 'Data conversion pipeline — Xero, QuickBooks, Sage, Excel migration to Jaz',
5
5
  'transaction-recipes': 'Complex accounting recipes — prepaid, deferred revenue, loans, IFRS 16, depreciation',
6
+ jobs: 'Accounting job blueprints — month/quarter/year-end close + 7 ad-hoc operational workflows',
6
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaz-cli",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "CLI to install Jaz AI skills for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,6 +13,8 @@
13
13
  "scripts": {
14
14
  "build": "tsc && node --input-type=module -e \"import{readFileSync,writeFileSync}from'fs';const c=readFileSync('dist/index.js','utf8');if(!c.startsWith('#!')){writeFileSync('dist/index.js','#!/usr/bin/env node\\n'+c)}\"",
15
15
  "dev": "node --loader ts-node/esm src/index.ts",
16
+ "test": "vitest run",
17
+ "test:watch": "vitest",
16
18
  "prepublishOnly": "npm run build"
17
19
  },
18
20
  "keywords": [
@@ -45,6 +47,7 @@
45
47
  "devDependencies": {
46
48
  "@types/node": "^22.10.1",
47
49
  "@types/prompts": "^2.4.9",
48
- "typescript": "^5.7.2"
50
+ "typescript": "^5.7.2",
51
+ "vitest": "^4.0.18"
49
52
  }
50
53
  }