Skip to content

Commit a463ce9

Browse files
avivsinaiclaude
andcommitted
fix: complete removal of zero-friction mode and update all examples
- Remove all references to zero-friction mode from help text and examples - Update all documentation to use explicit 'expert' and 'generate' commands - Fix examples in src/index.ts to use explicit commands with -f flag - Fix examples in CLAUDE.md template to use -f flag and --preset - Fix examples in preset.ts to use 'expert' command - Delete obsolete preset pattern files (auth-system, cli-analysis, terminal-fixes, typescript) - Rebuild embedded templates with corrected examples BREAKING CHANGE: Users must now use explicit 'expert' or 'generate' commands instead of asking questions directly. All file arguments require -f flag. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 7303eb8 commit a463ce9

File tree

10 files changed

+24
-67
lines changed

10 files changed

+24
-67
lines changed

packages/cli/.promptcode/presets/auth-system.patterns

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/cli/.promptcode/presets/cli-analysis.patterns

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/cli/.promptcode/presets/terminal-fixes.patterns

Lines changed: 0 additions & 10 deletions
This file was deleted.

packages/cli/.promptcode/presets/typescript.patterns

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/cli/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,21 @@ npm install -g promptcode-cli
3737
3838
## Quick Start
3939

40-
### AI-Agent Friendly (Zero Configuration)
40+
### Expert Mode
4141
```bash
42-
# Ask questions with codebase context
43-
promptcode "Why is this API slow?" src/**/*.ts
44-
promptcode "Explain the auth flow" @backend/ @frontend/
45-
promptcode "What are the security risks?" # Analyzes entire project
46-
47-
# Generate prompts from files
48-
promptcode src/**/*.ts docs/**/*.md # Just files = generate mode
42+
# Ask questions with codebase context using AI experts
43+
promptcode expert "Why is this API slow?" -f src/**/*.ts
44+
promptcode expert "Explain the auth flow" -f backend/**/*.ts
45+
promptcode expert "What are the security risks?" --preset api
4946
```
5047

51-
### Traditional Workflow
48+
### Generate Mode
5249
```bash
53-
# Create a preset for your backend code
54-
promptcode preset --create backend
50+
# Generate prompts from files for AI analysis
51+
promptcode generate -f src/**/*.ts docs/**/*.md
5552

56-
# Generate a prompt using the preset
53+
# Create and use presets for reusable patterns
54+
promptcode preset create backend
5755
promptcode generate -p backend -o prompt.md
5856

5957
# Ask AI expert for help (requires API key)

packages/cli/src/claude-templates/CLAUDE.md.template

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ Generate AI-ready prompts from your codebase. The CLI is designed to be AI-frien
77

88
```bash
99
# Generate a prompt with specific files
10-
promptcode generate src/api/handler.ts src/utils/*.ts
10+
promptcode generate -f src/api/handler.ts src/utils/*.ts
1111

1212
# Ask AI experts questions with code context
13-
promptcode expert "Why is this slow?" src/api/handler.ts
13+
promptcode expert "Why is this slow?" -f src/api/handler.ts
1414

1515
# Use presets for common file patterns
1616
promptcode preset list # See available presets
1717
promptcode preset info <name> # Show preset details & token count
18-
promptcode generate -l <preset-name> # Generate using preset
18+
promptcode generate --preset <preset-name> # Generate using preset
1919
```
2020

2121
## Working with Presets
@@ -28,7 +28,7 @@ promptcode preset create api-endpoints
2828

2929
# Edit the preset file to add patterns
3030
# Then use it:
31-
promptcode generate -l api-endpoints
31+
promptcode generate --preset api-endpoints
3232
```
3333

3434
## Common Workflows for AI Agents
@@ -47,7 +47,7 @@ When asked to analyze specific features:
4747
1. Create a descriptive preset: `promptcode preset create feature-name`
4848
2. Edit `.promptcode/presets/feature-name.patterns` with relevant patterns
4949
3. Use `promptcode preset info feature-name` to verify file selection
50-
4. Generate output: `promptcode generate -l feature-name`
50+
4. Generate output: `promptcode generate --preset feature-name`
5151

5252
### 3. Analyzing Code
5353
```bash

packages/cli/src/commands/expert.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ export async function expertCommand(question: string | undefined, options: Exper
117117
if (!finalQuestion) {
118118
console.error(chalk.red('🙋 I need a question to ask the AI expert.\n'));
119119
console.error(chalk.yellow('Examples:'));
120-
console.error(chalk.gray(' promptcode "Why is this slow?" src/**/*.ts'));
121-
console.error(chalk.gray(' promptcode "Explain the auth flow" @backend/'));
120+
console.error(chalk.gray(' promptcode expert "Why is this slow?" -f src/**/*.ts'));
121+
console.error(chalk.gray(' promptcode expert "Explain the auth flow" -f backend/**/*.ts'));
122122
console.error(chalk.gray(' promptcode expert "What are the security risks?" --preset api'));
123123
console.error(chalk.gray(' promptcode expert --prompt-file analysis.md --preset backend\n'));
124124
console.error(chalk.gray('To list available models: promptcode expert --models'));

packages/cli/src/commands/preset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ async function showPresetInfo(presetName: string, projectPath: string): Promise<
138138

139139
console.log(chalk.gray('\n # Ask AI expert with this preset:'));
140140
console.log(` ${chalk.cyan(`promptcode expert "Explain the architecture" --preset ${presetName}`)}`);
141-
console.log(` ${chalk.cyan(`promptcode "What are the security risks?" --preset ${presetName}`)}`);
141+
console.log(` ${chalk.cyan(`promptcode expert "What are the security risks?" --preset ${presetName}`)}`);
142142

143143
console.log(chalk.gray('\n # Save output to file:'));
144144
console.log(` ${chalk.cyan(`promptcode generate --preset ${presetName} --output /tmp/${presetName}-${new Date().toISOString().split('T')[0]}.txt`)}`);

packages/cli/src/embedded-templates.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/**
22
* Embedded templates for compiled binaries.
33
* This file is auto-generated during build - DO NOT EDIT MANUALLY.
4-
* Generated at: 2025-08-10T09:52:54.704Z
4+
* Generated at: 2025-08-10T11:09:09.025Z
55
*/
66

77
// Template contents embedded at build time
88
const EMBEDDED_TEMPLATES: Record<string, string> = {
9-
"CLAUDE.md.template": "<!-- PROMPTCODE-CLI-START -->\n# PromptCode CLI\n\nGenerate AI-ready prompts from your codebase. The CLI is designed to be AI-friendly with clear commands and outputs.\n\n## Quick Start\n\n```bash\n# Generate a prompt with specific files\npromptcode generate src/api/handler.ts src/utils/*.ts\n\n# Ask AI experts questions with code context\npromptcode expert \"Why is this slow?\" src/api/handler.ts\n\n# Use presets for common file patterns\npromptcode preset list # See available presets\npromptcode preset info <name> # Show preset details & token count\npromptcode generate -l <preset-name> # Generate using preset\n```\n\n## Working with Presets\n\nPresets are reusable file patterns stored in `.promptcode/presets/*.patterns`:\n\n```bash\n# Create a new preset\npromptcode preset create api-endpoints\n\n# Edit the preset file to add patterns\n# Then use it:\npromptcode generate -l api-endpoints\n```\n\n## Common Workflows for AI Agents\n\n### 1. Discovering Code Structure\n```bash\n# List all presets to understand project organization\npromptcode preset list\n\n# Inspect a preset to see what files it includes\npromptcode preset info functional-utils\n```\n\n### 2. Creating Focused Presets\nWhen asked to analyze specific features:\n1. Create a descriptive preset: `promptcode preset create feature-name`\n2. Edit `.promptcode/presets/feature-name.patterns` with relevant patterns\n3. Use `promptcode preset info feature-name` to verify file selection\n4. Generate output: `promptcode generate -l feature-name`\n\n### 3. Analyzing Code\n```bash\n# Generate prompt with specific concern\npromptcode generate src/**/*.ts --instructions \"Find performance bottlenecks\"\n\n# Or use expert mode for direct AI analysis\npromptcode expert \"Review this code for security issues\" src/api/**/*.ts\n```\n\n## Tips for AI Agents\n\n1. **Always check token counts** - Use `promptcode preset info` to see total tokens before generating\n2. **Be specific with patterns** - Use `src/api/*.ts` not `**/*.ts` to avoid huge contexts\n3. **Leverage existing presets** - Check `promptcode preset list` before creating new ones\n4. **Use descriptive preset names** - `auth-system` not `preset1`\n\n## Important: Cost Approval for AI Agents\n\nThe `expert` command includes built-in cost protection that requires approval for expensive operations (over $0.50 or using premium models). The CLI will automatically handle this in different environments:\n\n**In Interactive Mode (Terminal):**\n- The CLI will prompt the user directly for approval\n- Shows cost breakdown and waits for yes/no response\n\n**In Non-Interactive Mode (Claude Code, CI/CD):**\n```bash\n# Without approval flags, expensive operations will be blocked:\npromptcode expert \"Complex analysis\" --model o3-pro\n# Output: \"⚠️ Cost approval required for expensive operation (~$X.XX)\"\n# \"Non-interactive environment detected.\"\n# \"Use --yes to proceed with approval...\"\n```\n\n**AI Agent Approval Protocol:**\n1. **When you see \"Cost approval required\"**, STOP immediately\n2. **Inform the user**: \"This operation will cost approximately $X.XX. Do you want to proceed?\"\n3. **Wait for explicit user confirmation** (yes/no)\n4. **If approved**, re-run the command with `--yes` flag:\n ```bash\n promptcode expert \"Complex analysis\" --model o3-pro --yes\n ```\n5. **If declined**, inform the user the operation was cancelled\n\n**Important Guidelines for AI Agents:**\n- **NEVER** automatically add `--yes` without explicit user consent\n- **ALWAYS** show the cost estimate before asking for approval\n- The `--yes` flag means \"I have user approval for this specific operation\"\n- The `--yes` flag can be used to auto-approve operations after user consent\n- Default to conservative behavior - when in doubt, ask for approval\n\n**Cost Information:**\n- Expensive models: o3-pro\n- Threshold: Operations over $0.50 require approval\n- The CLI shows detailed cost breakdowns before execution\n\n## Claude Code Integration\n\nWhen you run `promptcode cc`, it installs a custom command for Claude:\n- **`.claude/commands/expert-consultation.md`** - Allows Claude to properly use the expert command with cost approval\n\nThis command helps Claude:\n1. Check available presets and select appropriate context\n2. Handle cost approval properly (never auto-approving expensive operations)\n3. Use the correct model based on your request (o3 vs o3-pro)\n4. Parse and present results effectively\n\nTo use it in Claude, simply ask: \"Consult an expert about [your question]\"\n\n## Configuration\n\nAPI keys must be set via environment variables:\n```bash\nexport OPENAI_API_KEY=sk-...\nexport ANTHROPIC_API_KEY=sk-ant-...\nexport GOOGLE_API_KEY=... # or GEMINI_API_KEY\nexport XAI_API_KEY=... # or GROK_API_KEY\n```\n\n<details>\n<summary>⚠️ Troubleshooting</summary>\n\n• **Command not found** – The CLI auto-installs to `~/.local/bin`. Ensure it's in PATH \n• **Missing API key** – Set via environment variable as shown above \n• **Context too large** – Use more specific file patterns or create focused presets\n• **Preset not found** – Check `.promptcode/presets/` directory exists\n</details>\n<!-- PROMPTCODE-CLI-END -->",
9+
"CLAUDE.md.template": "<!-- PROMPTCODE-CLI-START -->\n# PromptCode CLI\n\nGenerate AI-ready prompts from your codebase. The CLI is designed to be AI-friendly with clear commands and outputs.\n\n## Quick Start\n\n```bash\n# Generate a prompt with specific files\npromptcode generate -f src/api/handler.ts src/utils/*.ts\n\n# Ask AI experts questions with code context\npromptcode expert \"Why is this slow?\" -f src/api/handler.ts\n\n# Use presets for common file patterns\npromptcode preset list # See available presets\npromptcode preset info <name> # Show preset details & token count\npromptcode generate --preset <preset-name> # Generate using preset\n```\n\n## Working with Presets\n\nPresets are reusable file patterns stored in `.promptcode/presets/*.patterns`:\n\n```bash\n# Create a new preset\npromptcode preset create api-endpoints\n\n# Edit the preset file to add patterns\n# Then use it:\npromptcode generate --preset api-endpoints\n```\n\n## Common Workflows for AI Agents\n\n### 1. Discovering Code Structure\n```bash\n# List all presets to understand project organization\npromptcode preset list\n\n# Inspect a preset to see what files it includes\npromptcode preset info functional-utils\n```\n\n### 2. Creating Focused Presets\nWhen asked to analyze specific features:\n1. Create a descriptive preset: `promptcode preset create feature-name`\n2. Edit `.promptcode/presets/feature-name.patterns` with relevant patterns\n3. Use `promptcode preset info feature-name` to verify file selection\n4. Generate output: `promptcode generate --preset feature-name`\n\n### 3. Analyzing Code\n```bash\n# Generate prompt with specific concern\npromptcode generate src/**/*.ts --instructions \"Find performance bottlenecks\"\n\n# Or use expert mode for direct AI analysis\npromptcode expert \"Review this code for security issues\" src/api/**/*.ts\n```\n\n## Tips for AI Agents\n\n1. **Always check token counts** - Use `promptcode preset info` to see total tokens before generating\n2. **Be specific with patterns** - Use `src/api/*.ts` not `**/*.ts` to avoid huge contexts\n3. **Leverage existing presets** - Check `promptcode preset list` before creating new ones\n4. **Use descriptive preset names** - `auth-system` not `preset1`\n\n## Important: Cost Approval for AI Agents\n\nThe `expert` command includes built-in cost protection that requires approval for expensive operations (over $0.50 or using premium models). The CLI will automatically handle this in different environments:\n\n**In Interactive Mode (Terminal):**\n- The CLI will prompt the user directly for approval\n- Shows cost breakdown and waits for yes/no response\n\n**In Non-Interactive Mode (Claude Code, CI/CD):**\n```bash\n# Without approval flags, expensive operations will be blocked:\npromptcode expert \"Complex analysis\" --model o3-pro\n# Output: \"⚠️ Cost approval required for expensive operation (~$X.XX)\"\n# \"Non-interactive environment detected.\"\n# \"Use --yes to proceed with approval...\"\n```\n\n**AI Agent Approval Protocol:**\n1. **When you see \"Cost approval required\"**, STOP immediately\n2. **Inform the user**: \"This operation will cost approximately $X.XX. Do you want to proceed?\"\n3. **Wait for explicit user confirmation** (yes/no)\n4. **If approved**, re-run the command with `--yes` flag:\n ```bash\n promptcode expert \"Complex analysis\" --model o3-pro --yes\n ```\n5. **If declined**, inform the user the operation was cancelled\n\n**Important Guidelines for AI Agents:**\n- **NEVER** automatically add `--yes` without explicit user consent\n- **ALWAYS** show the cost estimate before asking for approval\n- The `--yes` flag means \"I have user approval for this specific operation\"\n- The `--yes` flag can be used to auto-approve operations after user consent\n- Default to conservative behavior - when in doubt, ask for approval\n\n**Cost Information:**\n- Expensive models: o3-pro\n- Threshold: Operations over $0.50 require approval\n- The CLI shows detailed cost breakdowns before execution\n\n## Claude Code Integration\n\nWhen you run `promptcode cc`, it installs a custom command for Claude:\n- **`.claude/commands/expert-consultation.md`** - Allows Claude to properly use the expert command with cost approval\n\nThis command helps Claude:\n1. Check available presets and select appropriate context\n2. Handle cost approval properly (never auto-approving expensive operations)\n3. Use the correct model based on your request (o3 vs o3-pro)\n4. Parse and present results effectively\n\nTo use it in Claude, simply ask: \"Consult an expert about [your question]\"\n\n## Configuration\n\nAPI keys must be set via environment variables:\n```bash\nexport OPENAI_API_KEY=sk-...\nexport ANTHROPIC_API_KEY=sk-ant-...\nexport GOOGLE_API_KEY=... # or GEMINI_API_KEY\nexport XAI_API_KEY=... # or GROK_API_KEY\n```\n\n<details>\n<summary>⚠️ Troubleshooting</summary>\n\n• **Command not found** – The CLI auto-installs to `~/.local/bin`. Ensure it's in PATH \n• **Missing API key** – Set via environment variable as shown above \n• **Context too large** – Use more specific file patterns or create focused presets\n• **Preset not found** – Check `.promptcode/presets/` directory exists\n</details>\n<!-- PROMPTCODE-CLI-END -->",
1010
"expert-consultation.md": "---\nallowed-tools: Bash(promptcode expert:*), Bash(promptcode preset:*), Bash(open -a Cursor:*), Read(/tmp/expert-*:*)\ndescription: Consult OpenAI o3/o3-pro expert for complex problems with code context\n---\nConsult an expert about: $ARGUMENTS\n\nInstructions:\n1. Analyze the request in $ARGUMENTS to understand:\n - The main question/problem\n - Whether code context would help\n\n2. If code context would be helpful:\n ```bash\n promptcode preset list # See available presets\n ```\n \n Choose relevant preset(s) or create specific file patterns.\n\n3. Ask the expert with appropriate context:\n ```bash\n # With preset:\n promptcode expert \"YOUR_CLEAR_QUESTION\" --preset <preset-name> --model <model>\n \n # With specific files:\n promptcode expert \"YOUR_CLEAR_QUESTION\" -f \"src/**/*.ts\" --model <model>\n \n # Without context (general question):\n promptcode expert \"YOUR_CLEAR_QUESTION\" --model <model>\n ```\n \n The CLI will show estimated cost and ask for confirmation if:\n - Cost exceeds $0.50\n - Using a \"pro\" model\n \n IMPORTANT: If you see \"Non-interactive environment detected\":\n - DO NOT automatically add --yes or --no-confirm\n - STOP and inform the user about the cost\n - Ask: \"This will cost approximately $X.XX. Do you want to proceed?\"\n - Only proceed with --yes after user explicitly approves\n \n Note: --no-confirm is an auto-accept mode for users who want to bypass\n all confirmations. AI agents should use --yes after explicit approval.\n \n Model options:\n - `o3` - Standard O3 model ($2/$8 per million tokens)\n - `o3-pro` - O3 Pro for complex tasks ($20/$80 per million tokens)\n - If question mentions \"o3-pro\" or \"o3 pro\", use `--model o3-pro`\n - Otherwise default to `--model o3`\n\n4. If output file was specified, open it:\n ```bash\n promptcode expert \"...\" --output response.md\n open -a Cursor response.md # or read the file\n ```\n\n5. Parse the response:\n - If successful: Summarize key insights\n - If API key missing: Tell user to set environment variable:\n ```bash\n export OPENAI_API_KEY=sk-...\n # Or for other providers:\n export ANTHROPIC_API_KEY=sk-ant-...\n export GOOGLE_API_KEY=...\n export XAI_API_KEY=...\n ```\n - For other errors: Report exact error message\n\nIMPORTANT: \n- Always include relevant code context when asking about specific functionality\n- Be clear and specific in your questions\n- Choose o3-pro only for genuinely complex tasks requiring deep reasoning"
1111
};
1212

packages/cli/src/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ Available Commands:
9494
$ promptcode expert "How to optimize this?" -p backend # Ask AI expert
9595
9696
Common Workflows:
97-
1. Zero-config usage:
98-
$ promptcode "What are the security risks?" # Analyze entire project
99-
$ promptcode "Review this code" file1.py file2.js # Specific files
97+
1. Explicit usage:
98+
$ promptcode expert "Why is this slow?" -f "src/**/*.ts"
99+
$ promptcode expert "Explain the auth flow" --preset auth
100+
$ promptcode generate -f "src/**/*.ts" -o prompt.md
100101
101102
2. Expert consultation:
102103
$ export OPENAI_API_KEY=sk-...

0 commit comments

Comments
 (0)