gitea-cli-skill 0.1.9 → 0.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.
- package/package.json +1 -1
- package/src/index.js +70 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -170,13 +170,20 @@ async function install(args) {
|
|
|
170
170
|
|
|
171
171
|
console.log(`Installing gitea-cli skill (${osArch.os}-${osArch.arch}) to ${skillDir}...`);
|
|
172
172
|
|
|
173
|
-
// 1. Copy SKILL.md
|
|
173
|
+
// 1. Copy SKILL.md and REFERENCE.md
|
|
174
174
|
fs.mkdirSync(skillDir, { recursive: true });
|
|
175
175
|
const srcSkill = path.resolve(__dirname, '..', 'assets', 'SKILL.md');
|
|
176
176
|
const destSkill = path.join(skillDir, 'SKILL.md');
|
|
177
177
|
fs.copyFileSync(srcSkill, destSkill);
|
|
178
178
|
console.log(` SKILL.md -> ${destSkill}`);
|
|
179
179
|
|
|
180
|
+
const srcRef = path.resolve(__dirname, '..', 'assets', 'REFERENCE.md');
|
|
181
|
+
const destRef = path.join(skillDir, 'REFERENCE.md');
|
|
182
|
+
if (fs.existsSync(srcRef)) {
|
|
183
|
+
fs.copyFileSync(srcRef, destRef);
|
|
184
|
+
console.log(` REFERENCE.md -> ${destRef}`);
|
|
185
|
+
}
|
|
186
|
+
|
|
180
187
|
// 2. Check existing binary
|
|
181
188
|
const binaryName = osArch.os === 'windows' ? 'gitea-cli.exe' : 'gitea-cli';
|
|
182
189
|
const destBinary = path.join(scriptsDir, binaryName);
|
|
@@ -324,6 +331,47 @@ async function addContext(args) {
|
|
|
324
331
|
configureContext({ giteaCliBin, host, token, contextName, defaultOwner, defaultRepo });
|
|
325
332
|
}
|
|
326
333
|
|
|
334
|
+
// ── Update command ────────────────────────────────────────────────────────────
|
|
335
|
+
|
|
336
|
+
async function update(args) {
|
|
337
|
+
const { host: explicitHost, platform: platformName, target: targetPath, local: localDir } = args;
|
|
338
|
+
const giteaHost = explicitHost || GITEA_HOST;
|
|
339
|
+
const osArch = detectOSArch();
|
|
340
|
+
const skillDir = resolveSkillDir(platformName, targetPath);
|
|
341
|
+
const scriptsDir = path.join(skillDir, 'scripts', `${osArch.os}-${osArch.arch}`);
|
|
342
|
+
|
|
343
|
+
console.log(`Updating gitea-cli skill (${osArch.os}-${osArch.arch}) at ${skillDir}...`);
|
|
344
|
+
|
|
345
|
+
// 1. Refresh SKILL.md and REFERENCE.md
|
|
346
|
+
const srcSkill = path.resolve(__dirname, '..', 'assets', 'SKILL.md');
|
|
347
|
+
const destSkill = path.join(skillDir, 'SKILL.md');
|
|
348
|
+
if (fs.existsSync(srcSkill)) {
|
|
349
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
350
|
+
fs.copyFileSync(srcSkill, destSkill);
|
|
351
|
+
console.log(` SKILL.md -> ${destSkill}`);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const srcRef = path.resolve(__dirname, '..', 'assets', 'REFERENCE.md');
|
|
355
|
+
const destRef = path.join(skillDir, 'REFERENCE.md');
|
|
356
|
+
if (fs.existsSync(srcRef)) {
|
|
357
|
+
fs.copyFileSync(srcRef, destRef);
|
|
358
|
+
console.log(` REFERENCE.md -> ${destRef}`);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// 2. Re-download / re-copy binary (always overwrite)
|
|
362
|
+
const binaryName = osArch.os === 'windows' ? 'gitea-cli.exe' : 'gitea-cli';
|
|
363
|
+
const destBinary = path.join(scriptsDir, binaryName);
|
|
364
|
+
|
|
365
|
+
if (localDir) {
|
|
366
|
+
installFromLocal(localDir, scriptsDir, destBinary, osArch);
|
|
367
|
+
} else {
|
|
368
|
+
const token = process.env.GITEA_TOKEN || null;
|
|
369
|
+
await installFromRelease(giteaHost, token, scriptsDir, destBinary, osArch);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
console.log('\nDone! Configuration preserved.');
|
|
373
|
+
}
|
|
374
|
+
|
|
327
375
|
// ── CLI ──────────────────────────────────────────────────────────────────────
|
|
328
376
|
|
|
329
377
|
function parseArgs(argv) {
|
|
@@ -356,10 +404,12 @@ function printHelp() {
|
|
|
356
404
|
|
|
357
405
|
Usage:
|
|
358
406
|
npx gitea-cli-skill init [flags] # Install + configure
|
|
407
|
+
npx gitea-cli-skill update [flags] # Refresh binary + docs
|
|
359
408
|
gitea-cli-skill add context [flags] # Update context only
|
|
360
409
|
|
|
361
410
|
Commands:
|
|
362
411
|
init Install skill (binary + SKILL.md) and optionally configure context
|
|
412
|
+
update Refresh binary and SKILL.md/REFERENCE.md (keeps config)
|
|
363
413
|
add context Add or update a Gitea API context (requires --token)
|
|
364
414
|
|
|
365
415
|
Flags (init):
|
|
@@ -373,6 +423,12 @@ Flags (init):
|
|
|
373
423
|
--default-repo <repo> Default repo for auto-config (optional)
|
|
374
424
|
--force Overwrite existing binary
|
|
375
425
|
|
|
426
|
+
Flags (update):
|
|
427
|
+
--host <url> Gitea host URL (default: ${GITEA_HOST})
|
|
428
|
+
--local <dir> Update from local goreleaser dist directory (skip download)
|
|
429
|
+
--platform <name> Target AI platform (default: claude)
|
|
430
|
+
--target <path> Custom install directory (overrides --platform)
|
|
431
|
+
|
|
376
432
|
Flags (add context):
|
|
377
433
|
--name <name> Context name (default: "default")
|
|
378
434
|
--host <url> Gitea host URL (required)
|
|
@@ -397,6 +453,12 @@ Examples:
|
|
|
397
453
|
# Install only (public repo, no token needed)
|
|
398
454
|
npx gitea-cli-skill init
|
|
399
455
|
|
|
456
|
+
# Update binary and docs after new release
|
|
457
|
+
npx gitea-cli-skill update
|
|
458
|
+
|
|
459
|
+
# Update from local build
|
|
460
|
+
npx gitea-cli-skill update --local ../dist
|
|
461
|
+
|
|
400
462
|
# Update context later
|
|
401
463
|
gitea-cli-skill add context --host https://gitea.example.com --token new-token
|
|
402
464
|
|
|
@@ -421,6 +483,13 @@ async function main() {
|
|
|
421
483
|
process.exit(1);
|
|
422
484
|
}
|
|
423
485
|
await install(args);
|
|
486
|
+
} else if (args.command === 'update') {
|
|
487
|
+
if (args.platform && !PLATFORMS[args.platform] && !args.target) {
|
|
488
|
+
console.error(`Unknown platform: ${args.platform}`);
|
|
489
|
+
console.error(`Available: ${Object.keys(PLATFORMS).join(', ')}, or use --target for custom path.`);
|
|
490
|
+
process.exit(1);
|
|
491
|
+
}
|
|
492
|
+
await update(args);
|
|
424
493
|
} else if (args.command === 'add' && args.subcommand === 'context') {
|
|
425
494
|
await addContext(args);
|
|
426
495
|
} else {
|