@fettstorch/clai 0.1.12 → 0.1.14
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 +7 -1
- package/dist/cli.js +26 -9
- package/dist/index.js +2 -2
- package/package.json +1 -1
- package/src/cli.ts +23 -6
- package/src/scraper.ts +2 -2
|
@@ -7,7 +7,13 @@
|
|
|
7
7
|
"Bash(clai:*)",
|
|
8
8
|
"Bash(cat:*)",
|
|
9
9
|
"Bash(grep:*)",
|
|
10
|
-
"Bash(./dist/cli.js --version)"
|
|
10
|
+
"Bash(./dist/cli.js --version)",
|
|
11
|
+
"Bash(npm update:*)",
|
|
12
|
+
"Bash(node:*)",
|
|
13
|
+
"Bash(bun:*)",
|
|
14
|
+
"Bash(timeout:*)",
|
|
15
|
+
"Bash(git add:*)",
|
|
16
|
+
"Bash(git commit:*)"
|
|
11
17
|
],
|
|
12
18
|
"deny": []
|
|
13
19
|
}
|
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.14";
|
|
54309
54309
|
var package_default = {
|
|
54310
54310
|
name: "@fettstorch/clai",
|
|
54311
54311
|
version,
|
|
@@ -68102,10 +68102,10 @@ async function getSearchResults(query) {
|
|
|
68102
68102
|
for (const engine of searchEngines) {
|
|
68103
68103
|
try {
|
|
68104
68104
|
const result = await engine.fn(query);
|
|
68105
|
-
console.log(`[${engine.name}]
|
|
68105
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(9989)}`);
|
|
68106
68106
|
return result;
|
|
68107
68107
|
} catch (_2) {
|
|
68108
|
-
console.log(`[${engine.name}]
|
|
68108
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(10060)}`);
|
|
68109
68109
|
}
|
|
68110
68110
|
}
|
|
68111
68111
|
console.log("All search engines failed - no URLs to scrape");
|
|
@@ -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(" ");
|
|
@@ -73441,12 +73441,28 @@ ${source_default.yellow.bold("\u2550\u2550\u2550 ")}${source_default.yellow.bold
|
|
|
73441
73441
|
return boldHandled;
|
|
73442
73442
|
}
|
|
73443
73443
|
async function analyzeInput(input, openAIKey) {
|
|
73444
|
-
const spinner = ora(
|
|
73444
|
+
const spinner = ora({
|
|
73445
|
+
text: "Thinking...",
|
|
73446
|
+
spinner: {
|
|
73447
|
+
frames: [
|
|
73448
|
+
String.fromCodePoint(10265),
|
|
73449
|
+
String.fromCodePoint(10297),
|
|
73450
|
+
String.fromCodePoint(10296),
|
|
73451
|
+
String.fromCodePoint(10278),
|
|
73452
|
+
String.fromCodePoint(10247),
|
|
73453
|
+
String.fromCodePoint(10255),
|
|
73454
|
+
String.fromCodePoint(10271),
|
|
73455
|
+
String.fromCodePoint(10303)
|
|
73456
|
+
],
|
|
73457
|
+
interval: 80
|
|
73458
|
+
}
|
|
73459
|
+
}).start();
|
|
73445
73460
|
try {
|
|
73446
73461
|
const result = await clai(input, openAIKey);
|
|
73447
|
-
spinner.
|
|
73462
|
+
spinner.stop();
|
|
73463
|
+
console.log(`${String.fromCodePoint(9989)} AHA!`);
|
|
73448
73464
|
console.log(source_default.green.bold(`
|
|
73449
|
-
|
|
73465
|
+
${String.fromCodePoint(128221)} \u2550\u2550\u2550 Summary \u2550\u2550\u2550 :`));
|
|
73450
73466
|
const formattedContent = formatMarkdownForTerminal(result.summary);
|
|
73451
73467
|
await animateText(formattedContent);
|
|
73452
73468
|
const { selectedLink } = await esm_default12.prompt([
|
|
@@ -73457,7 +73473,7 @@ async function analyzeInput(input, openAIKey) {
|
|
|
73457
73473
|
|
|
73458
73474
|
What now?:`,
|
|
73459
73475
|
choices: [
|
|
73460
|
-
{ name: source_default.yellow(
|
|
73476
|
+
{ name: source_default.yellow(`${String.fromCodePoint(128269)} New search`), value: "new" },
|
|
73461
73477
|
...result.links.map((link) => ({
|
|
73462
73478
|
name: `${source_default.bold(link.name)}: ${source_default.cyan(link.url)}`,
|
|
73463
73479
|
value: link.url
|
|
@@ -73480,7 +73496,8 @@ What now?:`,
|
|
|
73480
73496
|
await analyzeInput(selectedLink, openAIKey);
|
|
73481
73497
|
}
|
|
73482
73498
|
} catch (error) {
|
|
73483
|
-
spinner?.
|
|
73499
|
+
spinner?.stop();
|
|
73500
|
+
console.log(`${String.fromCodePoint(10060)} Analysis failed`);
|
|
73484
73501
|
console.error(source_default.red("Error:"), error);
|
|
73485
73502
|
}
|
|
73486
73503
|
}
|
package/dist/index.js
CHANGED
|
@@ -41019,10 +41019,10 @@ async function getSearchResults(query) {
|
|
|
41019
41019
|
for (const engine of searchEngines) {
|
|
41020
41020
|
try {
|
|
41021
41021
|
const result = await engine.fn(query);
|
|
41022
|
-
console.log(`[${engine.name}]
|
|
41022
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(9989)}`);
|
|
41023
41023
|
return result;
|
|
41024
41024
|
} catch (_) {
|
|
41025
|
-
console.log(`[${engine.name}]
|
|
41025
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(10060)}`);
|
|
41026
41026
|
}
|
|
41027
41027
|
}
|
|
41028
41028
|
console.log("All search engines failed - no URLs to scrape");
|
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
|
}
|
|
@@ -122,13 +122,29 @@ function formatMarkdownForTerminal(text: string): string {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
async function analyzeInput(input: string, openAIKey: string) {
|
|
125
|
-
const spinner = ora(
|
|
125
|
+
const spinner = ora({
|
|
126
|
+
text: "Thinking...",
|
|
127
|
+
spinner: {
|
|
128
|
+
frames: [
|
|
129
|
+
String.fromCodePoint(0x2819), // ⠙
|
|
130
|
+
String.fromCodePoint(0x2839), // ⠹
|
|
131
|
+
String.fromCodePoint(0x2838), // ⠸
|
|
132
|
+
String.fromCodePoint(0x2826), // ⠦
|
|
133
|
+
String.fromCodePoint(0x2807), // ⠧
|
|
134
|
+
String.fromCodePoint(0x280F), // ⠏
|
|
135
|
+
String.fromCodePoint(0x281F), // ⠟
|
|
136
|
+
String.fromCodePoint(0x283F), // ⠿
|
|
137
|
+
],
|
|
138
|
+
interval: 80
|
|
139
|
+
}
|
|
140
|
+
}).start();
|
|
126
141
|
|
|
127
142
|
try {
|
|
128
143
|
const result = await clai(input, openAIKey);
|
|
129
|
-
spinner.
|
|
144
|
+
spinner.stop();
|
|
145
|
+
console.log(`${String.fromCodePoint(0x2705)} AHA!`);
|
|
130
146
|
|
|
131
|
-
console.log(chalk.green.bold(
|
|
147
|
+
console.log(chalk.green.bold(`\n${String.fromCodePoint(0x1f4dd)} ═══ Summary ═══ :`));
|
|
132
148
|
const formattedContent = formatMarkdownForTerminal(result.summary);
|
|
133
149
|
await animateText(formattedContent);
|
|
134
150
|
|
|
@@ -139,7 +155,7 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
139
155
|
name: "selectedLink",
|
|
140
156
|
message: "\n\nWhat now?:",
|
|
141
157
|
choices: [
|
|
142
|
-
{ name: chalk.yellow(
|
|
158
|
+
{ name: chalk.yellow(`${String.fromCodePoint(0x1f50d)} New search`), value: "new" },
|
|
143
159
|
...result.links.map((link) => ({
|
|
144
160
|
name: `${chalk.bold(link.name)}: ${chalk.cyan(link.url)}`,
|
|
145
161
|
value: link.url,
|
|
@@ -163,7 +179,8 @@ async function analyzeInput(input: string, openAIKey: string) {
|
|
|
163
179
|
await analyzeInput(selectedLink, openAIKey);
|
|
164
180
|
}
|
|
165
181
|
} catch (error) {
|
|
166
|
-
spinner?.
|
|
182
|
+
spinner?.stop();
|
|
183
|
+
console.log(`${String.fromCodePoint(0x274c)} Analysis failed`);
|
|
167
184
|
console.error(chalk.red("Error:"), error);
|
|
168
185
|
}
|
|
169
186
|
}
|
package/src/scraper.ts
CHANGED
|
@@ -94,10 +94,10 @@ async function getSearchResults(query: string): Promise<string[]> {
|
|
|
94
94
|
for (const engine of searchEngines) {
|
|
95
95
|
try {
|
|
96
96
|
const result = await engine.fn(query);
|
|
97
|
-
console.log(`[${engine.name}]
|
|
97
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(0x2705)}`);
|
|
98
98
|
return result;
|
|
99
99
|
} catch (_) {
|
|
100
|
-
console.log(`[${engine.name}]
|
|
100
|
+
console.log(`[${engine.name}]::${String.fromCodePoint(0x274C)}`);
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|