@shopkit/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.
@@ -0,0 +1,273 @@
1
+ import * as picocolors_types from 'picocolors/types';
2
+ import * as readline from 'readline';
3
+ export { join } from 'path';
4
+
5
+ declare const colors: {
6
+ green: picocolors_types.Formatter;
7
+ yellow: picocolors_types.Formatter;
8
+ cyan: picocolors_types.Formatter;
9
+ red: picocolors_types.Formatter;
10
+ dim: picocolors_types.Formatter;
11
+ bold: picocolors_types.Formatter;
12
+ reset: (s: string) => string;
13
+ };
14
+ declare const log: {
15
+ success: (msg: string) => void;
16
+ error: (msg: string) => void;
17
+ warn: (msg: string) => void;
18
+ info: (msg: string) => void;
19
+ step: (msg: string) => void;
20
+ };
21
+
22
+ declare function getReadline(): readline.Interface;
23
+ declare function closeReadline(): void;
24
+ /**
25
+ * Prompt user for text input
26
+ */
27
+ declare function prompt(question: string): Promise<string>;
28
+ /**
29
+ * Prompt user to select from options
30
+ */
31
+ declare function promptSelect(question: string, options: string[]): Promise<string>;
32
+ /**
33
+ * Prompt user for yes/no confirmation
34
+ */
35
+ declare function promptConfirm(question: string, defaultValue?: boolean): Promise<boolean>;
36
+
37
+ /**
38
+ * Get current working directory
39
+ */
40
+ declare function getRoot(): string;
41
+ /**
42
+ * Get themes directory
43
+ */
44
+ declare function getThemesDir(): string;
45
+ /**
46
+ * Get widgets directory
47
+ */
48
+ declare function getWidgetsDir(): string;
49
+ /**
50
+ * Get existing theme names
51
+ */
52
+ declare function getExistingThemes(): string[];
53
+ /**
54
+ * Get existing widget scopes (namespaces)
55
+ */
56
+ declare function getExistingWidgetScopes(): string[];
57
+ /**
58
+ * Get existing widget names across all scopes
59
+ */
60
+ declare function getExistingWidgets(): string[];
61
+ /**
62
+ * Get templates for a specific theme
63
+ */
64
+ declare function getTemplatesForTheme(themeName: string): string[];
65
+ /**
66
+ * Convert PascalCase or camelCase to kebab-case
67
+ */
68
+ declare function toKebabCase(str: string): string;
69
+ /**
70
+ * Check if string is PascalCase
71
+ */
72
+ declare function isPascalCase(str: string): boolean;
73
+ /**
74
+ * Ensure directory exists
75
+ */
76
+ declare function ensureDir(dir: string): void;
77
+ /**
78
+ * Write file with content
79
+ */
80
+ declare function writeFile(path: string, content: string): void;
81
+ /**
82
+ * Read file content
83
+ */
84
+ declare function readFile(path: string): string;
85
+ /**
86
+ * Check if path exists
87
+ */
88
+ declare function exists(path: string): boolean;
89
+ /**
90
+ * Check if path is a directory
91
+ */
92
+ declare function isDirectory(path: string): boolean;
93
+ /**
94
+ * List directory entries
95
+ */
96
+ declare function listDir(dir: string): string[];
97
+
98
+ /**
99
+ * Run a generator script
100
+ */
101
+ declare function runGenerator(type: "widgets" | "templates" | "i18n"): boolean;
102
+ /**
103
+ * Run npm/bun command
104
+ */
105
+ declare function runCommand(command: string, silent?: boolean): boolean;
106
+ /**
107
+ * Get git staged files
108
+ */
109
+ declare function getStagedFiles(): string[];
110
+
111
+ interface WidgetGeneratorArgs {
112
+ name?: string;
113
+ scope?: string;
114
+ skipGenerate?: boolean;
115
+ addToTemplate?: string;
116
+ theme?: string;
117
+ section?: string;
118
+ }
119
+ /**
120
+ * Parse CLI arguments for widget generation
121
+ */
122
+ declare function parseWidgetArgs(): WidgetGeneratorArgs;
123
+ declare function generateIndexTsx(name: string): string;
124
+ declare function generateTypesTs(name: string): string;
125
+ declare function generateVariantsTs(name: string): string;
126
+ declare function generateV1IndexTsx(name: string): string;
127
+ /**
128
+ * Create widget structure
129
+ */
130
+ declare function createWidgetStructure(name: string, scope: string): void;
131
+ /**
132
+ * Main widget generator
133
+ */
134
+ declare function generateWidget(args?: WidgetGeneratorArgs): Promise<void>;
135
+
136
+ interface ThemeGeneratorArgs {
137
+ name?: string;
138
+ lang?: string;
139
+ }
140
+ /**
141
+ * Parse CLI arguments for theme generation
142
+ */
143
+ declare function parseThemeArgs(): ThemeGeneratorArgs;
144
+ /**
145
+ * Main theme generator
146
+ */
147
+ declare function generateTheme(args?: ThemeGeneratorArgs): Promise<void>;
148
+
149
+ interface TemplateGeneratorArgs {
150
+ name?: string;
151
+ theme?: string;
152
+ }
153
+ /**
154
+ * Parse CLI arguments for template generation
155
+ */
156
+ declare function parseTemplateArgs(): TemplateGeneratorArgs;
157
+ /**
158
+ * Main template generator
159
+ */
160
+ declare function generateTemplate(args?: TemplateGeneratorArgs): Promise<void>;
161
+
162
+ interface ValidationError {
163
+ widget: string;
164
+ message: string;
165
+ }
166
+ interface ValidateWidgetOptions {
167
+ stagedOnly?: boolean;
168
+ files?: string[];
169
+ }
170
+ /**
171
+ * Parse CLI arguments for widget validation
172
+ */
173
+ declare function parseValidateWidgetArgs(): ValidateWidgetOptions;
174
+ /**
175
+ * Run widget validation
176
+ */
177
+ declare function runWidgetValidation(options?: ValidateWidgetOptions): Promise<{
178
+ passed: number;
179
+ errors: ValidationError[];
180
+ }>;
181
+ /**
182
+ * CLI entry point for widget validation
183
+ */
184
+ declare function validateWidgets(options?: ValidateWidgetOptions): Promise<void>;
185
+
186
+ interface TemplateValidationError {
187
+ template: string;
188
+ theme: string;
189
+ message: string;
190
+ }
191
+ interface ValidateTemplateOptions {
192
+ theme?: string;
193
+ }
194
+ /**
195
+ * Parse CLI arguments for template validation
196
+ */
197
+ declare function parseValidateTemplateArgs(): ValidateTemplateOptions;
198
+ /**
199
+ * Run template validation
200
+ */
201
+ declare function runTemplateValidation(options?: ValidateTemplateOptions): Promise<{
202
+ passed: number;
203
+ errors: TemplateValidationError[];
204
+ }>;
205
+ /**
206
+ * CLI entry point for template validation
207
+ */
208
+ declare function validateTemplates(options?: ValidateTemplateOptions): Promise<void>;
209
+
210
+ interface ValidateRouteOptions {
211
+ stagedOnly?: boolean;
212
+ files?: string[];
213
+ }
214
+ /**
215
+ * Parse CLI arguments
216
+ */
217
+ declare function parseValidateRouteArgs(): ValidateRouteOptions;
218
+ /**
219
+ * CLI entry point
220
+ */
221
+ declare function validateRoutes(options?: ValidateRouteOptions): Promise<void>;
222
+
223
+ interface ValidateAssetsOptions {
224
+ stagedOnly?: boolean;
225
+ files?: string[];
226
+ }
227
+ declare function parseValidateAssetsArgs(): ValidateAssetsOptions;
228
+ declare function validateAssets(options?: ValidateAssetsOptions): Promise<void>;
229
+
230
+ interface CriticalWidgetIssue {
231
+ file: string;
232
+ widget: string;
233
+ line: number;
234
+ pattern: string;
235
+ message: string;
236
+ }
237
+ declare function runCriticalWidgetValidation(): Promise<{
238
+ passed: boolean;
239
+ issues: CriticalWidgetIssue[];
240
+ checkedFiles: string[];
241
+ }>;
242
+ declare function validateCriticalWidgets(): Promise<void>;
243
+
244
+ interface ScoreWidgetOptions {
245
+ stagedOnly?: boolean;
246
+ files?: string[];
247
+ widget?: string;
248
+ minScore?: number;
249
+ }
250
+ declare function parseScoreWidgetArgs(): ScoreWidgetOptions;
251
+ declare function scoreWidgets(options?: ScoreWidgetOptions): Promise<void>;
252
+
253
+ declare function auditThirdParty(): Promise<void>;
254
+
255
+ interface ListRulesOptions {
256
+ category?: string;
257
+ blocked?: boolean;
258
+ allowed?: boolean;
259
+ }
260
+ declare function parseListRulesArgs(): ListRulesOptions;
261
+ declare function listRules(options?: ListRulesOptions): Promise<void>;
262
+
263
+ declare function generateWidgetRegistry(): Promise<void>;
264
+
265
+ declare function generateTemplateRegistry(): Promise<void>;
266
+
267
+ declare function generateI18nManifest(): Promise<void>;
268
+
269
+ declare function watchWidgets(): Promise<void>;
270
+
271
+ declare function watchLocales(): Promise<void>;
272
+
273
+ export { type CriticalWidgetIssue, type ListRulesOptions, type ScoreWidgetOptions, type TemplateGeneratorArgs, type TemplateValidationError, type ThemeGeneratorArgs, type ValidateAssetsOptions, type ValidateRouteOptions, type ValidateTemplateOptions, type ValidateWidgetOptions, type ValidationError, type WidgetGeneratorArgs, auditThirdParty, closeReadline, colors, createWidgetStructure, ensureDir, exists, generateI18nManifest, generateIndexTsx, generateTemplate, generateTemplateRegistry, generateTheme, generateTypesTs, generateV1IndexTsx, generateVariantsTs, generateWidget, generateWidgetRegistry, getExistingThemes, getExistingWidgetScopes, getExistingWidgets, getReadline, getRoot, getStagedFiles, getTemplatesForTheme, getThemesDir, getWidgetsDir, isDirectory, isPascalCase, listDir, listRules, log, parseListRulesArgs, parseScoreWidgetArgs, parseTemplateArgs, parseThemeArgs, parseValidateAssetsArgs, parseValidateRouteArgs, parseValidateTemplateArgs, parseValidateWidgetArgs, parseWidgetArgs, prompt, promptConfirm, promptSelect, readFile, runCommand, runCriticalWidgetValidation, runGenerator, runTemplateValidation, runWidgetValidation, scoreWidgets, toKebabCase, validateAssets, validateCriticalWidgets, validateRoutes, validateTemplates, validateWidgets, watchLocales, watchWidgets, writeFile };
@@ -0,0 +1,273 @@
1
+ import * as picocolors_types from 'picocolors/types';
2
+ import * as readline from 'readline';
3
+ export { join } from 'path';
4
+
5
+ declare const colors: {
6
+ green: picocolors_types.Formatter;
7
+ yellow: picocolors_types.Formatter;
8
+ cyan: picocolors_types.Formatter;
9
+ red: picocolors_types.Formatter;
10
+ dim: picocolors_types.Formatter;
11
+ bold: picocolors_types.Formatter;
12
+ reset: (s: string) => string;
13
+ };
14
+ declare const log: {
15
+ success: (msg: string) => void;
16
+ error: (msg: string) => void;
17
+ warn: (msg: string) => void;
18
+ info: (msg: string) => void;
19
+ step: (msg: string) => void;
20
+ };
21
+
22
+ declare function getReadline(): readline.Interface;
23
+ declare function closeReadline(): void;
24
+ /**
25
+ * Prompt user for text input
26
+ */
27
+ declare function prompt(question: string): Promise<string>;
28
+ /**
29
+ * Prompt user to select from options
30
+ */
31
+ declare function promptSelect(question: string, options: string[]): Promise<string>;
32
+ /**
33
+ * Prompt user for yes/no confirmation
34
+ */
35
+ declare function promptConfirm(question: string, defaultValue?: boolean): Promise<boolean>;
36
+
37
+ /**
38
+ * Get current working directory
39
+ */
40
+ declare function getRoot(): string;
41
+ /**
42
+ * Get themes directory
43
+ */
44
+ declare function getThemesDir(): string;
45
+ /**
46
+ * Get widgets directory
47
+ */
48
+ declare function getWidgetsDir(): string;
49
+ /**
50
+ * Get existing theme names
51
+ */
52
+ declare function getExistingThemes(): string[];
53
+ /**
54
+ * Get existing widget scopes (namespaces)
55
+ */
56
+ declare function getExistingWidgetScopes(): string[];
57
+ /**
58
+ * Get existing widget names across all scopes
59
+ */
60
+ declare function getExistingWidgets(): string[];
61
+ /**
62
+ * Get templates for a specific theme
63
+ */
64
+ declare function getTemplatesForTheme(themeName: string): string[];
65
+ /**
66
+ * Convert PascalCase or camelCase to kebab-case
67
+ */
68
+ declare function toKebabCase(str: string): string;
69
+ /**
70
+ * Check if string is PascalCase
71
+ */
72
+ declare function isPascalCase(str: string): boolean;
73
+ /**
74
+ * Ensure directory exists
75
+ */
76
+ declare function ensureDir(dir: string): void;
77
+ /**
78
+ * Write file with content
79
+ */
80
+ declare function writeFile(path: string, content: string): void;
81
+ /**
82
+ * Read file content
83
+ */
84
+ declare function readFile(path: string): string;
85
+ /**
86
+ * Check if path exists
87
+ */
88
+ declare function exists(path: string): boolean;
89
+ /**
90
+ * Check if path is a directory
91
+ */
92
+ declare function isDirectory(path: string): boolean;
93
+ /**
94
+ * List directory entries
95
+ */
96
+ declare function listDir(dir: string): string[];
97
+
98
+ /**
99
+ * Run a generator script
100
+ */
101
+ declare function runGenerator(type: "widgets" | "templates" | "i18n"): boolean;
102
+ /**
103
+ * Run npm/bun command
104
+ */
105
+ declare function runCommand(command: string, silent?: boolean): boolean;
106
+ /**
107
+ * Get git staged files
108
+ */
109
+ declare function getStagedFiles(): string[];
110
+
111
+ interface WidgetGeneratorArgs {
112
+ name?: string;
113
+ scope?: string;
114
+ skipGenerate?: boolean;
115
+ addToTemplate?: string;
116
+ theme?: string;
117
+ section?: string;
118
+ }
119
+ /**
120
+ * Parse CLI arguments for widget generation
121
+ */
122
+ declare function parseWidgetArgs(): WidgetGeneratorArgs;
123
+ declare function generateIndexTsx(name: string): string;
124
+ declare function generateTypesTs(name: string): string;
125
+ declare function generateVariantsTs(name: string): string;
126
+ declare function generateV1IndexTsx(name: string): string;
127
+ /**
128
+ * Create widget structure
129
+ */
130
+ declare function createWidgetStructure(name: string, scope: string): void;
131
+ /**
132
+ * Main widget generator
133
+ */
134
+ declare function generateWidget(args?: WidgetGeneratorArgs): Promise<void>;
135
+
136
+ interface ThemeGeneratorArgs {
137
+ name?: string;
138
+ lang?: string;
139
+ }
140
+ /**
141
+ * Parse CLI arguments for theme generation
142
+ */
143
+ declare function parseThemeArgs(): ThemeGeneratorArgs;
144
+ /**
145
+ * Main theme generator
146
+ */
147
+ declare function generateTheme(args?: ThemeGeneratorArgs): Promise<void>;
148
+
149
+ interface TemplateGeneratorArgs {
150
+ name?: string;
151
+ theme?: string;
152
+ }
153
+ /**
154
+ * Parse CLI arguments for template generation
155
+ */
156
+ declare function parseTemplateArgs(): TemplateGeneratorArgs;
157
+ /**
158
+ * Main template generator
159
+ */
160
+ declare function generateTemplate(args?: TemplateGeneratorArgs): Promise<void>;
161
+
162
+ interface ValidationError {
163
+ widget: string;
164
+ message: string;
165
+ }
166
+ interface ValidateWidgetOptions {
167
+ stagedOnly?: boolean;
168
+ files?: string[];
169
+ }
170
+ /**
171
+ * Parse CLI arguments for widget validation
172
+ */
173
+ declare function parseValidateWidgetArgs(): ValidateWidgetOptions;
174
+ /**
175
+ * Run widget validation
176
+ */
177
+ declare function runWidgetValidation(options?: ValidateWidgetOptions): Promise<{
178
+ passed: number;
179
+ errors: ValidationError[];
180
+ }>;
181
+ /**
182
+ * CLI entry point for widget validation
183
+ */
184
+ declare function validateWidgets(options?: ValidateWidgetOptions): Promise<void>;
185
+
186
+ interface TemplateValidationError {
187
+ template: string;
188
+ theme: string;
189
+ message: string;
190
+ }
191
+ interface ValidateTemplateOptions {
192
+ theme?: string;
193
+ }
194
+ /**
195
+ * Parse CLI arguments for template validation
196
+ */
197
+ declare function parseValidateTemplateArgs(): ValidateTemplateOptions;
198
+ /**
199
+ * Run template validation
200
+ */
201
+ declare function runTemplateValidation(options?: ValidateTemplateOptions): Promise<{
202
+ passed: number;
203
+ errors: TemplateValidationError[];
204
+ }>;
205
+ /**
206
+ * CLI entry point for template validation
207
+ */
208
+ declare function validateTemplates(options?: ValidateTemplateOptions): Promise<void>;
209
+
210
+ interface ValidateRouteOptions {
211
+ stagedOnly?: boolean;
212
+ files?: string[];
213
+ }
214
+ /**
215
+ * Parse CLI arguments
216
+ */
217
+ declare function parseValidateRouteArgs(): ValidateRouteOptions;
218
+ /**
219
+ * CLI entry point
220
+ */
221
+ declare function validateRoutes(options?: ValidateRouteOptions): Promise<void>;
222
+
223
+ interface ValidateAssetsOptions {
224
+ stagedOnly?: boolean;
225
+ files?: string[];
226
+ }
227
+ declare function parseValidateAssetsArgs(): ValidateAssetsOptions;
228
+ declare function validateAssets(options?: ValidateAssetsOptions): Promise<void>;
229
+
230
+ interface CriticalWidgetIssue {
231
+ file: string;
232
+ widget: string;
233
+ line: number;
234
+ pattern: string;
235
+ message: string;
236
+ }
237
+ declare function runCriticalWidgetValidation(): Promise<{
238
+ passed: boolean;
239
+ issues: CriticalWidgetIssue[];
240
+ checkedFiles: string[];
241
+ }>;
242
+ declare function validateCriticalWidgets(): Promise<void>;
243
+
244
+ interface ScoreWidgetOptions {
245
+ stagedOnly?: boolean;
246
+ files?: string[];
247
+ widget?: string;
248
+ minScore?: number;
249
+ }
250
+ declare function parseScoreWidgetArgs(): ScoreWidgetOptions;
251
+ declare function scoreWidgets(options?: ScoreWidgetOptions): Promise<void>;
252
+
253
+ declare function auditThirdParty(): Promise<void>;
254
+
255
+ interface ListRulesOptions {
256
+ category?: string;
257
+ blocked?: boolean;
258
+ allowed?: boolean;
259
+ }
260
+ declare function parseListRulesArgs(): ListRulesOptions;
261
+ declare function listRules(options?: ListRulesOptions): Promise<void>;
262
+
263
+ declare function generateWidgetRegistry(): Promise<void>;
264
+
265
+ declare function generateTemplateRegistry(): Promise<void>;
266
+
267
+ declare function generateI18nManifest(): Promise<void>;
268
+
269
+ declare function watchWidgets(): Promise<void>;
270
+
271
+ declare function watchLocales(): Promise<void>;
272
+
273
+ export { type CriticalWidgetIssue, type ListRulesOptions, type ScoreWidgetOptions, type TemplateGeneratorArgs, type TemplateValidationError, type ThemeGeneratorArgs, type ValidateAssetsOptions, type ValidateRouteOptions, type ValidateTemplateOptions, type ValidateWidgetOptions, type ValidationError, type WidgetGeneratorArgs, auditThirdParty, closeReadline, colors, createWidgetStructure, ensureDir, exists, generateI18nManifest, generateIndexTsx, generateTemplate, generateTemplateRegistry, generateTheme, generateTypesTs, generateV1IndexTsx, generateVariantsTs, generateWidget, generateWidgetRegistry, getExistingThemes, getExistingWidgetScopes, getExistingWidgets, getReadline, getRoot, getStagedFiles, getTemplatesForTheme, getThemesDir, getWidgetsDir, isDirectory, isPascalCase, listDir, listRules, log, parseListRulesArgs, parseScoreWidgetArgs, parseTemplateArgs, parseThemeArgs, parseValidateAssetsArgs, parseValidateRouteArgs, parseValidateTemplateArgs, parseValidateWidgetArgs, parseWidgetArgs, prompt, promptConfirm, promptSelect, readFile, runCommand, runCriticalWidgetValidation, runGenerator, runTemplateValidation, runWidgetValidation, scoreWidgets, toKebabCase, validateAssets, validateCriticalWidgets, validateRoutes, validateTemplates, validateWidgets, watchLocales, watchWidgets, writeFile };