@arach/lattices 0.2.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +172 -86
  3. package/apps/mac/Info.plist +43 -0
  4. package/apps/mac/Lattices.app/Contents/Info.plist +43 -0
  5. package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
  6. package/apps/mac/Lattices.app/Contents/Resources/AppIcon.icns +0 -0
  7. package/apps/mac/Lattices.app/Contents/Resources/docs/assistant-knowledge.md +130 -0
  8. package/apps/mac/Lattices.app/Contents/Resources/tap.wav +0 -0
  9. package/apps/mac/Lattices.app/Contents/_CodeSignature/CodeResources +150 -0
  10. package/apps/mac/Lattices.entitlements +21 -0
  11. package/apps/mac/Resources/Pets/assistant-spark/pet.json +62 -0
  12. package/apps/mac/Resources/Pets/assistant-spark/spritesheet.webp +0 -0
  13. package/apps/mac/Resources/Pets/scout-ranger/pet.json +6 -0
  14. package/apps/mac/Resources/Pets/scout-ranger/spritesheet.webp +0 -0
  15. package/apps/mac/Resources/tap.wav +0 -0
  16. package/assets/AppIcon.icns +0 -0
  17. package/bin/assistant-intelligence.ts +912 -0
  18. package/bin/cli/capture.ts +252 -0
  19. package/bin/cli/daemon.ts +22 -0
  20. package/bin/cli/helpers.ts +105 -0
  21. package/bin/cli/layer.ts +178 -0
  22. package/bin/cli/runs.ts +43 -0
  23. package/bin/cli/search.ts +141 -0
  24. package/bin/cli/session.ts +32 -0
  25. package/bin/client.ts +17 -0
  26. package/bin/cua.ts +26 -0
  27. package/bin/{daemon-client.js → daemon-client.ts} +49 -30
  28. package/bin/handsoff-infer.ts +96 -0
  29. package/bin/handsoff-worker.ts +531 -0
  30. package/bin/infer.ts +424 -0
  31. package/bin/keychain.ts +75 -0
  32. package/bin/lattices-app.ts +655 -0
  33. package/bin/lattices-build +125 -0
  34. package/bin/lattices-build-env.ts +77 -0
  35. package/bin/lattices-dev +362 -0
  36. package/bin/lattices.ts +3260 -0
  37. package/bin/project-twin.ts +645 -0
  38. package/docs/agent-execution-plan.md +562 -0
  39. package/docs/agent-layer-guide.md +207 -0
  40. package/docs/agents.md +233 -0
  41. package/docs/ai-chat-ux-review.md +416 -0
  42. package/docs/api.md +1041 -47
  43. package/docs/app.md +96 -13
  44. package/docs/assistant-knowledge.md +130 -0
  45. package/docs/companion-deck.md +209 -0
  46. package/docs/component-extraction-roadmap.md +392 -0
  47. package/docs/concepts.md +13 -12
  48. package/docs/config.md +83 -10
  49. package/docs/gesture-customization-proposal.md +520 -0
  50. package/docs/handsoff-test-scenarios.md +84 -0
  51. package/docs/hyperspace-grid-snappiness.md +210 -0
  52. package/docs/layers.md +176 -28
  53. package/docs/mouse-gestures.md +244 -0
  54. package/docs/ocr.md +21 -9
  55. package/docs/overview.md +42 -23
  56. package/docs/presentation-execution-review.md +491 -0
  57. package/docs/prompts/hands-off-system.md +382 -0
  58. package/docs/prompts/hands-off-turn.md +30 -0
  59. package/docs/prompts/voice-advisor.md +31 -0
  60. package/docs/prompts/voice-fallback.md +23 -0
  61. package/docs/proposals/LAT-001-gesture-visual-customization.md +522 -0
  62. package/docs/proposals/LAT-002-shared-overlay-canvas.md +353 -0
  63. package/docs/proposals/LAT-003-menu-bar-controller-architecture.md +291 -0
  64. package/docs/proposals/LAT-004-interactive-overlay-actors.md +534 -0
  65. package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
  66. package/docs/proposals/LAT-006-followup-gaps.md +103 -0
  67. package/docs/proposals/LAT-006-runs-and-capture-in-lattices.md +566 -0
  68. package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
  69. package/docs/quickstart.md +8 -12
  70. package/docs/reference/dewey.config.ts +74 -0
  71. package/docs/reference/install-agent.md +79 -0
  72. package/docs/release.md +172 -0
  73. package/docs/repo-structure.md +100 -0
  74. package/docs/terminal-kit.md +87 -0
  75. package/docs/tiling-reference.md +224 -0
  76. package/docs/twins.md +138 -0
  77. package/docs/voice-command-protocol.md +278 -0
  78. package/docs/voice-error-model.md +73 -0
  79. package/docs/voice.md +221 -0
  80. package/package.json +69 -16
  81. package/packages/npm/sdk/cua.d.mts +1 -0
  82. package/packages/npm/sdk/cua.d.ts +188 -0
  83. package/packages/npm/sdk/cua.mjs +376 -0
  84. package/app/Lattices.app/Contents/Info.plist +0 -24
  85. package/app/Package.swift +0 -13
  86. package/app/Sources/ActionRow.swift +0 -61
  87. package/app/Sources/App.swift +0 -10
  88. package/app/Sources/AppDelegate.swift +0 -234
  89. package/app/Sources/AppShellView.swift +0 -62
  90. package/app/Sources/AppTypeClassifier.swift +0 -70
  91. package/app/Sources/AppWindowShell.swift +0 -63
  92. package/app/Sources/CheatSheetHUD.swift +0 -332
  93. package/app/Sources/CommandModeState.swift +0 -1362
  94. package/app/Sources/CommandModeView.swift +0 -1405
  95. package/app/Sources/CommandModeWindow.swift +0 -192
  96. package/app/Sources/CommandPaletteView.swift +0 -307
  97. package/app/Sources/CommandPaletteWindow.swift +0 -134
  98. package/app/Sources/DaemonProtocol.swift +0 -101
  99. package/app/Sources/DaemonServer.swift +0 -414
  100. package/app/Sources/DesktopModel.swift +0 -121
  101. package/app/Sources/DesktopModelTypes.swift +0 -71
  102. package/app/Sources/DiagnosticLog.swift +0 -271
  103. package/app/Sources/EventBus.swift +0 -30
  104. package/app/Sources/HotkeyManager.swift +0 -250
  105. package/app/Sources/HotkeyStore.swift +0 -338
  106. package/app/Sources/InventoryManager.swift +0 -35
  107. package/app/Sources/InventoryPath.swift +0 -43
  108. package/app/Sources/KeyRecorderView.swift +0 -210
  109. package/app/Sources/LatticesApi.swift +0 -1125
  110. package/app/Sources/MainView.swift +0 -467
  111. package/app/Sources/MainWindow.swift +0 -83
  112. package/app/Sources/OcrModel.swift +0 -309
  113. package/app/Sources/OcrStore.swift +0 -295
  114. package/app/Sources/OmniSearchState.swift +0 -283
  115. package/app/Sources/OmniSearchView.swift +0 -288
  116. package/app/Sources/OmniSearchWindow.swift +0 -105
  117. package/app/Sources/OrphanRow.swift +0 -129
  118. package/app/Sources/PaletteCommand.swift +0 -419
  119. package/app/Sources/PermissionChecker.swift +0 -125
  120. package/app/Sources/Preferences.swift +0 -92
  121. package/app/Sources/ProcessModel.swift +0 -199
  122. package/app/Sources/ProcessQuery.swift +0 -151
  123. package/app/Sources/Project.swift +0 -28
  124. package/app/Sources/ProjectRow.swift +0 -368
  125. package/app/Sources/ProjectScanner.swift +0 -121
  126. package/app/Sources/ScreenMapState.swift +0 -2387
  127. package/app/Sources/ScreenMapView.swift +0 -2820
  128. package/app/Sources/ScreenMapWindowController.swift +0 -89
  129. package/app/Sources/SessionManager.swift +0 -72
  130. package/app/Sources/SettingsView.swift +0 -1053
  131. package/app/Sources/SettingsWindow.swift +0 -20
  132. package/app/Sources/TabGroupRow.swift +0 -178
  133. package/app/Sources/Terminal.swift +0 -259
  134. package/app/Sources/TerminalQuery.swift +0 -156
  135. package/app/Sources/TerminalSynthesizer.swift +0 -200
  136. package/app/Sources/Theme.swift +0 -163
  137. package/app/Sources/TilePickerView.swift +0 -209
  138. package/app/Sources/TmuxModel.swift +0 -53
  139. package/app/Sources/TmuxQuery.swift +0 -81
  140. package/app/Sources/WindowTiler.swift +0 -1755
  141. package/app/Sources/WorkspaceManager.swift +0 -434
  142. package/bin/lattices-app.js +0 -221
  143. package/bin/lattices.js +0 -1418
@@ -0,0 +1,128 @@
1
+ # LAT-007: Unified App Shell
2
+
3
+ ## Summary
4
+
5
+ Lattices should feel like one structured app, not a collection of useful
6
+ windows added one feature at a time. The native app already has a strong
7
+ starting point in the unified shell managed by `ScreenMapWindowController`.
8
+ Future feature work should treat that shell as the durable product surface.
9
+
10
+ Transient surfaces such as the command palette, voice command window, HUD,
11
+ and menu bar popover should become launchers, inspectors, or fast overlays
12
+ that route back into the shell for persistent workflows.
13
+
14
+ ## Product Shape
15
+
16
+ The main Lattices window should own the primary information architecture:
17
+
18
+ | Area | Purpose |
19
+ |------|---------|
20
+ | Home | Workspace status, desktop control, agent/search entry points, and discoverable project launch |
21
+ | Assistant | Chat and agent-oriented workspace help |
22
+ | Layout | Visual desktop map and window arrangement |
23
+ | Desktop Inventory | Window/search/OCR inventory |
24
+ | Activity | Logs, diagnostics, event history, and operational feedback |
25
+ | Settings | Preferences, permissions, shortcuts, mouse, AI, OCR, companion |
26
+ | Docs | Reference and onboarding material |
27
+
28
+ The menu bar popover should stay lightweight: quick project launch plus
29
+ buttons into the main shell. The command palette should stay global and
30
+ action-oriented. The HUD and voice UI should stay transient and contextual.
31
+
32
+ ## First User Experience
33
+
34
+ The friendliest starting point is Home, not Settings and not a floating
35
+ utility panel.
36
+
37
+ On first launch:
38
+
39
+ 1. The onboarding window introduces the product briefly.
40
+ 2. Onboarding presents optional capabilities only; it does not require project
41
+ setup or terminal-session setup.
42
+ 3. Completing onboarding opens the unified Home page.
43
+ 4. Home starts with desktop control, search/context, and assistant entry points;
44
+ project launch remains discoverable inside the app.
45
+ 5. Missing setup is explained in place. Settings remains available, but the app
46
+ should not throw the user into Settings just because a scan root is missing.
47
+
48
+ This keeps the first mental model simple:
49
+
50
+ > Lattices sees your workspace, helps arrange it, and gives agents local context.
51
+ > Project and terminal workflows are useful depth, not the first required step.
52
+
53
+ ## Surface Rules
54
+
55
+ 1. Durable state belongs in the unified app shell.
56
+ 2. Popovers and overlays should not become alternate versions of the app.
57
+ 3. Feature entry points should navigate to an app page when the user needs
58
+ to read, configure, inspect, or continue a workflow.
59
+ 4. Floating panels are appropriate for short-lived interactions: search,
60
+ command execution, voice capture, HUD previews, and permission helpers.
61
+ 5. Settings, diagnostics, docs, assistant setup, and inventory views should
62
+ avoid standalone windows unless there is an explicit debugging reason.
63
+ 6. Page changes inside the shell should preserve the user's window size and
64
+ position. Pick a good initial size, then let the window feel stable.
65
+
66
+ ## Migration Plan
67
+
68
+ ### Phase 1: Route Existing Entry Points
69
+
70
+ - Add missing primary pages to the unified shell.
71
+ - Redirect menu, palette, hotkey, and footer links into shell pages.
72
+ - Keep legacy utility windows available internally where useful, but stop
73
+ presenting them from normal app navigation.
74
+
75
+ ### Phase 2: Normalize Page Responsibilities
76
+
77
+ - Make Home the status and launch surface.
78
+ - Make Layout the only visual arrangement surface.
79
+ - Make Desktop Inventory the only persistent search/inventory surface.
80
+ - Make Activity the only persistent diagnostics surface.
81
+ - Keep Settings and Docs under the shell instead of separate windows.
82
+
83
+ ### Phase 3: Reduce Duplicate UI
84
+
85
+ - Convert repeated panel headers, footers, and shell chrome into reusable
86
+ components.
87
+ - Move preview rendering and diagnostic log rendering into shared views.
88
+ - Keep command palette rows and menu items as bindings to canonical actions.
89
+
90
+ ### Phase 4: Product-Level Navigation
91
+
92
+ - Add a route helper for app pages so callers express intent like
93
+ `showActivity()` or `showSettings(.shortcuts)` instead of manually choosing
94
+ windows.
95
+ - Add page-specific deep links for companion, docs, and diagnostics.
96
+ - Record navigation in diagnostics so support sessions can reconstruct how a
97
+ user reached a feature.
98
+
99
+ ## First Slice
100
+
101
+ The first implemented slice is Activity consolidation:
102
+
103
+ - `Activity` is now a primary app-shell page.
104
+ - Home links to Activity.
105
+ - menu bar, command palette, hotkey, settings/docs footers, launch flag, voice,
106
+ and Layout log links route to the Activity page.
107
+ - The legacy floating `DiagnosticWindow` remains for internal/debug use.
108
+
109
+ The second implemented slice is first-run Home consolidation:
110
+
111
+ - Completing onboarding opens Home.
112
+ - Missing scan-root setup is handled inside Home instead of auto-opening
113
+ Settings.
114
+ - Onboarding no longer introduces project-root or tmux setup.
115
+ - Home shows a desktop-first getting-started path when no projects are
116
+ discovered: layout, search/context, and assistant.
117
+ - Project scanning is skipped when the scan root is empty.
118
+ - App-shell tab navigation preserves the current window frame instead of
119
+ resizing per page.
120
+
121
+ ## Open Questions
122
+
123
+ - Should the menu bar click open Home in the unified shell by default, leaving
124
+ the project popover as an explicit quick-launch mode?
125
+ - Should Command Mode become the embedded Desktop Inventory page only, with the
126
+ standalone panel reserved for a hotkey overlay?
127
+ - Should Settings expose direct subroutes such as `settings.shortcuts` and
128
+ `settings.permissions`?
@@ -8,15 +8,9 @@ Four steps to a running workspace.
8
8
 
9
9
  ## 1. Install lattices
10
10
 
11
- ```bash
12
- npm install -g @arach/lattices
13
- ```
14
-
15
- Or install from source:
16
-
17
11
  ```bash
18
12
  git clone https://github.com/arach/lattices
19
- cd lattices && npm link
13
+ cd lattices && bun link
20
14
  ```
21
15
 
22
16
  Verify: `lattices help` should print usage info.
@@ -45,7 +39,7 @@ This generates a config like:
45
39
  ```json
46
40
  {
47
41
  "panes": [
48
- { "name": "claude", "cmd": "claude", "size": 60 },
42
+ { "name": "shell", "size": 60 },
49
43
  { "name": "server", "cmd": "bun dev" }
50
44
  ]
51
45
  }
@@ -61,15 +55,17 @@ your pane layout:
61
55
 
62
56
  ```bash
63
57
  brew install tmux
64
- cd ~/your-project && lattices
58
+ cd ~/your-project
59
+ lattices # home screen: status only, does not attach
60
+ lattices start # create or reattach the session
65
61
  ```
66
62
 
67
63
  This creates a tmux session with your configured panes side by side.
68
64
  The session persists in the background — close your terminal, reopen it,
69
- run `lattices` again, and everything is still there.
65
+ run `lattices start` again, and everything is still there.
70
66
 
71
67
  > **Without tmux**, you still get the menu bar app, command palette,
72
- > window tiling, workspace layers, OCR, and the full daemon API.
68
+ > window tiling, workspace layers, OCR, and the full agent API.
73
69
 
74
70
  ## What's next
75
71
 
@@ -78,4 +74,4 @@ run `lattices` again, and everything is still there.
78
74
  - [Layers & Groups](/docs/layers): organize projects into switchable contexts
79
75
  - [Screen OCR](/docs/ocr): let agents read what's on screen
80
76
  - [Concepts](/docs/concepts): sessions, panes, and the architecture
81
- - [Daemon API](/docs/api): programmatic control for agents and scripts
77
+ - [Agent API](/docs/api): programmatic control for agents and scripts
@@ -0,0 +1,74 @@
1
+ /** @type {import('@arach/dewey').DeweyConfig} */
2
+ export default {
3
+ project: {
4
+ name: 'lattices',
5
+ tagline: 'macOS developer workspace manager — tmux sessions with a native menu bar app for tiling, navigation, and project management',
6
+ type: 'cli-tool',
7
+ version: '0.6.1',
8
+ },
9
+
10
+ agent: {
11
+ criticalContext: [
12
+ 'lattices has TWO primary interfaces: a TypeScript CLI (`bin/lattices.ts`) and a native Swift menu bar app (`apps/mac/Sources/`)',
13
+ 'Session names are `<basename>-<sha256-6chars>` — both CLI and app must produce identical hashes',
14
+ 'The app finds terminal windows via a `[lattices:session-name]` tag embedded in the tmux window title',
15
+ 'Window navigation falls through CG → AX → AppleScript depending on macOS permissions',
16
+ 'Space switching uses private SkyLight framework APIs loaded via dlopen at runtime',
17
+ 'The daemon runs on ws://127.0.0.1:9399 with 35+ RPC methods and real-time events',
18
+ ],
19
+
20
+ entryPoints: {
21
+ 'cli': 'bin/lattices.ts',
22
+ 'app-helper': 'bin/lattices-app.ts',
23
+ 'menu-bar-app': 'apps/mac/Sources/',
24
+ 'docs': 'docs/',
25
+ 'site': 'apps/site/',
26
+ 'marketing-site': 'apps/site/',
27
+ },
28
+
29
+ rules: [
30
+ { pattern: 'cli', instruction: 'Check bin/lattices.ts for CLI commands and session logic' },
31
+ { pattern: 'app', instruction: 'Check apps/mac/Sources/ for Swift menu bar app code' },
32
+ { pattern: 'config', instruction: 'Check docs/config.md for .lattices.json format and CLI reference' },
33
+ { pattern: 'tiling', instruction: 'Check apps/mac/Sources/Core/Desktop/WindowTiler.swift and apps/mac/Sources/Core/Desktop/PlacementSpec.swift' },
34
+ { pattern: 'palette', instruction: 'Check apps/mac/Sources/Core/Actions/PaletteCommand.swift for command palette actions' },
35
+ { pattern: 'terminal', instruction: 'Check apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift for supported terminals and launch logic' },
36
+ { pattern: 'daemon', instruction: 'Check apps/mac/Sources/Core/Daemon/DaemonServer.swift and apps/mac/Sources/Core/Daemon/LatticesApi.swift for WebSocket API' },
37
+ { pattern: 'api', instruction: 'Check docs/api.md for the daemon RPC reference' },
38
+ { pattern: 'twin', instruction: 'Check docs/twins.md and bin/project-twin.ts for the Pi-backed project twin runtime' },
39
+ ],
40
+
41
+ sections: ['overview', 'quickstart', 'concepts', 'twins', 'config', 'app', 'api', 'layers'],
42
+ },
43
+
44
+ docs: {
45
+ path: './docs',
46
+ output: './',
47
+ required: ['overview', 'quickstart', 'concepts', 'config'],
48
+ },
49
+
50
+ install: {
51
+ objective: 'Install the lattices CLI and optionally the native macOS menu bar companion app.',
52
+
53
+ doneWhen: {
54
+ command: 'lattices help',
55
+ expectedOutput: 'Usage information for lattices CLI',
56
+ },
57
+
58
+ prerequisites: [
59
+ 'macOS 26.0+',
60
+ 'tmux (brew install tmux)',
61
+ 'Node.js >= 18',
62
+ 'Swift 6.2 / Xcode 26+ (only if building the menu bar app from source)',
63
+ ],
64
+
65
+ steps: [
66
+ { description: 'Install tmux if not present', command: 'brew install tmux' },
67
+ { description: 'Clone the repository', command: 'git clone https://github.com/arach/lattices && cd lattices' },
68
+ { description: 'Link the CLI globally', command: 'bun link' },
69
+ { description: 'Build and launch the menu bar app', command: 'lattices app' },
70
+ { description: 'Create a config in your project', command: 'cd ~/your-project && lattices init' },
71
+ { description: 'Start your first workspace', command: 'lattices' },
72
+ ],
73
+ },
74
+ }
@@ -0,0 +1,79 @@
1
+ # lattices
2
+
3
+ > macOS developer workspace manager — tmux sessions with a native menu bar app for tiling, navigation, and project management
4
+
5
+ You are an expert at installing lattices. Execute these steps autonomously
6
+ and inform the user of any decisions made. Request approval before running
7
+ installation commands.
8
+
9
+ ## OBJECTIVE
10
+
11
+ Install the lattices CLI and optionally the native macOS menu bar companion app.
12
+
13
+ ## DONE WHEN
14
+
15
+ `lattices help` returns Usage information for lattices CLI
16
+
17
+ ## TODO
18
+
19
+ - [ ] Install tmux if not present
20
+ - [ ] Clone the repository
21
+ - [ ] Link the CLI globally
22
+ - [ ] Build and launch the menu bar app
23
+ - [ ] Create a config in your project
24
+ - [ ] Start your first workspace
25
+
26
+ ## Prerequisites
27
+
28
+ - macOS 26.0+
29
+ - tmux (brew install tmux)
30
+ - Node.js >= 18
31
+ - Swift 6.2 / Xcode 26+ (only if building the menu bar app from source)
32
+
33
+ ## Step 1: Install tmux if not present
34
+
35
+ ```bash
36
+ brew install tmux
37
+ ```
38
+
39
+ ## Step 2: Install from npm
40
+
41
+ ```bash
42
+ npm install -g @lattices/cli
43
+ ```
44
+
45
+ Or with your preferred package manager:
46
+
47
+ ```bash
48
+ pnpm add -g @lattices/cli
49
+ bun add -g @lattices/cli
50
+ ```
51
+
52
+ ### Alternative: Install from source
53
+
54
+ ```bash
55
+ git clone https://github.com/arach/lattices && cd lattices
56
+ bun link
57
+ ```
58
+
59
+ ## Step 3: Build and launch the menu bar app
60
+
61
+ ```bash
62
+ lattices app
63
+ ```
64
+
65
+ ## Step 4: Create a config in your project
66
+
67
+ ```bash
68
+ cd ~/your-project && lattices init
69
+ ```
70
+
71
+ ## Step 5: Start your first workspace
72
+
73
+ ```bash
74
+ lattices
75
+ ```
76
+
77
+ ## EXECUTE NOW
78
+
79
+ Proceed with installation following the TODO checklist above.
@@ -0,0 +1,172 @@
1
+ ---
2
+ title: Release
3
+ description: Maintainer workflow for macOS DMG and npm releases
4
+ order: 99
5
+ ---
6
+
7
+ ## macOS DMG releases
8
+
9
+ The public macOS app release is a signed, notarized DMG attached to the
10
+ GitHub release `v<version>`.
11
+
12
+ There are two valid DMG paths:
13
+
14
+ 1. CI release: push an `app-macos-v<version>` tag or run the
15
+ **Release App macOS** workflow with `publish=true`.
16
+ 2. Local maintainer release: build and ship from a Mac that has the
17
+ Developer ID certificate and notary profile installed.
18
+
19
+ Unsigned DMGs are smoke-test artifacts only. They should not create or update
20
+ a public GitHub release.
21
+
22
+ ### CI release
23
+
24
+ The workflow reads credentials from the GitHub `release` environment.
25
+
26
+ Required environment secrets:
27
+
28
+ ```text
29
+ DEVELOPER_ID_APPLICATION_CERT_BASE64
30
+ DEVELOPER_ID_APPLICATION_CERT_PASSWORD
31
+ KEYCHAIN_PASSWORD
32
+ APP_STORE_CONNECT_API_KEY_P8
33
+ ```
34
+
35
+ Required environment variable or secret:
36
+
37
+ ```text
38
+ APP_STORE_CONNECT_KEY_ID
39
+ ```
40
+
41
+ Optional environment variable or secret:
42
+
43
+ ```text
44
+ APP_STORE_CONNECT_ISSUER_ID
45
+ ```
46
+
47
+ Set `APP_STORE_CONNECT_ISSUER_ID` for Team API keys. Leave it unset for
48
+ Individual API keys.
49
+
50
+ Setup shape:
51
+
52
+ ```sh
53
+ # Export the Developer ID Application certificate as a .p12, then:
54
+ base64 < DeveloperIDApplication.p12 | tr -d '\n' \
55
+ | gh secret set DEVELOPER_ID_APPLICATION_CERT_BASE64 --repo arach/lattices --env release
56
+
57
+ gh secret set DEVELOPER_ID_APPLICATION_CERT_PASSWORD --repo arach/lattices --env release
58
+ gh secret set KEYCHAIN_PASSWORD --repo arach/lattices --env release
59
+ gh secret set APP_STORE_CONNECT_API_KEY_P8 --repo arach/lattices --env release < AuthKey_KEYID.p8
60
+
61
+ gh variable set APP_STORE_CONNECT_KEY_ID --repo arach/lattices --env release --body KEYID
62
+ gh variable set APP_STORE_CONNECT_ISSUER_ID --repo arach/lattices --env release --body ISSUER_UUID
63
+ ```
64
+
65
+ Release:
66
+
67
+ ```sh
68
+ git tag -a app-macos-v0.5.0 -m "Lattices macOS 0.5.0"
69
+ git push origin app-macos-v0.5.0
70
+ ```
71
+
72
+ The workflow builds `dist/Lattices.dmg`, signs, notarizes, staples, verifies,
73
+ then creates or updates GitHub release `v0.5.0` with both:
74
+
75
+ ```text
76
+ Lattices.dmg
77
+ Lattices-0.5.0.dmg
78
+ ```
79
+
80
+ If publish is requested and signing/notary configuration is missing, the
81
+ workflow must fail. A successful unsigned workflow run is only an artifact
82
+ build, not a release.
83
+
84
+ ### Local maintainer release
85
+
86
+ Use this when GitHub Actions is not provisioned with Apple credentials yet,
87
+ or when intentionally shipping from a local release machine.
88
+
89
+ Preflight:
90
+
91
+ ```sh
92
+ gh auth status
93
+ security find-identity -v -p codesigning
94
+ xcrun notarytool history --keychain-profile notarytool-art | head
95
+ ```
96
+
97
+ Build a signed, notarized DMG:
98
+
99
+ ```sh
100
+ ./tools/release/build-dmg.sh
101
+ ```
102
+
103
+ Build and upload to GitHub Releases:
104
+
105
+ ```sh
106
+ LATTICES_VERSION=0.5.0 ./tools/release/ship.sh dmg
107
+ ```
108
+
109
+ The local ship script now mirrors CI: it creates or updates release `v0.5.0`,
110
+ sets the title to `Lattices 0.5.0`, and uploads both the unversioned and
111
+ versioned DMG assets.
112
+
113
+ ### Unsigned checks
114
+
115
+ For a local smoke DMG:
116
+
117
+ ```sh
118
+ LATTICES_SKIP_SIGN=1 LATTICES_SKIP_NOTARIZE=1 ./tools/release/build-dmg.sh
119
+ ```
120
+
121
+ For CI smoke checks, run **Release App macOS** manually with `publish=false`.
122
+ That path uploads an unsigned workflow artifact and intentionally skips the
123
+ GitHub release step.
124
+
125
+ ## npm releases
126
+
127
+ The CLI package is published as `@arach/lattices` (npm page) and also as
128
+ `@lattices/cli` for back-compat — same tarball, dual publish in CI.
129
+
130
+ There are two valid npm paths:
131
+
132
+ 1. CI release: push an `npm-v<version>` tag or run the
133
+ **Release Package npm** workflow with `publish=true`.
134
+ 2. Smoke check: run **Release Package npm** manually with `publish=false`.
135
+
136
+ The npm workflow reads credentials from the GitHub `release` environment.
137
+
138
+ Required environment secret:
139
+
140
+ ```text
141
+ NPM_TOKEN
142
+ ```
143
+
144
+ `NPM_TOKEN` must be an npm automation or granular access token that can
145
+ publish `@arach/lattices` and `@lattices/cli`. It currently should authenticate as the npm user
146
+ `arach`; if a different maintainer publishes, set environment variable
147
+ `NPM_EXPECTED_USER` to that npm username.
148
+
149
+ Setup shape:
150
+
151
+ ```sh
152
+ gh secret set NPM_TOKEN --repo arach/lattices --env release
153
+ gh variable set NPM_EXPECTED_USER --repo arach/lattices --env release --body arach
154
+ ```
155
+
156
+ Release:
157
+
158
+ ```sh
159
+ git tag -a npm-v0.6.1 -m "@arach/lattices 0.6.1"
160
+ git push origin npm-v0.5.0
161
+ ```
162
+
163
+ To publish the current `main` without moving a stale tag, run:
164
+
165
+ ```sh
166
+ gh workflow run release-package-npm.yml --repo arach/lattices --ref main -f publish=true
167
+ ```
168
+
169
+ Before publishing, CI now runs `npm whoami` and fails immediately if the token
170
+ is missing, revoked, or belongs to the wrong npm user. This catches the common
171
+ bad-token case before the macOS app prepack build and before npm's less useful
172
+ package-scoped `E404` publish failure.
@@ -0,0 +1,100 @@
1
+ # Repository Structure
2
+
3
+ Lattices is a small project with several real product surfaces. The root should
4
+ make those surfaces obvious.
5
+
6
+ This document is the current maintainer-facing map and the proposed direction
7
+ for keeping file structure as architecture.
8
+
9
+ ## Current Top-Level Areas
10
+
11
+ | Path | Role |
12
+ | --- | --- |
13
+ | `apps/mac/` | Native macOS menu bar app. Swift/AppKit/SwiftUI package. |
14
+ | `bin/` | Published TypeScript CLI and app helper entry points. |
15
+ | `swift/` | Shared Swift package code used by the app. |
16
+ | `apps/ios/` | iOS companion app experiments and local build state. |
17
+ | `apps/site/` | Vite website, documentation, and blog content. |
18
+ | `apps/site/scripts/agent-docs.mjs` | Agent-facing docs collector and static artifact writer. |
19
+ | `docs/` | Markdown docs and engineering proposals. |
20
+ | `tools/agents/skills/` | Agent skill pack for driving Lattices. |
21
+ | `assets/` | Shared release/app assets. |
22
+ | `scripts/` | User/dev entry-point scripts: `install.sh`, `uninstall.sh`, `build.sh`, `run.sh` (root `install.sh` is a shim forwarding here). |
23
+ | `tools/release/` | Maintainer scripts for building and shipping. |
24
+ | `tests/` | CLI, daemon, and evaluation tests. |
25
+
26
+ ## Problem
27
+
28
+ The root currently mixes categories:
29
+
30
+ - shipped product surfaces: `apps/mac/`, `bin/`, `swift/`
31
+ - website/docs: `apps/site/`
32
+ - companion experiments: `apps/ios/`
33
+ - generated or release output: `dist/`
34
+ - maintainer and agent affordances: `docs/`, `tools/`, `tests/`
35
+
36
+ That makes the project feel larger than it is. It also makes it harder to see
37
+ which directories are architecture and which are support material.
38
+
39
+ ## Target Shape
40
+
41
+ Do not reorganize everything at once. The target is:
42
+
43
+ ```text
44
+ apps/
45
+ mac/ # macOS menu bar app
46
+ ios/ # iOS companion app
47
+ site/ # website, documentation, and blog content
48
+
49
+ packages/
50
+ cli/ # current bin/ plus TypeScript package surface
51
+ swift/ # current swift/
52
+
53
+ docs/
54
+ proposals/
55
+
56
+ tools/
57
+ release/ # release/build scripts
58
+ agents/skills/ # agent skill pack
59
+ ```
60
+
61
+ This is intentionally similar to the `apps/` and `packages/` split used by
62
+ small monorepos such as Flue, but adapted for Lattices' macOS app plus CLI
63
+ shape.
64
+
65
+ ## Migration Rules
66
+
67
+ - Move one category at a time.
68
+ - Keep published npm entry points stable.
69
+ - Keep app bundle and release scripts working after each move.
70
+ - Update docs and agent instructions in the same PR as any move.
71
+ - Avoid renames that only satisfy aesthetics without reducing ambiguity.
72
+ - Keep generated output ignored and out of the architectural map.
73
+
74
+ ## Near-Term Cleanup
75
+
76
+ Good first moves:
77
+
78
+ 1. Treat `dist/` as generated output only.
79
+ 2. Move blog content closer to the site that owns it, or explicitly document it
80
+ as shared content.
81
+ 3. Decide whether the iOS companion remains in this repo or moves to its own
82
+ repo once the companion work becomes active again.
83
+ 4. Split `docs/proposals/` for numbered engineering docs such as `LAT-001`.
84
+ 5. Decide whether `bin/` remains the package root for the CLI or becomes
85
+ `packages/cli/src/` before adding more exported modules.
86
+
87
+ ## What Stays Boring
88
+
89
+ Root files should be few and intentional:
90
+
91
+ - `README.md`
92
+ - `AGENTS.md`
93
+ - `package.json`
94
+ - lockfile
95
+ - TypeScript config
96
+ - license/security/contribution docs
97
+ - release/install affordances
98
+
99
+ Everything else should either be a product surface, a package, docs, content,
100
+ or tooling.
@@ -0,0 +1,87 @@
1
+ # LatticesTerminalKit
2
+
3
+ `LatticesTerminalKit` is the reusable Swift terminal-inventory slice of
4
+ lattices. It is designed for native hosts such as Scout that should embed the
5
+ same macOS probes directly instead of talking to the lattices daemon or CLI.
6
+
7
+ ## V1 Scope
8
+
9
+ The first slice inventories:
10
+
11
+ - Apple Terminal
12
+ - iTerm2
13
+ - Ghostty
14
+
15
+ It intentionally stays read-oriented. Focus and placement actions can build on
16
+ the returned handles later, but the v1 contract is an observed terminal
17
+ projection, not a canonical session or message store.
18
+
19
+ ## Import
20
+
21
+ The product lives in the repo's reusable Swift package:
22
+
23
+ ```swift
24
+ import LatticesTerminalKit
25
+
26
+ let snapshot = TerminalInventory.snapshot()
27
+ ```
28
+
29
+ For bounded tmux pane context:
30
+
31
+ ```swift
32
+ let snapshot = TerminalInventory.snapshot(options: .init(
33
+ includePaneContent: true,
34
+ paneContentLineLimit: 120
35
+ ))
36
+ ```
37
+
38
+ ## Snapshot Shape
39
+
40
+ `TerminalInventorySnapshot` contains:
41
+
42
+ - `snapshotId`
43
+ - `observedAt`
44
+ - `terminals`
45
+ - `tmuxSessions`
46
+ - `terminalTabs`
47
+ - `terminalWindows`
48
+
49
+ Each `TerminalInstance` includes:
50
+
51
+ - identity: `stableKey`, `tty`, app name, bundle id, app pid
52
+ - terminal UI: window id/title, tab index/title, terminal session id
53
+ - process context: interesting process rows, shell pid, cwd, cwd source
54
+ - tmux context: session and pane id
55
+ - harness detection: `detectedHarnesses` for Claude and Codex signals
56
+ - action preparation: `focusHandle`, `placementHandle`, `capabilities`
57
+ - trust metadata: `provenance` with confidence for tty/cwd/window/tmux/harness
58
+ - optional inspection: bounded `paneCapture`
59
+
60
+ ## Join Strategy
61
+
62
+ The kit joins by TTY first.
63
+
64
+ Inputs:
65
+
66
+ - process table from `ps`
67
+ - cwd lookup from batched `lsof`
68
+ - tmux sessions and panes
69
+ - AppleScript tab probes for Terminal and iTerm2
70
+ - CG window inventory for Terminal, iTerm2, and Ghostty
71
+
72
+ Window resolution order:
73
+
74
+ 1. lattices title tag: `[lattices:<session>]`
75
+ 2. app window index from Terminal/iTerm2 tab probes
76
+ 3. CG owner process tree TTY, used especially for Ghostty
77
+
78
+ Ghostty is expected to be window-level in v1. The kit does not synthesize stable
79
+ tab ids from titles or z-order.
80
+
81
+ ## Notes For Scout
82
+
83
+ CG window IDs are useful but volatile. Consumers should pair them with
84
+ `stableKey`, app pid, bundle id, tty, and tmux pane identity where available.
85
+
86
+ Pane capture is opt-in and ephemeral. It should be treated as drill-down context,
87
+ not as durable chat or terminal history.