quacking 1.0.0 → 1.0.2
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 +125 -0
- package/dist/app.js +2 -2
- package/dist/app.js.map +1 -1
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# quack
|
|
2
|
+
|
|
3
|
+
**quack** is a simple **TypeScript**‑based command‑line application that uses Google's [Gemini](https://developers.google.com/ai) generative AI models to perform a quick, terminal‑friendly search. It wraps the official `@google/genai` SDK and provides a few convenience options for configuration and output formatting.
|
|
4
|
+
|
|
5
|
+
> 🦆 *"Gemini powered terminal search"* — that's the tagline for `quack`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- Save and reuse a Gemini API key via a local configuration store using [`conf`](https://www.npmjs.com/package/conf).
|
|
12
|
+
- Query Gemini from the terminal and get short, human‑readable answers.
|
|
13
|
+
- Optional `--long` flag for longer responses (configurable in code).
|
|
14
|
+
- Download size is tiny and the interface is intentionally minimal.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# clone the repository (or install from npm once published)
|
|
20
|
+
git clone https://github.com/yourusername/quack.git
|
|
21
|
+
cd quack
|
|
22
|
+
|
|
23
|
+
# install dependencies
|
|
24
|
+
npm install
|
|
25
|
+
|
|
26
|
+
# build the project (typescript -> javascript)
|
|
27
|
+
npm run build # you may want to add a build script pointing to tsc
|
|
28
|
+
|
|
29
|
+
# link globally so you can run `quack` from anywhere
|
|
30
|
+
npm link
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> ⚠️ The package currently targets Node 18+ and uses ES modules (`"type": "module"`).
|
|
34
|
+
|
|
35
|
+
Alternatively, if published to the npm registry, simply:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g quack
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Usage: quack [options] [query...]
|
|
45
|
+
|
|
46
|
+
Gemini powered terminal search.
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
-V, --version output the version number
|
|
50
|
+
-l, --long Get long answer.
|
|
51
|
+
-s, --see See current api key.
|
|
52
|
+
-c, --config <key> configure gemini apikey
|
|
53
|
+
-h, --help display help for command
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Examples
|
|
57
|
+
|
|
58
|
+
Save your API key:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
quack -c YOUR_GEMINI_KEY_HERE
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Check the saved key (it will be printed in blue):
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
quack --see
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Perform a search:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
quack what is the capital of France
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Ask for a longer answer:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
quack -l tell me in detail about the lifecycle of a butterfly
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
If no query is provided, `quack` prints the help text.
|
|
83
|
+
|
|
84
|
+
## Development
|
|
85
|
+
|
|
86
|
+
This project is written in TypeScript.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# run the TypeScript file directly
|
|
90
|
+
npx ts-node src/app.ts <your query>
|
|
91
|
+
|
|
92
|
+
# compile to dist/
|
|
93
|
+
npm run build
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Configuration is handled with [`conf`](https://www.npmjs.com/package/conf), which stores data in a platform‑appropriate location (under `%APPDATA%` on Windows).
|
|
97
|
+
|
|
98
|
+
## Publishing
|
|
99
|
+
|
|
100
|
+
To publish to npm, ensure the `package.json` fields like `name`, `version`, `description`, `author`, and `keywords` are filled out, then run:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npm publish
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Contributing
|
|
107
|
+
|
|
108
|
+
Contributions are welcome! Please open issues or pull requests on the GitHub repository.
|
|
109
|
+
|
|
110
|
+
1. Fork the repository
|
|
111
|
+
2. Create a feature branch (`git checkout -b feature/my-feature`)
|
|
112
|
+
3. Commit your changes
|
|
113
|
+
4. Open a pull request
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
This project is licensed under the ISC License – see the [LICENSE](LICENSE) file for details.
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
> 💡 *Feel free to adapt the code, add more options, or support additional Gemini parameters.*
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
*Happy quacking!* 🦆
|
package/dist/app.js
CHANGED
|
@@ -41,11 +41,11 @@ program
|
|
|
41
41
|
console.log(chalk.gray("Quacking..."));
|
|
42
42
|
try {
|
|
43
43
|
const result = await ai.models.generateContent({ model: "gemini-2.5-flash-lite",
|
|
44
|
-
contents: [{ role: 'user', parts: [{ text: `${query}
|
|
44
|
+
contents: [{ role: 'user', parts: [{ text: `${query} short and specific output under 200 output tokens` }] }],
|
|
45
45
|
config: {
|
|
46
46
|
// systemInstruction: "",
|
|
47
47
|
temperature: 0.5,
|
|
48
|
-
maxOutputTokens:
|
|
48
|
+
maxOutputTokens: 200,
|
|
49
49
|
// thinkingConfig: {
|
|
50
50
|
// thinkingLevel: options.long ? ThinkingLevel.HIGH : ThinkingLevel.MEDIUM
|
|
51
51
|
// }
|
package/dist/app.js.map
CHANGED
|
@@ -1 +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,eAA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