agconf 0.3.1 → 0.3.3
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 +9 -9
- package/dist/{chunk-B53WKCQU.js → chunk-OHYGKXGJ.js} +10 -10
- package/dist/chunk-OHYGKXGJ.js.map +1 -0
- package/dist/index.js +67 -68
- package/dist/index.js.map +1 -1
- package/dist/{skill-metadata-XXNMIXLD.js → skill-metadata-NPSEW5UJ.js} +2 -2
- package/package.json +5 -6
- package/dist/chunk-B53WKCQU.js.map +0 -1
- /package/dist/{skill-metadata-XXNMIXLD.js.map → skill-metadata-NPSEW5UJ.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
stripMetadataComments,
|
|
19
19
|
stripRulesSectionMetadata,
|
|
20
20
|
validateSkillFrontmatter
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-OHYGKXGJ.js";
|
|
22
22
|
|
|
23
23
|
// src/cli.ts
|
|
24
24
|
import { Command } from "commander";
|
|
@@ -54,7 +54,7 @@ async function directoryExists(dirPath) {
|
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
async function createTempDir(prefix = "
|
|
57
|
+
async function createTempDir(prefix = "agconf-") {
|
|
58
58
|
const tmpDir = os.tmpdir();
|
|
59
59
|
return fs.mkdtemp(path.join(tmpDir, prefix));
|
|
60
60
|
}
|
|
@@ -374,11 +374,11 @@ jobs:
|
|
|
374
374
|
with:
|
|
375
375
|
node-version: '20'
|
|
376
376
|
|
|
377
|
-
- name: Install
|
|
377
|
+
- name: Install agconf CLI
|
|
378
378
|
run: npm install -g agconf
|
|
379
379
|
|
|
380
380
|
- name: Run sync
|
|
381
|
-
run:
|
|
381
|
+
run: agconf sync --yes --summary-file /tmp/sync-summary.md --expand-changes
|
|
382
382
|
env:
|
|
383
383
|
GITHUB_TOKEN: \${{ secrets.token }}
|
|
384
384
|
|
|
@@ -386,7 +386,7 @@ jobs:
|
|
|
386
386
|
id: check-changes
|
|
387
387
|
run: |
|
|
388
388
|
# Check for meaningful changes (excluding lockfile which always updates with synced_at)
|
|
389
|
-
LOCKFILE_PATH=".
|
|
389
|
+
LOCKFILE_PATH=".agconf/lockfile.json"
|
|
390
390
|
|
|
391
391
|
# Get changed files excluding lockfile
|
|
392
392
|
MEANINGFUL_CHANGES=$(git status --porcelain | grep -v "^.. $LOCKFILE_PATH$" || true)
|
|
@@ -533,17 +533,17 @@ jobs:
|
|
|
533
533
|
with:
|
|
534
534
|
node-version: '20'
|
|
535
535
|
|
|
536
|
-
- name: Install
|
|
536
|
+
- name: Install agconf CLI
|
|
537
537
|
run: npm install -g agconf
|
|
538
538
|
|
|
539
539
|
- name: Check file integrity
|
|
540
|
-
run:
|
|
540
|
+
run: agconf check
|
|
541
541
|
`;
|
|
542
542
|
}
|
|
543
543
|
async function canonicalInitCommand(options) {
|
|
544
544
|
const logger = createLogger();
|
|
545
545
|
console.log();
|
|
546
|
-
prompts.intro(pc2.bold("
|
|
546
|
+
prompts.intro(pc2.bold("agconf canonical init"));
|
|
547
547
|
const targetDir = options.dir ? path3.resolve(options.dir) : process.cwd();
|
|
548
548
|
const dirName = path3.basename(targetDir);
|
|
549
549
|
const cwd = process.cwd();
|
|
@@ -573,10 +573,10 @@ async function canonicalInitCommand(options) {
|
|
|
573
573
|
}
|
|
574
574
|
const dirExists = await directoryExists(targetDir);
|
|
575
575
|
if (dirExists) {
|
|
576
|
-
const configExists = await fileExists(path3.join(targetDir, "
|
|
576
|
+
const configExists = await fileExists(path3.join(targetDir, "agconf.yaml"));
|
|
577
577
|
if (configExists && !options.yes) {
|
|
578
578
|
const shouldContinue = await prompts.confirm({
|
|
579
|
-
message: "This directory already has an
|
|
579
|
+
message: "This directory already has an agconf.yaml. Overwrite?",
|
|
580
580
|
initialValue: false
|
|
581
581
|
});
|
|
582
582
|
if (prompts.isCancel(shouldContinue) || !shouldContinue) {
|
|
@@ -591,7 +591,7 @@ async function canonicalInitCommand(options) {
|
|
|
591
591
|
name: options.name ?? defaultName,
|
|
592
592
|
organization: options.org ?? gitOrganization,
|
|
593
593
|
targetDir,
|
|
594
|
-
markerPrefix: options.markerPrefix ?? "
|
|
594
|
+
markerPrefix: options.markerPrefix ?? "agconf",
|
|
595
595
|
includeExamples: options.includeExamples !== false,
|
|
596
596
|
rulesDir: options.rulesDir || void 0
|
|
597
597
|
};
|
|
@@ -623,8 +623,8 @@ async function canonicalInitCommand(options) {
|
|
|
623
623
|
}
|
|
624
624
|
const markerPrefix = await prompts.text({
|
|
625
625
|
message: "Marker prefix for managed content:",
|
|
626
|
-
placeholder: "
|
|
627
|
-
defaultValue: options.markerPrefix ?? "
|
|
626
|
+
placeholder: "agconf",
|
|
627
|
+
defaultValue: options.markerPrefix ?? "agconf",
|
|
628
628
|
validate: (value) => {
|
|
629
629
|
if (!value.trim()) return "Prefix is required";
|
|
630
630
|
if (!/^[a-z0-9-]+$/.test(value))
|
|
@@ -695,7 +695,7 @@ async function canonicalInitCommand(options) {
|
|
|
695
695
|
await ensureDir(rulesDir);
|
|
696
696
|
await fs3.writeFile(path3.join(rulesDir, ".gitkeep"), "", "utf-8");
|
|
697
697
|
}
|
|
698
|
-
const configPath = path3.join(resolvedOptions.targetDir, "
|
|
698
|
+
const configPath = path3.join(resolvedOptions.targetDir, "agconf.yaml");
|
|
699
699
|
await fs3.writeFile(configPath, generateConfigYaml(resolvedOptions), "utf-8");
|
|
700
700
|
const agentsMdPath = path3.join(instructionsDir, "AGENTS.md");
|
|
701
701
|
await fs3.writeFile(agentsMdPath, generateAgentsMd(resolvedOptions), "utf-8");
|
|
@@ -757,7 +757,7 @@ async function canonicalInitCommand(options) {
|
|
|
757
757
|
console.log();
|
|
758
758
|
console.log(
|
|
759
759
|
pc2.dim(
|
|
760
|
-
`See https://github.com/julian-pani/
|
|
760
|
+
`See https://github.com/julian-pani/agconf/blob/master/cli/docs/CANONICAL_REPOSITORY_SETUP.md for detailed setup instructions.`
|
|
761
761
|
)
|
|
762
762
|
);
|
|
763
763
|
prompts.outro(pc2.green("Done!"));
|
|
@@ -807,7 +807,7 @@ var ContentSchema = z.object({
|
|
|
807
807
|
}),
|
|
808
808
|
skills: z.array(z.string()),
|
|
809
809
|
targets: z.array(z.string()).optional(),
|
|
810
|
-
/** Marker prefix used for managed content (default: "
|
|
810
|
+
/** Marker prefix used for managed content (default: "agconf") */
|
|
811
811
|
marker_prefix: z.string().optional(),
|
|
812
812
|
/** Rules content tracking - optional for backward compat */
|
|
813
813
|
rules: RulesContentSchema.optional()
|
|
@@ -842,7 +842,7 @@ function checkSchemaCompatibility(contentVersion) {
|
|
|
842
842
|
if (contentMajor < supportedMajor) {
|
|
843
843
|
return {
|
|
844
844
|
compatible: false,
|
|
845
|
-
error: `Schema version ${contentVersion} is outdated and no longer supported. This content was created with an older version of
|
|
845
|
+
error: `Schema version ${contentVersion} is outdated and no longer supported. This content was created with an older version of agconf.`
|
|
846
846
|
};
|
|
847
847
|
}
|
|
848
848
|
if (contentMinor > supportedMinor) {
|
|
@@ -855,7 +855,7 @@ function checkSchemaCompatibility(contentVersion) {
|
|
|
855
855
|
}
|
|
856
856
|
|
|
857
857
|
// src/core/lockfile.ts
|
|
858
|
-
var CONFIG_DIR = ".
|
|
858
|
+
var CONFIG_DIR = ".agconf";
|
|
859
859
|
var LOCKFILE_NAME = "lockfile.json";
|
|
860
860
|
function getLockfilePath(targetDir) {
|
|
861
861
|
return path4.join(targetDir, CONFIG_DIR, LOCKFILE_NAME);
|
|
@@ -904,7 +904,7 @@ function hashContent(content) {
|
|
|
904
904
|
return `sha256:${hash.slice(0, 12)}`;
|
|
905
905
|
}
|
|
906
906
|
function getCliVersion() {
|
|
907
|
-
return true ? "0.3.
|
|
907
|
+
return true ? "0.3.3" : "0.0.0";
|
|
908
908
|
}
|
|
909
909
|
async function checkCliVersionMismatch(targetDir) {
|
|
910
910
|
const result = await readLockfile(targetDir);
|
|
@@ -941,8 +941,8 @@ async function checkCommand(options = {}) {
|
|
|
941
941
|
console.log();
|
|
942
942
|
console.log(pc3.yellow("Not synced"));
|
|
943
943
|
console.log();
|
|
944
|
-
console.log(pc3.dim("This repository has not been synced with
|
|
945
|
-
console.log(pc3.dim("Run `
|
|
944
|
+
console.log(pc3.dim("This repository has not been synced with agconf."));
|
|
945
|
+
console.log(pc3.dim("Run `agconf init` to sync engineering standards."));
|
|
946
946
|
console.log();
|
|
947
947
|
}
|
|
948
948
|
return;
|
|
@@ -1045,7 +1045,7 @@ async function checkCommand(options = {}) {
|
|
|
1045
1045
|
process.exit(1);
|
|
1046
1046
|
}
|
|
1047
1047
|
console.log();
|
|
1048
|
-
console.log(pc3.bold("
|
|
1048
|
+
console.log(pc3.bold("agconf check"));
|
|
1049
1049
|
console.log();
|
|
1050
1050
|
console.log(`${pc3.red("\u2717")} No managed files found`);
|
|
1051
1051
|
console.log();
|
|
@@ -1053,7 +1053,7 @@ async function checkCommand(options = {}) {
|
|
|
1053
1053
|
if (markerPrefix) {
|
|
1054
1054
|
console.log(pc3.dim(`Expected marker prefix: ${markerPrefix}`));
|
|
1055
1055
|
}
|
|
1056
|
-
console.log(pc3.dim("Run '
|
|
1056
|
+
console.log(pc3.dim("Run 'agconf sync' to restore the managed files."));
|
|
1057
1057
|
console.log();
|
|
1058
1058
|
process.exit(1);
|
|
1059
1059
|
}
|
|
@@ -1064,7 +1064,7 @@ async function checkCommand(options = {}) {
|
|
|
1064
1064
|
return;
|
|
1065
1065
|
}
|
|
1066
1066
|
console.log();
|
|
1067
|
-
console.log(pc3.bold("
|
|
1067
|
+
console.log(pc3.bold("agconf check"));
|
|
1068
1068
|
console.log();
|
|
1069
1069
|
console.log("Checking managed files...");
|
|
1070
1070
|
console.log();
|
|
@@ -1089,8 +1089,8 @@ async function checkCommand(options = {}) {
|
|
|
1089
1089
|
console.log(` Current hash: ${pc3.dim(file.currentHash)}`);
|
|
1090
1090
|
console.log();
|
|
1091
1091
|
}
|
|
1092
|
-
console.log(pc3.dim("These files are managed by
|
|
1093
|
-
console.log(pc3.dim("Run '
|
|
1092
|
+
console.log(pc3.dim("These files are managed by agconf and should not be modified manually."));
|
|
1093
|
+
console.log(pc3.dim("Run 'agconf sync' to restore them to the expected state."));
|
|
1094
1094
|
console.log();
|
|
1095
1095
|
process.exit(1);
|
|
1096
1096
|
}
|
|
@@ -1103,14 +1103,14 @@ import * as prompts2 from "@clack/prompts";
|
|
|
1103
1103
|
import pc4 from "picocolors";
|
|
1104
1104
|
import tabtab from "tabtab";
|
|
1105
1105
|
import tabtabInstaller from "tabtab/lib/installer.js";
|
|
1106
|
-
var CLI_NAME = "
|
|
1106
|
+
var CLI_NAME = "agconf";
|
|
1107
1107
|
var COMMANDS = {
|
|
1108
1108
|
init: {
|
|
1109
|
-
description: "Initialize or sync
|
|
1109
|
+
description: "Initialize or sync agconf standards",
|
|
1110
1110
|
options: ["-s", "--source", "--local", "-y", "--yes", "--override", "--ref", "-t", "--target"]
|
|
1111
1111
|
},
|
|
1112
1112
|
sync: {
|
|
1113
|
-
description: "Sync
|
|
1113
|
+
description: "Sync agconf standards",
|
|
1114
1114
|
options: ["-s", "--source", "--local", "-y", "--yes", "--override", "--ref", "-t", "--target"]
|
|
1115
1115
|
},
|
|
1116
1116
|
status: {
|
|
@@ -1341,7 +1341,7 @@ async function promptCompletionInstall() {
|
|
|
1341
1341
|
message: `Install shell completions for ${shell}?`
|
|
1342
1342
|
});
|
|
1343
1343
|
if (prompts2.isCancel(shouldInstall) || !shouldInstall) {
|
|
1344
|
-
prompts2.log.info(`You can install later with: ${pc4.cyan("
|
|
1344
|
+
prompts2.log.info(`You can install later with: ${pc4.cyan("agconf completion install")}`);
|
|
1345
1345
|
return false;
|
|
1346
1346
|
}
|
|
1347
1347
|
try {
|
|
@@ -1353,7 +1353,7 @@ async function promptCompletionInstall() {
|
|
|
1353
1353
|
return true;
|
|
1354
1354
|
} catch (error) {
|
|
1355
1355
|
prompts2.log.warn(`Could not install completions: ${error}`);
|
|
1356
|
-
prompts2.log.info(`You can try again with: ${pc4.cyan("
|
|
1356
|
+
prompts2.log.info(`You can try again with: ${pc4.cyan("agconf completion install")}`);
|
|
1357
1357
|
return false;
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
@@ -1363,13 +1363,13 @@ import * as prompts3 from "@clack/prompts";
|
|
|
1363
1363
|
import pc5 from "picocolors";
|
|
1364
1364
|
async function configShowCommand() {
|
|
1365
1365
|
console.log();
|
|
1366
|
-
prompts3.intro(pc5.bold("
|
|
1366
|
+
prompts3.intro(pc5.bold("agconf config"));
|
|
1367
1367
|
console.log();
|
|
1368
1368
|
console.log(pc5.bold("Global Configuration:"));
|
|
1369
1369
|
console.log();
|
|
1370
1370
|
console.log(pc5.dim(" No configuration options available."));
|
|
1371
1371
|
console.log();
|
|
1372
|
-
console.log(pc5.dim("Config location: ~/.
|
|
1372
|
+
console.log(pc5.dim("Config location: ~/.agconf/config.json"));
|
|
1373
1373
|
prompts3.outro("");
|
|
1374
1374
|
}
|
|
1375
1375
|
async function configGetCommand(key) {
|
|
@@ -1675,7 +1675,7 @@ function generateRulesSection(rules, markerPrefix) {
|
|
|
1675
1675
|
const contentHash = `sha256:${hash.slice(0, 12)}`;
|
|
1676
1676
|
const parts = [];
|
|
1677
1677
|
parts.push(`<!-- ${markerPrefix}:rules:start -->`);
|
|
1678
|
-
parts.push(`<!-- DO NOT EDIT THIS SECTION - Managed by
|
|
1678
|
+
parts.push(`<!-- DO NOT EDIT THIS SECTION - Managed by agconf -->`);
|
|
1679
1679
|
parts.push(`<!-- Content hash: ${contentHash} -->`);
|
|
1680
1680
|
parts.push(`<!-- Rule count: ${rules.length} -->`);
|
|
1681
1681
|
parts.push("");
|
|
@@ -2076,7 +2076,7 @@ async function deleteOrphanedSkills(targetDir, orphanedSkills, targets, previous
|
|
|
2076
2076
|
const skillMdPath = path8.join(skillDir, "SKILL.md");
|
|
2077
2077
|
try {
|
|
2078
2078
|
const content = await fs8.readFile(skillMdPath, "utf-8");
|
|
2079
|
-
const { isManaged, hasManualChanges } = await import("./skill-metadata-
|
|
2079
|
+
const { isManaged, hasManualChanges } = await import("./skill-metadata-NPSEW5UJ.js");
|
|
2080
2080
|
if (!isManaged(content, metadataOptions)) {
|
|
2081
2081
|
if (!skipped.includes(skillName)) {
|
|
2082
2082
|
skipped.push(skillName);
|
|
@@ -2116,10 +2116,10 @@ import pc6 from "picocolors";
|
|
|
2116
2116
|
// src/core/hooks.ts
|
|
2117
2117
|
import * as fs9 from "fs/promises";
|
|
2118
2118
|
import * as path9 from "path";
|
|
2119
|
-
var DEFAULT_CLI_NAME = "
|
|
2120
|
-
var DEFAULT_CONFIG_DIR = ".
|
|
2119
|
+
var DEFAULT_CLI_NAME = "agconf";
|
|
2120
|
+
var DEFAULT_CONFIG_DIR = ".agconf";
|
|
2121
2121
|
var DEFAULT_LOCKFILE_NAME = "lockfile.json";
|
|
2122
|
-
var HOOK_IDENTIFIER = "#
|
|
2122
|
+
var HOOK_IDENTIFIER = "# agconf pre-commit hook";
|
|
2123
2123
|
function generatePreCommitHook(config) {
|
|
2124
2124
|
const { cliName, configDir, lockfileName } = config;
|
|
2125
2125
|
return `#!/bin/bash
|
|
@@ -2236,7 +2236,7 @@ import { simpleGit as simpleGit2 } from "simple-git";
|
|
|
2236
2236
|
import * as fs10 from "fs/promises";
|
|
2237
2237
|
import * as path10 from "path";
|
|
2238
2238
|
import { parse as parseYaml } from "yaml";
|
|
2239
|
-
var CANONICAL_REPO_CONFIG = "
|
|
2239
|
+
var CANONICAL_REPO_CONFIG = "agconf.yaml";
|
|
2240
2240
|
async function loadCanonicalRepoConfig(basePath) {
|
|
2241
2241
|
const configPath = path10.join(basePath, CANONICAL_REPO_CONFIG);
|
|
2242
2242
|
try {
|
|
@@ -2273,7 +2273,7 @@ async function resolveLocalSource(options = {}) {
|
|
|
2273
2273
|
} catch {
|
|
2274
2274
|
}
|
|
2275
2275
|
const canonicalConfig = await loadCanonicalRepoConfig(basePath);
|
|
2276
|
-
const markerPrefix = canonicalConfig?.markers.prefix ?? "
|
|
2276
|
+
const markerPrefix = canonicalConfig?.markers.prefix ?? "agconf";
|
|
2277
2277
|
const rulesDir = canonicalConfig?.content.rules_dir;
|
|
2278
2278
|
const source = {
|
|
2279
2279
|
type: "local",
|
|
@@ -2296,7 +2296,7 @@ async function resolveGithubSource(options, tempDir) {
|
|
|
2296
2296
|
const log2 = await clonedGit.log({ maxCount: 1 });
|
|
2297
2297
|
const commitSha = log2.latest?.hash ?? "";
|
|
2298
2298
|
const canonicalConfig = await loadCanonicalRepoConfig(tempDir);
|
|
2299
|
-
const markerPrefix = canonicalConfig?.markers.prefix ?? "
|
|
2299
|
+
const markerPrefix = canonicalConfig?.markers.prefix ?? "agconf";
|
|
2300
2300
|
const rulesDir = canonicalConfig?.content.rules_dir;
|
|
2301
2301
|
const source = {
|
|
2302
2302
|
type: "github",
|
|
@@ -2347,7 +2347,7 @@ async function findCanonicalRepo(startDir) {
|
|
|
2347
2347
|
currentDir = path11.resolve(startDir);
|
|
2348
2348
|
while (currentDir !== root) {
|
|
2349
2349
|
const parentDir = path11.dirname(currentDir);
|
|
2350
|
-
const siblingCanonicalRepo = path11.join(parentDir, "
|
|
2350
|
+
const siblingCanonicalRepo = path11.join(parentDir, "agconf");
|
|
2351
2351
|
if (await isCanonicalRepo(siblingCanonicalRepo)) {
|
|
2352
2352
|
return siblingCanonicalRepo;
|
|
2353
2353
|
}
|
|
@@ -2376,7 +2376,7 @@ async function isCanonicalRepo(dir) {
|
|
|
2376
2376
|
const git = simpleGit2(dir);
|
|
2377
2377
|
const remotes = await git.getRemotes(true);
|
|
2378
2378
|
const hasMatchingRemote = remotes.some(
|
|
2379
|
-
(r) => r.refs.fetch?.includes("
|
|
2379
|
+
(r) => r.refs.fetch?.includes("agconf") || r.refs.push?.includes("agconf")
|
|
2380
2380
|
);
|
|
2381
2381
|
if (hasMatchingRemote) {
|
|
2382
2382
|
return true;
|
|
@@ -2431,7 +2431,7 @@ function getGitHubToken() {
|
|
|
2431
2431
|
} catch {
|
|
2432
2432
|
}
|
|
2433
2433
|
throw new Error(
|
|
2434
|
-
`GitHub authentication required to access
|
|
2434
|
+
`GitHub authentication required to access agconf releases.
|
|
2435
2435
|
|
|
2436
2436
|
To fix this, do one of the following:
|
|
2437
2437
|
|
|
@@ -2450,7 +2450,7 @@ function getGitHubHeaders() {
|
|
|
2450
2450
|
const token = getGitHubToken();
|
|
2451
2451
|
return {
|
|
2452
2452
|
Accept: "application/vnd.github.v3+json",
|
|
2453
|
-
"User-Agent": "
|
|
2453
|
+
"User-Agent": "agconf-cli",
|
|
2454
2454
|
Authorization: `token ${token}`
|
|
2455
2455
|
};
|
|
2456
2456
|
}
|
|
@@ -2461,7 +2461,7 @@ async function getLatestRelease(repo) {
|
|
|
2461
2461
|
});
|
|
2462
2462
|
if (!response.ok) {
|
|
2463
2463
|
if (response.status === 404) {
|
|
2464
|
-
throw new Error("No releases found for
|
|
2464
|
+
throw new Error("No releases found for agconf repository");
|
|
2465
2465
|
}
|
|
2466
2466
|
throw new Error(`Failed to fetch latest release: ${response.statusText}`);
|
|
2467
2467
|
}
|
|
@@ -2514,11 +2514,12 @@ function compareVersions(a, b) {
|
|
|
2514
2514
|
// src/core/workflows.ts
|
|
2515
2515
|
import * as fs12 from "fs/promises";
|
|
2516
2516
|
import * as path12 from "path";
|
|
2517
|
-
var DEFAULT_CLI_NAME2 = "
|
|
2517
|
+
var DEFAULT_CLI_NAME2 = "agconf";
|
|
2518
2518
|
var WORKFLOWS_DIR = ".github/workflows";
|
|
2519
2519
|
function getWorkflowConfig(sourceRepo, config) {
|
|
2520
2520
|
const name = config?.name ?? DEFAULT_CLI_NAME2;
|
|
2521
|
-
const
|
|
2521
|
+
const markerPrefix = config?.markerPrefix ?? DEFAULT_CLI_NAME2;
|
|
2522
|
+
const secretName = `${markerPrefix.toUpperCase().replace(/-/g, "_")}_TOKEN`;
|
|
2522
2523
|
return {
|
|
2523
2524
|
sourceRepo,
|
|
2524
2525
|
cliName: config?.cliName ?? DEFAULT_CLI_NAME2,
|
|
@@ -2780,10 +2781,10 @@ async function resolveSource(options, resolvedVersion) {
|
|
|
2780
2781
|
logger.error(`No canonical source specified.
|
|
2781
2782
|
|
|
2782
2783
|
Specify a source using one of these methods:
|
|
2783
|
-
1. CLI flag:
|
|
2784
|
-
2. Config file: Add 'source.repository' to .
|
|
2784
|
+
1. CLI flag: agconf init --source acme/engineering-standards
|
|
2785
|
+
2. Config file: Add 'source.repository' to .agconf.yaml
|
|
2785
2786
|
|
|
2786
|
-
Example .
|
|
2787
|
+
Example .agconf.yaml:
|
|
2787
2788
|
source:
|
|
2788
2789
|
type: github
|
|
2789
2790
|
repository: acme/engineering-standards`);
|
|
@@ -3096,9 +3097,9 @@ async function performSync(options) {
|
|
|
3096
3097
|
summaryLines.push(`- \`.github/workflows/${filename}\` (unchanged)`);
|
|
3097
3098
|
}
|
|
3098
3099
|
}
|
|
3099
|
-
const lockfilePath = formatPath(path13.join(targetDir, ".
|
|
3100
|
+
const lockfilePath = formatPath(path13.join(targetDir, ".agconf", "agconf.lock"));
|
|
3100
3101
|
console.log(` ${pc6.green("+")} ${lockfilePath}`);
|
|
3101
|
-
summaryLines.push("- `.
|
|
3102
|
+
summaryLines.push("- `.agconf/lockfile.json` (updated)");
|
|
3102
3103
|
const hookPath = formatPath(path13.join(targetDir, ".git/hooks/pre-commit"));
|
|
3103
3104
|
if (hookResult.installed) {
|
|
3104
3105
|
if (hookResult.alreadyExisted && !hookResult.wasUpdated) {
|
|
@@ -3150,7 +3151,7 @@ ${summaryLines.join("\n")}
|
|
|
3150
3151
|
async function initCommand(options) {
|
|
3151
3152
|
const logger = createLogger();
|
|
3152
3153
|
console.log();
|
|
3153
|
-
prompts5.intro(pc7.bold("
|
|
3154
|
+
prompts5.intro(pc7.bold("agconf init"));
|
|
3154
3155
|
const targetDir = await resolveTargetDirectory();
|
|
3155
3156
|
const targets = await parseAndValidateTargets(options.target);
|
|
3156
3157
|
const status = await getSyncStatus(targetDir);
|
|
@@ -3200,12 +3201,12 @@ async function statusCommand(options = {}) {
|
|
|
3200
3201
|
const targetDir = process.cwd();
|
|
3201
3202
|
const status = await getSyncStatus(targetDir);
|
|
3202
3203
|
console.log();
|
|
3203
|
-
console.log(pc8.bold("
|
|
3204
|
+
console.log(pc8.bold("agconf sync status"));
|
|
3204
3205
|
console.log();
|
|
3205
3206
|
if (!status.hasSynced) {
|
|
3206
3207
|
console.log(pc8.yellow("Not synced"));
|
|
3207
3208
|
console.log();
|
|
3208
|
-
console.log(pc8.dim("Run `
|
|
3209
|
+
console.log(pc8.dim("Run `agconf init` to sync engineering standards to this repository."));
|
|
3209
3210
|
console.log();
|
|
3210
3211
|
return;
|
|
3211
3212
|
}
|
|
@@ -3243,11 +3244,11 @@ async function statusCommand(options = {}) {
|
|
|
3243
3244
|
}
|
|
3244
3245
|
console.log();
|
|
3245
3246
|
console.log(pc8.dim(" These files will be overwritten on next sync. To preserve changes,"));
|
|
3246
|
-
console.log(pc8.dim(" copy them elsewhere before running `
|
|
3247
|
+
console.log(pc8.dim(" copy them elsewhere before running `agconf sync`."));
|
|
3247
3248
|
}
|
|
3248
3249
|
console.log();
|
|
3249
3250
|
}
|
|
3250
|
-
const lockfilePath = formatPath(path14.join(targetDir, ".
|
|
3251
|
+
const lockfilePath = formatPath(path14.join(targetDir, ".agconf", "agconf.lock"));
|
|
3251
3252
|
console.log(pc8.dim(`Lock file: ${lockfilePath}`));
|
|
3252
3253
|
console.log(pc8.dim(`CLI version: ${lockfile.cli_version}`));
|
|
3253
3254
|
console.log();
|
|
@@ -3259,7 +3260,7 @@ import pc9 from "picocolors";
|
|
|
3259
3260
|
async function syncCommand(options) {
|
|
3260
3261
|
const logger = createLogger();
|
|
3261
3262
|
console.log();
|
|
3262
|
-
prompts6.intro(pc9.bold("
|
|
3263
|
+
prompts6.intro(pc9.bold("agconf sync"));
|
|
3263
3264
|
if (options.pinned && options.ref) {
|
|
3264
3265
|
logger.error("Cannot use --pinned with --ref. Choose one.");
|
|
3265
3266
|
process.exit(1);
|
|
@@ -3281,9 +3282,7 @@ async function syncCommand(options) {
|
|
|
3281
3282
|
logger.warn(status.schemaWarning);
|
|
3282
3283
|
}
|
|
3283
3284
|
if (!status.hasSynced) {
|
|
3284
|
-
logger.warn(
|
|
3285
|
-
"This repository has not been synced yet. Consider running 'agent-conf init' first."
|
|
3286
|
-
);
|
|
3285
|
+
logger.warn("This repository has not been synced yet. Consider running 'agconf init' first.");
|
|
3287
3286
|
}
|
|
3288
3287
|
let sourceRepo = options.source;
|
|
3289
3288
|
if (!sourceRepo && status.lockfile?.source.type === "github") {
|
|
@@ -3368,7 +3367,7 @@ async function upgradeCliCommand(options) {
|
|
|
3368
3367
|
const logger = createLogger();
|
|
3369
3368
|
const currentVersion = getCliVersion();
|
|
3370
3369
|
console.log();
|
|
3371
|
-
prompts7.intro(pc10.bold("
|
|
3370
|
+
prompts7.intro(pc10.bold("agconf upgrade-cli"));
|
|
3372
3371
|
const spinner = logger.spinner("Checking for CLI updates...");
|
|
3373
3372
|
spinner.start();
|
|
3374
3373
|
let latestVersion;
|
|
@@ -3437,7 +3436,7 @@ async function warnIfCliOutdated() {
|
|
|
3437
3436
|
`\u26A0 CLI is outdated: v${mismatch.currentVersion} installed, but repo was synced with v${mismatch.lockfileVersion}`
|
|
3438
3437
|
)
|
|
3439
3438
|
);
|
|
3440
|
-
console.log(pc11.yellow(" Run:
|
|
3439
|
+
console.log(pc11.yellow(" Run: agconf upgrade-cli"));
|
|
3441
3440
|
console.log();
|
|
3442
3441
|
}
|
|
3443
3442
|
} catch {
|
|
@@ -3445,10 +3444,10 @@ async function warnIfCliOutdated() {
|
|
|
3445
3444
|
}
|
|
3446
3445
|
function createCli() {
|
|
3447
3446
|
const program = new Command();
|
|
3448
|
-
program.name("
|
|
3447
|
+
program.name("agconf").description("Sync company engineering standards from canonical repository").version(getCliVersion()).hook("preAction", async () => {
|
|
3449
3448
|
await warnIfCliOutdated();
|
|
3450
3449
|
});
|
|
3451
|
-
program.command("init").description("Initialize or sync
|
|
3450
|
+
program.command("init").description("Initialize or sync agconf standards to the current repository").option(
|
|
3452
3451
|
"-s, --source <repo>",
|
|
3453
3452
|
"Canonical repository in owner/repo format (e.g., acme/standards)"
|
|
3454
3453
|
).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 (default: latest release)").option("-t, --target <targets...>", "Target platforms (claude, codex)", ["claude"]).action(
|
|
@@ -3470,7 +3469,7 @@ function createCli() {
|
|
|
3470
3469
|
program.command("check").description("Check if managed files have been modified").option("-q, --quiet", "Minimal output, just exit code").action(async (options) => {
|
|
3471
3470
|
await checkCommand(options);
|
|
3472
3471
|
});
|
|
3473
|
-
program.command("upgrade-cli").description("Upgrade the
|
|
3472
|
+
program.command("upgrade-cli").description("Upgrade the agconf CLI to the latest version").option("-y, --yes", "Non-interactive mode").action(async (options) => {
|
|
3474
3473
|
await upgradeCliCommand(options);
|
|
3475
3474
|
});
|
|
3476
3475
|
const configCmd = program.command("config").description("Manage global CLI configuration");
|
|
@@ -3497,7 +3496,7 @@ function createCli() {
|
|
|
3497
3496
|
await installCompletion();
|
|
3498
3497
|
});
|
|
3499
3498
|
const canonicalCmd = program.command("canonical").description("Manage canonical repositories");
|
|
3500
|
-
canonicalCmd.command("init").description("Scaffold a new canonical repository structure").option("-n, --name <name>", "Name for the canonical repository").option("-o, --org <organization>", "Organization name").option("-d, --dir <directory>", "Target directory (default: current)").option("--marker-prefix <prefix>", "Marker prefix (default:
|
|
3499
|
+
canonicalCmd.command("init").description("Scaffold a new canonical repository structure").option("-n, --name <name>", "Name for the canonical repository").option("-o, --org <organization>", "Organization name").option("-d, --dir <directory>", "Target directory (default: current)").option("--marker-prefix <prefix>", "Marker prefix (default: agconf)").option("--no-examples", "Skip example skill creation").option("--rules-dir <directory>", "Rules directory (e.g., 'rules')").option("-y, --yes", "Non-interactive mode").action(
|
|
3501
3500
|
async (options) => {
|
|
3502
3501
|
await canonicalInitCommand({
|
|
3503
3502
|
name: options.name,
|