cognitive-modules-cli 2.2.12 → 2.2.13
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/CHANGELOG.md +4 -0
- package/README.md +36 -36
- package/dist/modules/runner.js +3 -2
- package/dist/providers/gemini.js +4 -1
- package/dist/providers/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ All notable changes to this package are documented in this file.
|
|
|
7
7
|
- Conformance: add `runtime` suite (offline, deterministic vectors) to validate publish-grade JSON parsing and profile gates.
|
|
8
8
|
- UX: conformance help/usage now documents `--suite runtime` explicitly.
|
|
9
9
|
|
|
10
|
+
## 2.2.13 - 2026-02-08
|
|
11
|
+
|
|
12
|
+
- Fix: do not repair/convert successful envelopes into error envelopes when output validation is disabled (`--profile core`/`validate=off`).
|
|
13
|
+
|
|
10
14
|
## 2.2.11 - 2026-02-07
|
|
11
15
|
|
|
12
16
|
- Fix: Gemini `responseSchema` compatibility by dropping non-string `enum`/`const` constraints (Gemini rejects boolean enums).
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/cognitive-modules-cli)
|
|
4
4
|
|
|
5
|
-
Node.js/TypeScript 版本的 Cognitive Modules CLI。文档统一使用明确入口 `npx cogn@2.2.
|
|
5
|
+
Node.js/TypeScript 版本的 Cognitive Modules CLI。文档统一使用明确入口 `npx cogn@2.2.13 ...`,避免 PATH/命令冲突。
|
|
6
6
|
|
|
7
7
|
> 这是 [cognitive-modules](../../README.md) monorepo 的一部分。
|
|
8
8
|
|
|
@@ -10,11 +10,11 @@ Node.js/TypeScript 版本的 Cognitive Modules CLI。文档统一使用明确入
|
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
# 零安装(推荐)
|
|
13
|
-
npx cogn@2.2.
|
|
13
|
+
npx cogn@2.2.13 --help
|
|
14
14
|
|
|
15
15
|
# 全局安装(可选)
|
|
16
|
-
npm install -g cogn@2.2.
|
|
17
|
-
# 或:npm install -g cognitive-modules-cli@2.2.
|
|
16
|
+
npm install -g cogn@2.2.13
|
|
17
|
+
# 或:npm install -g cognitive-modules-cli@2.2.13
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## 快速开始
|
|
@@ -24,16 +24,16 @@ npm install -g cogn@2.2.12
|
|
|
24
24
|
export OPENAI_API_KEY=sk-xxx
|
|
25
25
|
|
|
26
26
|
# 查看 providers 能力矩阵(结构化输出/流式)
|
|
27
|
-
npx cogn@2.2.
|
|
27
|
+
npx cogn@2.2.13 providers --pretty
|
|
28
28
|
|
|
29
29
|
# 运行模块
|
|
30
|
-
npx cogn@2.2.
|
|
30
|
+
npx cogn@2.2.13 run code-reviewer --args "def login(u,p): return db.query(f'SELECT * FROM users WHERE name={u}')" --pretty
|
|
31
31
|
|
|
32
32
|
# 列出模块
|
|
33
|
-
npx cogn@2.2.
|
|
33
|
+
npx cogn@2.2.13 list
|
|
34
34
|
|
|
35
35
|
# 管道模式
|
|
36
|
-
echo "review this code" | npx cogn@2.2.
|
|
36
|
+
echo "review this code" | npx cogn@2.2.13 pipe --module code-reviewer
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## 支持的 Provider
|
|
@@ -53,14 +53,14 @@ echo "review this code" | npx cogn@2.2.12 pipe --module code-reviewer
|
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
55
|
# Core(单文件极简路径)
|
|
56
|
-
npx cogn@2.2.
|
|
57
|
-
npx cogn@2.2.
|
|
58
|
-
npx cogn@2.2.
|
|
56
|
+
npx cogn@2.2.13 core new # 生成 demo.md
|
|
57
|
+
npx cogn@2.2.13 core run demo.md --args "..." # 运行单文件模块
|
|
58
|
+
npx cogn@2.2.13 core promote demo.md # 升级为 v2 模块目录
|
|
59
59
|
|
|
60
60
|
# 渐进复杂度(Profiles)
|
|
61
|
-
npx cogn@2.2.
|
|
62
|
-
npx cogn@2.2.
|
|
63
|
-
npx cogn@2.2.
|
|
61
|
+
npx cogn@2.2.13 run code-reviewer --args "..." --profile core # 极简:跳过校验
|
|
62
|
+
npx cogn@2.2.13 run code-reviewer --args "..." --profile standard # 推荐:日常默认
|
|
63
|
+
npx cogn@2.2.13 run code-reviewer --args "..." --profile certified # 最严格:v2.2 + 审计 + registry provenance/完整性门禁
|
|
64
64
|
# 兼容别名(不推荐写进新文档):
|
|
65
65
|
# - default -> standard
|
|
66
66
|
# - strict -> standard(deprecated preset)
|
|
@@ -70,41 +70,41 @@ npx cogn@2.2.12 run code-reviewer --args "..." --profile certified # 最严格
|
|
|
70
70
|
# - --audit(写入 ~/.cognitive/audit/)
|
|
71
71
|
|
|
72
72
|
# 模块操作
|
|
73
|
-
npx cogn@2.2.
|
|
74
|
-
npx cogn@2.2.
|
|
75
|
-
npx cogn@2.2.
|
|
76
|
-
npx cogn@2.2.
|
|
77
|
-
npx cogn@2.2.
|
|
78
|
-
npx cogn@2.2.
|
|
79
|
-
npx cogn@2.2.
|
|
80
|
-
npx cogn@2.2.
|
|
73
|
+
npx cogn@2.2.13 list # 列出模块
|
|
74
|
+
npx cogn@2.2.13 run <module> --args "..." # 运行模块
|
|
75
|
+
npx cogn@2.2.13 add <url> -m <module> # 从 GitHub 添加模块
|
|
76
|
+
npx cogn@2.2.13 update <module> # 更新模块
|
|
77
|
+
npx cogn@2.2.13 remove <module> # 删除模块
|
|
78
|
+
npx cogn@2.2.13 versions <url> # 查看可用版本
|
|
79
|
+
npx cogn@2.2.13 init <name> # 创建新模块
|
|
80
|
+
npx cogn@2.2.13 pipe --module <name> # 管道模式
|
|
81
81
|
|
|
82
82
|
# 组合执行
|
|
83
|
-
npx cogn@2.2.
|
|
84
|
-
npx cogn@2.2.
|
|
83
|
+
npx cogn@2.2.13 compose <module> --args "..."
|
|
84
|
+
npx cogn@2.2.13 compose-info <module>
|
|
85
85
|
|
|
86
86
|
# 校验与迁移
|
|
87
|
-
npx cogn@2.2.
|
|
88
|
-
npx cogn@2.2.
|
|
89
|
-
npx cogn@2.2.
|
|
90
|
-
npx cogn@2.2.
|
|
87
|
+
npx cogn@2.2.13 validate <module> --v22
|
|
88
|
+
npx cogn@2.2.13 validate --all
|
|
89
|
+
npx cogn@2.2.13 migrate <module> --dry-run
|
|
90
|
+
npx cogn@2.2.13 migrate --all --no-backup
|
|
91
91
|
|
|
92
92
|
# 服务器
|
|
93
|
-
npx cogn@2.2.
|
|
94
|
-
npx cogn@2.2.
|
|
93
|
+
npx cogn@2.2.13 serve --port 8000 # 启动 HTTP API 服务
|
|
94
|
+
npx cogn@2.2.13 mcp # 启动 MCP 服务(Claude Code / Cursor)
|
|
95
95
|
|
|
96
96
|
# 环境检查
|
|
97
|
-
npx cogn@2.2.
|
|
97
|
+
npx cogn@2.2.13 doctor
|
|
98
98
|
|
|
99
99
|
# Registry(索引与分发)
|
|
100
100
|
# 默认 registry index(latest):
|
|
101
101
|
# https://github.com/Cognary/cognitive/releases/latest/download/cognitive-registry.v2.json
|
|
102
102
|
# 可通过环境变量或全局参数覆盖:
|
|
103
|
-
COGNITIVE_REGISTRY_URL=... npx cogn@2.2.
|
|
104
|
-
COGNITIVE_REGISTRY_TIMEOUT_MS=15000 COGNITIVE_REGISTRY_MAX_BYTES=2097152 npx cogn@2.2.
|
|
105
|
-
npx cogn@2.2.
|
|
106
|
-
npx cogn@2.2.
|
|
107
|
-
npx cogn@2.2.
|
|
103
|
+
COGNITIVE_REGISTRY_URL=... npx cogn@2.2.13 search
|
|
104
|
+
COGNITIVE_REGISTRY_TIMEOUT_MS=15000 COGNITIVE_REGISTRY_MAX_BYTES=2097152 npx cogn@2.2.13 search
|
|
105
|
+
npx cogn@2.2.13 search --registry https://github.com/Cognary/cognitive/releases/download/vX.Y.Z/cognitive-registry.v2.json
|
|
106
|
+
npx cogn@2.2.13 registry verify --remote --index https://github.com/Cognary/cognitive/releases/latest/download/cognitive-registry.v2.json
|
|
107
|
+
npx cogn@2.2.13 registry verify --remote --concurrency 2
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
## 开发
|
package/dist/modules/runner.js
CHANGED
|
@@ -1798,8 +1798,9 @@ export async function runModule(module, provider, options = {}) {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
|
-
else if (enableRepair) {
|
|
1802
|
-
// Repair error envelopes to ensure they have proper meta fields
|
|
1801
|
+
else if (!response.ok && enableRepair) {
|
|
1802
|
+
// Repair error envelopes to ensure they have proper meta fields.
|
|
1803
|
+
// Important: do not run this on successful envelopes when validation is disabled.
|
|
1803
1804
|
response = repairErrorEnvelope(response);
|
|
1804
1805
|
response.version = ENVELOPE_VERSION;
|
|
1805
1806
|
}
|
package/dist/providers/gemini.js
CHANGED
|
@@ -9,7 +9,10 @@ export class GeminiProvider extends BaseProvider {
|
|
|
9
9
|
apiKey;
|
|
10
10
|
model;
|
|
11
11
|
baseUrl = 'https://generativelanguage.googleapis.com/v1beta';
|
|
12
|
-
|
|
12
|
+
// Default model is intentionally overrideable via `--model`.
|
|
13
|
+
// If this model is not available for a user's account/API version, they should pass an
|
|
14
|
+
// explicit model id (or switch providers) rather than relying on implicit defaults.
|
|
15
|
+
constructor(apiKey, model = 'gemini-3-pro-preview') {
|
|
13
16
|
super();
|
|
14
17
|
this.apiKey = apiKey || process.env.GEMINI_API_KEY || '';
|
|
15
18
|
this.model = model;
|
package/dist/providers/index.js
CHANGED
|
@@ -88,7 +88,7 @@ function providerRow(name, configured, model, make) {
|
|
|
88
88
|
}
|
|
89
89
|
export function listProviders() {
|
|
90
90
|
return [
|
|
91
|
-
providerRow('gemini', !!process.env.GEMINI_API_KEY, 'gemini-3-
|
|
91
|
+
providerRow('gemini', !!process.env.GEMINI_API_KEY, 'gemini-3-pro-preview', () => new GeminiProvider('')),
|
|
92
92
|
providerRow('openai', !!process.env.OPENAI_API_KEY, 'gpt-5.2', () => new OpenAIProvider('')),
|
|
93
93
|
providerRow('anthropic', !!process.env.ANTHROPIC_API_KEY, 'claude-sonnet-4.5', () => new AnthropicProvider('')),
|
|
94
94
|
providerRow('deepseek', !!process.env.DEEPSEEK_API_KEY, 'deepseek-v3.2', () => new DeepSeekProvider('')),
|