quacking 1.0.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/LICENSE +21 -0
- package/dist/app.d.ts +3 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +65 -0
- package/dist/app.js.map +1 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vivek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":""}
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { GoogleGenAI, ThinkingLevel } from "@google/genai";
|
|
4
|
+
import Conf from 'conf';
|
|
5
|
+
import chalk from 'chalk';
|
|
6
|
+
const program = new Command();
|
|
7
|
+
const configs = new Conf({ projectName: "quack-search" });
|
|
8
|
+
program
|
|
9
|
+
.name("quack")
|
|
10
|
+
.description("Gemini powered terminal search.")
|
|
11
|
+
.version("0.1")
|
|
12
|
+
// Use angle brackets <query...> to capture the search text
|
|
13
|
+
.argument('[query...]', 'the search query')
|
|
14
|
+
.option("-l, --long", "Get long answer.")
|
|
15
|
+
.option("-s, --see", "See current api key.")
|
|
16
|
+
// FIX: added <key> to capture the string
|
|
17
|
+
.option("-c, --config <key>", "configure gemini apikey")
|
|
18
|
+
.action(async (queryArray, options) => {
|
|
19
|
+
// --- 1. SET CONFIG ---
|
|
20
|
+
if (options.config) {
|
|
21
|
+
configs.set('GEMINI_API_KEY', options.config);
|
|
22
|
+
console.log(chalk.green("API key has been saved."));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// --- 2. SEE CONFIG ---
|
|
26
|
+
if (options.see) {
|
|
27
|
+
// FIX: .store contains the actual key-value pairs
|
|
28
|
+
console.log(chalk.blue("Current GEMINI API KEY:"), configs.store.GEMINI_API_KEY);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// --- 3. SEARCH LOGIC ---
|
|
32
|
+
const savedKey = configs.get('GEMINI_API_KEY');
|
|
33
|
+
if (!savedKey) {
|
|
34
|
+
console.log(chalk.red("Error: No API key found."));
|
|
35
|
+
console.log("Run " + chalk.cyan("quack -c YOUR_KEY") + " first.");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (queryArray && queryArray.length > 0) {
|
|
39
|
+
const query = queryArray.join(' ');
|
|
40
|
+
const ai = new GoogleGenAI({ apiKey: savedKey });
|
|
41
|
+
console.log(chalk.gray("Quacking..."));
|
|
42
|
+
try {
|
|
43
|
+
const result = await ai.models.generateContent({ model: "gemini-2.5-flash-lite",
|
|
44
|
+
contents: [{ role: 'user', parts: [{ text: `${query}. short and specific output under 200 output tokens` }] }],
|
|
45
|
+
config: {
|
|
46
|
+
// systemInstruction: "",
|
|
47
|
+
temperature: 0.5,
|
|
48
|
+
maxOutputTokens: 400,
|
|
49
|
+
// thinkingConfig: {
|
|
50
|
+
// thinkingLevel: options.long ? ThinkingLevel.HIGH : ThinkingLevel.MEDIUM
|
|
51
|
+
// }
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
console.log("\n" + result.text);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
console.error(`Error ${err}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
program.help();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
program.parseAsync(process.argv);
|
|
65
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,OAAO,GAAG,IAAI,IAAI,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;AAE1D,OAAO;KACF,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,iCAAiC,CAAC;KAC9C,OAAO,CAAC,KAAK,CAAC;IACf,2DAA2D;KAC1D,QAAQ,CAAC,YAAY,EAAE,kBAAkB,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AG,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC;QAEvC,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,KAAK,EAAE,uBAAuB;gBAC3E,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,qDAAqD,EAAE,CAAC,EAAE,CAAC;gBAC9G,MAAM,EAAE;oBACJ,yBAAyB;oBACzB,WAAW,EAAE,GAAG;oBAChB,eAAe,EAAE,GAAG;oBACpB,qBAAqB;oBACrB,+EAA+E;oBAC/E,IAAI;iBACP;aACJ,CAAC,CAAC;YAEH,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,SAAU,GAAI,EAAE,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,IAAI,EAAE,CAAC;IACnB,CAAC;AACL,CAAC,CAAC,CAAC;AAEP,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "quacking",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A modern TypeScript CLI for Gemini AI",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/app.js",
|
|
7
|
+
"types": "./dist/app.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"quack": "./dist/app.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"dev": "node --loader ts-node/esm src/app.ts",
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"start": "node dist/app.js",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"cli",
|
|
22
|
+
"gemini",
|
|
23
|
+
"ai",
|
|
24
|
+
"google-generative-ai",
|
|
25
|
+
"cli-search",
|
|
26
|
+
"automation",
|
|
27
|
+
"developer-tools",
|
|
28
|
+
"terminal-ai",
|
|
29
|
+
"ai-agent",
|
|
30
|
+
"typescript"
|
|
31
|
+
],
|
|
32
|
+
"author": "",
|
|
33
|
+
"license": "ISC",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@google/genai": "^1.42.0",
|
|
36
|
+
"chalk": "^5.6.2",
|
|
37
|
+
"commander": "^14.0.3",
|
|
38
|
+
"conf": "^15.1.0"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@types/node": "^25.3.0",
|
|
42
|
+
"ts-node": "^10.9.2",
|
|
43
|
+
"typescript": "^5.9.3"
|
|
44
|
+
}
|
|
45
|
+
}
|