@opencodehub/cli 0.1.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/LICENSE +202 -0
- package/README.md +85 -0
- package/dist/agent-context.d.ts +54 -0
- package/dist/agent-context.d.ts.map +1 -0
- package/dist/agent-context.js +122 -0
- package/dist/agent-context.js.map +1 -0
- package/dist/cobol-proleap-setup.d.ts +77 -0
- package/dist/cobol-proleap-setup.d.ts.map +1 -0
- package/dist/cobol-proleap-setup.js +289 -0
- package/dist/cobol-proleap-setup.js.map +1 -0
- package/dist/commands/analyze.d.ts +234 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +1096 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/augment.d.ts +48 -0
- package/dist/commands/augment.d.ts.map +1 -0
- package/dist/commands/augment.js +249 -0
- package/dist/commands/augment.js.map +1 -0
- package/dist/commands/baseline.d.ts +68 -0
- package/dist/commands/baseline.d.ts.map +1 -0
- package/dist/commands/baseline.js +110 -0
- package/dist/commands/baseline.js.map +1 -0
- package/dist/commands/bench.d.ts +54 -0
- package/dist/commands/bench.d.ts.map +1 -0
- package/dist/commands/bench.js +283 -0
- package/dist/commands/bench.js.map +1 -0
- package/dist/commands/ci-init.d.ts +37 -0
- package/dist/commands/ci-init.d.ts.map +1 -0
- package/dist/commands/ci-init.js +115 -0
- package/dist/commands/ci-init.js.map +1 -0
- package/dist/commands/clean.d.ts +13 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +38 -0
- package/dist/commands/clean.js.map +1 -0
- package/dist/commands/code-pack.d.ts +105 -0
- package/dist/commands/code-pack.d.ts.map +1 -0
- package/dist/commands/code-pack.js +187 -0
- package/dist/commands/code-pack.js.map +1 -0
- package/dist/commands/context.d.ts +30 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +237 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/detect-changes.d.ts +26 -0
- package/dist/commands/detect-changes.d.ts.map +1 -0
- package/dist/commands/detect-changes.js +73 -0
- package/dist/commands/detect-changes.js.map +1 -0
- package/dist/commands/doctor.d.ts +52 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +472 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/find-enclosing-symbol.d.ts +67 -0
- package/dist/commands/find-enclosing-symbol.d.ts.map +1 -0
- package/dist/commands/find-enclosing-symbol.js +106 -0
- package/dist/commands/find-enclosing-symbol.js.map +1 -0
- package/dist/commands/group.d.ts +123 -0
- package/dist/commands/group.d.ts.map +1 -0
- package/dist/commands/group.js +448 -0
- package/dist/commands/group.js.map +1 -0
- package/dist/commands/impact.d.ts +23 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +91 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/index-repo.d.ts +39 -0
- package/dist/commands/index-repo.d.ts.map +1 -0
- package/dist/commands/index-repo.js +148 -0
- package/dist/commands/index-repo.js.map +1 -0
- package/dist/commands/ingest-sarif.d.ts +64 -0
- package/dist/commands/ingest-sarif.d.ts.map +1 -0
- package/dist/commands/ingest-sarif.js +381 -0
- package/dist/commands/ingest-sarif.js.map +1 -0
- package/dist/commands/init.d.ts +75 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +315 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +17 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +79 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/mcp.d.ts +8 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +28 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/open-store.d.ts +25 -0
- package/dist/commands/open-store.d.ts.map +1 -0
- package/dist/commands/open-store.js +47 -0
- package/dist/commands/open-store.js.map +1 -0
- package/dist/commands/pack.d.ts +35 -0
- package/dist/commands/pack.d.ts.map +1 -0
- package/dist/commands/pack.js +83 -0
- package/dist/commands/pack.js.map +1 -0
- package/dist/commands/query.d.ts +85 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +309 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/scan.d.ts +81 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +407 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/setup.d.ts +178 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +370 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/sql.d.ts +19 -0
- package/dist/commands/sql.d.ts.map +1 -0
- package/dist/commands/sql.js +51 -0
- package/dist/commands/sql.js.map +1 -0
- package/dist/commands/status.d.ts +13 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +66 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/verdict-render.d.ts +33 -0
- package/dist/commands/verdict-render.d.ts.map +1 -0
- package/dist/commands/verdict-render.js +123 -0
- package/dist/commands/verdict-render.js.map +1 -0
- package/dist/commands/verdict.d.ts +61 -0
- package/dist/commands/verdict.d.ts.map +1 -0
- package/dist/commands/verdict.js +146 -0
- package/dist/commands/verdict.js.map +1 -0
- package/dist/commands/wiki.d.ts +26 -0
- package/dist/commands/wiki.d.ts.map +1 -0
- package/dist/commands/wiki.js +74 -0
- package/dist/commands/wiki.js.map +1 -0
- package/dist/editors/claude-code.d.ts +23 -0
- package/dist/editors/claude-code.d.ts.map +1 -0
- package/dist/editors/claude-code.js +58 -0
- package/dist/editors/claude-code.js.map +1 -0
- package/dist/editors/codex.d.ts +22 -0
- package/dist/editors/codex.d.ts.map +1 -0
- package/dist/editors/codex.js +59 -0
- package/dist/editors/codex.js.map +1 -0
- package/dist/editors/cursor.d.ts +13 -0
- package/dist/editors/cursor.d.ts.map +1 -0
- package/dist/editors/cursor.js +21 -0
- package/dist/editors/cursor.js.map +1 -0
- package/dist/editors/index.d.ts +12 -0
- package/dist/editors/index.d.ts.map +1 -0
- package/dist/editors/index.js +11 -0
- package/dist/editors/index.js.map +1 -0
- package/dist/editors/opencode.d.ts +23 -0
- package/dist/editors/opencode.d.ts.map +1 -0
- package/dist/editors/opencode.js +61 -0
- package/dist/editors/opencode.js.map +1 -0
- package/dist/editors/types.d.ts +33 -0
- package/dist/editors/types.d.ts.map +1 -0
- package/dist/editors/types.js +19 -0
- package/dist/editors/types.js.map +1 -0
- package/dist/editors/windows-wrap.d.ts +19 -0
- package/dist/editors/windows-wrap.d.ts.map +1 -0
- package/dist/editors/windows-wrap.js +28 -0
- package/dist/editors/windows-wrap.js.map +1 -0
- package/dist/editors/windsurf.d.ts +12 -0
- package/dist/editors/windsurf.d.ts.map +1 -0
- package/dist/editors/windsurf.js +21 -0
- package/dist/editors/windsurf.js.map +1 -0
- package/dist/embedder-downloader.d.ts +87 -0
- package/dist/embedder-downloader.d.ts.map +1 -0
- package/dist/embedder-downloader.js +261 -0
- package/dist/embedder-downloader.js.map +1 -0
- package/dist/fs-atomic.d.ts +22 -0
- package/dist/fs-atomic.d.ts.map +1 -0
- package/dist/fs-atomic.js +28 -0
- package/dist/fs-atomic.js.map +1 -0
- package/dist/groups.d.ts +64 -0
- package/dist/groups.d.ts.map +1 -0
- package/dist/groups.js +172 -0
- package/dist/groups.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +703 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/is-indexed.d.ts +20 -0
- package/dist/lib/is-indexed.d.ts.map +1 -0
- package/dist/lib/is-indexed.js +35 -0
- package/dist/lib/is-indexed.js.map +1 -0
- package/dist/registry.d.ts +64 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +145 -0
- package/dist/registry.js.map +1 -0
- package/dist/scip-downloader.d.ts +138 -0
- package/dist/scip-downloader.d.ts.map +1 -0
- package/dist/scip-downloader.js +372 -0
- package/dist/scip-downloader.js.map +1 -0
- package/dist/scip-pins.d.ts +99 -0
- package/dist/scip-pins.d.ts.map +1 -0
- package/dist/scip-pins.js +195 -0
- package/dist/scip-pins.js.map +1 -0
- package/dist/skills-gen.d.ts +47 -0
- package/dist/skills-gen.d.ts.map +1 -0
- package/dist/skills-gen.js +292 -0
- package/dist/skills-gen.js.map +1 -0
- package/package.json +81 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# @opencodehub/cli
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
# global install
|
|
5
|
+
npm install -g @opencodehub/cli
|
|
6
|
+
|
|
7
|
+
# or run without installing
|
|
8
|
+
npx @opencodehub/cli --help
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Then bootstrap any repo:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd /path/to/your/repo
|
|
15
|
+
codehub init # writes .mcp.json, Claude Code plugin, .gitignore entry
|
|
16
|
+
codehub analyze # index the repo
|
|
17
|
+
codehub mcp # start the stdio MCP server (your agent calls this)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The `codehub` command-line front end. Every subcommand lazy-loads its
|
|
21
|
+
implementation so `codehub --help` stays fast — no DuckDB binding, no
|
|
22
|
+
pipeline, no MCP SDK is initialised until the matching action runs
|
|
23
|
+
(`packages/cli/src/index.ts:1-13`).
|
|
24
|
+
|
|
25
|
+
## Surface
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
codehub <command> [options]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- The CLI binary is the only OpenCodeHub-distributed UX. There is no
|
|
32
|
+
daemon, no hosted service, and no second transport — agents talk to
|
|
33
|
+
OpenCodeHub through the stdio MCP server launched by `codehub mcp`.
|
|
34
|
+
- Errors print as `codehub: <message>` and set exit code 1
|
|
35
|
+
(`packages/cli/src/index.ts:860-864`).
|
|
36
|
+
|
|
37
|
+
## Commands
|
|
38
|
+
|
|
39
|
+
Registered in `packages/cli/src/index.ts:14-737`. The table groups the 25
|
|
40
|
+
top-level subcommands by phase of the workflow.
|
|
41
|
+
|
|
42
|
+
| Command | Purpose |
|
|
43
|
+
| ------------------ | -------------------------------------------------------------------------- |
|
|
44
|
+
| `init` | Bootstrap a repo: `.claude/`, `.mcp.json`, `.gitignore`, policy seed |
|
|
45
|
+
| `setup` | Write MCP config for editors, fetch embedder weights, install SCIP tools |
|
|
46
|
+
| `analyze` | Run the 31-phase ingestion pipeline against a repo |
|
|
47
|
+
| `index` | Register an existing `.codehub/` folder without re-analysing |
|
|
48
|
+
| `status` | Show registry metadata + index freshness for a repo |
|
|
49
|
+
| `list` | Enumerate every repo registered on this machine |
|
|
50
|
+
| `clean` | Delete one or all registered indexes |
|
|
51
|
+
| `mcp` | Launch the stdio MCP server |
|
|
52
|
+
| `query` | Hybrid BM25 + vector search against a repo's graph |
|
|
53
|
+
| `context` | 360-degree view of a symbol — callers, callees, flows |
|
|
54
|
+
| `impact` | Blast-radius traversal up/down/both with risk tier |
|
|
55
|
+
| `detect-changes` | Map an uncommitted or committed diff onto affected symbols + processes |
|
|
56
|
+
| `verdict` | 5-tier PR decision (`auto_merge`/`single_review`/.../`block`) |
|
|
57
|
+
| `scan` | Run Priority-1 scanners and ingest findings into the graph |
|
|
58
|
+
| `ingest-sarif` | Ingest an external SARIF 2.1.0 log into the graph |
|
|
59
|
+
| `pack` | Single-file LLM snapshot via repomix (AST-compressed) |
|
|
60
|
+
| `code-pack` | Deterministic 9-item BOM under `.codehub/packs/<packHash>/` |
|
|
61
|
+
| `wiki` | Emit a Markdown wiki tree (deterministic, optionally LLM-narrated) |
|
|
62
|
+
| `bench` | Run the acceptance gate suite and render a pass/fail dashboard |
|
|
63
|
+
| `doctor` | Probe the local environment and print actionable hints |
|
|
64
|
+
| `ci-init` | Emit GitHub Actions / GitLab CI workflow scaffolds |
|
|
65
|
+
| `augment` | Fast-path BM25 enrichment for editor PreToolUse hooks |
|
|
66
|
+
| `sql` | Read-only SQL against the graph store with a 5 s timeout |
|
|
67
|
+
| `group <sub>` | Cross-repo groups: `create`, `list`, `delete`, `status`, `query`, `sync` |
|
|
68
|
+
|
|
69
|
+
## Design
|
|
70
|
+
|
|
71
|
+
- **Lazy loading** — each `.action()` does `await import(...)` so cold
|
|
72
|
+
startup is bounded by Commander, not DuckDB or the parse pool
|
|
73
|
+
(`packages/cli/src/index.ts:78-81`).
|
|
74
|
+
- **No stateful daemon** — `analyze` runs to completion and exits;
|
|
75
|
+
`mcp` is the only long-running process.
|
|
76
|
+
- **Registry on disk** — `~/.codehub/registry.json` enumerates indexed
|
|
77
|
+
repos; per-repo state lives under `<repo>/.codehub/`
|
|
78
|
+
(`packages/cli/src/registry.ts`).
|
|
79
|
+
- **Env-toggle defaults** — `OCH_NATIVE_PARSER`, `CODEHUB_STORE`,
|
|
80
|
+
`CODEHUB_BEDROCK_DISABLED` flip behaviour without touching flags.
|
|
81
|
+
- **`mcp` is launched, never embedded** — agents that need the MCP
|
|
82
|
+
surface spawn `codehub mcp` over stdio (`packages/cli/src/commands/mcp.ts`).
|
|
83
|
+
|
|
84
|
+
See ADR 0013 for the storage-backend toggle and the root README's
|
|
85
|
+
"MCP tool surface" section for the agent-facing tool inventory.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md / CLAUDE.md stanza writer.
|
|
3
|
+
*
|
|
4
|
+
* When a repo is analyzed we update (or create) two agent-discovery files at
|
|
5
|
+
* the repo root — `AGENTS.md` and `CLAUDE.md`. Each gets the same stanza
|
|
6
|
+
* describing the 7 OpenCodeHub MCP tools, so any agent opening the repo knows
|
|
7
|
+
* what is available and how to call it.
|
|
8
|
+
*
|
|
9
|
+
* Clean-room authored. The stanza text below was written for OpenCodeHub; no
|
|
10
|
+
* prompt wording was copied from any prior tool. Callers can replace the
|
|
11
|
+
* stanza via the `{ stanza }` option for tests or custom branding.
|
|
12
|
+
*
|
|
13
|
+
* Behavior:
|
|
14
|
+
* - If the file does not exist → create it with just the stanza.
|
|
15
|
+
* - If it exists and already contains an `## OpenCodeHub MCP Tools` section
|
|
16
|
+
* → replace that section in place, preserving everything before/after.
|
|
17
|
+
* - If it exists and has no such section → append the stanza (preceded by a
|
|
18
|
+
* blank line when needed).
|
|
19
|
+
*/
|
|
20
|
+
export declare const STANZA_HEADING = "## OpenCodeHub MCP Tools";
|
|
21
|
+
/** Default stanza body. Clean-room authored — keep short, keep accurate. */
|
|
22
|
+
export declare const DEFAULT_STANZA = "## OpenCodeHub MCP Tools\n\nThis repository has been indexed by OpenCodeHub. When you are working in this\ncodebase, prefer the following MCP tools over raw file search \u2014 they return\ngraph-aware results grouped by execution flow and include blast-radius risk\ntiers.\n\n- `list_repos` \u2014 enumerate repos currently indexed on this machine.\n- `query` \u2014 hybrid BM25 + vector search over symbols, grouped by process.\n- `context` \u2014 inbound/outbound refs and participating flows for one symbol.\n- `impact` \u2014 dependents of a target up to a configurable depth, with a risk tier.\n- `detect_changes` \u2014 map an uncommitted or committed diff to affected symbols.\n- `rename` \u2014 graph-assisted multi-file rename; dry-run is the default.\n- `sql` \u2014 read-only SQL against the local graph store with a 5 s timeout.\n\nRun `codehub analyze` after pulling new commits so the index stays aligned\nwith the working tree. `codehub status` reports staleness.\n";
|
|
23
|
+
/** Files we manage. Order matters only for deterministic test output. */
|
|
24
|
+
export declare const AGENT_CONTEXT_FILES: readonly string[];
|
|
25
|
+
export interface WriteStanzaOptions {
|
|
26
|
+
/** Override the stanza body (must start with `## OpenCodeHub MCP Tools`). */
|
|
27
|
+
readonly stanza?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface WriteStanzaResult {
|
|
30
|
+
readonly file: string;
|
|
31
|
+
readonly action: "created" | "replaced" | "appended";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Write the stanza into both `AGENTS.md` and `CLAUDE.md` at `repoPath`.
|
|
35
|
+
* Returns per-file results so the caller can log what it did.
|
|
36
|
+
*/
|
|
37
|
+
export declare function writeAgentContextFiles(repoPath: string, opts?: WriteStanzaOptions): Promise<readonly WriteStanzaResult[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Write (or merge) the stanza into a single file. Exposed for tests and for
|
|
40
|
+
* callers that want to target a bespoke file path.
|
|
41
|
+
*/
|
|
42
|
+
export declare function writeStanza(file: string, opts?: WriteStanzaOptions): Promise<WriteStanzaResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Replace a prior `## OpenCodeHub MCP Tools` section with `stanza`, or append
|
|
45
|
+
* `stanza` at the end. The section extends from the heading up to (but not
|
|
46
|
+
* including) the next `## ` heading, or end-of-file.
|
|
47
|
+
*
|
|
48
|
+
* Exposed for tests; pure string transform, no IO.
|
|
49
|
+
*/
|
|
50
|
+
export declare function replaceOrAppendStanza(existing: string, stanza: string): {
|
|
51
|
+
replaced: boolean;
|
|
52
|
+
output: string;
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=agent-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context.d.ts","sourceRoot":"","sources":["../src/agent-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,eAAO,MAAM,cAAc,6BAA6B,CAAC;AAEzD,4EAA4E;AAC5E,eAAO,MAAM,cAAc,y9BAiB1B,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAA+B,CAAC;AAEjF,MAAM,WAAW,kBAAkB;IACjC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;CACtD;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAOvC;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAmB5B;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAqCvC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AGENTS.md / CLAUDE.md stanza writer.
|
|
3
|
+
*
|
|
4
|
+
* When a repo is analyzed we update (or create) two agent-discovery files at
|
|
5
|
+
* the repo root — `AGENTS.md` and `CLAUDE.md`. Each gets the same stanza
|
|
6
|
+
* describing the 7 OpenCodeHub MCP tools, so any agent opening the repo knows
|
|
7
|
+
* what is available and how to call it.
|
|
8
|
+
*
|
|
9
|
+
* Clean-room authored. The stanza text below was written for OpenCodeHub; no
|
|
10
|
+
* prompt wording was copied from any prior tool. Callers can replace the
|
|
11
|
+
* stanza via the `{ stanza }` option for tests or custom branding.
|
|
12
|
+
*
|
|
13
|
+
* Behavior:
|
|
14
|
+
* - If the file does not exist → create it with just the stanza.
|
|
15
|
+
* - If it exists and already contains an `## OpenCodeHub MCP Tools` section
|
|
16
|
+
* → replace that section in place, preserving everything before/after.
|
|
17
|
+
* - If it exists and has no such section → append the stanza (preceded by a
|
|
18
|
+
* blank line when needed).
|
|
19
|
+
*/
|
|
20
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
21
|
+
import { dirname, resolve } from "node:path";
|
|
22
|
+
import { writeFileAtomic } from "./fs-atomic.js";
|
|
23
|
+
export const STANZA_HEADING = "## OpenCodeHub MCP Tools";
|
|
24
|
+
/** Default stanza body. Clean-room authored — keep short, keep accurate. */
|
|
25
|
+
export const DEFAULT_STANZA = `${STANZA_HEADING}
|
|
26
|
+
|
|
27
|
+
This repository has been indexed by OpenCodeHub. When you are working in this
|
|
28
|
+
codebase, prefer the following MCP tools over raw file search — they return
|
|
29
|
+
graph-aware results grouped by execution flow and include blast-radius risk
|
|
30
|
+
tiers.
|
|
31
|
+
|
|
32
|
+
- \`list_repos\` — enumerate repos currently indexed on this machine.
|
|
33
|
+
- \`query\` — hybrid BM25 + vector search over symbols, grouped by process.
|
|
34
|
+
- \`context\` — inbound/outbound refs and participating flows for one symbol.
|
|
35
|
+
- \`impact\` — dependents of a target up to a configurable depth, with a risk tier.
|
|
36
|
+
- \`detect_changes\` — map an uncommitted or committed diff to affected symbols.
|
|
37
|
+
- \`rename\` — graph-assisted multi-file rename; dry-run is the default.
|
|
38
|
+
- \`sql\` — read-only SQL against the local graph store with a 5 s timeout.
|
|
39
|
+
|
|
40
|
+
Run \`codehub analyze\` after pulling new commits so the index stays aligned
|
|
41
|
+
with the working tree. \`codehub status\` reports staleness.
|
|
42
|
+
`;
|
|
43
|
+
/** Files we manage. Order matters only for deterministic test output. */
|
|
44
|
+
export const AGENT_CONTEXT_FILES = ["AGENTS.md", "CLAUDE.md"];
|
|
45
|
+
/**
|
|
46
|
+
* Write the stanza into both `AGENTS.md` and `CLAUDE.md` at `repoPath`.
|
|
47
|
+
* Returns per-file results so the caller can log what it did.
|
|
48
|
+
*/
|
|
49
|
+
export async function writeAgentContextFiles(repoPath, opts = {}) {
|
|
50
|
+
const results = [];
|
|
51
|
+
for (const name of AGENT_CONTEXT_FILES) {
|
|
52
|
+
const result = await writeStanza(resolve(repoPath, name), opts);
|
|
53
|
+
results.push(result);
|
|
54
|
+
}
|
|
55
|
+
return results;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Write (or merge) the stanza into a single file. Exposed for tests and for
|
|
59
|
+
* callers that want to target a bespoke file path.
|
|
60
|
+
*/
|
|
61
|
+
export async function writeStanza(file, opts = {}) {
|
|
62
|
+
const stanza = (opts.stanza ?? DEFAULT_STANZA).trimEnd();
|
|
63
|
+
let existing;
|
|
64
|
+
try {
|
|
65
|
+
existing = await readFile(file, "utf8");
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
if (err.code !== "ENOENT")
|
|
69
|
+
throw err;
|
|
70
|
+
existing = undefined;
|
|
71
|
+
}
|
|
72
|
+
if (existing === undefined) {
|
|
73
|
+
await mkdir(dirname(file), { recursive: true });
|
|
74
|
+
await writeFileAtomic(file, `${stanza}\n`, { raw: true });
|
|
75
|
+
return { file, action: "created" };
|
|
76
|
+
}
|
|
77
|
+
const { replaced, output } = replaceOrAppendStanza(existing, stanza);
|
|
78
|
+
await writeFileAtomic(file, output, { raw: true });
|
|
79
|
+
return { file, action: replaced ? "replaced" : "appended" };
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Replace a prior `## OpenCodeHub MCP Tools` section with `stanza`, or append
|
|
83
|
+
* `stanza` at the end. The section extends from the heading up to (but not
|
|
84
|
+
* including) the next `## ` heading, or end-of-file.
|
|
85
|
+
*
|
|
86
|
+
* Exposed for tests; pure string transform, no IO.
|
|
87
|
+
*/
|
|
88
|
+
export function replaceOrAppendStanza(existing, stanza) {
|
|
89
|
+
const lines = existing.split("\n");
|
|
90
|
+
const headingIndex = lines.findIndex((line) => line.trim() === STANZA_HEADING);
|
|
91
|
+
if (headingIndex === -1) {
|
|
92
|
+
if (existing.length === 0) {
|
|
93
|
+
return { replaced: false, output: `${stanza}\n` };
|
|
94
|
+
}
|
|
95
|
+
const base = existing.endsWith("\n") ? existing : `${existing}\n`;
|
|
96
|
+
// Ensure a blank line between prior content and our stanza.
|
|
97
|
+
const separator = base.endsWith("\n\n") ? "" : "\n";
|
|
98
|
+
return { replaced: false, output: `${base}${separator}${stanza}\n` };
|
|
99
|
+
}
|
|
100
|
+
// Find the end of the OpenCodeHub section: the next line that starts with
|
|
101
|
+
// `## ` (a sibling heading) at the same level. Lines starting with `###` or
|
|
102
|
+
// deeper are still part of our section.
|
|
103
|
+
let endIndex = lines.length;
|
|
104
|
+
for (let i = headingIndex + 1; i < lines.length; i += 1) {
|
|
105
|
+
const line = lines[i];
|
|
106
|
+
if (line === undefined)
|
|
107
|
+
continue;
|
|
108
|
+
if (line.startsWith("## ") && !line.startsWith("### ")) {
|
|
109
|
+
endIndex = i;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const before = lines.slice(0, headingIndex).join("\n");
|
|
114
|
+
const after = lines.slice(endIndex).join("\n");
|
|
115
|
+
const beforeBlock = before.length === 0 ? "" : before.endsWith("\n") ? before : `${before}\n`;
|
|
116
|
+
const afterBlock = after.length === 0 ? "" : after.startsWith("\n") ? after : `\n${after}`;
|
|
117
|
+
const output = `${beforeBlock}${stanza}\n${afterBlock}`;
|
|
118
|
+
// Collapse a double-trailing newline if afterBlock was empty.
|
|
119
|
+
const normalized = output.endsWith("\n") ? output : `${output}\n`;
|
|
120
|
+
return { replaced: true, output: normalized };
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=agent-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-context.js","sourceRoot":"","sources":["../src/agent-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,OAAO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C;IAE3F,MAAM,MAAM,GAAG,GAAG,WAAW,GAAG,MAAM,KAAK,UAAU,EAAE,CAAC;IACxD,8DAA8D;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAClE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `codehub setup --cobol-proleap` — one-time bootstrap for the COBOL
|
|
3
|
+
* deep-parse bridge.
|
|
4
|
+
*
|
|
5
|
+
* The uwol/cobol-parser library is NOT published to Maven Central as of 2026-04
|
|
6
|
+
* (search.maven.org returns 0 hits), and the latest GitHub Release is v2.4.0
|
|
7
|
+
* from 2018 — but master is on v4.x. So we build from source:
|
|
8
|
+
*
|
|
9
|
+
* 1. Probe for `git`, `mvn`, and `javac` (JDK 17+) on PATH. Missing tool
|
|
10
|
+
* → refuse with a tool-specific install hint.
|
|
11
|
+
* 2. Resolve a temp workdir, `git clone --branch master https://github.com/uwol/cobol-parser`.
|
|
12
|
+
* 3. `mvn install -DskipTests` to build the JAR. Target artifact is
|
|
13
|
+
* `<tmp>/target/proleap-cobol-parser-<ver>.jar`.
|
|
14
|
+
* 4. `javac -cp <jar> cobol_to_scip.java` — compile the wrapper class
|
|
15
|
+
* (the `.java` source ships under `packages/cobol-proleap/java/`).
|
|
16
|
+
* 5. Atomic rename the JAR + compiled wrapper into
|
|
17
|
+
* `~/.codehub/vendor/proleap/{proleap-cobol-parser-<ver>.jar,
|
|
18
|
+
* cobol_to_scip.class}`.
|
|
19
|
+
*
|
|
20
|
+
* Every external-tool spawn goes through the `ProcessApi` seam so tests
|
|
21
|
+
* can stub the whole pipeline without shelling out for real.
|
|
22
|
+
*/
|
|
23
|
+
export declare const COBOL_PROLEAP_REPO_URL = "https://github.com/uwol/cobol-parser";
|
|
24
|
+
export declare const COBOL_PROLEAP_BRANCH = "master";
|
|
25
|
+
export declare const MIN_JAVAC_MAJOR = 17;
|
|
26
|
+
/** Process-spawn + fs seam. Tests replace with in-memory doubles. */
|
|
27
|
+
export interface ProcessApi {
|
|
28
|
+
run(cmd: string, args: readonly string[], cwd?: string): Promise<ProcessResult>;
|
|
29
|
+
mkdtemp(prefix: string): Promise<string>;
|
|
30
|
+
mkdir(path: string): Promise<void>;
|
|
31
|
+
copyFile(src: string, dest: string): Promise<void>;
|
|
32
|
+
rename(src: string, dest: string): Promise<void>;
|
|
33
|
+
rm(path: string, opts?: {
|
|
34
|
+
recursive?: boolean;
|
|
35
|
+
force?: boolean;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
readdir(path: string): Promise<readonly string[]>;
|
|
38
|
+
exists(path: string): Promise<boolean>;
|
|
39
|
+
}
|
|
40
|
+
export interface ProcessResult {
|
|
41
|
+
readonly code: number;
|
|
42
|
+
readonly stdout: string;
|
|
43
|
+
readonly stderr: string;
|
|
44
|
+
}
|
|
45
|
+
export declare const DEFAULT_PROCESS_API: ProcessApi;
|
|
46
|
+
export interface SetupCobolProleapOptions {
|
|
47
|
+
/** Override the install dir. Default: `~/.codehub/vendor/proleap`. */
|
|
48
|
+
readonly vendorDir?: string;
|
|
49
|
+
/** Override the user home dir. Default: os.homedir(). */
|
|
50
|
+
readonly home?: string;
|
|
51
|
+
/** Override the Java source path. Default: resolved relative to the installed cli. */
|
|
52
|
+
readonly javaSourcePath?: string;
|
|
53
|
+
/** Force re-install even if the vendor dir already has a JAR. */
|
|
54
|
+
readonly force?: boolean;
|
|
55
|
+
/** Process / fs seam for tests. */
|
|
56
|
+
readonly processApi?: ProcessApi;
|
|
57
|
+
/** Structured logger. Defaults to `console.warn`. */
|
|
58
|
+
readonly log?: (message: string) => void;
|
|
59
|
+
readonly warn?: (message: string) => void;
|
|
60
|
+
}
|
|
61
|
+
export interface SetupCobolProleapResult {
|
|
62
|
+
readonly jarPath: string;
|
|
63
|
+
readonly wrapperClassPath: string;
|
|
64
|
+
readonly vendorDir: string;
|
|
65
|
+
readonly installed: boolean;
|
|
66
|
+
readonly skipped: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Run the setup. Returns the final install paths (jar + wrapper classpath
|
|
70
|
+
* dir) so the analyze runner can resolve them without re-walking the
|
|
71
|
+
* vendor dir. Throws on precondition failure with tool-specific install
|
|
72
|
+
* hints so the user can self-serve.
|
|
73
|
+
*/
|
|
74
|
+
export declare function runSetupCobolProleap(opts?: SetupCobolProleapOptions): Promise<SetupCobolProleapResult>;
|
|
75
|
+
/** Default vendor dir. */
|
|
76
|
+
export declare function defaultVendorDir(home?: string): string;
|
|
77
|
+
//# sourceMappingURL=cobol-proleap-setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cobol-proleap-setup.d.ts","sourceRoot":"","sources":["../src/cobol-proleap-setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAgBH,eAAO,MAAM,sBAAsB,yCAAyC,CAAC;AAC7E,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAChF,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,CAAC,GAA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