发布前完善:npm 包验证、向导安装提示改用包目录、README 补 GitHub/npm 安装方式

This commit is contained in:
billowliu2 committed 2026-08-02 01:34:27 +08:00
1 parent ed8f7ae977
commit 6ff51a935f
3 files changed
+33 -6

No files matched your search

+10 -2
View File
@@ -56,17 +56,25 @@ of the setup wizard); everything else is automatic.
### 1. Install the plugin ### 1. Install the plugin
In a Kimi Code session: In a Kimi Code session (any of these):
``` ```
# From GitHub (recommended)
/plugins install https://github.com/billowliu2/kimi-eyes
# From a local directory
/plugins install D:\AIGC\Plugin\kimi-eyes /plugins install D:\AIGC\Plugin\kimi-eyes
``` ```
### 2. Configure the vision API (one-time) ### 2. Configure the vision API (one-time)
Run the setup wizard from the plugin directory: Run the setup wizard (any of these):
``` ```
# One-shot via npm (once published)
npx kimi-eyes setup
# From the local plugin directory
cd D:\AIGC\Plugin\kimi-eyes cd D:\AIGC\Plugin\kimi-eyes
node setup.mjs node setup.mjs
``` ```
+10 -2
View File
@@ -38,17 +38,25 @@
### 1. 安装插件 ### 1. 安装插件
在 KimiCode 会话里执行: 在 KimiCode 会话里执行(任选一种):
``` ```
# 方式一:从 GitHub 安装(推荐)
/plugins install https://github.com/billowliu2/kimi-eyes
# 方式二:从本地目录安装
/plugins install D:\AIGC\Plugin\kimi-eyes /plugins install D:\AIGC\Plugin\kimi-eyes
``` ```
### 2. 配置视觉 API(一次性) ### 2. 配置视觉 API(一次性)
在插件目录运行配置向导: 运行配置向导(任选一种):
``` ```
# npm 安装后一键运行(发布后可用)
npx kimi-eyes setup
# 本地插件目录运行
cd D:\AIGC\Plugin\kimi-eyes cd D:\AIGC\Plugin\kimi-eyes
node setup.mjs node setup.mjs
``` ```
+13 -2
View File
@@ -7,8 +7,13 @@
import fs from 'node:fs'; import fs from 'node:fs';
import os from 'node:os'; import os from 'node:os';
import path from 'node:path'; import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { callVLM, modelsEndpoint, ONE_PX_PNG_BASE64, modelCapabilityTag } from './mcp/vision.mjs'; import { callVLM, modelsEndpoint, ONE_PX_PNG_BASE64, modelCapabilityTag } from './mcp/vision.mjs';
// Directory that contains this script — used for the /plugins install hint.
// Works both when run locally and when run via `npx kimi-eyes setup` from the npm package.
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Raw-mode line input (supports masked echo) // Raw-mode line input (supports masked echo)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@@ -33,7 +38,13 @@ function ask(query, { hidden = false } = {}) {
if (!stdin.isTTY) { if (!stdin.isTTY) {
// Non-TTY fallback (piped input in tests/CI): plain line read, no masking. // Non-TTY fallback (piped input in tests/CI): plain line read, no masking.
process.stdout.write(query); process.stdout.write(query);
return ensurePipeLines().then((lines) => lines.shift() ?? ''); return ensurePipeLines().then((lines) => {
if (lines.length === 0) {
console.error('\n[setup] 输入已结束,向导中止。');
process.exit(1);
}
return lines.shift() ?? '';
});
} }
process.stdout.write(query); process.stdout.write(query);
stdin.setRawMode(true); stdin.setRawMode(true);
@@ -230,7 +241,7 @@ async function main() {
if (cfg.mainModel) console.log(` mainModel: ${cfg.mainModel} (触发判断用)`); if (cfg.mainModel) console.log(` mainModel: ${cfg.mainModel} (触发判断用)`);
console.log(''); console.log('');
console.log('下一步:'); console.log('下一步:');
console.log(` 1. 安装插件: /plugins install ${process.cwd()}`); console.log(` 1. 安装插件: /plugins install ${__dirname}`);
console.log(' 2. 启用插件: /reload'); console.log(' 2. 启用插件: /reload');
console.log(' 3. 开始使用: 非多模态模型下 @图片路径 或 截图后提问'); console.log(' 3. 开始使用: 非多模态模型下 @图片路径 或 截图后提问');
} }