@mudraforge/statutory 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.
- package/CHANGELOG.md +46 -0
- package/README.md +60 -27
- package/bin/cli.js +368 -18
- package/docs/CORPUS_QUALITY.md +19 -6
- package/docs/PROVENANCE.md +33 -0
- package/okf/manifest.json +1 -1
- package/okf.publication.json +1 -1
- package/package.json +3 -2
- package/src/index.js +1162 -2
- package/types/index.d.ts +104 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,52 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [2.8.0] - 2026-10-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Dual-Act Statutory Crosswalk Engine (`crosswalk`)**:
|
|
14
|
+
- Implemented `crosswalkStatute()` in core library and exposed via `npx @mudraforge/statutory crosswalk <section> [--credit <date>] [--payment <date>] [--date <date>] [--json]`.
|
|
15
|
+
- Bridges provisions across the *Income-tax Act, 1961* and *Income-tax Act, 2025* (taking effect 1 April 2026).
|
|
16
|
+
- Enforces statutory withholding crystallization rule: tax withholding liability attaches on the earlier of credit in books or payment disbursement.
|
|
17
|
+
- Cites statutory savings authority under Section 536 of Income-tax Act, 2025 read with Section 6 of General Clauses Act, 1897.
|
|
18
|
+
- Correctly evaluates Section 206C(1H) seller TCS statutory sunset and formal omission w.e.f. 1 April 2025.
|
|
19
|
+
- Supports bidirectional crosswalks (both forward from 1961 Act and backward from 2025 Act).
|
|
20
|
+
- **Semantic Regulatory Diff & Amendment Tracker (`diff`)**:
|
|
21
|
+
- Implemented `getStatutoryDiff()` and exposed via `npx @mudraforge/statutory diff [--section <sec>] [--since <date>] [--domain <domain>] [--json]`.
|
|
22
|
+
- Compiles structured semantic regulatory changelogs across all 5 statutory domains.
|
|
23
|
+
- Tracks key legislative amendments: Section 194H rate cut (5% to 2% w.e.f. 2024-10-01), Section 206C(1H) sunset omission, Rule 48(4) e-invoicing ₹5 Cr threshold, Section 16(2)(aa) GSTR-2B mandatory matching, Section 43B(h) MSME disallowance, and Section 393 2025 Act transition.
|
|
24
|
+
- **StatutoryClient Parity**:
|
|
25
|
+
- Added `client.crosswalk()`, `client.diff()`, `client.verify()`, and `client.doctor()` methods to `StatutoryClient`.
|
|
26
|
+
- **Cryptographic Substrate Verifier (`verify`)**:
|
|
27
|
+
- Implemented `verifyLocalSubstrate()` in core library and exposed via `npx @mudraforge/statutory verify [path]`.
|
|
28
|
+
- Cryptographically verifies local file-level SHA-256 hashes against `manifest.json` (Integrity) and validates root Merkle digests against immutable release roots / Ed25519 signatures (Authenticity).
|
|
29
|
+
- Enforces mandatory statutory baseline policy checks (`194Q`, `194J`, `17(5)`, `MSMED-15-16`, `393`).
|
|
30
|
+
- **Diagnostic Environment Doctor (`doctor`)**:
|
|
31
|
+
- Implemented `runStatutoryDoctor()` in core library and exposed via `npx @mudraforge/statutory doctor [--offline]`.
|
|
32
|
+
- Diagnoses Node.js runtime (`>= v18`), OS platform, environment variables, local OKF filesystem health, and optional Cloudflare Anycast edge round-trip latency.
|
|
33
|
+
- Fully supports air-gapped / isolated VPC environments via `--offline` / `-o` without failing local health guarantees.
|
|
34
|
+
- **Global Machine-Readable Output (`--json`)**:
|
|
35
|
+
- Added `--json` / `-j` flag support across all CLI commands (`verify`, `doctor`, `lookup`, `list`, `browse`, `decode-id`, `check-update`).
|
|
36
|
+
- Emits clean, parseable JSON directly to `stdout` (suppressing banners, spinners, and update prompts) for CI/CD automation and `jq` scripting.
|
|
37
|
+
- **MudraForge Custom Exit Code Contract**:
|
|
38
|
+
- Established standardized exit codes: `0` (Success), `1` (Usage/Syntax error), `2` (Integrity/Security failure), `3` (Statutory policy violation).
|
|
39
|
+
- **Documentation & Release Alignment**:
|
|
40
|
+
- Unified package, manifest, and publication versions at `v2.8.0`.
|
|
41
|
+
- Extracted formal audit ledger into `docs/PROVENANCE.md` and streamlined main `README.md` for fast developer onboarding.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## [2.7.0] - 2026-10-25
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
- **Edge Sync Merkle Pinning & Trust Anchor Alignment**:
|
|
49
|
+
- Added v2.7.0 edge Merkle root digest (`sha256-6953ce79b63bb2a5809dc928178b4631f08448aa2dcde107dde10f84890bf5cb`) to authoritative `PINNED_RELEASE_ROOTS`.
|
|
50
|
+
- Unified local package, Edge Worker, and public manifest at OKF v2.7.0.
|
|
51
|
+
- Added CLI flag parsing for `--dest <path>`, `-d <path>`, and `--dest=<path>` in `bin/cli.js sync` command.
|
|
52
|
+
- Verified atomic remote sync downloads and unpacks all 24 statutory provisions cleanly into custom destination directories.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
10
56
|
## [2.6.0] - 2026-10-25
|
|
11
57
|
|
|
12
58
|
### Added
|
package/README.md
CHANGED
|
@@ -36,37 +36,21 @@ console.log(statute.statute.title); // MSMED statutory payment timelines & compo
|
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
## Overview
|
|
40
40
|
|
|
41
|
-
`@mudraforge/statutory`
|
|
41
|
+
`@mudraforge/statutory` is an offline, zero-dependency statutory knowledge substrate for Indian and cross-border financial compliance (Direct Tax, GST, MSME, Corporate M&A, International Tax). It grounds withholding rates, cumulative thresholds, and filing timelines in primary legislation and circulars rather than ungrounded LLM text generation.
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
* **Deterministic Knowledge**: Provides structured, offline rule definitions (`okf/**/section.json`) and ISO Mod-36 identifier decoding without outbound network calls.
|
|
44
|
+
* **Dual-Act Temporal Boundary**: Explicitly models both the *Income-tax Act, 1961* and the *Income-tax Act, 2025* (effective 1 April 2026), evaluating date-bound transitional savings rules automatically.
|
|
45
|
+
* **Separation of Concerns**: This open-source commons provides declarative statutory truth; downstream transactional execution, payment authorization, and bank disbursements belong to the governed execution layer (Adesha).
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
## Published Release & Provenance Ledger
|
|
48
|
-
|
|
49
|
-
| Item | Value |
|
|
50
|
-
|---|---|
|
|
51
|
-
| **Package Release** | **`v2.4.2`** (Public Beta) |
|
|
52
|
-
| **Knowledge Specification** | **Google Open Knowledge Format (OKF v0.2) + MudraForge Statutory Schema Extension** |
|
|
53
|
-
| **Regulatory Snapshot** | **CBDT / CBIC / MCA / MSME Baseline: October 2026** |
|
|
54
|
-
| **Corpus Quality Card** | 100% Citation Resolution (15/15 URLs) in [`docs/CORPUS_QUALITY.md`](./docs/CORPUS_QUALITY.md) |
|
|
55
|
-
| **Architecture Decision Records** | 6 Normative ADRs documented in [`docs/ARCHITECTURE_DECISIONS.md`](./docs/ARCHITECTURE_DECISIONS.md) |
|
|
56
|
-
| **Vendor Conformance Suite** | 12/12 Passing Fixture Tests in [`conformance/`](./conformance/) |
|
|
57
|
-
| **End-to-End Execution Trace** | Audited 7-stage AP lifecycle in [`examples/`](./examples/) (`npm run example:trace`) |
|
|
58
|
-
| **Enterprise Assurance Preview** | Formal TLA+ & mutation defenses in [`docs/ADESHA_ASSURANCE_OVERVIEW.md`](./docs/ADESHA_ASSURANCE_OVERVIEW.md) |
|
|
59
|
-
| **Integrity Root** | SHA-256 root manifest in [`okf/manifest.json`](./okf/manifest.json) (reproducible byte-level non-tampering proof) |
|
|
60
|
-
| **Temporal Framework** | Dual-Act Bridge: *Income-tax Act, 1961* & *Income-tax Act, 2025* |
|
|
61
|
-
| **Verification Gate** | 100% Pass across cumulative thresholds, legislative sunsets, and excess math |
|
|
62
|
-
|
|
63
|
-
> **Note on Cryptographic Scope**: The SHA-256 root hash in `okf/manifest.json` provides mathematical verification of **byte-level integrity** (ensuring local files have not been corrupted, altered, or partially written). A hash certifies that bytes match the published release; it does not by itself constitute legal or statutory authority. Epistemic authority is established strictly via the primary gazette citations, CBDT/CBIC executive circulars, and independent ground-truth tests.
|
|
47
|
+
> For cryptographic root digests, normative specifications, and formal assurance artifacts, see [docs/PROVENANCE.md](./docs/PROVENANCE.md).
|
|
64
48
|
|
|
65
49
|
---
|
|
66
50
|
|
|
67
51
|
## Table of Contents
|
|
68
52
|
|
|
69
|
-
- [
|
|
53
|
+
- [Overview](#overview)
|
|
70
54
|
- [Quick Start (Free Tier)](#quick-start-free-tier)
|
|
71
55
|
- [1. Installation via npm](#1-installation-via-npm)
|
|
72
56
|
- [2. Initialize AI Agent Skill](#2-initialize-ai-agent-skill)
|
|
@@ -81,7 +65,7 @@ console.log(statute.statute.title); // MSMED statutory payment timelines & compo
|
|
|
81
65
|
- [Structured OKF Directory Hierarchy](#structured-okf-domain-hierarchy-zero-token-discovery)
|
|
82
66
|
- [Canonical Edge Synchronization](#canonical-edge-synchronization-full-statutory-universe)
|
|
83
67
|
- [Enterprise Tier (Paid Cloud Execution)](#enterprise-tier-paid-cloud-execution--analysis-mode)
|
|
84
|
-
- [Edge API Endpoints &
|
|
68
|
+
- [Edge API Endpoints & Rate Limits](#enterprise-edge-api-endpoints--rate-limits)
|
|
85
69
|
- [Error Semantics & Response Codes](#error-semantics--response-codes)
|
|
86
70
|
- [System Origin & Validation Baseline](#system-origin--validation-baseline)
|
|
87
71
|
- [The Payment Instruction Boundary & End-to-End AP Architecture](#the-payment-instruction-boundary--end-to-end-ap-architecture)
|
|
@@ -427,6 +411,55 @@ const isActive2024 = await isStatuteActive('206C(1H)', '2024-05-01'); // true
|
|
|
427
411
|
const isActive2025 = await isStatuteActive('206C(1H)', '2025-06-01'); // false (omitted by Finance Act, 2025)
|
|
428
412
|
```
|
|
429
413
|
|
|
414
|
+
### 4. CLI Verification, Auditing & Pipeline Integration
|
|
415
|
+
|
|
416
|
+
The CLI provides cryptographic provenance checking, offline integrity verification, and machine-readable JSON output for CI/CD audit pipelines:
|
|
417
|
+
|
|
418
|
+
```bash
|
|
419
|
+
# Run full environment, local substrate health, and edge latency diagnostics
|
|
420
|
+
npx @mudraforge/statutory doctor
|
|
421
|
+
|
|
422
|
+
# Force air-gapped / offline diagnostics (zero outbound network requests)
|
|
423
|
+
npx @mudraforge/statutory doctor --offline
|
|
424
|
+
|
|
425
|
+
# Cryptographically verify local statutory substrate integrity & origin authenticity
|
|
426
|
+
npx @mudraforge/statutory verify
|
|
427
|
+
|
|
428
|
+
# Dual-act 1961 <-> 2025 statutory crosswalk (earlier of credit vs payment)
|
|
429
|
+
npx @mudraforge/statutory crosswalk 194Q --credit 2026-03-25 --payment 2026-04-10
|
|
430
|
+
|
|
431
|
+
# Reverse crosswalk from 2025 Act provision
|
|
432
|
+
npx @mudraforge/statutory crosswalk 393 --date 2025-08-01
|
|
433
|
+
|
|
434
|
+
# Query semantic regulatory changelog and amendment tracker
|
|
435
|
+
npx @mudraforge/statutory diff --section 194H
|
|
436
|
+
npx @mudraforge/statutory diff --since 2025-01-01
|
|
437
|
+
npx @mudraforge/statutory diff --domain indirect_tax_gst
|
|
438
|
+
|
|
439
|
+
# Output machine-parseable JSON for CI/CD or jq integration
|
|
440
|
+
npx @mudraforge/statutory crosswalk 194Q --credit 2026-03-25 --payment 2026-04-10 --json
|
|
441
|
+
npx @mudraforge/statutory diff --section 194H --json
|
|
442
|
+
npx @mudraforge/statutory verify --json
|
|
443
|
+
npx @mudraforge/statutory doctor --json --offline
|
|
444
|
+
|
|
445
|
+
# Query section in pure JSON format
|
|
446
|
+
npx @mudraforge/statutory lookup 194Q --json
|
|
447
|
+
|
|
448
|
+
# Decode and validate PAN / GSTIN offline with ISO Mod-36 checksum
|
|
449
|
+
npx @mudraforge/statutory decode-id 27AAPFU0939F1ZV --json
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
#### Custom MudraForge Exit Code Contract
|
|
453
|
+
Calling pipelines and CI/CD audit steps can inspect `$?` directly:
|
|
454
|
+
|
|
455
|
+
| Exit Code | Classification | Meaning |
|
|
456
|
+
|---|---|---|
|
|
457
|
+
| `0` | `SUCCESS` | Substrate verified authentic, intact, and all baseline provisions present. |
|
|
458
|
+
| `1` | `USAGE_OR_OPERATIONAL_ERROR` | Invalid CLI arguments, unknown command, or syntax error. |
|
|
459
|
+
| `2` | `INTEGRITY_OR_SECURITY_VIOLATION` | Cryptographic signature failure, unpinned root hash, file tampering, or revoked key. |
|
|
460
|
+
| `3` | `STATUTORY_POLICY_VIOLATION` | Statutory policy failure (e.g. missing mandatory baseline provision or sunset violation). |
|
|
461
|
+
|
|
462
|
+
|
|
430
463
|
---
|
|
431
464
|
|
|
432
465
|
## Enterprise Tier (Paid Cloud Execution & Analysis Mode)
|
|
@@ -453,9 +486,9 @@ console.log(result.taxableBase); // ₹70,00,000 (Calculates strictly on excess
|
|
|
453
486
|
console.log(result.taxAmount); // ₹7,000 (0.1% TDS on taxable base)
|
|
454
487
|
```
|
|
455
488
|
|
|
456
|
-
### Enterprise Edge API Endpoints &
|
|
489
|
+
### Enterprise Edge API Endpoints & Rate Limits
|
|
457
490
|
|
|
458
|
-
| Endpoint | Method | Auth Required |
|
|
491
|
+
| Endpoint | Method | Auth Required | Rate Limit (Per Client / IP) | Response |
|
|
459
492
|
|---|---|---|---|---|
|
|
460
493
|
| `/api/v1/statutory/sections` | `GET` | No | 180 req/min | JSON array of indexed OKF sections |
|
|
461
494
|
| `/api/v1/statutory/lookup` | `GET` | No | 180 req/min | Parametric section details & temporal validity |
|
|
@@ -487,7 +520,7 @@ All error responses from `@mudraforge/statutory` and the hosted edge API return
|
|
|
487
520
|
| `405 Method Not Allowed` | `METHOD_NOT_ALLOWED` | Non-GET request sent to read-only commons endpoints. |
|
|
488
521
|
| `413 Payload Too Large` | `PAYLOAD_TOO_LARGE` | JSON request body on `/calculate` exceeds 64KB security threshold. |
|
|
489
522
|
| `415 Unsupported Media` | `UNSUPPORTED_MEDIA_TYPE` | Non-JSON payload sent to calculation engine. Set `Content-Type: application/json`. |
|
|
490
|
-
| `429 Too Many Requests` | `RATE_LIMIT_EXCEEDED` |
|
|
523
|
+
| `429 Too Many Requests` | `RATE_LIMIT_EXCEEDED` | Rate limit threshold breached. Check `Retry-After` header before retrying. |
|
|
491
524
|
|
|
492
525
|
---
|
|
493
526
|
|