Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Commit b82d7d6

Browse files
authored
Merge pull request #133 from closedloop-ai/PLN-359
PLN-359: Add desktop managed security upgrade
2 parents c2169cc + 80b987b commit b82d7d6

29 files changed

Lines changed: 1510 additions & 21 deletions

.github/workflows/version-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818

1919
- name: Check desktop version bump
2020
run: |
21-
BASE="${{ github.event.pull_request.base.sha }}"
21+
BASE_REF="${{ github.event.pull_request.base.ref }}"
22+
BASE=$(git merge-base "origin/$BASE_REF" HEAD)
2223
2324
OLD_VERSION=$(git show "$BASE":apps/desktop/package.json | jq -r .version)
2425
NEW_VERSION=$(jq -r .version apps/desktop/package.json)

AGENTS.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Use `just` recipes from the repo root:
1717

1818
- `just install`: install workspace dependencies.
1919
- `just desktop-dev`: build and run Electron locally.
20+
- `just desktop-no-auth`: start Electron with gateway auth disabled for local development only.
21+
- `just desktop-debug-auth`: start Electron with debug token minting enabled.
2022
- `just desktop-start`: run Electron from existing build output.
2123
- `just desktop-lint`: run ESLint for desktop sources.
2224
- `just desktop-typecheck`: run TypeScript `--noEmit`.
@@ -31,8 +33,23 @@ TypeScript is strict-mode (`tsconfig.base.json`) and ESM (`NodeNext`).
3133
- Follow existing style: 2-space indentation, semicolons, double quotes.
3234
- Prefer `kebab-case` file names (for example, `gateway-auth.ts`).
3335
- Keep boundaries clear between `main`, `server`, and `shared` modules.
36+
- Use `.js` extensions in ESM imports.
3437
- Prefix intentionally unused variables/args with `_` to satisfy lint rules.
3538
- Do not edit `apps/desktop/src/shared/build-info.ts` manually (auto-generated in prebuild).
39+
- Avoid unnecessary TypeScript casts. Prefer importing concrete shared types, narrowing with type guards, or shaping helper return types so call sites do not need `as` to satisfy the compiler.
40+
- Use shared constants, generated enums, or exported enum-like objects for statuses, reasons, protocol modes, channel names, storage keys, and other contract values. Do not duplicate hardcoded strings when a constant or enum exists.
41+
- Export and reuse shared TypeScript types for cross-module contracts or metadata patches instead of duplicating inline `Pick`/`Partial` shapes in callers.
42+
- When the same helper logic, object shape, or protocol type appears in multiple files, extract it into the nearest shared module owned by that surface instead of committing parallel copies.
43+
- Prefer schema-based object validation and narrowing at JSON, IPC, persisted-store, and HTTP boundaries instead of ad hoc `Record<string, unknown>` casts or manual `typeof value === "object"` checks. Reuse or colocate schemas when the shape is shared.
44+
- For expected service outcomes such as conflicts, invalid state transitions, missing records, validation failures, or unsupported operations, return typed domain results instead of throwing custom Error classes for control flow.
45+
- Avoid `instanceof` and `in` checks for routine error/result handling when a typed result discriminant or shared error code can express the branch more clearly. Reserve thrown errors and exception-style narrowing for unexpected failures or third-party APIs that require it.
46+
47+
## Gateway Operations
48+
Gateway route handlers live under `apps/desktop/src/server/operations/`.
49+
50+
- Before adding a helper to an operation file, check existing shared modules such as `response-utils.ts` for `json()` and `symphony-utils.ts` for `expandHome()`. If helper logic is used by more than one operation, extract it into a shared module instead of copying it.
51+
- Follow the route registration pattern: export `registerXxxRoutes(dispatcher, ...deps)` from the operation module and register it from `router.ts`.
52+
- Do not duplicate local response helpers across operation files.
3653

3754
## Testing Guidelines
3855
Tests run with `tsx --test` (Node test runner) via `just desktop-test`.
@@ -57,3 +74,6 @@ Commit format follows `.gitmessage` and recent history:
5774
- Footer sections: `Testing:` and `Risks:`.
5875

5976
PRs should target `main`, explain what changed and why, link the ticket, and include screenshots/log snippets when UI or gateway behavior changes. Any PR that changes files under `apps/desktop/` must include a version bump in `apps/desktop/package.json`. If the current branch already has a version bump in `apps/desktop/package.json` (committed or uncommitted), do not bump again.
77+
78+
## GitHub Review Replies
79+
When replying to existing GitHub PR review comments, use the review-comment REST reply endpoint (`POST /repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies`) with the original review comment database ID. Do not use GraphQL `addPullRequestReviewThreadReply` unless you have verified in the GitHub UI or REST response model that it renders as a normal inline reply. After posting, verify the new comment has `in_reply_to_id` set to the original comment ID.

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "desktop",
3-
"version": "0.14.0",
3+
"version": "0.14.1",
44
"description": "ClosedLoop Desktop",
55
"author": "ClosedLoop AI <support@closedloop.ai>",
66
"private": true,

0 commit comments

Comments
 (0)