@nail00749/agent-gvozd 0.1.6 → 0.1.8
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/dist/cli.js +32 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7336,7 +7336,7 @@ function buildAgentPermissions(agent, mcpServers) {
|
|
|
7336
7336
|
|
|
7337
7337
|
// src/release-metadata.ts
|
|
7338
7338
|
var PACKAGE_NAME = "@nail00749/agent-gvozd";
|
|
7339
|
-
var PACKAGE_VERSION = "0.1.
|
|
7339
|
+
var PACKAGE_VERSION = "0.1.8";
|
|
7340
7340
|
var PACKAGE_SPEC = `${PACKAGE_NAME}@${PACKAGE_VERSION}`;
|
|
7341
7341
|
var SUPPORTED_OPENCODE_VERSION = "2.0.2";
|
|
7342
7342
|
var CONFIG_SCHEMA_VERSION = 2;
|
|
@@ -7593,6 +7593,9 @@ function createClient(executable, runner) {
|
|
|
7593
7593
|
async pluginAdd(spec) {
|
|
7594
7594
|
await checked(runner, executable, ["plugin", "add", spec], 60000);
|
|
7595
7595
|
},
|
|
7596
|
+
async pluginRemove(spec) {
|
|
7597
|
+
await checked(runner, executable, ["plugin", "remove", spec]);
|
|
7598
|
+
},
|
|
7596
7599
|
pluginList() {
|
|
7597
7600
|
return checked(runner, executable, ["plugin", "list"]);
|
|
7598
7601
|
},
|
|
@@ -8426,6 +8429,12 @@ async function confirm2(input, message) {
|
|
|
8426
8429
|
function sameSnapshot(left, right) {
|
|
8427
8430
|
return left.configRoot === right.configRoot && left.config.exists === right.config.exists && left.config.dev === right.config.dev && left.config.ino === right.config.ino && left.config.bytes === right.config.bytes && left.schema.exists === right.schema.exists && left.schema.dev === right.schema.dev && left.schema.ino === right.schema.ino && left.schema.bytes === right.schema.bytes;
|
|
8428
8431
|
}
|
|
8432
|
+
async function registeredPackageSpecs(client, packageName, target) {
|
|
8433
|
+
const output = await client.pluginList();
|
|
8434
|
+
const specPattern = new RegExp(`${packageName.replace(/[/@]/g, "\\$&")}@[^\\s]+`, "g");
|
|
8435
|
+
const specs = [...new Set(output.match(specPattern) ?? [])];
|
|
8436
|
+
return specs.filter((spec) => spec !== target);
|
|
8437
|
+
}
|
|
8429
8438
|
async function runSetup(input) {
|
|
8430
8439
|
const client = await (input.findClient ?? (() => findOpenCode()))();
|
|
8431
8440
|
const paths = await client.debugPaths();
|
|
@@ -8468,6 +8477,9 @@ async function runSetup(input) {
|
|
|
8468
8477
|
throw new Error("Global Gvozd configuration changed during locked setup revalidation; review and rerun setup");
|
|
8469
8478
|
}
|
|
8470
8479
|
writeManagedAgents({ configRoot, agents: lockedBefore.agents, check: true });
|
|
8480
|
+
for (const stale of await registeredPackageSpecs(client, PACKAGE_NAME, PACKAGE_SPEC)) {
|
|
8481
|
+
await client.pluginRemove(stale);
|
|
8482
|
+
}
|
|
8471
8483
|
await client.pluginAdd(PACKAGE_SPEC);
|
|
8472
8484
|
try {
|
|
8473
8485
|
writeGlobalConfig({ configRoot, profile: lockedProfile, schemaSource: lockedSchema, snapshot });
|
|
@@ -8702,7 +8714,16 @@ function syncAgentsUnlocked(config, options) {
|
|
|
8702
8714
|
}
|
|
8703
8715
|
const pluginTarget = join9(pluginDestination, "index.ts");
|
|
8704
8716
|
const pluginContent = renderPluginEntrypoint(config, pluginDestination);
|
|
8705
|
-
if (!
|
|
8717
|
+
if (!options.devPlugin) {
|
|
8718
|
+
if (assertRegularFile(pluginTarget)) {
|
|
8719
|
+
const current = readFileSync8(pluginTarget, "utf8");
|
|
8720
|
+
if (hasGeneratedPluginMarker(current)) {
|
|
8721
|
+
result.removed.push(pluginTarget);
|
|
8722
|
+
removals.set(pluginTarget, current);
|
|
8723
|
+
options.onDiff?.(renderDiff(pluginTarget, current, ""));
|
|
8724
|
+
}
|
|
8725
|
+
}
|
|
8726
|
+
} else if (!assertRegularFile(pluginTarget)) {
|
|
8706
8727
|
result.created.push(pluginTarget);
|
|
8707
8728
|
pluginWrite = { target: pluginTarget, content: pluginContent, replace: false };
|
|
8708
8729
|
} else {
|
|
@@ -8723,11 +8744,12 @@ function syncAgentsUnlocked(config, options) {
|
|
|
8723
8744
|
const writablePluginDestination = safeDirectory(config.projectRoot, [".opencode", "plugins", "agent-gvozd"], true);
|
|
8724
8745
|
for (const target of result.removed) {
|
|
8725
8746
|
if (!assertRegularFile(target)) {
|
|
8726
|
-
throw new Error(`Refusing to remove a changed or unsafe
|
|
8747
|
+
throw new Error(`Refusing to remove a changed or unsafe generated file: ${target}`);
|
|
8727
8748
|
}
|
|
8728
8749
|
const current = readFileSync8(target, "utf8");
|
|
8729
|
-
|
|
8730
|
-
|
|
8750
|
+
const generated = target.endsWith("index.ts") ? hasGeneratedPluginMarker(current) : hasGeneratedAgentMarker(current);
|
|
8751
|
+
if (!generated || current !== removals.get(target)) {
|
|
8752
|
+
throw new Error(`Refusing to remove a concurrently changed generated file: ${target}`);
|
|
8731
8753
|
}
|
|
8732
8754
|
unlinkSync4(target);
|
|
8733
8755
|
}
|
|
@@ -8818,7 +8840,8 @@ var HELP = [
|
|
|
8818
8840
|
" setup [--yes] Install or upgrade the global agent team",
|
|
8819
8841
|
" config [--yes] Configure model preferences",
|
|
8820
8842
|
" doctor [--json] Diagnose the global installation",
|
|
8821
|
-
" sync [--check]
|
|
8843
|
+
" sync [--check] [--dev-plugin] Maintain the project-local installation",
|
|
8844
|
+
" --dev-plugin also writes the local plugin entrypoint (dev repositories only)",
|
|
8822
8845
|
" trust-project [directory] Print the current project trust token",
|
|
8823
8846
|
"",
|
|
8824
8847
|
"Options:",
|
|
@@ -8888,12 +8911,13 @@ async function runCli(args, io = defaultIO, commands = { setup: runSetup, config
|
|
|
8888
8911
|
return report.status === "fail" ? 1 : 0;
|
|
8889
8912
|
}
|
|
8890
8913
|
if (command === "sync") {
|
|
8891
|
-
const parsed = parseFlags(rest, ["--check"]);
|
|
8914
|
+
const parsed = parseFlags(rest, ["--check", "--dev-plugin"]);
|
|
8892
8915
|
if (!parsed || parsed.positional.length > 1)
|
|
8893
8916
|
return usage(io);
|
|
8894
8917
|
const check = parsed.flags.has("--check");
|
|
8918
|
+
const devPlugin = parsed.flags.has("--dev-plugin");
|
|
8895
8919
|
const config = loadConfig(parsed.positional[0] ?? io.cwd());
|
|
8896
|
-
const result = syncAgents(config, { check, onDiff: (diff) => io.stdout(`${diff}
|
|
8920
|
+
const result = syncAgents(config, { check, devPlugin, onDiff: (diff) => io.stdout(`${diff}
|
|
8897
8921
|
`) });
|
|
8898
8922
|
io.stdout(formatSyncResult(result, check));
|
|
8899
8923
|
return check && result.created.length + result.updated.length + result.removed.length > 0 ? 1 : 0;
|