toolcraft 0.0.51 → 0.0.53

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/cli.js CHANGED
@@ -735,6 +735,14 @@ function isNodeVisibleInScope(node, scope) {
735
735
  function getVisibleChildren(group, scope) {
736
736
  return group.children.filter((child) => isNodeVisibleInScope(child, scope));
737
737
  }
738
+ function getHelpChildren(group, scope) {
739
+ return getVisibleChildren(group, scope).filter((child) => {
740
+ if (child.kind === "command") {
741
+ return child.hidden !== true;
742
+ }
743
+ return true;
744
+ });
745
+ }
738
746
  function findVisibleChild(group, token, scope) {
739
747
  return getVisibleChildren(group, scope).find((child) => child.name === token || child.aliases.includes(token));
740
748
  }
@@ -1039,7 +1047,7 @@ function formatCommandRowName(node, casing, globalLongOptionFlags) {
1039
1047
  return name;
1040
1048
  }
1041
1049
  function formatCommandRows(group, scope, casing, globalLongOptionFlags) {
1042
- return getVisibleChildren(group, scope).map((child) => ({
1050
+ return getHelpChildren(group, scope).map((child) => ({
1043
1051
  name: formatCommandRowName(child, casing, globalLongOptionFlags),
1044
1052
  description: child.description ?? ""
1045
1053
  }));
@@ -1083,7 +1091,7 @@ function collectSchemaGlobalFieldRows(group, scope, casing, globalLongOptionFlag
1083
1091
  }
1084
1092
  return;
1085
1093
  }
1086
- for (const child of getVisibleChildren(node, scope)) {
1094
+ for (const child of getHelpChildren(node, scope)) {
1087
1095
  visit(child);
1088
1096
  }
1089
1097
  };
@@ -1110,6 +1118,15 @@ function buildUsageLine(breadcrumb, rootUsageName, suffix) {
1110
1118
  const tokens = [rootUsageName, subPath, suffix].filter((segment) => segment.length > 0);
1111
1119
  return tokens.join(" ");
1112
1120
  }
1121
+ function formatGroupUsageSuffix(group, scope, casing, globalLongOptionFlags) {
1122
+ if (group.default !== undefined &&
1123
+ group.default.hidden === true &&
1124
+ group.default.scope.includes(scope)) {
1125
+ const parameterTokens = formatCommandParameterTokens(group.default, casing, globalLongOptionFlags);
1126
+ return ["[command]", "[OPTIONS]", ...parameterTokens].join(" ");
1127
+ }
1128
+ return "[command] [OPTIONS]";
1129
+ }
1113
1130
  function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUsageName, isRoot) {
1114
1131
  const sections = [];
1115
1132
  const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion, globalOptions.controls);
@@ -1130,7 +1147,7 @@ function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUs
1130
1147
  return renderHelpDocument({
1131
1148
  breadcrumb,
1132
1149
  rootUsageName,
1133
- usageLine: buildUsageLine(breadcrumb, rootUsageName, "[command] [OPTIONS]"),
1150
+ usageLine: buildUsageLine(breadcrumb, rootUsageName, formatGroupUsageSuffix(group, scope, casing, globalLongOptionFlags)),
1134
1151
  description: group.description,
1135
1152
  requiresAuth: group.requires?.auth === true,
1136
1153
  sections
@@ -1220,6 +1237,8 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
1220
1237
  return null;
1221
1238
  }
1222
1239
  const command = new CommanderCommand(node.name);
1240
+ Reflect.set(command, "_toolcraftHidden", node.hidden);
1241
+ Reflect.set(command, "_toolcraftOriginalName", node.name);
1223
1242
  const collected = collectFields(node.params, casing, globalLongOptionFlags);
1224
1243
  const fields = assignPositionals(collected.fields, node.positional);
1225
1244
  validateUniqueOptionFlags(fields, globalLongOptionFlags);
@@ -1263,10 +1282,14 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
1263
1282
  if (!isNodeVisibleInScope(node, "cli")) {
1264
1283
  return null;
1265
1284
  }
1285
+ const reservedChildNames = node.children
1286
+ .filter((child) => !isNodeVisibleInScope(child, "cli"))
1287
+ .flatMap((child) => getNodeCommandNames(child));
1266
1288
  const visibleChildren = node.children
1267
1289
  .map((child) => createNodeCommand(child, casing, globalLongOptionFlags, execute, presetsEnabled, controls, nextPathSegments))
1268
1290
  .filter((child) => child !== null);
1269
1291
  const group = new CommanderCommand(node.name);
1292
+ Reflect.set(group, "_toolcraftReservedChildNames", reservedChildNames);
1270
1293
  if (node.description !== undefined) {
1271
1294
  group.description(node.description);
1272
1295
  }
@@ -1283,7 +1306,7 @@ function createNodeCommand(node, casing, globalLongOptionFlags, execute, presets
1283
1306
  return group;
1284
1307
  }
1285
1308
  function addCommanderChild(parent, child, isDefault, siblingNames) {
1286
- if (isDefault && child.name().length === 0) {
1309
+ if (isDefault && (child.name().length === 0 || isToolcraftHiddenCommander(child))) {
1287
1310
  let internalName = "__toolcraft_default__";
1288
1311
  let suffix = 2;
1289
1312
  while (siblingNames.has(internalName)) {
@@ -1291,10 +1314,33 @@ function addCommanderChild(parent, child, isDefault, siblingNames) {
1291
1314
  suffix += 1;
1292
1315
  }
1293
1316
  child.name(internalName);
1317
+ Reflect.set(parent, "_toolcraftHiddenDefaultNames", getToolcraftHiddenDefaultNames(parent).concat([
1318
+ ...new Set([Reflect.get(child, "_toolcraftOriginalName"), ...child.aliases()].filter((name) => typeof name === "string" && name.length > 0))
1319
+ ]));
1294
1320
  parent.addCommand(child, { hidden: true, isDefault: true });
1295
1321
  return;
1296
1322
  }
1297
- parent.addCommand(child, isDefault ? { isDefault: true } : undefined);
1323
+ const options = {
1324
+ ...(isDefault ? { isDefault: true } : {}),
1325
+ ...(isToolcraftHiddenCommander(child) ? { hidden: true } : {})
1326
+ };
1327
+ parent.addCommand(child, Object.keys(options).length > 0 ? options : undefined);
1328
+ }
1329
+ function isToolcraftHiddenCommander(command) {
1330
+ return Reflect.get(command, "_toolcraftHidden") === true;
1331
+ }
1332
+ function getToolcraftHiddenDefaultNames(command) {
1333
+ const value = Reflect.get(command, "_toolcraftHiddenDefaultNames");
1334
+ return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
1335
+ }
1336
+ function getToolcraftReservedChildNames(command) {
1337
+ const value = Reflect.get(command, "_toolcraftReservedChildNames");
1338
+ return Array.isArray(value)
1339
+ ? value.filter((item) => typeof item === "string")
1340
+ : [];
1341
+ }
1342
+ function getNodeCommandNames(node) {
1343
+ return [node.name, ...node.aliases].filter((name) => name.length > 0);
1298
1344
  }
1299
1345
  function addGlobalOptions(command, presetsEnabled, controls) {
1300
1346
  const options = [];
@@ -3003,6 +3049,14 @@ function findUnknownCommanderCommand(program, argv) {
3003
3049
  }
3004
3050
  continue;
3005
3051
  }
3052
+ if (getToolcraftHiddenDefaultNames(current).includes(token) ||
3053
+ getToolcraftReservedChildNames(current).includes(token)) {
3054
+ return {
3055
+ input: token,
3056
+ currentCommand: current,
3057
+ commandPath: pathSegments.join(" ")
3058
+ };
3059
+ }
3006
3060
  if (current.commands.length === 0 || getDefaultCommanderCommandName(current) !== undefined) {
3007
3061
  return undefined;
3008
3062
  }
@@ -3073,6 +3127,9 @@ export async function runCLI(roots, options = {}) {
3073
3127
  if (version !== undefined) {
3074
3128
  program.version(version, "--version");
3075
3129
  }
3130
+ Reflect.set(program, "_toolcraftReservedChildNames", root.children
3131
+ .filter((child) => !isNodeVisibleInScope(child, "cli"))
3132
+ .flatMap((child) => getNodeCommandNames(child)));
3076
3133
  let lastActionCommand;
3077
3134
  let resolvedCommandPath = "";
3078
3135
  let errorReportContext;
package/dist/index.d.ts CHANGED
@@ -99,6 +99,7 @@ export type HandlerContext<TParamsSchema extends ObjectSchema<any> = AnyObjectSc
99
99
  export interface CommandConfig<TServices extends object, TParamsSchema extends ObjectSchema<any>, TSecrets extends SecretDeclarations | undefined, TResult> {
100
100
  name: string;
101
101
  description?: string;
102
+ hidden?: boolean;
102
103
  examples?: CommandExample[];
103
104
  aliases?: string[];
104
105
  positional?: string[];
@@ -116,6 +117,7 @@ export interface Command<TServices extends object = EmptyServices, TParamsSchema
116
117
  kind: "command";
117
118
  name: string;
118
119
  description?: string;
120
+ hidden: boolean;
119
121
  examples: CommandExample[];
120
122
  aliases: string[];
121
123
  positional: string[];
package/dist/index.js CHANGED
@@ -292,6 +292,7 @@ function createBaseCommand(config) {
292
292
  kind: "command",
293
293
  name: config.name,
294
294
  description: config.description,
295
+ hidden: config.hidden ?? false,
295
296
  examples: cloneCommandExamples(config.examples),
296
297
  aliases: [...(config.aliases ?? [])],
297
298
  positional: [...(config.positional ?? [])],
@@ -308,6 +309,7 @@ function createBaseCommand(config) {
308
309
  Object.defineProperty(command, commandConfigSymbol, {
309
310
  value: {
310
311
  scope: cloneScope(config.scope),
312
+ hidden: config.hidden ?? false,
311
313
  examples: cloneCommandExamples(config.examples),
312
314
  result: config.result,
313
315
  humanInLoop: config.humanInLoop,
@@ -358,6 +360,7 @@ function materializeCommand(command, inherited) {
358
360
  kind: "command",
359
361
  name: command.name,
360
362
  description: command.description,
363
+ hidden: internal.hidden,
361
364
  examples: cloneCommandExamples(internal.examples),
362
365
  aliases: [...command.aliases],
363
366
  positional: [...command.positional],
@@ -374,6 +377,7 @@ function materializeCommand(command, inherited) {
374
377
  Object.defineProperty(materialized, commandConfigSymbol, {
375
378
  value: {
376
379
  scope: cloneScope(internal.scope),
380
+ hidden: internal.hidden,
377
381
  examples: cloneCommandExamples(internal.examples),
378
382
  result: internal.result,
379
383
  humanInLoop: internal.humanInLoop,
package/dist/mcp-proxy.js CHANGED
@@ -78,6 +78,7 @@ function createProxyCommand(parent, tool, commandName, connection) {
78
78
  kind: "command",
79
79
  name: commandName,
80
80
  description: tool.description,
81
+ hidden: false,
81
82
  examples: [],
82
83
  aliases: [],
83
84
  positional: [],
@@ -20,6 +20,5 @@
20
20
  "files": [
21
21
  "dist"
22
22
  ],
23
- "dependencies": {},
24
23
  "devDependencies": {}
25
24
  }
@@ -18,8 +18,6 @@
18
18
  "dist"
19
19
  ],
20
20
  "dependencies": {
21
- "@poe-code/agent-defs": "*",
22
- "@poe-code/config-mutations": "*",
23
21
  "yaml": "^2.8.3"
24
22
  }
25
23
  }
@@ -22,7 +22,6 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "toolcraft-design": "*",
26
25
  "jsonc-parser": "^3.3.1",
27
26
  "smol-toml": "^1.3.0",
28
27
  "yaml": "^2.8.1"
@@ -20,7 +20,6 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@poe-code/process-runner": "*",
24
23
  "yaml": "*"
25
24
  }
26
25
  }
@@ -14,7 +14,6 @@
14
14
  "scripts": {
15
15
  "build": "node ../../scripts/guard-package-dist.mjs && tsc"
16
16
  },
17
- "dependencies": {},
18
17
  "files": [
19
18
  "dist"
20
19
  ],
@@ -15,7 +15,6 @@
15
15
  "build": "tsc"
16
16
  },
17
17
  "dependencies": {
18
- "auth-store": "*",
19
18
  "jose": "^6.1.2"
20
19
  },
21
20
  "devDependencies": {
@@ -13,9 +13,6 @@
13
13
  "url": "git+https://github.com/poe-platform/poe-code.git",
14
14
  "directory": "packages/tiny-mcp-client"
15
15
  },
16
- "dependencies": {
17
- "mcp-oauth": "*"
18
- },
19
16
  "devDependencies": {
20
17
  "@modelcontextprotocol/sdk": "^1.26.0",
21
18
  "tiny-stdio-mcp-server": "*"
@@ -20,7 +20,6 @@
20
20
  "dist"
21
21
  ],
22
22
  "dependencies": {
23
- "@poe-code/frontmatter": "*",
24
23
  "fast-string-width": "^3.0.2",
25
24
  "fast-wrap-ansi": "^0.2.0",
26
25
  "sisteransi": "^1.0.5"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -47,7 +47,7 @@
47
47
  "postpack": "node ../../scripts/manage-bundled-workspace-deps.mjs cleanup . toolcraft-design @poe-code/frontmatter @poe-code/agent-mcp-config @poe-code/agent-human-in-loop @poe-code/task-list @poe-code/agent-defs @poe-code/config-mutations @poe-code/process-runner tiny-mcp-client mcp-oauth auth-store"
48
48
  },
49
49
  "dependencies": {
50
- "toolcraft-schema": "0.0.51",
50
+ "toolcraft-schema": "0.0.53",
51
51
  "commander": "^14.0.3",
52
52
  "fast-string-width": "^3.0.2",
53
53
  "fast-wrap-ansi": "^0.2.0",