@fettstorch/clai 0.1.13 → 0.1.15
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/.claude/settings.local.json +3 -1
- package/dist/cli.js +23 -9
- package/package.json +1 -1
- package/src/cli.ts +19 -5
package/dist/cli.js
CHANGED
|
@@ -54305,7 +54305,7 @@ function ora(options) {
|
|
|
54305
54305
|
return new Ora(options);
|
|
54306
54306
|
}
|
|
54307
54307
|
// package.json
|
|
54308
|
-
var version = "0.1.
|
|
54308
|
+
var version = "0.1.15";
|
|
54309
54309
|
var package_default = {
|
|
54310
54310
|
name: "@fettstorch/clai",
|
|
54311
54311
|
version,
|
|
@@ -73376,7 +73376,7 @@ async function main2() {
|
|
|
73376
73376
|
program2.name("clai").description("AI-powered web scraping tool").version(package_default.version).argument("[input...]", "URL or search terms to analyze").action(async (inputs) => {
|
|
73377
73377
|
const openAIKey = process.env.OPENAI_API_KEY;
|
|
73378
73378
|
if (!openAIKey) {
|
|
73379
|
-
console.error(source_default.red(
|
|
73379
|
+
console.error(source_default.red(`${String.fromCodePoint(10060)} OPENAI_API_KEY environment variable is not set`));
|
|
73380
73380
|
process.exit(1);
|
|
73381
73381
|
}
|
|
73382
73382
|
let input = inputs?.join(" ");
|
|
@@ -73386,7 +73386,11 @@ async function main2() {
|
|
|
73386
73386
|
type: "input",
|
|
73387
73387
|
name: "input",
|
|
73388
73388
|
message: "Enter a URL or search query:",
|
|
73389
|
-
validate: (input2) => input2.length > 0
|
|
73389
|
+
validate: (input2) => input2.length > 0,
|
|
73390
|
+
prefix: String.fromCodePoint(63),
|
|
73391
|
+
theme: {
|
|
73392
|
+
prefix: String.fromCodePoint(63)
|
|
73393
|
+
}
|
|
73390
73394
|
}
|
|
73391
73395
|
]);
|
|
73392
73396
|
input = answers.input;
|
|
@@ -73459,9 +73463,10 @@ async function analyzeInput(input, openAIKey) {
|
|
|
73459
73463
|
}).start();
|
|
73460
73464
|
try {
|
|
73461
73465
|
const result = await clai(input, openAIKey);
|
|
73462
|
-
spinner.
|
|
73466
|
+
spinner.stop();
|
|
73467
|
+
console.log(`${String.fromCodePoint(9989)} AHA!`);
|
|
73463
73468
|
console.log(source_default.green.bold(`
|
|
73464
|
-
|
|
73469
|
+
${String.fromCodePoint(128221)} \u2550\u2550\u2550 Summary \u2550\u2550\u2550 :`));
|
|
73465
73470
|
const formattedContent = formatMarkdownForTerminal(result.summary);
|
|
73466
73471
|
await animateText(formattedContent);
|
|
73467
73472
|
const { selectedLink } = await esm_default12.prompt([
|
|
@@ -73472,13 +73477,17 @@ async function analyzeInput(input, openAIKey) {
|
|
|
73472
73477
|
|
|
73473
73478
|
What now?:`,
|
|
73474
73479
|
choices: [
|
|
73475
|
-
{ name: source_default.yellow(
|
|
73480
|
+
{ name: source_default.yellow(`${String.fromCodePoint(128269)} New search`), value: "new" },
|
|
73476
73481
|
...result.links.map((link) => ({
|
|
73477
73482
|
name: `${source_default.bold(link.name)}: ${source_default.cyan(link.url)}`,
|
|
73478
73483
|
value: link.url
|
|
73479
73484
|
})),
|
|
73480
73485
|
{ name: "Exit", value: "exit" }
|
|
73481
|
-
]
|
|
73486
|
+
],
|
|
73487
|
+
prefix: String.fromCodePoint(63),
|
|
73488
|
+
theme: {
|
|
73489
|
+
prefix: String.fromCodePoint(63)
|
|
73490
|
+
}
|
|
73482
73491
|
}
|
|
73483
73492
|
]);
|
|
73484
73493
|
if (selectedLink === "new") {
|
|
@@ -73487,7 +73496,11 @@ What now?:`,
|
|
|
73487
73496
|
type: "input",
|
|
73488
73497
|
name: "input",
|
|
73489
73498
|
message: "Enter a URL or search query:",
|
|
73490
|
-
validate: (input2) => input2.length > 0
|
|
73499
|
+
validate: (input2) => input2.length > 0,
|
|
73500
|
+
prefix: String.fromCodePoint(63),
|
|
73501
|
+
theme: {
|
|
73502
|
+
prefix: String.fromCodePoint(63)
|
|
73503
|
+
}
|
|
73491
73504
|
}
|
|
73492
73505
|
]);
|
|
73493
73506
|
await analyzeInput(newInput, openAIKey);
|
|
@@ -73495,7 +73508,8 @@ What now?:`,
|
|
|
73495
73508
|
await analyzeInput(selectedLink, openAIKey);
|
|
73496
73509
|
}
|
|
73497
73510
|
} catch (error) {
|
|
73498
|
-
spinner?.
|
|
73511
|
+
spinner?.stop();
|
|
73512
|
+
console.log(`${String.fromCodePoint(10060)} Analysis failed`);
|
|
73499
73513
|
console.error(source_default.red("Error:"), error);
|
|
73500
73514
|
}
|
|
73501
73515
|
}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -23,7 +23,7 @@ async function main() {
|
|
|
23
23
|
|
|
24
24
|
if (!openAIKey) {
|
|
25
25
|
console.error(
|
|
26
|
-
chalk.red(
|
|
26
|
+
chalk.red(`${String.fromCodePoint(0x274c)} OPENAI_API_KEY environment variable is not set`)
|
|
27
27
|
);
|
|
28
28
|
process.exit(1);
|
|
29
29
|
}
|
|
@@ -37,6 +37,10 @@ async function main() {
|
|
|
37
37
|
name: "input",
|
|
38
38
|
message: "Enter a URL or search query:",
|
|
39
39
|
validate: (input) => input.length > 0,
|
|
40
|
+
prefix: String.fromCodePoint(0x003F), // ?
|
|
41
|
+
theme: {
|
|
42
|
+
prefix: String.fromCodePoint(0x003F) // ?
|
|
43
|
+
}
|
|
40
44
|
},
|
|
41
45
|
]);
|
|
42
46
|
input = answers.input;
|
|
@@ -141,9 +145,10 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
141
145
|
|
|
142
146
|
try {
|
|
143
147
|
const result = await clai(input, openAIKey);
|
|
144
|
-
spinner.
|
|
148
|
+
spinner.stop();
|
|
149
|
+
console.log(`${String.fromCodePoint(0x2705)} AHA!`);
|
|
145
150
|
|
|
146
|
-
console.log(chalk.green.bold(
|
|
151
|
+
console.log(chalk.green.bold(`\n${String.fromCodePoint(0x1f4dd)} ═══ Summary ═══ :`));
|
|
147
152
|
const formattedContent = formatMarkdownForTerminal(result.summary);
|
|
148
153
|
await animateText(formattedContent);
|
|
149
154
|
|
|
@@ -154,13 +159,17 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
154
159
|
name: "selectedLink",
|
|
155
160
|
message: "\n\nWhat now?:",
|
|
156
161
|
choices: [
|
|
157
|
-
{ name: chalk.yellow(
|
|
162
|
+
{ name: chalk.yellow(`${String.fromCodePoint(0x1f50d)} New search`), value: "new" },
|
|
158
163
|
...result.links.map((link) => ({
|
|
159
164
|
name: `${chalk.bold(link.name)}: ${chalk.cyan(link.url)}`,
|
|
160
165
|
value: link.url,
|
|
161
166
|
})),
|
|
162
167
|
{ name: "Exit", value: "exit" },
|
|
163
168
|
],
|
|
169
|
+
prefix: String.fromCodePoint(0x003F), // ?
|
|
170
|
+
theme: {
|
|
171
|
+
prefix: String.fromCodePoint(0x003F) // ?
|
|
172
|
+
}
|
|
164
173
|
},
|
|
165
174
|
]);
|
|
166
175
|
|
|
@@ -171,6 +180,10 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
171
180
|
name: "input",
|
|
172
181
|
message: "Enter a URL or search query:",
|
|
173
182
|
validate: (input) => input.length > 0,
|
|
183
|
+
prefix: String.fromCodePoint(0x003F), // ?
|
|
184
|
+
theme: {
|
|
185
|
+
prefix: String.fromCodePoint(0x003F) // ?
|
|
186
|
+
}
|
|
174
187
|
},
|
|
175
188
|
]);
|
|
176
189
|
await analyzeInput(newInput, openAIKey);
|
|
@@ -178,7 +191,8 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
178
191
|
await analyzeInput(selectedLink, openAIKey);
|
|
179
192
|
}
|
|
180
193
|
} catch (error) {
|
|
181
|
-
spinner?.
|
|
194
|
+
spinner?.stop();
|
|
195
|
+
console.log(`${String.fromCodePoint(0x274c)} Analysis failed`);
|
|
182
196
|
console.error(chalk.red("Error:"), error);
|
|
183
197
|
}
|
|
184
198
|
}
|