Skip to content

fix(pro-installer): handle flat .md files when applying path placeholders - #19

Open
ifdev25 wants to merge 1 commit into
Melvynx:mainfrom
ifdev25:fix/pro-installer-enotdir-flat-md
Open

fix(pro-installer): handle flat .md files when applying path placeholders#19
ifdev25 wants to merge 1 commit into
Melvynx:mainfrom
ifdev25:fix/pro-installer-enotdir-flat-md

Conversation

@ifdev25

@ifdev25 ifdev25 commented May 17, 2026

Copy link
Copy Markdown

Summary

copyAgentCategory calls replacePathPlaceholdersInDir on the copied destination, but the destination is a file when the source entry is a flat .md (the current layout of aiblueprint-cli-premium/agents-config/agents/). replacePathPlaceholdersInDir runs fs.readdir on its argument, which throws ENOTDIR and breaks agents pro setup:

Failed to install premium configs: ENOTDIR: not a directory,
scandir '~/.agents/agents/code-architect.md'

This was reproducible on Windows running npx aiblueprint-cli@latest agents pro setup against the current premium repo.

Fix

Switch to applyPathPlaceholders — the existing helper in agents-installer.ts that branches on file vs directory (already used by installCategoryToAgents). Export it so pro-installer.ts can reuse it.

Diff is intentionally minimal:

  • src/lib/agents-installer.ts: export applyPathPlaceholders (+1/-1)
  • src/lib/pro-installer.ts: import + use the helper, export copyAgentCategory for the test (+3/-2)
  • tests/pro-installer.test.ts: new regression test file (+122)

Test plan

  • Added tests/pro-installer.test.ts with 3 cases:
    • Regression: flat .md source entry — fails with ENOTDIR before the fix, passes after.
    • Legacy layout: directory-shaped entry still works (no regression on {CLAUDE_PATH} substitution inside).
    • Skip path: existing real (non-symlink) entry in claudeDir is correctly skipped.
  • Verified the regression test fails on main with exactly the original error (ENOTDIR: scandir '...\agents\agents\code-architect.md') by reverting only the fix line.
  • bun test:run103 passed / 9 failed (the 9 failures are pre-existing Windows path/symlink-permission issues unrelated to this change; same counts before and after).
  • bun run build — OK.

…ders

copyAgentCategory always called replacePathPlaceholdersInDir on the
copied destination, but the destination is a file when the source entry
is a flat .md (current layout of aiblueprint-cli-premium/agents-config/agents).
replacePathPlaceholdersInDir runs fs.readdir on its argument, which
throws ENOTDIR and breaks `agents pro setup`:

    Failed to install premium configs: ENOTDIR: not a directory,
    scandir '~/.agents/agents/code-architect.md'

Switch to applyPathPlaceholders, the existing helper in agents-installer
that branches on file vs directory (already used by
installCategoryToAgents). Export it so pro-installer can reuse it.

Adds a regression test that reproduces the original ENOTDIR error and
covers the legacy directory layout plus the "skip when claudeDir has a
real entry" path.

@horde-dimitri horde-dimitri left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hermes Agent Review

Verdict: Approved

Reviewed the flat .md pro-installer placeholder handling. The change correctly routes flat files through applyPathPlaceholders() instead of directory traversal, and the regression tests cover the previous ENOTDIR path plus skip behavior for real user files. No blocking correctness, security, or maintainability issues found.


Reviewed by Hermes Agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants