auriga-cli 1.20.0 → 1.20.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/dist/catalog.json +1 -1
- package/dist/plugins.js +54 -15
- package/dist/utils.js +43 -0
- package/package.json +1 -1
package/dist/catalog.json
CHANGED
package/dist/plugins.js
CHANGED
|
@@ -3,7 +3,7 @@ import os from "node:os";
|
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { checkbox, select } from "@inquirer/prompts";
|
|
5
5
|
import { parse as parseToml, stringify as stringifyToml } from "smol-toml";
|
|
6
|
-
import { codexManifestPath, validateCodexInstallConfig, validateCodexMarketplace, } from "./codex-plugin-config.js";
|
|
6
|
+
import { codexLocalPluginPath, codexManifestPath, validateCodexInstallConfig, validateCodexMarketplace, } from "./codex-plugin-config.js";
|
|
7
7
|
import { validateMarketplaceField } from "./marketplace.js";
|
|
8
8
|
import { atomicWriteFile, exec, execAsync, fetchExtraContent, log, withEsc } from "./utils.js";
|
|
9
9
|
// Plugin names and plugin-package names end up in `claude plugins ...`
|
|
@@ -23,6 +23,7 @@ const MIGRATED_WORKFLOW_SKILLS = [
|
|
|
23
23
|
const NOTIFY_PLUGIN_NAME = "auriga-notify";
|
|
24
24
|
const WORKFLOW_SKILLS_PLUGIN_NAME = "auriga-workflow-skills";
|
|
25
25
|
const LEGACY_NOTIFY_MARKER = "auriga:notify";
|
|
26
|
+
const CODEX_PLUGIN_VERSION_RE = /^[A-Za-z0-9][A-Za-z0-9._+-]{0,127}$/;
|
|
26
27
|
export function validatePluginsConfig(raw) {
|
|
27
28
|
if (!raw || typeof raw !== "object") {
|
|
28
29
|
throw new Error("plugins.json: root must be an object");
|
|
@@ -177,10 +178,8 @@ function cleanupMigratedWorkflowSkillInstalls(opts, runtimes) {
|
|
|
177
178
|
for (const runtime of runtimes) {
|
|
178
179
|
const dir = legacySkillDir(opts, runtime, name);
|
|
179
180
|
const stat = fs.lstatSync(dir, { throwIfNoEntry: false });
|
|
180
|
-
if (!stat)
|
|
181
|
-
emitMigrationLog(opts, `${runtimeSkillRoot(runtime)}/skills/${name} not present`);
|
|
181
|
+
if (!stat)
|
|
182
182
|
continue;
|
|
183
|
-
}
|
|
184
183
|
if (scope === "project" && isWorkflowPluginDevSymlink(dir, cwd, name)) {
|
|
185
184
|
emitMigrationLog(opts, `preserved ${runtimeSkillRoot(runtime)}/skills/${name} development symlink`);
|
|
186
185
|
continue;
|
|
@@ -338,6 +337,16 @@ function pluginHasHooks(packageRoot, plugin) {
|
|
|
338
337
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"));
|
|
339
338
|
return typeof manifest.hooks === "string" || Array.isArray(manifest.hooks);
|
|
340
339
|
}
|
|
340
|
+
function resolveSelectedCodexMarketplacePlugins(localMarketplace, localSelected) {
|
|
341
|
+
const localMpByName = new Map(localMarketplace.plugins.map((p) => [p.name, p]));
|
|
342
|
+
return localSelected.map((p) => {
|
|
343
|
+
const plugin = localMpByName.get(p.name);
|
|
344
|
+
if (!plugin) {
|
|
345
|
+
throw new Error(`Codex install.json: plugin ${p.name} is not present in marketplace.json`);
|
|
346
|
+
}
|
|
347
|
+
return plugin;
|
|
348
|
+
});
|
|
349
|
+
}
|
|
341
350
|
async function ensureCodexPluginManifests(packageRoot, plugins) {
|
|
342
351
|
for (const plugin of plugins) {
|
|
343
352
|
const manifestPath = codexManifestPath(plugin);
|
|
@@ -349,6 +358,38 @@ async function ensureCodexPluginManifests(packageRoot, plugins) {
|
|
|
349
358
|
await fetchExtraContent(packageRoot, manifestPath);
|
|
350
359
|
}
|
|
351
360
|
}
|
|
361
|
+
function readCodexPluginVersion(packageRoot, plugin) {
|
|
362
|
+
const manifestPath = codexManifestPath(plugin);
|
|
363
|
+
if (!manifestPath) {
|
|
364
|
+
throw new Error(`Codex marketplace.json: plugin ${plugin.name} must use a local source.path`);
|
|
365
|
+
}
|
|
366
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, manifestPath), "utf-8"));
|
|
367
|
+
if (typeof manifest.version !== "string" || !CODEX_PLUGIN_VERSION_RE.test(manifest.version)) {
|
|
368
|
+
throw new Error(`Codex plugin ${plugin.name} manifest must include a safe string version`);
|
|
369
|
+
}
|
|
370
|
+
return manifest.version;
|
|
371
|
+
}
|
|
372
|
+
function materializeLocalCodexPluginCache(packageRoot, marketplaceName, plugins) {
|
|
373
|
+
const cacheRoot = path.join(codexHome(), "plugins", "cache");
|
|
374
|
+
for (const plugin of plugins) {
|
|
375
|
+
const sourcePath = codexLocalPluginPath(plugin);
|
|
376
|
+
if (!sourcePath) {
|
|
377
|
+
throw new Error(`Codex marketplace.json: plugin ${plugin.name} must use a local source.path`);
|
|
378
|
+
}
|
|
379
|
+
const version = readCodexPluginVersion(packageRoot, plugin);
|
|
380
|
+
const sourceDir = path.join(packageRoot, sourcePath);
|
|
381
|
+
const destDir = path.join(cacheRoot, marketplaceName, plugin.name, version);
|
|
382
|
+
const tmpDir = `${destDir}.tmp-${process.pid}-${Date.now()}`;
|
|
383
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
384
|
+
fs.mkdirSync(path.dirname(destDir), { recursive: true });
|
|
385
|
+
fs.cpSync(sourceDir, tmpDir, { recursive: true });
|
|
386
|
+
fs.rmSync(destDir, { recursive: true, force: true });
|
|
387
|
+
fs.renameSync(tmpDir, destDir);
|
|
388
|
+
if (!fs.existsSync(path.join(destDir, ".codex-plugin", "plugin.json"))) {
|
|
389
|
+
throw new Error(`Codex plugin ${plugin.name} cache materialization did not produce plugin.json`);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
352
393
|
function ensureTomlBoolean(content, section, key, value) {
|
|
353
394
|
const line = `${key} = ${value ? "true" : "false"}`;
|
|
354
395
|
const header = `[${section}]`;
|
|
@@ -477,19 +518,10 @@ async function addCodexMarketplaceWithRetry(marketplaceName, addCommand, opts, m
|
|
|
477
518
|
// manifest at install time. Acceptable while no external plugin ships
|
|
478
519
|
// hooks; once one does, prefer fetching the manifest or adding an
|
|
479
520
|
// explicit `requiresPluginHooks: true` field on the install.json entry.
|
|
480
|
-
async function composeCodexPluginKeys(packageRoot, localMarketplace,
|
|
521
|
+
async function composeCodexPluginKeys(packageRoot, localMarketplace, selectedMarketplacePlugins, externalSelected) {
|
|
481
522
|
const pluginKeys = [];
|
|
482
523
|
let needsPluginHooks = false;
|
|
483
524
|
if (localMarketplace) {
|
|
484
|
-
const localMpByName = new Map(localMarketplace.plugins.map((p) => [p.name, p]));
|
|
485
|
-
const selectedMarketplacePlugins = localSelected.map((p) => {
|
|
486
|
-
const plugin = localMpByName.get(p.name);
|
|
487
|
-
if (!plugin) {
|
|
488
|
-
throw new Error(`Codex install.json: plugin ${p.name} is not present in marketplace.json`);
|
|
489
|
-
}
|
|
490
|
-
return plugin;
|
|
491
|
-
});
|
|
492
|
-
await ensureCodexPluginManifests(packageRoot, selectedMarketplacePlugins);
|
|
493
525
|
for (const plugin of selectedMarketplacePlugins) {
|
|
494
526
|
pluginKeys.push(`${plugin.name}@${localMarketplace.name}`);
|
|
495
527
|
if (pluginHasHooks(packageRoot, plugin))
|
|
@@ -568,7 +600,14 @@ async function installCodexPlugins(packageRoot, opts) {
|
|
|
568
600
|
await addCodexMarketplaceWithRetry(mp.name, codexExternalMarketplaceAddCommand(mp.source), opts, marketplaceExecOpts, failures);
|
|
569
601
|
}
|
|
570
602
|
if (failures.length === 0) {
|
|
571
|
-
const
|
|
603
|
+
const selectedMarketplacePlugins = localMarketplace
|
|
604
|
+
? resolveSelectedCodexMarketplacePlugins(localMarketplace, localSelected)
|
|
605
|
+
: [];
|
|
606
|
+
await ensureCodexPluginManifests(packageRoot, selectedMarketplacePlugins);
|
|
607
|
+
if (localMarketplace) {
|
|
608
|
+
materializeLocalCodexPluginCache(packageRoot, localMarketplace.name, selectedMarketplacePlugins);
|
|
609
|
+
}
|
|
610
|
+
const { pluginKeys, needsPluginHooks } = await composeCodexPluginKeys(packageRoot, localMarketplace, selectedMarketplacePlugins, externalSelected);
|
|
572
611
|
enableCodexPluginConfig(path.join(codexHome(), "config.toml"), pluginKeys, needsPluginHooks);
|
|
573
612
|
for (const plugin of [...localSelected, ...externalSelected]) {
|
|
574
613
|
log.ok(`${plugin.name} enabled for Codex`);
|
package/dist/utils.js
CHANGED
|
@@ -152,6 +152,49 @@ const CONTENT_FILES = [
|
|
|
152
152
|
".agents/plugins/marketplace.json",
|
|
153
153
|
".agents/plugins/install.json",
|
|
154
154
|
".claude/hooks/hooks.json",
|
|
155
|
+
"plugins/auriga-go/.claude-plugin/plugin.json",
|
|
156
|
+
"plugins/auriga-go/.codex-plugin/plugin.json",
|
|
157
|
+
"plugins/auriga-go/README.md",
|
|
158
|
+
"plugins/auriga-go/skills/auriga-go/SKILL.md",
|
|
159
|
+
"plugins/auriga-go/skills/goalify/SKILL.md",
|
|
160
|
+
"plugins/auriga-git-guards/.claude-plugin/plugin.json",
|
|
161
|
+
"plugins/auriga-git-guards/.codex-plugin/plugin.json",
|
|
162
|
+
"plugins/auriga-git-guards/README.md",
|
|
163
|
+
"plugins/auriga-git-guards/hooks/hooks.json",
|
|
164
|
+
"plugins/auriga-git-guards/scripts/commit-reminder.mjs",
|
|
165
|
+
"plugins/auriga-git-guards/scripts/pr-create-guard.mjs",
|
|
166
|
+
"plugins/auriga-git-guards/scripts/pr-ready-guard.mjs",
|
|
167
|
+
"plugins/auriga-git-guards/skills/git-workflow/SKILL.md",
|
|
168
|
+
"plugins/auriga-workflow-skills/.claude-plugin/plugin.json",
|
|
169
|
+
"plugins/auriga-workflow-skills/.codex-plugin/plugin.json",
|
|
170
|
+
"plugins/auriga-workflow-skills/README.md",
|
|
171
|
+
"plugins/auriga-workflow-skills/skills/incremental-impl/SKILL.md",
|
|
172
|
+
"plugins/auriga-workflow-skills/skills/session-compound/SKILL.md",
|
|
173
|
+
"plugins/auriga-workflow-skills/skills/session-compound/analyzers/claude-code.mjs",
|
|
174
|
+
"plugins/auriga-workflow-skills/skills/session-compound/analyzers/codex.mjs",
|
|
175
|
+
"plugins/auriga-workflow-skills/skills/session-compound/template.html",
|
|
176
|
+
"plugins/auriga-workflow-skills/skills/test-designer/SKILL.md",
|
|
177
|
+
"plugins/session-instructions-loader/.codex-plugin/plugin.json",
|
|
178
|
+
"plugins/session-instructions-loader/README.md",
|
|
179
|
+
"plugins/session-instructions-loader/hooks/hooks.json",
|
|
180
|
+
"plugins/session-instructions-loader/scripts/session-start.mjs",
|
|
181
|
+
"plugins/deep-review/.claude-plugin/plugin.json",
|
|
182
|
+
"plugins/deep-review/.codex-plugin/plugin.json",
|
|
183
|
+
"plugins/deep-review/README.md",
|
|
184
|
+
"plugins/deep-review/skills/deep-review/SKILL.md",
|
|
185
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/code-quality.md",
|
|
186
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/correctness.md",
|
|
187
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/docs-sync.md",
|
|
188
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/performance.md",
|
|
189
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/robustness.md",
|
|
190
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/security.md",
|
|
191
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/skill-plugin-quality.md",
|
|
192
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/spec-conformance.md",
|
|
193
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/structure.md",
|
|
194
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/test-quality.md",
|
|
195
|
+
"plugins/deep-review/skills/deep-review/references/reviewers/ux.md",
|
|
196
|
+
"plugins/deep-review/skills/reviewer-creator/SKILL.md",
|
|
197
|
+
"plugins/deep-review/skills/reviewer-creator/references/template.md",
|
|
155
198
|
];
|
|
156
199
|
async function fetchFile(file) {
|
|
157
200
|
const ref = resolveContentRef();
|
package/package.json
CHANGED