@adverant-nexus/cli 2.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/ARCHITECTURE.md +1366 -0
- package/LICENSE +21 -0
- package/README.md +593 -0
- package/completions/_nexus +452 -0
- package/completions/nexus.bash +329 -0
- package/completions/nexus.fish +187 -0
- package/dist/cli.d.ts +35 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +135 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/agent/index.d.ts +9 -0
- package/dist/commands/agent/index.d.ts.map +1 -0
- package/dist/commands/agent/index.js +20 -0
- package/dist/commands/agent/index.js.map +1 -0
- package/dist/commands/agent/list.d.ts +9 -0
- package/dist/commands/agent/list.d.ts.map +1 -0
- package/dist/commands/agent/list.js +122 -0
- package/dist/commands/agent/list.js.map +1 -0
- package/dist/commands/agent/run.d.ts +10 -0
- package/dist/commands/agent/run.d.ts.map +1 -0
- package/dist/commands/agent/run.js +167 -0
- package/dist/commands/agent/run.js.map +1 -0
- package/dist/commands/agent/status.d.ts +9 -0
- package/dist/commands/agent/status.d.ts.map +1 -0
- package/dist/commands/agent/status.js +157 -0
- package/dist/commands/agent/status.js.map +1 -0
- package/dist/commands/compute/agent.d.ts +21 -0
- package/dist/commands/compute/agent.d.ts.map +1 -0
- package/dist/commands/compute/agent.js +158 -0
- package/dist/commands/compute/agent.js.map +1 -0
- package/dist/commands/compute/index.d.ts +10 -0
- package/dist/commands/compute/index.d.ts.map +1 -0
- package/dist/commands/compute/index.js +27 -0
- package/dist/commands/compute/index.js.map +1 -0
- package/dist/commands/compute/lib/hardware-detection.d.ts +52 -0
- package/dist/commands/compute/lib/hardware-detection.d.ts.map +1 -0
- package/dist/commands/compute/lib/hardware-detection.js +432 -0
- package/dist/commands/compute/lib/hardware-detection.js.map +1 -0
- package/dist/commands/compute/lib/local-compute-agent.d.ts +143 -0
- package/dist/commands/compute/lib/local-compute-agent.d.ts.map +1 -0
- package/dist/commands/compute/lib/local-compute-agent.js +1162 -0
- package/dist/commands/compute/lib/local-compute-agent.js.map +1 -0
- package/dist/commands/compute/lib/local-compute-client.d.ts +89 -0
- package/dist/commands/compute/lib/local-compute-client.d.ts.map +1 -0
- package/dist/commands/compute/lib/local-compute-client.js +388 -0
- package/dist/commands/compute/lib/local-compute-client.js.map +1 -0
- package/dist/commands/compute/list.d.ts +14 -0
- package/dist/commands/compute/list.d.ts.map +1 -0
- package/dist/commands/compute/list.js +164 -0
- package/dist/commands/compute/list.js.map +1 -0
- package/dist/commands/compute/logs.d.ts +14 -0
- package/dist/commands/compute/logs.d.ts.map +1 -0
- package/dist/commands/compute/logs.js +105 -0
- package/dist/commands/compute/logs.js.map +1 -0
- package/dist/commands/compute/resources.d.ts +14 -0
- package/dist/commands/compute/resources.d.ts.map +1 -0
- package/dist/commands/compute/resources.js +163 -0
- package/dist/commands/compute/resources.js.map +1 -0
- package/dist/commands/compute/status.d.ts +13 -0
- package/dist/commands/compute/status.d.ts.map +1 -0
- package/dist/commands/compute/status.js +223 -0
- package/dist/commands/compute/status.js.map +1 -0
- package/dist/commands/compute/submit.d.ts +19 -0
- package/dist/commands/compute/submit.d.ts.map +1 -0
- package/dist/commands/compute/submit.js +99 -0
- package/dist/commands/compute/submit.js.map +1 -0
- package/dist/commands/deploy.d.ts +11 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +117 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/dynamic/graphrag-commands.d.ts +16 -0
- package/dist/commands/dynamic/graphrag-commands.d.ts.map +1 -0
- package/dist/commands/dynamic/graphrag-commands.js +562 -0
- package/dist/commands/dynamic/graphrag-commands.js.map +1 -0
- package/dist/commands/dynamic/index.d.ts +10 -0
- package/dist/commands/dynamic/index.d.ts.map +1 -0
- package/dist/commands/dynamic/index.js +17 -0
- package/dist/commands/dynamic/index.js.map +1 -0
- package/dist/commands/dynamic/mageagent-commands.d.ts +8 -0
- package/dist/commands/dynamic/mageagent-commands.d.ts.map +1 -0
- package/dist/commands/dynamic/mageagent-commands.js +86 -0
- package/dist/commands/dynamic/mageagent-commands.js.map +1 -0
- package/dist/commands/dynamic/mcp-tool-mapper.d.ts +97 -0
- package/dist/commands/dynamic/mcp-tool-mapper.d.ts.map +1 -0
- package/dist/commands/dynamic/mcp-tool-mapper.js +328 -0
- package/dist/commands/dynamic/mcp-tool-mapper.js.map +1 -0
- package/dist/commands/dynamic/nexus-commands.d.ts +78 -0
- package/dist/commands/dynamic/nexus-commands.d.ts.map +1 -0
- package/dist/commands/dynamic/nexus-commands.js +426 -0
- package/dist/commands/dynamic/nexus-commands.js.map +1 -0
- package/dist/commands/dynamic/sandbox-commands.d.ts +8 -0
- package/dist/commands/dynamic/sandbox-commands.d.ts.map +1 -0
- package/dist/commands/dynamic/sandbox-commands.js +80 -0
- package/dist/commands/dynamic/sandbox-commands.js.map +1 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +128 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/list.d.ts +10 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +81 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/login.d.ts +10 -0
- package/dist/commands/login.d.ts.map +1 -0
- package/dist/commands/login.js +83 -0
- package/dist/commands/login.js.map +1 -0
- package/dist/commands/logs.d.ts +11 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +79 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/nexus/index.d.ts +69 -0
- package/dist/commands/nexus/index.d.ts.map +1 -0
- package/dist/commands/nexus/index.js +336 -0
- package/dist/commands/nexus/index.js.map +1 -0
- package/dist/commands/plugin/disable.d.ts +8 -0
- package/dist/commands/plugin/disable.d.ts.map +1 -0
- package/dist/commands/plugin/disable.js +31 -0
- package/dist/commands/plugin/disable.js.map +1 -0
- package/dist/commands/plugin/enable.d.ts +8 -0
- package/dist/commands/plugin/enable.d.ts.map +1 -0
- package/dist/commands/plugin/enable.js +37 -0
- package/dist/commands/plugin/enable.js.map +1 -0
- package/dist/commands/plugin/index.d.ts +8 -0
- package/dist/commands/plugin/index.d.ts.map +1 -0
- package/dist/commands/plugin/index.js +23 -0
- package/dist/commands/plugin/index.js.map +1 -0
- package/dist/commands/plugin/info.d.ts +8 -0
- package/dist/commands/plugin/info.d.ts.map +1 -0
- package/dist/commands/plugin/info.js +129 -0
- package/dist/commands/plugin/info.js.map +1 -0
- package/dist/commands/plugin/init.d.ts +8 -0
- package/dist/commands/plugin/init.d.ts.map +1 -0
- package/dist/commands/plugin/init.js +83 -0
- package/dist/commands/plugin/init.js.map +1 -0
- package/dist/commands/plugin/install.d.ts +8 -0
- package/dist/commands/plugin/install.d.ts.map +1 -0
- package/dist/commands/plugin/install.js +56 -0
- package/dist/commands/plugin/install.js.map +1 -0
- package/dist/commands/plugin/list.d.ts +8 -0
- package/dist/commands/plugin/list.d.ts.map +1 -0
- package/dist/commands/plugin/list.js +72 -0
- package/dist/commands/plugin/list.js.map +1 -0
- package/dist/commands/plugin/uninstall.d.ts +8 -0
- package/dist/commands/plugin/uninstall.d.ts.map +1 -0
- package/dist/commands/plugin/uninstall.js +49 -0
- package/dist/commands/plugin/uninstall.js.map +1 -0
- package/dist/commands/register.d.ts +10 -0
- package/dist/commands/register.d.ts.map +1 -0
- package/dist/commands/register.js +85 -0
- package/dist/commands/register.js.map +1 -0
- package/dist/commands/services/health.d.ts +7 -0
- package/dist/commands/services/health.d.ts.map +1 -0
- package/dist/commands/services/health.js +73 -0
- package/dist/commands/services/health.js.map +1 -0
- package/dist/commands/services/index.d.ts +16 -0
- package/dist/commands/services/index.d.ts.map +1 -0
- package/dist/commands/services/index.js +26 -0
- package/dist/commands/services/index.js.map +1 -0
- package/dist/commands/services/info.d.ts +7 -0
- package/dist/commands/services/info.d.ts.map +1 -0
- package/dist/commands/services/info.js +68 -0
- package/dist/commands/services/info.js.map +1 -0
- package/dist/commands/services/list.d.ts +9 -0
- package/dist/commands/services/list.d.ts.map +1 -0
- package/dist/commands/services/list.js +43 -0
- package/dist/commands/services/list.js.map +1 -0
- package/dist/commands/services/logs.d.ts +7 -0
- package/dist/commands/services/logs.d.ts.map +1 -0
- package/dist/commands/services/logs.js +107 -0
- package/dist/commands/services/logs.js.map +1 -0
- package/dist/commands/services/ports.d.ts +7 -0
- package/dist/commands/services/ports.d.ts.map +1 -0
- package/dist/commands/services/ports.js +65 -0
- package/dist/commands/services/ports.js.map +1 -0
- package/dist/commands/services/restart.d.ts +7 -0
- package/dist/commands/services/restart.d.ts.map +1 -0
- package/dist/commands/services/restart.js +67 -0
- package/dist/commands/services/restart.js.map +1 -0
- package/dist/commands/services/start.d.ts +7 -0
- package/dist/commands/services/start.d.ts.map +1 -0
- package/dist/commands/services/start.js +67 -0
- package/dist/commands/services/start.js.map +1 -0
- package/dist/commands/services/status.d.ts +9 -0
- package/dist/commands/services/status.d.ts.map +1 -0
- package/dist/commands/services/status.js +119 -0
- package/dist/commands/services/status.js.map +1 -0
- package/dist/commands/services/stop.d.ts +7 -0
- package/dist/commands/services/stop.d.ts.map +1 -0
- package/dist/commands/services/stop.js +67 -0
- package/dist/commands/services/stop.js.map +1 -0
- package/dist/commands/session/delete.d.ts +9 -0
- package/dist/commands/session/delete.d.ts.map +1 -0
- package/dist/commands/session/delete.js +51 -0
- package/dist/commands/session/delete.js.map +1 -0
- package/dist/commands/session/export.d.ts +9 -0
- package/dist/commands/session/export.d.ts.map +1 -0
- package/dist/commands/session/export.js +36 -0
- package/dist/commands/session/export.js.map +1 -0
- package/dist/commands/session/import.d.ts +9 -0
- package/dist/commands/session/import.d.ts.map +1 -0
- package/dist/commands/session/import.js +54 -0
- package/dist/commands/session/import.js.map +1 -0
- package/dist/commands/session/index.d.ts +9 -0
- package/dist/commands/session/index.d.ts.map +1 -0
- package/dist/commands/session/index.js +28 -0
- package/dist/commands/session/index.js.map +1 -0
- package/dist/commands/session/list.d.ts +9 -0
- package/dist/commands/session/list.d.ts.map +1 -0
- package/dist/commands/session/list.js +88 -0
- package/dist/commands/session/list.js.map +1 -0
- package/dist/commands/session/load.d.ts +9 -0
- package/dist/commands/session/load.d.ts.map +1 -0
- package/dist/commands/session/load.js +71 -0
- package/dist/commands/session/load.js.map +1 -0
- package/dist/commands/session/resume.d.ts +9 -0
- package/dist/commands/session/resume.d.ts.map +1 -0
- package/dist/commands/session/resume.js +49 -0
- package/dist/commands/session/resume.js.map +1 -0
- package/dist/commands/session/save.d.ts +9 -0
- package/dist/commands/session/save.d.ts.map +1 -0
- package/dist/commands/session/save.js +69 -0
- package/dist/commands/session/save.js.map +1 -0
- package/dist/commands/workspace/git-commit.d.ts +9 -0
- package/dist/commands/workspace/git-commit.d.ts.map +1 -0
- package/dist/commands/workspace/git-commit.js +156 -0
- package/dist/commands/workspace/git-commit.js.map +1 -0
- package/dist/commands/workspace/git-status.d.ts +9 -0
- package/dist/commands/workspace/git-status.d.ts.map +1 -0
- package/dist/commands/workspace/git-status.js +192 -0
- package/dist/commands/workspace/git-status.js.map +1 -0
- package/dist/commands/workspace/index.d.ts +9 -0
- package/dist/commands/workspace/index.d.ts.map +1 -0
- package/dist/commands/workspace/index.js +24 -0
- package/dist/commands/workspace/index.js.map +1 -0
- package/dist/commands/workspace/info.d.ts +10 -0
- package/dist/commands/workspace/info.d.ts.map +1 -0
- package/dist/commands/workspace/info.js +191 -0
- package/dist/commands/workspace/info.js.map +1 -0
- package/dist/commands/workspace/init.d.ts +9 -0
- package/dist/commands/workspace/init.d.ts.map +1 -0
- package/dist/commands/workspace/init.js +193 -0
- package/dist/commands/workspace/init.js.map +1 -0
- package/dist/commands/workspace/validate.d.ts +9 -0
- package/dist/commands/workspace/validate.d.ts.map +1 -0
- package/dist/commands/workspace/validate.js +140 -0
- package/dist/commands/workspace/validate.js.map +1 -0
- package/dist/core/agent-client.d.ts +49 -0
- package/dist/core/agent-client.d.ts.map +1 -0
- package/dist/core/agent-client.js +289 -0
- package/dist/core/agent-client.js.map +1 -0
- package/dist/core/config/config-manager.d.ts +75 -0
- package/dist/core/config/config-manager.d.ts.map +1 -0
- package/dist/core/config/config-manager.js +379 -0
- package/dist/core/config/config-manager.js.map +1 -0
- package/dist/core/config/profile-manager.d.ts +76 -0
- package/dist/core/config/profile-manager.d.ts.map +1 -0
- package/dist/core/config/profile-manager.js +250 -0
- package/dist/core/config/profile-manager.js.map +1 -0
- package/dist/core/config/workspace-detector.d.ts +66 -0
- package/dist/core/config/workspace-detector.d.ts.map +1 -0
- package/dist/core/config/workspace-detector.js +291 -0
- package/dist/core/config/workspace-detector.js.map +1 -0
- package/dist/core/discovery/docker-parser.d.ts +27 -0
- package/dist/core/discovery/docker-parser.d.ts.map +1 -0
- package/dist/core/discovery/docker-parser.js +361 -0
- package/dist/core/discovery/docker-parser.js.map +1 -0
- package/dist/core/discovery/index.d.ts +11 -0
- package/dist/core/discovery/index.d.ts.map +1 -0
- package/dist/core/discovery/index.js +16 -0
- package/dist/core/discovery/index.js.map +1 -0
- package/dist/core/discovery/mcp-discovery.d.ts +41 -0
- package/dist/core/discovery/mcp-discovery.d.ts.map +1 -0
- package/dist/core/discovery/mcp-discovery.js +439 -0
- package/dist/core/discovery/mcp-discovery.js.map +1 -0
- package/dist/core/discovery/openapi-parser.d.ts +95 -0
- package/dist/core/discovery/openapi-parser.d.ts.map +1 -0
- package/dist/core/discovery/openapi-parser.js +353 -0
- package/dist/core/discovery/openapi-parser.js.map +1 -0
- package/dist/core/discovery/plugin-discovery.d.ts +63 -0
- package/dist/core/discovery/plugin-discovery.d.ts.map +1 -0
- package/dist/core/discovery/plugin-discovery.js +333 -0
- package/dist/core/discovery/plugin-discovery.js.map +1 -0
- package/dist/core/discovery/service-discovery.d.ts +107 -0
- package/dist/core/discovery/service-discovery.d.ts.map +1 -0
- package/dist/core/discovery/service-discovery.js +349 -0
- package/dist/core/discovery/service-discovery.js.map +1 -0
- package/dist/core/nexus-client.d.ts +119 -0
- package/dist/core/nexus-client.d.ts.map +1 -0
- package/dist/core/nexus-client.js +292 -0
- package/dist/core/nexus-client.js.map +1 -0
- package/dist/core/nexus-tool-executor.d.ts +102 -0
- package/dist/core/nexus-tool-executor.d.ts.map +1 -0
- package/dist/core/nexus-tool-executor.js +386 -0
- package/dist/core/nexus-tool-executor.js.map +1 -0
- package/dist/core/react-handler.d.ts +17 -0
- package/dist/core/react-handler.d.ts.map +1 -0
- package/dist/core/react-handler.js +296 -0
- package/dist/core/react-handler.js.map +1 -0
- package/dist/core/router/command-registry.d.ts +61 -0
- package/dist/core/router/command-registry.d.ts.map +1 -0
- package/dist/core/router/command-registry.js +138 -0
- package/dist/core/router/command-registry.js.map +1 -0
- package/dist/core/router/command-router.d.ts +33 -0
- package/dist/core/router/command-router.d.ts.map +1 -0
- package/dist/core/router/command-router.js +111 -0
- package/dist/core/router/command-router.js.map +1 -0
- package/dist/core/router/index.d.ts +9 -0
- package/dist/core/router/index.d.ts.map +1 -0
- package/dist/core/router/index.js +8 -0
- package/dist/core/router/index.js.map +1 -0
- package/dist/core/session/context-manager.d.ts +69 -0
- package/dist/core/session/context-manager.d.ts.map +1 -0
- package/dist/core/session/context-manager.js +109 -0
- package/dist/core/session/context-manager.js.map +1 -0
- package/dist/core/session/history-manager.d.ts +72 -0
- package/dist/core/session/history-manager.d.ts.map +1 -0
- package/dist/core/session/history-manager.js +175 -0
- package/dist/core/session/history-manager.js.map +1 -0
- package/dist/core/session/index.d.ts +9 -0
- package/dist/core/session/index.d.ts.map +1 -0
- package/dist/core/session/index.js +9 -0
- package/dist/core/session/index.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +50 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +200 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/session/session-storage.d.ts +59 -0
- package/dist/core/session/session-storage.d.ts.map +1 -0
- package/dist/core/session/session-storage.js +226 -0
- package/dist/core/session/session-storage.js.map +1 -0
- package/dist/core/transport/http-client.d.ts +27 -0
- package/dist/core/transport/http-client.d.ts.map +1 -0
- package/dist/core/transport/http-client.js +182 -0
- package/dist/core/transport/http-client.js.map +1 -0
- package/dist/core/transport/index.d.ts +11 -0
- package/dist/core/transport/index.d.ts.map +1 -0
- package/dist/core/transport/index.js +10 -0
- package/dist/core/transport/index.js.map +1 -0
- package/dist/core/transport/mcp-client.d.ts +69 -0
- package/dist/core/transport/mcp-client.d.ts.map +1 -0
- package/dist/core/transport/mcp-client.js +252 -0
- package/dist/core/transport/mcp-client.js.map +1 -0
- package/dist/core/transport/stream-handler.d.ts +51 -0
- package/dist/core/transport/stream-handler.d.ts.map +1 -0
- package/dist/core/transport/stream-handler.js +264 -0
- package/dist/core/transport/stream-handler.js.map +1 -0
- package/dist/core/transport/websocket-client.d.ts +66 -0
- package/dist/core/transport/websocket-client.d.ts.map +1 -0
- package/dist/core/transport/websocket-client.js +232 -0
- package/dist/core/transport/websocket-client.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatters/index.d.ts +9 -0
- package/dist/output/formatters/index.d.ts.map +1 -0
- package/dist/output/formatters/index.js +9 -0
- package/dist/output/formatters/index.js.map +1 -0
- package/dist/output/formatters/json-formatter.d.ts +71 -0
- package/dist/output/formatters/json-formatter.d.ts.map +1 -0
- package/dist/output/formatters/json-formatter.js +236 -0
- package/dist/output/formatters/json-formatter.js.map +1 -0
- package/dist/output/formatters/stream-formatter.d.ts +107 -0
- package/dist/output/formatters/stream-formatter.d.ts.map +1 -0
- package/dist/output/formatters/stream-formatter.js +247 -0
- package/dist/output/formatters/stream-formatter.js.map +1 -0
- package/dist/output/formatters/table-formatter.d.ts +63 -0
- package/dist/output/formatters/table-formatter.d.ts.map +1 -0
- package/dist/output/formatters/table-formatter.js +294 -0
- package/dist/output/formatters/table-formatter.js.map +1 -0
- package/dist/output/formatters/text-formatter.d.ts +63 -0
- package/dist/output/formatters/text-formatter.d.ts.map +1 -0
- package/dist/output/formatters/text-formatter.js +202 -0
- package/dist/output/formatters/text-formatter.js.map +1 -0
- package/dist/output/formatters/yaml-formatter.d.ts +71 -0
- package/dist/output/formatters/yaml-formatter.d.ts.map +1 -0
- package/dist/output/formatters/yaml-formatter.js +239 -0
- package/dist/output/formatters/yaml-formatter.js.map +1 -0
- package/dist/output/index.d.ts +7 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +7 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/output-manager.d.ts +156 -0
- package/dist/output/output-manager.d.ts.map +1 -0
- package/dist/output/output-manager.js +339 -0
- package/dist/output/output-manager.js.map +1 -0
- package/dist/output/renderers/index.d.ts +6 -0
- package/dist/output/renderers/index.d.ts.map +1 -0
- package/dist/output/renderers/index.js +6 -0
- package/dist/output/renderers/index.js.map +1 -0
- package/dist/output/renderers/progress-renderer.d.ts +56 -0
- package/dist/output/renderers/progress-renderer.d.ts.map +1 -0
- package/dist/output/renderers/progress-renderer.js +306 -0
- package/dist/output/renderers/progress-renderer.js.map +1 -0
- package/dist/output/renderers/terminal-renderer.d.ts +117 -0
- package/dist/output/renderers/terminal-renderer.d.ts.map +1 -0
- package/dist/output/renderers/terminal-renderer.js +294 -0
- package/dist/output/renderers/terminal-renderer.js.map +1 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +18 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/plugin-loader.d.ts +37 -0
- package/dist/plugins/plugin-loader.d.ts.map +1 -0
- package/dist/plugins/plugin-loader.js +155 -0
- package/dist/plugins/plugin-loader.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +78 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.js +310 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/plugins/plugin-sdk.d.ts +136 -0
- package/dist/plugins/plugin-sdk.d.ts.map +1 -0
- package/dist/plugins/plugin-sdk.js +260 -0
- package/dist/plugins/plugin-sdk.js.map +1 -0
- package/dist/plugins/plugin-storage.d.ts +109 -0
- package/dist/plugins/plugin-storage.d.ts.map +1 -0
- package/dist/plugins/plugin-storage.js +207 -0
- package/dist/plugins/plugin-storage.js.map +1 -0
- package/dist/plugins/plugin-validator.d.ts +44 -0
- package/dist/plugins/plugin-validator.d.ts.map +1 -0
- package/dist/plugins/plugin-validator.js +272 -0
- package/dist/plugins/plugin-validator.js.map +1 -0
- package/dist/plugins/template-generator.d.ts +35 -0
- package/dist/plugins/template-generator.d.ts.map +1 -0
- package/dist/plugins/template-generator.js +438 -0
- package/dist/plugins/template-generator.js.map +1 -0
- package/dist/repl/completer.d.ts +58 -0
- package/dist/repl/completer.d.ts.map +1 -0
- package/dist/repl/completer.js +198 -0
- package/dist/repl/completer.js.map +1 -0
- package/dist/repl/evaluator.d.ts +55 -0
- package/dist/repl/evaluator.d.ts.map +1 -0
- package/dist/repl/evaluator.js +299 -0
- package/dist/repl/evaluator.js.map +1 -0
- package/dist/repl/index.d.ts +10 -0
- package/dist/repl/index.d.ts.map +1 -0
- package/dist/repl/index.js +10 -0
- package/dist/repl/index.js.map +1 -0
- package/dist/repl/renderer.d.ts +77 -0
- package/dist/repl/renderer.d.ts.map +1 -0
- package/dist/repl/renderer.js +291 -0
- package/dist/repl/renderer.js.map +1 -0
- package/dist/repl/repl.d.ts +89 -0
- package/dist/repl/repl.d.ts.map +1 -0
- package/dist/repl/repl.js +339 -0
- package/dist/repl/repl.js.map +1 -0
- package/dist/templates/python.d.ts +15 -0
- package/dist/templates/python.d.ts.map +1 -0
- package/dist/templates/python.js +375 -0
- package/dist/templates/python.js.map +1 -0
- package/dist/templates/typescript.d.ts +15 -0
- package/dist/templates/typescript.d.ts.map +1 -0
- package/dist/templates/typescript.js +274 -0
- package/dist/templates/typescript.js.map +1 -0
- package/dist/types/agent.d.ts +109 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +7 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/api.d.ts +125 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/api.js +53 -0
- package/dist/types/api.js.map +1 -0
- package/dist/types/command.d.ts +101 -0
- package/dist/types/command.d.ts.map +1 -0
- package/dist/types/command.js +7 -0
- package/dist/types/command.js.map +1 -0
- package/dist/types/compute.d.ts +317 -0
- package/dist/types/compute.d.ts.map +1 -0
- package/dist/types/compute.js +19 -0
- package/dist/types/compute.js.map +1 -0
- package/dist/types/config.d.ts +71 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +7 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/errors.d.ts +56 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +64 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +16 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/nexus.d.ts +254 -0
- package/dist/types/nexus.d.ts.map +1 -0
- package/dist/types/nexus.js +7 -0
- package/dist/types/nexus.js.map +1 -0
- package/dist/types/output.d.ts +107 -0
- package/dist/types/output.d.ts.map +1 -0
- package/dist/types/output.js +7 -0
- package/dist/types/output.js.map +1 -0
- package/dist/types/plugin.d.ts +118 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +7 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/types/service.d.ts +94 -0
- package/dist/types/service.d.ts.map +1 -0
- package/dist/types/service.js +15 -0
- package/dist/types/service.js.map +1 -0
- package/dist/types/session.d.ts +80 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/session.js +7 -0
- package/dist/types/session.js.map +1 -0
- package/dist/types/transport.d.ts +96 -0
- package/dist/types/transport.d.ts.map +1 -0
- package/dist/types/transport.js +7 -0
- package/dist/types/transport.js.map +1 -0
- package/dist/utils/config.d.ts +47 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +166 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/error-handler.d.ts +82 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +238 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +61 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +200 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/prompt.d.ts +57 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +141 -0
- package/dist/utils/prompt.js.map +1 -0
- package/dist/utils/spinner.d.ts +47 -0
- package/dist/utils/spinner.d.ts.map +1 -0
- package/dist/utils/spinner.js +123 -0
- package/dist/utils/spinner.js.map +1 -0
- package/dist/utils/validation.d.ts +97 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +289 -0
- package/dist/utils/validation.js.map +1 -0
- package/docs/COMPLETIONS.md +528 -0
- package/docs/REPL.md +466 -0
- package/docs/graphrag-commands.md +387 -0
- package/package.json +154 -0
- package/scripts/install-completions.sh +356 -0
- package/scripts/prepublish.js +522 -0
- package/scripts/verify-package.js +505 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pre-publish Validation Script for @adverant-nexus/cli
|
|
5
|
+
*
|
|
6
|
+
* This script validates that the package is ready for publication to npm.
|
|
7
|
+
* It checks compilation, files, metadata, and more.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execSync } from 'child_process';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = path.dirname(__filename);
|
|
17
|
+
const rootDir = path.resolve(__dirname, '..');
|
|
18
|
+
|
|
19
|
+
// ANSI color codes
|
|
20
|
+
const colors = {
|
|
21
|
+
reset: '\x1b[0m',
|
|
22
|
+
red: '\x1b[31m',
|
|
23
|
+
green: '\x1b[32m',
|
|
24
|
+
yellow: '\x1b[33m',
|
|
25
|
+
blue: '\x1b[34m',
|
|
26
|
+
magenta: '\x1b[35m',
|
|
27
|
+
cyan: '\x1b[36m',
|
|
28
|
+
bold: '\x1b[1m',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const icons = {
|
|
32
|
+
success: '✓',
|
|
33
|
+
error: '✗',
|
|
34
|
+
warning: '⚠',
|
|
35
|
+
info: 'ℹ',
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// Validation results tracking
|
|
39
|
+
const results = {
|
|
40
|
+
passed: [],
|
|
41
|
+
warnings: [],
|
|
42
|
+
errors: [],
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Print colored output
|
|
47
|
+
*/
|
|
48
|
+
function print(message, color = 'reset', icon = null) {
|
|
49
|
+
const colorCode = colors[color] || colors.reset;
|
|
50
|
+
const iconStr = icon ? `${icon} ` : '';
|
|
51
|
+
console.log(`${colorCode}${iconStr}${message}${colors.reset}`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Print section header
|
|
56
|
+
*/
|
|
57
|
+
function printSection(title) {
|
|
58
|
+
console.log('\n' + colors.bold + colors.cyan + `${'='.repeat(60)}` + colors.reset);
|
|
59
|
+
console.log(colors.bold + colors.cyan + title + colors.reset);
|
|
60
|
+
console.log(colors.bold + colors.cyan + `${'='.repeat(60)}` + colors.reset + '\n');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Print validation result
|
|
65
|
+
*/
|
|
66
|
+
function printResult(passed, message, details = null) {
|
|
67
|
+
if (passed) {
|
|
68
|
+
print(message, 'green', icons.success);
|
|
69
|
+
results.passed.push(message);
|
|
70
|
+
} else {
|
|
71
|
+
print(message, 'red', icons.error);
|
|
72
|
+
results.errors.push(message);
|
|
73
|
+
}
|
|
74
|
+
if (details) {
|
|
75
|
+
console.log(colors.cyan + ` ${details}` + colors.reset);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Print warning
|
|
81
|
+
*/
|
|
82
|
+
function printWarning(message, details = null) {
|
|
83
|
+
print(message, 'yellow', icons.warning);
|
|
84
|
+
results.warnings.push(message);
|
|
85
|
+
if (details) {
|
|
86
|
+
console.log(colors.yellow + ` ${details}` + colors.reset);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Execute command and return result
|
|
92
|
+
*/
|
|
93
|
+
function execCommand(command, options = {}) {
|
|
94
|
+
try {
|
|
95
|
+
const output = execSync(command, {
|
|
96
|
+
cwd: rootDir,
|
|
97
|
+
encoding: 'utf8',
|
|
98
|
+
stdio: options.silent ? 'pipe' : 'inherit',
|
|
99
|
+
...options,
|
|
100
|
+
});
|
|
101
|
+
return { success: true, output };
|
|
102
|
+
} catch (error) {
|
|
103
|
+
return {
|
|
104
|
+
success: false,
|
|
105
|
+
error: error.message,
|
|
106
|
+
stderr: error.stderr?.toString(),
|
|
107
|
+
stdout: error.stdout?.toString(),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Check if file or directory exists
|
|
114
|
+
*/
|
|
115
|
+
function fileExists(filePath) {
|
|
116
|
+
return fs.existsSync(path.resolve(rootDir, filePath));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Read package.json
|
|
121
|
+
*/
|
|
122
|
+
function readPackageJson() {
|
|
123
|
+
const pkgPath = path.resolve(rootDir, 'package.json');
|
|
124
|
+
const content = fs.readFileSync(pkgPath, 'utf8');
|
|
125
|
+
return JSON.parse(content);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Check for sensitive patterns in files
|
|
130
|
+
*/
|
|
131
|
+
function checkForSensitiveData() {
|
|
132
|
+
const sensitivePatterns = [
|
|
133
|
+
/(?:api[_-]?key|apikey)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
|
|
134
|
+
/(?:secret|password|passwd|pwd)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
|
|
135
|
+
/(?:token|auth)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
|
|
136
|
+
/(?:private[_-]?key)[\s]*[:=][\s]*['"][^'"]+['"]/gi,
|
|
137
|
+
/-----BEGIN (?:RSA |DSA )?PRIVATE KEY-----/gi,
|
|
138
|
+
/sk_live_[a-zA-Z0-9]+/gi, // Stripe keys
|
|
139
|
+
/AIza[0-9A-Za-z-_]{35}/gi, // Google API keys
|
|
140
|
+
/ghp_[a-zA-Z0-9]{36}/gi, // GitHub Personal Access Tokens
|
|
141
|
+
];
|
|
142
|
+
|
|
143
|
+
const filesToCheck = [];
|
|
144
|
+
const dirsToScan = ['dist', 'src'];
|
|
145
|
+
|
|
146
|
+
for (const dir of dirsToScan) {
|
|
147
|
+
const dirPath = path.resolve(rootDir, dir);
|
|
148
|
+
if (!fs.existsSync(dirPath)) continue;
|
|
149
|
+
|
|
150
|
+
const files = getAllFiles(dirPath);
|
|
151
|
+
filesToCheck.push(...files);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const findings = [];
|
|
155
|
+
|
|
156
|
+
for (const file of filesToCheck) {
|
|
157
|
+
// Skip large files and node_modules
|
|
158
|
+
if (file.includes('node_modules') || file.endsWith('.min.js')) continue;
|
|
159
|
+
|
|
160
|
+
try {
|
|
161
|
+
const content = fs.readFileSync(file, 'utf8');
|
|
162
|
+
|
|
163
|
+
for (const pattern of sensitivePatterns) {
|
|
164
|
+
const matches = content.match(pattern);
|
|
165
|
+
if (matches) {
|
|
166
|
+
findings.push({
|
|
167
|
+
file: path.relative(rootDir, file),
|
|
168
|
+
pattern: pattern.toString(),
|
|
169
|
+
matches: matches.length,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} catch (error) {
|
|
174
|
+
// Skip files that can't be read as text
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return findings;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Get all files recursively
|
|
184
|
+
*/
|
|
185
|
+
function getAllFiles(dir, fileList = []) {
|
|
186
|
+
const files = fs.readdirSync(dir);
|
|
187
|
+
|
|
188
|
+
for (const file of files) {
|
|
189
|
+
const filePath = path.join(dir, file);
|
|
190
|
+
const stat = fs.statSync(filePath);
|
|
191
|
+
|
|
192
|
+
if (stat.isDirectory()) {
|
|
193
|
+
getAllFiles(filePath, fileList);
|
|
194
|
+
} else {
|
|
195
|
+
fileList.push(filePath);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
return fileList;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Check directory size
|
|
204
|
+
*/
|
|
205
|
+
function getDirectorySize(dirPath) {
|
|
206
|
+
let size = 0;
|
|
207
|
+
|
|
208
|
+
if (!fs.existsSync(dirPath)) return 0;
|
|
209
|
+
|
|
210
|
+
const files = getAllFiles(dirPath);
|
|
211
|
+
for (const file of files) {
|
|
212
|
+
const stat = fs.statSync(file);
|
|
213
|
+
size += stat.size;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return size;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Format bytes to human readable
|
|
221
|
+
*/
|
|
222
|
+
function formatBytes(bytes) {
|
|
223
|
+
if (bytes === 0) return '0 Bytes';
|
|
224
|
+
const k = 1024;
|
|
225
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
|
|
226
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
227
|
+
return Math.round(bytes / Math.pow(k, i) * 100) / 100 + ' ' + sizes[i];
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Validate package.json metadata
|
|
232
|
+
*/
|
|
233
|
+
function validatePackageJson(pkg) {
|
|
234
|
+
const requiredFields = [
|
|
235
|
+
'name',
|
|
236
|
+
'version',
|
|
237
|
+
'description',
|
|
238
|
+
'main',
|
|
239
|
+
'bin',
|
|
240
|
+
'author',
|
|
241
|
+
'license',
|
|
242
|
+
'repository',
|
|
243
|
+
'keywords',
|
|
244
|
+
'engines',
|
|
245
|
+
];
|
|
246
|
+
|
|
247
|
+
for (const field of requiredFields) {
|
|
248
|
+
if (!pkg[field]) {
|
|
249
|
+
printResult(false, `Missing required field: ${field}`);
|
|
250
|
+
} else {
|
|
251
|
+
printResult(true, `Required field present: ${field}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Check version format
|
|
256
|
+
const versionRegex = /^\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?$/;
|
|
257
|
+
if (!versionRegex.test(pkg.version)) {
|
|
258
|
+
printResult(false, `Invalid version format: ${pkg.version}`, 'Should be semver (e.g., 1.0.0, 1.0.0-beta.1)');
|
|
259
|
+
} else {
|
|
260
|
+
printResult(true, `Valid version format: ${pkg.version}`);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Check package name format
|
|
264
|
+
if (pkg.name.startsWith('@')) {
|
|
265
|
+
const scopedRegex = /^@[a-z0-9-~][a-z0-9-._~]*\/[a-z0-9-~][a-z0-9-._~]*$/;
|
|
266
|
+
if (!scopedRegex.test(pkg.name)) {
|
|
267
|
+
printResult(false, `Invalid scoped package name: ${pkg.name}`);
|
|
268
|
+
} else {
|
|
269
|
+
printResult(true, `Valid scoped package name: ${pkg.name}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Check keywords
|
|
274
|
+
if (pkg.keywords && pkg.keywords.length > 0) {
|
|
275
|
+
printResult(true, `Keywords defined: ${pkg.keywords.length} keywords`);
|
|
276
|
+
} else {
|
|
277
|
+
printWarning('No keywords defined', 'Add keywords to improve discoverability');
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Check files field
|
|
281
|
+
if (pkg.files && pkg.files.length > 0) {
|
|
282
|
+
printResult(true, `Files field defined: ${pkg.files.length} patterns`);
|
|
283
|
+
} else {
|
|
284
|
+
printWarning('No files field defined', 'Consider adding a files field to control what gets published');
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
// Check engines
|
|
288
|
+
if (pkg.engines && pkg.engines.node) {
|
|
289
|
+
printResult(true, `Node.js version requirement: ${pkg.engines.node}`);
|
|
290
|
+
} else {
|
|
291
|
+
printWarning('No Node.js version specified in engines');
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Check publishConfig
|
|
295
|
+
if (pkg.publishConfig) {
|
|
296
|
+
printResult(true, 'publishConfig defined');
|
|
297
|
+
if (pkg.publishConfig.access === 'public') {
|
|
298
|
+
print(' Access: public', 'cyan');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Main validation runner
|
|
305
|
+
*/
|
|
306
|
+
async function runValidation() {
|
|
307
|
+
print('\n' + colors.bold + colors.magenta + '🚀 Pre-Publish Validation for @adverant-nexus/cli' + colors.reset + '\n');
|
|
308
|
+
|
|
309
|
+
const pkg = readPackageJson();
|
|
310
|
+
print(`Package: ${colors.bold}${pkg.name}@${pkg.version}${colors.reset}\n`);
|
|
311
|
+
|
|
312
|
+
// 1. Check TypeScript compilation
|
|
313
|
+
printSection('1. TypeScript Compilation');
|
|
314
|
+
print('Running TypeScript compiler...');
|
|
315
|
+
const tscResult = execCommand('npm run typecheck', { silent: false });
|
|
316
|
+
if (tscResult.success) {
|
|
317
|
+
printResult(true, 'TypeScript compilation successful');
|
|
318
|
+
} else {
|
|
319
|
+
printResult(false, 'TypeScript compilation failed');
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// 2. Check required files
|
|
323
|
+
printSection('2. Required Files Check');
|
|
324
|
+
const requiredFiles = [
|
|
325
|
+
{ path: 'dist', type: 'directory', required: true },
|
|
326
|
+
{ path: 'README.md', type: 'file', required: true },
|
|
327
|
+
{ path: 'LICENSE', type: 'file', required: false },
|
|
328
|
+
{ path: 'package.json', type: 'file', required: true },
|
|
329
|
+
{ path: 'dist/index.js', type: 'file', required: true },
|
|
330
|
+
];
|
|
331
|
+
|
|
332
|
+
for (const { path: filePath, type, required } of requiredFiles) {
|
|
333
|
+
const exists = fileExists(filePath);
|
|
334
|
+
if (required) {
|
|
335
|
+
printResult(exists, `${type}: ${filePath}`, exists ? 'Found' : 'Missing');
|
|
336
|
+
} else {
|
|
337
|
+
if (exists) {
|
|
338
|
+
printResult(true, `${type}: ${filePath}`, 'Found');
|
|
339
|
+
} else {
|
|
340
|
+
printWarning(`Optional ${type} not found: ${filePath}`);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
// 3. Check build output
|
|
346
|
+
printSection('3. Build Output Validation');
|
|
347
|
+
const distPath = path.resolve(rootDir, 'dist');
|
|
348
|
+
if (fs.existsSync(distPath)) {
|
|
349
|
+
const distSize = getDirectorySize(distPath);
|
|
350
|
+
print(`Build size: ${formatBytes(distSize)}`, 'cyan', icons.info);
|
|
351
|
+
|
|
352
|
+
if (distSize > 10 * 1024 * 1024) { // 10MB
|
|
353
|
+
printWarning('Build size exceeds 10MB', 'Consider optimizing bundle size');
|
|
354
|
+
} else {
|
|
355
|
+
printResult(true, 'Build size is reasonable');
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Check for source maps
|
|
359
|
+
const hasSourceMaps = getAllFiles(distPath).some(f => f.endsWith('.map'));
|
|
360
|
+
if (hasSourceMaps) {
|
|
361
|
+
printWarning('Source maps found in dist/', 'Consider excluding .map files to reduce package size');
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 4. Validate package.json
|
|
366
|
+
printSection('4. Package.json Validation');
|
|
367
|
+
validatePackageJson(pkg);
|
|
368
|
+
|
|
369
|
+
// 5. Check for sensitive data
|
|
370
|
+
printSection('5. Sensitive Data Check');
|
|
371
|
+
print('Scanning for potential secrets...');
|
|
372
|
+
const sensitiveFindings = checkForSensitiveData();
|
|
373
|
+
|
|
374
|
+
if (sensitiveFindings.length > 0) {
|
|
375
|
+
printResult(false, 'Potential sensitive data found:');
|
|
376
|
+
sensitiveFindings.forEach(finding => {
|
|
377
|
+
print(` ${finding.file}: ${finding.matches} match(es)`, 'red');
|
|
378
|
+
});
|
|
379
|
+
} else {
|
|
380
|
+
printResult(true, 'No sensitive data patterns detected');
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// 6. Verify dependencies
|
|
384
|
+
printSection('6. Dependencies Validation');
|
|
385
|
+
|
|
386
|
+
// Check for missing dependencies
|
|
387
|
+
print('Checking for missing dependencies...');
|
|
388
|
+
const depsCheck = execCommand('npm ls --depth=0', { silent: true });
|
|
389
|
+
if (depsCheck.success) {
|
|
390
|
+
printResult(true, 'All dependencies are installed');
|
|
391
|
+
} else {
|
|
392
|
+
if (depsCheck.stderr && depsCheck.stderr.includes('missing')) {
|
|
393
|
+
printResult(false, 'Missing dependencies detected', 'Run: npm install');
|
|
394
|
+
} else {
|
|
395
|
+
printWarning('Unable to verify dependencies');
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Check for outdated dependencies
|
|
400
|
+
print('Checking for outdated dependencies...');
|
|
401
|
+
const outdatedCheck = execCommand('npm outdated --json', { silent: true });
|
|
402
|
+
if (outdatedCheck.output) {
|
|
403
|
+
try {
|
|
404
|
+
const outdated = JSON.parse(outdatedCheck.output);
|
|
405
|
+
const outdatedCount = Object.keys(outdated).length;
|
|
406
|
+
if (outdatedCount > 0) {
|
|
407
|
+
printWarning(`${outdatedCount} outdated dependencies found`, 'Run: npm outdated');
|
|
408
|
+
} else {
|
|
409
|
+
printResult(true, 'All dependencies are up to date');
|
|
410
|
+
}
|
|
411
|
+
} catch (e) {
|
|
412
|
+
printResult(true, 'All dependencies are up to date');
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// 7. Run tests
|
|
417
|
+
printSection('7. Test Suite');
|
|
418
|
+
if (pkg.scripts && pkg.scripts.test) {
|
|
419
|
+
print('Running test suite...');
|
|
420
|
+
const testResult = execCommand('npm test', { silent: true });
|
|
421
|
+
if (testResult.success) {
|
|
422
|
+
printResult(true, 'All tests passed');
|
|
423
|
+
} else {
|
|
424
|
+
// Check if it's a "no tests found" error
|
|
425
|
+
const stderr = testResult.stderr || '';
|
|
426
|
+
const stdout = testResult.stdout || '';
|
|
427
|
+
const noTestsFound = stderr.includes('No tests found') || stdout.includes('No tests found');
|
|
428
|
+
|
|
429
|
+
if (noTestsFound) {
|
|
430
|
+
printWarning('No test files found', 'Consider adding tests before publishing');
|
|
431
|
+
} else {
|
|
432
|
+
printResult(false, 'Some tests failed');
|
|
433
|
+
if (stderr) {
|
|
434
|
+
console.log(colors.red + ' Error output:' + colors.reset);
|
|
435
|
+
console.log(stderr);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
} else {
|
|
440
|
+
printWarning('No test script defined', 'Consider adding tests before publishing');
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// 8. Run linter
|
|
444
|
+
printSection('8. Code Quality');
|
|
445
|
+
if (pkg.scripts && pkg.scripts.lint) {
|
|
446
|
+
print('Running linter...');
|
|
447
|
+
const lintResult = execCommand('npm run lint', { silent: true });
|
|
448
|
+
if (lintResult.success) {
|
|
449
|
+
printResult(true, 'Linting passed');
|
|
450
|
+
} else {
|
|
451
|
+
printWarning('Linting issues found', 'Run: npm run lint:fix');
|
|
452
|
+
}
|
|
453
|
+
} else {
|
|
454
|
+
printWarning('No lint script defined');
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// 9. Check .npmignore
|
|
458
|
+
printSection('9. Package Contents');
|
|
459
|
+
const npmignorePath = path.resolve(rootDir, '.npmignore');
|
|
460
|
+
if (fs.existsSync(npmignorePath)) {
|
|
461
|
+
printResult(true, '.npmignore file exists');
|
|
462
|
+
const npmignore = fs.readFileSync(npmignorePath, 'utf8');
|
|
463
|
+
|
|
464
|
+
const shouldIgnore = [
|
|
465
|
+
{ pattern: 'src', name: 'source files' },
|
|
466
|
+
{ pattern: 'test', name: 'test files' },
|
|
467
|
+
{ pattern: '.git', name: 'git files' },
|
|
468
|
+
{ pattern: 'tsconfig', name: 'TypeScript config' },
|
|
469
|
+
{ pattern: '.env', name: 'environment files' },
|
|
470
|
+
];
|
|
471
|
+
|
|
472
|
+
for (const { pattern, name } of shouldIgnore) {
|
|
473
|
+
if (npmignore.includes(pattern)) {
|
|
474
|
+
print(` ✓ Ignoring ${name}`, 'green');
|
|
475
|
+
} else {
|
|
476
|
+
printWarning(` Consider ignoring ${name}`);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
} else {
|
|
480
|
+
printWarning('.npmignore not found', 'Will use .gitignore or files field');
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// 10. Dry run pack
|
|
484
|
+
printSection('10. Package Simulation');
|
|
485
|
+
print('Running npm pack --dry-run...');
|
|
486
|
+
const packResult = execCommand('npm pack --dry-run', { silent: true });
|
|
487
|
+
if (packResult.success) {
|
|
488
|
+
printResult(true, 'Package simulation successful');
|
|
489
|
+
if (packResult.stdout) {
|
|
490
|
+
const lines = packResult.stdout.split('\n');
|
|
491
|
+
const fileCount = lines.filter(l => l.trim() && !l.includes('npm notice')).length;
|
|
492
|
+
print(` ${fileCount} files will be published`, 'cyan', icons.info);
|
|
493
|
+
}
|
|
494
|
+
} else {
|
|
495
|
+
printResult(false, 'Package simulation failed');
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// Final summary
|
|
499
|
+
printSection('Validation Summary');
|
|
500
|
+
print(`${colors.bold}Results:${colors.reset}`);
|
|
501
|
+
print(` ${colors.green}${icons.success} Passed: ${results.passed.length}${colors.reset}`);
|
|
502
|
+
print(` ${colors.yellow}${icons.warning} Warnings: ${results.warnings.length}${colors.reset}`);
|
|
503
|
+
print(` ${colors.red}${icons.error} Errors: ${results.errors.length}${colors.reset}`);
|
|
504
|
+
|
|
505
|
+
if (results.errors.length > 0) {
|
|
506
|
+
print('\n' + colors.bold + colors.red + '❌ Validation failed. Please fix the errors above before publishing.' + colors.reset);
|
|
507
|
+
process.exit(1);
|
|
508
|
+
} else if (results.warnings.length > 0) {
|
|
509
|
+
print('\n' + colors.bold + colors.yellow + '⚠️ Validation passed with warnings. Review warnings before publishing.' + colors.reset);
|
|
510
|
+
process.exit(0);
|
|
511
|
+
} else {
|
|
512
|
+
print('\n' + colors.bold + colors.green + '✅ All validations passed! Package is ready to publish.' + colors.reset);
|
|
513
|
+
process.exit(0);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
// Run validation
|
|
518
|
+
runValidation().catch(error => {
|
|
519
|
+
print('\n' + colors.bold + colors.red + '❌ Validation script failed:' + colors.reset);
|
|
520
|
+
console.error(error);
|
|
521
|
+
process.exit(1);
|
|
522
|
+
});
|