@milkio/cookbook-command 1.0.0-alpha.80 → 1.0.0-alpha.82
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/index.ts +34 -3
- package/package.json +3 -2
package/index.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { consola } from "consola";
|
|
2
|
+
import type OpenAI from "openai";
|
|
3
|
+
|
|
4
|
+
export async function defineCookbookCommand<Handler extends CookbookCommandHandler>(handler: Handler): Promise<Handler> {
|
|
5
|
+
return handler;
|
|
6
|
+
}
|
|
2
7
|
|
|
3
8
|
export type CookbookCommandHandler = (utils: {
|
|
4
9
|
log: typeof consola['log'],
|
|
@@ -22,8 +27,34 @@ export type CookbookCommandHandler = (utils: {
|
|
|
22
27
|
},
|
|
23
28
|
inputBoolean: (options: { env: string, message: string, placeholder?: string }) => Promise<boolean>,
|
|
24
29
|
inputString: (options: { env: string, message: string, placeholder?: string }) => Promise<string>,
|
|
30
|
+
useAI: () => Promise<{ model: string, client: OpenAI }>,
|
|
31
|
+
canUseAI: () => Promise<boolean>,
|
|
32
|
+
openProgress: (message: string) => Promise<void>,
|
|
33
|
+
closeProgress: (message: string) => Promise<void>,
|
|
34
|
+
getCookbookToml: () => Promise<CookbookToml>,
|
|
25
35
|
}) => Promise<void>;
|
|
26
36
|
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
37
|
+
export interface CookbookToml {
|
|
38
|
+
projects: Record<string, {
|
|
39
|
+
type: 'milkio' | 'custom'
|
|
40
|
+
port: number
|
|
41
|
+
start: Array<string>
|
|
42
|
+
build: Array<string>
|
|
43
|
+
name?: string
|
|
44
|
+
watch?: boolean
|
|
45
|
+
lazyRoutes?: boolean
|
|
46
|
+
typiaMode?: 'generation' | 'bundler'
|
|
47
|
+
significant?: Array<string>
|
|
48
|
+
insignificant?: Array<string>
|
|
49
|
+
autoStart?: boolean
|
|
50
|
+
autoStartDelay?: number
|
|
51
|
+
connectTestUrl?: string
|
|
52
|
+
}>
|
|
53
|
+
general: {
|
|
54
|
+
start: string
|
|
55
|
+
cookbookPort: number
|
|
56
|
+
},
|
|
57
|
+
config: {
|
|
58
|
+
[key: string]: string | number | boolean
|
|
59
|
+
}
|
|
60
|
+
}
|