camp-codegen


Namecamp-codegen JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryCamp Codegen: Python SDK and colorful CLI for AI-assisted smart contract generation, compilation, and deployment
upload_time2025-09-01 17:14:59
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT
keywords blockchain solidity deployment ai sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Camp Codegen

Camp Codegen is a Python SDK and colorful interactive CLI for AI‑assisted smart contract generation, compilation, and deployment.

- Default API: `https://acadcodegen-production.up.railway.app`
- Default auth header: `X-API-Key: <key>` (configurable)
- Maintained by: BlockX Internet — https://blockxint.com

## Features

- AI → Compile → Deploy pipeline (one prompt to deployed contract)
- One‑click ERC20 deployment (with default owner wallet)
- Artifacts access (sources, ABIs, scripts, combined JSON)
- Live job status and log streaming
- AI helpers: generate, fix, and compile Solidity
- Colorful, interactive CLI (Rich‑powered)

## Installation

From PyPI:
```bash
pip install camp-codegen
```

Or editable install in a repo checkout:
```bash
pip install -e .
```

## Quick Start (SDK)

```python
from acad_sdk import AcadClient

# Uses default Railway API and built-in defaults (network=basecamp, etc.)
client = AcadClient()

# Start the AI pipeline with minimal inputs
job_id = client.start_pipeline_auto(
    prompt="ERC721 with minting",  # max iters/filename auto
)

# Wait and stream logs until completion
final = client.wait_for_completion(job_id, stream_logs=True)
print("Final:", final)

# Fetch artifacts
sources = client.get_sources(job_id)
abis = client.get_abis(job_id)
scripts = client.get_scripts(job_id)
```

### One‑click ERC20

```python
from acad_sdk import AcadClient

client = AcadClient()
res = client.deploy_erc20(
    name="Camp Token",
    symbol="CAMP",
    initial_supply="1000000",
    # network/owner auto-filled from defaults
    network=None,
    owner=None,
)
print(res)
```

## Quick Start (CLI)

Camp Codegen provides two equivalent entry points:

```bash
camp
# or
acad
```

By default, the CLI uses built-in defaults and environment variables (if set). There are no auth prompts; set env vars if needed. The menu offers:

- AI pipeline
- Job status
- Log streaming
- Artifacts (print or save)
- ERC20 deploy
- AI helpers (generate/fix/compile)

### CLI Examples

- __Run the AI pipeline__

```bash
camp
# Choose: "Run AI → Compile → Deploy pipeline"
# Prompt: ERC721 with minting
# (network/maxIters/filename are auto)
# Wait for completion and stream logs: yes
```

- __Check status__

```bash
camp
# Choose: "Check job status"
# Job ID: <paste job id>
```

- __Stream logs__

```bash
camp
# Choose: "Stream job logs"
# Job ID: <paste job id>
# Start cursor: 0
# Follow: yes
```

- __Fetch artifacts__ (print or save to folder)

```bash
camp
# Choose: "Fetch artifacts"
# Job ID: <paste job id>
# Include: all   # or sources|abis|scripts
# Output directory (optional): ./artifacts
```

- __Deploy ERC20__ (uses default owner if not provided)

```bash
camp
# Choose: "One-click ERC20 deploy"
# Name: Camp Token
# Symbol: CAMP
# Initial supply: 1000000
# (network/owner auto)
```

- __Environment overrides__

```bash
# optional: provide auth and tweak defaults
export ACAD_API_KEY="<your-key>"
export ACAD_AUTH_HEADER="X-API-Key"
export ACAD_BASE_URL="https://acadcodegen-production.up.railway.app"
export ACAD_DEFAULT_NETWORK="basecamp"
export ACAD_DEFAULT_OWNER="0xYourWalletAddress"
export ACAD_MAX_ITERS="5"
export ACAD_DEFAULT_FILENAME="AIGenerated.sol"
camp
```

## Configuration

Environment variables:

- `ACAD_API_KEY` – API key (optional)
- `ACAD_AUTH_HEADER` – auth header name (default: `X-API-Key`)
- `ACAD_BASE_URL` – base URL (default: production Railway)
- `ACAD_DEFAULT_NETWORK` – default network (default: `basecamp`)
- `ACAD_DEFAULT_OWNER` – default owner for ERC20 (built-in default provided)
- `ACAD_MAX_ITERS` – default max iterations for pipeline (default: `5`)
- `ACAD_DEFAULT_FILENAME` – default filename for generated code (default: `AIGenerated.sol`)

## Error Handling

Errors are raised as `AcadError` with fields `status`, `code`, and `details`. The CLI pretty‑prints error details.

## Project Layout

- `acad_sdk/` – SDK package
  - `client.py` – `AcadClient` and `AcadError`
  - `cli.py` – Rich‑powered CLI entrypoint (also exposed as `camp` and `acad`)
- `acad_cli.py` – standalone CLI script (same UX)

## License & Attribution

MIT License.

Created by BlockX Internet — https://blockxint.com

## API Reference (Production)

- Base URL: `https://acadcodegen-production.up.railway.app`
- Auth header: `X-API-Key: <your-key>` (optional if your deployment allows anonymous)

### 1) AI Pipeline

Start the AI → Compile → Deploy pipeline

Request
```http
POST /api/ai/pipeline
Content-Type: application/json
X-API-Key: <your-key>

{
  "prompt": "ERC721 with minting",
  "network": "basecamp",
  "maxIters": 5,
  "filename": "AIGenerated.sol"
}
```

Response (job started)
```json
{
  "ok": true,
  "job": {
    "id": "ai_pipeline_<uuid>",
    "state": "running",
    "progress": 5,
    "step": "init"
  }
}
```

### 2) Job Tracking

Status
```http
GET /api/job/:id/status
```

Response (completed)
```json
{
  "ok": true,
  "data": {
    "id": "ai_pipeline_<uuid>",
    "state": "completed",
    "progress": 100,
    "step": "deploy",
    "result": {
      "network": "basecamp",
      "deployer": "0xDeployerAddress",
      "contract": "MyContract",
      "address": "0xDeployedContract",
      "params": { "args": [] },
      "explorerUrl": "https://basecamp.cloud.blockscout.com/address/0xDeployedContract"
    }
  }
}
```

Logs (stream)
```http
GET /api/job/:id/logs?since=0
```

```json
{
  "ok": true,
  "data": {
    "logs": [
      { "level": "info", "msg": "Compiled successfully" },
      { "level": "info", "msg": "Deployed at 0xDeployedContract" }
    ],
    "since": 2
  }
}
```

### 3) Artifacts

Combined
```http
GET /api/artifacts?include=all&jobId=<jobId>
```

Sources
```http
GET /api/artifacts/sources?jobId=<jobId>
```

ABIs
```http
GET /api/artifacts/abis?jobId=<jobId>
```

Scripts
```http
GET /api/artifacts/scripts?jobId=<jobId>
```

### 4) One‑Click ERC20

Request
```http
POST /api/deploy/erc20
Content-Type: application/json
X-API-Key: <your-key>

{
  "name": "Camp Token",
  "symbol": "CAMP",
  "initialSupply": "1000000",
  "owner": "0xa58DCCb0F17279abD1d0D9069Aa8711Df4a4c58E",
  "network": "basecamp"
}
```

Response
```json
{
  "ok": true,
  "result": {
    "network": "basecamp",
    "deployer": "0xDeployerAddress",
    "contract": "BusinessToken",
    "address": "0xNewTokenAddress",
    "params": {
      "name": "Camp Token",
      "symbol": "CAMP",
      "initialSupply": "1000000",
      "owner": "0xa58DCCb0F17279abD1d0D9069Aa8711Df4a4c58E"
    },
    "explorerUrl": "https://basecamp.cloud.blockscout.com/address/0xNewTokenAddress"
  }
}
```

## Testing

Here are simple ways to verify the SDK and CLI locally.

- __Install from PyPI__

```bash
python -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
pip install camp-codegen
```

- __SDK import smoke test__

```bash
python - <<'PY'
from acad_sdk import AcadClient
print('AcadClient OK:', bool(AcadClient))
PY
```

- __CLI help and basic navigation__

```bash
camp --help || acad --help
camp
# explore the menu; press Ctrl+C to exit
```

- __End-to-end pipeline (integration test)__

```bash
camp
# Run "AI → Compile → Deploy pipeline" with the defaults
# Confirm streaming logs and wait for completion
```

- __Artifacts retrieval__

```bash
camp
# Choose "Fetch artifacts" → Include: all → Output dir: ./artifacts
ls -la ./artifacts
```

- __ERC20 deploy__

```bash
camp
# Choose "One-click ERC20 deploy" (network/owner auto)
```

- __From source (editable)__

```bash
git clone <this repo>
cd <repo>
python -m venv .venv && source .venv/bin/activate
pip install -e .
camp
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "camp-codegen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "blockchain, solidity, deployment, ai, sdk",
    "author": null,
    "author_email": "BlockX AI International <mohit@blockxint.com>",
    "download_url": "https://files.pythonhosted.org/packages/cc/ba/5966ec84ee8440ca70c3dc7338c574bcfd8f61f3def42f6eeb8b62a917c0/camp_codegen-2.0.0.tar.gz",
    "platform": null,
    "description": "# Camp Codegen\n\nCamp Codegen is a Python SDK and colorful interactive CLI for AI\u2011assisted smart contract generation, compilation, and deployment.\n\n- Default API: `https://acadcodegen-production.up.railway.app`\n- Default auth header: `X-API-Key: <key>` (configurable)\n- Maintained by: BlockX Internet \u2014 https://blockxint.com\n\n## Features\n\n- AI \u2192 Compile \u2192 Deploy pipeline (one prompt to deployed contract)\n- One\u2011click ERC20 deployment (with default owner wallet)\n- Artifacts access (sources, ABIs, scripts, combined JSON)\n- Live job status and log streaming\n- AI helpers: generate, fix, and compile Solidity\n- Colorful, interactive CLI (Rich\u2011powered)\n\n## Installation\n\nFrom PyPI:\n```bash\npip install camp-codegen\n```\n\nOr editable install in a repo checkout:\n```bash\npip install -e .\n```\n\n## Quick Start (SDK)\n\n```python\nfrom acad_sdk import AcadClient\n\n# Uses default Railway API and built-in defaults (network=basecamp, etc.)\nclient = AcadClient()\n\n# Start the AI pipeline with minimal inputs\njob_id = client.start_pipeline_auto(\n    prompt=\"ERC721 with minting\",  # max iters/filename auto\n)\n\n# Wait and stream logs until completion\nfinal = client.wait_for_completion(job_id, stream_logs=True)\nprint(\"Final:\", final)\n\n# Fetch artifacts\nsources = client.get_sources(job_id)\nabis = client.get_abis(job_id)\nscripts = client.get_scripts(job_id)\n```\n\n### One\u2011click ERC20\n\n```python\nfrom acad_sdk import AcadClient\n\nclient = AcadClient()\nres = client.deploy_erc20(\n    name=\"Camp Token\",\n    symbol=\"CAMP\",\n    initial_supply=\"1000000\",\n    # network/owner auto-filled from defaults\n    network=None,\n    owner=None,\n)\nprint(res)\n```\n\n## Quick Start (CLI)\n\nCamp Codegen provides two equivalent entry points:\n\n```bash\ncamp\n# or\nacad\n```\n\nBy default, the CLI uses built-in defaults and environment variables (if set). There are no auth prompts; set env vars if needed. The menu offers:\n\n- AI pipeline\n- Job status\n- Log streaming\n- Artifacts (print or save)\n- ERC20 deploy\n- AI helpers (generate/fix/compile)\n\n### CLI Examples\n\n- __Run the AI pipeline__\n\n```bash\ncamp\n# Choose: \"Run AI \u2192 Compile \u2192 Deploy pipeline\"\n# Prompt: ERC721 with minting\n# (network/maxIters/filename are auto)\n# Wait for completion and stream logs: yes\n```\n\n- __Check status__\n\n```bash\ncamp\n# Choose: \"Check job status\"\n# Job ID: <paste job id>\n```\n\n- __Stream logs__\n\n```bash\ncamp\n# Choose: \"Stream job logs\"\n# Job ID: <paste job id>\n# Start cursor: 0\n# Follow: yes\n```\n\n- __Fetch artifacts__ (print or save to folder)\n\n```bash\ncamp\n# Choose: \"Fetch artifacts\"\n# Job ID: <paste job id>\n# Include: all   # or sources|abis|scripts\n# Output directory (optional): ./artifacts\n```\n\n- __Deploy ERC20__ (uses default owner if not provided)\n\n```bash\ncamp\n# Choose: \"One-click ERC20 deploy\"\n# Name: Camp Token\n# Symbol: CAMP\n# Initial supply: 1000000\n# (network/owner auto)\n```\n\n- __Environment overrides__\n\n```bash\n# optional: provide auth and tweak defaults\nexport ACAD_API_KEY=\"<your-key>\"\nexport ACAD_AUTH_HEADER=\"X-API-Key\"\nexport ACAD_BASE_URL=\"https://acadcodegen-production.up.railway.app\"\nexport ACAD_DEFAULT_NETWORK=\"basecamp\"\nexport ACAD_DEFAULT_OWNER=\"0xYourWalletAddress\"\nexport ACAD_MAX_ITERS=\"5\"\nexport ACAD_DEFAULT_FILENAME=\"AIGenerated.sol\"\ncamp\n```\n\n## Configuration\n\nEnvironment variables:\n\n- `ACAD_API_KEY` \u2013 API key (optional)\n- `ACAD_AUTH_HEADER` \u2013 auth header name (default: `X-API-Key`)\n- `ACAD_BASE_URL` \u2013 base URL (default: production Railway)\n- `ACAD_DEFAULT_NETWORK` \u2013 default network (default: `basecamp`)\n- `ACAD_DEFAULT_OWNER` \u2013 default owner for ERC20 (built-in default provided)\n- `ACAD_MAX_ITERS` \u2013 default max iterations for pipeline (default: `5`)\n- `ACAD_DEFAULT_FILENAME` \u2013 default filename for generated code (default: `AIGenerated.sol`)\n\n## Error Handling\n\nErrors are raised as `AcadError` with fields `status`, `code`, and `details`. The CLI pretty\u2011prints error details.\n\n## Project Layout\n\n- `acad_sdk/` \u2013 SDK package\n  - `client.py` \u2013 `AcadClient` and `AcadError`\n  - `cli.py` \u2013 Rich\u2011powered CLI entrypoint (also exposed as `camp` and `acad`)\n- `acad_cli.py` \u2013 standalone CLI script (same UX)\n\n## License & Attribution\n\nMIT License.\n\nCreated by BlockX Internet \u2014 https://blockxint.com\n\n## API Reference (Production)\n\n- Base URL: `https://acadcodegen-production.up.railway.app`\n- Auth header: `X-API-Key: <your-key>` (optional if your deployment allows anonymous)\n\n### 1) AI Pipeline\n\nStart the AI \u2192 Compile \u2192 Deploy pipeline\n\nRequest\n```http\nPOST /api/ai/pipeline\nContent-Type: application/json\nX-API-Key: <your-key>\n\n{\n  \"prompt\": \"ERC721 with minting\",\n  \"network\": \"basecamp\",\n  \"maxIters\": 5,\n  \"filename\": \"AIGenerated.sol\"\n}\n```\n\nResponse (job started)\n```json\n{\n  \"ok\": true,\n  \"job\": {\n    \"id\": \"ai_pipeline_<uuid>\",\n    \"state\": \"running\",\n    \"progress\": 5,\n    \"step\": \"init\"\n  }\n}\n```\n\n### 2) Job Tracking\n\nStatus\n```http\nGET /api/job/:id/status\n```\n\nResponse (completed)\n```json\n{\n  \"ok\": true,\n  \"data\": {\n    \"id\": \"ai_pipeline_<uuid>\",\n    \"state\": \"completed\",\n    \"progress\": 100,\n    \"step\": \"deploy\",\n    \"result\": {\n      \"network\": \"basecamp\",\n      \"deployer\": \"0xDeployerAddress\",\n      \"contract\": \"MyContract\",\n      \"address\": \"0xDeployedContract\",\n      \"params\": { \"args\": [] },\n      \"explorerUrl\": \"https://basecamp.cloud.blockscout.com/address/0xDeployedContract\"\n    }\n  }\n}\n```\n\nLogs (stream)\n```http\nGET /api/job/:id/logs?since=0\n```\n\n```json\n{\n  \"ok\": true,\n  \"data\": {\n    \"logs\": [\n      { \"level\": \"info\", \"msg\": \"Compiled successfully\" },\n      { \"level\": \"info\", \"msg\": \"Deployed at 0xDeployedContract\" }\n    ],\n    \"since\": 2\n  }\n}\n```\n\n### 3) Artifacts\n\nCombined\n```http\nGET /api/artifacts?include=all&jobId=<jobId>\n```\n\nSources\n```http\nGET /api/artifacts/sources?jobId=<jobId>\n```\n\nABIs\n```http\nGET /api/artifacts/abis?jobId=<jobId>\n```\n\nScripts\n```http\nGET /api/artifacts/scripts?jobId=<jobId>\n```\n\n### 4) One\u2011Click ERC20\n\nRequest\n```http\nPOST /api/deploy/erc20\nContent-Type: application/json\nX-API-Key: <your-key>\n\n{\n  \"name\": \"Camp Token\",\n  \"symbol\": \"CAMP\",\n  \"initialSupply\": \"1000000\",\n  \"owner\": \"0xa58DCCb0F17279abD1d0D9069Aa8711Df4a4c58E\",\n  \"network\": \"basecamp\"\n}\n```\n\nResponse\n```json\n{\n  \"ok\": true,\n  \"result\": {\n    \"network\": \"basecamp\",\n    \"deployer\": \"0xDeployerAddress\",\n    \"contract\": \"BusinessToken\",\n    \"address\": \"0xNewTokenAddress\",\n    \"params\": {\n      \"name\": \"Camp Token\",\n      \"symbol\": \"CAMP\",\n      \"initialSupply\": \"1000000\",\n      \"owner\": \"0xa58DCCb0F17279abD1d0D9069Aa8711Df4a4c58E\"\n    },\n    \"explorerUrl\": \"https://basecamp.cloud.blockscout.com/address/0xNewTokenAddress\"\n  }\n}\n```\n\n## Testing\n\nHere are simple ways to verify the SDK and CLI locally.\n\n- __Install from PyPI__\n\n```bash\npython -m venv .venv && source .venv/bin/activate\npython -m pip install --upgrade pip\npip install camp-codegen\n```\n\n- __SDK import smoke test__\n\n```bash\npython - <<'PY'\nfrom acad_sdk import AcadClient\nprint('AcadClient OK:', bool(AcadClient))\nPY\n```\n\n- __CLI help and basic navigation__\n\n```bash\ncamp --help || acad --help\ncamp\n# explore the menu; press Ctrl+C to exit\n```\n\n- __End-to-end pipeline (integration test)__\n\n```bash\ncamp\n# Run \"AI \u2192 Compile \u2192 Deploy pipeline\" with the defaults\n# Confirm streaming logs and wait for completion\n```\n\n- __Artifacts retrieval__\n\n```bash\ncamp\n# Choose \"Fetch artifacts\" \u2192 Include: all \u2192 Output dir: ./artifacts\nls -la ./artifacts\n```\n\n- __ERC20 deploy__\n\n```bash\ncamp\n# Choose \"One-click ERC20 deploy\" (network/owner auto)\n```\n\n- __From source (editable)__\n\n```bash\ngit clone <this repo>\ncd <repo>\npython -m venv .venv && source .venv/bin/activate\npip install -e .\ncamp\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Camp Codegen: Python SDK and colorful CLI for AI-assisted smart contract generation, compilation, and deployment",
    "version": "2.0.0",
    "project_urls": {
        "API": "https://acadcodegen-production.up.railway.app",
        "Homepage": "https://blockxint.com",
        "Source": "https://blockxint.com"
    },
    "split_keywords": [
        "blockchain",
        " solidity",
        " deployment",
        " ai",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "afeaebf5f3902a603c8a332fecf6ffee72e81b1f91dc92d84fece913e2c83ac4",
                "md5": "20d3c9af927ad1c2953b3a4a02f37a94",
                "sha256": "6777176f370465e958a200e6578ed8fb6202ce1c0e4dac221f34234336a35e19"
            },
            "downloads": -1,
            "filename": "camp_codegen-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "20d3c9af927ad1c2953b3a4a02f37a94",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 11465,
            "upload_time": "2025-09-01T17:14:57",
            "upload_time_iso_8601": "2025-09-01T17:14:57.897912Z",
            "url": "https://files.pythonhosted.org/packages/af/ea/ebf5f3902a603c8a332fecf6ffee72e81b1f91dc92d84fece913e2c83ac4/camp_codegen-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ccba5966ec84ee8440ca70c3dc7338c574bcfd8f61f3def42f6eeb8b62a917c0",
                "md5": "7aa1d56230547e2ae3af3c1d24c2d620",
                "sha256": "7bf6b81bf5fa5cf8a49c578a5add14e5008d36cd26bc2533b1f9392348438202"
            },
            "downloads": -1,
            "filename": "camp_codegen-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "7aa1d56230547e2ae3af3c1d24c2d620",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 12819,
            "upload_time": "2025-09-01T17:14:59",
            "upload_time_iso_8601": "2025-09-01T17:14:59.371255Z",
            "url": "https://files.pythonhosted.org/packages/cc/ba/5966ec84ee8440ca70c3dc7338c574bcfd8f61f3def42f6eeb8b62a917c0/camp_codegen-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-01 17:14:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "camp-codegen"
}
        
Elapsed time: 1.25846s