@k-msg/cli 0.8.17 → 0.9.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +43 -0
  3. package/package.json +13 -11
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @k-msg/cli
2
2
 
3
+ ## 0.9.1 — 2026-03-01
4
+
5
+ ### Patch changes
6
+
7
+ - [52275fb](https://github.com/k-otp/k-msg/commit/52275fb36874dc9445637931d524cb46af37d835) Automatically configure shell completion during curl installer runs for detected `zsh`, `bash`, and `fish` shells.
8
+
9
+ - Add installer flags:
10
+ - `K_MSG_CLI_SETUP_COMPLETIONS` (`true` by default, set `false` to opt out)
11
+ - `K_MSG_CLI_SHELL` (override shell detection for completion setup)
12
+ - Resolve shell init targets by shell context:
13
+ - `zsh`: `${ZDOTDIR:-$HOME}/.zshrc`
14
+ - `bash`: `~/.bashrc` + login profile (`~/.bash_profile` or `~/.profile`)
15
+ - `fish`: completion file under `~/.config/fish/completions`
16
+ - Register completion alias for `kmsg` alongside `k-msg`.
17
+ - Print shell reload hints after completion setup to reduce post-install confusion.
18
+ - Keep install success resilient by warning instead of failing when completion setup cannot be applied. — Thanks @imjlk!
19
+
20
+ ## 0.9.0 — 2026-03-01
21
+
22
+ ### Minor changes
23
+
24
+ - [ee90600](https://github.com/k-otp/k-msg/commit/ee90600cc60e349544edee57101d5ae88002c7e0) Migrate `@k-msg/cli` to Bunli 0.7.1 and adopt the 0.7 command model.
25
+
26
+ - Convert command trees to `defineGroup` for Bunli 0.7.x compatibility.
27
+ - Add runtime-safe shell completions via `k-msg completions <bash|zsh|fish|powershell>` and `k-msg complete -- ...`.
28
+ - Replace custom readline/arrow interactive flows with Bunli/Clack prompt APIs.
29
+ - Standardize interactive cancellation (`Ctrl+C`) to exit with code `2`.
30
+ - Add completion validation/smoke checks in CI and CLI distribution workflows. — Thanks @imjlk!
31
+
3
32
  ## 0.8.17 — 2026-02-28
4
33
 
5
34
  ### Patch changes
package/README.md CHANGED
@@ -14,16 +14,27 @@ Installer environment variables:
14
14
  - `K_MSG_CLI_VERSION`: override target version (default: latest Pages script version)
15
15
  - `K_MSG_CLI_INSTALL_DIR`: target directory override (default: auto-detect active `k-msg` directory when writable, otherwise `~/.local/bin`)
16
16
  - `K_MSG_CLI_BASE_URL`: override release base URL (default: `https://github.com/k-otp/k-msg/releases/download/cli-v<version>`)
17
+ - `K_MSG_CLI_SETUP_COMPLETIONS`: set `false` to skip automatic shell completion setup (default: `true`)
18
+ - `K_MSG_CLI_SHELL`: override shell detection for completion setup (`zsh|bash|fish`)
17
19
 
18
20
  The project now standardizes user-facing CLI installation on the curl installer path.
19
21
  Other install paths are intentionally undocumented here.
20
22
 
23
+ By default, the installer also auto-configures shell completion for detected `zsh`, `bash`, or `fish`.
24
+ It resolves shell init files by context:
25
+ - `zsh`: `${ZDOTDIR:-$HOME}/.zshrc`
26
+ - `bash`: `~/.bashrc` plus login profile (`~/.bash_profile` or `~/.profile`)
27
+ - `fish`: `~/.config/fish/completions/k-msg.fish`
28
+
21
29
  ## Run (local/dev)
22
30
 
23
31
  ```bash
24
32
  # Generate command types
25
33
  bun run --cwd apps/cli generate
26
34
 
35
+ # Validate completion metadata graph (strict)
36
+ bun run --cwd apps/cli doctor:completions
37
+
27
38
  # Build native binary
28
39
  bun run --cwd apps/cli build
29
40
  ./apps/cli/dist/k-msg --help
@@ -36,6 +47,36 @@ bun --cwd apps/cli dist/k-msg.js --help
36
47
  bun --cwd apps/cli src/k-msg.ts --help
37
48
  ```
38
49
 
50
+ ## Shell Completions
51
+
52
+ If installed via curl installer, completion is configured automatically for your detected shell.
53
+ Use manual setup only when you want custom paths or a non-default shell setup.
54
+ Installer-generated completion also covers the `kmsg` alias.
55
+
56
+ ```bash
57
+ # Print completion script
58
+ k-msg completions bash
59
+ k-msg completions zsh
60
+ k-msg completions fish
61
+ k-msg completions powershell
62
+
63
+ # Completion protocol callback (used by shell scripts)
64
+ k-msg complete -- ""
65
+ ```
66
+
67
+ Shell init examples:
68
+
69
+ ```bash
70
+ # bash
71
+ k-msg completions bash > ~/.bash_completion.d/k-msg
72
+ source ~/.bash_completion.d/k-msg
73
+
74
+ # zsh
75
+ k-msg completions zsh > "${HOME}/.zfunc/_k-msg"
76
+ fpath+=("${HOME}/.zfunc")
77
+ autoload -Uz compinit && compinit
78
+ ```
79
+
39
80
  ## Config (`k-msg.config.json`)
40
81
 
41
82
  Default config path:
@@ -129,6 +170,7 @@ Required values by provider/channel:
129
170
  - `k-msg providers list|health|doctor`
130
171
  - `k-msg sms send`
131
172
  - `k-msg alimtalk preflight|send`
173
+ - `k-msg completions <bash|zsh|fish|powershell>`
132
174
  - `k-msg send --input <json> | --file <path> | --stdin` (advanced/raw JSON only)
133
175
  - `k-msg db schema print|generate`
134
176
  - `k-msg db tracking migrate plan|apply|status|retry`
@@ -347,6 +389,7 @@ k-msg kakao template request --template-id TPL_001 --channel main
347
389
  - exit code:
348
390
  - `0`: success
349
391
  - `2`: input/config error
392
+ - `2`: interactive prompt cancelled (`Ctrl+C`)
350
393
  - `3`: provider/network error
351
394
  - `4`: unsupported capability (for example, provider does not support `balance`)
352
395
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@k-msg/cli",
3
- "version": "0.8.17",
3
+ "version": "0.9.1",
4
4
  "private": false,
5
5
  "description": "k-msg CLI (prebuilt binaries via GitHub Releases)",
6
6
  "type": "module",
@@ -21,6 +21,7 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "generate": "bunli generate",
24
+ "doctor:completions": "bun run generate && bunx bunli@0.7.1 doctor completions --strict",
24
25
  "build": "bunli build",
25
26
  "build:all": "bunli build --targets all",
26
27
  "build:native": "bunli build --targets native",
@@ -33,18 +34,19 @@
33
34
  "clean": "rm -rf dist"
34
35
  },
35
36
  "devDependencies": {
36
- "@k-msg/channel": "0.22.3",
37
- "@k-msg/core": "0.22.3",
38
- "@k-msg/messaging": "0.22.3",
39
- "@k-msg/provider": "0.22.3",
40
- "@k-msg/template": "0.22.3",
41
- "@bunli/core": "^0.5.4",
42
- "@bunli/plugin-ai-detect": "^0.5.2",
43
- "@bunli/test": "^0.3.2",
37
+ "@bunli/core": "^0.7.0",
38
+ "@bunli/plugin-ai-detect": "^0.6.2",
39
+ "@bunli/plugin-completions": "^0.3.3",
40
+ "@bunli/test": "^0.4.2",
41
+ "@k-msg/channel": "0.28.0",
42
+ "@k-msg/core": "0.28.0",
43
+ "@k-msg/messaging": "0.28.0",
44
+ "@k-msg/provider": "0.28.0",
45
+ "@k-msg/template": "0.28.0",
44
46
  "@types/bun": "^1.3.9",
45
47
  "@types/node": "^22.0.0",
46
- "bunli": "^0.5.3",
47
- "k-msg": "0.22.3",
48
+ "bunli": "^0.7.1",
49
+ "k-msg": "0.28.0",
48
50
  "solapi": "^5.5.4",
49
51
  "typescript": "^5.7.2",
50
52
  "zod": "^4.0.14"