Skip to content

fix(#293): param default の $PSScriptRoot を使わない (Windows PowerShell 5.1) - #294

Draft
rebuildup wants to merge 1 commit into
release-0-10-0from
293
Draft

rebuildup wants to merge 1 commit into
release-0-10-0from
293

Conversation

@rebuildup

Copy link
Copy Markdown
Owner

Refs #293

問題

Windows PowerShell 5.1 は param block を評価する時点で $PSScriptRoot が空である。powershell.exe -File で起動した script は、param default が失敗する。

PS> powershell.exe -NoProfile -ExecutionPolicy Bypass -File platforms\windows-11\install-apps.ps1
Join-Path : 引数が空の文字列であるため、パラメーター 'Path' にバインドできません。
発生場所 ...\platforms\windows-11\install-apps.ps1:3 文字:41
+     [string]$InventoryPath = (Join-Path $PSScriptRoot 'apps.psd1')
起動方法 5.1 7
& script.ps1 (in-process) param default でも解決する 解決する
powershell.exe -File script.ps1 空 (失敗する) 解決する

実機では 5.1 で起動した install-apps.ps1 が何も実行せず、verify.ps1 が Linear / Cursor / Notion を missing として報告していた。

変更

  • platforms/windows-11/install-apps.ps1 の InventoryPath と platforms/windows-11/setup-tailscale.ps1 の ConfigPath を、param block の評価後に解決する形にする。明示指定は引き続き優先される。
  • CI に repository 全体の check を追加: AST で param block の default を判定し、$PSScriptRoot を使う .ps1 があれば失敗する。将来の script への再発を防ぐ。

検証

  • ローカルで check を実行し violations 0。
  • 5.1 の powershell.exe -File で起動した install-apps.ps1 が desktop app を導入することを実機で確認。

Co-Authored-By: Claude Code noreply@anthropic.com

Windows PowerShell 5.1 は param block を評価する時点で $PSScriptRoot が空である。
`powershell.exe -File` で起動した script は param default の値が失敗する。

- `platforms/windows-11/install-apps.ps1` の InventoryPath と
  `platforms/windows-11/setup-tailscale.ps1` の ConfigPath を、param block の
  評価後に解決する形にする。明示指定は引き続き優先される。
- 実機では 5.1 で起動した install-apps.ps1 が何も実行せず、verify が Linear /
  Cursor / Notion を missing として報告していた。
- CI に repository 全体の check を追加: param default で $PSScriptRoot を使う
  .ps1 があれば失敗する (AST で param block の default を判定する)。

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

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant