Change log() function to use console.error instead of console.log.
This ensures that when stdout is piped (e.g., to 'code -'), only
the prompt file path is sent through the pipe, while progress
messages remain visible on the terminal via stderr.
Usage:
echo 'content' | yarn --silent docs:create --products X | code -
When running outside Claude Code, script now outputs prompt file path
to stdout by default (or prompt text with --print-prompt flag).
This enables integration with external AI tools without requiring flags.
Inside Claude Code, script continues to run Task() agent automatically.
Changes:
- Add isClaudeCode() detection function
- Add outputPromptForExternalUse() helper
- Add PROMPT_FILE constant for .tmp/scaffold-prompt.txt
- Update both URL-based and draft-based workflows
- Update help text with environment-aware behavior examples
Allows piping prompt to other AI tools or saving to file:
yarn docs:create --print-prompt draft.md > prompt.txt
yarn docs:create --print-prompt draft.md | llm -m gpt-4
The flag:
- Prepares context and selects products
- Generates the full AI prompt
- Outputs to stdout and exits
- Works with both URL-based and draft-based workflows
- stdin now requires --products flag with product keys
- removed early return in promptUser() that prevented interactive prompts
- updated help text with stdin + --products examples
- prevents 'No products selected' error when running interactively