erosolar-cli 1.7.55 → 1.7.56
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/package.json +1 -1
- package/dist/active-stack-security.d.ts +0 -110
- package/dist/active-stack-security.js +0 -313
- package/dist/active-stack-security.js.map +0 -1
- package/dist/advanced-targeting.d.ts +0 -113
- package/dist/advanced-targeting.js +0 -252
- package/dist/advanced-targeting.js.map +0 -1
- package/dist/bin/adapters/node/index.js +0 -33
- package/dist/bin/adapters/types.js +0 -1
- package/dist/bin/alpha-zero/agentWrapper.js +0 -165
- package/dist/bin/alpha-zero/codeEvaluator.js +0 -272
- package/dist/bin/alpha-zero/competitiveRunner.js +0 -219
- package/dist/bin/alpha-zero/index.js +0 -98
- package/dist/bin/alpha-zero/introspection.js +0 -298
- package/dist/bin/alpha-zero/metricsTracker.js +0 -207
- package/dist/bin/alpha-zero/security/core.js +0 -269
- package/dist/bin/alpha-zero/security/google.js +0 -308
- package/dist/bin/alpha-zero/security/googleLoader.js +0 -40
- package/dist/bin/alpha-zero/security/index.js +0 -31
- package/dist/bin/alpha-zero/security/simulation.js +0 -274
- package/dist/bin/alpha-zero/selfModification.js +0 -231
- package/dist/bin/alpha-zero/types.js +0 -30
- package/dist/bin/bin/erosolar-optimized.js +0 -205
- package/dist/bin/capabilities/agentSpawningCapability.js +0 -116
- package/dist/bin/capabilities/bashCapability.js +0 -22
- package/dist/bin/capabilities/cloudCapability.js +0 -36
- package/dist/bin/capabilities/codeAnalysisCapability.js +0 -22
- package/dist/bin/capabilities/codeQualityCapability.js +0 -23
- package/dist/bin/capabilities/dependencySecurityCapability.js +0 -22
- package/dist/bin/capabilities/devCapability.js +0 -22
- package/dist/bin/capabilities/editCapability.js +0 -28
- package/dist/bin/capabilities/emailCapability.js +0 -20
- package/dist/bin/capabilities/enhancedGitCapability.js +0 -221
- package/dist/bin/capabilities/filesystemCapability.js +0 -22
- package/dist/bin/capabilities/globCapability.js +0 -28
- package/dist/bin/capabilities/interactionCapability.js +0 -20
- package/dist/bin/capabilities/learnCapability.js +0 -22
- package/dist/bin/capabilities/mcpCapability.js +0 -20
- package/dist/bin/capabilities/notebookCapability.js +0 -28
- package/dist/bin/capabilities/planningCapability.js +0 -27
- package/dist/bin/capabilities/refactoringCapability.js +0 -23
- package/dist/bin/capabilities/repoChecksCapability.js +0 -22
- package/dist/bin/capabilities/searchCapability.js +0 -22
- package/dist/bin/capabilities/skillCapability.js +0 -76
- package/dist/bin/capabilities/taskManagementCapability.js +0 -20
- package/dist/bin/capabilities/testingCapability.js +0 -23
- package/dist/bin/capabilities/toolManifest.js +0 -159
- package/dist/bin/capabilities/toolRegistry.js +0 -114
- package/dist/bin/capabilities/webCapability.js +0 -20
- package/dist/bin/config.js +0 -139
- package/dist/bin/contracts/v1/agent.js +0 -7
- package/dist/bin/contracts/v1/agentProfileManifest.js +0 -8
- package/dist/bin/contracts/v1/agentRules.js +0 -9
- package/dist/bin/contracts/v1/toolAccess.js +0 -8
- package/dist/bin/erosolar-optimized.d.ts +0 -12
- package/dist/bin/erosolar-optimized.d.ts.map +0 -1
- package/dist/bin/erosolar-optimized.js +0 -239
- package/dist/bin/erosolar-optimized.js.map +0 -1
- package/dist/bin/headless/headlessApp.js +0 -172
- package/dist/bin/mcp/config.js +0 -202
- package/dist/bin/mcp/stdioClient.js +0 -172
- package/dist/bin/mcp/toolBridge.js +0 -104
- package/dist/bin/mcp/types.js +0 -1
- package/dist/bin/plugins/index.js +0 -113
- package/dist/bin/plugins/providers/anthropic/index.js +0 -25
- package/dist/bin/plugins/providers/deepseek/index.js +0 -24
- package/dist/bin/plugins/providers/google/index.js +0 -26
- package/dist/bin/plugins/providers/index.js +0 -19
- package/dist/bin/plugins/providers/ollama/index.js +0 -59
- package/dist/bin/plugins/providers/openai/index.js +0 -26
- package/dist/bin/plugins/providers/xai/index.js +0 -24
- package/dist/bin/plugins/tools/agentSpawning/agentSpawningPlugin.js +0 -8
- package/dist/bin/plugins/tools/bash/localBashPlugin.js +0 -13
- package/dist/bin/plugins/tools/checks/localRepoChecksPlugin.js +0 -13
- package/dist/bin/plugins/tools/cloud/cloudPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeAnalysis/codeAnalysisPlugin.js +0 -13
- package/dist/bin/plugins/tools/codeQuality/codeQualityPlugin.js +0 -13
- package/dist/bin/plugins/tools/dependency/dependencyPlugin.js +0 -11
- package/dist/bin/plugins/tools/development/devPlugin.js +0 -13
- package/dist/bin/plugins/tools/edit/editPlugin.js +0 -14
- package/dist/bin/plugins/tools/email/emailPlugin.js +0 -11
- package/dist/bin/plugins/tools/enhancedGit/enhancedGitPlugin.js +0 -8
- package/dist/bin/plugins/tools/filesystem/localFilesystemPlugin.js +0 -13
- package/dist/bin/plugins/tools/glob/globPlugin.js +0 -14
- package/dist/bin/plugins/tools/index.js +0 -2
- package/dist/bin/plugins/tools/interaction/interactionPlugin.js +0 -11
- package/dist/bin/plugins/tools/learn/learnPlugin.js +0 -13
- package/dist/bin/plugins/tools/mcp/mcpPlugin.js +0 -8
- package/dist/bin/plugins/tools/nodeDefaults.js +0 -56
- package/dist/bin/plugins/tools/notebook/notebookPlugin.js +0 -14
- package/dist/bin/plugins/tools/planning/planningPlugin.js +0 -14
- package/dist/bin/plugins/tools/refactoring/refactoringPlugin.js +0 -11
- package/dist/bin/plugins/tools/registry.js +0 -57
- package/dist/bin/plugins/tools/search/localSearchPlugin.js +0 -13
- package/dist/bin/plugins/tools/skills/skillPlugin.js +0 -8
- package/dist/bin/plugins/tools/taskManagement/taskManagementPlugin.js +0 -11
- package/dist/bin/plugins/tools/testing/testingPlugin.js +0 -11
- package/dist/bin/plugins/tools/web/webPlugin.js +0 -11
- package/dist/bin/providers/anthropicProvider.js +0 -329
- package/dist/bin/providers/googleProvider.js +0 -203
- package/dist/bin/providers/openaiChatCompletionsProvider.js +0 -208
- package/dist/bin/providers/openaiResponsesProvider.js +0 -249
- package/dist/bin/providers/providerFactory.js +0 -24
- package/dist/bin/runtime/agentController.js +0 -321
- package/dist/bin/runtime/agentHost.js +0 -153
- package/dist/bin/runtime/agentSession.js +0 -195
- package/dist/bin/runtime/node.js +0 -10
- package/dist/bin/runtime/universal.js +0 -28
- package/dist/bin/skills/skillRepository.js +0 -236
- package/dist/bin/skills/types.js +0 -1
- package/dist/bin/subagents/taskRunner.js +0 -269
- package/dist/bin/tools/backgroundBashTools.js +0 -211
- package/dist/bin/tools/bashTools.js +0 -159
- package/dist/bin/tools/cloudTools.js +0 -864
- package/dist/bin/tools/codeAnalysisTools.js +0 -641
- package/dist/bin/tools/codeQualityTools.js +0 -294
- package/dist/bin/tools/dependencyTools.js +0 -282
- package/dist/bin/tools/devTools.js +0 -238
- package/dist/bin/tools/diffUtils.js +0 -137
- package/dist/bin/tools/editTools.js +0 -134
- package/dist/bin/tools/emailTools.js +0 -448
- package/dist/bin/tools/fileTools.js +0 -282
- package/dist/bin/tools/globTools.js +0 -173
- package/dist/bin/tools/grepTools.js +0 -332
- package/dist/bin/tools/interactionTools.js +0 -170
- package/dist/bin/tools/learnTools.js +0 -1818
- package/dist/bin/tools/notebookEditTools.js +0 -196
- package/dist/bin/tools/planningTools.js +0 -46
- package/dist/bin/tools/refactoringTools.js +0 -293
- package/dist/bin/tools/repoChecksTools.js +0 -160
- package/dist/bin/tools/searchTools.js +0 -206
- package/dist/bin/tools/skillTools.js +0 -177
- package/dist/bin/tools/taskManagementTools.js +0 -156
- package/dist/bin/tools/testingTools.js +0 -232
- package/dist/bin/tools/webTools.js +0 -480
- package/dist/bin/workspace.js +0 -106
- package/dist/bin/workspace.validator.js +0 -213
- package/dist/capabilities/offensiveSecurityCapability.d.ts +0 -26
- package/dist/capabilities/offensiveSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveSecurityCapability.js +0 -58
- package/dist/capabilities/offensiveSecurityCapability.js.map +0 -1
- package/dist/capabilities/realSecurityCapability.d.ts +0 -26
- package/dist/capabilities/realSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/realSecurityCapability.js +0 -53
- package/dist/capabilities/realSecurityCapability.js.map +0 -1
- package/dist/capabilities/securityCapability.d.ts +0 -32
- package/dist/capabilities/securityCapability.d.ts.map +0 -1
- package/dist/capabilities/securityCapability.js +0 -57
- package/dist/capabilities/securityCapability.js.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.d.ts +0 -42
- package/dist/capabilities/ultimateSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/ultimateSecurityCapability.js +0 -96
- package/dist/capabilities/ultimateSecurityCapability.js.map +0 -1
- package/dist/core/designThoughtCheck.d.ts +0 -196
- package/dist/core/designThoughtCheck.d.ts.map +0 -1
- package/dist/core/designThoughtCheck.js +0 -287
- package/dist/core/designThoughtCheck.js.map +0 -1
- package/dist/core/designThoughtCheckEngine.d.ts +0 -58
- package/dist/core/designThoughtCheckEngine.d.ts.map +0 -1
- package/dist/core/designThoughtCheckEngine.js +0 -358
- package/dist/core/designThoughtCheckEngine.js.map +0 -1
- package/dist/core/designThoughtCheckIntegration.d.ts +0 -103
- package/dist/core/designThoughtCheckIntegration.d.ts.map +0 -1
- package/dist/core/designThoughtCheckIntegration.js +0 -207
- package/dist/core/designThoughtCheckIntegration.js.map +0 -1
- package/dist/core/intelligenceTools.d.ts +0 -19
- package/dist/core/intelligenceTools.d.ts.map +0 -1
- package/dist/core/intelligenceTools.js +0 -453
- package/dist/core/intelligenceTools.js.map +0 -1
- package/dist/core/operationalTools.d.ts +0 -19
- package/dist/core/operationalTools.d.ts.map +0 -1
- package/dist/core/operationalTools.js +0 -467
- package/dist/core/operationalTools.js.map +0 -1
- package/dist/offensive/core/offensive-engine.d.ts +0 -171
- package/dist/offensive/core/offensive-engine.d.ts.map +0 -1
- package/dist/offensive/core/offensive-engine.js +0 -345
- package/dist/offensive/core/offensive-engine.js.map +0 -1
- package/dist/offensive/core/offensive-integration.d.ts +0 -129
- package/dist/offensive/core/offensive-integration.d.ts.map +0 -1
- package/dist/offensive/core/offensive-integration.js +0 -364
- package/dist/offensive/core/offensive-integration.js.map +0 -1
- package/dist/offensive/core/offensive-tools.d.ts +0 -55
- package/dist/offensive/core/offensive-tools.d.ts.map +0 -1
- package/dist/offensive/core/offensive-tools.js +0 -438
- package/dist/offensive/core/offensive-tools.js.map +0 -1
- package/dist/offensive/offensive-cli.d.ts +0 -48
- package/dist/offensive/offensive-cli.d.ts.map +0 -1
- package/dist/offensive/offensive-cli.js +0 -233
- package/dist/offensive/offensive-cli.js.map +0 -1
- package/dist/security/apt-simulation-cli.d.ts +0 -57
- package/dist/security/apt-simulation-cli.d.ts.map +0 -1
- package/dist/security/apt-simulation-cli.js +0 -278
- package/dist/security/apt-simulation-cli.js.map +0 -1
- package/dist/security/apt-simulation-engine-complete.d.ts +0 -97
- package/dist/security/apt-simulation-engine-complete.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine-complete.js +0 -441
- package/dist/security/apt-simulation-engine-complete.js.map +0 -1
- package/dist/security/apt-simulation-engine.d.ts +0 -97
- package/dist/security/apt-simulation-engine.d.ts.map +0 -1
- package/dist/security/apt-simulation-engine.js +0 -441
- package/dist/security/apt-simulation-engine.js.map +0 -1
- package/dist/security/authorization.d.ts +0 -45
- package/dist/security/authorization.d.ts.map +0 -1
- package/dist/security/authorization.js +0 -128
- package/dist/security/authorization.js.map +0 -1
- package/dist/security/comprehensive-security-research.d.ts +0 -84
- package/dist/security/comprehensive-security-research.d.ts.map +0 -1
- package/dist/security/comprehensive-security-research.js +0 -211
- package/dist/security/comprehensive-security-research.js.map +0 -1
- package/dist/security/offensive/exploitationEngine.d.ts +0 -54
- package/dist/security/offensive/exploitationEngine.d.ts.map +0 -1
- package/dist/security/offensive/exploitationEngine.js +0 -263
- package/dist/security/offensive/exploitationEngine.js.map +0 -1
- package/dist/security/real/networkExploitation.d.ts +0 -92
- package/dist/security/real/networkExploitation.d.ts.map +0 -1
- package/dist/security/real/networkExploitation.js +0 -316
- package/dist/security/real/networkExploitation.js.map +0 -1
- package/dist/security/real/persistenceImplementation.d.ts +0 -62
- package/dist/security/real/persistenceImplementation.d.ts.map +0 -1
- package/dist/security/real/persistenceImplementation.js +0 -323
- package/dist/security/real/persistenceImplementation.js.map +0 -1
- package/dist/security/real/vulnerabilityScanner.d.ts +0 -73
- package/dist/security/real/vulnerabilityScanner.d.ts.map +0 -1
- package/dist/security/real/vulnerabilityScanner.js +0 -341
- package/dist/security/real/vulnerabilityScanner.js.map +0 -1
- package/dist/shell/capturePastePatch.d.ts +0 -9
- package/dist/shell/capturePastePatch.d.ts.map +0 -1
- package/dist/shell/capturePastePatch.js +0 -98
- package/dist/shell/capturePastePatch.js.map +0 -1
- package/dist/shell/enhancedInteractiveShell.d.ts +0 -90
- package/dist/shell/enhancedInteractiveShell.d.ts.map +0 -1
- package/dist/shell/enhancedInteractiveShell.js +0 -248
- package/dist/shell/enhancedInteractiveShell.js.map +0 -1
- package/dist/shell/inputProcessor.d.ts +0 -56
- package/dist/shell/inputProcessor.d.ts.map +0 -1
- package/dist/shell/inputProcessor.js +0 -172
- package/dist/shell/inputProcessor.js.map +0 -1
- package/dist/shell/interactiveShell-patch.d.ts +0 -27
- package/dist/shell/interactiveShell-patch.d.ts.map +0 -1
- package/dist/shell/interactiveShell-patch.js +0 -38
- package/dist/shell/interactiveShell-patch.js.map +0 -1
- package/dist/shell/interactiveShell-robust.d.ts +0 -26
- package/dist/shell/interactiveShell-robust.d.ts.map +0 -1
- package/dist/shell/interactiveShell-robust.js +0 -34
- package/dist/shell/interactiveShell-robust.js.map +0 -1
- package/dist/shell/multiLinePasteManager.d.ts +0 -106
- package/dist/shell/multiLinePasteManager.d.ts.map +0 -1
- package/dist/shell/multiLinePasteManager.js +0 -308
- package/dist/shell/multiLinePasteManager.js.map +0 -1
- package/dist/shell/processInputBlockPatch.d.ts +0 -8
- package/dist/shell/processInputBlockPatch.d.ts.map +0 -1
- package/dist/shell/processInputBlockPatch.js +0 -133
- package/dist/shell/processInputBlockPatch.js.map +0 -1
- package/dist/shell/unifiedInputProcessor.d.ts +0 -23
- package/dist/shell/unifiedInputProcessor.d.ts.map +0 -1
- package/dist/shell/unifiedInputProcessor.js +0 -92
- package/dist/shell/unifiedInputProcessor.js.map +0 -1
- package/dist/tools/enhancedSecurityTools.d.ts +0 -19
- package/dist/tools/enhancedSecurityTools.d.ts.map +0 -1
- package/dist/tools/enhancedSecurityTools.js +0 -215
- package/dist/tools/enhancedSecurityTools.js.map +0 -1
- package/dist/tools/offensiveSecurityTools.d.ts +0 -16
- package/dist/tools/offensiveSecurityTools.d.ts.map +0 -1
- package/dist/tools/offensiveSecurityTools.js +0 -285
- package/dist/tools/offensiveSecurityTools.js.map +0 -1
- package/dist/tools/realSecurityTools.d.ts +0 -18
- package/dist/tools/realSecurityTools.d.ts.map +0 -1
- package/dist/tools/realSecurityTools.js +0 -468
- package/dist/tools/realSecurityTools.js.map +0 -1
- package/dist/tools/securityTools.d.ts +0 -20
- package/dist/tools/securityTools.d.ts.map +0 -1
- package/dist/tools/securityTools.js +0 -449
- package/dist/tools/securityTools.js.map +0 -1
|
@@ -1,864 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Cloud Deployment Tools - Unified cloud CLI capabilities with auto-detection and auto-fix
|
|
3
|
-
*
|
|
4
|
-
* Supports:
|
|
5
|
-
* - Firebase (Hosting, Functions, Firestore, Storage, Auth)
|
|
6
|
-
* - Aliyun/Alibaba Cloud (OSS, FC, ACR, etc.)
|
|
7
|
-
* - AWS (S3, Lambda, CloudFront, etc.)
|
|
8
|
-
* - GCP (Cloud Run, Storage, Functions)
|
|
9
|
-
* - Azure (Static Web Apps, Functions, Blob Storage)
|
|
10
|
-
* - Vercel, Netlify, Cloudflare Pages
|
|
11
|
-
*
|
|
12
|
-
* Features:
|
|
13
|
-
* - Automatic CLI detection and installation checking
|
|
14
|
-
* - Authentication status verification
|
|
15
|
-
* - Auto-fix for common issues
|
|
16
|
-
* - AI-driven error resolution
|
|
17
|
-
*
|
|
18
|
-
* @license MIT
|
|
19
|
-
* @author Bo Shang
|
|
20
|
-
*
|
|
21
|
-
* DISCLAIMER: This software is provided for both defensive and offensive security
|
|
22
|
-
* purposes and is open source (available via npm and GitHub) to anyone globally.
|
|
23
|
-
* The creator, Bo Shang, does not solicit or endorse unauthorized attacks.
|
|
24
|
-
* This tool is released with the belief that providing technological freedom
|
|
25
|
-
* globally is the right thing to do. Users are solely responsible for ensuring
|
|
26
|
-
* their use complies with applicable laws and regulations in their jurisdiction.
|
|
27
|
-
* Use responsibly and ethically.
|
|
28
|
-
*/
|
|
29
|
-
import { spawn } from 'child_process';
|
|
30
|
-
import * as fs from 'fs';
|
|
31
|
-
import * as path from 'path';
|
|
32
|
-
const CLOUD_PROVIDERS = {
|
|
33
|
-
firebase: {
|
|
34
|
-
id: 'firebase',
|
|
35
|
-
name: 'Firebase',
|
|
36
|
-
cliCommand: 'firebase',
|
|
37
|
-
versionFlag: '--version',
|
|
38
|
-
installCommand: 'npm install -g firebase-tools',
|
|
39
|
-
installUrl: 'https://firebase.google.com/docs/cli',
|
|
40
|
-
loginCommand: 'firebase login',
|
|
41
|
-
checkAuthCommand: 'firebase projects:list',
|
|
42
|
-
configFile: 'firebase.json',
|
|
43
|
-
envVars: ['FIREBASE_TOKEN', 'GOOGLE_APPLICATION_CREDENTIALS'],
|
|
44
|
-
},
|
|
45
|
-
aliyun: {
|
|
46
|
-
id: 'aliyun',
|
|
47
|
-
name: 'Alibaba Cloud (Aliyun)',
|
|
48
|
-
cliCommand: 'aliyun',
|
|
49
|
-
versionFlag: 'version',
|
|
50
|
-
installCommand: 'brew install aliyun-cli || curl -O https://aliyuncli.alicdn.com/aliyun-cli-linux-amd64-*.tgz',
|
|
51
|
-
installUrl: 'https://www.alibabacloud.com/help/doc-detail/139508.htm',
|
|
52
|
-
loginCommand: 'aliyun configure',
|
|
53
|
-
checkAuthCommand: 'aliyun ecs DescribeRegions',
|
|
54
|
-
configFile: '~/.aliyun/config.json',
|
|
55
|
-
envVars: ['ALIBABA_CLOUD_ACCESS_KEY_ID', 'ALIBABA_CLOUD_ACCESS_KEY_SECRET'],
|
|
56
|
-
},
|
|
57
|
-
aws: {
|
|
58
|
-
id: 'aws',
|
|
59
|
-
name: 'Amazon Web Services',
|
|
60
|
-
cliCommand: 'aws',
|
|
61
|
-
versionFlag: '--version',
|
|
62
|
-
installCommand: 'brew install awscli || pip install awscli',
|
|
63
|
-
installUrl: 'https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html',
|
|
64
|
-
loginCommand: 'aws configure',
|
|
65
|
-
checkAuthCommand: 'aws sts get-caller-identity',
|
|
66
|
-
configFile: '~/.aws/credentials',
|
|
67
|
-
envVars: ['AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY', 'AWS_SESSION_TOKEN'],
|
|
68
|
-
},
|
|
69
|
-
gcloud: {
|
|
70
|
-
id: 'gcloud',
|
|
71
|
-
name: 'Google Cloud Platform',
|
|
72
|
-
cliCommand: 'gcloud',
|
|
73
|
-
versionFlag: '--version',
|
|
74
|
-
installCommand: 'brew install --cask google-cloud-sdk',
|
|
75
|
-
installUrl: 'https://cloud.google.com/sdk/docs/install',
|
|
76
|
-
loginCommand: 'gcloud auth login',
|
|
77
|
-
checkAuthCommand: 'gcloud auth list',
|
|
78
|
-
configFile: '~/.config/gcloud/credentials.db',
|
|
79
|
-
envVars: ['GOOGLE_APPLICATION_CREDENTIALS', 'CLOUDSDK_CORE_PROJECT'],
|
|
80
|
-
},
|
|
81
|
-
azure: {
|
|
82
|
-
id: 'azure',
|
|
83
|
-
name: 'Microsoft Azure',
|
|
84
|
-
cliCommand: 'az',
|
|
85
|
-
versionFlag: '--version',
|
|
86
|
-
installCommand: 'brew install azure-cli || curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash',
|
|
87
|
-
installUrl: 'https://docs.microsoft.com/en-us/cli/azure/install-azure-cli',
|
|
88
|
-
loginCommand: 'az login',
|
|
89
|
-
checkAuthCommand: 'az account show',
|
|
90
|
-
configFile: '~/.azure/accessTokens.json',
|
|
91
|
-
envVars: ['AZURE_CLIENT_ID', 'AZURE_CLIENT_SECRET', 'AZURE_TENANT_ID'],
|
|
92
|
-
},
|
|
93
|
-
vercel: {
|
|
94
|
-
id: 'vercel',
|
|
95
|
-
name: 'Vercel',
|
|
96
|
-
cliCommand: 'vercel',
|
|
97
|
-
versionFlag: '--version',
|
|
98
|
-
installCommand: 'npm install -g vercel',
|
|
99
|
-
installUrl: 'https://vercel.com/docs/cli',
|
|
100
|
-
loginCommand: 'vercel login',
|
|
101
|
-
checkAuthCommand: 'vercel whoami',
|
|
102
|
-
envVars: ['VERCEL_TOKEN'],
|
|
103
|
-
},
|
|
104
|
-
netlify: {
|
|
105
|
-
id: 'netlify',
|
|
106
|
-
name: 'Netlify',
|
|
107
|
-
cliCommand: 'netlify',
|
|
108
|
-
versionFlag: '--version',
|
|
109
|
-
installCommand: 'npm install -g netlify-cli',
|
|
110
|
-
installUrl: 'https://docs.netlify.com/cli/get-started/',
|
|
111
|
-
loginCommand: 'netlify login',
|
|
112
|
-
checkAuthCommand: 'netlify status',
|
|
113
|
-
envVars: ['NETLIFY_AUTH_TOKEN'],
|
|
114
|
-
},
|
|
115
|
-
cloudflare: {
|
|
116
|
-
id: 'cloudflare',
|
|
117
|
-
name: 'Cloudflare',
|
|
118
|
-
cliCommand: 'wrangler',
|
|
119
|
-
versionFlag: '--version',
|
|
120
|
-
installCommand: 'npm install -g wrangler',
|
|
121
|
-
installUrl: 'https://developers.cloudflare.com/workers/wrangler/install-and-update/',
|
|
122
|
-
loginCommand: 'wrangler login',
|
|
123
|
-
checkAuthCommand: 'wrangler whoami',
|
|
124
|
-
envVars: ['CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_ACCOUNT_ID'],
|
|
125
|
-
},
|
|
126
|
-
fly: {
|
|
127
|
-
id: 'fly',
|
|
128
|
-
name: 'Fly.io',
|
|
129
|
-
cliCommand: 'flyctl',
|
|
130
|
-
versionFlag: 'version',
|
|
131
|
-
installCommand: 'brew install flyctl || curl -L https://fly.io/install.sh | sh',
|
|
132
|
-
installUrl: 'https://fly.io/docs/hands-on/install-flyctl/',
|
|
133
|
-
loginCommand: 'flyctl auth login',
|
|
134
|
-
checkAuthCommand: 'flyctl auth whoami',
|
|
135
|
-
envVars: ['FLY_API_TOKEN'],
|
|
136
|
-
},
|
|
137
|
-
railway: {
|
|
138
|
-
id: 'railway',
|
|
139
|
-
name: 'Railway',
|
|
140
|
-
cliCommand: 'railway',
|
|
141
|
-
versionFlag: '--version',
|
|
142
|
-
installCommand: 'npm install -g @railway/cli',
|
|
143
|
-
installUrl: 'https://docs.railway.app/develop/cli',
|
|
144
|
-
loginCommand: 'railway login',
|
|
145
|
-
checkAuthCommand: 'railway whoami',
|
|
146
|
-
envVars: ['RAILWAY_TOKEN'],
|
|
147
|
-
},
|
|
148
|
-
supabase: {
|
|
149
|
-
id: 'supabase',
|
|
150
|
-
name: 'Supabase',
|
|
151
|
-
cliCommand: 'supabase',
|
|
152
|
-
versionFlag: '--version',
|
|
153
|
-
installCommand: 'npm install -g supabase',
|
|
154
|
-
installUrl: 'https://supabase.com/docs/guides/cli',
|
|
155
|
-
loginCommand: 'supabase login',
|
|
156
|
-
checkAuthCommand: 'supabase projects list',
|
|
157
|
-
envVars: ['SUPABASE_ACCESS_TOKEN'],
|
|
158
|
-
},
|
|
159
|
-
};
|
|
160
|
-
async function runCommand(command, timeout = 30000) {
|
|
161
|
-
return new Promise((resolve) => {
|
|
162
|
-
const child = spawn('sh', ['-c', command], {
|
|
163
|
-
timeout,
|
|
164
|
-
env: { ...process.env },
|
|
165
|
-
});
|
|
166
|
-
let stdout = '';
|
|
167
|
-
let stderr = '';
|
|
168
|
-
child.stdout?.on('data', (data) => {
|
|
169
|
-
stdout += data.toString();
|
|
170
|
-
});
|
|
171
|
-
child.stderr?.on('data', (data) => {
|
|
172
|
-
stderr += data.toString();
|
|
173
|
-
});
|
|
174
|
-
child.on('close', (code) => {
|
|
175
|
-
resolve({ stdout: stdout.trim(), stderr: stderr.trim(), exitCode: code ?? 1 });
|
|
176
|
-
});
|
|
177
|
-
child.on('error', (err) => {
|
|
178
|
-
resolve({ stdout: '', stderr: err.message, exitCode: 1 });
|
|
179
|
-
});
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
async function checkCLIInstalled(provider) {
|
|
183
|
-
try {
|
|
184
|
-
const result = await runCommand(`which ${provider.cliCommand} && ${provider.cliCommand} ${provider.versionFlag} 2>&1 | head -5`);
|
|
185
|
-
if (result.exitCode === 0 && result.stdout) {
|
|
186
|
-
// Extract version from output
|
|
187
|
-
const versionMatch = result.stdout.match(/(\d+\.\d+\.\d+[\w.-]*)/);
|
|
188
|
-
return {
|
|
189
|
-
installed: true,
|
|
190
|
-
version: versionMatch?.[1] || result.stdout.split('\n')[1] || 'unknown',
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
return { installed: false, error: result.stderr || 'CLI not found in PATH' };
|
|
194
|
-
}
|
|
195
|
-
catch (error) {
|
|
196
|
-
return { installed: false, error: error instanceof Error ? error.message : String(error) };
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
async function checkAuthentication(provider) {
|
|
200
|
-
try {
|
|
201
|
-
const result = await runCommand(provider.checkAuthCommand, 15000);
|
|
202
|
-
if (result.exitCode === 0) {
|
|
203
|
-
return {
|
|
204
|
-
authenticated: true,
|
|
205
|
-
details: result.stdout.slice(0, 500),
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
// Check for specific auth errors
|
|
209
|
-
const errorLower = (result.stderr + result.stdout).toLowerCase();
|
|
210
|
-
if (errorLower.includes('not logged in') ||
|
|
211
|
-
errorLower.includes('authentication') ||
|
|
212
|
-
errorLower.includes('credentials') ||
|
|
213
|
-
errorLower.includes('login') ||
|
|
214
|
-
errorLower.includes('token') ||
|
|
215
|
-
errorLower.includes('unauthorized')) {
|
|
216
|
-
return {
|
|
217
|
-
authenticated: false,
|
|
218
|
-
error: 'Not authenticated. Run: ' + provider.loginCommand,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
return { authenticated: false, error: result.stderr || result.stdout };
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
return { authenticated: false, error: error instanceof Error ? error.message : String(error) };
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
async function checkConfigFile(provider, workingDir) {
|
|
228
|
-
if (!provider.configFile) {
|
|
229
|
-
return true;
|
|
230
|
-
}
|
|
231
|
-
// Check for project-level config
|
|
232
|
-
const projectConfig = path.join(workingDir, provider.configFile);
|
|
233
|
-
if (fs.existsSync(projectConfig)) {
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
// Check for user-level config (expand ~)
|
|
237
|
-
if (provider.configFile.startsWith('~')) {
|
|
238
|
-
const homeConfig = provider.configFile.replace('~', process.env['HOME'] || '');
|
|
239
|
-
if (fs.existsSync(homeConfig)) {
|
|
240
|
-
return true;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
return false;
|
|
244
|
-
}
|
|
245
|
-
async function getFullCLIStatus(providerId, workingDir) {
|
|
246
|
-
const provider = CLOUD_PROVIDERS[providerId];
|
|
247
|
-
if (!provider) {
|
|
248
|
-
return {
|
|
249
|
-
installed: false,
|
|
250
|
-
authenticated: false,
|
|
251
|
-
configExists: false,
|
|
252
|
-
errors: [`Unknown provider: ${providerId}`],
|
|
253
|
-
suggestions: ['Available providers: ' + Object.keys(CLOUD_PROVIDERS).join(', ')],
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
const status = {
|
|
257
|
-
installed: false,
|
|
258
|
-
authenticated: false,
|
|
259
|
-
configExists: false,
|
|
260
|
-
errors: [],
|
|
261
|
-
suggestions: [],
|
|
262
|
-
};
|
|
263
|
-
// Check installation
|
|
264
|
-
const installCheck = await checkCLIInstalled(provider);
|
|
265
|
-
status.installed = installCheck.installed;
|
|
266
|
-
status.version = installCheck.version;
|
|
267
|
-
if (!installCheck.installed) {
|
|
268
|
-
status.errors.push(`${provider.name} CLI not installed`);
|
|
269
|
-
status.suggestions.push(`Install with: ${provider.installCommand}`);
|
|
270
|
-
status.suggestions.push(`Documentation: ${provider.installUrl}`);
|
|
271
|
-
return status;
|
|
272
|
-
}
|
|
273
|
-
// Check authentication
|
|
274
|
-
const authCheck = await checkAuthentication(provider);
|
|
275
|
-
status.authenticated = authCheck.authenticated;
|
|
276
|
-
status.authDetails = authCheck.details;
|
|
277
|
-
if (!authCheck.authenticated) {
|
|
278
|
-
status.errors.push(authCheck.error || 'Not authenticated');
|
|
279
|
-
status.suggestions.push(`Authenticate with: ${provider.loginCommand}`);
|
|
280
|
-
if (provider.envVars?.length) {
|
|
281
|
-
status.suggestions.push(`Or set environment variables: ${provider.envVars.join(', ')}`);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
// Check config file
|
|
285
|
-
status.configExists = await checkConfigFile(provider, workingDir);
|
|
286
|
-
if (!status.configExists && provider.configFile) {
|
|
287
|
-
status.errors.push(`Config file not found: ${provider.configFile}`);
|
|
288
|
-
if (provider.configFile.includes('firebase.json')) {
|
|
289
|
-
status.suggestions.push('Initialize project with: firebase init');
|
|
290
|
-
}
|
|
291
|
-
else if (provider.configFile.includes('aliyun')) {
|
|
292
|
-
status.suggestions.push('Configure with: aliyun configure');
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
return status;
|
|
296
|
-
}
|
|
297
|
-
async function autoFixIssues(providerId, workingDir) {
|
|
298
|
-
const fixes = [];
|
|
299
|
-
const provider = CLOUD_PROVIDERS[providerId];
|
|
300
|
-
if (!provider) {
|
|
301
|
-
return ['Unknown provider'];
|
|
302
|
-
}
|
|
303
|
-
const status = await getFullCLIStatus(providerId, workingDir);
|
|
304
|
-
// Try to install if not present
|
|
305
|
-
if (!status.installed) {
|
|
306
|
-
fixes.push(`Attempting to install ${provider.name} CLI...`);
|
|
307
|
-
// Try npm install first for npm-based CLIs
|
|
308
|
-
if (provider.installCommand.includes('npm install')) {
|
|
309
|
-
const result = await runCommand(provider.installCommand, 120000);
|
|
310
|
-
if (result.exitCode === 0) {
|
|
311
|
-
fixes.push(`✅ Successfully installed ${provider.name} CLI`);
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
fixes.push(`❌ Failed to install: ${result.stderr}`);
|
|
315
|
-
fixes.push(`Manual install: ${provider.installCommand}`);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
else {
|
|
319
|
-
fixes.push(`Manual installation required: ${provider.installCommand}`);
|
|
320
|
-
fixes.push(`Visit: ${provider.installUrl}`);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
// Check for CI environment variables if not authenticated
|
|
324
|
-
if (!status.authenticated && provider.envVars) {
|
|
325
|
-
const hasEnvAuth = provider.envVars.some((v) => process.env[v]);
|
|
326
|
-
if (hasEnvAuth) {
|
|
327
|
-
fixes.push(`Environment credentials detected for ${provider.name}`);
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
fixes.push(`Authentication required. Run: ${provider.loginCommand}`);
|
|
331
|
-
// For headless/CI environments
|
|
332
|
-
if (process.env['CI'] || !process.stdin.isTTY) {
|
|
333
|
-
fixes.push(`For CI/headless environments, set: ${provider.envVars.join(' or ')}`);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
return fixes;
|
|
338
|
-
}
|
|
339
|
-
export function createCloudTools(workingDir = process.cwd()) {
|
|
340
|
-
return [
|
|
341
|
-
{
|
|
342
|
-
name: 'cloud_status',
|
|
343
|
-
description: `Check the status of cloud CLIs on this system.
|
|
344
|
-
|
|
345
|
-
Detects and reports on:
|
|
346
|
-
- CLI installation status and versions
|
|
347
|
-
- Authentication status
|
|
348
|
-
- Project configuration
|
|
349
|
-
- Required environment variables
|
|
350
|
-
|
|
351
|
-
Supports: Firebase, Aliyun, AWS, GCP, Azure, Vercel, Netlify, Cloudflare, Fly.io, Railway, Supabase
|
|
352
|
-
|
|
353
|
-
Use this before attempting any cloud deployment to ensure everything is properly configured.`,
|
|
354
|
-
parameters: {
|
|
355
|
-
type: 'object',
|
|
356
|
-
properties: {
|
|
357
|
-
providers: {
|
|
358
|
-
type: 'array',
|
|
359
|
-
items: { type: 'string' },
|
|
360
|
-
description: 'Specific providers to check (default: all). Options: firebase, aliyun, aws, gcloud, azure, vercel, netlify, cloudflare, fly, railway, supabase',
|
|
361
|
-
},
|
|
362
|
-
},
|
|
363
|
-
},
|
|
364
|
-
handler: async (args) => {
|
|
365
|
-
const providersToCheck = args['providers'] || Object.keys(CLOUD_PROVIDERS);
|
|
366
|
-
const results = ['☁️ Cloud CLI Status Report\n'];
|
|
367
|
-
for (const providerId of providersToCheck) {
|
|
368
|
-
const provider = CLOUD_PROVIDERS[providerId];
|
|
369
|
-
if (!provider) {
|
|
370
|
-
results.push(`❓ Unknown provider: ${providerId}`);
|
|
371
|
-
continue;
|
|
372
|
-
}
|
|
373
|
-
results.push(`\n--- ${provider.name} (${provider.cliCommand}) ---`);
|
|
374
|
-
const status = await getFullCLIStatus(providerId, workingDir);
|
|
375
|
-
if (status.installed) {
|
|
376
|
-
results.push(`✅ Installed: v${status.version}`);
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
results.push(`❌ Not installed`);
|
|
380
|
-
}
|
|
381
|
-
if (status.installed) {
|
|
382
|
-
if (status.authenticated) {
|
|
383
|
-
results.push(`✅ Authenticated`);
|
|
384
|
-
if (status.authDetails) {
|
|
385
|
-
results.push(` ${status.authDetails.split('\n')[0]}`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
results.push(`❌ Not authenticated`);
|
|
390
|
-
}
|
|
391
|
-
if (status.configExists) {
|
|
392
|
-
results.push(`✅ Project config found`);
|
|
393
|
-
}
|
|
394
|
-
else if (provider.configFile) {
|
|
395
|
-
results.push(`⚠️ No project config (${provider.configFile})`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
if (status.errors.length > 0) {
|
|
399
|
-
results.push(`\nIssues:`);
|
|
400
|
-
for (const err of status.errors) {
|
|
401
|
-
results.push(` ⚠️ ${err}`);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
if (status.suggestions.length > 0) {
|
|
405
|
-
results.push(`\nSuggestions:`);
|
|
406
|
-
for (const sug of status.suggestions) {
|
|
407
|
-
results.push(` 💡 ${sug}`);
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
return results.join('\n');
|
|
412
|
-
},
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
name: 'cloud_fix',
|
|
416
|
-
description: `Automatically fix cloud CLI issues.
|
|
417
|
-
|
|
418
|
-
Attempts to:
|
|
419
|
-
- Install missing CLIs (via npm/brew where possible)
|
|
420
|
-
- Detect environment credentials
|
|
421
|
-
- Provide step-by-step fix instructions for issues that can't be auto-fixed
|
|
422
|
-
|
|
423
|
-
Use this when cloud_status reports issues.`,
|
|
424
|
-
parameters: {
|
|
425
|
-
type: 'object',
|
|
426
|
-
properties: {
|
|
427
|
-
provider: {
|
|
428
|
-
type: 'string',
|
|
429
|
-
description: 'The cloud provider to fix. Options: firebase, aliyun, aws, gcloud, azure, vercel, netlify, cloudflare, fly, railway, supabase',
|
|
430
|
-
},
|
|
431
|
-
},
|
|
432
|
-
required: ['provider'],
|
|
433
|
-
},
|
|
434
|
-
handler: async (args) => {
|
|
435
|
-
const providerId = args['provider']?.toLowerCase();
|
|
436
|
-
if (!CLOUD_PROVIDERS[providerId]) {
|
|
437
|
-
return `Unknown provider: ${providerId}\n\nAvailable: ${Object.keys(CLOUD_PROVIDERS).join(', ')}`;
|
|
438
|
-
}
|
|
439
|
-
const fixes = await autoFixIssues(providerId, workingDir);
|
|
440
|
-
return `🔧 Auto-Fix Results for ${CLOUD_PROVIDERS[providerId]?.name}\n\n${fixes.join('\n')}`;
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
name: 'firebase_deploy',
|
|
445
|
-
description: `Deploy to Firebase (Hosting, Functions, Firestore rules, Storage rules).
|
|
446
|
-
|
|
447
|
-
Automatically:
|
|
448
|
-
- Checks Firebase CLI status
|
|
449
|
-
- Validates firebase.json configuration
|
|
450
|
-
- Handles authentication issues
|
|
451
|
-
- Provides detailed deployment logs
|
|
452
|
-
|
|
453
|
-
Supports:
|
|
454
|
-
- firebase deploy --only hosting
|
|
455
|
-
- firebase deploy --only functions
|
|
456
|
-
- firebase deploy --only firestore
|
|
457
|
-
- firebase deploy --only storage
|
|
458
|
-
- firebase deploy (all)`,
|
|
459
|
-
parameters: {
|
|
460
|
-
type: 'object',
|
|
461
|
-
properties: {
|
|
462
|
-
target: {
|
|
463
|
-
type: 'string',
|
|
464
|
-
description: 'Deployment target: "hosting", "functions", "firestore", "storage", "all" (default: all)',
|
|
465
|
-
},
|
|
466
|
-
project: {
|
|
467
|
-
type: 'string',
|
|
468
|
-
description: 'Firebase project ID (uses default if not specified)',
|
|
469
|
-
},
|
|
470
|
-
dry_run: {
|
|
471
|
-
type: 'boolean',
|
|
472
|
-
description: 'Preview deployment without actually deploying (default: false)',
|
|
473
|
-
},
|
|
474
|
-
},
|
|
475
|
-
},
|
|
476
|
-
handler: async (args) => {
|
|
477
|
-
const target = args['target'] || 'all';
|
|
478
|
-
const project = args['project'];
|
|
479
|
-
const dryRun = args['dry_run'] === true;
|
|
480
|
-
// First check status
|
|
481
|
-
const status = await getFullCLIStatus('firebase', workingDir);
|
|
482
|
-
if (!status.installed) {
|
|
483
|
-
return `Firebase CLI not installed.\n\n🔧 Auto-fix: Run \`npm install -g firebase-tools\`\n\nOr use cloud_fix tool with provider="firebase"`;
|
|
484
|
-
}
|
|
485
|
-
if (!status.authenticated) {
|
|
486
|
-
return `Firebase not authenticated.\n\n🔧 Fix options:\n1. Interactive: \`firebase login\`\n2. CI/Headless: \`firebase login:ci\` and set FIREBASE_TOKEN\n3. Service account: Set GOOGLE_APPLICATION_CREDENTIALS`;
|
|
487
|
-
}
|
|
488
|
-
if (!status.configExists) {
|
|
489
|
-
return `No firebase.json found in ${workingDir}.\n\n🔧 Initialize with: \`firebase init\``;
|
|
490
|
-
}
|
|
491
|
-
// Build deploy command
|
|
492
|
-
let cmd = 'firebase deploy';
|
|
493
|
-
if (target !== 'all') {
|
|
494
|
-
cmd += ` --only ${target}`;
|
|
495
|
-
}
|
|
496
|
-
if (project) {
|
|
497
|
-
cmd += ` --project ${project}`;
|
|
498
|
-
}
|
|
499
|
-
if (dryRun) {
|
|
500
|
-
cmd += ' --dry-run';
|
|
501
|
-
}
|
|
502
|
-
cmd += ' 2>&1';
|
|
503
|
-
const result = await runCommand(`cd "${workingDir}" && ${cmd}`, 300000); // 5 min timeout
|
|
504
|
-
if (result.exitCode === 0) {
|
|
505
|
-
return `✅ Firebase deployment successful!\n\n${result.stdout}`;
|
|
506
|
-
}
|
|
507
|
-
// Analyze error and provide fixes
|
|
508
|
-
const output = result.stdout + result.stderr;
|
|
509
|
-
let fix = '';
|
|
510
|
-
if (output.includes('authentication') || output.includes('login')) {
|
|
511
|
-
fix = '\n\n🔧 Fix: Run `firebase login --reauth`';
|
|
512
|
-
}
|
|
513
|
-
else if (output.includes('permission') || output.includes('denied')) {
|
|
514
|
-
fix = '\n\n🔧 Fix: Check Firebase project permissions at https://console.firebase.google.com';
|
|
515
|
-
}
|
|
516
|
-
else if (output.includes('quota') || output.includes('limit')) {
|
|
517
|
-
fix = '\n\n🔧 Fix: Quota exceeded. Check billing at https://console.firebase.google.com/billing';
|
|
518
|
-
}
|
|
519
|
-
else if (output.includes('build') || output.includes('compile')) {
|
|
520
|
-
fix = '\n\n🔧 Fix: Build errors detected. Run your build command first (e.g., npm run build)';
|
|
521
|
-
}
|
|
522
|
-
return `❌ Firebase deployment failed\n\n${output}${fix}`;
|
|
523
|
-
},
|
|
524
|
-
},
|
|
525
|
-
{
|
|
526
|
-
name: 'aliyun_deploy',
|
|
527
|
-
description: `Deploy to Alibaba Cloud (Aliyun).
|
|
528
|
-
|
|
529
|
-
Supports:
|
|
530
|
-
- OSS (Object Storage Service) - static file hosting
|
|
531
|
-
- FC (Function Compute) - serverless functions
|
|
532
|
-
- ACR (Container Registry) - Docker images
|
|
533
|
-
- ECS (Elastic Compute Service) - VM management
|
|
534
|
-
|
|
535
|
-
Automatically handles authentication and common issues.`,
|
|
536
|
-
parameters: {
|
|
537
|
-
type: 'object',
|
|
538
|
-
properties: {
|
|
539
|
-
service: {
|
|
540
|
-
type: 'string',
|
|
541
|
-
description: 'Service to deploy: "oss", "fc", "acr", "ecs"',
|
|
542
|
-
},
|
|
543
|
-
action: {
|
|
544
|
-
type: 'string',
|
|
545
|
-
description: 'Action to perform (service-specific)',
|
|
546
|
-
},
|
|
547
|
-
region: {
|
|
548
|
-
type: 'string',
|
|
549
|
-
description: 'Aliyun region (e.g., cn-hangzhou, cn-shanghai)',
|
|
550
|
-
},
|
|
551
|
-
args: {
|
|
552
|
-
type: 'string',
|
|
553
|
-
description: 'Additional CLI arguments',
|
|
554
|
-
},
|
|
555
|
-
},
|
|
556
|
-
required: ['service', 'action'],
|
|
557
|
-
},
|
|
558
|
-
handler: async (args) => {
|
|
559
|
-
const service = args['service'];
|
|
560
|
-
const action = args['action'];
|
|
561
|
-
const region = args['region'];
|
|
562
|
-
const extraArgs = args['args'];
|
|
563
|
-
// Check status
|
|
564
|
-
const status = await getFullCLIStatus('aliyun', workingDir);
|
|
565
|
-
if (!status.installed) {
|
|
566
|
-
return `Aliyun CLI not installed.\n\n🔧 Install:\n- macOS: brew install aliyun-cli\n- Linux: curl -O https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz\n\nDocs: https://www.alibabacloud.com/help/doc-detail/139508.htm`;
|
|
567
|
-
}
|
|
568
|
-
if (!status.authenticated) {
|
|
569
|
-
return `Aliyun not configured.\n\n🔧 Fix:\n1. Run: aliyun configure\n2. Enter your AccessKey ID and Secret\n3. Get keys at: https://ram.console.aliyun.com/manage/ak\n\nOr set environment variables:\n- ALIBABA_CLOUD_ACCESS_KEY_ID\n- ALIBABA_CLOUD_ACCESS_KEY_SECRET`;
|
|
570
|
-
}
|
|
571
|
-
// Build command
|
|
572
|
-
let cmd = `aliyun ${service} ${action}`;
|
|
573
|
-
if (region) {
|
|
574
|
-
cmd += ` --region ${region}`;
|
|
575
|
-
}
|
|
576
|
-
if (extraArgs) {
|
|
577
|
-
cmd += ` ${extraArgs}`;
|
|
578
|
-
}
|
|
579
|
-
cmd += ' 2>&1';
|
|
580
|
-
const result = await runCommand(cmd, 120000);
|
|
581
|
-
if (result.exitCode === 0) {
|
|
582
|
-
return `✅ Aliyun ${service} ${action} successful!\n\n${result.stdout}`;
|
|
583
|
-
}
|
|
584
|
-
// Error analysis
|
|
585
|
-
const output = result.stdout + result.stderr;
|
|
586
|
-
let fix = '';
|
|
587
|
-
if (output.includes('InvalidAccessKeyId') || output.includes('SignatureDoesNotMatch')) {
|
|
588
|
-
fix = '\n\n🔧 Fix: Invalid credentials. Run `aliyun configure` with correct AccessKey';
|
|
589
|
-
}
|
|
590
|
-
else if (output.includes('Forbidden')) {
|
|
591
|
-
fix = '\n\n🔧 Fix: Permission denied. Check RAM policies at https://ram.console.aliyun.com';
|
|
592
|
-
}
|
|
593
|
-
return `❌ Aliyun command failed\n\n${output}${fix}`;
|
|
594
|
-
},
|
|
595
|
-
},
|
|
596
|
-
{
|
|
597
|
-
name: 'cloud_deploy',
|
|
598
|
-
description: `Universal cloud deployment command that works across providers.
|
|
599
|
-
|
|
600
|
-
Automatically:
|
|
601
|
-
- Detects project type and configuration
|
|
602
|
-
- Selects appropriate deployment target
|
|
603
|
-
- Handles provider-specific requirements
|
|
604
|
-
- Auto-fixes common issues
|
|
605
|
-
|
|
606
|
-
Supports deployment to:
|
|
607
|
-
- Firebase, Vercel, Netlify for web apps
|
|
608
|
-
- AWS Lambda, GCP Functions, Azure Functions for serverless
|
|
609
|
-
- Cloudflare Workers/Pages for edge deployments
|
|
610
|
-
- Fly.io, Railway for containers`,
|
|
611
|
-
parameters: {
|
|
612
|
-
type: 'object',
|
|
613
|
-
properties: {
|
|
614
|
-
provider: {
|
|
615
|
-
type: 'string',
|
|
616
|
-
description: 'Cloud provider: firebase, vercel, netlify, cloudflare, fly, railway, aws, gcloud, azure',
|
|
617
|
-
},
|
|
618
|
-
command: {
|
|
619
|
-
type: 'string',
|
|
620
|
-
description: 'Deployment command (e.g., "deploy", "deploy --prod")',
|
|
621
|
-
},
|
|
622
|
-
auto_fix: {
|
|
623
|
-
type: 'boolean',
|
|
624
|
-
description: 'Automatically attempt to fix issues (default: true)',
|
|
625
|
-
},
|
|
626
|
-
},
|
|
627
|
-
required: ['provider'],
|
|
628
|
-
},
|
|
629
|
-
handler: async (args) => {
|
|
630
|
-
const providerId = args['provider']?.toLowerCase();
|
|
631
|
-
const command = args['command'] || 'deploy';
|
|
632
|
-
const autoFix = args['auto_fix'] !== false;
|
|
633
|
-
const provider = CLOUD_PROVIDERS[providerId];
|
|
634
|
-
if (!provider) {
|
|
635
|
-
return `Unknown provider: ${providerId}\n\nAvailable: ${Object.keys(CLOUD_PROVIDERS).join(', ')}`;
|
|
636
|
-
}
|
|
637
|
-
// Check and potentially fix status
|
|
638
|
-
let status = await getFullCLIStatus(providerId, workingDir);
|
|
639
|
-
if (!status.installed && autoFix) {
|
|
640
|
-
const fixes = await autoFixIssues(providerId, workingDir);
|
|
641
|
-
// Re-check after fix attempt
|
|
642
|
-
status = await getFullCLIStatus(providerId, workingDir);
|
|
643
|
-
if (!status.installed) {
|
|
644
|
-
return `${provider.name} CLI could not be installed.\n\n${fixes.join('\n')}`;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
if (!status.installed) {
|
|
648
|
-
return `${provider.name} CLI not installed.\n\nInstall: ${provider.installCommand}\nDocs: ${provider.installUrl}`;
|
|
649
|
-
}
|
|
650
|
-
if (!status.authenticated) {
|
|
651
|
-
return `${provider.name} not authenticated.\n\nFix: ${provider.loginCommand}\n\nFor CI, set: ${provider.envVars?.join(' or ') || 'appropriate credentials'}`;
|
|
652
|
-
}
|
|
653
|
-
// Execute deployment
|
|
654
|
-
const cmd = `${provider.cliCommand} ${command} 2>&1`;
|
|
655
|
-
const result = await runCommand(`cd "${workingDir}" && ${cmd}`, 300000);
|
|
656
|
-
if (result.exitCode === 0) {
|
|
657
|
-
return `✅ ${provider.name} deployment successful!\n\n${result.stdout}`;
|
|
658
|
-
}
|
|
659
|
-
// Provide error context and fixes
|
|
660
|
-
const output = result.stdout + result.stderr;
|
|
661
|
-
// AI-driven error analysis
|
|
662
|
-
const errorAnalysis = analyzeDeploymentError(output, provider);
|
|
663
|
-
return `❌ ${provider.name} deployment failed\n\n${output}\n\n${errorAnalysis}`;
|
|
664
|
-
},
|
|
665
|
-
},
|
|
666
|
-
{
|
|
667
|
-
name: 'cloud_init',
|
|
668
|
-
description: `Initialize a cloud project configuration.
|
|
669
|
-
|
|
670
|
-
Creates configuration files and sets up project structure for:
|
|
671
|
-
- Firebase (firebase.json, .firebaserc)
|
|
672
|
-
- Vercel (vercel.json)
|
|
673
|
-
- Netlify (netlify.toml)
|
|
674
|
-
- Cloudflare (wrangler.toml)
|
|
675
|
-
|
|
676
|
-
Auto-detects project type (React, Vue, Angular, Next.js, etc.) and configures appropriately.`,
|
|
677
|
-
parameters: {
|
|
678
|
-
type: 'object',
|
|
679
|
-
properties: {
|
|
680
|
-
provider: {
|
|
681
|
-
type: 'string',
|
|
682
|
-
description: 'Cloud provider to initialize: firebase, vercel, netlify, cloudflare',
|
|
683
|
-
},
|
|
684
|
-
project_type: {
|
|
685
|
-
type: 'string',
|
|
686
|
-
description: 'Project type: react, vue, angular, nextjs, static, node (auto-detected if not specified)',
|
|
687
|
-
},
|
|
688
|
-
},
|
|
689
|
-
required: ['provider'],
|
|
690
|
-
},
|
|
691
|
-
handler: async (args) => {
|
|
692
|
-
const providerId = args['provider']?.toLowerCase();
|
|
693
|
-
const projectType = args['project_type'];
|
|
694
|
-
// Detect project type if not specified
|
|
695
|
-
const detectedType = projectType || detectProjectType(workingDir);
|
|
696
|
-
const configs = {
|
|
697
|
-
firebase: () => generateFirebaseConfig(detectedType, workingDir),
|
|
698
|
-
vercel: () => generateVercelConfig(detectedType),
|
|
699
|
-
netlify: () => generateNetlifyConfig(detectedType),
|
|
700
|
-
cloudflare: () => generateCloudflareConfig(detectedType),
|
|
701
|
-
};
|
|
702
|
-
if (!configs[providerId]) {
|
|
703
|
-
return `Initialization not supported for: ${providerId}\n\nSupported: firebase, vercel, netlify, cloudflare`;
|
|
704
|
-
}
|
|
705
|
-
const config = configs[providerId]();
|
|
706
|
-
return `📝 ${CLOUD_PROVIDERS[providerId]?.name || providerId} Configuration\n\nProject type: ${detectedType}\n\n${config}`;
|
|
707
|
-
},
|
|
708
|
-
},
|
|
709
|
-
];
|
|
710
|
-
}
|
|
711
|
-
// Helper functions
|
|
712
|
-
function analyzeDeploymentError(output, provider) {
|
|
713
|
-
const suggestions = ['🔍 Error Analysis:'];
|
|
714
|
-
const lower = output.toLowerCase();
|
|
715
|
-
// Authentication issues
|
|
716
|
-
if (lower.includes('auth') || lower.includes('login') || lower.includes('token') || lower.includes('credential')) {
|
|
717
|
-
suggestions.push(`• Authentication issue detected`);
|
|
718
|
-
suggestions.push(` Fix: ${provider.loginCommand}`);
|
|
719
|
-
if (provider.envVars?.length) {
|
|
720
|
-
suggestions.push(` CI: Set ${provider.envVars[0]}`);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
// Permission issues
|
|
724
|
-
if (lower.includes('permission') || lower.includes('denied') || lower.includes('forbidden') || lower.includes('access')) {
|
|
725
|
-
suggestions.push(`• Permission issue detected`);
|
|
726
|
-
suggestions.push(` Check your account permissions/roles`);
|
|
727
|
-
}
|
|
728
|
-
// Build issues
|
|
729
|
-
if (lower.includes('build') || lower.includes('compile') || lower.includes('error') || lower.includes('failed')) {
|
|
730
|
-
suggestions.push(`• Build/compile error detected`);
|
|
731
|
-
suggestions.push(` Run your build command locally first`);
|
|
732
|
-
}
|
|
733
|
-
// Network issues
|
|
734
|
-
if (lower.includes('network') || lower.includes('timeout') || lower.includes('econnrefused') || lower.includes('dns')) {
|
|
735
|
-
suggestions.push(`• Network connectivity issue`);
|
|
736
|
-
suggestions.push(` Check your internet connection`);
|
|
737
|
-
}
|
|
738
|
-
// Quota/limits
|
|
739
|
-
if (lower.includes('quota') || lower.includes('limit') || lower.includes('exceeded') || lower.includes('billing')) {
|
|
740
|
-
suggestions.push(`• Quota/billing issue detected`);
|
|
741
|
-
suggestions.push(` Check your account billing status`);
|
|
742
|
-
}
|
|
743
|
-
// Config issues
|
|
744
|
-
if (lower.includes('config') || lower.includes('not found') || lower.includes('missing')) {
|
|
745
|
-
suggestions.push(`• Configuration issue detected`);
|
|
746
|
-
suggestions.push(` Use cloud_init to create configuration`);
|
|
747
|
-
}
|
|
748
|
-
if (suggestions.length === 1) {
|
|
749
|
-
suggestions.push(`• Unable to determine specific cause`);
|
|
750
|
-
suggestions.push(` Try running the command directly for more details`);
|
|
751
|
-
}
|
|
752
|
-
return suggestions.join('\n');
|
|
753
|
-
}
|
|
754
|
-
function detectProjectType(dir) {
|
|
755
|
-
// Check for common framework indicators
|
|
756
|
-
const packageJsonPath = path.join(dir, 'package.json');
|
|
757
|
-
if (fs.existsSync(packageJsonPath)) {
|
|
758
|
-
try {
|
|
759
|
-
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
|
|
760
|
-
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
761
|
-
if (deps['next'])
|
|
762
|
-
return 'nextjs';
|
|
763
|
-
if (deps['@angular/core'])
|
|
764
|
-
return 'angular';
|
|
765
|
-
if (deps['vue'])
|
|
766
|
-
return 'vue';
|
|
767
|
-
if (deps['react'])
|
|
768
|
-
return 'react';
|
|
769
|
-
if (deps['svelte'])
|
|
770
|
-
return 'svelte';
|
|
771
|
-
if (deps['express'] || deps['fastify'] || deps['koa'])
|
|
772
|
-
return 'node';
|
|
773
|
-
}
|
|
774
|
-
catch {
|
|
775
|
-
// Ignore parse errors
|
|
776
|
-
}
|
|
777
|
-
}
|
|
778
|
-
// Check for index.html (static site)
|
|
779
|
-
if (fs.existsSync(path.join(dir, 'index.html')) || fs.existsSync(path.join(dir, 'public', 'index.html'))) {
|
|
780
|
-
return 'static';
|
|
781
|
-
}
|
|
782
|
-
return 'unknown';
|
|
783
|
-
}
|
|
784
|
-
function generateFirebaseConfig(projectType, _dir) {
|
|
785
|
-
const buildDirs = {
|
|
786
|
-
react: 'build',
|
|
787
|
-
nextjs: 'out',
|
|
788
|
-
angular: 'dist',
|
|
789
|
-
vue: 'dist',
|
|
790
|
-
svelte: 'public',
|
|
791
|
-
static: 'public',
|
|
792
|
-
unknown: 'public',
|
|
793
|
-
};
|
|
794
|
-
const buildDir = buildDirs[projectType] || 'public';
|
|
795
|
-
const config = {
|
|
796
|
-
hosting: {
|
|
797
|
-
public: buildDir,
|
|
798
|
-
ignore: ['firebase.json', '**/.*', '**/node_modules/**'],
|
|
799
|
-
rewrites: [{ source: '**', destination: '/index.html' }],
|
|
800
|
-
},
|
|
801
|
-
};
|
|
802
|
-
return `Create firebase.json:
|
|
803
|
-
\`\`\`json
|
|
804
|
-
${JSON.stringify(config, null, 2)}
|
|
805
|
-
\`\`\`
|
|
806
|
-
|
|
807
|
-
Then run: firebase init
|
|
808
|
-
Select Hosting and follow the prompts.`;
|
|
809
|
-
}
|
|
810
|
-
function generateVercelConfig(projectType) {
|
|
811
|
-
const configs = {
|
|
812
|
-
nextjs: {}, // Vercel auto-detects Next.js
|
|
813
|
-
react: { buildCommand: 'npm run build', outputDirectory: 'build' },
|
|
814
|
-
vue: { buildCommand: 'npm run build', outputDirectory: 'dist' },
|
|
815
|
-
angular: { buildCommand: 'npm run build', outputDirectory: 'dist' },
|
|
816
|
-
static: { buildCommand: null, outputDirectory: '.' },
|
|
817
|
-
unknown: {},
|
|
818
|
-
};
|
|
819
|
-
const config = configs[projectType] || configs['unknown'];
|
|
820
|
-
return `Create vercel.json:
|
|
821
|
-
\`\`\`json
|
|
822
|
-
${JSON.stringify(config, null, 2)}
|
|
823
|
-
\`\`\`
|
|
824
|
-
|
|
825
|
-
Then run: vercel`;
|
|
826
|
-
}
|
|
827
|
-
function generateNetlifyConfig(projectType) {
|
|
828
|
-
const configs = {
|
|
829
|
-
react: { command: 'npm run build', publish: 'build' },
|
|
830
|
-
nextjs: { command: 'npm run build', publish: '.next' },
|
|
831
|
-
vue: { command: 'npm run build', publish: 'dist' },
|
|
832
|
-
angular: { command: 'npm run build', publish: 'dist' },
|
|
833
|
-
static: { command: '', publish: '.' },
|
|
834
|
-
unknown: { command: 'npm run build', publish: 'public' },
|
|
835
|
-
};
|
|
836
|
-
const config = configs[projectType] || configs['unknown'] || { command: 'npm run build', publish: 'public' };
|
|
837
|
-
return `Create netlify.toml:
|
|
838
|
-
\`\`\`toml
|
|
839
|
-
[build]
|
|
840
|
-
command = "${config.command}"
|
|
841
|
-
publish = "${config.publish}"
|
|
842
|
-
|
|
843
|
-
[[redirects]]
|
|
844
|
-
from = "/*"
|
|
845
|
-
to = "/index.html"
|
|
846
|
-
status = 200
|
|
847
|
-
\`\`\`
|
|
848
|
-
|
|
849
|
-
Then run: netlify deploy`;
|
|
850
|
-
}
|
|
851
|
-
function generateCloudflareConfig(projectType) {
|
|
852
|
-
return `Create wrangler.toml:
|
|
853
|
-
\`\`\`toml
|
|
854
|
-
name = "my-${projectType}-app"
|
|
855
|
-
main = "src/index.js"
|
|
856
|
-
compatibility_date = "${new Date().toISOString().split('T')[0]}"
|
|
857
|
-
|
|
858
|
-
[site]
|
|
859
|
-
bucket = "./dist"
|
|
860
|
-
\`\`\`
|
|
861
|
-
|
|
862
|
-
For Pages, run: npx wrangler pages project create`;
|
|
863
|
-
}
|
|
864
|
-
export { CLOUD_PROVIDERS, getFullCLIStatus, autoFixIssues };
|