nf build deletes the whole project when the output dir is . or a parent folder
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- bun, node.js, typescript
調査の方向性
Start with src/lib/utils/files.ts and the resetFolder call in src/action/actions/build.action.ts; trace how the client and server output directories are resolved before deletion. Check how out.dir is validated in libs/config/src/parse/validate-config.ts. Add coverage for unsafe paths, including ., a parent folder, and paths containing the entry file or assets; done means builds reject them before deleting project files.
索引モデルが issue の本文から書いたものです。
説明
Which package is this bug report for?
@nanoforge-dev/cli
Which command is this bug report for?
build
Issue description
nf build deletes the whole project when the output folder is . (or a parent folder). Before each build, resetFolder runs rmSync(join(directory, outDir), { recursive: true, force: true }) (src/lib/utils/files.ts#L14-L15, called from src/action/actions/build.action.ts#L139). Neither --client-out-dir/--server-out-dir nor the config's out.dir (libs/config/src/parse/validate-config.ts#L10, a bare z.string()) refuses ., .., an absolute path or a folder that holds the sources.
Steps to reproduce (reproduced with dist/nf.js on a throwaway project):
- A project with
nanoforge.config.ts(export default { type: "client" };),src/main.tsandassets/sprites/b.png. nf build -d <project> --client-out-dir .- The output is
ENOENT opening root directory "src"/Build of Client failed!, and the project folder is now empty: config,src/andassets/are gone.
Expected: the build refuses an output folder that is the project folder, one of its parents, outside the project, or one that contains the entry file or the assets folder, before anything is deleted. The same rule is checked on out.dir in @nanoforge-dev/config, and a test covers it.
Found during a read-only audit of main at e95b881 (2026-11-11).
Code sample
// nanoforge.config.ts
export default { type: "client" };
// then: nf build --client-out-dir . -> the project folder is emptied
Versions
- @nanoforge-dev/cli 3.0.1 (main, e95b881)
- Node.js 26.7.0
- Bun 1.3.14 (bundled)
- Linux
Issue priority
High (immediate attention needed)
I have tested this issue on a development release
e95b881
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 2
- 平均マージ
- 2日 18時間
- マージ済み PR(30日)
- 17
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NanoForge-dev/CLI のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NanoForge-dev/CLI#294 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NanoForge-dev/CLI#293 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NanoForge-dev/CLI#292 ·
メンテナーはふだん 1 日以内に返信
-
command:dev enhancement good first issue refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NanoForge-dev/CLI#281 ·
メンテナーはふだん 1 日以内に返信
-
bug command:build good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NanoForge-dev/CLI#276 ·
メンテナーはふだん 1 日以内に返信
NanoForge-dev/CLI の issue をすべて見る
似ている issue
-
Mend: dependency security vulnerability
難易度 1/5 1〜3時間 初心者へのやさしさ 65/100
fdm-monster/fdm-monster#5563 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
be-BOP-io-SA/be-BOP#2849 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
1️⃣ phase/under-investigation flaky/confirmed flaky/needs-decision type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
growilabs/growi#12246 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
🐛 The Rulekeeper - An index run that gives up on the lock ends Succeeded対応中かも @github-actions が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SSWConsulting/SSW.Rules#2809 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信