Skip to content

Commit 0d9457f

Browse files
fix(claude-sm): validate --print/-p requires prompt argument
- Add validation before launching Claude - Show clear error message with usage examples - Prevents confusing Claude CLI error
1 parent 8f8b473 commit 0d9457f

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stackmemoryai/stackmemory",
3-
"version": "0.5.42",
3+
"version": "0.5.43",
44
"description": "Lossless memory runtime for AI coding tools - organizes context as a call stack instead of linear chat logs, with team collaboration and infinite retention",
55
"engines": {
66
"node": ">=20.0.0",

src/cli/claude-sm.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,23 @@ class ClaudeSM {
680680
i++;
681681
}
682682

683+
// Validate --print/-p requires a prompt argument
684+
const printIndex = claudeArgs.findIndex(
685+
(a) => a === '-p' || a === '--print'
686+
);
687+
if (printIndex !== -1) {
688+
const nextArg = claudeArgs[printIndex + 1];
689+
// If no next arg, or next arg is a flag, error out
690+
if (!nextArg || nextArg.startsWith('-')) {
691+
console.error(
692+
chalk.red('Error: --print/-p requires a prompt argument.')
693+
);
694+
console.log(chalk.gray('Usage: claude-smd -p "your prompt here"'));
695+
console.log(chalk.gray(' echo "prompt" | claude-smd -p'));
696+
process.exit(1);
697+
}
698+
}
699+
683700
// Initialize tracing system if enabled
684701
if (this.config.tracingEnabled) {
685702
// Set up environment for tracing

0 commit comments

Comments
 (0)