Skip to content

fix(cli): prioritize user iii config lookup#693

Open
HWliao wants to merge 1 commit into
rohitg00:mainfrom
HWliao:fix/iii-config-lookup-priority
Open

fix(cli): prioritize user iii config lookup#693
HWliao wants to merge 1 commit into
rohitg00:mainfrom
HWliao:fix/iii-config-lookup-priority

Conversation

@HWliao
Copy link
Copy Markdown

@HWliao HWliao commented May 28, 2026

Summary

  • Extract iii-config lookup into a tested resolver with precedence: AGENTMEMORY_III_CONFIG > cwd > ~/.agentmemory > bundled config.
  • Document the engine config lookup order and Windows path guidance.
  • Replace POSIX-only build asset copying with a cross-platform Node script so Windows builds work.
  • Ignore local .idea/.opencode workspace folders.

Verification

  • npx vitest run test/cli-iii-config.test.ts
  • npm run build
  • npm install -g . and manual startup verification on Windows

Note: I also ran npm test locally; unrelated failures occurred from local ~/.agentmemory/.env provider settings and existing Windows path-sensitive tests, while the new targeted test passed.

Summary by CodeRabbit

  • Documentation

    • Added configuration lookup guide explaining the ordered search locations for config files (environment variable, current directory, home directory, then bundled default) with cross-platform file path configuration guidance.
  • Improvements

    • Enhanced CLI help text formatting and clarity for environment variable documentation.

Review Change Stack

@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

Someone is attempting to deploy a commit to the rohitg00's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1a6c6815-55ef-4cba-9296-d1615dfa6094

📥 Commits

Reviewing files that changed from the base of the PR and between 37fff9a and 395137f.

📒 Files selected for processing (7)
  • .gitignore
  • README.md
  • package.json
  • scripts/copy-build-assets.mjs
  • src/cli.ts
  • src/cli/iii-config.ts
  • test/cli-iii-config.test.ts

📝 Walkthrough

Walkthrough

This PR extracts configuration file lookup logic from the CLI into a dedicated module with a formal contract, updates the CLI to use the new resolver, refactors build asset copying into a standalone script, and documents the configuration search order in the README.

Changes

Config resolution refactoring and build extraction

Layer / File(s) Summary
Config lookup contract and resolution functions
src/cli/iii-config.ts
IiiConfigLookupOptions type and iiiConfigCandidates() establish ordered candidate paths for iii-config.yaml across environment variable, cwd, home, and bundled locations. resolveIiiConfigPath() returns the first candidate matching the provided exists predicate.
Config resolution test suite
test/cli-iii-config.test.ts
Vitest suite validates candidate ordering and resolution precedence, verifying environment override, cwd/home/bundled priority, and fallback to empty string when no config exists.
CLI integration of config resolver
src/cli.ts
CLI imports resolveIiiConfigPath() and uses it to locate config instead of inline candidate scanning. Help text for AGENTMEMORY_III_CONFIG is reformatted, and status output assembly for flag rows is restructured via forEach.
Build asset copying extraction
scripts/copy-build-assets.mjs, package.json
New copy-build-assets.mjs script copies config templates, compose examples, and viewer assets into dist/ using parallel operations. Build script in package.json delegates asset copying to this script instead of inline shell commands.
Config lookup documentation
README.md
New "Engine Config Lookup" section documents the ordered search precedence for iii-config.yaml and provides guidance for absolute path configuration in user directories.
IDE and development metadata
.gitignore
.idea directory is added to ignored entries for IDE project metadata.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • rohitg00/agentmemory#686: Both PRs modify the config file resolution logic in src/cli.ts, with this PR extracting the lookup into a dedicated module while PR #686 modifies the candidate precedence directly.

Poem

A rabbit refactors with care,
Config paths scattered everywhere,
Now ordered and neat in a module so sweet,
With tests that verify each step with flair,
Build assets copy without despair,
And .idea rests in the gitignore lair! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the primary change: extracting and prioritizing the iii-config lookup mechanism with a defined precedence order.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant