@k-leumas/queque-cli 0.8.1 → 0.9.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/README.md +21 -152
- package/dist/cli/app.js +65 -12
- package/dist/cli/app.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,110 +15,31 @@
|
|
|
15
15
|
|
|
16
16
|
**Now:** Type your intent, hit `??`, pick a command — it lands in your buffer, ready to tweak and run.
|
|
17
17
|
|
|
18
|
+

|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
Welcome to the **future** –
|
|
22
|
-
`
|
|
23
|
-
brew install k-leumas/tap/queque
|
|
24
|
-
`
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-

|
|
28
|
-
|
|
29
|
-
> [!NOTE]
|
|
30
|
-
> After install, run `qq init zsh && source ~/.zshrc` to wire up the `??` keybinding. `qq init zsh` adds the QueQue source line to the end of `~/.zshrc` itself, so do not redirect its output into the file.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<details>
|
|
34
|
-
<summary>Install via npm</summary>
|
|
35
|
-
|
|
36
|
-
## Requirements
|
|
37
|
-
|
|
38
|
-
- zsh
|
|
39
|
-
- Node.js 24 or newer
|
|
40
|
-
- [jq](https://jqlang.github.io/jq/)
|
|
41
|
-
- Claude Code signed in, an Anthropic API key, an OpenAI API key, or Ollama (see [Choose a provider](#choose-a-provider))
|
|
42
|
-
|
|
20
|
+
## Install
|
|
43
21
|
|
|
44
22
|
```shell
|
|
45
|
-
|
|
23
|
+
brew install k-leumas/tap/queque
|
|
46
24
|
qq init zsh && source ~/.zshrc
|
|
47
25
|
```
|
|
48
26
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
## Choose a provider
|
|
52
|
-
|
|
53
|
-
Claude is the default. If you already use Claude Code or have an Anthropic API key, there is nothing to set up. To use OpenAI or a local Ollama model instead (both in beta), run `qq init provider` once.
|
|
54
|
-
|
|
55
|
-
### Claude (default)
|
|
56
|
-
|
|
57
|
-
QueQue talks to Claude in one of two ways. You only need one.
|
|
58
|
-
|
|
59
|
-
**Claude Code login (no API key needed).** If you already use Claude Code, QueQue runs `claude -p` on your existing login whenever no API key is set. Sign in once through Claude Code's `/login`:
|
|
60
|
-
|
|
61
|
-
```shell
|
|
62
|
-
claude /login
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
On this route QueQue uses whatever account and default model Claude Code is set to; it passes no model flag. `claude -p` runs with its tools disabled and session persistence off, so it only answers the query. If `claude` is not signed in, `??` shows this message and puts back what you typed:
|
|
66
|
-
|
|
67
|
-
```text
|
|
68
|
-
QueQue: Claude is not authenticated. Run `claude /login`, or set ANTHROPIC_API_KEY in the environment or ~/.env.local. To use OpenAI or Ollama instead, run `qq init provider`.
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
If `claude` is not on your `PATH` at all, the message starts with `QueQue: No AI provider is ready.` and lists the same three options. Any other `claude -p` failure, such as an overloaded API or a usage limit, shows `QueQue: Claude Code could not answer (claude -p failed).`; run `claude -p "hi"` to see the underlying error.
|
|
72
|
-
|
|
73
|
-
**Anthropic API key.** QueQue looks for `ANTHROPIC_API_KEY` in this order:
|
|
74
|
-
|
|
75
|
-
1. **Environment variable**: `export ANTHROPIC_API_KEY="sk-ant-..."` in `~/.zshrc`, above the QueQue source line.
|
|
76
|
-
2. **`.env.local` file**: a line `ANTHROPIC_API_KEY=sk-ant-...` in `~/.env.local`. QueQue reads only `~/.env.local` itself: never the directory you run `??` from and never a directory above your home directory, so a `.env.local` inside a project (or in `/tmp`) is not used. The background daemon reads the file once, when it starts.
|
|
77
|
-
|
|
78
|
-
An empty or whitespace-only value counts as unset.
|
|
27
|
+
`qq init zsh` wires up the `??` keybinding and adds the QueQue source line to the end of `~/.zshrc` itself, so do not redirect its output into the file.
|
|
79
28
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
`QQ_MODEL` (in your environment or `~/.env.local`) picks the model on the API-key route only. The default is `claude-sonnet-5`.
|
|
83
|
-
|
|
84
|
-
### OpenAI or Ollama (beta)
|
|
85
|
-
|
|
86
|
-
Run the picker in a terminal:
|
|
29
|
+
Or with npm (needs zsh, Node.js 24 or newer and jq):
|
|
87
30
|
|
|
88
31
|
```shell
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
It asks one question (Claude, OpenAI or Ollama), saves your answer to `~/.config/qq/provider.json`, and restarts the background daemon. Nothing is probed until you answer, and `??` never asks you to choose.
|
|
93
|
-
|
|
94
|
-
- **OpenAI (beta)** needs `OPENAI_API_KEY` in your environment (`export OPENAI_API_KEY="sk-..."` in `~/.zshrc`, above the QueQue source line) or in `~/.env.local`. Set the key first, open a new terminal, then run `qq init provider`. QueQue never asks for the key and never stores it: `provider.json` only records that you chose OpenAI. The default model is `gpt-5.5`.
|
|
95
|
-
- **Ollama (beta)** lists the models you have already pulled and pins the one you pick. If Ollama is not running, the picker prints the download link and `ollama serve`. If it has no models, the picker tells you to run `ollama pull`. When `provider.json` has a `baseUrl` (a remote server), the picker lists and keeps that server; to go back to Ollama on this machine, remove `baseUrl` from `provider.json`.
|
|
96
|
-
|
|
97
|
-
Your choice sticks. If the chosen provider fails, `??` shows that provider's error; QueQue never switches to a different provider on its own. Run `qq init provider` again to switch, including back to Claude.
|
|
98
|
-
|
|
99
|
-
Every provider gets 25 seconds per `??`. If an OpenAI or Ollama answer is cut off before a full command, QueQue asks the same provider once more within those same 25 seconds. If the second try also falls short, you get the commands that did arrive, or a "cut off" message when none did. When an OpenAI model rejects one of QueQue's request settings, QueQue re-sends without it and remembers that for the model until the daemon restarts.
|
|
100
|
-
|
|
101
|
-
`provider.json` is plain JSON you can edit by hand, and QueQue reads it again on every `??`:
|
|
102
|
-
|
|
103
|
-
```json
|
|
104
|
-
{"version":1,"provider":"ollama","model":"gemma4"}
|
|
32
|
+
npm install -g @k-leumas/queque-cli
|
|
33
|
+
qq init zsh && source ~/.zshrc
|
|
105
34
|
```
|
|
106
35
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
### After changing your key or settings
|
|
36
|
+
See [Install](https://github.com/k-leumas/queque/blob/main/docs/INSTALL.md) for the full requirements.
|
|
110
37
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
- `qq init provider` restarts the daemon for you, so running it after exporting a new key is enough.
|
|
38
|
+
## Choose a provider
|
|
114
39
|
|
|
115
|
-
|
|
116
|
-
- After changing any of them, restart the daemon from a shell that has the new values:
|
|
40
|
+
Claude is the default. If you already use Claude Code (signed in with `claude /login`) or have an Anthropic API key (`ANTHROPIC_API_KEY`), there is nothing to set up. To use OpenAI or a local Ollama model instead (both in beta), run `qq init provider`.
|
|
117
41
|
|
|
118
|
-
|
|
119
|
-
pkill -f 'daemon --socket /tmp/qq-'
|
|
120
|
-
qq daemon --ensure
|
|
121
|
-
```
|
|
42
|
+
See [Choose a provider](https://github.com/k-leumas/queque/blob/main/docs/PROVIDERS.md) for keys, models and restarting the daemon.
|
|
122
43
|
|
|
123
44
|
## Usage
|
|
124
45
|
|
|
@@ -130,68 +51,16 @@ find docker containers using port 3000??
|
|
|
130
51
|
git undo last commit but keep changes??
|
|
131
52
|
```
|
|
132
53
|
|
|
133
|
-
A
|
|
134
|
-
|
|
135
|
-
Press `Esc` to cancel. It stops the request to the provider and restores what you were typing, so you can tweak your intent and hit `??` again.
|
|
136
|
-
|
|
137
|
-
A command that matches a destructive pattern (`rm`, `sudo` and similar) is marked `⚠ review carefully — this command may be destructive`. The mark is a warning only; the row stays selectable.
|
|
138
|
-
|
|
139
|
-
### Installed-tool awareness
|
|
140
|
-
|
|
141
|
-
On every `??`, zsh refreshes its list of the commands it can find (`rehash`), so a tool you installed a moment ago in the same shell counts. QueQue uses that list in two ways.
|
|
142
|
-
|
|
143
|
-
**It tells the provider which well-known tools you have.** QueQue ships a fixed catalog of 196 public command-line tool names that have common alternatives, such as `rg`, `fd`, `bat`, `jq` and `kubectl`. The request includes only the catalog tools you have installed, with instructions to prefer them, to make at least one suggestion that uses only installed tools, and never to suggest install steps. The catalog mostly leaves out basic utilities such as `ls`, `grep` and `find`; the provider is told those are present. Nothing outside the catalog is sent: the rest of your `PATH`, your shell functions and your aliases stay on your machine. The catalog is checked twice, once before the request leaves the client and again just before the prompt is built, so a name that is not in it never reaches a provider.
|
|
144
|
-
|
|
145
|
-
**It marks suggestions that need a missing tool.** This check runs locally, against the full list. A row that needs a tool zsh cannot find gets `ⓘ` before its explanation, and the legend reads `ⓘ not installed`. The row stays selectable. When QueQue knows how to install that tool with brew, apt, dnf or pacman, the legend adds `tab prepends the install command`: press `Tab` (or `Shift+Tab`) on the row to switch it to the install form, and again to switch back. The install form is inserted like any other command, never run.
|
|
146
|
-
|
|
147
|
-
Set `QQ_TOOL_AWARENESS=0` in your shell to turn off both: no tool names are sent and no rows are marked.
|
|
148
|
-
|
|
149
|
-
### Inside Zellij
|
|
150
|
-
|
|
151
|
-
QueQue detects Zellij automatically and opens in a floating pane instead of inline. Same trigger, same result, better layout.
|
|
152
|
-
|
|
153
|
-
Set `QQ_PANE_WIDTH` (default `80`) and `QQ_PANE_HEIGHT` (default `24`) to resize the floating pane.
|
|
154
|
-
|
|
155
|
-
Without Zellij, QueQue falls back to an inline TUI in your current terminal session.
|
|
156
|
-
|
|
157
|
-
## Privacy defaults
|
|
158
|
-
|
|
159
|
-
QueQue is **insertion-only**: it writes commands into your shell buffer — you press Enter to run them. QueQue never auto-executes suggestions.
|
|
160
|
-
|
|
161
|
-
**What leaves your machine (Claude and OpenAI, hosted).** The provider you chose receives the same context, whichever it is: Claude (through `claude -p` or the API key) or OpenAI (through `OPENAI_API_KEY`). Only that one provider receives it:
|
|
162
|
-
|
|
163
|
-
- Your query text and current working directory
|
|
164
|
-
- Your OS platform name (for example `darwin` or `linux`) and shell name (`zsh`)
|
|
165
|
-
- Git metadata (repository root path, branch, dirty flag, changed file *names* — not file contents)
|
|
166
|
-
- Parsed filename hints from your query (no disk reads)
|
|
167
|
-
- The names of installed tools that appear in QueQue's public catalog of 196 well-known tools (see [Installed-tool awareness](#installed-tool-awareness)). The rest of your `PATH`, your function names and your alias names stay on your machine. `QQ_TOOL_AWARENESS=0` stops even the catalog names.
|
|
168
|
-
|
|
169
|
-
**With Ollama**, the same context goes only to your Ollama server (`http://localhost:11434` by default, or the `baseUrl` in `provider.json`). With the default setting, nothing leaves your machine. A `baseUrl` that starts with `http://` and names another machine sends that context across the network unencrypted; for a remote server, use an `https://` URL (for example behind a reverse proxy).
|
|
170
|
-
|
|
171
|
-
**What QueQue never sends:**
|
|
172
|
-
|
|
173
|
-
- File contents. `QQ_ALLOW_FILE_READ=1` is reserved for a future opt-in and reads nothing today.
|
|
174
|
-
- Paths matching sensitive patterns (`.env`, credentials, `.pem`, `id_rsa`, `.ssh/`, `.aws/`, `secret`) are stripped from git context
|
|
175
|
-
|
|
176
|
-
**Debug logging:** The client and daemon append short diagnostics to `/tmp/qq-<uid>-debug.log`, or to the file named by `QQ_DEBUG_LOG_FILE`. Shell buffer and query text are redacted unless `QQ_DEBUG_VERBOSE=1`. The zsh widget adds its own lines only when `QQ_DEBUG_LOG_FILE` is set. The log stays on your machine.
|
|
177
|
-
|
|
178
|
-
**User config:** Copy [docs/config.example.json](docs/config.example.json) to `~/.config/qq/config.json` to add extra sensitive path patterns, log redaction keys, or destructive-command warnings. Built-in defaults always apply — your patterns are merged on top. Override the file path with `QQ_CONFIG_FILE`: a leading `~/` means your home directory, and a relative path is resolved against your home directory. Malformed `config.json` is ignored with a warning; QueQue falls back to built-in defaults (fail-closed).
|
|
179
|
-
|
|
180
|
-
See [docs/EXTENSIONS.md](docs/EXTENSIONS.md) for the expansion path (local learning, multi-provider, plugins).
|
|
181
|
-
|
|
182
|
-
## Configuration reference
|
|
183
|
-
|
|
184
|
-
Copy [docs/config.example.json](docs/config.example.json) to `~/.config/qq/config.json` (or set `QQ_CONFIG_FILE`). Field meanings:
|
|
185
|
-
|
|
186
|
-
| Field | Type | Purpose |
|
|
187
|
-
|-------|------|---------|
|
|
188
|
-
| `effort` | `"low" \| "medium" \| "high" \| "xhigh" \| "max"` | Claude effort for `claude -p` (`--effort`) and for the API-key SDK path, which sends it as `output_config.effort`. The SDK path omits it when `QQ_MODEL` names a model without effort support (Haiku 4.5, Sonnet 4.5 or older); a level that a `QQ_MODEL` model does not support (for example `xhigh` on Opus 4.5) is your responsibility. Default `low`. Trimmed and case-insensitive; invalid values fall back to `low` without affecting the rest of the file. Takes effect after a [daemon restart](#after-changing-your-key-or-settings), because the daemon reads config.json once. OpenAI and Ollama ignore it. |
|
|
189
|
-
| `privacy.sensitivePathPatterns` | `string[]` | Extra regex patterns merged onto built-in defaults (`.env`, credentials, keys, etc.). Built-in patterns are never removed. An invalid pattern, or one longer than 256 characters, is skipped. |
|
|
190
|
-
| `privacy.redactLogKeys` | `string[]` | Extra JSON keys to redact in debug logs (merged with defaults: `lbuffer`, `rbuffer`, `queryText`, `request`). |
|
|
191
|
-
| `privacy.allowFileRead` | `boolean` | Opt-in gate for future file-content context. Env `QQ_ALLOW_FILE_READ=1` overrides this. No file reads in v1. |
|
|
192
|
-
| `privacy.useGitignore` | `boolean` | Reserved for future gitignore-based filtering. Ignored today. |
|
|
193
|
-
| `safety.destructiveCommandPatterns` | `string[]` | Extra warn-only UI patterns merged onto built-in defaults (`rm`, `sudo`, `chmod -R`, writes to `/dev/`, `curl` or `wget` piped to `sh`). The same skip rule applies. |
|
|
54
|
+
A picker opens in your terminal: move with the arrow keys and press `Enter`. The command lands in your buffer exactly as shown, ready to run or edit; QueQue never runs it for you. `Esc` cancels and restores what you typed.
|
|
194
55
|
|
|
195
|
-
See [
|
|
56
|
+
See [Usage](https://github.com/k-leumas/queque/blob/main/docs/USAGE.md) for filtering, destructive-command warnings, installed-tool awareness and Zellij.
|
|
196
57
|
|
|
58
|
+
## More
|
|
197
59
|
|
|
60
|
+
- [Install](https://github.com/k-leumas/queque/blob/main/docs/INSTALL.md): requirements, Homebrew and npm.
|
|
61
|
+
- [Choose a provider](https://github.com/k-leumas/queque/blob/main/docs/PROVIDERS.md): Claude Code login, API keys, OpenAI and Ollama (beta), restarting the daemon.
|
|
62
|
+
- [Usage](https://github.com/k-leumas/queque/blob/main/docs/USAGE.md): the picker, installed-tool awareness, Zellij.
|
|
63
|
+
- [Privacy](https://github.com/k-leumas/queque/blob/main/docs/PRIVACY.md): what leaves your machine, debug logging, opt-in anonymous telemetry.
|
|
64
|
+
- [Configuration](https://github.com/k-leumas/queque/blob/main/docs/CONFIGURATION.md): the `config.json` fields.
|
|
65
|
+
- [System design](https://github.com/k-leumas/queque/blob/main/docs/SYSTEM_DESIGN.md) and [Extensions](https://github.com/k-leumas/queque/blob/main/docs/EXTENSIONS.md): architecture and extension seams.
|
|
66
|
+
- [Contributing](https://github.com/k-leumas/queque/blob/main/CONTRIBUTING.md): development setup and developer-only settings.
|
package/dist/cli/app.js
CHANGED
|
@@ -60002,9 +60002,14 @@ var ipcResponseSchema = external_exports.discriminatedUnion("kind", [
|
|
|
60002
60002
|
// prompt to Claude even when the user pinned a local provider.
|
|
60003
60003
|
providerPin: external_exports.literal(true).optional(),
|
|
60004
60004
|
// Daemon buffers `telemetry-event` and answers `telemetry-show`/`telemetry-reset` (phase
|
|
60005
|
-
// 10).
|
|
60006
|
-
//
|
|
60007
|
-
telemetry: external_exports.literal(true).optional()
|
|
60005
|
+
// 10). The flag alone never triggers a replacement, but a daemon that lacks it is from an
|
|
60006
|
+
// older build, and it is replaced for the build mismatch (quick 261030-tq3).
|
|
60007
|
+
telemetry: external_exports.literal(true).optional(),
|
|
60008
|
+
// The daemon's `__QUEQUE_BUILD_ID__` (quick 261030-tq3). Absent on daemons from before
|
|
60009
|
+
// 261030-tq3. A malformed value becomes undefined (read as another build) instead of
|
|
60010
|
+
// rejecting the pong: a rejected pong would read as 'unknown', and an 'unknown' daemon is
|
|
60011
|
+
// kept.
|
|
60012
|
+
build: external_exports.string().max(128).optional().catch(void 0)
|
|
60008
60013
|
}),
|
|
60009
60014
|
external_exports.object({
|
|
60010
60015
|
kind: external_exports.literal("session-ready"),
|
|
@@ -60131,8 +60136,21 @@ function pingDaemonFetchCap(socketPath2) {
|
|
|
60131
60136
|
done("unknown");
|
|
60132
60137
|
return;
|
|
60133
60138
|
}
|
|
60134
|
-
const
|
|
60135
|
-
|
|
60139
|
+
const flags = response.data.fetchCandidates === true && response.data.installedTools === true && response.data.streamCandidates === true && response.data.providerPin === true;
|
|
60140
|
+
if (!flags) {
|
|
60141
|
+
done("no");
|
|
60142
|
+
return;
|
|
60143
|
+
}
|
|
60144
|
+
const build = response.data.build;
|
|
60145
|
+
if (build === "0.9.0+5b7c9b1.mvvvqpyl") {
|
|
60146
|
+
done("yes");
|
|
60147
|
+
return;
|
|
60148
|
+
}
|
|
60149
|
+
void appendDebugLog("daemon", "daemon build differs", {
|
|
60150
|
+
daemonBuild: build ?? null,
|
|
60151
|
+
clientBuild: "0.9.0+5b7c9b1.mvvvqpyl"
|
|
60152
|
+
});
|
|
60153
|
+
done("no");
|
|
60136
60154
|
});
|
|
60137
60155
|
client.on("error", () => {
|
|
60138
60156
|
done("unknown");
|
|
@@ -61710,7 +61728,7 @@ function CandidateSelect({
|
|
|
61710
61728
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { dimColor: true, children: legend.slice(MISSING_TOOL_MARK.length) })
|
|
61711
61729
|
] }),
|
|
61712
61730
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ControlsLine, {}),
|
|
61713
|
-
process.env.QQ_DEV_ROOT != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: `dev v${"0.
|
|
61731
|
+
process.env.QQ_DEV_ROOT != null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { justifyContent: "flex-end", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: `dev v${"0.9.0"} ${"5b7c9b1"}` }) })
|
|
61714
61732
|
] });
|
|
61715
61733
|
}
|
|
61716
61734
|
|
|
@@ -62529,7 +62547,8 @@ function startDaemonServer(socketPath2, options = {}) {
|
|
|
62529
62547
|
installedTools: true,
|
|
62530
62548
|
streamCandidates: true,
|
|
62531
62549
|
providerPin: true,
|
|
62532
|
-
telemetry: true
|
|
62550
|
+
telemetry: true,
|
|
62551
|
+
build: "0.9.0+5b7c9b1.mvvvqpyl"
|
|
62533
62552
|
});
|
|
62534
62553
|
void appendDebugLog("daemon", "replied pong");
|
|
62535
62554
|
break;
|
|
@@ -62697,7 +62716,7 @@ function createTelemetryBuffer(deps = {}) {
|
|
|
62697
62716
|
const readState = deps.readState ?? (() => readTelemetryState());
|
|
62698
62717
|
const env3 = deps.env ?? (() => process.env);
|
|
62699
62718
|
const endpointFor = deps.endpoint ?? resolveTelemetryEndpoint;
|
|
62700
|
-
const version3 = deps.version ?? "0.
|
|
62719
|
+
const version3 = deps.version ?? "0.9.0";
|
|
62701
62720
|
let events = [];
|
|
62702
62721
|
let lastSent = null;
|
|
62703
62722
|
let lastEnvironment = null;
|
|
@@ -62911,7 +62930,17 @@ function shutdownDaemon(server, connections, options = {}) {
|
|
|
62911
62930
|
}
|
|
62912
62931
|
async function daemonCommand(options) {
|
|
62913
62932
|
const sock = options.socket ?? socketPath();
|
|
62914
|
-
void appendDebugLog("daemon", "command start", {
|
|
62933
|
+
void appendDebugLog("daemon", "command start", {
|
|
62934
|
+
socket: sock,
|
|
62935
|
+
ensure: options.ensure,
|
|
62936
|
+
restart: options.restart
|
|
62937
|
+
});
|
|
62938
|
+
if (options.restart) {
|
|
62939
|
+
await restartDaemon(sock);
|
|
62940
|
+
void appendDebugLog("daemon", "restart command complete", { socket: sock });
|
|
62941
|
+
process.stdout.write("daemon restarted\n");
|
|
62942
|
+
return;
|
|
62943
|
+
}
|
|
62915
62944
|
if (options.ensure) {
|
|
62916
62945
|
await ensureDaemon(sock);
|
|
62917
62946
|
void appendDebugLog("daemon", "ensure command complete", { socket: sock });
|
|
@@ -63206,7 +63235,7 @@ function defaultDoctorDeps() {
|
|
|
63206
63235
|
uid: process.getuid?.() ?? 0,
|
|
63207
63236
|
socketPath: socketPath(),
|
|
63208
63237
|
nodeVersion: process.versions.node,
|
|
63209
|
-
qqVersion: "0.
|
|
63238
|
+
qqVersion: "0.9.0",
|
|
63210
63239
|
which: (name) => whichOnPath(name, env3.PATH),
|
|
63211
63240
|
zshVersion: async () => {
|
|
63212
63241
|
const out = await captureStdout(
|
|
@@ -63852,6 +63881,8 @@ import * as net5 from "net";
|
|
|
63852
63881
|
var DAEMON_REQUEST_TIMEOUT_MS = 500;
|
|
63853
63882
|
var USAGE = "usage: qq telemetry [status|on|off|show]";
|
|
63854
63883
|
var DAEMON_NOT_RUNNING = "daemon not running: nothing buffered";
|
|
63884
|
+
var DAEMON_NO_ANSWER = "the daemon did not answer (it may be outdated)";
|
|
63885
|
+
var DAEMON_RESTART_HINT = "restart it: qq daemon --restart";
|
|
63855
63886
|
var NO_KEY_NOTE = "note: this build has no project key, so nothing is sent";
|
|
63856
63887
|
function requestDaemonOnce(socketPath2, request, timeoutMs = DAEMON_REQUEST_TIMEOUT_MS) {
|
|
63857
63888
|
return new Promise((resolve6) => {
|
|
@@ -63905,6 +63936,9 @@ function defaultTelemetryCliDeps() {
|
|
|
63905
63936
|
socketPath: socket,
|
|
63906
63937
|
endpoint: () => resolveTelemetryEndpoint(process.env),
|
|
63907
63938
|
requestDaemon: (request) => requestDaemonOnce(socket, request),
|
|
63939
|
+
// An arrow wrapper reads the bootstrap binding at call time: tests/client-result.test.ts
|
|
63940
|
+
// mocks daemon/bootstrap.js with ensureDaemon only (see init-provider.ts).
|
|
63941
|
+
socketConnectable: (path5) => tryConnect(path5),
|
|
63908
63942
|
out: (text) => {
|
|
63909
63943
|
process.stdout.write(text);
|
|
63910
63944
|
},
|
|
@@ -63924,6 +63958,13 @@ function endpointHost(deps, endpoint) {
|
|
|
63924
63958
|
}
|
|
63925
63959
|
return "not configured";
|
|
63926
63960
|
}
|
|
63961
|
+
async function daemonIsSilent(deps) {
|
|
63962
|
+
try {
|
|
63963
|
+
return await deps.socketConnectable(deps.socketPath);
|
|
63964
|
+
} catch {
|
|
63965
|
+
return false;
|
|
63966
|
+
}
|
|
63967
|
+
}
|
|
63927
63968
|
function printStatus(deps, configPath) {
|
|
63928
63969
|
const blockedBy = telemetryBlockedBy(deps.env);
|
|
63929
63970
|
const state = readTelemetryState(configPath);
|
|
@@ -63964,6 +64005,8 @@ async function turnOff(deps, configPath) {
|
|
|
63964
64005
|
const lines = ["telemetry: off", "install id deleted"];
|
|
63965
64006
|
if (reply?.kind === "telemetry-buffer") {
|
|
63966
64007
|
lines.push("daemon buffer cleared");
|
|
64008
|
+
} else if (reply === null && await daemonIsSilent(deps)) {
|
|
64009
|
+
lines.push(`${DAEMON_NO_ANSWER}: its buffer was not cleared`, DAEMON_RESTART_HINT);
|
|
63967
64010
|
}
|
|
63968
64011
|
deps.out(`${lines.join("\n")}
|
|
63969
64012
|
`);
|
|
@@ -63971,12 +64014,22 @@ async function turnOff(deps, configPath) {
|
|
|
63971
64014
|
async function show(deps) {
|
|
63972
64015
|
const reply = await deps.requestDaemon({ kind: "telemetry-show" });
|
|
63973
64016
|
if (reply === null) {
|
|
64017
|
+
if (await daemonIsSilent(deps)) {
|
|
64018
|
+
deps.out(`${DAEMON_NO_ANSWER}: nothing shown
|
|
64019
|
+
${DAEMON_RESTART_HINT}
|
|
64020
|
+
`);
|
|
64021
|
+
return;
|
|
64022
|
+
}
|
|
63974
64023
|
deps.out(`${DAEMON_NOT_RUNNING}
|
|
63975
64024
|
`);
|
|
63976
64025
|
return;
|
|
63977
64026
|
}
|
|
63978
64027
|
if (reply.kind !== "telemetry-buffer") {
|
|
63979
|
-
deps.out(
|
|
64028
|
+
deps.out(
|
|
64029
|
+
`the daemon did not return a telemetry buffer (it may be outdated): nothing shown
|
|
64030
|
+
${DAEMON_RESTART_HINT}
|
|
64031
|
+
`
|
|
64032
|
+
);
|
|
63980
64033
|
return;
|
|
63981
64034
|
}
|
|
63982
64035
|
deps.out(`pending:
|
|
@@ -64071,7 +64124,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
64071
64124
|
cli.command("telemetry [action]", "Anonymous usage and error counts: status, on, off or show").action(async (action) => {
|
|
64072
64125
|
await telemetryCommand(action);
|
|
64073
64126
|
});
|
|
64074
|
-
cli.command("daemon").option("--socket <path>", "Unix socket path for the daemon").option("--ensure", "Ensure the daemon is running before returning").action(async (options) => {
|
|
64127
|
+
cli.command("daemon").option("--socket <path>", "Unix socket path for the daemon").option("--ensure", "Ensure the daemon is running before returning").option("--restart", "Stop the running daemon and start a fresh one from this qq").action(async (options) => {
|
|
64075
64128
|
await daemonCommand(options);
|
|
64076
64129
|
});
|
|
64077
64130
|
cli.help();
|