@hanv89/azure-arch-skill 0.5.0 → 0.6.0
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/adapters/registry.js +5 -1
- package/dist/all.js +66 -0
- package/dist/index.js +12 -3
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SUPPORTED_AGENTS = exports.ADAPTERS = void 0;
|
|
3
|
+
exports.SUPPORTED_TARGETS = exports.ALL_TARGET = exports.SUPPORTED_AGENTS = exports.ADAPTERS = void 0;
|
|
4
4
|
const claude_code_1 = require("./claude-code");
|
|
5
5
|
const codex_1 = require("./codex");
|
|
6
6
|
const cursor_1 = require("./cursor");
|
|
@@ -14,3 +14,7 @@ exports.ADAPTERS = {
|
|
|
14
14
|
"cursor": cursor_1.cursorAdapter,
|
|
15
15
|
};
|
|
16
16
|
exports.SUPPORTED_AGENTS = Object.keys(exports.ADAPTERS);
|
|
17
|
+
/** Sentinel value for `--agent=all` — iterate every adapter under one command. */
|
|
18
|
+
exports.ALL_TARGET = "all";
|
|
19
|
+
/** Full target set the CLI's `--agent` flag accepts. */
|
|
20
|
+
exports.SUPPORTED_TARGETS = [...exports.SUPPORTED_AGENTS, exports.ALL_TARGET];
|
package/dist/all.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runOverAll = void 0;
|
|
4
|
+
const registry_1 = require("./adapters/registry");
|
|
5
|
+
async function runOverAll(sub, opts) {
|
|
6
|
+
if (registry_1.SUPPORTED_AGENTS.length === 0) {
|
|
7
|
+
throw new Error("no adapters loaded in registry (registry.ts ADAPTERS is empty)");
|
|
8
|
+
}
|
|
9
|
+
const completed = [];
|
|
10
|
+
const successes = [];
|
|
11
|
+
const failures = [];
|
|
12
|
+
const isTransactional = sub === "install" || sub === "update";
|
|
13
|
+
for (const agent of registry_1.SUPPORTED_AGENTS) {
|
|
14
|
+
const adapter = registry_1.ADAPTERS[agent];
|
|
15
|
+
const outcome = await runOne(adapter, agent, sub, opts);
|
|
16
|
+
if (outcome.exit === 0) {
|
|
17
|
+
successes.push(agent);
|
|
18
|
+
if (isTransactional)
|
|
19
|
+
completed.push(agent);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
failures.push(outcome);
|
|
23
|
+
if (isTransactional)
|
|
24
|
+
break; // halt + roll back below
|
|
25
|
+
// uninstall / list: best-effort, keep going
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const rolledBack = [];
|
|
29
|
+
if (isTransactional && failures.length > 0) {
|
|
30
|
+
for (const agent of completed.slice().reverse()) {
|
|
31
|
+
try {
|
|
32
|
+
const exit = await registry_1.ADAPTERS[agent].uninstall(opts);
|
|
33
|
+
if (exit === 0) {
|
|
34
|
+
rolledBack.push(agent);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
process.stderr.write(`fatal: rollback failed for ${agent}: uninstall exited ${exit}\n`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
42
|
+
process.stderr.write(`fatal: rollback failed for ${agent}: ${msg}\n`);
|
|
43
|
+
// continue with the rest (best-effort cleanup)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
process.stderr.write(formatSummary(sub, successes, failures, rolledBack, isTransactional));
|
|
48
|
+
return failures.length > 0 ? 1 : 0;
|
|
49
|
+
}
|
|
50
|
+
exports.runOverAll = runOverAll;
|
|
51
|
+
async function runOne(adapter, agent, sub, opts) {
|
|
52
|
+
try {
|
|
53
|
+
const exit = await adapter[sub](opts);
|
|
54
|
+
return { agent, exit };
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
return { agent, exit: 1, error: err instanceof Error ? err : new Error(String(err)) };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function formatSummary(sub, successes, failures, rolledBack, isTransactional) {
|
|
61
|
+
const fmt = (list, fallback) => `[${list.length > 0 ? list.join(", ") : fallback}]`;
|
|
62
|
+
const succLabel = fmt(successes, "(none)");
|
|
63
|
+
const failLabel = fmt(failures.map(f => f.agent), "(none)");
|
|
64
|
+
const rbLabel = isTransactional ? fmt(rolledBack, "(none)") : "[(n/a)]";
|
|
65
|
+
return `--agent=all (${sub}): succeeded=${succLabel} failed=${failLabel} rolled-back=${rbLabel}\n`;
|
|
66
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -7,9 +7,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
const commander_1 = require("commander");
|
|
8
8
|
const package_json_1 = __importDefault(require("../package.json"));
|
|
9
9
|
const registry_1 = require("./adapters/registry");
|
|
10
|
+
const all_1 = require("./all");
|
|
10
11
|
function pickAdapter(agent) {
|
|
11
12
|
if (!(agent in registry_1.ADAPTERS)) {
|
|
12
|
-
throw new Error(`unknown agent: ${agent} (supported: ${registry_1.
|
|
13
|
+
throw new Error(`unknown agent: ${agent} (supported: ${registry_1.SUPPORTED_TARGETS.join(", ")})`);
|
|
13
14
|
}
|
|
14
15
|
return registry_1.ADAPTERS[agent];
|
|
15
16
|
}
|
|
@@ -21,14 +22,22 @@ function defineSubcommand(name, description) {
|
|
|
21
22
|
program
|
|
22
23
|
.command(name)
|
|
23
24
|
.description(description)
|
|
24
|
-
.requiredOption("--agent <name>", `target AI agent (${registry_1.
|
|
25
|
+
.requiredOption("--agent <name>", `target AI agent (${registry_1.SUPPORTED_TARGETS.join("|")})`)
|
|
25
26
|
.option("--target <dir>", "override target directory (validation use)")
|
|
26
27
|
.action(async (opts) => {
|
|
27
28
|
// Set process.exitCode so any pending async cleanup (file handles, the
|
|
28
29
|
// override-warning stderr write) drains before the event loop empties.
|
|
29
30
|
// Both this top-level path and adapter-internal failures emit a single
|
|
30
31
|
// '^fatal: ' prefix line on stderr — log-parsers can rely on the prefix.
|
|
31
|
-
|
|
32
|
+
const optsForAdapter = { target: opts.target };
|
|
33
|
+
if (opts.agent === registry_1.ALL_TARGET) {
|
|
34
|
+
process.exitCode = await (0, all_1.runOverAll)(name, optsForAdapter);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!registry_1.SUPPORTED_AGENTS.includes(opts.agent)) {
|
|
38
|
+
throw new Error(`unknown agent: ${opts.agent} (supported: ${registry_1.SUPPORTED_TARGETS.join(", ")})`);
|
|
39
|
+
}
|
|
40
|
+
process.exitCode = await pickAdapter(opts.agent)[name](optsForAdapter);
|
|
32
41
|
});
|
|
33
42
|
}
|
|
34
43
|
defineSubcommand("install", "Install the skill into an AI agent's skill folder.");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanv89/azure-arch-skill",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Install the Azure architecture diagram skill into your AI coding agent (Claude Code, Codex CLI, Cursor).",
|
|
5
5
|
"bin": {
|
|
6
6
|
"azure-arch-skill": "dist/index.js"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "tsc",
|
|
17
17
|
"start": "node dist/index.js",
|
|
18
|
-
"test": "tsc && node --test dist
|
|
18
|
+
"test": "tsc && node --test dist/**/*.test.js dist/*.test.js",
|
|
19
19
|
"prepublishOnly": "npm run build"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|