cc-hub-cli 1.0.1 → 1.0.2

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.
Files changed (3) hide show
  1. package/README.md +160 -1
  2. package/dist/index.js +2 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,160 @@
1
- # cc-hub
1
+ # cc-hub
2
+
3
+ Manage Claude CLI profiles, hooks, and sessions — one tool, all in one place.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g cc-hub-cli
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Add a profile
15
+ cc-hub profile add flow -m anthropic.claude-4-6-sonnet -t eyJ... -u https://example.com/api
16
+
17
+ # Set as default
18
+ cc-hub profile default flow
19
+
20
+ # Launch Claude Code with it
21
+ cc-hub run
22
+
23
+ # Or launch with a specific profile
24
+ cc-hub run flow
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ ### Profiles
30
+
31
+ Manage multiple Claude API configurations (model, token, URL).
32
+
33
+ ```bash
34
+ cc-hub profile add <name> -m <model> -t <token> -u <url> # Add or update
35
+ cc-hub profile update <name> -m <model> # Update fields
36
+ cc-hub profile list # List all (tokens masked)
37
+ cc-hub profile view <name> # View details (token visible)
38
+ cc-hub profile view <name> -j # View as JSON
39
+ cc-hub profile remove <name> # Remove
40
+ cc-hub profile default <name> # Set default
41
+ ```
42
+
43
+ ### Run / Use
44
+
45
+ Launch Claude Code with a profile's credentials injected as environment variables.
46
+
47
+ ```bash
48
+ # Set a profile as default (no launch)
49
+ cc-hub use <name>
50
+
51
+ # Launch Claude Code with a profile
52
+ cc-hub use <name> [extra args...]
53
+
54
+ # Launch using the default profile
55
+ cc-hub run [extra args...]
56
+
57
+ # Launch with a specific profile
58
+ cc-hub run <name> [extra args...]
59
+ ```
60
+
61
+ `run` and `use` exec into the `claude` CLI with `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL`, and `--model` set from the profile.
62
+
63
+ ### Hook
64
+
65
+ Manage Claude Code hooks in `~/.claude/settings.json`.
66
+
67
+ ```bash
68
+ cc-hub hook list # List all hooks
69
+ cc-hub hook add -e <event> -c <command> [-m <matcher>] [-a] # Add a hook
70
+ cc-hub hook remove -i <index> # Remove by index
71
+ cc-hub hook enable -i <index> [-i <index>] # Enable disabled hooks
72
+ cc-hub hook disable -i <index> [-i <index>] # Disable active hooks
73
+ ```
74
+
75
+ **Events:** `PreToolUse`, `PostToolUse`, `Notification`, `Stop`, `UserPromptSubmit`, `PermissionRequest`
76
+
77
+ **Examples:**
78
+
79
+ ```bash
80
+ # Desktop notification when Claude finishes
81
+ cc-hub hook add -e Stop -c 'osascript -e "display notification \"Done\""'
82
+
83
+ # Hook only for Bash tool usage
84
+ cc-hub hook add -e PreToolUse -m Bash -c 'echo "Running bash..."'
85
+
86
+ # Async hook
87
+ cc-hub hook add -e PostToolUse -c 'my-logger.sh' -a
88
+ ```
89
+
90
+ Disabled hooks are kept in a pool and can be re-enabled later with `hook enable`.
91
+
92
+ ### Session
93
+
94
+ Browse and search Claude Code session history from `~/.claude/projects/`.
95
+
96
+ ```bash
97
+ cc-hub session list [-n <limit>] [-s] [-j] # List projects
98
+ cc-hub session show <project> [-v] # Show sessions for a project
99
+ cc-hub session search <query> [-p <project>] [-n <n>] [-i] # Search conversation history
100
+ cc-hub session ps # Show active processes
101
+ cc-hub session stats # Summary statistics
102
+ cc-hub session clean [-d <days>] [--dry-run] # Delete old sessions
103
+ ```
104
+
105
+ **Examples:**
106
+
107
+ ```bash
108
+ # List recent projects
109
+ cc-hub session list -n 10
110
+
111
+ # Show sessions with first message preview
112
+ cc-hub session show cc-hub -v
113
+
114
+ # Case-insensitive search
115
+ cc-hub session search "authentication" -i
116
+
117
+ # Preview what would be cleaned up
118
+ cc-hub session clean -d 60 --dry-run
119
+ ```
120
+
121
+ ### Shell Completion
122
+
123
+ ```bash
124
+ # zsh — add to ~/.zshrc
125
+ eval "$(cc-hub complete zsh)"
126
+
127
+ # bash — add to ~/.bashrc
128
+ eval "$(cc-hub complete bash)"
129
+ ```
130
+
131
+ Completes subcommands, profile names, and event types.
132
+
133
+ ## Configuration
134
+
135
+ cc-hub reads from these paths (overridable via environment variables):
136
+
137
+ | File | Default | Env Override |
138
+ |---|---|---|
139
+ | Profiles | `~/.claude/profiles.json` | `CLAUDE_PROFILES_FILE` |
140
+ | Settings | `~/.claude/settings.json` | `CLAUDE_SETTINGS_FILE` |
141
+ | Claude dir | `~/.claude` | `CLAUDE_DIR` |
142
+
143
+ ### Profile storage format
144
+
145
+ ```json
146
+ {
147
+ "profiles": {
148
+ "flow": {
149
+ "model": "anthropic.claude-4-6-sonnet",
150
+ "token": "eyJ...",
151
+ "url": "https://example.com/api"
152
+ }
153
+ },
154
+ "default": "flow"
155
+ }
156
+ ```
157
+
158
+ ## License
159
+
160
+ MIT
package/dist/index.js CHANGED
@@ -152,7 +152,7 @@ function execClaude(profileName, p, extraArgs) {
152
152
  process.exit(result.status ?? 1);
153
153
  }
154
154
  function useCommand() {
155
- return new Command("use").description("Launch Claude Code with a saved profile (or set default if no args)").argument("<name>", "Profile name").argument("[args...]", "Extra arguments passed to claude").action((name, args) => {
155
+ return new Command("use").description("Launch Claude Code with a saved profile (or set default if no args)").allowUnknownOption().argument("<name>", "Profile name").argument("[args...]", "Extra arguments passed to claude").action((name, args) => {
156
156
  ensureProfilesFile();
157
157
  const data = readJson(PROFILES_FILE);
158
158
  const p = data.profiles[name];
@@ -170,7 +170,7 @@ function useCommand() {
170
170
  });
171
171
  }
172
172
  function runCommand() {
173
- return new Command("run").description("Launch Claude Code using the default or a specified profile").argument("[args...]", "Optional profile name followed by extra arguments").action((args) => {
173
+ return new Command("run").description("Launch Claude Code using the default or a specified profile").allowUnknownOption().argument("[args...]", "Optional profile name followed by extra arguments").action((args) => {
174
174
  ensureProfilesFile();
175
175
  const data = readJson(PROFILES_FILE);
176
176
  let profileName = "";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-hub-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Manage Claude CLI profiles, hooks, and sessions",
5
5
  "type": "module",
6
6
  "bin": {