Skip to content

Commit 7f35375

Browse files
committed
Initial AgentShot release
0 parents  commit 7f35375

17 files changed

Lines changed: 2618 additions & 0 deletions

‎.gitattributes‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
* text=auto eol=lf
2+
*.ps1 text eol=crlf

‎.github/workflows/ci.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
validate:
10+
name: Validate (${{ matrix.os }}, Node ${{ matrix.node }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: [ubuntu-latest, macos-latest, windows-latest]
16+
node: [18, 20, 22]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: ${{ matrix.node }}
26+
27+
- name: Validate
28+
run: npm run validate

‎.gitignore‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
npm-debug.log*
3+
.npm-cache/
4+
.DS_Store
5+
*.tgz

‎AGENTS.md‎

Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
# AgentShot Agent Guide
2+
3+
This file is for AI coding agents working on AgentShot.
4+
5+
## Project Summary
6+
7+
AgentShot is a local-first screenshot bridge for terminal AI agents. It helps users capture or copy a screenshot, save it as a local image file, render an AI-tool-specific prompt that references the image path, and copy that prompt to the clipboard.
8+
9+
The primary user workflow is:
10+
11+
```text
12+
install AgentShot -> daemon watches clipboard -> user takes screenshot -> AgentShot saves image and copies prompt -> user pastes into Claude Code, Codex CLI, or another terminal AI tool
13+
```
14+
15+
AgentShot should not upload screenshots, call AI APIs, or inject text into terminal windows by default.
16+
17+
## Product Direction
18+
19+
Primary distribution is npm:
20+
21+
```bash
22+
npm install -g @junchenmeteor/agentshot
23+
```
24+
25+
The package uses a best-effort `postinstall` script to register a startup daemon. The install must not fail if daemon registration is blocked.
26+
27+
Current product phases:
28+
29+
1. Robust local screenshot bridge.
30+
2. Resident startup daemon by default.
31+
3. Read-only AI session detection for future explicit injection workflows.
32+
33+
Direct terminal injection is not a default behavior. Keep the safe default as "copy prompt to clipboard, user pastes manually".
34+
35+
## Tech Stack
36+
37+
- Runtime: Node.js 18+
38+
- Module system: ESM
39+
- CLI entrypoint: `bin/agentshot.js`
40+
- Tests: Node built-in test runner
41+
- Package manager: npm
42+
- Platforms: Windows and macOS first, limited Linux clipboard fallback
43+
- No runtime npm dependencies currently
44+
45+
## Important Files
46+
47+
- `bin/agentshot.js`: main CLI implementation.
48+
- `scripts/postinstall.mjs`: best-effort npm postinstall daemon registration.
49+
- `scripts/validate.mjs`: local validation runner.
50+
- `tests/agentshot.test.js`: unit tests.
51+
- `README.md`: English user-facing README.
52+
- `README.zh-CN.md`: Chinese user-facing README.
53+
- `docs/PRODUCT_SPEC.md`: product scope, platform strategy, and roadmap.
54+
- `docs/NPM_RELEASE.md`: npm publishing checklist.
55+
- `docs/QUALITY.md`: quality and validation baseline.
56+
57+
## Commands
58+
59+
Run full validation:
60+
61+
```bash
62+
npm run validate
63+
```
64+
65+
Run tests:
66+
67+
```bash
68+
npm test
69+
```
70+
71+
Syntax check:
72+
73+
```bash
74+
npm run check
75+
```
76+
77+
Smoke test:
78+
79+
```bash
80+
npm run smoke
81+
```
82+
83+
Package dry run:
84+
85+
```bash
86+
npm pack --dry-run
87+
```
88+
89+
Manual CLI examples:
90+
91+
```bash
92+
node bin/agentshot.js --help
93+
node bin/agentshot.js daemon status
94+
node bin/agentshot.js sessions
95+
```
96+
97+
## CLI Commands
98+
99+
Supported commands:
100+
101+
- `agentshot [capture]`
102+
- `agentshot clipboard`
103+
- `agentshot watch`
104+
- `agentshot daemon`
105+
- `agentshot daemon run`
106+
- `agentshot daemon install`
107+
- `agentshot daemon status`
108+
- `agentshot daemon uninstall`
109+
- `agentshot sessions`
110+
- `agentshot last`
111+
- `agentshot dir`
112+
113+
Supported tool templates:
114+
115+
- `claude`
116+
- `codex`
117+
- `aider`
118+
- `gemini`
119+
- `opencode`
120+
- `generic`
121+
122+
## Daemon Behavior
123+
124+
The daemon is a clipboard watcher.
125+
126+
- macOS startup integration uses `~/Library/LaunchAgents/com.junchenmeteor.agentshot.plist`.
127+
- Windows startup integration uses a user logon scheduled task named `AgentShot`.
128+
- Logs are written to `~/.agentshot/daemon.log`.
129+
- Config is written to `~/.agentshot/daemon.json`.
130+
- `AGENTSHOT_SKIP_POSTINSTALL=1` skips automatic daemon setup during npm install.
131+
132+
Daemon registration must be best-effort. Do not make npm installation fail because of OS permissions, CI, missing shell capabilities, or unsupported platforms.
133+
134+
## Storage
135+
136+
Screenshots are local only.
137+
138+
Default candidate directories:
139+
140+
1. `AGENTSHOT_DIR` if set.
141+
2. `~/.agentshot/shots`.
142+
3. `~/Pictures/agent-shots`.
143+
4. System temp directory.
144+
145+
Do not add cloud upload, telemetry, remote image hosting, or third-party accounts without explicit product approval.
146+
147+
## Coding Rules
148+
149+
- Keep source code comments and internal code text in English.
150+
- Keep README content bilingual: update both `README.md` and `README.zh-CN.md` for user-facing behavior changes.
151+
- Prefer zero runtime dependencies unless a dependency clearly reduces platform risk.
152+
- Keep OS integration conservative and failure-tolerant.
153+
- Avoid direct terminal injection as a default behavior.
154+
- Do not add a GUI, tray app, or global hotkey without updating product docs first.
155+
- Preserve existing CLI compatibility where practical. For example, `agentshot daemon` should remain a foreground watcher alias.
156+
- Use structured APIs for OS integration where practical. Avoid brittle string parsing when an OS command can return JSON.
157+
- Do not upload screenshots or send image data to AI providers.
158+
159+
## Testing Rules
160+
161+
When changing CLI parsing, prompt rendering, path conversion, daemon lifecycle parsing, or session detection helpers, add or update unit tests.
162+
163+
Before considering work complete, run:
164+
165+
```bash
166+
npm run validate
167+
```
168+
169+
Real screenshot capture and OS startup registration require manual acceptance testing on Windows and macOS. Do not pretend these are covered by unit tests.
170+
171+
## Documentation Rules
172+
173+
Update docs when behavior changes:
174+
175+
- User-facing install or workflow changes: update both READMEs.
176+
- Product scope or roadmap changes: update `docs/PRODUCT_SPEC.md`.
177+
- Publishing changes: update `docs/NPM_RELEASE.md`.
178+
- Quality process changes: update `docs/QUALITY.md`.
179+
180+
## Release Rules
181+
182+
Primary package name:
183+
184+
```text
185+
@junchenmeteor/agentshot
186+
```
187+
188+
First public publish:
189+
190+
```bash
191+
npm login
192+
npm run validate
193+
npm publish --access public
194+
```
195+
196+
Version bumps:
197+
198+
- Patch: bug fixes.
199+
- Minor: new features.
200+
- Major: breaking changes.
201+
202+
Always run validation before publish.
203+
204+
## Known Constraints
205+
206+
- The project currently has no runtime dependencies.
207+
- The current implementation is optimized for Windows and macOS.
208+
- `--paste` is best-effort and depends on focus and OS permissions.
209+
- `sessions` is read-only and should remain non-invasive.
210+
- Global daemon install behavior can vary by OS permissions and npm environment.
211+

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 JunchenMeteor
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)