Skip to content

release: v2.3.0 — full GST toolkit (HSN rates, GSTIN, SAC, CLI, export)#7

Merged
karthi-21 merged 7 commits into
mainfrom
dev
Jun 3, 2026
Merged

release: v2.3.0 — full GST toolkit (HSN rates, GSTIN, SAC, CLI, export)#7
karthi-21 merged 7 commits into
mainfrom
dev

Conversation

@karthi-21
Copy link
Copy Markdown
Owner

Release v2.3.0

This release turns hsn-code-package from an HSN lookup library into a full, zero-runtime-dependency GST toolkit for India. It bundles three feature tracks plus a pre-release quality pass.

Features since main

Issue #2 — GST rate data

  • Bundled chapter-level GST rates for all 12,604 HSN codes, derived from CBIC Notification No. 09/2025-CT(Rate) dated 17 Sep 2025 (effective 2025-09-22).
  • New lookups: getGstRateByCode, getHsnByExactCodeWithRate, getHsnByRateSlabs.
  • Weekly auto-update GitHub Actions workflow (update-gst-rates.yml) and npm run update:rates.

Issue #3 — GST calculation utilities

  • Pure, rate-agnostic helpers: calculateTax, calculateGSTBreakdown, reverseCalculateTax, getApplicableTaxType, calculateInvoiceTotals, groupItemsByTaxRate, applyRoundOffRules.

Issue #4 — GSTIN/PAN, SAC, export, CLI, advanced HSN

  • GSTIN/PAN validation with MOD-36 checksum and state decoding: validateGSTIN, formatGSTIN, getStateFromGSTIN, isValidPAN, getGSTINComponents.
  • SAC codes (496 entries): getAllSac, getSacByCode, searchSac, getCodeDetails.
  • Export utilities: exportToCSV, exportToJSON, generateGSTR1Summary.
  • Advanced HSN lookups: getChapterSummary, findCodesByDescription, bulkValidateHsnCodes.
  • hsn CLI: search, validate, chapter, stats, gstin, sac, export, help.

Pre-release polish (this pass)

  • Comprehensive README rewrite: table of contents, per-function docs and examples for all 33 exports, honest data-source notes, migration table.
  • index.d.ts audit: module docstring, complete/accurate interfaces, unknown/readonly where appropriate.
  • Added tests/types.test.ts TypeScript smoke test and npm run typecheck (tsc --strict --noEmit).
  • Added .npmignore to keep the published tarball lean (excludes scripts/tests/.github/coverage/xlsx).
  • package.json: refreshed keywords, files, update:rates script, jest testMatch scoped to tests/**/*.test.js.

Verification

  • npm test — 105/105 passing, 7 suites green.
  • npm run typecheck — zero errors.
  • 33 exports load; CLI stats / search / gstin / validate smoke-tested.
  • No runtime dependencies; Node >= 14 compatible (no ES2022+ syntax).

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi


Generated by Claude Code

claude and others added 7 commits June 2, 2026 02:07
Adds a new pure, zero-dependency `gst.js` module with helper functions
that most GST tools end up reimplementing:

- calculateTax — tax + total at a given rate
- calculateGSTBreakdown — CGST/SGST (intra) or IGST (inter) + cess
- reverseCalculateTax — extract base + tax from inclusive total
- getApplicableTaxType — IGST vs CGST_SGST from state codes
- calculateInvoiceTotals — line-item invoice totals with round-off
- groupItemsByTaxRate — GSTR-1 style grouping
- applyRoundOffRules — 2-decimal half-up rounding

All re-exported from index.js, fully typed in index.d.ts, documented
in the README, and covered by 20 new tests (gst.js 100% coverage).

The rate-lookup-from-HSN variant (calculateItemTax) is intentionally
deferred — it depends on rate data being added to the dataset (#2).

Refs #3

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi
…CLI, advanced lookups

- Add gstin.js: validateGSTIN, formatGSTIN, getStateFromGSTIN, isValidPAN, getGSTINComponents
- Add sac.js + data/sac_codes.json: 490+ real SAC codes with getAllSac, getSacByCode, searchSac, getCodeDetails
- Add export.js: exportToCSV, exportToJSON, generateGSTR1Summary
- Add advanced HSN: getChapterSummary, findCodesByDescription, bulkValidateHsnCodes
- Add bin/cli.js: CLI with search, validate, chapter, stats, gstin, sac, export commands
- Add 4 new test files (gstin, sac, export, advanced)
- Update TypeScript definitions and README docs
- Bump version to 2.2.0

Closes #4

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi
…te job

- Add data/gst_rates.json with IGST/CGST/SGST/cess per HSN code (12,604 entries)
  based on CBIC Notification No. 09/2025-CT(Rate), effective 22 Sep 2025
- Add scripts/update-gst-rates.js: download-or-fallback pipeline for rate data
- Add .github/workflows/update-gst-rates.yml: weekly Monday cron + manual dispatch
  with auto-issue on failure
- Add getGstRateByCode(), getHsnByExactCodeWithRate(), getHsnByRateSlabs()
- Add TypeScript types: GstRate, HsnCodeWithRate
- Add tests/gst-rates.test.js
- Bump version to 2.3.0

Closes #2

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi
feat: add rate-agnostic GST calculation utilities (#3)
Merged gst.js calculation utilities (from dev/PR #5) with all PR #6
features: GSTIN validation, SAC codes, export utils, CLI, advanced
HSN lookups, and GST rate data. All 105 tests passing.

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi
feat: GSTIN validation, SAC codes, export utilities, CLI, and advanced HSN lookups (Issue #4)
- Rewrite README with full API docs, ToC, examples for all 30+ functions
- Audit index.d.ts: complete types, interfaces, correct signatures
- Add tests/types.test.ts TypeScript smoke test
- Add typecheck npm script (tsc --strict --noEmit)
- Add .npmignore to keep published package lean
- Add update:rates npm script alias
- Fix any compatibility issues found
- All 105 tests passing, typecheck clean

https://claude.ai/code/session_01V2bGsWhrzxeEpoV8BJyZMi
@karthi-21 karthi-21 marked this pull request as ready for review June 3, 2026 02:21
@karthi-21 karthi-21 merged commit f843f57 into main Jun 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants