agentscfg 0.1.0-alpha.2 → 0.1.0-alpha.4
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 -7
- package/dist/cli.cjs +369 -111
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -19,7 +19,8 @@ agentscfg init
|
|
|
19
19
|
# edit .agentscfg/instructions/* and .agentscfg/skills/*
|
|
20
20
|
agentscfg plan
|
|
21
21
|
agentscfg diff
|
|
22
|
-
agentscfg
|
|
22
|
+
agentscfg gen
|
|
23
|
+
agentscfg import --from codex
|
|
23
24
|
```
|
|
24
25
|
|
|
25
26
|
## Commands
|
|
@@ -29,7 +30,8 @@ init [--force]
|
|
|
29
30
|
validate
|
|
30
31
|
plan [--to claude,opencode,codex] [--json]
|
|
31
32
|
diff [--to ...]
|
|
32
|
-
|
|
33
|
+
gen [--to ...] [--remove] [--adopt] [--force] [--allow-dirty]
|
|
34
|
+
import --from <tool>
|
|
33
35
|
doctor
|
|
34
36
|
```
|
|
35
37
|
|
|
@@ -61,12 +63,12 @@ Run `agentscfg <command> --help` for detailed help on each command.
|
|
|
61
63
|
## Outputs
|
|
62
64
|
|
|
63
65
|
- Claude Code: `CLAUDE.md`, `.claude/skills/<skill>/...`
|
|
64
|
-
- OpenCode: `.opencode/agent/
|
|
66
|
+
- OpenCode: `.opencode/skill/<skill>/...` (agent/config files come from `.agentscfg/targets/opencode/**`)
|
|
65
67
|
- Codex CLI: `AGENTS.md`, `.codex/skills/<skill>/...`
|
|
66
68
|
|
|
67
69
|
### Target Mappings
|
|
68
70
|
|
|
69
|
-
All files under `.agentscfg/targets/<tool>/` are
|
|
71
|
+
All files under `.agentscfg/targets/<tool>/` are generated into the tool's config
|
|
70
72
|
directory:
|
|
71
73
|
|
|
72
74
|
- `.agentscfg/targets/claude/**` → `.claude/**`
|
|
@@ -82,13 +84,13 @@ MCP config:
|
|
|
82
84
|
- Generated files include a `agentscfg:generated ... sha256=...` marker.
|
|
83
85
|
- Guided mode (default) will not overwrite unmanaged files unless you pass
|
|
84
86
|
`--adopt` or the file already contains the marker.
|
|
85
|
-
- If a generated file's hash marker does not match,
|
|
87
|
+
- If a generated file's hash marker does not match, gen refuses to overwrite
|
|
86
88
|
unless `--force` is provided.
|
|
87
|
-
- `
|
|
89
|
+
- `gen` refuses to run on a dirty git working tree unless `--allow-dirty` is set.
|
|
88
90
|
|
|
89
91
|
## Tips
|
|
90
92
|
|
|
91
|
-
Add generated paths to `.gitignore` and use `agentscfg
|
|
93
|
+
Add generated paths to `.gitignore` and use `agentscfg gen` to regenerate them:
|
|
92
94
|
|
|
93
95
|
```text
|
|
94
96
|
.claude/
|
package/dist/cli.cjs
CHANGED
|
@@ -26790,6 +26790,9 @@ var findRepoRoot = (start3) => Effect_exports.gen(function* (_) {
|
|
|
26790
26790
|
return yield* _(Effect_exports.fail(new RepoRootNotFound()));
|
|
26791
26791
|
});
|
|
26792
26792
|
|
|
26793
|
+
// package.json
|
|
26794
|
+
var version = "0.1.0-alpha.4";
|
|
26795
|
+
|
|
26793
26796
|
// src/cli/commands/init.ts
|
|
26794
26797
|
var import_node_path4 = __toESM(require("node:path"), 1);
|
|
26795
26798
|
|
|
@@ -27097,7 +27100,7 @@ var validateCommand = (repoRoot) => Effect_exports.gen(function* (_) {
|
|
|
27097
27100
|
});
|
|
27098
27101
|
|
|
27099
27102
|
// src/core/planner/plan.ts
|
|
27100
|
-
var
|
|
27103
|
+
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
27101
27104
|
|
|
27102
27105
|
// src/io/hash.ts
|
|
27103
27106
|
var import_node_crypto = require("node:crypto");
|
|
@@ -27173,29 +27176,6 @@ var compileInstructions = (cfg, instructions, outputs) => Effect_exports.gen(fun
|
|
|
27173
27176
|
);
|
|
27174
27177
|
outputsList.push({ path: outputs.codex, content, sha });
|
|
27175
27178
|
}
|
|
27176
|
-
if (outputs.opencode) {
|
|
27177
|
-
const body = [
|
|
27178
|
-
"---",
|
|
27179
|
-
"name: default",
|
|
27180
|
-
"purpose: Generated default agent from canonical instructions",
|
|
27181
|
-
"---",
|
|
27182
|
-
"",
|
|
27183
|
-
"# Default Agent (Generated by agentscfg)",
|
|
27184
|
-
"",
|
|
27185
|
-
"## Base",
|
|
27186
|
-
baseNormalized,
|
|
27187
|
-
"",
|
|
27188
|
-
includeProject ? "## Project" : void 0,
|
|
27189
|
-
includeProject ? projectNormalized ?? "" : void 0,
|
|
27190
|
-
"",
|
|
27191
|
-
footer(".opencode/agent/default.md", includeProject, sha)
|
|
27192
|
-
].filter((line) => line !== void 0).join("\n");
|
|
27193
|
-
const content = applyNewlines(
|
|
27194
|
-
ensureTrailingNewline(normalizeLf(body)),
|
|
27195
|
-
cfg.output.newlines
|
|
27196
|
-
);
|
|
27197
|
-
outputsList.push({ path: outputs.opencode, content, sha });
|
|
27198
|
-
}
|
|
27199
27179
|
return {
|
|
27200
27180
|
sha,
|
|
27201
27181
|
includeProject,
|
|
@@ -27214,6 +27194,7 @@ var extractMarkerSha = (content) => {
|
|
|
27214
27194
|
var import_node_path6 = __toESM(require("node:path"), 1);
|
|
27215
27195
|
var claudeInstructionPath = (repoRoot) => import_node_path6.default.join(repoRoot, "CLAUDE.md");
|
|
27216
27196
|
var claudeSkillsRoot = (repoRoot) => import_node_path6.default.join(repoRoot, ".claude", "skills");
|
|
27197
|
+
var mcpConfigPath = (repoRoot) => import_node_path6.default.join(repoRoot, ".mcp.json");
|
|
27217
27198
|
|
|
27218
27199
|
// src/adapters/codex.ts
|
|
27219
27200
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
@@ -27226,19 +27207,14 @@ var opencodeInstructionPath = (repoRoot) => import_node_path8.default.join(repoR
|
|
|
27226
27207
|
var opencodeSkillsRoot = (repoRoot) => import_node_path8.default.join(repoRoot, ".opencode", "skill");
|
|
27227
27208
|
var opencodeClaudeCompatSkillsRoot = (repoRoot) => import_node_path8.default.join(repoRoot, ".claude", "skills");
|
|
27228
27209
|
|
|
27229
|
-
// src/adapters/mcp.ts
|
|
27230
|
-
var import_node_path9 = __toESM(require("node:path"), 1);
|
|
27231
|
-
var mcpConfigPath = (repoRoot) => import_node_path9.default.join(repoRoot, ".mcp.json");
|
|
27232
|
-
|
|
27233
27210
|
// src/core/planner/plan.ts
|
|
27234
27211
|
var expectedOutputPaths = (repoRoot) => /* @__PURE__ */ new Set([
|
|
27235
27212
|
claudeInstructionPath(repoRoot),
|
|
27236
27213
|
codexInstructionPath(repoRoot),
|
|
27237
|
-
opencodeInstructionPath(repoRoot),
|
|
27238
27214
|
mcpConfigPath(repoRoot)
|
|
27239
27215
|
]);
|
|
27240
27216
|
var isExpectedOutput = (repoRoot, targetPath) => expectedOutputPaths(repoRoot).has(targetPath);
|
|
27241
|
-
var normalizeRel2 = (repoRoot, targetPath) =>
|
|
27217
|
+
var normalizeRel2 = (repoRoot, targetPath) => import_node_path9.default.relative(repoRoot, targetPath).replace(/\\/g, "/");
|
|
27242
27218
|
var normalizeLf2 = (input) => input.replace(/\r\n?/g, "\n");
|
|
27243
27219
|
var applyNewlines2 = (input, mode) => mode === "crlf" ? input.replace(/\n/g, "\r\n") : input;
|
|
27244
27220
|
var ensureTrailingNewline2 = (input) => input.endsWith("\n") ? input : `${input}
|
|
@@ -27250,8 +27226,8 @@ var walkFiles = (dirPath, baseRel = "") => Effect_exports.gen(function* (_) {
|
|
|
27250
27226
|
}
|
|
27251
27227
|
const entries2 = yield* _(readdir(dirPath));
|
|
27252
27228
|
for (const entry of entries2) {
|
|
27253
|
-
const nextRel = baseRel ?
|
|
27254
|
-
const nextAbs =
|
|
27229
|
+
const nextRel = baseRel ? import_node_path9.default.join(baseRel, entry.name) : entry.name;
|
|
27230
|
+
const nextAbs = import_node_path9.default.join(dirPath, entry.name);
|
|
27255
27231
|
if (!shouldIncludePath(nextRel)) {
|
|
27256
27232
|
continue;
|
|
27257
27233
|
}
|
|
@@ -27340,7 +27316,7 @@ var diffDir = (sourceDir, targetDir, remove8) => Effect_exports.gen(function* (_
|
|
|
27340
27316
|
ops.push({
|
|
27341
27317
|
rel,
|
|
27342
27318
|
from: src.abs,
|
|
27343
|
-
to:
|
|
27319
|
+
to: import_node_path9.default.join(targetDir, rel),
|
|
27344
27320
|
mode: src.mode,
|
|
27345
27321
|
kind: "add"
|
|
27346
27322
|
});
|
|
@@ -27396,8 +27372,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27396
27372
|
const instructionOutputs = yield* _(
|
|
27397
27373
|
compileInstructions(ws.cfg, ws.instructions, {
|
|
27398
27374
|
claude: targets.has("claude") ? claudeInstructionPath(ws.repoRoot) : void 0,
|
|
27399
|
-
codex: targets.has("codex") ? codexInstructionPath(ws.repoRoot) : void 0
|
|
27400
|
-
opencode: targets.has("opencode") ? opencodeInstructionPath(ws.repoRoot) : void 0
|
|
27375
|
+
codex: targets.has("codex") ? codexInstructionPath(ws.repoRoot) : void 0
|
|
27401
27376
|
})
|
|
27402
27377
|
);
|
|
27403
27378
|
const normalizeOutputContent = (input) => applyNewlines2(
|
|
@@ -27428,7 +27403,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27428
27403
|
);
|
|
27429
27404
|
warnings.push(...result.warnings);
|
|
27430
27405
|
if (result.op) {
|
|
27431
|
-
mkdirs.add(
|
|
27406
|
+
mkdirs.add(import_node_path9.default.dirname(output.path));
|
|
27432
27407
|
ops.push(result.op);
|
|
27433
27408
|
}
|
|
27434
27409
|
if (result.adopted) {
|
|
@@ -27448,7 +27423,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27448
27423
|
);
|
|
27449
27424
|
warnings.push(...result.warnings);
|
|
27450
27425
|
if (result.op) {
|
|
27451
|
-
mkdirs.add(
|
|
27426
|
+
mkdirs.add(import_node_path9.default.dirname(output.path));
|
|
27452
27427
|
ops.push(result.op);
|
|
27453
27428
|
}
|
|
27454
27429
|
if (result.adopted) {
|
|
@@ -27458,7 +27433,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27458
27433
|
const skillTargets = buildSkillTargets(ws.repoRoot, ws.cfg, targets);
|
|
27459
27434
|
for (const skill of ws.skills) {
|
|
27460
27435
|
for (const target of skillTargets) {
|
|
27461
|
-
const destDir =
|
|
27436
|
+
const destDir = import_node_path9.default.join(target.root, skill.name);
|
|
27462
27437
|
const managed = managedData ? isManagedPath(ws.repoRoot, destDir, managedData) : false;
|
|
27463
27438
|
const destExists = yield* _(exists4(destDir));
|
|
27464
27439
|
if (destExists && !managed && managedData) {
|
|
@@ -27472,7 +27447,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27472
27447
|
`Managed tracking missing for ${normalizeRel2(
|
|
27473
27448
|
ws.repoRoot,
|
|
27474
27449
|
destDir
|
|
27475
|
-
)}. Run
|
|
27450
|
+
)}. Run gen with --adopt to establish ownership.`
|
|
27476
27451
|
);
|
|
27477
27452
|
continue;
|
|
27478
27453
|
}
|
|
@@ -27491,18 +27466,18 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27491
27466
|
const targetDirMappings = [
|
|
27492
27467
|
{
|
|
27493
27468
|
name: "claude",
|
|
27494
|
-
source:
|
|
27495
|
-
dest:
|
|
27469
|
+
source: import_node_path9.default.join(ws.root, "targets", "claude"),
|
|
27470
|
+
dest: import_node_path9.default.join(ws.repoRoot, ".claude")
|
|
27496
27471
|
},
|
|
27497
27472
|
{
|
|
27498
27473
|
name: "opencode",
|
|
27499
|
-
source:
|
|
27500
|
-
dest:
|
|
27474
|
+
source: import_node_path9.default.join(ws.root, "targets", "opencode"),
|
|
27475
|
+
dest: import_node_path9.default.join(ws.repoRoot, ".opencode")
|
|
27501
27476
|
},
|
|
27502
27477
|
{
|
|
27503
27478
|
name: "codex",
|
|
27504
|
-
source:
|
|
27505
|
-
dest:
|
|
27479
|
+
source: import_node_path9.default.join(ws.root, "targets", "codex"),
|
|
27480
|
+
dest: import_node_path9.default.join(ws.repoRoot, ".codex")
|
|
27506
27481
|
}
|
|
27507
27482
|
];
|
|
27508
27483
|
for (const mapping of targetDirMappings) {
|
|
@@ -27523,7 +27498,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27523
27498
|
`Managed tracking missing for ${normalizeRel2(
|
|
27524
27499
|
ws.repoRoot,
|
|
27525
27500
|
mapping.dest
|
|
27526
|
-
)}. Run
|
|
27501
|
+
)}. Run gen with --adopt to establish ownership.`
|
|
27527
27502
|
);
|
|
27528
27503
|
continue;
|
|
27529
27504
|
}
|
|
@@ -27548,7 +27523,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27548
27523
|
for (const dir of dirs) {
|
|
27549
27524
|
if (skillNames.has(dir.name))
|
|
27550
27525
|
continue;
|
|
27551
|
-
const removePath =
|
|
27526
|
+
const removePath = import_node_path9.default.join(target.root, dir.name);
|
|
27552
27527
|
if (managedData && isManagedPath(ws.repoRoot, removePath, managedData)) {
|
|
27553
27528
|
ops.push({ type: "RemovePath", path: removePath });
|
|
27554
27529
|
} else if (!managedData) {
|
|
@@ -27556,7 +27531,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27556
27531
|
`Managed tracking missing for ${normalizeRel2(
|
|
27557
27532
|
ws.repoRoot,
|
|
27558
27533
|
removePath
|
|
27559
|
-
)}. Run
|
|
27534
|
+
)}. Run gen with --adopt to establish ownership.`
|
|
27560
27535
|
);
|
|
27561
27536
|
} else {
|
|
27562
27537
|
warnings.push(
|
|
@@ -27573,7 +27548,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27573
27548
|
if (!managedData && options.adopt) {
|
|
27574
27549
|
const base = defaultManaged();
|
|
27575
27550
|
const updated = adopted.length ? addAdopted(ws.repoRoot, base, adopted, /* @__PURE__ */ new Date()) : base;
|
|
27576
|
-
mkdirs.add(
|
|
27551
|
+
mkdirs.add(import_node_path9.default.dirname(managedPathValue));
|
|
27577
27552
|
ops.push({
|
|
27578
27553
|
type: "WriteFile",
|
|
27579
27554
|
path: managedPathValue,
|
|
@@ -27583,7 +27558,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27583
27558
|
} else if ((options.adopt || !managedData) && adopted.length > 0) {
|
|
27584
27559
|
const base = managedData ?? defaultManaged();
|
|
27585
27560
|
const updated = addAdopted(ws.repoRoot, base, adopted, /* @__PURE__ */ new Date());
|
|
27586
|
-
mkdirs.add(
|
|
27561
|
+
mkdirs.add(import_node_path9.default.dirname(managedPathValue));
|
|
27587
27562
|
ops.push({
|
|
27588
27563
|
type: "WriteFile",
|
|
27589
27564
|
path: managedPathValue,
|
|
@@ -27592,7 +27567,7 @@ var planWorkspace = (ws, options) => Effect_exports.gen(function* (_) {
|
|
|
27592
27567
|
});
|
|
27593
27568
|
} else if (!managedData) {
|
|
27594
27569
|
warnings.push(
|
|
27595
|
-
"managed tracking missing; run
|
|
27570
|
+
"managed tracking missing; run gen with --adopt to establish ownership"
|
|
27596
27571
|
);
|
|
27597
27572
|
}
|
|
27598
27573
|
const orderedMkdirs = Array.from(mkdirs).filter((dir) => dir && dir !== ".").sort((a, b) => a.localeCompare(b));
|
|
@@ -27628,7 +27603,7 @@ var planCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
27628
27603
|
});
|
|
27629
27604
|
|
|
27630
27605
|
// src/core/planner/diff.ts
|
|
27631
|
-
var
|
|
27606
|
+
var import_node_path10 = __toESM(require("node:path"), 1);
|
|
27632
27607
|
|
|
27633
27608
|
// node_modules/diff/libesm/diff/base.js
|
|
27634
27609
|
var Diff = class {
|
|
@@ -28075,7 +28050,7 @@ var renderDiff = (repoRoot, plan) => Effect_exports.gen(function* (_) {
|
|
|
28075
28050
|
if (op.type === "WriteFile") {
|
|
28076
28051
|
const existsNow = yield* _(exists4(op.path));
|
|
28077
28052
|
const before2 = existsNow ? yield* _(readFileString(op.path)) : "";
|
|
28078
|
-
const relPath =
|
|
28053
|
+
const relPath = import_node_path10.default.relative(repoRoot, op.path).replace(/\\/g, "/");
|
|
28079
28054
|
const patch9 = createTwoFilesPatch(
|
|
28080
28055
|
relPath,
|
|
28081
28056
|
relPath,
|
|
@@ -28165,8 +28140,8 @@ var isDirty = (repoRoot) => Effect_exports.tryPromise({
|
|
|
28165
28140
|
catch: (err) => new IoError("Failed to check git status", String(err))
|
|
28166
28141
|
});
|
|
28167
28142
|
|
|
28168
|
-
// src/cli/commands/
|
|
28169
|
-
var
|
|
28143
|
+
// src/cli/commands/gen.ts
|
|
28144
|
+
var genCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
28170
28145
|
const gitRepo = yield* _(isGitRepo(repoRoot));
|
|
28171
28146
|
if (gitRepo) {
|
|
28172
28147
|
const dirty = yield* _(isDirty(repoRoot));
|
|
@@ -28174,7 +28149,7 @@ var syncCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
28174
28149
|
return yield* _(
|
|
28175
28150
|
Effect_exports.fail(
|
|
28176
28151
|
new DirtyRepoError(
|
|
28177
|
-
"Refusing to
|
|
28152
|
+
"Refusing to run gen: git working tree is dirty. Commit/stash, or pass --allow-dirty."
|
|
28178
28153
|
)
|
|
28179
28154
|
)
|
|
28180
28155
|
);
|
|
@@ -28188,11 +28163,11 @@ var syncCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
28188
28163
|
});
|
|
28189
28164
|
|
|
28190
28165
|
// src/cli/commands/doctor.ts
|
|
28191
|
-
var
|
|
28166
|
+
var import_node_path11 = __toESM(require("node:path"), 1);
|
|
28192
28167
|
var doctorCommand = (repoRoot) => Effect_exports.gen(function* (_) {
|
|
28193
|
-
const root =
|
|
28194
|
-
const configPath =
|
|
28195
|
-
const basePath =
|
|
28168
|
+
const root = import_node_path11.default.join(repoRoot, ".agentscfg");
|
|
28169
|
+
const configPath = import_node_path11.default.join(root, "agentscfg.jsonc");
|
|
28170
|
+
const basePath = import_node_path11.default.join(root, "instructions", "BASE.md");
|
|
28196
28171
|
const workspacePresent = yield* _(exists4(root));
|
|
28197
28172
|
const configPresent = yield* _(exists4(configPath));
|
|
28198
28173
|
const basePresent = yield* _(exists4(basePath));
|
|
@@ -28226,11 +28201,10 @@ var doctorCommand = (repoRoot) => Effect_exports.gen(function* (_) {
|
|
|
28226
28201
|
}
|
|
28227
28202
|
const outputPaths = [
|
|
28228
28203
|
claudeInstructionPath(repoRoot),
|
|
28229
|
-
|
|
28230
|
-
|
|
28231
|
-
import_node_path12.default.join(repoRoot, ".opencode"),
|
|
28204
|
+
import_node_path11.default.join(repoRoot, ".claude"),
|
|
28205
|
+
import_node_path11.default.join(repoRoot, ".opencode"),
|
|
28232
28206
|
codexInstructionPath(repoRoot),
|
|
28233
|
-
|
|
28207
|
+
import_node_path11.default.join(repoRoot, ".codex"),
|
|
28234
28208
|
mcpConfigPath(repoRoot),
|
|
28235
28209
|
claudeSkillsRoot(repoRoot),
|
|
28236
28210
|
opencodeSkillsRoot(repoRoot),
|
|
@@ -28263,15 +28237,15 @@ var doctorCommand = (repoRoot) => Effect_exports.gen(function* (_) {
|
|
|
28263
28237
|
});
|
|
28264
28238
|
|
|
28265
28239
|
// src/cli/commands/status.ts
|
|
28266
|
-
var
|
|
28240
|
+
var import_node_path12 = __toESM(require("node:path"), 1);
|
|
28267
28241
|
var getInstructionPath = (target, repoRoot) => {
|
|
28268
28242
|
switch (target) {
|
|
28269
28243
|
case "claude":
|
|
28270
28244
|
return claudeInstructionPath(repoRoot);
|
|
28271
|
-
case "opencode":
|
|
28272
|
-
return opencodeInstructionPath(repoRoot);
|
|
28273
28245
|
case "codex":
|
|
28274
28246
|
return codexInstructionPath(repoRoot);
|
|
28247
|
+
case "opencode":
|
|
28248
|
+
return null;
|
|
28275
28249
|
}
|
|
28276
28250
|
};
|
|
28277
28251
|
var getSkillsRoot = (target, repoRoot) => {
|
|
@@ -28316,31 +28290,48 @@ var statusCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
28316
28290
|
const pendingWritePaths = new Set(
|
|
28317
28291
|
plan.ops.filter((op) => op.type === "WriteFile").map((op) => op.path)
|
|
28318
28292
|
);
|
|
28319
|
-
const
|
|
28320
|
-
|
|
28321
|
-
)
|
|
28293
|
+
const joinRelPath = (root, rel) => import_node_path12.default.join(root, ...rel.split("/"));
|
|
28294
|
+
const pendingCopyFilePaths = /* @__PURE__ */ new Set();
|
|
28295
|
+
for (const op of plan.ops) {
|
|
28296
|
+
if (op.type !== "CopyDir")
|
|
28297
|
+
continue;
|
|
28298
|
+
for (const file of op.files) {
|
|
28299
|
+
pendingCopyFilePaths.add(joinRelPath(op.to, file.rel));
|
|
28300
|
+
}
|
|
28301
|
+
}
|
|
28302
|
+
const hasPendingCopyFor = (targetPath) => pendingCopyFilePaths.has(targetPath);
|
|
28303
|
+
const hasPendingCopyUnder = (targetDir) => {
|
|
28304
|
+
for (const p of pendingCopyFilePaths) {
|
|
28305
|
+
if (p === targetDir || p.startsWith(targetDir + import_node_path12.default.sep)) {
|
|
28306
|
+
return true;
|
|
28307
|
+
}
|
|
28308
|
+
}
|
|
28309
|
+
return false;
|
|
28310
|
+
};
|
|
28322
28311
|
for (const target of targetNames) {
|
|
28323
28312
|
const enabled2 = ws.cfg.targets[target].enabled;
|
|
28324
28313
|
const instructionPath = getInstructionPath(target, repoRoot);
|
|
28325
28314
|
const skillsRootPath = getSkillsRoot(target, repoRoot);
|
|
28326
|
-
const instructionExists = yield* _(exists4(instructionPath));
|
|
28315
|
+
const instructionExists = instructionPath ? yield* _(exists4(instructionPath)) : false;
|
|
28327
28316
|
const skillsRootExists = yield* _(exists4(skillsRootPath));
|
|
28328
28317
|
let instructionStatus;
|
|
28329
|
-
if (
|
|
28330
|
-
|
|
28331
|
-
|
|
28332
|
-
|
|
28333
|
-
|
|
28334
|
-
|
|
28335
|
-
|
|
28336
|
-
|
|
28318
|
+
if (instructionPath) {
|
|
28319
|
+
if (!enabled2) {
|
|
28320
|
+
instructionStatus = instructionExists ? "synced" : "missing";
|
|
28321
|
+
} else if (!instructionExists) {
|
|
28322
|
+
instructionStatus = "missing";
|
|
28323
|
+
} else if (pendingWritePaths.has(instructionPath) || hasPendingCopyFor(instructionPath)) {
|
|
28324
|
+
instructionStatus = "outdated";
|
|
28325
|
+
} else {
|
|
28326
|
+
instructionStatus = "synced";
|
|
28327
|
+
}
|
|
28337
28328
|
}
|
|
28338
28329
|
let skillsStatus;
|
|
28339
28330
|
if (!enabled2) {
|
|
28340
28331
|
skillsStatus = skillsRootExists ? "synced" : "missing";
|
|
28341
28332
|
} else if (!skillsRootExists && ws.skills.length > 0) {
|
|
28342
28333
|
skillsStatus = "missing";
|
|
28343
|
-
} else if (
|
|
28334
|
+
} else if (hasPendingCopyUnder(skillsRootPath)) {
|
|
28344
28335
|
skillsStatus = "outdated";
|
|
28345
28336
|
} else {
|
|
28346
28337
|
skillsStatus = "synced";
|
|
@@ -28348,12 +28339,12 @@ var statusCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
28348
28339
|
targets.push({
|
|
28349
28340
|
name: target,
|
|
28350
28341
|
enabled: enabled2,
|
|
28351
|
-
instruction: {
|
|
28352
|
-
path:
|
|
28353
|
-
status: instructionStatus
|
|
28354
|
-
},
|
|
28342
|
+
instruction: instructionPath ? {
|
|
28343
|
+
path: import_node_path12.default.relative(repoRoot, instructionPath),
|
|
28344
|
+
status: instructionStatus ?? "missing"
|
|
28345
|
+
} : void 0,
|
|
28355
28346
|
skillsRoot: {
|
|
28356
|
-
path:
|
|
28347
|
+
path: import_node_path12.default.relative(repoRoot, skillsRootPath),
|
|
28357
28348
|
status: skillsStatus
|
|
28358
28349
|
}
|
|
28359
28350
|
});
|
|
@@ -28373,19 +28364,19 @@ var statusCommand = (repoRoot, options) => Effect_exports.gen(function* (_) {
|
|
|
28373
28364
|
});
|
|
28374
28365
|
|
|
28375
28366
|
// src/cli/commands/clean.ts
|
|
28376
|
-
var
|
|
28367
|
+
var import_node_path13 = __toESM(require("node:path"), 1);
|
|
28377
28368
|
var normalizeRel3 = (relPath) => relPath.replace(/\\/g, "/");
|
|
28378
28369
|
var expandManagedPaths = (repoRoot, managedData) => Effect_exports.gen(function* (_) {
|
|
28379
28370
|
const paths = [];
|
|
28380
28371
|
for (const entry of managedData.managed) {
|
|
28381
28372
|
if (entry.endsWith("/**")) {
|
|
28382
28373
|
const prefix = entry.slice(0, -3);
|
|
28383
|
-
const dirPath =
|
|
28374
|
+
const dirPath = import_node_path13.default.join(repoRoot, prefix);
|
|
28384
28375
|
if (yield* _(exists4(dirPath))) {
|
|
28385
28376
|
paths.push(dirPath);
|
|
28386
28377
|
}
|
|
28387
28378
|
} else {
|
|
28388
|
-
const filePath =
|
|
28379
|
+
const filePath = import_node_path13.default.join(repoRoot, entry);
|
|
28389
28380
|
if (yield* _(exists4(filePath))) {
|
|
28390
28381
|
paths.push(filePath);
|
|
28391
28382
|
}
|
|
@@ -28394,7 +28385,7 @@ var expandManagedPaths = (repoRoot, managedData) => Effect_exports.gen(function*
|
|
|
28394
28385
|
return paths;
|
|
28395
28386
|
});
|
|
28396
28387
|
var cleanCommand = (repoRoot, dryRun) => Effect_exports.gen(function* (_) {
|
|
28397
|
-
const workspaceRoot =
|
|
28388
|
+
const workspaceRoot = import_node_path13.default.join(repoRoot, ".agentscfg");
|
|
28398
28389
|
if (!(yield* _(exists4(workspaceRoot)))) {
|
|
28399
28390
|
return yield* _(
|
|
28400
28391
|
Effect_exports.fail(
|
|
@@ -28407,7 +28398,7 @@ var cleanCommand = (repoRoot, dryRun) => Effect_exports.gen(function* (_) {
|
|
|
28407
28398
|
const removed = [];
|
|
28408
28399
|
const skipped = [];
|
|
28409
28400
|
for (const targetPath of pathsToRemove) {
|
|
28410
|
-
const rel = normalizeRel3(
|
|
28401
|
+
const rel = normalizeRel3(import_node_path13.default.relative(repoRoot, targetPath));
|
|
28411
28402
|
if (dryRun) {
|
|
28412
28403
|
removed.push(rel);
|
|
28413
28404
|
} else {
|
|
@@ -28426,6 +28417,209 @@ var cleanCommand = (repoRoot, dryRun) => Effect_exports.gen(function* (_) {
|
|
|
28426
28417
|
};
|
|
28427
28418
|
});
|
|
28428
28419
|
|
|
28420
|
+
// src/cli/commands/import.ts
|
|
28421
|
+
var import_node_path14 = __toESM(require("node:path"), 1);
|
|
28422
|
+
var normalizeLf3 = (input) => input.replace(/\r\n?/g, "\n");
|
|
28423
|
+
var ensureTrailingNewline3 = (input) => input.endsWith("\n") ? input : `${input}
|
|
28424
|
+
`;
|
|
28425
|
+
var stripGeneratedFooter = (lines) => {
|
|
28426
|
+
let end3 = lines.length;
|
|
28427
|
+
while (end3 > 0 && lines[end3 - 1]?.trim() === "") {
|
|
28428
|
+
end3 -= 1;
|
|
28429
|
+
}
|
|
28430
|
+
if (end3 > 0 && /agentscfg:generated/i.test(lines[end3 - 1] ?? "")) {
|
|
28431
|
+
end3 -= 1;
|
|
28432
|
+
}
|
|
28433
|
+
while (end3 > 0 && lines[end3 - 1]?.trim() === "") {
|
|
28434
|
+
end3 -= 1;
|
|
28435
|
+
}
|
|
28436
|
+
return lines.slice(0, end3);
|
|
28437
|
+
};
|
|
28438
|
+
var normalizeSection = (lines) => {
|
|
28439
|
+
const trimmed2 = stripGeneratedFooter(lines);
|
|
28440
|
+
if (trimmed2[0] === "") {
|
|
28441
|
+
trimmed2.shift();
|
|
28442
|
+
}
|
|
28443
|
+
return trimmed2.join("\n");
|
|
28444
|
+
};
|
|
28445
|
+
var extractInstructions = (content) => {
|
|
28446
|
+
const normalized = normalizeLf3(content);
|
|
28447
|
+
const lines = normalized.split("\n");
|
|
28448
|
+
const baseIndex = lines.findIndex((line) => line.trim() === "## Base");
|
|
28449
|
+
if (baseIndex === -1) {
|
|
28450
|
+
const base2 = ensureTrailingNewline3(
|
|
28451
|
+
stripGeneratedFooter(lines).join("\n")
|
|
28452
|
+
);
|
|
28453
|
+
return { base: base2, project: void 0, parsed: false };
|
|
28454
|
+
}
|
|
28455
|
+
const projectIndex = lines.findIndex(
|
|
28456
|
+
(line, idx) => idx > baseIndex && line.trim() === "## Project"
|
|
28457
|
+
);
|
|
28458
|
+
const baseLines = projectIndex === -1 ? lines.slice(baseIndex + 1) : lines.slice(baseIndex + 1, projectIndex);
|
|
28459
|
+
const base = ensureTrailingNewline3(normalizeSection(baseLines));
|
|
28460
|
+
if (projectIndex === -1) {
|
|
28461
|
+
return { base, project: void 0, parsed: true };
|
|
28462
|
+
}
|
|
28463
|
+
const projectLines = lines.slice(projectIndex + 1);
|
|
28464
|
+
const project = ensureTrailingNewline3(normalizeSection(projectLines));
|
|
28465
|
+
return { base, project, parsed: true };
|
|
28466
|
+
};
|
|
28467
|
+
var walkFiles2 = (dirPath, baseRel = "", exclude3) => Effect_exports.gen(function* (_) {
|
|
28468
|
+
const results = [];
|
|
28469
|
+
if (!(yield* _(exists4(dirPath)))) {
|
|
28470
|
+
return results;
|
|
28471
|
+
}
|
|
28472
|
+
const entries2 = yield* _(readdir(dirPath));
|
|
28473
|
+
for (const entry of entries2) {
|
|
28474
|
+
const nextRel = baseRel ? import_node_path14.default.join(baseRel, entry.name) : entry.name;
|
|
28475
|
+
const nextRelNormalized = nextRel.replace(/\\/g, "/");
|
|
28476
|
+
if (!shouldIncludePath(nextRelNormalized)) {
|
|
28477
|
+
continue;
|
|
28478
|
+
}
|
|
28479
|
+
if (exclude3 && exclude3(nextRelNormalized)) {
|
|
28480
|
+
continue;
|
|
28481
|
+
}
|
|
28482
|
+
const nextAbs = import_node_path14.default.join(dirPath, entry.name);
|
|
28483
|
+
if (entry.isDirectory()) {
|
|
28484
|
+
const nested3 = yield* _(walkFiles2(nextAbs, nextRel, exclude3));
|
|
28485
|
+
results.push(...nested3);
|
|
28486
|
+
} else if (entry.isFile()) {
|
|
28487
|
+
const st = yield* _(stat(nextAbs));
|
|
28488
|
+
results.push({
|
|
28489
|
+
rel: nextRelNormalized,
|
|
28490
|
+
abs: nextAbs,
|
|
28491
|
+
mode: st.mode
|
|
28492
|
+
});
|
|
28493
|
+
}
|
|
28494
|
+
}
|
|
28495
|
+
return results.sort((a, b) => a.rel.localeCompare(b.rel));
|
|
28496
|
+
});
|
|
28497
|
+
var copyDir = (sourceRoot, destRoot, exclude3) => Effect_exports.gen(function* (_) {
|
|
28498
|
+
const files = yield* _(walkFiles2(sourceRoot, "", exclude3));
|
|
28499
|
+
for (const file of files) {
|
|
28500
|
+
const destPath = import_node_path14.default.join(destRoot, file.rel);
|
|
28501
|
+
yield* _(copyFile(file.abs, destPath, file.mode));
|
|
28502
|
+
}
|
|
28503
|
+
return files.length;
|
|
28504
|
+
});
|
|
28505
|
+
var ensureWorkspace = (repoRoot) => Effect_exports.gen(function* (_) {
|
|
28506
|
+
const root = import_node_path14.default.join(repoRoot, ".agentscfg");
|
|
28507
|
+
if (!(yield* _(exists4(root)))) {
|
|
28508
|
+
return yield* _(Effect_exports.fail(new WorkspaceMissing()));
|
|
28509
|
+
}
|
|
28510
|
+
const configPath = import_node_path14.default.join(root, "agentscfg.jsonc");
|
|
28511
|
+
if (!(yield* _(exists4(configPath)))) {
|
|
28512
|
+
return yield* _(Effect_exports.fail(new InvalidConfig("Missing agentscfg.jsonc")));
|
|
28513
|
+
}
|
|
28514
|
+
return {
|
|
28515
|
+
root,
|
|
28516
|
+
instructionsRoot: import_node_path14.default.join(root, "instructions"),
|
|
28517
|
+
basePath: import_node_path14.default.join(root, "instructions", "BASE.md"),
|
|
28518
|
+
projectPath: import_node_path14.default.join(root, "instructions", "PROJECT.md"),
|
|
28519
|
+
skillsRoot: import_node_path14.default.join(root, "skills"),
|
|
28520
|
+
targetsRoot: import_node_path14.default.join(root, "targets"),
|
|
28521
|
+
mcpRoot: import_node_path14.default.join(root, "mcp"),
|
|
28522
|
+
mcpPath: import_node_path14.default.join(root, "mcp", "mcp.json")
|
|
28523
|
+
};
|
|
28524
|
+
});
|
|
28525
|
+
var resolveSource = (repoRoot, from) => {
|
|
28526
|
+
switch (from) {
|
|
28527
|
+
case "claude":
|
|
28528
|
+
return {
|
|
28529
|
+
instructionPath: claudeInstructionPath(repoRoot),
|
|
28530
|
+
skillsRoot: claudeSkillsRoot(repoRoot),
|
|
28531
|
+
targetsRoot: import_node_path14.default.join(repoRoot, ".claude")
|
|
28532
|
+
};
|
|
28533
|
+
case "opencode":
|
|
28534
|
+
return {
|
|
28535
|
+
instructionPath: opencodeInstructionPath(repoRoot),
|
|
28536
|
+
skillsRoot: opencodeSkillsRoot(repoRoot),
|
|
28537
|
+
targetsRoot: import_node_path14.default.join(repoRoot, ".opencode")
|
|
28538
|
+
};
|
|
28539
|
+
case "codex":
|
|
28540
|
+
return {
|
|
28541
|
+
instructionPath: codexInstructionPath(repoRoot),
|
|
28542
|
+
skillsRoot: codexSkillsRoot(repoRoot),
|
|
28543
|
+
targetsRoot: import_node_path14.default.join(repoRoot, ".codex")
|
|
28544
|
+
};
|
|
28545
|
+
}
|
|
28546
|
+
};
|
|
28547
|
+
var buildTargetExcludes = (from) => {
|
|
28548
|
+
if (from === "opencode") {
|
|
28549
|
+
return (rel) => rel === "skill" || rel.startsWith("skill/");
|
|
28550
|
+
}
|
|
28551
|
+
if (from === "claude" || from === "codex") {
|
|
28552
|
+
return (rel) => rel === "skills" || rel.startsWith("skills/");
|
|
28553
|
+
}
|
|
28554
|
+
return void 0;
|
|
28555
|
+
};
|
|
28556
|
+
var importCommand = (repoRoot, from) => Effect_exports.gen(function* (_) {
|
|
28557
|
+
if (typeof from !== "string") {
|
|
28558
|
+
return yield* _(
|
|
28559
|
+
Effect_exports.fail(new InvalidConfig("Missing --from (claude|opencode|codex)"))
|
|
28560
|
+
);
|
|
28561
|
+
}
|
|
28562
|
+
const source = from.trim().toLowerCase();
|
|
28563
|
+
if (source !== "claude" && source !== "opencode" && source !== "codex") {
|
|
28564
|
+
return yield* _(
|
|
28565
|
+
Effect_exports.fail(new InvalidConfig("Invalid --from (claude|opencode|codex)"))
|
|
28566
|
+
);
|
|
28567
|
+
}
|
|
28568
|
+
const ws = yield* _(ensureWorkspace(repoRoot));
|
|
28569
|
+
const tool = source;
|
|
28570
|
+
const mapping = resolveSource(repoRoot, tool);
|
|
28571
|
+
const warnings = [];
|
|
28572
|
+
if (!(yield* _(exists4(mapping.instructionPath)))) {
|
|
28573
|
+
return yield* _(
|
|
28574
|
+
Effect_exports.fail(new IoError(`Missing source instructions at ${mapping.instructionPath}`))
|
|
28575
|
+
);
|
|
28576
|
+
}
|
|
28577
|
+
const instructionContent = yield* _(readFileString(mapping.instructionPath));
|
|
28578
|
+
const parsed = extractInstructions(instructionContent);
|
|
28579
|
+
yield* _(writeFileAtomic(ws.basePath, parsed.base));
|
|
28580
|
+
let projectWritten = false;
|
|
28581
|
+
let projectRemoved = false;
|
|
28582
|
+
if (parsed.project !== void 0) {
|
|
28583
|
+
yield* _(writeFileAtomic(ws.projectPath, parsed.project));
|
|
28584
|
+
projectWritten = true;
|
|
28585
|
+
} else if (yield* _(exists4(ws.projectPath))) {
|
|
28586
|
+
yield* _(rm(ws.projectPath));
|
|
28587
|
+
projectRemoved = true;
|
|
28588
|
+
}
|
|
28589
|
+
let skillsCount = 0;
|
|
28590
|
+
if (yield* _(exists4(mapping.skillsRoot))) {
|
|
28591
|
+
skillsCount = yield* _(copyDir(mapping.skillsRoot, ws.skillsRoot));
|
|
28592
|
+
} else {
|
|
28593
|
+
warnings.push(`No skills found at ${mapping.skillsRoot}`);
|
|
28594
|
+
}
|
|
28595
|
+
let targetsCount = 0;
|
|
28596
|
+
if (yield* _(exists4(mapping.targetsRoot))) {
|
|
28597
|
+
const destRoot = import_node_path14.default.join(ws.targetsRoot, tool);
|
|
28598
|
+
targetsCount = yield* _(
|
|
28599
|
+
copyDir(mapping.targetsRoot, destRoot, buildTargetExcludes(tool))
|
|
28600
|
+
);
|
|
28601
|
+
} else {
|
|
28602
|
+
warnings.push(`No target config found at ${mapping.targetsRoot}`);
|
|
28603
|
+
}
|
|
28604
|
+
let mcpCopied = false;
|
|
28605
|
+
const mcpSource = mcpConfigPath(repoRoot);
|
|
28606
|
+
if (yield* _(exists4(mcpSource))) {
|
|
28607
|
+
yield* _(copyFile(mcpSource, ws.mcpPath));
|
|
28608
|
+
mcpCopied = true;
|
|
28609
|
+
}
|
|
28610
|
+
if (!parsed.parsed) {
|
|
28611
|
+
warnings.push("Instructions did not match generated format; imported as BASE.md");
|
|
28612
|
+
}
|
|
28613
|
+
return {
|
|
28614
|
+
from: tool,
|
|
28615
|
+
instructions: { base: true, project: projectWritten, removedProject: projectRemoved },
|
|
28616
|
+
skills: { files: skillsCount },
|
|
28617
|
+
targets: { files: targetsCount },
|
|
28618
|
+
mcp: { copied: mcpCopied },
|
|
28619
|
+
warnings
|
|
28620
|
+
};
|
|
28621
|
+
});
|
|
28622
|
+
|
|
28429
28623
|
// src/cli/render.ts
|
|
28430
28624
|
var import_node_path15 = __toESM(require("node:path"), 1);
|
|
28431
28625
|
|
|
@@ -28487,7 +28681,7 @@ var renderPlanSummary = (plan) => {
|
|
|
28487
28681
|
};
|
|
28488
28682
|
var renderWarnings = (warnings) => warnings.length > 0 ? `${yellow("Warnings:")}
|
|
28489
28683
|
${warnings.map((w) => yellow(` - ${w}`)).join("\n")}` : "";
|
|
28490
|
-
var
|
|
28684
|
+
var renderGenSummary = (plan) => {
|
|
28491
28685
|
const lines = [];
|
|
28492
28686
|
const writeOps = plan.ops.filter((op) => op.type === "WriteFile");
|
|
28493
28687
|
const copyOps = plan.ops.filter((op) => op.type === "CopyDir");
|
|
@@ -28559,8 +28753,10 @@ var renderStatusReport = (report) => {
|
|
|
28559
28753
|
for (const target of report.targets) {
|
|
28560
28754
|
const enabledLabel = target.enabled ? "" : dim(" (disabled)");
|
|
28561
28755
|
lines.push(bold(`${target.name}${enabledLabel}`));
|
|
28562
|
-
|
|
28563
|
-
|
|
28756
|
+
if (target.instruction) {
|
|
28757
|
+
const instIcon = statusIcon(target.instruction.status);
|
|
28758
|
+
lines.push(` ${instIcon} ${target.instruction.path}`);
|
|
28759
|
+
}
|
|
28564
28760
|
const skillsIcon = statusIcon(target.skillsRoot.status);
|
|
28565
28761
|
lines.push(` ${skillsIcon} ${target.skillsRoot.path}/`);
|
|
28566
28762
|
}
|
|
@@ -28621,8 +28817,31 @@ var renderDoctorReport = (report) => {
|
|
|
28621
28817
|
}
|
|
28622
28818
|
return lines.join("\n");
|
|
28623
28819
|
};
|
|
28820
|
+
var renderImportSummary = (result) => {
|
|
28821
|
+
const lines = [];
|
|
28822
|
+
lines.push(green(`\u2713 Imported from ${result.from}`));
|
|
28823
|
+
const instructionParts = ["BASE.md"];
|
|
28824
|
+
if (result.instructions.project)
|
|
28825
|
+
instructionParts.push("PROJECT.md");
|
|
28826
|
+
lines.push(cyan(` \u25CB instructions: ${instructionParts.join(", ")}`));
|
|
28827
|
+
lines.push(
|
|
28828
|
+
cyan(
|
|
28829
|
+
` \u25CB skills: ${result.skills.files} file${result.skills.files === 1 ? "" : "s"}`
|
|
28830
|
+
)
|
|
28831
|
+
);
|
|
28832
|
+
lines.push(
|
|
28833
|
+
cyan(
|
|
28834
|
+
` \u25CB targets: ${result.targets.files} file${result.targets.files === 1 ? "" : "s"}`
|
|
28835
|
+
)
|
|
28836
|
+
);
|
|
28837
|
+
lines.push(
|
|
28838
|
+
cyan(` \u25CB mcp: ${result.mcp.copied ? "copied" : "not found"}`)
|
|
28839
|
+
);
|
|
28840
|
+
return lines.join("\n");
|
|
28841
|
+
};
|
|
28624
28842
|
|
|
28625
28843
|
// src/cli/args.ts
|
|
28844
|
+
var FLAGS_WITH_VALUES = /* @__PURE__ */ new Set(["--to", "--from"]);
|
|
28626
28845
|
var parseArgs = (argv) => {
|
|
28627
28846
|
const args2 = [...argv];
|
|
28628
28847
|
const command = args2.shift() ?? "help";
|
|
@@ -28638,7 +28857,7 @@ var parseArgs = (argv) => {
|
|
|
28638
28857
|
if (value3 !== void 0) {
|
|
28639
28858
|
flags[flag] = value3;
|
|
28640
28859
|
} else if (args2[0] && !args2[0].startsWith("--")) {
|
|
28641
|
-
if (flag
|
|
28860
|
+
if (FLAGS_WITH_VALUES.has(flag)) {
|
|
28642
28861
|
flags[flag] = args2.shift();
|
|
28643
28862
|
} else {
|
|
28644
28863
|
flags[flag] = true;
|
|
@@ -28682,12 +28901,14 @@ Usage: agentscfg <command> [options]
|
|
|
28682
28901
|
Commands:
|
|
28683
28902
|
init Initialize a new .agentscfg workspace
|
|
28684
28903
|
validate Validate workspace structure
|
|
28685
|
-
status Show
|
|
28686
|
-
plan Show what
|
|
28904
|
+
status Show generation status at a glance
|
|
28905
|
+
plan Show what gen would do without making changes
|
|
28687
28906
|
diff Show file diffs for planned changes
|
|
28688
|
-
|
|
28907
|
+
gen Apply planned changes to target files
|
|
28908
|
+
import Import config from an existing agent setup
|
|
28689
28909
|
clean Remove all generated files
|
|
28690
28910
|
doctor Diagnose workspace health
|
|
28911
|
+
version Show CLI version
|
|
28691
28912
|
|
|
28692
28913
|
Run 'agentscfg <command> --help' for command-specific help.`;
|
|
28693
28914
|
var INIT_HELP = `agentscfg init - Initialize a new .agentscfg workspace
|
|
@@ -28719,7 +28940,7 @@ Checks that:
|
|
|
28719
28940
|
|
|
28720
28941
|
Example:
|
|
28721
28942
|
agentscfg validate`;
|
|
28722
|
-
var PLAN_HELP = `agentscfg plan - Show what
|
|
28943
|
+
var PLAN_HELP = `agentscfg plan - Show what gen would do without making changes
|
|
28723
28944
|
|
|
28724
28945
|
Usage: agentscfg plan [options]
|
|
28725
28946
|
|
|
@@ -28747,9 +28968,9 @@ Shows unified diffs for all files that would change.
|
|
|
28747
28968
|
Examples:
|
|
28748
28969
|
agentscfg diff
|
|
28749
28970
|
agentscfg diff --to codex`;
|
|
28750
|
-
var
|
|
28971
|
+
var GEN_HELP = `agentscfg gen - Apply planned changes to target files
|
|
28751
28972
|
|
|
28752
|
-
Usage: agentscfg
|
|
28973
|
+
Usage: agentscfg gen [options]
|
|
28753
28974
|
|
|
28754
28975
|
Options:
|
|
28755
28976
|
--to <targets> Comma-separated targets: claude,opencode,codex
|
|
@@ -28757,19 +28978,19 @@ Options:
|
|
|
28757
28978
|
--remove Remove orphaned managed files
|
|
28758
28979
|
--adopt Adopt unmanaged files that match expected content
|
|
28759
28980
|
--force Overwrite unmanaged files (use with caution)
|
|
28760
|
-
--allow-dirty Allow
|
|
28981
|
+
--allow-dirty Allow gen even with uncommitted git changes
|
|
28761
28982
|
|
|
28762
28983
|
Safety:
|
|
28763
|
-
By default,
|
|
28984
|
+
By default, gen refuses to run if git has uncommitted changes.
|
|
28764
28985
|
Use --allow-dirty to override (not recommended).
|
|
28765
28986
|
|
|
28766
28987
|
Files not generated by agentscfg are protected. Use --adopt to
|
|
28767
28988
|
take ownership of matching files, or --force to overwrite.
|
|
28768
28989
|
|
|
28769
28990
|
Examples:
|
|
28770
|
-
agentscfg
|
|
28771
|
-
agentscfg
|
|
28772
|
-
agentscfg
|
|
28991
|
+
agentscfg gen
|
|
28992
|
+
agentscfg gen --to claude --allow-dirty
|
|
28993
|
+
agentscfg gen --remove --adopt`;
|
|
28773
28994
|
var DOCTOR_HELP = `agentscfg doctor - Diagnose workspace health
|
|
28774
28995
|
|
|
28775
28996
|
Usage: agentscfg doctor
|
|
@@ -28782,7 +29003,20 @@ Checks for:
|
|
|
28782
29003
|
|
|
28783
29004
|
Example:
|
|
28784
29005
|
agentscfg doctor`;
|
|
28785
|
-
var
|
|
29006
|
+
var IMPORT_HELP = `agentscfg import - Import config from an existing agent setup
|
|
29007
|
+
|
|
29008
|
+
Usage: agentscfg import --from <tool>
|
|
29009
|
+
|
|
29010
|
+
Options:
|
|
29011
|
+
--from <tool> Source tool: claude, opencode, codex
|
|
29012
|
+
|
|
29013
|
+
Imports instructions, skills, targets, and MCP config into .agentscfg/.
|
|
29014
|
+
Requires an existing .agentscfg/ workspace (run agentscfg init).
|
|
29015
|
+
|
|
29016
|
+
Examples:
|
|
29017
|
+
agentscfg import --from codex
|
|
29018
|
+
agentscfg import --from claude`;
|
|
29019
|
+
var STATUS_HELP = `agentscfg status - Show generation status at a glance
|
|
28786
29020
|
|
|
28787
29021
|
Usage: agentscfg status [options]
|
|
28788
29022
|
|
|
@@ -28815,15 +29049,25 @@ Removes all files managed by agentscfg:
|
|
|
28815
29049
|
Examples:
|
|
28816
29050
|
agentscfg clean --dry-run
|
|
28817
29051
|
agentscfg clean`;
|
|
29052
|
+
var VERSION_HELP = `agentscfg version - Show CLI version
|
|
29053
|
+
|
|
29054
|
+
Usage: agentscfg version
|
|
29055
|
+
|
|
29056
|
+
Displays the current version of the agentscfg CLI.
|
|
29057
|
+
|
|
29058
|
+
Example:
|
|
29059
|
+
agentscfg version`;
|
|
28818
29060
|
var COMMAND_HELP = {
|
|
28819
29061
|
init: INIT_HELP,
|
|
28820
29062
|
validate: VALIDATE_HELP,
|
|
28821
29063
|
status: STATUS_HELP,
|
|
28822
29064
|
plan: PLAN_HELP,
|
|
28823
29065
|
diff: DIFF_HELP,
|
|
28824
|
-
|
|
29066
|
+
gen: GEN_HELP,
|
|
29067
|
+
import: IMPORT_HELP,
|
|
28825
29068
|
clean: CLEAN_HELP,
|
|
28826
|
-
doctor: DOCTOR_HELP
|
|
29069
|
+
doctor: DOCTOR_HELP,
|
|
29070
|
+
version: VERSION_HELP
|
|
28827
29071
|
};
|
|
28828
29072
|
var getHelp = (command) => {
|
|
28829
29073
|
if (command && command in COMMAND_HELP) {
|
|
@@ -28877,6 +29121,10 @@ var run = async () => {
|
|
|
28877
29121
|
info(getHelp(command));
|
|
28878
29122
|
return;
|
|
28879
29123
|
}
|
|
29124
|
+
if (command === "version") {
|
|
29125
|
+
info(`agentscfg v${version}`);
|
|
29126
|
+
return;
|
|
29127
|
+
}
|
|
28880
29128
|
try {
|
|
28881
29129
|
repoRoot = await findRepoRoot(cwd).pipe(Effect_exports.runPromise);
|
|
28882
29130
|
} catch (err) {
|
|
@@ -28926,11 +29174,11 @@ var run = async () => {
|
|
|
28926
29174
|
console.log(diff8 || "(no changes)");
|
|
28927
29175
|
return;
|
|
28928
29176
|
}
|
|
28929
|
-
case "
|
|
28930
|
-
const plan = await
|
|
29177
|
+
case "gen": {
|
|
29178
|
+
const plan = await genCommand(repoRoot, buildOptions(flags)).pipe(
|
|
28931
29179
|
Effect_exports.runPromise
|
|
28932
29180
|
);
|
|
28933
|
-
info(
|
|
29181
|
+
info(renderGenSummary(plan));
|
|
28934
29182
|
const warnings = renderWarnings(plan.warnings);
|
|
28935
29183
|
if (warnings)
|
|
28936
29184
|
info(warnings);
|
|
@@ -28956,6 +29204,16 @@ var run = async () => {
|
|
|
28956
29204
|
info(renderDoctorReport(report));
|
|
28957
29205
|
return;
|
|
28958
29206
|
}
|
|
29207
|
+
case "import": {
|
|
29208
|
+
const result = await importCommand(repoRoot, flags["--from"]).pipe(
|
|
29209
|
+
Effect_exports.runPromise
|
|
29210
|
+
);
|
|
29211
|
+
info(renderImportSummary(result));
|
|
29212
|
+
const warnings = renderWarnings(result.warnings);
|
|
29213
|
+
if (warnings)
|
|
29214
|
+
info(warnings);
|
|
29215
|
+
return;
|
|
29216
|
+
}
|
|
28959
29217
|
case "help":
|
|
28960
29218
|
default: {
|
|
28961
29219
|
info(getHelp(flags["--help"] ? void 0 : void 0));
|