@wirecat/cli-template 0.0.0-stage → 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.
Files changed (131) hide show
  1. package/.github/dependabot.yml +23 -0
  2. package/.github/workflows/changelog-guard.yml +12 -0
  3. package/.github/workflows/ci.yml +88 -0
  4. package/.github/workflows/main.yml +17 -0
  5. package/.github/workflows/monthly.yml +28 -0
  6. package/.github/workflows/pr.yml +19 -0
  7. package/.github/workflows/release.yml +191 -0
  8. package/.github/workflows/standards.yml +51 -0
  9. package/.gitignore +42 -0
  10. package/.gitleaks.toml +5 -0
  11. package/.markdownlint-cli2.jsonc +7 -0
  12. package/.vale.ini +5 -0
  13. package/AGENTS.md +27 -0
  14. package/CHANGELOG.md +19 -0
  15. package/CLAUDE.md +17 -0
  16. package/LICENSE +204 -0
  17. package/README.md +52 -2
  18. package/SECURITY.md +15 -0
  19. package/bin/release +139 -0
  20. package/biome.json +6 -0
  21. package/config/wirecat/LICENSE +204 -0
  22. package/config/wirecat/biome.base.json +140 -0
  23. package/config/wirecat/check.mjs +41 -0
  24. package/config/wirecat/cspell.json +80 -0
  25. package/config/wirecat/lefthook.yml +26 -0
  26. package/config/wirecat/manifest.json +34 -0
  27. package/config/wirecat/markdownlint.json +10 -0
  28. package/config/wirecat/no-deep-wirecat-import.grit +15 -0
  29. package/config/wirecat/no-exec-interpolation.grit +17 -0
  30. package/config/wirecat/no-new-function.grit +8 -0
  31. package/config/wirecat/no-shell-true.grit +8 -0
  32. package/config/wirecat/no-unbounded-spread.grit +10 -0
  33. package/config/wirecat/release-lock-info.mjs +71 -0
  34. package/config/wirecat/release-lock.sh +34 -0
  35. package/config/wirecat/rumdl.toml +9 -0
  36. package/contracts/help.snap +16 -0
  37. package/contracts/mcp-tools.json +922 -0
  38. package/contracts/no-leak.json +3 -0
  39. package/contracts/plan.json +50 -0
  40. package/cspell.json +10 -0
  41. package/dist/bin/app.d.ts +3 -0
  42. package/dist/bin/app.d.ts.map +1 -0
  43. package/dist/bin/app.js +14 -0
  44. package/dist/bin/app.js.map +1 -0
  45. package/dist/commands/doctor.d.ts +23 -0
  46. package/dist/commands/doctor.d.ts.map +1 -0
  47. package/dist/commands/doctor.js +44 -0
  48. package/dist/commands/doctor.js.map +1 -0
  49. package/dist/commands/mcp.d.ts +3 -0
  50. package/dist/commands/mcp.d.ts.map +1 -0
  51. package/dist/commands/mcp.js +36 -0
  52. package/dist/commands/mcp.js.map +1 -0
  53. package/dist/config.d.ts +3 -0
  54. package/dist/config.d.ts.map +1 -0
  55. package/dist/config.js +4 -0
  56. package/dist/config.js.map +1 -0
  57. package/dist/identity.d.ts +5 -0
  58. package/dist/identity.d.ts.map +1 -0
  59. package/dist/identity.js +12 -0
  60. package/dist/identity.js.map +1 -0
  61. package/dist/index.d.ts +3 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +3 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/mcp.d.ts +19 -0
  66. package/dist/mcp.d.ts.map +1 -0
  67. package/dist/mcp.js +62 -0
  68. package/dist/mcp.js.map +1 -0
  69. package/dist/program.d.ts +6 -0
  70. package/dist/program.d.ts.map +1 -0
  71. package/dist/program.js +37 -0
  72. package/dist/program.js.map +1 -0
  73. package/dist/version.d.ts +2 -0
  74. package/dist/version.d.ts.map +1 -0
  75. package/dist/version.js +2 -0
  76. package/dist/version.js.map +1 -0
  77. package/docs/commands.md +227 -0
  78. package/docs/configuration.md +18 -0
  79. package/docs/dev/DESIGN.md +13 -0
  80. package/docs/dev/TESTING.md +16 -0
  81. package/docs/dev/design-questions.md +24 -0
  82. package/docs/dev/reference-clis.md +15 -0
  83. package/docs/dev/skills/design-interview/SKILL.md +34 -0
  84. package/docs/dev/skills/release/SKILL.md +24 -0
  85. package/docs/dev/test-matrix.md +52 -0
  86. package/docs/index.md +7 -0
  87. package/docs/installation.md +17 -0
  88. package/docs/meta.json +18 -0
  89. package/docs/security.md +8 -0
  90. package/docs/troubleshooting.md +14 -0
  91. package/docs/usage.md +31 -0
  92. package/kit/README.md +123 -0
  93. package/kit/dist/interview.js +170 -0
  94. package/kit/dist/main.js +70 -0
  95. package/kit/dist/manifest.js +111 -0
  96. package/kit/dist/new.js +249 -0
  97. package/kit/dist/rename.js +35 -0
  98. package/kit/dist/source.js +74 -0
  99. package/kit/dist/upgrade.js +223 -0
  100. package/kit/tsconfig.json +17 -0
  101. package/kit/tsconfig.test.json +5 -0
  102. package/lefthook.yml +2 -0
  103. package/lint/baseline/.gitkeep +0 -0
  104. package/lint/overrides.json +1 -0
  105. package/package.json +105 -4
  106. package/pnpm-workspace.yaml +6 -0
  107. package/scripts/audit.sh +22 -0
  108. package/scripts/command-program.ts +1 -0
  109. package/scripts/commands.ts +39 -0
  110. package/scripts/smoke.ts +56 -0
  111. package/scripts/test-matrix-untested.ts +12 -0
  112. package/skills/app-cli/SKILL.md +21 -0
  113. package/src/bin/app.ts +13 -0
  114. package/src/commands/doctor.ts +45 -0
  115. package/src/commands/mcp.ts +38 -0
  116. package/src/config.ts +4 -0
  117. package/src/identity.ts +15 -0
  118. package/src/index.ts +2 -0
  119. package/src/mcp.test.ts +84 -0
  120. package/src/mcp.ts +82 -0
  121. package/src/program.test.ts +66 -0
  122. package/src/program.ts +53 -0
  123. package/src/roots.test.ts +80 -0
  124. package/src/testing/argv-log.ts +1 -0
  125. package/src/testing/sandbox.ts +25 -0
  126. package/src/version.ts +1 -0
  127. package/template.json +40 -0
  128. package/tsconfig.json +9 -0
  129. package/tsconfig.scripts.json +1 -0
  130. package/tsconfig.test.json +1 -0
  131. package/vitest.config.ts +19 -0
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,53 @@
1
- # Temporary Holding Version
1
+ # app
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ `app` is a command-line tool started from [cli-template](https://github.com/WireCatLabs/cli-template), the kit for
4
+ new WireCat CLIs. It is a working skeleton: the shared root commands, the settings, the agent skill and the MCP
5
+ server run, and every check of the WireCat standards passes. It does not connect to a service yet. Replace this page
6
+ with the tool's own introduction once it does.
7
+
8
+ To start a new CLI from the template:
9
+
10
+ ```sh
11
+ npx @wirecat/cli-template new cal-cli --command cal --package @wirecat/cal-cli --owner WireCatLabs
12
+ ```
13
+
14
+ ## Quick start
15
+
16
+ ```sh
17
+ pnpm install
18
+ pnpm build
19
+ node dist/bin/app.js personal doctor
20
+ ```
21
+
22
+ `personal` is the profile: a name you choose for one account. Every command that uses an account starts with it, and
23
+ none is ever assumed. `APP_PROFILE=personal` does the same for a whole shell session.
24
+
25
+ ## What you can do
26
+
27
+ | Command | What it does |
28
+ | --- | --- |
29
+ | `app personal doctor` | Checks this installation: version, paths, settings and profiles, without the network |
30
+ | `app commands --json` | Prints every command as JSON, for agents and scripts |
31
+ | `app personal config show` | Shows each setting and where it came from |
32
+ | `app skill install` | Installs the agent skill for Claude Code, Codex and Gemini CLI |
33
+ | `app personal mcp` | Serves the profile's commands to an AI agent over MCP |
34
+ | `app upgrade --check` | Says whether a newer version is on npm |
35
+
36
+ ## For AI agents
37
+
38
+ `app skill show` prints the rules an agent follows with this tool. `app personal mcp` serves every command to an
39
+ agent, writes included: the profile's permissions decide what runs. See [MCP and permissions](docs/usage.md#agents).
40
+
41
+ ## Documentation
42
+
43
+ - [Install](docs/installation.md)
44
+ - [Use it](docs/usage.md)
45
+ - [Settings](docs/configuration.md)
46
+ - [Commands](docs/commands.md)
47
+ - [When something goes wrong](docs/troubleshooting.md)
48
+ - [Security](docs/security.md)
49
+
50
+ ## Development
51
+
52
+ The working rules for people and agents are in [AGENTS.md](AGENTS.md). `pnpm release:check` runs every check the
53
+ standards ask for. The changes are in [CHANGELOG.md](CHANGELOG.md).
package/SECURITY.md ADDED
@@ -0,0 +1,15 @@
1
+ # Reporting a vulnerability
2
+
3
+ Please report a security problem privately — never in a public issue:
4
+
5
+ - by email: [hello@wirecat.dev](mailto:hello@wirecat.dev);
6
+ - or through [GitHub's private vulnerability reporting](https://github.com/WireCatLabs/app-cli/security/advisories/new).
7
+
8
+ Say what you saw, how to repeat it, and the version (`app --version`). Never send a token, a password or anyone's
9
+ private content.
10
+
11
+ What `app` keeps on your computer: the [shared security page](https://wirecat.dev/en/docs/security) and
12
+ [docs/security.md](docs/security.md).
13
+
14
+ Security audits of `app` follow the shared
15
+ [security method](https://github.com/WireCatLabs/cli-testing/tree/main/docs/security) in cli-testing.
package/bin/release ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env sh
2
+ # Publishes the version in package.json and tags it. Run on a clean `main` that matches origin/main; the owner runs
3
+ # it, never an agent. Nothing is published until `pnpm release:check` passes.
4
+ #
5
+ # bin/release # publishes from GitHub Actions (.github/workflows/release.yml, npm trusted publishing)
6
+ # bin/release --local # publishes from this computer: NPM_TOKEN if exported, else your own `npm login`
7
+ #
8
+ # A package that is not on npm yet is published the same way; its first version needs --local until npm trusts
9
+ # release.yml. The npm token is never printed and never written to a file (WC-REL-14).
10
+ set -eu
11
+
12
+ # Keep the caller's token out of the checks and of every lifecycle script.
13
+ publish_token=${NPM_TOKEN:-}
14
+ unset NPM_TOKEN
15
+
16
+ mode=ci
17
+ for arg; do
18
+ case "$arg" in
19
+ --local) mode=local ;;
20
+ *) echo "usage: bin/release [--local]" >&2; exit 2 ;;
21
+ esac
22
+ done
23
+
24
+ cd "$(dirname "$0")/.."
25
+ self=$(git hash-object bin/release)
26
+ # The fold fast-forwards main, and sh reads this file as it goes: a newer bin/release would run half old, half new.
27
+ rerun_if_changed() {
28
+ [ "$(git hash-object bin/release)" != "$self" ] || return 0
29
+ [ -z "${WIRECAT_RELEASE_RERUN:-}" ] || { echo "bin/release changed again while releasing — run it again" >&2; exit 1; }
30
+ echo "bin/release changed on main — running the new one"
31
+ export WIRECAT_RELEASE_RERUN=1
32
+ NPM_TOKEN="$publish_token" exec ./bin/release "$@"
33
+ }
34
+
35
+ git fetch -q --tags origin
36
+ [ "$(git branch --show-current)" = main ] || { echo "run from main" >&2; exit 1; }
37
+ [ -z "$(git status --porcelain --untracked-files=no)" ] || { echo "uncommitted changes" >&2; exit 1; }
38
+ [ "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)" ] || { echo "update main to origin/main first" >&2; exit 1; }
39
+ # One release at a time per package on this machine (WC-REL-3).
40
+ . ./config/wirecat/release-lock.sh
41
+ wirecat_release_lock "${WIRECAT_RELEASE_WAIT_SECONDS:-0}"
42
+ git fetch -q origin
43
+ [ "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)" ] || { echo "main changed while waiting; update main first" >&2; exit 1; }
44
+
45
+ pnpm install --frozen-lockfile
46
+ package=$(node -p 'require("./package.json").name')
47
+ version=$(node -p 'require("./package.json").version')
48
+ # A 404 for a package npm has never seen is "not published", like any other failure of `npm view`.
49
+ published() {
50
+ npm view "$package@$version" version --prefer-online >/dev/null 2>&1
51
+ }
52
+
53
+ # A merge after the version was dated, but before it was published, adds Unreleased above it; --land folds it on a
54
+ # fresh main through its own pull request.
55
+ folded=""
56
+ published || folded=$(pnpm exec cli-dev changelog fold --land --version "$version")
57
+ [ -z "$folded" ] || echo "$folded"
58
+ rerun_if_changed "$@"
59
+ top=$(sed -n '/^## /{p;q;}' CHANGELOG.md)
60
+ case "$top" in
61
+ "## $version — "[0-9][0-9].[0-9][0-9].[0-9][0-9][0-9][0-9]) ;;
62
+ *) echo "date the top changelog section as \"## $version — DD.MM.YYYY\" in a pull request before releasing" >&2; exit 1 ;;
63
+ esac
64
+ if published; then
65
+ echo "$package@$version is already on npm; raise the version in a pull request" >&2
66
+ exit 1
67
+ fi
68
+
69
+ echo "== checks for $version =="
70
+ pnpm release:check
71
+
72
+ if [ "$mode" = ci ]; then
73
+ last_run() {
74
+ gh run list --workflow release.yml --branch main --event workflow_dispatch --limit 1 \
75
+ --json databaseId --jq '.[0].databaseId // ""'
76
+ }
77
+ previous=$(last_run)
78
+ gh workflow run release.yml --ref main -f commit="$(git rev-parse HEAD)"
79
+ run=""
80
+ for _ in $(seq 30); do
81
+ run=$(last_run)
82
+ [ -n "$run" ] && [ "$run" != "$previous" ] && break
83
+ run=""
84
+ sleep 2
85
+ done
86
+ [ -n "$run" ] || { echo "the release workflow did not start within a minute — see gh run list --workflow release.yml" >&2; exit 1; }
87
+ if ! gh run watch "$run" --exit-status; then
88
+ echo "release failed; inspect: gh run view $run --log-failed" >&2
89
+ echo "a package npm does not trust yet publishes its first version with bin/release --local" >&2
90
+ exit 1
91
+ fi
92
+ git fetch -q --tags origin
93
+ echo "published $package@$version"
94
+ exit 0
95
+ fi
96
+
97
+ # Our own npm config names the variable, not the value, so the token stays in the publish process's environment.
98
+ # Without NPM_TOKEN, npm reads your own login from ~/.npmrc as usual.
99
+ config=$(mktemp)
100
+ trap 'rm -f "$config"' EXIT
101
+ if [ -n "$publish_token" ]; then
102
+ # shellcheck disable=SC2016 # npm resolves the variable only in the publish process.
103
+ printf '//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n' > "$config"
104
+ set -- --userconfig "$config"
105
+ else
106
+ npm whoami >/dev/null 2>&1 || { echo "not logged in to npm: run npm login, or export NPM_TOKEN" >&2; exit 1; }
107
+ set --
108
+ fi
109
+
110
+ echo "== local validation for $version =="
111
+ pnpm contracts:check
112
+ pnpm security:no-leak
113
+ pnpm smoke
114
+ command -v gitleaks >/dev/null 2>&1 || { echo "gitleaks is not installed; it scans the history before publishing" >&2; exit 1; }
115
+ gitleaks git --log-opts=HEAD --no-banner --redact --exit-code 1 .
116
+ pnpm audit --prod --audit-level high
117
+
118
+ echo "== publishing $package@$version =="
119
+ pnpm build
120
+ NPM_TOKEN="$publish_token" npm publish --access public --ignore-scripts "$@"
121
+
122
+ echo "== waiting for npm to show $version (up to fifteen minutes) =="
123
+ seen=""
124
+ for _ in $(seq 90); do
125
+ if published; then seen=1; break; fi
126
+ sleep 10
127
+ done
128
+ [ -n "$seen" ] || {
129
+ echo "npm does not show $version after fifteen minutes — not tagging. Once it does, on $(git rev-parse HEAD):" >&2
130
+ echo " git tag -a v$version -m $version && git push origin v$version" >&2
131
+ exit 1
132
+ }
133
+
134
+ # The same tag and GitHub release that release.yml's tag job makes (WC-REL-13).
135
+ git tag -a "v$version" -m "$version"
136
+ git push -q origin "v$version"
137
+ awk -v v="$version" '$0 ~ "^## "v" " {on=1; next} /^## / && on {exit} on' CHANGELOG.md |
138
+ gh release create "v$version" --title "$version" --notes-file -
139
+ echo "published $package@$version"
package/biome.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "files": {
3
+ "includes": ["**", "!**/node_modules", "!**/dist", "!.worktrees", "!pnpm-lock.yaml", "!config/wirecat"]
4
+ },
5
+ "extends": ["./config/wirecat/biome.base.json"]
6
+ }
@@ -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.