@kernel.chat/kbot 2.18.0 → 2.19.1
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/README.md +7 -7
- package/dist/cli.js +77 -0
- package/dist/cli.js.map +1 -1
- package/dist/tools/audit.d.ts +20 -0
- package/dist/tools/audit.d.ts.map +1 -0
- package/dist/tools/audit.js +440 -0
- package/dist/tools/audit.js.map +1 -0
- package/dist/tools/contribute.d.ts +2 -0
- package/dist/tools/contribute.d.ts.map +1 -0
- package/dist/tools/contribute.js +262 -0
- package/dist/tools/contribute.js.map +1 -0
- package/dist/tools/documents.d.ts +2 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +460 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +7 -1
- package/dist/tools/index.js.map +1 -1
- package/package.json +14 -3
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
// K:BOT Contribute Tools — Find issues, generate fixes, open PRs
|
|
2
|
+
//
|
|
3
|
+
// Makes kbot a visible participant in open source.
|
|
4
|
+
// Every PR has kbot branding. Every contribution is a billboard.
|
|
5
|
+
import { registerTool } from './index.js';
|
|
6
|
+
import { execSync } from 'node:child_process';
|
|
7
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { homedir } from 'node:os';
|
|
10
|
+
const GITHUB_API = 'https://api.github.com';
|
|
11
|
+
const HEADERS = {
|
|
12
|
+
'User-Agent': 'KBot/2.18 (Contribute)',
|
|
13
|
+
'Accept': 'application/vnd.github.v3+json',
|
|
14
|
+
};
|
|
15
|
+
async function githubFetch(path) {
|
|
16
|
+
const res = await fetch(`${GITHUB_API}${path}`, { headers: HEADERS });
|
|
17
|
+
if (!res.ok)
|
|
18
|
+
throw new Error(`GitHub API ${res.status}: ${path}`);
|
|
19
|
+
return res.json();
|
|
20
|
+
}
|
|
21
|
+
export function registerContributeTools() {
|
|
22
|
+
// ── Find Contribution Opportunities ──
|
|
23
|
+
registerTool({
|
|
24
|
+
name: 'find_issues',
|
|
25
|
+
description: 'Find open source issues to contribute to. Searches GitHub for "good first issue", "help wanted", or custom labels in any language. Returns issues sorted by freshness and approachability.',
|
|
26
|
+
parameters: {
|
|
27
|
+
language: { type: 'string', description: 'Programming language filter (e.g., "typescript", "python", "rust")' },
|
|
28
|
+
label: { type: 'string', description: 'Issue label (default: "good first issue"). Try: "help wanted", "bug", "documentation"' },
|
|
29
|
+
topic: { type: 'string', description: 'Topic or keyword to narrow results (e.g., "cli", "api", "testing")' },
|
|
30
|
+
stars: { type: 'string', description: 'Minimum stars (default: ">=10")' },
|
|
31
|
+
limit: { type: 'number', description: 'Max results (default: 10)' },
|
|
32
|
+
},
|
|
33
|
+
tier: 'free',
|
|
34
|
+
async execute(args) {
|
|
35
|
+
const label = String(args.label || 'good first issue');
|
|
36
|
+
const limit = Number(args.limit) || 10;
|
|
37
|
+
const parts = [`label:"${label}"`, 'state:open', 'is:issue'];
|
|
38
|
+
if (args.language)
|
|
39
|
+
parts.push(`language:${args.language}`);
|
|
40
|
+
if (args.topic)
|
|
41
|
+
parts.push(String(args.topic));
|
|
42
|
+
if (args.stars)
|
|
43
|
+
parts.push(`stars:${args.stars}`);
|
|
44
|
+
else
|
|
45
|
+
parts.push('stars:>=10');
|
|
46
|
+
const q = encodeURIComponent(parts.join(' '));
|
|
47
|
+
try {
|
|
48
|
+
const data = await githubFetch(`/search/issues?q=${q}&sort=created&order=desc&per_page=${limit}`);
|
|
49
|
+
if (!data.items?.length)
|
|
50
|
+
return 'No matching issues found. Try different filters.';
|
|
51
|
+
const results = data.items.map((i) => {
|
|
52
|
+
const repo = i.repository_url.split('/').slice(-2).join('/');
|
|
53
|
+
const labels = (i.labels || []).map((l) => l.name).join(', ');
|
|
54
|
+
const daysOld = Math.floor((Date.now() - new Date(i.created_at).getTime()) / 86400000);
|
|
55
|
+
return [
|
|
56
|
+
`**${repo}** #${i.number}`,
|
|
57
|
+
` ${i.title}`,
|
|
58
|
+
` Labels: ${labels || 'none'} | ${daysOld}d old | ${i.comments} comments`,
|
|
59
|
+
` ${i.html_url}`,
|
|
60
|
+
].join('\n');
|
|
61
|
+
});
|
|
62
|
+
return `Found ${data.total_count} issues matching "${label}":\n\n` + results.join('\n\n');
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
return `Search failed: ${err.message}`;
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
// ── Clone & Prepare Contribution ──
|
|
70
|
+
registerTool({
|
|
71
|
+
name: 'prepare_contribution',
|
|
72
|
+
description: 'Clone a repo and create a branch for contributing. Sets up a local working directory in ~/.kbot/contributions/ ready for making changes.',
|
|
73
|
+
parameters: {
|
|
74
|
+
repo: { type: 'string', description: 'Repository in "owner/repo" format', required: true },
|
|
75
|
+
issue: { type: 'number', description: 'Issue number to reference in the branch name' },
|
|
76
|
+
branch_name: { type: 'string', description: 'Custom branch name (default: auto-generated from issue)' },
|
|
77
|
+
},
|
|
78
|
+
tier: 'free',
|
|
79
|
+
timeout: 120_000,
|
|
80
|
+
async execute(args) {
|
|
81
|
+
const repo = String(args.repo);
|
|
82
|
+
const contribDir = join(homedir(), '.kbot', 'contributions');
|
|
83
|
+
mkdirSync(contribDir, { recursive: true });
|
|
84
|
+
const repoDir = join(contribDir, repo.replace('/', '-'));
|
|
85
|
+
const branchName = args.branch_name
|
|
86
|
+
? String(args.branch_name)
|
|
87
|
+
: args.issue
|
|
88
|
+
? `kbot/fix-${args.issue}`
|
|
89
|
+
: `kbot/contribution-${Date.now().toString(36)}`;
|
|
90
|
+
try {
|
|
91
|
+
if (existsSync(repoDir)) {
|
|
92
|
+
// Already cloned, just create branch
|
|
93
|
+
execSync(`cd "${repoDir}" && git fetch origin && git checkout -b "${branchName}" origin/main 2>/dev/null || git checkout -b "${branchName}" origin/master`, {
|
|
94
|
+
encoding: 'utf-8', timeout: 60000,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// Clone
|
|
99
|
+
execSync(`git clone --depth 50 "https://github.com/${repo}.git" "${repoDir}"`, {
|
|
100
|
+
encoding: 'utf-8', timeout: 60000,
|
|
101
|
+
});
|
|
102
|
+
execSync(`cd "${repoDir}" && git checkout -b "${branchName}"`, {
|
|
103
|
+
encoding: 'utf-8', timeout: 10000,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Read issue context if provided
|
|
107
|
+
let issueContext = '';
|
|
108
|
+
if (args.issue) {
|
|
109
|
+
try {
|
|
110
|
+
const issue = await githubFetch(`/repos/${repo}/issues/${args.issue}`);
|
|
111
|
+
issueContext = `\n\nIssue #${args.issue}: ${issue.title}\n${issue.body?.slice(0, 500) || '(no body)'}`;
|
|
112
|
+
}
|
|
113
|
+
catch { /* ignore */ }
|
|
114
|
+
}
|
|
115
|
+
return [
|
|
116
|
+
`Repository cloned to: ${repoDir}`,
|
|
117
|
+
`Branch: ${branchName}`,
|
|
118
|
+
'',
|
|
119
|
+
'Ready for contribution. Make your changes, then use `submit_contribution` to open a PR.',
|
|
120
|
+
issueContext,
|
|
121
|
+
].join('\n');
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
return `Clone failed: ${err.message}`;
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
// ── Submit Contribution ──
|
|
129
|
+
registerTool({
|
|
130
|
+
name: 'submit_contribution',
|
|
131
|
+
description: 'Commit changes and open a pull request on a forked repository. Requires GitHub CLI (gh) for authentication. Creates a branded PR with kbot attribution.',
|
|
132
|
+
parameters: {
|
|
133
|
+
repo: { type: 'string', description: 'Original repository in "owner/repo" format', required: true },
|
|
134
|
+
title: { type: 'string', description: 'PR title', required: true },
|
|
135
|
+
body: { type: 'string', description: 'PR description', required: true },
|
|
136
|
+
issue: { type: 'number', description: 'Issue number this PR fixes (adds "Fixes #N")' },
|
|
137
|
+
commit_message: { type: 'string', description: 'Commit message (default: uses PR title)' },
|
|
138
|
+
},
|
|
139
|
+
tier: 'free',
|
|
140
|
+
timeout: 120_000,
|
|
141
|
+
async execute(args) {
|
|
142
|
+
const repo = String(args.repo);
|
|
143
|
+
const repoDir = join(homedir(), '.kbot', 'contributions', repo.replace('/', '-'));
|
|
144
|
+
if (!existsSync(repoDir))
|
|
145
|
+
return `No local clone found for ${repo}. Run prepare_contribution first.`;
|
|
146
|
+
// Check for gh CLI
|
|
147
|
+
try {
|
|
148
|
+
execSync('gh auth status', { stdio: 'ignore', timeout: 5000 });
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return 'GitHub CLI (gh) is not installed or not authenticated. Install: brew install gh && gh auth login';
|
|
152
|
+
}
|
|
153
|
+
const commitMsg = String(args.commit_message || args.title);
|
|
154
|
+
const fixesLine = args.issue ? `\n\nFixes #${args.issue}` : '';
|
|
155
|
+
const prBody = String(args.body) + fixesLine + '\n\n---\n*This contribution was prepared with [K:BOT](https://www.npmjs.com/package/@kernel.chat/kbot) — the open-source terminal AI agent*';
|
|
156
|
+
try {
|
|
157
|
+
// Fork, commit, push, create PR
|
|
158
|
+
execSync(`cd "${repoDir}" && gh repo fork "${repo}" --clone=false 2>/dev/null || true`, {
|
|
159
|
+
encoding: 'utf-8', timeout: 30000,
|
|
160
|
+
});
|
|
161
|
+
execSync(`cd "${repoDir}" && git add -A && git commit -m "${commitMsg.replace(/"/g, '\\"')}"`, {
|
|
162
|
+
encoding: 'utf-8', timeout: 10000,
|
|
163
|
+
});
|
|
164
|
+
execSync(`cd "${repoDir}" && gh repo fork "${repo}" --remote=true 2>/dev/null || true`, {
|
|
165
|
+
encoding: 'utf-8', timeout: 30000,
|
|
166
|
+
});
|
|
167
|
+
const branch = execSync(`cd "${repoDir}" && git rev-parse --abbrev-ref HEAD`, {
|
|
168
|
+
encoding: 'utf-8', timeout: 5000,
|
|
169
|
+
}).trim();
|
|
170
|
+
execSync(`cd "${repoDir}" && git push -u origin "${branch}"`, {
|
|
171
|
+
encoding: 'utf-8', timeout: 30000,
|
|
172
|
+
});
|
|
173
|
+
const safeTitle = String(args.title).replace(/"/g, '\\"');
|
|
174
|
+
const safePrBody = prBody.replace(/"/g, '\\"');
|
|
175
|
+
const prUrl = execSync(`cd "${repoDir}" && gh pr create --repo "${repo}" --title "${safeTitle}" --body "${safePrBody}"`, { encoding: 'utf-8', timeout: 30000 }).trim();
|
|
176
|
+
return `PR created! ${prUrl}\n\nEvery contribution makes kbot visible to new developers.`;
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
return `Submission failed: ${err.message}`;
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
// ── Scan Repo for Quick Wins ──
|
|
184
|
+
registerTool({
|
|
185
|
+
name: 'find_quick_wins',
|
|
186
|
+
description: 'Scan a GitHub repository for easy contribution opportunities: missing docs, typos in README, missing .gitignore entries, no CI, no tests, etc. Returns actionable suggestions.',
|
|
187
|
+
parameters: {
|
|
188
|
+
repo: { type: 'string', description: 'Repository in "owner/repo" format', required: true },
|
|
189
|
+
},
|
|
190
|
+
tier: 'free',
|
|
191
|
+
timeout: 60_000,
|
|
192
|
+
async execute(args) {
|
|
193
|
+
const repo = String(args.repo);
|
|
194
|
+
const wins = [];
|
|
195
|
+
const rawCheck = async (path) => {
|
|
196
|
+
try {
|
|
197
|
+
const res = await fetch(`https://raw.githubusercontent.com/${repo}/main/${path}`, { headers: { 'User-Agent': 'KBot/2.18' } });
|
|
198
|
+
if (res.ok)
|
|
199
|
+
return res.text();
|
|
200
|
+
const res2 = await fetch(`https://raw.githubusercontent.com/${repo}/master/${path}`, { headers: { 'User-Agent': 'KBot/2.18' } });
|
|
201
|
+
if (res2.ok)
|
|
202
|
+
return res2.text();
|
|
203
|
+
}
|
|
204
|
+
catch { /* ignore */ }
|
|
205
|
+
return null;
|
|
206
|
+
};
|
|
207
|
+
// Check missing files
|
|
208
|
+
const checks = [
|
|
209
|
+
{ file: 'LICENSE', win: 'Add a LICENSE file (most repos use MIT)' },
|
|
210
|
+
{ file: 'CONTRIBUTING.md', win: 'Add CONTRIBUTING.md with guidelines' },
|
|
211
|
+
{ file: 'CODE_OF_CONDUCT.md', win: 'Add a Code of Conduct' },
|
|
212
|
+
{ file: 'SECURITY.md', win: 'Add a security policy (SECURITY.md)' },
|
|
213
|
+
{ file: '.editorconfig', win: 'Add .editorconfig for consistent formatting' },
|
|
214
|
+
{ file: '.github/ISSUE_TEMPLATE/bug_report.md', win: 'Add issue templates' },
|
|
215
|
+
{ file: '.github/PULL_REQUEST_TEMPLATE.md', win: 'Add a PR template' },
|
|
216
|
+
];
|
|
217
|
+
for (const check of checks) {
|
|
218
|
+
const content = await rawCheck(check.file);
|
|
219
|
+
if (!content)
|
|
220
|
+
wins.push(check.win);
|
|
221
|
+
}
|
|
222
|
+
// Check README quality
|
|
223
|
+
const readme = await rawCheck('README.md');
|
|
224
|
+
if (!readme) {
|
|
225
|
+
wins.push('Create a README.md');
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
if (readme.length < 300)
|
|
229
|
+
wins.push('Expand the README (currently very short)');
|
|
230
|
+
if (!/install/i.test(readme))
|
|
231
|
+
wins.push('Add installation instructions to README');
|
|
232
|
+
if (!/usage|example|getting started/i.test(readme))
|
|
233
|
+
wins.push('Add usage examples to README');
|
|
234
|
+
if (!/badge|shield/i.test(readme))
|
|
235
|
+
wins.push('Add status badges (CI, npm, coverage)');
|
|
236
|
+
if (!/contribut/i.test(readme))
|
|
237
|
+
wins.push('Add a "Contributing" section to README');
|
|
238
|
+
}
|
|
239
|
+
// Check CI/CD
|
|
240
|
+
const ci = await rawCheck('.github/workflows/ci.yml') || await rawCheck('.github/workflows/ci.yaml') || await rawCheck('.github/workflows/test.yml');
|
|
241
|
+
if (!ci)
|
|
242
|
+
wins.push('Set up GitHub Actions CI/CD');
|
|
243
|
+
// Check gitignore
|
|
244
|
+
const gitignore = await rawCheck('.gitignore');
|
|
245
|
+
if (!gitignore)
|
|
246
|
+
wins.push('Add a .gitignore file');
|
|
247
|
+
if (wins.length === 0) {
|
|
248
|
+
return `${repo} looks well-maintained! No obvious quick wins found.`;
|
|
249
|
+
}
|
|
250
|
+
return [
|
|
251
|
+
`## Quick Win Opportunities for ${repo}`,
|
|
252
|
+
'',
|
|
253
|
+
`Found ${wins.length} easy contributions:`,
|
|
254
|
+
'',
|
|
255
|
+
...wins.map((w, i) => `${i + 1}. ${w}`),
|
|
256
|
+
'',
|
|
257
|
+
'Use `prepare_contribution` to clone the repo and start working on any of these.',
|
|
258
|
+
].join('\n');
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=contribute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contribute.js","sourceRoot":"","sources":["../../src/tools/contribute.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,mDAAmD;AACnD,iEAAiE;AAEjE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,UAAU,GAAG,wBAAwB,CAAA;AAC3C,MAAM,OAAO,GAAG;IACd,YAAY,EAAE,wBAAwB;IACtC,QAAQ,EAAE,gCAAgC;CAC3C,CAAA;AAED,KAAK,UAAU,WAAW,CAAC,IAAY;IACrC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,UAAU,GAAG,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAA;IACrE,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAA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