@optima-chat/scout-cli 0.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 ADDED
@@ -0,0 +1,274 @@
1
+ # Optima Scout CLI
2
+
3
+ Command-line interface for Optima Scout - AI-powered Amazon product research tool.
4
+
5
+ **Designed for LLM consumption** - optimized for Claude Code and other AI assistants.
6
+
7
+ ## Features
8
+
9
+ - **JSON Output**: Default structured JSON output for easy LLM parsing
10
+ - **Non-Interactive**: No spinners, prompts, or colored output by default
11
+ - **Simple Text Mode**: Optional plain text format for human readability
12
+ - **Fast**: Leverages backend caching for quick responses
13
+
14
+ ## Prerequisites
15
+
16
+ - Node.js >= 20.0.0
17
+ - Optima Scout API running (default: `http://localhost:3000`)
18
+
19
+ ## Installation
20
+
21
+ ### From Source
22
+
23
+ ```bash
24
+ # Install dependencies
25
+ npm install
26
+
27
+ # Run in development mode
28
+ npm run dev <command>
29
+
30
+ # Or build and use globally
31
+ npm run build
32
+ npm link
33
+ scout <command>
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ ### Initialize Claude Code Skills
39
+
40
+ Initialize Optima Scout Skills in your project for Claude Code integration:
41
+
42
+ ```bash
43
+ scout init
44
+ ```
45
+
46
+ This creates `.claude/skills/` directory with `search.json` and `product.json` configurations.
47
+
48
+ **Options:**
49
+ - `-f, --force` - Overwrite existing skills
50
+
51
+ **Example:**
52
+ ```bash
53
+ # First time setup
54
+ cd your-project
55
+ scout init
56
+
57
+ # Update skills configuration
58
+ scout init --force
59
+ ```
60
+
61
+ After initialization, you can use Optima Scout in Claude Code:
62
+ ```
63
+ 帮我搜索一下 "wireless mouse"
64
+ ```
65
+
66
+ ---
67
+
68
+ ### Search Products
69
+
70
+ Search for products on Amazon with JSON output (default):
71
+
72
+ ```bash
73
+ scout search "coffee maker"
74
+ ```
75
+
76
+ **Output (JSON)**:
77
+ ```json
78
+ {
79
+ "results": [
80
+ {
81
+ "position": 1,
82
+ "title": "BLACK+DECKER 12-Cup Digital Coffee Maker...",
83
+ "asin": "B01GJOMWVA",
84
+ "price": { "value": 40.99, "currency": "USD" },
85
+ "rating": 4.4,
86
+ "ratings_total": 46754,
87
+ "recent_sales": "10K+ bought in past month"
88
+ }
89
+ ],
90
+ "metadata": {
91
+ "total_results": 48,
92
+ "shown_results": 10,
93
+ "cached": false,
94
+ "credits_remaining": 89
95
+ }
96
+ }
97
+ ```
98
+
99
+ **Options:**
100
+ - `-d, --domain <domain>` - Amazon domain (default: `amazon.com`)
101
+ - `-l, --limit <number>` - Limit results (default: `10`)
102
+ - `-f, --format <format>` - Output format: `json` (default) or `text`
103
+
104
+ **Examples:**
105
+
106
+ ```bash
107
+ # JSON output (default) - for LLMs
108
+ scout search "coffee maker" --limit 5
109
+
110
+ # Text output - for humans
111
+ scout search "coffee maker" --limit 5 --format text
112
+ ```
113
+
114
+ **Text Output**:
115
+ ```
116
+ B01GJOMWVA BLACK+DECKER 12-Cup Digital Coffee Maker... 40.99 4.4 46754 10K+ bought in past month
117
+ B0C8B9V7HR BLACK+DECKER 12-Cup Coffee Maker... 28.67 4.3 18851 20K+ bought in past month
118
+ ```
119
+
120
+ ### Get Product Details
121
+
122
+ Get detailed information about a specific product (JSON by default):
123
+
124
+ ```bash
125
+ scout product B01GJOMWVA
126
+ ```
127
+
128
+ **Output (JSON)**:
129
+ ```json
130
+ {
131
+ "product": {
132
+ "asin": "B01GJOMWVA",
133
+ "title": "BLACK+DECKER 12-Cup Digital Coffee Maker...",
134
+ "brand": "BLACK+DECKER",
135
+ "buybox_winner": {
136
+ "price": { "value": 40.99, "currency": "USD" },
137
+ "new_offers_count": 2
138
+ },
139
+ "recent_sales": "10K+ bought in past month",
140
+ "rating": 4.4,
141
+ "ratings_total": 46754,
142
+ "rating_breakdown": {
143
+ "five_star": { "percentage": 70, "count": 32727 },
144
+ "one_star": { "percentage": 7, "count": 3272 }
145
+ },
146
+ "top_reviews": [ /* array of reviews */ ],
147
+ "specifications": [ /* array of specs including BSR */ ]
148
+ },
149
+ "metadata": {
150
+ "cached": true,
151
+ "credits_remaining": 90
152
+ }
153
+ }
154
+ ```
155
+
156
+ **Options:**
157
+ - `-d, --domain <domain>` - Amazon domain (default: `amazon.com`)
158
+ - `-f, --format <format>` - Output format: `json` (default) or `text`
159
+
160
+ **Text Output**:
161
+ ```
162
+ ASIN: B01GJOMWVA
163
+ Title: BLACK+DECKER 12-Cup Digital Coffee Maker...
164
+ Brand: BLACK+DECKER
165
+ Price: $40.99
166
+ Sellers: 2
167
+ Recent Sales: 10K+ bought in past month
168
+ Rating: 4.4
169
+ Reviews: 46754
170
+ BSR: #530 in Home & Kitchen #2 in Coffee Machines
171
+ ```
172
+
173
+ ## Configuration
174
+
175
+ Create a `.env` file:
176
+
177
+ ```bash
178
+ cp .env.example .env
179
+ ```
180
+
181
+ Edit `.env`:
182
+
183
+ ```env
184
+ API_URL=http://localhost:3000
185
+ ```
186
+
187
+ ## LLM Integration
188
+
189
+ This CLI is designed for Claude Code and other LLM tools:
190
+
191
+ ### Key Features for LLMs
192
+
193
+ 1. **Structured JSON Output**: All data returned in parseable JSON by default
194
+ 2. **No Interactive Elements**: No spinners, colors, or prompts
195
+ 3. **Complete Data**: Full product information in single response
196
+ 4. **Error Handling**: Errors also returned as JSON
197
+
198
+ ### Example LLM Usage
199
+
200
+ ```typescript
201
+ // Claude Code can call:
202
+ const result = await exec('scout search "coffee maker" --limit 5');
203
+ const data = JSON.parse(result);
204
+
205
+ // Access structured data
206
+ data.results.forEach(product => {
207
+ console.log(product.asin, product.title, product.recent_sales);
208
+ });
209
+ ```
210
+
211
+ ## Development
212
+
213
+ ### Project Structure
214
+
215
+ ```
216
+ cli/
217
+ ├── src/
218
+ │ ├── commands/ # CLI commands
219
+ │ │ ├── search.ts # Search command
220
+ │ │ └── product.ts # Product command
221
+ │ ├── types/ # TypeScript types
222
+ │ │ └── api.ts # API response types
223
+ │ ├── utils/ # Utilities
224
+ │ │ ├── api.ts # API client
225
+ │ │ └── config.ts # Configuration
226
+ │ └── index.ts # Entry point
227
+ ├── package.json
228
+ └── tsconfig.json
229
+ ```
230
+
231
+ ### Scripts
232
+
233
+ ```bash
234
+ # Development mode
235
+ npm run dev <command>
236
+
237
+ # Build TypeScript
238
+ npm run build
239
+
240
+ # Type checking
241
+ npm run type-check
242
+
243
+ # Lint code
244
+ npm run lint
245
+ ```
246
+
247
+ ## Output Formats
248
+
249
+ ### JSON Format (Default)
250
+
251
+ - **Purpose**: LLM consumption
252
+ - **Benefits**:
253
+ - Easy to parse programmatically
254
+ - Complete data structure
255
+ - No formatting noise
256
+ - Metadata included (caching, credits)
257
+
258
+ ### Text Format
259
+
260
+ - **Purpose**: Human readability
261
+ - **Benefits**:
262
+ - Quick visual scanning
263
+ - Tab-separated values (easy to parse)
264
+ - Minimal but informative
265
+
266
+ ## Tech Stack
267
+
268
+ - **Commander.js** - CLI framework
269
+ - **TypeScript** - Type safety
270
+ - **Minimal Dependencies** - Only essential packages
271
+
272
+ ## License
273
+
274
+ MIT
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const initCommand: Command;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuEpC,eAAO,MAAM,WAAW,SAsDpB,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { Command } from 'commander';
2
+ import { mkdir, writeFile, access } from 'fs/promises';
3
+ import { join } from 'path';
4
+ /**
5
+ * Skills templates for Claude Code
6
+ */
7
+ const SKILLS_TEMPLATES = {
8
+ 'search.json': {
9
+ name: 'search',
10
+ description: 'Search for products on Amazon. Returns structured JSON data with product information including ASIN, title, price, rating, reviews, and recent sales data.',
11
+ command: 'scout search {{query}} --limit {{limit}}',
12
+ parameters: {
13
+ query: {
14
+ type: 'string',
15
+ description: 'Search query (e.g., \'coffee maker\', \'laptop stand\')',
16
+ required: true,
17
+ },
18
+ limit: {
19
+ type: 'number',
20
+ description: 'Maximum number of results to return (default: 10)',
21
+ required: false,
22
+ default: 10,
23
+ },
24
+ },
25
+ output: {
26
+ type: 'json',
27
+ description: 'Returns JSON with results array containing product data and metadata with total results, caching status, and remaining API credits',
28
+ },
29
+ examples: [
30
+ {
31
+ description: 'Search for coffee makers',
32
+ query: 'coffee maker',
33
+ limit: 5,
34
+ },
35
+ {
36
+ description: 'Search for wireless keyboards',
37
+ query: 'wireless keyboard',
38
+ limit: 10,
39
+ },
40
+ ],
41
+ },
42
+ 'product.json': {
43
+ name: 'product',
44
+ description: 'Get detailed information about a specific Amazon product by ASIN. Returns comprehensive product data including pricing, sales metrics, ratings breakdown, reviews, specifications, BSR, and listing quality indicators.',
45
+ command: 'scout product {{asin}}',
46
+ parameters: {
47
+ asin: {
48
+ type: 'string',
49
+ description: 'Amazon ASIN (10-character product identifier, e.g., \'B01GJOMWVA\')',
50
+ required: true,
51
+ pattern: '^[A-Z0-9]{10}$',
52
+ },
53
+ },
54
+ output: {
55
+ type: 'json',
56
+ description: 'Returns JSON with complete product object containing all product details and metadata with caching status and remaining API credits',
57
+ },
58
+ examples: [
59
+ {
60
+ description: 'Get details for a coffee maker',
61
+ asin: 'B01GJOMWVA',
62
+ },
63
+ {
64
+ description: 'Analyze a specific product',
65
+ asin: 'B0788F3R8X',
66
+ },
67
+ ],
68
+ },
69
+ };
70
+ export const initCommand = new Command('init')
71
+ .description('Initialize Claude Code Skills in current directory')
72
+ .option('-f, --force', 'Overwrite existing skills', false)
73
+ .action(async (options) => {
74
+ try {
75
+ const skillsDir = join(process.cwd(), '.claude', 'skills');
76
+ // Check if .claude/skills already exists
77
+ let exists = false;
78
+ try {
79
+ await access(skillsDir);
80
+ exists = true;
81
+ }
82
+ catch {
83
+ // Directory doesn't exist, which is fine
84
+ }
85
+ if (exists && !options.force) {
86
+ console.log('✅ Claude Code Skills already configured in this directory.');
87
+ console.log('\n📁 Skills directory:', skillsDir);
88
+ console.log('\n💡 Use --force to overwrite existing skills.');
89
+ return;
90
+ }
91
+ // Create .claude/skills directory
92
+ await mkdir(skillsDir, { recursive: true });
93
+ // Write skills files
94
+ const createdFiles = [];
95
+ for (const [filename, content] of Object.entries(SKILLS_TEMPLATES)) {
96
+ const filepath = join(skillsDir, filename);
97
+ await writeFile(filepath, JSON.stringify(content, null, 2) + '\n');
98
+ createdFiles.push(filename);
99
+ }
100
+ // Success message
101
+ console.log('✅ Optima Scout Skills initialized successfully!\n');
102
+ console.log('📁 Skills directory:', skillsDir);
103
+ console.log('📄 Created files:');
104
+ createdFiles.forEach((file) => {
105
+ console.log(` - ${file}`);
106
+ });
107
+ console.log('\n🎯 Next steps:');
108
+ console.log(' 1. Make sure Optima Scout Backend is running:');
109
+ console.log(' cd /path/to/optima-scout && docker compose up -d');
110
+ console.log(' 2. Open this project in Claude Code');
111
+ console.log(' 3. Ask Claude to search products:');
112
+ console.log(' "帮我搜索一下 wireless mouse"');
113
+ console.log('\n📚 Learn more: https://github.com/Optima-Chat/optima-scout');
114
+ }
115
+ catch (error) {
116
+ console.error('❌ Error:', error instanceof Error ? error.message : String(error));
117
+ process.exit(1);
118
+ }
119
+ });
120
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACvB,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,4JAA4J;QACzK,OAAO,EAAE,0CAA0C;QACnD,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,I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EAAE;YAC5B,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;QACtD,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAE7C,OAAO,CAAC,GAAG,CAAC,8DAA8D,CAAC,CAAC;IAC9E,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const productCommand: Command;
3
+ //# sourceMappingURL=product.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/commands/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,cAAc,SA+DvB,CAAC"}
@@ -0,0 +1,65 @@
1
+ import { Command } from 'commander';
2
+ import { api } from '../utils/api.js';
3
+ export const productCommand = new Command('product')
4
+ .description('Get detailed product information')
5
+ .argument('<asin>', 'Product ASIN')
6
+ .option('-d, --domain <domain>', 'Amazon domain', 'amazon.com')
7
+ .option('-f, --format <format>', 'Output format (json|text)', 'json')
8
+ .action(async (asin, options) => {
9
+ try {
10
+ const response = await api.getProduct(asin, options.domain);
11
+ const { product } = response.data;
12
+ if (!product) {
13
+ if (options.format === 'json') {
14
+ console.log(JSON.stringify({ error: 'Product not found' }));
15
+ }
16
+ else {
17
+ console.log('Product not found');
18
+ }
19
+ process.exit(1);
20
+ }
21
+ if (options.format === 'json') {
22
+ // JSON output for LLM - complete product data
23
+ console.log(JSON.stringify({
24
+ product,
25
+ metadata: {
26
+ cached: response.cached,
27
+ credits_remaining: response.data.request_info.credits_remaining,
28
+ },
29
+ }, null, 2));
30
+ }
31
+ else {
32
+ // Simple text output - key information only
33
+ console.log(`ASIN: ${product.asin}`);
34
+ console.log(`Title: ${product.title}`);
35
+ if (product.brand)
36
+ console.log(`Brand: ${product.brand}`);
37
+ if (product.buybox_winner) {
38
+ console.log(`Price: $${product.buybox_winner.price.value}`);
39
+ console.log(`Sellers: ${product.buybox_winner.new_offers_count}`);
40
+ }
41
+ if (product.recent_sales)
42
+ console.log(`Recent Sales: ${product.recent_sales}`);
43
+ if (product.rating)
44
+ console.log(`Rating: ${product.rating}`);
45
+ if (product.ratings_total)
46
+ console.log(`Reviews: ${product.ratings_total}`);
47
+ // BSR
48
+ const bsr = product.specifications?.find((spec) => spec.name === 'Best Sellers Rank');
49
+ if (bsr)
50
+ console.log(`BSR: ${bsr.value}`);
51
+ }
52
+ }
53
+ catch (error) {
54
+ if (options.format === 'json') {
55
+ console.error(JSON.stringify({
56
+ error: error instanceof Error ? error.message : String(error),
57
+ }));
58
+ }
59
+ else {
60
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
61
+ }
62
+ process.exit(1);
63
+ }
64
+ });
65
+ //# sourceMappingURL=product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product.js","sourceRoot":"","sources":["../../src/commands/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,CAA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C,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare const searchCommand: Command;
3
+ //# sourceMappingURL=search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,eAAO,MAAM,aAAa,SA2DtB,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { Command } from 'commander';
2
+ import { api } from '../utils/api.js';
3
+ export const searchCommand = new Command('search')
4
+ .description('Search for products on Amazon')
5
+ .argument('<query>', 'Search query')
6
+ .option('-d, --domain <domain>', 'Amazon domain', 'amazon.com')
7
+ .option('-l, --limit <number>', 'Limit number of results', '10')
8
+ .option('-f, --format <format>', 'Output format (json|text)', 'json')
9
+ .action(async (query, options) => {
10
+ try {
11
+ const response = await api.search(query, options.domain);
12
+ const results = response.data.search_results;
13
+ if (!results || results.length === 0) {
14
+ if (options.format === 'json') {
15
+ console.log(JSON.stringify({ results: [], metadata: response.data.request_info }));
16
+ }
17
+ else {
18
+ console.log('No results found');
19
+ }
20
+ return;
21
+ }
22
+ // Limit results
23
+ const limit = parseInt(options.limit, 10);
24
+ const limitedResults = results.slice(0, limit);
25
+ if (options.format === 'json') {
26
+ // JSON output for LLM
27
+ console.log(JSON.stringify({
28
+ results: limitedResults,
29
+ metadata: {
30
+ total_results: results.length,
31
+ shown_results: limitedResults.length,
32
+ cached: response.cached,
33
+ credits_remaining: response.data.request_info.credits_remaining,
34
+ },
35
+ }, null, 2));
36
+ }
37
+ else {
38
+ // Simple text output
39
+ limitedResults.forEach((result) => {
40
+ console.log(`${result.asin}\t${result.title}\t${result.price?.value || 'N/A'}\t${result.rating || 'N/A'}\t${result.ratings_total || 'N/A'}\t${result.recent_sales || 'N/A'}`);
41
+ });
42
+ }
43
+ }
44
+ catch (error) {
45
+ if (options.format === 'json') {
46
+ console.error(JSON.stringify({
47
+ error: error instanceof Error ? error.message : String(error),
48
+ }));
49
+ }
50
+ else {
51
+ console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
52
+ }
53
+ process.exit(1);
54
+ }
55
+ });
56
+ //# sourceMappingURL=search.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/commands/search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC;KAC/C,WAAW,CAAC,+BAA+B,CAAC;KAC5C,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;KACnC,MAAM,CAAC,uBAAuB,EAAE,eAAe,EAAE,YAAY,CAAC;KAC9D,MAAM,CAAC,sBAAsB,EAAE,yBAAyB,EAAE,IAAI,CAAC;KAC/D,MAAM,CAAC,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,CAAC;KACpE,MAAM,CAAC,KAAK,EAAE,KAAa,EAAE,OAA0D,EAAE,EAAE;IAC1F,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC;QAE7C,IAAI,CAAC,OAA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KAAK,MAAM,CAAC,YAAY,IAAI,KAAK,EAAE,CAAC,CAAC;YAChL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;YAC9B,OAAO,CAAC,KAAK,CACX,IAAI,CAAC,SAAS,CAAC;gBACb,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import { searchCommand } from './commands/search.js';
4
+ import { productCommand } from './commands/product.js';
5
+ import { initCommand } from './commands/init.js';
6
+ const program = new Command();
7
+ program
8
+ .name('scout')
9
+ .description('Optima Scout - AI-powered Amazon product research tool')
10
+ .version('0.1.0');
11
+ // Register commands
12
+ program.addCommand(initCommand);
13
+ program.addCommand(searchCommand);
14
+ program.addCommand(productCommand);
15
+ // Parse arguments
16
+ program.parse();
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,OAAO,CAAC;KACb,WAAW,CAAC,wDAAwD,CAAC;KACrE,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,oBAAoB;AACpB,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;AAChC,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;AAClC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAEnC,kBAAkB;AAClB,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,133 @@
1
+ /**
2
+ * API Response Types
3
+ */
4
+ export interface ApiResponse<T> {
5
+ data: T;
6
+ cached: boolean;
7
+ }
8
+ export interface SearchResponse {
9
+ request_info: {
10
+ success: boolean;
11
+ credits_used: number;
12
+ credits_remaining: number;
13
+ };
14
+ search_results: SearchResult[];
15
+ pagination?: {
16
+ total_results: number;
17
+ current_page: number;
18
+ total_pages: number;
19
+ };
20
+ }
21
+ export interface SearchResult {
22
+ position: number;
23
+ asin: string;
24
+ title: string;
25
+ link: string;
26
+ recent_sales?: string;
27
+ price?: {
28
+ value: number;
29
+ currency: string;
30
+ raw: string;
31
+ };
32
+ rating?: number;
33
+ ratings_total?: number;
34
+ image?: string;
35
+ }
36
+ export interface ProductResponse {
37
+ request_info: {
38
+ success: boolean;
39
+ credits_used: number;
40
+ credits_remaining: number;
41
+ };
42
+ product: Product;
43
+ }
44
+ export interface Product {
45
+ asin: string;
46
+ title: string;
47
+ link: string;
48
+ brand?: string;
49
+ recent_sales?: string;
50
+ buybox_winner?: {
51
+ price: {
52
+ value: number;
53
+ currency: string;
54
+ raw: string;
55
+ };
56
+ new_offers_count: number;
57
+ is_prime?: boolean;
58
+ availability?: {
59
+ raw: string;
60
+ };
61
+ fulfillment?: {
62
+ type: string;
63
+ is_sold_by_amazon: boolean;
64
+ is_fulfilled_by_amazon: boolean;
65
+ is_sold_by_third_party: boolean;
66
+ is_fulfilled_by_third_party: boolean;
67
+ };
68
+ };
69
+ rating?: number;
70
+ ratings_total?: number;
71
+ rating_breakdown?: {
72
+ five_star: {
73
+ percentage: number;
74
+ count: number;
75
+ };
76
+ four_star: {
77
+ percentage: number;
78
+ count: number;
79
+ };
80
+ three_star: {
81
+ percentage: number;
82
+ count: number;
83
+ };
84
+ two_star: {
85
+ percentage: number;
86
+ count: number;
87
+ };
88
+ one_star: {
89
+ percentage: number;
90
+ count: number;
91
+ };
92
+ };
93
+ top_reviews?: Review[];
94
+ images?: Array<{
95
+ link: string;
96
+ }>;
97
+ videos?: Array<{
98
+ link: string;
99
+ }>;
100
+ feature_bullets?: string[];
101
+ description?: string;
102
+ categories?: Array<{
103
+ name: string;
104
+ link: string;
105
+ category_id: string;
106
+ }>;
107
+ specifications?: Array<{
108
+ name: string;
109
+ value: string;
110
+ }>;
111
+ first_available?: {
112
+ raw: string;
113
+ utc: string;
114
+ };
115
+ variants?: Array<{
116
+ asin: string;
117
+ title: string;
118
+ is_current_product: boolean;
119
+ }>;
120
+ }
121
+ export interface Review {
122
+ id: string;
123
+ title: string;
124
+ body: string;
125
+ rating: number;
126
+ date: {
127
+ raw: string;
128
+ utc: string;
129
+ };
130
+ verified_purchase: boolean;
131
+ helpful_votes?: number;
132
+ }
133
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC;IACR,MA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AU,CAAC,EAAE,KAAK,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;IACH,cAAc,CAAC,EAAE,KAAK,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC,CAAC;IAGH,eAAe,CAAC,EAAE;QAChB,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,kBAAkB,EAAE,OAAO,CAAC;KAC7B,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * API Response Types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/types/api.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,26 @@
1
+ import type { ApiResponse, SearchResponse, ProductResponse } from '../types/api.js';
2
+ /**
3
+ * API Client for Optima Scout Backend
4
+ */
5
+ export declare class ApiClient {
6
+ private baseUrl;
7
+ constructor(baseUrl?: string);
8
+ /**
9
+ * Search for products
10
+ */
11
+ search(query: string, domain?: string): Promise<ApiResponse<SearchResponse>>;
12
+ /**
13
+ * Get product details by ASIN
14
+ */
15
+ getProduct(asin: string, domain?: string): Promise<ApiResponse<ProductResponse>>;
16
+ /**
17
+ * Health check
18
+ */
19
+ health(): Promise<{
20
+ status: string;
21
+ timestamp: string;
22
+ environment: string;
23
+ }>;
24
+ }
25
+ export declare const api: ApiClient;
26
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpF;;GAEG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,GAAE,MAAsB;IAI3C;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,SAAe,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAcxF;;OAEG;IACG,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,SAAe,GAAG,OAAO,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAa5F;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC;CASpF;AAGD,eAAO,MAAM,GAAG,WAAkB,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { CONFIG } from './config.js';
2
+ /**
3
+ * API Client for Optima Scout Backend
4
+ */
5
+ export class ApiClient {
6
+ baseUrl;
7
+ constructor(baseUrl = CONFIG.apiUrl) {
8
+ this.baseUrl = baseUrl;
9
+ }
10
+ /**
11
+ * Search for products
12
+ */
13
+ async search(query, domain = 'amazon.com') {
14
+ const url = new URL(`${this.baseUrl}/api/products/search`);
15
+ url.searchParams.append('q', query);
16
+ url.searchParams.append('domain', domain);
17
+ const response = await fetch(url.toString());
18
+ if (!response.ok) {
19
+ throw new Error(`API error: ${response.status} ${response.statusText}`);
20
+ }
21
+ return response.json();
22
+ }
23
+ /**
24
+ * Get product details by ASIN
25
+ */
26
+ async getProduct(asin, domain = 'amazon.com') {
27
+ const url = new URL(`${this.baseUrl}/api/products/${asin}`);
28
+ url.searchParams.append('domain', domain);
29
+ const response = await fetch(url.toString());
30
+ if (!response.ok) {
31
+ throw new Error(`API error: ${response.status} ${response.statusText}`);
32
+ }
33
+ return response.json();
34
+ }
35
+ /**
36
+ * Health check
37
+ */
38
+ async health() {
39
+ const response = await fetch(`${this.baseUrl}/health`);
40
+ if (!response.ok) {
41
+ throw new Error(`Health check failed: ${response.status}`);
42
+ }
43
+ return response.json();
44
+ }
45
+ }
46
+ // Default instance
47
+ export const api = new ApiClient();
48
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC;;GAEG;AACH,MAAM,OAAO,SAAS;IACZ,OAAO,CAAS;IAExB,YAAY,UAAkB,MAAM,CAAC,MAAM;QACzC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,MAAM,GAAG,YAAY;QAC/C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,sBAAsB,CAAC,CAAC;QAC3D,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACpC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAE1C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,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"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,MAAM;;CAET,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { config } from 'dotenv';
2
+ // Load environment variables
3
+ config();
4
+ export const CONFIG = {
5
+ apiUrl: process.env.API_URL || 'http://dev.optima.sh:3000',
6
+ };
7
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,6BAA6B;AAC7B,MAAM,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,2BAA2B;CAClD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "@optima-chat/scout-cli",
3
+ "version": "0.1.0",
4
+ "description": "AI-powered Amazon product research CLI tool - Search products and get detailed analytics",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "bin": {
8
+ "scout": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "dev": "tsx src/index.ts",
16
+ "build": "tsc",
17
+ "start": "node dist/index.js",
18
+ "lint": "eslint src --ext .ts",
19
+ "type-check": "tsc --noEmit",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "optima-scout",
24
+ "amazon",
25
+ "product-research",
26
+ "cli",
27
+ "e-commerce",
28
+ "product-selection",
29
+ "claude-code",
30
+ "ai-tools"
31
+ ],
32
+ "author": "VeryPro",
33
+ "license": "MIT",
34
+ "homepage": "https://github.com/Optima-Chat/optima-scout#readme",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/Optima-Chat/optima-scout.git",
38
+ "directory": "cli"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/Optima-Chat/optima-scout/issues"
42
+ },
43
+ "dependencies": {
44
+ "commander": "^12.1.0",
45
+ "dotenv": "^17.2.3"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.9.1",
49
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
50
+ "@typescript-eslint/parser": "^7.18.0",
51
+ "eslint": "^8.57.1",
52
+ "tsx": "^4.19.2",
53
+ "typescript": "^5.6.3"
54
+ },
55
+ "engines": {
56
+ "node": ">=20.0.0"
57
+ }
58
+ }