gitlab-catalog-browser 0.1.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.
- package/LICENSE +201 -0
- package/README.md +75 -0
- package/bin/gitlab-ci-cli.js +29 -0
- package/dist/api/catalog.d.ts +38 -0
- package/dist/api/catalog.d.ts.map +1 -0
- package/dist/api/catalog.js +72 -0
- package/dist/api/catalog.js.map +1 -0
- package/dist/api/gitlab.d.ts +69 -0
- package/dist/api/gitlab.d.ts.map +1 -0
- package/dist/api/gitlab.js +226 -0
- package/dist/api/gitlab.js.map +1 -0
- package/dist/api/lint.d.ts +61 -0
- package/dist/api/lint.d.ts.map +1 -0
- package/dist/api/lint.js +41 -0
- package/dist/api/lint.js.map +1 -0
- package/dist/cache/schema-cache.d.ts +54 -0
- package/dist/cache/schema-cache.d.ts.map +1 -0
- package/dist/cache/schema-cache.js +124 -0
- package/dist/cache/schema-cache.js.map +1 -0
- package/dist/commands/batch.d.ts +19 -0
- package/dist/commands/batch.d.ts.map +1 -0
- package/dist/commands/batch.js +174 -0
- package/dist/commands/batch.js.map +1 -0
- package/dist/commands/catalog.d.ts +42 -0
- package/dist/commands/catalog.d.ts.map +1 -0
- package/dist/commands/catalog.js +158 -0
- package/dist/commands/catalog.js.map +1 -0
- package/dist/commands/component.d.ts +46 -0
- package/dist/commands/component.d.ts.map +1 -0
- package/dist/commands/component.js +213 -0
- package/dist/commands/component.js.map +1 -0
- package/dist/commands/pipeline.d.ts +61 -0
- package/dist/commands/pipeline.d.ts.map +1 -0
- package/dist/commands/pipeline.js +880 -0
- package/dist/commands/pipeline.js.map +1 -0
- package/dist/commands/setup.d.ts +119 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +391 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/skills.d.ts +39 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +208 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/validate.d.ts +27 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +201 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config/loader.d.ts +80 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +217 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +45 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +437 -0
- package/dist/index.js.map +1 -0
- package/dist/output/table.d.ts +28 -0
- package/dist/output/table.d.ts.map +1 -0
- package/dist/output/table.js +67 -0
- package/dist/output/table.js.map +1 -0
- package/dist/types/api.d.ts +66 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +61 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/catalog.d.ts +77 -0
- package/dist/types/catalog.d.ts.map +1 -0
- package/dist/types/catalog.js +5 -0
- package/dist/types/catalog.js.map +1 -0
- package/package.json +60 -0
- package/skill-data/core/reference.md +127 -0
- package/skill-data/core/templates.md +97 -0
- package/skill-data/core/workflows.md +84 -0
- package/skill-data/manifest.json +12 -0
- package/skill-data/templates/basic-pipeline.yml +29 -0
- package/skill-data/templates/docker-build.yml +38 -0
- package/skill-data/templates/multi-stage.yml +43 -0
- package/skills/gitlab-catalog-browser/SKILL.md +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* gitlab-catalog-browser — CLI entry point
|
|
4
|
+
*
|
|
5
|
+
* Main entry point for the `gitlab-ci-cli` command.
|
|
6
|
+
* Registers all commands using Commander.js.
|
|
7
|
+
* Loads configuration at startup and makes it available to all commands.
|
|
8
|
+
*/
|
|
9
|
+
import { Command } from 'commander';
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
|
+
import { join, dirname } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { handleInit, handleUpgrade, handleDoctor, } from './commands/setup.js';
|
|
14
|
+
import { handleCatalogList, handleCatalogSearch, handleCatalogInfo, } from './commands/catalog.js';
|
|
15
|
+
import { handleComponentSchema, handleComponentInputs, handleComponentWorkflows, handleComponentJobs, } from './commands/component.js';
|
|
16
|
+
import { handleValidate } from './commands/validate.js';
|
|
17
|
+
import { handlePipelineExplain, handlePipelineTrace, handlePipelineStages, handlePipelineIncludes, handlePipelineSummary, } from './commands/pipeline.js';
|
|
18
|
+
import { handleSkillsList, handleSkillsGet, handleSkillsPath, } from './commands/skills.js';
|
|
19
|
+
import { handleBatch } from './commands/batch.js';
|
|
20
|
+
import { loadConfig } from './config/loader.js';
|
|
21
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
22
|
+
const __dirname = dirname(__filename);
|
|
23
|
+
function loadPackageVersion() {
|
|
24
|
+
try {
|
|
25
|
+
const pkgPath = join(__dirname, '..', 'package.json');
|
|
26
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
27
|
+
return pkg.version ?? '0.0.0';
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return '0.0.0';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Load configuration at startup — this reads config files, env vars, etc.
|
|
34
|
+
// CLI flags will override these values later in individual command handlers.
|
|
35
|
+
const cliConfig = loadConfig();
|
|
36
|
+
// Utility: merge CLI flag overrides into the loaded config
|
|
37
|
+
function overrideConfig(overrides) {
|
|
38
|
+
return { ...cliConfig, ...overrides };
|
|
39
|
+
}
|
|
40
|
+
const program = new Command();
|
|
41
|
+
program
|
|
42
|
+
.name('gitlab-ci-cli')
|
|
43
|
+
.description('CLI tool for browsing the GitLab CI/CD Catalog and managing pipelines')
|
|
44
|
+
.version(loadPackageVersion());
|
|
45
|
+
// ── Global options ───────────────────────────
|
|
46
|
+
// These can be used with any command
|
|
47
|
+
program
|
|
48
|
+
.option('--gitlab-url <url>', 'GitLab instance URL')
|
|
49
|
+
.option('--token <token>', 'GitLab personal access token');
|
|
50
|
+
// ── init ──────────────────────────────────────
|
|
51
|
+
program
|
|
52
|
+
.command('init')
|
|
53
|
+
.description('Initialize project configuration and verify environment')
|
|
54
|
+
.option('--force', 'Overwrite existing configuration file')
|
|
55
|
+
.option('--completion <shell>', 'Generate shell completion script (bash|zsh)')
|
|
56
|
+
.action(async (options) => {
|
|
57
|
+
const initOptions = { force: options.force };
|
|
58
|
+
if (options.completion) {
|
|
59
|
+
const shell = options.completion.toLowerCase();
|
|
60
|
+
if (shell !== 'bash' && shell !== 'zsh') {
|
|
61
|
+
console.error(`Unsupported shell: ${options.completion}. Use 'bash' or 'zsh'.`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
initOptions.completion = shell;
|
|
65
|
+
}
|
|
66
|
+
const result = handleInit(initOptions);
|
|
67
|
+
for (const msg of result.messages) {
|
|
68
|
+
console.log(msg);
|
|
69
|
+
}
|
|
70
|
+
process.exit(result.exitCode);
|
|
71
|
+
});
|
|
72
|
+
// ── upgrade ───────────────────────────────────
|
|
73
|
+
program
|
|
74
|
+
.command('upgrade')
|
|
75
|
+
.description('Check for and apply CLI upgrades from the npm registry')
|
|
76
|
+
.option('--dry-run', 'Check for upgrades without applying them')
|
|
77
|
+
.action(async (options) => {
|
|
78
|
+
const upgradeOptions = { dryRun: options.dryRun ?? false };
|
|
79
|
+
const result = await handleUpgrade(upgradeOptions);
|
|
80
|
+
for (const msg of result.messages) {
|
|
81
|
+
console.log(msg);
|
|
82
|
+
}
|
|
83
|
+
process.exit(result.exitCode);
|
|
84
|
+
});
|
|
85
|
+
// ── doctor ────────────────────────────────────
|
|
86
|
+
program
|
|
87
|
+
.command('doctor')
|
|
88
|
+
.description('Run comprehensive environment diagnostics')
|
|
89
|
+
.option('--json', 'Output results in JSON format')
|
|
90
|
+
.action(async (options) => {
|
|
91
|
+
// Use loaded config, allowing CLI flags to override
|
|
92
|
+
const mergedConfig = overrideConfig({
|
|
93
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
94
|
+
token: program.opts().token || undefined,
|
|
95
|
+
});
|
|
96
|
+
const doctorOptions = {
|
|
97
|
+
json: options.json ?? false,
|
|
98
|
+
gitlabUrl: mergedConfig.gitlabUrl,
|
|
99
|
+
token: mergedConfig.token,
|
|
100
|
+
};
|
|
101
|
+
const result = await handleDoctor(doctorOptions);
|
|
102
|
+
if (doctorOptions.json) {
|
|
103
|
+
console.log(JSON.stringify(result.report, null, 2));
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
for (const check of result.report.checks) {
|
|
107
|
+
const icon = check.status === 'pass' ? '✓' : '✗';
|
|
108
|
+
console.log(`${icon} ${check.name}: ${check.message}`);
|
|
109
|
+
}
|
|
110
|
+
console.log('');
|
|
111
|
+
console.log(result.report.summary.failed === 0
|
|
112
|
+
? 'All checks passed'
|
|
113
|
+
: `${result.report.summary.failed} check(s) failed`);
|
|
114
|
+
}
|
|
115
|
+
process.exit(result.exitCode);
|
|
116
|
+
});
|
|
117
|
+
// ── catalog ──────────────────────────────────
|
|
118
|
+
const catalogCmd = program
|
|
119
|
+
.command('catalog')
|
|
120
|
+
.description('Browse GitLab CI/CD Catalog components');
|
|
121
|
+
catalogCmd
|
|
122
|
+
.command('list')
|
|
123
|
+
.description('List all catalog components in a namespace')
|
|
124
|
+
.requiredOption('--org <namespace>', 'GitLab namespace or organization')
|
|
125
|
+
.option('--json', 'Output as JSON')
|
|
126
|
+
.option('--page <n>', 'Page number', parseInt)
|
|
127
|
+
.option('--per-page <n>', 'Results per page', parseInt)
|
|
128
|
+
.action(async (options) => {
|
|
129
|
+
const mergedConfig = overrideConfig({
|
|
130
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
131
|
+
token: program.opts().token || undefined,
|
|
132
|
+
});
|
|
133
|
+
const result = await handleCatalogList(options.org, mergedConfig, {
|
|
134
|
+
json: options.json ?? false,
|
|
135
|
+
page: options.page,
|
|
136
|
+
perPage: options.perPage,
|
|
137
|
+
});
|
|
138
|
+
console.log(result.output);
|
|
139
|
+
process.exit(result.exitCode);
|
|
140
|
+
});
|
|
141
|
+
catalogCmd
|
|
142
|
+
.command('search')
|
|
143
|
+
.description('Search catalog components by keyword')
|
|
144
|
+
.argument('<query>', 'Search keyword')
|
|
145
|
+
.option('--json', 'Output as JSON')
|
|
146
|
+
.option('--page <n>', 'Page number', parseInt)
|
|
147
|
+
.option('--per-page <n>', 'Results per page', parseInt)
|
|
148
|
+
.action(async (query, options) => {
|
|
149
|
+
const mergedConfig = overrideConfig({
|
|
150
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
151
|
+
token: program.opts().token || undefined,
|
|
152
|
+
});
|
|
153
|
+
const result = await handleCatalogSearch(query, mergedConfig, {
|
|
154
|
+
json: options.json ?? false,
|
|
155
|
+
page: options.page,
|
|
156
|
+
perPage: options.perPage,
|
|
157
|
+
});
|
|
158
|
+
console.log(result.output);
|
|
159
|
+
process.exit(result.exitCode);
|
|
160
|
+
});
|
|
161
|
+
catalogCmd
|
|
162
|
+
.command('info')
|
|
163
|
+
.description('Show detailed information about a specific component')
|
|
164
|
+
.argument('<full-path>', 'Full component path (e.g. to-be-continuous/docker-build)')
|
|
165
|
+
.option('--json', 'Output as JSON')
|
|
166
|
+
.action(async (fullPath, options) => {
|
|
167
|
+
const mergedConfig = overrideConfig({
|
|
168
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
169
|
+
token: program.opts().token || undefined,
|
|
170
|
+
});
|
|
171
|
+
const result = await handleCatalogInfo(fullPath, mergedConfig, {
|
|
172
|
+
json: options.json ?? false,
|
|
173
|
+
});
|
|
174
|
+
console.log(result.output);
|
|
175
|
+
process.exit(result.exitCode);
|
|
176
|
+
});
|
|
177
|
+
// ── component ────────────────────────────────
|
|
178
|
+
const componentCmd = program
|
|
179
|
+
.command('component')
|
|
180
|
+
.description('Inspect GitLab CI/CD component schemas');
|
|
181
|
+
componentCmd
|
|
182
|
+
.command('schema')
|
|
183
|
+
.description('Get the complete YAML specification of a component')
|
|
184
|
+
.argument('<full-path>', 'Full component path (e.g. to-be-continuous/docker-build)')
|
|
185
|
+
.option('--version <version>', 'Specific version to fetch')
|
|
186
|
+
.option('--output-file <path>', 'Save schema to file')
|
|
187
|
+
.option('--no-cache', 'Bypass cache and fetch fresh data')
|
|
188
|
+
.action(async (fullPath, options) => {
|
|
189
|
+
const mergedConfig = overrideConfig({
|
|
190
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
191
|
+
token: program.opts().token || undefined,
|
|
192
|
+
});
|
|
193
|
+
const result = await handleComponentSchema(fullPath, mergedConfig, {
|
|
194
|
+
version: options.version,
|
|
195
|
+
outputFile: options.outputFile,
|
|
196
|
+
noCache: options.noCache ?? false,
|
|
197
|
+
});
|
|
198
|
+
console.log(result.output);
|
|
199
|
+
process.exit(result.exitCode);
|
|
200
|
+
});
|
|
201
|
+
componentCmd
|
|
202
|
+
.command('inputs')
|
|
203
|
+
.description('List all input parameters for a component')
|
|
204
|
+
.argument('<full-path>', 'Full component path')
|
|
205
|
+
.option('--json', 'Output as JSON')
|
|
206
|
+
.action(async (fullPath, options) => {
|
|
207
|
+
const mergedConfig = overrideConfig({
|
|
208
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
209
|
+
token: program.opts().token || undefined,
|
|
210
|
+
});
|
|
211
|
+
const result = await handleComponentInputs(fullPath, mergedConfig, {
|
|
212
|
+
json: options.json ?? false,
|
|
213
|
+
});
|
|
214
|
+
console.log(result.output);
|
|
215
|
+
process.exit(result.exitCode);
|
|
216
|
+
});
|
|
217
|
+
componentCmd
|
|
218
|
+
.command('workflows')
|
|
219
|
+
.description('List workflow definitions for a component')
|
|
220
|
+
.argument('<full-path>', 'Full component path')
|
|
221
|
+
.action(async (fullPath) => {
|
|
222
|
+
const mergedConfig = overrideConfig({
|
|
223
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
224
|
+
token: program.opts().token || undefined,
|
|
225
|
+
});
|
|
226
|
+
const result = await handleComponentWorkflows(fullPath, mergedConfig);
|
|
227
|
+
console.log(result.output);
|
|
228
|
+
process.exit(result.exitCode);
|
|
229
|
+
});
|
|
230
|
+
componentCmd
|
|
231
|
+
.command('jobs')
|
|
232
|
+
.description('List job definitions for a component')
|
|
233
|
+
.argument('<full-path>', 'Full component path')
|
|
234
|
+
.option('--with-artifacts', 'Show artifact dependency information')
|
|
235
|
+
.action(async (fullPath, options) => {
|
|
236
|
+
const mergedConfig = overrideConfig({
|
|
237
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
238
|
+
token: program.opts().token || undefined,
|
|
239
|
+
});
|
|
240
|
+
const result = await handleComponentJobs(fullPath, mergedConfig, {
|
|
241
|
+
withArtifacts: options.withArtifacts ?? false,
|
|
242
|
+
});
|
|
243
|
+
console.log(result.output);
|
|
244
|
+
process.exit(result.exitCode);
|
|
245
|
+
});
|
|
246
|
+
// ── pipeline ─────────────────────────────────
|
|
247
|
+
const pipelineCmd = program
|
|
248
|
+
.command('pipeline')
|
|
249
|
+
.description('Analyze GitLab CI pipeline configurations');
|
|
250
|
+
pipelineCmd
|
|
251
|
+
.command('explain')
|
|
252
|
+
.description('Show job dependency graph for specified jobs')
|
|
253
|
+
.argument('<file>', 'Path to .gitlab-ci.yml file')
|
|
254
|
+
.requiredOption('--jobs <list>', 'Comma-separated job names (or "all")')
|
|
255
|
+
.option('--json', 'Output as JSON')
|
|
256
|
+
.action(async (file, opts) => {
|
|
257
|
+
const mergedConfig = overrideConfig({
|
|
258
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
259
|
+
token: program.opts().token || undefined,
|
|
260
|
+
});
|
|
261
|
+
const result = await handlePipelineExplain(file, mergedConfig, {
|
|
262
|
+
jobs: opts.jobs,
|
|
263
|
+
json: opts.json ?? false,
|
|
264
|
+
});
|
|
265
|
+
console.log(result.output);
|
|
266
|
+
process.exit(result.exitCode);
|
|
267
|
+
});
|
|
268
|
+
pipelineCmd
|
|
269
|
+
.command('trace')
|
|
270
|
+
.description('Trace variable usage across the pipeline')
|
|
271
|
+
.argument('<file>', 'Path to .gitlab-ci.yml file')
|
|
272
|
+
.requiredOption('--var <name>', 'Variable name to trace')
|
|
273
|
+
.option('--json', 'Output as JSON')
|
|
274
|
+
.action(async (file, opts) => {
|
|
275
|
+
const mergedConfig = overrideConfig({
|
|
276
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
277
|
+
token: program.opts().token || undefined,
|
|
278
|
+
});
|
|
279
|
+
const result = await handlePipelineTrace(file, mergedConfig, {
|
|
280
|
+
var: opts.var,
|
|
281
|
+
json: opts.json ?? false,
|
|
282
|
+
});
|
|
283
|
+
console.log(result.output);
|
|
284
|
+
process.exit(result.exitCode);
|
|
285
|
+
});
|
|
286
|
+
pipelineCmd
|
|
287
|
+
.command('stages')
|
|
288
|
+
.description('List pipeline stages and their jobs')
|
|
289
|
+
.argument('<file>', 'Path to .gitlab-ci.yml file')
|
|
290
|
+
.option('--mermaid', 'Output as Mermaid diagram')
|
|
291
|
+
.option('--json', 'Output as JSON')
|
|
292
|
+
.action(async (file, opts) => {
|
|
293
|
+
const mergedConfig = overrideConfig({
|
|
294
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
295
|
+
token: program.opts().token || undefined,
|
|
296
|
+
});
|
|
297
|
+
const result = await handlePipelineStages(file, mergedConfig, {
|
|
298
|
+
mermaid: opts.mermaid ?? false,
|
|
299
|
+
json: opts.json ?? false,
|
|
300
|
+
});
|
|
301
|
+
console.log(result.output);
|
|
302
|
+
process.exit(result.exitCode);
|
|
303
|
+
});
|
|
304
|
+
pipelineCmd
|
|
305
|
+
.command('includes')
|
|
306
|
+
.description('Show include hierarchy of the pipeline')
|
|
307
|
+
.argument('<file>', 'Path to .gitlab-ci.yml file')
|
|
308
|
+
.option('--json', 'Output as JSON')
|
|
309
|
+
.action(async (file, opts) => {
|
|
310
|
+
const mergedConfig = overrideConfig({
|
|
311
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
312
|
+
token: program.opts().token || undefined,
|
|
313
|
+
});
|
|
314
|
+
const result = await handlePipelineIncludes(file, mergedConfig, {
|
|
315
|
+
json: opts.json ?? false,
|
|
316
|
+
});
|
|
317
|
+
console.log(result.output);
|
|
318
|
+
process.exit(result.exitCode);
|
|
319
|
+
});
|
|
320
|
+
pipelineCmd
|
|
321
|
+
.command('summary')
|
|
322
|
+
.description('Generate a structured pipeline summary')
|
|
323
|
+
.argument('<file>', 'Path to .gitlab-ci.yml file')
|
|
324
|
+
.option('--json', 'Output as JSON')
|
|
325
|
+
.action(async (file, opts) => {
|
|
326
|
+
const mergedConfig = overrideConfig({
|
|
327
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
328
|
+
token: program.opts().token || undefined,
|
|
329
|
+
});
|
|
330
|
+
const result = await handlePipelineSummary(file, mergedConfig, {
|
|
331
|
+
json: opts.json ?? false,
|
|
332
|
+
});
|
|
333
|
+
console.log(result.output);
|
|
334
|
+
process.exit(result.exitCode);
|
|
335
|
+
});
|
|
336
|
+
// ── validate ─────────────────────────────────
|
|
337
|
+
program
|
|
338
|
+
.command('validate')
|
|
339
|
+
.description('Validate a .gitlab-ci.yml pipeline configuration')
|
|
340
|
+
.argument('[file]', 'Path to .gitlab-ci.yml file')
|
|
341
|
+
.option('--stdin', 'Read pipeline content from stdin')
|
|
342
|
+
.option('--dry-run', 'Evaluate rules and show which jobs would execute')
|
|
343
|
+
.option('--project <path>', 'GitLab project path for context-aware validation')
|
|
344
|
+
.option('--var <key=value>', 'Simulate CI/CD variables (repeatable)', collectVar, [])
|
|
345
|
+
.option('--json', 'Output results as JSON')
|
|
346
|
+
.action(async (file, opts) => {
|
|
347
|
+
const mergedConfig = overrideConfig({
|
|
348
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
349
|
+
token: program.opts().token || undefined,
|
|
350
|
+
});
|
|
351
|
+
const options = {
|
|
352
|
+
stdin: opts.stdin ?? false,
|
|
353
|
+
dryRun: opts.dryRun ?? false,
|
|
354
|
+
project: opts.project,
|
|
355
|
+
vars: opts.Var,
|
|
356
|
+
json: opts.json ?? false,
|
|
357
|
+
};
|
|
358
|
+
const result = await handleValidate(file, mergedConfig, options);
|
|
359
|
+
console.log(result.output);
|
|
360
|
+
process.exit(result.exitCode);
|
|
361
|
+
});
|
|
362
|
+
// ── skills ────────────────────────────────────
|
|
363
|
+
const skillsCmd = program
|
|
364
|
+
.command('skills')
|
|
365
|
+
.description('Manage AI agent skill content');
|
|
366
|
+
skillsCmd
|
|
367
|
+
.command('list')
|
|
368
|
+
.description('List available skills')
|
|
369
|
+
.option('--json', 'Output as JSON')
|
|
370
|
+
.action(async (opts) => {
|
|
371
|
+
const mergedConfig = overrideConfig({
|
|
372
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
373
|
+
token: program.opts().token || undefined,
|
|
374
|
+
});
|
|
375
|
+
const result = await handleSkillsList(mergedConfig, {
|
|
376
|
+
json: opts.json ?? false,
|
|
377
|
+
});
|
|
378
|
+
console.log(result.output);
|
|
379
|
+
process.exit(result.exitCode);
|
|
380
|
+
});
|
|
381
|
+
skillsCmd
|
|
382
|
+
.command('get')
|
|
383
|
+
.description('Get skill content')
|
|
384
|
+
.argument('[name]', 'Skill name')
|
|
385
|
+
.option('--full', 'Include full reference and supplementary content')
|
|
386
|
+
.option('--all', 'Output every available skill')
|
|
387
|
+
.action(async (name, opts) => {
|
|
388
|
+
const mergedConfig = overrideConfig({
|
|
389
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
390
|
+
token: program.opts().token || undefined,
|
|
391
|
+
});
|
|
392
|
+
const result = await handleSkillsGet(name, mergedConfig, {
|
|
393
|
+
full: opts.full ?? false,
|
|
394
|
+
all: opts.all ?? false,
|
|
395
|
+
});
|
|
396
|
+
console.log(result.output);
|
|
397
|
+
process.exit(result.exitCode);
|
|
398
|
+
});
|
|
399
|
+
skillsCmd
|
|
400
|
+
.command('path')
|
|
401
|
+
.description('Print skill directory path')
|
|
402
|
+
.argument('[name]', 'Skill name')
|
|
403
|
+
.action(async (name) => {
|
|
404
|
+
const mergedConfig = overrideConfig({
|
|
405
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
406
|
+
token: program.opts().token || undefined,
|
|
407
|
+
});
|
|
408
|
+
const result = await handleSkillsPath(name, mergedConfig);
|
|
409
|
+
console.log(result.output);
|
|
410
|
+
process.exit(result.exitCode);
|
|
411
|
+
});
|
|
412
|
+
// ── batch ─────────────────────────────────────
|
|
413
|
+
program
|
|
414
|
+
.command('batch')
|
|
415
|
+
.description('Execute multiple commands in sequence')
|
|
416
|
+
.argument('[commands...]', 'Commands to execute')
|
|
417
|
+
.option('--bail', 'Stop on first failure')
|
|
418
|
+
.option('--json', 'Read commands from stdin as JSON array')
|
|
419
|
+
.action(async (commands, opts) => {
|
|
420
|
+
const mergedConfig = overrideConfig({
|
|
421
|
+
gitlabUrl: program.opts().gitlabUrl || undefined,
|
|
422
|
+
token: program.opts().token || undefined,
|
|
423
|
+
});
|
|
424
|
+
const result = await handleBatch(commands, mergedConfig, {
|
|
425
|
+
bail: opts.bail ?? false,
|
|
426
|
+
json: opts.json ?? false,
|
|
427
|
+
});
|
|
428
|
+
console.log(result.output);
|
|
429
|
+
process.exit(result.exitCode);
|
|
430
|
+
});
|
|
431
|
+
// ── Parse ─────────────────────────────────────
|
|
432
|
+
program.parse(process.argv);
|
|
433
|
+
// Helper: collect repeated --var values
|
|
434
|
+
function collectVar(value, previous) {
|
|
435
|
+
return [...previous, value];
|
|
436
|
+
}
|
|
437
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAEH,OAAO,EAAE,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C,CAAC;AAChC,CAAC,CAAC,CAAC;AAEL,iDAAiD;AACjD,OAAO;KACJ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,uCAAuC,CAAC;KACpD,QAAQ,CAAC,eAAe,EAAE,qBAAqB,CAAC;KAChD,MAAM,CAAC,QAAQ,EAAE,uBAAuB,CAAC;KACzC,MAAM,CAAC,QAAQ,EAAE,wCAAwC,CAAC;KAC1D,MAAM,CAAC,KAAK,EAAE,QAA8B,EAAE,IAAwC,EAAE,EAAE;IACzF,MAAM,YAAY,GAAG,cAAc,CAAC;QAClC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,IAAI,SAAS;QAChD,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,SAAS;KACzC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,YAAY,EAAE;QACvD,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK;QACxB,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,KAAK;KACzB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC,CAAC,CAAC;AAEL,iDAAiD;AACjD,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,wCAAwC;AACxC,SAAS,UAAU,CAAC,KAAa,EAAE,QAAkB;IACnD,OAAO,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple table formatter for CLI output.
|
|
3
|
+
*
|
|
4
|
+
* Renders aligned, human-readable tables without external dependencies.
|
|
5
|
+
*/
|
|
6
|
+
export interface TableColumn {
|
|
7
|
+
/** Column header text */
|
|
8
|
+
header: string;
|
|
9
|
+
/** Alignment */
|
|
10
|
+
align?: 'left' | 'right';
|
|
11
|
+
}
|
|
12
|
+
export type TableRow = Record<string, string | number | boolean | undefined | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Render an array of objects as a formatted table string.
|
|
15
|
+
*
|
|
16
|
+
* @param columns - Column definitions (header + alignment)
|
|
17
|
+
* @param rows - Array of row objects (keys match column headers)
|
|
18
|
+
* @returns Formatted table string
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderTable(columns: TableColumn[], rows: TableRow[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Render a single row as key-value pairs (for detail views like `catalog info`).
|
|
23
|
+
*/
|
|
24
|
+
export declare function renderDetail(items: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
value: string;
|
|
27
|
+
}>): string;
|
|
28
|
+
//# sourceMappingURL=table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/output/table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,gBAAgB;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;AAMpF;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,MAAM,CA6C5E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAMnF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple table formatter for CLI output.
|
|
3
|
+
*
|
|
4
|
+
* Renders aligned, human-readable tables without external dependencies.
|
|
5
|
+
*/
|
|
6
|
+
// ──────────────────────────────────────────────
|
|
7
|
+
// Render
|
|
8
|
+
// ──────────────────────────────────────────────
|
|
9
|
+
/**
|
|
10
|
+
* Render an array of objects as a formatted table string.
|
|
11
|
+
*
|
|
12
|
+
* @param columns - Column definitions (header + alignment)
|
|
13
|
+
* @param rows - Array of row objects (keys match column headers)
|
|
14
|
+
* @returns Formatted table string
|
|
15
|
+
*/
|
|
16
|
+
export function renderTable(columns, rows) {
|
|
17
|
+
if (columns.length === 0)
|
|
18
|
+
return '';
|
|
19
|
+
const headers = columns.map((c) => c.header);
|
|
20
|
+
// Calculate column widths
|
|
21
|
+
const colWidths = columns.map((col) => {
|
|
22
|
+
const headerLen = col.header.length;
|
|
23
|
+
const maxDataLen = rows.reduce((max, row) => {
|
|
24
|
+
const val = String(row[col.header] ?? '');
|
|
25
|
+
return Math.max(max, val.length);
|
|
26
|
+
}, 0);
|
|
27
|
+
return Math.max(headerLen, maxDataLen);
|
|
28
|
+
});
|
|
29
|
+
const lines = [];
|
|
30
|
+
// Header row
|
|
31
|
+
const headerLine = headers
|
|
32
|
+
.map((h, i) => {
|
|
33
|
+
const width = colWidths[i];
|
|
34
|
+
const align = columns[i]?.align ?? 'left';
|
|
35
|
+
return align === 'right' ? h.padStart(width) : h.padEnd(width);
|
|
36
|
+
})
|
|
37
|
+
.join(' ');
|
|
38
|
+
lines.push(headerLine);
|
|
39
|
+
// Separator
|
|
40
|
+
const sepLine = colWidths.map((w) => '─'.repeat(w)).join('──');
|
|
41
|
+
lines.push(sepLine);
|
|
42
|
+
// Data rows
|
|
43
|
+
for (const row of rows) {
|
|
44
|
+
const dataLine = columns
|
|
45
|
+
.map((col, i) => {
|
|
46
|
+
const val = String(row[col.header] ?? '');
|
|
47
|
+
const width = colWidths[i];
|
|
48
|
+
const align = col.align ?? 'left';
|
|
49
|
+
return align === 'right' ? val.padStart(width) : val.padEnd(width);
|
|
50
|
+
})
|
|
51
|
+
.join(' ');
|
|
52
|
+
lines.push(dataLine);
|
|
53
|
+
}
|
|
54
|
+
return lines.join('\n');
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Render a single row as key-value pairs (for detail views like `catalog info`).
|
|
58
|
+
*/
|
|
59
|
+
export function renderDetail(items) {
|
|
60
|
+
if (items.length === 0)
|
|
61
|
+
return '';
|
|
62
|
+
const maxLabelLen = items.reduce((max, item) => Math.max(max, item.label.length), 0);
|
|
63
|
+
return items
|
|
64
|
+
.map((item) => `${item.label.padEnd(maxLabelLen)} ${item.value}`)
|
|
65
|
+
.join('\n');
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/output/table.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAeH,iDAAiD;AACjD,SAAS;AACT,iDAAiD;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAsB,EAAE,IAAgB;IAClE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAEpC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAE7C,0BAA0B;IAC1B,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACpC,MAAM,SAAS,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC;QACpC,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;YAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1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3B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,MAAM,CAAC;YAClC,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrE,CAAC,CAAC;aACD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAA8C;IACzE,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IACrF,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;SACjE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared API response and error types for GitLab API interactions.
|
|
3
|
+
*/
|
|
4
|
+
export interface PaginationParams {
|
|
5
|
+
page?: number;
|
|
6
|
+
perPage?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PaginatedResponse<T> {
|
|
9
|
+
data: T[];
|
|
10
|
+
page: number;
|
|
11
|
+
perPage: number;
|
|
12
|
+
total?: number;
|
|
13
|
+
totalPages?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare class GitLabApiError extends Error {
|
|
16
|
+
readonly statusCode: number;
|
|
17
|
+
readonly code?: string | undefined;
|
|
18
|
+
constructor(message: string, statusCode: number, code?: string | undefined);
|
|
19
|
+
}
|
|
20
|
+
export declare class AuthenticationError extends GitLabApiError {
|
|
21
|
+
constructor(message?: string);
|
|
22
|
+
}
|
|
23
|
+
export declare class PermissionError extends GitLabApiError {
|
|
24
|
+
constructor(message?: string);
|
|
25
|
+
}
|
|
26
|
+
export declare class NotFoundError extends GitLabApiError {
|
|
27
|
+
constructor(resource: string);
|
|
28
|
+
}
|
|
29
|
+
export declare class RateLimitError extends GitLabApiError {
|
|
30
|
+
readonly retryAfterSeconds?: number | undefined;
|
|
31
|
+
constructor(message: string, retryAfterSeconds?: number | undefined);
|
|
32
|
+
}
|
|
33
|
+
export declare class ServerError extends GitLabApiError {
|
|
34
|
+
constructor(statusCode: number, statusText: string);
|
|
35
|
+
}
|
|
36
|
+
export declare class NetworkError extends GitLabApiError {
|
|
37
|
+
constructor(url: string, cause: string);
|
|
38
|
+
}
|
|
39
|
+
export declare class ConfigurationError extends GitLabApiError {
|
|
40
|
+
constructor(message: string);
|
|
41
|
+
}
|
|
42
|
+
export type ApiResult<T> = {
|
|
43
|
+
success: true;
|
|
44
|
+
data: T;
|
|
45
|
+
} | {
|
|
46
|
+
success: false;
|
|
47
|
+
error: GitLabApiError;
|
|
48
|
+
};
|
|
49
|
+
export interface GitLabApiErrorResponse {
|
|
50
|
+
message: string | Record<string, string[]>;
|
|
51
|
+
error?: string;
|
|
52
|
+
status?: number;
|
|
53
|
+
}
|
|
54
|
+
export interface GitLabVersion {
|
|
55
|
+
version: string;
|
|
56
|
+
revision: string;
|
|
57
|
+
}
|
|
58
|
+
export interface GitLabUser {
|
|
59
|
+
id: number;
|
|
60
|
+
name: string;
|
|
61
|
+
username: string;
|
|
62
|
+
state: string;
|
|
63
|
+
avatar_url: string;
|
|
64
|
+
web_url: string;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=api.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