@ollie-shop/cli 0.1.3 → 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.
Files changed (181) hide show
  1. package/.turbo/turbo-build.log +2 -11
  2. package/CHANGELOG.md +17 -5
  3. package/CLAUDE_CLI.md +265 -0
  4. package/README.md +704 -8
  5. package/__tests__/mocks/console.ts +22 -0
  6. package/__tests__/mocks/core.ts +137 -0
  7. package/__tests__/mocks/index.ts +4 -0
  8. package/__tests__/mocks/inquirer.ts +16 -0
  9. package/__tests__/mocks/progress.ts +19 -0
  10. package/dist/__tests__/helpers/cli-test-helper.d.ts +89 -0
  11. package/dist/__tests__/helpers/cli-test-helper.d.ts.map +1 -0
  12. package/dist/__tests__/helpers/cli-test-helper.js +220 -0
  13. package/dist/__tests__/mocks/index.d.ts +69 -0
  14. package/dist/__tests__/mocks/index.d.ts.map +1 -0
  15. package/dist/__tests__/mocks/index.js +77 -0
  16. package/dist/actions/component.actions.d.ts +14 -0
  17. package/dist/actions/component.actions.d.ts.map +1 -0
  18. package/dist/actions/component.actions.js +273 -0
  19. package/dist/actions/function.actions.d.ts +15 -0
  20. package/dist/actions/function.actions.d.ts.map +1 -0
  21. package/dist/actions/function.actions.js +254 -0
  22. package/dist/actions/project.actions.d.ts +17 -0
  23. package/dist/actions/project.actions.d.ts.map +1 -0
  24. package/dist/actions/project.actions.js +97 -0
  25. package/dist/actions/version.actions.d.ts +19 -0
  26. package/dist/actions/version.actions.d.ts.map +1 -0
  27. package/dist/actions/version.actions.js +216 -0
  28. package/dist/commands/component.d.ts +3 -0
  29. package/dist/commands/component.d.ts.map +1 -0
  30. package/dist/commands/component.js +192 -0
  31. package/dist/commands/docs.d.ts +3 -0
  32. package/dist/commands/docs.d.ts.map +1 -0
  33. package/dist/commands/docs.js +16 -0
  34. package/dist/commands/function.d.ts +3 -0
  35. package/dist/commands/function.d.ts.map +1 -0
  36. package/dist/commands/function.js +243 -0
  37. package/dist/commands/help.d.ts +3 -0
  38. package/dist/commands/help.d.ts.map +1 -0
  39. package/dist/commands/help.js +20 -0
  40. package/dist/commands/index.d.ts +3 -0
  41. package/dist/commands/index.d.ts.map +1 -0
  42. package/dist/commands/index.js +26 -0
  43. package/dist/commands/login.d.ts +3 -0
  44. package/dist/commands/login.d.ts.map +1 -0
  45. package/dist/commands/login.js +175 -0
  46. package/dist/commands/project.d.ts +3 -0
  47. package/dist/commands/project.d.ts.map +1 -0
  48. package/dist/commands/project.js +78 -0
  49. package/dist/commands/store-version.d.ts +3 -0
  50. package/dist/commands/store-version.d.ts.map +1 -0
  51. package/dist/commands/store-version.js +241 -0
  52. package/dist/commands/version.d.ts +3 -0
  53. package/dist/commands/version.d.ts.map +1 -0
  54. package/dist/commands/version.js +46 -0
  55. package/dist/commands/whoami.d.ts +3 -0
  56. package/dist/commands/whoami.d.ts.map +1 -0
  57. package/dist/commands/whoami.js +41 -0
  58. package/dist/index.d.ts +3 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +93 -226
  61. package/dist/prompts/component.prompts.d.ts +14 -0
  62. package/dist/prompts/component.prompts.d.ts.map +1 -0
  63. package/dist/prompts/component.prompts.js +75 -0
  64. package/dist/prompts/function.prompts.d.ts +21 -0
  65. package/dist/prompts/function.prompts.d.ts.map +1 -0
  66. package/dist/prompts/function.prompts.js +127 -0
  67. package/dist/schemas/command.schema.d.ts +516 -0
  68. package/dist/schemas/command.schema.d.ts.map +1 -0
  69. package/dist/schemas/command.schema.js +267 -0
  70. package/dist/types/index.d.ts +147 -0
  71. package/dist/types/index.d.ts.map +1 -0
  72. package/dist/types/index.js +18 -0
  73. package/dist/utils/auth.d.ts +4 -0
  74. package/dist/utils/auth.d.ts.map +1 -0
  75. package/dist/utils/auth.js +26 -0
  76. package/dist/utils/cli-progress-reporter.d.ts +12 -0
  77. package/dist/utils/cli-progress-reporter.d.ts.map +1 -0
  78. package/dist/utils/cli-progress-reporter.js +77 -0
  79. package/dist/utils/command-builder.d.ts +22 -0
  80. package/dist/utils/command-builder.d.ts.map +1 -0
  81. package/dist/utils/command-builder.js +268 -0
  82. package/dist/utils/command-helpers.d.ts +19 -0
  83. package/dist/utils/command-helpers.d.ts.map +1 -0
  84. package/dist/utils/command-helpers.js +79 -0
  85. package/dist/utils/command-parser.d.ts +146 -0
  86. package/dist/utils/command-parser.d.ts.map +1 -0
  87. package/dist/utils/command-parser.js +179 -0
  88. package/dist/utils/command-suggestions.d.ts +35 -0
  89. package/dist/utils/command-suggestions.d.ts.map +1 -0
  90. package/dist/utils/command-suggestions.js +152 -0
  91. package/dist/utils/console.d.ts +44 -0
  92. package/dist/utils/console.d.ts.map +1 -0
  93. package/dist/utils/console.js +233 -0
  94. package/dist/utils/constants.d.ts +8 -0
  95. package/dist/utils/constants.d.ts.map +1 -0
  96. package/dist/utils/constants.js +10 -0
  97. package/dist/utils/context-detector.d.ts +12 -0
  98. package/dist/utils/context-detector.d.ts.map +1 -0
  99. package/dist/utils/context-detector.js +155 -0
  100. package/dist/utils/enhanced-error-handler.d.ts +47 -0
  101. package/dist/utils/enhanced-error-handler.d.ts.map +1 -0
  102. package/dist/utils/enhanced-error-handler.js +221 -0
  103. package/dist/utils/error-handler.d.ts +3 -0
  104. package/dist/utils/error-handler.d.ts.map +1 -0
  105. package/dist/utils/error-handler.js +55 -0
  106. package/dist/utils/errors.d.ts +44 -0
  107. package/dist/utils/errors.d.ts.map +1 -0
  108. package/dist/utils/errors.js +76 -0
  109. package/dist/utils/interactive-builder.d.ts +22 -0
  110. package/dist/utils/interactive-builder.d.ts.map +1 -0
  111. package/dist/utils/interactive-builder.js +246 -0
  112. package/dist/utils/rich-progress.d.ts +59 -0
  113. package/dist/utils/rich-progress.d.ts.map +1 -0
  114. package/dist/utils/rich-progress.js +234 -0
  115. package/dist/utils/store.d.ts +11 -0
  116. package/dist/utils/store.d.ts.map +1 -0
  117. package/dist/utils/store.js +19 -0
  118. package/dist/utils/validation-error-formatter.d.ts +25 -0
  119. package/dist/utils/validation-error-formatter.d.ts.map +1 -0
  120. package/dist/utils/validation-error-formatter.js +258 -0
  121. package/dist/utils/validation-helpers.d.ts +60 -0
  122. package/dist/utils/validation-helpers.d.ts.map +1 -0
  123. package/dist/utils/validation-helpers.js +152 -0
  124. package/package.json +44 -9
  125. package/src/__tests__/helpers/cli-test-helper.ts +281 -0
  126. package/src/__tests__/mocks/index.ts +142 -0
  127. package/src/actions/component.actions.ts +334 -0
  128. package/src/actions/function.actions.ts +313 -0
  129. package/src/actions/project.actions.ts +126 -0
  130. package/src/actions/version.actions.ts +233 -0
  131. package/src/commands/__tests__/component-validation.test.ts +250 -0
  132. package/src/commands/__tests__/component.test.ts +321 -0
  133. package/src/commands/__tests__/function-validation.test.ts +220 -0
  134. package/src/commands/__tests__/function.test.ts +286 -0
  135. package/src/commands/__tests__/store-version-validation.test.ts +414 -0
  136. package/src/commands/__tests__/store-version.test.ts +405 -0
  137. package/src/commands/__tests__/version.test.ts +71 -0
  138. package/src/commands/component.ts +188 -0
  139. package/src/commands/docs.ts +24 -0
  140. package/src/commands/function.ts +252 -0
  141. package/src/commands/help.ts +18 -0
  142. package/src/commands/index.ts +21 -7
  143. package/src/commands/login.ts +19 -79
  144. package/src/commands/project.ts +107 -0
  145. package/src/commands/store-version.ts +242 -0
  146. package/src/commands/version.ts +51 -0
  147. package/src/commands/whoami.ts +46 -0
  148. package/src/index.ts +110 -15
  149. package/src/prompts/component.prompts.ts +94 -0
  150. package/src/prompts/function.prompts.ts +168 -0
  151. package/src/schemas/command.schema.ts +354 -0
  152. package/src/types/index.ts +183 -0
  153. package/src/utils/__tests__/command-parser.test.ts +159 -0
  154. package/src/utils/__tests__/command-suggestions.test.ts +185 -0
  155. package/src/utils/__tests__/console.test.ts +192 -0
  156. package/src/utils/__tests__/context-detector.test.ts +258 -0
  157. package/src/utils/__tests__/enhanced-error-handler.test.ts +137 -0
  158. package/src/utils/__tests__/error-handler.test.ts +107 -0
  159. package/src/utils/__tests__/rich-progress.test.ts +170 -0
  160. package/src/utils/__tests__/validation-error-formatter.test.ts +175 -0
  161. package/src/utils/__tests__/validation-helpers.test.ts +125 -0
  162. package/src/utils/auth.ts +41 -0
  163. package/src/utils/cli-progress-reporter.ts +84 -0
  164. package/src/utils/command-builder.ts +390 -0
  165. package/src/utils/command-helpers.ts +83 -0
  166. package/src/utils/command-parser.ts +250 -0
  167. package/src/utils/command-suggestions.ts +176 -0
  168. package/src/utils/console.ts +291 -0
  169. package/src/utils/context-detector.ts +177 -0
  170. package/src/utils/enhanced-error-handler.ts +264 -0
  171. package/src/utils/error-handler.ts +60 -0
  172. package/src/utils/errors.ts +125 -0
  173. package/src/utils/interactive-builder.ts +271 -0
  174. package/src/utils/rich-progress.ts +320 -0
  175. package/src/utils/store.ts +23 -0
  176. package/src/utils/validation-error-formatter.ts +337 -0
  177. package/src/utils/validation-helpers.ts +192 -0
  178. package/tsconfig.json +13 -7
  179. package/vitest.config.ts +28 -0
  180. package/vitest.setup.ts +29 -0
  181. package/tsup.config.ts +0 -15
@@ -0,0 +1,19 @@
1
+ interface CreateOptions {
2
+ store: string;
3
+ name: string;
4
+ template?: string;
5
+ active?: boolean;
6
+ }
7
+ interface ListOptions {
8
+ store: string;
9
+ }
10
+ export declare function create(options: CreateOptions): Promise<void>;
11
+ export declare function list(options: ListOptions): Promise<void>;
12
+ export declare function get(versionId: string): Promise<void>;
13
+ export declare function setDefault(versionId: string): Promise<void>;
14
+ export declare function activate(versionId: string): Promise<void>;
15
+ export declare function deactivate(versionId: string): Promise<void>;
16
+ export declare function clone(sourceId: string, name: string): Promise<void>;
17
+ export declare function deleteVersion(versionId: string, force?: boolean): Promise<void>;
18
+ export {};
19
+ //# sourceMappingURL=version.actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.actions.d.ts","sourceRoot":"","sources":["../../src/actions/version.actions.ts"],"names":[],"mappings":"AAKA,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAgClE;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC9D;AAED,wBAAsB,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsC1D;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED,wBAAsB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB/D;AAED,wBAAsB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAejE;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBzE;AAED,wBAAsB,aAAa,CACjC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAuBf"}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.create = create;
37
+ exports.list = list;
38
+ exports.get = get;
39
+ exports.setDefault = setDefault;
40
+ exports.activate = activate;
41
+ exports.deactivate = deactivate;
42
+ exports.clone = clone;
43
+ exports.deleteVersion = deleteVersion;
44
+ const core = __importStar(require("@ollie-shop/core"));
45
+ const console_1 = require("../utils/console");
46
+ const error_handler_1 = require("../utils/error-handler");
47
+ async function create(options) {
48
+ const spinner = console_1.console.spinner("Creating version...");
49
+ try {
50
+ const version = await core.createVersion({
51
+ storeId: options.store,
52
+ name: options.name,
53
+ template: options.template || "default",
54
+ active: options.active ?? true,
55
+ });
56
+ spinner.succeed(`Version "${version.name}" created successfully`);
57
+ console_1.console.info("\nVersion details:");
58
+ console_1.console.table([
59
+ {
60
+ ID: version.id,
61
+ Name: version.name,
62
+ Template: version.template || "default",
63
+ Active: version.active ? "✓" : "✗",
64
+ Default: version.default ? "✓" : "✗",
65
+ },
66
+ ]);
67
+ if (!version.active) {
68
+ console_1.console.dim("\nNote: This version is inactive. Activate it with:");
69
+ console_1.console.dim(` ollieshop version activate ${version.id}`);
70
+ }
71
+ }
72
+ catch (error) {
73
+ spinner.fail("Failed to create version");
74
+ (0, error_handler_1.handleError)(error);
75
+ }
76
+ }
77
+ async function list(options) {
78
+ const spinner = console_1.console.spinner("Loading versions...");
79
+ try {
80
+ const versions = await core.listVersions(options.store);
81
+ spinner.succeed();
82
+ if (versions.length === 0) {
83
+ console_1.console.warn("No versions found for this store");
84
+ console_1.console.dim("\nCreate a version with:");
85
+ console_1.console.dim(` ollieshop version create --store ${options.store} --name "My Version"`);
86
+ return;
87
+ }
88
+ console_1.console.info(`Found ${versions.length} version${versions.length === 1 ? "" : "s"}:\n`);
89
+ console_1.console.table(versions.map((v) => ({
90
+ ID: v.id,
91
+ Name: v.name,
92
+ Template: v.template || "default",
93
+ Active: v.active ? "✓" : "✗",
94
+ Default: v.default ? "✓" : "✗",
95
+ Created: new Date(v.createdAt).toLocaleDateString(),
96
+ })));
97
+ }
98
+ catch (error) {
99
+ spinner.fail("Failed to list versions");
100
+ (0, error_handler_1.handleError)(error);
101
+ }
102
+ }
103
+ async function get(versionId) {
104
+ const spinner = console_1.console.spinner("Loading version...");
105
+ try {
106
+ const version = await core.getVersion(versionId);
107
+ spinner.succeed();
108
+ console_1.console.info("Version details:\n");
109
+ const details = {
110
+ ID: version.id,
111
+ Name: version.name,
112
+ "Store ID": version.storeId,
113
+ Template: version.template || "default",
114
+ Active: version.active ? "Yes" : "No",
115
+ Default: version.default ? "Yes" : "No",
116
+ Created: new Date(version.createdAt).toLocaleString(),
117
+ Updated: new Date(version.updatedAt).toLocaleString(),
118
+ };
119
+ for (const [key, value] of Object.entries(details)) {
120
+ console_1.console.log(`${console_1.console.bold(`${key}:`)} ${value}`);
121
+ }
122
+ if (version.theme) {
123
+ console_1.console.info("\nTheme configuration:");
124
+ console_1.console.json(version.theme);
125
+ }
126
+ if (version.props) {
127
+ console_1.console.info("\nProps configuration:");
128
+ console_1.console.json(version.props);
129
+ }
130
+ }
131
+ catch (error) {
132
+ spinner.fail("Failed to get version");
133
+ (0, error_handler_1.handleError)(error);
134
+ }
135
+ }
136
+ async function setDefault(versionId) {
137
+ const spinner = console_1.console.spinner("Setting default version...");
138
+ try {
139
+ await core.setDefaultVersion(versionId);
140
+ spinner.succeed("Version set as default successfully");
141
+ console_1.console.dim("\nThis version will now be used for all new checkout sessions.");
142
+ }
143
+ catch (error) {
144
+ spinner.fail("Failed to set default version");
145
+ (0, error_handler_1.handleError)(error);
146
+ }
147
+ }
148
+ async function activate(versionId) {
149
+ const spinner = console_1.console.spinner("Activating version...");
150
+ try {
151
+ const version = await core.activateVersion(versionId);
152
+ spinner.succeed(`Version "${version.name}" activated successfully`);
153
+ if (!version.default) {
154
+ console_1.console.dim("\nTo make this the default version, run:");
155
+ console_1.console.dim(` ollieshop version set-default ${versionId}`);
156
+ }
157
+ }
158
+ catch (error) {
159
+ spinner.fail("Failed to activate version");
160
+ (0, error_handler_1.handleError)(error);
161
+ }
162
+ }
163
+ async function deactivate(versionId) {
164
+ const spinner = console_1.console.spinner("Deactivating version...");
165
+ try {
166
+ const version = await core.deactivateVersion(versionId);
167
+ spinner.succeed(`Version "${version.name}" deactivated successfully`);
168
+ console_1.console.warn("\nWarning: This version can no longer be used for checkout sessions.");
169
+ }
170
+ catch (error) {
171
+ spinner.fail("Failed to deactivate version");
172
+ (0, error_handler_1.handleError)(error);
173
+ }
174
+ }
175
+ async function clone(sourceId, name) {
176
+ const spinner = console_1.console.spinner("Cloning version...");
177
+ try {
178
+ const newVersion = await core.cloneVersion(sourceId, name);
179
+ spinner.succeed(`Version cloned successfully as "${newVersion.name}"`);
180
+ console_1.console.info("\nCloned version details:");
181
+ console_1.console.table([
182
+ {
183
+ ID: newVersion.id,
184
+ Name: newVersion.name,
185
+ Template: newVersion.template || "default",
186
+ Active: newVersion.active ? "✓" : "✗",
187
+ Default: newVersion.default ? "✓" : "✗",
188
+ },
189
+ ]);
190
+ console_1.console.dim("\nNote: The cloned version is inactive. To activate it:");
191
+ console_1.console.dim(` ollieshop version activate ${newVersion.id}`);
192
+ }
193
+ catch (error) {
194
+ spinner.fail("Failed to clone version");
195
+ (0, error_handler_1.handleError)(error);
196
+ }
197
+ }
198
+ async function deleteVersion(versionId, force) {
199
+ // Confirm deletion if not forced
200
+ if (!force) {
201
+ const confirmed = await console_1.console.confirm("Are you sure you want to delete this version? This action cannot be undone.");
202
+ if (!confirmed) {
203
+ console_1.console.info("Deletion cancelled");
204
+ return;
205
+ }
206
+ }
207
+ const spinner = console_1.console.spinner("Deleting version...");
208
+ try {
209
+ await core.deleteVersion(versionId);
210
+ spinner.succeed("Version deleted successfully");
211
+ }
212
+ catch (error) {
213
+ spinner.fail("Failed to delete version");
214
+ (0, error_handler_1.handleError)(error);
215
+ }
216
+ }
@@ -0,0 +1,3 @@
1
+ import type { Command } from "@commander-js/extra-typings";
2
+ export declare function registerComponentCommands(program: Command): void;
3
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/commands/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAa3D,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8KhE"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.registerComponentCommands = registerComponentCommands;
37
+ const componentActions = __importStar(require("../actions/component.actions"));
38
+ const command_schema_1 = require("../schemas/command.schema");
39
+ const command_builder_1 = require("../utils/command-builder");
40
+ const command_parser_1 = require("../utils/command-parser");
41
+ function registerComponentCommands(program) {
42
+ const cmd = (0, command_builder_1.buildCommandGroup)(program, "component", "Manage Ollie Shop components", ["comp"]);
43
+ // Create component command
44
+ (0, command_builder_1.buildCommand)(cmd, {
45
+ name: "create",
46
+ description: "Create a new component",
47
+ options: [
48
+ command_parser_1.COMMON_OPTIONS.componentName,
49
+ command_parser_1.COMMON_OPTIONS.componentSlot,
50
+ command_parser_1.COMMON_OPTIONS.tests,
51
+ command_parser_1.COMMON_OPTIONS.noTests,
52
+ {
53
+ flags: "-i, --interactive",
54
+ description: "Use interactive mode",
55
+ defaultValue: false,
56
+ },
57
+ ],
58
+ schema: command_schema_1.ComponentCreateOptionsSchema,
59
+ examples: [
60
+ {
61
+ description: "Create a header component",
62
+ command: "ollieshop component create --name header --slot header",
63
+ },
64
+ {
65
+ description: "Create a component with TypeScript",
66
+ command: "ollieshop component create --name product-list --typescript",
67
+ },
68
+ {
69
+ description: "Interactive mode",
70
+ command: "ollieshop component create --interactive",
71
+ },
72
+ {
73
+ description: "Create with tests",
74
+ command: "ollieshop component create --name product-list",
75
+ },
76
+ ],
77
+ handler: async (options, console) => {
78
+ // Use interactive mode if requested
79
+ if ("interactive" in options && options.interactive) {
80
+ const { runInteractiveCommand } = await import("../utils/interactive-builder.js");
81
+ await runInteractiveCommand("component-create", console);
82
+ return;
83
+ }
84
+ await componentActions.createComponent(options, console);
85
+ },
86
+ });
87
+ // Validate component command
88
+ (0, command_builder_1.buildCommand)(cmd, {
89
+ name: "validate",
90
+ description: "Validate a component",
91
+ options: [command_parser_1.COMMON_OPTIONS.path],
92
+ schema: command_schema_1.ComponentValidateOptionsSchema,
93
+ examples: [
94
+ {
95
+ description: "Validate current directory",
96
+ command: "ollieshop component validate",
97
+ },
98
+ {
99
+ description: "Validate specific component",
100
+ command: "ollieshop component validate --path ./components/header",
101
+ },
102
+ ],
103
+ handler: async (options, console) => {
104
+ await componentActions.validateComponent({
105
+ path: options.path || process.cwd(),
106
+ strict: options.strict ?? false,
107
+ fix: options.fix ?? false,
108
+ }, console);
109
+ },
110
+ });
111
+ // Build component command
112
+ (0, command_builder_1.buildCommand)(cmd, {
113
+ name: "build",
114
+ description: "Build a component",
115
+ options: [command_parser_1.COMMON_OPTIONS.path, command_parser_1.COMMON_OPTIONS.watch],
116
+ schema: command_schema_1.ComponentBuildOptionsSchema,
117
+ examples: [
118
+ {
119
+ description: "Build current directory",
120
+ command: "ollieshop component build",
121
+ },
122
+ {
123
+ description: "Build specific component",
124
+ command: "ollieshop component build --path ./components/header",
125
+ },
126
+ {
127
+ description: "Build with watch mode",
128
+ command: "ollieshop component build --watch",
129
+ },
130
+ ],
131
+ handler: async (options, console) => {
132
+ await componentActions.buildComponent({
133
+ path: options.path || process.cwd(),
134
+ watch: options.watch ?? false,
135
+ }, console);
136
+ },
137
+ });
138
+ // Deploy component command
139
+ (0, command_builder_1.buildCommand)(cmd, {
140
+ name: "deploy",
141
+ description: "Deploy a component",
142
+ options: [
143
+ {
144
+ flags: "--id <id>",
145
+ description: "Component ID",
146
+ required: true,
147
+ },
148
+ command_parser_1.COMMON_OPTIONS.path,
149
+ {
150
+ flags: "--wait",
151
+ description: "Wait for deployment to complete",
152
+ defaultValue: false,
153
+ },
154
+ ],
155
+ schema: command_schema_1.ComponentDeployOptionsSchema,
156
+ examples: [
157
+ {
158
+ description: "Deploy a component",
159
+ command: "ollieshop component deploy --id comp-123",
160
+ },
161
+ {
162
+ description: "Deploy and wait for completion",
163
+ command: "ollieshop component deploy --id comp-123 --wait",
164
+ },
165
+ ],
166
+ handler: async (options, console) => {
167
+ // Map id to componentId if provided
168
+ const deployOptions = {
169
+ path: options.path,
170
+ componentId: options.id || options.componentId,
171
+ wait: options.wait,
172
+ };
173
+ await componentActions.deployComponent(deployOptions, console);
174
+ },
175
+ });
176
+ // List components command
177
+ (0, command_builder_1.buildCommand)(cmd, {
178
+ name: "list",
179
+ description: "List all components",
180
+ aliases: ["ls"],
181
+ examples: [
182
+ {
183
+ description: "List all components",
184
+ command: "ollieshop component list",
185
+ },
186
+ ],
187
+ handler: async (_, console) => {
188
+ await componentActions.listComponents(console);
189
+ },
190
+ });
191
+ // Add more commands as needed
192
+ }
@@ -0,0 +1,3 @@
1
+ import type { Command } from "@commander-js/extra-typings";
2
+ export declare function configureDocsCommand(program: Command): void;
3
+ //# sourceMappingURL=docs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoB3D"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configureDocsCommand = configureDocsCommand;
4
+ const console_1 = require("../utils/console");
5
+ function configureDocsCommand(program) {
6
+ program
7
+ .command("docs")
8
+ .description("Show documentation links for Ollie Shop")
9
+ .action(() => {
10
+ console_1.console.info("Ollie Shop Documentation\n");
11
+ console_1.console.info(`${"Main Docs:".padEnd(20)} https://docs.ollie.shop/ollie-shop`);
12
+ console_1.console.info(`${"Components:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/component`);
13
+ console_1.console.info(`${"Functions:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/function`);
14
+ console_1.console.info(`${"Versions:".padEnd(20)} https://docs.ollie.shop/ollie-shop/concepts/version\n`);
15
+ });
16
+ }
@@ -0,0 +1,3 @@
1
+ import type { Command } from "@commander-js/extra-typings";
2
+ export declare function registerFunctionCommands(program: Command): void;
3
+ //# sourceMappingURL=function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function.d.ts","sourceRoot":"","sources":["../../src/commands/function.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAa3D,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA8O/D"}