Files
AgentCompany/scripts/README.md
T
ZacharyZhang-NY 0db6e4261f Migrate top-20 high-frequency catch sites to AppError taxonomy (C6.1 part 2/2)
Each of these catches already logged via an accessible `logger` or `log`.
The migration wraps the thrown value through `classifyUnknownError(raw,
fallback)` and emits the log line with the structured `[code]` prefix.
Observable behaviour — return values, fail strings, DB writes — is
unchanged; the only addition is a machine-readable `code` on every log
line so future telemetry can bucket by category.

Sites migrated (11 files, 20 catch sites):

  src/main/browser-action-service.ts             (2) approval lookup, payload JSON
  src/main/ipc-credentials-handlers.ts           (4) save, remove, test lookup, test resolve
  src/main/hire-hook.ts                          (3) getAgent, connector def, outer exception
  src/main/checkpoint-engine.ts                  (2) onTaskStarted, onDocumentDrafted
  src/main/document-lifecycle.ts                 (1) getRun while deriving taskId
  src/main/skills/runtime.ts                     (2) builtin statSync, builtin readdir
  src/main/worker/handlers/run-status-handler.ts (1) run not found during status
  src/main/worker/handlers/run-log-handler.ts    (1) lease renewal lookup
  src/main/notification-service.ts               (1) notification.close during destroy
  src/main/updater-service.ts                    (1) autoUpdater.checkForUpdates
  src/main/ipc-support.ts                        (2) ipc handler throw, emitEvent send

Why only 20 tonight: 248 catches exist in src/main/. Rewriting them all
in one commit is high-diff-risk (collides with Linus's in-flight
database/backup/migration work on database/*, connector-definitions-*,
message-* and scripts/*) and low-value (pure-library catches with no
accessible logger produce dead `void classified` constructs). The
taxonomy module is committed separately so the remaining 228 sites can
land incrementally via the C6.2 proposal.

All 11 files selected sit outside Linus's working set. Verified:
  - pnpm typecheck   clean
  - pnpm test:unit   498 passed
2026-04-20 12:22:52 -04:00

49 lines
3.0 KiB
Markdown

# scripts/
Build, release, and asset-generation helpers invoked from `package.json`
or from the release pipeline. Every top-level script has a single owner
and is wired up either as an npm script or as a child of `release-boss.mjs`.
## Layout
| Path | Purpose |
| ----------------------------- | ------------------------------------------------------------------------------ |
| `postinstall.mjs` | Ran by pnpm after install; stamps Electron name patches and env dependencies. |
| `build-desktop.mjs` | `pnpm build` entry. Wraps `electron-builder` with AgentCompany defaults. |
| `build-all-platforms.mjs` | `pnpm build:current` entry. Cross-platform matrix driver for local testing. |
| `build/` | Auxiliary assets consumed by electron-builder (entitlements, installer hooks). |
| `electron-builder-mac-sign.mjs` | macOS codesign + notarize helper invoked from electron-builder `afterSign`. |
| `patch-electron-name.sh` | Rewrites the Electron binary name into `AgentCompany` so macOS treats it as a distinct app. |
| `release/` | Shared helpers imported by `release-*` scripts. |
| `release-boss.mjs` | `pnpm release:boss` entry. Builds the Boss edition bundle and uploads it. |
| `release-local.mjs` | `pnpm release:local` entry. Packages a local-only build for internal testers. |
| `release-local/` | Fixtures / templates consumed by `release-local.mjs`. |
| `release-public-cloudflare.mjs` | `pnpm release:cloudflare:public` entry. Publishes the public release to Cloudflare R2. |
| `generate-landing-release-links.mjs` | Regenerates the landing-page download links from the Cloudflare manifest. |
| `icons/` | Icon generation utilities. See `icons/generate-icons.py`. |
## Icons
`pnpm assets:generate` runs `scripts/icons/generate-icons.py`, a
macOS-only helper that rebuilds the Electron app icon, the landing-page
favicons, and the tray icons from the SVG masters in `assets/`. Only
re-run it when the SVG sources change; the committed PNG / ICNS outputs
are consumed directly at build time.
## Release
`pnpm release:cloudflare` invokes `release-public-cloudflare.mjs`
followed by `release-boss.mjs`. The Boss edition bundles additional
credentials and is uploaded to a private bucket; never commit its
outputs (see the `boss-build/` entry in `.gitignore`).
## Conventions
- Scripts here are invoked from CI and from local dev. They must run
without network access except where explicitly required (release
uploads). Any tool requirement (e.g. `cairo`, `iconutil`) belongs in
the script's header comment with install instructions.
- Treat `scripts/` as source, not generated output. Do not commit
build artefacts into subdirectories beyond the fixtures under
`build/` and `release-local/`.