@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.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-BjT5tN_H.mjs";
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-BuyXvVl3.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, projectRoot) => {
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
  });
@@ -827,7 +828,13 @@ const printScoreBox = async (score, label, categoryIssueCounts, warningsCount, e
827
828
  else if (score >= 75) scoreColor = chalk.yellow.bold;
828
829
  else if (score >= 50) scoreColor = chalk.magenta.bold;
829
830
  const whaleLines = getWhaleMascot(score, scoreColor);
830
- const shareUrl = `https://docker-doctor.vercel.app/share?s=${score}&w=${warningsCount}&e=${errorsCount}`;
831
+ const shareUrl = `https://docker-doctor.vercel.app/share?${new URLSearchParams({
832
+ e: String(errorsCount),
833
+ s: String(score),
834
+ utm_medium: "terminal",
835
+ utm_source: "cli",
836
+ w: String(warningsCount)
837
+ }).toString()}`;
831
838
  if (shouldAnimate) {
832
839
  const frameCount = 20;
833
840
  const frameDelay = 15;
@@ -1084,7 +1091,7 @@ const runAgentHandoff = async (context) => {
1084
1091
  return;
1085
1092
  }
1086
1093
  const agentId = launchable[choice];
1087
- const installResult = await installSkillForAgents([agentId], context.rootDir);
1094
+ const installResult = await installSkillForAgents([agentId], { projectRoot: context.rootDir });
1088
1095
  if (installResult && installResult.installed.length > 0) console.log(`\n ${chalk.green("✔")} Installed the docker-doctor skill for ${agentDisplayName(agentId)}`);
1089
1096
  console.log(`\n Handing off to ${agentDisplayName(agentId)}...\n`);
1090
1097
  if (!await launchAgent(agentId, payload)) {
@@ -1133,7 +1140,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1133
1140
  try {
1134
1141
  const content = await fs.readFile(fullPath, "utf-8");
1135
1142
  fileContents[df] = content;
1136
- return runDockerfileRules(parseDockerfile(content), df, projectFilesList, rulesConfig);
1143
+ const instructions = parseDockerfile(content);
1144
+ return runDockerfileRules(instructions, df, projectFilesList, rulesConfig);
1137
1145
  } catch (error) {
1138
1146
  const msg = error instanceof Error ? error.message : String(error);
1139
1147
  console.error(`Failed to analyze Dockerfile ${df}: ${msg}`);
@@ -1150,7 +1158,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1150
1158
  try {
1151
1159
  const content = await fs.readFile(fullPath, "utf-8");
1152
1160
  fileContents[cf] = content;
1153
- return runComposeRules(parseCompose(content, cf), cf, rulesConfig);
1161
+ const composeObj = parseCompose(content, cf);
1162
+ return runComposeRules(composeObj, cf, rulesConfig);
1154
1163
  } catch (error) {
1155
1164
  const msg = error instanceof Error ? error.message : String(error);
1156
1165
  console.error(`Failed to analyze Compose file ${cf}: ${msg}`);
@@ -1297,7 +1306,7 @@ const resolveInstallAgents = async (requested) => {
1297
1306
  selected: detectedSet.has(agent)
1298
1307
  })))).map((i) => choices[i]);
1299
1308
  };
1300
- 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) => {
1301
1310
  if (!getSkillSourceDirectory()) {
1302
1311
  console.error("Bundled skill not found — this looks like a broken installation.");
1303
1312
  process.exit(1);
@@ -1308,14 +1317,20 @@ program.command("install").description("install the Docker Doctor agent skill fo
1308
1317
  console.log("Nothing selected — skipped.");
1309
1318
  return;
1310
1319
  }
1311
- const result = await installSkillForAgents(agents, process.cwd());
1320
+ const result = await installSkillForAgents(agents, {
1321
+ global: options.global,
1322
+ projectRoot: process.cwd()
1323
+ });
1312
1324
  if (!result) {
1313
1325
  console.error("Failed to install the skill.");
1314
1326
  process.exit(1);
1315
1327
  }
1316
1328
  for (const installed of result.installed) console.log(` ${chalk.green("✔")} ${agentDisplayName(installed.agent)} → ${installed.path}`);
1317
1329
  for (const failed of result.failed) console.log(` ${chalk.red("✖")} ${agentDisplayName(failed.agent)}: ${failed.error}`);
1318
- if (result.installed.length > 0) console.log(`\n The agent can now run ${chalk.cyan("/docker-doctor")} to scan and triage this project.`);
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
+ }
1319
1334
  process.exitCode = result.failed.length > 0 ? 1 : 0;
1320
1335
  });
1321
1336
  const rules = program.command("rules").description("manage and list configuration rules");