deepdebug-local-agent 0.3.1

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.
Files changed (50) hide show
  1. package/.dockerignore +24 -0
  2. package/.idea/deepdebug-local-agent.iml +12 -0
  3. package/.idea/modules.xml +8 -0
  4. package/.idea/vcs.xml +6 -0
  5. package/Dockerfile +46 -0
  6. package/cloudbuild.yaml +42 -0
  7. package/index.js +42 -0
  8. package/mcp-server.js +533 -0
  9. package/package.json +22 -0
  10. package/src/ai-engine.js +861 -0
  11. package/src/analyzers/config-analyzer.js +446 -0
  12. package/src/analyzers/controller-analyzer.js +429 -0
  13. package/src/analyzers/dto-analyzer.js +455 -0
  14. package/src/detectors/build-tool-detector.js +0 -0
  15. package/src/detectors/framework-detector.js +91 -0
  16. package/src/detectors/language-detector.js +89 -0
  17. package/src/detectors/multi-project-detector.js +191 -0
  18. package/src/detectors/service-detector.js +244 -0
  19. package/src/detectors.js +30 -0
  20. package/src/exec-utils.js +215 -0
  21. package/src/fs-utils.js +34 -0
  22. package/src/git/base-git-provider.js +384 -0
  23. package/src/git/git-provider-registry.js +110 -0
  24. package/src/git/github-provider.js +502 -0
  25. package/src/mcp-http-server.js +313 -0
  26. package/src/patch/patch-engine.js +339 -0
  27. package/src/patch-manager.js +816 -0
  28. package/src/patch.js +607 -0
  29. package/src/patch_bkp.js +154 -0
  30. package/src/ports.js +69 -0
  31. package/src/routes/workspace.route.js +528 -0
  32. package/src/runtimes/base-runtime.js +290 -0
  33. package/src/runtimes/java/gradle-runtime.js +378 -0
  34. package/src/runtimes/java/java-integrations.js +339 -0
  35. package/src/runtimes/java/maven-runtime.js +418 -0
  36. package/src/runtimes/node/node-integrations.js +247 -0
  37. package/src/runtimes/node/npm-runtime.js +466 -0
  38. package/src/runtimes/node/yarn-runtime.js +354 -0
  39. package/src/runtimes/runtime-registry.js +256 -0
  40. package/src/server-local.js +576 -0
  41. package/src/server.js +4565 -0
  42. package/src/utils/environment-diagnostics.js +666 -0
  43. package/src/utils/exec-utils.js +264 -0
  44. package/src/utils/fs-utils.js +218 -0
  45. package/src/workspace/detect-port.js +176 -0
  46. package/src/workspace/file-reader.js +54 -0
  47. package/src/workspace/git-client.js +0 -0
  48. package/src/workspace/process-manager.js +619 -0
  49. package/src/workspace/scanner.js +72 -0
  50. package/src/workspace-manager.js +172 -0
package/.dockerignore ADDED
@@ -0,0 +1,24 @@
1
+ node_modules
2
+ npm-debug.log
3
+ .git
4
+ .gitignore
5
+ .env
6
+ .env.*
7
+ *.md
8
+ .DS_Store
9
+ Thumbs.db
10
+ .idea
11
+ .vscode
12
+ *.log
13
+ coverage
14
+ .nyc_output
15
+ test
16
+ tests
17
+ __tests__
18
+ *.test.js
19
+ *.spec.js
20
+ .idea/deepdebug-local-agent.iml
21
+ .idea/modules.xml
22
+ node_modules/
23
+ src/.DS_Store
24
+ src/analyzers/
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$">
5
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
+ <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
+ </content>
9
+ <orderEntry type="inheritedJdk" />
10
+ <orderEntry type="sourceFolder" forTests="false" />
11
+ </component>
12
+ </module>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/deepdebug-local-agent.iml" filepath="$PROJECT_DIR$/.idea/deepdebug-local-agent.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
package/Dockerfile ADDED
@@ -0,0 +1,46 @@
1
+ # ============================================
2
+ # Dockerfile - InspTech Local Agent
3
+ # Node.js Application for GCP Cloud Run
4
+ # ============================================
5
+
6
+ FROM node:20-alpine
7
+
8
+ # Set working directory
9
+ WORKDIR /app
10
+
11
+ # Install git (needed for some operations)
12
+ RUN apk add --no-cache git bash
13
+
14
+ # Copy package files first for better layer caching
15
+ COPY package*.json ./
16
+
17
+ # Install dependencies (production only)
18
+ RUN npm ci --only=production
19
+
20
+ # Copy source code
21
+ COPY src/ ./src/
22
+ COPY index.js ./
23
+
24
+ # Create non-root user for security
25
+ RUN addgroup -g 1001 -S nodejs && \
26
+ adduser -S deepdebug -u 1001 -G nodejs
27
+
28
+ # Create workspace directory for temporary files
29
+ RUN mkdir -p /app/workspaces && chown -R deepdebug:nodejs /app
30
+
31
+ # Switch to non-root user
32
+ USER deepdebug
33
+
34
+ # Expose port (Cloud Run uses PORT env variable)
35
+ EXPOSE 8080
36
+
37
+ # Set environment variables
38
+ ENV NODE_ENV=production
39
+ ENV PORT=8080
40
+
41
+ # Health check
42
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
43
+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
44
+
45
+ # Start the application (uses src/server.js as defined in package.json)
46
+ CMD ["node", "src/server.js"]
@@ -0,0 +1,42 @@
1
+ steps:
2
+ # Step 1: Build Docker image
3
+ - name: 'gcr.io/cloud-builders/docker'
4
+ args:
5
+ - 'build'
6
+ - '-t'
7
+ - 'us-central1-docker.pkg.dev/insptechai/deepdebug-docker/local-agent:latest'
8
+ - '.'
9
+ timeout: '600s'
10
+
11
+ # Step 2: Push to Artifact Registry
12
+ - name: 'gcr.io/cloud-builders/docker'
13
+ args:
14
+ - 'push'
15
+ - 'us-central1-docker.pkg.dev/insptechai/deepdebug-docker/local-agent:latest'
16
+
17
+ # Step 3: Deploy to Cloud Run
18
+ - name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
19
+ entrypoint: 'gcloud'
20
+ args:
21
+ - 'run'
22
+ - 'deploy'
23
+ - 'deepdebug-local-agent'
24
+ - '--image=us-central1-docker.pkg.dev/insptechai/deepdebug-docker/local-agent:latest'
25
+ - '--region=us-central1'
26
+ - '--platform=managed'
27
+ - '--allow-unauthenticated'
28
+ - '--memory=1Gi'
29
+ - '--cpu=1'
30
+ - '--min-instances=0'
31
+ - '--max-instances=5'
32
+ - '--port=8080'
33
+ - '--timeout=300'
34
+ - '--set-env-vars=NODE_ENV=production'
35
+
36
+ images:
37
+ - 'us-central1-docker.pkg.dev/insptechai/deepdebug-docker/local-agent:latest'
38
+
39
+ options:
40
+ logging: CLOUD_LOGGING_ONLY
41
+
42
+ timeout: '1200s'
package/index.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * InspTech Local Agent
3
+ *
4
+ * Módulo principal que exporta todas as funcionalidades.
5
+ */
6
+
7
+ // Runtimes
8
+ export { BaseRuntime } from './runtimes/base-runtime.js';
9
+ export { RuntimeRegistry, getRuntimeRegistry, initializeRuntimes } from './runtimes/runtime-registry.js';
10
+ export { MavenRuntime } from './runtimes/java/maven-runtime.js';
11
+ export { GradleRuntime } from './runtimes/java/gradle-runtime.js';
12
+ export { NpmRuntime } from './runtimes/node/npm-runtime.js';
13
+ export { YarnRuntime } from './runtimes/node/yarn-runtime.js';
14
+
15
+ // Git Providers
16
+ export { BaseGitProvider } from './git/base-git-provider.js';
17
+ export { GitHubProvider } from './git/github-provider.js';
18
+ export { GitProviderRegistry, getGitProviderRegistry } from './git/git-provider-registry.js';
19
+
20
+ // Integration Analyzers
21
+ export { JavaIntegrationAnalyzer } from './runtimes/java/java-integrations.js';
22
+ export { NodeIntegrationAnalyzer } from './runtimes/node/node-integrations.js';
23
+
24
+ // Patch Engine
25
+ export {
26
+ parsePatch,
27
+ applyPatch,
28
+ applyUnifiedDiff,
29
+ createBackup,
30
+ restoreBackup,
31
+ extractAffectedFiles
32
+ } from './patch/patch-engine.js';
33
+
34
+ // Process Manager
35
+ export { ProcessManager } from './process/process-manager.js';
36
+
37
+ // Utils
38
+ export * as fsUtils from './utils/fs-utils.js';
39
+ export * as execUtils from './utils/exec-utils.js';
40
+
41
+ // Version
42
+ export const VERSION = '2.0.0';