Commit Graph
7 Commits
Author SHA1 Message Date
02a2b568d4 fix(examples): keep the macos launchagent running when reinstall is declined (#4734)
## Description

In `examples/deployment/macos-launchagent/install.sh` (lines 96-113 on
`1da8930a`), when the plist already exists the script runs `launchctl
bootout` on the running service first and only then asks `Reinstall?
[y/N]`. Answering `N` prints `Installation cancelled.` and exits 0, but
the service is already stopped, so a cancelled install leaves the proxy
down until the next login or a manual `launchctl bootstrap`.

This PR moves the stop block below the prompt, unchanged, so `bootout`
runs only after the user confirmed, or in `--unattended` mode (which
never prompts). Nothing else changes.

Part of #4730

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `examples/deployment/macos-launchagent/install.sh`: the `launchctl
print` / `launchctl bootout` block moves from before the `Reinstall?`
prompt to after it, with a one-line comment. 6 lines moved, 1 comment
added.

## Testing

- [x] Unit tests pass (`pytest`) (the new test file only; I did not run
the full suite)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

This is a shell example script, so the Python lint and type checks do
not apply to it. The new test file is checked with ruff (below). The
project's bug-fix policy asks for a test that fails before and passes
after, so a committed test runs the real script against stubs (below),
and the earlier manual driver is kept under it.

### Test Output

#### Committed regression test

`tests/test_macos_launchagent_install_cancel.py` runs the real
`install.sh` under `bash` with stub `uname`, `launchctl`, `headroom` and
`lsof` on `PATH` and a fake `HOME`. It is skipped when `bash` is not on
`PATH`. Environment: Ubuntu on WSL2, bash, Python venv
`/var/tmp/cb-fix-8mh5/repo/.venv`, pytest `-p no:cacheprovider`, test
file run from a scratch copy (no `headroom` import, no repo conftest).

Same test file, `install.sh` taken from `origin/main` (`1da8930a`):

```text
FAILED test_declining_reinstall_keeps_the_service_running
1 failed, 1 passed in 0.14s
(test_confirming_reinstall_stops_the_service passes: bootout is still called after y)
```

Same test file, `install.sh` from this branch:

```text
2 passed in 0.06s
```

`ruff format --check` and `ruff check` on the new file: clean.

#### Earlier manual driver

Driver: copies `install.sh` and the plist template into a scratch
directory, puts stubs first on `PATH` (`uname` prints `Darwin`;
`headroom` exits 0; `lsof` exits 1; `launchctl` appends each call to a
log and exits 0, so `launchctl print` reports a running service), points
`HOME` at a fake home that already contains
`Library/LaunchAgents/com.headroom.proxy.plist`, and feeds stdin. Git
Bash on Windows 11. Paths shortened to `<run>`; output filtered to the
lines that matter.

`origin/main` (`1da8930a`), `echo N | bash install.sh`:

```text
⚠ LaunchAgent already installed at: <run>/fakehome/Library/LaunchAgents/com.headroom.proxy.plist
==> Stopping existing service...
Installation cancelled.
rc=0
--- launchctl call log:
launchctl print gui/197609/com.headroom.proxy
launchctl bootout gui/197609/com.headroom.proxy
```

This branch, `echo N | bash install.sh`:

```text
⚠ LaunchAgent already installed at: <run>/fakehome/Library/LaunchAgents/com.headroom.proxy.plist
Installation cancelled.
rc=0
--- launchctl call log:
(no calls)
```

This branch, `printf 'y\n\n' | bash install.sh` (answer `y`, then the
default port). Reinstall still boots out and bootstraps; `origin/main`
produces the same four calls:

```text
⚠ LaunchAgent already installed at: <run>/fakehome/Library/LaunchAgents/com.headroom.proxy.plist
==> Stopping existing service...
✓ Created: <run>/fakehome/Library/LaunchAgents/com.headroom.proxy.plist
✓ LaunchAgent loaded successfully
✓ Service is running
⚠ Service is running but port 8787 is not listening yet
✓ Headroom proxy installed successfully!
rc=0
--- launchctl call log:
launchctl print gui/197609/com.headroom.proxy
launchctl bootout gui/197609/com.headroom.proxy
launchctl bootstrap gui/197609 <run>/fakehome/Library/LaunchAgents/com.headroom.proxy.plist
launchctl print gui/197609/com.headroom.proxy
```

(The "port 8787 is not listening" warning comes from the `lsof` stub
exiting 1; it is not a finding.)

## Real Behavior Proof

- Environment: Git Bash on Windows 11 with stubbed `uname`, `launchctl`,
`headroom`, `lsof`; no macOS, no real LaunchAgent.
- Exact command / steps: the driver above, `echo N | bash install.sh` on
`origin/main`'s script and on this branch's, then `printf 'y\n\n' | bash
install.sh` on both.
- Observed result: on `origin/main`, answering `N` made the stub log
`launchctl bootout` before `Installation cancelled.`; on this branch the
log is empty. Answering `y` makes the same four `launchctl` calls on
both.
- Not tested: real macOS launchd (the proof uses stubs on Windows and
WSL, not a live LaunchAgent); real `launchctl` on macOS; the
`--unattended` path (the block there runs unchanged, only its place in
the file differs, but I did not run it).

## Runtime Rollout Safety

- Rollout-managed feature(s): none; example script only.
- Minimum rollout channel: n/a
- Stable/default behavior changed: only the cancel path: the running
service is no longer stopped when the user declines.
- Kill switch / disable path: n/a
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this commit.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [x] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes (new test
file only; the stubbed runs above are the check)
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- Scope is an example script; the effect of the bug is a stopped proxy
on the user's own machine.
- Other defects in the same directory are in #4730 and separate PRs.

Produced with AI assistance (Claude Code) operated by me (HetCreep); the
driver was run on my machine against a clone of the repository.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-11-11 09:57:40 -06:00
a91c48a3a4 fix(examples): validate the macos launchagent port as plain decimal (#4733)
## Description

`examples/deployment/macos-launchagent/install.sh` checks the port with
`! [[ "${PORT}" =~ ^[0-9]+$ ]] || [[ "${PORT}" -lt 1024 ]] || [[
"${PORT}" -gt 65535 ]]` (line 126 on `1da8930a`). The regex lets any
digit string through, and `-lt` / `-gt` inside `[[ ]]` do bash
arithmetic, so:

- a leading `0` is read as octal: `0100000` is 32768 and passes; `08080`
is not valid octal, bash prints an arithmetic error, and the failed test
counts as false, so it is accepted;
- a number past 64 bits wraps: `18446744073709553616` passes the range
test;
- `01024` is rejected although the decimal value 1024 is in range.

The real command is `headroom proxy --port`, a `click.IntRange(1,
65535)` (`headroom/cli/proxy.py:298-301`, read, not run), so an accepted
bad value is written into the plist and the LaunchAgent fails when it
starts.

This PR requires 4 or 5 decimal digits with no leading zero
(`^[1-9][0-9]{3,4}$`) before the existing range test. Every accepted
value is then plain decimal 1000-99999, which cannot overflow, and the
`-lt 1024` / `-gt 65535` checks do the rest. A port written with a
leading zero (`01024`) is rejected; that is deliberate.

Part of #4730

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `examples/deployment/macos-launchagent/install.sh`: the port regex is
`^[1-9][0-9]{3,4}$` instead of `^[0-9]+$`. One line.

## Testing

- [x] Unit tests pass (`pytest`) (the new test file only; I did not run
the full suite)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [x] New tests added for new functionality
- [x] Manual testing performed

This is a shell example script, so the Python lint and type checks do
not apply to it. The new test file is checked with ruff (below). The
project's bug-fix policy asks for a test that fails before and passes
after, so a committed test runs the real script (below), and the earlier
probe is kept under it.

### Test Output

#### Committed regression test

`tests/test_macos_launchagent_install_port.py` runs the real
`install.sh` under `bash` with stub `uname`, `launchctl`, `headroom` and
`lsof` on `PATH` and a fake `HOME`. It is skipped when `bash` is not on
`PATH`. Environment: Ubuntu on WSL2, bash, Python venv
`/var/tmp/cb-fix-8mh5/repo/.venv`, pytest `-p no:cacheprovider`, test
file run from a scratch copy (no `headroom` import, no repo conftest).

Same test file, `install.sh` taken from `origin/main` (`1da8930a`):

```text
FAILED test_invalid_port_is_rejected[0100000]
FAILED test_invalid_port_is_rejected[08080]
FAILED test_invalid_port_is_rejected[18446744073709553616]
3 failed, 7 passed in 0.30s
```

Same test file, `install.sh` from this branch:

```text
10 passed in 0.33s
```

`ruff format --check` and `ruff check` on the new file: clean.

#### Earlier manual driver

A small probe takes the condition line that follows `# Validate port
number` out of the given `install.sh` and evaluates it for each value
(Git Bash on Windows 11, bash 5.3.15; `<probe>` stands for the local
path of my probe script).

`origin/main` (`1da8930a`):

```text
condition: ! [[ "${PORT}" =~ ^[0-9]+$ ]] || [[ "${PORT}" -lt 1024 ]] || [[ "${PORT}" -gt 65535 ]]
'0100000'              ACCEPT 
'08080'                <probe>: line 8: [[: 08080: value too great for base (error token is "08080") <probe>: line 8: [[: 08080: value too great for base (error token is "08080") ACCEPT 
'18446744073709553616' ACCEPT 
'01024'                REJECT 
'1023'                 REJECT 
'1024'                 ACCEPT 
'8787'                 ACCEPT 
'65535'                ACCEPT 
'65536'                REJECT 
'abc'                  REJECT 
''                     REJECT 
```

This branch:

```text
condition: ! [[ "${PORT}" =~ ^[1-9][0-9]{3,4}$ ]] || [[ "${PORT}" -lt 1024 ]] || [[ "${PORT}" -gt 65535 ]]
'0100000'              REJECT 
'08080'                REJECT 
'18446744073709553616' REJECT 
'01024'                REJECT 
'1023'                 REJECT 
'1024'                 ACCEPT 
'8787'                 ACCEPT 
'65535'                ACCEPT 
'65536'                REJECT 
'abc'                  REJECT 
''                     REJECT 
```

`ACCEPT` means the condition is false, so `install.sh` goes on; `REJECT`
means it calls `fatal`. The three bad values and nothing else change
from ACCEPT to REJECT, plus `08080` loses its bash error. `01024` was
already rejected on main and stays rejected.

## Real Behavior Proof

- Environment: Git Bash on Windows 11, bash 5.3.15. No macOS available.
- Exact command / steps: the probe above, run once on `origin/main`'s
`install.sh` and once on this branch's, for the values `0100000 08080
18446744073709553616 01024 1023 1024 8787 65535 65536 abc ''`.
- Observed result: on `origin/main` `0100000`, `08080` (with a bash
arithmetic error) and `18446744073709553616` are accepted; on this
branch all three are rejected, and `1024`, `8787`, `65535` are still
accepted. Tables above.
- Not tested: real macOS launchd; macOS bash 3.2 (the system bash) and
`launchctl`; I did not run `install.sh` end to end on a Mac. That
`headroom proxy --port` rejects such values is read from
`headroom/cli/proxy.py:298-301`, not run.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; example script only.
- Minimum rollout channel: n/a
- Stable/default behavior changed: no for valid ports. Invalid ports
that were accepted are now rejected, and `--port 01024`-style input with
a leading zero is rejected.
- Kill switch / disable path: n/a
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this commit.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes (new test
file only; the probe above is the check)
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- Scope is an example script. The wrong port only breaks that user's own
LaunchAgent; nothing here is a security issue.
- Other defects in the same directory are in #4730 and separate PRs.

Produced with AI assistance (Claude Code) operated by me (HetCreep); the
probe was run on my machine against a clone of the repository.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
2026-11-10 22:45:21 -06:00
HetCreepandClaude Sonnet 5.5 46a3d910c9 docs(examples): name the port variable shell-integration.sh reads (#4735)
## Description

`examples/deployment/macos-launchagent/README.md` (line 12 on
`1da8930a`) tells users to add `export HEADROOM_PORT=8787` before
sourcing `shell-integration.sh`. That script reads `HEADROOM_PROXY_PORT`
(`shell-integration.sh:22`), and `install.sh:214` prints the same name
in its own instructions. A user who follows the README with a
non-default port exports a variable the script ignores, so it checks
port 8787 and sets `ANTHROPIC_BASE_URL` to the wrong port or reports the
proxy as not running.

This PR changes the README line to `HEADROOM_PROXY_PORT`. Docs only.

Part of #4730

## Type of Change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `examples/deployment/macos-launchagent/README.md`: `export
HEADROOM_PORT=8787` becomes `export HEADROOM_PROXY_PORT=8787`. One line.

## Testing

- [ ] Unit tests pass (`pytest`)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [ ] New tests added for new functionality
- [x] Manual testing performed

Docs-only change; no code to run. Manual check: a grep of the directory
before and after (below).

### Test Output

`grep -rn "HEADROOM_PORT\|HEADROOM_PROXY_PORT"
examples/deployment/macos-launchagent` on `origin/main` (`1da8930a`):

```text
./com.headroom.proxy.plist.template:24:        <key>HEADROOM_PROXY_PORT</key>
./install.sh:214:echo "    export HEADROOM_PROXY_PORT=${PORT}"
./README.md:12:export HEADROOM_PORT=8787
./shell-integration.sh:11:#     export HEADROOM_PROXY_PORT=8787  # Optional: customize port (default: 8787)
./shell-integration.sh:22:HEADROOM_PROXY_PORT="${HEADROOM_PROXY_PORT:-8787}"
./shell-integration.sh:34:  lsof -iTCP:"${HEADROOM_PROXY_PORT}" -sTCP:LISTEN -t >/dev/null 2>&1
./shell-integration.sh:59:  export ANTHROPIC_BASE_URL="http://localhost:${HEADROOM_PROXY_PORT}"
./shell-integration.sh:64:    export ANTHROPIC_BASE_URL="http://localhost:${HEADROOM_PROXY_PORT}"
./shell-integration.sh:65:    echo "✓ Headroom proxy started on port ${HEADROOM_PROXY_PORT}"
./shell-integration.sh:68:    echo "⚠ Headroom proxy not running on port ${HEADROOM_PROXY_PORT}"
```

This branch (same command): identical, except line 12 is now

```text
./README.md:12:export HEADROOM_PROXY_PORT=8787
```

so `HEADROOM_PORT` no longer appears in the directory.

## Real Behavior Proof

- Environment: docs-only; read in a clone of the repository at
`1da8930a`.
- Exact command / steps: the grep above, before and after.
- Observed result: `README.md:12` was the only place in the directory
that used `HEADROOM_PORT`; after the change every mention uses the name
`shell-integration.sh` reads.
- Not tested: the script itself was not run (docs-only).
`wiki/macos-deployment.md` (lines 185, 249, 532) uses `HEADROOM_PORT`
for the same shell-integration step; I left it out to keep this PR to
the example directory.

## Runtime Rollout Safety

- Rollout-managed feature(s): none; docs only.
- Minimum rollout channel: n/a
- Stable/default behavior changed: no
- Kill switch / disable path: n/a
- Unsafe override required: no
- Qualification impact: none
- Rollback path: revert this commit.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes (docs
only, none affected)
- [x] I did **not** edit `CHANGELOG.md` — it is generated by
release-please from my Conventional Commit PR title (a CI guard enforces
this)

## Additional Notes

- Other defects in the same directory are in #4730 and separate PRs.

Produced with AI assistance (Claude Code) operated by me (HetCreep).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 09:08:18 -06:00
Dashsoap 0d4571f72f docs: fix broken macos-deployment.md link in launchagent example (#985)
## Description

The macOS LaunchAgent example README links to
`../../../docs/macos-deployment.md`, but that file does not exist — the
guide lives at `wiki/macos-deployment.md`. This fixes the broken link
(path and text) so "complete documentation" resolves.

Closes #

## Type of Change

- [x] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring (no functional changes)

## Changes Made

- `examples/deployment/macos-launchagent/README.md`: link target
`../../../docs/macos-deployment.md` →
`../../../wiki/macos-deployment.md`, and the link text
`docs/macos-deployment.md` → `wiki/macos-deployment.md`.

## Testing

<!-- Check what you actually ran, then paste the real command output
below. -->

- [ ] Unit tests pass (`pytest`)
- [ ] Linting passes (`ruff check .`)
- [ ] Type checking passes (`mypy headroom`)
- [ ] New tests added for new functionality
- [x] Manual testing performed

### Test Output

```text
# The old target does not exist; the real guide is under wiki/:
$ git ls-files '*macos-deployment.md'
wiki/macos-deployment.md
$ ls docs/content/docs | grep -i macos        # nothing — no docs/macos-deployment.md
$ test -f examples/deployment/macos-launchagent/../../../wiki/macos-deployment.md && echo "new link resolves"
new link resolves

# This was the only stale reference to docs/macos-deployment.md in the repo:
$ grep -rn 'docs/macos-deployment' --include='*.md' --include='*.mdx' .
(only the line fixed by this PR, now pointing at wiki/)
```

## Real Behavior Proof

- Environment: local clone at `origin/main`; documentation-only change.
- Exact command / steps: ran a relative-link checker across all
Markdown/MDX, which flagged
`examples/deployment/macos-launchagent/README.md:168` as the only broken
internal link; confirmed the guide is at `wiki/macos-deployment.md`;
repointed the link there.
- Observed result: the new relative path
`../../../wiki/macos-deployment.md` resolves to the existing macOS
Deployment Guide (which itself documents this exact LaunchAgent setup).
- Not tested: N/A — single-line Markdown link fix; no code, build, or
runtime behavior involved.

## Review Readiness

- [x] I have performed a self-review
- [x] This PR is ready for human review

## Checklist

- [x] My code follows the project's style guidelines
- [x] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] I have updated the CHANGELOG.md if applicable

## Additional Notes

Documentation-only change, so `pytest`/`ruff`/`mypy` over the `headroom`
package are N/A — the diff contains no Python source. The target guide
(`wiki/macos-deployment.md`) covers the same LaunchAgent deployment this
example sets up, so it is the correct destination for "complete
documentation".
2026-06-16 09:43:08 -05:00
pratikbin 42b1cd24de docs: fix env var discrepancies across markdown files
Audit all .md files against codebase; fix wrong names, remove phantom
variables, and correct outdated values:

- HEADROOM_PROXY_PORT → HEADROOM_PORT (proxy.py envvar="HEADROOM_PORT")
- HEADROOM_BIND → HEADROOM_HOST + HEADROOM_PORT (RUST_DEV.md)
- HEADROOM_LEARN_{CLAUDE,CODEX,GEMINI}_ENABLED → HEADROOM_LEARN_CLI
  (only HEADROOM_LEARN_CLI exists in learn/analyzer.py)
- HEADROOM_TRACING_ENABLED → HEADROOM_LANGFUSE_ENABLED=1 with correct
  LANGFUSE_PUBLIC_KEY/SECRET_KEY vars (tracing.py)
- HEADROOM_LOG_LEVEL/LOG_FORMAT → --log-level CLI flag / RUST_LOG
  (no HEADROOM_LOG_LEVEL var exists in code)
- HEADROOM_LOG_LEVEL/HEADROOM_STORE_URL/HEADROOM_DEFAULT_MODE rows
  removed from wiki/configuration.md (all phantom)
- HEADROOM_SUMMARY_{ENABLED,THRESHOLD,RATIO} noted as not yet
  implemented (no code exists)
- HEADROOM_DB_URL/HEADROOM_CACHE_BACKEND → explanatory notes pointing
  to HEADROOM_WORKSPACE_DIR (no external DB support in code)
- HEADROOM_DB_PATH/HEADROOM_CACHE_PATH table rows replaced with actual
  HEADROOM_WORKSPACE_DIR/CONFIG_DIR (paths.py)
2026-05-29 15:04:13 +05:30
Claude Code BotandClaude Sonnet 4.5 063b6e85f4 fix(deployment): correct port placeholder in LaunchAgent plist template
The plist template was using ${HEADROOM_PROXY_PORT} in ProgramArguments,
but LaunchAgent doesn't expand environment variables in that context.
Changed to use __PORT__ placeholder which install.sh replaces via sed.

This fixes the "invalid int value" error when starting the proxy service.

AI review: Clean (via pre-commit hook)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 13:44:30 -08:00
Claude Code BotandClaude Sonnet 4.5 3ac26207b8 docs(deployment): add macOS LaunchAgent deployment guide and templates
Add comprehensive macOS deployment support for running headroom proxy as a
persistent background service using LaunchAgent. This enables automatic startup,
crash recovery, and proper lifecycle management for local development environments.

Files added:
- examples/deployment/macos-launchagent/com.headroom.proxy.plist.template
- examples/deployment/macos-launchagent/install.sh (shellcheck-clean)
- examples/deployment/macos-launchagent/uninstall.sh (shellcheck-clean)
- examples/deployment/macos-launchagent/shell-integration.sh (bash + zsh)
- examples/deployment/macos-launchagent/README.md
- docs/macos-deployment.md

Key features:
- Configurable port via HEADROOM_PROXY_PORT environment variable (default: 8787)
- Automated installation and uninstallation scripts
- Shell integration supporting both bash and zsh
- Comprehensive documentation with troubleshooting guide
- All shell scripts are shellcheck-clean (zero errors, warnings, or info messages)

Files modified:
- .gitignore: Added CLAUDE.md to prevent committing local config
- docs/README.md: Added Deployment & Operations section with navigation entry

AI review: Pending (will be run by pre-commit hook)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-19 13:34:52 -08:00