@raolin2025/claude-code-node 2.2.3 → 2.2.5
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/package.json +1 -1
- package/src/core/cli.js +17 -1
package/package.json
CHANGED
package/src/core/cli.js
CHANGED
|
@@ -138,6 +138,7 @@ Commands:
|
|
|
138
138
|
/channel CMD — Manage notification channels (list|send|test)
|
|
139
139
|
/cost — Show API cost report
|
|
140
140
|
/compact — Manually compact conversation context
|
|
141
|
+
/cd PATH — Change working directory
|
|
141
142
|
/allow [tool] — Allow a tool for the current session (default: all)
|
|
142
143
|
/exit — Exit (also Ctrl+C)
|
|
143
144
|
/quit — Same as /exit
|
|
@@ -173,7 +174,7 @@ function parseArgs(argv) {
|
|
|
173
174
|
case '--verbose': case '-v': args.verbose = true; break
|
|
174
175
|
case '--no-stream': args.noStream = true; break
|
|
175
176
|
case '--version':
|
|
176
|
-
const pkg = JSON.parse(readFileSync(new URL('
|
|
177
|
+
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf8'))
|
|
177
178
|
console.log(pkg.version)
|
|
178
179
|
process.exit(0)
|
|
179
180
|
case '--help': case '-h':
|
|
@@ -423,6 +424,21 @@ export async function main() {
|
|
|
423
424
|
case 'cost':
|
|
424
425
|
console.log(engine.costTracker.formatReport())
|
|
425
426
|
break
|
|
427
|
+
case 'cd':
|
|
428
|
+
if (rest.length === 0) {
|
|
429
|
+
console.log(`Current directory: ${process.cwd()}`)
|
|
430
|
+
} else {
|
|
431
|
+
const target = rest.join(' ')
|
|
432
|
+
try {
|
|
433
|
+
process.chdir(target)
|
|
434
|
+
const newCwd = process.cwd()
|
|
435
|
+
engine.config.cwd = newCwd
|
|
436
|
+
console.log(`📂 ${newCwd}`)
|
|
437
|
+
} catch (err) {
|
|
438
|
+
console.log(`❌ ${err.message}`)
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
break
|
|
426
442
|
case 'compact': {
|
|
427
443
|
if (engine.tokenBudget) {
|
|
428
444
|
const { compacted, messages } = autoCompact(engine.state.messages, engine.tokenBudget, { keepRecentTurns: 4 })
|