@flintttan/hapi 0.3.4 → 0.5.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/NOTICE +52 -0
- package/package.json +26 -78
- package/README.md +0 -127
package/NOTICE
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
hapi CLI
|
|
2
|
+
Copyright (c) 2024-2025 weishu
|
|
3
|
+
|
|
4
|
+
This software contains code derived from happy-cli
|
|
5
|
+
(https://github.com/slopus/happy-cli), which is licensed
|
|
6
|
+
under the MIT License:
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
MIT License
|
|
11
|
+
|
|
12
|
+
Copyright (c) 2024 Kirill Dubovitskiy
|
|
13
|
+
|
|
14
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
in the Software without restriction, including without limitation the rights
|
|
17
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
furnished to do so, subject to the following conditions:
|
|
20
|
+
|
|
21
|
+
The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
copies or substantial portions of the Software.
|
|
23
|
+
|
|
24
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
SOFTWARE.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
The following files/directories are derived from happy-cli:
|
|
35
|
+
- src/api/
|
|
36
|
+
- src/claude/
|
|
37
|
+
- src/codex/
|
|
38
|
+
- src/daemon/
|
|
39
|
+
- src/commands/
|
|
40
|
+
- src/ui/
|
|
41
|
+
- src/utils/
|
|
42
|
+
- src/modules/ripgrep/
|
|
43
|
+
- src/modules/difftastic/
|
|
44
|
+
- src/modules/watcher/
|
|
45
|
+
- src/modules/common/registerCommonHandlers.ts
|
|
46
|
+
- src/modules/common/pathSecurity.ts
|
|
47
|
+
- src/parsers/
|
|
48
|
+
- src/configuration.ts
|
|
49
|
+
- src/persistence.ts
|
|
50
|
+
- src/projectPath.ts
|
|
51
|
+
- src/lib.ts
|
|
52
|
+
- src/index.ts
|
package/package.json
CHANGED
|
@@ -1,81 +1,29 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
"name": "@flintttan/hapi",
|
|
3
|
+
"version": "0.5.1",
|
|
4
|
+
"description": "App for agentic coding - access coding agent anywhere",
|
|
5
|
+
"author": "Kirill Dubovitskiy & weishu",
|
|
6
|
+
"license": "AGPL-3.0-only",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"homepage": "https://github.com/flintttan/hapi",
|
|
9
|
+
"bugs": "https://github.com/flintttan/hapi/issues",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/flintttan/hapi.git",
|
|
13
|
+
"directory": "cli"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"hapi": "bin/hapi.cjs"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin/hapi.cjs",
|
|
20
|
+
"NOTICE"
|
|
21
|
+
],
|
|
22
|
+
"optionalDependencies": {
|
|
23
|
+
"@flintttan/hapi-darwin-arm64": "0.5.1",
|
|
24
|
+
"@flintttan/hapi-darwin-x64": "0.5.1",
|
|
25
|
+
"@flintttan/hapi-linux-arm64": "0.5.1",
|
|
26
|
+
"@flintttan/hapi-linux-x64": "0.5.1",
|
|
27
|
+
"@flintttan/hapi-win32-x64": "0.5.1"
|
|
25
28
|
}
|
|
26
|
-
},
|
|
27
|
-
"optionalDependencies": {
|
|
28
|
-
"@flintttan/hapi-darwin-arm64": "0.3.4",
|
|
29
|
-
"@flintttan/hapi-darwin-x64": "0.3.4",
|
|
30
|
-
"@flintttan/hapi-linux-arm64": "0.3.4",
|
|
31
|
-
"@flintttan/hapi-linux-x64": "0.3.4",
|
|
32
|
-
"@flintttan/hapi-win32-x64": "0.3.4"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"typecheck": "tsc --noEmit",
|
|
36
|
-
"build:exe": "bun run scripts/build-executable.ts",
|
|
37
|
-
"build:exe:all": "bun run scripts/build-executable.ts --all",
|
|
38
|
-
"build:exe:allinone": "bun run scripts/build-executable.ts --with-web-assets",
|
|
39
|
-
"build:exe:allinone:all": "bun run scripts/build-executable.ts --with-web-assets --all",
|
|
40
|
-
"prepare-npm-packages": "bun run scripts/prepare-npm-packages.ts",
|
|
41
|
-
"prepack": "bun run prepare-npm-packages",
|
|
42
|
-
"tools:unpack": "bun run scripts/unpack-tools.ts",
|
|
43
|
-
"update-homebrew-formula": "bun run scripts/update-homebrew-formula.ts",
|
|
44
|
-
"test": "bun run tools:unpack && vitest run",
|
|
45
|
-
"test:win": "vitest run",
|
|
46
|
-
"dev": "bun src/index.ts",
|
|
47
|
-
"dev:local-server": "bun --env-file .env.dev-local-server src/index.ts",
|
|
48
|
-
"dev:integration-test-env": "bun --env-file .env.integration-test src/index.ts",
|
|
49
|
-
"release-all": "bun run scripts/release-all.ts"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
53
|
-
"@types/cross-spawn": "^6.0.6",
|
|
54
|
-
"@types/ps-list": "^6.2.1",
|
|
55
|
-
"@types/react": "^19.2.7",
|
|
56
|
-
"axios": "^1.13.2",
|
|
57
|
-
"chalk": "^5.6.2",
|
|
58
|
-
"cross-spawn": "^7.0.6",
|
|
59
|
-
"fastify": "^5.6.2",
|
|
60
|
-
"fastify-type-provider-zod": "6.1.0",
|
|
61
|
-
"ink": "^6.6.0",
|
|
62
|
-
"ps-list": "^9.0.0",
|
|
63
|
-
"react": "^19.2.3",
|
|
64
|
-
"socket.io-client": "^4.8.3",
|
|
65
|
-
"tar": "^7.5.2",
|
|
66
|
-
"zod": "^4.2.1"
|
|
67
|
-
},
|
|
68
|
-
"devDependencies": {
|
|
69
|
-
"@types/node": ">=25",
|
|
70
|
-
"bun-types": "^1.3.5",
|
|
71
|
-
"dotenv": "^17.2.3",
|
|
72
|
-
"typescript": "^5",
|
|
73
|
-
"vitest": "^4.0.16"
|
|
74
|
-
},
|
|
75
|
-
"resolutions": {
|
|
76
|
-
"whatwg-url": "14.2.0",
|
|
77
|
-
"parse-path": "7.0.3",
|
|
78
|
-
"@types/parse-path": "7.0.3"
|
|
79
|
-
},
|
|
80
|
-
"packageManager": "bun@1.3.5"
|
|
81
29
|
}
|
package/README.md
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# hapi CLI
|
|
2
|
-
|
|
3
|
-
Run Claude Code, Codex, or Gemini sessions from your terminal and control them remotely through the hapi server.
|
|
4
|
-
|
|
5
|
-
## What it does
|
|
6
|
-
|
|
7
|
-
- Starts Claude Code sessions and registers them with hapi-server.
|
|
8
|
-
- Starts Codex mode for OpenAI-based sessions.
|
|
9
|
-
- Starts Gemini mode via ACP (Anthropic Code Plugins).
|
|
10
|
-
- Provides an MCP stdio bridge for external tools.
|
|
11
|
-
- Manages a background daemon for long-running sessions.
|
|
12
|
-
- Includes diagnostics and auth helpers.
|
|
13
|
-
|
|
14
|
-
## Typical flow
|
|
15
|
-
|
|
16
|
-
1. Start the server and set env vars (see ../server/README.md).
|
|
17
|
-
2. Set the same CLI_API_TOKEN on this machine or run `hapi auth login`.
|
|
18
|
-
3. Run `hapi` to start a session.
|
|
19
|
-
4. Use the web app or Telegram Mini App to monitor and control.
|
|
20
|
-
|
|
21
|
-
## Commands
|
|
22
|
-
|
|
23
|
-
### Session commands
|
|
24
|
-
|
|
25
|
-
- `hapi` - Start a Claude Code session (passes through Claude CLI flags). See `src/index.ts`.
|
|
26
|
-
- `hapi codex` - Start Codex mode. See `src/codex/runCodex.ts`.
|
|
27
|
-
- `hapi gemini` - Start Gemini mode via ACP. See `src/agent/runners/runAgentSession.ts`.
|
|
28
|
-
Note: Gemini runs in remote mode only; it waits for messages from the server UI/Telegram.
|
|
29
|
-
|
|
30
|
-
### Authentication
|
|
31
|
-
|
|
32
|
-
- `hapi auth status` - Show authentication configuration and token source.
|
|
33
|
-
- `hapi auth login` - Interactively enter and save CLI_API_TOKEN.
|
|
34
|
-
- `hapi auth logout` - Clear saved credentials.
|
|
35
|
-
|
|
36
|
-
See `src/commands/auth.ts`.
|
|
37
|
-
|
|
38
|
-
### Daemon management
|
|
39
|
-
|
|
40
|
-
- `hapi daemon start` - Start daemon as detached process.
|
|
41
|
-
- `hapi daemon stop` - Stop daemon gracefully.
|
|
42
|
-
- `hapi daemon status` - Show daemon diagnostics.
|
|
43
|
-
- `hapi daemon list` - List active sessions managed by daemon.
|
|
44
|
-
- `hapi daemon stop-session <sessionId>` - Terminate specific session.
|
|
45
|
-
- `hapi daemon logs` - Print path to latest daemon log file.
|
|
46
|
-
- `hapi daemon install` - Install daemon as system service.
|
|
47
|
-
- `hapi daemon uninstall` - Remove daemon system service.
|
|
48
|
-
|
|
49
|
-
See `src/daemon/run.ts`.
|
|
50
|
-
|
|
51
|
-
### Diagnostics
|
|
52
|
-
|
|
53
|
-
- `hapi doctor` - Show full diagnostics (version, daemon status, logs, processes).
|
|
54
|
-
- `hapi doctor clean` - Kill runaway HAPI processes.
|
|
55
|
-
|
|
56
|
-
See `src/ui/doctor.ts`.
|
|
57
|
-
|
|
58
|
-
### Other
|
|
59
|
-
|
|
60
|
-
- `hapi mcp` - Start MCP stdio bridge. See `src/codex/happyMcpStdioBridge.ts`.
|
|
61
|
-
- `hapi server` - Start the bundled server (single binary workflow).
|
|
62
|
-
|
|
63
|
-
## Configuration
|
|
64
|
-
|
|
65
|
-
See `src/configuration.ts` for all options.
|
|
66
|
-
|
|
67
|
-
### Required
|
|
68
|
-
|
|
69
|
-
- `CLI_API_TOKEN` - Shared secret; must match the server. Can be set via env or `~/.hapi/settings.json` (env wins).
|
|
70
|
-
- `HAPI_SERVER_URL` - Server base URL (default: http://localhost:3006).
|
|
71
|
-
|
|
72
|
-
### Optional
|
|
73
|
-
|
|
74
|
-
- `HAPI_HOME` - Config/data directory (default: ~/.hapi).
|
|
75
|
-
- `HAPI_EXPERIMENTAL` - Enable experimental features (true/1/yes).
|
|
76
|
-
- `HAPI_CLAUDE_PATH` - Path to a specific `claude` executable.
|
|
77
|
-
- `HAPI_HTTP_MCP_URL` - Default MCP target for `hapi mcp`.
|
|
78
|
-
|
|
79
|
-
### Daemon
|
|
80
|
-
|
|
81
|
-
- `HAPI_DAEMON_HEARTBEAT_INTERVAL` - Heartbeat interval in ms (default: 60000).
|
|
82
|
-
- `HAPI_DAEMON_HTTP_TIMEOUT` - HTTP timeout for daemon control in ms (default: 10000).
|
|
83
|
-
|
|
84
|
-
## Storage
|
|
85
|
-
|
|
86
|
-
Data is stored in `~/.hapi/` (or `$HAPI_HOME`):
|
|
87
|
-
|
|
88
|
-
- `settings.json` - User settings (machineId, token, onboarding flag). See `src/persistence.ts`.
|
|
89
|
-
- `daemon.state.json` - Daemon state (pid, port, version, heartbeat).
|
|
90
|
-
- `logs/` - Log files.
|
|
91
|
-
|
|
92
|
-
## Requirements
|
|
93
|
-
|
|
94
|
-
- Claude CLI installed and logged in (`claude` on PATH).
|
|
95
|
-
- Bun for building from source.
|
|
96
|
-
|
|
97
|
-
## Build from source
|
|
98
|
-
|
|
99
|
-
From the repo root:
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
bun install
|
|
103
|
-
bun run build:cli
|
|
104
|
-
bun run build:cli:exe
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
For an all-in-one binary that also embeds the web app:
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
bun run build:single-exe
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
## Source structure
|
|
114
|
-
|
|
115
|
-
- `src/api/` - Bot communication (Socket.IO + REST).
|
|
116
|
-
- `src/claude/` - Claude Code integration.
|
|
117
|
-
- `src/codex/` - Codex mode integration.
|
|
118
|
-
- `src/agent/` - Multi-agent support (Gemini via ACP).
|
|
119
|
-
- `src/daemon/` - Background service.
|
|
120
|
-
- `src/commands/` - CLI command handlers.
|
|
121
|
-
- `src/ui/` - User interface and diagnostics.
|
|
122
|
-
- `src/modules/` - Tool implementations (ripgrep, difftastic, git).
|
|
123
|
-
|
|
124
|
-
## Related docs
|
|
125
|
-
|
|
126
|
-
- `../server/README.md`
|
|
127
|
-
- `../web/README.md`
|