This example demonstrates how to use the codeguide-cli package in development mode.
- Link the packages (from the codeguide-cli directory):
npm run dev:link- Link to this example project:
cd example-project
npm link @codeguide/core
npm link @codeguide/cli- Run the example:
npm startconst { CodeGuide } = require('@codeguide/core');
const codeguide = new CodeGuide({
baseUrl: 'https://api.codeguide.app',
databaseApiKey: 'sk_your_api_key'
});
// Get code guidance
const response = await codeguide.getGuidance('How to create a React component?');
console.log(response.response);
// Check API health
const isHealthy = await codeguide.isHealthy();# Ask for code guidance
codeguide ask "How to create a React component?" --database-api-key sk_your_key
# Check API health
codeguide health --database-api-key sk_your_key
# Get help
codeguide --help
codeguide ask --help
codeguide health --helpChoose one of the following authentication methods:
-
Database API Key (highest priority):
codeguide ask "your question" --database-api-key sk_your_key -
Legacy API Key + User ID:
codeguide ask "your question" --api-key your_key --user-id your_user_id -
JWT Token:
codeguide ask "your question" --jwt-token your_jwt_token
Copy .env.example to .env and configure your API credentials:
cp .env.example .env- Make changes to codeguide-cli source code
- Rebuild:
cd ../ && npm run build - Relink:
npm run dev:link - Changes are immediately available in this example project
To remove links and restore normal packages:
# In example project
npm unlink @codeguide/core
npm unlink @codeguide/cli
# In codeguide-cli directory
npm run dev:unlink