agent-conf 1.0.2 → 2.0.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 +1 -2
- package/dist/index.js +61 -141
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,10 +22,9 @@ Full documentation, setup guides, and FAQ available on GitHub:
|
|
|
22
22
|
| Command | Description |
|
|
23
23
|
|---------|-------------|
|
|
24
24
|
| `init` | Initialize repo from a canonical source |
|
|
25
|
-
| `sync` |
|
|
25
|
+
| `sync` | Sync content from canonical repo (fetches latest by default) |
|
|
26
26
|
| `status` | Show current sync status |
|
|
27
27
|
| `check` | Verify managed files are unchanged |
|
|
28
|
-
| `update` | Check for and apply updates |
|
|
29
28
|
| `init-canonical-repo` | Scaffold a new canonical repository |
|
|
30
29
|
|
|
31
30
|
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
|
|
17
17
|
// src/cli.ts
|
|
18
18
|
import { Command } from "commander";
|
|
19
|
-
import
|
|
19
|
+
import pc11 from "picocolors";
|
|
20
20
|
|
|
21
21
|
// src/commands/check.ts
|
|
22
22
|
import * as fs2 from "fs/promises";
|
|
@@ -66,7 +66,7 @@ var CONFIG_DIR = ".agent-conf";
|
|
|
66
66
|
var LOCKFILE_NAME = "lockfile.json";
|
|
67
67
|
var CLI_VERSION = "0.1.0";
|
|
68
68
|
function getBuildCommit() {
|
|
69
|
-
return true ? "
|
|
69
|
+
return true ? "95b3bde2e0c69d73035f93e655d08eb0c89e3b53" : "unknown";
|
|
70
70
|
}
|
|
71
71
|
function getLockfilePath(targetDir) {
|
|
72
72
|
return path.join(targetDir, CONFIG_DIR, LOCKFILE_NAME);
|
|
@@ -1516,7 +1516,7 @@ async function resolveTargetDirectory() {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
return gitRoot;
|
|
1518
1518
|
}
|
|
1519
|
-
async function resolveVersion(options, status,
|
|
1519
|
+
async function resolveVersion(options, status, _commandName, repo) {
|
|
1520
1520
|
const logger = createLogger();
|
|
1521
1521
|
if (options.local !== void 0) {
|
|
1522
1522
|
return {
|
|
@@ -1542,7 +1542,11 @@ async function resolveVersion(options, status, commandName, repo) {
|
|
|
1542
1542
|
releaseInfo: null
|
|
1543
1543
|
};
|
|
1544
1544
|
}
|
|
1545
|
-
if (
|
|
1545
|
+
if (options.pinned) {
|
|
1546
|
+
if (!status.lockfile?.pinned_version) {
|
|
1547
|
+
logger.error("Cannot use --pinned: no version pinned in lockfile.");
|
|
1548
|
+
process.exit(1);
|
|
1549
|
+
}
|
|
1546
1550
|
const version = status.lockfile.pinned_version;
|
|
1547
1551
|
return {
|
|
1548
1552
|
ref: formatTag(version),
|
|
@@ -2327,6 +2331,14 @@ async function syncCommand(options) {
|
|
|
2327
2331
|
const logger = createLogger();
|
|
2328
2332
|
console.log();
|
|
2329
2333
|
prompts6.intro(pc9.bold("agent-conf sync"));
|
|
2334
|
+
if (options.pinned && options.ref) {
|
|
2335
|
+
logger.error("Cannot use --pinned with --ref. Choose one.");
|
|
2336
|
+
process.exit(1);
|
|
2337
|
+
}
|
|
2338
|
+
if (options.pinned && options.local !== void 0) {
|
|
2339
|
+
logger.error("Cannot use --pinned with --local.");
|
|
2340
|
+
process.exit(1);
|
|
2341
|
+
}
|
|
2330
2342
|
const targetDir = await resolveTargetDirectory();
|
|
2331
2343
|
const targets = await parseAndValidateTargets(options.target);
|
|
2332
2344
|
const status = await getSyncStatus(targetDir);
|
|
@@ -2340,6 +2352,36 @@ async function syncCommand(options) {
|
|
|
2340
2352
|
sourceRepo = status.lockfile.source.repository;
|
|
2341
2353
|
}
|
|
2342
2354
|
const resolvedVersion = await resolveVersion(options, status, "sync", sourceRepo);
|
|
2355
|
+
if (!options.pinned && !options.ref && !options.local && status.lockfile?.pinned_version) {
|
|
2356
|
+
const currentVersion = status.lockfile.pinned_version;
|
|
2357
|
+
if (resolvedVersion.version) {
|
|
2358
|
+
const comparison = compareVersions(currentVersion, resolvedVersion.version);
|
|
2359
|
+
console.log();
|
|
2360
|
+
console.log(`Canonical source: ${pc9.cyan(sourceRepo)}`);
|
|
2361
|
+
console.log(`Latest release: ${pc9.cyan(resolvedVersion.version)}`);
|
|
2362
|
+
console.log(`Pinned version: ${pc9.cyan(currentVersion)}`);
|
|
2363
|
+
if (comparison >= 0) {
|
|
2364
|
+
console.log(` ${pc9.green("\u2713")} Up to date`);
|
|
2365
|
+
console.log();
|
|
2366
|
+
prompts6.outro(pc9.green("Already up to date!"));
|
|
2367
|
+
return;
|
|
2368
|
+
}
|
|
2369
|
+
console.log(
|
|
2370
|
+
` ${pc9.yellow("\u2192")} Update available: ${currentVersion} \u2192 ${resolvedVersion.version}`
|
|
2371
|
+
);
|
|
2372
|
+
console.log();
|
|
2373
|
+
if (!options.yes) {
|
|
2374
|
+
const shouldUpdate = await prompts6.confirm({
|
|
2375
|
+
message: "Proceed with update?",
|
|
2376
|
+
initialValue: true
|
|
2377
|
+
});
|
|
2378
|
+
if (prompts6.isCancel(shouldUpdate) || !shouldUpdate) {
|
|
2379
|
+
prompts6.cancel("Sync cancelled");
|
|
2380
|
+
process.exit(0);
|
|
2381
|
+
}
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2343
2385
|
if (options.ref && status.lockfile?.pinned_version) {
|
|
2344
2386
|
const currentVersion = status.lockfile.pinned_version;
|
|
2345
2387
|
if (resolvedVersion.version && currentVersion !== resolvedVersion.version) {
|
|
@@ -2369,129 +2411,10 @@ async function syncCommand(options) {
|
|
|
2369
2411
|
});
|
|
2370
2412
|
}
|
|
2371
2413
|
|
|
2372
|
-
// src/commands/update.ts
|
|
2373
|
-
import * as prompts7 from "@clack/prompts";
|
|
2374
|
-
import pc10 from "picocolors";
|
|
2375
|
-
function getRepositoryFromLockfile(status) {
|
|
2376
|
-
if (!status.lockfile?.source) {
|
|
2377
|
-
return void 0;
|
|
2378
|
-
}
|
|
2379
|
-
if (status.lockfile.source.type === "github") {
|
|
2380
|
-
return status.lockfile.source.repository;
|
|
2381
|
-
}
|
|
2382
|
-
return void 0;
|
|
2383
|
-
}
|
|
2384
|
-
async function updateCommand(options) {
|
|
2385
|
-
const logger = createLogger();
|
|
2386
|
-
const currentCliVersion = getCliVersion();
|
|
2387
|
-
console.log();
|
|
2388
|
-
prompts7.intro(pc10.bold("agent-conf update"));
|
|
2389
|
-
const cwd = process.cwd();
|
|
2390
|
-
const gitRoot = await getGitRoot(cwd);
|
|
2391
|
-
if (!gitRoot) {
|
|
2392
|
-
logger.error("Not inside a git repository. Run this command from within a git repository.");
|
|
2393
|
-
process.exit(1);
|
|
2394
|
-
}
|
|
2395
|
-
const status = await getSyncStatus(gitRoot);
|
|
2396
|
-
const sourceRepository = getRepositoryFromLockfile(status);
|
|
2397
|
-
if (!sourceRepository) {
|
|
2398
|
-
logger.error(
|
|
2399
|
-
"No GitHub source found in lockfile. Cannot check for updates.\nRun 'agent-conf init --source <owner/repo>' to sync from a canonical repository first."
|
|
2400
|
-
);
|
|
2401
|
-
process.exit(1);
|
|
2402
|
-
}
|
|
2403
|
-
const spinner = logger.spinner("Checking for updates...");
|
|
2404
|
-
spinner.start();
|
|
2405
|
-
let latestRelease;
|
|
2406
|
-
try {
|
|
2407
|
-
latestRelease = await getLatestRelease(sourceRepository);
|
|
2408
|
-
spinner.stop();
|
|
2409
|
-
} catch (error) {
|
|
2410
|
-
spinner.fail("Failed to check for updates");
|
|
2411
|
-
logger.error(error instanceof Error ? error.message : String(error));
|
|
2412
|
-
process.exit(1);
|
|
2413
|
-
}
|
|
2414
|
-
console.log();
|
|
2415
|
-
console.log(`CLI version: ${pc10.cyan(currentCliVersion)}`);
|
|
2416
|
-
console.log(`Canonical source: ${pc10.cyan(sourceRepository)}`);
|
|
2417
|
-
console.log(`Latest release: ${pc10.cyan(latestRelease.tag)}`);
|
|
2418
|
-
const currentRepoVersion = status.lockfile?.pinned_version;
|
|
2419
|
-
const repoNeedsUpdate = currentRepoVersion ? compareVersions(currentRepoVersion, latestRelease.version) < 0 : false;
|
|
2420
|
-
if (currentRepoVersion) {
|
|
2421
|
-
console.log(`Pinned version: ${pc10.cyan(currentRepoVersion)}`);
|
|
2422
|
-
if (repoNeedsUpdate) {
|
|
2423
|
-
console.log(` ${pc10.yellow("\u2192")} Update available: ${latestRelease.version}`);
|
|
2424
|
-
} else {
|
|
2425
|
-
console.log(` ${pc10.green("\u2713")} Up to date`);
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
if (!repoNeedsUpdate) {
|
|
2429
|
-
console.log();
|
|
2430
|
-
prompts7.outro(pc10.green("Everything is up to date!"));
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
console.log();
|
|
2434
|
-
console.log(pc10.bold("Updates available:"));
|
|
2435
|
-
console.log(` ${pc10.yellow("\u2192")} Canonical: ${currentRepoVersion} \u2192 ${latestRelease.version}`);
|
|
2436
|
-
console.log();
|
|
2437
|
-
if (!options.yes) {
|
|
2438
|
-
const shouldUpdate = await prompts7.confirm({
|
|
2439
|
-
message: "Proceed with update?",
|
|
2440
|
-
initialValue: true
|
|
2441
|
-
});
|
|
2442
|
-
if (prompts7.isCancel(shouldUpdate) || !shouldUpdate) {
|
|
2443
|
-
prompts7.cancel("Update cancelled");
|
|
2444
|
-
process.exit(0);
|
|
2445
|
-
}
|
|
2446
|
-
}
|
|
2447
|
-
console.log();
|
|
2448
|
-
console.log(pc10.bold("Updating canonical content..."));
|
|
2449
|
-
const targets = await parseAndValidateTargets(options.target);
|
|
2450
|
-
const currentStatus = await getSyncStatus(gitRoot);
|
|
2451
|
-
const resolvedVersion = {
|
|
2452
|
-
ref: latestRelease.tag,
|
|
2453
|
-
version: latestRelease.version,
|
|
2454
|
-
isRelease: true,
|
|
2455
|
-
releaseInfo: latestRelease
|
|
2456
|
-
};
|
|
2457
|
-
let tempDir = null;
|
|
2458
|
-
try {
|
|
2459
|
-
tempDir = await createTempDir();
|
|
2460
|
-
const resolvedSource = await resolveGithubSource(
|
|
2461
|
-
{ repository: sourceRepository, ref: latestRelease.tag },
|
|
2462
|
-
tempDir
|
|
2463
|
-
);
|
|
2464
|
-
await checkModifiedFilesBeforeSync(gitRoot, targets, options, tempDir);
|
|
2465
|
-
const shouldOverride = await promptMergeOrOverride(
|
|
2466
|
-
currentStatus,
|
|
2467
|
-
{ ...options, override: false },
|
|
2468
|
-
tempDir
|
|
2469
|
-
);
|
|
2470
|
-
await performSync({
|
|
2471
|
-
targetDir: gitRoot,
|
|
2472
|
-
resolvedSource,
|
|
2473
|
-
resolvedVersion,
|
|
2474
|
-
shouldOverride,
|
|
2475
|
-
targets,
|
|
2476
|
-
context: {
|
|
2477
|
-
commandName: "sync",
|
|
2478
|
-
status: currentStatus
|
|
2479
|
-
},
|
|
2480
|
-
tempDir,
|
|
2481
|
-
yes: options.yes,
|
|
2482
|
-
sourceRepo: sourceRepository
|
|
2483
|
-
});
|
|
2484
|
-
} catch (error) {
|
|
2485
|
-
if (tempDir) await removeTempDir(tempDir);
|
|
2486
|
-
throw error;
|
|
2487
|
-
}
|
|
2488
|
-
prompts7.outro(pc10.green("Update complete!"));
|
|
2489
|
-
}
|
|
2490
|
-
|
|
2491
2414
|
// src/commands/upgrade-cli.ts
|
|
2492
2415
|
import { execSync as execSync2 } from "child_process";
|
|
2493
|
-
import * as
|
|
2494
|
-
import
|
|
2416
|
+
import * as prompts7 from "@clack/prompts";
|
|
2417
|
+
import pc10 from "picocolors";
|
|
2495
2418
|
var NPM_PACKAGE_NAME = "agent-conf";
|
|
2496
2419
|
async function getLatestNpmVersion() {
|
|
2497
2420
|
const response = await fetch(`https://registry.npmjs.org/${NPM_PACKAGE_NAME}/latest`);
|
|
@@ -2505,7 +2428,7 @@ async function upgradeCliCommand(options) {
|
|
|
2505
2428
|
const logger = createLogger();
|
|
2506
2429
|
const currentVersion = getCliVersion();
|
|
2507
2430
|
console.log();
|
|
2508
|
-
|
|
2431
|
+
prompts7.intro(pc10.bold("agent-conf upgrade-cli"));
|
|
2509
2432
|
const spinner = logger.spinner("Checking for CLI updates...");
|
|
2510
2433
|
spinner.start();
|
|
2511
2434
|
let latestVersion;
|
|
@@ -2518,24 +2441,24 @@ async function upgradeCliCommand(options) {
|
|
|
2518
2441
|
process.exit(1);
|
|
2519
2442
|
}
|
|
2520
2443
|
console.log();
|
|
2521
|
-
console.log(`Current version: ${
|
|
2522
|
-
console.log(`Latest version: ${
|
|
2444
|
+
console.log(`Current version: ${pc10.cyan(currentVersion)}`);
|
|
2445
|
+
console.log(`Latest version: ${pc10.cyan(latestVersion)}`);
|
|
2523
2446
|
const needsUpdate = compareVersions(currentVersion, latestVersion) < 0;
|
|
2524
2447
|
if (!needsUpdate) {
|
|
2525
2448
|
console.log();
|
|
2526
|
-
|
|
2449
|
+
prompts7.outro(pc10.green("CLI is already up to date!"));
|
|
2527
2450
|
return;
|
|
2528
2451
|
}
|
|
2529
2452
|
console.log();
|
|
2530
|
-
console.log(`${
|
|
2453
|
+
console.log(`${pc10.yellow("\u2192")} Update available: ${currentVersion} \u2192 ${latestVersion}`);
|
|
2531
2454
|
console.log();
|
|
2532
2455
|
if (!options.yes) {
|
|
2533
|
-
const shouldUpdate = await
|
|
2456
|
+
const shouldUpdate = await prompts7.confirm({
|
|
2534
2457
|
message: "Proceed with CLI upgrade?",
|
|
2535
2458
|
initialValue: true
|
|
2536
2459
|
});
|
|
2537
|
-
if (
|
|
2538
|
-
|
|
2460
|
+
if (prompts7.isCancel(shouldUpdate) || !shouldUpdate) {
|
|
2461
|
+
prompts7.cancel("Upgrade cancelled");
|
|
2539
2462
|
process.exit(0);
|
|
2540
2463
|
}
|
|
2541
2464
|
}
|
|
@@ -2547,7 +2470,7 @@ async function upgradeCliCommand(options) {
|
|
|
2547
2470
|
});
|
|
2548
2471
|
installSpinner.succeed("CLI upgraded");
|
|
2549
2472
|
console.log();
|
|
2550
|
-
|
|
2473
|
+
prompts7.outro(pc10.green(`CLI upgraded to ${latestVersion}!`));
|
|
2551
2474
|
} catch (error) {
|
|
2552
2475
|
installSpinner.fail("Upgrade failed");
|
|
2553
2476
|
logger.error(error instanceof Error ? error.message : String(error));
|
|
@@ -2570,12 +2493,12 @@ async function warnIfCliOutdated() {
|
|
|
2570
2493
|
if (mismatch) {
|
|
2571
2494
|
console.log();
|
|
2572
2495
|
console.log(
|
|
2573
|
-
|
|
2496
|
+
pc11.yellow(
|
|
2574
2497
|
`\u26A0 CLI is outdated: built from ${mismatch.cliCommit}, but repo was synced from ${mismatch.lockfileCommit}`
|
|
2575
2498
|
)
|
|
2576
2499
|
);
|
|
2577
2500
|
console.log(
|
|
2578
|
-
|
|
2501
|
+
pc11.yellow(
|
|
2579
2502
|
" Rebuild the CLI: cd <agent-conf-repo>/cli && pnpm build && pnpm link --global"
|
|
2580
2503
|
)
|
|
2581
2504
|
);
|
|
@@ -2597,10 +2520,10 @@ function createCli() {
|
|
|
2597
2520
|
await initCommand(options);
|
|
2598
2521
|
}
|
|
2599
2522
|
);
|
|
2600
|
-
program.command("sync").description("Sync
|
|
2523
|
+
program.command("sync").description("Sync content from canonical repository (fetches latest by default)").option(
|
|
2601
2524
|
"-s, --source <repo>",
|
|
2602
2525
|
"Canonical repository in owner/repo format (e.g., acme/standards)"
|
|
2603
|
-
).option("--local [path]", "Use local canonical repository (auto-discover or specify path)").option("-y, --yes", "Non-interactive mode (merge by default)").option("--override", "Override existing AGENTS.md instead of merging").option("--ref <ref>", "GitHub ref/version to sync from
|
|
2526
|
+
).option("--local [path]", "Use local canonical repository (auto-discover or specify path)").option("-y, --yes", "Non-interactive mode (merge by default)").option("--override", "Override existing AGENTS.md instead of merging").option("--ref <ref>", "GitHub ref/version to sync from").option("--pinned", "Use lockfile version without fetching latest").option("-t, --target <targets...>", "Target platforms (claude, codex)", ["claude"]).action(
|
|
2604
2527
|
async (options) => {
|
|
2605
2528
|
await syncCommand(options);
|
|
2606
2529
|
}
|
|
@@ -2608,9 +2531,6 @@ function createCli() {
|
|
|
2608
2531
|
program.command("status").description("Show current sync status").option("-c, --check", "Check for manually modified skill files").action(async (options) => {
|
|
2609
2532
|
await statusCommand(options);
|
|
2610
2533
|
});
|
|
2611
|
-
program.command("update").description("Check for and apply updates from the canonical repository").option("-y, --yes", "Non-interactive mode").option("-t, --target <targets...>", "Target platforms (claude, codex)", ["claude"]).action(async (options) => {
|
|
2612
|
-
await updateCommand(options);
|
|
2613
|
-
});
|
|
2614
2534
|
program.command("check").description("Check if managed files have been modified").option("-q, --quiet", "Minimal output, just exit code").action(async (options) => {
|
|
2615
2535
|
await checkCommand(options);
|
|
2616
2536
|
});
|