You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
npm run cli reads the checkout's .loopway, not the directory you ran it from #508
Found while testing #502. Matthew saw no updates: under npm workspaces, npm run cli sets INIT_CWD to the checkout root, so projectDir in packages/cli/src/index.ts resolved the checkout's own .loopway, not the scratch project. #502 changed the docs to say "run node <checkout>/packages/cli/dist/index.js from your project". That works, but it's easy to get wrong.
What
loopway finds its project the way git finds a repo: it walks up from process.cwd() to the nearest directory holding a .loopway/ folder. No INIT_CWD fallback. --project <dir> overrides the search. If no .loopway/ is found, it exits with a message naming where it looked.
On startup, the log and the TUI header print the resolved project path, so a wrong project is obvious.
Give the checkout a dev entry point that works from anywhere, e.g. npm link -w @loopway/cli documented in docs/developing.md, so loopway on your PATH is your checkout's build. Remove or fix the root cli script so it can't silently read the wrong project.
How to test it (you, locally)
npm run build && npm link -w @loopway/cli.
cd into a scratch project that has .loopway/dev.md, or into a subdirectory of one, and run loopway --no-tui. The first line names that project's .loopway.
cd /tmp && loopway: it exits saying no .loopway/ was found above /tmp.
loopway --project <scratch> from anywhere uses that project.
Done when
Tests for the walk-up, --project and the not-found message.
npm test, npm run typecheck, npm run lint and npm run format:check pass.
`INIT_CWD` is an environment variable that npm sets when you run `npm run <script>`: it holds the directory you ran npm from. Under npm workspaces, `npm run cli` from the checkout root ran the script with that root as `INIT_CWD`, and the old code used `process.env.INIT_CWD || process.cwd()` as the project, so it read the checkout's own `.loopway` instead of your scratch project. "No fallback" means loopway no longer reads that variable at all: the project comes only from `process.cwd()` walking up, or `--project`. PR #509 does that, and removes the root `cli` script.
I don't get how a walk up solves a problem here. I'm always running beside a .loopway directory. If we can't know that CWD why would a walk up find it?
You're right: the walk-up does not fix the #502 bug. That bug came from `npm run`: npm runs the script with its cwd at the checkout, not where you typed it, so `process.cwd()` was the wrong place too. That is why the old code reached for `INIT_CWD`, and why it read the checkout's `.loopway`. What fixes it in #509 is dropping that path: `loopway` on your PATH (`npm link -w @loopway/cli`) runs in your own cwd, and the root `cli` script is gone so nothing can silently run from the checkout.
The walk-up is the other bullet in the issue. It only matters when you run from a subdirectory of a project. If you always run beside .loopway, it changes nothing for you, and --project covers running from elsewhere. If you would rather keep this to "cwd must hold .loopway", I can drop the walk-up and keep the rest. Say so and I will.
Activity
mcwhittemore commentedon Nov 11, 2026
I don't get what
No INIT_CWD fallbackreally means. Where isINIT_CWDcoming from?mcwhittemore commentedon Nov 11, 2026
mcwhittemore commentedon Nov 11, 2026
I don't get how a walk up solves a problem here. I'm always running beside a
.loopwaydirectory. If we can't know that CWD why would a walk up find it?mcwhittemore commentedon Nov 11, 2026
The walk-up is the other bullet in the issue. It only matters when you run from a subdirectory of a project. If you always run beside
.loopway, it changes nothing for you, and--projectcovers running from elsewhere. If you would rather keep this to "cwd must hold.loopway", I can drop the walk-up and keep the rest. Say so and I will.mcwhittemore commentedon Nov 11, 2026
I think we can close this ticket for now. This is past where we are from a robustness POV.