Skip to content

Commit 3051cf7

Browse files
plossonclaude
andcommitted
feat(github): add LLM-friendly examples to all github commands
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 784c269 commit 3051cf7

3 files changed

Lines changed: 128 additions & 90 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
name: agentio-github
3+
description: Use when interacting with GitHub via the agentio CLI.
4+
---
5+
6+
# Github via agentio
7+
8+
Auto-generated from `agentio skill github`. Do not edit by hand.
9+
10+
## agentio github install <repo>
11+
12+
Install AGENTIO_KEY and AGENTIO_CONFIG as GitHub Actions secrets
13+
14+
Options:
15+
16+
- `--profile <name>`: Profile name (optional if only one profile exists)
17+
18+
```
19+
Examples:
20+
21+
# install secrets into a repo using the default github profile
22+
agentio github install octocat/hello-world
23+
24+
# install secrets using a named profile
25+
agentio github install octocat/hello-world --profile work
26+
```
27+
28+
## agentio github uninstall <repo>
29+
30+
Remove AGENTIO_KEY and AGENTIO_CONFIG secrets from a repository
31+
32+
Options:
33+
34+
- `--profile <name>`: Profile name (optional if only one profile exists)
35+
36+
```
37+
Examples:
38+
39+
# remove the agentio secrets from a repo
40+
agentio github uninstall octocat/hello-world
41+
42+
# uninstall using a named profile
43+
agentio github uninstall octocat/hello-world --profile work
44+
```
45+

src/commands/github.ts

Lines changed: 83 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { performGitHubOAuthFlow } from '../auth/github-oauth';
88
import { generateExportData } from './config';
99
import { CliError, handleError } from '../utils/errors';
1010
import { enforceWriteAccess } from '../utils/read-only';
11+
import { addExamples } from '../utils/command-tree';
1112
import type { GitHubCredentials } from '../types/github';
1213

1314
const getGitHubClient = createClientGetter<GitHubCredentials, GitHubClient>({
@@ -32,70 +33,88 @@ export function registerGitHubCommands(program: Command): void {
3233
.command('github')
3334
.description('GitHub operations');
3435

35-
github
36-
.command('install')
37-
.description('Install AGENTIO_KEY and AGENTIO_CONFIG as GitHub Actions secrets')
38-
.argument('<repo>', 'Repository in owner/repo format')
39-
.option('--profile <name>', 'Profile name (optional if only one profile exists)')
40-
.action(async (repo: string, options) => {
41-
try {
42-
// Validate repo format
43-
parseRepo(repo);
44-
45-
const { client, profile } = await getGitHubClient(options.profile);
46-
await enforceWriteAccess('github', profile, 'install secrets');
47-
48-
console.error(`Using GitHub profile: ${profile}`);
49-
console.error(`Installing secrets to: ${repo}`);
50-
51-
// Generate the export data
52-
const exportData = await generateExportData();
53-
54-
// Set secrets on the repo
55-
console.error('\nSetting AGENTIO_KEY...');
56-
await client.setRepoSecret(repo, 'AGENTIO_KEY', exportData.key);
57-
58-
console.error('Setting AGENTIO_CONFIG...');
59-
await client.setRepoSecret(repo, 'AGENTIO_CONFIG', exportData.config);
60-
61-
console.log(`\nInstalled AGENTIO_KEY and AGENTIO_CONFIG to ${repo}`);
62-
console.log('\nIn your GitHub Actions workflow, use:');
63-
console.log(' env:');
64-
console.log(' AGENTIO_KEY: ${{ secrets.AGENTIO_KEY }}');
65-
console.log(' AGENTIO_CONFIG: ${{ secrets.AGENTIO_CONFIG }}');
66-
} catch (error) {
67-
handleError(error);
68-
}
69-
});
70-
71-
github
72-
.command('uninstall')
73-
.description('Remove AGENTIO_KEY and AGENTIO_CONFIG secrets from a repository')
74-
.argument('<repo>', 'Repository in owner/repo format')
75-
.option('--profile <name>', 'Profile name (optional if only one profile exists)')
76-
.action(async (repo: string, options) => {
77-
try {
78-
// Validate repo format
79-
parseRepo(repo);
80-
81-
const { client, profile } = await getGitHubClient(options.profile);
82-
await enforceWriteAccess('github', profile, 'uninstall secrets');
83-
84-
console.error(`Using GitHub profile: ${profile}`);
85-
console.error(`Removing secrets from: ${repo}`);
86-
87-
// Delete secrets from the repo
88-
console.error('\nDeleting AGENTIO_KEY...');
89-
await client.deleteRepoSecret(repo, 'AGENTIO_KEY');
90-
91-
console.error('Deleting AGENTIO_CONFIG...');
92-
await client.deleteRepoSecret(repo, 'AGENTIO_CONFIG');
93-
94-
console.log(`\nRemoved AGENTIO_KEY and AGENTIO_CONFIG from ${repo}`);
95-
} catch (error) {
96-
handleError(error);
97-
}
98-
});
36+
addExamples(
37+
github
38+
.command('install')
39+
.description('Install AGENTIO_KEY and AGENTIO_CONFIG as GitHub Actions secrets')
40+
.argument('<repo>', 'Repository in owner/repo format')
41+
.option('--profile <name>', 'Profile name (optional if only one profile exists)')
42+
.action(async (repo: string, options) => {
43+
try {
44+
// Validate repo format
45+
parseRepo(repo);
46+
47+
const { client, profile } = await getGitHubClient(options.profile);
48+
await enforceWriteAccess('github', profile, 'install secrets');
49+
50+
console.error(`Using GitHub profile: ${profile}`);
51+
console.error(`Installing secrets to: ${repo}`);
52+
53+
// Generate the export data
54+
const exportData = await generateExportData();
55+
56+
// Set secrets on the repo
57+
console.error('\nSetting AGENTIO_KEY...');
58+
await client.setRepoSecret(repo, 'AGENTIO_KEY', exportData.key);
59+
60+
console.error('Setting AGENTIO_CONFIG...');
61+
await client.setRepoSecret(repo, 'AGENTIO_CONFIG', exportData.config);
62+
63+
console.log(`\nInstalled AGENTIO_KEY and AGENTIO_CONFIG to ${repo}`);
64+
console.log('\nIn your GitHub Actions workflow, use:');
65+
console.log(' env:');
66+
console.log(' AGENTIO_KEY: ${{ secrets.AGENTIO_KEY }}');
67+
console.log(' AGENTIO_CONFIG: ${{ secrets.AGENTIO_CONFIG }}');
68+
} catch (error) {
69+
handleError(error);
70+
}
71+
}),
72+
`Examples:
73+
74+
# install secrets into a repo using the default github profile
75+
agentio github install octocat/hello-world
76+
77+
# install secrets using a named profile
78+
agentio github install octocat/hello-world --profile work`,
79+
);
80+
81+
addExamples(
82+
github
83+
.command('uninstall')
84+
.description('Remove AGENTIO_KEY and AGENTIO_CONFIG secrets from a repository')
85+
.argument('<repo>', 'Repository in owner/repo format')
86+
.option('--profile <name>', 'Profile name (optional if only one profile exists)')
87+
.action(async (repo: string, options) => {
88+
try {
89+
// Validate repo format
90+
parseRepo(repo);
91+
92+
const { client, profile } = await getGitHubClient(options.profile);
93+
await enforceWriteAccess('github', profile, 'uninstall secrets');
94+
95+
console.error(`Using GitHub profile: ${profile}`);
96+
console.error(`Removing secrets from: ${repo}`);
97+
98+
// Delete secrets from the repo
99+
console.error('\nDeleting AGENTIO_KEY...');
100+
await client.deleteRepoSecret(repo, 'AGENTIO_KEY');
101+
102+
console.error('Deleting AGENTIO_CONFIG...');
103+
await client.deleteRepoSecret(repo, 'AGENTIO_CONFIG');
104+
105+
console.log(`\nRemoved AGENTIO_KEY and AGENTIO_CONFIG from ${repo}`);
106+
} catch (error) {
107+
handleError(error);
108+
}
109+
}),
110+
`Examples:
111+
112+
# remove the agentio secrets from a repo
113+
agentio github uninstall octocat/hello-world
114+
115+
# uninstall using a named profile
116+
agentio github uninstall octocat/hello-world --profile work`,
117+
);
99118

100119
// Profile management
101120
const profile = createProfileCommands<GitHubCredentials>(github, {

src/commands/help-examples.test.ts

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,6 @@ const EXEMPT_PENDING = new Set<string>([
88
// Populated by Task 3 step 1 — every currently-visible leaf command
99
// that does not yet have an Examples: block. Drive this list to empty as
1010
// each service is migrated to use addExamples().
11-
'discourse list',
12-
'discourse get',
13-
'discourse categories',
14-
'github install',
15-
'github uninstall',
16-
'slack send',
17-
'sql query',
18-
'whatsapp inbox pull',
19-
'whatsapp inbox get',
20-
'whatsapp inbox ack',
21-
'whatsapp inbox reply',
22-
'whatsapp inbox stats',
23-
'whatsapp outbox send',
24-
'whatsapp outbox status',
25-
'whatsapp outbox list',
26-
'whatsapp group list',
27-
'whatsapp group get',
28-
'whatsapp group create',
29-
'whatsapp group update',
30-
'whatsapp group add',
31-
'whatsapp group remove',
32-
'whatsapp group promote',
33-
'whatsapp group demote',
34-
'whatsapp group leave',
35-
'whatsapp group invite',
36-
'whatsapp group join',
3711
'config export',
3812
'config import',
3913
'config env set',

0 commit comments

Comments
 (0)