PicoCreator / smol-dev-js

Smol personal AI, for smol incremental tasks in a JS project
MIT License
325 stars 53 forks source link

ReferenceError: child_process is not defined #8

Closed Lamer217 closed 1 year ago

Lamer217 commented 1 year ago

.smol-dev-js/config/config.json

{
    "provider": "openai",
    "gpt4_32k": false,
    "short_description": "NestJs microserivce with REST API",
    "src_include": [
        "**"
    ],
    "src_exclude": [
        "**/.*",
        "**/*.bin",
        "**/node_modules/**",
        "**/build/**",
        "**/bin/**"
    ]
}

.smol-dev-js/config/aibridge.json

{
    "provider": {
        "openai": "sk-***"
    },
    "providerLatencyAdd": 0,
    "cache": {
        "localJsonlDir": {
            "enable": true,
            "path": "./.smol-dev-js/ai-cache"
        },
        "mongoDB": {
            "enable": false,
            "url": "<CHANGE TO YOUR RESPECTIVE MONGODB URL>"
        },
        "promptCache": true,
        "embeddingCache": true
    },
    "providerRateLimit": 2
}

Environment:

Steps to reproduce:

  1. Install the smol-dev-js package globally with the pnpm.
  2. Create new empty directory to serve as the project directory.
  3. Run the smol-dev-js setup in the project directory.
  4. Setup the OpenAI as the main service provide and add a short desctiption. "Enter" through all the other choices.
  5. Run the smol-dev-js run command.
  6. Tell it you'll be using pnpm as the project package manager and you want the NestJs installed as the core dependency.
  7. Type "y" when prompted to confirm the suggested steps. No further input/interaction

Unexpected output:

🐣 [ai]: Working on the plan ...
🐣 [ai]: Studying 0 dependencies (in parallel)
🐣 [ai]: Performing any required modules install / file moves / deletion
Confirm the excution of 'npm install @nestjs/core @nestjs/common @nestjs/microservices @nestjs/platform-express reflect-metadata rxjs langchain'
? [you]: Install listed dependencies? › (Y/n)ReferenceError: child_process is not defined
    at getOperationFileMapFromPlan (/Users/malesh/Library/pnpm/global/5/.pnpm/smol-dev-js@1.2.15/node_modules/smol-dev-js/src/ai/seq/applyOperationFileMapFromPlan.js:70:3)
    at generateFilesFromPrompt (/Users/malesh/Library/pnpm/global/5/.pnpm/smol-dev-js@1.2.15/node_modules/smol-dev-js/src/ai/seq/generateFilesFromPrompt.js:106:8)
    at async TypeCommand.run [as _runHandler] (/Users/malesh/Library/pnpm/global/5/.pnpm/smol-dev-js@1.2.15/node_modules/smol-dev-js/src/cli/command/prompt.js:65:4)
    at async Promise.all (index 3)
shannonlal commented 1 year ago

@Lamer217 I ran into the same problem in my repo. I ended up just installing ( "child_process": "^1.0.2",) into my package.json of the project that I am working on. I guess you could also include it in global.

Alternatively you could submit a PR to this project about using this

PicoCreator commented 1 year ago

Im abit confused by this, because i thought child_process is native to node.js API https://nodejs.org/api/child_process.html

(dun mind adding it in as a PR, though)

shannonlal commented 1 year ago

@PicoCreator I walking through the code for this and running into another issue. For the ``` fetch not found


I am getting in Debugger in VS Code but now when I run through terminal.  Do you mind if I ask how you are debugging this?  Are you using VS Code Studio?  If so are you using Debugger?
PicoCreator commented 1 year ago

for fetch not found - you will need to switch to node 18 LTS

m4yankp commented 1 year ago

@PicoCreator https://github.com/PicoCreator/smol-dev-js/pull/15 Pr added.

PicoCreator commented 1 year ago

Merged =)