ai-project-manage-cli 8.1.1 → 8.1.2

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/dist/index.js CHANGED
@@ -1044,6 +1044,7 @@ function validateWebIdeMessagePush(o) {
1044
1044
  return { ok: false, reason: "webide-message \u7F3A\u5C11 user" };
1045
1045
  }
1046
1046
  const useNewAgent = o.useNewAgent === true;
1047
+ const tools = Array.isArray(o.tools) ? o.tools.filter((t) => typeof t === "string" && t.trim().length > 0).map((t) => t.trim()) : void 0;
1047
1048
  return {
1048
1049
  ok: true,
1049
1050
  data: {
@@ -1056,7 +1057,8 @@ function validateWebIdeMessagePush(o) {
1056
1057
  apiKey: o.apiKey.trim(),
1057
1058
  workdir: o.workdir.trim(),
1058
1059
  user: o.user.trim(),
1059
- ...useNewAgent ? { useNewAgent: true } : {}
1060
+ ...useNewAgent ? { useNewAgent: true } : {},
1061
+ ...tools && tools.length > 0 ? { tools } : {}
1060
1062
  }
1061
1063
  };
1062
1064
  }
@@ -2250,12 +2250,22 @@ AskQuestion \u5DF2\u901A\u8FC7 MCP \u670D\u52A1\u5668 custom-user-tools \u6CE8\u
2250
2250
  var WORKSPACE_BOUNDARY_HINT = `[\u5DE5\u4F5C\u533A\u8FB9\u754C]
2251
2251
  \u6240\u6709\u6587\u4EF6\u8BFB\u5199\u3001\u641C\u7D22\uFF08Grep/Glob/Read\uFF09\u3001Shell \u5FC5\u987B\u4E25\u683C\u9650\u5236\u5728\u5F53\u524D\u5DE5\u4F5C\u533A cwd \u5185\u3002
2252
2252
  \u7981\u6B62\u8BBF\u95EE\u5DE5\u4F5C\u533A\u5916\u8DEF\u5F84\uFF08\u5982\u5176\u5B83\u9879\u76EE\u3001~/.cursor\u3001agent-transcripts\u3001\u7CFB\u7EDF\u76EE\u5F55\u7B49\uFF09\u3002`;
2253
+ function wantsTool(name, options, legacyDefault) {
2254
+ if (options.toolNames) {
2255
+ return options.toolNames.includes(name);
2256
+ }
2257
+ return legacyDefault;
2258
+ }
2253
2259
  function createCursorCustomTools(cfg2, options) {
2260
+ const enableAppend = options.enableAppendMessage !== false && Boolean(options.appendMessageContent);
2261
+ const enableAsk = options.enableAskQuestion !== false;
2262
+ const enablePlan = options.enableWebIdePlanTools === true;
2263
+ const enableMysql = options.enableMysqlTools === true;
2254
2264
  const tools = {
2255
- ...options.enableAppendMessage !== false && options.appendMessageContent ? createAppendMessageCustomTools({
2265
+ ...wantsTool("AppendMessage", options, enableAppend) && options.appendMessageContent ? createAppendMessageCustomTools({
2256
2266
  appendContent: options.appendMessageContent
2257
2267
  }) : {},
2258
- ...options.enableAskQuestion !== false ? createAskQuestionTool({
2268
+ ...wantsTool("AskQuestion", options, enableAsk) ? createAskQuestionTool({
2259
2269
  onInvoke: options?.onAskQuestion,
2260
2270
  execute: options?.askQuestionExecute
2261
2271
  }) : {}
@@ -2263,24 +2273,39 @@ function createCursorCustomTools(cfg2, options) {
2263
2273
  if (options?.taskId && options.workdir) {
2264
2274
  const { cli } = createApmApiClient(cfg2);
2265
2275
  const taskId = options.taskId;
2266
- if (options.enableWebIdePlanTools) {
2276
+ if (wantsTool("RecommendPlan", options, enablePlan)) {
2267
2277
  Object.assign(
2268
2278
  tools,
2269
2279
  createRecommendPlanTool({
2270
2280
  webideRecommendPlan: (args) => cli.webideRecommendPlan({ taskId, ...args })
2271
- }),
2281
+ })
2282
+ );
2283
+ }
2284
+ if (wantsTool("UpsertWebIdePlan", options, enablePlan)) {
2285
+ Object.assign(
2286
+ tools,
2272
2287
  createUpsertWebIdePlanTool({
2273
2288
  webideUpsertPlan: (args) => cli.webideUpsertPlan({ taskId, ...args })
2274
- }),
2289
+ })
2290
+ );
2291
+ }
2292
+ if (wantsTool("UpsertWebIdeTestCases", options, enablePlan)) {
2293
+ Object.assign(
2294
+ tools,
2275
2295
  createUpsertWebIdeTestCasesTool({
2276
2296
  webideReplaceTestCases: (args) => cli.webideReplaceTestCases({ taskId, ...args })
2277
- }),
2297
+ })
2298
+ );
2299
+ }
2300
+ if (wantsTool("MergeWebIdePullRequests", options, enablePlan)) {
2301
+ Object.assign(
2302
+ tools,
2278
2303
  createMergeWebIdePullRequestsTool({
2279
2304
  webideMergePullRequests: () => cli.webideMergePullRequests({ taskId })
2280
2305
  })
2281
2306
  );
2282
2307
  }
2283
- if (options.enableMysqlTools && options.sqlExecutionId && options.workdir) {
2308
+ if (wantsTool("MysqlExecute", options, enableMysql) && options.sqlExecutionId && options.workdir) {
2284
2309
  Object.assign(
2285
2310
  tools,
2286
2311
  createMysqlExecuteTool({
@@ -2440,6 +2465,7 @@ async function runCursorAgent(cfg2, ctx, options) {
2440
2465
  enableWebIdePlanTools: options.enableWebIdePlanTools,
2441
2466
  enableMysqlTools: options.enableMysqlTools,
2442
2467
  sqlExecutionId: options.sqlExecutionId,
2468
+ toolNames: options.toolNames,
2443
2469
  taskId: options.taskId,
2444
2470
  workdir,
2445
2471
  enablePackageStatusTools: options.enablePackageStatusTools,
@@ -4663,6 +4689,7 @@ ${assumptionAnswersText}` : msg2.content,
4663
4689
  enablePtySessionMcp: startLocalServices,
4664
4690
  enableMysqlTools: executeSql,
4665
4691
  sqlExecutionId,
4692
+ toolNames: Array.isArray(msg2.tools) && msg2.tools.length > 0 ? msg2.tools : void 0,
4666
4693
  enableSandbox: false,
4667
4694
  onInvalidatePersistedAgentId: startLocalServices ? void 0 : () => {
4668
4695
  if (designAction) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "8.1.1",
3
+ "version": "8.1.2",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,