Skip to content

fix: resolve build errors and add launcher script#168

Open
mattleaverton wants to merge 1 commit intodanshapiro:mainfrom
mattleaverton:fix/build-warnings-and-launcher
Open

fix: resolve build errors and add launcher script#168
mattleaverton wants to merge 1 commit intodanshapiro:mainfrom
mattleaverton:fix/build-warnings-and-launcher

Conversation

@mattleaverton
Copy link
Contributor

Summary

  • Fix 3 TS2532 errors in server/agent-api/layout-store.tsensurePaneTitleMaps() guarantees nested objects exist but TypeScript can't narrow across function boundaries; added non-null assertions at the call sites
  • Fix vite "dynamic import will not move module into another chunk" warnings for lean-qrSetupWizard.tsx was statically importing while App.tsx dynamically imported, defeating code splitting. Switched SetupWizard to dynamic imports to match
  • Add scripts/launch.sh — one-command server startup that pulls upstream, builds, launches the server backgrounded, and captures the access URL to ~/.freshell/url

Test plan

  • npm run build passes with no errors or warnings
  • npm test passes (2 pre-existing failures unrelated to these changes)
  • Verified lean-qr now chunks separately (svg-DjJviKnF.js + index-BnEwwU7r.js)

🤖 Generated with Claude Code

Copy link

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

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: af76a06933

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


# Wait for the URL to appear in log output (up to 30s)
for i in $(seq 1 60); do
if url_line=$(grep -o 'http://[^ ]*token=[^ ]*' "$LOG_FILE" 2>/dev/null | head -1); then

Choose a reason for hiding this comment

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

P2 Badge Strip ANSI escapes before persisting startup URL

The URL extraction regex reads directly from server.log, but startup URLs are printed with ANSI color wrappers, so grep -o 'http://[^ ]*token=[^ ]*' captures trailing escape bytes (for example \x1b[0m) as part of the match. This makes ~/.freshell/url contain non-printable characters, which can break downstream consumers that parse or open the saved URL programmatically.

Useful? React with 👍 / 👎.

cd "$FRESHELL_DIR"

# Check for already-running server
if [[ -f "$PID_FILE" ]] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then

Choose a reason for hiding this comment

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

P2 Badge Verify PID ownership before declaring server already running

The startup guard only checks whether the PID in server.pid exists via kill -0; if a stale PID file points to a reused PID from an unrelated process, the script exits early with "already running" even though Freshell is not running. This false-positive blocks recovery after crashes/reboots until users manually remove the pid file.

Useful? React with 👍 / 👎.

@mattleaverton
Copy link
Contributor Author

Addressed both review items in 6e0d41d:

  1. ANSI stripping — strips escape sequences with sed before extracting the URL, so ~/.freshell/url contains a clean URL
  2. PID ownership — verifies the saved PID is actually a dist/server/index.js process via ps -p, cleans up stale PID files otherwise

@mattleaverton mattleaverton force-pushed the fix/build-warnings-and-launcher branch from 6e0d41d to 9fb7305 Compare March 10, 2026 20:40
Add scripts/launch.sh that pulls upstream and builds when on main,
or warns and proceeds when on another branch. Starts the server
backgrounded and captures the access URL to ~/.freshell/url.

Validates PID ownership before declaring server already running (checks
process args, not just PID existence). Strips ANSI escapes from log
output before extracting the URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mattleaverton mattleaverton force-pushed the fix/build-warnings-and-launcher branch from 9fb7305 to ae46942 Compare March 10, 2026 20:50
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