@galaxy-tool-util/cli 1.1.0 → 1.3.0

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.
Files changed (71) hide show
  1. package/dist/commands/annotate-connections.d.ts +30 -0
  2. package/dist/commands/annotate-connections.d.ts.map +1 -0
  3. package/dist/commands/annotate-connections.js +42 -0
  4. package/dist/commands/annotate-connections.js.map +1 -0
  5. package/dist/commands/connection-validation.d.ts +20 -0
  6. package/dist/commands/connection-validation.d.ts.map +1 -0
  7. package/dist/commands/connection-validation.js +26 -0
  8. package/dist/commands/connection-validation.js.map +1 -0
  9. package/dist/commands/cytoscapejs/_template-bundled.d.ts +2 -0
  10. package/dist/commands/cytoscapejs/_template-bundled.d.ts.map +1 -0
  11. package/dist/commands/cytoscapejs/_template-bundled.js +182 -0
  12. package/dist/commands/cytoscapejs/_template-bundled.js.map +1 -0
  13. package/dist/commands/cytoscapejs.d.ts +12 -0
  14. package/dist/commands/cytoscapejs.d.ts.map +1 -0
  15. package/dist/commands/cytoscapejs.js +62 -0
  16. package/dist/commands/cytoscapejs.js.map +1 -0
  17. package/dist/commands/mermaid.d.ts +2 -0
  18. package/dist/commands/mermaid.d.ts.map +1 -1
  19. package/dist/commands/mermaid.js +5 -1
  20. package/dist/commands/mermaid.js.map +1 -1
  21. package/dist/commands/summarize.d.ts +31 -0
  22. package/dist/commands/summarize.d.ts.map +1 -0
  23. package/dist/commands/summarize.js +85 -0
  24. package/dist/commands/summarize.js.map +1 -0
  25. package/dist/commands/validate-workflow.d.ts +1 -0
  26. package/dist/commands/validate-workflow.d.ts.map +1 -1
  27. package/dist/commands/validate-workflow.js +38 -3
  28. package/dist/commands/validate-workflow.js.map +1 -1
  29. package/dist/index.d.ts +3 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +2 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/meta/extract-spec.d.ts +13 -0
  34. package/dist/meta/extract-spec.d.ts.map +1 -0
  35. package/dist/meta/extract-spec.js +90 -0
  36. package/dist/meta/extract-spec.js.map +1 -0
  37. package/dist/meta/index.d.ts +8 -0
  38. package/dist/meta/index.d.ts.map +1 -0
  39. package/dist/meta/index.js +21 -0
  40. package/dist/meta/index.js.map +1 -0
  41. package/dist/meta/spec-types.d.ts +40 -0
  42. package/dist/meta/spec-types.d.ts.map +1 -0
  43. package/dist/meta/spec-types.js +11 -0
  44. package/dist/meta/spec-types.js.map +1 -0
  45. package/dist/meta/specs.d.ts +4 -0
  46. package/dist/meta/specs.d.ts.map +1 -0
  47. package/dist/meta/specs.js +10 -0
  48. package/dist/meta/specs.js.map +1 -0
  49. package/dist/meta/types.d.ts +55 -0
  50. package/dist/meta/types.d.ts.map +1 -0
  51. package/dist/meta/types.js +9 -0
  52. package/dist/meta/types.js.map +1 -0
  53. package/dist/meta-build.d.ts +13 -0
  54. package/dist/meta-build.d.ts.map +1 -0
  55. package/dist/meta-build.js +60 -0
  56. package/dist/meta-build.js.map +1 -0
  57. package/dist/programs/galaxy-tool-cache.d.ts +5 -1
  58. package/dist/programs/galaxy-tool-cache.d.ts.map +1 -1
  59. package/dist/programs/galaxy-tool-cache.js +14 -56
  60. package/dist/programs/galaxy-tool-cache.js.map +1 -1
  61. package/dist/programs/gxwf.d.ts +7 -1
  62. package/dist/programs/gxwf.d.ts.map +1 -1
  63. package/dist/programs/gxwf.js +36 -184
  64. package/dist/programs/gxwf.js.map +1 -1
  65. package/dist/spec/build-program.d.ts +12 -0
  66. package/dist/spec/build-program.d.ts.map +1 -0
  67. package/dist/spec/build-program.js +102 -0
  68. package/dist/spec/build-program.js.map +1 -0
  69. package/package.json +10 -4
  70. package/spec/galaxy-tool-cache.json +177 -0
  71. package/spec/gxwf.json +693 -0
@@ -1,66 +1,24 @@
1
- import { Command } from "commander";
2
1
  import { runAdd } from "../commands/add.js";
3
2
  import { runList } from "../commands/list.js";
4
3
  import { runInfo } from "../commands/info.js";
5
4
  import { runClear } from "../commands/clear.js";
6
5
  import { runPopulateWorkflow } from "../commands/populate-workflow.js";
7
6
  import { runSchema } from "../commands/schema.js";
7
+ import { runSummarize } from "../commands/summarize.js";
8
8
  import { runStructuralSchema } from "../commands/structural-schema.js";
9
+ import { buildProgramFromSpec } from "../spec/build-program.js";
10
+ import { galaxyToolCacheSpec } from "../meta/specs.js";
11
+ const handlers = {
12
+ add: runAdd,
13
+ list: runList,
14
+ info: runInfo,
15
+ clear: runClear,
16
+ schema: runSchema,
17
+ summarize: runSummarize,
18
+ populateWorkflow: runPopulateWorkflow,
19
+ structuralSchema: runStructuralSchema,
20
+ };
9
21
  export function buildGalaxyToolCacheProgram() {
10
- const program = new Command();
11
- program
12
- .name("galaxy-tool-cache")
13
- .description("Cache and inspect Galaxy tool metadata")
14
- .version("1.0.0");
15
- program
16
- .command("add")
17
- .description("Fetch a tool from ToolShed/Galaxy and cache it")
18
- .argument("<tool_id>", "Tool ID (full toolshed path or TRS ID)")
19
- .option("--version <ver>", "Tool version")
20
- .option("--cache-dir <dir>", "Cache directory")
21
- .option("--galaxy-url <url>", "Galaxy instance URL for fallback")
22
- .action(runAdd);
23
- program
24
- .command("list")
25
- .description("List cached tools")
26
- .option("--json", "Output as JSON")
27
- .option("--cache-dir <dir>", "Cache directory")
28
- .action(runList);
29
- program
30
- .command("info")
31
- .description("Show metadata for a cached tool")
32
- .argument("<tool_id>", "Tool ID")
33
- .option("--version <ver>", "Tool version")
34
- .option("--cache-dir <dir>", "Cache directory")
35
- .action(runInfo);
36
- program
37
- .command("clear")
38
- .description("Clear cached tools")
39
- .argument("[prefix]", "Only clear tools matching this prefix")
40
- .option("--cache-dir <dir>", "Cache directory")
41
- .action(runClear);
42
- program
43
- .command("schema")
44
- .description("Export JSON Schema for a cached tool's parameters")
45
- .argument("<tool_id>", "Tool ID")
46
- .option("--version <ver>", "Tool version")
47
- .option("--representation <rep>", "State representation (e.g., workflow_step)", "workflow_step")
48
- .option("--output <file>", "Output file (default: stdout)")
49
- .option("--cache-dir <dir>", "Cache directory")
50
- .action(runSchema);
51
- program
52
- .command("populate-workflow")
53
- .description("Scan a workflow and cache all referenced tools")
54
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
55
- .option("--cache-dir <dir>", "Cache directory")
56
- .option("--galaxy-url <url>", "Galaxy instance URL for fallback")
57
- .action(runPopulateWorkflow);
58
- program
59
- .command("structural-schema")
60
- .description("Export the structural JSON Schema for Galaxy workflows")
61
- .option("--format <fmt>", "Workflow format: format2 (default) or native", "format2")
62
- .option("--output <file>", "Output file (default: stdout)")
63
- .action(runStructuralSchema);
64
- return program;
22
+ return buildProgramFromSpec(galaxyToolCacheSpec, handlers);
65
23
  }
66
24
  //# sourceMappingURL=galaxy-tool-cache.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"galaxy-tool-cache.js","sourceRoot":"","sources":["../../src/programs/galaxy-tool-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,UAAU,2BAA2B;IACzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,mBAAmB,CAAC;SACzB,WAAW,CAAC,wCAAwC,CAAC;SACrD,OAAO,CAAC,OAAO,CAAC,CAAC;IAEpB,OAAO;SACJ,OAAO,CAAC,KAAK,CAAC;SACd,WAAW,CAAC,gDAAgD,CAAC;SAC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AO;IACb,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,YAAY;IACvB,gBAAgB,EAAE,mBAAmB;IACrC,gBAAgB,EAAE,mBAAmB;CACtC,CAAC;AAEF,MAAM,UAAU,2BAA2B;IACzC,OAAO,oBAAoB,CAAC,mBAAmB,EAAE,QAAQ,CAAC,CAAC;AAC7D,CAAC"}
@@ -1,3 +1,9 @@
1
- import { Command } from "commander";
1
+ /**
2
+ * `gxwf` commander program — built at runtime from `spec/gxwf.json`
3
+ * plus the handler registry below. The JSON spec is the source of truth
4
+ * for the command surface; this file just wires action functions to
5
+ * spec entries by name.
6
+ */
7
+ import type { Command } from "commander";
2
8
  export declare function buildGxwfProgram(): Command;
3
9
  //# sourceMappingURL=gxwf.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gxwf.d.ts","sourceRoot":"","sources":["../../src/programs/gxwf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoBpC,wBAAgB,gBAAgB,IAAI,OAAO,CAsQ1C"}
1
+ {"version":3,"file":"gxwf.d.ts","sourceRoot":"","sources":["../../src/programs/gxwf.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuEzC,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C"}
@@ -1,4 +1,3 @@
1
- import { Command } from "commander";
2
1
  import { runClean } from "../commands/clean.js";
3
2
  import { runCleanTree } from "../commands/clean-tree.js";
4
3
  import { runConvert } from "../commands/convert.js";
@@ -7,6 +6,7 @@ import { runRoundtrip } from "../commands/roundtrip.js";
7
6
  import { runRoundtripTree } from "../commands/roundtrip-tree.js";
8
7
  import { runLint } from "../commands/lint.js";
9
8
  import { runMermaid } from "../commands/mermaid.js";
9
+ import { runCytoscapeJs } from "../commands/cytoscapejs.js";
10
10
  import { runLintTree } from "../commands/lint-tree.js";
11
11
  import { runValidateWorkflow } from "../commands/validate-workflow.js";
12
12
  import { runValidateTests } from "../commands/validate-tests.js";
@@ -16,189 +16,41 @@ import { runToolSearch } from "../commands/tool-search.js";
16
16
  import { runToolVersions } from "../commands/tool-versions.js";
17
17
  import { runToolRevisions } from "../commands/tool-revisions.js";
18
18
  import { runRepoSearch } from "../commands/repo-search.js";
19
- import { addStrictOptions } from "../commands/strict-options.js";
19
+ import { buildProgramFromSpec } from "../spec/build-program.js";
20
+ import { gxwfSpec } from "../meta/specs.js";
21
+ const handlers = {
22
+ validateWorkflow: runValidateWorkflow,
23
+ validateTests: runValidateTests,
24
+ clean: runClean,
25
+ lint: runLint,
26
+ convert: runConvert,
27
+ roundtrip: runRoundtrip,
28
+ mermaid: (file, output, opts) => runMermaid(file, {
29
+ output,
30
+ comments: opts.comments,
31
+ annotateConnections: opts.annotateConnections,
32
+ cacheDir: opts.cacheDir,
33
+ }),
34
+ cytoscapeJs: (file, output, opts) => runCytoscapeJs(file, {
35
+ output,
36
+ html: opts.html,
37
+ json: opts.json,
38
+ annotateConnections: opts.annotateConnections,
39
+ cacheDir: opts.cacheDir,
40
+ layout: opts.layout,
41
+ }),
42
+ validateTree: runValidateTree,
43
+ lintTree: runLintTree,
44
+ cleanTree: runCleanTree,
45
+ convertTree: runConvertTree,
46
+ roundtripTree: runRoundtripTree,
47
+ validateTestsTree: runValidateTestsTree,
48
+ toolSearch: runToolSearch,
49
+ toolVersions: runToolVersions,
50
+ toolRevisions: runToolRevisions,
51
+ repoSearch: runRepoSearch,
52
+ };
20
53
  export function buildGxwfProgram() {
21
- const program = new Command();
22
- program
23
- .name("gxwf")
24
- .description("Galaxy workflow operations — validate, clean, lint, convert (single-file and tree)")
25
- .version("1.0.0");
26
- addStrictOptions(program
27
- .command("validate")
28
- .description("Validate Galaxy workflow files (structure + optional tool state)")
29
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
30
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
31
- .option("--no-tool-state", "Skip tool state validation")
32
- .option("--cache-dir <dir>", "Tool cache directory")
33
- .option("--mode <mode>", "Validation backend: effect (default) or json-schema", "effect")
34
- .option("--tool-schema-dir <dir>", "Directory of pre-exported per-tool JSON Schemas (for offline json-schema mode)")
35
- .option("--json", "Output structured JSON report")
36
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")).action(runValidateWorkflow);
37
- program
38
- .command("validate-tests")
39
- .description("Validate a workflow-test file (*-tests.yml, *.gxwf-tests.yml) against the Galaxy Tests schema")
40
- .argument("<file>", "Tests file (*-tests.yml)")
41
- .option("--json", "Output structured JSON report")
42
- .option("--workflow <path>", "Cross-check job inputs + output assertions against a workflow (.ga / .gxwf.yml)")
43
- .action(runValidateTests);
44
- program
45
- .command("clean")
46
- .description("Strip stale keys and decode legacy tool_state encoding")
47
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
48
- .option("--output <file>", "Write cleaned workflow to file (default: stdout)")
49
- .option("--diff", "Show diff of changes instead of writing output")
50
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
51
- .option("--json", "Output structured JSON report")
52
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")
53
- .option("--skip-uuid", "Skip stripping uuid fields (errors are always stripped)")
54
- .action(runClean);
55
- addStrictOptions(program
56
- .command("lint")
57
- .description("Lint Galaxy workflow — structural checks, best practices, tool state validation")
58
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
59
- .option("--skip-best-practices", "Skip annotation/creator/license/label checks")
60
- .option("--skip-state-validation", "Skip tool state validation against cached tool definitions")
61
- .option("--cache-dir <dir>", "Tool cache directory (for state validation)")
62
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
63
- .option("--json", "Output structured JSON result")
64
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")).action(runLint);
65
- addStrictOptions(program
66
- .command("convert")
67
- .description("Convert between native (.ga) and format2 (.gxwf.yml) formats")
68
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
69
- .option("--to <format>", "Target format: native or format2 (infers opposite by default)")
70
- .option("--output <file>", "Write result to file (default: stdout)")
71
- .option("--compact", "Omit position info in format2 output")
72
- .option("--json", "Force JSON output")
73
- .option("--yaml", "Force YAML output")
74
- .option("--format <fmt>", "Force source format (auto-detected by default)")
75
- .option("--stateful", "Use cached tool definitions for schema-aware state re-encoding")
76
- .option("--cache-dir <dir>", "Tool cache directory (for --stateful)")).action(runConvert);
77
- addStrictOptions(program
78
- .command("roundtrip")
79
- .description("Roundtrip-validate a native workflow: native → format2 → native, diff tool_state")
80
- .argument("<file>", "Native workflow file (.ga)")
81
- .option("--cache-dir <dir>", "Tool cache directory")
82
- .option("--format <fmt>", "Force source format (must resolve to native)")
83
- .option("--json", "Output structured JSON report")
84
- .option("--errors-only", "Suppress benign diffs and clean steps from output")
85
- .option("--benign-only", "Show only steps with benign diffs (no errors, no failures)")
86
- .option("--brief", "Omit per-diff list; show only the one-line summary")).action(runRoundtrip);
87
- program
88
- .command("mermaid")
89
- .description("Render a Galaxy workflow as a Mermaid flowchart diagram")
90
- .argument("<file>", "Workflow file (.ga, .gxwf.yml)")
91
- .argument("[output]", "Output path (.mmd for raw, .md for fenced code block); stdout if omitted")
92
- .option("--comments", "Render frame comments as Mermaid subgraphs")
93
- .action((file, output, opts) => runMermaid(file, { output, comments: opts.comments }));
94
- // -- Tree (batch) variants --
95
- addStrictOptions(program
96
- .command("validate-tree")
97
- .description("Batch validate all workflows under a directory")
98
- .argument("<dir>", "Directory to scan for workflows")
99
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
100
- .option("--no-tool-state", "Skip tool state validation")
101
- .option("--cache-dir <dir>", "Tool cache directory")
102
- .option("--mode <mode>", "Validation backend: effect (default) or json-schema", "effect")
103
- .option("--tool-schema-dir <dir>", "Directory of pre-exported per-tool JSON Schemas (for offline json-schema mode)")
104
- .option("--json", "Output structured JSON report")
105
- .option("--report-markdown [file]", "Write Markdown report to file (or stdout if omitted)")
106
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")).action(runValidateTree);
107
- addStrictOptions(program
108
- .command("lint-tree")
109
- .description("Batch lint all workflows under a directory")
110
- .argument("<dir>", "Directory to scan for workflows")
111
- .option("--skip-best-practices", "Skip annotation/creator/license/label checks")
112
- .option("--skip-state-validation", "Skip tool state validation against cached tool definitions")
113
- .option("--cache-dir <dir>", "Tool cache directory (for state validation)")
114
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
115
- .option("--json", "Output structured JSON report")
116
- .option("--report-markdown [file]", "Write Markdown report to file (or stdout if omitted)")
117
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")).action(runLintTree);
118
- program
119
- .command("clean-tree")
120
- .description("Batch clean all workflows under a directory")
121
- .argument("<dir>", "Directory to scan for workflows")
122
- .option("--output-dir <dir>", "Write cleaned workflows to directory (mirrors source tree)")
123
- .option("--format <fmt>", "Force format: native or format2 (auto-detected by default)")
124
- .option("--json", "Output structured JSON report")
125
- .option("--report-markdown [file]", "Write Markdown report to file (or stdout if omitted)")
126
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")
127
- .option("--skip-uuid", "Skip stripping uuid fields (errors are always stripped)")
128
- .action(runCleanTree);
129
- addStrictOptions(program
130
- .command("convert-tree")
131
- .description("Batch convert all workflows under a directory")
132
- .argument("<dir>", "Directory to scan for workflows")
133
- .option("--to <format>", "Target format: native or format2 (infers opposite by default)")
134
- .option("--output-dir <dir>", "Write converted workflows to directory (required)")
135
- .option("--compact", "Omit position info in format2 output")
136
- .option("--report-json", "Output structured JSON report")
137
- .option("--json", "Force JSON output for converted files")
138
- .option("--yaml", "Force YAML output")
139
- .option("--format <fmt>", "Force source format (auto-detected by default)")
140
- .option("--stateful", "Use cached tool definitions for schema-aware state re-encoding")
141
- .option("--cache-dir <dir>", "Tool cache directory (for --stateful)")).action(runConvertTree);
142
- addStrictOptions(program
143
- .command("roundtrip-tree")
144
- .description("Batch roundtrip-validate native workflows under a directory")
145
- .argument("<dir>", "Directory to scan for native workflows")
146
- .option("--cache-dir <dir>", "Tool cache directory")
147
- .option("--format <fmt>", "Force source format (must resolve to native)")
148
- .option("--json", "Output structured JSON report")
149
- .option("--errors-only", "List only files with errors or failures")
150
- .option("--benign-only", "List only files with benign diffs (no errors, no failures)")
151
- .option("--brief", "Omit per-file lines; print only the aggregate summary")
152
- .option("--report-markdown [file]", "Write Markdown report to file (or stdout if omitted)")
153
- .option("--report-html [file]", "Write HTML report to file (or stdout if omitted)")).action(runRoundtripTree);
154
- program
155
- .command("validate-tests-tree")
156
- .description("Batch validate workflow-test files (*-tests.yml / *.gxwf-tests.yml) under a directory")
157
- .argument("<dir>", "Directory to scan for test files")
158
- .option("--json", "Output structured JSON report")
159
- .option("--auto-workflow", "Pair each tests file with a sibling workflow by filename convention (foo.gxwf-tests.yml ↔ foo.gxwf.yml/foo.ga) and cross-check inputs/outputs")
160
- .action(runValidateTestsTree);
161
- program
162
- .command("tool-search")
163
- .description("Search the Galaxy Tool Shed for tools matching a query")
164
- .argument("<query>", "Search text (e.g. 'fastqc')")
165
- .option("--page-size <n>", "Server-side page size", "20")
166
- .option("--max-results <n>", "Hard cap on hits returned", "50")
167
- .option("--page <n>", "Starting page (1-indexed)", "1")
168
- .option("--owner <user>", "Filter hits to a single repo owner (client-side)")
169
- .option("--match-name", "Drop hits where the query is not a token in the tool name")
170
- .option("--json", "Emit machine-readable JSON envelope")
171
- .option("--enrich", "Resolve each hit's ParsedTool and attach it as `parsedTool` (one fetch per hit; off by default)")
172
- .option("--cache-dir <dir>", "Tool cache directory (used by --enrich; shared with galaxy-tool-cache)")
173
- .action(runToolSearch);
174
- program
175
- .command("tool-versions")
176
- .description("List TRS-published versions of a Tool Shed tool (newest last)")
177
- .argument("<tool-id>", "TRS id (owner~repo~tool_id) or pretty form (owner/repo/tool_id)")
178
- .option("--json", "Emit machine-readable JSON envelope")
179
- .option("--latest", "Print only the latest version")
180
- .action(runToolVersions);
181
- program
182
- .command("tool-revisions")
183
- .description("List changeset revisions that publish a Tool Shed tool (ordered oldest→newest). " +
184
- "Use for reproducible (name, owner, changeset_revision) workflow pins. " +
185
- "Caveat: version strings are not monotonic — the same version can appear in multiple changesets.")
186
- .argument("<tool-id>", "TRS id (owner~repo~tool_id) or pretty form (owner/repo/tool_id)")
187
- .option("--tool-version <v>", "Restrict to revisions that publish this exact tool version")
188
- .option("--latest", "Print only the newest matching revision")
189
- .option("--json", "Emit machine-readable JSON envelope")
190
- .action(runToolRevisions);
191
- program
192
- .command("repo-search")
193
- .description("Search the Galaxy Tool Shed for repositories. Ranking is popularity-boosted; supports server-side --owner / --category filters via reserved keywords.")
194
- .argument("<query>", "Search text (e.g. 'fastqc')")
195
- .option("--page-size <n>", "Server-side page size", "20")
196
- .option("--max-results <n>", "Hard cap on hits returned", "50")
197
- .option("--page <n>", "Starting page (1-indexed)", "1")
198
- .option("--owner <user>", "Restrict to a single owner (server-side `owner:` keyword)")
199
- .option("--category <name>", "Restrict to a category (server-side `category:` keyword)")
200
- .option("--json", "Emit machine-readable JSON envelope")
201
- .action(runRepoSearch);
202
- return program;
54
+ return buildProgramFromSpec(gxwfSpec, handlers);
203
55
  }
204
56
  //# sourceMappingURL=gxwf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"gxwf.js","sourceRoot":"","sources":["../../src/programs/gxwf.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,OAAO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,IAAI,CAAC,mBAAmB;QAC7C,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC;IACJ,WAAW,EAAE,CACX,IAAY,EACZ,MAA0B,EAC1B,IAMC,EACD,EAAE,CACF,cAAc,CAAC,IAAI,EAAE;QACnB,MAAM;QACN,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;QAC7C,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,IAAI,CAAC,MAAM;KACpB,CAAC;IACJ,YAAY,EAAE,eAAe;IAC7B,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,YAAY;IACvB,WAAW,EAAE,cAAc;IAC3B,aAAa,EAAE,gBAAgB;IAC/B,iBAAiB,EAAE,oBAAoB;IACvC,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,eAAe;IAC7B,aAAa,EAAE,gBAAgB;IAC/B,UAAU,EAAE,aAAa;CAC1B,CAAC;AAEF,MAAM,UAAU,gBAAgB;IAC9B,OAAO,oBAAoB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Build a commander `Command` tree from a declarative `ProgramSpec` plus
3
+ * a name-keyed handler registry. The spec carries the static shape
4
+ * (commands, args, options, defaults); the registry supplies the
5
+ * runtime action functions.
6
+ */
7
+ import { Command } from "commander";
8
+ import type { ProgramSpec } from "../meta/spec-types.js";
9
+ export type HandlerFn = (...args: any[]) => void | Promise<void>;
10
+ export type HandlerRegistry = Record<string, HandlerFn>;
11
+ export declare function buildProgramFromSpec(spec: ProgramSpec, handlers: HandlerRegistry): Command;
12
+ //# sourceMappingURL=build-program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-program.d.ts","sourceRoot":"","sources":["../../src/spec/build-program.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAA2B,MAAM,uBAAuB,CAAC;AAElF,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACjE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AAExD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAS1F"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Build a commander `Command` tree from a declarative `ProgramSpec` plus
3
+ * a name-keyed handler registry. The spec carries the static shape
4
+ * (commands, args, options, defaults); the registry supplies the
5
+ * runtime action functions.
6
+ */
7
+ import { Command } from "commander";
8
+ export function buildProgramFromSpec(spec, handlers) {
9
+ validateSpec(spec, handlers);
10
+ const program = new Command();
11
+ program.name(spec.name).description(spec.description).version(spec.version);
12
+ const groups = spec.optionGroups ?? {};
13
+ for (const cmd of spec.commands) {
14
+ program.addCommand(buildCommand(cmd, groups, handlers));
15
+ }
16
+ return program;
17
+ }
18
+ /**
19
+ * Cheap structural checks the YAML loader doesn't catch — duplicate
20
+ * names, dangling refs, missing handlers. Runs before commander touches
21
+ * the spec so errors point at the YAML, not at a confusing commander
22
+ * stack trace.
23
+ */
24
+ function validateSpec(spec, handlers) {
25
+ const groups = spec.optionGroups ?? {};
26
+ const seenCommands = new Set();
27
+ for (const cmd of spec.commands) {
28
+ if (seenCommands.has(cmd.name)) {
29
+ throw new Error(`Duplicate command "${cmd.name}" in spec "${spec.name}"`);
30
+ }
31
+ seenCommands.add(cmd.name);
32
+ if (!handlers[cmd.handler]) {
33
+ throw new Error(`Missing handler "${cmd.handler}" for command "${cmd.name}"`);
34
+ }
35
+ const seenOptions = new Set();
36
+ const checkOptName = (flags) => {
37
+ const optName = attributeNameFromFlags(flags);
38
+ if (seenOptions.has(optName)) {
39
+ throw new Error(`Duplicate option "${optName}" on command "${cmd.name}"`);
40
+ }
41
+ seenOptions.add(optName);
42
+ };
43
+ for (const opt of cmd.options ?? [])
44
+ checkOptName(opt.flags);
45
+ for (const groupName of cmd.optionGroups ?? []) {
46
+ const group = groups[groupName];
47
+ if (!group) {
48
+ throw new Error(`Command "${cmd.name}" references unknown optionGroup "${groupName}"`);
49
+ }
50
+ for (const opt of group)
51
+ checkOptName(opt.flags);
52
+ }
53
+ }
54
+ }
55
+ /**
56
+ * Extract the option's attributeName the same way commander does — the
57
+ * first long flag, stripped of `--no-` prefix and camelCased. Used only
58
+ * for duplicate detection here; commander itself owns the canonical
59
+ * derivation at runtime.
60
+ */
61
+ function attributeNameFromFlags(flags) {
62
+ const long = flags.split(/[ ,|]+/).find((part) => part.startsWith("--"));
63
+ if (!long)
64
+ return flags;
65
+ const stripped = long.replace(/^--(no-)?/, "");
66
+ return stripped.replace(/-([a-z])/g, (_m, c) => c.toUpperCase());
67
+ }
68
+ function buildCommand(spec, groups, handlers) {
69
+ const cmd = new Command(spec.name).description(spec.description);
70
+ for (const arg of spec.args ?? []) {
71
+ if (arg.description !== undefined)
72
+ cmd.argument(arg.raw, arg.description);
73
+ else
74
+ cmd.argument(arg.raw);
75
+ }
76
+ for (const opt of spec.options ?? []) {
77
+ addOption(cmd, opt);
78
+ }
79
+ for (const groupName of spec.optionGroups ?? []) {
80
+ const group = groups[groupName];
81
+ if (!group) {
82
+ throw new Error(`Command "${spec.name}" references unknown optionGroup "${groupName}"`);
83
+ }
84
+ for (const opt of group)
85
+ addOption(cmd, opt);
86
+ }
87
+ const handler = handlers[spec.handler];
88
+ if (!handler) {
89
+ throw new Error(`Missing handler "${spec.handler}" for command "${spec.name}"`);
90
+ }
91
+ cmd.action(handler);
92
+ return cmd;
93
+ }
94
+ function addOption(cmd, opt) {
95
+ if (opt.default !== undefined) {
96
+ cmd.option(opt.flags, opt.description, String(opt.default));
97
+ }
98
+ else {
99
+ cmd.option(opt.flags, opt.description);
100
+ }
101
+ }
102
+ //# sourceMappingURL=build-program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-program.js","sourceRoot":"","sources":["../../src/spec/build-program.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,MAAM,UAAU,oBAAoB,CAAC,IAAiB,EAAE,QAAyB;IAC/E,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1D,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,YAAY,CAAC,IAAiB,EAAE,QAAyB;IAChE,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,IAAI,EAAE,CAAC;IACvC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChC,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,CAAC,IAAI,cAAc,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;QAC5E,CAAC;QACD,YAAY,CAAC,GAAG,CAAC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AE,GAAG,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,OAAO,kBAAkB,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC;IAClF,CAAC;IACD,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACpB,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,SAAS,CAAC,GAAY,EAAE,GAAe;IAC9C,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC;IAC9D,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galaxy-tool-util/cli",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "galaxy-tool-cache CLI — cache and inspect Galaxy tool metadata",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,10 +11,15 @@
11
11
  ".": {
12
12
  "types": "./dist/index.d.ts",
13
13
  "import": "./dist/index.js"
14
+ },
15
+ "./meta": {
16
+ "types": "./dist/meta/index.d.ts",
17
+ "import": "./dist/meta/index.js"
14
18
  }
15
19
  },
16
20
  "files": [
17
21
  "dist",
22
+ "spec",
18
23
  "README.md",
19
24
  "LICENSE"
20
25
  ],
@@ -34,9 +39,10 @@
34
39
  "effect": "^3.21.0",
35
40
  "nunjucks": "^3.2.4",
36
41
  "yaml": "^2.8.3",
37
- "@galaxy-tool-util/core": "1.1.0",
38
- "@galaxy-tool-util/schema": "1.1.0",
39
- "@galaxy-tool-util/search": "1.1.0"
42
+ "@galaxy-tool-util/connection-validation": "1.2.0",
43
+ "@galaxy-tool-util/core": "1.2.0",
44
+ "@galaxy-tool-util/schema": "1.2.0",
45
+ "@galaxy-tool-util/search": "1.2.0"
40
46
  },
41
47
  "devDependencies": {
42
48
  "@types/node": "^25.5.0",