@wirecat/cli-base 0.0.0-stage → 0.22.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 +204 -0
- package/README.md +390 -2
- package/config/biome.base.json +56 -0
- package/config/cspell.json +57 -0
- package/config/lefthook.yml +34 -0
- package/config/rumdl.toml +9 -0
- package/config/tsconfig.base.json +21 -0
- package/config/tsconfig.scripts.json +13 -0
- package/config/tsconfig.test.json +11 -0
- package/config/vale/CliDocs/Filler.yml +9 -0
- package/config/vale/CliDocs/SentenceLength.yml +6 -0
- package/config/vale/Tg/Tone.yml +7 -0
- package/config/wirecat/LICENSE +204 -0
- package/config/wirecat/biome.base.json +56 -0
- package/config/wirecat/check.mjs +41 -0
- package/config/wirecat/cspell.json +80 -0
- package/config/wirecat/lefthook.yml +26 -0
- package/config/wirecat/manifest.json +23 -0
- package/config/wirecat/markdownlint.json +10 -0
- package/config/wirecat/rumdl.toml +9 -0
- package/dist/codegen/index.d.ts +12 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/index.js +11 -0
- package/dist/codegen/index.js.map +1 -0
- package/dist/codegen/manifest.d.ts +47 -0
- package/dist/codegen/manifest.d.ts.map +1 -0
- package/dist/codegen/manifest.js +73 -0
- package/dist/codegen/manifest.js.map +1 -0
- package/dist/codegen/model.d.ts +146 -0
- package/dist/codegen/model.d.ts.map +1 -0
- package/dist/codegen/model.js +7 -0
- package/dist/codegen/model.js.map +1 -0
- package/dist/codegen/names.d.ts +4 -0
- package/dist/codegen/names.d.ts.map +1 -0
- package/dist/codegen/names.js +46 -0
- package/dist/codegen/names.js.map +1 -0
- package/dist/codegen/pipeline.d.ts +24 -0
- package/dist/codegen/pipeline.d.ts.map +1 -0
- package/dist/codegen/pipeline.js +193 -0
- package/dist/codegen/pipeline.js.map +1 -0
- package/dist/codegen/runtime.d.ts +24 -0
- package/dist/codegen/runtime.d.ts.map +1 -0
- package/dist/codegen/runtime.js +38 -0
- package/dist/codegen/runtime.js.map +1 -0
- package/dist/codegen/tree.d.ts +29 -0
- package/dist/codegen/tree.d.ts.map +1 -0
- package/dist/codegen/tree.js +87 -0
- package/dist/codegen/tree.js.map +1 -0
- package/dist/codegen/typescript.d.ts +6 -0
- package/dist/codegen/typescript.d.ts.map +1 -0
- package/dist/codegen/typescript.js +78 -0
- package/dist/codegen/typescript.js.map +1 -0
- package/dist/codegen/valibot.d.ts +10 -0
- package/dist/codegen/valibot.d.ts.map +1 -0
- package/dist/codegen/valibot.js +132 -0
- package/dist/codegen/valibot.js.map +1 -0
- package/dist/commands/document.d.ts +72 -0
- package/dist/commands/document.d.ts.map +1 -0
- package/dist/commands/document.js +71 -0
- package/dist/commands/document.js.map +1 -0
- package/dist/commands/index.d.ts +83 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +85 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/page.d.ts +80 -0
- package/dist/commands/page.d.ts.map +1 -0
- package/dist/commands/page.js +100 -0
- package/dist/commands/page.js.map +1 -0
- package/dist/completion/index.d.ts +37 -0
- package/dist/completion/index.d.ts.map +1 -0
- package/dist/completion/index.js +87 -0
- package/dist/completion/index.js.map +1 -0
- package/dist/config.d.ts +20 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +61 -0
- package/dist/config.js.map +1 -0
- package/dist/credentials.d.ts +48 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +120 -0
- package/dist/credentials.js.map +1 -0
- package/dist/deadline.d.ts +14 -0
- package/dist/deadline.d.ts.map +1 -0
- package/dist/deadline.js +88 -0
- package/dist/deadline.js.map +1 -0
- package/dist/dev/bin.d.ts +3 -0
- package/dist/dev/bin.d.ts.map +1 -0
- package/dist/dev/bin.js +8 -0
- package/dist/dev/bin.js.map +1 -0
- package/dist/dev/lint.d.ts +31 -0
- package/dist/dev/lint.d.ts.map +1 -0
- package/dist/dev/lint.js +148 -0
- package/dist/dev/lint.js.map +1 -0
- package/dist/dev/main.d.ts +7 -0
- package/dist/dev/main.d.ts.map +1 -0
- package/dist/dev/main.js +279 -0
- package/dist/dev/main.js.map +1 -0
- package/dist/dev/next-version.d.ts +11 -0
- package/dist/dev/next-version.d.ts.map +1 -0
- package/dist/dev/next-version.js +33 -0
- package/dist/dev/next-version.js.map +1 -0
- package/dist/dev/slow-tests.d.ts +14 -0
- package/dist/dev/slow-tests.d.ts.map +1 -0
- package/dist/dev/slow-tests.js +17 -0
- package/dist/dev/slow-tests.js.map +1 -0
- package/dist/dev/test-matrix.d.ts +35 -0
- package/dist/dev/test-matrix.d.ts.map +1 -0
- package/dist/dev/test-matrix.js +93 -0
- package/dist/dev/test-matrix.js.map +1 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/executable.d.ts +3 -0
- package/dist/executable.d.ts.map +1 -0
- package/dist/executable.js +41 -0
- package/dist/executable.js.map +1 -0
- package/dist/exit-codes.d.ts +11 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +25 -0
- package/dist/exit-codes.js.map +1 -0
- package/dist/http/index.d.ts +20 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +46 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/keyring.d.ts +27 -0
- package/dist/keyring.d.ts.map +1 -0
- package/dist/keyring.js +45 -0
- package/dist/keyring.js.map +1 -0
- package/dist/legacy-paths.d.ts +33 -0
- package/dist/legacy-paths.d.ts.map +1 -0
- package/dist/legacy-paths.js +128 -0
- package/dist/legacy-paths.js.map +1 -0
- package/dist/logger.d.ts +12 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +7 -0
- package/dist/logger.js.map +1 -0
- package/dist/logging.d.ts +31 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +58 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp/index.d.ts +32 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +113 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/output-buffer.d.ts +16 -0
- package/dist/output-buffer.d.ts.map +1 -0
- package/dist/output-buffer.js +69 -0
- package/dist/output-buffer.js.map +1 -0
- package/dist/paths.d.ts +35 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +45 -0
- package/dist/paths.js.map +1 -0
- package/dist/pretty.d.ts +12 -0
- package/dist/pretty.d.ts.map +1 -0
- package/dist/pretty.js +83 -0
- package/dist/pretty.js.map +1 -0
- package/dist/release/index.d.ts +38 -0
- package/dist/release/index.d.ts.map +1 -0
- package/dist/release/index.js +91 -0
- package/dist/release/index.js.map +1 -0
- package/dist/release/markdown.d.ts +36 -0
- package/dist/release/markdown.d.ts.map +1 -0
- package/dist/release/markdown.js +153 -0
- package/dist/release/markdown.js.map +1 -0
- package/dist/release/structure.d.ts +16 -0
- package/dist/release/structure.d.ts.map +1 -0
- package/dist/release/structure.js +74 -0
- package/dist/release/structure.js.map +1 -0
- package/dist/renderer.d.ts +34 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +55 -0
- package/dist/renderer.js.map +1 -0
- package/dist/result-fields.d.ts +4 -0
- package/dist/result-fields.d.ts.map +1 -0
- package/dist/result-fields.js +56 -0
- package/dist/result-fields.js.map +1 -0
- package/dist/retry.d.ts +27 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +26 -0
- package/dist/retry.js.map +1 -0
- package/dist/sanitize.d.ts +25 -0
- package/dist/sanitize.d.ts.map +1 -0
- package/dist/sanitize.js +52 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/skill/index.d.ts +78 -0
- package/dist/skill/index.d.ts.map +1 -0
- package/dist/skill/index.js +190 -0
- package/dist/skill/index.js.map +1 -0
- package/dist/standards/errors.d.ts +40 -0
- package/dist/standards/errors.d.ts.map +1 -0
- package/dist/standards/errors.js +33 -0
- package/dist/standards/errors.js.map +1 -0
- package/dist/standards/index.d.ts +8 -0
- package/dist/standards/index.d.ts.map +1 -0
- package/dist/standards/index.js +8 -0
- package/dist/standards/index.js.map +1 -0
- package/dist/standards/lint.d.ts +29 -0
- package/dist/standards/lint.d.ts.map +1 -0
- package/dist/standards/lint.js +50 -0
- package/dist/standards/lint.js.map +1 -0
- package/dist/standards/log.d.ts +21 -0
- package/dist/standards/log.d.ts.map +1 -0
- package/dist/standards/log.js +18 -0
- package/dist/standards/log.js.map +1 -0
- package/dist/standards/output.d.ts +126 -0
- package/dist/standards/output.d.ts.map +1 -0
- package/dist/standards/output.js +54 -0
- package/dist/standards/output.js.map +1 -0
- package/dist/standards/registry.d.ts +18 -0
- package/dist/standards/registry.d.ts.map +1 -0
- package/dist/standards/registry.js +41 -0
- package/dist/standards/registry.js.map +1 -0
- package/dist/standards/steps.d.ts +28 -0
- package/dist/standards/steps.d.ts.map +1 -0
- package/dist/standards/steps.js +56 -0
- package/dist/standards/steps.js.map +1 -0
- package/dist/standards/vocabulary.d.ts +40 -0
- package/dist/standards/vocabulary.d.ts.map +1 -0
- package/dist/standards/vocabulary.js +242 -0
- package/dist/standards/vocabulary.js.map +1 -0
- package/dist/streams.d.ts +24 -0
- package/dist/streams.d.ts.map +1 -0
- package/dist/streams.js +26 -0
- package/dist/streams.js.map +1 -0
- package/dist/testing/index.d.ts +24 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +29 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/time.d.ts +21 -0
- package/dist/time.d.ts.map +1 -0
- package/dist/time.js +19 -0
- package/dist/time.js.map +1 -0
- package/dist/update/index.d.ts +76 -0
- package/dist/update/index.d.ts.map +1 -0
- package/dist/update/index.js +160 -0
- package/dist/update/index.js.map +1 -0
- package/package.json +135 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Copyright (c) 2026 Viacheslav Ptsarev
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
Apache License
|
|
5
|
+
Version 2.0, January 2004
|
|
6
|
+
http://www.apache.org/licenses/
|
|
7
|
+
|
|
8
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
9
|
+
|
|
10
|
+
1. Definitions.
|
|
11
|
+
|
|
12
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
13
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
14
|
+
|
|
15
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
16
|
+
the copyright owner that is granting the License.
|
|
17
|
+
|
|
18
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
19
|
+
other entities that control, are controlled by, or are under common
|
|
20
|
+
control with that entity. For the purposes of this definition,
|
|
21
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
22
|
+
direction or management of such entity, whether by contract or
|
|
23
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
24
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
25
|
+
|
|
26
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
27
|
+
exercising permissions granted by this License.
|
|
28
|
+
|
|
29
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
30
|
+
including but not limited to software source code, documentation
|
|
31
|
+
source, and configuration files.
|
|
32
|
+
|
|
33
|
+
"Object" form shall mean any form resulting from mechanical
|
|
34
|
+
transformation or translation of a Source form, including but
|
|
35
|
+
not limited to compiled object code, generated documentation,
|
|
36
|
+
and conversions to other media types.
|
|
37
|
+
|
|
38
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
39
|
+
Object form, made available under the License, as indicated by a
|
|
40
|
+
copyright notice that is included in or attached to the work
|
|
41
|
+
(an example is provided in the Appendix below).
|
|
42
|
+
|
|
43
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
44
|
+
form, that is based on (or derived from) the Work and for which the
|
|
45
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
46
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
47
|
+
of this License, Derivative Works shall not include works that remain
|
|
48
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
49
|
+
the Work and Derivative Works thereof.
|
|
50
|
+
|
|
51
|
+
"Contribution" shall mean any work of authorship, including
|
|
52
|
+
the original version of the Work and any modifications or additions
|
|
53
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
54
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
55
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
56
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
57
|
+
means any form of electronic, verbal, or written communication sent
|
|
58
|
+
to the Licensor or its representatives, including but not limited to
|
|
59
|
+
communication on electronic mailing lists, source code control systems,
|
|
60
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
61
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
62
|
+
excluding communication that is conspicuously marked or otherwise
|
|
63
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
64
|
+
|
|
65
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
66
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
67
|
+
subsequently incorporated within the Work.
|
|
68
|
+
|
|
69
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
70
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
71
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
72
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
73
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
74
|
+
Work and such Derivative Works in Source or Object form.
|
|
75
|
+
|
|
76
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
77
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
78
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
79
|
+
(except as stated in this section) patent license to make, have made,
|
|
80
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
81
|
+
where such license applies only to those patent claims licensable
|
|
82
|
+
by such Contributor that are necessarily infringed by their
|
|
83
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
84
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
85
|
+
institute patent litigation against any entity (including a
|
|
86
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
87
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
88
|
+
or contributory patent infringement, then any patent licenses
|
|
89
|
+
granted to You under this License for that Work shall terminate
|
|
90
|
+
as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
93
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
94
|
+
modifications, and in Source or Object form, provided that You
|
|
95
|
+
meet the following conditions:
|
|
96
|
+
|
|
97
|
+
(a) You must give any other recipients of the Work or
|
|
98
|
+
Derivative Works a copy of this License; and
|
|
99
|
+
|
|
100
|
+
(b) You must cause any modified files to carry prominent notices
|
|
101
|
+
stating that You changed the files; and
|
|
102
|
+
|
|
103
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
104
|
+
that You distribute, all copyright, patent, trademark, and
|
|
105
|
+
attribution notices from the Source form of the Work,
|
|
106
|
+
excluding those notices that do not pertain to any part of
|
|
107
|
+
the Derivative Works; and
|
|
108
|
+
|
|
109
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
110
|
+
distribution, then any Derivative Works that You distribute must
|
|
111
|
+
include a readable copy of the attribution notices contained
|
|
112
|
+
within such NOTICE file, excluding those notices that do not
|
|
113
|
+
pertain to any part of the Derivative Works, in at least one
|
|
114
|
+
of the following places: within a NOTICE text file distributed
|
|
115
|
+
as part of the Derivative Works; within the Source form or
|
|
116
|
+
documentation, if provided along with the Derivative Works; or,
|
|
117
|
+
within a display generated by the Derivative Works, if and
|
|
118
|
+
wherever such third-party notices normally appear. The contents
|
|
119
|
+
of the NOTICE file are for informational purposes only and
|
|
120
|
+
do not modify the License. You may add Your own attribution
|
|
121
|
+
notices within Derivative Works that You distribute, alongside
|
|
122
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
123
|
+
that such additional attribution notices cannot be construed
|
|
124
|
+
as modifying the License.
|
|
125
|
+
|
|
126
|
+
You may add Your own copyright statement to Your modifications and
|
|
127
|
+
may provide additional or different license terms and conditions
|
|
128
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
129
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
130
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
131
|
+
the conditions stated in this License.
|
|
132
|
+
|
|
133
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
134
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
135
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
136
|
+
this License, without any additional terms or conditions.
|
|
137
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
138
|
+
the terms of any separate license agreement you may have executed
|
|
139
|
+
with Licensor regarding such Contributions.
|
|
140
|
+
|
|
141
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
142
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
143
|
+
except as required for reasonable and customary use in describing the
|
|
144
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
145
|
+
|
|
146
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
147
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
148
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
149
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
150
|
+
implied, including, without limitation, any warranties or conditions
|
|
151
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
152
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
153
|
+
appropriateness of using or redistributing the Work and assume any
|
|
154
|
+
risks associated with Your exercise of permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
182
|
+
|
|
183
|
+
To apply the Apache License to your work, attach the following
|
|
184
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
185
|
+
replaced with your own identifying information. (Don't include
|
|
186
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
187
|
+
comment syntax for the file format. We also recommend that a
|
|
188
|
+
file or class name and description of purpose be included on the
|
|
189
|
+
same "printed page" as the copyright notice for easier
|
|
190
|
+
identification within third-party archives.
|
|
191
|
+
|
|
192
|
+
Copyright [yyyy] [name of copyright owner]
|
|
193
|
+
|
|
194
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
195
|
+
you may not use this file except in compliance with the License.
|
|
196
|
+
You may obtain a copy of the License at
|
|
197
|
+
|
|
198
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
199
|
+
|
|
200
|
+
Unless required by applicable law or agreed to in writing, software
|
|
201
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
202
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
203
|
+
See the License for the specific language governing permissions and
|
|
204
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,391 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="https://raw.githubusercontent.com/WireCatLabs/cli-base/main/docs/images/social-preview.png" alt="The foundation for agent-ready CLIs: output for people and machines, stable exit codes, keyring, testable clocks" width="100%">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# @wirecat/cli-base
|
|
4
|
+
|
|
5
|
+
The parts every command line tool needs and nobody enjoys writing twice: the two output streams,
|
|
6
|
+
a renderer for people and for machines, a closed error model with stable exit codes, the OS
|
|
7
|
+
keyring behind a testable seam, and injectable clocks.
|
|
8
|
+
|
|
9
|
+
Extracted from [`brazecli`](https://github.com/leemour/brazecli), where each piece earned its
|
|
10
|
+
shape, and shared with [`max-cli`](https://github.com/WireCatLabs/max-cli).
|
|
11
|
+
|
|
12
|
+
Published on npm and used by `max-cli`, `cli-messaging`, `tg-cli` and `brazecli`. What changed in
|
|
13
|
+
each version is in [`CHANGELOG.md`](CHANGELOG.md); how the package is put together and released is in
|
|
14
|
+
[`docs/dev/`](docs/dev/ARCHITECTURE.md).
|
|
15
|
+
|
|
16
|
+
## The rule this package exists to keep
|
|
17
|
+
|
|
18
|
+
**In a machine mode, stdout carries data and nothing else.** No spinner, no `✓`, no warning, no
|
|
19
|
+
ANSI. Diagnostics go to stderr, in every mode including the pretty one. That is the contract a
|
|
20
|
+
script or an agent depends on, and `captureStreams` exists so a test can prove nothing leaked
|
|
21
|
+
across.
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { captureStreams, createRenderer } from "@wirecat/cli-base"
|
|
25
|
+
|
|
26
|
+
const streams = captureStreams()
|
|
27
|
+
createRenderer({ format: "json", color: false, streams }).result({ chats: 2 })
|
|
28
|
+
|
|
29
|
+
streams.stdout // ['{"chats":2}']
|
|
30
|
+
streams.stderr // []
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What is in it
|
|
34
|
+
|
|
35
|
+
| | |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `streams` | the stdout/stderr split, and the capture used to test it |
|
|
38
|
+
| `renderer` · `pretty` | `pretty` / `json` / `jsonl`; tables for lists, labelled lines for objects; `quiet` keeps only failures on stderr |
|
|
39
|
+
| `errors` · `exit-codes` | 14 closed error codes, one exit number each, so a script can branch on `$?` |
|
|
40
|
+
| `keyring` | `KeyringStore` with the system, memory and deliberately-broken implementations |
|
|
41
|
+
| `fieldsOf` · `projectFields` | validated field selection preserving list metadata and operation identifiers |
|
|
42
|
+
| `createOutputBuffer` | bounded UTF-8 output held until successful completion and resource cleanup |
|
|
43
|
+
| `createDeadline` | cooperative command cancellation with injected sleep and a parent abort signal |
|
|
44
|
+
| `time` | monotonic and wall clocks, and the one sleep that both timeouts and backoff use |
|
|
45
|
+
| `logger` | the four-method interface a host adapts Pino to — this package logs nothing itself |
|
|
46
|
+
| `paths` | config, state and cache in the XDG layout on Linux and macOS (`~/.config`, `~/.local/share`, `~/.cache`) and the `AppData` one on Windows, each overridable by environment variable; `migrateLegacyMacPaths` moves an older release's `~/Library` folders once |
|
|
47
|
+
| `config` | JSON config loading that names the bad field, and an atomic write that locks the directory down |
|
|
48
|
+
| `credentials` | environment → keyring → file, warning once and falling through when the keyring refuses |
|
|
49
|
+
| `logging` | a Pino adapter writing JSON lines with secrets redacted by field name; a file that cannot be written is reported to `onError`, never thrown |
|
|
50
|
+
| `retry` | full-jitter backoff, and the distinction between "no answer came" and "safe to repeat" |
|
|
51
|
+
| `/testing` | `captureStreams`, `memoryKeyring`, `brokenKeyring`, `fakeClock` |
|
|
52
|
+
| `/commands` | the command registry: `describeProgram`, `annotate`, `flatten`, `refuseJoinedPath`, and `commandsDocument` — the one `commands --json` shape, with its schema — see below |
|
|
53
|
+
| `/completion` | shell completion over the registry: `suggest`, `formatSuggestions` — see below |
|
|
54
|
+
| `/update` | keeping an install current: `installerOf`, `updateCommand`, `latestVersion`, `mayNotify`, `updateNotice`, `runUpdate` — see below |
|
|
55
|
+
| `/codegen` | build time: an official API description → types, Valibot schemas, an operation manifest and a coverage page — see below |
|
|
56
|
+
| `/release` | release time: `releaseCheck` and the checks it runs — changelog shape, links, package contents, version in step — see below |
|
|
57
|
+
| `/skill` | the CLI's SKILL.md for coding agents: `skillCommand` (`show`, `install`), `skillHint`, `skillResource` — see below |
|
|
58
|
+
| `/mcp` | local stdio MCP setup for Codex and Claude Code, plus a read-only handshake and tool-list probe |
|
|
59
|
+
| `/standards` | the registries the standard is made of — vocabulary, output envelope, error object and reasons, next steps, log record, lint rules — as Valibot schemas that also emit JSON Schema 2020-12 |
|
|
60
|
+
|
|
61
|
+
**Nothing in the root export is HTTP.** Status classification, `Retry-After` parsing and the fetch
|
|
62
|
+
seam live in `@wirecat/cli-base/http`, so a CLI that speaks a socket never depends on a stack it
|
|
63
|
+
does not call:
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { providerWaitMs, statusToCode } from "@wirecat/cli-base/http"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Portable command control stays independent of provider and store lifetimes.**
|
|
70
|
+
`fieldsOf("id,speaker.id")` parses up to 128 field paths; `projectFields(value, paths)` selects data
|
|
71
|
+
from objects or list items while preserving the list envelope and `operationId` / `sendId`.
|
|
72
|
+
`items.id` also works for bare objects and JSONL items. Unknown fields are omitted; parent selections
|
|
73
|
+
win over their children. Unsafe prototype paths are refused, including when paths are passed directly.
|
|
74
|
+
|
|
75
|
+
`createOutputBuffer({ maxOutputBytes })` retains raw output chunks until `flush(write)` or `discard()`.
|
|
76
|
+
Its default limit is 4 MiB; zero disables the limit. It counts actual UTF-8 bytes, including delimiters
|
|
77
|
+
the caller passes, and adds no newlines. Use a new buffer for each command and flush only after resource
|
|
78
|
+
cleanup succeeds; discard on failure. A flush consumes the buffer even when its writer throws.
|
|
79
|
+
The `bytes` property reports the cumulative accepted byte count. A writer failure can leave partial
|
|
80
|
+
output; buffering only guarantees no output before flushing.
|
|
81
|
+
|
|
82
|
+
Optional `{ fields, format: "json" | "jsonl" }` projects before counting bytes. With projection,
|
|
83
|
+
each `data(text)` must contain a complete JSON value or complete JSONL lines; fragments fail before
|
|
84
|
+
buffering. Without projection, arbitrary text chunks work. Hosts can instead project values before
|
|
85
|
+
rendering and buffer the renderer's raw text. For core renderers, pass the line delimiter explicitly
|
|
86
|
+
when adapting `Streams.data`: `data: (text) => buffer.data(text + "\n")`.
|
|
87
|
+
|
|
88
|
+
`createDeadline({ timeoutMs, signal, sleep })` supplies a command signal and `race(body)`. An omitted
|
|
89
|
+
timeout creates no timer; zero aborts synchronously without calling sleep, and the maximum is 2147483647 milliseconds.
|
|
90
|
+
Pass its signal to every cancellable operation and check it before writes. On timeout or parent
|
|
91
|
+
cancellation, `race` waits for the body to settle before rejecting, so a caller can safely close
|
|
92
|
+
resources afterwards. An operation ignoring its signal can delay completion; this helper never
|
|
93
|
+
abandons it in the background. A body's more precise `outcome_unknown` error survives interruption.
|
|
94
|
+
Call `dispose()` in `finally` to remove the timer and parent listener. There are no process signal
|
|
95
|
+
handlers, retries, automatic resource cleanup or HTTP behavior in these helpers.
|
|
96
|
+
|
|
97
|
+
**The command registry is `@wirecat/cli-base/commands`** — the whole command tree as data, like
|
|
98
|
+
`rails routes`, for an agent to read instead of `--help` and for generated documentation. It walks
|
|
99
|
+
the live [Commander](https://github.com/tj/commander.js) tree, so a command built in a loop from a
|
|
100
|
+
catalog appears exactly like a handwritten one; `annotate` adds what the tree cannot say. Commander
|
|
101
|
+
is a type here, not a runtime dependency — an optional peer, 15 or newer.
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { annotate, describeProgram } from "@wirecat/cli-base/commands"
|
|
105
|
+
|
|
106
|
+
annotate(program.command("send"), { mutates: true, examples: ["max messages send 42 hi"] })
|
|
107
|
+
annotate(generated, { origin: "generated", operationId: "campaigns.list" })
|
|
108
|
+
|
|
109
|
+
describeProgram(program) // [{ path: ["send"], usage, origin, mutates, options: [...], commands: [...] }]
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Each option says whether it `takesValue` and, separately, whether it is `mandatory` — not
|
|
113
|
+
Commander's `required`, which means "takes a value when given" — plus its choices, default,
|
|
114
|
+
environment variable, the options it `conflicts` with and the values it `implies`.
|
|
115
|
+
|
|
116
|
+
`refuseJoinedPath(program, args)` throws a `validation_error` when a command path arrived as one
|
|
117
|
+
argument (`"projects add" --help`, what a zsh loop over `$c` passes), naming the words to type.
|
|
118
|
+
Commander would print the root help instead; call it on the words before `parseAsync`, after a
|
|
119
|
+
leading profile word if the CLI takes one.
|
|
120
|
+
|
|
121
|
+
**Shell completion is `@wirecat/cli-base/completion`**, built on the registry. `suggest` takes the
|
|
122
|
+
words typed so far and answers what may come next: a command, an action, an option, one of its
|
|
123
|
+
values, or an argument's values from a source the CLI hands in — a local cache, never the network,
|
|
124
|
+
because a shell calls it on every Tab. `formatSuggestions` writes the answer in the protocol of the
|
|
125
|
+
shell scripts [`@bomb.sh/tab`](https://github.com/bombshell-dev/tab) generates, so the CLI prints
|
|
126
|
+
those scripts with tab and answers `<cli> complete -- <words>` with this; cli-base itself does not
|
|
127
|
+
depend on tab.
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { formatSuggestions, suggest } from "@wirecat/cli-base/completion"
|
|
131
|
+
|
|
132
|
+
const words = argv.slice(argv.indexOf("--") + 1)
|
|
133
|
+
streams.data(formatSuggestions(suggest({ commands, globalOptions, words, sources: { arguments: { chat: chatNames } } })))
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Two traps worth knowing before you use the credential store.** The OS keyring is global: an entry
|
|
137
|
+
is addressed by service and account and knows nothing about which config directory asked for it, so
|
|
138
|
+
a throwaway config directory silently overwrites the real secret unless you pass `isolated: true`.
|
|
139
|
+
And a secret should never be handed to a logger in the first place — redaction by field name is the
|
|
140
|
+
second line of defence, not the first.
|
|
141
|
+
|
|
142
|
+
**Everything the environment knows can be passed in**: the clock, the sleep, the keyring, `env`,
|
|
143
|
+
`fetch` and the streams. The real ones are only defaults — `Credentials` without a `keyring` uses the
|
|
144
|
+
system keychain, `resolvePaths` without `env` reads `process.env`. Passing them is what makes a
|
|
145
|
+
timeout test finish instantly and a keyring test incapable of reaching a real keychain.
|
|
146
|
+
|
|
147
|
+
**Generating an API catalog is `@wirecat/cli-base/codegen`**, a build-time tool. It reads a
|
|
148
|
+
format-neutral `ApiModel` — operations with a transport binding (`http` method and path, or `rpc`
|
|
149
|
+
name), an `effect` (`read`, `write`, `destructive`) and how far the source can be trusted
|
|
150
|
+
(`contract`, `example`, `inferred`, `override`) — and writes committed files. It parses no file
|
|
151
|
+
format: the adapter from OpenAPI, Postman or anything else lives in the CLI that has that source,
|
|
152
|
+
so this adds no dependency. Generation stops, naming the problem, when two operations collide, an
|
|
153
|
+
operation is not classified as a read or a write, an override matches nothing, a reference points
|
|
154
|
+
nowhere or a construct cannot be expressed; it never drops an operation or falls back to `any`.
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { generate, manifestGenerator, typesGenerator, valibotGenerator, writeArtifacts } from "@wirecat/cli-base/codegen"
|
|
158
|
+
|
|
159
|
+
const artifacts = generate(model, [typesGenerator({ path }), valibotGenerator({ path, typesImport }), manifestGenerator({ path })], {
|
|
160
|
+
overrides: { answerOnCallback: { effect: "write", reason: "a POST that edits a message" } },
|
|
161
|
+
banner: ["Source: spec/bot/schema.yaml", "Run: pnpm bot:generate"],
|
|
162
|
+
})
|
|
163
|
+
const stale = writeArtifacts(artifacts, { root, check: process.argv.includes("--check") })
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The generated schemas import `@wirecat/cli-base/codegen/runtime` at run time — a few number
|
|
167
|
+
helpers, not the generator. Numbers are expected from a lossless JSON parser (`lossless-json`): a
|
|
168
|
+
64-bit integer comes out as its exact decimal string, and any other integer that does not fit a JS
|
|
169
|
+
number fails instead of rounding. Objects are loose, so a field the API added later passes through.
|
|
170
|
+
Unions retain every alternative, including recursive references and Boolean literals.
|
|
171
|
+
`definitionsGenerator` emits the same schema nodes for runtime input traversal; RPC parameters can be in the JSON body.
|
|
172
|
+
Enums and discriminated unions are **strict**: a value or subtype the snapshot does not know fails,
|
|
173
|
+
so decode a live stream (updates, webhooks) only where that is what you want.
|
|
174
|
+
|
|
175
|
+
**The schemas decode; they do not encode.** Their output carries an `int64` as a string, so sending
|
|
176
|
+
it back would put a string where the API expects a number. Validate a request with the schema, then
|
|
177
|
+
send the original lossless value.
|
|
178
|
+
|
|
179
|
+
**Keeping an install current is `@wirecat/cli-base/update`.** `installerOf(realpath(script))` says
|
|
180
|
+
which package manager put the CLI there — pnpm, npm or bun, measured on real installs — and
|
|
181
|
+
`updateCommand` gives the argv that updates it; a checkout or `npx` gets none. `latestVersion` asks
|
|
182
|
+
npm with a timeout and answers `undefined` on any failure. `mayNotify` says whether a person is at a
|
|
183
|
+
terminal to be told: never in JSON, a pipe, `--quiet`, `CI` or with `NO_UPDATE_NOTIFIER`.
|
|
184
|
+
`updateNotice` is the whole daily line: it stays silent when `update` or `complete` is anywhere on
|
|
185
|
+
the command line, asks npm at most once a day through a state file the CLI names, and returns the
|
|
186
|
+
sentence or `undefined` — it never throws. `runUpdate` starts the package manager with its output on
|
|
187
|
+
stderr (`spawnPlan` is the Windows `.cmd` rule). Nothing here updates or prints by itself — a CLI
|
|
188
|
+
holding somebody's credentials must not change itself unasked.
|
|
189
|
+
|
|
190
|
+
**A CLI's guide for coding agents is `@wirecat/cli-base/skill`.** `skillCommand(app, skillUrl,
|
|
191
|
+
environment)` is `<cli> skill show` — SKILL.md on stdout, even into a pipe, or `{ name, content }`
|
|
192
|
+
with `--json` — and `<cli> skill install [--for claude|agents|all]`, which writes it to
|
|
193
|
+
`~/.claude/skills/<appName>/` and `~/.agents/skills/<appName>/` with the CLI's version as
|
|
194
|
+
`metadata.version` in the frontmatter, refusing a file whose `name` is not `<appName>`. `environment` is the host's own renderer, streams and `env` for that invocation.
|
|
195
|
+
`skillHint` is one line, or `undefined`, for an agent (`AI_AGENT` or `CLAUDECODE` set) with no copy
|
|
196
|
+
installed or an older one, at most once a day, through the same state file as `updateNotice`; the
|
|
197
|
+
host prints it on stderr. `skillResource` is what an MCP server registers to serve the file as
|
|
198
|
+
`<command>://skill`, plus a line for its `instructions` — the SDK stays the host's.
|
|
199
|
+
|
|
200
|
+
**The release checks are `@wirecat/cli-base/release`** — everything about a release that a program
|
|
201
|
+
can decide. A check is `{ name, run }`, and `run` returns the problems it found, one line each; an
|
|
202
|
+
empty list is a pass. `releaseCheck(checks, { version, log })` runs them all, even after a failure,
|
|
203
|
+
prints `ok` or `FAIL` per check and returns how many failed — the caller exits. The checks every CLI
|
|
204
|
+
shares: `command(root, "pnpm", "lint")` for anything that passes by exiting 0, `notOnNpm`,
|
|
205
|
+
`packContents` against a list of what may ship, `changelogProblems` for the fixed headings and the
|
|
206
|
+
dated top section, `docsProblems` for dead links and anchors and the rules of the pages a user reads,
|
|
207
|
+
and `versionScript` — the whole of a `version:check` / `version:sync` script. Each CLI passes its
|
|
208
|
+
own headings, id prefixes and pages; the checks that belong to one messenger stay in that CLI.
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
import { command, notOnNpm, packageVersion, releaseCheck } from "@wirecat/cli-base/release"
|
|
212
|
+
|
|
213
|
+
const version = packageVersion(root)
|
|
214
|
+
const failed = releaseCheck(
|
|
215
|
+
[
|
|
216
|
+
{ name: "version not on npm", run: notOnNpm(root, "@wirecat/tg-cli", version) },
|
|
217
|
+
{ name: "lint", run: command(root, "pnpm", "lint") },
|
|
218
|
+
],
|
|
219
|
+
{ version, log: console.log },
|
|
220
|
+
)
|
|
221
|
+
process.exit(failed === 0 ? 0 : 1)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Where secrets actually go, per platform
|
|
225
|
+
|
|
226
|
+
The keyring is real on every desktop and absent on most servers, so the fallback is not an edge
|
|
227
|
+
case — it is the normal path in CI and containers. Checked against `@napi-rs/keyring` 2.1.0 on
|
|
228
|
+
2026-09-19.
|
|
229
|
+
|
|
230
|
+
| Platform | Backing store | Needs installing |
|
|
231
|
+
|---|---|---|
|
|
232
|
+
| macOS | Keychain, via the Security framework | nothing — part of the OS |
|
|
233
|
+
| Windows | Credential Manager | nothing — part of the OS |
|
|
234
|
+
| Linux desktop (GNOME, KDE) | Secret Service over D-Bus — `gnome-keyring`, `kwallet` | nothing on a normal desktop; the keyring must be **unlocked** |
|
|
235
|
+
| Linux headless, container, WSL, CI | usually **nothing** — no session bus, no secrets daemon | falls back to a `0600` file, with one warning on stderr |
|
|
236
|
+
| FreeBSD | Secret Service, same as Linux | same |
|
|
237
|
+
|
|
238
|
+
**No compiler is involved.** The package ships prebuilt binaries for twelve platform triples —
|
|
239
|
+
macOS arm64/x64, Windows x64/ia32/arm64, Linux x64 and arm64 in both glibc and musl, armv7,
|
|
240
|
+
riscv64, FreeBSD x64 — so there is no Rust toolchain and no node-gyp on any mainstream target.
|
|
241
|
+
The Linux binary links only against libc: it speaks D-Bus itself rather than through libsecret,
|
|
242
|
+
so *libsecret is not a requirement* — a running Secret Service provider is.
|
|
243
|
+
|
|
244
|
+
Two consequences worth designing for rather than discovering:
|
|
245
|
+
|
|
246
|
+
- **`auto` is the right default and `file` must stay available.** `credentialStorage: "file"` skips
|
|
247
|
+
the keyring entirely, which is what a container wants and what a locked keyring makes necessary.
|
|
248
|
+
- **A locked Linux keyring can block on a prompt** rather than failing. That is the one case the
|
|
249
|
+
fallback does not rescue, and a CLI that hangs looks broken rather than locked.
|
|
250
|
+
|
|
251
|
+
## Both runtimes
|
|
252
|
+
|
|
253
|
+
Node 22+ and Bun, and the Bun half is executed rather than assumed:
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
pnpm test # vitest, Node
|
|
257
|
+
pnpm smoke:bun # the same exports, actually run under Bun
|
|
258
|
+
pnpm lint
|
|
259
|
+
pnpm typecheck
|
|
260
|
+
pnpm build
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
The rest of the checks, and what each is for, are in [`docs/dev/TESTING.md`](docs/dev/TESTING.md).
|
|
264
|
+
|
|
265
|
+
## Shared tooling
|
|
266
|
+
|
|
267
|
+
The configuration, development scripts and CI that every CLI on cli-base used to copy. A repository
|
|
268
|
+
takes each piece on its own.
|
|
269
|
+
|
|
270
|
+
**TypeScript.** Compiler options only; paths and file lists stay in the repository, because `tsc`
|
|
271
|
+
resolves them against the file that declares them.
|
|
272
|
+
|
|
273
|
+
```jsonc
|
|
274
|
+
// tsconfig.json
|
|
275
|
+
{
|
|
276
|
+
"extends": "@wirecat/cli-base/tsconfig.base.json",
|
|
277
|
+
"compilerOptions": { "rootDir": "src", "outDir": "dist" },
|
|
278
|
+
"include": ["src/**/*.ts"],
|
|
279
|
+
"exclude": ["src/**/*.test.ts"]
|
|
280
|
+
}
|
|
281
|
+
// tsconfig.test.json — checks every file under src/, tests included, without emitting
|
|
282
|
+
{ "extends": ["./tsconfig.json", "@wirecat/cli-base/tsconfig.test.json"] }
|
|
283
|
+
// tsconfig.scripts.json — checks scripts/
|
|
284
|
+
{ "extends": ["./tsconfig.json", "@wirecat/cli-base/tsconfig.scripts.json"] }
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
**Biome.** Formatter, linter and the rule that lets `scripts/` print. Your `files.includes` and
|
|
288
|
+
your own `overrides` (import boundaries) stay in your file; Biome adds them to the shared ones.
|
|
289
|
+
Write the specifier without `.json`: Biome reads anything ending in `.json` as a relative path.
|
|
290
|
+
|
|
291
|
+
```json
|
|
292
|
+
{ "extends": ["@wirecat/cli-base/biome"], "files": { "includes": ["**", "!**/dist", "!**/node_modules", "!pnpm-lock.yaml"] } }
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**lefthook.** Biome and gitleaks on staged files before a commit, `pnpm typecheck` before a push.
|
|
296
|
+
An extended file **overrides** your `lefthook.yml`; to change a shared hook, use `lefthook-local.yml`.
|
|
297
|
+
|
|
298
|
+
```yaml
|
|
299
|
+
extends:
|
|
300
|
+
- node_modules/@wirecat/cli-base/config/lefthook.yml
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**`cli-dev`.** Installed with the package; `pnpm exec cli-dev help` lists the commands.
|
|
304
|
+
|
|
305
|
+
| Instead of | Run |
|
|
306
|
+
|---|---|
|
|
307
|
+
| `scripts/slow-tests.ts` | `cli-dev slow-tests [report] [count]` |
|
|
308
|
+
| `scripts/next-version.mjs` | `cli-dev next-version <wanted> <latest> <versions-json>` |
|
|
309
|
+
| `scripts/version.ts` | `cli-dev version [--sync] [--file src/version.ts]` |
|
|
310
|
+
| `scripts/docs-check.ts` | `cli-dev docs-check --rules scripts/release/checks.ts`, or `--ids CLI,MAX` with the English defaults |
|
|
311
|
+
| `scripts/test-matrix.ts` | `cli-dev test-matrix --program dist/program.js --untested scripts/test-matrix-untested.ts --name max [--check]` |
|
|
312
|
+
|
|
313
|
+
| — | `cli-dev lint --cli dist/bin.js` (or `--commands <file>`): the command tree against the standard |
|
|
314
|
+
|
|
315
|
+
`cli-dev lint` reads `<cli> commands --json`, refuses a document not in `commandsDocument`'s shape, and
|
|
316
|
+
judges it by `LINT_RULES` and `VOCABULARY` from `/standards`. Known violations live in
|
|
317
|
+
`lint/baseline/<rule-id>.json`, one file per rule, and may only shrink: an entry with no violation left
|
|
318
|
+
fails the run. `--write-baseline` rewrites those files to today's violations. Permanent exceptions go in
|
|
319
|
+
`lint/overrides.json` — `[{ "rule", "target", "reason" }]` — and more than `--budget` (10) of them fails.
|
|
320
|
+
|
|
321
|
+
`--rules` names a module exporting `CHANGELOG` and `docsRules(root)`; `--program` one exporting
|
|
322
|
+
`createProgram`; `--untested` one exporting `UNTESTED`. A TypeScript module loads on Node 24 as it is.
|
|
323
|
+
|
|
324
|
+
**Docs.** Spelling, Markdown form and prose rules for the pages a user reads. The tools are your
|
|
325
|
+
own dev dependencies (`cspell`, `@cspell/dict-ru_ru`, `@cspell/dict-en-gb`, `rumdl`); the settings
|
|
326
|
+
and the shared word list are here. Code blocks and inline code are not spell-checked: commands and
|
|
327
|
+
options are checked against the program by the parity check.
|
|
328
|
+
|
|
329
|
+
```jsonc
|
|
330
|
+
// cspell.json — the dictionaries resolve from your node_modules, so you import them yourself
|
|
331
|
+
{
|
|
332
|
+
"version": "0.2",
|
|
333
|
+
"import": ["@wirecat/cli-base/cspell", "@cspell/dict-en-gb/cspell-ext.json", "@cspell/dict-ru_ru/cspell-ext.json"],
|
|
334
|
+
"ignorePaths": ["docs/commands.md", "docs/dev/**", "CHANGELOG.md"],
|
|
335
|
+
"words": []
|
|
336
|
+
}
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
```sh
|
|
340
|
+
cspell --no-progress README.md "docs/*.md"
|
|
341
|
+
rumdl check --config node_modules/@wirecat/cli-base/config/rumdl.toml README.md docs/*.md
|
|
342
|
+
vale README.md docs/*.md # .vale.ini: StylesPath = node_modules/@wirecat/cli-base/config/vale
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
`cli-dev docs-check --pages` adds the structure check: `docs/` against `docs/meta.json`, the
|
|
346
|
+
sidebar of [the docs portal](https://github.com/WireCatLabs/cli-docs/blob/main/docs/STRUCTURE.md).
|
|
347
|
+
Vale's styles are `CliDocs` (filler words, long sentences) and `Tg` (tg's tone: a Telegram client,
|
|
348
|
+
never "unofficial"); its rules warn rather than fail until they are tuned.
|
|
349
|
+
|
|
350
|
+
**CI.** Install, lint, typecheck, test with coverage, build, your extra checks, Bun, and a gitleaks
|
|
351
|
+
scan of the whole history. Jobs only your repository needs stay beside it in your `ci.yml`.
|
|
352
|
+
|
|
353
|
+
```yaml
|
|
354
|
+
jobs:
|
|
355
|
+
ci:
|
|
356
|
+
uses: WireCatLabs/cli-base/.github/workflows/node-ci.yml@v<version>
|
|
357
|
+
with:
|
|
358
|
+
checks: |
|
|
359
|
+
pnpm docs:check
|
|
360
|
+
bun-run: pnpm build && pnpm smoke:bun # the default is pnpm smoke:bun
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Inputs: `node-version` (`"24"`), `checks` (shell lines run after the build), `bun` (`true`),
|
|
364
|
+
`bun-run`. The workflow is in the repository, not the package: pin a tag or a commit, not `main`.
|
|
365
|
+
|
|
366
|
+
## Releasing
|
|
367
|
+
|
|
368
|
+
Raise `version` in `package.json` and date the `## Unreleased` section of
|
|
369
|
+
[`CHANGELOG.md`](CHANGELOG.md) as that version, through a pull request; merge it, then on `main`:
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
bin/release
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
It refuses a dirty tree, a branch other than `main` and a `main` that is not pushed. When npm already
|
|
376
|
+
has the version, or a higher one, it commits the next free version to `main` — the next minor for
|
|
377
|
+
`x.y.0`, the next patch otherwise — renames the changelog heading to match, and publishes that. Then it starts
|
|
378
|
+
[`release.yml`](.github/workflows/release.yml) and follows it. The workflow runs every check,
|
|
379
|
+
publishes through npm's [trusted publishing](https://docs.npmjs.com/trusted-publishers/) — no npm
|
|
380
|
+
token in GitHub, and npm attaches provenance — and tags `v<version>` only once npm shows the new version.
|
|
381
|
+
|
|
382
|
+
npm trusts the workflow **by file name**: the package's Trusted Publisher settings on npmjs.com name
|
|
383
|
+
`WireCatLabs` / `cli-base` / `release.yml`. Rename the file and publishing stops until they are updated.
|
|
384
|
+
|
|
385
|
+
`bin/release --local` is the fallback: it runs the same checks here and publishes with the npm token
|
|
386
|
+
from the keyring (`secret-tool`, service `npm`, account `leemour`) without printing it. The token
|
|
387
|
+
must be allowed to write `@wirecat/cli-base`, not only `@wirecat/max-cli`.
|
|
388
|
+
|
|
389
|
+
## Licence
|
|
390
|
+
|
|
391
|
+
[Apache License 2.0](LICENSE).
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"vcs": {
|
|
3
|
+
"enabled": true,
|
|
4
|
+
"clientKind": "git",
|
|
5
|
+
"useIgnoreFile": true
|
|
6
|
+
},
|
|
7
|
+
"formatter": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"indentStyle": "space",
|
|
10
|
+
"indentWidth": 2,
|
|
11
|
+
"lineWidth": 120
|
|
12
|
+
},
|
|
13
|
+
"javascript": {
|
|
14
|
+
"formatter": {
|
|
15
|
+
"quoteStyle": "double",
|
|
16
|
+
"semicolons": "asNeeded",
|
|
17
|
+
"trailingCommas": "all",
|
|
18
|
+
"arrowParentheses": "always"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"linter": {
|
|
22
|
+
"enabled": true,
|
|
23
|
+
"rules": {
|
|
24
|
+
"preset": "recommended",
|
|
25
|
+
"style": {
|
|
26
|
+
"useConst": "error",
|
|
27
|
+
"noNonNullAssertion": "error"
|
|
28
|
+
},
|
|
29
|
+
"correctness": {
|
|
30
|
+
"noUnusedImports": "error",
|
|
31
|
+
"noUnusedVariables": "error"
|
|
32
|
+
},
|
|
33
|
+
"suspicious": {
|
|
34
|
+
"noExplicitAny": "error",
|
|
35
|
+
"noConsole": {
|
|
36
|
+
"level": "error",
|
|
37
|
+
"options": {
|
|
38
|
+
"allow": ["error"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"overrides": [
|
|
45
|
+
{
|
|
46
|
+
"includes": ["scripts/**"],
|
|
47
|
+
"linter": {
|
|
48
|
+
"rules": {
|
|
49
|
+
"suspicious": {
|
|
50
|
+
"noConsole": "off"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|