Skip to content

Add kickstart.sh for first-install walkthroughs - #836

Merged
FuJacob merged 1 commit into
mainfrom
tools/kickstart-script
Sep 28, 2026
Merged

FuJacob merged 1 commit into
mainfrom
tools/kickstart-script

Conversation

@FuJacob

@FuJacob FuJacob commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

Adds scripts/kickstart.sh, which resets this Mac to a first-install state for both Cotabby identities (release com.jacobfu.tabby and dev com.jacobfu.tabby.dev) and builds a Developer ID signed Release DMG the same way release.yml does, so the real new-user path (DMG, drag to Applications, onboarding, permission prompts) can be walked end to end.

  • Quits both apps by exact process name, ejects mounted Cotabby volumes, removes installed/built bundles.
  • Resets TCC for both bundle ids, before removal and again against the new build.
  • Clears preferences through defaults, caches, logs, and saved state; keeps downloaded models unless --wipe-models.
  • Options: --wipe-models, --clean-only, --no-open, --adhoc, -y.

Validation

  • Ran bash scripts/kickstart.sh -y locally against main at 0641e0d: apps stopped, bundles/prefs/logs cleared with models kept, DMG built and signed with Developer ID, and opened.

RetriggerConfidence Score: 0/5

This PR is not safe to merge until the untrusted interpreter path and the reset, signing, and failure-cleanup paths are addressed.

Fix All in CodexFindings

  1. P1 Security Untrusted temporary interpreter ▶
  2. P1 Tagless clones abort after reset ▶
  3. P1 Signing identity can be ambiguous ▶
  4. P1 Dev permissions can survive reset ▶
  5. P1 Failed reset leaves app registered ▶

Summary

Adds a Mac first-install walkthrough script that resets both Cotabby identities, optionally preserves downloaded models, builds and signs a release-style DMG, and opens it for onboarding. The reset and build paths need safeguards for tagless clones, signing-certificate selection, permission-reset coverage, and cleanup after failures.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Confirm reset] --> B[Stop apps and clear local state]
  B --> C{Clean only?}
  C -- Yes --> D[Finish]
  C -- No --> E[Archive and sign release app]
  E --> F[Build and sign DMG]
  F --> G[Register app and reset release TCC]
  G --> H[Unregister app]
  H --> I[Optionally open DMG]
Loading

Reviews (1) · Last reviewed commit: "Add kickstart.sh to reset this Mac to a ..."

Copilot AI balanced review requested due to automatic review settings September 28, 2026 23:39
@FuJacob
FuJacob merged commit 949867e into main Sep 28, 2026
4 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0aa5a9d0-f6c5-4bf2-87a4-eed24bdba312

📥 Commits

Reviewing files that changed from the base of the PR and between 0641e0d and df33d99.

📒 Files selected for processing (1)
  • scripts/kickstart.sh
 _____________________________________________
< You shall not pass...without a code review! >
 ---------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

Comment @coderabbitai help to get the list of available commands.

Comment thread scripts/kickstart.sh
note "signed with: $([[ "$signing_identity" == "-" ]] && echo "ad-hoc" || echo "$signing_identity ($team_id)")"

# dmgbuild lives in an isolated venv because Homebrew Python is externally managed (PEP 668).
[[ -x "$VENV_DIR/bin/python3" ]] || python3 -m venv "$VENV_DIR"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Untrusted temporary interpreter If another local user creates /tmp/Cotabby-dmg-venv/bin/python3 first, this executable-only check accepts it and the build step runs it with the kickstart user's privileges. Use a user-owned environment or verify ownership before executing an existing interpreter.

How this was verified: The fixed /tmp interpreter path is checked only for executability before the script invokes it.

Fix in Codex Fix in Claude Code

Comment thread scripts/kickstart.sh
rm -rf "$archive" "$DMG_PATH"
"$REPO_ROOT/scripts/prepare_cotabby_workspace.sh"

marketing_version="$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Tagless clones abort after reset If the clone has no reachable Git tag, git describe fails and pipefail exits the script before the 0.0.0 fallback runs. By then, the app bundles and preferences have been removed, leaving the Mac reset without a replacement DMG. Handle the failed lookup within this assignment.

Fix in Codex Fix in Claude Code

Comment thread scripts/kickstart.sh
Comment on lines +82 to +84
elif security find-identity -v -p codesigning | grep -q '"Developer ID Application'; then
signing_identity="Developer ID Application"
team_id="$(security find-identity -v -p codesigning | sed -n 's/.*"Developer ID Application: .*(\([A-Z0-9]\{10\}\))".*/\1/p' | head -1)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Signing identity can be ambiguous If the Mac has multiple Developer ID Application certificates, this code takes the first listed team ID but gives Xcode and codesign only the generic identity name. Signing can fail as ambiguous or use a certificate from another team, so the DMG does not reliably reproduce the release identity. Select one certificate and use it throughout.

Fix in Codex Fix in Claude Code

Comment thread scripts/kickstart.sh
Comment on lines +128 to +131
if tccutil reset All "$id" >/dev/null 2>&1; then
note "reset $id"
else
note "skipped $id (no registered app; retried after the build for the release id)"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Dev permissions can survive reset If a previously deleted Cotabby Dev app cannot be resolved for this reset, the script skips it. The later retry registers and resets only the release app, so a subsequent Dev launch can retain an old permission grant instead of starting from the promised first-install state for both identities.

Knowledge Base Used: Permissions and user guidance

Fix in Codex Fix in Claude Code

Comment thread scripts/kickstart.sh
Comment on lines +251 to +253
"$lsregister" -f "$app_path"
tccutil reset All com.jacobfu.tabby >/dev/null && note "reset com.jacobfu.tabby against the new build"
"$lsregister" -u "$app_path"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Failed reset leaves app registered If the post-build tccutil reset fails, errexit stops the script before it unregisters the archived app. That leaves a throwaway copy registered under the release bundle ID, so later app resolution can point to the archive instead of the installed app. Unregister it on the failure path as well.

Fix in Codex Fix in Claude Code

flexi767 added a commit to flexi767/cotabby that referenced this pull request Sep 30, 2026
…anchor

Brings in FuJacob/cotabby through 7724926 (FuJacob#825, FuJacob#827, FuJacob#834, FuJacob#835, FuJacob#836, FuJacob#837,
FuJacob#838): ghost text matched to the host's own rendering plus finishing the word
being typed, Obsidian/Electron accessibility priming, rapid Tab accepts kept
owned while the overlay presents, Apple Intelligence greyed out when
unavailable, a new llama-recall eval fixture, the installer artwork and
kickstart script, and a CI test-flakiness fix.

Resolution, where both sides changed the same thing:
- Suppression reasons: upstream's `CompletionContentPolicy` rejects any
  completion without a letter or digit (`noWordContent`), which subsumes this
  fork's `periodOnly`, so that case and its helper are removed and the bare-dot
  test now asserts the broader reason. Behaviour change worth knowing: a lone
  closing bracket or question mark is now withheld too, where this fork
  deliberately let those through; its test records that.
- Prompt renderer: upstream's `personaLine(_:prefix:)` (the name only appears at
  a sign-off) wins; this fork's learned-phrases section is unchanged beside it.
- Eval case schema: upstream added `visualContextSummary` and `clipboardContext`
  for its recall fixture; this fork's `screenText` and `learnedPhrases` stay
  alongside them. The harness prefers the pre-rendered summary and still puts
  raw `screenText` through the live local passes. Both scorer helpers kept.
- Kept from this fork: the separate test host, the 2-4 word eval preset, phrase
  memory, the clock-time rule, the debug-artifact gate.

Full suite: 2,724 tests, 16 skipped, 0 failures; the installed app's defaults
byte-identical afterwards and no debug artifacts written.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

2 participants