Skip to content

fix: resolve Issue #12 — ac.mjs no longer silently falls back to source repo - #13

Merged
tak2-08 merged 1 commit into
mainfrom
fix/issue-12
Aug 27, 2026
Merged

fix: resolve Issue #12 — ac.mjs no longer silently falls back to source repo#13
tak2-08 merged 1 commit into
mainfrom
fix/issue-12

Conversation

@tak2-08

@tak2-08 tak2-08 commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #12, part (A) only — the critical data-pollution bug.

tools/ac.mjs resolveRoot() previously fell back to new URL('../agent-context', import.meta.url) when the current working directory had neither agent-context.config.json nor agent-context/. When invoked from a wrong/empty directory (e.g. by an automation script that didn't set cwd, or via npx), it silently wrote user entries into the package source (or npx cache) and regenerated index.json/graph.json — polluting the install.

Now resolveRoot() prints a clear bilingual error and process.exit(1) instead of falling back:

agent-context가 초기화되지 않았습니다. 먼저 'agent-context-init.mjs --yes' 를 실행하세요.
(agent-context not initialized in cwd; run 'agent-context-init.mjs --yes' first.)
cwd: <cwd>

Dogfooding from the repo root still works because the repo root itself contains agent-context.config.json + agent-context/ (cwd detection branch unchanged).

Verification

  • Repro (pre-fix): git show HEAD~1:tools/ac.mjs showed the silent new URL('../agent-context', ...).pathname fallback.
  • Post-fix: running ac.mjs from a clean dir with no project → exit code 1 + bilingual error; git status of the repo shows no pollution of agent-context/ (index.json/graph.json untouched, no new files).
  • Regression: cwd-with-project (repo root) still creates entries correctly.
  • node --check tools/ac.mjs passes.
  • node tools/e2e-workflow.mjs → all 6 steps pass.

Out of scope (filed as future work)

Part (B) of #12 (synonym dict expansion + search-lite padding/threshold) is not addressed here, per task scope.
The same silent directory fallback also exists in ac-watch.mjs and ac-fts.mjs (and many tools read the source agent-context.config.json when cwd has no project) — noted for a follow-up issue, not changed in this PR.

🤖 Generated with opencode

…ce repo

resolveRoot() previously returned new URL('../agent-context', import.meta.url)
when cwd had no project, polluting the package source (or npx cache) with
user data. Now it prints a clear bilingual error and exits 1, requiring an
initialized agent-context in cwd.

Repro: run ac.mjs outside a project dir -> exit 1 + error, source repo untouched.
e2e-workflow.mjs 6/6 still pass. (ac-watch.mjs/ac-fts.mjs share the pattern;
filed separately as future work.)
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.

agent-shared-context 이슈 리포트 (2026-08-27, 독립 벤치마크 기반 By Claude)

1 participant