dotmd-cli 0.49.2 → 0.49.3
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/new.mjs +4 -2
package/package.json
CHANGED
package/src/new.mjs
CHANGED
|
@@ -366,14 +366,16 @@ export async function runNew(argv, config, opts = {}) {
|
|
|
366
366
|
else if (bodyArg !== null) {
|
|
367
367
|
bodyInput = readBodyInput(bodyArg);
|
|
368
368
|
bodyInputSource = bodyArg === '-' ? 'stdin (`-`)' : (bodyArg.startsWith('@') ? `file (\`${bodyArg}\`)` : 'inline body argument');
|
|
369
|
-
} else
|
|
369
|
+
} else {
|
|
370
370
|
// Auto-consume piped or redirected stdin so agents don't need the `-`
|
|
371
371
|
// placeholder for the most common pattern (`cat draft.md | dotmd new …`,
|
|
372
372
|
// `dotmd new … < draft.md`, or a `<<'EOF'` heredoc). We probe stdin via
|
|
373
373
|
// fstatSync rather than `!isTTY` so a closed/inherited fd doesn't trigger
|
|
374
374
|
// a blocking read of an empty stream. We accept FIFO (shell pipes), regular
|
|
375
375
|
// file (shell redirection / heredoc), and socket (Node spawnSync `input:`
|
|
376
|
-
// delivers stdin as an AF_UNIX socket).
|
|
376
|
+
// delivers stdin as an AF_UNIX socket). Probe this even for templates that
|
|
377
|
+
// don't accept bodies so the fail-fast guard below can reject accidental
|
|
378
|
+
// heredoc/input instead of silently scaffolding without it.
|
|
377
379
|
try {
|
|
378
380
|
const stat = fstatSync(0);
|
|
379
381
|
if (stat.isFIFO() || stat.isFile() || stat.isSocket()) {
|