shipmyagent 1.0.73 → 1.0.75

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/bin/cli.js CHANGED
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import { Command } from "commander";
3
3
  import { initCommand } from "./commands/init.js";
4
+ import { runCommand } from "./commands/run.js";
4
5
  import { startCommand } from "./commands/start.js";
6
+ import { stopCommand } from "./commands/stop.js";
7
+ import { restartCommand } from "./commands/restart.js";
5
8
  import { aliasCommand } from "./commands/alias.js";
6
9
  import { readFileSync } from "fs";
7
10
  import { join, dirname, basename } from "path";
@@ -41,16 +44,42 @@ const init = program
41
44
  .description("初始化 ShipMyAgent 项目")
42
45
  .helpOption("--help", "display help for command")
43
46
  .action(initCommand);
44
- // Start command
47
+ // Run command (foreground)
48
+ const run = program
49
+ .command("run [path]")
50
+ .description("前台启动 Agent Runtime(当前终端运行)")
51
+ .option("-p, --port <port>", "服务端口(可在 ship.json 的 start.port 配置)", parsePort)
52
+ .option("-h, --host <host>", "服务主机(可在 ship.json 的 start.host 配置)")
53
+ .option("--interactive-web [enabled]", "启动交互式 Web 界面(可在 ship.json 的 start.interactiveWeb 配置)", parseBoolean)
54
+ .option("--interactive-port <port>", "交互式 Web 界面端口(可在 ship.json 的 start.interactivePort 配置)", parsePort)
55
+ .helpOption("--help", "display help for command")
56
+ .action(runCommand);
57
+ // Start command (daemon)
45
58
  const start = program
46
59
  .command("start [path]")
47
- .description("启动 Agent Runtime")
60
+ .description("后台启动 Agent Runtime(终端退出也保持运行)")
48
61
  .option("-p, --port <port>", "服务端口(可在 ship.json 的 start.port 配置)", parsePort)
49
62
  .option("-h, --host <host>", "服务主机(可在 ship.json 的 start.host 配置)")
50
63
  .option("--interactive-web [enabled]", "启动交互式 Web 界面(可在 ship.json 的 start.interactiveWeb 配置)", parseBoolean)
51
64
  .option("--interactive-port <port>", "交互式 Web 界面端口(可在 ship.json 的 start.interactivePort 配置)", parsePort)
52
65
  .helpOption("--help", "display help for command")
53
66
  .action(startCommand);
67
+ // Stop command (daemon)
68
+ const stop = program
69
+ .command("stop [path]")
70
+ .description("停止后台 Agent 服务器(daemon)")
71
+ .helpOption("--help", "display help for command")
72
+ .action(stopCommand);
73
+ // Restart command (daemon)
74
+ const restart = program
75
+ .command("restart [path]")
76
+ .description("重启后台 Agent 服务器(daemon)")
77
+ .option("-p, --port <port>", "服务端口(可在 ship.json 的 start.port 配置)", parsePort)
78
+ .option("-h, --host <host>", "服务主机(可在 ship.json 的 start.host 配置)")
79
+ .option("--interactive-web [enabled]", "启动交互式 Web 界面(可在 ship.json 的 start.interactiveWeb 配置)", parseBoolean)
80
+ .option("--interactive-port <port>", "交互式 Web 界面端口(可在 ship.json 的 start.interactivePort 配置)", parsePort)
81
+ .helpOption("--help", "display help for command")
82
+ .action(restartCommand);
54
83
  const alias = program
55
84
  .command("alias")
56
85
  .description("在 .zshrc / .bashrc 中写入 `alias sma=\"shipmyagent\"`")
@@ -59,12 +88,12 @@ const alias = program
59
88
  .option("--print", "仅打印 alias 内容(用于 eval)", false)
60
89
  .helpOption("--help", "display help for command")
61
90
  .action(aliasCommand);
62
- // Default: `shipmyagent` / `shipmyagent .` / `shipmyagent [start-options]` => `shipmyagent start [path]`
91
+ // Default: `shipmyagent` / `shipmyagent .` / `shipmyagent [run-options]` => `shipmyagent run [path]`
63
92
  const firstArg = process.argv[2];
64
93
  if (!firstArg ||
65
- (![init.name(), start.name(), alias.name(), "help"].includes(firstArg) &&
94
+ (![init.name(), run.name(), start.name(), stop.name(), restart.name(), alias.name(), "help"].includes(firstArg) &&
66
95
  !["--help", "-v", "--version"].includes(firstArg))) {
67
- process.argv.splice(2, 0, "start");
96
+ process.argv.splice(2, 0, "run");
68
97
  }
69
98
  program.parse();
70
99
  //# sourceMappingURL=cli.js.map
package/bin/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],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,MAAM,CAAC;KACnE,MAAM,CAAC,WAAW,EAAE,kBAAkB,EAAE,KAAK,CAAC;KAC9C,MAAM,CAAC,SAAS,EAAE,uBAAuB,EAAE,KAAK,CAAC;KACjD,UAAU,CAAC,QAAQ,EAAE,0BAA0B,CAAC;KAChD,MAAM,CAAC,YAAY,CAAC,CAAC;AAExB,qGAAqG;AACrG,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjC,IACE,CAAC,QAAQ;IACT,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC7G,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACpD,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC;AAED,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA8BA,UAAU,WAAW;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,WAAW,CAAC,GAAG,GAAE,MAAY,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0O7F"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA+BH,OAAO,KAAK,EAAc,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,wBAAsB,WAAW,CAC/B,GAAG,GAAE,MAAY,EACjB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,IAAI,CAAC,CA+Pf"}
@@ -1,19 +1,30 @@
1
- import path from 'path';
2
- import prompts from 'prompts';
3
- import fs from 'fs-extra';
4
- import { getAgentMdPath, getShipJsonPath, getShipDirPath, getLogsDirPath, getCacheDirPath, getShipSchemaPath, getShipChatRootDirPath, getShipConfigDirPath, getShipDataDirPath, getShipMcpConfigPath, getShipMcpSchemaPath, getShipProfileDirPath, getShipProfileOtherPath, getShipProfilePrimaryPath, getShipDebugDirPath, getShipPublicDirPath, getShipTasksDirPath, ensureDir, saveJson, DEFAULT_SHIP_JSON, MODEL_CONFIGS, } from '../utils.js';
5
- import { SHIP_JSON_SCHEMA } from '../schemas/ship.schema.js';
6
- import { MCP_JSON_SCHEMA } from '../schemas/mcp.schema.js';
7
- export async function initCommand(cwd = '.', options = {}) {
1
+ /**
2
+ * `shipmyagent init`:在目标目录生成最小可用的 ShipMyAgent 工程骨架与配置文件。
3
+ *
4
+ * 目标
5
+ * - 生成 `Agent.md` / `ship.json` / `.ship/` 目录结构与 schema 文件
6
+ * - 通过交互式问题收集必要配置(模型、Adapters 等)
7
+ *
8
+ * 设计要点
9
+ * - Adapters 支持多选:仅写入用户选择的 adapters(未选择的不出现在 `ship.json`)
10
+ * - 避免写入无意义的默认值:能省则省,保持配置简洁
11
+ */
12
+ import path from "path";
13
+ import prompts from "prompts";
14
+ import fs from "fs-extra";
15
+ import { getAgentMdPath, getShipJsonPath, getShipDirPath, getLogsDirPath, getCacheDirPath, getShipSchemaPath, getShipChatRootDirPath, getShipConfigDirPath, getShipDataDirPath, getShipMcpConfigPath, getShipMcpSchemaPath, getShipProfileDirPath, getShipProfileOtherPath, getShipProfilePrimaryPath, getShipDebugDirPath, getShipPublicDirPath, getShipTasksDirPath, ensureDir, saveJson, DEFAULT_SHIP_JSON, MODEL_CONFIGS, } from "../utils.js";
16
+ import { SHIP_JSON_SCHEMA } from "../schemas/ship.schema.js";
17
+ import { MCP_JSON_SCHEMA } from "../schemas/mcp.schema.js";
18
+ export async function initCommand(cwd = ".", options = {}) {
8
19
  const projectRoot = path.resolve(cwd);
9
- const LLM_API_KEY = '${LLM_API_KEY}';
10
- const LLM_BASE_URL = '${LLM_BASE_URL}';
11
- const LLM_MODEL = '${LLM_MODEL}';
12
- const TELEGRAM_BOT_TOKEN = '${TELEGRAM_BOT_TOKEN}';
13
- const FEISHU_APP_ID = '${FEISHU_APP_ID}';
14
- const FEISHU_APP_SECRET = '${FEISHU_APP_SECRET}';
15
- const QQ_APP_ID = '${QQ_APP_ID}';
16
- const QQ_APP_SECRET = '${QQ_APP_SECRET}';
20
+ const LLM_API_KEY = "${LLM_API_KEY}";
21
+ const LLM_BASE_URL = "${LLM_BASE_URL}";
22
+ const LLM_MODEL = "${LLM_MODEL}";
23
+ const TELEGRAM_BOT_TOKEN = "${TELEGRAM_BOT_TOKEN}";
24
+ const FEISHU_APP_ID = "${FEISHU_APP_ID}";
25
+ const FEISHU_APP_SECRET = "${FEISHU_APP_SECRET}";
26
+ const QQ_APP_ID = "${QQ_APP_ID}";
27
+ const QQ_APP_SECRET = "${QQ_APP_SECRET}";
17
28
  console.log(`🚀 Initializing ShipMyAgent project: ${projectRoot}`);
18
29
  // Check if Agent.md and ship.json already exist
19
30
  const existingAgentMd = fs.existsSync(getAgentMdPath(projectRoot));
@@ -21,13 +32,13 @@ export async function initCommand(cwd = '.', options = {}) {
21
32
  if (existingAgentMd || existingShipJson) {
22
33
  if (!options.force) {
23
34
  const response = await prompts({
24
- type: 'confirm',
25
- name: 'overwrite',
26
- message: 'Project already initialized. Overwrite existing configuration?',
35
+ type: "confirm",
36
+ name: "overwrite",
37
+ message: "Project already initialized. Overwrite existing configuration?",
27
38
  initial: false,
28
39
  });
29
40
  if (!response.overwrite) {
30
- console.log('❌ Initialization cancelled');
41
+ console.log("❌ Initialization cancelled");
31
42
  return;
32
43
  }
33
44
  }
@@ -35,45 +46,46 @@ export async function initCommand(cwd = '.', options = {}) {
35
46
  // Collect configuration information
36
47
  const response = await prompts([
37
48
  {
38
- type: 'text',
39
- name: 'name',
40
- message: 'Agent name',
49
+ type: "text",
50
+ name: "name",
51
+ message: "Agent name",
41
52
  initial: path.basename(projectRoot),
42
53
  },
43
54
  {
44
- type: 'select',
45
- name: 'model',
46
- message: 'Select LLM model',
55
+ type: "select",
56
+ name: "model",
57
+ message: "Select LLM model",
47
58
  choices: [
48
- { title: 'Claude Sonnet 4', value: 'claude-sonnet-4-5' },
49
- { title: 'Claude Haiku', value: 'claude-haiku' },
50
- { title: 'Claude 3.5 Sonnet', value: 'claude-3-5-sonnet-20241022' },
51
- { title: 'Claude 3 Opus', value: 'claude-3-opus-20240229' },
52
- { title: 'GPT-4', value: 'gpt-4' },
53
- { title: 'GPT-4 Turbo', value: 'gpt-4-turbo' },
54
- { title: 'GPT-4o', value: 'gpt-4o' },
55
- { title: 'GPT-3.5 Turbo', value: 'gpt-3.5-turbo' },
56
- { title: 'DeepSeek Chat', value: 'deepseek-chat' },
57
- { title: 'Custom model', value: 'custom' },
59
+ { title: "Claude Sonnet 4", value: "claude-sonnet-4-5" },
60
+ { title: "Claude Haiku", value: "claude-haiku" },
61
+ { title: "Claude 3.5 Sonnet", value: "claude-3-5-sonnet-20241022" },
62
+ { title: "Claude 3 Opus", value: "claude-3-opus-20240229" },
63
+ { title: "GPT-4", value: "gpt-4" },
64
+ { title: "GPT-4 Turbo", value: "gpt-4-turbo" },
65
+ { title: "GPT-4o", value: "gpt-4o" },
66
+ { title: "GPT-3.5 Turbo", value: "gpt-3.5-turbo" },
67
+ { title: "DeepSeek Chat", value: "deepseek-chat" },
68
+ { title: "Custom model", value: "custom" },
58
69
  ],
59
70
  initial: 0,
60
71
  },
61
72
  {
62
- type: 'select',
63
- name: 'integration',
64
- message: 'Select messaging integration',
73
+ // 关键交互:Adapters 允许多选,未选择的就不写入 ship.json
74
+ type: "multiselect",
75
+ name: "adapters",
76
+ message: "Select adapters (multi-select)",
65
77
  choices: [
66
- { title: 'None', value: 'none' },
67
- { title: 'Telegram', value: 'telegram' },
68
- { title: 'Feishu', value: 'feishu' },
69
- { title: 'QQ', value: 'qq' },
78
+ { title: "Telegram", value: "telegram" },
79
+ { title: "Feishu", value: "feishu" },
80
+ { title: "QQ", value: "qq" },
70
81
  ],
71
- initial: 0,
72
82
  },
73
83
  {
74
- type: (prev, values) => (values.integration === 'qq' ? 'confirm' : null),
75
- name: 'qqSandbox',
76
- message: 'Use QQ sandbox environment?',
84
+ type: (prev, values) => Array.isArray(values.adapters) && values.adapters.includes("qq")
85
+ ? "confirm"
86
+ : null,
87
+ name: "qqSandbox",
88
+ message: "Use QQ sandbox environment?",
77
89
  initial: false,
78
90
  },
79
91
  ]);
@@ -100,45 +112,52 @@ Help users understand and work with their codebase by exploring, analyzing, and
100
112
  console.log(`✅ Created Agent.md`);
101
113
  // Save ship.json
102
114
  // Build LLM configuration
103
- const selectedModel = response.model || 'claude-sonnet-4-5';
115
+ const selectedModel = response.model || "claude-sonnet-4-5";
104
116
  const modelTemplate = MODEL_CONFIGS[selectedModel] || MODEL_CONFIGS.custom;
105
117
  const llmConfig = {
106
118
  provider: modelTemplate.provider,
107
- model: selectedModel === 'custom' ? LLM_MODEL : selectedModel, // custom needs env
108
- baseUrl: selectedModel === 'custom' ? LLM_BASE_URL : modelTemplate.baseUrl,
119
+ model: selectedModel === "custom" ? LLM_MODEL : selectedModel, // custom needs env
120
+ baseUrl: selectedModel === "custom" ? LLM_BASE_URL : modelTemplate.baseUrl,
109
121
  apiKey: LLM_API_KEY,
110
122
  temperature: 0.7,
111
123
  };
124
+ const selectedAdapters = new Set(Array.isArray(response.adapters) ? response.adapters : []);
125
+ const adaptersConfig = {};
126
+ if (selectedAdapters.has("telegram")) {
127
+ adaptersConfig.telegram = {
128
+ enabled: true,
129
+ botToken: TELEGRAM_BOT_TOKEN,
130
+ chatId: undefined,
131
+ };
132
+ }
133
+ if (selectedAdapters.has("feishu")) {
134
+ adaptersConfig.feishu = {
135
+ enabled: true,
136
+ appId: FEISHU_APP_ID,
137
+ appSecret: FEISHU_APP_SECRET,
138
+ domain: "https://open.feishu.cn",
139
+ };
140
+ }
141
+ if (selectedAdapters.has("qq")) {
142
+ adaptersConfig.qq = {
143
+ enabled: true,
144
+ appId: QQ_APP_ID,
145
+ appSecret: QQ_APP_SECRET,
146
+ sandbox: Boolean(response.qqSandbox),
147
+ };
148
+ }
112
149
  const shipConfig = {
113
150
  $schema: DEFAULT_SHIP_JSON.$schema,
114
151
  name: response.name || path.basename(projectRoot),
115
- version: '1.0.0',
152
+ version: "1.0.0",
116
153
  start: {
117
154
  port: 3000,
118
- host: '0.0.0.0',
155
+ host: "0.0.0.0",
119
156
  interactiveWeb: false,
120
157
  interactivePort: 3001,
121
158
  },
122
159
  llm: llmConfig,
123
- adapters: {
124
- telegram: {
125
- enabled: response.integration === 'telegram',
126
- botToken: response.integration === 'telegram' ? TELEGRAM_BOT_TOKEN : undefined,
127
- chatId: undefined,
128
- },
129
- feishu: {
130
- enabled: response.integration === 'feishu',
131
- appId: response.integration === 'feishu' ? FEISHU_APP_ID : undefined,
132
- appSecret: response.integration === 'feishu' ? FEISHU_APP_SECRET : undefined,
133
- domain: 'https://open.feishu.cn',
134
- },
135
- qq: {
136
- enabled: response.integration === 'qq',
137
- appId: response.integration === 'qq' ? QQ_APP_ID : undefined,
138
- appSecret: response.integration === 'qq' ? QQ_APP_SECRET : undefined,
139
- sandbox: response.integration === 'qq' ? Boolean(response.qqSandbox) : false,
140
- },
141
- },
160
+ ...(Object.keys(adaptersConfig).length > 0 ? { adapters: adaptersConfig } : {}),
142
161
  };
143
162
  await saveJson(shipJsonPath, shipConfig);
144
163
  console.log(`✅ Created ship.json`);
@@ -153,7 +172,7 @@ Help users understand and work with their codebase by exploring, analyzing, and
153
172
  getShipChatRootDirPath(projectRoot),
154
173
  getShipPublicDirPath(projectRoot),
155
174
  getShipConfigDirPath(projectRoot),
156
- path.join(getShipDirPath(projectRoot), 'schema'),
175
+ path.join(getShipDirPath(projectRoot), "schema"),
157
176
  getShipDebugDirPath(projectRoot),
158
177
  ];
159
178
  for (const dir of dirs) {
@@ -180,49 +199,50 @@ Help users understand and work with their codebase by exploring, analyzing, and
180
199
  await ensureDir(path.dirname(mcpSchemaPath));
181
200
  await ensureDir(path.dirname(mcpJsonPath));
182
201
  await saveJson(mcpSchemaPath, MCP_JSON_SCHEMA);
183
- await saveJson(mcpJsonPath, { $schema: '../schema/mcp.schema.json', servers: {} });
202
+ await saveJson(mcpJsonPath, { $schema: "../schema/mcp.schema.json", servers: {} });
184
203
  console.log(`✅ Created .ship/config/mcp.json (MCP configuration)`);
185
204
  console.log('\n🎉 Initialization complete!\n');
186
205
  console.log(`📦 Current model: ${llmConfig.provider} / ${llmConfig.model}`);
187
206
  console.log(`🌐 API URL: ${llmConfig.baseUrl}\n`);
188
- if (response.integration === 'feishu') {
189
- console.log('📱 Feishu integration enabled');
190
- console.log(' Please configure FEISHU_APP_ID and FEISHU_APP_SECRET in ship.json');
191
- console.log(' or set environment variables: FEISHU_APP_ID and FEISHU_APP_SECRET\n');
207
+ if (selectedAdapters.has("feishu")) {
208
+ console.log("📱 Feishu adapter enabled");
209
+ console.log(" Please configure FEISHU_APP_ID and FEISHU_APP_SECRET in ship.json");
210
+ console.log(" or set environment variables: FEISHU_APP_ID and FEISHU_APP_SECRET\n");
192
211
  }
193
- else if (response.integration === 'telegram') {
194
- console.log('📱 Telegram integration enabled');
195
- console.log(' Please configure TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID (optional) in ship.json');
196
- console.log(' or set environment variables: TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID\n');
212
+ if (selectedAdapters.has("telegram")) {
213
+ console.log("📱 Telegram adapter enabled");
214
+ console.log(" Please configure TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID (optional) in ship.json");
215
+ console.log(" or set environment variables: TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID\n");
197
216
  }
198
- else if (response.integration === 'qq') {
199
- console.log('📱 QQ integration enabled');
200
- console.log(' Please configure QQ_APP_ID and QQ_APP_SECRET in ship.json');
201
- console.log(' or set environment variables: QQ_APP_ID and QQ_APP_SECRET\n');
202
- console.log(' Optional: set QQ_SANDBOX=true to use sandbox environment\n');
217
+ if (selectedAdapters.has("qq")) {
218
+ console.log("📱 QQ adapter enabled");
219
+ console.log(" Please configure QQ_APP_ID and QQ_APP_SECRET in ship.json");
220
+ console.log(" or set environment variables: QQ_APP_ID and QQ_APP_SECRET\n");
221
+ console.log(" Optional: set QQ_SANDBOX=true to use sandbox environment\n");
203
222
  }
204
- console.log('Next steps:');
205
- console.log(' 1. Edit Agent.md to customize agent behavior');
206
- console.log(' 2. Edit ship.json to modify LLM configuration (baseUrl, apiKey, temperature, etc.)');
207
- console.log(' 3. (Optional) Edit .ship/config/mcp.json to configure MCP servers for extended capabilities');
208
- if (response.integration === 'feishu') {
209
- console.log(' 4. Configure Feishu App ID and App Secret');
210
- console.log(' 5. Run "shipmyagent start" to start the agent\n');
223
+ const nextSteps = [
224
+ "Edit Agent.md to customize agent behavior",
225
+ "Edit ship.json to modify LLM configuration (baseUrl, apiKey, temperature, etc.)",
226
+ "(Optional) Edit .ship/config/mcp.json to configure MCP servers for extended capabilities",
227
+ ];
228
+ if (selectedAdapters.has("telegram")) {
229
+ nextSteps.push("Configure Telegram Bot Token and Chat ID (optional)");
211
230
  }
212
- else if (response.integration === 'telegram') {
213
- console.log(' 4. Configure Telegram Bot Token and Chat ID (optional)');
214
- console.log(' 5. Run "shipmyagent start" to start the agent\n');
231
+ if (selectedAdapters.has("feishu")) {
232
+ nextSteps.push("Configure Feishu App ID and App Secret");
215
233
  }
216
- else if (response.integration === 'qq') {
217
- console.log(' 4. Configure QQ App ID and App Secret');
218
- console.log(' 5. Run "shipmyagent start" to start the agent\n');
234
+ if (selectedAdapters.has("qq")) {
235
+ nextSteps.push("Configure QQ App ID and App Secret");
219
236
  }
220
- else {
221
- console.log(' 4. Run "shipmyagent start" to start the agent\n');
237
+ nextSteps.push('Run "shipmyagent start" to start the agent');
238
+ console.log("Next steps:");
239
+ for (const [idx, line] of nextSteps.entries()) {
240
+ console.log(` ${idx + 1}. ${line}`);
222
241
  }
242
+ console.log("");
223
243
  console.log('💡 Tip: API Key is recommended to use environment variables (e.g. ${ANTHROPIC_API_KEY} or ${OPENAI_API_KEY})\n');
224
- console.log('🔌 MCP Support: Configure MCP servers in .ship/config/mcp.json to connect to databases, APIs, and more');
225
- console.log(' Learn more: https://modelcontextprotocol.io\n');
226
- console.log('To switch models or modify configuration, edit the llm field in ship.json directly.\n');
244
+ console.log("🔌 MCP Support: Configure MCP servers in .ship/config/mcp.json to connect to databases, APIs, and more");
245
+ console.log(" Learn more: https://modelcontextprotocol.io\n");
246
+ console.log("To switch models or modify configuration, edit the llm field in ship.json directly.\n");
227
247
  }
228
248
  //# sourceMappingURL=init.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,yBAAyB,EACzB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,aAAa,GAEd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAM3D,MAAM,CAAC,KAAK,UAAU,WAA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G,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,gHAAgH,CAAC,CAAC;IAC9H,OAAO,CAAC,GAAG,CAAC,wGAAwG,CAAC,CAAC;IACtH,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;IAChE,OAAO,CAAC,GAAG,CAAC,uFAAuF,CAAC,CAAC;AACvG,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.d.ts","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,YAAM,EACjB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAiCf"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * `shipmyagent restart`:重启后台常驻的 Agent Runtime(daemon)。
3
+ */
4
+ import path from "path";
5
+ import fs from "fs-extra";
6
+ import { fileURLToPath } from "url";
7
+ import { getAgentMdPath, getShipJsonPath } from "../utils.js";
8
+ import { buildRunArgsFromOptions } from "../daemon/cli-args.js";
9
+ import { startDaemonProcess, stopDaemonProcess } from "../daemon/manager.js";
10
+ export async function restartCommand(cwd = ".", options) {
11
+ const projectRoot = path.resolve(cwd);
12
+ if (!fs.existsSync(getAgentMdPath(projectRoot))) {
13
+ console.error('❌ Project not initialized. Please run "shipmyagent init" first');
14
+ process.exit(1);
15
+ }
16
+ if (!fs.existsSync(getShipJsonPath(projectRoot))) {
17
+ console.error('❌ ship.json does not exist. Please run "shipmyagent init" first');
18
+ process.exit(1);
19
+ }
20
+ // 计算当前 CLI 的入口路径(编译后是 `bin/cli.js`)。
21
+ const __filename = fileURLToPath(import.meta.url);
22
+ const __dirname = path.dirname(__filename);
23
+ const cliPath = path.resolve(__dirname, "../cli.js");
24
+ try {
25
+ await stopDaemonProcess({ projectRoot });
26
+ const args = buildRunArgsFromOptions(projectRoot, options || {});
27
+ const { pid, logPath } = await startDaemonProcess({
28
+ projectRoot,
29
+ cliPath,
30
+ args,
31
+ });
32
+ console.log("✅ ShipMyAgent daemon restarted");
33
+ console.log(` pid: ${pid}`);
34
+ console.log(` log: ${logPath}`);
35
+ }
36
+ catch (error) {
37
+ console.error("❌ Failed to restart daemon:", error);
38
+ process.exit(1);
39
+ }
40
+ }
41
+ //# sourceMappingURL=restart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restart.js","sourceRoot":"","sources":["../../src/commands/restart.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG7E,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAc,GAAG,EACjB,OAAqB;IAErB,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAEtC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,gEAAgE,CAAC,CAAC;QAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;QACjF,OAAO,CAAC,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