@milkio/cookbook-command 1.0.0-alpha.100

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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # @milkio/cookbook-command
2
+
3
+ To install dependencies:
4
+
5
+ ```bash
6
+ bun install
7
+ ```
8
+
9
+ To run:
10
+
11
+ ```bash
12
+ bun run index.ts
13
+ ```
14
+
15
+ This project was created using `bun init` in bun v1.2.4. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
package/index.ts ADDED
@@ -0,0 +1,61 @@
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
+ }
7
+
8
+ 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>,
35
+ }) => Promise<void>;
36
+
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
+ packageManager: string
56
+ cookbookPort: number
57
+ },
58
+ config: {
59
+ [key: string]: string | number | boolean
60
+ }
61
+ }
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@milkio/cookbook-command",
3
+ "module": "index.ts",
4
+ "type": "module",
5
+ "dependencies": {
6
+ "consola": "^3.4.0",
7
+ "openai": "^4.87.3"
8
+ },
9
+ "version": "1.0.0-alpha.100"
10
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Enable latest features
4
+ "lib": ["ESNext", "DOM"],
5
+ "target": "ESNext",
6
+ "module": "ESNext",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+
22
+ // Some stricter flags (disabled by default)
23
+ "noUnusedLocals": false,
24
+ "noUnusedParameters": false,
25
+ "noPropertyAccessFromIndexSignature": false
26
+ }
27
+ }