@raolin2025/claude-code-node 2.2.6 → 2.2.7

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/core/cli.js +44 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raolin2025/claude-code-node",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/core/cli.js CHANGED
@@ -143,8 +143,43 @@ Commands:
143
143
  /allow [tool] — Allow a tool for the current session (default: all)
144
144
  /exit — Exit (also Ctrl+C)
145
145
  /quit — Same as /exit
146
+
147
+ Use "/help <cmd>" for detailed help on a specific command.
146
148
  `
147
149
 
150
+ const DETAILED_HELP = {
151
+ help: "/help [command]\n Show help. Without argument: list all commands.\n With a command name: show detailed help for that command.\n\n Example: /help model",
152
+
153
+ model: "/model <model_name>\n Switch the LLM model in real-time.\n The change takes effect immediately for the next message.\n You can use any model name supported by your current API provider.\n\n Example: /model deepseek-chat\n Example: /model gpt-4o",
154
+
155
+ models: "/models\n Fetch and display all available models from the current API provider.\n Shows a numbered list, then prompts you to select by number or name.\n Requires a configured API key (the one you used to start cc-node).\n Uses the endpoint: <apiBase>/models",
156
+
157
+ tools: "/tools\n List all available tools that cc-node can use.\n Shows tool names with their short descriptions.\n\n Tools include: Bash, Read, Edit, Write, Glob, Grep,\n WebFetch, WebSearch, AskUserQuestion, GitTool",
158
+
159
+ session: "/session\n Show current session information:\n - Session ID\n - Session title\n - Number of messages\n - Number of tool call turns",
160
+
161
+ sessions:"/sessions\n List all saved sessions.\n Shows session ID, title, message count, and last update time.",
162
+
163
+ clear: "/clear\n Clear the current conversation context.\n Starts a fresh session. Previous messages are not sent to the API anymore.\n\n Note: Does not delete saved sessions.",
164
+
165
+ config: "/config [key]\n Without key: show the entire config as JSON.\n With a key path: show the value for that specific path.\n\n Example: /config\n Example: /config model",
166
+
167
+ budget: "/budget\n Show token budget usage for the current session.\n Displays how many tokens have been used vs the limit.",
168
+
169
+ channel: "/channel <list|send|test>\n Manage notification channels.\n\n Subcommands:\n list — List all configured notification channels\n send <msg> — Send a message via all channels\n test — Send a test message to verify channels\n\n Requires channel environment variables to be set at startup.",
170
+
171
+ cost: "/cost\n Show API cost report.\n Displays total tokens used and estimated cost in USD.\n Supports pricing for: DeepSeek, OpenAI, Qwen, GLM, Kimi.",
172
+
173
+ compact: "/compact\n Manually trigger context compression.\n Compresses the conversation history to fit within the token budget.\n Keeps recent turns intact, compresses older ones.\n\n Typically triggered automatically at 80% budget usage.",
174
+
175
+ cd: "/cd <path>\n Change the working directory of cc-node.\n Affects all subsequent tool executions (Bash, Read, Write, etc.).\n\n Without path: show the current working directory.\n\n Example: /cd /home/raolin/projects\n Example: /cd ..",
176
+
177
+ allow: "/allow [tool_name]\n Allow a tool to execute without confirmation for this session.\n Without tool name: allows ALL tools.\n\n Example: /allow\n Example: /allow Bash",
178
+
179
+ exit: "/exit\n Exit cc-node. Same as Ctrl+C or /quit.",
180
+ quit: "/quit\n Exit cc-node. Same as Ctrl+C or /exit.",
181
+ }
182
+
148
183
  // ============================================================
149
184
  // 参数解析
150
185
  // ============================================================
@@ -352,7 +387,15 @@ export async function main() {
352
387
  if (input.startsWith('/')) {
353
388
  const [cmd, ...rest] = input.slice(1).split(' ')
354
389
  switch (cmd) {
355
- case 'help': console.log(HELP_TEXT); break
390
+ case 'help':
391
+ if (rest[0]) {
392
+ const detail = DETAILED_HELP[rest[0].toLowerCase()]
393
+ if (detail) console.log(detail)
394
+ else console.log(`No detailed help for /${rest[0]}. Type /help for all commands.`)
395
+ } else {
396
+ console.log(HELP_TEXT)
397
+ }
398
+ break
356
399
  case 'model':
357
400
  if (rest[0]) { engine.config.model = rest.join(' '); console.log(`Model → ${engine.config.model}`) }
358
401
  else console.log(`Model: ${engine.config.model}`)