mainframe-modernization-toolkit 0.1.0__tar.gz

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 (80) hide show
  1. mainframe_modernization_toolkit-0.1.0/CHANGELOG.md +9 -0
  2. mainframe_modernization_toolkit-0.1.0/LICENSE +175 -0
  3. mainframe_modernization_toolkit-0.1.0/MANIFEST.in +14 -0
  4. mainframe_modernization_toolkit-0.1.0/PKG-INFO +311 -0
  5. mainframe_modernization_toolkit-0.1.0/README.md +285 -0
  6. mainframe_modernization_toolkit-0.1.0/THIRD_PARTY_NOTICES.md +13 -0
  7. mainframe_modernization_toolkit-0.1.0/pyproject.toml +61 -0
  8. mainframe_modernization_toolkit-0.1.0/scripts/_compat.py +14 -0
  9. mainframe_modernization_toolkit-0.1.0/scripts/business_rule_extractor.py +4 -0
  10. mainframe_modernization_toolkit-0.1.0/scripts/characterization_test_scaffolder.py +4 -0
  11. mainframe_modernization_toolkit-0.1.0/scripts/cobol_to_python_skeleton.py +4 -0
  12. mainframe_modernization_toolkit-0.1.0/scripts/copybook_to_contract.py +4 -0
  13. mainframe_modernization_toolkit-0.1.0/scripts/copybook_to_dataclass.py +4 -0
  14. mainframe_modernization_toolkit-0.1.0/scripts/dead_code_finder.py +4 -0
  15. mainframe_modernization_toolkit-0.1.0/scripts/dependency_graph.py +4 -0
  16. mainframe_modernization_toolkit-0.1.0/scripts/generate_copybook_fixtures.py +4 -0
  17. mainframe_modernization_toolkit-0.1.0/scripts/generate_file_readers.py +4 -0
  18. mainframe_modernization_toolkit-0.1.0/scripts/generate_program_capsule.py +4 -0
  19. mainframe_modernization_toolkit-0.1.0/scripts/impact_analysis.py +4 -0
  20. mainframe_modernization_toolkit-0.1.0/scripts/ir_to_pyspark.py +4 -0
  21. mainframe_modernization_toolkit-0.1.0/scripts/jcl_flow_extractor.py +4 -0
  22. mainframe_modernization_toolkit-0.1.0/scripts/migration_complexity_report.py +4 -0
  23. mainframe_modernization_toolkit-0.1.0/scripts/migration_preflight.py +4 -0
  24. mainframe_modernization_toolkit-0.1.0/scripts/sql_extractor.py +4 -0
  25. mainframe_modernization_toolkit-0.1.0/scripts/validate_relational_ir.py +4 -0
  26. mainframe_modernization_toolkit-0.1.0/setup.cfg +4 -0
  27. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/__init__.py +3 -0
  28. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/__main__.py +5 -0
  29. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/application.py +142 -0
  30. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/__init__.py +1 -0
  31. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/business_rule_extractor.py +263 -0
  32. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/characterization_test_scaffolder.py +180 -0
  33. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/cobol_to_python_skeleton.py +305 -0
  34. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/copybook_to_contract.py +93 -0
  35. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/copybook_to_dataclass.py +330 -0
  36. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/dead_code_finder.py +152 -0
  37. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/dependency_graph.py +174 -0
  38. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/generate_copybook_fixtures.py +116 -0
  39. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/generate_file_readers.py +406 -0
  40. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/generate_program_capsule.py +945 -0
  41. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/impact_analysis.py +178 -0
  42. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/ir_to_pyspark.py +495 -0
  43. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/jcl_flow_extractor.py +166 -0
  44. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/migration_complexity_report.py +154 -0
  45. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/migration_preflight.py +833 -0
  46. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/sql_extractor.py +230 -0
  47. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/cli/validate_relational_ir.py +48 -0
  48. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/__init__.py +14 -0
  49. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/cli_context.py +205 -0
  50. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/cobol_parser.py +1199 -0
  51. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/comp_decode.py +173 -0
  52. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/file_reader_codegen.py +748 -0
  53. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/file_resolution.py +286 -0
  54. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/jcl_parser.py +281 -0
  55. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/migration_config.py +944 -0
  56. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/naming.py +24 -0
  57. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/pic_types.py +268 -0
  58. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/record_contract.py +698 -0
  59. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/record_layout.py +249 -0
  60. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/relational_ir.py +1733 -0
  61. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/synthetic_records.py +413 -0
  62. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/warnings_model.py +167 -0
  63. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/common/workspace_index.py +511 -0
  64. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/registry.py +48 -0
  65. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/customizations/agents/mainframe-jcl-migrator.agent.md +47 -0
  66. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/customizations/skills/mainframe-jcl-migration/SKILL.md +212 -0
  67. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/customizations/skills/mainframe-jcl-migration/references/migration-checklist.md +193 -0
  68. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/customizations/skills/mainframe-jcl-migration/references/tool-catalog.md +54 -0
  69. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/mainframe-migration.json +31 -0
  70. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/mainframe-migration.schema.json +214 -0
  71. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/relational-ir.schema.json +504 -0
  72. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/vsix/mainframe-migration-toolkit-0.1.0.vsix +0 -0
  73. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources/vsix/manifest.json +8 -0
  74. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit/resources.py +100 -0
  75. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/PKG-INFO +311 -0
  76. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/SOURCES.txt +78 -0
  77. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/dependency_links.txt +1 -0
  78. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/entry_points.txt +19 -0
  79. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/requires.txt +4 -0
  80. mainframe_modernization_toolkit-0.1.0/src/mainframe_modernization_toolkit.egg-info/top_level.txt +1 -0
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## 0.1.0 - 2026-08-18
6
+
7
+ - Initial Python package with 17 deterministic migration CLIs and the `mainframe-toolkit` umbrella command.
8
+ - Bundled standalone VS Code extension and language server.
9
+ - Added workspace templates, schemas, VSIX export/verification, and release validation.
@@ -0,0 +1,175 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
@@ -0,0 +1,14 @@
1
+ include LICENSE
2
+ include CHANGELOG.md
3
+ include THIRD_PARTY_NOTICES.md
4
+ include README.md
5
+ recursive-include src/mainframe_modernization_toolkit/resources *
6
+ recursive-include scripts *.py
7
+ prune carddemo-conversion-examples
8
+ prune test-fixtures
9
+ prune tests
10
+ prune extension
11
+ prune server
12
+ prune docs
13
+ prune .github
14
+ global-exclude __pycache__ *.py[cod] .DS_Store .env .env.*
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: mainframe-modernization-toolkit
3
+ Version: 0.1.0
4
+ Summary: Deterministic COBOL/JCL analysis and mainframe modernization tooling
5
+ Author: Mainframe Migration Toolkit Contributors
6
+ License-Expression: Apache-2.0
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Topic :: Software Development :: Code Generators
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Provides-Extra: release
23
+ Requires-Dist: build>=1.2; extra == "release"
24
+ Requires-Dist: twine>=6; extra == "release"
25
+ Dynamic: license-file
26
+
27
+ # Mainframe Migration Toolkit - COBOL/JCL -> Python/SQL
28
+
29
+ A VS Code extension + language server + CLI toolkit that gives an AI
30
+ coding agent (GitHub Copilot in agent mode) **deterministic** navigation
31
+ of a legacy COBOL/JCL codebase's dependencies (CALL/COPY/EXEC), and a set
32
+ of scripts that automate the mechanical, low-risk parts of migrating that
33
+ codebase to Python and SQL.
34
+
35
+ This project intentionally does not try to auto-translate COBOL business
36
+ logic into Python - see [docs/RESEARCH.md](docs/RESEARCH.md) for why that
37
+ approach is unsafe for financial-grade code, and what large migration
38
+ programs do instead.
39
+
40
+ ## Why "deterministic"?
41
+
42
+ LLMs are good at reading and writing code, but bad at reliably tracing
43
+ "what calls what" across thousands of files inside a limited context
44
+ window - and a hallucinated dependency edge in a mainframe migration can
45
+ mean a silent production regression. Every tool here is a plain parser or
46
+ graph traversal: same input always produces the same output, with no
47
+ model involved. The AI agent's job is to *call* these tools and reason
48
+ over their output, not to re-derive the graph itself.
49
+
50
+ ## How edge cases are handled
51
+
52
+ No regex-based parser can understand 100% of real-world COBOL/JCL. When
53
+ a tool hits something it can't safely resolve - an unresolved CALL/COPY
54
+ target, a dynamic `CALL WS-VAR`, `EXEC CICS`/`IMS` blocks, `OCCURS ...
55
+ DEPENDING ON` variable-length tables, an unterminated `EXEC SQL` block,
56
+ a missing `PROGRAM-ID`, `GO TO` control flow, an edited/floating-point
57
+ PIC clause, a qualified/indicator SQL host variable, a JCL backward
58
+ reference to a nonexistent step, etc. - it **never guesses**. Instead it
59
+ emits a structured warning (`code`, `severity`, `message`,
60
+ `suggested_action`, `file`, `line`, `snippet`) defined once in
61
+ [scripts/common/warnings_model.py](scripts/common/warnings_model.py) /
62
+ [server/src/warningsModel.ts](server/src/warningsModel.ts), and every
63
+ tool surfaces it:
64
+
65
+ - Immediately supplyable missing prerequisites produce `BLOCK` and stop
66
+ the affected file generation before outputs are written. Semantic
67
+ decisions produce configurable code-local
68
+ `TODO(mainframe-migration): [CODE] explanation / required decision`
69
+ markers while unaffected units continue.
70
+ - The language server reports the same facts as editor diagnostics on
71
+ the offending line, and via the `mainframe/warnings` custom LSP
72
+ request (also folded into `mainframe/dependencyGraph` and
73
+ `mainframe/impactAnalysis` results).
74
+ - Known IBM/vendor utility programs (`IEFBR14`, `SORT`, `IDCAMS`, ...)
75
+ and system copybooks (`SQLCA`, `DFHCOMMAREA`, ...) are allowlisted so
76
+ real findings aren't buried in expected noise.
77
+
78
+ See [test-fixtures/edge-cases/](test-fixtures/edge-cases) for a fixture
79
+ per edge case, used to regression-test this behavior.
80
+
81
+ ## Repository layout
82
+
83
+ ```
84
+ extension/ VS Code extension: starts the language server and
85
+ registers 5 vscode.lm Language Model Tools for Copilot
86
+ agent mode (see extension/package.json
87
+ "languageModelTools").
88
+ server/ Deterministic COBOL/JCL language server
89
+ (vscode-languageserver, TypeScript). Provides go-to-
90
+ definition & hover for CALL/COPY/EXEC PGM=, diagnostics
91
+ for unresolved targets, and custom LSP requests
92
+ (mainframe/dependencyGraph, mainframe/impactAnalysis,
93
+ mainframe/callers, mainframe/resolveCopybook) that back
94
+ the extension's LM tools.
95
+ scripts/ 17 standalone Python CLI tools for migration planning and
96
+ scaffolding (see below). No dependencies beyond the
97
+ Python 3 standard library.
98
+ scripts/common/ Shared deterministic COBOL/JCL parsing + workspace
99
+ indexing code used by every script (and conceptually
100
+ mirrored in server/src/*.ts for the LSP).
101
+ test-fixtures/ An original, small "bank batch" COBOL/JCL system used to
102
+ exercise every tool end-to-end (see
103
+ test-fixtures/README.md for its call/copy graph).
104
+ docs/RESEARCH.md Research on migration strategies used by large players,
105
+ and which tool here implements each one.
106
+ ```
107
+
108
+ ## Configuration and preflight
109
+
110
+ Use a workspace-relative `mainframe-migration.json` to define ordered
111
+ primary/fallback COBOL, copybook, and JCL libraries. The schema is
112
+ [mainframe-migration.schema.json](mainframe-migration.schema.json), and
113
+ [test-fixtures/mainframe-migration.json](test-fixtures/mainframe-migration.json)
114
+ is a complete example that intentionally includes `edge-cases/` as a
115
+ fallback library.
116
+
117
+ `mainframe-migration.json` is authoritative for paths, ordered primary and
118
+ fallback libraries, source encoding, extensions, external registries, the
119
+ generated TODO prefix, and optional named `transportProfiles`. A transport
120
+ profile defines fixed-width text charset, line separator, trim policy, and the
121
+ representation of DISPLAY, COMP-3, BINARY/COMP-4, COMP-1, and COMP-2 fields.
122
+ Old configs remain valid, but contract/fixture generation requires an explicit
123
+ profile or `defaultTransportProfile`.
124
+
125
+ Physical copybook layout and transported text layout are separate contracts.
126
+ For example, a six-byte packed COMP-3 value can become 13 text characters
127
+ (precision digits, decimal point, and sign) without changing its source offset
128
+ or physical length. Expanded decimal width is precision plus an explicit
129
+ decimal point when scale is non-zero plus one sign character when signed;
130
+ expanded integer width is precision plus one sign character when signed.
131
+
132
+ Run mandatory phase-zero preflight before generating migration output:
133
+
134
+ ```bash
135
+ python3 scripts/migration_preflight.py test-fixtures --jcl BANKRUN --format text
136
+ python3 scripts/migration_preflight.py test-fixtures --format json
137
+ ```
138
+
139
+ Preflight exits `0` when there are no `BLOCK` findings and `2` when a
140
+ human-suppliable fact is missing or ambiguous. Dynamic calls, transaction
141
+ dialects, ODO, `REDEFINES`, edited PICs, and qualified SQL hosts become
142
+ explicit `TODO` findings and do not stop unrelated analysis. Generate a
143
+ starter file with `--write-template`. Present the initial report grouped by
144
+ `user_can_supply=true` and then `false`. Resolution order is fixed: current
145
+ LSP facts, configured primary libraries, configured fallback libraries,
146
+ then verified known externals; exhaustion blocks and requires user input.
147
+ Automated migration repair is capped at 50 total failed attempts.
148
+
149
+ Configuration-aware CLIs accept `--config`. For single-file CLIs, the selected file must
150
+ exist, match its configured kind, and belong to the selected inventory.
151
+ Omitting config retains legacy behavior.
152
+
153
+ ## Pinned CardDemo validation
154
+
155
+ Run the parsed phase-3 scenarios against the exact pinned AWS CardDemo revision
156
+ with one command (the runner clones/caches and verifies the detached commit):
157
+
158
+ ```bash
159
+ python3 tests/run_carddemo_scenarios.py
160
+ ```
161
+
162
+ The assertions, observed results, known fixes, and residual TODOs are recorded in
163
+ [`docs/research-carddemo-validation.md`](docs/research-carddemo-validation.md).
164
+
165
+ ## The 17 tools
166
+
167
+ | Tool | What it answers |
168
+ |------|------------------|
169
+ | [`scripts/migration_preflight.py`](scripts/migration_preflight.py) | Validates configured source inventory, precedence, static dependencies, and migration blockers before generation |
170
+ | [`scripts/dependency_graph.py`](scripts/dependency_graph.py) | "What calls/copies/executes what across the whole codebase?" (JSON/DOT/text) |
171
+ | [`scripts/impact_analysis.py`](scripts/impact_analysis.py) | "If I change X, what breaks?" (transitive upstream/downstream + risk) |
172
+ | [`scripts/dead_code_finder.py`](scripts/dead_code_finder.py) | "Which programs/copybooks are never referenced?" |
173
+ | [`scripts/sql_extractor.py`](scripts/sql_extractor.py) | Pulls embedded `EXEC SQL` out of COBOL into standalone, bind-parameterized `.sql` files |
174
+ | [`scripts/business_rule_extractor.py`](scripts/business_rule_extractor.py) | Mines IF/EVALUATE decision logic (+ preceding comments) into a reviewable rule list |
175
+ | [`scripts/copybook_to_dataclass.py`](scripts/copybook_to_dataclass.py) | Copybook PIC layout -> Python `@dataclass` and/or SQL `CREATE TABLE` |
176
+ | [`scripts/copybook_to_contract.py`](scripts/copybook_to_contract.py) | Copybook physical offsets + selected transport profile -> canonical language-neutral JSON record contract with digest, provenance, and structured TODO/BLOCK findings |
177
+ | [`scripts/generate_copybook_fixtures.py`](scripts/generate_copybook_fixtures.py) | Canonical contract or configured copybook -> deterministic seeded fixed-width input, decoded JSONL, invalid decode cases, and a non-authoritative manifest for ingestion testing only |
178
+ | [`scripts/generate_file_readers.py`](scripts/generate_file_readers.py) | FILE-CONTROL/FD/COPY -> standalone `domain/model` dataclasses and binary-safe fixed-width readers; missing copybooks block writes while semantic layout decisions remain explicit TODO stubs |
179
+ | [`scripts/cobol_to_python_skeleton.py`](scripts/cobol_to_python_skeleton.py) | COBOL paragraph structure -> Python class skeleton (structure preserved, logic left as TODOs) |
180
+ | [`scripts/jcl_flow_extractor.py`](scripts/jcl_flow_extractor.py) | JCL step/COND flow -> explicit orchestration description or Python skeleton |
181
+ | [`scripts/migration_complexity_report.py`](scripts/migration_complexity_report.py) | Ranks every program by migration effort/risk into a wave plan |
182
+ | [`scripts/characterization_test_scaffolder.py`](scripts/characterization_test_scaffolder.py) | Generates a golden-master pytest harness from a program's LINKAGE SECTION contract |
183
+ | [`scripts/generate_program_capsule.py`](scripts/generate_program_capsule.py) | Runs selected-JCL preflight, then creates per-program/utility PARTIAL capsules with deterministic DD/I/O evidence, contract copies, explicit semantic TODO IR, placeholder source/tests, and exact paths/commands; any preflight BLOCK writes nothing |
184
+ | [`scripts/validate_relational_ir.py`](scripts/validate_relational_ir.py) | Pure-stdlib typed validation for relational IR v1; exits `0` only for executable reviewed plans, `2` for BLOCK, and `3` for TODO/non-executable |
185
+ | [`scripts/ir_to_pyspark.py`](scripts/ir_to_pyspark.py) | Deterministically compiles validated executable IR to native PySpark source with `run(inputs, outputs, spark)` and refuses BLOCK/TODO plans before writing |
186
+
187
+ Every script is runnable standalone:
188
+
189
+ ```bash
190
+ python3 scripts/dependency_graph.py test-fixtures --format text
191
+ python3 scripts/copybook_to_contract.py test-fixtures/copybooks/TRANREC.cpy --config test-fixtures/mainframe-migration.json --out TRANREC.contract.json
192
+ python3 scripts/generate_copybook_fixtures.py TRANREC.contract.json --out-dir synthetic/TRANREC --count 6 --seed 41 --include-invalid
193
+ python3 scripts/generate_file_readers.py test-fixtures --out-dir domain
194
+ python3 scripts/generate_program_capsule.py test-fixtures --jcl BANKRUN --out-dir migration/BANKRUN/capsules --format text
195
+ python3 scripts/validate_relational_ir.py migration/BANKRUN/capsules/mainpgm/ir/plan.scaffold.json --format text
196
+ ```
197
+
198
+ [`relational-ir.schema.json`](relational-ir.schema.json) defines the portable
199
+ relational plan format. An AI may author the semantic operations only after the
200
+ program semantic brief and target design review are approved. The validator and
201
+ PySpark compiler are deterministic; they do not infer missing types or business
202
+ rules. A generated program capsule is intentionally `PARTIAL`, contains an
203
+ explicit semantic `TODO`, and is not a translated or equivalent implementation.
204
+
205
+ The generated readers open files in binary mode so `COMP-3`, `COMP-4`/
206
+ `BINARY`, and DISPLAY fields retain their physical COBOL representation.
207
+ Each malformed line yields a structured `RecordParseError` by default;
208
+ valid records continue streaming. Missing copybooks block before package
209
+ creation; semantic or unsafe layout decisions generate an empty dataclass
210
+ and reader stub with a standardized TODO instead of a guessed layout.
211
+
212
+ Synthetic fixture output never contains authoritative expected program output.
213
+ Its manifest says `synthetic=true`, `authoritative=false`, and
214
+ `purpose=ingestion_validation_only`. Raw binary fields are not written into a
215
+ `fixed_width_text` artifact; a `source_bytes` representation requires an
216
+ explicit binary-capable output mode and otherwise blocks generation.
217
+
218
+ ## Copilot migration workflow
219
+
220
+ Use the workspace-scoped [mainframe JCL migration skill](.github/skills/mainframe-jcl-migration/SKILL.md)
221
+ directly, or select the [Mainframe JCL Migrator agent](.github/agents/mainframe-jcl-migrator.agent.md)
222
+ for the phase-gated workflow. Example invocation:
223
+
224
+ ```text
225
+ /mainframe-jcl-migration /path/to/mainframe-workspace BANKRUN migration/BANKRUN
226
+ ```
227
+
228
+ The first argument is the workspace root, the second is a JCL job name or
229
+ path, and the optional third argument is the target directory.
230
+
231
+ ## The 5 Language Model Tools (for Copilot agent mode)
232
+
233
+ Registered in [`extension/package.json`](extension/package.json) under
234
+ `contributes.languageModelTools` and implemented in
235
+ [`extension/src/extension.ts`](extension/src/extension.ts):
236
+
237
+ 1. **`mainframe_getDependencyGraph`** - whole-graph or scoped CALL/COPY/EXEC graph.
238
+ 2. **`mainframe_getCallers`** - who calls a given program, including JCL `EXEC PGM=`.
239
+ 3. **`mainframe_resolveCopybook`** - resolve a COPY target to its file + users.
240
+ 4. **`mainframe_impactAnalysis`** - transitive blast-radius + risk rating before any change.
241
+ 5. **`mainframe_runMigrationScript`** - runs any of the 17 scripts above, workspace-sandboxed.
242
+
243
+ These are backed by the same language server used for interactive
244
+ go-to-definition/hover, so an agent and a human developer see identical
245
+ dependency information.
246
+
247
+ ## Building
248
+
249
+ ```bash
250
+ cd server && npm install && npm run compile
251
+ cd ../extension && npm install && npm run compile
252
+ ```
253
+
254
+ Then press F5 in VS Code (or use the "Run Extension" launch
255
+ configuration in [.vscode/launch.json](.vscode/launch.json)) to try it
256
+ against [test-fixtures/](test-fixtures/).
257
+
258
+ A standalone smoke test for the language server (no VS Code required) is
259
+ at [`server/scripts/smoke_test.js`](server/scripts/smoke_test.js):
260
+
261
+ ```bash
262
+ node server/scripts/smoke_test.js test-fixtures
263
+ node server/scripts/config_parity_test.js test-fixtures
264
+ ```
265
+
266
+ ## Installing the release artifacts
267
+
268
+ Build the wheel, source distribution, and bundled VSIX without publishing:
269
+
270
+ ```bash
271
+ python tools/build_release.py
272
+ python -m pip install dist/mainframe_modernization_toolkit-0.1.0-py3-none-any.whl
273
+ mainframe-toolkit --version
274
+ ```
275
+
276
+ The wheel contains the standalone VS Code extension, including the bundled
277
+ `dist/server.js`. Export and verify the exact embedded bytes before installing
278
+ the VSIX manually:
279
+
280
+ ```bash
281
+ mainframe-toolkit vsix export --output mainframe-migration-toolkit-0.1.0.vsix
282
+ mainframe-toolkit vsix verify mainframe-migration-toolkit-0.1.0.vsix
283
+ code --install-extension mainframe-migration-toolkit-0.1.0.vsix
284
+ ```
285
+
286
+ The extension invokes `mainframe-toolkit` by default. Set
287
+ `mainframeMigration.executablePath` to the installed executable's absolute
288
+ path when it is not on the VS Code extension host's `PATH`. Run
289
+ `mainframe-toolkit workspace init <workspace>` or the
290
+ `Mainframe Migration: Initialize Workspace` command to add the packaged
291
+ configuration, schemas, skill, and agent without overwriting existing files.
292
+
293
+ ## Source extensions referenced
294
+
295
+ This project was built with the two extensions supplied in the task as
296
+ primary references for real-world COBOL/JCL LSP feature scope:
297
+
298
+ - [eclipse-che4z/che-che4z-lsp-for-cobol](https://github.com/eclipse-che4z/che-che4z-lsp-for-cobol) -
299
+ full COBOL LSP (ANTLR-based, JVM). Studied for how it models copybook
300
+ resolution, dialects, and CALL/COPY dependency nodes; not vendored
301
+ directly (JVM/Maven toolchain would be heavy for an agent-facing tool -
302
+ see [docs/RESEARCH.md](docs/RESEARCH.md) for the tradeoff rationale).
303
+ - [BroadcomMFD/jcl-language-support](https://github.com/BroadcomMFD/jcl-language-support) -
304
+ JCL syntax highlighting/snippets/Zowe integration. Studied for JCL file
305
+ detection conventions (`.jcl`/`.cntl`, jobcard sniffing) and DD/DSN
306
+ navigation patterns.
307
+ - Their Marketplace listings (`broadcomMFD.jcl-language-support`,
308
+ `broadcomMFD.cobol-language-support`) were fetched for feature summaries.
309
+
310
+ All COBOL/JCL fixtures under `test-fixtures/` are original, written for
311
+ this project (not copied from any repository).