@docker-doctor/cli 0.3.4 → 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-DWIAE2Ni.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
  });
@@ -1097,7 +1098,7 @@ const runAgentHandoff = async (context) => {
1097
1098
  return;
1098
1099
  }
1099
1100
  const agentId = launchable[choice];
1100
- const installResult = await installSkillForAgents([agentId], context.rootDir);
1101
+ const installResult = await installSkillForAgents([agentId], { projectRoot: context.rootDir });
1101
1102
  if (installResult && installResult.installed.length > 0) console.log(`\n ${chalk.green("✔")} Installed the docker-doctor skill for ${agentDisplayName(agentId)}`);
1102
1103
  console.log(`\n Handing off to ${agentDisplayName(agentId)}...\n`);
1103
1104
  if (!await launchAgent(agentId, payload)) {
@@ -1146,7 +1147,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1146
1147
  try {
1147
1148
  const content = await node_fs_promises.default.readFile(fullPath, "utf-8");
1148
1149
  fileContents[df] = content;
1149
- 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);
1150
1152
  } catch (error) {
1151
1153
  const msg = error instanceof Error ? error.message : String(error);
1152
1154
  console.error(`Failed to analyze Dockerfile ${df}: ${msg}`);
@@ -1163,7 +1165,8 @@ const runRulesEngine = async (rootDir, project, rulesConfig, projectFilesList, f
1163
1165
  try {
1164
1166
  const content = await node_fs_promises.default.readFile(fullPath, "utf-8");
1165
1167
  fileContents[cf] = content;
1166
- 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);
1167
1170
  } catch (error) {
1168
1171
  const msg = error instanceof Error ? error.message : String(error);
1169
1172
  console.error(`Failed to analyze Compose file ${cf}: ${msg}`);
@@ -1310,7 +1313,7 @@ const resolveInstallAgents = async (requested) => {
1310
1313
  selected: detectedSet.has(agent)
1311
1314
  })))).map((i) => choices[i]);
1312
1315
  };
1313
- 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) => {
1314
1317
  if (!getSkillSourceDirectory()) {
1315
1318
  console.error("Bundled skill not found — this looks like a broken installation.");
1316
1319
  process.exit(1);
@@ -1321,14 +1324,20 @@ program.command("install").description("install the Docker Doctor agent skill fo
1321
1324
  console.log("Nothing selected — skipped.");
1322
1325
  return;
1323
1326
  }
1324
- const result = await installSkillForAgents(agents, process.cwd());
1327
+ const result = await installSkillForAgents(agents, {
1328
+ global: options.global,
1329
+ projectRoot: process.cwd()
1330
+ });
1325
1331
  if (!result) {
1326
1332
  console.error("Failed to install the skill.");
1327
1333
  process.exit(1);
1328
1334
  }
1329
1335
  for (const installed of result.installed) console.log(` ${chalk.green("✔")} ${agentDisplayName(installed.agent)} → ${installed.path}`);
1330
1336
  for (const failed of result.failed) console.log(` ${chalk.red("✖")} ${agentDisplayName(failed.agent)}: ${failed.error}`);
1331
- 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
+ }
1332
1341
  process.exitCode = result.failed.length > 0 ? 1 : 0;
1333
1342
  });
1334
1343
  const rules = program.command("rules").description("manage and list configuration rules");