Skip to content

feat(scripts): -Track flag + install.ps1 $PROFILE fix#32

Open
abdout wants to merge 1 commit into
feat/bootstrapfrom
feat/polish
Open

feat(scripts): -Track flag + install.ps1 $PROFILE fix#32
abdout wants to merge 1 commit into
feat/bootstrapfrom
feat/polish

Conversation

@abdout
Copy link
Copy Markdown
Contributor

@abdout abdout commented May 16, 2026

Summary

Closes two open acceptance criteria from spec #28.

1. install.ps1 $PROFILE bug fix

The current install.ps1 only appends a comment to $PROFILE — never the actual c function. Users had to run doctor -Fix after install to get a working c command (and most never knew that).

Before (the existing bug):

if (-not (Select-String -Path $profilePath -Pattern "claude" -Quiet -ErrorAction SilentlyContinue)) {
    Add-Content -Path $profilePath -Value "`n# Claude Code (Kun Engine)"
}

After:

$fixShell = "$CLAUDE_DIR\scripts\lib\Fix-Shell.ps1"
if (Test-Path $fixShell) {
    . $fixShell
    try { Repair-Profile | Out-Null } catch { Write-Host "  Profile repair skipped: $_" -ForegroundColor Yellow }
}

install.ps1 and doctor -Fix now produce identical $PROFILE output — the canonical c/cc/env-loader/PATH-prepend block from Fix-Shell.ps1 (already shipping in #29).

2. bootstrap -Track flag

New lib/Track-Issue.ps1 (95 lines) — New-TrackingIssue, Update-TrackingIssue, Close-TrackingIssue. When -Track is set, bootstrap creates a GitHub issue at step 3, flips each checkbox live as steps complete, and finalizes at step 16:

Title: bootstrap: HOSTNAME — 2026-05-16 18:42
Body:
  - [x] [0]  ExecutionPolicy → RemoteSigned
  - [x] [1]  Self-elevation (UAC)
  - [x] [2]  OS + PowerShell version check
  - [x] [3]  Logs directory + log file
  - [x] [4]  winget bundle (Git, Node, gh, pwsh, Claude CLI, Claude Desktop)
  - [ ] [5]  PATH refresh                     ← currently here
  - [ ] [6]  pnpm via npm
  ...

Live progress visible from your phone via the GitHub mobile app while the laptop is grinding. Useful for cross-device monitoring and post-mortem forensics.

Design choices

  • Requires gh auth. If gh auth status isn't green at step 3, -Track silently degrades (warning printed, bootstrap continues without tracking). After step 12 OAuth completes, bootstrap retroactively creates the issue and back-fills checkboxes 0-12.
  • Tracking is best-effort. Every gh call is wrapped in try/catch — a GitHub 5xx or network blip never aborts the bootstrap itself.
  • Outcome handling:
    • Success → close issue with ✅ Bootstrap completed successfully
    • Failure → leave issue open with the last 40 log lines in a comment for forensics

Test plan

  • All three files parse cleanly (Parser::ParseFile)
  • bootstrap -DryRun -SkipOAuth -SkipWebStorm -Track runs all 16 steps without errors
  • Fresh VM: bootstrap -Track creates a real issue, updates live, closes on success
  • No-gh-auth scenario: -Track warns at step 3, retroactively creates issue after step 12
  • Failure scenario: kill bootstrap at step 9, verify issue stays open with log attached

Dependencies

This branch stacks on feat/bootstrap (#31). Merge order:

#29 → #30 → #31 → this PR

Closes the two remaining spec #28 ACs:

  • bootstrap -Track creates and updates a GitHub tracking issue
  • ✅ install.ps1 writes the actual c function (not just a comment)

🤖 Generated with Claude Code

Closes two open acceptance criteria from spec #28.

1. **install.ps1 \$PROFILE bug (real)**: previously appended only the
   comment '# Claude Code (Kun Engine)' to \$PROFILE — never the
   actual c/cc/env-loader/PATH-prepend block. Users had to run
   'doctor -Fix' afterward to get a working 'c' command. Fixed by
   sourcing lib/Fix-Shell.ps1 (already shipping in #29) and calling
   Repair-Profile. install.ps1 and 'doctor -Fix' now produce
   identical \$PROFILE output.

2. **bootstrap -Track flag**: new lib/Track-Issue.ps1 with
   New-TrackingIssue / Update-TrackingIssue / Close-TrackingIssue.
   When -Track is set, bootstrap creates a GitHub issue in
   databayt/kun at step 3 with a 17-item checkbox list, then flips
   each box live as steps complete. On success: closes the issue
   with a green comment. On failure: leaves it open with the last
   40 log lines attached for forensics.
   - Requires gh auth (silently degrades if unauthed at step 3,
     then retroactively creates the issue after step 12 OAuth)
   - All gh calls are wrapped in try/catch — tracking failures
     never abort the bootstrap itself
   - Issue label: 'bootstrap-run' (created on first use)

Smoke-tested via 'bootstrap -DryRun -SkipOAuth -SkipWebStorm -Track'
— runs all 16 steps cleanly with the new wiring.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 16, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kun Ready Ready Preview, Comment May 16, 2026 3:53pm

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