Conversation
Add a Windows-friendly `pwsh-demo` workspace and document the `Out-String` install flow so PowerShell completions can be exercised end to end. Refresh local tooling config and workspace metadata to support the new example and current tool versions. Fixes #16
commit: |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
dreamcli | 6f222d0 | Commit Preview URL Branch Preview URL |
Apr 16 2026, 07:12 PM |
📝 WalkthroughAdd PowerShell completion playground; harden PowerShell completions, docs, tests, and release metadata
Co-authored changes include PowerShell completion fixes, new example workspace and smoke tests, documentation alignment, Bun/runtime support relaxation, and multiple tooling/configuration normalizations. WalkthroughNormalized formatter/config JSONC formatting and bumped dprint plugins; relaxed Bun minimum to 1.3 and updated tests/docs; changed PowerShell install command to pipe through Changes
Sequence Diagram(s)sequenceDiagram
participant User as "User"
participant CLI as "CLI (pwsh-demo / app)"
participant PowerShell as "PowerShell Host"
participant Smoke as "Smoke Test"
Note over CLI,PowerShell: generate & install completions for current session
User->>CLI: run `completions powershell`
CLI-->>PowerShell: emit multiline completion script
PowerShell->>PowerShell: Out-String (convert pipeline output to single string)
PowerShell->>PowerShell: Invoke-Expression (evaluate completions)
Smoke->>PowerShell: TabExpansion2 / completion query
PowerShell-->>Smoke: completion items (formatted/escaped)
Smoke->>Smoke: assert includes/excludes expected entries
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 7 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (7 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Align runtime checks, docs, and package metadata around Bun `>= 1.3` and add the Windows launcher fixes needed for the `pwsh-demo` example to run reliably from its `.cmd` shim.
236079f to
6f222d0
Compare
Treat the active token as in-progress so partial enum values complete. Stop suggesting flags after `--` and quote enum values so accepted completions stay valid PowerShell input. Extend the PowerShell playground and smoke tests to cover partial, inline, and quoted enum completions.
Cut the 2.1.0 changelog entry and comparison links, and align npm and Deno package metadata so the upcoming release publishes a consistent version surface.
Drop the GOALS-based pre-merge checks that were producing noisy, outdated failures and replace them with repo-specific guards for release metadata, runtime support sync, and generated docs artifacts.
Add example-package guidance for `examples/pwsh-demo` and expand the PowerShell smoke script with proper comment-based help so repo checks can understand the example surface.
Restore meta-descriptions:check on Windows by resolving docs data paths as real filesystem paths and normalizing TypeDoc inputs before bootstrap. Tighten the PowerShell smoke script to verify the native pwsh-demo launcher matches the direct Bun completion output, and expand the CodeRabbit runtime-support sync guard to include the getting-started docs surface.
Assert the direct Bun and native pwsh-demo completion commands exit successfully before comparing their output so launcher failures cannot pass as empty-output mismatches.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@examples/pwsh-demo/smoke-powershell.ps1`:
- Around line 61-126: Rename the plural-noun functions to use singular nouns:
change Get-CompletionTexts to Get-CompletionText, Assert-Contains to
Assert-Contain, and Assert-Excludes to Assert-Exclude; update every call site in
this file to the new names (including the three existing usages), and ensure
parameter lists and behavior remain unchanged so only the identifiers are
refactored.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: b94701bb-e971-4acc-b63e-2796f4e4d4a8
📒 Files selected for processing (1)
examples/pwsh-demo/smoke-powershell.ps1
📜 Review details
⏰ Context from checks skipped due to timeout of 18000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Static Checks
- GitHub Check: Test (bun)
- GitHub Check: Test (node)
- GitHub Check: Test (node)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: Do not edit generated docs pages when the source of truth is an example file; maintain separation between generated docs and example source
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: Single-file examples should not bloat with walkthrough-only complexity; move complex logic to `examples/gh` workspace package
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: Examples must be pedagogical and runnable; they double as documentation content
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: `examples/gh` workspace package must be typechecked and tested in CI as a consumer canary with real-world command and test coverage
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: `examples/pwsh-demo` workspace package must maintain PowerShell completion smoke coverage and cannot have install behavior changed without updating docs
Learnt from: CR
URL:
File: examples/AGENTS.md:undefined-undefined
Timestamp: 2026-04-17T11:21:42.636Z
Learning: Do not treat `.cache/` directory as source; it contains generated build cache only
🪛 PSScriptAnalyzer (1.25.0)
examples/pwsh-demo/smoke-powershell.ps1
[warning] 61-61: The cmdlet 'Get-CompletionTexts' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Get-CompletionTexts'
(PSUseSingularNouns)
[warning] 85-85: The cmdlet 'Assert-Contains' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Assert-Contains'
(PSUseSingularNouns)
[warning] 115-115: The cmdlet 'Assert-Excludes' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Assert-Excludes'
(PSUseSingularNouns)
[warning] 44-44: Invoke-Expression is used. Please remove Invoke-Expression from script and find other options instead.
(PSAvoidUsingInvokeExpression)
🔇 Additional comments (2)
examples/pwsh-demo/smoke-powershell.ps1 (2)
20-42: Great hardening of launcher-path smoke coverage.Line 20 through Line 42 now correctly fail on non-zero exits, reject empty output, and assert native
pwsh-demooutput matches direct Bun generation. This closes the earlier false-pass gap cleanly.
44-44: Install-flow execution check is correctly intentional here.Line 44 validating
Out-String | Invoke-Expressionin smoke is appropriate for this example because the script is explicitly testing documented PowerShell installation behavior, not arbitrary user input execution.
Based on learnings: "examples/pwsh-demoworkspace package must maintain PowerShell completion smoke coverage and cannot have install behavior changed without updating docs."
| function Get-CompletionTexts { | ||
| param([string]$InputScript) | ||
|
|
||
| $expanded = TabExpansion2 -inputScript $InputScript -cursorColumn $InputScript.Length | ||
| return @($expanded.CompletionMatches | ForEach-Object CompletionText) | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Fails when expected completion values are missing. | ||
|
|
||
| .DESCRIPTION | ||
| Compares the expected completion values to the actual completion results and | ||
| throws when any expected value is absent. | ||
|
|
||
| .PARAMETER Label | ||
| The scenario label used in the failure message. | ||
|
|
||
| .PARAMETER Actual | ||
| The completion texts returned by the expansion. | ||
|
|
||
| .PARAMETER Expected | ||
| The completion texts that must be present. | ||
| #> | ||
| function Assert-Contains { | ||
| param( | ||
| [string]$Label, | ||
| [string[]]$Actual, | ||
| [string[]]$Expected | ||
| ) | ||
|
|
||
| $missing = @($Expected | Where-Object { $_ -notin $Actual }) | ||
| if ($missing.Count -gt 0) { | ||
| throw "$Label is missing expected completions: $($missing -join ', ')" | ||
| } | ||
| } | ||
|
|
||
| <# | ||
| .SYNOPSIS | ||
| Fails when excluded completion values appear in the results. | ||
|
|
||
| .DESCRIPTION | ||
| Compares the actual completion results to a list of values that must remain | ||
| hidden and throws when any excluded value is present. | ||
|
|
||
| .PARAMETER Label | ||
| The scenario label used in the failure message. | ||
|
|
||
| .PARAMETER Actual | ||
| The completion texts returned by the expansion. | ||
|
|
||
| .PARAMETER Excluded | ||
| The completion texts that must not appear. | ||
| #> | ||
| function Assert-Excludes { | ||
| param( | ||
| [string]$Label, | ||
| [string[]]$Actual, | ||
| [string[]]$Excluded | ||
| ) | ||
|
|
||
| $unexpected = @($Excluded | Where-Object { $_ -in $Actual }) | ||
| if ($unexpected.Count -gt 0) { | ||
| throw "$Label included completions that should stay hidden: $($unexpected -join ', ')" | ||
| } | ||
| } |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify these function names are only used where expected before renaming.
rg -n -C2 '\b(Get-CompletionTexts|Assert-Contains|Assert-Excludes)\b'Repository: kjanat/dreamcli
Length of output: 1578
Arrr, fix them function names to follow PowerShell conventions, ye scallywag!
Lines 61, 85, and 115 be usin' plural nouns in the function names (Get-CompletionTexts, Assert-Contains, Assert-Excludes), which violates the PSUseSingularNouns rule. The grep search confirms all calls be contained within this same file (lines 210-212), so it be a safe refactoring with no other code dependencies. Clean up them names and make yer analyzer happy!
♻️ Suggested rename patch
-function Get-CompletionTexts {
+function Get-CompletionText {
param([string]$InputScript)
$expanded = TabExpansion2 -inputScript $InputScript -cursorColumn $InputScript.Length
return @($expanded.CompletionMatches | ForEach-Object CompletionText)
}
-function Assert-Contains {
+function Assert-Contain {
param(
[string]$Label,
[string[]]$Actual,
[string[]]$Expected
)
@@
-function Assert-Excludes {
+function Assert-Exclude {
param(
[string]$Label,
[string[]]$Actual,
[string[]]$Excluded
)
@@
- $actual = Get-CompletionTexts -InputScript $case.Input
- Assert-Contains -Label $case.Label -Actual $actual -Expected $case.Expected
- Assert-Excludes -Label $case.Label -Actual $actual -Excluded $case.Excluded
+ $actual = Get-CompletionText -InputScript $case.Input
+ Assert-Contain -Label $case.Label -Actual $actual -Expected $case.Expected
+ Assert-Exclude -Label $case.Label -Actual $actual -Excluded $case.Excluded🧰 Tools
🪛 PSScriptAnalyzer (1.25.0)
[warning] 61-61: The cmdlet 'Get-CompletionTexts' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Get-CompletionTexts'
(PSUseSingularNouns)
[warning] 85-85: The cmdlet 'Assert-Contains' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Assert-Contains'
(PSUseSingularNouns)
[warning] 115-115: The cmdlet 'Assert-Excludes' uses a plural noun. A singular noun should be used instead.
Suggested fix: Singularized correction of 'Assert-Excludes'
(PSUseSingularNouns)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@examples/pwsh-demo/smoke-powershell.ps1` around lines 61 - 126, Rename the
plural-noun functions to use singular nouns: change Get-CompletionTexts to
Get-CompletionText, Assert-Contains to Assert-Contain, and Assert-Excludes to
Assert-Exclude; update every call site in this file to the new names (including
the three existing usages), and ensure parameter lists and behavior remain
unchanged so only the identifiers are refactored.
Summary
examples/pwsh-demoworkspace with apwsh-demo.cmdlauncher, README install flow, example tests, and a nativesmoke:powershellscript that exercises aliases, nested subcommands, root-surface defaults, hidden entries, and quoted enum values--flag=valuecompletions work, values after--stop receiving flag suggestions, and accepted values are quoted when PowerShell would otherwise parse them incorrectlyOut-String | Invoke-Expression>= 1.3across package metadata, runtime support checks, docs, and runtime tests, and update the Windows launcher and workspace metadata needed for the new example2.1.0release metadata by syncingpackage.json,deno.json, andCHANGELOG.mdGOALS.mdchecks with repo-specific guards and documentpwsh-demoinexamples/AGENTS.mdValidation
bun run test -- src/core/completion/completion.test.tsbun run test(inexamples/pwsh-demo)bun run smoke:powershell(inexamples/pwsh-demo)