Skip to content

feat: @antfu/ni をグローバルパッケージに追加し ni エイリアスを設定 - #531

Merged
keito4 merged 5 commits into
mainfrom
feat/add-ni-package-manager
Mar 5, 2026
Merged

feat: @antfu/ni をグローバルパッケージに追加し ni エイリアスを設定#531
keito4 merged 5 commits into
mainfrom
feat/add-ni-package-manager

Conversation

@keito4

@keito4 keito4 commented Mar 5, 2026

Copy link
Copy Markdown
Owner

概要

パッケージマネージャーコマンドを統一するツール @antfu/ni をグローバルインストールパッケージに追加し、ショートカットエイリアスを設定する。

変更内容

  • npm/global.json: @antfu/ni@28.2.0 を追加
  • dot/.zshrc: ni エイリアスを追加
  • dot/.zshrc.devcontainer: ni エイリアスを追加(DevContainer 用)

ni とは

@antfu/ni はロックファイル(pnpm-lock.yaml, yarn.lock, package-lock.json 等)を自動検出し、プロジェクトのパッケージマネージャーに合わせたコマンドを実行するツール。

コマンド 機能
ni 依存関係インストール
nr <script> スクリプト実行
nu パッケージ更新
nun パッケージ削除
nlx npx/pnpm dlx 相当
nci クリーンインストール(lockfile frozen)

追加エイリアス

alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview"

参考

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Introduced unified package manager command tool with convenient shell aliases for common development tasks.
  • Chores

    • Pinned package manager version for consistency in containerized environments.
    • Enhanced dependency security configurations to prevent supply chain attacks and verify package integrity.
  • Documentation

    • Added comprehensive setup guides covering security best practices and package manager command unification.

github-actions Bot and others added 4 commits March 5, 2026 09:18
## 変更内容

### pnpm バージョン固定 (Dockerfile)
- `npm install -g pnpm` → `npm install -g pnpm@10.30.3` に固定
- バージョン未固定のままだと最新版が自動インストールされ、
  悪意のある新規リリースを意図せず取り込むリスクがある

### .npmrc 追加(pnpm セキュリティ設定)
- `strict-peer-dependencies=true`: peer dep コンフリクトで即失敗
- `shamefully-hoist=false`: phantom dependencies の排除
- `audit=true / audit-level=moderate`: インストール時に脆弱性チェック
- `verify-store-integrity=true`: コンテンツハッシュで改ざん検知

### Renovate 導入(直近 2 日のリリースをスキップ)
- `renovate.json` を追加し、npm 依存を Renovate で管理
- `minimumReleaseAge: "2 days"` により公開後 2 日未満のパッケージを
  依存更新対象から除外(supply chain attack の主要な攻撃窓を閉じる)
- Dependabot から npm セクションを削除(重複防止)
- Docker / GitHub Actions は引き続き Dependabot が担当

> Note: Renovate を有効にするには GitHub App のインストールが必要。
> https://github.com/apps/renovate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pnpm v10.16.0+ のネイティブ機能で supply chain attack 対策を実装するため、
Renovate 設定を削除し pnpm-workspace.yaml に移行。

## 変更内容

- `pnpm-workspace.yaml` を追加
  - `minimumReleaseAge: 2880`(2日間 = 2880分)
  - パッケージ追加・更新時に公開から2日未満のバージョンはインストールを拒否
  - GitHub App 不要・外部サービス依存なし
- `renovate.json` を削除(pnpm native で代替可能なため不要)
- `dependabot.yml` の npm セクションを復元

## minimumReleaseAge の動作

- `pnpm add` や `pnpm update` で依存グラフを解決する際に適用
- pnpm-lock.yaml が存在する場合はスキップ(環境再現性を優先)
- pnpm v10.16.0+ が必須(現在 v10.30.3 を使用)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
supply chain attack 対策として pnpm v10.16.0+ の minimumReleaseAge 機能と
セキュリティ設定を各リポジトリタイプのセットアップガイドに追加する。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
パッケージマネージャーコマンド統一ツール @antfu/ni をグローバルインストールし、
よく使うスクリプト実行のショートカットエイリアスを zshrc に追加する。

- npm/global.json: @antfu/ni@28.2.0 を追加
- dot/.zshrc: nrd/nrb/nrs/nrp エイリアスを追加
- dot/.zshrc.devcontainer: 同上(DevContainer 用)

ni はロックファイル(pnpm-lock.yaml 等)を検出し、プロジェクトの
パッケージマネージャーを自動判定してコマンドを実行する。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 5, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds pnpm security configurations (peer dependencies, audit settings, store verification), pins pnpm version in DevContainer, introduces @antfu/ni package manager CLI tool, creates shell aliases (nrd, nrb, nrs, nrp), and documents supply chain attack prevention measures across multiple setup documentation files.

Changes

Cohort / File(s) Summary
DevContainer & Global Packages
.devcontainer/Dockerfile, npm/global.json
Pins pnpm to version 10.30.3 in Dockerfile and adds @antfu/ni (v28.2.0) to global npm dependencies.
pnpm Configuration
.npmrc, pnpm-workspace.yaml
Introduces .npmrc with security settings (strict peer dependencies, audit with moderate level, store integrity verification) and adds minimumReleaseAge threshold (2880 minutes) to pnpm-workspace.yaml to enforce release-age-based installation restrictions.
Documentation
docs/setup/npm-library-cli.md, docs/setup/spa-react-vite.md, docs/setup/web-app-nextjs.md
Adds sections documenting pnpm security configurations for supply chain attack prevention and @antfu/ni package manager CLI tool usage, including command mappings and recommended shell aliases.
Shell Configuration
dot/.zshrc, dot/.zshrc.devcontainer
Adds four npm script aliases (nrd="nr dev", nrb="nr build", nrs="nr start", nrp="nr preview") for convenient access to common development commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested labels

released

Poem

🐰 With whiskers twitching, npm chains secured,
I hopped through configs, supply chains cured,
Aliases dancing—nrd, nrb assured,
Peer dependencies strictly procured,
Seven days' aging, integrity assured!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding @antfu/ni to global packages and setting up ni aliases. It is specific, concise, and directly reflects the primary objectives of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-ni-package-manager

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@keito4

keito4 commented Mar 5, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

  • dot/.zshrc:128-132
    alias nrp="nr preview"# Added by Windsurf# がコメント扱いにならずトークンに連結されるため、alias の引数が壊れてシェル起動時にエラーになり得ます(alias の残り引数が不正)。スペースを入れて alias nrp="nr preview" # ... にする必要があります。

Overall: patch is incorrect
理由: シェル初期化時にエラーを起こし得る不正な alias 行が導入されているため。
信頼度: 0.69

✨ Gemini Review

I will review the changes to .devcontainer/Dockerfile, .npmrc, pnpm-workspace.yaml, and the documentation, focusing on security settings and package manager aliases.

ご提示いただいたパッチのレビュー結果を報告します。

指摘事項

  1. Dockerfile での @antfu/ni インストール漏れ

    • ファイル: .devcontainer/Dockerfile (71-98行目付近)
    • 説明: npm/global.json@antfu/ni が追加され、.zshrcnr などのエイリアスが追加されていますが、Dockerfile 内の npm install -g を実行するステップでこのパッケージが追加されていません。このままでは、コンテナ内でエイリアス(nrd, nrb 等)を実行した際に command not found: nr となり、開発者体験を損ないます。
    • 対策: Dockerfile 内の npm install -g のリストに @antfu/ni を追加するか、global.json から動的にバージョンを取得してインストールするロジックに追加してください。
  2. pnpm-workspace.yamlpackages フィールドが不足

    • ファイル: pnpm-workspace.yaml
    • 説明: pnpm の仕様では、pnpm-workspace.yaml には必ず packages フィールド(例: packages: - '.' または packages: - 'packages/*')が必要です。このフィールドがない場合、pnpm はこのファイルを有効な設定ファイルとして認識せず、エラーになるか minimumReleaseAge 設定が無視される可能性があります。
    • 対策: packages: 設定を追記してください。
  3. ドキュメントの重複による保守性の低下

    • ファイル: docs/setup/npm-library-cli.md, docs/setup/spa-react-vite.md, docs/setup/web-app-nextjs.md
    • 説明: 全く同じ「pnpm セキュリティ設定」のセクションが3つのファイルに追加されています。将来的に設定値を変更(例: 2日から1日に変更など)する場合、すべてのファイルを更新する必要があり、修正漏れの原因となります。
    • 対策: セキュリティ設定に関する共通ドキュメント(例: docs/policy/pnpm-security.md)を一つ作成し、各セットアップガイドからはそこへのリンクを貼る形式を推奨します。
  4. minimumReleaseAge 設定による緊急更新のブロック

    • ファイル: pnpm-workspace.yaml, docs/setup/*.md
    • 説明: minimumReleaseAge: 2880 (2日間) はサプライチェーン攻撃対策として有効ですが、依存パッケージの重大な脆弱性に対する緊急パッチがリリースされた直後に pnpm update で適用しようとしてもブロックされます。
    • 対策: ドキュメントに、緊急時の回避策(minimumReleaseAgeExclude への一時的な追加方法や、pnpm install には影響しない旨の強調など)を記載しておくと、より親切です。

判定

patch is incorrect

理由:
.zshrc で追加されたエイリアスに必要な @antfu/niDockerfile でインストールされていないため、コンテナ環境ですぐに機能しません。また、pnpm-workspace.yaml の形式が不完全なため、意図したセキュリティ設定が有効にならないリスクがあります。

信頼度スコア: 0.95


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@keito4

keito4 commented Mar 5, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (default) / Gemini (default)

🤖 Codex Review

発見事項(重大順)

  1. pnpm ワークスペース定義の必須項目が欠落
    pnpm-workspace.yamlpackages が定義されていないため、pnpm がワークスペースとして解釈した際に「ワークスペースのパッケージが見つからない」エラーになり、pnpm install 等が失敗する可能性があります。単一パッケージ運用でも packages を明示するか、ワークスペース化が不要ならファイル自体を置かない方が安全です。
    影響範囲: pnpm-workspace.yaml:1-10

総合判定: patch is incorrect
理由: pnpm ワークスペースの必須設定不足により、pnpm 実行が失敗する可能性が高く、開発者体験と正確性に影響します。
信頼度: 0.45

✨ Gemini Review

指摘事項

  1. pnpm-workspace.yaml における packages フィールドの欠如

    • ファイル: pnpm-workspace.yaml
    • 行範囲: 1-10
    • 説明: pnpm のワークスペース設定ファイルには packages フィールドが必須です。単一パッケージのプロジェクトであっても、設定を有効にするには packages: ["."] などの定義が必要です。これがない場合、pnpm が設定を無視するかエラーを出す可能性があります。
  2. .zshrc におけるエイリアス設定の書式不備

    • ファイル: dot/.zshrc
    • 行範囲: 130
    • 説明: alias nrp="nr preview"# Added by Windsurf の箇所で、エイリアス定義とコメントの間にスペースがなく結合されています。可読性が低く、将来的な自動編集ツールによる誤動作の原因となる可能性があります。
  3. ファイルの末尾の改行欠如

    • ファイル: dot/.zshrc.devcontainer
    • 行範囲: 95
    • 説明: ファイルの末尾に改行が含まれていません。POSIX準拠や一部のツールでの処理、将来の差分確認のしやすさを考慮し、末尾には改行を入れることが推奨されます。

判定

patch is correct

理由:
pnpm v10 へのバージョン固定と minimumReleaseAge によるサプライチェーン攻撃対策は、セキュリティと開発環境の安定性を高める優れた変更です。指摘事項は設定の微調整やフォーマットに関するものであり、変更の主要な目的であるセキュリティ強化と開発者体験(ni の導入)は適切に達成されています。

信頼度スコア: 0.95


⚠️ 修正が必要です

上記のレビューで問題が指摘されています。修正してからマージしてください。


🤖 Generated by post_pr_ai_review.py hook

@claude

claude Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

PR レビュー

全体的に有用な変更ですが、いくつか修正が必要な点とコメントがあります。

バグ・要修正

1. dot/.zshrc 改行欠落

alias nrp="nr preview" の直後に改行がなく、# Added by Windsurf が同一行に連結されています。現状では zsh が構文エラーを出す可能性があります。

正しい形:

alias nrp="nr preview"
# Added by Windsurf

2. dot/.zshrc.devcontainer ファイル末尾の改行欠落

ファイルが No newline at end of file で終わっています。POSIX規則上、テキストファイルは末尾改行が必要です。


設計上の懸念

3. .npmrc と pnpm-workspace.yaml の配置場所

リポジトリルートに追加されていますが、ドキュメントでは「プロジェクトで設定すること」として案内されています。このリポジトリ自体で pnpm を使う意図かどうか確認が必要です。テンプレートとして示すだけなら template/.npmrc のような形にする方が意図が明確です。

4. strict-peer-dependencies=true と auto-install-peers=true の組み合わせ

  • strict-peer-dependencies=true:peer deps の不整合があればエラー
  • auto-install-peers=true:peer deps を自動インストール

バージョン競合がある場合に strict によりエラーが発生する可能性があります。意図通りであればコメントで補足を推奨します。

5. shamefully-hoist=false は pnpm のデフォルト

明示的に書く意図はわかりますが、デフォルト値であることをコメントすると読み手に親切です。


提案・改善点

6. PR スコープが広い

タイトルは「@antfu/ni 追加」ですが、実際には pnpm バージョンピン固定、.npmrc/pnpm-workspace.yaml 追加、ドキュメント3ファイルへのセキュリティ設定追記など独立した変更が含まれています。可能であれば PR を分割するか、タイトルをより包括的なものにすることを推奨します。

7. ドキュメントの重複

npm-library-cli.md、spa-react-vite.md、web-app-nextjs.md の3ファイルに同一内容の pnpm セキュリティ設定が追加されています。docs/setup/pnpm-security.md として切り出して各ドキュメントからリンクする形にすると、将来の更新が一箇所で済みます(DRY 原則)。

8. @antfu/ni バージョン 28.2.0 の確認

npm info @antfu/ni version で最新版を確認した上でのピン固定かご確認ください。


良い点

  • pnpm をバージョン固定(pnpm@10.30.3)したことで Dockerfile の再現性が向上
  • minimumReleaseAge: 2880 による supply chain attack 対策は非常に有用
  • verify-store-integrity=true でパッケージ改ざん検知を明示的に有効化している点も評価できます
  • エイリアスのコメントが適切に記載されています

優先度: バグ修正(1, 2)を対応後マージ推奨です。

🤖 Reviewed by Claude Sonnet 4.6

web-app-nextjs / spa-react-vite / npm-library-cli の各セットアップガイドに
@antfu/ni の使用を推奨するセクションを追加する。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddb2db442e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread dot/.zshrc
alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview"# Added by Windsurf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix malformed nrp alias line in zshrc

The nrp alias line appends # Added by Windsurf directly after the closing quote, so # is parsed as part of the argument (not a comment) and the trailing words are treated as extra alias operands when the file is sourced. This leaves nrp mapped incorrectly (e.g. ending with #) and can emit startup errors, so the new shortcut does not reliably work.

Useful? React with 👍 / 👎.

Comment thread npm/global.json
Comment on lines +56 to +58
"@antfu/ni": {
"version": "28.2.0",
"overridden": false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install @antfu/ni where global CLIs are provisioned

Adding @antfu/ni to npm/global.json alone does not make nr available in fresh DevContainer/Codespaces setups, because provisioning still uses hardcoded package allowlists (.devcontainer/Dockerfile global install block and script/install-npm-globals.sh PACKAGES) that do not include this package. The newly added nrd/nrb/nrs/nrp aliases therefore point to a command that is missing by default.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.devcontainer/Dockerfile (1)

100-112: ⚠️ Potential issue | 🟠 Major

@antfu/ni is not installed in the Dockerfile.

The PR adds @antfu/ni to npm/global.json and defines aliases (nrd, nrb, nrs, nrp) in dot/.zshrc.devcontainer, but the Dockerfile's npm install step (Lines 100-112) only installs a hardcoded subset of packages. @antfu/ni is missing from this list, so nr and related aliases will fail with "command not found" inside the devcontainer.

🔧 Proposed fix: Add `@antfu/ni` to the install list
 RUN CODEX_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@openai/codex'].version") \
  && VERCEL_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['vercel'].version") \
  && GEMINI_CLI_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@google/gemini-cli'].version") \
  && HAPPY_CODER_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['happy-coder'].version") \
  && DIFIT_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['difit'].version") \
+ && NI_VERSION=$(node -pe "require('/tmp/npm-global.json').dependencies['@antfu/ni'].version") \
  && npm install -g eslint \
     typescript \
     typescript-language-server \
     `@openai/codex`@${CODEX_VERSION} \
     vercel@${VERCEL_VERSION} \
     `@google/gemini-cli`@${GEMINI_CLI_VERSION} \
     happy-coder@${HAPPY_CODER_VERSION} \
-    difit@${DIFIT_VERSION}
+    difit@${DIFIT_VERSION} \
+    `@antfu/ni`@${NI_VERSION}

Alternatively, consider dynamically installing all packages from npm/global.json similar to script/import.sh to avoid manual maintenance.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/Dockerfile around lines 100 - 112, The Dockerfile npm install
block is missing `@antfu/ni` so the aliases (nrd, nrb, nrs, nrp) defined in
dot/.zshrc.devcontainer will fail; update the RUN block that computes
CODEX_VERSION/VERCEL_VERSION/... and runs npm install -g to also compute
NI_VERSION from /tmp/npm-global.json (or simply reference the `@antfu/ni` entry)
and include `@antfu/ni`@${NI_VERSION} in the global install list (or replace the
hardcoded list with a dynamic install that reads /tmp/npm-global.json similar to
script/import.sh) so the nr* aliases work inside the devcontainer.
🧹 Nitpick comments (1)
docs/setup/web-app-nextjs.md (1)

650-712: Documentation is accurate; consider centralizing duplicated content.

The pnpm security settings and ni documentation sections are well-written and match the actual configurations. However, identical content appears in docs/setup/spa-react-vite.md and docs/setup/npm-library-cli.md, creating maintenance burden.

Consider extracting these sections to a shared document (e.g., docs/pnpm-security.md) and linking from each setup guide to reduce duplication.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/setup/web-app-nextjs.md` around lines 650 - 712, The pnpm security and
ni sections are duplicated across docs (docs/setup/web-app-nextjs.md,
docs/setup/spa-react-vite.md, docs/setup/npm-library-cli.md); extract the
repeated blocks (the "pnpm セキュリティ設定(supply chain attack 対策)" section and the
"ni(パッケージマネージャーコマンド統一)" section) into a single shared file (e.g.,
docs/pnpm-security.md) and replace the original blocks with short include/link
references in each setup guide; ensure the new shared file contains the YAML and
.npmrc snippets and the ni alias table and update any relative links or anchors
so headings (pnpm security and ni) still resolve from web-app-nextjs.md,
spa-react-vite.md, and npm-library-cli.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@dot/.zshrc`:
- Line 132: The alias definition alias nrp="nr preview"# Added by Windsurf
includes the # inside the quoted value; update the alias nrp declaration so the
comment is separated (e.g., add a space before the # or move the comment after a
space) so the alias value is exactly "nr preview" and the trailing comment
(Added by Windsurf) is parsed as a comment rather than part of the alias.

In `@dot/.zshrc.devcontainer`:
- Around line 91-95: The file ends without a trailing newline; add a single
newline character at EOF so the last alias line (e.g., the aliases nrd, nrb,
nrs, nrp defined with "alias nrd=\"nr dev\"" etc.) is terminated by a newline to
satisfy POSIX compliance and editors—simply ensure the file's last byte is a
newline character.

In `@pnpm-workspace.yaml`:
- Around line 1-10: The review suggests removing or moving minimumReleaseAge,
but the minimumReleaseAge setting must remain in pnpm-workspace.yaml (it cannot
live in .npmrc); update the file to keep minimumReleaseAge: 2880 and
minimumReleaseAgeExclude: [] as-is and optionally add packages: [] to explicitly
mark a single-package workspace for compatibility with pnpm < 10.8.1; do not
move minimumReleaseAge to .npmrc and ensure the symbols minimumReleaseAge,
minimumReleaseAgeExclude, and packages appear in the workspace file.

---

Outside diff comments:
In @.devcontainer/Dockerfile:
- Around line 100-112: The Dockerfile npm install block is missing `@antfu/ni` so
the aliases (nrd, nrb, nrs, nrp) defined in dot/.zshrc.devcontainer will fail;
update the RUN block that computes CODEX_VERSION/VERCEL_VERSION/... and runs npm
install -g to also compute NI_VERSION from /tmp/npm-global.json (or simply
reference the `@antfu/ni` entry) and include `@antfu/ni`@${NI_VERSION} in the global
install list (or replace the hardcoded list with a dynamic install that reads
/tmp/npm-global.json similar to script/import.sh) so the nr* aliases work inside
the devcontainer.

---

Nitpick comments:
In `@docs/setup/web-app-nextjs.md`:
- Around line 650-712: The pnpm security and ni sections are duplicated across
docs (docs/setup/web-app-nextjs.md, docs/setup/spa-react-vite.md,
docs/setup/npm-library-cli.md); extract the repeated blocks (the "pnpm
セキュリティ設定(supply chain attack 対策)" section and the "ni(パッケージマネージャーコマンド統一)"
section) into a single shared file (e.g., docs/pnpm-security.md) and replace the
original blocks with short include/link references in each setup guide; ensure
the new shared file contains the YAML and .npmrc snippets and the ni alias table
and update any relative links or anchors so headings (pnpm security and ni)
still resolve from web-app-nextjs.md, spa-react-vite.md, and npm-library-cli.md.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bd6d7843-3f84-46da-a30f-93ddee1cfd9e

📥 Commits

Reviewing files that changed from the base of the PR and between 83f081c and 6355a25.

📒 Files selected for processing (9)
  • .devcontainer/Dockerfile
  • .npmrc
  • docs/setup/npm-library-cli.md
  • docs/setup/spa-react-vite.md
  • docs/setup/web-app-nextjs.md
  • dot/.zshrc
  • dot/.zshrc.devcontainer
  • npm/global.json
  • pnpm-workspace.yaml

Comment thread dot/.zshrc
alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview"# Added by Windsurf

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

cat -n dot/.zshrc | sed -n '125,140p'

Repository: keito4/config

Length of output: 594


🏁 Script executed:

# Test shell alias parsing with and without space before inline comment
bash -c 'alias nrp="nr preview"# Added by Windsurf 2>/dev/null; alias nrp' 2>&1 || true
echo "---"
bash -c 'alias nrp2="nr preview" # Added by Windsurf 2>/dev/null; alias nrp2' 2>&1 || true

Repository: keito4/config

Length of output: 84


🏁 Script executed:

# Verify the exact patterns mentioned in the review
rg -nP '^\s*alias\s+nrp="nr preview"#' dot/.zshrc dot/.zshrc.devcontainer 2>/dev/null || echo "No matches found"
echo "---"
rg -nP '^\s*alias\s+nr[dbsp]=' dot/.zshrc dot/.zshrc.devcontainer 2>/dev/null | head -20

Repository: keito4/config

Length of output: 472


Fix inline comment spacing in alias definition.

Line 132 has alias nrp="nr preview"# where the # is included in the alias value instead of starting a comment. Add a space before # so the comment is properly parsed.

Suggested fix
-alias nrp="nr preview"# Added by Windsurf
+alias nrp="nr preview" # Added by Windsurf

This causes the alias to expand to nr preview# instead of nr preview, making it non-functional.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
alias nrp="nr preview"# Added by Windsurf
alias nrp="nr preview" # Added by Windsurf
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dot/.zshrc` at line 132, The alias definition alias nrp="nr preview"# Added
by Windsurf includes the # inside the quoted value; update the alias nrp
declaration so the comment is separated (e.g., add a space before the # or move
the comment after a space) so the alias value is exactly "nr preview" and the
trailing comment (Added by Windsurf) is parsed as a comment rather than part of
the alias.

Comment thread dot/.zshrc.devcontainer
Comment on lines +91 to +95
# ni - package manager command unifier (@antfu/ni)
alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview" No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Aliases look correct; add trailing newline for POSIX compliance.

The ni aliases are properly defined. However, the file is missing a trailing newline at the end (Line 95), which can cause issues with POSIX tools and some editors.

🔧 Add trailing newline
 # ni - package manager command unifier (`@antfu/ni`)
 alias nrd="nr dev"
 alias nrb="nr build"
 alias nrs="nr start"
 alias nrp="nr preview"
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# ni - package manager command unifier (@antfu/ni)
alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview"
# ni - package manager command unifier (`@antfu/ni`)
alias nrd="nr dev"
alias nrb="nr build"
alias nrs="nr start"
alias nrp="nr preview"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@dot/.zshrc.devcontainer` around lines 91 - 95, The file ends without a
trailing newline; add a single newline character at EOF so the last alias line
(e.g., the aliases nrd, nrb, nrs, nrp defined with "alias nrd=\"nr dev\"" etc.)
is terminated by a newline to satisfy POSIX compliance and editors—simply ensure
the file's last byte is a newline character.

Comment thread pnpm-workspace.yaml
Comment on lines +1 to +10
# pnpm workspace configuration
# https://pnpm.io/pnpm-workspace_yaml

# supply chain attack 対策: 公開から 2 日未満のパッケージをインストール禁止
# pnpm v10.16.0+ でサポート
# 単位: 分(2880 = 2 days)
minimumReleaseAge: 2880

# 除外パッケージ(公式・信頼できるリリースサイクルが速いもの)
minimumReleaseAgeExclude: []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

pnpm-workspace.yaml packages field required mandatory

💡 Result:

  • Conceptually (per docs): pnpm-workspace.yaml is the workspace manifest; if you do provide packages, it’s used to include/exclude workspace packages, and if you don’t specify it, pnpm considers “all packages in all subdirectories” included by default. So from a configuration standpoint, packages is not inherently mandatory. [1]

  • In practice (pnpm v10 bug/regression): some pnpm v10.x versions would throw ERROR packages field missing or empty if a pnpm-workspace.yaml existed without a packages array (even if you only wanted other settings like onlyBuiltDependencies). This is documented in pnpm issues. [2]

  • Fix: pnpm merged a change to allow packages to be optional in the workspace manifest, and downstream release notes indicate this landed by pnpm 10.8.1 (“The packages field in pnpm-workspace.yaml became optional”). [3][4]

What to do

  • If you’re seeing packages field missing or empty, upgrade pnpm (≥ 10.8.1), or add a packages: list (even a broad one), or remove pnpm-workspace.yaml if you don’t need it.

Sources
[1] https://cuyl.github.io/pnpm.github.io/pnpm-workspace_yaml/
[2] pnpm/pnpm#9361
[3] pnpm/pnpm#8969
[4] https://build.opensuse.org/projects/openSUSE%3AFactory/packages/pnpm/files/pnpm.changes?expand=1


🌐 Web query:

pnpm minimumReleaseAge configuration pnpm-workspace.yaml .npmrc

💡 Result:

minimumReleaseAge (and minimumReleaseAgeExclude) is configured in the root pnpm-workspace.yaml of a workspace (monorepo). pnpm’s docs state this setting works only when placed in a pnpm-workspace.yaml located at the workspace root—not in per-package .npmrc files. [1]

Example (pnpm-workspace.yaml at repo root):

packages:
  - "packages/*"

minimumReleaseAge: 1440 # minutes (24h)

minimumReleaseAgeExclude:
  - react
  - webpack
  - "@myorg/*"

Sources: pnpm settings documentation (workspace file) describing minimumReleaseAge, minimumReleaseAgeExclude, and the “root pnpm-workspace.yaml only” constraint. [1]

References
[1] (pnpm.cn)

Citations:


🌐 Web query:

pnpm workspace configuration yaml single package repository

💡 Result:

If your repo has only one package (the root package.json), you usually don’t need pnpm workspaces at all—just use pnpm normally (package.json + pnpm-lock.yaml). Workspaces are mainly for multi-package repos. [1]

If you still want a pnpm-workspace.yaml (e.g., to keep pnpm-only settings in one place), put it in the repo root. pnpm uses it as a configuration source, and (importantly) the root package is always included as a workspace package even when you customize package globs. [2][3]

Minimal “single-package repo” pnpm-workspace.yaml

packages: []

Typical monorepo-style example (for reference)

packages:
  - "packages/**"
  - "apps/**"
  - "!**/test/**"

[3]

Notes

  • packages: uses glob patterns to include/exclude workspace package folders. [3]
  • pnpm-workspace.yaml can also hold various pnpm settings (not just packages). [2]

Sources: [1] [2] [3]


Remove suggestion to move minimumReleaseAge to .npmrc—it must remain in pnpm-workspace.yaml.

The minimumReleaseAge setting is correctly placed and configured. However, the packages field is only mandatory for pnpm versions before 10.8.1; in pnpm ≥ 10.8.1, it is optional. For compatibility with older pnpm versions or for clarity, consider adding packages: [] to explicitly define this as a single-package workspace. Note that minimumReleaseAge cannot be configured in .npmrc—it must remain in the workspace-level pnpm-workspace.yaml.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pnpm-workspace.yaml` around lines 1 - 10, The review suggests removing or
moving minimumReleaseAge, but the minimumReleaseAge setting must remain in
pnpm-workspace.yaml (it cannot live in .npmrc); update the file to keep
minimumReleaseAge: 2880 and minimumReleaseAgeExclude: [] as-is and optionally
add packages: [] to explicitly mark a single-package workspace for compatibility
with pnpm < 10.8.1; do not move minimumReleaseAge to .npmrc and ensure the
symbols minimumReleaseAge, minimumReleaseAgeExclude, and packages appear in the
workspace file.

@keito4
keito4 merged commit 22e8c33 into main Mar 5, 2026
24 checks passed
@github-actions

github-actions Bot commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.84.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant