@milkio/cookbook-command 1.0.0-alpha.100 → 1.0.0-alpha.102

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 (2) hide show
  1. package/index.ts +71 -51
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -1,61 +1,81 @@
1
1
  import type { consola } from "consola";
2
- import type OpenAI from "openai";
3
2
 
4
3
  export async function defineCookbookCommand<Handler extends CookbookCommandHandler>(handler: Handler): Promise<Handler> {
5
- return handler;
4
+ return handler;
6
5
  }
7
6
 
8
7
  export type CookbookCommandHandler = (utils: {
9
- log: typeof consola['log'],
10
- info: typeof consola['info'],
11
- warn: typeof consola['warn'],
12
- error: typeof consola['error'],
13
- success: typeof consola['success'],
14
- debug: typeof consola['debug'],
15
- fatal: typeof consola['fatal'],
16
- trace: typeof consola['trace'],
17
- start: typeof consola['start'],
18
- box: typeof consola['box'],
19
- prompt: typeof consola['prompt'],
20
- getScriptPath: () => string,
21
- getWorkspacePath: () => string,
22
- getParams: () => {
23
- command: string;
24
- commands: Array<string>;
25
- options: Record<string, string | true>;
26
- raw: Array<string>;
27
- },
28
- inputBoolean: (options: { env: string, message: string, placeholder?: string }) => Promise<boolean>,
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>,
8
+ log: (typeof consola)["log"];
9
+ info: (typeof consola)["info"];
10
+ warn: (typeof consola)["warn"];
11
+ error: (typeof consola)["error"];
12
+ success: (typeof consola)["success"];
13
+ debug: (typeof consola)["debug"];
14
+ fatal: (typeof consola)["fatal"];
15
+ trace: (typeof consola)["trace"];
16
+ start: (typeof consola)["start"];
17
+ box: (typeof consola)["box"];
18
+ prompt: (typeof consola)["prompt"];
19
+ getScriptPath: () => string;
20
+ getWorkspacePath: () => string;
21
+ getParams: () => {
22
+ command: string;
23
+ commands: Array<string>;
24
+ options: Record<string, string | true>;
25
+ raw: Array<string>;
26
+ };
27
+ inputBoolean: (options: { env: string; message: string; placeholder?: string }) => Promise<boolean>;
28
+ inputString: (options: { env: string; message: string; placeholder?: string }) => Promise<string>;
29
+ canUseAI: () => Promise<
30
+ | false
31
+ | {
32
+ aiBaseUrl: string;
33
+ aiApiKey: string;
34
+ aiModel: string;
35
+ }
36
+ >;
37
+ fetchEventSource: (
38
+ input: string | URL | globalThis.Request,
39
+ init?: RequestInit,
40
+ ) => AsyncIterableIterator<{
41
+ data: any;
42
+ event?: string;
43
+ id?: string;
44
+ }>;
45
+ openProgress: (message: string) => Promise<void>;
46
+ closeProgress: (message: string) => Promise<void>;
47
+ getCookbookToml: () => Promise<CookbookToml>;
35
48
  }) => Promise<void>;
36
49
 
37
50
  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
- packageManager: string
56
- cookbookPort: number
57
- },
58
- config: {
59
- [key: string]: string | number | boolean
51
+ projects: Record<
52
+ string,
53
+ {
54
+ type: "milkio" | "custom";
55
+ port: number;
56
+ start: string;
57
+ build: string;
58
+ meta: Partial<{
59
+ inspect: boolean;
60
+ }>;
61
+ name?: string;
62
+ watch?: boolean;
63
+ lazyRoutes?: boolean;
64
+ typiaMode?: "generation" | "bundler";
65
+ significant?: Array<string>;
66
+ insignificant?: Array<string>;
67
+ autoStart?: boolean;
68
+ autoStartDelay?: number;
69
+ connectTestUrl?: string;
70
+ prismaMigrateMode?: "migrate-dev" | "push";
60
71
  }
61
- }
72
+ >;
73
+ general: {
74
+ start: string;
75
+ packageManager: string;
76
+ cookbookPort: number;
77
+ };
78
+ config: {
79
+ [key: string]: string | number | boolean;
80
+ };
81
+ }
package/package.json CHANGED
@@ -6,5 +6,5 @@
6
6
  "consola": "^3.4.0",
7
7
  "openai": "^4.87.3"
8
8
  },
9
- "version": "1.0.0-alpha.100"
9
+ "version": "1.0.0-alpha.102"
10
10
  }