honeydo 0.1.2 → 0.1.4
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/package.json +1 -1
- package/packages/gcli/dist/cli.d.ts +60 -13
- package/packages/gcli/dist/cli.js +275 -92
- package/packages/gcli/dist/cli.js.map +1 -1
package/package.json
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* `gcli agy ...` routes to the agy CLI (explicit subcommand required); the
|
|
7
7
|
* claude backend can switch cc-switch providers inline via
|
|
8
8
|
* `claude -p ... --settings`. Adds value over calling the backends directly:
|
|
9
|
-
* prompt via argv or stdin (`-p -`),
|
|
10
|
-
*
|
|
9
|
+
* prompt via argv or stdin (`-p -`), a hard timeout (spawn SIGTERM), explicit
|
|
10
|
+
* exit codes, and empty-output detection. Output is passed through unmodified
|
|
11
|
+
* — size limits are the endpoint's business, not ours.
|
|
11
12
|
*
|
|
12
13
|
* The claude backend resolves `--provider <name>` from the cc-switch SQLite
|
|
13
14
|
* DB (read-only) and never rewrites ~/.claude/settings.json — the provider
|
|
@@ -25,7 +26,6 @@
|
|
|
25
26
|
* backend's own timeout flag.
|
|
26
27
|
*/
|
|
27
28
|
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
28
|
-
export declare const CHARACTER_LIMIT = 50000;
|
|
29
29
|
export declare const API_DEFAULT_MAX_TOKENS = 80000;
|
|
30
30
|
/**
|
|
31
31
|
* Path to the cc-switch SQLite database. cc-switch ships provider configs
|
|
@@ -103,6 +103,7 @@ export type PickerKeyAction = {
|
|
|
103
103
|
export type PickerEntry = {
|
|
104
104
|
name: string;
|
|
105
105
|
quota?: string;
|
|
106
|
+
tag?: string;
|
|
106
107
|
};
|
|
107
108
|
/** Result of the arrow-key picker (C-P1): a picked provider, or a skip. */
|
|
108
109
|
export type PickerOutcome = {
|
|
@@ -216,9 +217,9 @@ export type RunDeps = {
|
|
|
216
217
|
isInteractive: () => boolean;
|
|
217
218
|
/**
|
|
218
219
|
* TTY-only arrow-key provider picker (C-P1/C-P3): present the cc-switch
|
|
219
|
-
* provider entries (the production impl
|
|
220
|
+
* provider entries (the production impl renders a dim Esc 退出 footer;
|
|
220
221
|
* row — `entries` holds providers only) and resolve the confirmed entry,
|
|
221
|
-
* or {kind:"skip"} on Esc
|
|
222
|
+
* or {kind:"skip"} on Esc/C-g (= 退出,不启动后端). `initialIndex` is the caller-
|
|
222
223
|
* computed row to highlight (memory hit or 0); implementations clamp it.
|
|
223
224
|
* Only ever invoked on the claude path in a TTY with no --provider —
|
|
224
225
|
* non-interactive callers (skills/CI/pipes) must see zero prompts and
|
|
@@ -289,7 +290,6 @@ export type RunOutcome = {
|
|
|
289
290
|
* prompt="claude" — the subcommand must literally lead.
|
|
290
291
|
*/
|
|
291
292
|
export declare function parseSubcommand(argv: string[]): SubcommandResult;
|
|
292
|
-
export declare function truncate(text: string): string;
|
|
293
293
|
export interface GcliOptions {
|
|
294
294
|
/** Omit for interactive mode (no -p emitted). */
|
|
295
295
|
prompt?: string;
|
|
@@ -348,7 +348,7 @@ export type PickerKeyInput = {
|
|
|
348
348
|
* - "return" / "enter" → confirm the current row (the physical Enter key
|
|
349
349
|
* emits "return" in raw mode; "enter" is the LF byte, which a tty may
|
|
350
350
|
* substitute for CR in input buffered before raw mode was enabled)
|
|
351
|
-
* - "escape" → skip (
|
|
351
|
+
* - "escape" → skip (退出,不启动后端)
|
|
352
352
|
* - Emacs (revise-2): ctrl+"n" ≡ down, ctrl+"p" ≡ up (same wrap); ctrl+"g"
|
|
353
353
|
* ≡ escape → skip; meta+"<" → first row (absolute), meta+">" → last row
|
|
354
354
|
* (absolute). Horizontal Emacs keys (C-f/C-b/C-a/C-e) and paging (C-v/M-v)
|
|
@@ -357,7 +357,7 @@ export type PickerKeyInput = {
|
|
|
357
357
|
* exit 130)
|
|
358
358
|
*
|
|
359
359
|
* `index` is the highlighted row, `count` the total rendered rows INCLUDING
|
|
360
|
-
* the
|
|
360
|
+
* the footer row. Movement wraps with `(index±1+count)%count`; with
|
|
361
361
|
* count <= 0 moves are a noop (nothing is rendered).
|
|
362
362
|
*/
|
|
363
363
|
export declare function applyPickerKey(k: PickerKeyInput, index: number, count: number): PickerKeyAction;
|
|
@@ -396,16 +396,35 @@ export declare function buildQuotaRequest(env: {
|
|
|
396
396
|
export declare function parseKimiUsages(body: unknown): QuotaWindows;
|
|
397
397
|
/**
|
|
398
398
|
* Parse GLM `/api/monitor/usage/quota/limit` (C-Q2): data.limits[] entries
|
|
399
|
-
* with type
|
|
399
|
+
* with type "TOKENS_LIMIT" (coding-plan 订阅) or "CREDIT_LIMIT" (credit 资源
|
|
400
|
+
* 包) — billing type is per-account, fields are identical, same rendering
|
|
401
|
+
* (parity with statusline-sage); sorted by nextResetTime ascending — first is
|
|
400
402
|
* the short (5h) window, last the weekly one.
|
|
401
403
|
*/
|
|
402
404
|
export declare function parseGlmQuota(body: unknown): QuotaWindows;
|
|
403
405
|
/**
|
|
404
|
-
* Format quota windows as the menu subtitle (C-Q3
|
|
405
|
-
*
|
|
406
|
-
* missing/expired reset omits
|
|
406
|
+
* Format quota windows as the menu subtitle (C-Q3, 2026-09 双窗重置):
|
|
407
|
+
* `5h:P% ↻<rel> wk:P% ↻<rel>` — each window carries its own reset time.
|
|
408
|
+
* Missing windows degrade; a missing/expired reset omits that window's ↻;
|
|
409
|
+
* no windows → "". Byte-exact contract with downstream consumers — the
|
|
410
|
+
* plain-text output is locked by unit tests; colors live in `colorQuota`,
|
|
411
|
+
* never here.
|
|
407
412
|
*/
|
|
408
413
|
export declare function formatQuota(q: QuotaWindows, nowMs: number): string;
|
|
414
|
+
export declare const QUOTA_HIGH = 85;
|
|
415
|
+
export declare const QUOTA_MID = 60;
|
|
416
|
+
/**
|
|
417
|
+
* Limit 用量 → 段颜色:≥85 朱红、≥60 琥珀、其余(含非有限数)回退苔绿
|
|
418
|
+
* (阈值语义照搬 statusline-sage `_level_color`)。
|
|
419
|
+
*/
|
|
420
|
+
export declare function levelColor(pct: number): string;
|
|
421
|
+
/**
|
|
422
|
+
* `formatQuota` 的染色版(picker 用):`5h:P% ↻rel`/`wk:P% ↻rel` 每个窗口段
|
|
423
|
+
* 按各自 pct 独立选色,各自的重置时间恒 dim,不参与染色。结构与降级规则和
|
|
424
|
+
* `formatQuota` 一致(无窗口 → "")。行内使用 `\x1b[39m`/`\x1b[22m` 收尾而
|
|
425
|
+
* 非全复位,以免抹掉选中行背景。
|
|
426
|
+
*/
|
|
427
|
+
export declare function colorQuota(q: QuotaWindows, nowMs: number): string;
|
|
409
428
|
export interface ClaudeOptions {
|
|
410
429
|
/** Omit for interactive mode (no -p emitted). */
|
|
411
430
|
prompt?: string;
|
|
@@ -683,7 +702,7 @@ export declare function runClaudeInteractive(args: string[], cwd?: string): Prom
|
|
|
683
702
|
* (timeoutMs). Either firing aborts the fetch via AbortController → exit 1
|
|
684
703
|
* with a timeout message.
|
|
685
704
|
* - stream=false: awaits the full JSON body and extracts `content[].text`,
|
|
686
|
-
*
|
|
705
|
+
* returned as-is (no size cap — endpoint limits are the endpoint's call).
|
|
687
706
|
*
|
|
688
707
|
* TRANSIENT failures are retried automatically (default 1 retry, `--retry N`):
|
|
689
708
|
* network-level fetch errors, HTTP 408/429/5xx, malformed JSON, empty-content
|
|
@@ -714,6 +733,34 @@ export declare function readCcSwitchProvider(dbPath: string): Promise<ProviderLo
|
|
|
714
733
|
export declare function validateProviderName(name: string): string | {
|
|
715
734
|
error: string;
|
|
716
735
|
};
|
|
736
|
+
/**
|
|
737
|
+
* The full picker frame as plain lines: 标题 2 行 + dim 分隔线 + 条目 N 行 +
|
|
738
|
+
* dim 末行提示 (`Esc 退出`, non-selectable — skip 只经 Esc/C-g(skip = 退出不启动)). Pure:
|
|
739
|
+
* no I/O; with `noColor` (NO_COLOR downgrade) zero ANSI escapes — 仅纯文本
|
|
740
|
+
* 排版,❯ 缩进 + 列对齐保留。Redraw cursor-up height = `entries.length + 4`.
|
|
741
|
+
*/
|
|
742
|
+
export declare function renderPickerRows(entries: PickerEntry[], selectedIndex: number, noColor: boolean): string[];
|
|
743
|
+
/**
|
|
744
|
+
* Production deps.pickProvider: arrow-key menu rendered entirely on stderr
|
|
745
|
+
* (stdout stays pipe-clean). ↑↓/j/k move with wrap, Enter confirms, Esc
|
|
746
|
+
* skips, ctrl-c restores the terminal then exits 130; any other key is a
|
|
747
|
+
* noop (C-P1). Frame = 标题 2 行 + 分隔线 + 条目 N 行 + dim `Esc 退出`
|
|
748
|
+
* 末行提示——旧的可选中「不切换」行已退化为提示(skip 走 Esc/C-g),移动
|
|
749
|
+
* 只覆盖条目行。
|
|
750
|
+
*
|
|
751
|
+
* Zero deps: `readline.emitKeypressEvents` + raw-mode stdin + hand-written
|
|
752
|
+
* ANSI (16-color structure + truecolor Sage Limit 染色; `NO_COLOR` 非空 →
|
|
753
|
+
* 全无色纯文本). Rows are redrawn in place (cursor-up + `\r` + clear-to-EOL
|
|
754
|
+
* per line) so navigation leaves no ghosting (C-P3).
|
|
755
|
+
*
|
|
756
|
+
* Raw-mode lifecycle: `process.stdin.isRaw` is saved before
|
|
757
|
+
* `setRawMode(true)` and restored on EVERY exit path (confirm / Esc / ctrl-c
|
|
758
|
+
* / stream end / error) before the promise settles, and the keypress (and
|
|
759
|
+
* its lazily-attached internal `data`) listeners are removed — so the
|
|
760
|
+
* spawned claude TUI takes stdin over cleanly. The picker always completes
|
|
761
|
+
* before any backend spawn.
|
|
762
|
+
*/
|
|
763
|
+
export declare function pickProviderInteractive(entries: PickerEntry[], initialIndex: number): Promise<PickerOutcome>;
|
|
717
764
|
/**
|
|
718
765
|
* Route argv to the agy / claude / api backend via injectable deps (C1/C2).
|
|
719
766
|
* Returns a {exitCode, stdout, stderr} outcome; main() owns process.exit.
|