@docker-doctor/cli 0.3.3 → 0.4.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/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_src = require('./src-DfNUTuMC.cjs');
2
+ const require_src = require('./src-mfI8Ifa8.cjs');
3
3
  let node_fs_promises = require("node:fs/promises");
4
4
  node_fs_promises = require_src.__toESM(node_fs_promises, 1);
5
5
  let node_path = require("node:path");
@@ -710,13 +710,14 @@ const getSkillSourceDirectory = () => {
710
710
  for (const candidate of candidates) if (node_fs.default.existsSync(node_path.default.join(candidate, agent_install.SKILL_MANIFEST_FILE))) return candidate;
711
711
  return null;
712
712
  };
713
- const installSkillForAgents = async (agents, projectRoot) => {
713
+ const installSkillForAgents = async (agents, options) => {
714
714
  const source = getSkillSourceDirectory();
715
715
  if (!source) return null;
716
716
  try {
717
717
  return await (0, agent_install.installSkillsFromSource)({
718
718
  agents,
719
- cwd: projectRoot,
719
+ cwd: options.projectRoot,
720
+ global: options.global,
720
721
  mode: "copy",
721
722
  source
722
723
  });
@@ -834,7 +835,13 @@ const printScoreBox = async (score, label, categoryIssueCounts, warningsCount, e
834
835
  else if (score >= 75) scoreColor = chalk.yellow.bold;
835
836
  else if (score >= 50) scoreColor = chalk.magenta.bold;
836
837
  const whaleLines = getWhaleMascot(score, scoreColor);
837
- const shareUrl = `https://docker-doctor.vercel.app/share?s=${score}&w=${warningsCount}&e=${errorsCount}`;
838
+ const shareUrl = `https://docker-doctor.vercel.app/share?${new URLSearchParams({
839
+ e: String(errorsCount),
840
+ s: String(score),
841
+ utm_medium: "terminal",
842
+ utm_source: "cli",
843
+ w: String(warningsCount)
844
+ }).toString()}`;
838
845
  if (shouldAnimate) {
839
846
  const frameCount = 20;
840
847
  const frameDelay = 15;
@@ -1091,7 +1098,7 @@ const runAgentHandoff = async (context) => {
1091
1098
  return;
1092
1099
  }
1093
1100
  const agentId = launchable[choice];
1094
- const installResult = await installSkillForAgents([agentId], context.rootDir);
1101
+ const installResult = await installSkillForAgents([agentId], { projectRoot: context.rootDir });
1095
1102
  if (installResult && installResult.installed.length > 0) console.log(`\n ${chalk.green("✔")} Installed the docker-doctor skill for ${agentDisplayName(agentId)}`);
1096
1103
  console.log(`\n Handing off to ${agentDisplayName(agentId)}...\n`);
1097
1104
  if (!await launchAgent(agentId, payload)) {
@@ -1140,7 +1147,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1140
1147
  try {
1141
1148
  const content = await node_fs_promises.default.readFile(fullPath, "utf-8");
1142
1149
  fileContents[df] = content;
1143
- return require_src.runDockerfileRules(require_src.parseDockerfile(content), df, projectFilesList, rulesConfig);
1150
+ const instructions = require_src.parseDockerfile(content);
1151
+ return require_src.runDockerfileRules(instructions, df, projectFilesList, rulesConfig);
1144
1152
  } catch (error) {
1145
1153
  const msg = error instanceof Error ? error.message : String(error);
1146
1154
  console.error(`Failed to analyze Dockerfile ${df}: ${msg}`);
@@ -1157,7 +1165,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1157
1165
  try {
1158
1166
  const content = await node_fs_promises.default.readFile(fullPath, "utf-8");
1159
1167
  fileContents[cf] = content;
1160
- return require_src.runComposeRules(require_src.parseCompose(content, cf), cf, rulesConfig);
1168
+ const composeObj = require_src.parseCompose(content, cf);
1169
+ return require_src.runComposeRules(composeObj, cf, rulesConfig);
1161
1170
  } catch (error) {
1162
1171
  const msg = error instanceof Error ? error.message : String(error);
1163
1172
  console.error(`Failed to analyze Compose file ${cf}: ${msg}`);
@@ -1304,7 +1313,7 @@ const resolveInstallAgents = async (requested) => {
1304
1313
  selected: detectedSet.has(agent)
1305
1314
  })))).map((i) => choices[i]);
1306
1315
  };
1307
- 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) => {
1316
+ 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) => {
1308
1317
  if (!getSkillSourceDirectory()) {
1309
1318
  console.error("Bundled skill not found — this looks like a broken installation.");
1310
1319
  process.exit(1);
@@ -1315,14 +1324,20 @@ program.command("install").description("install the Docker Doctor agent skill fo
1315
1324
  console.log("Nothing selected — skipped.");
1316
1325
  return;
1317
1326
  }
1318
- const result = await installSkillForAgents(agents, process.cwd());
1327
+ const result = await installSkillForAgents(agents, {
1328
+ global: options.global,
1329
+ projectRoot: process.cwd()
1330
+ });
1319
1331
  if (!result) {
1320
1332
  console.error("Failed to install the skill.");
1321
1333
  process.exit(1);
1322
1334
  }
1323
1335
  for (const installed of result.installed) console.log(` ${chalk.green("✔")} ${agentDisplayName(installed.agent)} → ${installed.path}`);
1324
1336
  for (const failed of result.failed) console.log(` ${chalk.red("✖")} ${agentDisplayName(failed.agent)}: ${failed.error}`);
1325
- if (result.installed.length > 0) console.log(`\n The agent can now run ${chalk.cyan("/docker-doctor")} to scan and triage this project.`);
1337
+ if (result.installed.length > 0) {
1338
+ const scope = options.global ? "any project" : "this project";
1339
+ console.log(`\n The agent can now run ${chalk.cyan("/docker-doctor")} to scan and triage ${scope}.`);
1340
+ }
1326
1341
  process.exitCode = result.failed.length > 0 ? 1 : 0;
1327
1342
  });
1328
1343
  const rules = program.command("rules").description("manage and list configuration rules");