@compass-aiden/neo 0.2.2 → 0.2.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.
@@ -0,0 +1,7 @@
1
+ import type { CliDeps, CliIo } from './cli.js';
2
+ export declare function cmdModel(args: readonly string[], io: CliIo, deps: CliDeps): Promise<number>;
3
+ /** 供 cli.ts 的帮助文本使用:命令级 usage。 */
4
+ export declare const MODEL_USAGE: readonly string[];
5
+ export declare const MODEL_FLAGS_HELP: readonly string[];
6
+ /** 供 cli.ts 判断 `model` 子命令是否允许 `--json`(读命令才允许)。 */
7
+ export declare function modelAllowsJson(args: readonly string[]): boolean;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * TTY 交互层(0.2.3):所有终端对话收敛到 @clack/prompts,不再自研 readline/raw-mode。
3
+ *
4
+ * 设计约束:
5
+ * - 取消(Esc / Ctrl-C)抛 {@link PromptCanceled},由 runCli 统一映射成退出码 130;
6
+ * 业务失败仍是 1、明确拒绝(例如 remove 的 no)是 0。
7
+ * - 交互闸门必须是 stdin 且 stdout 都是 TTY;测试通过 CliDeps 注入,永不触真实终端。
8
+ * - 本模块只被 CLI 的缺省实现引用;core 与领域逻辑不 import 它。
9
+ */
10
+ /** 用户主动取消(Esc/Ctrl-C):不是业务失败,退出码 130,且不写任何东西。 */
11
+ export declare class PromptCanceled extends Error {
12
+ constructor();
13
+ }
14
+ /** 交互闸门:显式注入优先;否则 stdin 与 stdout 都必须是 TTY。 */
15
+ export declare function interactiveTty(deps: {
16
+ isTty?: boolean;
17
+ }): boolean;
18
+ interface TextPromptOptions {
19
+ message: string;
20
+ placeholder?: string;
21
+ defaultValue?: string;
22
+ initialValue?: string;
23
+ validate?: (value: string) => string | Error | undefined;
24
+ }
25
+ /** 文本提问:空输入返回 defaultValue(与旧 ask(question, fallback) 语义一致)。 */
26
+ export declare function promptText(options: TextPromptOptions): Promise<string>;
27
+ /** 是/否确认;initialValue 决定光标默认落在哪一项。 */
28
+ export declare function promptConfirm(message: string, initialValue?: boolean): Promise<boolean>;
29
+ export interface PromptOption {
30
+ value: string;
31
+ label?: string;
32
+ hint?: string;
33
+ disabled?: boolean;
34
+ }
35
+ /** 交互端口:命令层只依赖它;缺省实现是 clack,测试注入假实现(零真实终端)。 */
36
+ export interface PromptPort {
37
+ text(options: TextPromptOptions): Promise<string>;
38
+ confirm(message: string, initialValue?: boolean): Promise<boolean>;
39
+ select(message: string, options: readonly PromptOption[], initialValue?: string): Promise<string>;
40
+ multiselect(message: string, options: readonly PromptOption[], initialValues?: readonly string[]): Promise<string[]>;
41
+ }
42
+ /** 单选(clack select)。 */
43
+ export declare function promptSelect(message: string, options: readonly PromptOption[], initialValue?: string): Promise<string>;
44
+ /** 多选(clack multiselect);返回空数组 = 用户确认但没勾选。 */
45
+ export declare function promptMultiselect(message: string, options: readonly PromptOption[], initialValues?: readonly string[]): Promise<string[]>;
46
+ /** 旧 `ask(question, fallback)` 语义的薄封装。 */
47
+ export declare function promptAsk(question: string, fallback: string): Promise<string>;
48
+ /** 缺省交互端口(clack 实现)。 */
49
+ export declare const defaultPromptPort: PromptPort;
50
+ export interface SkillChoiceOption {
51
+ name: string;
52
+ description?: string;
53
+ }
54
+ export interface SkillSelectContext {
55
+ role: string;
56
+ installed: readonly string[];
57
+ }
58
+ /**
59
+ * `neo add` 的技能多选:已安装项只作 hint 标注、不预勾选(与旧 checkbox 语义一致),
60
+ * 空数组 = 用户确认但没勾选(调用方据此打印 "nothing selected" 并 exit 0)。
61
+ */
62
+ export declare function promptSkillSelection(options: readonly SkillChoiceOption[], context: SkillSelectContext): Promise<string[]>;
63
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compass-aiden/neo",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "neo CLI — 跨 Agent 技能角色管理命令行(bin: neo)",
5
5
  "type": "module",
6
6
  "author": "Aiden-FE",
@@ -34,12 +34,13 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/node": "^22.10.0",
37
+ "esbuild": "^0.28.2",
37
38
  "typescript": "^5.7.0",
38
39
  "vitest": "^3.0.0",
39
- "esbuild": "^0.28.2",
40
- "@compass-aiden/neo-core": "0.2.2"
40
+ "@compass-aiden/neo-core": "0.2.4"
41
41
  },
42
42
  "dependencies": {
43
+ "@clack/prompts": "^1.9.0",
43
44
  "yaml": "^2.9.1"
44
45
  },
45
46
  "scripts": {