@inf-monkeys-tech/monkeys-cli 0.11.6 → 0.12.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 +11 -8
- package/README.zh.md +11 -8
- package/bin/run.js +4 -52
- package/bin/update-cache.js +3 -1
- package/dist/cli/run.d.ts +2 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +45 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/command/metadata.d.ts +1 -2
- package/dist/command/metadata.d.ts.map +1 -1
- package/dist/command/metadata.js +4 -13
- package/dist/command/metadata.js.map +1 -1
- package/dist/commands/dev-agent/work/watch.d.ts.map +1 -1
- package/dist/commands/dev-agent/work/watch.js +4 -7
- package/dist/commands/dev-agent/work/watch.js.map +1 -1
- package/dist/commands/execution/watch.d.ts.map +1 -1
- package/dist/commands/execution/watch.js +4 -7
- package/dist/commands/execution/watch.js.map +1 -1
- package/dist/commands/install.d.ts +12 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +66 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +68 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/local-command.d.ts +0 -2
- package/dist/config/local-command.d.ts.map +1 -1
- package/dist/config/local-command.js +8 -14
- package/dist/config/local-command.js.map +1 -1
- package/dist/config/registry.d.ts.map +1 -1
- package/dist/config/registry.js +2 -12
- package/dist/config/registry.js.map +1 -1
- package/dist/config/store.d.ts.map +1 -1
- package/dist/config/store.js +46 -5
- package/dist/config/store.js.map +1 -1
- package/dist/contracts/result.d.ts +1 -1
- package/dist/contracts/result.js +1 -1
- package/dist/contracts/version.d.ts +2 -2
- package/dist/contracts/version.js +2 -2
- package/dist/errors/cli-error.d.ts +3 -0
- package/dist/errors/cli-error.d.ts.map +1 -1
- package/dist/errors/cli-error.js +17 -0
- package/dist/errors/cli-error.js.map +1 -1
- package/dist/output/render.js +1 -1
- package/dist/schema/command-schema.d.ts +2 -1
- package/dist/schema/command-schema.d.ts.map +1 -1
- package/dist/schema/command-schema.js +2 -1
- package/dist/schema/command-schema.js.map +1 -1
- package/dist/security/redact.d.ts.map +1 -1
- package/dist/security/redact.js +16 -2
- package/dist/security/redact.js.map +1 -1
- package/dist/skills/content.d.ts +1 -0
- package/dist/skills/content.d.ts.map +1 -1
- package/dist/skills/content.js +2 -2
- package/dist/skills/content.js.map +1 -1
- package/dist/skills/state.d.ts +33 -7
- package/dist/skills/state.d.ts.map +1 -1
- package/dist/skills/state.js +103 -14
- package/dist/skills/state.js.map +1 -1
- package/dist/skills/sync.d.ts +5 -2
- package/dist/skills/sync.d.ts.map +1 -1
- package/dist/skills/sync.js +110 -9
- package/dist/skills/sync.js.map +1 -1
- package/dist/transport/http-client.d.ts.map +1 -1
- package/dist/transport/http-client.js +46 -20
- package/dist/transport/http-client.js.map +1 -1
- package/dist/transport/url-policy.d.ts +2 -0
- package/dist/transport/url-policy.d.ts.map +1 -0
- package/dist/transport/url-policy.js +33 -0
- package/dist/transport/url-policy.js.map +1 -0
- package/dist/update/finalize.d.ts +26 -0
- package/dist/update/finalize.d.ts.map +1 -0
- package/dist/update/finalize.js +5 -0
- package/dist/update/finalize.js.map +1 -0
- package/dist/update/installation.d.ts +17 -0
- package/dist/update/installation.d.ts.map +1 -0
- package/dist/update/installation.js +63 -0
- package/dist/update/installation.js.map +1 -0
- package/dist/update/notifier.d.ts +4 -4
- package/dist/update/notifier.d.ts.map +1 -1
- package/dist/update/notifier.js +68 -39
- package/dist/update/notifier.js.map +1 -1
- package/dist/update/process.d.ts +11 -0
- package/dist/update/process.d.ts.map +1 -0
- package/dist/update/process.js +20 -0
- package/dist/update/process.js.map +1 -0
- package/dist/update/updater.d.ts +12 -13
- package/dist/update/updater.d.ts.map +1 -1
- package/dist/update/updater.js +149 -59
- package/dist/update/updater.js.map +1 -1
- package/oclif.manifest.json +235 -2811
- package/package.json +5 -13
- package/skills/monkeys-shared/SKILL.md +1 -1
- package/skills/monkeys-shared/references/compatibility.md +2 -2
- package/bin/install-wizard.js +0 -77
- package/dist/config/fast-subscription-list.d.ts +0 -6
- package/dist/config/fast-subscription-list.d.ts.map +0 -1
- package/dist/config/fast-subscription-list.js +0 -19
- package/dist/config/fast-subscription-list.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inf-monkeys-tech/monkeys-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Monkeys command-line client for AI agents, automation, and interactive use",
|
|
6
6
|
"type": "module",
|
|
@@ -24,24 +24,22 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc -p tsconfig.build.json && oclif manifest . && node ./scripts/sort-manifest.mjs",
|
|
26
26
|
"benchmark": "node ./scripts/benchmark.mjs",
|
|
27
|
-
"checksums": "node ./scripts/checksums.mjs",
|
|
28
|
-
"ci:prepare-version": "bun ./scripts/ci/prepare-npm-version.ts",
|
|
29
27
|
"ci:create-release": "bun ./scripts/ci/create-gitlab-release.ts",
|
|
28
|
+
"ci:prepare-version": "bun ./scripts/ci/prepare-npm-version.ts",
|
|
30
29
|
"clean": "node ./scripts/clean.mjs",
|
|
31
30
|
"dev": "tsx ./bin/dev.ts",
|
|
32
31
|
"format": "prettier --write package.json tsconfig.json tsconfig.build.json .prettierrc.json bin scripts src test",
|
|
33
32
|
"format:check": "prettier --check package.json tsconfig.json tsconfig.build.json .prettierrc.json bin scripts src test",
|
|
34
33
|
"language:check": "node ./scripts/check-english.mjs",
|
|
35
34
|
"lint": "tsc -p tsconfig.json --noEmit",
|
|
36
|
-
"pack:standalone": "bun run build && node ./scripts/oclif-pack.mjs -t win32-x64,linux-x64,darwin-x64",
|
|
37
35
|
"prepack": "bun run clean && bun run build",
|
|
38
36
|
"smoke:installer": "node ./scripts/install-wizard-smoke.mjs",
|
|
37
|
+
"smoke:contracts": "node ./scripts/cli-contract-smoke.mjs",
|
|
39
38
|
"smoke:npm": "node ./scripts/npm-install-smoke.mjs",
|
|
40
|
-
"smoke:standalone": "node ./scripts/standalone-smoke.mjs",
|
|
41
39
|
"smoke:update": "node ./scripts/update-notifier-smoke.mjs",
|
|
42
40
|
"test": "vitest run",
|
|
43
41
|
"test:watch": "vitest",
|
|
44
|
-
"verify": "bun run format:check && bun run language:check && bun run lint && bun run test && bun run build && bun run language:check && bun run version:smoke && bun run smoke:update && bun run smoke:installer && bun run smoke:npm && bun run benchmark",
|
|
42
|
+
"verify": "bun run format:check && bun run language:check && bun run lint && bun run test && bun run build && bun run language:check && bun run version:smoke && bun run smoke:contracts && bun run smoke:update && bun run smoke:installer && bun run smoke:npm && bun run benchmark",
|
|
45
43
|
"version:smoke": "node ./scripts/version-smoke.mjs"
|
|
46
44
|
},
|
|
47
45
|
"oclif": {
|
|
@@ -101,11 +99,6 @@
|
|
|
101
99
|
"workflow": {
|
|
102
100
|
"description": "Create, inspect, run, and transfer workflows"
|
|
103
101
|
}
|
|
104
|
-
},
|
|
105
|
-
"update": {
|
|
106
|
-
"node": {
|
|
107
|
-
"version": "24.18.0"
|
|
108
|
-
}
|
|
109
102
|
}
|
|
110
103
|
},
|
|
111
104
|
"dependencies": {
|
|
@@ -123,7 +116,6 @@
|
|
|
123
116
|
},
|
|
124
117
|
"devDependencies": {
|
|
125
118
|
"@types/node": "26.1.2",
|
|
126
|
-
"7zip-bin": "5.2.0",
|
|
127
119
|
"oclif": "4.23.29",
|
|
128
120
|
"prettier": "3.9.6",
|
|
129
121
|
"tsx": "4.23.1",
|
|
@@ -142,5 +134,5 @@
|
|
|
142
134
|
"publishConfig": {
|
|
143
135
|
"access": "public"
|
|
144
136
|
},
|
|
145
|
-
"monkeysReleaseCommit": "
|
|
137
|
+
"monkeysReleaseCommit": "f436062418d70f02f95d527a761aa613c91c5953"
|
|
146
138
|
}
|
|
@@ -12,7 +12,7 @@ description: 通过 monkeys CLI 选择多租户或私有化部署的 Subscriptio
|
|
|
12
12
|
1. 运行 `monkeys version show`;若 `_notice.update` 存在,只报告升级提示,得到用户授权后才运行 `monkeys update`。
|
|
13
13
|
2. 运行 `monkeys context show --subscription <Subscription>` 核对 endpoint、tenant、credential kind、Surface 与 Team。Subscription 不明确时先用 `monkeys subscription list`,Team 或 Identity 不明确时用 `monkeys team list`、`monkeys identity list`,禁止猜测。
|
|
14
14
|
3. 第一次使用命令或参数不确定时运行 `monkeys schema <command path>`;领域导航不明确时运行 `monkeys --help`。
|
|
15
|
-
4. 默认消费 JSON envelope
|
|
15
|
+
4. 默认消费 JSON envelope:成功从 stdout 读取 `.data`,失败从 stderr 读取 `.error`,系统提示读取 `._notice`。需要窄字段时使用 `--jq`;面向人展示时才用 `--output table|text`。错误永远不经过 `--jq`。
|
|
16
16
|
5. 写操作先运行 `--dry-run`,回显精确 Subscription、Team、目标 ID 与风险。只有 schema 标记需要确认时才传 `--yes`,不得自动重放结果未知的写请求。
|
|
17
17
|
6. 返回结果、关键资源 ID 与 Context Fingerprint;失败时返回 error code、recovery、retryable 和副作用是否未知。
|
|
18
18
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# 兼容性
|
|
2
2
|
|
|
3
|
-
- 本 Skill 面向命令 Schema Major `
|
|
3
|
+
- 本 Skill 面向命令 Schema Major `4`,最低 CLI 版本 `0.12.0`。
|
|
4
4
|
- 开始任务时运行 `monkeys version show --output json`。
|
|
5
5
|
- 任意结构化输出中的 `_notice.update` 表示 npm `latest` 高于当前 CLI;报告 `current`、`latest` 与 `command`。可用 `monkeys update --check --output json` 实时复核,只有用户明确授权后才运行 `monkeys update` 或 `monkeys update --force`。
|
|
6
|
-
- `monkeys update`
|
|
6
|
+
- `monkeys update` 只更新由 npm 或 pnpm 实际拥有的安装,精确安装目标版本,并验证 shell PATH、版本 envelope、全部 7 个同版本 Skills 的实际发现路径与校验和。任一最终验证失败都回滚到精确旧版本并返回结构化错误;用 `monkeys skills status` 检查实际漂移,用 `monkeys skills sync` 只重同步 Skills。
|
|
7
7
|
- CLI Major、命令 Schema Major 或 Skill 声明不兼容时停止写操作,升级匹配版本后再继续。
|
|
8
8
|
- OpenAPI Snapshot 可动态刷新,但语义命令合同不会因刷新而被静默改写。
|
|
9
9
|
- Data 合同由 Deployment 的 `data_contract=auto|ontology-v1|bucket-v1` 决定;`auto` 依次采用精确 OpenAPI、同一上下文缓存和有界只读探测。只有 Ontology 路由明确返回 404 时才探测旧 Bucket 路由。
|
package/bin/install-wizard.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { resolve } from 'node:path';
|
|
4
|
-
|
|
5
|
-
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
6
|
-
|
|
7
|
-
export function createInstallPlan({ packageName, packageRoot }) {
|
|
8
|
-
if (!packageName) throw new Error('npm package name cannot be empty.');
|
|
9
|
-
if (!packageRoot) throw new Error('The npm package directory cannot be empty.');
|
|
10
|
-
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
args: ['install', '--global', packageName],
|
|
14
|
-
command: 'npm',
|
|
15
|
-
label: `Install ${packageName} globally`,
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
args: ['-y', 'skills', 'add', resolve(packageRoot, 'skills'), '-y', '-g', '--copy'],
|
|
19
|
-
command: 'npx',
|
|
20
|
-
label: 'Install Monkeys AI Skills',
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function runCommand(command, args, options = {}) {
|
|
26
|
-
const windows = process.platform === 'win32';
|
|
27
|
-
const executable = windows ? (process.env.ComSpec ?? 'cmd.exe') : command;
|
|
28
|
-
const commandArgs = windows ? ['/d', '/s', '/c', command, ...args] : args;
|
|
29
|
-
const result = spawnSync(executable, commandArgs, {
|
|
30
|
-
encoding: 'utf8',
|
|
31
|
-
stdio: 'inherit',
|
|
32
|
-
timeout: options.timeoutMs ?? DEFAULT_TIMEOUT_MS,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (result.error) throw result.error;
|
|
36
|
-
if (result.status !== 0) throw new Error(`${command} failed to execute with exit code ${result.status ?? 'unknown'}.`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export async function runInstallWizard(options = {}) {
|
|
40
|
-
const packageRoot = options.packageRoot ?? resolve(import.meta.dirname, '..');
|
|
41
|
-
const packageJson = JSON.parse(await readFile(resolve(packageRoot, 'package.json'), 'utf8'));
|
|
42
|
-
const plan = createInstallPlan({ packageName: packageJson.name, packageRoot });
|
|
43
|
-
const execute = options.execute ?? runCommand;
|
|
44
|
-
const recordState =
|
|
45
|
-
options.recordState ??
|
|
46
|
-
(async () => {
|
|
47
|
-
const [{ listBundledSkills }, { writeSkillsState }] = await Promise.all([
|
|
48
|
-
import('../dist/skills/content.js'),
|
|
49
|
-
import('../dist/skills/state.js'),
|
|
50
|
-
]);
|
|
51
|
-
await writeSkillsState(packageJson.version, await listBundledSkills(resolve(packageRoot, 'skills')), 'install');
|
|
52
|
-
});
|
|
53
|
-
const output = options.output ?? ((message) => process.stdout.write(`${message}\n`));
|
|
54
|
-
|
|
55
|
-
output('Setting up Monkeys CLI...');
|
|
56
|
-
for (const step of plan) {
|
|
57
|
-
output(`${step.label}...`);
|
|
58
|
-
execute(step.command, step.args);
|
|
59
|
-
}
|
|
60
|
-
await recordState({ packageRoot, version: packageJson.version });
|
|
61
|
-
output('Monkeys CLI and AI Skills are installed.');
|
|
62
|
-
|
|
63
|
-
return plan;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export async function runInstallWizardCli() {
|
|
67
|
-
try {
|
|
68
|
-
await runInstallWizard();
|
|
69
|
-
} catch (error) {
|
|
70
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
71
|
-
process.stderr.write(`Monkeys CLI installation failed: ${message}\n`);
|
|
72
|
-
process.stderr.write('You can try again separately: \n');
|
|
73
|
-
process.stderr.write(' npm install --global @inf-monkeys-tech/monkeys-cli\n');
|
|
74
|
-
process.stderr.write(' npx -y skills add <skills-directory-from-installed-npm-package> -y -g --copy\n');
|
|
75
|
-
process.exitCode = 1;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fast-subscription-list.d.ts","sourceRoot":"","sources":["../../src/config/fast-subscription-list.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAKtE,wBAAsB,0BAA0B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAclH"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { errorResult, successResult } from '../contracts/result.js';
|
|
2
|
-
import { asCliError } from '../errors/cli-error.js';
|
|
3
|
-
import { renderResult } from '../output/render.js';
|
|
4
|
-
import { paginateArray, paginationFingerprint } from '../pagination/index.js';
|
|
5
|
-
import { redactValue } from '../security/redact.js';
|
|
6
|
-
import { ConfigRegistry } from './registry.js';
|
|
7
|
-
export async function renderFastSubscriptionList(output) {
|
|
8
|
-
try {
|
|
9
|
-
const data = await paginateArray(await new ConfigRegistry().listSubscriptions(), { pageAll: false, pageDelay: 0, pageLimit: 20, pageSize: 20 }, paginationFingerprint({ command: 'subscription.list' }));
|
|
10
|
-
const result = successResult(data, { command: 'subscription list' });
|
|
11
|
-
return { exitCode: 0, text: renderResult(redactValue(result), output) };
|
|
12
|
-
}
|
|
13
|
-
catch (error) {
|
|
14
|
-
const cliError = asCliError(error);
|
|
15
|
-
const result = errorResult(cliError.toErrorDetail(), { command: 'subscription list' });
|
|
16
|
-
return { exitCode: cliError.exitCode, text: renderResult(redactValue(result), output) };
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=fast-subscription-list.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fast-subscription-list.js","sourceRoot":"","sources":["../../src/config/fast-subscription-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAqB,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,MAAoB;IACnE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,aAAa,CAC9B,MAAM,IAAI,cAAc,EAAE,CAAC,iBAAiB,EAAE,EAC9C,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,EAC7D,qBAAqB,CAAC,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CACxD,CAAC;QACF,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACrE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,CAA2B,EAAE,MAAM,CAAC,EAAE,CAAC;IACpG,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,aAAa,EAAE,EAAE,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;QACvF,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,MAAM,CAAyB,EAAE,MAAM,CAAC,EAAE,CAAC;IAClH,CAAC;AACH,CAAC"}
|