UNPKG

@accounter/shaam-uniform-format-generator

Version:

Fully typed application that generates, parses, and validates SHAAM uniform format tax reports (INI.TXT and BKMVDATA.TXT).

204 lines (125 loc) 6.75 kB
# TODO Checklist for SHAAM Uniform Format Generator & Parser This checklist follows the phased, iterative blueprint for building the project in a test‑driven, modular manner. Each item uses a checkbox `[ ]` for easy marking. --- ## Phase 0: Project Kick‑Off ✅ COMPLETED [x] Initialize repository [x] `git init` [x] `npm init -y` [x] Install dependencies [x] `npm install typescript zod vite vitest expect-type` [x] Create configuration files [x] `tsconfig.json` (strict mode) [x] `vitest.config.ts` [x] Create `README.md` stub --- ## Phase 1: Core API & Orchestrator ✅ COMPLETED [x] Scaffold `src/index.ts` [x] Implement stub `generateUniformFormatReport(input, options?)` [x] Export stubbed function [x] Define initial types [x] `src/types/input-schema.ts` with empty `ReportInput` and `ReportOutput` [x] Add Vitest test [x] `tests/index.spec.ts` to import stub and assert return shape [x] Run smoke test: `vitest --run` --- ## Phase 2: Validation Pipeline ✅ COMPLETED [x] Define Zod schemas [x] `src/types/input-schema.ts`: `BusinessMetadataSchema`, `ReportInputSchema` [x] Implement validation logic [x] `src/validation/validateInput.ts` with `fail-fast` and `collect-all` modes [x] Integrate validation into orchestrator [x] Call `validateInput` at start of `generateUniformFormatReport` [x] Write validation tests [x] Passing case with valid minimal input [x] Failing case: missing required fields (`fail-fast`) [x] Failing case: multiple errors returned (`collect-all`) --- ## Phase 3: Fixed‑Width Formatting Helpers ✅ COMPLETED [x] `src/format/padding.ts` [x] `padLeft(value, width, fill)` [x] `padRight(value, width, fill)` [x] `src/format/newline.ts` [x] Export `CRLF = '\r\n'` [x] `src/format/encoder.ts` [x] `formatField(value, width, align, padChar)` helper [x] Unit tests for formatting [x] Test `padLeft` and `padRight` [x] Test `formatField` various alignments --- ## Phase 4: Record Module Example — A100 ✅ COMPLETED [x] Scaffold module `src/records/a100.ts` [x] Define Zod schema (`A100Schema`) and TS type `A100` [x] Implement `encodeA100(input: A100): string` [x] Implement `parseA100(line: string): A100` [x] Write Vitest tests [x] Round-trip JSON → line → JSON [x] Error on invalid line lengths [x] Confirm module exports [x] `A100Schema`, `encodeA100`, `parseA100` --- ## Phase 5: File Assembly (INI.TXT) ✅ COMPLETED [x] Implement CRLF join logic in `src/format/encoder.ts` [x] In `src/index.ts`, build `iniText` [x] Call `encodeA100` [x] Append summary records placeholder [x] Write test for `iniText` [x] Stub input with minimal `business` metadata [x] Assert `iniText` contains the `A100` line --- ## Phase 6: Implement Remaining Records ### Documents: C100, D110, D120 [x] Scaffold `src/records/C100.ts`, `src/records/D110.ts`, `src/records/D120.ts` [x] Define Zod schemas + TS types [x] Implement `encodeXXX` and `parseXXX` [x] Write round-trip tests ### Journal Entries: B100 [x] Scaffold `src/records/B100.ts` [x] Zod schema, TS type, encoder, parser, tests ### Accounts: B110 [x] Scaffold `src/records/B110.ts` [x] Zod schema, TS type, encoder, parser, tests ### Inventory: M100 [x] Scaffold `src/records/M100.ts` [x] Zod schema, TS type, encoder, parser, tests ### Closing Record: Z900 [x] Scaffold `src/records/Z900.ts` [x] Zod schema, TS type, encoder, parser, tests --- ## Phase 7: Full Integration & Data File ✅ COMPLETED [x] Wire all `encodeXXX` calls in `src/index.ts` [x] Assemble `dataText` for `BKMVDATA.TXT` [x] Create `File` objects for both outputs [x] Write integration test [x] Use comprehensive `ReportInput` fixture [x] Assert `dataText` matches spec example [x] Parse back and compare semantic objects --- ## Phase 8: DX, Enums, & Packaging ✅ COMPLETED [x] Define `src/types/enums.ts` with code tables [x] Document types, currency codes, country codes, etc. [x] Export enums and literal unions [x] Implement `src/utils/file-helpers.ts` [x] `createFile(text: string, name: string): File` [x] Document public API usage in `README.md` [x] Configure CI (Vitest + lint) with GitHub Actions --- ## Phase 9: Documentation & Release [x] Finalize `README.md` with examples [x] Bump version to `0.1.0` [x] Publish to npm [ ] Tag `v0.1.0` in Git --- ## ✅ Implementation Status ### Completed Infrastructure ✅ - [x] Project scaffolding with TypeScript, Zod, Vitest, and ESLint - [x] Strict TypeScript configuration - [x] Basic Zod schemas for input validation - [x] Core API structure with placeholder implementations - [x] Fixed-width encoding/decoding utilities - [x] Basic testing setup and passing smoke test - [x] File structure for all record types (placeholder exports) - [x] Build system working correctly ### Completed Validation Pipeline ✅ - [x] Comprehensive Zod schemas for all input types - [x] Validation logic with both `fail-fast` and `collect-all` modes - [x] Custom error handling with `ShaamFormatError` - [x] Integration of validation into main API - [x] Full test coverage for validation scenarios - [x] All linting and type-checking issues resolved ### Completed Record Modules Summary ✅ - [x] A100 - Business opening record (20 tests) - [x] B100 - Journal entry line record (22 tests) - [x] B110 - Account record (21 tests) - [x] C100 - Document header record (18 tests) - [x] D110 - Document line record (8 tests) - [x] D120 - Payment/receipt record (13 tests) - [x] M100 - Item/Product record (25 tests) - [x] Z900 - Closing record (21 tests) **Total: 148 record-specific tests, all passing** ### Ready for Next Phase **Phase 8 Progress!** All core functionality and developer experience improvements are now complete. The project has: - ✅ Complete record module implementations for all 8 SHAAM record types - ✅ 352 comprehensive tests covering all record functionality - ✅ Full validation, encoding, parsing, and round-trip testing - ✅ Proper handling of Hebrew text, Unicode, and special formatting requirements - ✅ All builds and tests passing - ✅ Complete integration with INI.TXT and BKMVDATA.TXT file generation - ✅ CRLF join logic implementation and adoption across the package - ✅ A000Sum summary record functionality - ✅ Comprehensive integration tests validating end-to-end functionality -**Complete enum system with all SHAAM code tables** -**Comprehensive file helper utilities** -**TypeScript type safety with strict typing and autocompletion** -**Developer-friendly API with proper error handling** **Next: Complete Phase 8 & Phase 9 - Documentation & Release** The project now has production-ready functionality with excellent developer experience. Remaining tasks focus on documentation, CI setup, and release preparation.