Skip to content

Commit b45053b

Browse files
fix(claude-sm): allow stdin input for --print/-p flag
- Check for piped stdin before erroring on missing prompt - Supports: echo 'prompt' | claude-smd -p
1 parent 0d9457f commit b45053b

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

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.43",
3+
"version": "0.5.44",
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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,14 +680,17 @@ class ClaudeSM {
680680
i++;
681681
}
682682

683-
// Validate --print/-p requires a prompt argument
683+
// Validate --print/-p requires a prompt argument (unless stdin is piped)
684684
const printIndex = claudeArgs.findIndex(
685685
(a) => a === '-p' || a === '--print'
686686
);
687687
if (printIndex !== -1) {
688688
const nextArg = claudeArgs[printIndex + 1];
689-
// If no next arg, or next arg is a flag, error out
690-
if (!nextArg || nextArg.startsWith('-')) {
689+
const hasStdin = !process.stdin.isTTY; // stdin is piped
690+
const hasPromptArg = nextArg && !nextArg.startsWith('-');
691+
692+
// Error only if no stdin AND no prompt argument
693+
if (!hasStdin && !hasPromptArg) {
691694
console.error(
692695
chalk.red('Error: --print/-p requires a prompt argument.')
693696
);

0 commit comments

Comments
 (0)