happy-stacks 0.0.0
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.
- package/README.md +314 -0
- package/bin/happys.mjs +168 -0
- package/docs/menubar.md +186 -0
- package/docs/mobile-ios.md +134 -0
- package/docs/remote-access.md +43 -0
- package/docs/server-flavors.md +79 -0
- package/docs/stacks.md +218 -0
- package/docs/tauri.md +62 -0
- package/docs/worktrees-and-forks.md +395 -0
- package/extras/swiftbar/auth-login.sh +31 -0
- package/extras/swiftbar/happy-stacks.5s.sh +218 -0
- package/extras/swiftbar/icons/happy-green.png +0 -0
- package/extras/swiftbar/icons/happy-orange.png +0 -0
- package/extras/swiftbar/icons/happy-red.png +0 -0
- package/extras/swiftbar/icons/logo-white.png +0 -0
- package/extras/swiftbar/install.sh +191 -0
- package/extras/swiftbar/lib/git.sh +330 -0
- package/extras/swiftbar/lib/icons.sh +105 -0
- package/extras/swiftbar/lib/render.sh +774 -0
- package/extras/swiftbar/lib/system.sh +190 -0
- package/extras/swiftbar/lib/utils.sh +205 -0
- package/extras/swiftbar/pnpm-term.sh +125 -0
- package/extras/swiftbar/pnpm.sh +21 -0
- package/extras/swiftbar/set-interval.sh +62 -0
- package/extras/swiftbar/set-server-flavor.sh +57 -0
- package/extras/swiftbar/wt-pr.sh +95 -0
- package/package.json +58 -0
- package/scripts/auth.mjs +272 -0
- package/scripts/build.mjs +204 -0
- package/scripts/cli-link.mjs +58 -0
- package/scripts/completion.mjs +364 -0
- package/scripts/daemon.mjs +349 -0
- package/scripts/dev.mjs +181 -0
- package/scripts/doctor.mjs +342 -0
- package/scripts/happy.mjs +79 -0
- package/scripts/init.mjs +232 -0
- package/scripts/install.mjs +379 -0
- package/scripts/menubar.mjs +107 -0
- package/scripts/mobile.mjs +305 -0
- package/scripts/run.mjs +236 -0
- package/scripts/self.mjs +298 -0
- package/scripts/server_flavor.mjs +125 -0
- package/scripts/service.mjs +526 -0
- package/scripts/stack.mjs +815 -0
- package/scripts/tailscale.mjs +278 -0
- package/scripts/uninstall.mjs +190 -0
- package/scripts/utils/args.mjs +17 -0
- package/scripts/utils/cli.mjs +24 -0
- package/scripts/utils/cli_registry.mjs +262 -0
- package/scripts/utils/config.mjs +40 -0
- package/scripts/utils/dotenv.mjs +30 -0
- package/scripts/utils/env.mjs +138 -0
- package/scripts/utils/env_file.mjs +59 -0
- package/scripts/utils/env_local.mjs +25 -0
- package/scripts/utils/fs.mjs +11 -0
- package/scripts/utils/paths.mjs +184 -0
- package/scripts/utils/pm.mjs +294 -0
- package/scripts/utils/ports.mjs +66 -0
- package/scripts/utils/proc.mjs +66 -0
- package/scripts/utils/runtime.mjs +30 -0
- package/scripts/utils/server.mjs +41 -0
- package/scripts/utils/smoke_help.mjs +45 -0
- package/scripts/utils/validate.mjs +47 -0
- package/scripts/utils/wizard.mjs +69 -0
- package/scripts/utils/worktrees.mjs +78 -0
- package/scripts/where.mjs +105 -0
- package/scripts/worktrees.mjs +1721 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Mobile app development (iOS)
|
|
2
|
+
|
|
3
|
+
This is optional. Most people can use the served web UI on mobile via Tailscale:
|
|
4
|
+
see the “Using Happy from your phone” section in the main README.
|
|
5
|
+
|
|
6
|
+
## Prereqs (one-time)
|
|
7
|
+
|
|
8
|
+
- Xcode installed
|
|
9
|
+
- CocoaPods installed (`brew install cocoapods`)
|
|
10
|
+
|
|
11
|
+
## Step 1: Generate iOS native project + Pods (run when needed)
|
|
12
|
+
|
|
13
|
+
Run this after pulling changes that affect native deps/config, or if `ios/` was deleted:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
happys mobile:prebuild
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Step 2: Install the iOS dev build
|
|
20
|
+
|
|
21
|
+
- **iOS Simulator**:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
happys mobile --run-ios --device="iPhone 16 Pro"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- **Real iPhone** (requires code signing in Xcode once):
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
happys mobile --run-ios --device="Your iPhone"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Tip: you can omit `--device` to auto-pick the first connected iPhone over USB:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
happys mobile --run-ios
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To see the exact device names/IDs you can pass:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
happys mobile:devices
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If you hit a bundle identifier error (e.g. `com.slopus.happy.dev` “not available”), set a unique local bundle id:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
HAPPY_STACKS_IOS_BUNDLE_ID="com.yourname.happy.local.dev" happys mobile --run-ios
|
|
49
|
+
# legacy: HAPPY_LOCAL_IOS_BUNDLE_ID="com.yourname.happy.local.dev" happys mobile --run-ios
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Release build (runs without Metro)
|
|
53
|
+
|
|
54
|
+
Build + install a Release configuration (no Metro required at runtime):
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
happys mobile:install
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Step 3: Start Metro (dev client)
|
|
61
|
+
|
|
62
|
+
- **iOS Simulator**:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
happys mobile --host=localhost
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- **Real iPhone** (same Wi‑Fi as your Mac):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
happys mobile --host=lan
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Open the dev build and tap Reload. Scanning the QR should open the dev build (not the App Store app).
|
|
75
|
+
|
|
76
|
+
## Bake the default server URL into the app (optional)
|
|
77
|
+
|
|
78
|
+
If you want the built app to default to your happy-stacks server URL, set this **when building**:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
HAPPY_STACKS_SERVER_URL="https://<your-machine>.<tailnet>.ts.net" happys mobile:install
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Note: changing `HAPPY_STACKS_SERVER_URL` requires rebuilding/reinstalling the Release app (`happys mobile:install`).
|
|
85
|
+
|
|
86
|
+
You can also set a custom bundle id (recommended for real devices):
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
HAPPY_STACKS_IOS_BUNDLE_ID="com.yourname.happy.local.dev" HAPPY_STACKS_SERVER_URL="https://<your-machine>.<tailnet>.ts.net" happys mobile:install
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Customizing the app identity (optional)
|
|
93
|
+
|
|
94
|
+
- **Bundle identifier (recommended for real iPhones)**:
|
|
95
|
+
- You may *need* this if the default `com.slopus.happy.dev` can’t be registered on your Apple team.
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
HAPPY_STACKS_IOS_BUNDLE_ID="com.yourname.happy.local.dev" happys mobile --run-ios
|
|
99
|
+
HAPPY_STACKS_IOS_BUNDLE_ID="com.yourname.happy.local.dev" happys mobile:install
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
- **App name (what shows on the home screen)**:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
HAPPY_STACKS_IOS_APP_NAME="Happy Local" happys mobile:install
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Suggested env (recommended)
|
|
109
|
+
|
|
110
|
+
Add these to your main stack env file (`~/.happy/stacks/main/env`) (or `~/.happy-stacks/env.local` for global overrides) so you don’t have to prefix every command:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
# Required if you want the Release app to default to your stack server:
|
|
114
|
+
HAPPY_STACKS_SERVER_URL="https://<your-machine>.<tailnet>.ts.net"
|
|
115
|
+
|
|
116
|
+
# Strongly recommended for real devices (needs to be unique + owned by your Apple team):
|
|
117
|
+
HAPPY_STACKS_IOS_BUNDLE_ID="com.yourname.happy.local.dev"
|
|
118
|
+
|
|
119
|
+
# Optional: home screen name:
|
|
120
|
+
HAPPY_STACKS_IOS_APP_NAME="Happy Local"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Personal build on iPhone (EAS internal distribution)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
cd "$HOME/.happy-stacks/workspace/components/happy"
|
|
127
|
+
eas build --profile development --platform ios
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Then keep Metro running from `happy-stacks`:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
happys mobile --host=lan
|
|
134
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Remote access (Tailscale + phone)
|
|
2
|
+
|
|
3
|
+
Happy relies on “secure context” browser features (WebCrypto). Browsers treat `http://localhost` as a secure context, but **not** `http://<lan-ip>:<port>` or `http://<tailscale-ip>:<port>`.
|
|
4
|
+
|
|
5
|
+
For remote access (phone, another laptop, etc) you should use **HTTPS**.
|
|
6
|
+
|
|
7
|
+
The recommended approach is **Tailscale Serve**, which gives you an `https://*.ts.net` URL for your machine that is only accessible inside your tailnet.
|
|
8
|
+
|
|
9
|
+
## Quickstart
|
|
10
|
+
|
|
11
|
+
1) Install Tailscale and sign in on your computer.
|
|
12
|
+
|
|
13
|
+
2) Enable Serve:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
happys tailscale enable
|
|
17
|
+
happys tailscale url
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3) Open the URL from `happys tailscale url` on another device (also signed into Tailscale).
|
|
21
|
+
|
|
22
|
+
Tip: on iOS, you can “Add to Home Screen” from Safari to use it like an app.
|
|
23
|
+
|
|
24
|
+
## Automation
|
|
25
|
+
|
|
26
|
+
If Serve is already configured, `happys start` will automatically prefer the `https://*.ts.net` URL for “public” links unless you explicitly set `HAPPY_STACKS_SERVER_URL` (legacy: `HAPPY_LOCAL_SERVER_URL`).
|
|
27
|
+
|
|
28
|
+
You can also ask happy-stacks to enable Serve automatically at boot:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
HAPPY_STACKS_TAILSCALE_SERVE=1 happys start
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Useful knobs:
|
|
35
|
+
- `HAPPY_STACKS_TAILSCALE_WAIT_MS` (legacy: `HAPPY_LOCAL_TAILSCALE_WAIT_MS`)
|
|
36
|
+
- `HAPPY_STACKS_TAILSCALE_BIN` (legacy: `HAPPY_LOCAL_TAILSCALE_BIN`)
|
|
37
|
+
|
|
38
|
+
## Using the native Happy mobile app (optional)
|
|
39
|
+
|
|
40
|
+
The upstream Happy mobile app has an “API Endpoint” setting (developer mode).
|
|
41
|
+
Point it at the same HTTPS `*.ts.net` URL to use your local server.
|
|
42
|
+
|
|
43
|
+
However, the simplest option is usually the **served web UI** (no app updates needed).
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Server flavors: `happy-server-light` vs `happy-server`
|
|
2
|
+
|
|
3
|
+
Happy Stacks supports two server “flavors”. You can switch between them globally (main stack) or per stack.
|
|
4
|
+
|
|
5
|
+
## What’s the difference?
|
|
6
|
+
|
|
7
|
+
Both are forks/flavors of the same upstream server repo (`slopus/happy-server`), but optimized for different use cases:
|
|
8
|
+
|
|
9
|
+
- **`happy-server-light`** (recommended default)
|
|
10
|
+
- optimized for local usage
|
|
11
|
+
- can **serve the built web UI** (so `happys start` works end-to-end without a separate web server)
|
|
12
|
+
- usually the best choice when you just want a stable “main” stack on your machine
|
|
13
|
+
|
|
14
|
+
- **`happy-server`** (full server)
|
|
15
|
+
- closer to upstream “full” behavior (useful when developing server changes meant to go upstream)
|
|
16
|
+
- typically does **not** serve the built UI (you’ll use the UI dev server or connect the UI separately)
|
|
17
|
+
- useful when you need to test upstream/server-only behavior or reproduce upstream issues
|
|
18
|
+
|
|
19
|
+
Important: for a given run (`happys start` / `happys dev`) you choose **one** flavor.
|
|
20
|
+
|
|
21
|
+
## How to switch (main stack)
|
|
22
|
+
|
|
23
|
+
Use the `srv` helper (persisted in `~/.happy/stacks/main/env` by default, or in your stack env file when using `happys stack ...`):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
happys srv status
|
|
27
|
+
happys srv use happy-server-light
|
|
28
|
+
happys srv use happy-server
|
|
29
|
+
happys srv use --interactive
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This persists `HAPPY_STACKS_SERVER_COMPONENT` (and also writes the legacy alias `HAPPY_LOCAL_SERVER_COMPONENT` for compatibility).
|
|
33
|
+
|
|
34
|
+
## How to switch for a specific stack
|
|
35
|
+
|
|
36
|
+
Use the stack wrapper:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
happys stack srv exp1 -- status
|
|
40
|
+
happys stack srv exp1 -- use happy-server-light
|
|
41
|
+
happys stack srv exp1 -- use happy-server
|
|
42
|
+
happys stack srv exp1 -- use --interactive
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
This updates the stack env file (typically `~/.happy/stacks/<name>/env`).
|
|
46
|
+
|
|
47
|
+
## One-off overrides (do not persist)
|
|
48
|
+
|
|
49
|
+
You can override the server flavor for a single run:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
happys start --server=happy-server-light
|
|
53
|
+
happys start --server=happy-server
|
|
54
|
+
|
|
55
|
+
happys dev --server=happy-server-light
|
|
56
|
+
happys dev --server=happy-server
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Flavor vs worktree selection (common pitfall)
|
|
60
|
+
|
|
61
|
+
There are two separate concepts:
|
|
62
|
+
|
|
63
|
+
- **Flavor selection**: which server component the launcher will run
|
|
64
|
+
- controlled by `HAPPY_STACKS_SERVER_COMPONENT` (via `happys srv use ...`)
|
|
65
|
+
- **Worktree selection**: which checkout directory to use for each component
|
|
66
|
+
- controlled by `HAPPY_STACKS_COMPONENT_DIR_HAPPY_SERVER_LIGHT` and `HAPPY_STACKS_COMPONENT_DIR_HAPPY_SERVER`
|
|
67
|
+
- easiest via `happys wt use happy-server-light ...` / `happys wt use happy-server ...`
|
|
68
|
+
|
|
69
|
+
If you set `HAPPY_STACKS_SERVER_COMPONENT=happy-server-light` but accidentally point the *server-light component dir* at a `happy-server` worktree (or vice versa), `happys start/dev/doctor` will refuse to run and print a fix hint.
|
|
70
|
+
|
|
71
|
+
`happys wt use` also prevents the most common mismatch when selecting server worktrees inside `components/` / `components/.worktrees/`.
|
|
72
|
+
|
|
73
|
+
## Setup note (cloning both)
|
|
74
|
+
|
|
75
|
+
If you want both component repos present under `components/`:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
happys bootstrap --server=both
|
|
79
|
+
```
|
package/docs/stacks.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Stacks (multiple local Happy instances)
|
|
2
|
+
|
|
3
|
+
`happy-stacks` supports running **multiple stacks** in parallel on the same machine.
|
|
4
|
+
|
|
5
|
+
A “stack” is just:
|
|
6
|
+
|
|
7
|
+
- a dedicated **server port**
|
|
8
|
+
- isolated directories for **UI build output**, **CLI home**, and **logs**
|
|
9
|
+
- optional per-component overrides (point at specific worktrees)
|
|
10
|
+
|
|
11
|
+
Stacks are configured via a plain env file stored under:
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
~/.happy/stacks/<name>/env
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Legacy path (still supported during migration):
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
~/.happy/local/stacks/<name>/env
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To migrate existing stacks:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
happys stack migrate
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Create a stack
|
|
30
|
+
|
|
31
|
+
Non-interactive:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
happys stack new exp1 --port=3010 --server=happy-server-light
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Auto-pick a port:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
happys stack new exp2
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Interactive wizard (TTY only):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
happys stack new --interactive
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The wizard lets you:
|
|
50
|
+
|
|
51
|
+
- pick the server type (`happy-server-light` or `happy-server`)
|
|
52
|
+
- pick or create worktrees for `happy`, `happy-cli`, and the chosen server component
|
|
53
|
+
- choose which Git remote to base newly-created worktrees on (defaults to `upstream`)
|
|
54
|
+
|
|
55
|
+
## Run a stack
|
|
56
|
+
|
|
57
|
+
Dev mode:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
happys stack dev exp1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Production-like mode:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
happys stack start exp1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Build UI for a stack (server-light serving):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
happys stack build exp1
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Doctor:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
happys stack doctor exp1
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Edit a stack (interactive)
|
|
82
|
+
|
|
83
|
+
To change server flavor, port, or component worktrees for an existing stack:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
happys stack edit exp1 --interactive
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Switch server flavor for a stack
|
|
90
|
+
|
|
91
|
+
You can change `happy-server-light` vs `happy-server` for an existing stack without re-running the full edit wizard:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
happys stack srv exp1 -- status
|
|
95
|
+
happys stack srv exp1 -- use happy-server-light
|
|
96
|
+
happys stack srv exp1 -- use happy-server
|
|
97
|
+
happys stack srv exp1 -- use --interactive
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Switch component worktrees for a stack (`stack wt`)
|
|
101
|
+
|
|
102
|
+
If you want the **exact** same UX as `happys wt`, but scoped to a stack env file:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
happys stack wt exp1 -- status happy
|
|
106
|
+
happys stack wt exp1 -- use happy slopus/pr/my-ui-pr
|
|
107
|
+
happys stack wt exp1 -- use happy-cli default
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
This updates the stack env file (`~/.happy/stacks/<name>/env`), not repo `env.local` (legacy path still supported).
|
|
111
|
+
|
|
112
|
+
## Stack wrappers you can use
|
|
113
|
+
|
|
114
|
+
These commands run with the stack env file applied:
|
|
115
|
+
|
|
116
|
+
- `happys stack dev <name>`
|
|
117
|
+
- `happys stack start <name>`
|
|
118
|
+
- `happys stack build <name>`
|
|
119
|
+
- `happys stack doctor <name>`
|
|
120
|
+
- `happys stack mobile <name>`
|
|
121
|
+
- `happys stack srv <name> -- status|use ...`
|
|
122
|
+
- `happys stack wt <name> -- <wt args...>`
|
|
123
|
+
- `happys stack tailscale:status|enable|disable|url <name>`
|
|
124
|
+
- `happys stack service:* <name>`
|
|
125
|
+
|
|
126
|
+
Global/non-stack commands:
|
|
127
|
+
|
|
128
|
+
- `happys bootstrap` (sets up shared component repos)
|
|
129
|
+
- `happys cli:link` (installs `happy` shim under `~/.happy-stacks/bin/`)
|
|
130
|
+
|
|
131
|
+
## Services (macOS LaunchAgents)
|
|
132
|
+
|
|
133
|
+
Each stack can have its own LaunchAgent (so multiple stacks can start at login).
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
happys stack service exp1 install
|
|
137
|
+
happys stack service exp1 status
|
|
138
|
+
happys stack service exp1 restart
|
|
139
|
+
happys stack service exp1 logs
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Implementation notes:
|
|
143
|
+
|
|
144
|
+
- Service label is stack-scoped:
|
|
145
|
+
- `main` → `com.happy.stacks` (legacy: `com.happy.local`)
|
|
146
|
+
- `exp1` → `com.happy.stacks.exp1` (legacy: `com.happy.local.exp1`)
|
|
147
|
+
- The LaunchAgent persists `HAPPY_STACKS_ENV_FILE` (and legacy `HAPPY_LOCAL_ENV_FILE`), so you can edit the stack env file without reinstalling.
|
|
148
|
+
|
|
149
|
+
## Component/worktree selection per stack
|
|
150
|
+
|
|
151
|
+
When creating a stack you can point components at worktrees:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
happys stack new exp3 \\
|
|
155
|
+
--happy=slopus/pr/my-ui-pr \\
|
|
156
|
+
--happy-cli=slopus/pr/my-cli-pr \\
|
|
157
|
+
--server=happy-server
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Worktree specs are interpreted as:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
components/.worktrees/<component>/<spec...>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
So `--happy=slopus/pr/foo` maps to:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
components/.worktrees/happy/slopus/pr/foo
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
You can also pass an absolute path.
|
|
173
|
+
|
|
174
|
+
## Stack env + repo env precedence
|
|
175
|
+
|
|
176
|
+
On startup, `happy-stacks` loads env in this order:
|
|
177
|
+
|
|
178
|
+
1. `~/.happy-stacks/.env` (defaults)
|
|
179
|
+
2. `~/.happy-stacks/env.local` (optional global overrides; prefer stack env for persistent config)
|
|
180
|
+
3. `HAPPY_STACKS_ENV_FILE` (stack env; highest precedence for `HAPPY_STACKS_*` / `HAPPY_LOCAL_*`)
|
|
181
|
+
|
|
182
|
+
`happys stack ...` sets `HAPPY_STACKS_ENV_FILE=~/.happy/stacks/<name>/env` (and also sets legacy `HAPPY_LOCAL_ENV_FILE`) and clears any already-exported `HAPPY_STACKS_*` / `HAPPY_LOCAL_*` variables so the stack env stays authoritative.
|
|
183
|
+
|
|
184
|
+
Cloned-repo fallback (before you run `happys init`):
|
|
185
|
+
|
|
186
|
+
1. `<repo>/.env` (defaults)
|
|
187
|
+
2. `<repo>/env.local` (optional overrides)
|
|
188
|
+
3. `HAPPY_STACKS_ENV_FILE` (stack env)
|
|
189
|
+
|
|
190
|
+
## Daemon auth + “no machine” on first run
|
|
191
|
+
|
|
192
|
+
On a **fresh machine** (or any new stack), the daemon may need to authenticate before it can register a “machine”.
|
|
193
|
+
If the UI shows “no machine” (or the daemon shows `auth_required`), it usually means the stack-specific CLI home
|
|
194
|
+
doesn’t have credentials yet:
|
|
195
|
+
|
|
196
|
+
- `~/.happy/stacks/<stack>/cli/access.key`
|
|
197
|
+
|
|
198
|
+
To check / authenticate a stack, run:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
happys stack auth <stack> status
|
|
202
|
+
happys stack auth <stack> login
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Notes:
|
|
206
|
+
- For the **main** stack, use `<stack>=main` and the default `<port>=3005` (unless you changed it).
|
|
207
|
+
- If you use Tailscale Serve, `HAPPY_WEBAPP_URL` should be your HTTPS URL (what you get from `happys tailscale url`).
|
|
208
|
+
- Logs live under `~/.happy/stacks/<stack>/cli/logs/`.
|
|
209
|
+
|
|
210
|
+
## JSON mode
|
|
211
|
+
|
|
212
|
+
For programmatic usage:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
happys stack list --json
|
|
216
|
+
happys stack new exp3 --json
|
|
217
|
+
happys stack edit exp3 --interactive --json
|
|
218
|
+
```
|
package/docs/tauri.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Tauri desktop app (optional)
|
|
2
|
+
|
|
3
|
+
The Tauri app is a native desktop wrapper around the web UI. It’s useful when you want:
|
|
4
|
+
|
|
5
|
+
- a native desktop window (instead of a browser tab)
|
|
6
|
+
- separate storage from the “regular” Happy desktop app (so it doesn’t reuse old server URLs/auth)
|
|
7
|
+
|
|
8
|
+
## Important behavior
|
|
9
|
+
|
|
10
|
+
- The Tauri app must embed an explicit API base URL.
|
|
11
|
+
- By default, `happy-stacks` will embed:
|
|
12
|
+
- a **Tailscale Serve** `https://*.ts.net` URL if it detects one on this machine (so the built app can be copied to other devices on the same tailnet), otherwise
|
|
13
|
+
- the local loopback URL `http://127.0.0.1:<HAPPY_LOCAL_SERVER_PORT>` (same-machine only).
|
|
14
|
+
- If you change what URL you want embedded, rebuild the Tauri app.
|
|
15
|
+
|
|
16
|
+
## Prereqs
|
|
17
|
+
|
|
18
|
+
- Rust toolchain installed
|
|
19
|
+
- Tauri build dependencies installed for your OS
|
|
20
|
+
|
|
21
|
+
## Build it
|
|
22
|
+
|
|
23
|
+
Build (one-off):
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
happys build --tauri
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or during bootstrap:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
happys bootstrap --tauri
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Run it
|
|
36
|
+
|
|
37
|
+
1) Start the local server (or install the service):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
happys start
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2) Launch the built app bundle (location is under `~/.happy/local/tauri-target/`).
|
|
44
|
+
- New default: `~/.happy/stacks/main/tauri-target/`
|
|
45
|
+
- Legacy: `~/.happy/local/tauri-target/`
|
|
46
|
+
|
|
47
|
+
## “Portable” Tauri builds (send to another computer)
|
|
48
|
+
|
|
49
|
+
If you build the Tauri app while Tailscale Serve is enabled on the server machine, the app will embed the `https://*.ts.net` URL and can be copied to another computer.
|
|
50
|
+
|
|
51
|
+
Requirements:
|
|
52
|
+
|
|
53
|
+
- The server machine is running `happys start` and Tailscale Serve is enabled
|
|
54
|
+
- The other computer is on the same tailnet and can access the `https://*.ts.net` URL
|
|
55
|
+
|
|
56
|
+
## Configuration (high-signal)
|
|
57
|
+
|
|
58
|
+
- `HAPPY_STACKS_TAURI_IDENTIFIER` (legacy: `HAPPY_LOCAL_TAURI_IDENTIFIER`) (default `com.happy.stacks`)
|
|
59
|
+
- `HAPPY_STACKS_TAURI_PRODUCT_NAME` (legacy: `HAPPY_LOCAL_TAURI_PRODUCT_NAME`) (default `Happy Stacks`)
|
|
60
|
+
- `HAPPY_STACKS_TAURI_DEBUG=0` (legacy: `HAPPY_LOCAL_TAURI_DEBUG=0`) (build release-like without devtools)
|
|
61
|
+
- `HAPPY_STACKS_TAURI_SERVER_URL` (legacy: `HAPPY_LOCAL_TAURI_SERVER_URL`) (force the embedded API URL)
|
|
62
|
+
- `HAPPY_STACKS_TAURI_PREFER_TAILSCALE=0` (legacy: `HAPPY_LOCAL_TAURI_PREFER_TAILSCALE=0`) (disable Tailscale detection; always embed `127.0.0.1`)
|