@ishaanranjan/code-complete
v1.0.0
Published
CLI for code completion
Readme
Inception Code Complete (CLI)
A tiny Node.js CLI that sends your code context and a prompt to InceptionLabs' Mercury model for code completion.
⚠️ Security: Never commit your API key to a public repo. Prefer
.envand environment variables.
Quick start
# 1) Go to the folder
cd mercury-code-completion
# 2) Install deps
npm install
# If you previously ran into 'ora is not a function', pull latest and reinstall.
# 3) (Option A) Put your key in .env
cp .env.example .env
# edit .env to set INCEPTION_API_KEY
# 3) (Option B) Or export it in your shell
export INCEPTION_API_KEY=sk_...
# 4) Link the CLI locally
npm link
# 5) Use it
mercury-complete -f path/to/file.js -p "Write the next function to handle pagination"Basic usage
# Print completion to stdout
mercury-complete -f src/app.ts
# Provide a guiding prompt
mercury-complete -f src/app.ts -p "Continue the code. Add input validation and JSDoc comments."
# Append completion to the file
mercury-complete -f src/app.ts --append
# Write completion to a new file
mercury-complete -f src/app.ts --out src/app.completed.tsFlags
-f, --file <path>: (required) Source file to provide as context.-p, --prompt <text>: Guidance for the model (default: "Continue the code from the end. Provide only code.").--append: Append the generated code to the original file.-o, --out <path>: Write completion to this file.--max-tokens <n>: Upper bound on tokens to generate (default 512).--temperature <n>: Sampling temperature (default 0.2).
How it works
We call POST https://api.inceptionlabs.ai/v1/chat/completions with the Mercury model.
The file content is sent as context with your prompt. We ask the model to return code only (no backticks, no prose).
Example
mercury-complete -f example/input.ts -p "Add a robust retry helper with exponential backoff."Troubleshooting
- 401 / 403 – Make sure
INCEPTION_API_KEYis set. - 429 – You may be rate-limited; retry after a pause.
- 500 – Transient server error; try again.
- Weird output – Tighten your prompt (e.g., "Return only code for TypeScript; no comments or backticks.").
### New flag
- `--keep-fences`: keep triple-backtick code fences if the model returns them (default is to strip them).