@igorlau/dotagents 1.0.17 → 1.0.19

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.
@@ -1 +1 @@
1
- {"commit":"386b124"}
1
+ {"commit":"6f88dc2"}
package/dist/commands.js CHANGED
@@ -7,7 +7,7 @@ import { loadCatalog, loadScaffold } from "./catalog.js";
7
7
  import { repoRoot } from "./git.js";
8
8
  import { fromStored, globalManifestPath, hash, projectManifestPath, readManifest, toStored, writeManifest, } from "./manifest.js";
9
9
  import { claudeHome, codexHome, configDir, packageRoot } from "./paths.js";
10
- import { planInstall, planScaffold } from "./targets.js";
10
+ import { planInstall, planScaffold, projectClaudeRulesFile } from "./targets.js";
11
11
  export const DEFAULT_SOURCE = "@igorlau/dotagents@latest";
12
12
  export const UP_TO_DATE = "Already up to date.";
13
13
  export const NOTHING_TO_UNINSTALL = "Nothing to uninstall.";
@@ -88,6 +88,10 @@ function run(scope, agents, options, uninstall = false) {
88
88
  report(result, options.dryRun);
89
89
  if (options.dryRun)
90
90
  return result.problems.length === 0;
91
+ const claudeRulesFile = scope.root === undefined ? undefined : projectClaudeRulesFile(scope.root);
92
+ if (!uninstall && result.changes.some((change) => change.action === "remove" && change.path === claudeRulesFile)) {
93
+ log("Claude Code now reads the rules from AGENTS.md.");
94
+ }
91
95
  if (result.entries.length === 0) {
92
96
  fs.rmSync(scope.manifestPath, { force: true });
93
97
  }
@@ -196,7 +200,15 @@ export function doctor(cwd) {
196
200
  for (const scope of scopes) {
197
201
  const manifest = readManifest(scope.manifestPath);
198
202
  log(`Checking ${describe(scope)} (dotagents ${manifest.version}, agents: ${manifest.agents.join(", ")})`);
199
- for (const entry of fromStored(manifest.entries, scope.root)) {
203
+ const entries = fromStored(manifest.entries, scope.root);
204
+ if (version() === manifest.version) {
205
+ const installed = new Set(entries.map((entry) => entry.path));
206
+ for (const op of planInstall(loadCatalog(), scope.mode, manifest.agents, scope.root)) {
207
+ if (!installed.has(op.path))
208
+ issues.push(`${op.path}: not installed. Run \`dotagents update\`.`);
209
+ }
210
+ }
211
+ for (const entry of entries) {
200
212
  if (!fs.existsSync(entry.path)) {
201
213
  issues.push(`${entry.path}: missing. Run \`dotagents update\`.`);
202
214
  continue;
@@ -296,6 +308,19 @@ export function setCheckHook(cwd, enabled, dryRun) {
296
308
  export function selfUpdate(args) {
297
309
  const source = readSource();
298
310
  log(`Running the latest dotagents from ${source}:`);
299
- const result = spawnSync("npx", ["--yes", "--prefer-online", source, "update", ...args], { stdio: "inherit" });
311
+ const npx = npxCommand(["--yes", "--prefer-online", source, "update", ...args]);
312
+ const result = spawnSync(npx.command, npx.args, { shell: npx.shell, stdio: "inherit" });
300
313
  return result.status === 0;
301
314
  }
315
+ /**
316
+ * Builds the command that starts `npx`. On Windows, `npx` is `npx.cmd`, which Node starts only through a shell,
317
+ * so the arguments go into one quoted command line. `cmd.exe` still reads `"` and `%` inside quotes, so those throw.
318
+ */
319
+ export function npxCommand(args, platform = process.platform) {
320
+ if (platform !== "win32")
321
+ return { args, command: "npx", shell: false };
322
+ const unsafe = args.find((arg) => /["%]/.test(arg));
323
+ if (unsafe !== undefined)
324
+ throw new Error(`Cannot pass ${unsafe} to npx on Windows. Remove the " and % characters.`);
325
+ return { args: [], command: ["npx", ...args.map((arg) => `"${arg}"`)].join(" "), shell: true };
326
+ }
package/dist/targets.js CHANGED
@@ -22,15 +22,14 @@ function layout(mode, root, pending) {
22
22
  }
23
23
  // Copilot reads AGENTS.md too, so both agents share one block.
24
24
  const agentsMd = path.join(root, "AGENTS.md");
25
- const claudeMd = path.join(root, "CLAUDE.md");
26
- const claudeRulesInAgentsMd = importsAgentsMd(pending.find((op) => op.path === claudeMd)?.content ?? readIfExists(claudeMd));
25
+ const claudeRulesInAgentsMd = claudeReadsAgentsMd(root, pending);
27
26
  return {
28
27
  skillDirs: {
29
28
  claude: path.join(root, ".claude", "skills"),
30
29
  codex: path.join(root, ".agents", "skills"),
31
30
  copilot: path.join(root, ".agents", "skills"),
32
31
  },
33
- claudeRules: claudeRulesInAgentsMd ? agentsMd : path.join(root, ".claude", "rules", RULES_FILE),
32
+ claudeRules: claudeRulesInAgentsMd ? agentsMd : projectClaudeRulesFile(root),
34
33
  claudeRulesInAgentsMd,
35
34
  codexRules: agentsMd,
36
35
  copilotRules: agentsMd,
@@ -68,6 +67,18 @@ export function planInstall(catalog, mode, agents, root = "", pending = []) {
68
67
  add({ kind: "block", path: target.copilotRules, content: rules });
69
68
  return [...ops.values()];
70
69
  }
70
+ /** The rules file for Claude Code in a project install, when Claude Code does not read AGENTS.md. */
71
+ export function projectClaudeRulesFile(root) {
72
+ return path.join(root, ".claude", "rules", RULES_FILE);
73
+ }
74
+ // Claude Code reads AGENTS.md when the project has no CLAUDE.md or CLAUDE.local.md: https://code.claude.com/docs/en/memory#agents-md
75
+ function claudeReadsAgentsMd(root, pending) {
76
+ const claudeMdPath = path.join(root, "CLAUDE.md");
77
+ const claudeMd = pending.find((op) => op.path === claudeMdPath)?.content ?? readIfExists(claudeMdPath);
78
+ if (claudeMd !== undefined)
79
+ return importsAgentsMd(claudeMd);
80
+ return !["CLAUDE.local.md", path.join(".claude", "CLAUDE.md")].some((rel) => fs.existsSync(path.join(root, rel)));
81
+ }
71
82
  /** Reports whether the repository at `root` has a CLAUDE.md that does not import AGENTS.md. */
72
83
  export function claudeMdSkipsAgentsMd(root) {
73
84
  const claudeMd = readIfExists(path.join(root, "CLAUDE.md"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igorlau/dotagents",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Install a curated set of agent skills and rules into Claude Code, Codex, and GitHub Copilot.",
5
5
  "license": "MIT",
6
6
  "repository": {