Problem
ArkEnv still has scattered ad-hoc console.* calls and manually-prefixed log strings in several production packages. PR #1294 introduced shared log helpers in @arkenv/build/log.ts, but that placement creates an unnecessary dependency footprint (e.g. pulling chokidar into @arkenv/bun-plugin consumers) and splits formatting utilities away from @repo/utils where styleText, indent, and ArkEnvError already live.
Already done (do not redo)
Scope — Phase 1 (v1)
1. Relocate log helpers to @repo/utils
Move log helper functions from @arkenv/build/log.ts to @repo/utils (e.g. log-helpers.ts):
BUILD_PREFIX, WATCHER_PREFIX
formatBuildError, logBuildWarning, logBuildError, logWatcherError
- Extend with any helpers needed for remaining call sites (e.g. logging a secondary error detail line)
Delete @arkenv/build/log entirely — no re-exports. The ./log subpath was added in #1294 (@arkenv/build@0.0.1), has no external consumers, and is safe to remove pre-v1.0 release.
2. Per-package migration rules
| Package |
Approach |
@arkenv/bun-plugin |
Bundle log helpers from @repo/utils via alwaysBundle. Zero runtime deps — do not depend on @arkenv/build. |
@arkenv/nextjs |
Bundle log helpers from @repo/utils via alwaysBundle. Update imports currently using @arkenv/build or @arkenv/build/log. |
@arkenv/nuxt |
Bundle log helpers from @repo/utils via alwaysBundle. Update imports currently using @arkenv/build. |
@arkenv/build |
Import log helpers directly from @repo/utils internally. Remove log.ts entry point and ./log export from package.json. |
arkenv CLI |
LoggerPort only. Instantiate a barebones TextReporter/LoggerPort fallback for unhandled rejections in index.ts when no global logger exists. Never import from @arkenv/build. |
| Scaffold generated script |
Leave console.error. Generated user-run scripts should stay vanilla Node. |
3. Remaining call sites to migrate
Build / integration packages
@arkenv/bun-plugin — schema load failure uses raw console.error
@arkenv/nextjs — validation failure still prints error body via raw console.error after logBuildError header
CLI (arkenv package)
injection.ts — dts append failure uses raw console.error
index.ts — unhandled rejection/exception fallbacks when no global logger is set
node-project-scanner.adapter.ts — git-not-installed message uses raw console.debug
Explicitly excluded
scaffold/executor.ts — generated script console.error stays as-is
Constraints
- Do not change
ArkEnvError throw formatting or the EnvIssue system.
- Do not introduce a new logging package — use existing
@repo/utils.
- Do not add
@arkenv/build as a runtime dependency to @arkenv/bun-plugin or arkenv CLI.
Implementation order
- Add log helpers to
@repo/utils (+ tests)
- Switch
@arkenv/build to utils, delete ./log export
- Migrate
nextjs, nuxt, bun-plugin call sites
- CLI
LoggerPort fallback + remaining paths
Out of scope — Phase 2
Tracked in #1300 (v1): injectable logger API, log levels, silent mode, unified abstraction across packages.
Acceptance criteria
Agent brief
See the single consolidated agent brief comment on this issue for the authoritative implementation spec.
Target branch
v1
Problem
ArkEnv still has scattered ad-hoc
console.*calls and manually-prefixed log strings in several production packages. PR #1294 introduced shared log helpers in@arkenv/build/log.ts, but that placement creates an unnecessary dependency footprint (e.g. pullingchokidarinto@arkenv/bun-pluginconsumers) and splits formatting utilities away from@repo/utilswherestyleText,indent, andArkEnvErroralready live.Already done (do not redo)
EnvIssue,ArkEnvError,formatIssues,safeArkEnv, credential redaction in@repo/utils.@arkenv/nextjs,@arkenv/nuxt, and@arkenv/buildwatcher paths — to be relocated to@repo/utilsin this issue.Scope — Phase 1 (v1)
1. Relocate log helpers to
@repo/utilsMove log helper functions from
@arkenv/build/log.tsto@repo/utils(e.g.log-helpers.ts):BUILD_PREFIX,WATCHER_PREFIXformatBuildError,logBuildWarning,logBuildError,logWatcherErrorDelete
@arkenv/build/logentirely — no re-exports. The./logsubpath was added in #1294 (@arkenv/build@0.0.1), has no external consumers, and is safe to remove pre-v1.0 release.2. Per-package migration rules
@arkenv/bun-plugin@repo/utilsviaalwaysBundle. Zero runtime deps — do not depend on@arkenv/build.@arkenv/nextjs@repo/utilsviaalwaysBundle. Update imports currently using@arkenv/buildor@arkenv/build/log.@arkenv/nuxt@repo/utilsviaalwaysBundle. Update imports currently using@arkenv/build.@arkenv/build@repo/utilsinternally. Removelog.tsentry point and./logexport frompackage.json.arkenvCLILoggerPortonly. Instantiate a barebonesTextReporter/LoggerPortfallback for unhandled rejections inindex.tswhen no global logger exists. Never import from@arkenv/build.console.error. Generated user-run scripts should stay vanilla Node.3. Remaining call sites to migrate
Build / integration packages
@arkenv/bun-plugin— schema load failure uses rawconsole.error@arkenv/nextjs— validation failure still prints error body via rawconsole.errorafterlogBuildErrorheaderCLI (
arkenvpackage)injection.ts— dts append failure uses rawconsole.errorindex.ts— unhandled rejection/exception fallbacks when no global logger is setnode-project-scanner.adapter.ts— git-not-installed message uses rawconsole.debugExplicitly excluded
scaffold/executor.ts— generated scriptconsole.errorstays as-isConstraints
ArkEnvErrorthrow formatting or theEnvIssuesystem.@repo/utils.@arkenv/buildas a runtime dependency to@arkenv/bun-pluginorarkenvCLI.Implementation order
@repo/utils(+ tests)@arkenv/buildto utils, delete./logexportnextjs,nuxt,bun-plugincall sitesLoggerPortfallback + remaining pathsOut of scope — Phase 2
Tracked in #1300 (v1): injectable logger API, log levels, silent mode, unified abstraction across packages.
Acceptance criteria
@repo/utilsand are exported from its index@arkenv/build/logsubpath deleted — no re-exports,log.tsentry removed from tsdown config andpackage.jsonexports@arkenv/buildwatcher paths import log helpers from@repo/utils@arkenv/bun-plugin,@arkenv/nextjs,@arkenv/nuxtbundle log helpers from@repo/utils— no@arkenv/builddependency added for logging[ArkEnv]or[ArkEnv Watcher]string literals outside@repo/utilslog helpers@arkenv/nextjsvalidation failure output uses log helpers end-to-end (no rawconsole.errorfor the error body)injection.ts,index.ts,node-project-scanner.adapter.ts) route throughLoggerPort— no ad-hocconsole.*console.errorpreserved)Agent brief
See the single consolidated agent brief comment on this issue for the authoritative implementation spec.
Target branch
v1