@docker-doctor/cli 0.3.4 → 0.4.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/README.md +13 -3
- package/dist/cli.cjs +18 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +18 -9
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-BuADwzRj.mjs → src-DHveWSuN.mjs} +8 -5
- package/dist/{src-BuADwzRj.mjs.map → src-DHveWSuN.mjs.map} +1 -1
- package/dist/{src-DWIAE2Ni.cjs → src-DOPSHVJr.cjs} +9 -6
- package/dist/src-DOPSHVJr.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/src-DWIAE2Ni.cjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as runDockerfileRules, c as parseCompose, d as version, i as runComposeRules, l as parseDockerfile, n as calculateScore, o as allRules, r as loadConfig, s as findRule, t as toJsonReport, u as discoverProject } from "./src-
|
|
2
|
+
import { a as runDockerfileRules, c as parseCompose, d as version, i as runComposeRules, l as parseDockerfile, n as calculateScore, o as allRules, r as loadConfig, s as findRule, t as toJsonReport, u as discoverProject } from "./src-DHveWSuN.mjs";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import os from "node:os";
|
|
@@ -703,13 +703,14 @@ const getSkillSourceDirectory = () => {
|
|
|
703
703
|
for (const candidate of candidates) if (fs$1.existsSync(path.join(candidate, SKILL_MANIFEST_FILE))) return candidate;
|
|
704
704
|
return null;
|
|
705
705
|
};
|
|
706
|
-
const installSkillForAgents = async (agents,
|
|
706
|
+
const installSkillForAgents = async (agents, options) => {
|
|
707
707
|
const source = getSkillSourceDirectory();
|
|
708
708
|
if (!source) return null;
|
|
709
709
|
try {
|
|
710
710
|
return await installSkillsFromSource({
|
|
711
711
|
agents,
|
|
712
|
-
cwd: projectRoot,
|
|
712
|
+
cwd: options.projectRoot,
|
|
713
|
+
global: options.global,
|
|
713
714
|
mode: "copy",
|
|
714
715
|
source
|
|
715
716
|
});
|
|
@@ -1090,7 +1091,7 @@ const runAgentHandoff = async (context) => {
|
|
|
1090
1091
|
return;
|
|
1091
1092
|
}
|
|
1092
1093
|
const agentId = launchable[choice];
|
|
1093
|
-
const installResult = await installSkillForAgents([agentId], context.rootDir);
|
|
1094
|
+
const installResult = await installSkillForAgents([agentId], { projectRoot: context.rootDir });
|
|
1094
1095
|
if (installResult && installResult.installed.length > 0) console.log(`\n ${chalk.green("✔")} Installed the docker-doctor skill for ${agentDisplayName(agentId)}`);
|
|
1095
1096
|
console.log(`\n Handing off to ${agentDisplayName(agentId)}...\n`);
|
|
1096
1097
|
if (!await launchAgent(agentId, payload)) {
|
|
@@ -1139,7 +1140,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
|
|
|
1139
1140
|
try {
|
|
1140
1141
|
const content = await fs.readFile(fullPath, "utf-8");
|
|
1141
1142
|
fileContents[df] = content;
|
|
1142
|
-
|
|
1143
|
+
const instructions = parseDockerfile(content);
|
|
1144
|
+
return runDockerfileRules(instructions, df, projectFilesList, rulesConfig);
|
|
1143
1145
|
} catch (error) {
|
|
1144
1146
|
const msg = error instanceof Error ? error.message : String(error);
|
|
1145
1147
|
console.error(`Failed to analyze Dockerfile ${df}: ${msg}`);
|
|
@@ -1156,7 +1158,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
|
|
|
1156
1158
|
try {
|
|
1157
1159
|
const content = await fs.readFile(fullPath, "utf-8");
|
|
1158
1160
|
fileContents[cf] = content;
|
|
1159
|
-
|
|
1161
|
+
const composeObj = parseCompose(content, cf);
|
|
1162
|
+
return runComposeRules(composeObj, cf, rulesConfig);
|
|
1160
1163
|
} catch (error) {
|
|
1161
1164
|
const msg = error instanceof Error ? error.message : String(error);
|
|
1162
1165
|
console.error(`Failed to analyze Compose file ${cf}: ${msg}`);
|
|
@@ -1303,7 +1306,7 @@ const resolveInstallAgents = async (requested) => {
|
|
|
1303
1306
|
selected: detectedSet.has(agent)
|
|
1304
1307
|
})))).map((i) => choices[i]);
|
|
1305
1308
|
};
|
|
1306
|
-
program.command("install").description("install the Docker Doctor agent skill for your coding agents").option("-a, --agent <agents...>", "agent id(s) to install for (e.g. claude-code codex cursor)").action(async (options) => {
|
|
1309
|
+
program.command("install").description("install the Docker Doctor agent skill for your coding agents").option("-a, --agent <agents...>", "agent id(s) to install for (e.g. claude-code codex cursor)").option("-g, --global", "install into each agent's global skills directory (e.g. ~/.claude/skills) instead of the current project").action(async (options) => {
|
|
1307
1310
|
if (!getSkillSourceDirectory()) {
|
|
1308
1311
|
console.error("Bundled skill not found — this looks like a broken installation.");
|
|
1309
1312
|
process.exit(1);
|
|
@@ -1314,14 +1317,20 @@ program.command("install").description("install the Docker Doctor agent skill fo
|
|
|
1314
1317
|
console.log("Nothing selected — skipped.");
|
|
1315
1318
|
return;
|
|
1316
1319
|
}
|
|
1317
|
-
const result = await installSkillForAgents(agents,
|
|
1320
|
+
const result = await installSkillForAgents(agents, {
|
|
1321
|
+
global: options.global,
|
|
1322
|
+
projectRoot: process.cwd()
|
|
1323
|
+
});
|
|
1318
1324
|
if (!result) {
|
|
1319
1325
|
console.error("Failed to install the skill.");
|
|
1320
1326
|
process.exit(1);
|
|
1321
1327
|
}
|
|
1322
1328
|
for (const installed of result.installed) console.log(` ${chalk.green("✔")} ${agentDisplayName(installed.agent)} → ${installed.path}`);
|
|
1323
1329
|
for (const failed of result.failed) console.log(` ${chalk.red("✖")} ${agentDisplayName(failed.agent)}: ${failed.error}`);
|
|
1324
|
-
if (result.installed.length > 0)
|
|
1330
|
+
if (result.installed.length > 0) {
|
|
1331
|
+
const scope = options.global ? "any project" : "this project";
|
|
1332
|
+
console.log(`\n The agent can now run ${chalk.cyan("/docker-doctor")} to scan and triage ${scope}.`);
|
|
1333
|
+
}
|
|
1325
1334
|
process.exitCode = result.failed.length > 0 ? 1 : 0;
|
|
1326
1335
|
});
|
|
1327
1336
|
const rules = program.command("rules").description("manage and list configuration rules");
|