Skip to content

Commit 74ba49d

Browse files
committed
chore: bump version to 0.4.1 and add prompt-file option
- Update version from 0.4.0 to 0.4.1 in package.json - Introduce --prompt-file option in CLI to read prompts from a file - Update embedded-templates timestamp to reflect recent build This release enhances the CLI functionality by allowing users to specify a prompt file, improving usability for AI consultations.
1 parent 457b360 commit 74ba49d

File tree

5 files changed

+30
-5
lines changed

5 files changed

+30
-5
lines changed

bun.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
},
3232
"packages/cli": {
3333
"name": "promptcode-cli",
34-
"version": "0.1.1",
34+
"version": "0.4.0",
3535
"bin": {
3636
"promptcode": "./dist/promptcode",
3737
},
@@ -1248,6 +1248,8 @@
12481248

12491249
"playwright/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
12501250

1251+
"promptcode-cli/@promptcode/core": ["@promptcode/core@file:packages/core", { "dependencies": { "@types/debug": "^4.1.12", "debug": "^4.4.1", "fast-glob": "^3.3.2", "gpt-tokenizer": "^2.1.2", "ignore": "^5.3.0", "lru-cache": "^11.1.0" }, "devDependencies": { "@types/node": "^20.0.0", "typescript": "^5.7.3" } }],
1252+
12511253
"rc/strip-json-comments": ["[email protected]", "", {}, "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ=="],
12521254

12531255
"read/mute-stream": ["[email protected]", "", {}, "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="],

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "promptcode-cli",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "CLI tool for PromptCode - Generate AI-ready prompts from codebases",
55
"bin": {
66
"promptcode": "./dist/promptcode"

packages/cli/src/commands/expert.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ interface ExpertOptions {
1919
path?: string;
2020
preset?: string;
2121
files?: string[];
22+
promptFile?: string;
2223
model?: string;
2324
output?: string;
2425
stream?: boolean;
@@ -95,17 +96,37 @@ export async function expertCommand(question: string | undefined, options: Exper
9596
return;
9697
}
9798

99+
// Read question from file if --prompt-file is provided
100+
let finalQuestion = question;
101+
if (options.promptFile) {
102+
const promptFilePath = path.resolve(options.promptFile);
103+
if (!fs.existsSync(promptFilePath)) {
104+
console.error(chalk.red(`❌ Prompt file not found: ${options.promptFile}`));
105+
process.exit(1);
106+
}
107+
try {
108+
finalQuestion = await fs.promises.readFile(promptFilePath, 'utf8');
109+
console.log(chalk.gray(`📄 Using prompt from: ${options.promptFile}`));
110+
} catch (error) {
111+
console.error(chalk.red(`❌ Error reading prompt file: ${(error as Error).message}`));
112+
process.exit(1);
113+
}
114+
}
115+
98116
// Require question for actual consultation
99-
if (!question) {
117+
if (!finalQuestion) {
100118
console.error(chalk.red('🙋 I need a question to ask the AI expert.\n'));
101119
console.error(chalk.yellow('Examples:'));
102120
console.error(chalk.gray(' promptcode "Why is this slow?" src/**/*.ts'));
103121
console.error(chalk.gray(' promptcode "Explain the auth flow" @backend/'));
104-
console.error(chalk.gray(' promptcode expert "What are the security risks?" --preset api\n'));
122+
console.error(chalk.gray(' promptcode expert "What are the security risks?" --preset api'));
123+
console.error(chalk.gray(' promptcode expert --prompt-file analysis.md --preset backend\n'));
105124
console.error(chalk.gray('To list available models: promptcode expert --models'));
106125
process.exit(1);
107126
}
108127

128+
question = finalQuestion;
129+
109130
// In Claude Code environment, provide additional guidance
110131
if (process.env.CLAUDE_PROJECT_DIR && !options.yes) {
111132
console.log(chalk.gray('💡 In Claude Code: AI agents will ask for approval before expensive operations'));

packages/cli/src/embedded-templates.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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:11:07.798Z
4+
* Generated at: 2025-08-10T09:52:54.704Z
55
*/
66

77
// Template contents embedded at build time

packages/cli/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,12 @@ Examples:
242242
$ promptcode expert "Explain the authentication flow" --preset auth
243243
$ promptcode expert "Find potential security issues" -f "src/api/**/*.ts"
244244
$ promptcode expert "Review this code" --model opus-4 --stream
245+
$ promptcode expert --prompt-file analysis.md # Use prompt from file
245246
$ promptcode expert --models # See all available models`)
246247
.option('--path <dir>', 'project root directory', process.cwd())
247248
.option('--preset <name>', 'use a preset for context')
248249
.option('-f, --files <patterns...>', 'file patterns to include')
250+
.option('--prompt-file <file>', 'read prompt/question from a file')
249251
.option('--model <model>', 'AI model to use (use --models to see available options)')
250252
.option('--models', 'List available AI models')
251253
.option('-o, --output <file>', 'save response to file')

0 commit comments

Comments
 (0)