hacklab 0.5.4 → 0.6.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 +74 -16
- package/package.json +3 -4
- package/bin/ddd +0 -19
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ npx hacklab@latest join
|
|
|
22
22
|
## The join ritual
|
|
23
23
|
|
|
24
24
|
```
|
|
25
|
-
scan local AI usage → see your rank → pick a username → sign in with GitHub → claim
|
|
25
|
+
scan local AI usage → see your rank → pick a username → sign in with GitHub → claim → chat
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
1. **Scan** — reads your local AI token usage from Claude Code, Codex, Cursor,
|
|
@@ -35,6 +35,8 @@ scan local AI usage → see your rank → pick a username → sign in with GitHu
|
|
|
35
35
|
uploads in the background while you get a shareable stats card.
|
|
36
36
|
6. **Share** — a stats thumbnail (belt, level, rank, token breakdown) is rendered
|
|
37
37
|
locally, copied to your clipboard, and you can post it to X in one keystroke.
|
|
38
|
+
7. **Chat** — finally, you're offered the live channel (default yes). Decline and
|
|
39
|
+
you can jump in anytime with `hacklab chat`.
|
|
38
40
|
|
|
39
41
|
## Commands
|
|
40
42
|
|
|
@@ -43,13 +45,13 @@ scan local AI usage → see your rank → pick a username → sign in with GitHu
|
|
|
43
45
|
- `hacklab sync` — re-scan local AI usage and sync it to your profile.
|
|
44
46
|
- `hacklab whoami` — show who you're logged in as.
|
|
45
47
|
- `hacklab drop "message"` — post a drop to your feed (`-u <url>` to attach a link).
|
|
46
|
-
- `hacklab chat
|
|
47
|
-
`
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
- `hacklab chat` — open the live channel (typing posts; this is the default, so
|
|
49
|
+
bare `hacklab chat` and `hacklab chat live` are the same). Other subcommands:
|
|
50
|
+
`tail`, `post`, `history`, `dms`, `dm <handle>`, `flag`. Author handles are
|
|
51
|
+
coloured by belt rank. Add `--json` to any non-interactive subcommand for
|
|
52
|
+
machine-readable output an agent can drive.
|
|
50
53
|
- `hacklab login` — re-authenticate with GitHub.
|
|
51
|
-
- `hacklab
|
|
52
|
-
- `hacklab scan` — build your full profile (skills, repos, blog).
|
|
54
|
+
- `hacklab logout` — clear your saved session on this machine.
|
|
53
55
|
- `hacklab config <key> <value>` — set config (`cursor-api-key`, `cursor-email`).
|
|
54
56
|
- `hacklab brag [path]` — sync a `.hacklab/project.yaml` to your profile.
|
|
55
57
|
- `hacklab org` — edit the profile of an organization you've claimed. Pick a
|
|
@@ -59,33 +61,89 @@ scan local AI usage → see your rank → pick a username → sign in with GitHu
|
|
|
59
61
|
|
|
60
62
|
## Choosing a backend
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
Every command resolves which backend to talk to by the same precedence:
|
|
65
|
+
|
|
66
|
+
1. **`--env <name>`** on the command line (highest);
|
|
67
|
+
2. **`HACKLAB_APP_URL`** set in the environment;
|
|
68
|
+
3. **the backend you logged into** (saved in the session file);
|
|
69
|
+
4. **production** (`https://hacklab.so`) by default.
|
|
64
70
|
|
|
65
71
|
```bash
|
|
66
72
|
hacklab join --env staging # https://staging.hacklab.so
|
|
67
73
|
hacklab join --env development # http://localhost:3000
|
|
74
|
+
hacklab drop "hi" --env staging # the override applies to every command, not just login
|
|
68
75
|
```
|
|
69
76
|
|
|
70
|
-
`--env`
|
|
77
|
+
`--env` accepts any unambiguous abbreviation (`dev`, `prod`, `stag`) and the
|
|
78
|
+
aliases `local`/`localhost` for development. Under the hood it just sets
|
|
79
|
+
`HACKLAB_APP_URL` for that run, so an explicit `--env` overrides an inherited
|
|
80
|
+
`HACKLAB_APP_URL`.
|
|
81
|
+
|
|
82
|
+
Note that **sessions are per-backend**: your token is only valid on the backend
|
|
83
|
+
you logged into. Overriding `--env` to a backend you haven't authenticated
|
|
84
|
+
against will 401 until you `hacklab login --env <that>`. `hacklab whoami` shows
|
|
85
|
+
the effective backend and warns when it differs from where you logged in.
|
|
71
86
|
|
|
72
87
|
## Environment
|
|
73
88
|
|
|
74
|
-
- `HACKLAB_APP_URL` — explicit app base URL
|
|
75
|
-
|
|
89
|
+
- `HACKLAB_APP_URL` — explicit app base URL (read from the real environment; the
|
|
90
|
+
CLI does not load any `.env` file). A command-line `--env` sets this for the
|
|
91
|
+
run, so `--env` wins over an inherited value. See **Choosing a backend** for
|
|
92
|
+
the full precedence.
|
|
76
93
|
- `HACKLAB_SESSION_PATH` — custom path for the session file
|
|
77
94
|
(default `~/.hacklab/session.json`).
|
|
95
|
+
- `HACKLAB_CALLBACK_PORT` — pin the local OAuth callback port (default: a random
|
|
96
|
+
free port). Lets you forward a fixed port for the browser-callback flow on a
|
|
97
|
+
remote host.
|
|
98
|
+
|
|
99
|
+
## Signing in
|
|
100
|
+
|
|
101
|
+
`hacklab login` and `hacklab join` use **GitHub's device flow** by default,
|
|
102
|
+
everywhere (desktop or headless): they print a short code and
|
|
103
|
+
`github.com/login/device`. Open that on any device where you're signed into
|
|
104
|
+
GitHub, enter the code, and authorize Hacklab — the terminal logs into the
|
|
105
|
+
linked Hacklab account. No local server, no port forwarding, no localhost/app
|
|
106
|
+
URL. (No Hacklab account linked to that GitHub yet? `hacklab join` registers
|
|
107
|
+
one; `hacklab login` tells you to run `join`.)
|
|
108
|
+
|
|
109
|
+
### `--browser`: the local browser flow
|
|
110
|
+
|
|
111
|
+
Pass `--browser` to `login`/`join` to use the OAuth-redirect flow instead — it
|
|
112
|
+
opens your browser and catches the redirect on a local callback server. Handy on
|
|
113
|
+
a desktop where auto-opening a browser beats typing a code. On a remote host
|
|
114
|
+
you'd forward the callback port (pin it with `HACKLAB_CALLBACK_PORT` so the
|
|
115
|
+
forward is stable):
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
# on the remote host:
|
|
119
|
+
HACKLAB_CALLBACK_PORT=8765 hacklab login --browser
|
|
120
|
+
# from your laptop, forward that port, then open the printed URL:
|
|
121
|
+
ssh -L 8765:localhost:8765 <this-host>
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The device flow also falls back to `--browser` automatically if a backend
|
|
125
|
+
doesn't expose the device routes yet (e.g. not-yet-deployed staging).
|
|
78
126
|
|
|
79
127
|
## Local development
|
|
80
128
|
|
|
81
|
-
From the repo root,
|
|
129
|
+
From the repo root, `pnpm cli <command>` runs the CLI from source (tsx, no
|
|
130
|
+
build) and defaults to the **development** backend, so local work needs no
|
|
131
|
+
flags:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pnpm cli chat # runs against http://localhost:3000
|
|
135
|
+
pnpm cli join --env staging # override the dev default per-command
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The dev default lives only in the root `cli` script (`--env development`), so
|
|
139
|
+
the published npm package still defaults to production. Use a throwaway session
|
|
140
|
+
to avoid touching a real account:
|
|
82
141
|
|
|
83
142
|
```bash
|
|
84
|
-
HACKLAB_SESSION_PATH=/tmp/hl-test.json
|
|
85
|
-
pnpm --filter hacklab dev join --env development
|
|
143
|
+
HACKLAB_SESSION_PATH=/tmp/hl-test.json pnpm cli join
|
|
86
144
|
```
|
|
87
145
|
|
|
88
|
-
`pnpm --filter hacklab dev
|
|
146
|
+
Under the hood `pnpm cli` is `pnpm --filter hacklab dev` (= `tsx src/index.ts`).
|
|
89
147
|
`pnpm --filter hacklab build` compiles to `dist/`.
|
|
90
148
|
|
|
91
149
|
To reset a test account so its GitHub identity can join fresh:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hacklab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
"node": ">=20"
|
|
11
11
|
},
|
|
12
12
|
"bin": {
|
|
13
|
-
"hacklab": "./dist/index.js"
|
|
14
|
-
"ddd": "./bin/ddd"
|
|
13
|
+
"hacklab": "./dist/index.js"
|
|
15
14
|
},
|
|
16
|
-
"files": ["dist"
|
|
15
|
+
"files": ["dist"],
|
|
17
16
|
"scripts": {
|
|
18
17
|
"build": "tsc -p tsconfig.json && chmod +x dist/index.js",
|
|
19
18
|
"dev": "tsx src/index.ts",
|
package/bin/ddd
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
# Wrapper that invokes the real dd.js entrypoint.
|
|
3
|
-
# When used with a noglob alias (alias ddd='noglob ddd'), zsh won't
|
|
4
|
-
# expand special characters like ? ! * before they reach Node.
|
|
5
|
-
#
|
|
6
|
-
# Resolve symlinks so dist/dd.js is found even when this script is invoked
|
|
7
|
-
# through a bin symlink (e.g. /opt/homebrew/bin/ddd -> .../hacklab/bin/ddd).
|
|
8
|
-
# A plain `dirname "$0"` would point at the symlink's dir, not the package.
|
|
9
|
-
src="$0"
|
|
10
|
-
while [ -L "$src" ]; do
|
|
11
|
-
dir="$(cd -P "$(dirname "$src")" && pwd)"
|
|
12
|
-
src="$(readlink "$src")"
|
|
13
|
-
case "$src" in
|
|
14
|
-
/*) ;;
|
|
15
|
-
*) src="$dir/$src" ;;
|
|
16
|
-
esac
|
|
17
|
-
done
|
|
18
|
-
dir="$(cd -P "$(dirname "$src")" && pwd)"
|
|
19
|
-
exec node "$dir/../dist/dd.js" "$@"
|