@mudraforge/statutory 0.0.0-stage → 2.4.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 (58) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/CONTRIBUTING.md +191 -0
  3. package/LICENSE +21 -0
  4. package/README.md +452 -2
  5. package/SECURITY.md +72 -0
  6. package/SKILL.md +61 -0
  7. package/bin/cli.js +298 -0
  8. package/conformance/README.md +54 -0
  9. package/conformance/fixtures/invalid_malformed_temporal_dates.json +10 -0
  10. package/conformance/fixtures/invalid_missing_effective_period.json +6 -0
  11. package/conformance/fixtures/invalid_missing_section_code.json +9 -0
  12. package/conformance/fixtures/valid_circular_frontmatter.md +16 -0
  13. package/conformance/fixtures/valid_full_section.json +35 -0
  14. package/conformance/fixtures/valid_minimal_section.json +11 -0
  15. package/conformance/test_conformance.js +129 -0
  16. package/docs/ADESHA_ASSURANCE_OVERVIEW.md +166 -0
  17. package/docs/ARCHITECTURE.md +750 -0
  18. package/docs/ARCHITECTURE_DECISIONS.md +133 -0
  19. package/docs/CATALOG.md +337 -0
  20. package/docs/CORPUS_QUALITY.md +68 -0
  21. package/docs/DATA_LICENSING.md +73 -0
  22. package/docs/DOMAIN_BREADTH_AND_DEPTH_COMPARISON.md +207 -0
  23. package/docs/ENTERPRISE_GOVERNANCE.md +100 -0
  24. package/docs/VERIFICATION.md +106 -0
  25. package/examples/README.md +56 -0
  26. package/examples/invoice_deduction_trace.json +149 -0
  27. package/examples/simulate_end_to_end_trace.js +106 -0
  28. package/okf/corporate_ma_restructuring/slump_sale_50b/circulars/cbdt_notification_68_2021_rule_11uae_fmv.md +68 -0
  29. package/okf/corporate_ma_restructuring/slump_sale_50b/circulars/cbic_notification_12_2017_going_concern_exemption.md +47 -0
  30. package/okf/corporate_ma_restructuring/slump_sale_50b/forms/form_3cea_chartered_accountant_report.json +41 -0
  31. package/okf/corporate_ma_restructuring/slump_sale_50b/forms/section_281_tax_clearance_checklist.md +38 -0
  32. package/okf/corporate_ma_restructuring/slump_sale_50b/section.json +69 -0
  33. package/okf/direct_tax/tcs_goods_206c_1h/circulars/finance_act_2025_sunset_memo.md +34 -0
  34. package/okf/direct_tax/tcs_goods_206c_1h/section.json +50 -0
  35. package/okf/direct_tax/tds_goods_194q/circulars/cbdt_circular_13_2021_guidelines.md +43 -0
  36. package/okf/direct_tax/tds_goods_194q/circulars/cbdt_circular_23_2017_gst_unbundling.md +28 -0
  37. package/okf/direct_tax/tds_goods_194q/forms/form_26q_quarterly_return.json +31 -0
  38. package/okf/direct_tax/tds_goods_194q/forms/vendor_pan_declaration.md +31 -0
  39. package/okf/direct_tax/tds_goods_194q/section.json +54 -0
  40. package/okf/direct_tax/tds_goods_393/section.json +62 -0
  41. package/okf/direct_tax/tds_services_194j/circulars/cbdt_circular_03_2020_fts_rate_cut.md +44 -0
  42. package/okf/direct_tax/tds_services_194j/forms/form_16a_tds_certificate.json +25 -0
  43. package/okf/direct_tax/tds_services_194j/section.json +57 -0
  44. package/okf/indirect_tax_gst/blocked_itc_17_5/circulars/cbic_circular_172_2022_employer_obligations.md +38 -0
  45. package/okf/indirect_tax_gst/blocked_itc_17_5/forms/gstr_2b_ineligible_reconciliation.json +22 -0
  46. package/okf/indirect_tax_gst/blocked_itc_17_5/section.json +64 -0
  47. package/okf/international_tax/foreign_tax_credit_irc_901_904/forms/form_67_statement_of_foreign_tax.json +25 -0
  48. package/okf/international_tax/foreign_tax_credit_irc_901_904/forms/irs_schedule_k3_reporting.json +23 -0
  49. package/okf/international_tax/foreign_tax_credit_irc_901_904/section.json +52 -0
  50. package/okf/manifest.json +66 -0
  51. package/okf/msme_commercial/delayed_payments_15_16/circulars/msme_om_2021_trader_exclusion.md +38 -0
  52. package/okf/msme_commercial/delayed_payments_15_16/forms/schedule_iii_msme_disclosure.md +34 -0
  53. package/okf/msme_commercial/delayed_payments_15_16/forms/udyam_registration_verification.json +44 -0
  54. package/okf/msme_commercial/delayed_payments_15_16/section.json +74 -0
  55. package/okf.publication.json +101 -0
  56. package/package.json +57 -4
  57. package/src/index.js +1122 -0
  58. package/types/index.d.ts +186 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@mudraforge/statutory` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [2.4.0] - 2026-10-22
11
+
12
+ ### Added
13
+ - **Multi-Domain OKF v0.2 Architecture**: Reorganized statutory knowledge corpus into four foundational regulatory domains:
14
+ - `direct_tax` (Income-tax Act, 1961 / Income-tax Act, 2025; Section 194Q, Section 194J, Section 206C(1H) sunset)
15
+ - `indirect_tax_gst` (Central Goods and Services Tax Act, 2017; Section 17(5) Blocked ITC)
16
+ - `msme_commercial` (MSMED Act, 2006 Sections 15 & 16; delayed payments and Section 43B(h) linkage)
17
+ - `international_tax` (US Internal Revenue Code §§ 901 & 904; Foreign Tax Credit baskets)
18
+ - **Executive Circulars & Compliance Forms**: Bundled 6 official executive circulars with YAML frontmatter and 8 compliance return schemas (Form 26Q, Form 16A, GSTR-2B Table 4(B), UDYAM verification, Form 67, IRS Schedule K-3).
19
+ - **Automated OKF Validator & Linter**: Created `scripts/validate_okf.js` (`npm run validate`) enforcing schema validation, ISO date checks, `OPEN_ENDED` validity flags, and official URL checks.
20
+ - **Cryptographic Manifest & Integrity Tooling**: Created `scripts/generate_manifest.js` calculating per-file SHA-256 hashes and a root Merkle digest (`sha256-d389...`). Added `npm run manifest:check` for tamper-evidence verification.
21
+ - **Automated Catalog Generator**: Created `scripts/build_catalog.js` (`npm run catalog`) compiling an authoritative markdown index ([`docs/CATALOG.md`](./docs/CATALOG.md)) from the repository corpus.
22
+ - **GitHub Actions CI Matrix**: Added `.github/workflows/ci.yml` running validation, manifest integrity check, and test suite on Ubuntu and Windows across Node.js 18.x, 20.x, and 22.x with minimal permissions (`contents: read`).
23
+ - **Governance & Contributor Protocols**:
24
+ - [`CONTRIBUTING.md`](./CONTRIBUTING.md): Authoring standards for `section.json`, executive circulars, and CA review process.
25
+ - [`SECURITY.md`](./SECURITY.md): Responsible disclosure policy for code flaws and statutory inaccuracy triage (2-business-day acknowledgment).
26
+ - [`docs/DATA_LICENSING.md`](./docs/DATA_LICENSING.md): Explicit tripartite licensing separating MIT software, public domain statutes, and CC BY 4.0 structured annotations.
27
+ - `.github/ISSUE_TEMPLATE/`: Templates for new statute requests and legislative amendment notifications.
28
+ - `.github/PULL_REQUEST_TEMPLATE.md`: 7-point verification and provenance checklist.
29
+ - **11-Suite Multi-Domain Regression Test**: Expanded `test.js` to cover all 6 provisions, boundary conditions, dead-network offline fallbacks, explicit retrieval modes, and failure cases.
30
+
31
+ ### Changed
32
+ - **Explicit Retrieval Modes**: Refactored `lookupStatute()` in `src/index.js` to support explicit `mode: 'auto' | 'local' | 'edge'`. Responses return explicit `retrievalMode` (`LOCAL_SNAPSHOT` vs `EDGE_LIVE`), `isOfflineSnapshot: true`, and advisory notes to prevent stale offline data from being mistaken for real-time gazetted law.
33
+ - **Terminal Typography**: Replaced all emojis with standards-compliant bracketed status tags (`[OK]`, `[INFO]`, `[WARN]`, `[ERROR]`, `[PASS]`) across CLI, test suites, and scripts.
34
+ - **Temporal Alignment**: Updated temporal references to the *Income-tax Act, 2025* to reflect its effective date of 1 April 2026.
35
+ - **Policy Alignment**: Replaced defensive maintenance wording with a grounded, transparent **Free OKF Sync and Maintenance Policy** clarifying best-effort service boundaries.
36
+
37
+ ### Removed
38
+ - Deprecated legacy unversioned flat schemas in favor of domain-scoped hierarchy.
@@ -0,0 +1,191 @@
1
+ # Contributing to MudraForge Statutory Substrate
2
+
3
+ > **Open Knowledge Format (OKF v0.2) Contribution & Practitioner Review Guide**
4
+
5
+ Thank you for your interest in contributing to `@mudraforge/statutory`.
6
+
7
+ Our mission is to build the definitive, open, machine-readable statutory knowledge substrate for Indian and cross-border commercial finance. We welcome contributions from **software engineers, AI agent builders, Chartered Accountants (CAs), CPAs, and legal compliance practitioners**.
8
+
9
+ ---
10
+
11
+ ## 1. Operating Principles & Epistemic Standards
12
+
13
+ Unlike standard software libraries where code is judged primarily on execution speed, statutory knowledge repositories are judged on **statutory ground truth, temporal precision, and provenance**:
14
+
15
+ 1. **Official Primary Sources Only**: All statutory thresholds, rates, and rules must be sourced directly from official Union Gazettes, Central Board of Direct Taxes (CBDT), Central Board of Indirect Taxes and Customs (CBIC), Reserve Bank of India (RBI), Ministry of Corporate Affairs (MCA), or official regulatory portals. **Citations to third-party SEO blogs or unverified discussion forums are strictly rejected.**
16
+ 2. **Temporal Enforcement**: Statutory provisions must declare strict temporal boundaries (`effectivePeriod.validFrom` and `effectivePeriod.validTo` in `section.json`; `valid_from` and `valid_to` in circular YAML frontmatter, or `OPEN_ENDED` for active legislation). Sunset dates must be rigorously documented.
17
+ 3. **Fail-Closed Validation**: Every submission must pass the automated schema linter (`npm run validate`) and test suite (`npm test`) with zero defects before merge.
18
+
19
+ ---
20
+
21
+ ## 2. Structure of an OKF Statutory Provision
22
+
23
+ All provisions reside under [`okf/<domain>/<provision_folder>/`](./okf/) and adhere to a 3-part layout:
24
+
25
+ ```
26
+ okf/<domain>/<provision_code>/
27
+ ├── section.json # Core machine-readable statutory schema
28
+ ├── circulars/
29
+ │ └── <authority>_circular_<no>_<topic>.md # Full-text official circulars (Markdown with YAML frontmatter)
30
+ └── forms/
31
+ └── <form_name>.<json|md> # Return schemas, verification checklists, or declarations
32
+ ```
33
+
34
+ ### A. Authoring `section.json`
35
+ Every `section.json` must provide these required fields:
36
+
37
+ ```json
38
+ {
39
+ "sectionId": "ITA1961_SEC194Q",
40
+ "sectionCode": "194Q",
41
+ "aliases": ["194Q", "194q", "goods tds", "purchase of goods"],
42
+ "governingStatute": "Income-tax Act, 1961 (Act No. 43 of 1961)",
43
+ "statutorySection": "Section 194Q",
44
+ "successorStatute": "Income-tax Act, 2025",
45
+ "successorSection": "Section 393(1), Table 8, Item (ii)",
46
+ "title": "Deduction of tax at source on payment of a certain sum for purchase of goods",
47
+ "effectivePeriod": {
48
+ "validFrom": "2021-07-01",
49
+ "validTo": "2026-03-31",
50
+ "annualReset": "Every April 1 (Cumulative Purchases Reset Annually)",
51
+ "sunsetNotes": "Transitions to Section 393(1) Table 8(ii) of the Income-tax Act, 2025 effective 1 April 2026."
52
+ },
53
+ "plainTextSummary": "Plain English summary explaining who must deduct, when, and on what base.",
54
+ "keyStatutoryThresholds": {
55
+ "buyerPriorYearTurnoverCr": 10,
56
+ "annualPurchaseThresholdInr": 5000000,
57
+ "standardDeductionRatePercent": 0.1,
58
+ "inoperativePanPenaltyRatePercent": 5.0,
59
+ "taxableBaseScope": "Tax is deductible strictly on the excess over ₹50 Lakhs, NOT on the aggregate gross turnover."
60
+ },
61
+ "officialCitations": [
62
+ {
63
+ "authority": "Central Board of Direct Taxes (CBDT)",
64
+ "instrument": "Circular No. 13 of 2021 (Dated 30 June 2021)",
65
+ "subject": "Guidelines under section 194Q - Threshold calculation & advance netting",
66
+ "officialUrl": "https://incometaxindia.gov.in/communications/circular/circular_13_2021.pdf"
67
+ }
68
+ ],
69
+ "requiredDocumentChecklist": [
70
+ "Valid Permanent Account Number (PAN) of Seller",
71
+ "Cumulative Purchase Ledger for current FY",
72
+ "Tax invoice with GST separately stated"
73
+ ],
74
+ "tier": "PUBLIC_COMMONS_FREE",
75
+ "version": "2.4.0"
76
+ }
77
+ ```
78
+
79
+ ### B. Authoring Circulars (`circulars/*.md`)
80
+ Executive circulars must include Google OKF YAML frontmatter at the top:
81
+
82
+ ```markdown
83
+ ---
84
+ id: cbdt_circular_13_2021
85
+ title: CBDT Circular No. 13 of 2021 - Guidelines under Section 194Q
86
+ authority: Central Board of Direct Taxes (CBDT), Department of Revenue, Ministry of Finance
87
+ date: 2021-06-30
88
+ statutory_section: Section 194Q
89
+ valid_from: 2021-07-01
90
+ valid_to: 2026-03-31
91
+ temporal_status: ACTIVE
92
+ subject: Threshold calculation, advance payment netting, and non-resident exemption
93
+ official_url: https://incometaxindia.gov.in/communications/circular/circular_13_2021.pdf
94
+ ---
95
+
96
+ > [STATUTORY VALIDITY WINDOW & TEMPORAL STATUS]
97
+ > **Valid From**: 1 July 2021
98
+ > **Valid To**: 31 March 2026
99
+ > **Temporal Status**: ACTIVE
100
+
101
+ # Circular Title & Legal Guidance Body...
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 3. Step-by-Step Contribution Workflow
107
+
108
+ ### Step 1: Fork and Clone the Repository
109
+ ```bash
110
+ git clone https://github.com/<your-username>/mudraforge-statutory.git
111
+ cd mudraforge-statutory
112
+ npm install
113
+ ```
114
+
115
+ ### Step 2: Create a Dedicated Feature Branch
116
+ ```bash
117
+ git checkout -b feat/add-section-194c-contractors
118
+ ```
119
+
120
+ ### Step 3: Implement Your Statute
121
+ Place your files in the appropriate domain folder under `./okf/`:
122
+ - `direct_tax/`
123
+ - `indirect_tax_gst/`
124
+ - `msme_commercial/`
125
+ - `international_tax/`
126
+
127
+ ### Step 4: Run the Schema Linter & Validator
128
+ We provide an automated validator that verifies all fields, dates, URLs, and frontmatter:
129
+ ```bash
130
+ npm run validate
131
+ ```
132
+ Ensure output finishes with: `ALL OKF SCHEMAS, CIRCULARS & FORMS PASSED VALIDATION WITH ZERO DEFECTS!`
133
+
134
+ ### Step 5: Run the Integration Test Suite
135
+ ```bash
136
+ npm test
137
+ ```
138
+
139
+ ### Step 6: Developer Certificate of Origin (DCO 1.1) Sign-Off
140
+ All commits must be signed off to certify that the contributor has the right to submit the code and legal annotations under the project's open licenses (MIT for code, CC BY 4.0 for OKF data).
141
+
142
+ Use the `-s` or `--signoff` flag when committing:
143
+ ```bash
144
+ git commit -s -m "feat(direct_tax): add section 194C contractor withholding"
145
+ ```
146
+
147
+ By adding a `Signed-off-by:` line, you certify the following:
148
+ ```
149
+ Developer Certificate of Origin
150
+ Version 1.1
151
+
152
+ Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
153
+
154
+ By making a contribution to this project, I certify that:
155
+ (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
156
+ (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license; or
157
+ (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
158
+ (d) I understand and agree that this project and the contribution are public and that a record of the contribution is maintained indefinitely.
159
+ ```
160
+
161
+ ### Step 7: Submit a Pull Request
162
+ Push your branch to GitHub and open a Pull Request against `main`. Provide:
163
+ 1. The governing statute and section code.
164
+ 2. Official government links (Gazette, CBDT, CBIC, or RBI notifications).
165
+ 3. Any temporal effective dates or Finance Act amendments.
166
+
167
+ ---
168
+
169
+ ## 4. Starter Tasks & Good First Issues
170
+
171
+ Looking to contribute? Here are recommended starter areas:
172
+ - **Circular Updates**: Adding newly notified CBDT or CBIC circulars to existing direct tax provisions with standard YAML frontmatter.
173
+ - **Form Schemas**: Adding JSON return schemas or GSTR-2B reconciliation templates under `okf/indirect_tax_gst/forms/`.
174
+ - **Successor Mappings**: Adding dual-act cross-references for sections transitioning from the *Income-tax Act, 1961* to the *Income-tax Act, 2025* (taking effect 1 April 2026).
175
+ - **Cross-Border Treaties**: Adding DTAA withholding schedules (e.g. India-US Article 12, India-Singapore Article 12) under `okf/international_tax/`.
176
+
177
+ ---
178
+
179
+ ## 5. Chartered Accountant (CA) & Legal Practitioner Empanelment
180
+
181
+ If you are a Chartered Accountant (FCA/ACA), CPA, Company Secretary (CS), or tax attorney and wish to author, verify, or co-sign statutory rule packs:
182
+
183
+ - Co-authored statutory packs carry official attribution in `section.json` (`reviewedBy`, `practitionerRegistrationNumber`).
184
+ - Empanelled reviewers receive verification attribution in release notes and access to the MudraForge Enterprise Research network.
185
+ - To join the review panel or collaborate, reach out directly to the maintainer at **`hello@mudraforge.in`** or **`mondeepe@gmail.com`**.
186
+
187
+ ---
188
+
189
+ ## 6. Security & Responsible Disclosure
190
+
191
+ If you discover a vulnerability or statutory discrepancy that could lead to financial calculation errors or compliance failures, please report it privately to **`security@mudraforge.in`** or **`hello@mudraforge.in`**.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MudraForge Technologies
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.