@h-ai/cli 1.0.0-beta.18 → 1.0.0-beta.19
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.en.md +4 -0
- package/README.ja.md +4 -0
- package/README.md +4 -0
- package/dist/{chunk-6YZBC5MO.js → chunk-2ZL5ORQ2.js} +85 -25
- package/dist/chunk-2ZL5ORQ2.js.map +1 -0
- package/dist/{chunk-7NVRYYHN.js → chunk-L53P43B2.js} +129 -31
- package/dist/chunk-L53P43B2.js.map +1 -0
- package/dist/cli-config-templates-LWMD2I6V.js +5 -0
- package/dist/{cli-config-templates-QG5HOYR5.js.map → cli-config-templates-LWMD2I6V.js.map} +1 -1
- package/dist/{cli-skill-templates-W4I6ZKYW.js → cli-skill-templates-D6S2OQ6X.js} +3 -3
- package/dist/{cli-skill-templates-W4I6ZKYW.js.map → cli-skill-templates-D6S2OQ6X.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2747 -671
- package/dist/index.js.map +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +22 -22
- package/templates/apps/admin/src/routes/+layout.svelte.hbs +16 -10
- package/templates/apps/admin/src/routes/+page.svelte.hbs +4 -4
- package/templates/apps/admin/src/routes/admin/+layout.svelte.hbs +17 -7
- package/templates/apps/admin/src/routes/admin/+page.svelte.hbs +26 -6
- package/templates/apps/admin/src/routes/admin/settings/+page.svelte.hbs +2 -2
- package/templates/apps/api/apps/{{projectName}}-contract/src/app-schemas.ts.hbs +6 -1
- package/templates/apps/api/apps/{{projectName}}-contract/src/{{projectName}}-contract.ts.hbs +13 -5
- package/templates/apps/api/apps/{{projectName}}-contract/tests/contract.test.ts.hbs +13 -5
- package/templates/apps/api/apps/{{projectName}}-contract/tsup.config.ts.hbs +3 -1
- package/templates/apps/api/apps/{{projectName}}-serv/src/app.ts.hbs +71 -32
- package/templates/apps/api/apps/{{projectName}}-serv/src/build-metadata.ts.hbs +0 -1
- package/templates/apps/api/apps/{{projectName}}-serv/src/lib/server/init.ts.hbs +131 -54
- package/templates/apps/api/apps/{{projectName}}-serv/src/server/procedures/index.ts.hbs +39 -13
- package/templates/apps/api/apps/{{projectName}}-serv/tests/service.test.ts.hbs +78 -31
- package/templates/apps/api/apps/{{projectName}}-serv/tsup.config.ts.hbs +3 -1
- package/templates/apps/api/apps/{{projectName}}-serv/vitest.config.ts.hbs +3 -1
- package/templates/apps/api/e2e/api-serv.spec.ts.hbs +20 -3
- package/templates/apps/api/e2e/capture-evidence.ts.hbs +4 -1
- package/templates/apps/api/eslint.config.js.hbs +3 -1
- package/templates/apps/api/images/serv.Dockerfile.hbs +3 -4
- package/templates/apps/api/playwright.config.ts.hbs +23 -19
- package/templates/apps/api/pnpm-workspace.yaml.hbs +27 -16
- package/templates/apps/fullstack/apps/{{projectName}}-app/capacitor.config.ts.hbs +1 -3
- package/templates/apps/fullstack/apps/{{projectName}}-app/eslint.config.js.hbs +10 -2
- package/templates/apps/fullstack/apps/{{projectName}}-app/src/App.svelte.hbs +10 -2
- package/templates/apps/fullstack/apps/{{projectName}}-app/src/build-metadata.ts.hbs +0 -1
- package/templates/apps/fullstack/apps/{{projectName}}-app/src/lib/capacitor.ts.hbs +0 -1
- package/templates/apps/fullstack/apps/{{projectName}}-app/svelte.config.js.hbs +4 -1
- package/templates/apps/fullstack/apps/{{projectName}}-app/vite.config.ts.hbs +16 -4
- package/templates/apps/fullstack/apps/{{projectName}}-desktop/src/App.svelte.hbs +8 -2
- package/templates/apps/fullstack/apps/{{projectName}}-desktop/src/build-metadata.ts.hbs +0 -1
- package/templates/apps/fullstack/apps/{{projectName}}-desktop/svelte.config.js.hbs +4 -1
- package/templates/apps/fullstack/apps/{{projectName}}-desktop/vite.config.ts.hbs +16 -4
- package/templates/apps/fullstack/apps/{{projectName}}-web/eslint.config.js.hbs +10 -2
- package/templates/apps/fullstack/apps/{{projectName}}-web/src/build-metadata.ts.hbs +0 -1
- package/templates/apps/fullstack/apps/{{projectName}}-web/src/main.ts.hbs +0 -2
- package/templates/apps/fullstack/apps/{{projectName}}-web/svelte.config.js.hbs +4 -1
- package/templates/apps/fullstack/apps/{{projectName}}-web/vite.config.ts.hbs +19 -5
- package/templates/apps/fullstack/e2e/fullstack.spec.ts.hbs +111 -26
- package/templates/apps/fullstack/e2e/session-close.spec.ts.hbs +19 -5
- package/templates/apps/fullstack/eslint.config.js.hbs +3 -1
- package/templates/apps/fullstack/images/serv.Dockerfile.hbs +3 -4
- package/templates/apps/fullstack/images/web.Dockerfile.hbs +0 -2
- package/templates/apps/fullstack/packages/{{projectName}}-contract/src/admin-contract.ts.hbs +114 -23
- package/templates/apps/fullstack/packages/{{projectName}}-contract/src/admin-schemas.ts.hbs +57 -11
- package/templates/apps/fullstack/packages/{{projectName}}-contract/tsup.config.ts.hbs +3 -1
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/app-server.ts.hbs +65 -30
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/build-metadata.ts.hbs +0 -1
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/admin-service.ts.hbs +69 -21
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/business-settings.ts.hbs +21 -5
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/procedures/admin-procedures.ts.hbs +63 -11
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/procedures/app-procedures.ts.hbs +6 -1
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/procedures/index.ts.hbs +3 -1
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/runtime.ts.hbs +139 -49
- package/templates/apps/fullstack/packages/{{projectName}}-serv/src/server/security-roles.ts.hbs +43 -12
- package/templates/apps/fullstack/packages/{{projectName}}-serv/tests/app-server.test.ts.hbs +139 -28
- package/templates/apps/fullstack/packages/{{projectName}}-serv/tests/runtime.test.ts.hbs +33 -10
- package/templates/apps/fullstack/packages/{{projectName}}-serv/tests/security.test.ts.hbs +141 -25
- package/templates/apps/fullstack/packages/{{projectName}}-serv/tsup.config.ts.hbs +6 -2
- package/templates/apps/fullstack/packages/{{projectName}}-serv/vitest.config.ts.hbs +3 -1
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/api/api-client.ts.hbs +9 -2
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/api/feedback-client.ts.hbs +0 -3
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/api/sensitive-actions.svelte.ts.hbs +15 -3
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/components/AppShell.svelte.hbs +33 -7
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/components/FeedbackEntry.svelte.hbs +16 -2
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/pages/audit.svelte.hbs +104 -13
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/pages/feedback.svelte.hbs +37 -7
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/pages/roles.svelte.hbs +9 -3
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/pages/settings.svelte.hbs +25 -3
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/pages/users.svelte.hbs +133 -19
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/security/role-label.ts.hbs +14 -2
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/stores/guide-store.ts.hbs +66 -34
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/stores/management-store.svelte.ts.hbs +132 -30
- package/templates/apps/fullstack/packages/{{projectName}}-shared/src/lib/stores/theme-store.svelte.ts.hbs +8 -2
- package/templates/apps/fullstack/packages/{{projectName}}-shared/tests/api-client.test.ts.hbs +23 -5
- package/templates/apps/fullstack/packages/{{projectName}}-shared/tests/management-store.test.ts.hbs +143 -21
- package/templates/apps/fullstack/packages/{{projectName}}-shared/vitest.config.ts.hbs +7 -2
- package/templates/apps/fullstack/playwright.config.ts.hbs +9 -3
- package/templates/apps/fullstack/pnpm-workspace.yaml.hbs +30 -15
- package/templates/apps/h5/src/routes/+layout.svelte.hbs +57 -21
- package/templates/apps/h5/src/routes/+page.svelte.hbs +2 -2
- package/templates/apps/h5/src/routes/discover/+page.svelte.hbs +2 -2
- package/templates/apps/h5/src/routes/profile/+page.svelte.hbs +2 -2
- package/templates/apps/mobile-app/src/App.svelte.hbs +17 -5
- package/templates/apps/mobile-app/src/lib/api.ts.hbs +14 -3
- package/templates/apps/mobile-app/src/lib/app-config.ts.hbs +8 -1
- package/templates/apps/mobile-app/src/lib/pages/home.svelte.hbs +6 -2
- package/templates/apps/mobile-app/src/lib/pages/tasks.svelte.hbs +5 -1
- package/templates/apps/website/scripts/static-website.mjs.hbs +16 -3
- package/templates/apps/website/src/routes/+layout.svelte.hbs +44 -23
- package/templates/apps/website/src/routes/+page.svelte.hbs +4 -4
- package/templates/apps/website/src/routes/about/+page.svelte.hbs +2 -2
- package/templates/apps/website/src/routes/contact/+page.svelte.hbs +2 -2
- package/templates/apps/website/src/routes/services/+page.svelte.hbs +20 -5
- package/templates/base/e2e/app.spec.ts.hbs +49 -16
- package/templates/base/eslint-rules.js +44 -25
- package/templates/base/eslint.config.js.hbs +3 -1
- package/templates/base/images/web.Dockerfile.hbs +3 -4
- package/templates/base/package.json.hbs +5 -4
- package/templates/base/patches/daisyui-5.7.50.patch +8 -0
- package/templates/base/patches/deepmerge-4.3.1.patch +51 -0
- package/templates/base/playwright.config.ts +3 -1
- package/templates/base/pnpm-workspace.yaml.hbs +33 -16
- package/templates/base/src/app.d.ts.hbs +1 -1
- package/templates/base/src/hooks.server.ts.hbs +36 -27
- package/templates/base/src/lib/build-metadata.ts.hbs +0 -1
- package/templates/base/src/lib/server/init.ts.hbs +124 -51
- package/templates/base/src/lib/server/kit-config.ts.hbs +7 -4
- package/templates/base/src/routes/+layout.server.ts.hbs +2 -2
- package/templates/base/svelte.config.js.hbs +10 -100
- package/templates/base/tests/scaffold.test.ts.hbs +12 -3
- package/templates/base/tsconfig.json.hbs +7 -4
- package/templates/base/vite.config.ts.hbs +108 -14
- package/templates/base/vitest.config.ts.hbs +6 -2
- package/templates/features/ai/routes/api/chat/+server.ts +3 -1
- package/templates/features/iam/routes-admin/(auth)/auth/forgot-password/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-admin/(auth)/auth/login/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-admin/(auth)/auth/register/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-admin/(auth)/auth/reset-password/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-h5/auth/forgot-password/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-h5/auth/login/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-h5/auth/register/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-h5/auth/reset-password/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-website/auth/forgot-password/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-website/auth/login/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-website/auth/register/+page.svelte.hbs +3 -3
- package/templates/features/iam/routes-website/auth/reset-password/+page.svelte.hbs +3 -3
- package/templates/features/payment/routes/api/v1/payment/create/+server.ts +11 -2
- package/templates/shared/browser-check/startup.js +32 -6
- package/templates/shared/browser-startup.spec.ts +3 -1
- package/templates/shared/build-metadata.ts +18 -4
- package/templates/shared/e2e-env.ts +22 -6
- package/templates/shared/native-name.mjs +9 -2
- package/templates/shared/public-base-path.mjs +17 -4
- package/templates/shared/run-e2e.mjs +40 -9
- package/templates/shared/run-node.mjs +15 -4
- package/templates/shared/run-tauri.mjs +37 -8
- package/templates/shared/vite-runtime-config.ts +9 -3
- package/templates/skills/AGENTS.md +10 -73
- package/templates/skills/bridges/admin/AGENTS.md +9 -65
- package/templates/skills/bridges/api/AGENTS.md +8 -59
- package/templates/skills/bridges/fullstack/AGENTS.md.hbs +9 -54
- package/templates/skills/bridges/h5/AGENTS.md +8 -63
- package/templates/skills/bridges/mobile-app/AGENTS.md +8 -62
- package/templates/skills/bridges/website/AGENTS.md +8 -63
- package/templates/skills/hai-ai/acp.md +2 -0
- package/templates/skills/hai-ai/guide.md +17 -6
- package/templates/skills/hai-ai/reference.md +21 -12
- package/templates/skills/hai-api-client/reference.md +1 -1
- package/templates/skills/hai-app-create/development.md +3 -1
- package/templates/skills/hai-app-create/project.md +33 -0
- package/templates/skills/hai-app-create/reference.md +8 -8
- package/templates/skills/hai-app-tests/reference.md +1 -1
- package/templates/skills/hai-build/SKILL.md +2 -2
- package/templates/skills/hai-build/paths.md +1 -1
- package/templates/skills/hai-build/reference.md +11 -7
- package/templates/skills/hai-capacitor/reference.md +2 -0
- package/templates/skills/hai-ci/SKILL.md +1 -0
- package/templates/skills/hai-core/reference.md +3 -0
- package/templates/skills/hai-crypto/reference.md +2 -0
- package/templates/skills/hai-deploy/SKILL.md +7 -1
- package/templates/skills/hai-deploy/middleware.md +3 -1
- package/templates/skills/hai-framework-sync/sync.md +2 -0
- package/templates/skills/hai-kit/reference.md +16 -4
- package/templates/skills/hai-payment/reference.md +2 -0
- package/templates/skills/hai-reach/SKILL.md +2 -1
- package/templates/skills/hai-reach/reference.md +1 -1
- package/templates/skills/hai-reldb/SKILL.md +1 -1
- package/templates/skills/hai-reldb/reference.md +4 -0
- package/templates/skills/hai-serv/reference.md +12 -2
- package/templates/skills/hai-storage/reference.md +12 -3
- package/templates/skills/hai-ui/SKILL.md +3 -2
- package/templates/skills/hai-ui/guide.md +1 -1
- package/templates/skills/hai-ui/reference.md +23 -35
- package/templates/skills/hai-vecdb/reference.md +1 -1
- package/dist/chunk-6YZBC5MO.js.map +0 -1
- package/dist/chunk-7NVRYYHN.js.map +0 -1
- package/dist/cli-config-templates-QG5HOYR5.js +0 -5
|
@@ -1711,7 +1711,7 @@ var cli_config_catalog_default = [
|
|
|
1711
1711
|
name: "HAI_AI_MEMORY_ALLOWEPHEMERALFALLBACK",
|
|
1712
1712
|
module: "ai",
|
|
1713
1713
|
path: "ai.memory.allowEphemeralFallback",
|
|
1714
|
-
description: "\u662F\u5426\u5141\u8BB8\u5728\u914D\u7F6E\u4E86\u6301\u4E45\u5316\u5411\u91CF\u540E\u7AEF\u4F46 mem0 \u65E0\u6CD5\u6620\u5C04\u65F6\u9000\u56DE\u5185\u5B58\u5B58\u50A8\uFF08\u9ED8\u8BA4 false\uFF09 \u4EC5\u5F71\u54CD `provider='mem0'`\uFF1A\u5F53\u524D\u6846\u67B6\u9002\u914D\u4EC5\u6620\u5C04 qdrant\
|
|
1714
|
+
description: "\u662F\u5426\u5141\u8BB8\u5728\u914D\u7F6E\u4E86\u6301\u4E45\u5316\u5411\u91CF\u540E\u7AEF\u4F46 mem0 \u65E0\u6CD5\u6620\u5C04\u65F6\u9000\u56DE\u5185\u5B58\u5B58\u50A8\uFF08\u9ED8\u8BA4 false\uFF09 \u4EC5\u5F71\u54CD `provider='mem0'`\uFF1A\u5F53\u524D\u6846\u67B6\u9002\u914D\u4EC5\u6620\u5C04 qdrant\uFF1B\u5176\u5B83\u6301\u4E45\u5316\u540E\u7AEF\u4F7F\u7528 native Provider\u3002\u5E95\u5C42 vecdb \u662F lancedb / chroma / \u672A\u77E5\u540E\u7AEF\u65F6\uFF0C\u9ED8\u8BA4 fail-fast\uFF08\u521D\u59CB\u5316\u5931\u8D25\uFF09\uFF0C\u907F\u514D\u670D\u52A1\u91CD\u542F\u540E\u8BB0\u5FC6\u9759\u9ED8\u4E22\u5931\uFF1B \u4EC5\u5F53\u663E\u5F0F\u8BBE\u4E3A true \u65F6\u624D\u5728\u5F00\u53D1\u6216\u660E\u786E E2E \u73AF\u5883\u9000\u56DE\u5185\u5B58\u5B58\u50A8\uFF08\u6570\u636E\u4E0D\u6301\u4E45\uFF09\u3002 \u751F\u4EA7\u59CB\u7EC8\u8981\u6C42\u5B9E\u9645\u6301\u4E45\u5316\u8FDE\u63A5\uFF0C\u4E0D\u80FD\u901A\u8FC7\u6B64\u5F00\u5173\u7ED5\u8FC7\u5171\u4EAB\u72B6\u6001\u8981\u6C42\u3002",
|
|
1715
1715
|
value: "false",
|
|
1716
1716
|
constraint: "true | false"
|
|
1717
1717
|
},
|
|
@@ -1759,7 +1759,7 @@ var cli_config_catalog_default = [
|
|
|
1759
1759
|
name: "HAI_AI_MEMORY_PROVIDER",
|
|
1760
1760
|
module: "ai",
|
|
1761
1761
|
path: "ai.memory.provider",
|
|
1762
|
-
description: "\u8BB0\u5FC6\u540E\u7AEF\uFF1Anative \u4F7F\u7528\u6846\u67B6\u539F\u751F\u5B58\u50A8\u4E0E\u6279\u91CF\u5408\u5E76\uFF1Bmem0 \u5C06\u6846\u67B6\u63D0\u53D6\u7ED3\u679C\
|
|
1762
|
+
description: "\u8BB0\u5FC6\u540E\u7AEF\uFF1Anative \u4F7F\u7528\u6846\u67B6\u539F\u751F\u5B58\u50A8\u4E0E\u6279\u91CF\u5408\u5E76\uFF1Bmem0 \u5C06\u6846\u67B6\u63D0\u53D6\u7ED3\u679C\u4EE5 Mem0 \u6570\u636E\u683C\u5F0F\u5199\u5165 Qdrant",
|
|
1763
1763
|
value: "native",
|
|
1764
1764
|
constraint: "\u5B57\u7B26\u4E32\uFF1B\u53D6\u503C\uFF1Anative | mem0"
|
|
1765
1765
|
},
|
|
@@ -1783,7 +1783,7 @@ var cli_config_catalog_default = [
|
|
|
1783
1783
|
name: "HAI_AI_MEMORY_WRITEBACKRELATEDTOPK",
|
|
1784
1784
|
module: "ai",
|
|
1785
1785
|
path: "ai.memory.writebackRelatedTopK",
|
|
1786
|
-
description: "\u5199\u56DE / \u5408\u5E76\u65F6\u68C0\u7D22\u76F8\u5173\u8BB0\u5FC6\u7684\u6570\u91CF\
|
|
1786
|
+
description: "\u5199\u56DE / \u5408\u5E76\u65F6\u68C0\u7D22\u76F8\u5173\u8BB0\u5FC6\u7684\u6570\u91CF\uFF08\u4EC5 native\uFF0C\u9ED8\u8BA4 20\uFF09",
|
|
1787
1787
|
value: "20",
|
|
1788
1788
|
constraint: "\u6574\u6570\uFF1B<= 9007199254740991\uFF1B> 0"
|
|
1789
1789
|
},
|
|
@@ -7323,7 +7323,10 @@ function withoutGeneratedDocumentation(content) {
|
|
|
7323
7323
|
} else if (isSeq(node)) {
|
|
7324
7324
|
node.items.forEach((item) => collect(item, virtual));
|
|
7325
7325
|
} else if (isScalar(node) && node.range) {
|
|
7326
|
-
ranges.push(virtual ? [
|
|
7326
|
+
ranges.push(virtual ? [
|
|
7327
|
+
originalOffset(node.range[0], false),
|
|
7328
|
+
originalOffset(node.range[1], true)
|
|
7329
|
+
] : [node.range[0], node.range[1]]);
|
|
7327
7330
|
}
|
|
7328
7331
|
}
|
|
7329
7332
|
collect(parseDocument(content).contents, false);
|
|
@@ -7335,7 +7338,9 @@ function withoutGeneratedDocumentation(content) {
|
|
|
7335
7338
|
if (metadata && !protectedAt(starts[index] + metadata[1].length))
|
|
7336
7339
|
return [];
|
|
7337
7340
|
const suffix = line.lastIndexOf(" # \u8BF4\u660E\uFF1A");
|
|
7338
|
-
return [
|
|
7341
|
+
return [
|
|
7342
|
+
suffix >= 0 && !protectedAt(starts[index] + suffix + 1) ? line.slice(0, suffix) : line
|
|
7343
|
+
];
|
|
7339
7344
|
}).join("\n");
|
|
7340
7345
|
}
|
|
7341
7346
|
function documentConfig(name, content) {
|
|
@@ -7365,12 +7370,19 @@ function documentConfig(name, content) {
|
|
|
7365
7370
|
if (!isScalar(pair.key))
|
|
7366
7371
|
continue;
|
|
7367
7372
|
clearGeneratedComments(pair.key);
|
|
7368
|
-
const field = [
|
|
7373
|
+
const field = [
|
|
7374
|
+
...segments,
|
|
7375
|
+
String(pair.key.value)
|
|
7376
|
+
];
|
|
7369
7377
|
const description = catalogByPath.get([name, ...field].join(".").replace(/\.\d+(?=\.|$)/g, ".0"))?.description;
|
|
7370
7378
|
if (description) {
|
|
7371
7379
|
const target = sequenceItem && index === 0 ? node : pair.key;
|
|
7372
7380
|
const entry = catalogByPath.get([name, ...field].join(".").replace(/\.\d+(?=\.|$)/g, ".0"));
|
|
7373
|
-
const comment = [
|
|
7381
|
+
const comment = [
|
|
7382
|
+
target.commentBefore,
|
|
7383
|
+
` \u8BF4\u660E\uFF1A${description}`,
|
|
7384
|
+
entry?.constraint ? ` \u53D6\u503C\uFF1A${configurationConstraint(entry.constraint)}` : void 0
|
|
7385
|
+
].filter(Boolean).join("\n");
|
|
7374
7386
|
if (target.commentBefore !== comment) {
|
|
7375
7387
|
target.commentBefore = comment;
|
|
7376
7388
|
changed = true;
|
|
@@ -7379,7 +7391,10 @@ function documentConfig(name, content) {
|
|
|
7379
7391
|
walk(pair.value, field);
|
|
7380
7392
|
}
|
|
7381
7393
|
} else if (isSeq(node)) {
|
|
7382
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7394
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7395
|
+
...segments,
|
|
7396
|
+
String(index)
|
|
7397
|
+
], true));
|
|
7383
7398
|
}
|
|
7384
7399
|
}
|
|
7385
7400
|
walk(document.contents, []);
|
|
@@ -7395,7 +7410,10 @@ function documentOptionalConfig(name, content) {
|
|
|
7395
7410
|
for (const pair of node.items) {
|
|
7396
7411
|
if (!isScalar(pair.key))
|
|
7397
7412
|
continue;
|
|
7398
|
-
const segments = [
|
|
7413
|
+
const segments = [
|
|
7414
|
+
...path,
|
|
7415
|
+
String(pair.key.value)
|
|
7416
|
+
];
|
|
7399
7417
|
const entry = catalogByPath.get([name, ...segments].join(".").replace(/\.\d+(?=\.|$)/g, ".0"));
|
|
7400
7418
|
if (entry && pair.key.range) {
|
|
7401
7419
|
const line = counter.linePos(pair.key.range[0]).line - 1;
|
|
@@ -7406,7 +7424,10 @@ function documentOptionalConfig(name, content) {
|
|
|
7406
7424
|
walk(pair.value, segments);
|
|
7407
7425
|
}
|
|
7408
7426
|
} else if (isSeq(node)) {
|
|
7409
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7427
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7428
|
+
...path,
|
|
7429
|
+
String(index)
|
|
7430
|
+
]));
|
|
7410
7431
|
}
|
|
7411
7432
|
}
|
|
7412
7433
|
walk(document.contents, []);
|
|
@@ -7433,11 +7454,18 @@ function parameterizeConfig(name, content) {
|
|
|
7433
7454
|
}
|
|
7434
7455
|
if (isMap(node)) {
|
|
7435
7456
|
for (const pair of node.items) {
|
|
7436
|
-
if (isScalar(pair.key))
|
|
7437
|
-
walk(pair.value, [
|
|
7457
|
+
if (isScalar(pair.key)) {
|
|
7458
|
+
walk(pair.value, [
|
|
7459
|
+
...path,
|
|
7460
|
+
String(pair.key.value)
|
|
7461
|
+
]);
|
|
7462
|
+
}
|
|
7438
7463
|
}
|
|
7439
7464
|
} else if (isSeq(node)) {
|
|
7440
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7465
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7466
|
+
...path,
|
|
7467
|
+
String(index)
|
|
7468
|
+
]));
|
|
7441
7469
|
} else if (isScalar(node) && node.value !== null && node.value !== void 0) {
|
|
7442
7470
|
const value = String(node.value);
|
|
7443
7471
|
if (value.includes("${") || /[\n\r}]/.test(value))
|
|
@@ -7461,11 +7489,18 @@ function parameterizeOptionalConfig(name, content) {
|
|
|
7461
7489
|
function walk(node, segments) {
|
|
7462
7490
|
if (isMap(node)) {
|
|
7463
7491
|
for (const pair of node.items) {
|
|
7464
|
-
if (isScalar(pair.key))
|
|
7465
|
-
walk(pair.value, [
|
|
7492
|
+
if (isScalar(pair.key)) {
|
|
7493
|
+
walk(pair.value, [
|
|
7494
|
+
...segments,
|
|
7495
|
+
String(pair.key.value)
|
|
7496
|
+
]);
|
|
7497
|
+
}
|
|
7466
7498
|
}
|
|
7467
7499
|
} else if (isSeq(node)) {
|
|
7468
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7500
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7501
|
+
...segments,
|
|
7502
|
+
String(index)
|
|
7503
|
+
]));
|
|
7469
7504
|
} else if (isScalar(node) && node.range && node.value !== null && node.value !== void 0) {
|
|
7470
7505
|
const location = counter.linePos(node.range[0]);
|
|
7471
7506
|
const line = lines[location.line - 1];
|
|
@@ -7480,7 +7515,11 @@ function parameterizeOptionalConfig(name, content) {
|
|
|
7480
7515
|
const fallback = typeof node.value === "string" && text !== "" && (parsed.errors.length > 0 || !isScalar(parsed.contents) || parsed.contents.value !== text) ? JSON.stringify(text) : text;
|
|
7481
7516
|
const replacement = `\${${variable}:${fallback}}`;
|
|
7482
7517
|
const list = edits.get(location.line - 1) ?? [];
|
|
7483
|
-
list.push({
|
|
7518
|
+
list.push({
|
|
7519
|
+
start: location.col + 1,
|
|
7520
|
+
end: location.col + 1 + node.range[1] - node.range[0],
|
|
7521
|
+
value: JSON.stringify(replacement)
|
|
7522
|
+
});
|
|
7484
7523
|
edits.set(location.line - 1, list);
|
|
7485
7524
|
}
|
|
7486
7525
|
}
|
|
@@ -7498,11 +7537,18 @@ function configEnvironmentVariables(name, content) {
|
|
|
7498
7537
|
function locate(node, path) {
|
|
7499
7538
|
if (isMap(node)) {
|
|
7500
7539
|
for (const pair of node.items) {
|
|
7501
|
-
if (isScalar(pair.key))
|
|
7502
|
-
locate(pair.value, [
|
|
7540
|
+
if (isScalar(pair.key)) {
|
|
7541
|
+
locate(pair.value, [
|
|
7542
|
+
...path,
|
|
7543
|
+
String(pair.key.value)
|
|
7544
|
+
]);
|
|
7545
|
+
}
|
|
7503
7546
|
}
|
|
7504
7547
|
} else if (isSeq(node)) {
|
|
7505
|
-
node.items.forEach((item, index) => locate(item, [
|
|
7548
|
+
node.items.forEach((item, index) => locate(item, [
|
|
7549
|
+
...path,
|
|
7550
|
+
String(index)
|
|
7551
|
+
]));
|
|
7506
7552
|
} else if (isScalar(node) && typeof node.value === "string") {
|
|
7507
7553
|
for (const match of node.value.matchAll(/\$\{([^}:]+)(?::([^}]*))?\}/g)) {
|
|
7508
7554
|
locations.set(match[1], [name, ...path].join("."));
|
|
@@ -7518,7 +7564,9 @@ function configEnvironmentVariables(name, content) {
|
|
|
7518
7564
|
continue;
|
|
7519
7565
|
const normalized = catalogByName.get(variable.replace(/_\d+(?=_|$)/g, "_0"));
|
|
7520
7566
|
const entry = catalogByName.get(variable) ?? normalized;
|
|
7521
|
-
const indices = [
|
|
7567
|
+
const indices = [
|
|
7568
|
+
...variable.matchAll(/_(\d+)(?=_|$)/g)
|
|
7569
|
+
].map((item) => item[1]);
|
|
7522
7570
|
const catalogPath = (entry?.path === variable ? normalized?.path : entry?.path)?.replace(/\.0(?=\.|$)/g, () => `.${indices.shift() ?? "0"}`);
|
|
7523
7571
|
variables.set(variable, {
|
|
7524
7572
|
name: variable,
|
|
@@ -7529,7 +7577,9 @@ function configEnvironmentVariables(name, content) {
|
|
|
7529
7577
|
optional: !locations.has(variable)
|
|
7530
7578
|
});
|
|
7531
7579
|
}
|
|
7532
|
-
return [
|
|
7580
|
+
return [
|
|
7581
|
+
...variables.values()
|
|
7582
|
+
];
|
|
7533
7583
|
}
|
|
7534
7584
|
function variableConstraint(name, value) {
|
|
7535
7585
|
const known = catalogByName.get(name) ?? catalogByName.get(name.replace(/_\d+(?=_|$)/g, "_0"));
|
|
@@ -7570,8 +7620,9 @@ function variableConstraint(name, value) {
|
|
|
7570
7620
|
return "\u6574\u6570 1\u201365535";
|
|
7571
7621
|
if (name.endsWith("TEMPERATURE"))
|
|
7572
7622
|
return "\u6570\u5B57 0\u20132";
|
|
7573
|
-
if (/^HAI_AI_.*(?:TIMEOUT|MAXTOKENS|CACHE_TTL)$/.test(name))
|
|
7623
|
+
if (/^HAI_AI_.*(?:TIMEOUT|MAXTOKENS|CACHE_TTL)$/.test(name)) {
|
|
7574
7624
|
return name.endsWith("MAXTOKENS") ? "\u6570\u5B57 > 0\uFF0C\u5355\u4F4D token" : "\u6570\u5B57 > 0\uFF0C\u5355\u4F4D\u6BEB\u79D2";
|
|
7625
|
+
}
|
|
7575
7626
|
if (name === "HAI_CACHE_DB")
|
|
7576
7627
|
return "\u6574\u6570 0\u201315";
|
|
7577
7628
|
if (name === "HAI_DB_DATABASE")
|
|
@@ -7597,13 +7648,22 @@ function runtimeEnvironmentVariables(content) {
|
|
|
7597
7648
|
const variables = /* @__PURE__ */ new Map();
|
|
7598
7649
|
for (const match of content.matchAll(/(?:process\.env|import\.meta\.env)(?:\?\.)?\.?(?:([A-Z][A-Z0-9_]+)|\[['"]([A-Z][A-Z0-9_]+)['"]\])|\$\{((?:HAI_|PUBLIC_|VITE_)[A-Z0-9_]+)(?::[^}]*)?\}/g)) {
|
|
7599
7650
|
const name = match[1] ?? match[2] ?? match[3];
|
|
7600
|
-
if (match[0].startsWith("import.meta.env") && [
|
|
7651
|
+
if (match[0].startsWith("import.meta.env") && [
|
|
7652
|
+
"SSR",
|
|
7653
|
+
"MODE",
|
|
7654
|
+
"DEV",
|
|
7655
|
+
"PROD",
|
|
7656
|
+
"BASE_URL"
|
|
7657
|
+
].includes(name)) {
|
|
7601
7658
|
continue;
|
|
7659
|
+
}
|
|
7602
7660
|
const variable = catalogByName.get(name);
|
|
7603
7661
|
if (variable)
|
|
7604
7662
|
variables.set(name, variable);
|
|
7605
7663
|
}
|
|
7606
|
-
return [
|
|
7664
|
+
return [
|
|
7665
|
+
...variables.values()
|
|
7666
|
+
];
|
|
7607
7667
|
}
|
|
7608
7668
|
|
|
7609
7669
|
// src/commands/cli-config-templates.ts
|
|
@@ -7788,7 +7848,12 @@ function generateCacheConfig(cfg) {
|
|
|
7788
7848
|
const cacheType = cfg?.type ?? "memory";
|
|
7789
7849
|
const host = cfg?.host ?? "localhost";
|
|
7790
7850
|
const port = cfg?.port ?? 6379;
|
|
7791
|
-
const connection = stringify({
|
|
7851
|
+
const connection = stringify({
|
|
7852
|
+
host,
|
|
7853
|
+
port,
|
|
7854
|
+
password: "",
|
|
7855
|
+
keyPrefix: "hai:"
|
|
7856
|
+
}).trim();
|
|
7792
7857
|
return `# =============================================================================
|
|
7793
7858
|
# \u7F13\u5B58\u914D\u7F6E
|
|
7794
7859
|
# =============================================================================
|
|
@@ -8223,8 +8288,34 @@ ${stringify({ model }).trim().split("\n").map((line) => ` ${line}`).join("\n")}
|
|
|
8223
8288
|
`;
|
|
8224
8289
|
}
|
|
8225
8290
|
function generateEnvExample(features, configs, includeDisabled = false, configContents = {}) {
|
|
8226
|
-
const keys = /* @__PURE__ */ new Set([
|
|
8227
|
-
|
|
8291
|
+
const keys = /* @__PURE__ */ new Set([
|
|
8292
|
+
"core",
|
|
8293
|
+
...["serv", "kit"].filter((key) => configContents[key]),
|
|
8294
|
+
...features.filter((feature) => ![
|
|
8295
|
+
"crypto",
|
|
8296
|
+
"api-client",
|
|
8297
|
+
"capacitor",
|
|
8298
|
+
"datapipe"
|
|
8299
|
+
].includes(feature))
|
|
8300
|
+
]);
|
|
8301
|
+
const allKeys = [
|
|
8302
|
+
"core",
|
|
8303
|
+
"serv",
|
|
8304
|
+
"kit",
|
|
8305
|
+
"crypto",
|
|
8306
|
+
"db",
|
|
8307
|
+
"cache",
|
|
8308
|
+
"iam",
|
|
8309
|
+
"storage",
|
|
8310
|
+
"ai",
|
|
8311
|
+
"vecdb",
|
|
8312
|
+
"reach",
|
|
8313
|
+
"payment",
|
|
8314
|
+
"scheduler",
|
|
8315
|
+
"deploy",
|
|
8316
|
+
"audit",
|
|
8317
|
+
"feedback"
|
|
8318
|
+
];
|
|
8228
8319
|
const sections = [`# Environment configuration
|
|
8229
8320
|
# .env / .env.dev / .env.test / .env.prod are public configuration tracked in Git.
|
|
8230
8321
|
# .env.local is private to this machine and ignored by Git.
|
|
@@ -8272,7 +8363,14 @@ function generateProductionEnvironment(features, configs) {
|
|
|
8272
8363
|
if (enabled.has("db")) {
|
|
8273
8364
|
const mysql = configs?.db?.type === "mysql";
|
|
8274
8365
|
const database = configs?.db?.type !== "sqlite" && configs?.db?.database ? configs.db.database : "hai";
|
|
8275
|
-
sections.push("", "# \u5FC5\u987B\u79C1\u6709\u6CE8\u5165 HAI_DB_PASSWORD\uFF1B\u5916\u90E8\u6570\u636E\u5E93\u53EF\u8986\u76D6\u4E0B\u5217\u8FDE\u63A5\u5B57\u6BB5\u3002", `HAI_DB_TYPE=${mysql ? "mysql" : "postgresql"}`, "HAI_DB_HOST=db", `HAI_DB_PORT=${mysql ? 3306 : 5432}`, renderEnvironment([
|
|
8366
|
+
sections.push("", "# \u5FC5\u987B\u79C1\u6709\u6CE8\u5165 HAI_DB_PASSWORD\uFF1B\u5916\u90E8\u6570\u636E\u5E93\u53EF\u8986\u76D6\u4E0B\u5217\u8FDE\u63A5\u5B57\u6BB5\u3002", `HAI_DB_TYPE=${mysql ? "mysql" : "postgresql"}`, "HAI_DB_HOST=db", `HAI_DB_PORT=${mysql ? 3306 : 5432}`, renderEnvironment([
|
|
8367
|
+
{
|
|
8368
|
+
name: "HAI_DB_DATABASE",
|
|
8369
|
+
path: "db.database",
|
|
8370
|
+
value: database,
|
|
8371
|
+
constraint: "\u751F\u4EA7\u6570\u636E\u5E93\u540D"
|
|
8372
|
+
}
|
|
8373
|
+
]), `HAI_DB_USER=${mysql ? "root" : "postgres"}`);
|
|
8276
8374
|
}
|
|
8277
8375
|
if (enabled.has("cache"))
|
|
8278
8376
|
sections.push("", "# \u5FC5\u987B\u79C1\u6709\u6CE8\u5165 HAI_CACHE_PASSWORD\u3002", "HAI_CACHE_TYPE=redis", "HAI_CACHE_HOST=cache", "HAI_CACHE_PORT=6379");
|
|
@@ -8604,5 +8702,5 @@ envAllowlist:
|
|
|
8604
8702
|
}
|
|
8605
8703
|
|
|
8606
8704
|
export { documentConfig, generateConfigFile, generateEnvExample, generateProductionEnvironment, moduleEnvironmentVariables, parameterizeConfig, renderEnvironment, runtimeEnvironmentVariables };
|
|
8607
|
-
//# sourceMappingURL=chunk-
|
|
8608
|
-
//# sourceMappingURL=chunk-
|
|
8705
|
+
//# sourceMappingURL=chunk-L53P43B2.js.map
|
|
8706
|
+
//# sourceMappingURL=chunk-L53P43B2.js.map
|