@h-ai/cli 0.1.0-alpha.10 → 0.1.0-alpha.11
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/dist/index.js +65 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/templates/base/eslint.config.js +26 -0
- package/templates/base/package.json.hbs +62 -47
- package/templates/base/src/app.css.hbs +38 -0
- package/templates/base/src/app.d.ts.hbs +3 -1
- package/templates/base/src/app.html.hbs +6 -0
- package/templates/base/svelte.config.js.hbs +19 -1
- package/templates/base/tsconfig.json +14 -2
- package/templates/base/vite.config.ts.hbs +31 -11
- package/templates/base/vitest.config.ts +10 -0
- package/templates/i18n/project.inlang/settings.json +1 -1
- package/templates/base/src/app.css +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.11",
|
|
5
5
|
"description": "Hai Framework CLI for project scaffolding and code generation.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ora": "^9.1.0",
|
|
35
35
|
"prompts": "^2.4.2",
|
|
36
36
|
"yaml": "^2.7.0",
|
|
37
|
-
"@h-ai/core": "0.1.0-alpha.
|
|
37
|
+
"@h-ai/core": "0.1.0-alpha.11"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ESLint 配置
|
|
3
|
+
*
|
|
4
|
+
* @see https://github.com/antfu/eslint-config
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import antfu from '@antfu/eslint-config'
|
|
8
|
+
|
|
9
|
+
export default antfu({
|
|
10
|
+
formatters: true,
|
|
11
|
+
ignores: [
|
|
12
|
+
'**/.svelte-kit/**',
|
|
13
|
+
'**/build/**',
|
|
14
|
+
'**/*.d.ts',
|
|
15
|
+
'**/project.inlang/**',
|
|
16
|
+
'**/paraglide/**',
|
|
17
|
+
'**/.agents/**',
|
|
18
|
+
],
|
|
19
|
+
svelte: true,
|
|
20
|
+
}, {
|
|
21
|
+
files: ['**/*.ts', '**/*.svelte'],
|
|
22
|
+
rules: {
|
|
23
|
+
'no-console': 'error',
|
|
24
|
+
'ts/no-explicit-any': 'error',
|
|
25
|
+
},
|
|
26
|
+
})
|
|
@@ -1,67 +1,82 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.11",
|
|
4
4
|
"private": true,
|
|
5
|
+
"description": "{{#if_eq appType 'admin'}}Enterprise management system built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'website'}}Enterprise website built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'h5'}}Mobile H5 app built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'api'}}REST API service built with hai Agent Framework{{/if_eq}}{{#if_eq appType 'android-app'}}Android app built with hai Agent Framework{{/if_eq}}",
|
|
6
|
+
"keywords": ["hai", "sveltekit", "svelte5", "{{appType}}"],
|
|
5
7
|
"license": "Apache-2.0",
|
|
6
8
|
"type": "module",
|
|
7
9
|
"scripts": {
|
|
10
|
+
{{#if hasI18n}}
|
|
11
|
+
"paraglide:compile": "paraglide-js compile --project ./project.inlang --outdir ./src/lib/paraglide",
|
|
12
|
+
{{/if}}
|
|
8
13
|
"dev": "vite dev",
|
|
9
14
|
"build": "vite build",
|
|
10
15
|
"preview": "vite preview",
|
|
11
16
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
|
12
17
|
"lint": "eslint .",
|
|
13
18
|
"test": "vitest run",
|
|
14
|
-
"test:
|
|
19
|
+
"test:watch": "vitest",
|
|
20
|
+
"test:e2e": "playwright test",
|
|
21
|
+
"clean": "rimraf .svelte-kit build .turbo"
|
|
15
22
|
},
|
|
16
23
|
"dependencies": {
|
|
17
|
-
"@h-ai/core": "^0.1.0-alpha.
|
|
18
|
-
"@h-ai/kit": "^0.1.0-alpha.
|
|
19
|
-
"@h-ai/ui": "^0.1.0-alpha.
|
|
20
|
-
"@h-ai/reldb": "^0.1.0-alpha.
|
|
21
|
-
"@h-ai/cache": "^0.1.0-alpha.
|
|
22
|
-
"@h-ai/iam": "^0.1.0-alpha.
|
|
23
|
-
"@h-ai/crypto": "^0.1.0-alpha.
|
|
24
|
-
"@h-ai/storage": "^0.1.0-alpha.
|
|
25
|
-
"@h-ai/ai": "^0.1.0-alpha.
|
|
26
|
-
"@h-ai/audit": "^0.1.0-alpha.
|
|
27
|
-
"@h-ai/reach": "^0.1.0-alpha.
|
|
28
|
-
"@h-ai/payment": "^0.1.0-alpha.
|
|
29
|
-
"@h-ai/vecdb": "^0.1.0-alpha.
|
|
30
|
-
"@h-ai/datapipe": "^0.1.0-alpha.
|
|
31
|
-
"@h-ai/scheduler": "^0.1.0-alpha.
|
|
32
|
-
"@h-ai/deploy": "^0.1.0-alpha.
|
|
33
|
-
"@h-ai/api-client": "^0.1.0-alpha.
|
|
34
|
-
"@h-ai/capacitor": "^0.1.0-alpha.
|
|
35
|
-
"@h-ai/api-client": "^0.1.0-alpha.
|
|
36
|
-
"@h-ai/capacitor": "^0.1.0-alpha.
|
|
37
|
-
"zod": "^3.
|
|
24
|
+
"@h-ai/core": "^0.1.0-alpha.11",
|
|
25
|
+
"@h-ai/kit": "^0.1.0-alpha.11"{{#if hasUi}},
|
|
26
|
+
"@h-ai/ui": "^0.1.0-alpha.11"{{/if}}{{#if features.db}},
|
|
27
|
+
"@h-ai/reldb": "^0.1.0-alpha.11"{{/if}}{{#if features.cache}},
|
|
28
|
+
"@h-ai/cache": "^0.1.0-alpha.11"{{/if}}{{#if features.iam}},
|
|
29
|
+
"@h-ai/iam": "^0.1.0-alpha.11"{{/if}}{{#if features.crypto}},
|
|
30
|
+
"@h-ai/crypto": "^0.1.0-alpha.11"{{/if}}{{#if features.storage}},
|
|
31
|
+
"@h-ai/storage": "^0.1.0-alpha.11"{{/if}}{{#if features.ai}},
|
|
32
|
+
"@h-ai/ai": "^0.1.0-alpha.11"{{/if}}{{#if features.audit}},
|
|
33
|
+
"@h-ai/audit": "^0.1.0-alpha.11"{{/if}}{{#if features.reach}},
|
|
34
|
+
"@h-ai/reach": "^0.1.0-alpha.11"{{/if}}{{#if features.payment}},
|
|
35
|
+
"@h-ai/payment": "^0.1.0-alpha.11"{{/if}}{{#if features.vecdb}},
|
|
36
|
+
"@h-ai/vecdb": "^0.1.0-alpha.11"{{/if}}{{#if features.datapipe}},
|
|
37
|
+
"@h-ai/datapipe": "^0.1.0-alpha.11"{{/if}}{{#if features.scheduler}},
|
|
38
|
+
"@h-ai/scheduler": "^0.1.0-alpha.11"{{/if}}{{#if features.deploy}},
|
|
39
|
+
"@h-ai/deploy": "^0.1.0-alpha.11"{{/if}}{{#if features.api-client}},
|
|
40
|
+
"@h-ai/api-client": "^0.1.0-alpha.11"{{/if}}{{#if features.capacitor}},
|
|
41
|
+
"@h-ai/capacitor": "^0.1.0-alpha.11"{{/if}}{{#if isCapacitorApp}}{{#unless features.api-client}},
|
|
42
|
+
"@h-ai/api-client": "^0.1.0-alpha.11"{{/unless}}{{#unless features.capacitor}},
|
|
43
|
+
"@h-ai/capacitor": "^0.1.0-alpha.11"{{/unless}}{{/if}},
|
|
44
|
+
"zod": "^4.3.6"
|
|
38
45
|
},
|
|
39
46
|
"devDependencies": {
|
|
40
|
-
"@playwright/test": "^1.
|
|
47
|
+
"@playwright/test": "^1.59.1",
|
|
41
48
|
{{#if isCapacitorApp}}
|
|
42
|
-
"@capacitor/cli": "^
|
|
43
|
-
"@capacitor/core": "^
|
|
44
|
-
"@capacitor/android": "^
|
|
45
|
-
"@capacitor/preferences": "^
|
|
46
|
-
"@sveltejs/adapter-static": "^3.0.
|
|
49
|
+
"@capacitor/cli": "^8.2.0",
|
|
50
|
+
"@capacitor/core": "^8.2.0",
|
|
51
|
+
"@capacitor/android": "^8.2.0",
|
|
52
|
+
"@capacitor/preferences": "^8.0.1",
|
|
53
|
+
"@sveltejs/adapter-static": "^3.0.10",
|
|
54
|
+
{{else}}
|
|
55
|
+
{{#if_eq appType 'api'}}
|
|
56
|
+
"@sveltejs/adapter-node": "^5.5.4",
|
|
47
57
|
{{else}}
|
|
48
|
-
"@sveltejs/adapter-auto": "^
|
|
58
|
+
"@sveltejs/adapter-auto": "^7.0.1",
|
|
59
|
+
{{/if_eq}}
|
|
49
60
|
{{/if}}
|
|
50
|
-
"@sveltejs/kit": "^2.
|
|
51
|
-
"@sveltejs/vite-plugin-svelte": "^
|
|
52
|
-
"@types/node": "^
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"svelte
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"tailwindcss": "^4.
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"@iconify/
|
|
64
|
-
"@
|
|
65
|
-
"@inlang/
|
|
66
|
-
|
|
61
|
+
"@sveltejs/kit": "^2.57.1",
|
|
62
|
+
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
63
|
+
"@types/node": "^25.6.0",
|
|
64
|
+
"pino-pretty": "^13.1.3",
|
|
65
|
+
"rimraf": "^6.1.3",
|
|
66
|
+
"svelte": "^5.55.3",
|
|
67
|
+
"svelte-check": "^4.4.6",
|
|
68
|
+
"typescript": "^6.0.2",
|
|
69
|
+
"vite": "^8.0.8",
|
|
70
|
+
"vitest": "^4.1.4"{{#if hasUi}},
|
|
71
|
+
"@tailwindcss/vite": "^4.2.2",
|
|
72
|
+
"tailwindcss": "^4.2.2",
|
|
73
|
+
"daisyui": "^5.5.19",
|
|
74
|
+
"@iconify-json/tabler": "^1.2.33",
|
|
75
|
+
"@iconify/tailwind4": "^1.2.3"{{/if}}{{#if hasI18n}},
|
|
76
|
+
"@inlang/paraglide-js": "^2.15.3",
|
|
77
|
+
"@inlang/plugin-message-format": "^4.4.0"{{/if}}
|
|
78
|
+
}{{#if features.db}},
|
|
79
|
+
"pnpm": {
|
|
80
|
+
"onlyBuiltDependencies": ["better-sqlite3"]
|
|
81
|
+
}{{/if}}
|
|
67
82
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{{#if hasUi}}
|
|
2
|
+
/* ─── Tailwind CSS v4 ─── */
|
|
3
|
+
@import 'tailwindcss';
|
|
4
|
+
|
|
5
|
+
/* ─── @h-ai/ui 共享样式 ─── */
|
|
6
|
+
@import '@h-ai/ui/styles/global.css';
|
|
7
|
+
@import '@h-ai/ui/styles/theme.css';
|
|
8
|
+
@import '@h-ai/ui/styles/design-tokens.css';
|
|
9
|
+
@import '@h-ai/ui/styles/mobile.css';
|
|
10
|
+
|
|
11
|
+
/* ─── 扫描 @h-ai/ui 组件中使用的 Tailwind 类名 ─── */
|
|
12
|
+
@source "../node_modules/@h-ai/ui/dist/**/*.{svelte,ts}";
|
|
13
|
+
|
|
14
|
+
/* ─── DaisyUI 主题 ─── */
|
|
15
|
+
@plugin "daisyui" {
|
|
16
|
+
themes:
|
|
17
|
+
light --default,
|
|
18
|
+
dark --prefersdark,
|
|
19
|
+
cupcake,
|
|
20
|
+
emerald,
|
|
21
|
+
corporate,
|
|
22
|
+
nord,
|
|
23
|
+
lofi,
|
|
24
|
+
winter,
|
|
25
|
+
dracula,
|
|
26
|
+
night,
|
|
27
|
+
dim,
|
|
28
|
+
business,
|
|
29
|
+
sunset,
|
|
30
|
+
luxury,
|
|
31
|
+
coffee;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* ─── 图标 ─── */
|
|
35
|
+
@plugin "@iconify/tailwind4" {
|
|
36
|
+
prefixes: tabler;
|
|
37
|
+
}
|
|
38
|
+
{{/if}}
|
|
@@ -8,6 +8,12 @@
|
|
|
8
8
|
<meta charset="utf-8" />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
10
10
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
|
11
|
+
<script>
|
|
12
|
+
;(function () {
|
|
13
|
+
const theme = localStorage.getItem('theme') || 'light'
|
|
14
|
+
document.documentElement.setAttribute('data-theme', theme)
|
|
15
|
+
})()
|
|
16
|
+
</script>
|
|
11
17
|
%sveltekit.head%
|
|
12
18
|
</head>
|
|
13
19
|
<body data-sveltekit-preload-data="hover">
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Svelte 配置
|
|
3
3
|
*/
|
|
4
|
+
import process from 'node:process'
|
|
5
|
+
{{#if hasUi}}
|
|
6
|
+
import { autoImportHaiUi } from '@h-ai/ui/auto-import'
|
|
7
|
+
{{/if}}
|
|
4
8
|
{{#if isCapacitorApp}}
|
|
5
9
|
import adapter from '@sveltejs/adapter-static'
|
|
6
10
|
{{else}}
|
|
11
|
+
{{#if_eq appType 'api'}}
|
|
12
|
+
import adapter from '@sveltejs/adapter-node'
|
|
13
|
+
{{else}}
|
|
7
14
|
import adapter from '@sveltejs/adapter-auto'
|
|
15
|
+
{{/if_eq}}
|
|
8
16
|
{{/if}}
|
|
9
17
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
|
10
18
|
|
|
11
19
|
/** @type {import('@sveltejs/kit').Config} */
|
|
12
20
|
const config = {
|
|
13
|
-
preprocess: vitePreprocess(),
|
|
21
|
+
preprocess: [{{#if hasUi}}autoImportHaiUi(), {{/if}}vitePreprocess()],
|
|
14
22
|
compilerOptions: {
|
|
15
23
|
runes: true,
|
|
16
24
|
},
|
|
@@ -24,6 +32,16 @@ const config = {
|
|
|
24
32
|
{{else}}
|
|
25
33
|
adapter: adapter(),
|
|
26
34
|
{{/if}}
|
|
35
|
+
csrf: {
|
|
36
|
+
trustedOrigins: process.env.HAI_E2E === '1'
|
|
37
|
+
? ['http://localhost:4173', 'http://127.0.0.1:4173']
|
|
38
|
+
: [],
|
|
39
|
+
},
|
|
40
|
+
alias: {
|
|
41
|
+
$components: './src/lib/components',
|
|
42
|
+
$stores: './src/lib/stores',
|
|
43
|
+
$utils: './src/lib/utils',
|
|
44
|
+
},
|
|
27
45
|
},
|
|
28
46
|
}
|
|
29
47
|
|
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
"extends": "./.svelte-kit/tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"moduleResolution": "bundler",
|
|
5
|
+
"allowImportingTsExtensions": true,
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"checkJs": false,
|
|
5
8
|
"strict": true,
|
|
6
|
-
"verbatimModuleSyntax": true
|
|
7
|
-
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"skipLibCheck": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*",
|
|
14
|
+
"src/**/*.svelte"
|
|
15
|
+
],
|
|
16
|
+
"exclude": [
|
|
17
|
+
"node_modules",
|
|
18
|
+
".svelte-kit"
|
|
19
|
+
]
|
|
8
20
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* {{projectName}} - Vite 配置
|
|
3
3
|
*/
|
|
4
|
+
import path from 'node:path'
|
|
5
|
+
import process from 'node:process'
|
|
4
6
|
import { sveltekit } from '@sveltejs/kit/vite'
|
|
5
7
|
{{#if hasUi}}
|
|
6
8
|
import tailwindcss from '@tailwindcss/vite'
|
|
@@ -8,20 +10,38 @@ import tailwindcss from '@tailwindcss/vite'
|
|
|
8
10
|
{{#if hasI18n}}
|
|
9
11
|
import { paraglideVitePlugin } from '@inlang/paraglide-js'
|
|
10
12
|
{{/if}}
|
|
11
|
-
import { defineConfig } from 'vite'
|
|
13
|
+
import { defineConfig, loadEnv } from 'vite'
|
|
12
14
|
|
|
13
|
-
export default defineConfig({
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
export default defineConfig(({ mode }) => {
|
|
16
|
+
const env = loadEnv(mode, process.cwd(), '')
|
|
17
|
+
Object.assign(process.env, env)
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
plugins: [
|
|
21
|
+
sveltekit(),
|
|
16
22
|
{{#if hasUi}}
|
|
17
|
-
|
|
23
|
+
tailwindcss(),
|
|
18
24
|
{{/if}}
|
|
19
25
|
{{#if hasI18n}}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
paraglideVitePlugin({
|
|
27
|
+
project: './project.inlang',
|
|
28
|
+
outdir: './src/lib/paraglide',
|
|
29
|
+
strategy: ['cookie', 'baseLocale'],
|
|
30
|
+
}),
|
|
31
|
+
{{/if}}
|
|
32
|
+
],
|
|
33
|
+
{{#if hasUi}}
|
|
34
|
+
optimizeDeps: {
|
|
35
|
+
exclude: ['bits-ui'],
|
|
36
|
+
},
|
|
25
37
|
{{/if}}
|
|
26
|
-
|
|
38
|
+
ssr: {
|
|
39
|
+
noExternal: [/@h-ai\//],
|
|
40
|
+
},
|
|
41
|
+
server: {
|
|
42
|
+
fs: {
|
|
43
|
+
allow: [path.resolve(process.cwd())],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}
|
|
27
47
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"baseLocale": "zh-CN",
|
|
4
4
|
"locales": ["zh-CN", "en-US"],
|
|
5
5
|
"modules": [
|
|
6
|
-
"
|
|
6
|
+
"./node_modules/@inlang/plugin-message-format/dist/index.js"
|
|
7
7
|
],
|
|
8
8
|
"plugin.inlang.messageFormat": {
|
|
9
9
|
"pathPattern": "./messages/{locale}.json"
|