UX Friction: Drop legacy "v1" enforcement by supporting .pss, .pwsh, or extension-less scripts (Related to #26584)
还没有人认领这个 Issue。
评估
调研方向
Start at the pwsh -File entry point and review the extension-less script handling discussed in related issue #26584. Define acceptance criteria for .pss, .pwsh, and extension-less files while preserving existing .ps1 support; the issue does not name specific files or tests.
由索引模型根据 Issue 内容生成。
描述
Summary of the new feature / enhancement
Summary of the new feature/enhancement
The enforcement of the .ps1 file extension feels increasingly like an archaic holdover from the 2006 Windows-only PowerShell 1.0 architecture. Forcinig a hardcoded "Version 1" into the extension creates a persistent UX friction point for modern cross-platform automation pipelines.
Modern shells (such as Bash and Python) focus on script parsing logic rather than strict extension requirements. We need a cleaner alternative to .ps1 that adapts to modern cross-platform development workflows.
This is fundamentally related to the issue discussed in #26584 regarding extension-less script handling.
Proposed technical behavior
Allow the pwsh engine to execute files using modernized or non-enforced file parameters. I propose the engine should actively support the following three avenues:
-
Option A: Compact Script Extension (
.pss)
Support.pss([P]ower[S]hell [S]cript) to offer a clean 3-character alternative that avoids system conflicts with Adobe PostScript (.ps). -
Option B: Modernized Extension (
.pwsh)
Natively recognize.pwshto align with the name of the open-source cross-platform engine binary. It drops the legacy version "1" while clearly differentiating Core from Windows PowerShell. -
Option C: Pure Extension-less Execution (No Extension)
Allowpwsh -File <filename>to parse and execute valid PowerShell script data regardless of the file suffix (or complete lack of one). This natively fixes environments like Linux Git hooks, which explicitly require extension-less scripts (see context in #26584).
Proposed solutions for compatibility
- Parser Agnosticism: If a text file is explicitly fed to the
-Fileparameter, the engine should parse the text block rather than strictly demanding a.ps1regex match. - Side-by-Side Coexistence: Maintain full fallback support for
.ps1to prevent breaking millions of existing production enterprise scripts, while allowing developers to opt-into the cleaner naming styles.
Evaluation of alternatives
The alternative is forcing developers to write awkward wrapper scripts or manage complex execution blocks just to run an extension-less automation task. Adopting a flexible model simplifies the user experience and updates PowerShell's identity to better match the standards of the open-source community.
Proposed technical implementation details (optional)
No response
- 主要语言
- C#
- 星标
- 55.5k
- 派生
- 8.5k
- 平均合并
- 1 天 17 小时
- 30 天内合并 PR
- 97
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/PowerShell 的其他 Issue
-
Issue-Enhancement Needs-Triage
难度 1/5 1 小时以内 新手友好度 86/100
PowerShell/PowerShell#28061 · 2 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 90/100
PowerShell/PowerShell#28037 ·
-
Needs-Triage
难度 2/5 1-3 小时 新手友好度 74/100
PowerShell/PowerShell#27973 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
PowerShell/PowerShell#27720 ·
-
Issue-Bug Up-for-Grabs WG-Cmdlets WG-Reviewed
难度 2/5 1-3 小时 新手友好度 72/100
PowerShell/PowerShell#27670 · 3 条评论 ·
查看 PowerShell/PowerShell 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
nightscout/nocturne#1425 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 65/100
-
Documentation
难度 2/5 1-3 小时 新手友好度 75/100
cake-build/cake#5024 ·
-
Frontend status/draft TechnicalDebt
难度 2/5 1-2 天 新手友好度 75/100
Altinn/altinn-auth#4143 ·