@celljs/cli 3.9.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +442 -1
- package/agent/guide.md +39 -0
- package/bin/cell.js +2 -0
- package/lib/agent/agent-guide.d.ts +39 -0
- package/lib/agent/agent-guide.d.ts.map +1 -0
- package/lib/agent/agent-guide.js +67 -0
- package/lib/agent/agent-guide.js.map +1 -0
- package/lib/build/executable-compiler.d.ts +44 -0
- package/lib/build/executable-compiler.d.ts.map +1 -0
- package/lib/build/executable-compiler.js +145 -0
- package/lib/build/executable-compiler.js.map +1 -0
- package/lib/build/executable-compiler.spec.d.ts +2 -0
- package/lib/build/executable-compiler.spec.d.ts.map +1 -0
- package/lib/build/executable-compiler.spec.js +71 -0
- package/lib/build/executable-compiler.spec.js.map +1 -0
- package/lib/build/single-compile.spec.d.ts +2 -0
- package/lib/build/single-compile.spec.d.ts.map +1 -0
- package/lib/build/single-compile.spec.js +135 -0
- package/lib/build/single-compile.spec.js.map +1 -0
- package/lib/check/project-checker.d.ts +85 -0
- package/lib/check/project-checker.d.ts.map +1 -0
- package/lib/check/project-checker.js +332 -0
- package/lib/check/project-checker.js.map +1 -0
- package/lib/check/project-checker.spec.d.ts +2 -0
- package/lib/check/project-checker.spec.d.ts.map +1 -0
- package/lib/check/project-checker.spec.js +147 -0
- package/lib/check/project-checker.spec.js.map +1 -0
- package/lib/cli/agent-command.d.ts +15 -0
- package/lib/cli/agent-command.d.ts.map +1 -0
- package/lib/cli/agent-command.js +42 -0
- package/lib/cli/agent-command.js.map +1 -0
- package/lib/cli/build-command.d.ts +84 -0
- package/lib/cli/build-command.d.ts.map +1 -0
- package/lib/cli/build-command.js +170 -0
- package/lib/cli/build-command.js.map +1 -0
- package/lib/cli/cell-cli.d.ts +35 -0
- package/lib/cli/cell-cli.d.ts.map +1 -0
- package/lib/cli/cell-cli.js +159 -0
- package/lib/cli/cell-cli.js.map +1 -0
- package/lib/cli/cell-cli.spec.d.ts +2 -0
- package/lib/cli/cell-cli.spec.d.ts.map +1 -0
- package/lib/cli/cell-cli.spec.js +195 -0
- package/lib/cli/cell-cli.spec.js.map +1 -0
- package/lib/cli/check-command.d.ts +31 -0
- package/lib/cli/check-command.d.ts.map +1 -0
- package/lib/cli/check-command.js +67 -0
- package/lib/cli/check-command.js.map +1 -0
- package/lib/cli/command.d.ts +24 -0
- package/lib/cli/command.d.ts.map +1 -0
- package/lib/cli/command.js +10 -0
- package/lib/cli/command.js.map +1 -0
- package/lib/cli/config-command.d.ts +29 -0
- package/lib/cli/config-command.d.ts.map +1 -0
- package/lib/cli/config-command.js +71 -0
- package/lib/cli/config-command.js.map +1 -0
- package/lib/cli/config-command.spec.d.ts +2 -0
- package/lib/cli/config-command.spec.d.ts.map +1 -0
- package/lib/cli/config-command.spec.js +79 -0
- package/lib/cli/config-command.spec.js.map +1 -0
- package/lib/cli/deploy-command.d.ts +41 -0
- package/lib/cli/deploy-command.d.ts.map +1 -0
- package/lib/cli/deploy-command.js +114 -0
- package/lib/cli/deploy-command.js.map +1 -0
- package/lib/cli/dev-command.d.ts +47 -0
- package/lib/cli/dev-command.d.ts.map +1 -0
- package/lib/cli/dev-command.js +219 -0
- package/lib/cli/dev-command.js.map +1 -0
- package/lib/cli/dev-command.spec.d.ts +2 -0
- package/lib/cli/dev-command.spec.d.ts.map +1 -0
- package/lib/cli/dev-command.spec.js +149 -0
- package/lib/cli/dev-command.spec.js.map +1 -0
- package/lib/cli/docs-command.d.ts +19 -0
- package/lib/cli/docs-command.d.ts.map +1 -0
- package/lib/cli/docs-command.js +47 -0
- package/lib/cli/docs-command.js.map +1 -0
- package/lib/cli/info-command.d.ts +44 -0
- package/lib/cli/info-command.d.ts.map +1 -0
- package/lib/cli/info-command.js +39 -0
- package/lib/cli/info-command.js.map +1 -0
- package/lib/cli/info-command.spec.d.ts +2 -0
- package/lib/cli/info-command.spec.d.ts.map +1 -0
- package/lib/cli/info-command.spec.js +236 -0
- package/lib/cli/info-command.spec.js.map +1 -0
- package/lib/cli/init-command.d.ts +20 -0
- package/lib/cli/init-command.d.ts.map +1 -0
- package/lib/cli/init-command.js +43 -0
- package/lib/cli/init-command.js.map +1 -0
- package/lib/cli/main.d.ts +2 -0
- package/lib/cli/main.d.ts.map +1 -0
- package/lib/cli/main.js +3 -0
- package/lib/cli/main.js.map +1 -0
- package/lib/cli/mcp-command.d.ts +34 -0
- package/lib/cli/mcp-command.d.ts.map +1 -0
- package/lib/cli/mcp-command.js +85 -0
- package/lib/cli/mcp-command.js.map +1 -0
- package/lib/cli/mcp-command.spec.d.ts +2 -0
- package/lib/cli/mcp-command.spec.d.ts.map +1 -0
- package/lib/cli/mcp-command.spec.js +132 -0
- package/lib/cli/mcp-command.spec.js.map +1 -0
- package/lib/cli/preview-command.d.ts +24 -0
- package/lib/cli/preview-command.d.ts.map +1 -0
- package/lib/cli/preview-command.js +91 -0
- package/lib/cli/preview-command.js.map +1 -0
- package/lib/cli/reporter.d.ts +26 -0
- package/lib/cli/reporter.d.ts.map +1 -0
- package/lib/cli/reporter.js +58 -0
- package/lib/cli/reporter.js.map +1 -0
- package/lib/config/config-build.spec.d.ts +2 -0
- package/lib/config/config-build.spec.d.ts.map +1 -0
- package/lib/config/config-build.spec.js +111 -0
- package/lib/config/config-build.spec.js.map +1 -0
- package/lib/config/config-explainer.d.ts +48 -0
- package/lib/config/config-explainer.d.ts.map +1 -0
- package/lib/config/config-explainer.js +130 -0
- package/lib/config/config-explainer.js.map +1 -0
- package/lib/config/config-file-loader.d.ts +22 -0
- package/lib/config/config-file-loader.d.ts.map +1 -0
- package/lib/config/config-file-loader.js +63 -0
- package/lib/config/config-file-loader.js.map +1 -0
- package/lib/config/config-resolver.d.ts +111 -0
- package/lib/config/config-resolver.d.ts.map +1 -0
- package/lib/config/config-resolver.js +215 -0
- package/lib/config/config-resolver.js.map +1 -0
- package/lib/config/config-resolver.spec.d.ts +2 -0
- package/lib/config/config-resolver.spec.d.ts.map +1 -0
- package/lib/config/config-resolver.spec.js +159 -0
- package/lib/config/config-resolver.spec.js.map +1 -0
- package/lib/config/config-validator.d.ts +35 -0
- package/lib/config/config-validator.d.ts.map +1 -0
- package/lib/config/config-validator.js +160 -0
- package/lib/config/config-validator.js.map +1 -0
- package/lib/config/config-validator.spec.d.ts +2 -0
- package/lib/config/config-validator.spec.d.ts.map +1 -0
- package/lib/config/config-validator.spec.js +77 -0
- package/lib/config/config-validator.spec.js.map +1 -0
- package/lib/config/define-config.d.ts +4 -0
- package/lib/config/define-config.d.ts.map +1 -0
- package/lib/config/define-config.js +5 -0
- package/lib/config/define-config.js.map +1 -0
- package/lib/config/types.d.ts +53 -0
- package/lib/config/types.d.ts.map +1 -0
- package/lib/config/types.js +2 -0
- package/lib/config/types.js.map +1 -0
- package/lib/deploy/cloud-api.d.ts +58 -0
- package/lib/deploy/cloud-api.d.ts.map +1 -0
- package/lib/deploy/cloud-api.js +189 -0
- package/lib/deploy/cloud-api.js.map +1 -0
- package/lib/deploy/code-package.d.ts +15 -0
- package/lib/deploy/code-package.d.ts.map +1 -0
- package/lib/deploy/code-package.js +40 -0
- package/lib/deploy/code-package.js.map +1 -0
- package/lib/deploy/deploy-utils.spec.d.ts +2 -0
- package/lib/deploy/deploy-utils.spec.d.ts.map +1 -0
- package/lib/deploy/deploy-utils.spec.js +56 -0
- package/lib/deploy/deploy-utils.spec.js.map +1 -0
- package/lib/deploy/deployer-registry.d.ts +11 -0
- package/lib/deploy/deployer-registry.d.ts.map +1 -0
- package/lib/deploy/deployer-registry.js +40 -0
- package/lib/deploy/deployer-registry.js.map +1 -0
- package/lib/deploy/request-signer.d.ts +51 -0
- package/lib/deploy/request-signer.d.ts.map +1 -0
- package/lib/deploy/request-signer.js +109 -0
- package/lib/deploy/request-signer.js.map +1 -0
- package/lib/deploy/zip-writer.d.ts +32 -0
- package/lib/deploy/zip-writer.d.ts.map +1 -0
- package/lib/deploy/zip-writer.js +114 -0
- package/lib/deploy/zip-writer.js.map +1 -0
- package/lib/docs/docs-index.d.ts +54 -0
- package/lib/docs/docs-index.d.ts.map +1 -0
- package/lib/docs/docs-index.js +140 -0
- package/lib/docs/docs-index.js.map +1 -0
- package/lib/docs/docs-index.spec.d.ts +2 -0
- package/lib/docs/docs-index.spec.d.ts.map +1 -0
- package/lib/docs/docs-index.spec.js +52 -0
- package/lib/docs/docs-index.spec.js.map +1 -0
- package/lib/events/event-bus.d.ts +30 -0
- package/lib/events/event-bus.d.ts.map +1 -0
- package/lib/events/event-bus.js +81 -0
- package/lib/events/event-bus.js.map +1 -0
- package/lib/events/event-bus.spec.d.ts +2 -0
- package/lib/events/event-bus.spec.d.ts.map +1 -0
- package/lib/events/event-bus.spec.js +69 -0
- package/lib/events/event-bus.spec.js.map +1 -0
- package/lib/events/hook-runner.d.ts +27 -0
- package/lib/events/hook-runner.d.ts.map +1 -0
- package/lib/events/hook-runner.js +65 -0
- package/lib/events/hook-runner.js.map +1 -0
- package/lib/events/hook-runner.spec.d.ts +2 -0
- package/lib/events/hook-runner.spec.d.ts.map +1 -0
- package/lib/events/hook-runner.spec.js +36 -0
- package/lib/events/hook-runner.spec.js.map +1 -0
- package/lib/index.d.ts +57 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +57 -2
- package/lib/index.js.map +1 -1
- package/lib/info/project-inspector.d.ts +143 -0
- package/lib/info/project-inspector.d.ts.map +1 -0
- package/lib/info/project-inspector.js +244 -0
- package/lib/info/project-inspector.js.map +1 -0
- package/lib/init/project-initializer.d.ts +44 -0
- package/lib/init/project-initializer.d.ts.map +1 -0
- package/lib/init/project-initializer.js +90 -0
- package/lib/init/project-initializer.js.map +1 -0
- package/lib/init/project-initializer.spec.d.ts +2 -0
- package/lib/init/project-initializer.spec.d.ts.map +1 -0
- package/lib/init/project-initializer.spec.js +88 -0
- package/lib/init/project-initializer.spec.js.map +1 -0
- package/lib/mcp/dev-activity.d.ts +34 -0
- package/lib/mcp/dev-activity.d.ts.map +1 -0
- package/lib/mcp/dev-activity.js +46 -0
- package/lib/mcp/dev-activity.js.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.d.ts +62 -0
- package/lib/mcp/dev-mcp-endpoint.d.ts.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.js +280 -0
- package/lib/mcp/dev-mcp-endpoint.js.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.spec.d.ts +2 -0
- package/lib/mcp/dev-mcp-endpoint.spec.d.ts.map +1 -0
- package/lib/mcp/dev-mcp-endpoint.spec.js +143 -0
- package/lib/mcp/dev-mcp-endpoint.spec.js.map +1 -0
- package/lib/mcp/mcp-server.d.ts +64 -0
- package/lib/mcp/mcp-server.d.ts.map +1 -0
- package/lib/mcp/mcp-server.js +201 -0
- package/lib/mcp/mcp-server.js.map +1 -0
- package/lib/mcp/mcp-server.spec.d.ts +2 -0
- package/lib/mcp/mcp-server.spec.d.ts.map +1 -0
- package/lib/mcp/mcp-server.spec.js +136 -0
- package/lib/mcp/mcp-server.spec.js.map +1 -0
- package/lib/mcp/project-mcp-tools.d.ts +35 -0
- package/lib/mcp/project-mcp-tools.d.ts.map +1 -0
- package/lib/mcp/project-mcp-tools.js +199 -0
- package/lib/mcp/project-mcp-tools.js.map +1 -0
- package/lib/modules/module-host.d.ts +118 -0
- package/lib/modules/module-host.d.ts.map +1 -0
- package/lib/modules/module-host.js +405 -0
- package/lib/modules/module-host.js.map +1 -0
- package/lib/modules/module-host.spec.d.ts +2 -0
- package/lib/modules/module-host.spec.d.ts.map +1 -0
- package/lib/modules/module-host.spec.js +220 -0
- package/lib/modules/module-host.spec.js.map +1 -0
- package/lib/preset/builtin-presets.d.ts +9 -0
- package/lib/preset/builtin-presets.d.ts.map +1 -0
- package/lib/preset/builtin-presets.js +24 -0
- package/lib/preset/builtin-presets.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare-deployer.d.ts +26 -0
- package/lib/preset/cloudflare/cloudflare-deployer.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare-deployer.js +116 -0
- package/lib/preset/cloudflare/cloudflare-deployer.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare-preset.d.ts +16 -0
- package/lib/preset/cloudflare/cloudflare-preset.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare-preset.js +97 -0
- package/lib/preset/cloudflare/cloudflare-preset.js.map +1 -0
- package/lib/preset/cloudflare/cloudflare.spec.d.ts +2 -0
- package/lib/preset/cloudflare/cloudflare.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/cloudflare.spec.js +212 -0
- package/lib/preset/cloudflare/cloudflare.spec.js.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.d.ts +50 -0
- package/lib/preset/cloudflare/wrangler-config.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.js +160 -0
- package/lib/preset/cloudflare/wrangler-config.js.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.spec.d.ts +2 -0
- package/lib/preset/cloudflare/wrangler-config.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler-config.spec.js +112 -0
- package/lib/preset/cloudflare/wrangler-config.spec.js.map +1 -0
- package/lib/preset/cloudflare/wrangler.d.ts +38 -0
- package/lib/preset/cloudflare/wrangler.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler.js +90 -0
- package/lib/preset/cloudflare/wrangler.js.map +1 -0
- package/lib/preset/cloudflare/wrangler.spec.d.ts +2 -0
- package/lib/preset/cloudflare/wrangler.spec.d.ts.map +1 -0
- package/lib/preset/cloudflare/wrangler.spec.js +64 -0
- package/lib/preset/cloudflare/wrangler.spec.js.map +1 -0
- package/lib/preset/fc/fc-deployer.d.ts +50 -0
- package/lib/preset/fc/fc-deployer.d.ts.map +1 -0
- package/lib/preset/fc/fc-deployer.js +209 -0
- package/lib/preset/fc/fc-deployer.js.map +1 -0
- package/lib/preset/fc/fc-preset.d.ts +20 -0
- package/lib/preset/fc/fc-preset.d.ts.map +1 -0
- package/lib/preset/fc/fc-preset.js +46 -0
- package/lib/preset/fc/fc-preset.js.map +1 -0
- package/lib/preset/lambda/lambda-deployer.d.ts +50 -0
- package/lib/preset/lambda/lambda-deployer.d.ts.map +1 -0
- package/lib/preset/lambda/lambda-deployer.js +274 -0
- package/lib/preset/lambda/lambda-deployer.js.map +1 -0
- package/lib/preset/lambda/lambda-preset.d.ts +14 -0
- package/lib/preset/lambda/lambda-preset.d.ts.map +1 -0
- package/lib/preset/lambda/lambda-preset.js +44 -0
- package/lib/preset/lambda/lambda-preset.js.map +1 -0
- package/lib/preset/preset-output.d.ts +19 -0
- package/lib/preset/preset-output.d.ts.map +1 -0
- package/lib/preset/preset-output.js +45 -0
- package/lib/preset/preset-output.js.map +1 -0
- package/lib/preset/preset-registry.d.ts +16 -0
- package/lib/preset/preset-registry.d.ts.map +1 -0
- package/lib/preset/preset-registry.js +58 -0
- package/lib/preset/preset-registry.js.map +1 -0
- package/lib/preset/preset-registry.spec.d.ts +2 -0
- package/lib/preset/preset-registry.spec.d.ts.map +1 -0
- package/lib/preset/preset-registry.spec.js +28 -0
- package/lib/preset/preset-registry.spec.js.map +1 -0
- package/lib/preset/scf/scf-deployer.d.ts +54 -0
- package/lib/preset/scf/scf-deployer.d.ts.map +1 -0
- package/lib/preset/scf/scf-deployer.js +202 -0
- package/lib/preset/scf/scf-deployer.js.map +1 -0
- package/lib/preset/scf/scf-preset.d.ts +19 -0
- package/lib/preset/scf/scf-preset.d.ts.map +1 -0
- package/lib/preset/scf/scf-preset.js +43 -0
- package/lib/preset/scf/scf-preset.js.map +1 -0
- package/lib/preset/serverless-deployers.spec.d.ts +2 -0
- package/lib/preset/serverless-deployers.spec.d.ts.map +1 -0
- package/lib/preset/serverless-deployers.spec.js +307 -0
- package/lib/preset/serverless-deployers.spec.js.map +1 -0
- package/lib/preset/serverless-presets.spec.d.ts +2 -0
- package/lib/preset/serverless-presets.spec.d.ts.map +1 -0
- package/lib/preset/serverless-presets.spec.js +280 -0
- package/lib/preset/serverless-presets.spec.js.map +1 -0
- package/lib/preset/serverless-scripts.d.ts +29 -0
- package/lib/preset/serverless-scripts.d.ts.map +1 -0
- package/lib/preset/serverless-scripts.js +120 -0
- package/lib/preset/serverless-scripts.js.map +1 -0
- package/lib/preset/vercel/vercel-deployer.d.ts +38 -0
- package/lib/preset/vercel/vercel-deployer.d.ts.map +1 -0
- package/lib/preset/vercel/vercel-deployer.js +160 -0
- package/lib/preset/vercel/vercel-deployer.js.map +1 -0
- package/lib/preset/vercel/vercel-preset.d.ts +19 -0
- package/lib/preset/vercel/vercel-preset.d.ts.map +1 -0
- package/lib/preset/vercel/vercel-preset.js +102 -0
- package/lib/preset/vercel/vercel-preset.js.map +1 -0
- package/lib/test/fixture-project.d.ts +17 -0
- package/lib/test/fixture-project.d.ts.map +1 -0
- package/lib/test/fixture-project.js +43 -0
- package/lib/test/fixture-project.js.map +1 -0
- package/lib/testing/create-test-app.d.ts +27 -0
- package/lib/testing/create-test-app.d.ts.map +1 -0
- package/lib/testing/create-test-app.js +54 -0
- package/lib/testing/create-test-app.js.map +1 -0
- package/lib/testing/create-test-app.spec.d.ts +2 -0
- package/lib/testing/create-test-app.spec.d.ts.map +1 -0
- package/lib/testing/create-test-app.spec.js +66 -0
- package/lib/testing/create-test-app.spec.js.map +1 -0
- package/lib/toolchain/toolchain.d.ts +49 -0
- package/lib/toolchain/toolchain.d.ts.map +1 -0
- package/lib/toolchain/toolchain.js +100 -0
- package/lib/toolchain/toolchain.js.map +1 -0
- package/lib/utils/json-util.d.ts +11 -0
- package/lib/utils/json-util.d.ts.map +1 -0
- package/lib/utils/json-util.js +73 -0
- package/lib/utils/json-util.js.map +1 -0
- package/lib/utils/json-util.spec.d.ts +2 -0
- package/lib/utils/json-util.spec.d.ts.map +1 -0
- package/lib/utils/json-util.spec.js +18 -0
- package/lib/utils/json-util.spec.js.map +1 -0
- package/lib/utils/text-util.d.ts +19 -0
- package/lib/utils/text-util.d.ts.map +1 -0
- package/lib/utils/text-util.js +66 -0
- package/lib/utils/text-util.js.map +1 -0
- package/lib/utils/text-util.spec.d.ts +2 -0
- package/lib/utils/text-util.spec.d.ts.map +1 -0
- package/lib/utils/text-util.spec.js +22 -0
- package/lib/utils/text-util.spec.js.map +1 -0
- package/package.json +28 -30
- package/src/agent/agent-guide.ts +90 -0
- package/src/build/executable-compiler.ts +179 -0
- package/src/check/project-checker.ts +365 -0
- package/src/cli/agent-command.ts +46 -0
- package/src/cli/build-command.ts +189 -0
- package/src/cli/cell-cli.ts +174 -0
- package/src/cli/check-command.ts +74 -0
- package/src/cli/command.ts +29 -0
- package/src/cli/config-command.ts +73 -0
- package/src/cli/deploy-command.ts +122 -0
- package/src/cli/dev-command.ts +232 -0
- package/src/cli/docs-command.ts +53 -0
- package/src/cli/info-command.ts +40 -0
- package/src/cli/init-command.ts +53 -0
- package/src/cli/main.ts +3 -0
- package/src/cli/mcp-command.ts +98 -0
- package/src/cli/preview-command.ts +98 -0
- package/src/cli/reporter.ts +67 -0
- package/src/config/config-explainer.ts +158 -0
- package/src/config/config-file-loader.ts +76 -0
- package/src/config/config-resolver.ts +300 -0
- package/src/config/config-validator.ts +208 -0
- package/src/config/define-config.ts +6 -0
- package/src/config/types.ts +57 -0
- package/src/deploy/cloud-api.ts +194 -0
- package/src/deploy/code-package.ts +44 -0
- package/src/deploy/deployer-registry.ts +44 -0
- package/src/deploy/request-signer.ts +155 -0
- package/src/deploy/zip-writer.ts +132 -0
- package/src/docs/docs-index.ts +174 -0
- package/src/events/event-bus.ts +94 -0
- package/src/events/hook-runner.ts +78 -0
- package/src/index.ts +57 -0
- package/src/info/project-inspector.ts +352 -0
- package/src/init/project-initializer.ts +111 -0
- package/src/mcp/dev-activity.ts +71 -0
- package/src/mcp/dev-mcp-endpoint.ts +323 -0
- package/src/mcp/mcp-server.ts +251 -0
- package/src/mcp/project-mcp-tools.ts +216 -0
- package/src/modules/module-host.ts +489 -0
- package/src/preset/builtin-presets.ts +26 -0
- package/src/preset/cloudflare/cloudflare-deployer.ts +126 -0
- package/src/preset/cloudflare/cloudflare-preset.ts +97 -0
- package/src/preset/cloudflare/wrangler-config.ts +173 -0
- package/src/preset/cloudflare/wrangler.ts +113 -0
- package/src/preset/fc/fc-deployer.ts +237 -0
- package/src/preset/fc/fc-preset.ts +51 -0
- package/src/preset/lambda/lambda-deployer.ts +317 -0
- package/src/preset/lambda/lambda-preset.ts +45 -0
- package/src/preset/preset-output.ts +55 -0
- package/src/preset/preset-registry.ts +65 -0
- package/src/preset/scf/scf-deployer.ts +232 -0
- package/src/preset/scf/scf-preset.ts +45 -0
- package/src/preset/serverless-scripts.ts +132 -0
- package/src/preset/vercel/vercel-deployer.ts +168 -0
- package/src/preset/vercel/vercel-preset.ts +111 -0
- package/src/test/fixture-project.ts +50 -0
- package/src/testing/create-test-app.ts +73 -0
- package/src/toolchain/toolchain.ts +121 -0
- package/src/utils/json-util.ts +67 -0
- package/src/utils/text-util.ts +68 -0
- package/templates/backend/README.md +13 -0
- package/templates/backend/_gitignore +5 -0
- package/templates/backend/cell.yml +3 -0
- package/templates/backend/package.json +23 -0
- package/templates/{file-service/src → backend/src/node}/home-controller.ts +5 -2
- package/templates/{file-service/src → backend/src/node}/module.ts +0 -1
- package/templates/backend/template.json +3 -0
- package/templates/backend/test/app.spec.ts +19 -0
- package/templates/backend/tsconfig.json +25 -0
- package/templates/fullstack/README.md +13 -0
- package/templates/fullstack/_gitignore +5 -0
- package/templates/fullstack/cell.yml +6 -0
- package/templates/fullstack/package.json +27 -0
- package/templates/fullstack/src/browser/home.view.tsx +19 -0
- package/templates/{cell-component/src → fullstack/src/browser}/module.ts +1 -1
- package/templates/fullstack/src/common/greeting-protocol.ts +5 -0
- package/templates/fullstack/src/node/greeting-server.ts +13 -0
- package/templates/{admin-app/src/browser → fullstack/src/node}/module.ts +2 -1
- package/templates/fullstack/template.json +3 -0
- package/templates/fullstack/test/app.spec.ts +18 -0
- package/templates/fullstack/tsconfig.json +27 -0
- package/bin/cell +0 -2
- package/lib/build/build-manager.d.ts +0 -9
- package/lib/build/build-manager.d.ts.map +0 -1
- package/lib/build/build-manager.js +0 -41
- package/lib/build/build-manager.js.map +0 -1
- package/lib/build/build.d.ts +0 -6
- package/lib/build/build.d.ts.map +0 -1
- package/lib/build/build.js +0 -16
- package/lib/build/build.js.map +0 -1
- package/lib/cell-main.d.ts +0 -2
- package/lib/cell-main.d.ts.map +0 -1
- package/lib/cell-main.js +0 -110
- package/lib/cell-main.js.map +0 -1
- package/lib/cell.d.ts +0 -2
- package/lib/cell.d.ts.map +0 -1
- package/lib/cell.js +0 -194
- package/lib/cell.js.map +0 -1
- package/lib/config/config.d.ts +0 -12
- package/lib/config/config.d.ts.map +0 -1
- package/lib/config/config.js +0 -48
- package/lib/config/config.js.map +0 -1
- package/lib/deploy/deploy.d.ts +0 -7
- package/lib/deploy/deploy.d.ts.map +0 -1
- package/lib/deploy/deploy.js +0 -30
- package/lib/deploy/deploy.js.map +0 -1
- package/lib/info/info.d.ts +0 -6
- package/lib/info/info.d.ts.map +0 -1
- package/lib/info/info.js +0 -21
- package/lib/info/info.js.map +0 -1
- package/lib/init/init-manager.d.ts +0 -33
- package/lib/init/init-manager.d.ts.map +0 -1
- package/lib/init/init-manager.js +0 -141
- package/lib/init/init-manager.js.map +0 -1
- package/lib/init/init.d.ts +0 -4
- package/lib/init/init.d.ts.map +0 -1
- package/lib/init/init.js +0 -17
- package/lib/init/init.js.map +0 -1
- package/lib/init/templates.d.ts +0 -2
- package/lib/init/templates.d.ts.map +0 -1
- package/lib/init/templates.js +0 -23
- package/lib/init/templates.js.map +0 -1
- package/lib/package.spec.d.ts +0 -2
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -7
- package/lib/package.spec.js.map +0 -1
- package/lib/props/props.d.ts +0 -9
- package/lib/props/props.d.ts.map +0 -1
- package/lib/props/props.js +0 -49
- package/lib/props/props.js.map +0 -1
- package/lib/serve/serve-manager.d.ts +0 -8
- package/lib/serve/serve-manager.d.ts.map +0 -1
- package/lib/serve/serve-manager.js +0 -44
- package/lib/serve/serve-manager.js.map +0 -1
- package/lib/serve/serve.d.ts +0 -8
- package/lib/serve/serve.d.ts.map +0 -1
- package/lib/serve/serve.js +0 -25
- package/lib/serve/serve.js.map +0 -1
- package/lib/update/update.d.ts +0 -9
- package/lib/update/update.d.ts.map +0 -1
- package/lib/update/update.js +0 -56
- package/lib/update/update.js.map +0 -1
- package/lib/utils/banner-util.d.ts +0 -6
- package/lib/utils/banner-util.d.ts.map +0 -1
- package/lib/utils/banner-util.js +0 -44
- package/lib/utils/banner-util.js.map +0 -1
- package/lib/utils/index.d.ts +0 -2
- package/lib/utils/index.d.ts.map +0 -1
- package/lib/utils/index.js +0 -18
- package/lib/utils/index.js.map +0 -1
- package/src/build/build-manager.ts +0 -50
- package/src/build/build.ts +0 -17
- package/src/cell-main.ts +0 -125
- package/src/cell.ts +0 -215
- package/src/config/config.ts +0 -56
- package/src/deploy/deploy.ts +0 -31
- package/src/info/info.ts +0 -23
- package/src/init/init-manager.ts +0 -163
- package/src/init/init.ts +0 -15
- package/src/init/templates.ts +0 -19
- package/src/package.spec.ts +0 -5
- package/src/props/props.ts +0 -48
- package/src/serve/serve-manager.ts +0 -51
- package/src/serve/serve.ts +0 -29
- package/src/update/update.ts +0 -61
- package/src/utils/banner-util.ts +0 -41
- package/src/utils/index.ts +0 -1
- package/templates/accounts/README.md +0 -76
- package/templates/accounts/cell-database.yml +0 -17
- package/templates/accounts/cell-locale.yml +0 -17
- package/templates/accounts/cell-oauth2.0.yml +0 -8
- package/templates/accounts/cell-theme.yml +0 -9
- package/templates/accounts/cell.yml +0 -10
- package/templates/accounts/favicon.ico +0 -0
- package/templates/accounts/package.json +0 -48
- package/templates/accounts/src/browser/home.view.tsx +0 -86
- package/templates/accounts/src/browser/index.ts +0 -3
- package/templates/accounts/src/browser/login.view.tsx +0 -78
- package/templates/accounts/src/browser/module.ts +0 -3
- package/templates/accounts/src/common/entity-protocol.ts +0 -7
- package/templates/accounts/src/common/index.ts +0 -1
- package/templates/accounts/src/node/authentication/authentication-success-handler.ts +0 -69
- package/templates/accounts/src/node/authentication/index.ts +0 -1
- package/templates/accounts/src/node/entity/base-entity.ts +0 -13
- package/templates/accounts/src/node/entity/connection.ts +0 -52
- package/templates/accounts/src/node/entity/index.ts +0 -1
- package/templates/accounts/src/node/entity/user.ts +0 -73
- package/templates/accounts/src/node/error/error.ts +0 -14
- package/templates/accounts/src/node/error/index.ts +0 -1
- package/templates/accounts/src/node/index.ts +0 -2
- package/templates/accounts/src/node/module.ts +0 -9
- package/templates/accounts/src/node/user/index.ts +0 -4
- package/templates/accounts/src/node/user/user-protocol.ts +0 -19
- package/templates/accounts/src/node/user/user-repository.ts +0 -72
- package/templates/accounts/src/node/user/user-service.ts +0 -36
- package/templates/accounts/tsconfig.json +0 -32
- package/templates/admin-app/.github/workflows/deploy.yml +0 -25
- package/templates/admin-app/.vscode/launch.json +0 -23
- package/templates/admin-app/README.md +0 -76
- package/templates/admin-app/cell-database.yml +0 -7
- package/templates/admin-app/cell.yml +0 -93
- package/templates/admin-app/package.json +0 -37
- package/templates/admin-app/src/browser/user.view.tsx +0 -40
- package/templates/admin-app/src/common/index.ts +0 -1
- package/templates/admin-app/src/common/user-protocol.ts +0 -23
- package/templates/admin-app/src/node/entity/index.ts +0 -1
- package/templates/admin-app/src/node/entity/user.ts +0 -15
- package/templates/admin-app/src/node/module.ts +0 -8
- package/templates/admin-app/src/node/user-service.ts +0 -41
- package/templates/admin-app/tsconfig.json +0 -32
- package/templates/backend-app/.github/workflows/deploy.yml +0 -25
- package/templates/backend-app/.vscode/launch.json +0 -23
- package/templates/backend-app/README.md +0 -76
- package/templates/backend-app/cell.yml +0 -0
- package/templates/backend-app/package.json +0 -33
- package/templates/backend-app/src/home-controller.ts +0 -11
- package/templates/backend-app/src/module.ts +0 -4
- package/templates/backend-app/src/user-controller.ts +0 -48
- package/templates/backend-app/test/home-controller.spec.ts +0 -19
- package/templates/backend-app/tsconfig.json +0 -32
- package/templates/cell-component/README.md +0 -27
- package/templates/cell-component/cell.yml +0 -0
- package/templates/cell-component/package.json +0 -29
- package/templates/cell-component/src/echo-service.ts +0 -16
- package/templates/cell-component/src/index.ts +0 -1
- package/templates/cell-component/src/package.spec.ts +0 -5
- package/templates/cell-component/tsconfig.json +0 -37
- package/templates/database-app/.github/workflows/deploy.yml +0 -25
- package/templates/database-app/.vscode/launch.json +0 -23
- package/templates/database-app/README.md +0 -76
- package/templates/database-app/cell.yml +0 -17
- package/templates/database-app/package.json +0 -31
- package/templates/database-app/src/entity/index.ts +0 -1
- package/templates/database-app/src/entity/user.ts +0 -13
- package/templates/database-app/src/home-controller.ts +0 -11
- package/templates/database-app/src/module.ts +0 -8
- package/templates/database-app/src/user-controller.ts +0 -43
- package/templates/database-app/tsconfig.json +0 -32
- package/templates/docker-app/.github/workflows/deploy.yml +0 -25
- package/templates/docker-app/.vscode/launch.json +0 -23
- package/templates/docker-app/Dockerfile +0 -27
- package/templates/docker-app/README.md +0 -77
- package/templates/docker-app/cell.yml +0 -0
- package/templates/docker-app/package.json +0 -31
- package/templates/docker-app/src/browser/assets/logo.png +0 -0
- package/templates/docker-app/src/browser/css-shims.d.ts +0 -30
- package/templates/docker-app/src/browser/hello.view.tsx +0 -31
- package/templates/docker-app/src/browser/module.ts +0 -3
- package/templates/docker-app/src/browser/style/hello.module.scss +0 -4
- package/templates/docker-app/src/common/welcome-protocol.ts +0 -5
- package/templates/docker-app/src/node/module.ts +0 -3
- package/templates/docker-app/src/node/welcome-server.ts +0 -9
- package/templates/docker-app/tsconfig.json +0 -33
- package/templates/file-service/.github/workflows/deploy.yml +0 -25
- package/templates/file-service/.vscode/launch.json +0 -23
- package/templates/file-service/README.md +0 -76
- package/templates/file-service/cell.yml +0 -12
- package/templates/file-service/package.json +0 -34
- package/templates/file-service/src/file-controller.ts +0 -47
- package/templates/file-service/tsconfig.json +0 -32
- package/templates/jwt-app/.github/workflows/deploy.yml +0 -25
- package/templates/jwt-app/.vscode/launch.json +0 -23
- package/templates/jwt-app/README.md +0 -76
- package/templates/jwt-app/cell.yml +0 -4
- package/templates/jwt-app/package.json +0 -36
- package/templates/jwt-app/src/context.ts +0 -16
- package/templates/jwt-app/src/error-handler.ts +0 -30
- package/templates/jwt-app/src/error.ts +0 -4
- package/templates/jwt-app/src/home-controller.ts +0 -23
- package/templates/jwt-app/src/index.ts +0 -5
- package/templates/jwt-app/src/jwt-middleware.ts +0 -36
- package/templates/jwt-app/src/module.ts +0 -3
- package/templates/jwt-app/test/home-controller.spec.ts +0 -19
- package/templates/jwt-app/tsconfig.json +0 -32
- package/templates/koa-app/app.js +0 -8
- package/templates/koa-app/package.json +0 -9
- package/templates/microservice/.github/workflows/deploy.yml +0 -28
- package/templates/microservice/.vscode/launch.json +0 -24
- package/templates/microservice/README.md +0 -76
- package/templates/microservice/examples/backend-app/README.md +0 -76
- package/templates/microservice/examples/backend-app/cell-remote.yml +0 -4
- package/templates/microservice/examples/backend-app/cell.yml +0 -3
- package/templates/microservice/examples/backend-app/package.json +0 -32
- package/templates/microservice/examples/backend-app/src/api-controller.ts +0 -31
- package/templates/microservice/examples/backend-app/src/module.ts +0 -3
- package/templates/microservice/examples/backend-app/tsconfig.json +0 -32
- package/templates/microservice/package.json +0 -20
- package/templates/microservice/packages/api/README.md +0 -76
- package/templates/microservice/packages/api/cell.yml +0 -0
- package/templates/microservice/packages/api/package.json +0 -25
- package/templates/microservice/packages/api/src/common/api-protocol.ts +0 -10
- package/templates/microservice/packages/api/src/common/index.ts +0 -1
- package/templates/microservice/packages/api/tsconfig.json +0 -30
- package/templates/microservice/packages/serviceA/.vscode/launch.json +0 -23
- package/templates/microservice/packages/serviceA/README.md +0 -76
- package/templates/microservice/packages/serviceA/cell.yml +0 -6
- package/templates/microservice/packages/serviceA/package.json +0 -29
- package/templates/microservice/packages/serviceA/src/node/module.ts +0 -3
- package/templates/microservice/packages/serviceA/src/node/service-a.ts +0 -9
- package/templates/microservice/packages/serviceA/tsconfig.json +0 -30
- package/templates/microservice/packages/serviceB/README.md +0 -76
- package/templates/microservice/packages/serviceB/cell.yml +0 -5
- package/templates/microservice/packages/serviceB/package.json +0 -29
- package/templates/microservice/packages/serviceB/src/node/module.ts +0 -3
- package/templates/microservice/packages/serviceB/src/node/service-b.ts +0 -9
- package/templates/microservice/packages/serviceB/tsconfig.json +0 -30
- package/templates/microservice/tsconfig.json +0 -32
- package/templates/mycli/.vscode/launch.json +0 -33
- package/templates/mycli/bin/mycli +0 -2
- package/templates/mycli/bin/mycli-deploy +0 -2
- package/templates/mycli/bin/mycli-init +0 -2
- package/templates/mycli/package.json +0 -33
- package/templates/mycli/src/bootstrap.ts +0 -7
- package/templates/mycli/src/constants.ts +0 -1
- package/templates/mycli/src/deploy/deploy-manager.ts +0 -12
- package/templates/mycli/src/deploy/deploy.ts +0 -16
- package/templates/mycli/src/deploy/index.ts +0 -1
- package/templates/mycli/src/index.ts +0 -2
- package/templates/mycli/src/init/index.ts +0 -1
- package/templates/mycli/src/init/init-manager.ts +0 -85
- package/templates/mycli/src/init/init.ts +0 -25
- package/templates/mycli/src/init/templates.ts +0 -3
- package/templates/mycli/src/module.ts +0 -3
- package/templates/mycli/src/mycli.ts +0 -13
- package/templates/mycli/templates/application-template/README.md +0 -0
- package/templates/mycli/tsconfig.json +0 -32
- package/templates/nest-app/.eslintrc.js +0 -25
- package/templates/nest-app/.prettierrc +0 -4
- package/templates/nest-app/README.md +0 -73
- package/templates/nest-app/nest-cli.json +0 -8
- package/templates/nest-app/package.json +0 -69
- package/templates/nest-app/src/app.controller.spec.ts +0 -22
- package/templates/nest-app/src/app.controller.ts +0 -12
- package/templates/nest-app/src/app.module.ts +0 -10
- package/templates/nest-app/src/app.service.ts +0 -8
- package/templates/nest-app/src/main.ts +0 -8
- package/templates/nest-app/test/app.e2e-spec.ts +0 -24
- package/templates/nest-app/test/jest-e2e.json +0 -9
- package/templates/nest-app/tsconfig.build.json +0 -12
- package/templates/nest-app/tsconfig.json +0 -25
- package/templates/nextjs-app/.eslintrc.json +0 -3
- package/templates/nextjs-app/README.md +0 -34
- package/templates/nextjs-app/next.config.js +0 -6
- package/templates/nextjs-app/package.json +0 -20
- package/templates/nextjs-app/pages/_app.js +0 -7
- package/templates/nextjs-app/pages/api/hello.js +0 -5
- package/templates/nextjs-app/pages/index.js +0 -69
- package/templates/nextjs-app/public/favicon.ico +0 -0
- package/templates/nextjs-app/public/vercel.svg +0 -4
- package/templates/nextjs-app/styles/Home.module.css +0 -116
- package/templates/nextjs-app/styles/globals.css +0 -16
- package/templates/sample-app/.github/workflows/deploy.yml +0 -25
- package/templates/sample-app/.vscode/launch.json +0 -23
- package/templates/sample-app/README.md +0 -76
- package/templates/sample-app/cell.yml +0 -0
- package/templates/sample-app/package.json +0 -31
- package/templates/sample-app/src/browser/assets/logo.png +0 -0
- package/templates/sample-app/src/browser/css-shims.d.ts +0 -30
- package/templates/sample-app/src/browser/hello.view.tsx +0 -31
- package/templates/sample-app/src/browser/module.ts +0 -3
- package/templates/sample-app/src/browser/style/hello.module.scss +0 -4
- package/templates/sample-app/src/common/welcome-protocol.ts +0 -5
- package/templates/sample-app/src/node/module.ts +0 -3
- package/templates/sample-app/src/node/welcome-server.ts +0 -9
- package/templates/sample-app/tsconfig.json +0 -32
- package/templates/schedule/.github/workflows/deploy.yml +0 -25
- package/templates/schedule/.vscode/launch.json +0 -23
- package/templates/schedule/README.md +0 -76
- package/templates/schedule/cell.yml +0 -1
- package/templates/schedule/package.json +0 -29
- package/templates/schedule/src/module.ts +0 -3
- package/templates/schedule/src/scheduler.ts +0 -10
- package/templates/schedule/tsconfig.json +0 -32
- package/templates/standalone-app/package.json +0 -17
- package/templates/standalone-app/src/app.service.ts +0 -10
- package/templates/standalone-app/src/main.ts +0 -14
- package/templates/standalone-app/src/module.ts +0 -3
- package/templates/standalone-app/tsconfig.json +0 -30
- package/templates/vue-app/.github/workflows/deploy.yml +0 -25
- package/templates/vue-app/.vscode/launch.json +0 -23
- package/templates/vue-app/README.md +0 -76
- package/templates/vue-app/cell.yml +0 -0
- package/templates/vue-app/package.json +0 -32
- package/templates/vue-app/src/browser/App.vue +0 -32
- package/templates/vue-app/src/browser/app.ts +0 -7
- package/templates/vue-app/src/browser/components/HelloWorld.vue +0 -42
- package/templates/vue-app/src/browser/declare.d.ts +0 -7
- package/templates/vue-app/src/browser/images/logo.png +0 -0
- package/templates/vue-app/src/browser/module.ts +0 -3
- package/templates/vue-app/src/browser/router.ts +0 -13
- package/templates/vue-app/src/browser/shims-vue.d.ts +0 -5
- package/templates/vue-app/src/browser/views/About.vue +0 -5
- package/templates/vue-app/src/browser/views/Root.vue +0 -37
- package/templates/vue-app/src/common/welcome-protocol.ts +0 -5
- package/templates/vue-app/src/node/module.ts +0 -3
- package/templates/vue-app/src/node/welcome-server.ts +0 -9
- package/templates/vue-app/tsconfig.json +0 -32
package/src/index.ts
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export * from './agent/agent-guide.js';
|
|
2
|
+
export * from './build/executable-compiler.js';
|
|
3
|
+
export * from './check/project-checker.js';
|
|
4
|
+
export * from './cli/agent-command.js';
|
|
5
|
+
export * from './cli/build-command.js';
|
|
6
|
+
export * from './cli/cell-cli.js';
|
|
7
|
+
export * from './cli/check-command.js';
|
|
8
|
+
export * from './cli/command.js';
|
|
9
|
+
export * from './cli/config-command.js';
|
|
10
|
+
export * from './cli/deploy-command.js';
|
|
11
|
+
export * from './cli/dev-command.js';
|
|
12
|
+
export * from './cli/docs-command.js';
|
|
13
|
+
export * from './cli/info-command.js';
|
|
14
|
+
export * from './cli/init-command.js';
|
|
15
|
+
export * from './cli/mcp-command.js';
|
|
16
|
+
export * from './cli/preview-command.js';
|
|
17
|
+
export * from './cli/reporter.js';
|
|
18
|
+
export * from './config/config-explainer.js';
|
|
19
|
+
export * from './config/config-file-loader.js';
|
|
20
|
+
export * from './config/config-resolver.js';
|
|
21
|
+
export * from './config/config-validator.js';
|
|
22
|
+
export * from './config/define-config.js';
|
|
23
|
+
export * from './config/types.js';
|
|
24
|
+
export * from './deploy/cloud-api.js';
|
|
25
|
+
export * from './deploy/code-package.js';
|
|
26
|
+
export * from './deploy/deployer-registry.js';
|
|
27
|
+
export * from './deploy/request-signer.js';
|
|
28
|
+
export * from './deploy/zip-writer.js';
|
|
29
|
+
export * from './docs/docs-index.js';
|
|
30
|
+
export * from './events/event-bus.js';
|
|
31
|
+
export * from './events/hook-runner.js';
|
|
32
|
+
export * from './info/project-inspector.js';
|
|
33
|
+
export * from './init/project-initializer.js';
|
|
34
|
+
export * from './mcp/dev-activity.js';
|
|
35
|
+
export * from './mcp/dev-mcp-endpoint.js';
|
|
36
|
+
export * from './mcp/mcp-server.js';
|
|
37
|
+
export * from './mcp/project-mcp-tools.js';
|
|
38
|
+
export * from './preset/builtin-presets.js';
|
|
39
|
+
export * from './preset/cloudflare/cloudflare-deployer.js';
|
|
40
|
+
export * from './preset/cloudflare/cloudflare-preset.js';
|
|
41
|
+
export * from './preset/cloudflare/wrangler.js';
|
|
42
|
+
export * from './preset/cloudflare/wrangler-config.js';
|
|
43
|
+
export * from './preset/fc/fc-deployer.js';
|
|
44
|
+
export * from './preset/fc/fc-preset.js';
|
|
45
|
+
export * from './preset/lambda/lambda-deployer.js';
|
|
46
|
+
export * from './preset/lambda/lambda-preset.js';
|
|
47
|
+
export * from './preset/preset-output.js';
|
|
48
|
+
export * from './preset/preset-registry.js';
|
|
49
|
+
export * from './preset/scf/scf-deployer.js';
|
|
50
|
+
export * from './preset/scf/scf-preset.js';
|
|
51
|
+
export * from './preset/serverless-scripts.js';
|
|
52
|
+
export * from './preset/vercel/vercel-deployer.js';
|
|
53
|
+
export * from './preset/vercel/vercel-preset.js';
|
|
54
|
+
export * from './testing/create-test-app.js';
|
|
55
|
+
export * from './toolchain/toolchain.js';
|
|
56
|
+
export * from './utils/json-util.js';
|
|
57
|
+
export * from './utils/text-util.js';
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { basename, isAbsolute, join, relative } from 'node:path';
|
|
3
|
+
import type { CheckIssue, ComponentInfo, EnvOverrideReport, Preset, ProjectModel, ServerRuntime, Target, TargetModel } from '@celljs/kit';
|
|
4
|
+
import { type OutputManifest, ProjectLoader, type ProjectLoaderOptions } from '@celljs/vite';
|
|
5
|
+
import { ConfigResolver, type ModuleSpec, type ResolvedConfig, type ValueSource } from '../config/config-resolver.js';
|
|
6
|
+
import type { CompileTarget } from '../config/types.js';
|
|
7
|
+
import type { ModuleRegistrations } from '../modules/module-host.js';
|
|
8
|
+
import { TextUtil } from '../utils/text-util.js';
|
|
9
|
+
|
|
10
|
+
/** A component as `cell info` reports it. Paths are relative to the project root; empty declarations are left out. */
|
|
11
|
+
export interface ComponentSummary {
|
|
12
|
+
name: string;
|
|
13
|
+
version: string;
|
|
14
|
+
dir: string;
|
|
15
|
+
/** Present (and `true`) for the project itself. */
|
|
16
|
+
root?: true;
|
|
17
|
+
configFiles: string[];
|
|
18
|
+
targets?: Target[];
|
|
19
|
+
entries?: Record<string, string>;
|
|
20
|
+
toolchain?: string;
|
|
21
|
+
optionalDependencies?: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface TargetSummary {
|
|
25
|
+
entry: string;
|
|
26
|
+
/** Component whose `entries` provided the entry. */
|
|
27
|
+
entryComponent?: string;
|
|
28
|
+
/** DI modules in load order; files of the project are relative to its root. */
|
|
29
|
+
staticModules: string[];
|
|
30
|
+
modules: string[];
|
|
31
|
+
/** Merged application configuration, only with `--app-config`. Backend values keep `${...}`. */
|
|
32
|
+
config?: Record<string, unknown>;
|
|
33
|
+
/**
|
|
34
|
+
* `CELL_FRONTEND__*` / `CELL_BACKEND__*` variables of the current environment and the keys they set;
|
|
35
|
+
* present when there are any. Frontend ones are applied by `cell build`, backend ones by the server
|
|
36
|
+
* at startup. Values are left out.
|
|
37
|
+
*/
|
|
38
|
+
envOverrides?: EnvOverrideReport;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface OutputSummary {
|
|
42
|
+
/** Output directory, relative to the project root. */
|
|
43
|
+
dir: string;
|
|
44
|
+
built: boolean;
|
|
45
|
+
preset?: string;
|
|
46
|
+
format?: 'esm' | 'cjs';
|
|
47
|
+
targets?: Target[];
|
|
48
|
+
server?: string;
|
|
49
|
+
public?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The result of `cell info` (docs/design/architecture.md §8): what the next `cell build` with the same flags would use. */
|
|
53
|
+
export interface ProjectInfo {
|
|
54
|
+
root: string;
|
|
55
|
+
name: string;
|
|
56
|
+
version: string;
|
|
57
|
+
cellVersion: string;
|
|
58
|
+
/** cell.config file, relative to the root. */
|
|
59
|
+
configFile?: string;
|
|
60
|
+
preset: {
|
|
61
|
+
name: string;
|
|
62
|
+
source: ValueSource;
|
|
63
|
+
description?: string;
|
|
64
|
+
entry?: string;
|
|
65
|
+
format?: 'esm' | 'cjs';
|
|
66
|
+
runtime?: ServerRuntime;
|
|
67
|
+
/** Deployer of `cell deploy`; none means the output is run by hand. */
|
|
68
|
+
deployer?: string;
|
|
69
|
+
available: string[];
|
|
70
|
+
};
|
|
71
|
+
mode: string[];
|
|
72
|
+
targets: Target[];
|
|
73
|
+
/** Why each target is built: `cell.config.ts`, `default` (the backend) or the components that declare it. */
|
|
74
|
+
targetSources: Partial<Record<Target, string[]>>;
|
|
75
|
+
build: { format: 'esm' | 'cjs'; outDir: string; external: string[]; sourcemap: boolean; single: boolean; compile: false | CompileTarget };
|
|
76
|
+
components: ComponentSummary[];
|
|
77
|
+
frontend?: TargetSummary;
|
|
78
|
+
backend?: TargetSummary;
|
|
79
|
+
/** Project hooks by event. `cell info` lists them and never runs them. */
|
|
80
|
+
hooks: Record<string, string>;
|
|
81
|
+
/** The `modules` entries of cell.config.ts. */
|
|
82
|
+
modules: ModuleSpec[];
|
|
83
|
+
/** Keys of toolchain module options in cell.config.ts. */
|
|
84
|
+
moduleOptions: string[];
|
|
85
|
+
/** Toolchain modules in load order and what each registered (docs/design/modules.md §3.5); `file` is relative to the root. */
|
|
86
|
+
toolchainModules: ModuleRegistrations[];
|
|
87
|
+
output: OutputSummary;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface InspectOptions {
|
|
91
|
+
/** Include the merged application configuration of each target. */
|
|
92
|
+
appConfig?: boolean;
|
|
93
|
+
cellVersion?: string;
|
|
94
|
+
/** Environment for frontend expressions and `CELL_*__` overrides. Default: `process.env`. */
|
|
95
|
+
env?: Record<string, string | undefined>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Describes a project from its resolved toolchain configuration and the project model. Reads
|
|
100
|
+
* package.json, cell*.yml and manifest.json only: no project code runs and nothing is built, so it
|
|
101
|
+
* returns quickly and is safe to call from agents and editors (docs/design/agent-first.md R2).
|
|
102
|
+
*/
|
|
103
|
+
export class ProjectInspector {
|
|
104
|
+
static readonly COMMAND_MODES = ['production', 'development'];
|
|
105
|
+
static readonly MODE_FILE = /^cell\.([\w-]+)\.yml$/;
|
|
106
|
+
|
|
107
|
+
/** What `cell info` warns about, with stable codes for `cell check`. */
|
|
108
|
+
readonly issues: CheckIssue[] = [];
|
|
109
|
+
|
|
110
|
+
get warnings(): string[] {
|
|
111
|
+
return this.issues.map(issue => issue.message);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
protected warn(code: string, message: string, file?: string): void {
|
|
115
|
+
this.issues.push({ level: 'warning', code, message, ...(file ? { file } : {}) });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
constructor(
|
|
119
|
+
protected readonly config: ResolvedConfig,
|
|
120
|
+
protected readonly preset: Preset,
|
|
121
|
+
protected readonly presets: string[],
|
|
122
|
+
/** What toolchain modules contributed: project options (DI modules, entries) and their registrations. */
|
|
123
|
+
protected readonly contributions: { projectOptions?: ProjectLoaderOptions; modules?: ModuleRegistrations[] } = {},
|
|
124
|
+
) {}
|
|
125
|
+
|
|
126
|
+
inspect(options: InspectOptions = {}): ProjectInfo {
|
|
127
|
+
const { config, preset } = this;
|
|
128
|
+
const projectOptions = this.contributions.projectOptions ?? ConfigResolver.toProjectOptions(config, preset);
|
|
129
|
+
const model = new ProjectLoader({ ...projectOptions, env: options.env }).load();
|
|
130
|
+
const project = model.components[model.components.length - 1];
|
|
131
|
+
const info: ProjectInfo = {
|
|
132
|
+
root: config.root,
|
|
133
|
+
name: project.name,
|
|
134
|
+
version: project.version,
|
|
135
|
+
cellVersion: options.cellVersion ?? '',
|
|
136
|
+
...(config.file ? { configFile: this.relative(config.file) } : {}),
|
|
137
|
+
preset: {
|
|
138
|
+
name: preset.name,
|
|
139
|
+
source: config.preset.source,
|
|
140
|
+
...(preset.description ? { description: preset.description } : {}),
|
|
141
|
+
...(preset.entry ? { entry: preset.entry } : {}),
|
|
142
|
+
...(preset.format ? { format: preset.format } : {}),
|
|
143
|
+
...(preset.runtime ? { runtime: preset.runtime } : {}),
|
|
144
|
+
...(preset.deployer ? { deployer: preset.deployer } : {}),
|
|
145
|
+
available: this.presets,
|
|
146
|
+
},
|
|
147
|
+
mode: config.mode,
|
|
148
|
+
targets: model.targets,
|
|
149
|
+
targetSources: this.targetSources(model),
|
|
150
|
+
build: {
|
|
151
|
+
format: ConfigResolver.format(config, preset),
|
|
152
|
+
outDir: config.build.outDir,
|
|
153
|
+
external: config.build.external,
|
|
154
|
+
sourcemap: config.build.sourcemap,
|
|
155
|
+
single: config.build.single,
|
|
156
|
+
compile: config.build.compile,
|
|
157
|
+
},
|
|
158
|
+
components: model.components.map(c => this.component(c)),
|
|
159
|
+
hooks: { ...config.hooks } as Record<string, string>,
|
|
160
|
+
modules: config.modules.map(spec => (spec.kind === 'local' ? { ...spec, path: this.relative(spec.path) } : spec)),
|
|
161
|
+
moduleOptions: Object.keys(config.options),
|
|
162
|
+
toolchainModules: (this.contributions.modules ?? []).map(m => ({ ...m, file: this.relative(m.file) })),
|
|
163
|
+
output: this.output(),
|
|
164
|
+
};
|
|
165
|
+
for (const target of model.targets) {
|
|
166
|
+
info[target] = this.target(model[target] as TargetModel, options.appConfig ?? false);
|
|
167
|
+
}
|
|
168
|
+
this.check(model);
|
|
169
|
+
return info;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** The human form of {@link ProjectInfo}: a short summary; `--json` has the details. */
|
|
173
|
+
static format(info: ProjectInfo): string {
|
|
174
|
+
const rows: [string, string][] = [
|
|
175
|
+
['config', info.configFile ?? 'none (defaults)'],
|
|
176
|
+
['preset', `${info.preset.name} (${info.preset.source})${info.preset.description ? `: ${info.preset.description}` : ''}, ${info.build.format}`],
|
|
177
|
+
['mode', info.mode.join(', ')],
|
|
178
|
+
['targets', info.targets.map(t => `${t} (${info.targetSources[t]?.join(', ')})`).join(', ')],
|
|
179
|
+
];
|
|
180
|
+
for (const target of info.targets) {
|
|
181
|
+
const summary = info[target] as TargetSummary;
|
|
182
|
+
const count = summary.staticModules.length + summary.modules.length;
|
|
183
|
+
const entry = target === 'backend' && !summary.entryComponent ? `${summary.entry} (default entry)` : summary.entry;
|
|
184
|
+
rows.push([target, `${entry}, ${count} DI module${count === 1 ? '' : 's'}`]);
|
|
185
|
+
}
|
|
186
|
+
const overrides = info.targets.flatMap(target => (info[target] as TargetSummary).envOverrides?.applied ?? []);
|
|
187
|
+
if (overrides.length > 0) {
|
|
188
|
+
rows.push(['env', overrides.map(({ variable, path }) => `${variable} → ${path}`).join(', ')]);
|
|
189
|
+
}
|
|
190
|
+
const hooks = Object.entries(info.hooks);
|
|
191
|
+
rows.push(['hooks', hooks.length > 0 ? hooks.map(([event, command]) => `${event} → ${command}`).join('; ') : 'none']);
|
|
192
|
+
if (info.modules.length > 0) {
|
|
193
|
+
rows.push(['modules', info.modules.map(spec => ProjectInspector.formatModule(spec)).join(', ')]);
|
|
194
|
+
}
|
|
195
|
+
if (info.toolchainModules.length > 0) {
|
|
196
|
+
rows.push(['toolchain', info.toolchainModules.map(m => ProjectInspector.formatToolchainModule(m)).join(', ')]);
|
|
197
|
+
}
|
|
198
|
+
const { output } = info;
|
|
199
|
+
rows.push([
|
|
200
|
+
'output',
|
|
201
|
+
output.built
|
|
202
|
+
? `${output.dir} (built: ${output.preset ?? 'no preset'}, ${output.format}, ${output.targets?.join(' + ')})`
|
|
203
|
+
: `${output.dir} (not built)`,
|
|
204
|
+
]);
|
|
205
|
+
rows.push(['components', String(info.components.length)]);
|
|
206
|
+
const width = Math.max(...rows.map(([label]) => label.length)) + 2;
|
|
207
|
+
return [
|
|
208
|
+
`${info.name} ${info.version} ${info.root}`,
|
|
209
|
+
...rows.map(([label, value]) => ` ${label.padEnd(width)}${value}`),
|
|
210
|
+
...info.components.map(c => ` ${c.name} ${c.version}${c.root ? ' (project)' : ''}`),
|
|
211
|
+
'',
|
|
212
|
+
'Details: cell info --json (add --app-config for the merged cell.yml)',
|
|
213
|
+
].join('\n');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
static missingEntryWarning(preset: Preset): string {
|
|
217
|
+
return `No component provides the '${preset.entry}' entry of the ${preset.name} preset, so the backend starts the application without a server. Add @celljs/express-adapter to dependencies for an HTTP server, or use the cli preset for a command-line application.`;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
static envProblemWarning(target: Target, problem: { variable: string; message: string }): string {
|
|
221
|
+
return `${problem.variable} is ignored${target === 'backend' ? ' by the server' : ''}: ${problem.message}`;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** `@x/ui (2 vite plugins, 1 check)`: what a module registered, counted. */
|
|
225
|
+
static formatToolchainModule(module: ModuleRegistrations): string {
|
|
226
|
+
const counts: [number, string, string][] = [
|
|
227
|
+
[module.vitePlugins.length, 'vite plugin', 'vite plugins'],
|
|
228
|
+
[module.runtimeModules.length, 'DI module', 'DI modules'],
|
|
229
|
+
[module.virtualModules.length, 'virtual module', 'virtual modules'],
|
|
230
|
+
[Object.keys(module.entries).length, 'entry', 'entries'],
|
|
231
|
+
[module.devHandlers.length, 'dev handler', 'dev handlers'],
|
|
232
|
+
[module.presets.length, 'preset', 'presets'],
|
|
233
|
+
[module.outputFiles.length, 'output file', 'output files'],
|
|
234
|
+
[module.checks.length, 'check', 'checks'],
|
|
235
|
+
[module.mcpTools.length, 'MCP tool', 'MCP tools'],
|
|
236
|
+
[module.docs.length, 'docs dir', 'docs dirs'],
|
|
237
|
+
[module.events.length, 'event', 'events'],
|
|
238
|
+
];
|
|
239
|
+
const parts = counts.filter(([n]) => n > 0).map(([n, one, many]) => `${n} ${n === 1 ? one : many}`);
|
|
240
|
+
return parts.length > 0 ? `${module.name} (${parts.join(', ')})` : module.name;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
static formatModule(spec: ModuleSpec): string {
|
|
244
|
+
switch (spec.kind) {
|
|
245
|
+
case 'local':
|
|
246
|
+
return spec.path;
|
|
247
|
+
case 'package':
|
|
248
|
+
return spec.name;
|
|
249
|
+
case 'disabled':
|
|
250
|
+
return `!${spec.name}`;
|
|
251
|
+
case 'filter':
|
|
252
|
+
return `${spec.name} (${[spec.runtime ? '' : 'runtime: false', spec.toolchain ? '' : 'toolchain: false'].filter(Boolean).join(', ')})`;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
protected targetSources(model: ProjectModel): Partial<Record<Target, string[]>> {
|
|
257
|
+
const sources: Partial<Record<Target, string[]>> = {};
|
|
258
|
+
for (const target of model.targets) {
|
|
259
|
+
if (this.config.targets) {
|
|
260
|
+
sources[target] = [this.config.file ? basename(this.config.file) : 'cell.config.ts'];
|
|
261
|
+
continue;
|
|
262
|
+
}
|
|
263
|
+
const declaring = model.components.filter(c => c.targets.includes(target)).map(c => c.name);
|
|
264
|
+
sources[target] = target === 'backend' ? ['default', ...declaring] : declaring;
|
|
265
|
+
}
|
|
266
|
+
return sources;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
protected component(component: ComponentInfo): ComponentSummary {
|
|
270
|
+
const { name, version, dir, root, configFiles, targets, entries, toolchain, optionalDependencies } = component;
|
|
271
|
+
return {
|
|
272
|
+
name,
|
|
273
|
+
version,
|
|
274
|
+
dir: this.relative(dir) || '.',
|
|
275
|
+
...(root ? { root: true as const } : {}),
|
|
276
|
+
configFiles: configFiles.map(file => this.relative(file)),
|
|
277
|
+
...(targets.length > 0 ? { targets } : {}),
|
|
278
|
+
...(Object.keys(entries).length > 0 ? { entries } : {}),
|
|
279
|
+
...(toolchain ? { toolchain } : {}),
|
|
280
|
+
...(optionalDependencies.length > 0 ? { optionalDependencies } : {}),
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
protected target(model: TargetModel, appConfig: boolean): TargetSummary {
|
|
285
|
+
const specifier = (s: string) => (isAbsolute(s) ? this.relative(s) : s);
|
|
286
|
+
return {
|
|
287
|
+
entry: specifier(model.entry),
|
|
288
|
+
...(model.entryComponent ? { entryComponent: model.entryComponent } : {}),
|
|
289
|
+
staticModules: model.staticModules.map(m => specifier(m.specifier)),
|
|
290
|
+
modules: model.modules.map(m => specifier(m.specifier)),
|
|
291
|
+
...(appConfig ? { config: model.config } : {}),
|
|
292
|
+
...(model.envOverrides.applied.length + model.envOverrides.problems.length > 0 ? { envOverrides: model.envOverrides } : {}),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
protected output(): OutputSummary {
|
|
297
|
+
const dir = this.config.build.outDir;
|
|
298
|
+
const file = join(this.config.root, dir, 'manifest.json');
|
|
299
|
+
if (!existsSync(file)) {
|
|
300
|
+
return { dir, built: false };
|
|
301
|
+
}
|
|
302
|
+
try {
|
|
303
|
+
const { preset, format, targets, server, public: publicDir } = JSON.parse(readFileSync(file, 'utf8')) as OutputManifest;
|
|
304
|
+
return { dir, built: true, preset, format, targets, server, public: publicDir };
|
|
305
|
+
} catch {
|
|
306
|
+
this.warn('CELL_OUTPUT_UNREADABLE', `${this.relative(file)} cannot be read; run \`cell build\` to write it again.`, file);
|
|
307
|
+
return { dir, built: false };
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/** Settings that `cell build` would accept but that change nothing or fail: say so before the build does. */
|
|
312
|
+
protected check(model: ProjectModel): void {
|
|
313
|
+
if (model.backend && !model.backend.entryComponent && this.preset.entry) {
|
|
314
|
+
this.warn('CELL_ENTRY_MISSING', ProjectInspector.missingEntryWarning(this.preset), join(this.config.root, 'package.json'));
|
|
315
|
+
}
|
|
316
|
+
const available = this.availableModes(model);
|
|
317
|
+
for (const mode of this.config.mode) {
|
|
318
|
+
if (!ProjectInspector.COMMAND_MODES.includes(mode) && !available.includes(mode)) {
|
|
319
|
+
const suggestion = TextUtil.closest(mode, available);
|
|
320
|
+
this.warn(
|
|
321
|
+
'CELL_MODE_UNKNOWN',
|
|
322
|
+
`Mode '${mode}' changes nothing: neither the project nor its components have cell.${mode}.yml.${suggestion ? ` Did you mean '${suggestion}'?` : ''}`,
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
for (const target of model.targets) {
|
|
327
|
+
const { applied, problems } = (model[target] as TargetModel).envOverrides;
|
|
328
|
+
for (const problem of problems) {
|
|
329
|
+
this.warn('CELL_ENV_OVERRIDE_IGNORED', ProjectInspector.envProblemWarning(target, problem));
|
|
330
|
+
}
|
|
331
|
+
for (const { variable, path, shadows } of applied) {
|
|
332
|
+
if (shadows) {
|
|
333
|
+
const explicit = variable.replace(/^(CELL_[A-Z]+__)/, '$1CELL__');
|
|
334
|
+
this.warn(
|
|
335
|
+
'CELL_ENV_OVERRIDE_SHADOWS',
|
|
336
|
+
`${variable} sets ${path}, not ${shadows}: the top-level key comes first. Use ${explicit} for ${shadows}.`,
|
|
337
|
+
);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/** Modes with a `cell.<mode>.yml` in the project or any of its components, active or not. */
|
|
344
|
+
protected availableModes(model: ProjectModel): string[] {
|
|
345
|
+
const modes = model.components.flatMap(c => readdirSync(c.dir).flatMap(file => ProjectInspector.MODE_FILE.exec(file)?.[1] ?? []));
|
|
346
|
+
return [...new Set(modes)];
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
protected relative(path: string): string {
|
|
350
|
+
return relative(this.config.root, path);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { basename, join, relative, resolve } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { CellError } from '@celljs/kit';
|
|
5
|
+
import { AgentGuide } from '../agent/agent-guide.js';
|
|
6
|
+
import { TextUtil } from '../utils/text-util.js';
|
|
7
|
+
|
|
8
|
+
export interface TemplateInfo {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface InitResult {
|
|
14
|
+
template: string;
|
|
15
|
+
name: string;
|
|
16
|
+
/** Absolute project directory. */
|
|
17
|
+
dir: string;
|
|
18
|
+
/** Files created, relative to the project directory. */
|
|
19
|
+
files: string[];
|
|
20
|
+
/** Commands to run next, from the current directory. */
|
|
21
|
+
next: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `cell init`: copies a template of @celljs/cli into a new directory, with the project name and the
|
|
26
|
+
* Cell version filled in, and adds what coding agents need: AGENTS.md, the cell skill, a CLAUDE.md
|
|
27
|
+
* that includes AGENTS.md and an MCP configuration for `cell mcp` (docs/design/agent-first.md §3).
|
|
28
|
+
*/
|
|
29
|
+
export class ProjectInitializer {
|
|
30
|
+
static readonly TEMPLATES = fileURLToPath(new URL('../../templates', import.meta.url));
|
|
31
|
+
/** Files whose names npm would drop or rename when publishing. */
|
|
32
|
+
static readonly RENAMED: Record<string, string> = { _gitignore: '.gitignore' };
|
|
33
|
+
static readonly MCP_CONFIG = { mcpServers: { cell: { command: 'npx', args: ['cell', 'mcp'] } } };
|
|
34
|
+
|
|
35
|
+
constructor(protected readonly version: string) {}
|
|
36
|
+
|
|
37
|
+
static templates(): TemplateInfo[] {
|
|
38
|
+
return readdirSync(ProjectInitializer.TEMPLATES)
|
|
39
|
+
.filter(name => existsSync(join(ProjectInitializer.TEMPLATES, name, 'template.json')))
|
|
40
|
+
.sort()
|
|
41
|
+
.map(name => ({ name, description: JSON.parse(readFileSync(join(ProjectInitializer.TEMPLATES, name, 'template.json'), 'utf8')).description }));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** npm package names are lowercase, without spaces, at most 214 characters. */
|
|
45
|
+
static packageName(dir: string): string {
|
|
46
|
+
return basename(dir)
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/[^a-z0-9._~-]+/g, '-')
|
|
49
|
+
.replace(/^[._-]+|-+$/g, '');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
init(template: string, dir: string, options: { name?: string; force?: boolean; cwd?: string } = {}): InitResult {
|
|
53
|
+
const templates = ProjectInitializer.templates();
|
|
54
|
+
if (!templates.some(t => t.name === template)) {
|
|
55
|
+
const suggestion = TextUtil.closest(
|
|
56
|
+
template,
|
|
57
|
+
templates.map(t => t.name),
|
|
58
|
+
);
|
|
59
|
+
throw new CellError({
|
|
60
|
+
code: 'CELL_TEMPLATE_NOT_FOUND',
|
|
61
|
+
message: `Unknown template '${template}'.`,
|
|
62
|
+
hint: suggestion ? `Did you mean '${suggestion}'?` : `Templates: ${templates.map(t => t.name).join(', ')}.`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const target = resolve(options.cwd ?? process.cwd(), dir);
|
|
66
|
+
const name = options.name ?? ProjectInitializer.packageName(target);
|
|
67
|
+
if (!/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name) || name.length > 214) {
|
|
68
|
+
throw new CellError({
|
|
69
|
+
code: 'CELL_ARGUMENT_INVALID',
|
|
70
|
+
message: `'${name}' is not a valid package name.`,
|
|
71
|
+
hint: 'Pass --name with lowercase letters, digits, - and . (e.g. --name my-app).',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (existsSync(target) && (!statSync(target).isDirectory() || readdirSync(target).length > 0) && !options.force) {
|
|
75
|
+
throw new CellError({
|
|
76
|
+
code: 'CELL_INIT_NOT_EMPTY',
|
|
77
|
+
message: `${target} exists and is not empty.`,
|
|
78
|
+
hint: 'Choose a new directory, or pass --force to write the template files into it (files with the same names are replaced).',
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
mkdirSync(target, { recursive: true });
|
|
82
|
+
const source = join(ProjectInitializer.TEMPLATES, template);
|
|
83
|
+
cpSync(source, target, { recursive: true, filter: file => basename(file) !== 'template.json' });
|
|
84
|
+
const files: string[] = [];
|
|
85
|
+
for (const file of ProjectInitializer.walk(source).filter(f => basename(f) !== 'template.json')) {
|
|
86
|
+
const rel = relative(source, file);
|
|
87
|
+
const renamed = join(target, ...rel.split(/[\\/]/).map(part => ProjectInitializer.RENAMED[part] ?? part));
|
|
88
|
+
if (renamed !== join(target, rel)) {
|
|
89
|
+
renameSync(join(target, rel), renamed);
|
|
90
|
+
}
|
|
91
|
+
writeFileSync(renamed, readFileSync(renamed, 'utf8').replaceAll('{{name}}', name).replaceAll('{{cellVersion}}', this.version));
|
|
92
|
+
files.push(relative(target, renamed));
|
|
93
|
+
}
|
|
94
|
+
files.push(...new AgentGuide(target, this.version).sync([]).files);
|
|
95
|
+
writeFileSync(join(target, 'CLAUDE.md'), '@AGENTS.md\n');
|
|
96
|
+
writeFileSync(join(target, '.mcp.json'), `${JSON.stringify(ProjectInitializer.MCP_CONFIG, null, 2)}\n`);
|
|
97
|
+
files.push('CLAUDE.md', '.mcp.json');
|
|
98
|
+
const cd = relative(options.cwd ?? process.cwd(), target) || '.';
|
|
99
|
+
return {
|
|
100
|
+
template,
|
|
101
|
+
name,
|
|
102
|
+
dir: target,
|
|
103
|
+
files: files.map(f => f.split('\\').join('/')).sort(),
|
|
104
|
+
next: [...(cd === '.' ? [] : [`cd ${cd}`]), 'npm install', 'npx cell agent sync', 'npx cell dev'],
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
protected static walk(dir: string): string[] {
|
|
109
|
+
return (readdirSync(dir, { recursive: true }) as string[]).map(name => join(dir, name)).filter(file => statSync(file).isFile());
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { format } from 'node:util';
|
|
2
|
+
import type { CellError } from '@celljs/kit';
|
|
3
|
+
import type { DevRequestRecord } from '@celljs/vite';
|
|
4
|
+
|
|
5
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
6
|
+
|
|
7
|
+
export interface DevLogRecord {
|
|
8
|
+
time: string;
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
message: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface DevErrorRecord {
|
|
14
|
+
time: string;
|
|
15
|
+
/** Files whose change led to the failed reload; empty for a start. */
|
|
16
|
+
files: string[];
|
|
17
|
+
error: ReturnType<CellError['toJSON']>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What happened in `cell dev`, for the dev MCP endpoint: backend requests, start errors and console
|
|
22
|
+
* output, each kept to the last few hundred entries. Lives across restarts of the dev server.
|
|
23
|
+
*/
|
|
24
|
+
export class DevActivity {
|
|
25
|
+
static readonly MAX_REQUESTS = 200;
|
|
26
|
+
static readonly MAX_ERRORS = 20;
|
|
27
|
+
static readonly MAX_LOGS = 1000;
|
|
28
|
+
static readonly LEVELS: LogLevel[] = ['debug', 'info', 'warn', 'error'];
|
|
29
|
+
|
|
30
|
+
readonly requests: DevRequestRecord[] = [];
|
|
31
|
+
readonly errors: DevErrorRecord[] = [];
|
|
32
|
+
readonly logs: DevLogRecord[] = [];
|
|
33
|
+
|
|
34
|
+
recordRequest(record: DevRequestRecord): void {
|
|
35
|
+
DevActivity.push(this.requests, record, DevActivity.MAX_REQUESTS);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
recordError(error: CellError, files: string[] = []): void {
|
|
39
|
+
DevActivity.push(this.errors, { time: new Date().toISOString(), files, error: error.toJSON() }, DevActivity.MAX_ERRORS);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
recordLog(level: LogLevel, message: string): void {
|
|
43
|
+
DevActivity.push(this.logs, { time: new Date().toISOString(), level, message }, DevActivity.MAX_LOGS);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Copies console output into {@link logs}, still printing it; returns the function that stops. */
|
|
47
|
+
captureConsole(): () => void {
|
|
48
|
+
const original = { debug: console.debug, log: console.log, info: console.info, warn: console.warn, error: console.error };
|
|
49
|
+
const wrap =
|
|
50
|
+
(level: LogLevel, print: (...args: unknown[]) => void) =>
|
|
51
|
+
(...args: unknown[]) => {
|
|
52
|
+
this.recordLog(level, format(...args));
|
|
53
|
+
print.apply(console, args);
|
|
54
|
+
};
|
|
55
|
+
console.debug = wrap('debug', original.debug);
|
|
56
|
+
console.log = wrap('info', original.log);
|
|
57
|
+
console.info = wrap('info', original.info);
|
|
58
|
+
console.warn = wrap('warn', original.warn);
|
|
59
|
+
console.error = wrap('error', original.error);
|
|
60
|
+
return () => {
|
|
61
|
+
Object.assign(console, original);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
protected static push<T>(list: T[], item: T, max: number): void {
|
|
66
|
+
list.push(item);
|
|
67
|
+
if (list.length > max) {
|
|
68
|
+
list.splice(0, list.length - max);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|