@ollie-shop/cli 0.2.0 → 0.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/.turbo/turbo-build.log +2 -11
- package/CHANGELOG.md +13 -7
- package/CLAUDE_CLI.md +265 -0
- package/README.md +704 -8
- package/__tests__/mocks/console.ts +22 -0
- package/__tests__/mocks/core.ts +137 -0
- package/__tests__/mocks/index.ts +4 -0
- package/__tests__/mocks/inquirer.ts +16 -0
- package/__tests__/mocks/progress.ts +19 -0
- package/dist/__tests__/helpers/cli-test-helper.d.ts +89 -0
- package/dist/__tests__/helpers/cli-test-helper.d.ts.map +1 -0
- package/dist/__tests__/helpers/cli-test-helper.js +220 -0
- package/dist/__tests__/mocks/index.d.ts +69 -0
- package/dist/__tests__/mocks/index.d.ts.map +1 -0
- package/dist/__tests__/mocks/index.js +77 -0
- package/dist/actions/component.actions.d.ts +14 -0
- package/dist/actions/component.actions.d.ts.map +1 -0
- package/dist/actions/component.actions.js +273 -0
- package/dist/actions/function.actions.d.ts +15 -0
- package/dist/actions/function.actions.d.ts.map +1 -0
- package/dist/actions/function.actions.js +254 -0
- package/dist/actions/project.actions.d.ts +17 -0
- package/dist/actions/project.actions.d.ts.map +1 -0
- package/dist/actions/project.actions.js +97 -0
- package/dist/actions/version.actions.d.ts +19 -0
- package/dist/actions/version.actions.d.ts.map +1 -0
- package/dist/actions/version.actions.js +216 -0
- package/dist/commands/component.d.ts +3 -0
- package/dist/commands/component.d.ts.map +1 -0
- package/dist/commands/component.js +192 -0
- package/dist/commands/docs.d.ts +3 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +16 -0
- package/dist/commands/function.d.ts +3 -0
- package/dist/commands/function.d.ts.map +1 -0
- package/dist/commands/function.js +243 -0
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +20 -0
- package/dist/commands/index.d.ts +3 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +26 -0
- package/dist/commands/login.d.ts +3 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +175 -0
- package/dist/commands/project.d.ts +3 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +78 -0
- package/dist/commands/store-version.d.ts +3 -0
- package/dist/commands/store-version.d.ts.map +1 -0
- package/dist/commands/store-version.js +241 -0
- package/dist/commands/version.d.ts +3 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +46 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +41 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +88 -478
- package/dist/prompts/component.prompts.d.ts +14 -0
- package/dist/prompts/component.prompts.d.ts.map +1 -0
- package/dist/prompts/component.prompts.js +75 -0
- package/dist/prompts/function.prompts.d.ts +21 -0
- package/dist/prompts/function.prompts.d.ts.map +1 -0
- package/dist/prompts/function.prompts.js +127 -0
- package/dist/schemas/command.schema.d.ts +516 -0
- package/dist/schemas/command.schema.d.ts.map +1 -0
- package/dist/schemas/command.schema.js +267 -0
- package/dist/types/index.d.ts +147 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +18 -0
- package/dist/utils/auth.d.ts +4 -0
- package/dist/utils/auth.d.ts.map +1 -0
- package/dist/utils/auth.js +26 -0
- package/dist/utils/cli-progress-reporter.d.ts +12 -0
- package/dist/utils/cli-progress-reporter.d.ts.map +1 -0
- package/dist/utils/cli-progress-reporter.js +77 -0
- package/dist/utils/command-builder.d.ts +22 -0
- package/dist/utils/command-builder.d.ts.map +1 -0
- package/dist/utils/command-builder.js +268 -0
- package/dist/utils/command-helpers.d.ts +19 -0
- package/dist/utils/command-helpers.d.ts.map +1 -0
- package/dist/utils/command-helpers.js +79 -0
- package/dist/utils/command-parser.d.ts +146 -0
- package/dist/utils/command-parser.d.ts.map +1 -0
- package/dist/utils/command-parser.js +179 -0
- package/dist/utils/command-suggestions.d.ts +35 -0
- package/dist/utils/command-suggestions.d.ts.map +1 -0
- package/dist/utils/command-suggestions.js +152 -0
- package/dist/utils/console.d.ts +44 -0
- package/dist/utils/console.d.ts.map +1 -0
- package/dist/utils/console.js +233 -0
- package/dist/utils/constants.d.ts +8 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +10 -0
- package/dist/utils/context-detector.d.ts +12 -0
- package/dist/utils/context-detector.d.ts.map +1 -0
- package/dist/utils/context-detector.js +155 -0
- package/dist/utils/enhanced-error-handler.d.ts +47 -0
- package/dist/utils/enhanced-error-handler.d.ts.map +1 -0
- package/dist/utils/enhanced-error-handler.js +221 -0
- package/dist/utils/error-handler.d.ts +3 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +55 -0
- package/dist/utils/errors.d.ts +44 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +76 -0
- package/dist/utils/interactive-builder.d.ts +22 -0
- package/dist/utils/interactive-builder.d.ts.map +1 -0
- package/dist/utils/interactive-builder.js +246 -0
- package/dist/utils/rich-progress.d.ts +59 -0
- package/dist/utils/rich-progress.d.ts.map +1 -0
- package/dist/utils/rich-progress.js +234 -0
- package/dist/utils/store.d.ts +11 -0
- package/dist/utils/store.d.ts.map +1 -0
- package/dist/utils/store.js +19 -0
- package/dist/utils/validation-error-formatter.d.ts +25 -0
- package/dist/utils/validation-error-formatter.d.ts.map +1 -0
- package/dist/utils/validation-error-formatter.js +258 -0
- package/dist/utils/validation-helpers.d.ts +60 -0
- package/dist/utils/validation-helpers.d.ts.map +1 -0
- package/dist/utils/validation-helpers.js +152 -0
- package/package.json +43 -11
- package/src/__tests__/helpers/cli-test-helper.ts +281 -0
- package/src/__tests__/mocks/index.ts +142 -0
- package/src/actions/component.actions.ts +334 -0
- package/src/actions/function.actions.ts +313 -0
- package/src/actions/project.actions.ts +126 -0
- package/src/actions/version.actions.ts +233 -0
- package/src/commands/__tests__/component-validation.test.ts +250 -0
- package/src/commands/__tests__/component.test.ts +321 -0
- package/src/commands/__tests__/function-validation.test.ts +220 -0
- package/src/commands/__tests__/function.test.ts +286 -0
- package/src/commands/__tests__/store-version-validation.test.ts +414 -0
- package/src/commands/__tests__/store-version.test.ts +405 -0
- package/src/commands/__tests__/version.test.ts +71 -0
- package/src/commands/component.ts +188 -0
- package/src/commands/docs.ts +11 -11
- package/src/commands/function.ts +252 -0
- package/src/commands/help.ts +8 -18
- package/src/commands/index.ts +14 -7
- package/src/commands/login.ts +19 -79
- package/src/commands/project.ts +107 -0
- package/src/commands/store-version.ts +242 -0
- package/src/commands/version.ts +45 -8
- package/src/commands/whoami.ts +8 -13
- package/src/index.ts +108 -34
- package/src/prompts/component.prompts.ts +94 -0
- package/src/prompts/function.prompts.ts +168 -0
- package/src/schemas/command.schema.ts +354 -0
- package/src/types/index.ts +183 -0
- package/src/utils/__tests__/command-parser.test.ts +159 -0
- package/src/utils/__tests__/command-suggestions.test.ts +185 -0
- package/src/utils/__tests__/console.test.ts +192 -0
- package/src/utils/__tests__/context-detector.test.ts +258 -0
- package/src/utils/__tests__/enhanced-error-handler.test.ts +137 -0
- package/src/utils/__tests__/error-handler.test.ts +107 -0
- package/src/utils/__tests__/rich-progress.test.ts +170 -0
- package/src/utils/__tests__/validation-error-formatter.test.ts +175 -0
- package/src/utils/__tests__/validation-helpers.test.ts +125 -0
- package/src/utils/auth.ts +0 -1
- package/src/utils/cli-progress-reporter.ts +84 -0
- package/src/utils/command-builder.ts +390 -0
- package/src/utils/command-helpers.ts +83 -0
- package/src/utils/command-parser.ts +250 -0
- package/src/utils/command-suggestions.ts +176 -0
- package/src/utils/console.ts +291 -0
- package/src/utils/context-detector.ts +177 -0
- package/src/utils/enhanced-error-handler.ts +264 -0
- package/src/utils/error-handler.ts +60 -0
- package/src/utils/errors.ts +125 -0
- package/src/utils/interactive-builder.ts +271 -0
- package/src/utils/rich-progress.ts +320 -0
- package/src/utils/validation-error-formatter.ts +337 -0
- package/src/utils/validation-helpers.ts +192 -0
- package/tsconfig.json +13 -7
- package/vitest.config.ts +28 -0
- package/vitest.setup.ts +29 -0
- package/src/commands/validate.ts +0 -62
- package/src/utils/core.ts +0 -105
- package/tsup.config.ts +0 -15
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VersionListItemSchema = exports.BuildStatusSchema = exports.ComponentListItemSchema = exports.FunctionListItemSchema = exports.StoreVersionSetDefaultOptionsSchema = exports.StoreVersionActivateOptionsSchema = exports.StoreVersionCloneOptionsSchema = exports.StoreVersionListOptionsSchema = exports.StoreVersionCreateOptionsSchema = exports.InitOptionsSchema = exports.LoginOptionsSchema = exports.BuildOptionsSchema = exports.GlobalOptionsSchema = exports.DevServerOptionsSchema = exports.FunctionDeployOptionsSchema = exports.FunctionTestOptionsSchema = exports.FunctionValidateOptionsSchema = exports.FunctionBuildOptionsSchema = exports.FunctionCreateOptionsSchema = exports.ComponentDeployOptionsSchema = exports.ComponentValidateOptionsSchema = exports.ComponentBuildOptionsSchema = exports.ComponentCreateOptionsSchema = exports.SemverSchema = exports.UrlSchema = exports.PrioritySchema = exports.VersionNameSchema = exports.StoreIdSchema = exports.PathSchema = exports.FunctionNameSchema = exports.ComponentNameSchema = void 0;
|
|
4
|
+
exports.validatePath = validatePath;
|
|
5
|
+
exports.validateStoreId = validateStoreId;
|
|
6
|
+
exports.validateVersionName = validateVersionName;
|
|
7
|
+
exports.validatePriority = validatePriority;
|
|
8
|
+
exports.validateUrl = validateUrl;
|
|
9
|
+
exports.validateSemver = validateSemver;
|
|
10
|
+
// Following TypeScript Discipline: Import schemas from core instead of duplicating
|
|
11
|
+
const core_1 = require("@ollie-shop/core");
|
|
12
|
+
Object.defineProperty(exports, "ComponentNameSchema", { enumerable: true, get: function () { return core_1.ComponentNameSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "FunctionNameSchema", { enumerable: true, get: function () { return core_1.FunctionNameSchema; } });
|
|
14
|
+
const zod_1 = require("zod");
|
|
15
|
+
/**
|
|
16
|
+
* CLI-specific schemas (only for CLI-specific concerns)
|
|
17
|
+
*/
|
|
18
|
+
exports.PathSchema = zod_1.z.string().min(1, "Path cannot be empty");
|
|
19
|
+
exports.StoreIdSchema = zod_1.z.string().uuid("Invalid store ID format");
|
|
20
|
+
exports.VersionNameSchema = zod_1.z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1, "Version name is required")
|
|
23
|
+
.max(100, "Version name is too long (max 100 characters)");
|
|
24
|
+
exports.PrioritySchema = zod_1.z
|
|
25
|
+
.number()
|
|
26
|
+
.int("Priority must be a whole number")
|
|
27
|
+
.min(0, "Priority must be between 0 and 100")
|
|
28
|
+
.max(100, "Priority must be between 0 and 100");
|
|
29
|
+
exports.UrlSchema = zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1, "URL is required")
|
|
32
|
+
.refine((url) => {
|
|
33
|
+
// Allow URL patterns like /api/* or /*
|
|
34
|
+
if (url.startsWith("/")) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
// Validate full URLs
|
|
38
|
+
try {
|
|
39
|
+
const parsed = new URL(url);
|
|
40
|
+
return ["http:", "https:"].includes(parsed.protocol);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
}, "URL must be a valid URL or path pattern");
|
|
46
|
+
exports.SemverSchema = zod_1.z
|
|
47
|
+
.string()
|
|
48
|
+
.regex(/^\d+\.\d+\.\d+$/, "Version must follow semantic versioning format (e.g., 1.0.0)");
|
|
49
|
+
/**
|
|
50
|
+
* Component command schemas
|
|
51
|
+
*/
|
|
52
|
+
exports.ComponentCreateOptionsSchema = zod_1.z
|
|
53
|
+
.object({
|
|
54
|
+
name: core_1.ComponentNameSchema.optional(), // Optional for interactive mode
|
|
55
|
+
slot: core_1.ComponentSlot.optional().default("main"),
|
|
56
|
+
tests: zod_1.z.boolean().optional().default(true),
|
|
57
|
+
template: zod_1.z.string().optional(),
|
|
58
|
+
interactive: zod_1.z.boolean().optional(),
|
|
59
|
+
})
|
|
60
|
+
.refine((data) => data.interactive || data.name, {
|
|
61
|
+
message: "Component name is required when not in interactive mode",
|
|
62
|
+
path: ["name"],
|
|
63
|
+
});
|
|
64
|
+
exports.ComponentBuildOptionsSchema = zod_1.z.object({
|
|
65
|
+
path: exports.PathSchema.optional(),
|
|
66
|
+
watch: zod_1.z.boolean().optional(),
|
|
67
|
+
minify: zod_1.z.boolean().optional(),
|
|
68
|
+
sourcemap: zod_1.z.boolean().optional(),
|
|
69
|
+
});
|
|
70
|
+
exports.ComponentValidateOptionsSchema = zod_1.z.object({
|
|
71
|
+
path: exports.PathSchema.optional(),
|
|
72
|
+
strict: zod_1.z.boolean().optional(),
|
|
73
|
+
fix: zod_1.z.boolean().optional(),
|
|
74
|
+
});
|
|
75
|
+
exports.ComponentDeployOptionsSchema = zod_1.z.object({
|
|
76
|
+
path: exports.PathSchema.optional(),
|
|
77
|
+
componentId: zod_1.z.string().optional(),
|
|
78
|
+
id: zod_1.z.string().optional(), // CLI uses --id flag
|
|
79
|
+
wait: zod_1.z.boolean().optional(),
|
|
80
|
+
});
|
|
81
|
+
/**
|
|
82
|
+
* Function command schemas
|
|
83
|
+
*/
|
|
84
|
+
exports.FunctionCreateOptionsSchema = zod_1.z.object({
|
|
85
|
+
name: core_1.FunctionNameSchema,
|
|
86
|
+
invocation: core_1.FunctionInvocationType.optional().default("request"),
|
|
87
|
+
priority: exports.PrioritySchema.optional().default(0),
|
|
88
|
+
onError: core_1.OnErrorBehavior.optional().default("throw"),
|
|
89
|
+
tests: zod_1.z.boolean().optional().default(true),
|
|
90
|
+
template: zod_1.z.string().optional(),
|
|
91
|
+
description: zod_1.z.string().optional(),
|
|
92
|
+
});
|
|
93
|
+
exports.FunctionBuildOptionsSchema = zod_1.z.object({
|
|
94
|
+
path: exports.PathSchema.optional(),
|
|
95
|
+
watch: zod_1.z.boolean().optional(),
|
|
96
|
+
minify: zod_1.z.boolean().optional(),
|
|
97
|
+
target: zod_1.z.enum(["node16", "node18", "node20"]).optional(),
|
|
98
|
+
});
|
|
99
|
+
exports.FunctionValidateOptionsSchema = zod_1.z.object({
|
|
100
|
+
path: exports.PathSchema.optional(),
|
|
101
|
+
strict: zod_1.z.boolean().optional(),
|
|
102
|
+
fix: zod_1.z.boolean().optional(),
|
|
103
|
+
});
|
|
104
|
+
exports.FunctionTestOptionsSchema = zod_1.z.object({
|
|
105
|
+
path: exports.PathSchema.optional(),
|
|
106
|
+
payload: zod_1.z.string().optional(),
|
|
107
|
+
timeout: zod_1.z.number().optional(),
|
|
108
|
+
coverage: zod_1.z.boolean().optional(),
|
|
109
|
+
watch: zod_1.z.boolean().optional(),
|
|
110
|
+
});
|
|
111
|
+
exports.FunctionDeployOptionsSchema = zod_1.z.object({
|
|
112
|
+
path: exports.PathSchema.optional(),
|
|
113
|
+
functionId: zod_1.z.string().optional(),
|
|
114
|
+
id: zod_1.z.string().optional(), // CLI uses --id flag
|
|
115
|
+
wait: zod_1.z.boolean().optional(),
|
|
116
|
+
});
|
|
117
|
+
/**
|
|
118
|
+
* Development server schemas
|
|
119
|
+
*/
|
|
120
|
+
exports.DevServerOptionsSchema = zod_1.z.object({
|
|
121
|
+
port: zod_1.z.number().min(1000).max(65535).default(3000),
|
|
122
|
+
host: zod_1.z.string().default("localhost"),
|
|
123
|
+
open: zod_1.z.boolean().default(true),
|
|
124
|
+
component: exports.PathSchema.optional(),
|
|
125
|
+
function: exports.PathSchema.optional(),
|
|
126
|
+
mockData: exports.PathSchema.optional(),
|
|
127
|
+
hot: zod_1.z.boolean().default(true),
|
|
128
|
+
https: zod_1.z.boolean().default(false),
|
|
129
|
+
});
|
|
130
|
+
/**
|
|
131
|
+
* Global CLI options schemas
|
|
132
|
+
*/
|
|
133
|
+
exports.GlobalOptionsSchema = zod_1.z.object({
|
|
134
|
+
verbose: zod_1.z.boolean().default(false),
|
|
135
|
+
quiet: zod_1.z.boolean().default(false),
|
|
136
|
+
color: zod_1.z.boolean().default(true), // --no-color sets this to false
|
|
137
|
+
config: exports.PathSchema.optional(),
|
|
138
|
+
logLevel: zod_1.z.enum(["error", "warn", "info", "debug"]).default("info"),
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Build command schemas
|
|
142
|
+
*/
|
|
143
|
+
exports.BuildOptionsSchema = zod_1.z.object({
|
|
144
|
+
path: exports.PathSchema.optional(),
|
|
145
|
+
output: exports.PathSchema.optional(),
|
|
146
|
+
minify: zod_1.z.boolean().default(true),
|
|
147
|
+
sourcemap: zod_1.z.boolean().default(true),
|
|
148
|
+
watch: zod_1.z.boolean().default(false),
|
|
149
|
+
clean: zod_1.z.boolean().default(true),
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* Login/Auth schemas
|
|
153
|
+
*/
|
|
154
|
+
exports.LoginOptionsSchema = zod_1.z.object({
|
|
155
|
+
token: zod_1.z.string().optional(),
|
|
156
|
+
interactive: zod_1.z.boolean().default(true),
|
|
157
|
+
save: zod_1.z.boolean().default(true),
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* Init project schemas
|
|
161
|
+
*/
|
|
162
|
+
exports.InitOptionsSchema = zod_1.z.object({
|
|
163
|
+
name: zod_1.z.string().optional(),
|
|
164
|
+
template: core_1.Template.optional().default("default"),
|
|
165
|
+
git: zod_1.z.boolean().default(true),
|
|
166
|
+
install: zod_1.z.boolean().default(true),
|
|
167
|
+
path: exports.PathSchema.optional(),
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* Store version command schemas
|
|
171
|
+
*/
|
|
172
|
+
exports.StoreVersionCreateOptionsSchema = zod_1.z.object({
|
|
173
|
+
store: exports.StoreIdSchema,
|
|
174
|
+
name: exports.VersionNameSchema,
|
|
175
|
+
template: core_1.Template.optional(),
|
|
176
|
+
active: zod_1.z.boolean().optional(),
|
|
177
|
+
});
|
|
178
|
+
exports.StoreVersionListOptionsSchema = zod_1.z.object({
|
|
179
|
+
store: exports.StoreIdSchema,
|
|
180
|
+
});
|
|
181
|
+
exports.StoreVersionCloneOptionsSchema = zod_1.z.object({
|
|
182
|
+
store: exports.StoreIdSchema,
|
|
183
|
+
sourceId: zod_1.z.string().uuid("Invalid source version ID"),
|
|
184
|
+
name: exports.VersionNameSchema,
|
|
185
|
+
});
|
|
186
|
+
exports.StoreVersionActivateOptionsSchema = zod_1.z.object({
|
|
187
|
+
store: exports.StoreIdSchema,
|
|
188
|
+
versionId: zod_1.z.string().uuid("Invalid version ID"),
|
|
189
|
+
});
|
|
190
|
+
exports.StoreVersionSetDefaultOptionsSchema = zod_1.z.object({
|
|
191
|
+
store: exports.StoreIdSchema,
|
|
192
|
+
versionId: zod_1.z.string().uuid("Invalid version ID"),
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Validation helper functions
|
|
196
|
+
*/
|
|
197
|
+
// NOTE: For component and function name validation, use validation functions from core:
|
|
198
|
+
// import { validateComponentName, validateFunctionName } from "@ollie-shop/core/schemas"
|
|
199
|
+
function validatePath(path) {
|
|
200
|
+
return exports.PathSchema.safeParse(path).success;
|
|
201
|
+
}
|
|
202
|
+
function validateStoreId(storeId) {
|
|
203
|
+
return exports.StoreIdSchema.safeParse(storeId).success;
|
|
204
|
+
}
|
|
205
|
+
function validateVersionName(name) {
|
|
206
|
+
return exports.VersionNameSchema.safeParse(name).success;
|
|
207
|
+
}
|
|
208
|
+
function validatePriority(priority) {
|
|
209
|
+
return exports.PrioritySchema.safeParse(priority).success;
|
|
210
|
+
}
|
|
211
|
+
function validateUrl(url) {
|
|
212
|
+
return exports.UrlSchema.safeParse(url).success;
|
|
213
|
+
}
|
|
214
|
+
function validateSemver(version) {
|
|
215
|
+
return exports.SemverSchema.safeParse(version).success;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* CLI Data Display Schemas
|
|
219
|
+
* These schemas define the structure for data displayed in CLI commands
|
|
220
|
+
*/
|
|
221
|
+
// Function list item schema for CLI display
|
|
222
|
+
exports.FunctionListItemSchema = zod_1.z.object({
|
|
223
|
+
id: zod_1.z.string(),
|
|
224
|
+
name: zod_1.z.string(),
|
|
225
|
+
runtime: zod_1.z.string().optional(),
|
|
226
|
+
version: zod_1.z.string().optional(),
|
|
227
|
+
enabled: zod_1.z.boolean(),
|
|
228
|
+
createdAt: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
|
|
229
|
+
invocation: core_1.FunctionInvocationType.optional(),
|
|
230
|
+
priority: zod_1.z.number().optional(),
|
|
231
|
+
onError: core_1.OnErrorBehavior.optional(),
|
|
232
|
+
description: zod_1.z.string().optional(),
|
|
233
|
+
});
|
|
234
|
+
// Component list item schema for CLI display
|
|
235
|
+
exports.ComponentListItemSchema = zod_1.z.object({
|
|
236
|
+
id: zod_1.z.string(),
|
|
237
|
+
name: zod_1.z.string(),
|
|
238
|
+
slot: core_1.ComponentSlot,
|
|
239
|
+
version: zod_1.z.string().optional(),
|
|
240
|
+
enabled: zod_1.z.boolean(),
|
|
241
|
+
createdAt: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
|
|
242
|
+
description: zod_1.z.string().optional(),
|
|
243
|
+
});
|
|
244
|
+
// Build status schema
|
|
245
|
+
exports.BuildStatusSchema = zod_1.z.object({
|
|
246
|
+
id: zod_1.z.string(),
|
|
247
|
+
status: core_1.BuildStatus,
|
|
248
|
+
startTime: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
|
|
249
|
+
endTime: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]).optional(),
|
|
250
|
+
deploymentUrl: zod_1.z.string().optional(),
|
|
251
|
+
artifactLocation: zod_1.z.string().optional(),
|
|
252
|
+
logs: zod_1.z.string().optional(),
|
|
253
|
+
error: zod_1.z.string().optional(),
|
|
254
|
+
resourceId: zod_1.z.string(),
|
|
255
|
+
resourceType: zod_1.z.enum(["component", "function"]),
|
|
256
|
+
});
|
|
257
|
+
// Version list item schema for CLI display
|
|
258
|
+
exports.VersionListItemSchema = zod_1.z.object({
|
|
259
|
+
id: zod_1.z.string(),
|
|
260
|
+
name: zod_1.z.string(),
|
|
261
|
+
template: zod_1.z.string().nullable().optional(),
|
|
262
|
+
active: zod_1.z.boolean(),
|
|
263
|
+
default: zod_1.z.boolean(),
|
|
264
|
+
createdAt: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
|
|
265
|
+
updatedAt: zod_1.z.union([zod_1.z.string(), zod_1.z.date()]),
|
|
266
|
+
storeId: zod_1.z.string(),
|
|
267
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared type definitions for the CLI package
|
|
3
|
+
*/
|
|
4
|
+
import type { Ora } from "ora";
|
|
5
|
+
/**
|
|
6
|
+
* CLI Error types
|
|
7
|
+
*/
|
|
8
|
+
export interface CLIError extends Error {
|
|
9
|
+
code?: string;
|
|
10
|
+
context?: ErrorContext;
|
|
11
|
+
}
|
|
12
|
+
export interface NodeError extends Error {
|
|
13
|
+
code: string;
|
|
14
|
+
errno?: number;
|
|
15
|
+
syscall?: string;
|
|
16
|
+
path?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ErrorContext {
|
|
19
|
+
command?: string;
|
|
20
|
+
file?: string;
|
|
21
|
+
input?: string;
|
|
22
|
+
attemptedCommand?: string;
|
|
23
|
+
path?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Progress and spinner types
|
|
27
|
+
*/
|
|
28
|
+
export type Spinner = Ora;
|
|
29
|
+
/**
|
|
30
|
+
* Command handler types
|
|
31
|
+
*/
|
|
32
|
+
export type CommandHandler<T = unknown> = (options: T, console: typeof import("../utils/console").console) => Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Build progress types
|
|
35
|
+
*/
|
|
36
|
+
export interface BuildProgressPayload {
|
|
37
|
+
emoji?: string;
|
|
38
|
+
step?: string;
|
|
39
|
+
message?: string;
|
|
40
|
+
startTime?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* CLI Progress bar options
|
|
44
|
+
*/
|
|
45
|
+
export interface ProgressBarOptions {
|
|
46
|
+
barCompleteString: string;
|
|
47
|
+
barIncompleteString: string;
|
|
48
|
+
barsize: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Progress bar params from cli-progress
|
|
52
|
+
*/
|
|
53
|
+
export interface ProgressParams {
|
|
54
|
+
progress: number;
|
|
55
|
+
value: number;
|
|
56
|
+
total: number;
|
|
57
|
+
eta: number;
|
|
58
|
+
startTime: number;
|
|
59
|
+
stopTime: number | null;
|
|
60
|
+
duration: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Progress bar payload that can contain custom data
|
|
64
|
+
*/
|
|
65
|
+
export interface ProgressPayload {
|
|
66
|
+
emoji?: string;
|
|
67
|
+
step?: string;
|
|
68
|
+
message?: string;
|
|
69
|
+
startTime?: number;
|
|
70
|
+
[key: string]: unknown;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Generic formatter for progress bars
|
|
74
|
+
* Matches cli-progress GenericFormatter interface
|
|
75
|
+
*/
|
|
76
|
+
export type ProgressFormatter = (options: {
|
|
77
|
+
barCompleteString?: string;
|
|
78
|
+
barIncompleteString?: string;
|
|
79
|
+
barsize?: number;
|
|
80
|
+
[key: string]: unknown;
|
|
81
|
+
}, params: ProgressParams, payload: ProgressPayload) => string;
|
|
82
|
+
/**
|
|
83
|
+
* Interactive command types
|
|
84
|
+
*/
|
|
85
|
+
export interface InteractiveChoice {
|
|
86
|
+
name: string;
|
|
87
|
+
value: string;
|
|
88
|
+
short?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mock data types for development
|
|
92
|
+
*/
|
|
93
|
+
export interface MockComponent {
|
|
94
|
+
id: string;
|
|
95
|
+
name: string;
|
|
96
|
+
slot: string;
|
|
97
|
+
version: string;
|
|
98
|
+
enabled: boolean;
|
|
99
|
+
createdAt: string;
|
|
100
|
+
type?: string;
|
|
101
|
+
description?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface MockFunction {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
runtime?: string;
|
|
107
|
+
version?: string;
|
|
108
|
+
enabled: boolean;
|
|
109
|
+
createdAt: string;
|
|
110
|
+
event?: string;
|
|
111
|
+
timing?: string;
|
|
112
|
+
description?: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* CLI Error with exit code for process control
|
|
116
|
+
*/
|
|
117
|
+
export interface CLIError extends Error {
|
|
118
|
+
exitCode?: number;
|
|
119
|
+
isValidationError?: boolean;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Type guards
|
|
123
|
+
*/
|
|
124
|
+
export declare function isNodeError(error: unknown): error is NodeError;
|
|
125
|
+
export declare function isCLIError(error: unknown): error is CLIError;
|
|
126
|
+
/**
|
|
127
|
+
* Command option types without index signatures
|
|
128
|
+
*/
|
|
129
|
+
export interface BaseCommandOptions {
|
|
130
|
+
verbose?: boolean;
|
|
131
|
+
quiet?: boolean;
|
|
132
|
+
debug?: boolean;
|
|
133
|
+
}
|
|
134
|
+
export interface PathCommandOptions extends BaseCommandOptions {
|
|
135
|
+
path?: string;
|
|
136
|
+
}
|
|
137
|
+
export interface WatchCommandOptions extends PathCommandOptions {
|
|
138
|
+
watch?: boolean;
|
|
139
|
+
}
|
|
140
|
+
export interface BuildCommandOptions extends WatchCommandOptions {
|
|
141
|
+
minify?: boolean;
|
|
142
|
+
sourcemap?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface DeployCommandOptions extends PathCommandOptions {
|
|
145
|
+
wait?: boolean;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isNodeError = isNodeError;
|
|
7
|
+
exports.isCLIError = isCLIError;
|
|
8
|
+
/**
|
|
9
|
+
* Type guards
|
|
10
|
+
*/
|
|
11
|
+
function isNodeError(error) {
|
|
12
|
+
return (error instanceof Error &&
|
|
13
|
+
"code" in error &&
|
|
14
|
+
typeof error.code === "string");
|
|
15
|
+
}
|
|
16
|
+
function isCLIError(error) {
|
|
17
|
+
return error instanceof Error && "context" in error;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAyBA,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAezE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCurrentUser = getCurrentUser;
|
|
7
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
8
|
+
const node_os_1 = require("node:os");
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const jwt_decode_1 = require("jwt-decode");
|
|
11
|
+
const CREDENTIALS_PATH = node_path_1.default.join((0, node_os_1.homedir)(), ".ollie-shop", "credentials.json");
|
|
12
|
+
async function getCurrentUser() {
|
|
13
|
+
try {
|
|
14
|
+
const raw = await promises_1.default.readFile(CREDENTIALS_PATH, "utf-8");
|
|
15
|
+
const token = JSON.parse(raw);
|
|
16
|
+
if (!token.accessToken)
|
|
17
|
+
return null;
|
|
18
|
+
const decoded = (0, jwt_decode_1.jwtDecode)(token.accessToken);
|
|
19
|
+
return {
|
|
20
|
+
email: decoded.email,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BuildProgress } from "@ollie-shop/core";
|
|
2
|
+
export declare class CLIProgressReporter {
|
|
3
|
+
private bar;
|
|
4
|
+
constructor();
|
|
5
|
+
start(): void;
|
|
6
|
+
updateProgress(progress: BuildProgress): void;
|
|
7
|
+
stop(success: boolean): void;
|
|
8
|
+
private formatPhase;
|
|
9
|
+
private formatETA;
|
|
10
|
+
}
|
|
11
|
+
export declare function createCLIProgressReporter(): CLIProgressReporter;
|
|
12
|
+
//# sourceMappingURL=cli-progress-reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-progress-reporter.d.ts","sourceRoot":"","sources":["../../src/utils/cli-progress-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAiBtD,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAwB;;IAanC,KAAK,IAAI,IAAI;IAOb,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAU7C,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAc5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,SAAS;CAalB;AAED,wBAAgB,yBAAyB,IAAI,mBAAmB,CAE/D"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CLIProgressReporter = void 0;
|
|
7
|
+
exports.createCLIProgressReporter = createCLIProgressReporter;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const cli_progress_1 = __importDefault(require("cli-progress"));
|
|
10
|
+
const PHASE_DISPLAY_NAMES = {
|
|
11
|
+
SUBMITTED: "Queued",
|
|
12
|
+
PROVISIONING: "Setting up",
|
|
13
|
+
DOWNLOAD_SOURCE: "Downloading",
|
|
14
|
+
INSTALL: "Installing deps",
|
|
15
|
+
PRE_BUILD: "Preparing",
|
|
16
|
+
BUILD: "Building",
|
|
17
|
+
POST_BUILD: "Finalizing",
|
|
18
|
+
UPLOAD_ARTIFACTS: "Uploading",
|
|
19
|
+
FINALIZING: "Completing",
|
|
20
|
+
COMPLETED: "Done",
|
|
21
|
+
};
|
|
22
|
+
class CLIProgressReporter {
|
|
23
|
+
constructor() {
|
|
24
|
+
this.bar = new cli_progress_1.default.SingleBar({
|
|
25
|
+
format: `Building |${chalk_1.default.cyan("{bar}")}| {percentage}% | {phase} | ETA: {eta_formatted}`,
|
|
26
|
+
barCompleteChar: "\u2588",
|
|
27
|
+
barIncompleteChar: "\u2591",
|
|
28
|
+
hideCursor: true,
|
|
29
|
+
stopOnComplete: false,
|
|
30
|
+
clearOnComplete: false,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
start() {
|
|
34
|
+
this.bar.start(100, 0, {
|
|
35
|
+
phase: "Initializing",
|
|
36
|
+
eta_formatted: "calculating...",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
updateProgress(progress) {
|
|
40
|
+
const phaseDisplay = this.formatPhase(progress.currentPhase);
|
|
41
|
+
const etaFormatted = this.formatETA(progress.estimatedRemainingSeconds);
|
|
42
|
+
this.bar.update(progress.percentComplete, {
|
|
43
|
+
phase: phaseDisplay,
|
|
44
|
+
eta_formatted: etaFormatted,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
stop(success) {
|
|
48
|
+
this.bar.stop();
|
|
49
|
+
// Clear the line and show final status
|
|
50
|
+
process.stdout.clearLine(0);
|
|
51
|
+
process.stdout.cursorTo(0);
|
|
52
|
+
if (success) {
|
|
53
|
+
console.log(chalk_1.default.green("✓ Build completed successfully!"));
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log(chalk_1.default.red("✗ Build failed"));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
formatPhase(phase) {
|
|
60
|
+
return PHASE_DISPLAY_NAMES[phase] || phase;
|
|
61
|
+
}
|
|
62
|
+
formatETA(seconds) {
|
|
63
|
+
if (seconds <= 0) {
|
|
64
|
+
return "completing...";
|
|
65
|
+
}
|
|
66
|
+
if (seconds < 60) {
|
|
67
|
+
return `${Math.ceil(seconds)}s`;
|
|
68
|
+
}
|
|
69
|
+
const minutes = Math.floor(seconds / 60);
|
|
70
|
+
const remainingSeconds = Math.ceil(seconds % 60);
|
|
71
|
+
return `${minutes}m ${remainingSeconds}s`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.CLIProgressReporter = CLIProgressReporter;
|
|
75
|
+
function createCLIProgressReporter() {
|
|
76
|
+
return new CLIProgressReporter();
|
|
77
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { CommandHandler } from "../types";
|
|
4
|
+
import type { EnhancedOption } from "./command-parser";
|
|
5
|
+
export interface CommandConfig<T = unknown> {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
aliases?: string[];
|
|
9
|
+
options?: EnhancedOption[];
|
|
10
|
+
schema?: z.ZodSchema<T>;
|
|
11
|
+
examples?: Array<{
|
|
12
|
+
description: string;
|
|
13
|
+
command: string;
|
|
14
|
+
}>;
|
|
15
|
+
handler: CommandHandler<T>;
|
|
16
|
+
}
|
|
17
|
+
export declare function buildCommand<T = unknown>(parent: Command, config: CommandConfig<T>): Command;
|
|
18
|
+
/**
|
|
19
|
+
* Build a command group (like "component" or "function")
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildCommandGroup(program: Command, name: string, description: string, aliases?: string[]): Command;
|
|
22
|
+
//# sourceMappingURL=command-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-builder.d.ts","sourceRoot":"","sources":["../../src/utils/command-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAY,cAAc,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAQvD,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,OAAO;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC,CAAC;IACH,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC;CAC5B;AA6ED,wBAAgB,YAAY,CAAC,CAAC,GAAG,OAAO,EACtC,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GACvB,OAAO,CA6BT;AA6LD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,OAAO,CAgBT"}
|