SuperCode: explicit-hole AI implementation generator and minimal super frontend
Project description
SuperCode
SuperCode is an experimental AI hole-filling compiler/interpreter frontend.
It does not rewrite your source code.
It only fills explicit super_func, super_export_func, super_struct, and super_class holes, stores generated implementations under .supercode/, and links or imports them back through super.
Warning
- SuperCode is experimental.
- It calls an LLM.
- It generates code.
- Generated code may be wrong.
- Inspect
.supercode/implbefore trusting generated code. - Do not use SuperCode for production, security-critical, financial, safety-critical, or unreviewed code paths.
Installation
Arch Linux:
yay -S python-supercode-cli-git
Linux / macOS:
uv tool install supercode-cli
Alternative:
pipx install supercode-cli
If you know exactly how you want to manage your Python environment, you can also install with pip, but uv tool install / pipx / AUR are the recommended user-facing paths.
Verify:
super --help
super init
Names:
- PyPI distribution name:
supercode-cli - AUR package name:
python-supercode-cli-git - CLI command:
super - Python import name:
supercode - C header:
supercode.h - C++ header:
supercode.hpp
Quick Start
super init
export OPENROUTER_API_KEY="your_api_key_here"
# edit supercode.toml if needed
super examples/c_local_func/main.c -o /tmp/sc-local
/tmp/sc-local
super inspect
LLM Configuration
SuperCode reads LLM settings from supercode.toml.
- Do not put a raw API key into
supercode.toml. api_key_envis the name of an environment variable, not the key itself.- Put the actual key into your shell environment.
OpenRouter + DeepSeek example:
[llm]
provider = "openai-compatible"
base_url = "https://openrouter.ai/api/v1"
api_key_env = "OPENROUTER_API_KEY"
model = "deepseek/deepseek-v4-pro"
temperature = 0.1
export OPENROUTER_API_KEY="your_api_key_here"
DeepSeek direct example:
[llm]
provider = "openai-compatible"
base_url = "https://api.deepseek.com"
api_key_env = "DEEPSEEK_API_KEY"
model = "deepseek-v4-flash"
temperature = 0.1
export DEEPSEEK_API_KEY="your_api_key_here"
The model field is user-configurable. Change it to match the provider and model you want to use.
Minimal LLM Config Change
If you only want to change the key, change the environment variable value:
export OPENROUTER_API_KEY="new_key_here"
If you want to switch providers, only change these four fields in supercode.toml:
providerbase_urlapi_key_envmodel
Example:
[llm]
provider = "openai-compatible"
base_url = "https://your-provider.example/v1"
api_key_env = "YOUR_PROVIDER_API_KEY"
model = "your/model-name"
export YOUR_PROVIDER_API_KEY="your_key_here"
Mock Mode
--mockdoes not call an LLM.--mockdoes not validate AI generation quality.--mockonly validates scanner/emitter/build plumbing.- Real SuperCode behavior requires a real LLM backend.
Example:
super examples/c_local_func/main.c -o /tmp/sc-local --mock
C Local super_func
#include <stdio.h>
#include <supercode.h>
int mode_min_tie(const int *a, int n) {
// Return the most frequent element; if there is a tie, return the smallest value.
return super_func(int, a, n);
}
int main(void) {
int a[] = {3, 1, 3, 1, 1};
printf("%d\n", mode_min_tie(a, 5));
return 0;
}
- User source is not rewritten.
.supercode/implcontains only the generated helper implementation.- It does not contain a copy of the full source file.
C super_export_func and Python Binding
super_export_func(mode_min_tie, int, const int *a, int n);
This generates:
- a C implementation
- a shared library
- a Python
ctypesbinding
Python usage:
from supercode_generated import mode_min_tie
print(mode_min_tie([3, 1, 3, 1, 1]))
C super_struct
// An int dynamic array with create, destroy, push, get, and size operations.
super_struct(IntVec);
super_struct(IntVec)generates an opaque C API.- The struct layout lives in
.supercode/impl. - The user only sees declarations.
C++ super_class
#include <iostream>
#include <supercode.hpp>
// A fixed-capacity LRU cache with int keys and double values.
super_class(LRUCache);
int main() {
LRUCache c(2);
c.put(1, 3.14);
std::cout << c.get(1) << "\n";
}
- The generated C++ class uses a PImpl-style implementation.
- User source is not rewritten.
Python Local sc.super_func
import supercode as sc
def mode_min_tie(a: list[int]) -> int:
# Return the most frequent element; if there is a tie, return the smallest value.
return sc.super_func(int, a)
print(mode_min_tie([3, 1, 3, 1, 1]))
- Run Python SuperCode source files with
super file.py. - Plain
python file.pywill fail unless a generated registry already exists. - Runtime dispatch does not call the LLM.
IDE Support
super init
This generates:
supercode.toml.clangdpyrightconfig.json.supercode/include/supercode_ide.h
Notes:
- Run
super init --forceif you have older generated config files. - Restart clangd / pyright after
super init --force. .clangduses packaged include paths.pyrightconfig.jsonadds runtime and generated paths.
IDE Troubleshooting
If clangd still reports supercode.h file not found, Type specifier, or undeclared function:
- Re-run:
super init --force
-
Restart clangd / your LSP client.
-
Confirm that
.clangduses absolute packaged include paths. -
For Python IDE support, confirm that
pyrightconfig.jsoncontains:..supercode/bindings/python.supercode/py_impl- the SuperCode runtime package path
-
If Python still reports
import not found, restart pyright / basedpyright / your Python LSP. -
Validate syntax directly:
clang -fsyntax-only \
-I"$PWD/include" \
-I"$PWD/.supercode/include" \
-DSUPERCODE_IDE=1 \
-include "$PWD/.supercode/include/supercode_ide.h" \
examples/c_export_func/main.c
clang++ -std=c++17 -fsyntax-only \
-I"$PWD/include" \
-I"$PWD/.supercode/include" \
-DSUPERCODE_IDE=1 \
-include "$PWD/.supercode/include/supercode_ide.h" \
examples/cpp_class/main.cpp
What SuperCode Does Not Do
- It does not rewrite source files.
- It does not copy full source files into
.supercode. - It does not fix syntax errors.
- It does not make bare
gcc,g++, orpythonunderstand SuperCode holes. - Use
super, not bare compilers/interpreters, for files containing SuperCode holes. - It is not a production compiler.
Current Support Matrix
Supported:
- C local
super_func - C
super_export_func - C
super_struct - C++
super_class - Python local
sc.super_func - Python
ctypesbinding for exported C functions - clangd / pyright initialization through
super init
Not yet supported or still experimental:
- CUDA
- Rust
- Java
- full
supermake - complex multi-file projects
- complex C/C++ macros/templates
- production use
Boundaries
- SuperCode does not modify user source files.
- SuperCode does not copy full source files into
.supercode. .supercode/implcontains generated implementation units only.super initdoes not call an LLM and does not generate implementations.- The manifest stores locations, hashes, generated symbols, and generated file paths, not raw source lines.
- Generated implementations do not include user source files.
- Generated implementations do not copy user wrapper functions.
- AI generation is limited to explicit holes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file supercode_cli-0.1.1.tar.gz.
File metadata
- Download URL: supercode_cli-0.1.1.tar.gz
- Upload date:
- Size: 28.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5814a972691a9e2837fd78af7a3b60aa13bb3f555b143ea349cd17e2db7f8db7
|
|
| MD5 |
5fabff900f6f0afdc58781c901ba3b11
|
|
| BLAKE2b-256 |
15b11238b50edb4ca9eb8f2a6ad5c8ba72ba13d9a885ddaeb96a9a8a3af78a53
|
Provenance
The following attestation bundles were made for supercode_cli-0.1.1.tar.gz:
Publisher:
publish.yml on LwhJesse/SuperCode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
supercode_cli-0.1.1.tar.gz -
Subject digest:
5814a972691a9e2837fd78af7a3b60aa13bb3f555b143ea349cd17e2db7f8db7 - Sigstore transparency entry: 1632417385
- Sigstore integration time:
-
Permalink:
LwhJesse/SuperCode@54abe9a504439c5b7cc89553e172bcdad94f8e47 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LwhJesse
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@54abe9a504439c5b7cc89553e172bcdad94f8e47 -
Trigger Event:
release
-
Statement type:
File details
Details for the file supercode_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: supercode_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 30.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f7c605b72511226336a0a2216dbd337fa09136b851547bb94ef3f2660bab049
|
|
| MD5 |
b9ca9b7e74b4bc72e83ebce43421493a
|
|
| BLAKE2b-256 |
4859cdcc71cd12784132207171de80721a617e6d9e048d412ad7121da46161f6
|
Provenance
The following attestation bundles were made for supercode_cli-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on LwhJesse/SuperCode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
supercode_cli-0.1.1-py3-none-any.whl -
Subject digest:
1f7c605b72511226336a0a2216dbd337fa09136b851547bb94ef3f2660bab049 - Sigstore transparency entry: 1632417438
- Sigstore integration time:
-
Permalink:
LwhJesse/SuperCode@54abe9a504439c5b7cc89553e172bcdad94f8e47 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/LwhJesse
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@54abe9a504439c5b7cc89553e172bcdad94f8e47 -
Trigger Event:
release
-
Statement type: