@h-ai/cli 1.0.0-beta.17 → 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 +6 -0
- package/README.ja.md +6 -0
- package/README.md +6 -0
- package/dist/{chunk-EWTIVFHN.js → chunk-2ZL5ORQ2.js} +94 -28
- package/dist/chunk-2ZL5ORQ2.js.map +1 -0
- package/dist/{chunk-S2ZP7BHG.js → chunk-L53P43B2.js} +138 -32
- package/dist/chunk-L53P43B2.js.map +1 -0
- package/dist/cli-config-templates-LWMD2I6V.js +5 -0
- package/dist/{cli-config-templates-MKVYSK3E.js.map → cli-config-templates-LWMD2I6V.js.map} +1 -1
- package/dist/{cli-skill-templates-M64VPXZ4.js → cli-skill-templates-D6S2OQ6X.js} +3 -3
- package/dist/{cli-skill-templates-M64VPXZ4.js.map → cli-skill-templates-D6S2OQ6X.js.map} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2797 -666
- 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 +9 -1
- 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 +3 -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/SKILL.md +13 -9
- 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-EWTIVFHN.js.map +0 -1
- package/dist/chunk-S2ZP7BHG.js.map +0 -1
- package/dist/cli-config-templates-MKVYSK3E.js +0 -5
|
@@ -431,7 +431,15 @@ var cli_config_catalog_default = [
|
|
|
431
431
|
name: "HAI_AI_ACP_WORKSPACES_0_ENVIRONMENTREFS",
|
|
432
432
|
module: "ai",
|
|
433
433
|
path: "ai.acp.workspaces.0.environmentRefs",
|
|
434
|
-
description: "\
|
|
434
|
+
description: "\u5DE5\u4F5C\u533A\u5386\u53F2\u5171\u7528\u53D8\u91CF\u6620\u5C04\uFF1BAgent \u4E13\u7528\u51ED\u636E\u5E94\u914D\u7F6E\u5728 Agent \u5B9A\u4E49\u4E2D\u3002",
|
|
435
|
+
value: "{}",
|
|
436
|
+
constraint: "JSON \u5BF9\u8C61\uFF1B\u6574\u4F53\u8986\u76D6\u65F6\u66FF\u6362\u8BE5\u8282\u70B9"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
name: "HAI_AI_ACP_WORKSPACES_0_GITENVIRONMENTREFS",
|
|
440
|
+
module: "ai",
|
|
441
|
+
path: "ai.acp.workspaces.0.gitEnvironmentRefs",
|
|
442
|
+
description: "\u4EC5\u4F9B\u53D7\u7BA1 Git \u8FDC\u7A0B\u64CD\u4F5C\u4F7F\u7528\u7684\u73AF\u5883\u53D8\u91CF\u5F15\u7528\uFF0C\u503C\u4E0D\u4F20\u7ED9 Agent \u6216\u672C\u5730\u63D0\u4EA4\u3002",
|
|
435
443
|
value: "{}",
|
|
436
444
|
constraint: "JSON \u5BF9\u8C61\uFF1B\u6574\u4F53\u8986\u76D6\u65F6\u66FF\u6362\u8BE5\u8282\u70B9"
|
|
437
445
|
},
|
|
@@ -1703,7 +1711,7 @@ var cli_config_catalog_default = [
|
|
|
1703
1711
|
name: "HAI_AI_MEMORY_ALLOWEPHEMERALFALLBACK",
|
|
1704
1712
|
module: "ai",
|
|
1705
1713
|
path: "ai.memory.allowEphemeralFallback",
|
|
1706
|
-
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",
|
|
1707
1715
|
value: "false",
|
|
1708
1716
|
constraint: "true | false"
|
|
1709
1717
|
},
|
|
@@ -1751,7 +1759,7 @@ var cli_config_catalog_default = [
|
|
|
1751
1759
|
name: "HAI_AI_MEMORY_PROVIDER",
|
|
1752
1760
|
module: "ai",
|
|
1753
1761
|
path: "ai.memory.provider",
|
|
1754
|
-
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",
|
|
1755
1763
|
value: "native",
|
|
1756
1764
|
constraint: "\u5B57\u7B26\u4E32\uFF1B\u53D6\u503C\uFF1Anative | mem0"
|
|
1757
1765
|
},
|
|
@@ -1775,7 +1783,7 @@ var cli_config_catalog_default = [
|
|
|
1775
1783
|
name: "HAI_AI_MEMORY_WRITEBACKRELATEDTOPK",
|
|
1776
1784
|
module: "ai",
|
|
1777
1785
|
path: "ai.memory.writebackRelatedTopK",
|
|
1778
|
-
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",
|
|
1779
1787
|
value: "20",
|
|
1780
1788
|
constraint: "\u6574\u6570\uFF1B<= 9007199254740991\uFF1B> 0"
|
|
1781
1789
|
},
|
|
@@ -7315,7 +7323,10 @@ function withoutGeneratedDocumentation(content) {
|
|
|
7315
7323
|
} else if (isSeq(node)) {
|
|
7316
7324
|
node.items.forEach((item) => collect(item, virtual));
|
|
7317
7325
|
} else if (isScalar(node) && node.range) {
|
|
7318
|
-
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]]);
|
|
7319
7330
|
}
|
|
7320
7331
|
}
|
|
7321
7332
|
collect(parseDocument(content).contents, false);
|
|
@@ -7327,7 +7338,9 @@ function withoutGeneratedDocumentation(content) {
|
|
|
7327
7338
|
if (metadata && !protectedAt(starts[index] + metadata[1].length))
|
|
7328
7339
|
return [];
|
|
7329
7340
|
const suffix = line.lastIndexOf(" # \u8BF4\u660E\uFF1A");
|
|
7330
|
-
return [
|
|
7341
|
+
return [
|
|
7342
|
+
suffix >= 0 && !protectedAt(starts[index] + suffix + 1) ? line.slice(0, suffix) : line
|
|
7343
|
+
];
|
|
7331
7344
|
}).join("\n");
|
|
7332
7345
|
}
|
|
7333
7346
|
function documentConfig(name, content) {
|
|
@@ -7357,12 +7370,19 @@ function documentConfig(name, content) {
|
|
|
7357
7370
|
if (!isScalar(pair.key))
|
|
7358
7371
|
continue;
|
|
7359
7372
|
clearGeneratedComments(pair.key);
|
|
7360
|
-
const field = [
|
|
7373
|
+
const field = [
|
|
7374
|
+
...segments,
|
|
7375
|
+
String(pair.key.value)
|
|
7376
|
+
];
|
|
7361
7377
|
const description = catalogByPath.get([name, ...field].join(".").replace(/\.\d+(?=\.|$)/g, ".0"))?.description;
|
|
7362
7378
|
if (description) {
|
|
7363
7379
|
const target = sequenceItem && index === 0 ? node : pair.key;
|
|
7364
7380
|
const entry = catalogByPath.get([name, ...field].join(".").replace(/\.\d+(?=\.|$)/g, ".0"));
|
|
7365
|
-
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");
|
|
7366
7386
|
if (target.commentBefore !== comment) {
|
|
7367
7387
|
target.commentBefore = comment;
|
|
7368
7388
|
changed = true;
|
|
@@ -7371,7 +7391,10 @@ function documentConfig(name, content) {
|
|
|
7371
7391
|
walk(pair.value, field);
|
|
7372
7392
|
}
|
|
7373
7393
|
} else if (isSeq(node)) {
|
|
7374
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7394
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7395
|
+
...segments,
|
|
7396
|
+
String(index)
|
|
7397
|
+
], true));
|
|
7375
7398
|
}
|
|
7376
7399
|
}
|
|
7377
7400
|
walk(document.contents, []);
|
|
@@ -7387,7 +7410,10 @@ function documentOptionalConfig(name, content) {
|
|
|
7387
7410
|
for (const pair of node.items) {
|
|
7388
7411
|
if (!isScalar(pair.key))
|
|
7389
7412
|
continue;
|
|
7390
|
-
const segments = [
|
|
7413
|
+
const segments = [
|
|
7414
|
+
...path,
|
|
7415
|
+
String(pair.key.value)
|
|
7416
|
+
];
|
|
7391
7417
|
const entry = catalogByPath.get([name, ...segments].join(".").replace(/\.\d+(?=\.|$)/g, ".0"));
|
|
7392
7418
|
if (entry && pair.key.range) {
|
|
7393
7419
|
const line = counter.linePos(pair.key.range[0]).line - 1;
|
|
@@ -7398,7 +7424,10 @@ function documentOptionalConfig(name, content) {
|
|
|
7398
7424
|
walk(pair.value, segments);
|
|
7399
7425
|
}
|
|
7400
7426
|
} else if (isSeq(node)) {
|
|
7401
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7427
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7428
|
+
...path,
|
|
7429
|
+
String(index)
|
|
7430
|
+
]));
|
|
7402
7431
|
}
|
|
7403
7432
|
}
|
|
7404
7433
|
walk(document.contents, []);
|
|
@@ -7425,11 +7454,18 @@ function parameterizeConfig(name, content) {
|
|
|
7425
7454
|
}
|
|
7426
7455
|
if (isMap(node)) {
|
|
7427
7456
|
for (const pair of node.items) {
|
|
7428
|
-
if (isScalar(pair.key))
|
|
7429
|
-
walk(pair.value, [
|
|
7457
|
+
if (isScalar(pair.key)) {
|
|
7458
|
+
walk(pair.value, [
|
|
7459
|
+
...path,
|
|
7460
|
+
String(pair.key.value)
|
|
7461
|
+
]);
|
|
7462
|
+
}
|
|
7430
7463
|
}
|
|
7431
7464
|
} else if (isSeq(node)) {
|
|
7432
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7465
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7466
|
+
...path,
|
|
7467
|
+
String(index)
|
|
7468
|
+
]));
|
|
7433
7469
|
} else if (isScalar(node) && node.value !== null && node.value !== void 0) {
|
|
7434
7470
|
const value = String(node.value);
|
|
7435
7471
|
if (value.includes("${") || /[\n\r}]/.test(value))
|
|
@@ -7453,11 +7489,18 @@ function parameterizeOptionalConfig(name, content) {
|
|
|
7453
7489
|
function walk(node, segments) {
|
|
7454
7490
|
if (isMap(node)) {
|
|
7455
7491
|
for (const pair of node.items) {
|
|
7456
|
-
if (isScalar(pair.key))
|
|
7457
|
-
walk(pair.value, [
|
|
7492
|
+
if (isScalar(pair.key)) {
|
|
7493
|
+
walk(pair.value, [
|
|
7494
|
+
...segments,
|
|
7495
|
+
String(pair.key.value)
|
|
7496
|
+
]);
|
|
7497
|
+
}
|
|
7458
7498
|
}
|
|
7459
7499
|
} else if (isSeq(node)) {
|
|
7460
|
-
node.items.forEach((item, index) => walk(item, [
|
|
7500
|
+
node.items.forEach((item, index) => walk(item, [
|
|
7501
|
+
...segments,
|
|
7502
|
+
String(index)
|
|
7503
|
+
]));
|
|
7461
7504
|
} else if (isScalar(node) && node.range && node.value !== null && node.value !== void 0) {
|
|
7462
7505
|
const location = counter.linePos(node.range[0]);
|
|
7463
7506
|
const line = lines[location.line - 1];
|
|
@@ -7472,7 +7515,11 @@ function parameterizeOptionalConfig(name, content) {
|
|
|
7472
7515
|
const fallback = typeof node.value === "string" && text !== "" && (parsed.errors.length > 0 || !isScalar(parsed.contents) || parsed.contents.value !== text) ? JSON.stringify(text) : text;
|
|
7473
7516
|
const replacement = `\${${variable}:${fallback}}`;
|
|
7474
7517
|
const list = edits.get(location.line - 1) ?? [];
|
|
7475
|
-
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
|
+
});
|
|
7476
7523
|
edits.set(location.line - 1, list);
|
|
7477
7524
|
}
|
|
7478
7525
|
}
|
|
@@ -7490,11 +7537,18 @@ function configEnvironmentVariables(name, content) {
|
|
|
7490
7537
|
function locate(node, path) {
|
|
7491
7538
|
if (isMap(node)) {
|
|
7492
7539
|
for (const pair of node.items) {
|
|
7493
|
-
if (isScalar(pair.key))
|
|
7494
|
-
locate(pair.value, [
|
|
7540
|
+
if (isScalar(pair.key)) {
|
|
7541
|
+
locate(pair.value, [
|
|
7542
|
+
...path,
|
|
7543
|
+
String(pair.key.value)
|
|
7544
|
+
]);
|
|
7545
|
+
}
|
|
7495
7546
|
}
|
|
7496
7547
|
} else if (isSeq(node)) {
|
|
7497
|
-
node.items.forEach((item, index) => locate(item, [
|
|
7548
|
+
node.items.forEach((item, index) => locate(item, [
|
|
7549
|
+
...path,
|
|
7550
|
+
String(index)
|
|
7551
|
+
]));
|
|
7498
7552
|
} else if (isScalar(node) && typeof node.value === "string") {
|
|
7499
7553
|
for (const match of node.value.matchAll(/\$\{([^}:]+)(?::([^}]*))?\}/g)) {
|
|
7500
7554
|
locations.set(match[1], [name, ...path].join("."));
|
|
@@ -7510,7 +7564,9 @@ function configEnvironmentVariables(name, content) {
|
|
|
7510
7564
|
continue;
|
|
7511
7565
|
const normalized = catalogByName.get(variable.replace(/_\d+(?=_|$)/g, "_0"));
|
|
7512
7566
|
const entry = catalogByName.get(variable) ?? normalized;
|
|
7513
|
-
const indices = [
|
|
7567
|
+
const indices = [
|
|
7568
|
+
...variable.matchAll(/_(\d+)(?=_|$)/g)
|
|
7569
|
+
].map((item) => item[1]);
|
|
7514
7570
|
const catalogPath = (entry?.path === variable ? normalized?.path : entry?.path)?.replace(/\.0(?=\.|$)/g, () => `.${indices.shift() ?? "0"}`);
|
|
7515
7571
|
variables.set(variable, {
|
|
7516
7572
|
name: variable,
|
|
@@ -7521,7 +7577,9 @@ function configEnvironmentVariables(name, content) {
|
|
|
7521
7577
|
optional: !locations.has(variable)
|
|
7522
7578
|
});
|
|
7523
7579
|
}
|
|
7524
|
-
return [
|
|
7580
|
+
return [
|
|
7581
|
+
...variables.values()
|
|
7582
|
+
];
|
|
7525
7583
|
}
|
|
7526
7584
|
function variableConstraint(name, value) {
|
|
7527
7585
|
const known = catalogByName.get(name) ?? catalogByName.get(name.replace(/_\d+(?=_|$)/g, "_0"));
|
|
@@ -7562,8 +7620,9 @@ function variableConstraint(name, value) {
|
|
|
7562
7620
|
return "\u6574\u6570 1\u201365535";
|
|
7563
7621
|
if (name.endsWith("TEMPERATURE"))
|
|
7564
7622
|
return "\u6570\u5B57 0\u20132";
|
|
7565
|
-
if (/^HAI_AI_.*(?:TIMEOUT|MAXTOKENS|CACHE_TTL)$/.test(name))
|
|
7623
|
+
if (/^HAI_AI_.*(?:TIMEOUT|MAXTOKENS|CACHE_TTL)$/.test(name)) {
|
|
7566
7624
|
return name.endsWith("MAXTOKENS") ? "\u6570\u5B57 > 0\uFF0C\u5355\u4F4D token" : "\u6570\u5B57 > 0\uFF0C\u5355\u4F4D\u6BEB\u79D2";
|
|
7625
|
+
}
|
|
7567
7626
|
if (name === "HAI_CACHE_DB")
|
|
7568
7627
|
return "\u6574\u6570 0\u201315";
|
|
7569
7628
|
if (name === "HAI_DB_DATABASE")
|
|
@@ -7589,13 +7648,22 @@ function runtimeEnvironmentVariables(content) {
|
|
|
7589
7648
|
const variables = /* @__PURE__ */ new Map();
|
|
7590
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)) {
|
|
7591
7650
|
const name = match[1] ?? match[2] ?? match[3];
|
|
7592
|
-
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)) {
|
|
7593
7658
|
continue;
|
|
7659
|
+
}
|
|
7594
7660
|
const variable = catalogByName.get(name);
|
|
7595
7661
|
if (variable)
|
|
7596
7662
|
variables.set(name, variable);
|
|
7597
7663
|
}
|
|
7598
|
-
return [
|
|
7664
|
+
return [
|
|
7665
|
+
...variables.values()
|
|
7666
|
+
];
|
|
7599
7667
|
}
|
|
7600
7668
|
|
|
7601
7669
|
// src/commands/cli-config-templates.ts
|
|
@@ -7780,7 +7848,12 @@ function generateCacheConfig(cfg) {
|
|
|
7780
7848
|
const cacheType = cfg?.type ?? "memory";
|
|
7781
7849
|
const host = cfg?.host ?? "localhost";
|
|
7782
7850
|
const port = cfg?.port ?? 6379;
|
|
7783
|
-
const connection = stringify({
|
|
7851
|
+
const connection = stringify({
|
|
7852
|
+
host,
|
|
7853
|
+
port,
|
|
7854
|
+
password: "",
|
|
7855
|
+
keyPrefix: "hai:"
|
|
7856
|
+
}).trim();
|
|
7784
7857
|
return `# =============================================================================
|
|
7785
7858
|
# \u7F13\u5B58\u914D\u7F6E
|
|
7786
7859
|
# =============================================================================
|
|
@@ -8215,8 +8288,34 @@ ${stringify({ model }).trim().split("\n").map((line) => ` ${line}`).join("\n")}
|
|
|
8215
8288
|
`;
|
|
8216
8289
|
}
|
|
8217
8290
|
function generateEnvExample(features, configs, includeDisabled = false, configContents = {}) {
|
|
8218
|
-
const keys = /* @__PURE__ */ new Set([
|
|
8219
|
-
|
|
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
|
+
];
|
|
8220
8319
|
const sections = [`# Environment configuration
|
|
8221
8320
|
# .env / .env.dev / .env.test / .env.prod are public configuration tracked in Git.
|
|
8222
8321
|
# .env.local is private to this machine and ignored by Git.
|
|
@@ -8264,7 +8363,14 @@ function generateProductionEnvironment(features, configs) {
|
|
|
8264
8363
|
if (enabled.has("db")) {
|
|
8265
8364
|
const mysql = configs?.db?.type === "mysql";
|
|
8266
8365
|
const database = configs?.db?.type !== "sqlite" && configs?.db?.database ? configs.db.database : "hai";
|
|
8267
|
-
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"}`);
|
|
8268
8374
|
}
|
|
8269
8375
|
if (enabled.has("cache"))
|
|
8270
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");
|
|
@@ -8596,5 +8702,5 @@ envAllowlist:
|
|
|
8596
8702
|
}
|
|
8597
8703
|
|
|
8598
8704
|
export { documentConfig, generateConfigFile, generateEnvExample, generateProductionEnvironment, moduleEnvironmentVariables, parameterizeConfig, renderEnvironment, runtimeEnvironmentVariables };
|
|
8599
|
-
//# sourceMappingURL=chunk-
|
|
8600
|
-
//# sourceMappingURL=chunk-
|
|
8705
|
+
//# sourceMappingURL=chunk-L53P43B2.js.map
|
|
8706
|
+
//# sourceMappingURL=chunk-L53P43B2.js.map
|