@wirecat/cli-base 0.43.5 → 0.44.1
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/dist/commands/document.d.ts.map +1 -1
- package/dist/commands/document.js +2 -0
- package/dist/commands/document.js.map +1 -1
- package/dist/commands/index.d.ts +9 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +10 -6
- package/dist/commands/index.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/dev/audit.d.ts.map +1 -1
- package/dist/dev/audit.js +6 -2
- package/dist/dev/audit.js.map +1 -1
- package/dist/dev/lint.d.ts.map +1 -1
- package/dist/dev/lint.js +3 -0
- package/dist/dev/lint.js.map +1 -1
- package/dist/query/parser.d.ts.map +1 -1
- package/dist/query/parser.js +6 -1
- package/dist/query/parser.js.map +1 -1
- package/dist/result-fields.d.ts.map +1 -1
- package/dist/result-fields.js +2 -1
- package/dist/result-fields.js.map +1 -1
- package/dist/standards/flags-how.d.ts.map +1 -1
- package/dist/standards/flags-how.js +13 -0
- package/dist/standards/flags-how.js.map +1 -1
- package/dist/standards/lint.d.ts.map +1 -1
- package/dist/standards/lint.js +6 -0
- package/dist/standards/lint.js.map +1 -1
- package/dist/standards/vocabulary.d.ts.map +1 -1
- package/dist/standards/vocabulary.js +1 -0
- package/dist/standards/vocabulary.js.map +1 -1
- package/docs/standards/README.md +1 -1
- package/docs/standards/architecture.md +4 -2
- package/docs/standards/ci.md +5 -3
- package/docs/standards/commands.md +1 -1
- package/docs/standards/docs.md +2 -2
- package/docs/standards/layout.md +1 -0
- package/docs/standards/lifecycle.md +4 -1
- package/docs/standards/new-cli.md +8 -4
- package/docs/standards/output.md +8 -4
- package/docs/standards/permissions.md +8 -5
- package/docs/standards/releases.md +3 -1
- package/docs/standards/security.md +9 -3
- package/docs/standards/style.md +3 -1
- package/docs/standards/testing.md +9 -4
- package/docs/standards/toolchain.md +17 -2
- package/package.json +1 -1
package/docs/standards/style.md
CHANGED
|
@@ -35,7 +35,9 @@ formatting, so this page does not repeat it.
|
|
|
35
35
|
- **Enforced by:** review only.
|
|
36
36
|
- **Example:** `src/format-markdown.ts` and `src/format-markdown.test.ts`. A test that covers a behaviour across
|
|
37
37
|
modules is named after that behaviour, such as `src/every-failure.test.ts`.
|
|
38
|
-
- **Exceptions:**
|
|
38
|
+
- **Exceptions:** a language whose toolchain reads meaning from a file name keeps that language's form. Go files are
|
|
39
|
+
lower case with underscores, because `go test` finds `_test.go` and the build picks `_unix.go` or `_windows.go`
|
|
40
|
+
by name: wa's `engine/cmd/wa-engine/lock_unix.go` and `convert_test.go`.
|
|
39
41
|
- **Applies to:** all repositories. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
40
42
|
|
|
41
43
|
### WC-STYLE-4 · Write functions in the small, and a class only where identity matters
|
|
@@ -47,14 +47,17 @@ and which run after merge is in [CI](ci.md).
|
|
|
47
47
|
- **Applies to:** all CLIs and the shared packages. cli-base uses the shared setup; the CLIs keep their own sandboxes
|
|
48
48
|
for now. drive has none yet, and zoom's moves only the temporary directory. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
49
49
|
|
|
50
|
-
### WC-TEST-2 · No test
|
|
50
|
+
### WC-TEST-2 · No test opens a real credential store
|
|
51
51
|
|
|
52
|
-
- **Why:** the owner's tokens live in the real keychain, and
|
|
53
|
-
|
|
52
|
+
- **Why:** the owner's tokens live in the real keychain, and a messenger's device keys in a file of their own; one
|
|
53
|
+
test that forgets an option would read or write the real one.
|
|
54
|
+
- **Enforced by:** `src/keyring.test.ts` · `whatsapp-cli: src/testing/sandbox.test.ts`.
|
|
54
55
|
- **Example:** every test passes `memoryKeyring()` from `@wirecat/cli-base/testing`. The shared setup
|
|
55
56
|
(`@wirecat/cli-base/testing/setup`, [WC-TEST-1](#wc-test-1--point-every-path-a-test-could-write-at-a-temporary-directory))
|
|
56
57
|
also replaces `@napi-rs/keyring` with a module that throws, so a forgotten option fails the test instead of
|
|
57
58
|
reaching the keychain, and `src/keyring.test.ts` asserts that `systemKeyring` throws under it.
|
|
59
|
+
A credential store that is a file, such as WhatsApp's linked-device keys in `private.db`, resolves under the
|
|
60
|
+
sandbox's state directory, and a sandbox test asserts that its path is inside the temporary root, as wa's does.
|
|
58
61
|
- **Exceptions:** none. Until a CLI adopts the shared setup, its sandbox does not replace `@napi-rs/keyring`; tg and
|
|
59
62
|
max only scope the keyring entry through environment variables.
|
|
60
63
|
- **Applies to:** all CLIs and the shared packages. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
@@ -220,7 +223,9 @@ and which run after merge is in [CI](ci.md).
|
|
|
220
223
|
- **Example:** live scenarios run by hand, by the owner or with the owner's yes, on test profiles and test chats
|
|
221
224
|
only. The cast lives in an ignored file, no profile is assumed, and the record keeps the shape of each answer,
|
|
222
225
|
never its content. When a scenario is run again, the sentence it supports is updated.
|
|
223
|
-
- **Exceptions:**
|
|
226
|
+
- **Exceptions:** a messenger with no test accounts, such as WhatsApp, where a second account or a second linked
|
|
227
|
+
device would change the owner's real one, runs live scenarios on the owner's profile and only in the owner's own
|
|
228
|
+
chat (the chat with themselves). It never writes to another person, and still runs only with the owner's yes.
|
|
224
229
|
- **Applies to:** all CLIs that talk to a real account. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
225
230
|
|
|
226
231
|
## Sources
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Toolchain
|
|
2
2
|
|
|
3
|
+
<!-- cspell:ignore gofmt -->
|
|
4
|
+
|
|
3
5
|
## Scope
|
|
4
6
|
|
|
5
7
|
How a repository is built and checked before review: the shared presets and `standards:check`, strict TypeScript,
|
|
6
8
|
the shared Biome preset and its grit plugins, the file size cap, import cycles, layer boundaries as lint, the command
|
|
7
|
-
lint, spelling and
|
|
9
|
+
lint, spelling, Markdown lint, and the checks for a Go part.
|
|
8
10
|
|
|
9
11
|
Rule ids on this page are `WC-TOOL-<n>`. How to read a rule, how ids work and which rule wins are in the
|
|
10
12
|
[index](README.md). What runs on which trigger is on the [CI page](ci.md).
|
|
@@ -156,7 +158,8 @@ cli-testing, cli-docs, plus community itself.
|
|
|
156
158
|
in [WC-LAY-7](layout.md#wc-lay-7--treat-300-and-500-lines-as-review-signals).
|
|
157
159
|
- **Exceptions:** a file that is one cohesive unit may get its own override, listed by path in `biome.json` (tg
|
|
158
160
|
`src/telegram/adapter.ts`; four files in cli-core). A smaller cap is allowed: zoom uses 500. cli-base, cli-testing,
|
|
159
|
-
cli-docs and community have no cap yet.
|
|
161
|
+
cli-docs and community have no cap yet. Biome reads only JavaScript and TypeScript, so the cap does not cover
|
|
162
|
+
code in another language, such as wa's Go engine; the review signals of WC-LAY-7 still apply to it.
|
|
160
163
|
- **Applies to:** the ten repositories. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
161
164
|
|
|
162
165
|
### WC-TOOL-14 · Turn on the import cycle rule
|
|
@@ -223,6 +226,18 @@ cli-testing, cli-docs, plus community itself.
|
|
|
223
226
|
- **Exceptions:** memo, drive, cli-base and cli-core do not run `rumdl` yet.
|
|
224
227
|
- **Applies to:** the CLIs and cli-testing. **Since:** cli-base 0.41.0. **Rulings:** none.
|
|
225
228
|
|
|
229
|
+
### WC-TOOL-20 · Build a Go part with the version in `go.mod`, and check it with gofmt, vet and its tests
|
|
230
|
+
|
|
231
|
+
- **Why:** the TypeScript checks do not read Go, so a Go part with no checks of its own drifts without anyone seeing
|
|
232
|
+
it.
|
|
233
|
+
- **Enforced by:** `whatsapp-cli: engine-pr.yml:engine` · `whatsapp-cli: ci.yml:engine`.
|
|
234
|
+
- **Example:** every workflow that builds the Go part uses `actions/setup-go` with `go-version-file` pointing at its
|
|
235
|
+
`go.mod`, never a version written in the workflow. A path-scoped pull request job and full validation both run
|
|
236
|
+
`gofmt -l .` (any file listed fails), `go vet ./...` and `go test ./...` in the Go folder. wa's engine is the
|
|
237
|
+
example.
|
|
238
|
+
- **Exceptions:** none.
|
|
239
|
+
- **Applies to:** CLIs with a Go part (wa). **Since:** cli-base 0.44.0. **Rulings:** none.
|
|
240
|
+
|
|
226
241
|
## Sources
|
|
227
242
|
|
|
228
243
|
These documents explain the rules on this page in more detail. Where one of them disagrees with this page, this page
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-base",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"description": "The parts every command line tool needs: output modes, terminal rendering, error model, exit codes, credentials, clocks",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Viacheslav Ptsarev",
|