Skip to content

Commit 973cb53

Browse files
committed
build(cli): package ccpool as a standalone, publishable npm package
Bundle the CLI into a single self-contained package so `npm i -g ccpool` works without the private workspace packages: - rename @ccpool/cli -> ccpool; build with tsup, bundling @ccpool/core and @ccpool/daemon (moved to devDeps) into dist while keeping commander/ink/react external - add publish metadata (description, keywords, license, repo, bugs, engines); `files: ["dist"]` with README/LICENSE generated into the package root at build time (gitignored, copied from repo root) so npm renders them - normalize `bin` to `dist/cli.js` (drops npm's "invalid and removed" warning) - drive `ccpool --version` from package.json via a tsup define (was hardcoded) - add MIT LICENSE; add description/license to every package and mark the non-published apps private; rename the monorepo root to ccpool-monorepo to end the name collision with the CLI Also: point DEFAULT_SERVER_URL at ccpool.vps.hexxt.dev and refresh the ccpool-large marketing image.
1 parent 2beb05d commit 973cb53

16 files changed

Lines changed: 353 additions & 17 deletions

File tree

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 hexxt
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.

apps/app/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@ccpool/app",
33
"type": "module",
44
"version": "0.0.1",
5+
"description": "ccpool web dashboard (React + Vite).",
6+
"license": "MIT",
7+
"private": true,
58
"scripts": {
69
"dev": "vite",
710
"build": "tsc -b && vite build",

apps/cli/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# generated at build time from the repo root (see tsup.config.ts)
2+
/README.md
3+
/LICENSE

apps/cli/package.json

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,61 @@
11
{
2-
"name": "@ccpool/cli",
2+
"name": "ccpool",
33
"type": "module",
4-
"version": "0.0.1",
4+
"version": "0.0.2",
5+
"description": "Fairly share one Claude Code subscription across a group — a live, shared view of the account's usage and who's driving it.",
6+
"keywords": [
7+
"claude",
8+
"claude-code",
9+
"cli",
10+
"usage",
11+
"quota",
12+
"rate-limit",
13+
"tui",
14+
"ink"
15+
],
16+
"license": "MIT",
17+
"author": "hexxt",
18+
"homepage": "https://github.com/hexxt-git/ccpool#readme",
19+
"repository": {
20+
"type": "git",
21+
"url": "git+https://github.com/hexxt-git/ccpool.git",
22+
"directory": "apps/cli"
23+
},
24+
"bugs": {
25+
"url": "https://github.com/hexxt-git/ccpool/issues"
26+
},
27+
"engines": {
28+
"node": ">=20"
29+
},
530
"bin": {
6-
"ccpool": "./dist/cli.js"
31+
"ccpool": "dist/cli.js"
32+
},
33+
"files": [
34+
"dist"
35+
],
36+
"publishConfig": {
37+
"access": "public"
738
},
839
"scripts": {
940
"dev": "tsx src/cli.tsx",
10-
"build": "tsc",
41+
"build": "tsup",
1142
"type-check": "tsc --noEmit",
1243
"lint": "eslint src",
1344
"link": "npm link",
14-
"unlink": "npm unlink -g @ccpool/cli"
45+
"unlink": "npm unlink -g ccpool"
1546
},
1647
"dependencies": {
17-
"@ccpool/core": "workspace:*",
18-
"@ccpool/daemon": "workspace:*",
1948
"commander": "^13.1.0",
2049
"ink": "^5.1.0",
2150
"react": "^18.3.1"
2251
},
2352
"devDependencies": {
53+
"@ccpool/core": "workspace:*",
54+
"@ccpool/daemon": "workspace:*",
2455
"@types/node": "^22.0.0",
2556
"@types/react": "^18.3.18",
2657
"ink-testing-library": "^4.0.0",
58+
"tsup": "^8.3.5",
2759
"tsx": "^4.19.2",
2860
"typescript": "^5.7.2"
2961
}

apps/cli/src/cli.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ import {
1919

2020
const program = new Command();
2121

22+
// Injected at build time by tsup from package.json (see tsup.config.ts); the
23+
// `typeof` guard keeps `tsx` dev runs (where it isn't defined) working.
24+
declare const __CLI_VERSION__: string;
25+
2226
program
2327
.name("ccpool")
2428
.description("a shared, live picture of one Claude account's usage and who's using it")
25-
.version("0.0.1");
29+
.version(typeof __CLI_VERSION__ !== "undefined" ? __CLI_VERSION__ : "0.0.0-dev");
2630

2731
// Bare `ccpool` opens the TUI: onboarding when unconfigured, the live view
2832
// otherwise (press `c` there to configure). The subcommands below remain as a

apps/cli/src/lib/links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const SITE_URL = "https://ccpool.hexxt.dev";
77
* purpose — members only ever type the two passwords. `CCPOOL_SERVER_URL`
88
* overrides it for development and self-hosted servers.
99
*/
10-
export const DEFAULT_SERVER_URL = "https://api.ccpool.hexxt.dev";
10+
export const DEFAULT_SERVER_URL = "https://ccpool.vps.hexxt.dev";
1111

1212
/**
1313
* Wrap `text` as a clickable OSC 8 hyperlink to `url`. When `enabled` is false

apps/cli/tsup.config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { copyFile, readFile } from "node:fs/promises";
2+
import { defineConfig } from "tsup";
3+
4+
const { version } = JSON.parse(await readFile("./package.json", "utf8")) as {
5+
version: string;
6+
};
7+
8+
export default defineConfig({
9+
entry: { cli: "src/cli.tsx" },
10+
format: ["esm"],
11+
target: "node20",
12+
platform: "node",
13+
outDir: "dist",
14+
clean: true,
15+
// Single source of truth for `ccpool --version`: injected from package.json.
16+
define: { __CLI_VERSION__: JSON.stringify(version) },
17+
// Bundle the internal workspace packages (they are devDependencies) into the
18+
// single published `ccpool` package; keep real runtime deps external so npm
19+
// installs them normally.
20+
noExternal: [/^@ccpool\//],
21+
// The entry file already carries `#!/usr/bin/env node`; tsup preserves it.
22+
// Pull the canonical README/LICENSE from the repo root into the package root
23+
// at build time so they ship in the tarball without committing duplicates
24+
// here. They must land at the package root (not dist) — npm only renders the
25+
// README and recognizes the LICENSE from there. Both are gitignored.
26+
async onSuccess() {
27+
await Promise.all([
28+
copyFile("../../README.md", "README.md"),
29+
copyFile("../../LICENSE", "LICENSE"),
30+
]);
31+
},
32+
});

apps/server/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"name": "@ccpool/server",
33
"type": "module",
44
"version": "0.0.1",
5+
"description": "Multi-tenant HTTP server for ccpool (Hono + libSQL) — the one path to the shared ledger.",
6+
"license": "MIT",
57
"private": true,
68
"exports": {
79
".": {

apps/web/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@ccpool/web",
33
"type": "module",
44
"version": "0.0.1",
5+
"description": "Astro marketing site for ccpool.",
6+
"license": "MIT",
7+
"private": true,
58
"scripts": {
69
"dev": "astro dev",
710
"build": "astro build",

apps/web/public/ccpool-large.jpg

103 KB
Loading

0 commit comments

Comments
 (0)