toolcraft 0.0.129 → 0.0.130

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/composition.json CHANGED
@@ -108,7 +108,7 @@
108
108
  },
109
109
  {
110
110
  "name": "toolcraft",
111
- "version": "0.0.129",
111
+ "version": "0.0.130",
112
112
  "license": "MIT"
113
113
  },
114
114
  {
@@ -118,7 +118,7 @@
118
118
  },
119
119
  {
120
120
  "name": "toolcraft-schema",
121
- "version": "0.0.129",
121
+ "version": "0.0.130",
122
122
  "license": "MIT"
123
123
  },
124
124
  {
package/dist/cli.d.ts CHANGED
@@ -7,8 +7,14 @@ export { renderErrorReport } from "./error-report.js";
7
7
  export type { ErrorReportRenderContext, ErrorReportRenderResult } from "./error-report.js";
8
8
  export { configureTheme };
9
9
  type Casing = "kebab" | "snake";
10
+ export type CLIHelpDepth = "concise" | "extended";
10
11
  export interface CLIControls {
11
12
  debug?: boolean;
13
+ /**
14
+ * Group `--help` depth. `extended` (default) lists every nested action under the
15
+ * help target; `concise` lists only direct children.
16
+ */
17
+ help?: CLIHelpDepth;
12
18
  logLevel?: boolean;
13
19
  output?: boolean | CLIOutputControl;
14
20
  verbose?: boolean;
package/dist/cli.js CHANGED
@@ -663,6 +663,7 @@ function resolveCLIControls(controls) {
663
663
  validateOutputFormats(outputFormats);
664
664
  return {
665
665
  debug: controls?.debug === true,
666
+ help: controls?.help === "concise" ? "concise" : "extended",
666
667
  logLevel: controls?.logLevel === true,
667
668
  output: controls?.output === true || typeof controls?.output === "object",
668
669
  outputFormats,
@@ -1132,11 +1133,31 @@ function formatCommandRowName(node, casing, globalLongOptionFlags) {
1132
1133
  const name = parameterTokens.length === 0 ? baseName : `${baseName} ${parameterTokens.join(" ")}`;
1133
1134
  return name;
1134
1135
  }
1135
- function formatCommandRows(group, scope, casing, globalLongOptionFlags) {
1136
- return getHelpChildren(group, scope).map((child) => ({
1137
- name: formatCommandRowName(child, casing, globalLongOptionFlags),
1138
- description: child.description ?? ""
1139
- }));
1136
+ function formatCommandRows(group, scope, casing, globalLongOptionFlags, help) {
1137
+ if (help === "concise") {
1138
+ return getHelpChildren(group, scope).map((child) => ({
1139
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
1140
+ description: child.description ?? "",
1141
+ kind: child.kind,
1142
+ depth: 0
1143
+ }));
1144
+ }
1145
+ const rows = [];
1146
+ const visit = (node, depth) => {
1147
+ for (const child of getHelpChildren(node, scope)) {
1148
+ rows.push({
1149
+ name: formatCommandRowName(child, casing, globalLongOptionFlags),
1150
+ description: child.description ?? "",
1151
+ kind: child.kind,
1152
+ depth
1153
+ });
1154
+ if (child.kind === "group") {
1155
+ visit(child, depth + 1);
1156
+ }
1157
+ }
1158
+ };
1159
+ visit(group, 0);
1160
+ return rows;
1140
1161
  }
1141
1162
  function formatGlobalOptionsLine(ctx) {
1142
1163
  const flags = [];
@@ -1222,7 +1243,7 @@ function formatGroupUsageSuffix(group, scope, casing, globalLongOptionFlags) {
1222
1243
  function renderGroupHelp(group, breadcrumb, scope, casing, globalOptions, rootUsageName, isRoot) {
1223
1244
  const sections = [];
1224
1245
  const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion, globalOptions.controls);
1225
- const commandRows = formatCommandRows(group, scope, casing, globalLongOptionFlags);
1246
+ const commandRows = formatCommandRows(group, scope, casing, globalLongOptionFlags, globalOptions.controls.help);
1226
1247
  if (commandRows.length > 0) {
1227
1248
  sections.push(`${text.sectionHeader("Commands")}\n${formatHelpCommandList(commandRows)}`);
1228
1249
  }
@@ -1288,7 +1309,7 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
1288
1309
  const globalLongOptionFlags = getGlobalLongOptionFlags(globalOptions.presetsEnabled, globalOptions.showVersion, globalOptions.controls);
1289
1310
  const node = target.node;
1290
1311
  if (node.kind === "group") {
1291
- const commandRows = formatCommandRows(node, "cli", casing, globalLongOptionFlags);
1312
+ const commandRows = formatCommandRows(node, "cli", casing, globalLongOptionFlags, globalOptions.controls.help);
1292
1313
  const isRoot = node === root;
1293
1314
  return `${JSON.stringify({
1294
1315
  schemaVersion: 1,
@@ -1297,7 +1318,12 @@ function renderJsonHelp(target, root, casing, globalOptions, rootUsageName) {
1297
1318
  path: target.breadcrumb.filter((segment) => segment.length > 0),
1298
1319
  usage: buildUsageLine(target.breadcrumb, rootUsageName, formatGroupUsageSuffix(node, "cli", casing, globalLongOptionFlags)),
1299
1320
  ...(node.description === undefined ? {} : { description: node.description }),
1300
- commands: commandRows.map((row) => ({ name: row.name, description: row.description })),
1321
+ commands: commandRows.map((row) => ({
1322
+ name: row.name,
1323
+ description: row.description,
1324
+ kind: row.kind,
1325
+ depth: row.depth
1326
+ })),
1301
1327
  options: isRoot
1302
1328
  ? collectSchemaGlobalFieldRows(node, "cli", casing, globalLongOptionFlags).map((row) => ({
1303
1329
  name: row.flags.split(/[ ,]+/)[0]?.replace(/^--/, "") ?? row.flags,
@@ -108,7 +108,7 @@
108
108
  },
109
109
  {
110
110
  "name": "toolcraft",
111
- "version": "0.0.129",
111
+ "version": "0.0.130",
112
112
  "license": "MIT"
113
113
  },
114
114
  {
@@ -118,7 +118,7 @@
118
118
  },
119
119
  {
120
120
  "name": "toolcraft-schema",
121
- "version": "0.0.129",
121
+ "version": "0.0.130",
122
122
  "license": "MIT"
123
123
  },
124
124
  {
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "toolcraft-schema",
11
- "version": "0.0.129",
11
+ "version": "0.0.130",
12
12
  "license": "MIT"
13
13
  }
14
14
  ]
@@ -117,7 +117,7 @@ export function formatColumns(opts) {
117
117
  export function formatCommandList(commands) {
118
118
  return formatColumns({
119
119
  rows: commands.map((cmd) => ({
120
- left: cmd.name,
120
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${cmd.name}`,
121
121
  right: cmd.description
122
122
  }))
123
123
  });
@@ -1,6 +1,8 @@
1
1
  export interface CommandInfo {
2
2
  name: string;
3
3
  description: string;
4
+ /** Nesting depth relative to the help target. Depth 0 is a direct child. */
5
+ depth?: number;
4
6
  }
5
7
  export interface OptionInfo {
6
8
  flags: string;
@@ -190,7 +190,7 @@ export function formatOption(flags, description) {
190
190
  export function formatCommandList(commands) {
191
191
  return formatColumns({
192
192
  rows: commands.map((cmd) => ({
193
- left: text.command(cmd.name),
193
+ left: `${" ".repeat((cmd.depth ?? 0) * 2)}${text.command(cmd.name)}`,
194
194
  right: cmd.description
195
195
  }))
196
196
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.129",
3
+ "version": "0.0.130",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -153,7 +153,7 @@
153
153
  "yaml"
154
154
  ],
155
155
  "optionalDependencies": {
156
- "toolcraft-schema": "0.0.129",
156
+ "toolcraft-schema": "0.0.130",
157
157
  "toolcraft-design": "*",
158
158
  "@poe-code/frontmatter": "*",
159
159
  "@poe-code/agent-mcp-config": "*",