From 22c91250fa8af9f2ba3e39aa4babe5d5097e1a24 Mon Sep 17 00:00:00 2001 From: opencode Date: Thu, 27 Aug 2026 04:35:47 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20Issue=20#12=20=E2=80=94=20ac.m?= =?UTF-8?q?js=20no=20longer=20silently=20falls=20back=20to=20source=20repo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.) --- tools/ac.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/ac.mjs b/tools/ac.mjs index 09da9fa..b791e1c 100755 --- a/tools/ac.mjs +++ b/tools/ac.mjs @@ -46,7 +46,13 @@ function resolveRoot() { const cwd = process.cwd(); if (existsSync(join(cwd, 'agent-context.config.json')) || existsSync(join(cwd, 'agent-context'))) return join(cwd, 'agent-context'); - return new URL('../agent-context', import.meta.url).pathname; // source-repo fallback + // Issue #12 fix: never silently fall back to the source repo — that pollutes + // the package install (e.g. npx cache) with user data. Require an initialized + // project in cwd instead. + process.stderr.write("agent-context가 초기화되지 않았습니다. 먼저 'agent-context-init.mjs --yes' 를 실행하세요.\n"); + process.stderr.write("(agent-context not initialized in cwd; run 'agent-context-init.mjs --yes' first.)\n"); + process.stderr.write("cwd: " + cwd + "\n"); + process.exit(1); } function pluralDir(type) { const map = { issue: 'bugs', bug: 'bugs', learning: 'learnings', idea: 'ideas', note: 'notes',