heyi 1.0.0 → 1.1.0
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/README.md +5 -1
- package/bin/index.js +17 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ heyi [prompt] [options]
|
|
|
23
23
|
- `-m, --model <model>` - AI model to use (default: `openai/gpt-4o-mini`)
|
|
24
24
|
- `-f, --format <format>` - Output format: `string`, `number`, `object`, `array` (default: `string`)
|
|
25
25
|
- `-s, --schema <schema>` - Zod schema for object/array format (required when format is `object` or `array`)
|
|
26
|
-
- `--file <path>` - Read content from file and include as context
|
|
26
|
+
- `--file <path>` - Read content from file and include as context (can be used multiple times)
|
|
27
27
|
- `-h, --help` - Display help information
|
|
28
28
|
- `-V, --version` - Display version number
|
|
29
29
|
|
|
@@ -62,6 +62,10 @@ API_KEY=your-key heyi "Hello, AI!"
|
|
|
62
62
|
# Input from file as context
|
|
63
63
|
heyi "Summarize this content" --file input.txt
|
|
64
64
|
|
|
65
|
+
# Input from multiple files as context
|
|
66
|
+
heyi "Compare these files" --file file1.txt --file file2.txt
|
|
67
|
+
heyi "Analyze all these documents" --file doc1.md --file doc2.md --file doc3.md
|
|
68
|
+
|
|
65
69
|
# Input from stdin
|
|
66
70
|
cat article.md | heyi "Extract all URLs mentioned"
|
|
67
71
|
echo "Analyze this text" | heyi
|
package/bin/index.js
CHANGED
|
@@ -25,6 +25,7 @@ Examples:
|
|
|
25
25
|
|
|
26
26
|
# Input from stdin or file
|
|
27
27
|
$ heyi "Summarize this content" --file input.txt
|
|
28
|
+
$ heyi "Compare these files" --file a.txt --file b.txt
|
|
28
29
|
$ cat prompt.txt | heyi
|
|
29
30
|
`
|
|
30
31
|
|
|
@@ -36,9 +37,12 @@ const action = async (prompt, options) => {
|
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
// Handle file content as context
|
|
39
|
-
|
|
40
|
+
const fileContents = []
|
|
40
41
|
if (options.file) {
|
|
41
|
-
|
|
42
|
+
for (const filePath of options.file) {
|
|
43
|
+
const content = await readFileContent(filePath)
|
|
44
|
+
fileContents.push({ path: filePath, content })
|
|
45
|
+
}
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
// Handle stdin input
|
|
@@ -54,8 +58,10 @@ const action = async (prompt, options) => {
|
|
|
54
58
|
|
|
55
59
|
// Build the final prompt
|
|
56
60
|
let finalPrompt = prompt ?? stdinContent
|
|
57
|
-
if (
|
|
58
|
-
|
|
61
|
+
if (fileContents.length > 0) {
|
|
62
|
+
const fileContexts = fileContents.map(({ path, content }) => `File: ${path}\n${content}`).join('\n\n---\n\n')
|
|
63
|
+
const contextLabel = fileContents.length === 1 ? 'Context from file:' : 'Context from files:'
|
|
64
|
+
finalPrompt = `${finalPrompt}\n\n${contextLabel}\n${fileContexts}`
|
|
59
65
|
}
|
|
60
66
|
|
|
61
67
|
const result = await executePrompt(finalPrompt, {
|
|
@@ -82,7 +88,13 @@ program
|
|
|
82
88
|
.option('-m, --model <model>', 'AI model to use', process.env.MODEL ?? DEFAULT_MODEL)
|
|
83
89
|
.option('-f, --format <format>', 'Output format: string, number, object, array', 'string')
|
|
84
90
|
.option('-s, --schema <schema>', 'Zod schema for object/array format (required when format is object or array)')
|
|
85
|
-
.option(
|
|
91
|
+
.option(
|
|
92
|
+
'--file <path>',
|
|
93
|
+
'Read content from file and include as context (can be used multiple times)',
|
|
94
|
+
(value, previous) => {
|
|
95
|
+
return previous ? [...previous, value] : [value]
|
|
96
|
+
},
|
|
97
|
+
)
|
|
86
98
|
.addHelpText('after', helpText)
|
|
87
99
|
.action(action)
|
|
88
100
|
.parse()
|