veryfront 0.1.111 → 0.1.113
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/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +13 -0
- package/esm/cli/commands/analyze-chunks/command-help.d.ts.map +1 -1
- package/esm/cli/commands/analyze-chunks/command-help.js +1 -0
- package/esm/cli/commands/build/command-help.d.ts.map +1 -1
- package/esm/cli/commands/build/command-help.js +1 -0
- package/esm/cli/commands/build/command.d.ts.map +1 -1
- package/esm/cli/commands/build/command.js +47 -2
- package/esm/cli/commands/clean/command-help.d.ts.map +1 -1
- package/esm/cli/commands/clean/command-help.js +1 -0
- package/esm/cli/commands/completions/command-help.d.ts +3 -0
- package/esm/cli/commands/completions/command-help.d.ts.map +1 -0
- package/esm/cli/commands/completions/command-help.js +13 -0
- package/esm/cli/commands/completions/command.d.ts +28 -0
- package/esm/cli/commands/completions/command.d.ts.map +1 -0
- package/esm/cli/commands/completions/command.js +133 -0
- package/esm/cli/commands/completions/handler.d.ts +3 -0
- package/esm/cli/commands/completions/handler.d.ts.map +1 -0
- package/esm/cli/commands/completions/handler.js +20 -0
- package/esm/cli/commands/demo/command-help.d.ts.map +1 -1
- package/esm/cli/commands/demo/command-help.js +1 -0
- package/esm/cli/commands/deploy/command-help.d.ts.map +1 -1
- package/esm/cli/commands/deploy/command-help.js +1 -0
- package/esm/cli/commands/deploy/command.d.ts.map +1 -1
- package/esm/cli/commands/deploy/command.js +73 -1
- package/esm/cli/commands/dev/command-help.d.ts.map +1 -1
- package/esm/cli/commands/dev/command-help.js +1 -0
- package/esm/cli/commands/doctor/command-help.d.ts.map +1 -1
- package/esm/cli/commands/doctor/command-help.js +1 -0
- package/esm/cli/commands/files/command-help.d.ts.map +1 -1
- package/esm/cli/commands/files/command-help.js +1 -0
- package/esm/cli/commands/generate/command-help.d.ts.map +1 -1
- package/esm/cli/commands/generate/command-help.js +1 -0
- package/esm/cli/commands/init/command-help.d.ts.map +1 -1
- package/esm/cli/commands/init/command-help.js +1 -0
- package/esm/cli/commands/install/command-help.d.ts.map +1 -1
- package/esm/cli/commands/install/command-help.js +2 -0
- package/esm/cli/commands/issues/command-help.d.ts.map +1 -1
- package/esm/cli/commands/issues/command-help.js +1 -0
- package/esm/cli/commands/knowledge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command-help.js +1 -0
- package/esm/cli/commands/lint/command-help.d.ts +3 -0
- package/esm/cli/commands/lint/command-help.d.ts.map +1 -0
- package/esm/cli/commands/lint/command-help.js +13 -0
- package/esm/cli/commands/lint/command.d.ts +24 -0
- package/esm/cli/commands/lint/command.d.ts.map +1 -0
- package/esm/cli/commands/lint/command.js +34 -0
- package/esm/cli/commands/lint/handler.d.ts +3 -0
- package/esm/cli/commands/lint/handler.d.ts.map +1 -0
- package/esm/cli/commands/lint/handler.js +33 -0
- package/esm/cli/commands/lock/command-help.d.ts.map +1 -1
- package/esm/cli/commands/lock/command-help.js +1 -0
- package/esm/cli/commands/login/command-help.d.ts.map +1 -1
- package/esm/cli/commands/login/command-help.js +1 -0
- package/esm/cli/commands/logout/command-help.d.ts.map +1 -1
- package/esm/cli/commands/logout/command-help.js +1 -0
- package/esm/cli/commands/mcp/command-help.d.ts.map +1 -1
- package/esm/cli/commands/mcp/command-help.js +1 -0
- package/esm/cli/commands/merge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/merge/command-help.js +1 -0
- package/esm/cli/commands/pull/command-help.d.ts.map +1 -1
- package/esm/cli/commands/pull/command-help.js +1 -0
- package/esm/cli/commands/push/command-help.d.ts.map +1 -1
- package/esm/cli/commands/push/command-help.js +1 -0
- package/esm/cli/commands/routes/command-help.d.ts.map +1 -1
- package/esm/cli/commands/routes/command-help.js +1 -0
- package/esm/cli/commands/schema/command-help.d.ts +3 -0
- package/esm/cli/commands/schema/command-help.d.ts.map +1 -0
- package/esm/cli/commands/schema/command-help.js +15 -0
- package/esm/cli/commands/schema/command.d.ts +30 -0
- package/esm/cli/commands/schema/command.d.ts.map +1 -0
- package/esm/cli/commands/schema/command.js +39 -0
- package/esm/cli/commands/schema/handler.d.ts +3 -0
- package/esm/cli/commands/schema/handler.d.ts.map +1 -0
- package/esm/cli/commands/schema/handler.js +25 -0
- package/esm/cli/commands/serve/command-help.d.ts.map +1 -1
- package/esm/cli/commands/serve/command-help.js +1 -0
- package/esm/cli/commands/skills/command-help.d.ts +3 -0
- package/esm/cli/commands/skills/command-help.d.ts.map +1 -0
- package/esm/cli/commands/skills/command-help.js +21 -0
- package/esm/cli/commands/skills/command.d.ts +9 -0
- package/esm/cli/commands/skills/command.d.ts.map +1 -0
- package/esm/cli/commands/skills/command.js +17 -0
- package/esm/cli/commands/skills/create.d.ts +3 -0
- package/esm/cli/commands/skills/create.d.ts.map +1 -0
- package/esm/cli/commands/skills/create.js +65 -0
- package/esm/cli/commands/skills/handler.d.ts +3 -0
- package/esm/cli/commands/skills/handler.d.ts.map +1 -0
- package/esm/cli/commands/skills/handler.js +82 -0
- package/esm/cli/commands/skills/validate.d.ts +3 -0
- package/esm/cli/commands/skills/validate.d.ts.map +1 -0
- package/esm/cli/commands/skills/validate.js +91 -0
- package/esm/cli/commands/start/command-help.d.ts.map +1 -1
- package/esm/cli/commands/start/command-help.js +1 -0
- package/esm/cli/commands/studio/command-help.d.ts.map +1 -1
- package/esm/cli/commands/studio/command-help.js +1 -0
- package/esm/cli/commands/styles/command-help.d.ts.map +1 -1
- package/esm/cli/commands/styles/command-help.js +1 -0
- package/esm/cli/commands/task/command-help.d.ts.map +1 -1
- package/esm/cli/commands/task/command-help.js +1 -0
- package/esm/cli/commands/test/command-help.d.ts +3 -0
- package/esm/cli/commands/test/command-help.d.ts.map +1 -0
- package/esm/cli/commands/test/command-help.js +16 -0
- package/esm/cli/commands/test/command.d.ts +25 -0
- package/esm/cli/commands/test/command.d.ts.map +1 -0
- package/esm/cli/commands/test/command.js +68 -0
- package/esm/cli/commands/test/handler.d.ts +3 -0
- package/esm/cli/commands/test/handler.d.ts.map +1 -0
- package/esm/cli/commands/test/handler.js +61 -0
- package/esm/cli/commands/up/command-help.d.ts.map +1 -1
- package/esm/cli/commands/up/command-help.js +1 -0
- package/esm/cli/commands/uploads/command-help.d.ts.map +1 -1
- package/esm/cli/commands/uploads/command-help.js +1 -0
- package/esm/cli/commands/whoami/command-help.d.ts.map +1 -1
- package/esm/cli/commands/whoami/command-help.js +1 -0
- package/esm/cli/commands/workflow/command-help.d.ts.map +1 -1
- package/esm/cli/commands/workflow/command-help.js +1 -0
- package/esm/cli/help/command-definitions.d.ts.map +1 -1
- package/esm/cli/help/command-definitions.js +10 -0
- package/esm/cli/help/main-help.d.ts.map +1 -1
- package/esm/cli/help/main-help.js +38 -5
- package/esm/cli/help/types.d.ts +2 -0
- package/esm/cli/help/types.d.ts.map +1 -1
- package/esm/cli/mcp/advanced-tools.d.ts.map +1 -1
- package/esm/cli/mcp/advanced-tools.js +4 -0
- package/esm/cli/mcp/server.d.ts.map +1 -1
- package/esm/cli/mcp/server.js +68 -0
- package/esm/cli/mcp/standalone.d.ts +2 -0
- package/esm/cli/mcp/standalone.d.ts.map +1 -1
- package/esm/cli/mcp/standalone.js +117 -2
- package/esm/cli/mcp/tools/cicd-tools.d.ts +3 -0
- package/esm/cli/mcp/tools/cicd-tools.d.ts.map +1 -0
- package/esm/cli/mcp/tools/cicd-tools.js +75 -0
- package/esm/cli/mcp/tools/introspection-tools.d.ts +3 -0
- package/esm/cli/mcp/tools/introspection-tools.d.ts.map +1 -0
- package/esm/cli/mcp/tools/introspection-tools.js +38 -0
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +35 -1
- package/esm/cli/shared/args.d.ts +4 -0
- package/esm/cli/shared/args.d.ts.map +1 -1
- package/esm/cli/shared/args.js +2 -0
- package/esm/cli/shared/interactive.d.ts +13 -0
- package/esm/cli/shared/interactive.d.ts.map +1 -0
- package/esm/cli/shared/interactive.js +26 -0
- package/esm/cli/shared/json-output.d.ts +52 -0
- package/esm/cli/shared/json-output.d.ts.map +1 -0
- package/esm/cli/shared/json-output.js +58 -0
- package/esm/cli/shared/suggest.d.ts +8 -0
- package/esm/cli/shared/suggest.d.ts.map +1 -0
- package/esm/cli/shared/suggest.js +25 -0
- package/esm/cli/skills/core-skills.d.ts +9 -0
- package/esm/cli/skills/core-skills.d.ts.map +1 -0
- package/esm/cli/skills/core-skills.js +230 -0
- package/esm/cli/skills/loader.d.ts +13 -0
- package/esm/cli/skills/loader.d.ts.map +1 -0
- package/esm/cli/skills/loader.js +87 -0
- package/esm/cli/skills/types.d.ts +29 -0
- package/esm/cli/skills/types.d.ts.map +1 -0
- package/esm/cli/skills/types.js +25 -0
- package/esm/cli/utils/index.d.ts.map +1 -1
- package/esm/cli/utils/index.js +3 -0
- package/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/html/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/dev-scripts.js +3 -2
- package/esm/src/html/html-injection.d.ts.map +1 -1
- package/esm/src/html/html-injection.js +2 -1
- package/esm/src/html/html-shell-generator.js +1 -1
- package/esm/src/html/hydration-script-builder/dev-client-renderer.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-component-manifest.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -1
- package/esm/src/html/hydration-script-builder/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +2 -1
- package/esm/src/html/styles-builder/dev-styles.d.ts.map +1 -1
- package/esm/src/html/styles-builder/dev-styles.js +2 -1
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.d.ts +10 -0
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.js +53 -26
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.js +3 -3
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +94 -5
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +2 -2
- package/esm/src/rendering/rsc/client-boot.ts +30 -4
- package/esm/src/rendering/snippet-renderer.js +1 -1
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +3 -2
- package/esm/src/server/dev-server/error-overlay/html-template.d.ts +1 -1
- package/esm/src/server/dev-server/error-overlay/html-template.d.ts.map +1 -1
- package/esm/src/server/dev-server/error-overlay/html-template.js +4 -3
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.d.ts +1 -1
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.d.ts.map +1 -1
- package/esm/src/server/dev-server/error-overlay/overlay-renderer.js +2 -2
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +3 -3
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.d.ts.map +1 -1
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +10 -5
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +2 -2
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +13 -10
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.d.ts +2 -2
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.js +4 -4
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.d.ts +2 -3
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.js +71 -50
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +7 -5
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.js +3 -2
- package/esm/src/utils/version.d.ts +1 -1
- package/esm/src/utils/version.js +1 -1
- package/package.json +1 -1
- package/src/cli/auth/login.ts +14 -0
- package/src/cli/commands/analyze-chunks/command-help.ts +1 -0
- package/src/cli/commands/build/command-help.ts +1 -0
- package/src/cli/commands/build/command.ts +47 -2
- package/src/cli/commands/clean/command-help.ts +1 -0
- package/src/cli/commands/completions/command-help.ts +15 -0
- package/src/cli/commands/completions/command.ts +163 -0
- package/src/cli/commands/completions/handler.ts +29 -0
- package/src/cli/commands/demo/command-help.ts +1 -0
- package/src/cli/commands/deploy/command-help.ts +1 -0
- package/src/cli/commands/deploy/command.ts +82 -1
- package/src/cli/commands/dev/command-help.ts +1 -0
- package/src/cli/commands/doctor/command-help.ts +1 -0
- package/src/cli/commands/files/command-help.ts +1 -0
- package/src/cli/commands/generate/command-help.ts +1 -0
- package/src/cli/commands/init/command-help.ts +1 -0
- package/src/cli/commands/install/command-help.ts +2 -0
- package/src/cli/commands/issues/command-help.ts +1 -0
- package/src/cli/commands/knowledge/command-help.ts +1 -0
- package/src/cli/commands/lint/command-help.ts +15 -0
- package/src/cli/commands/lint/command.ts +59 -0
- package/src/cli/commands/lint/handler.ts +36 -0
- package/src/cli/commands/lock/command-help.ts +1 -0
- package/src/cli/commands/login/command-help.ts +1 -0
- package/src/cli/commands/logout/command-help.ts +1 -0
- package/src/cli/commands/mcp/command-help.ts +1 -0
- package/src/cli/commands/merge/command-help.ts +1 -0
- package/src/cli/commands/pull/command-help.ts +1 -0
- package/src/cli/commands/push/command-help.ts +1 -0
- package/src/cli/commands/routes/command-help.ts +1 -0
- package/src/cli/commands/schema/command-help.ts +17 -0
- package/src/cli/commands/schema/command.ts +64 -0
- package/src/cli/commands/schema/handler.ts +32 -0
- package/src/cli/commands/serve/command-help.ts +1 -0
- package/src/cli/commands/skills/command-help.ts +23 -0
- package/src/cli/commands/skills/command.ts +23 -0
- package/src/cli/commands/skills/create.ts +87 -0
- package/src/cli/commands/skills/handler.ts +106 -0
- package/src/cli/commands/skills/validate.ts +110 -0
- package/src/cli/commands/start/command-help.ts +1 -0
- package/src/cli/commands/studio/command-help.ts +1 -0
- package/src/cli/commands/styles/command-help.ts +1 -0
- package/src/cli/commands/task/command-help.ts +1 -0
- package/src/cli/commands/test/command-help.ts +18 -0
- package/src/cli/commands/test/command.ts +90 -0
- package/src/cli/commands/test/handler.ts +70 -0
- package/src/cli/commands/up/command-help.ts +1 -0
- package/src/cli/commands/uploads/command-help.ts +1 -0
- package/src/cli/commands/whoami/command-help.ts +1 -0
- package/src/cli/commands/workflow/command-help.ts +1 -0
- package/src/cli/help/command-definitions.ts +10 -0
- package/src/cli/help/main-help.ts +48 -5
- package/src/cli/help/types.ts +9 -0
- package/src/cli/mcp/advanced-tools.ts +4 -0
- package/src/cli/mcp/server.ts +72 -0
- package/src/cli/mcp/standalone.ts +133 -1
- package/src/cli/mcp/tools/cicd-tools.ts +86 -0
- package/src/cli/mcp/tools/introspection-tools.ts +46 -0
- package/src/cli/router.ts +32 -1
- package/src/cli/shared/args.ts +2 -0
- package/src/cli/shared/interactive.ts +33 -0
- package/src/cli/shared/json-output.ts +96 -0
- package/src/cli/shared/suggest.ts +33 -0
- package/src/cli/skills/core-skills.ts +233 -0
- package/src/cli/skills/loader.ts +98 -0
- package/src/cli/skills/types.ts +39 -0
- package/src/cli/utils/index.ts +2 -0
- package/src/deno.js +3 -1
- package/src/src/html/dev-scripts.ts +4 -2
- package/src/src/html/html-injection.ts +2 -1
- package/src/src/html/html-shell-generator.ts +1 -1
- package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -1
- package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -1
- package/src/src/html/hydration-script-builder/dev-error-logger.ts +3 -1
- package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -1
- package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -1
- package/src/src/html/hydration-script-builder/prod-scripts.ts +2 -1
- package/src/src/html/styles-builder/dev-styles.ts +2 -1
- package/src/src/modules/react-loader/ssr-module-loader/http-bundle-helpers.ts +65 -31
- package/src/src/modules/react-loader/ssr-module-loader/loader.ts +1 -0
- package/src/src/modules/react-loader/ssr-module-loader/ssr-cache-manager.ts +4 -4
- package/src/src/rendering/orchestrator/html.ts +113 -4
- package/src/src/rendering/orchestrator/module-loader/index.ts +2 -1
- package/src/src/rendering/snippet-renderer.ts +1 -1
- package/src/src/security/http/response/security-handler.ts +3 -2
- package/src/src/server/dev-server/error-overlay/html-template.ts +4 -2
- package/src/src/server/dev-server/error-overlay/overlay-renderer.ts +2 -1
- package/src/src/server/services/rendering/ssr.service.ts +12 -7
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/transforms/mdx/esm-module-loader/cache/index.ts +15 -4
- package/src/src/transforms/mdx/esm-module-loader/cache-format.ts +24 -6
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/cache-keys.ts +10 -3
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/framework-validator.ts +98 -51
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +20 -4
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/module-cache.ts +3 -1
- package/src/src/utils/version.ts +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared JSON output utilities for CLI commands
|
|
3
|
+
*
|
|
4
|
+
* Provides consistent structured output for agent consumption.
|
|
5
|
+
* All commands use the same envelope format.
|
|
6
|
+
*
|
|
7
|
+
* @module cli/shared/json-output
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** Whether the current command should output JSON */
|
|
11
|
+
let _jsonMode = false;
|
|
12
|
+
|
|
13
|
+
/** Whether the current command should write output to a file */
|
|
14
|
+
let _outputPath: string | null = null;
|
|
15
|
+
|
|
16
|
+
export function setJsonMode(enabled: boolean): void {
|
|
17
|
+
_jsonMode = enabled;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isJsonMode(): boolean {
|
|
21
|
+
return _jsonMode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function setOutputPath(path: string | null): void {
|
|
25
|
+
_outputPath = path;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function getOutputPath(): string | null {
|
|
29
|
+
return _outputPath;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface SuccessEnvelope<T = unknown> {
|
|
33
|
+
success: true;
|
|
34
|
+
command: string;
|
|
35
|
+
data: T;
|
|
36
|
+
timing?: { duration_ms: number };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ErrorEnvelope {
|
|
40
|
+
success: false;
|
|
41
|
+
command: string;
|
|
42
|
+
error: {
|
|
43
|
+
code: string;
|
|
44
|
+
slug: string;
|
|
45
|
+
message: string;
|
|
46
|
+
context?: Record<string, unknown>;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type JsonEnvelope<T = unknown> = SuccessEnvelope<T> | ErrorEnvelope;
|
|
51
|
+
|
|
52
|
+
export function createSuccessEnvelope<T>(
|
|
53
|
+
command: string,
|
|
54
|
+
data: T,
|
|
55
|
+
timing?: { duration_ms: number },
|
|
56
|
+
): SuccessEnvelope<T> {
|
|
57
|
+
const envelope: SuccessEnvelope<T> = { success: true, command, data };
|
|
58
|
+
if (timing) envelope.timing = timing;
|
|
59
|
+
return envelope;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function createErrorEnvelope(
|
|
63
|
+
command: string,
|
|
64
|
+
error: { code: string; slug: string; message: string; context?: Record<string, unknown> },
|
|
65
|
+
): ErrorEnvelope {
|
|
66
|
+
return { success: false, command, error };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function formatJsonOutput(envelope: JsonEnvelope): string {
|
|
70
|
+
return JSON.stringify(envelope, null, 2);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Print JSON envelope to stdout.
|
|
75
|
+
* If --output was specified, also write to file.
|
|
76
|
+
*/
|
|
77
|
+
export async function outputJson(envelope: JsonEnvelope): Promise<void> {
|
|
78
|
+
const json = formatJsonOutput(envelope);
|
|
79
|
+
console.log(json);
|
|
80
|
+
|
|
81
|
+
if (_outputPath) {
|
|
82
|
+
const { dirname } = await import("../../src/platform/compat/path/index.js");
|
|
83
|
+
const { createFileSystem } = await import("../../src/platform/index.js");
|
|
84
|
+
const fs = createFileSystem();
|
|
85
|
+
await fs.mkdir(dirname(_outputPath), { recursive: true });
|
|
86
|
+
await fs.writeTextFile(_outputPath, json);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Write a single NDJSON line to stdout.
|
|
92
|
+
* Used for streaming output from long-running commands.
|
|
93
|
+
*/
|
|
94
|
+
export function streamJsonLine(event: Record<string, unknown>): void {
|
|
95
|
+
console.log(JSON.stringify(event));
|
|
96
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command suggestion via Levenshtein distance
|
|
3
|
+
*
|
|
4
|
+
* @module cli/shared/suggest
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export function levenshtein(a: string, b: string): number {
|
|
8
|
+
const matrix: number[][] = [];
|
|
9
|
+
for (let i = 0; i <= a.length; i++) matrix[i] = [i];
|
|
10
|
+
for (let j = 0; j <= b.length; j++) matrix[0]![j] = j;
|
|
11
|
+
for (let i = 1; i <= a.length; i++) {
|
|
12
|
+
for (let j = 1; j <= b.length; j++) {
|
|
13
|
+
matrix[i]![j] = Math.min(
|
|
14
|
+
matrix[i - 1]![j]! + 1,
|
|
15
|
+
matrix[i]![j - 1]! + 1,
|
|
16
|
+
matrix[i - 1]![j - 1]! + (a[i - 1] === b[j - 1] ? 0 : 1),
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return matrix[a.length]![b.length]!;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function suggestCommand(
|
|
24
|
+
input: string,
|
|
25
|
+
commands: string[],
|
|
26
|
+
maxDistance = 2,
|
|
27
|
+
): string[] {
|
|
28
|
+
return commands
|
|
29
|
+
.map((cmd) => ({ cmd, dist: levenshtein(input, cmd) }))
|
|
30
|
+
.filter(({ dist }) => dist <= maxDistance)
|
|
31
|
+
.sort((a, b) => a.dist - b.dist)
|
|
32
|
+
.map(({ cmd }) => cmd);
|
|
33
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core skills embedded as data for compiled binary support.
|
|
3
|
+
*
|
|
4
|
+
* When running from source, the loader reads from cli/mcp/skills/.
|
|
5
|
+
* When compiled, this module provides the same data without filesystem access.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { LoadedSkill } from "./types.js";
|
|
9
|
+
|
|
10
|
+
export const CORE_SKILLS: LoadedSkill[] = [
|
|
11
|
+
{
|
|
12
|
+
manifest: {
|
|
13
|
+
name: "scaffold-app",
|
|
14
|
+
version: "1.0.0",
|
|
15
|
+
description: "Scaffold a new Veryfront app with the right structure, config, and conventions",
|
|
16
|
+
requires: {
|
|
17
|
+
cli: ["init", "dev", "doctor"],
|
|
18
|
+
mcp: ["vf_list_templates", "vf_create_project"],
|
|
19
|
+
},
|
|
20
|
+
inputs: {
|
|
21
|
+
name: { type: "string", description: "Project name" },
|
|
22
|
+
template: {
|
|
23
|
+
type: "string",
|
|
24
|
+
default: "minimal",
|
|
25
|
+
description: "Template to use",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
skillMd: `# Scaffold App
|
|
30
|
+
|
|
31
|
+
Create a new Veryfront application with proper structure and conventions.
|
|
32
|
+
|
|
33
|
+
## Steps
|
|
34
|
+
|
|
35
|
+
1. **Discover templates**
|
|
36
|
+
\`\`\`bash
|
|
37
|
+
veryfront schema --json | jq '.commands[] | select(.name == "init")'
|
|
38
|
+
\`\`\`
|
|
39
|
+
|
|
40
|
+
2. **Create project**
|
|
41
|
+
\`\`\`bash
|
|
42
|
+
veryfront init <name> --template <template> --yes --json
|
|
43
|
+
\`\`\`
|
|
44
|
+
Expected: \`{ "success": true, "command": "init", "data": { "projectDir": "..." } }\`
|
|
45
|
+
|
|
46
|
+
3. **Verify project health**
|
|
47
|
+
\`\`\`bash
|
|
48
|
+
cd <name>
|
|
49
|
+
veryfront doctor --json
|
|
50
|
+
\`\`\`
|
|
51
|
+
|
|
52
|
+
4. **Start dev server**
|
|
53
|
+
\`\`\`bash
|
|
54
|
+
veryfront dev
|
|
55
|
+
\`\`\`
|
|
56
|
+
|
|
57
|
+
## Error Recovery
|
|
58
|
+
|
|
59
|
+
- **init fails**: Check template name, retry with --force
|
|
60
|
+
- **doctor fails**: Fix missing dependencies
|
|
61
|
+
- **dev fails**: Run veryfront clean, then retry`,
|
|
62
|
+
directory: "core:scaffold-app",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
manifest: {
|
|
66
|
+
name: "scaffold-ai-app",
|
|
67
|
+
version: "1.0.0",
|
|
68
|
+
description: "Scaffold a Veryfront app with AI tools, agent definitions, and knowledge base",
|
|
69
|
+
requires: {
|
|
70
|
+
cli: ["init", "dev", "doctor", "workflow"],
|
|
71
|
+
mcp: ["vf_list_templates", "vf_create_project", "vf_scaffold"],
|
|
72
|
+
},
|
|
73
|
+
inputs: {
|
|
74
|
+
name: { type: "string", description: "Project name" },
|
|
75
|
+
provider: {
|
|
76
|
+
type: "string",
|
|
77
|
+
default: "anthropic",
|
|
78
|
+
description: "AI provider to configure",
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
skillMd: `# Scaffold AI App
|
|
83
|
+
|
|
84
|
+
Create a Veryfront app with AI capabilities.
|
|
85
|
+
|
|
86
|
+
## Steps
|
|
87
|
+
|
|
88
|
+
1. \`veryfront init <name> --template ai --yes --json\`
|
|
89
|
+
2. \`veryfront install --with ai --yes --json\`
|
|
90
|
+
3. Use vf_scaffold to generate AI components
|
|
91
|
+
4. Configure provider API key in .env
|
|
92
|
+
5. \`veryfront doctor --json\` then \`veryfront dev\`
|
|
93
|
+
|
|
94
|
+
## Error Recovery
|
|
95
|
+
|
|
96
|
+
- **Missing API key**: Set provider key in .env
|
|
97
|
+
- **Tool generation fails**: Use vf_get_conventions, scaffold manually`,
|
|
98
|
+
directory: "core:scaffold-ai-app",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
manifest: {
|
|
102
|
+
name: "deploy-safely",
|
|
103
|
+
version: "1.0.0",
|
|
104
|
+
description: "Build, test, deploy, and verify — with automatic rollback on failure",
|
|
105
|
+
requires: {
|
|
106
|
+
cli: ["build", "test", "deploy"],
|
|
107
|
+
mcp: ["vf_get_errors"],
|
|
108
|
+
},
|
|
109
|
+
inputs: {
|
|
110
|
+
environment: {
|
|
111
|
+
type: "string",
|
|
112
|
+
default: "production",
|
|
113
|
+
description: "Target environment",
|
|
114
|
+
},
|
|
115
|
+
branch: {
|
|
116
|
+
type: "string",
|
|
117
|
+
default: "main",
|
|
118
|
+
description: "Branch to deploy",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
skillMd: `# Deploy Safely
|
|
123
|
+
|
|
124
|
+
Build, test, deploy, and verify — with rollback on failure.
|
|
125
|
+
|
|
126
|
+
## Steps
|
|
127
|
+
|
|
128
|
+
1. \`veryfront build --json\` — abort if success: false
|
|
129
|
+
2. \`veryfront test --json\` — abort if any test fails
|
|
130
|
+
3. \`veryfront deploy --env <environment> --branch <branch> --yes --json\`
|
|
131
|
+
4. Use vf_get_errors to verify no runtime errors after deploy
|
|
132
|
+
5. If errors: redeploy previous version
|
|
133
|
+
|
|
134
|
+
## Error Recovery
|
|
135
|
+
|
|
136
|
+
- **Build fails**: Check vf_get_errors, fix and retry
|
|
137
|
+
- **Tests fail**: Read JSON output, fix failing tests
|
|
138
|
+
- **Deploy fails**: Check environment, auth, branch
|
|
139
|
+
- **Post-deploy errors**: Redeploy previous release`,
|
|
140
|
+
directory: "core:deploy-safely",
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
manifest: {
|
|
144
|
+
name: "debug-build",
|
|
145
|
+
version: "1.0.0",
|
|
146
|
+
description: "Diagnose and fix build failures using structured error output",
|
|
147
|
+
requires: {
|
|
148
|
+
cli: ["build", "doctor"],
|
|
149
|
+
mcp: ["vf_get_errors", "vf_get_debug_context"],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
skillMd: `# Debug Build
|
|
153
|
+
|
|
154
|
+
Diagnose and fix build failures.
|
|
155
|
+
|
|
156
|
+
## Steps
|
|
157
|
+
|
|
158
|
+
1. \`veryfront build --json\` — capture error envelope
|
|
159
|
+
2. Use vf_get_errors and vf_get_debug_context for details
|
|
160
|
+
3. Common issues: import resolution, type errors, config errors
|
|
161
|
+
4. Apply fix, rebuild: \`veryfront build --json\`
|
|
162
|
+
5. \`veryfront doctor --json\` to verify health
|
|
163
|
+
|
|
164
|
+
## Error Recovery
|
|
165
|
+
|
|
166
|
+
- **Module not found**: Check deno.json imports map
|
|
167
|
+
- **Type errors**: Run deno check for diagnostics
|
|
168
|
+
- **Config invalid**: Compare against fresh veryfront init`,
|
|
169
|
+
directory: "core:debug-build",
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
manifest: {
|
|
173
|
+
name: "debug-runtime",
|
|
174
|
+
version: "1.0.0",
|
|
175
|
+
description: "Diagnose runtime errors by connecting to dev server via MCP",
|
|
176
|
+
requires: {
|
|
177
|
+
cli: ["dev"],
|
|
178
|
+
mcp: ["vf_get_errors", "vf_get_debug_context"],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
skillMd: `# Debug Runtime
|
|
182
|
+
|
|
183
|
+
Diagnose runtime errors via MCP.
|
|
184
|
+
|
|
185
|
+
## Steps
|
|
186
|
+
|
|
187
|
+
1. Ensure \`veryfront dev\` is running (MCP on port 9999)
|
|
188
|
+
2. Use vf_get_errors for current runtime errors
|
|
189
|
+
3. Use vf_get_debug_context for stack traces
|
|
190
|
+
4. Read veryfront://logs resource for server logs
|
|
191
|
+
5. Identify failing route/component, fix source
|
|
192
|
+
6. HMR auto-reloads; use vf_get_errors to confirm fix
|
|
193
|
+
|
|
194
|
+
## Error Recovery
|
|
195
|
+
|
|
196
|
+
- **Dev server not running**: Start with veryfront dev
|
|
197
|
+
- **MCP not responding**: Check port 9999, restart
|
|
198
|
+
- **Error persists**: veryfront clean, restart dev`,
|
|
199
|
+
directory: "core:debug-runtime",
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
manifest: {
|
|
203
|
+
name: "contribute",
|
|
204
|
+
version: "1.0.0",
|
|
205
|
+
description: "Onboard to veryfront-code — architecture, testing, conventions, PR process",
|
|
206
|
+
requires: {
|
|
207
|
+
cli: ["test", "lint", "schema"],
|
|
208
|
+
mcp: ["vf_get_conventions"],
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
skillMd: `# Contribute
|
|
212
|
+
|
|
213
|
+
Onboard to the veryfront-code repository.
|
|
214
|
+
|
|
215
|
+
## Steps
|
|
216
|
+
|
|
217
|
+
1. Read AGENTS.md and cli/AGENTS.md for conventions
|
|
218
|
+
2. Use vf_get_conventions for coding patterns
|
|
219
|
+
3. \`veryfront schema --json\` to understand available commands
|
|
220
|
+
4. Follow patterns: hash imports, defineError(), createArgParser()
|
|
221
|
+
5. \`veryfront test --json\` to run tests
|
|
222
|
+
6. \`veryfront lint --json\` to lint
|
|
223
|
+
7. \`deno fmt\` to format
|
|
224
|
+
|
|
225
|
+
## PR Checklist
|
|
226
|
+
|
|
227
|
+
- Tests pass (veryfront test)
|
|
228
|
+
- Lint clean (veryfront lint)
|
|
229
|
+
- Formatted (deno fmt --check)
|
|
230
|
+
- Commands registered in router.ts AND command-definitions.ts`,
|
|
231
|
+
directory: "core:contribute",
|
|
232
|
+
},
|
|
233
|
+
];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { createFileSystem } from "../../src/platform/index.js";
|
|
2
|
+
import { cwd } from "../../src/platform/index.js";
|
|
3
|
+
import { type LoadedSkill, parseSkillJson } from "./types.js";
|
|
4
|
+
import { CORE_SKILLS } from "./core-skills.js";
|
|
5
|
+
|
|
6
|
+
function getCoreSkillsDir(): string {
|
|
7
|
+
return new URL("../mcp/skills", import.meta.url).pathname;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export async function loadSkill(
|
|
11
|
+
directory: string,
|
|
12
|
+
): Promise<LoadedSkill | null> {
|
|
13
|
+
const fs = createFileSystem();
|
|
14
|
+
|
|
15
|
+
try {
|
|
16
|
+
const manifestRaw = await fs.readTextFile(`${directory}/skill.json`);
|
|
17
|
+
const manifest = parseSkillJson(JSON.parse(manifestRaw));
|
|
18
|
+
if (!manifest.success) return null;
|
|
19
|
+
|
|
20
|
+
const skillMd = await fs.readTextFile(`${directory}/SKILL.md`).catch(
|
|
21
|
+
() => "",
|
|
22
|
+
);
|
|
23
|
+
return { manifest: manifest.data, skillMd, directory };
|
|
24
|
+
} catch {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function listCoreSkills(): Promise<LoadedSkill[]> {
|
|
30
|
+
const fs = createFileSystem();
|
|
31
|
+
const skills: LoadedSkill[] = [];
|
|
32
|
+
const skillsDir = getCoreSkillsDir();
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
for await (const entry of fs.readDir(skillsDir)) {
|
|
36
|
+
if (!entry.isDirectory) continue;
|
|
37
|
+
const skill = await loadSkill(`${skillsDir}/${entry.name}`);
|
|
38
|
+
if (skill) skills.push(skill);
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
// Filesystem skills not available (compiled binary) — use embedded
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Fall back to embedded core skills if none loaded from filesystem
|
|
45
|
+
if (skills.length === 0) {
|
|
46
|
+
return CORE_SKILLS;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return skills;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Scan the current working directory for local skill directories.
|
|
54
|
+
* A local skill is any subdirectory containing a skill.json file.
|
|
55
|
+
*/
|
|
56
|
+
export async function listLocalSkills(): Promise<LoadedSkill[]> {
|
|
57
|
+
const fs = createFileSystem();
|
|
58
|
+
const skills: LoadedSkill[] = [];
|
|
59
|
+
const dir = cwd();
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
for await (const entry of fs.readDir(dir)) {
|
|
63
|
+
if (!entry.isDirectory) continue;
|
|
64
|
+
const skill = await loadSkill(`${dir}/${entry.name}`);
|
|
65
|
+
if (skill) skills.push(skill);
|
|
66
|
+
}
|
|
67
|
+
} catch {
|
|
68
|
+
// cwd not readable
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return skills;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* List all skills: core (built-in) + local (in cwd).
|
|
76
|
+
*/
|
|
77
|
+
export async function listAllSkills(): Promise<LoadedSkill[]> {
|
|
78
|
+
const [core, local] = await Promise.all([
|
|
79
|
+
listCoreSkills(),
|
|
80
|
+
listLocalSkills(),
|
|
81
|
+
]);
|
|
82
|
+
|
|
83
|
+
// Deduplicate by name, local skills override core
|
|
84
|
+
const seen = new Set<string>();
|
|
85
|
+
const result: LoadedSkill[] = [];
|
|
86
|
+
|
|
87
|
+
for (const skill of local) {
|
|
88
|
+
seen.add(skill.manifest.name);
|
|
89
|
+
result.push(skill);
|
|
90
|
+
}
|
|
91
|
+
for (const skill of core) {
|
|
92
|
+
if (!seen.has(skill.manifest.name)) {
|
|
93
|
+
result.push(skill);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const SkillManifestSchema = z.object({
|
|
4
|
+
name: z.string(),
|
|
5
|
+
version: z.string(),
|
|
6
|
+
description: z.string(),
|
|
7
|
+
requires: z
|
|
8
|
+
.object({
|
|
9
|
+
cli: z.array(z.string()).optional(),
|
|
10
|
+
mcp: z.array(z.string()).optional(),
|
|
11
|
+
})
|
|
12
|
+
.optional(),
|
|
13
|
+
inputs: z
|
|
14
|
+
.record(
|
|
15
|
+
z.string(),
|
|
16
|
+
z.object({
|
|
17
|
+
type: z.string(),
|
|
18
|
+
default: z.unknown().optional(),
|
|
19
|
+
description: z.string().optional(),
|
|
20
|
+
}),
|
|
21
|
+
)
|
|
22
|
+
.optional(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export type SkillManifest = z.infer<typeof SkillManifestSchema>;
|
|
26
|
+
|
|
27
|
+
export function parseSkillJson(
|
|
28
|
+
raw: unknown,
|
|
29
|
+
): { success: true; data: SkillManifest } | { success: false; error: string } {
|
|
30
|
+
const result = SkillManifestSchema.safeParse(raw);
|
|
31
|
+
if (result.success) return { success: true, data: result.data };
|
|
32
|
+
return { success: false, error: result.error.message };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface LoadedSkill {
|
|
36
|
+
manifest: SkillManifest;
|
|
37
|
+
skillMd: string;
|
|
38
|
+
directory: string;
|
|
39
|
+
}
|
package/src/cli/utils/index.ts
CHANGED
|
@@ -211,6 +211,8 @@ export async function confirmPrompt(
|
|
|
211
211
|
message: string,
|
|
212
212
|
defaultValue = false,
|
|
213
213
|
): Promise<boolean> {
|
|
214
|
+
const { isInteractive } = await import("../shared/interactive.js");
|
|
215
|
+
if (!isInteractive()) return true;
|
|
214
216
|
if (!isTTY()) return defaultValue;
|
|
215
217
|
|
|
216
218
|
const hint = defaultValue ? "[Y/n]" : "[y/N]";
|
package/src/deno.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"name": "veryfront",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.113",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"nodeModulesDir": "auto",
|
|
6
6
|
"exclude": [
|
|
@@ -112,6 +112,8 @@ export default {
|
|
|
112
112
|
"#veryfront/build": "./src/build/index.ts",
|
|
113
113
|
"#veryfront/cache": "./src/cache/index.ts",
|
|
114
114
|
"#cli/shared/args": "./cli/shared/args.ts",
|
|
115
|
+
"#cli/shared/json-output": "./cli/shared/json-output.ts",
|
|
116
|
+
"#cli/shared/interactive": "./cli/shared/interactive.ts",
|
|
115
117
|
"#cli/shared/types": "./cli/shared/types.ts",
|
|
116
118
|
"#cli/shared/constants": "./cli/shared/constants.ts",
|
|
117
119
|
"#cli/shared/config": "./cli/shared/config.ts",
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { escapeHtml } from "./html-escape.js";
|
|
2
|
+
|
|
1
3
|
export function getDevStyles(nonce?: string): string {
|
|
2
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
4
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
3
5
|
|
|
4
6
|
return `
|
|
5
7
|
<style${nonceAttr}>
|
|
@@ -32,7 +34,7 @@ export function getDevStyles(nonce?: string): string {
|
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
function getNonceAttr(nonce?: string): string {
|
|
35
|
-
return nonce ? ` nonce="${nonce}"` : "";
|
|
37
|
+
return nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
export function getDevScripts(_hmrPort?: number, nonce?: string): string {
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
generateScriptTags,
|
|
6
6
|
generateStyleTags,
|
|
7
7
|
} from "./tag-generators.js";
|
|
8
|
+
import { escapeHtml } from "./html-escape.js";
|
|
8
9
|
import { getDevScripts, getDevStyles, getProdScripts, getStudioScripts } from "./dev-scripts.js";
|
|
9
10
|
|
|
10
11
|
export interface InjectHTMLContentOptions {
|
|
@@ -61,7 +62,7 @@ export function injectHTMLContent(
|
|
|
61
62
|
|
|
62
63
|
// Inject import map into <head> for ESM module resolution (must be before any module scripts)
|
|
63
64
|
if (options.importMapJson && /<\/head>/i.test(html)) {
|
|
64
|
-
const nonceAttr = options.nonce ? ` nonce="${options.nonce}"` : "";
|
|
65
|
+
const nonceAttr = options.nonce ? ` nonce="${escapeHtml(options.nonce)}"` : "";
|
|
65
66
|
const importMapTag =
|
|
66
67
|
`<script type="importmap"${nonceAttr}>\n${options.importMapJson}\n</script>`;
|
|
67
68
|
html = html.replace(/<\/head>/i, `${importMapTag}\n</head>`);
|
|
@@ -206,7 +206,7 @@ async function generateHTMLShellPartsImpl(
|
|
|
206
206
|
? `<link rel="modulepreload" href="${jsxRuntimeUrl}">`
|
|
207
207
|
: "";
|
|
208
208
|
|
|
209
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
209
|
+
const nonceAttr = nonce ? ` nonce="${escapeHTML(nonce)}"` : "";
|
|
210
210
|
|
|
211
211
|
// Expose project slug for runtime error overlay "Fix in Veryfront" button
|
|
212
212
|
const overlaySlug = options.projectId || meta.slug;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
2
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
3
|
|
|
3
4
|
export function generateDevClientRendererScript(nonce?: string): string {
|
|
4
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
5
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
5
6
|
|
|
6
7
|
return `
|
|
7
8
|
<script type="module"${nonceAttr}>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { VeryfrontConfig } from "../../config/index.js";
|
|
2
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
3
|
|
|
3
4
|
export function generateDevComponentManifestScript(
|
|
4
5
|
config: VeryfrontConfig,
|
|
5
6
|
nonce?: string,
|
|
6
7
|
): string {
|
|
7
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
8
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
8
9
|
const components = config.dev?.components ?? [];
|
|
9
10
|
|
|
10
11
|
return `
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
|
+
|
|
1
3
|
function getOpenScriptTag(nonce?: string): string {
|
|
2
|
-
return nonce ? `<script nonce="${nonce}">` : "<script>";
|
|
4
|
+
return nonce ? `<script nonce="${escapeHtml(nonce)}">` : "<script>";
|
|
3
5
|
}
|
|
4
6
|
|
|
5
7
|
export function generateDevErrorLoggerScript(nonce?: string): string {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentProps } from "../../types/index.js";
|
|
2
2
|
import type { VeryfrontConfig } from "../../config/index.js";
|
|
3
|
+
import { escapeHtml } from "../html-escape.js";
|
|
3
4
|
import { generateDevErrorLoggerScript } from "./dev-error-logger.js";
|
|
4
5
|
import { generateDevComponentManifestScript } from "./dev-component-manifest.js";
|
|
5
6
|
import { generateDevClientRendererScript } from "./dev-client-renderer.js";
|
|
@@ -12,7 +13,7 @@ function generateHMRScript(
|
|
|
12
13
|
// Skip dev HMR script when preview-hmr.js will be used instead
|
|
13
14
|
if (skipDevHMR || !config.dev?.hmr) return "";
|
|
14
15
|
|
|
15
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
16
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
16
17
|
return `<script type="module" src="/_veryfront/hmr.js"${nonceAttr}></script>`;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from "../../types/index.js";
|
|
2
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
3
|
|
|
3
4
|
export function generateProdHydrationScript(
|
|
4
5
|
slug: string,
|
|
@@ -6,7 +7,7 @@ export function generateProdHydrationScript(
|
|
|
6
7
|
props?: ComponentProps,
|
|
7
8
|
nonce?: string,
|
|
8
9
|
): string {
|
|
9
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
10
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
10
11
|
const pageProps = JSON.stringify(props ?? {});
|
|
11
12
|
|
|
12
13
|
return `
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
2
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
3
|
|
|
3
4
|
export function getProdScripts(
|
|
4
5
|
_slug: string,
|
|
@@ -6,7 +7,7 @@ export function getProdScripts(
|
|
|
6
7
|
_props?: Record<string, unknown>,
|
|
7
8
|
nonce?: string,
|
|
8
9
|
): string {
|
|
9
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
10
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
10
11
|
|
|
11
12
|
return `
|
|
12
13
|
<script type="module"${nonceAttr}>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Z_INDEX_ERROR_OVERLAY } from "../../utils/index.js";
|
|
2
|
+
import { escapeHtml } from "../html-escape.js";
|
|
2
3
|
|
|
3
4
|
export function getDevStyles(nonce?: string): string {
|
|
4
|
-
const nonceAttr = nonce ? ` nonce="${nonce}"` : "";
|
|
5
|
+
const nonceAttr = nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
5
6
|
|
|
6
7
|
return `
|
|
7
8
|
<style${nonceAttr}>
|