@gitgate/gg-cli 0.1.2 → 0.2.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/dist/commands/agent.d.ts +15 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +205 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/ci.d.ts +14 -0
- package/dist/commands/ci.d.ts.map +1 -0
- package/dist/commands/ci.js +316 -0
- package/dist/commands/ci.js.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gg agent — Agent identity, budget, and usage management.
|
|
3
|
+
*
|
|
4
|
+
* gg agent register --org <org> --name <name> --provider <provider>
|
|
5
|
+
* gg agent list --org <org>
|
|
6
|
+
* gg agent revoke --org <org> --id <id>
|
|
7
|
+
* gg agent budget create --org <org> ...
|
|
8
|
+
* gg agent budget list --org <org>
|
|
9
|
+
* gg agent usage --org <org> [--agent <id>] [--from <date>] [--to <date>]
|
|
10
|
+
* gg agent leaderboard --org <org>
|
|
11
|
+
* gg agent compare --org <org> --agents <id1>,<id2>
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
export declare const agentCommand: Command;
|
|
15
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,eAAO,MAAM,YAAY,SACwC,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gg agent — Agent identity, budget, and usage management.
|
|
3
|
+
*
|
|
4
|
+
* gg agent register --org <org> --name <name> --provider <provider>
|
|
5
|
+
* gg agent list --org <org>
|
|
6
|
+
* gg agent revoke --org <org> --id <id>
|
|
7
|
+
* gg agent budget create --org <org> ...
|
|
8
|
+
* gg agent budget list --org <org>
|
|
9
|
+
* gg agent usage --org <org> [--agent <id>] [--from <date>] [--to <date>]
|
|
10
|
+
* gg agent leaderboard --org <org>
|
|
11
|
+
* gg agent compare --org <org> --agents <id1>,<id2>
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
import { isAuthenticated } from '../lib/config.js';
|
|
15
|
+
import { getClient } from '../lib/api-client.js';
|
|
16
|
+
import { table, relativeTime } from '../lib/output.js';
|
|
17
|
+
export const agentCommand = new Command('agent')
|
|
18
|
+
.description('Manage org agent identities, budgets, and usage');
|
|
19
|
+
// ── agent register ────────────────────────────────────────
|
|
20
|
+
agentCommand
|
|
21
|
+
.command('register')
|
|
22
|
+
.description('Register a new agent identity')
|
|
23
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
24
|
+
.requiredOption('--name <name>', 'Agent display name')
|
|
25
|
+
.option('--provider <provider>', 'Agent provider (claude, cursor, devin, copilot, sweep, custom)', 'custom')
|
|
26
|
+
.action(async (opts) => {
|
|
27
|
+
requireAuth();
|
|
28
|
+
const client = getClient();
|
|
29
|
+
const res = await client.post(`/api/orgs/${opts.org}/agents`, {
|
|
30
|
+
name: opts.name,
|
|
31
|
+
provider: opts.provider,
|
|
32
|
+
});
|
|
33
|
+
console.log(`Agent registered: ${res.data.agent.name} (${res.data.agent.provider})`);
|
|
34
|
+
console.log(` ID: ${res.data.agent.id}`);
|
|
35
|
+
console.log(` Token: ${res.data.credentials.token}`);
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log(' Save this token — it will not be shown again.');
|
|
38
|
+
});
|
|
39
|
+
// ── agent list ────────────────────────────────────────────
|
|
40
|
+
agentCommand
|
|
41
|
+
.command('list')
|
|
42
|
+
.description('List agent identities in an org')
|
|
43
|
+
.alias('ls')
|
|
44
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
45
|
+
.action(async (opts) => {
|
|
46
|
+
requireAuth();
|
|
47
|
+
const client = getClient();
|
|
48
|
+
const res = await client.get(`/api/orgs/${opts.org}/agents`);
|
|
49
|
+
if (res.data.length === 0) {
|
|
50
|
+
console.log(`No agents registered in ${opts.org}`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const rows = res.data.map((a) => [
|
|
54
|
+
a.id.substring(0, 8),
|
|
55
|
+
a.name,
|
|
56
|
+
a.provider,
|
|
57
|
+
a.status,
|
|
58
|
+
relativeTime(a.createdAt),
|
|
59
|
+
]);
|
|
60
|
+
console.log(table(['ID', 'NAME', 'PROVIDER', 'STATUS', 'CREATED'], rows));
|
|
61
|
+
});
|
|
62
|
+
// ── agent revoke ──────────────────────────────────────────
|
|
63
|
+
agentCommand
|
|
64
|
+
.command('revoke')
|
|
65
|
+
.description('Revoke an agent identity')
|
|
66
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
67
|
+
.requiredOption('--id <id>', 'Agent identity ID')
|
|
68
|
+
.action(async (opts) => {
|
|
69
|
+
requireAuth();
|
|
70
|
+
const client = getClient();
|
|
71
|
+
await client.delete(`/api/orgs/${opts.org}/agents/${opts.id}`);
|
|
72
|
+
console.log(`Agent ${opts.id.substring(0, 8)} revoked.`);
|
|
73
|
+
});
|
|
74
|
+
// ── agent budget ──────────────────────────────────────────
|
|
75
|
+
const budgetCmd = agentCommand
|
|
76
|
+
.command('budget')
|
|
77
|
+
.description('Manage agent budgets');
|
|
78
|
+
budgetCmd
|
|
79
|
+
.command('create')
|
|
80
|
+
.description('Create a budget rule')
|
|
81
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
82
|
+
.requiredOption('--scope-type <type>', 'Scope type (org, team, repo, agent)')
|
|
83
|
+
.requiredOption('--scope-id <id>', 'Scope ID')
|
|
84
|
+
.requiredOption('--period <period>', 'Period (daily, weekly, monthly, rolling_30)')
|
|
85
|
+
.requiredOption('--limit <units>', 'Max activity units', parseFloat)
|
|
86
|
+
.option('--enforcement <mode>', 'Enforcement (alert, throttle, block)', 'alert')
|
|
87
|
+
.action(async (opts) => {
|
|
88
|
+
requireAuth();
|
|
89
|
+
const client = getClient();
|
|
90
|
+
const res = await client.post(`/api/orgs/${opts.org}/agents/budgets`, {
|
|
91
|
+
scopeType: opts.scopeType,
|
|
92
|
+
scopeId: opts.scopeId,
|
|
93
|
+
period: opts.period,
|
|
94
|
+
limitUnits: opts.limit,
|
|
95
|
+
enforcement: opts.enforcement,
|
|
96
|
+
});
|
|
97
|
+
console.log(`Budget created: ${res.data.id.substring(0, 8)}`);
|
|
98
|
+
console.log(` ${opts.limit} AU/${opts.period} for ${opts.scopeType}:${opts.scopeId} (enforcement: ${opts.enforcement})`);
|
|
99
|
+
});
|
|
100
|
+
budgetCmd
|
|
101
|
+
.command('list')
|
|
102
|
+
.description('List budget rules')
|
|
103
|
+
.alias('ls')
|
|
104
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
105
|
+
.action(async (opts) => {
|
|
106
|
+
requireAuth();
|
|
107
|
+
const client = getClient();
|
|
108
|
+
const res = await client.get(`/api/orgs/${opts.org}/agents/budgets`);
|
|
109
|
+
if (res.data.length === 0) {
|
|
110
|
+
console.log(`No budgets configured in ${opts.org}`);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
const rows = res.data.map((b) => [
|
|
114
|
+
b.id.substring(0, 8),
|
|
115
|
+
`${b.scopeType}:${b.scopeId.substring(0, 8)}`,
|
|
116
|
+
b.period,
|
|
117
|
+
String(b.limitUnits),
|
|
118
|
+
b.enforcement,
|
|
119
|
+
b.currentUsage ? `${b.currentUsage.pctConsumed}%` : '—',
|
|
120
|
+
]);
|
|
121
|
+
console.log(table(['ID', 'SCOPE', 'PERIOD', 'LIMIT', 'ENFORCE', 'USED'], rows));
|
|
122
|
+
});
|
|
123
|
+
// ── agent usage ───────────────────────────────────────────
|
|
124
|
+
agentCommand
|
|
125
|
+
.command('usage')
|
|
126
|
+
.description('View agent activity usage')
|
|
127
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
128
|
+
.option('--agent <id>', 'Filter by agent ID')
|
|
129
|
+
.option('--from <date>', 'Start date (ISO)')
|
|
130
|
+
.option('--to <date>', 'End date (ISO)')
|
|
131
|
+
.action(async (opts) => {
|
|
132
|
+
requireAuth();
|
|
133
|
+
const client = getClient();
|
|
134
|
+
const params = new URLSearchParams();
|
|
135
|
+
if (opts.agent)
|
|
136
|
+
params.set('agentId', opts.agent);
|
|
137
|
+
if (opts.from)
|
|
138
|
+
params.set('from', opts.from);
|
|
139
|
+
if (opts.to)
|
|
140
|
+
params.set('to', opts.to);
|
|
141
|
+
const qs = params.toString() ? `?${params.toString()}` : '';
|
|
142
|
+
const res = await client.get(`/api/orgs/${opts.org}/agents/usage${qs}`);
|
|
143
|
+
console.log(`Total: ${res.data.totals.units} AU across ${res.data.totals.count} activities\n`);
|
|
144
|
+
if (res.data.logs.length > 0) {
|
|
145
|
+
const rows = res.data.logs.slice(0, 20).map((l) => [
|
|
146
|
+
l.agentId.substring(0, 8),
|
|
147
|
+
l.activityType,
|
|
148
|
+
String(l.activityUnits),
|
|
149
|
+
relativeTime(l.timestamp),
|
|
150
|
+
]);
|
|
151
|
+
console.log(table(['AGENT', 'TYPE', 'AU', 'TIME'], rows));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
// ── agent leaderboard ─────────────────────────────────────
|
|
155
|
+
agentCommand
|
|
156
|
+
.command('leaderboard')
|
|
157
|
+
.description('View agent leaderboard')
|
|
158
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
159
|
+
.action(async (opts) => {
|
|
160
|
+
requireAuth();
|
|
161
|
+
const client = getClient();
|
|
162
|
+
const res = await client.get(`/api/orgs/${opts.org}/agents/leaderboard`);
|
|
163
|
+
if (res.data.length === 0) {
|
|
164
|
+
console.log('No leaderboard data yet.');
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
const rows = res.data.map((a, i) => [
|
|
168
|
+
`#${i + 1}`,
|
|
169
|
+
(a.name ?? a.agentId).substring(0, 20),
|
|
170
|
+
`${a.prsMerged}/${a.prsOpened}`,
|
|
171
|
+
`${Math.round(a.mergeRate * 100)}%`,
|
|
172
|
+
String(Math.round(a.avgMergeConfidence)),
|
|
173
|
+
`${Math.round(a.ciPassRate * 100)}%`,
|
|
174
|
+
a.efficiencyRatio.toFixed(2),
|
|
175
|
+
]);
|
|
176
|
+
console.log(table(['RANK', 'AGENT', 'MERGED/OPENED', 'MERGE%', 'CONFIDENCE', 'CI%', 'EFFICIENCY'], rows));
|
|
177
|
+
});
|
|
178
|
+
// ── agent compare ─────────────────────────────────────────
|
|
179
|
+
agentCommand
|
|
180
|
+
.command('compare')
|
|
181
|
+
.description('Compare agents side-by-side')
|
|
182
|
+
.requiredOption('--org <org>', 'Organization slug')
|
|
183
|
+
.requiredOption('--agents <ids>', 'Comma-separated agent IDs')
|
|
184
|
+
.action(async (opts) => {
|
|
185
|
+
requireAuth();
|
|
186
|
+
const client = getClient();
|
|
187
|
+
const ids = opts.agents.split(',').map((s) => s.trim());
|
|
188
|
+
const params = ids.map((id) => `agent_ids=${id}`).join('&');
|
|
189
|
+
const res = await client.get(`/api/orgs/${opts.org}/agents/leaderboard/compare?${params}`);
|
|
190
|
+
for (const agent of res.data) {
|
|
191
|
+
console.log(`\n${agent.name ?? agent.agentId}:`);
|
|
192
|
+
console.log(` Merge Rate: ${Math.round(agent.mergeRate * 100)}%`);
|
|
193
|
+
console.log(` Avg Confidence: ${Math.round(agent.avgMergeConfidence)}`);
|
|
194
|
+
console.log(` CI Pass Rate: ${Math.round(agent.ciPassRate * 100)}%`);
|
|
195
|
+
console.log(` Revision Cycles: ${agent.avgRevisionCycles.toFixed(1)}`);
|
|
196
|
+
console.log(` Efficiency: ${agent.efficiencyRatio.toFixed(2)}`);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
function requireAuth() {
|
|
200
|
+
if (!isAuthenticated()) {
|
|
201
|
+
console.error('Not authenticated. Run: gg auth login');
|
|
202
|
+
process.exit(1);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC;KAC7C,WAAW,CAAC,iDAAiD,CAAC,CAAC;AAElE,6DAA6D;AAE7D,YAAY;KACT,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,+BAA+B,CAAC;KAC5C,cAAc,CAAC,aAAa,EAAE,mBAAmB,CAAC;KAClD,cAAc,CAAC,eAAe,EAAE,oBAAoB,CAAC;KACrD,MAAM,CAAC,uBAAuB,EAAE,gEAAgE,EAAE,QAAQ,CAAC;KAC3G,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;IACrB,WAAW,EAAE,CAAC;IACd,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,IAAI,CAGxB,aAAa,IAAI,CAAC,GAAG,SAAS,EAAE;QACnC,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,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eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,SAAS,WAAW;IAClB,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gg ci — CI/CD management and GitHub Actions conversion.
|
|
3
|
+
*
|
|
4
|
+
* gg ci convert <path> — Convert GitHub Actions workflows to GitGate CI
|
|
5
|
+
* gg ci run — Trigger CI on current branch
|
|
6
|
+
* gg ci status <owner/repo> — Show latest CI status
|
|
7
|
+
* gg ci logs <owner/repo> <run_id> — View CI run logs
|
|
8
|
+
* gg ci secrets set <KEY> <VALUE> — Set a CI secret
|
|
9
|
+
* gg ci secrets list — List secret names
|
|
10
|
+
* gg ci cache clear — Clear CI cache
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
export declare const ciCommand: Command;
|
|
14
|
+
//# sourceMappingURL=ci.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci.d.ts","sourceRoot":"","sources":["../../src/commands/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,eAAO,MAAM,SAAS,SAC0C,CAAC"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gg ci — CI/CD management and GitHub Actions conversion.
|
|
3
|
+
*
|
|
4
|
+
* gg ci convert <path> — Convert GitHub Actions workflows to GitGate CI
|
|
5
|
+
* gg ci run — Trigger CI on current branch
|
|
6
|
+
* gg ci status <owner/repo> — Show latest CI status
|
|
7
|
+
* gg ci logs <owner/repo> <run_id> — View CI run logs
|
|
8
|
+
* gg ci secrets set <KEY> <VALUE> — Set a CI secret
|
|
9
|
+
* gg ci secrets list — List secret names
|
|
10
|
+
* gg ci cache clear — Clear CI cache
|
|
11
|
+
*/
|
|
12
|
+
import { Command } from 'commander';
|
|
13
|
+
import { readFileSync, writeFileSync, readdirSync, mkdirSync, existsSync } from 'fs';
|
|
14
|
+
import { join, basename } from 'path';
|
|
15
|
+
import { isAuthenticated } from '../lib/config.js';
|
|
16
|
+
import { getClient } from '../lib/api-client.js';
|
|
17
|
+
import { table, relativeTime, statusIcon } from '../lib/output.js';
|
|
18
|
+
export const ciCommand = new Command('ci')
|
|
19
|
+
.description('CI/CD management and GitHub Actions conversion');
|
|
20
|
+
// ════════════════════════════════════════════════════════════
|
|
21
|
+
// GitHub Actions Converter
|
|
22
|
+
// ════════════════════════════════════════════════════════════
|
|
23
|
+
ciCommand
|
|
24
|
+
.command('convert')
|
|
25
|
+
.description('Convert GitHub Actions workflows to GitGate CI format')
|
|
26
|
+
.argument('<path>', 'Path to .github/workflows/ directory or single YAML file')
|
|
27
|
+
.option('--output <dir>', 'Output directory', '.gitgate/workflows')
|
|
28
|
+
.action(async (inputPath, opts) => {
|
|
29
|
+
const files = [];
|
|
30
|
+
if (inputPath.endsWith('.yml') || inputPath.endsWith('.yaml')) {
|
|
31
|
+
files.push(inputPath);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
// Directory mode
|
|
35
|
+
const dir = inputPath.endsWith('/') ? inputPath : inputPath + '/';
|
|
36
|
+
if (!existsSync(dir)) {
|
|
37
|
+
console.error(`Directory not found: ${dir}`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
for (const f of readdirSync(dir)) {
|
|
41
|
+
if (f.endsWith('.yml') || f.endsWith('.yaml')) {
|
|
42
|
+
files.push(join(dir, f));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (files.length === 0) {
|
|
47
|
+
console.error('No YAML files found.');
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
// Ensure output dir exists
|
|
51
|
+
if (!existsSync(opts.output)) {
|
|
52
|
+
mkdirSync(opts.output, { recursive: true });
|
|
53
|
+
}
|
|
54
|
+
const report = {
|
|
55
|
+
full: [], review: [], unsupported: [],
|
|
56
|
+
};
|
|
57
|
+
for (const file of files) {
|
|
58
|
+
const content = readFileSync(file, 'utf-8');
|
|
59
|
+
const result = convertWorkflow(content, basename(file));
|
|
60
|
+
const outFile = join(opts.output, basename(file));
|
|
61
|
+
writeFileSync(outFile, result.output);
|
|
62
|
+
if (result.notes.length === 0) {
|
|
63
|
+
report.full.push(`${basename(file)} → ${outFile}`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
report.review.push({ file: `${basename(file)} → ${outFile}`, notes: result.notes });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Print report
|
|
70
|
+
console.log('\n📋 Conversion Report\n');
|
|
71
|
+
if (report.full.length > 0) {
|
|
72
|
+
console.log(`✅ Fully converted (${report.full.length}):`);
|
|
73
|
+
for (const f of report.full)
|
|
74
|
+
console.log(` ${f}`);
|
|
75
|
+
}
|
|
76
|
+
if (report.review.length > 0) {
|
|
77
|
+
console.log(`\n⚠️ Needs review (${report.review.length}):`);
|
|
78
|
+
for (const r of report.review) {
|
|
79
|
+
console.log(` ${r.file}`);
|
|
80
|
+
for (const note of r.notes)
|
|
81
|
+
console.log(` → ${note}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (report.unsupported.length > 0) {
|
|
85
|
+
console.log(`\n❌ Not supported (${report.unsupported.length}):`);
|
|
86
|
+
for (const f of report.unsupported)
|
|
87
|
+
console.log(` ${f}`);
|
|
88
|
+
}
|
|
89
|
+
console.log('\nNext steps:');
|
|
90
|
+
console.log(' 1. Review generated files in .gitgate/workflows/');
|
|
91
|
+
console.log(' 2. Add secrets: gg ci secrets set <KEY> <VALUE>');
|
|
92
|
+
console.log(' 3. Push to trigger your first GitGate CI run');
|
|
93
|
+
});
|
|
94
|
+
function convertWorkflow(yamlContent, filename) {
|
|
95
|
+
const notes = [];
|
|
96
|
+
const lines = yamlContent.split('\n');
|
|
97
|
+
const outputLines = [];
|
|
98
|
+
outputLines.push('# Converted from GitHub Actions by: gg ci convert');
|
|
99
|
+
outputLines.push(`# Source: ${filename}`);
|
|
100
|
+
outputLines.push('');
|
|
101
|
+
for (const line of lines) {
|
|
102
|
+
const trimmed = line.trim();
|
|
103
|
+
// Skip empty lines and comments
|
|
104
|
+
if (trimmed === '' || trimmed.startsWith('#')) {
|
|
105
|
+
outputLines.push(line);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
// Convert trigger syntax: on: → trigger:
|
|
109
|
+
if (trimmed.startsWith('on:')) {
|
|
110
|
+
outputLines.push(line.replace('on:', 'trigger:'));
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
// Convert trigger events
|
|
114
|
+
if (trimmed === 'push:' || trimmed === 'pull_request:') {
|
|
115
|
+
outputLines.push(line.replace('pull_request:', 'pr:'));
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// Convert runs-on: → container:
|
|
119
|
+
if (trimmed.startsWith('runs-on:')) {
|
|
120
|
+
const container = mapRunsOn(trimmed.replace('runs-on:', '').trim());
|
|
121
|
+
outputLines.push(line.replace(/runs-on:.*/, `container: ${container}`));
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
// Convert needs: → depends_on:
|
|
125
|
+
if (trimmed.startsWith('needs:')) {
|
|
126
|
+
outputLines.push(line.replace('needs:', 'depends_on:'));
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
// Convert if: → when:
|
|
130
|
+
if (trimmed.startsWith('if:')) {
|
|
131
|
+
outputLines.push(line.replace('if:', 'when:'));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
// Handle uses: directives
|
|
135
|
+
if (trimmed.startsWith('- uses:') || trimmed.startsWith('uses:')) {
|
|
136
|
+
const action = trimmed.replace(/^-?\s*uses:\s*/, '');
|
|
137
|
+
const conversion = mapAction(action);
|
|
138
|
+
if (conversion.skip) {
|
|
139
|
+
outputLines.push(`${getIndent(line)}# ${action} — implicit in GitGate CI (repo is auto-cloned)`);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (conversion.replacement) {
|
|
143
|
+
outputLines.push(`${getIndent(line)}${conversion.replacement}`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (conversion.note) {
|
|
147
|
+
notes.push(conversion.note);
|
|
148
|
+
outputLines.push(`${getIndent(line)}# REVIEW: ${action}`);
|
|
149
|
+
outputLines.push(`${getIndent(line)}# ${conversion.note}`);
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// Pass through everything else
|
|
154
|
+
outputLines.push(line);
|
|
155
|
+
}
|
|
156
|
+
return { output: outputLines.join('\n'), notes };
|
|
157
|
+
}
|
|
158
|
+
function mapRunsOn(value) {
|
|
159
|
+
const cleaned = value.replace(/['"]/g, '').trim();
|
|
160
|
+
const map = {
|
|
161
|
+
'ubuntu-latest': 'node-22',
|
|
162
|
+
'ubuntu-22.04': 'node-22',
|
|
163
|
+
'ubuntu-20.04': 'node-20',
|
|
164
|
+
'macos-latest': 'node-22',
|
|
165
|
+
'windows-latest': 'node-22',
|
|
166
|
+
};
|
|
167
|
+
return map[cleaned] ?? 'node-22';
|
|
168
|
+
}
|
|
169
|
+
function mapAction(action) {
|
|
170
|
+
const name = action.split('@')[0];
|
|
171
|
+
// Actions that are implicit in GitGate CI
|
|
172
|
+
const implicit = ['actions/checkout', 'actions/setup-node', 'actions/setup-python', 'actions/setup-go'];
|
|
173
|
+
if (implicit.some(a => name.startsWith(a))) {
|
|
174
|
+
return { skip: true };
|
|
175
|
+
}
|
|
176
|
+
// Actions with direct mappings
|
|
177
|
+
if (name === 'actions/cache') {
|
|
178
|
+
return { skip: true }; // GitGate CI has zero-config caching
|
|
179
|
+
}
|
|
180
|
+
if (name === 'actions/upload-artifact') {
|
|
181
|
+
return { replacement: '# Artifacts: use "artifacts:" block — GitGate stores in R2 automatically' };
|
|
182
|
+
}
|
|
183
|
+
if (name === 'actions/download-artifact') {
|
|
184
|
+
return { replacement: '# Download artifacts: use "artifacts:" block to declare dependencies' };
|
|
185
|
+
}
|
|
186
|
+
// Slack notification — common action
|
|
187
|
+
if (name.includes('slack')) {
|
|
188
|
+
return {
|
|
189
|
+
replacement: '# Slack: use webhook notification step',
|
|
190
|
+
note: `${action} → Replaced with webhook notification. Verify SLACK_WEBHOOK_URL in secrets.`,
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
// Unknown actions — flag for review
|
|
194
|
+
return {
|
|
195
|
+
note: `${action} → No direct equivalent. See: https://gitgate.com/docs/ci/custom-containers`,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
function getIndent(line) {
|
|
199
|
+
const match = line.match(/^(\s*)/);
|
|
200
|
+
return match ? match[1] : '';
|
|
201
|
+
}
|
|
202
|
+
// ════════════════════════════════════════════════════════════
|
|
203
|
+
// CI Commands
|
|
204
|
+
// ════════════════════════════════════════════════════════════
|
|
205
|
+
ciCommand
|
|
206
|
+
.command('run')
|
|
207
|
+
.description('Trigger a CI run on the current branch')
|
|
208
|
+
.argument('<repo>', 'owner/repo')
|
|
209
|
+
.option('--container <container>', 'Container image', 'node-22')
|
|
210
|
+
.option('--command <cmd...>', 'Commands to run')
|
|
211
|
+
.action(async (repoArg, opts) => {
|
|
212
|
+
requireAuth();
|
|
213
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
214
|
+
const client = getClient();
|
|
215
|
+
const commands = opts.command ?? ['npm install', 'npm test'];
|
|
216
|
+
const res = await client.post(`/api/repos/${owner}/${repo}/ci/runs`, { container: opts.container, commands });
|
|
217
|
+
console.log(`CI run started: ${res.data.id.substring(0, 8)} (${res.data.status})`);
|
|
218
|
+
});
|
|
219
|
+
ciCommand
|
|
220
|
+
.command('status')
|
|
221
|
+
.description('Show latest CI runs')
|
|
222
|
+
.argument('<repo>', 'owner/repo')
|
|
223
|
+
.action(async (repoArg) => {
|
|
224
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
225
|
+
const client = getClient();
|
|
226
|
+
const res = await client.get(`/api/repos/${owner}/${repo}/ci/runs`);
|
|
227
|
+
if (res.data.length === 0) {
|
|
228
|
+
console.log(`No CI runs in ${owner}/${repo}`);
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const rows = res.data.map(r => [
|
|
232
|
+
statusIcon(r.status),
|
|
233
|
+
r.id.substring(0, 8),
|
|
234
|
+
r.status,
|
|
235
|
+
r.triggerType,
|
|
236
|
+
r.triggerRef.replace('refs/heads/', ''),
|
|
237
|
+
r.container,
|
|
238
|
+
r.durationSeconds ? `${r.durationSeconds}s` : '—',
|
|
239
|
+
relativeTime(r.createdAt),
|
|
240
|
+
]);
|
|
241
|
+
console.log(table(['', 'ID', 'STATUS', 'TRIGGER', 'REF', 'CONTAINER', 'DURATION', 'CREATED'], rows));
|
|
242
|
+
});
|
|
243
|
+
ciCommand
|
|
244
|
+
.command('logs')
|
|
245
|
+
.description('View CI run logs')
|
|
246
|
+
.argument('<repo>', 'owner/repo')
|
|
247
|
+
.argument('<run_id>', 'CI run ID')
|
|
248
|
+
.action(async (repoArg, runId) => {
|
|
249
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
250
|
+
const client = getClient();
|
|
251
|
+
const res = await client.get(`/api/repos/${owner}/${repo}/ci/runs/${runId}`);
|
|
252
|
+
console.log(`Run ${res.data.id.substring(0, 8)} — ${res.data.status}\n`);
|
|
253
|
+
console.log(res.data.logs ?? '(No logs available)');
|
|
254
|
+
});
|
|
255
|
+
// ── Secrets ───────────────────────────────────────────────
|
|
256
|
+
const secretsCmd = ciCommand.command('secrets').description('Manage CI secrets');
|
|
257
|
+
secretsCmd
|
|
258
|
+
.command('set')
|
|
259
|
+
.description('Set a CI secret')
|
|
260
|
+
.argument('<repo>', 'owner/repo')
|
|
261
|
+
.argument('<key>', 'Secret key (UPPER_SNAKE_CASE)')
|
|
262
|
+
.argument('<value>', 'Secret value')
|
|
263
|
+
.action(async (repoArg, key, value) => {
|
|
264
|
+
requireAuth();
|
|
265
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
266
|
+
const client = getClient();
|
|
267
|
+
await client.post(`/api/repos/${owner}/${repo}/ci/secrets`, { key, value });
|
|
268
|
+
console.log(`Secret ${key} set.`);
|
|
269
|
+
});
|
|
270
|
+
secretsCmd
|
|
271
|
+
.command('list')
|
|
272
|
+
.description('List CI secret names')
|
|
273
|
+
.alias('ls')
|
|
274
|
+
.argument('<repo>', 'owner/repo')
|
|
275
|
+
.action(async (repoArg) => {
|
|
276
|
+
requireAuth();
|
|
277
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
278
|
+
const client = getClient();
|
|
279
|
+
const res = await client.get(`/api/repos/${owner}/${repo}/ci/secrets`);
|
|
280
|
+
if (res.data.length === 0) {
|
|
281
|
+
console.log('No secrets configured.');
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
for (const key of res.data)
|
|
285
|
+
console.log(` ${key}`);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
// ── Cache ─────────────────────────────────────────────────
|
|
289
|
+
ciCommand
|
|
290
|
+
.command('cache')
|
|
291
|
+
.description('Manage CI cache')
|
|
292
|
+
.command('clear')
|
|
293
|
+
.description('Clear CI cache for a repo')
|
|
294
|
+
.argument('<repo>', 'owner/repo')
|
|
295
|
+
.action(async (repoArg) => {
|
|
296
|
+
requireAuth();
|
|
297
|
+
const [owner, repo] = parseRepo(repoArg);
|
|
298
|
+
const client = getClient();
|
|
299
|
+
await client.delete(`/api/repos/${owner}/${repo}/ci/cache`);
|
|
300
|
+
console.log('CI cache cleared.');
|
|
301
|
+
});
|
|
302
|
+
function parseRepo(arg) {
|
|
303
|
+
const parts = arg.split('/');
|
|
304
|
+
if (parts.length !== 2 || !parts[0] || !parts[1]) {
|
|
305
|
+
console.error('Invalid repo format. Use: owner/repo');
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
return [parts[0], parts[1]];
|
|
309
|
+
}
|
|
310
|
+
function requireAuth() {
|
|
311
|
+
if (!isAuthenticated()) {
|
|
312
|
+
console.error('Not authenticated. Run: gg auth login');
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=ci.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci.js","sourceRoot":"","sources":["../../src/commands/ci.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACrF,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;KACvC,WAAW,CAAC,gDAAgD,CAAC,CAAC;AAEjE,+DAA+D;AAC/D,2BAA2B;AAC3B,+DAA+D;AAE/D,SAAS;KACN,OAAO,CAAC,SAAS,CAAC;KAClB,WAAW,CAAC,uDAAuD,CAAC;KACpE,QAAQ,CAAC,QAAQ,EAAE,0DAA0D,CAAC;KAC9E,MAAM,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,CAAC;KAClE,MAAM,CAAC,KAAK,EAAE,SAAS,EAA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AAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,MAAM,MAAM,CAAC,MAAM,CAAC,cAAc,KAAK,IAAI,IAAI,WAAW,CAAC,CAAC;IAC5D,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEL,SAAS,SAAS,CAAC,GAAW;IAC5B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,WAAW;IAClB,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC;QACvB,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import { runCommand } from './commands/actions.js';
|
|
|
14
14
|
import { searchCommand } from './commands/search.js';
|
|
15
15
|
import { importCommand } from './commands/import.js';
|
|
16
16
|
import { vizCommand } from './commands/viz.js';
|
|
17
|
+
import { agentCommand } from './commands/agent.js';
|
|
18
|
+
import { ciCommand } from './commands/ci.js';
|
|
17
19
|
const program = new Command();
|
|
18
20
|
program
|
|
19
21
|
.name('gg')
|
|
@@ -27,6 +29,8 @@ program.addCommand(runCommand);
|
|
|
27
29
|
program.addCommand(searchCommand);
|
|
28
30
|
program.addCommand(importCommand);
|
|
29
31
|
program.addCommand(vizCommand);
|
|
32
|
+
program.addCommand(agentCommand);
|
|
33
|
+
program.addCommand(ciCommand);
|
|
30
34
|
program.parseAsync(process.argv).catch((err) => {
|
|
31
35
|
console.error(err instanceof Error ? err.message : 'Unknown error');
|
|
32
36
|
process.exit(1);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,O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