@zookanalytics/agent-env 0.3.0 → 0.3.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.
- package/README.md +127 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,6 +13,133 @@ npm install -g @zookanalytics/agent-env
|
|
|
13
13
|
- Node.js >= 20
|
|
14
14
|
- Docker (OrbStack recommended on macOS)
|
|
15
15
|
|
|
16
|
+
## Workspace Structure
|
|
17
|
+
|
|
18
|
+
Each agent environment creates a `.agent-env/` directory inside the workspace to store instance-specific data:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
<workspace>/
|
|
22
|
+
├── .agent-env/ # Instance data (git-ignored)
|
|
23
|
+
│ ├── state.json # Instance metadata (repo URL, container name, config source)
|
|
24
|
+
│ ├── ssh/ # SSH host keys (container identity)
|
|
25
|
+
│ │ ├── ssh_host_ed25519_key
|
|
26
|
+
│ │ ├── ssh_host_ed25519_key.pub
|
|
27
|
+
│ │ ├── ssh_host_rsa_key
|
|
28
|
+
│ │ └── ssh_host_rsa_key.pub
|
|
29
|
+
│ ├── devcontainer.json # Baseline config (only if using baseline)
|
|
30
|
+
│ └── init-host.sh # Baseline init script (only if using baseline)
|
|
31
|
+
├── .devcontainer/ # Project's devcontainer config (if present)
|
|
32
|
+
└── <your code>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**What's in `.agent-env/`:**
|
|
36
|
+
|
|
37
|
+
- **`state.json`** - Instance metadata including repository URL, container name, and configuration source
|
|
38
|
+
- **`ssh/`** - SSH host keys that persist across container restarts, preventing "host identification changed" warnings
|
|
39
|
+
- **`devcontainer.json`** - Copied from baseline config when creating instances without their own `.devcontainer/`
|
|
40
|
+
- **`init-host.sh`** - Host-side initialization script (baseline configs only)
|
|
41
|
+
|
|
42
|
+
**Git exclusion:**
|
|
43
|
+
|
|
44
|
+
The `.agent-env/` directory is automatically added to `.git/info/exclude` so instance state doesn't appear as untracked files in your git status.
|
|
45
|
+
|
|
46
|
+
## SSH Access
|
|
47
|
+
|
|
48
|
+
Each agent environment runs an SSH server, allowing you to connect directly:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# On OrbStack (recommended)
|
|
52
|
+
ssh node@ae-<instance-name>.orb.local
|
|
53
|
+
|
|
54
|
+
# Via port forwarding (automatic fallback)
|
|
55
|
+
ssh -p <port> node@localhost
|
|
56
|
+
|
|
57
|
+
# Find connection details
|
|
58
|
+
agent-env list # Shows SSH connection strings
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### How It Works
|
|
62
|
+
|
|
63
|
+
**Host Keys (Container Identity)**
|
|
64
|
+
|
|
65
|
+
Each container generates unique SSH host keys on first creation, stored in `.agent-env/ssh/` inside the workspace:
|
|
66
|
+
- `ssh_host_ed25519_key` / `ssh_host_ed25519_key.pub`
|
|
67
|
+
- `ssh_host_rsa_key` / `ssh_host_rsa_key.pub`
|
|
68
|
+
|
|
69
|
+
These persist across container stops/starts/rebuilds, ensuring you don't get "host identification changed" warnings. They identify the SSH **server** (the container's sshd).
|
|
70
|
+
|
|
71
|
+
**User Keys (Your Identity)**
|
|
72
|
+
|
|
73
|
+
Your public SSH keys from `~/.ssh/*.pub` are automatically staged into the container's `authorized_keys`. The private keys remain on your host - containers only see your public keys.
|
|
74
|
+
|
|
75
|
+
**Why separate host and user keys?**
|
|
76
|
+
- **Host keys**: Container proves "I'm the legitimate ae-my-project server"
|
|
77
|
+
- **User keys**: You prove "I'm authorized to access this container"
|
|
78
|
+
|
|
79
|
+
This is standard SSH architecture - the same pattern used by any SSH server.
|
|
80
|
+
|
|
81
|
+
## Commit Signing Setup
|
|
82
|
+
|
|
83
|
+
Agent environments support commit signing via **SSH signing** (recommended) or GPG signing.
|
|
84
|
+
|
|
85
|
+
### SSH Signing (Recommended)
|
|
86
|
+
|
|
87
|
+
SSH signing is recommended because:
|
|
88
|
+
- SSH agent forwarding is built into Docker Desktop
|
|
89
|
+
- No additional background processes needed
|
|
90
|
+
- Works reliably on macOS with Docker Desktop
|
|
91
|
+
- Supported by GitHub, GitLab, and Gitea
|
|
92
|
+
|
|
93
|
+
**Setup:**
|
|
94
|
+
|
|
95
|
+
1. **Configure git to use the public key content directly:**
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Configure git to use SSH signing with the actual key content
|
|
99
|
+
git config --global gpg.format ssh
|
|
100
|
+
git config --global user.signingkey "$(cat ~/.ssh/id_ed25519.pub)"
|
|
101
|
+
git config --global commit.gpgsign true
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
This embeds the public key content in your `.gitconfig`:
|
|
105
|
+
```ini
|
|
106
|
+
[gpg]
|
|
107
|
+
format = ssh
|
|
108
|
+
[user]
|
|
109
|
+
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAA... user@host
|
|
110
|
+
[commit]
|
|
111
|
+
gpgsign = true
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Why use the key content instead of a file path?**
|
|
115
|
+
|
|
116
|
+
Your `.gitconfig` is mounted from the host into containers, but SSH keys are NOT copied in. Instead, the SSH agent socket is forwarded. The public key content acts as an identifier telling git which key pair to use - the actual signing happens via the forwarded SSH agent using your private key.
|
|
117
|
+
|
|
118
|
+
File paths like `~/.ssh/id_ed25519.pub` won't work because:
|
|
119
|
+
- Host path: `/Users/you/.ssh/id_ed25519.pub`
|
|
120
|
+
- Container path: `/home/node/.ssh/id_ed25519.pub` (doesn't exist - keys aren't copied)
|
|
121
|
+
|
|
122
|
+
Using the key content directly avoids this path mismatch entirely.
|
|
123
|
+
|
|
124
|
+
2. **Verify SSH agent has your key:**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
ssh-add -l # Should list your SSH key
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Commit signing will now work in all containers automatically.
|
|
131
|
+
|
|
132
|
+
### GPG Signing
|
|
133
|
+
|
|
134
|
+
GPG signing has limitations on macOS with Docker Desktop:
|
|
135
|
+
- Unix domain sockets cannot be bind-mounted from macOS to Linux containers
|
|
136
|
+
- Requires SSH tunneling or relay processes per container
|
|
137
|
+
- Complex lifecycle management
|
|
138
|
+
|
|
139
|
+
**If you must use GPG:**
|
|
140
|
+
- GPG signing works when opening containers in VS Code (built-in forwarding)
|
|
141
|
+
- For CLI-based workflows, consider SSH signing instead
|
|
142
|
+
|
|
16
143
|
## Usage
|
|
17
144
|
|
|
18
145
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -42,7 +42,7 @@ import React3 from "react";
|
|
|
42
42
|
// package.json
|
|
43
43
|
var package_default = {
|
|
44
44
|
name: "@zookanalytics/agent-env",
|
|
45
|
-
version: "0.3.
|
|
45
|
+
version: "0.3.1",
|
|
46
46
|
description: "CLI for creating isolated, AI-ready development environments",
|
|
47
47
|
type: "module",
|
|
48
48
|
bin: {
|