ecomcoder-cli 1.2.12 → 1.3.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 +293 -0
- package/dist/__tests__/test-utils.d.ts +123 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +133 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/cli.d.ts +8 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +70 -65
- package/dist/cli.js.map +1 -1
- package/dist/commands/docs/index.d.ts +10 -0
- package/dist/commands/docs/index.d.ts.map +1 -0
- package/dist/commands/docs/index.js +43 -0
- package/dist/commands/docs/index.js.map +1 -0
- package/dist/commands/metafield/index.d.ts +10 -0
- package/dist/commands/metafield/index.d.ts.map +1 -0
- package/dist/commands/metafield/index.js +55 -0
- package/dist/commands/metafield/index.js.map +1 -0
- package/dist/commands/product/__tests__/service.test.d.ts +7 -0
- package/dist/commands/product/__tests__/service.test.d.ts.map +1 -0
- package/dist/commands/product/__tests__/service.test.js +299 -0
- package/dist/commands/product/__tests__/service.test.js.map +1 -0
- package/dist/commands/product/__tests__/update-description.test.d.ts +5 -0
- package/dist/commands/product/__tests__/update-description.test.d.ts.map +1 -0
- package/dist/commands/product/__tests__/update-description.test.js +110 -0
- package/dist/commands/product/__tests__/update-description.test.js.map +1 -0
- package/dist/commands/product/get.d.ts +2 -0
- package/dist/commands/product/get.d.ts.map +1 -0
- package/dist/commands/product/get.js +305 -0
- package/dist/commands/product/get.js.map +1 -0
- package/dist/commands/product/index.d.ts +10 -0
- package/dist/commands/product/index.d.ts.map +1 -0
- package/dist/commands/product/index.js +73 -0
- package/dist/commands/product/index.js.map +1 -0
- package/dist/commands/product/queries.d.ts +32 -0
- package/dist/commands/product/queries.d.ts.map +1 -0
- package/dist/commands/product/queries.js +195 -0
- package/dist/commands/product/queries.js.map +1 -0
- package/dist/commands/product/service.d.ts +51 -0
- package/dist/commands/product/service.d.ts.map +1 -0
- package/dist/commands/product/service.js +237 -0
- package/dist/commands/product/service.js.map +1 -0
- package/dist/commands/product/types.d.ts +165 -0
- package/dist/commands/product/types.d.ts.map +1 -0
- package/dist/commands/product/types.js +6 -0
- package/dist/commands/product/types.js.map +1 -0
- package/dist/commands/product/update-description.d.ts +8 -0
- package/dist/commands/product/update-description.d.ts.map +1 -0
- package/dist/commands/product/update-description.js +86 -0
- package/dist/commands/product/update-description.js.map +1 -0
- package/dist/commands/product/update-price.d.ts +8 -0
- package/dist/commands/product/update-price.d.ts.map +1 -0
- package/dist/commands/product/update-price.js +101 -0
- package/dist/commands/product/update-price.js.map +1 -0
- package/dist/commands/product/update-template.d.ts +8 -0
- package/dist/commands/product/update-template.d.ts.map +1 -0
- package/dist/commands/product/update-template.js +114 -0
- package/dist/commands/product/update-template.js.map +1 -0
- package/dist/commands/product/utils.d.ts +69 -0
- package/dist/commands/product/utils.d.ts.map +1 -0
- package/dist/commands/product/utils.js +180 -0
- package/dist/commands/product/utils.js.map +1 -0
- package/dist/commands/products/index.d.ts +10 -0
- package/dist/commands/products/index.d.ts.map +1 -0
- package/dist/commands/products/index.js +62 -0
- package/dist/commands/products/index.js.map +1 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +11 -0
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/args-parser.d.ts.map +1 -1
- package/dist/lib/args-parser.js +2 -1
- package/dist/lib/args-parser.js.map +1 -1
- package/dist/lib/command-registry.d.ts +64 -0
- package/dist/lib/command-registry.d.ts.map +1 -0
- package/dist/lib/command-registry.js +76 -0
- package/dist/lib/command-registry.js.map +1 -0
- package/package.json +11 -3
- package/dist/lib/gemini-client.d.ts +0 -6
- package/dist/lib/gemini-client.d.ts.map +0 -1
- package/dist/lib/gemini-client.js +0 -27
- package/dist/lib/gemini-client.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
# EcomCoder CLI
|
|
2
|
+
|
|
3
|
+
> CLI tools for EcomCoder - Shopify development utilities
|
|
4
|
+
|
|
5
|
+
A command-line interface for streamlining Shopify theme development and testing. Built for developers working with EcomCoder's Shopify development platform.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g ecomcoder-cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or use with npx (no installation required):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx ecomcoder-cli [command]
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js >= 18.0.0
|
|
22
|
+
- Active EcomCoder session (authenticated via Claude Agent SDK)
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ecomcoder <command> <subcommand> [options]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Commands
|
|
31
|
+
|
|
32
|
+
### Products
|
|
33
|
+
|
|
34
|
+
#### Create Dummy Products
|
|
35
|
+
|
|
36
|
+
Create test products in your Shopify store for development and testing.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
ecomcoder products create --count=10
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**Options:**
|
|
43
|
+
- `--count` - Number of products to create (default: 10)
|
|
44
|
+
|
|
45
|
+
#### List Products
|
|
46
|
+
|
|
47
|
+
Retrieve and display products from your Shopify store.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
ecomcoder products list --limit=50
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**Options:**
|
|
54
|
+
- `--limit` - Maximum number of products to retrieve (default: 50)
|
|
55
|
+
|
|
56
|
+
#### Set Product Rating
|
|
57
|
+
|
|
58
|
+
Add rating metafields to a product (useful for testing review systems).
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
ecomcoder products set-rating \
|
|
62
|
+
--product-id="gid://shopify/Product/123456789" \
|
|
63
|
+
--rating=4.5 \
|
|
64
|
+
--count=127
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Options:**
|
|
68
|
+
- `--product-id` - Shopify product GID
|
|
69
|
+
- `--rating` - Rating value (e.g., 4.5)
|
|
70
|
+
- `--count` - Number of reviews/ratings
|
|
71
|
+
|
|
72
|
+
### Metafields
|
|
73
|
+
|
|
74
|
+
#### Create Metafield Definition
|
|
75
|
+
|
|
76
|
+
Create custom metafield definitions at product or shop level.
|
|
77
|
+
|
|
78
|
+
**Product-level metafield:**
|
|
79
|
+
```bash
|
|
80
|
+
ecomcoder metafield create \
|
|
81
|
+
--name="Product Rating" \
|
|
82
|
+
--key=rating \
|
|
83
|
+
--type=number_decimal \
|
|
84
|
+
--owner-type=PRODUCT
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Shop-level metafield (global):**
|
|
88
|
+
```bash
|
|
89
|
+
ecomcoder metafield create \
|
|
90
|
+
--name="Cart Upsell Product" \
|
|
91
|
+
--key=cart_upsell \
|
|
92
|
+
--type=product_reference \
|
|
93
|
+
--owner-type=SHOP
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Options:**
|
|
97
|
+
- `--name` - Display name for the metafield
|
|
98
|
+
- `--key` - Metafield key (used in code)
|
|
99
|
+
- `--type` - Metafield type (e.g., `number_decimal`, `product_reference`, `single_line_text_field`)
|
|
100
|
+
- `--owner-type` - Owner type: `PRODUCT` or `SHOP`
|
|
101
|
+
|
|
102
|
+
#### Get Metafield Definition
|
|
103
|
+
|
|
104
|
+
Retrieve metafield definitions from your store.
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
ecomcoder metafield get \
|
|
108
|
+
--namespace=ecomcoder \
|
|
109
|
+
--key=upsell \
|
|
110
|
+
--owner-type=PRODUCT
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Options:**
|
|
114
|
+
- `--namespace` - Metafield namespace
|
|
115
|
+
- `--key` - Metafield key
|
|
116
|
+
- `--owner-type` - Owner type: `PRODUCT` or `SHOP`
|
|
117
|
+
|
|
118
|
+
### Documentation
|
|
119
|
+
|
|
120
|
+
#### Search Shopify Docs
|
|
121
|
+
|
|
122
|
+
Search Shopify theme documentation using AI-powered semantic search.
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
ecomcoder docs search --query="How do sections work in Shopify themes?"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Options:**
|
|
129
|
+
- `--query` - Your search question
|
|
130
|
+
|
|
131
|
+
## Authentication
|
|
132
|
+
|
|
133
|
+
The CLI uses session-based authentication that's automatically provided when running within the Claude Agent SDK environment. The following environment variables are auto-injected:
|
|
134
|
+
|
|
135
|
+
- `SESSION_ID` - Session identifier
|
|
136
|
+
- `BACKEND_URL` - Orchestrator backend URL
|
|
137
|
+
- `SUPABASE_JWT` - Authentication token
|
|
138
|
+
- `SUPABASE_URL` - Supabase project URL
|
|
139
|
+
- `SUPABASE_ANON_KEY` - Supabase anonymous key
|
|
140
|
+
|
|
141
|
+
You can also manually provide the session ID:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
ecomcoder products list --session-id=your-session-id
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## Development
|
|
148
|
+
|
|
149
|
+
### Setup
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Clone the repository
|
|
153
|
+
git clone https://github.com/ImadMoka/ecomcoder-cli.git
|
|
154
|
+
cd ecomcoder-cli
|
|
155
|
+
|
|
156
|
+
# Install dependencies
|
|
157
|
+
npm install
|
|
158
|
+
|
|
159
|
+
# Build the project
|
|
160
|
+
npm run build
|
|
161
|
+
|
|
162
|
+
# Run in development mode (watch mode)
|
|
163
|
+
npm run dev
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Project Structure
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
ecomcoder-cli/
|
|
170
|
+
├── bin/
|
|
171
|
+
│ └── ecomcoder.js # CLI executable
|
|
172
|
+
├── src/
|
|
173
|
+
│ ├── commands/ # Command implementations
|
|
174
|
+
│ │ ├── create-dummy-products.ts
|
|
175
|
+
│ │ ├── list-products.ts
|
|
176
|
+
│ │ ├── set-product-rating.ts
|
|
177
|
+
│ │ ├── create-metafield.ts
|
|
178
|
+
│ │ ├── get-metafield.ts
|
|
179
|
+
│ │ └── docs-search.ts
|
|
180
|
+
│ ├── lib/ # Shared utilities
|
|
181
|
+
│ │ ├── api-client.ts
|
|
182
|
+
│ │ ├── shopify-client.ts
|
|
183
|
+
│ │ ├── supabase-client.ts
|
|
184
|
+
│ │ ├── pinecone-client.ts
|
|
185
|
+
│ │ ├── args-parser.ts
|
|
186
|
+
│ │ └── types.ts
|
|
187
|
+
│ └── cli.ts # Main CLI entry point
|
|
188
|
+
├── dist/ # Compiled output
|
|
189
|
+
└── package.json
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Scripts
|
|
193
|
+
|
|
194
|
+
- `npm run build` - Compile TypeScript to JavaScript
|
|
195
|
+
- `npm run dev` - Watch mode for development
|
|
196
|
+
- `npm run release:patch` - Bump patch version and publish (manual)
|
|
197
|
+
- `npm run release:minor` - Bump minor version and publish (manual)
|
|
198
|
+
- `npm run release:major` - Bump major version and publish (manual)
|
|
199
|
+
|
|
200
|
+
## Publishing
|
|
201
|
+
|
|
202
|
+
### Automated Publishing (Recommended)
|
|
203
|
+
|
|
204
|
+
This project uses GitHub Actions for automated npm publishing:
|
|
205
|
+
|
|
206
|
+
1. **Create a GitHub Release:**
|
|
207
|
+
- Go to your repository on GitHub
|
|
208
|
+
- Click "Releases" → "Create a new release"
|
|
209
|
+
- Create a tag following semver (e.g., `v1.2.12`, `v1.3.0`)
|
|
210
|
+
- Add release notes describing changes
|
|
211
|
+
- Click "Publish release"
|
|
212
|
+
|
|
213
|
+
2. **Automatic Publishing:**
|
|
214
|
+
- GitHub Actions automatically triggers
|
|
215
|
+
- Updates package.json version from the tag
|
|
216
|
+
- Builds the project
|
|
217
|
+
- Publishes to npm with provenance
|
|
218
|
+
- Provides a summary with npm link
|
|
219
|
+
|
|
220
|
+
### Setup (First Time Only)
|
|
221
|
+
|
|
222
|
+
**1. Create npm Access Token:**
|
|
223
|
+
- Go to [npmjs.com](https://www.npmjs.com/) → Account Settings → Access Tokens
|
|
224
|
+
- Generate a new "Automation" token
|
|
225
|
+
- Copy the token
|
|
226
|
+
|
|
227
|
+
**2. Add Token to GitHub:**
|
|
228
|
+
- Repository Settings → Secrets and variables → Actions
|
|
229
|
+
- Click "New repository secret"
|
|
230
|
+
- Name: `NPM_TOKEN`
|
|
231
|
+
- Value: paste your npm token
|
|
232
|
+
- Save
|
|
233
|
+
|
|
234
|
+
### Manual Publishing (Legacy)
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
# Patch release (1.2.11 → 1.2.12)
|
|
238
|
+
npm run release:patch
|
|
239
|
+
|
|
240
|
+
# Minor release (1.2.11 → 1.3.0)
|
|
241
|
+
npm run release:minor
|
|
242
|
+
|
|
243
|
+
# Major release (1.2.11 → 2.0.0)
|
|
244
|
+
npm run release:major
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## Examples
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Create 25 test products
|
|
251
|
+
ecomcoder products create --count=25
|
|
252
|
+
|
|
253
|
+
# List all products (up to 100)
|
|
254
|
+
ecomcoder products list --limit=100
|
|
255
|
+
|
|
256
|
+
# Add a 4.8 star rating with 243 reviews
|
|
257
|
+
ecomcoder products set-rating \
|
|
258
|
+
--product-id="gid://shopify/Product/8234567890" \
|
|
259
|
+
--rating=4.8 \
|
|
260
|
+
--count=243
|
|
261
|
+
|
|
262
|
+
# Create a shop-level recommended products metafield
|
|
263
|
+
ecomcoder metafield create \
|
|
264
|
+
--name="Recommended Products" \
|
|
265
|
+
--key=recommended \
|
|
266
|
+
--type=list.product_reference \
|
|
267
|
+
--owner-type=SHOP
|
|
268
|
+
|
|
269
|
+
# Search for information about Liquid filters
|
|
270
|
+
ecomcoder docs search --query="What are the available date filters in Liquid?"
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## License
|
|
274
|
+
|
|
275
|
+
MIT
|
|
276
|
+
|
|
277
|
+
## Support
|
|
278
|
+
|
|
279
|
+
For issues and feature requests, please visit:
|
|
280
|
+
- [GitHub Issues](https://github.com/ImadMoka/ecomcoder-cli/issues)
|
|
281
|
+
- [EcomCoder Platform](https://ecomcoder.com)
|
|
282
|
+
|
|
283
|
+
## Contributing
|
|
284
|
+
|
|
285
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
**Built with:**
|
|
290
|
+
- TypeScript
|
|
291
|
+
- Shopify Admin API
|
|
292
|
+
- Supabase
|
|
293
|
+
- Pinecone (for semantic search)
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared helpers for testing CLI commands
|
|
5
|
+
*/
|
|
6
|
+
import type { ShopifyCredentials } from '../lib/types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Mock Shopify credentials for testing
|
|
9
|
+
*/
|
|
10
|
+
export declare const mockCredentials: ShopifyCredentials;
|
|
11
|
+
/**
|
|
12
|
+
* Mock GraphQL response helper
|
|
13
|
+
*/
|
|
14
|
+
export declare function mockGraphQLResponse<T>(data: T, errors?: any[]): {
|
|
15
|
+
data: T;
|
|
16
|
+
errors: any[] | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Mock product data
|
|
20
|
+
*/
|
|
21
|
+
export declare const mockProduct: {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
descriptionHtml: string;
|
|
26
|
+
handle: string;
|
|
27
|
+
productType: string;
|
|
28
|
+
vendor: string;
|
|
29
|
+
tags: string[];
|
|
30
|
+
status: "ACTIVE";
|
|
31
|
+
templateSuffix: null;
|
|
32
|
+
variants: {
|
|
33
|
+
edges: {
|
|
34
|
+
node: {
|
|
35
|
+
id: string;
|
|
36
|
+
title: string;
|
|
37
|
+
sku: string;
|
|
38
|
+
price: string;
|
|
39
|
+
compareAtPrice: null;
|
|
40
|
+
inventoryQuantity: number;
|
|
41
|
+
availableForSale: boolean;
|
|
42
|
+
};
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
images: {
|
|
46
|
+
edges: never[];
|
|
47
|
+
};
|
|
48
|
+
priceRangeV2: {
|
|
49
|
+
minVariantPrice: {
|
|
50
|
+
amount: string;
|
|
51
|
+
currencyCode: string;
|
|
52
|
+
};
|
|
53
|
+
maxVariantPrice: {
|
|
54
|
+
amount: string;
|
|
55
|
+
currencyCode: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Mock product with multiple variants
|
|
61
|
+
*/
|
|
62
|
+
export declare const mockProductMultipleVariants: {
|
|
63
|
+
variants: {
|
|
64
|
+
edges: {
|
|
65
|
+
node: {
|
|
66
|
+
id: string;
|
|
67
|
+
title: string;
|
|
68
|
+
sku: string;
|
|
69
|
+
price: string;
|
|
70
|
+
compareAtPrice: null;
|
|
71
|
+
inventoryQuantity: number;
|
|
72
|
+
availableForSale: boolean;
|
|
73
|
+
};
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
id: string;
|
|
77
|
+
title: string;
|
|
78
|
+
description: string;
|
|
79
|
+
descriptionHtml: string;
|
|
80
|
+
handle: string;
|
|
81
|
+
productType: string;
|
|
82
|
+
vendor: string;
|
|
83
|
+
tags: string[];
|
|
84
|
+
status: "ACTIVE";
|
|
85
|
+
templateSuffix: null;
|
|
86
|
+
images: {
|
|
87
|
+
edges: never[];
|
|
88
|
+
};
|
|
89
|
+
priceRangeV2: {
|
|
90
|
+
minVariantPrice: {
|
|
91
|
+
amount: string;
|
|
92
|
+
currencyCode: string;
|
|
93
|
+
};
|
|
94
|
+
maxVariantPrice: {
|
|
95
|
+
amount: string;
|
|
96
|
+
currencyCode: string;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Mock variant data
|
|
102
|
+
*/
|
|
103
|
+
export declare const mockVariant: {
|
|
104
|
+
id: string;
|
|
105
|
+
price: string;
|
|
106
|
+
compareAtPrice: null;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Mock user errors
|
|
110
|
+
*/
|
|
111
|
+
export declare const mockUserErrors: {
|
|
112
|
+
field: string[];
|
|
113
|
+
message: string;
|
|
114
|
+
}[];
|
|
115
|
+
/**
|
|
116
|
+
* Parse JSON output from CLI commands
|
|
117
|
+
*/
|
|
118
|
+
export declare function parseCommandOutput(output: string): any;
|
|
119
|
+
/**
|
|
120
|
+
* Create mock shopifyGraphQL function
|
|
121
|
+
*/
|
|
122
|
+
export declare function createMockShopifyGraphQL(mockResponse: any): (credentials: ShopifyCredentials, query: string, variables?: any) => Promise<any>;
|
|
123
|
+
//# sourceMappingURL=test-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../src/__tests__/test-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,kBAG7B,CAAC;AAEF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE;;;EAK7D;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;;;;CAIvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc;;;GAK1B,CAAC;AAEF;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAMtD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,GAAG,IAC1C,aAAa,kBAAkB,EAAE,OAAO,MAAM,EAAE,YAAY,GAAG,kBAG9E"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared helpers for testing CLI commands
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Mock Shopify credentials for testing
|
|
8
|
+
*/
|
|
9
|
+
export const mockCredentials = {
|
|
10
|
+
shopifyUrl: 'https://test-shop.myshopify.com',
|
|
11
|
+
shopifyAdminPassword: 'shpat_test_token_12345'
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Mock GraphQL response helper
|
|
15
|
+
*/
|
|
16
|
+
export function mockGraphQLResponse(data, errors) {
|
|
17
|
+
return {
|
|
18
|
+
data,
|
|
19
|
+
errors: errors || undefined
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Mock product data
|
|
24
|
+
*/
|
|
25
|
+
export const mockProduct = {
|
|
26
|
+
id: 'gid://shopify/Product/123456789',
|
|
27
|
+
title: 'Test Product',
|
|
28
|
+
description: 'Test description',
|
|
29
|
+
descriptionHtml: '<p>Test description</p>',
|
|
30
|
+
handle: 'test-product',
|
|
31
|
+
productType: 'Test Type',
|
|
32
|
+
vendor: 'Test Vendor',
|
|
33
|
+
tags: ['test', 'sample'],
|
|
34
|
+
status: 'ACTIVE',
|
|
35
|
+
templateSuffix: null,
|
|
36
|
+
variants: {
|
|
37
|
+
edges: [
|
|
38
|
+
{
|
|
39
|
+
node: {
|
|
40
|
+
id: 'gid://shopify/ProductVariant/987654321',
|
|
41
|
+
title: 'Default Title',
|
|
42
|
+
sku: 'TEST-SKU',
|
|
43
|
+
price: '29.99',
|
|
44
|
+
compareAtPrice: null,
|
|
45
|
+
inventoryQuantity: 100,
|
|
46
|
+
availableForSale: true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
images: {
|
|
52
|
+
edges: []
|
|
53
|
+
},
|
|
54
|
+
priceRangeV2: {
|
|
55
|
+
minVariantPrice: {
|
|
56
|
+
amount: '29.99',
|
|
57
|
+
currencyCode: 'USD'
|
|
58
|
+
},
|
|
59
|
+
maxVariantPrice: {
|
|
60
|
+
amount: '29.99',
|
|
61
|
+
currencyCode: 'USD'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Mock product with multiple variants
|
|
67
|
+
*/
|
|
68
|
+
export const mockProductMultipleVariants = {
|
|
69
|
+
...mockProduct,
|
|
70
|
+
variants: {
|
|
71
|
+
edges: [
|
|
72
|
+
{
|
|
73
|
+
node: {
|
|
74
|
+
id: 'gid://shopify/ProductVariant/111',
|
|
75
|
+
title: 'Small',
|
|
76
|
+
sku: 'TEST-SKU-S',
|
|
77
|
+
price: '29.99',
|
|
78
|
+
compareAtPrice: null,
|
|
79
|
+
inventoryQuantity: 50,
|
|
80
|
+
availableForSale: true,
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
node: {
|
|
85
|
+
id: 'gid://shopify/ProductVariant/222',
|
|
86
|
+
title: 'Medium',
|
|
87
|
+
sku: 'TEST-SKU-M',
|
|
88
|
+
price: '29.99',
|
|
89
|
+
compareAtPrice: null,
|
|
90
|
+
inventoryQuantity: 50,
|
|
91
|
+
availableForSale: true,
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Mock variant data
|
|
99
|
+
*/
|
|
100
|
+
export const mockVariant = {
|
|
101
|
+
id: 'gid://shopify/ProductVariant/987654321',
|
|
102
|
+
price: '29.99',
|
|
103
|
+
compareAtPrice: null
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Mock user errors
|
|
107
|
+
*/
|
|
108
|
+
export const mockUserErrors = [
|
|
109
|
+
{
|
|
110
|
+
field: ['input', 'price'],
|
|
111
|
+
message: 'Price must be positive'
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
/**
|
|
115
|
+
* Parse JSON output from CLI commands
|
|
116
|
+
*/
|
|
117
|
+
export function parseCommandOutput(output) {
|
|
118
|
+
try {
|
|
119
|
+
return JSON.parse(output);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
throw new Error(`Failed to parse command output: ${output}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Create mock shopifyGraphQL function
|
|
127
|
+
*/
|
|
128
|
+
export function createMockShopifyGraphQL(mockResponse) {
|
|
129
|
+
return async (credentials, query, variables) => {
|
|
130
|
+
return mockResponse;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=test-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../../src/__tests__/test-utils.ts"],"names":[],"mappings":"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"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* EcomCoder CLI - Main Entry Point
|
|
3
|
+
* EcomCoder CLI - Main Entry Point (Refactored)
|
|
4
4
|
*
|
|
5
|
-
* Command
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
5
|
+
* Architecture: Command Registry Pattern
|
|
6
|
+
*
|
|
7
|
+
* Benefits:
|
|
8
|
+
* ✅ Open/Closed Principle - Add commands without modifying this file
|
|
9
|
+
* ✅ Single Responsibility - This file only routes, doesn't know command details
|
|
10
|
+
* ✅ Scalability - Supports unlimited commands
|
|
11
|
+
* ✅ Testability - Easy to test routing logic
|
|
11
12
|
*/
|
|
12
13
|
export {};
|
|
13
14
|
//# sourceMappingURL=cli.d.ts.map
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;GAUG"}
|