gitea-cli-skill 0.2.0 → 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 +62 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -331,6 +331,47 @@ async function addContext(args) {
|
|
|
331
331
|
configureContext({ giteaCliBin, host, token, contextName, defaultOwner, defaultRepo });
|
|
332
332
|
}
|
|
333
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
|
+
|
|
334
375
|
// ── CLI ──────────────────────────────────────────────────────────────────────
|
|
335
376
|
|
|
336
377
|
function parseArgs(argv) {
|
|
@@ -363,10 +404,12 @@ function printHelp() {
|
|
|
363
404
|
|
|
364
405
|
Usage:
|
|
365
406
|
npx gitea-cli-skill init [flags] # Install + configure
|
|
407
|
+
npx gitea-cli-skill update [flags] # Refresh binary + docs
|
|
366
408
|
gitea-cli-skill add context [flags] # Update context only
|
|
367
409
|
|
|
368
410
|
Commands:
|
|
369
411
|
init Install skill (binary + SKILL.md) and optionally configure context
|
|
412
|
+
update Refresh binary and SKILL.md/REFERENCE.md (keeps config)
|
|
370
413
|
add context Add or update a Gitea API context (requires --token)
|
|
371
414
|
|
|
372
415
|
Flags (init):
|
|
@@ -380,6 +423,12 @@ Flags (init):
|
|
|
380
423
|
--default-repo <repo> Default repo for auto-config (optional)
|
|
381
424
|
--force Overwrite existing binary
|
|
382
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
|
+
|
|
383
432
|
Flags (add context):
|
|
384
433
|
--name <name> Context name (default: "default")
|
|
385
434
|
--host <url> Gitea host URL (required)
|
|
@@ -404,6 +453,12 @@ Examples:
|
|
|
404
453
|
# Install only (public repo, no token needed)
|
|
405
454
|
npx gitea-cli-skill init
|
|
406
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
|
+
|
|
407
462
|
# Update context later
|
|
408
463
|
gitea-cli-skill add context --host https://gitea.example.com --token new-token
|
|
409
464
|
|
|
@@ -428,6 +483,13 @@ async function main() {
|
|
|
428
483
|
process.exit(1);
|
|
429
484
|
}
|
|
430
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);
|
|
431
493
|
} else if (args.command === 'add' && args.subcommand === 'context') {
|
|
432
494
|
await addContext(args);
|
|
433
495
|
} else {
|