@codeguide/core 0.0.27 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -41
- package/__tests__/services/codespace/codespace-v2.test.ts +29 -18
- package/__tests__/services/usage/usage-service.test.ts +597 -85
- package/codeguide.ts +6 -0
- package/dist/codeguide.d.ts +3 -1
- package/dist/codeguide.js +2 -0
- package/dist/index.d.ts +4 -3
- package/dist/services/base/base-service.d.ts +21 -0
- package/dist/services/base/base-service.js +114 -0
- package/dist/services/codespace/codespace-service.d.ts +55 -1
- package/dist/services/codespace/codespace-service.js +260 -5
- package/dist/services/codespace/codespace-types.d.ts +193 -13
- package/dist/services/codespace/index.d.ts +1 -1
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +7 -1
- package/dist/services/projects/project-types.d.ts +66 -32
- package/dist/services/repository-analysis/repository-types.d.ts +1 -0
- package/dist/services/starter-kits/index.d.ts +2 -0
- package/dist/services/starter-kits/index.js +20 -0
- package/dist/services/starter-kits/starter-kits-service.d.ts +13 -0
- package/dist/services/starter-kits/starter-kits-service.js +27 -0
- package/dist/services/starter-kits/starter-kits-types.d.ts +34 -0
- package/dist/services/starter-kits/starter-kits-types.js +2 -0
- package/dist/services/tasks/task-service.d.ts +2 -1
- package/dist/services/tasks/task-service.js +8 -0
- package/dist/services/tasks/task-types.d.ts +26 -7
- package/dist/services/usage/usage-service.d.ts +5 -2
- package/dist/services/usage/usage-service.js +58 -9
- package/dist/services/usage/usage-types.d.ts +207 -34
- package/dist/services/users/index.d.ts +2 -0
- package/dist/services/users/index.js +20 -0
- package/dist/services/users/user-service.d.ts +12 -0
- package/dist/services/users/user-service.js +17 -0
- package/dist/services/users/user-types.d.ts +55 -0
- package/dist/services/users/user-types.js +2 -0
- package/docs/.vitepress/README.md +51 -0
- package/docs/.vitepress/config.ts +139 -0
- package/docs/.vitepress/theme/custom.css +80 -0
- package/docs/.vitepress/theme/index.ts +13 -0
- package/docs/.vitepress/tsconfig.json +19 -0
- package/docs/QUICKSTART.md +77 -0
- package/docs/README.md +134 -0
- package/docs/README_SETUP.md +46 -0
- package/docs/authentication.md +351 -0
- package/docs/codeguide-client.md +350 -0
- package/docs/codespace-models.md +1004 -0
- package/docs/codespace-service.md +558 -81
- package/docs/index.md +135 -0
- package/docs/package.json +14 -0
- package/docs/projects-service.md +688 -0
- package/docs/security-keys-service.md +773 -0
- package/docs/starter-kits-service.md +249 -0
- package/docs/task-service.md +955 -0
- package/docs/testsprite_tests/TC001_Homepage_Load_and_Hero_Section_Display.py +70 -0
- package/docs/testsprite_tests/TC002_Sidebar_Navigation_ExpandCollapse_Functionality.py +73 -0
- package/docs/testsprite_tests/TC003_Full_Text_Local_Search_with_Keyboard_Shortcut.py +90 -0
- package/docs/testsprite_tests/TC004_Dark_Mode_Toggle_and_Persistence.py +73 -0
- package/docs/testsprite_tests/TC005_Mobile_Responsiveness_and_Touch_Navigation.py +113 -0
- package/docs/testsprite_tests/TC006_GitHub_Integration_Edit_this_page_Links.py +73 -0
- package/docs/testsprite_tests/TC007_Syntax_Highlighting_and_Code_Copy_Functionality.py +73 -0
- package/docs/testsprite_tests/TC008_Auto_Generated_Table_of_Contents_Accuracy.py +73 -0
- package/docs/testsprite_tests/TC009_SEO_and_Content_Discoverability_Verification.py +73 -0
- package/docs/testsprite_tests/TC010_Accessibility_Compliance_WCAG_AA.py +73 -0
- package/docs/testsprite_tests/TC011_Local_Development_Workflow_Build_and_Hot_Reload.py +74 -0
- package/docs/testsprite_tests/TC012_Performance_Metrics_Compliance.py +73 -0
- package/docs/testsprite_tests/standard_prd.json +122 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.html +2508 -0
- package/docs/testsprite_tests/testsprite-mcp-test-report.md +273 -0
- package/docs/testsprite_tests/testsprite_frontend_test_plan.json +390 -0
- package/docs/usage-service.md +616 -0
- package/index.ts +11 -3
- package/package.json +16 -2
- package/plans/CODESPACE_LOGS_STREAMING_GUIDE.md +320 -0
- package/plans/CODESPACE_TASK_LOGS_API_COMPLETE_GUIDE.md +821 -0
- package/services/base/base-service.ts +130 -0
- package/services/codespace/codespace-service.ts +347 -8
- package/services/codespace/codespace-types.ts +263 -14
- package/services/codespace/index.ts +16 -1
- package/services/index.ts +4 -0
- package/services/projects/README.md +107 -34
- package/services/projects/project-types.ts +69 -32
- package/services/repository-analysis/repository-types.ts +1 -0
- package/services/starter-kits/index.ts +2 -0
- package/services/starter-kits/starter-kits-service.ts +33 -0
- package/services/starter-kits/starter-kits-types.ts +38 -0
- package/services/tasks/task-service.ts +10 -0
- package/services/tasks/task-types.ts +29 -7
- package/services/usage/usage-service.ts +59 -10
- package/services/usage/usage-types.ts +239 -34
- package/services/users/index.ts +2 -0
- package/services/users/user-service.ts +15 -0
- package/services/users/user-types.ts +59 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/* Custom styles for VitePress theme */
|
|
2
|
+
|
|
3
|
+
:root {
|
|
4
|
+
--vp-c-brand: #42b983;
|
|
5
|
+
--vp-c-brand-light: #42b983;
|
|
6
|
+
--vp-c-brand-lighter: #66d9a3;
|
|
7
|
+
--vp-c-brand-lightest: #8ae5b8;
|
|
8
|
+
--vp-c-brand-dark: #35495e;
|
|
9
|
+
--vp-c-brand-darker: #2c3e50;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* Code block styling */
|
|
13
|
+
.vp-code-group .tabs {
|
|
14
|
+
border-radius: 8px 8px 0 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.vp-code-group .blocks {
|
|
18
|
+
border-radius: 0 0 8px 8px;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Custom code block background */
|
|
22
|
+
div[class*='language-'] {
|
|
23
|
+
background-color: var(--vp-code-block-bg);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/* Improve table styling */
|
|
27
|
+
table {
|
|
28
|
+
display: table;
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/* Better spacing for method documentation */
|
|
33
|
+
.method-doc {
|
|
34
|
+
margin-bottom: 2rem;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.method-doc h3 {
|
|
38
|
+
margin-top: 2rem;
|
|
39
|
+
padding-bottom: 0.5rem;
|
|
40
|
+
border-bottom: 1px solid var(--vp-c-divider);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Improve code example readability */
|
|
44
|
+
.vp-code-group {
|
|
45
|
+
margin: 1.5rem 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Better list spacing */
|
|
49
|
+
.vp-doc ul,
|
|
50
|
+
.vp-doc ol {
|
|
51
|
+
padding-left: 1.5rem;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/* Improve type definition blocks */
|
|
55
|
+
.type-definition {
|
|
56
|
+
background-color: var(--vp-c-bg-soft);
|
|
57
|
+
padding: 1rem;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
margin: 1rem 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* Custom badge styling */
|
|
63
|
+
.badge {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
padding: 0.25rem 0.5rem;
|
|
66
|
+
border-radius: 4px;
|
|
67
|
+
font-size: 0.875rem;
|
|
68
|
+
font-weight: 500;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.badge-required {
|
|
72
|
+
background-color: var(--vp-c-red-soft);
|
|
73
|
+
color: var(--vp-c-red);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.badge-optional {
|
|
77
|
+
background-color: var(--vp-c-yellow-soft);
|
|
78
|
+
color: var(--vp-c-yellow);
|
|
79
|
+
}
|
|
80
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Theme } from 'vitepress'
|
|
2
|
+
import DefaultTheme from 'vitepress/theme'
|
|
3
|
+
import './custom.css'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
extends: DefaultTheme,
|
|
7
|
+
enhanceApp({ app }) {
|
|
8
|
+
// You can add custom Vue components here if needed
|
|
9
|
+
// Example:
|
|
10
|
+
// app.component('CustomComponent', CustomComponent)
|
|
11
|
+
},
|
|
12
|
+
} satisfies Theme
|
|
13
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"jsx": "preserve",
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"isolatedModules": true,
|
|
14
|
+
"types": ["node"]
|
|
15
|
+
},
|
|
16
|
+
"include": ["config.ts", "theme/**/*.ts"],
|
|
17
|
+
"exclude": ["node_modules"]
|
|
18
|
+
}
|
|
19
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Quick Start Guide
|
|
2
|
+
|
|
3
|
+
## Running the Documentation Locally
|
|
4
|
+
|
|
5
|
+
1. **Install dependencies** (if not already installed):
|
|
6
|
+
```bash
|
|
7
|
+
cd packages/core
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
2. **Start the development server**:
|
|
12
|
+
```bash
|
|
13
|
+
npm run docs:dev
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
3. **Open your browser**:
|
|
17
|
+
Navigate to http://localhost:5173
|
|
18
|
+
|
|
19
|
+
## Building for Production
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run docs:build
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The built files will be in `packages/core/docs/.vitepress/dist`
|
|
26
|
+
|
|
27
|
+
## Previewing the Build
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm run docs:preview
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Project Structure
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
docs/
|
|
37
|
+
├── .vitepress/
|
|
38
|
+
│ ├── config.ts # VitePress configuration (TypeScript)
|
|
39
|
+
│ ├── theme/
|
|
40
|
+
│ │ ├── index.ts # Theme customization
|
|
41
|
+
│ │ └── custom.css # Custom styles
|
|
42
|
+
│ └── tsconfig.json # TypeScript config for VitePress
|
|
43
|
+
├── README.md # Homepage
|
|
44
|
+
├── codeguide-client.md # Client documentation
|
|
45
|
+
├── authentication.md # Authentication docs
|
|
46
|
+
├── projects-service.md # Projects service docs
|
|
47
|
+
├── codespace-service.md # Codespace service docs
|
|
48
|
+
├── codespace-models.md # Models documentation
|
|
49
|
+
├── security-keys-service.md # Security keys docs
|
|
50
|
+
└── usage-service.md # Usage service docs
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- ✅ TypeScript-based configuration
|
|
56
|
+
- ✅ Fast hot module replacement
|
|
57
|
+
- ✅ Built-in search
|
|
58
|
+
- ✅ Dark mode support
|
|
59
|
+
- ✅ Mobile responsive
|
|
60
|
+
- ✅ SEO optimized
|
|
61
|
+
- ✅ Edit links to GitHub
|
|
62
|
+
|
|
63
|
+
## Customization
|
|
64
|
+
|
|
65
|
+
### Changing Colors
|
|
66
|
+
|
|
67
|
+
Edit `docs/.vitepress/theme/custom.css` to customize the color scheme.
|
|
68
|
+
|
|
69
|
+
### Adding Pages
|
|
70
|
+
|
|
71
|
+
1. Create a new `.md` file in the `docs/` directory
|
|
72
|
+
2. Add it to the sidebar in `docs/.vitepress/config.ts`
|
|
73
|
+
|
|
74
|
+
### Custom Components
|
|
75
|
+
|
|
76
|
+
Add Vue components in `docs/.vitepress/theme/index.ts` in the `enhanceApp` function.
|
|
77
|
+
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: home
|
|
3
|
+
|
|
4
|
+
hero:
|
|
5
|
+
name: "@codeguide/core"
|
|
6
|
+
text: "TypeScript SDK"
|
|
7
|
+
tagline: Complete TypeScript SDK for integrating CodeGuide functionality into your applications
|
|
8
|
+
actions:
|
|
9
|
+
- theme: brand
|
|
10
|
+
text: Get Started
|
|
11
|
+
link: /codeguide-client
|
|
12
|
+
- theme: alt
|
|
13
|
+
text: View on GitHub
|
|
14
|
+
link: https://github.com/CodeGuide-dev/codeguide
|
|
15
|
+
|
|
16
|
+
features:
|
|
17
|
+
- title: 🔑 Multiple Authentication Methods
|
|
18
|
+
details: Database API keys, legacy keys, and JWT tokens with automatic fallback
|
|
19
|
+
- title: 📝 Project Management
|
|
20
|
+
details: Create, update, and manage projects programmatically with full CRUD operations
|
|
21
|
+
- title: 🤖 Codespace Tasks
|
|
22
|
+
details: Create and manage AI-powered coding tasks with support for multiple execution modes
|
|
23
|
+
- title: 🎯 Model Management
|
|
24
|
+
details: Query and manage LLM models and providers for your codespace tasks
|
|
25
|
+
- title: 🔐 Security Keys
|
|
26
|
+
details: Securely manage provider API keys and GitHub tokens with encryption
|
|
27
|
+
- title: 🛡️ TypeScript Support
|
|
28
|
+
details: Full type safety and IntelliSense support for all API methods
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### Installation
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm install @codeguide/core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Basic Usage
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { CodeGuide } from '@codeguide/core'
|
|
43
|
+
|
|
44
|
+
// Initialize the CodeGuide client
|
|
45
|
+
const codeguide = new CodeGuide({
|
|
46
|
+
baseUrl: 'https://api.codeguide.ai',
|
|
47
|
+
databaseApiKey: 'sk_your_database_api_key', // Recommended
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
// Access services
|
|
51
|
+
const projects = await codeguide.projects.getAllProjects()
|
|
52
|
+
const tasks = await codeguide.codespace.getCodespaceTasksByProject({
|
|
53
|
+
project_id: 'your_project_id'
|
|
54
|
+
})
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Documentation Structure
|
|
58
|
+
|
|
59
|
+
### Core Components
|
|
60
|
+
|
|
61
|
+
- **[CodeGuide Client](./codeguide-client.md)** - Main client class and initialization
|
|
62
|
+
- **[Authentication](./authentication.md)** - Authentication methods and configuration
|
|
63
|
+
|
|
64
|
+
### Services
|
|
65
|
+
|
|
66
|
+
- **[Projects Service](./projects-service.md)** - Project management and repository connections
|
|
67
|
+
- **[Codespace Service](./codespace-service.md)** - AI-powered coding tasks and workflows
|
|
68
|
+
- **[Codespace Models](./codespace-models.md)** - LLM model providers and model management
|
|
69
|
+
- **[Security Keys Service](./security-keys-service.md)** - Provider API keys and GitHub token management
|
|
70
|
+
- **[Usage Service](./usage-service.md)** - Usage tracking and authorization
|
|
71
|
+
|
|
72
|
+
## Features
|
|
73
|
+
|
|
74
|
+
- 🔑 **Multiple Authentication Methods** - Database API keys, legacy keys, and JWT tokens
|
|
75
|
+
- 📝 **Project Management** - Create, update, and manage projects programmatically
|
|
76
|
+
- 🤖 **Codespace Tasks** - Create and manage AI-powered coding tasks
|
|
77
|
+
- 🎯 **Model Management** - Query and manage LLM models and providers
|
|
78
|
+
- 🔐 **Security Keys** - Securely manage provider API keys and GitHub tokens
|
|
79
|
+
- 📊 **Usage Tracking** - Monitor API usage and credits
|
|
80
|
+
- 🛡️ **TypeScript Support** - Full type safety and IntelliSense
|
|
81
|
+
|
|
82
|
+
## Getting Started
|
|
83
|
+
|
|
84
|
+
1. **Install the package**: `npm install @codeguide/core`
|
|
85
|
+
2. **Get your API key**: Sign up at [codeguide.ai](https://codeguide.ai) to get your API key
|
|
86
|
+
3. **Initialize the client**: See [CodeGuide Client](./codeguide-client.md) for setup instructions
|
|
87
|
+
4. **Authenticate**: See [Authentication](./authentication.md) for authentication options
|
|
88
|
+
5. **Start building**: Explore the service documentation to learn about available features
|
|
89
|
+
|
|
90
|
+
## Common Use Cases
|
|
91
|
+
|
|
92
|
+
### Creating a Project
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
const project = await codeguide.projects.createProject({
|
|
96
|
+
title: 'My New Project',
|
|
97
|
+
description: 'Project description here'
|
|
98
|
+
})
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Creating a Codespace Task
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
const task = await codeguide.codespace.createCodespaceTaskV2({
|
|
105
|
+
project_id: project.id,
|
|
106
|
+
task_description: 'Implement user authentication',
|
|
107
|
+
execution_mode: 'implementation'
|
|
108
|
+
})
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Managing Security Keys
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
// Store a provider API key
|
|
115
|
+
await codeguide.securityKeys.createProviderAPIKey({
|
|
116
|
+
provider_key: 'openai',
|
|
117
|
+
api_key: 'sk-your-openai-key'
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// Store a GitHub token
|
|
121
|
+
await codeguide.securityKeys.createGitHubToken({
|
|
122
|
+
github_token: 'ghp_your_github_token'
|
|
123
|
+
})
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Support
|
|
127
|
+
|
|
128
|
+
- **GitHub**: [CodeGuide Repository](https://github.com/CodeGuide-dev/codeguide)
|
|
129
|
+
- **Issues**: [GitHub Issues](https://github.com/CodeGuide-dev/codeguide/issues)
|
|
130
|
+
- **Documentation**: This documentation site
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# VitePress Setup Instructions
|
|
2
|
+
|
|
3
|
+
## The Issue
|
|
4
|
+
|
|
5
|
+
VitePress is an ESM-only package, but Node.js was trying to load it with CommonJS `require()`. This has been fixed by creating a separate `package.json` in the `docs/` directory with `"type": "module"`.
|
|
6
|
+
|
|
7
|
+
## Setup Steps
|
|
8
|
+
|
|
9
|
+
1. **Install dependencies in the docs directory**:
|
|
10
|
+
```bash
|
|
11
|
+
cd packages/core
|
|
12
|
+
npm run docs:install
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or manually:
|
|
16
|
+
```bash
|
|
17
|
+
cd packages/core/docs
|
|
18
|
+
npm install
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. **Start the development server**:
|
|
22
|
+
```bash
|
|
23
|
+
cd packages/core
|
|
24
|
+
npm run docs:dev
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
3. **Open your browser**:
|
|
28
|
+
Navigate to http://localhost:5173
|
|
29
|
+
|
|
30
|
+
## Available Commands
|
|
31
|
+
|
|
32
|
+
From `packages/core/`:
|
|
33
|
+
- `npm run docs:dev` - Start development server
|
|
34
|
+
- `npm run docs:build` - Build for production
|
|
35
|
+
- `npm run docs:preview` - Preview the built site
|
|
36
|
+
- `npm run docs:install` - Install docs dependencies
|
|
37
|
+
|
|
38
|
+
Or from `packages/core/docs/`:
|
|
39
|
+
- `npm run dev` - Start development server
|
|
40
|
+
- `npm run build` - Build for production
|
|
41
|
+
- `npm run preview` - Preview the built site
|
|
42
|
+
|
|
43
|
+
## Why Separate package.json?
|
|
44
|
+
|
|
45
|
+
The docs directory has its own `package.json` with `"type": "module"` to ensure VitePress (which is ESM-only) works correctly without affecting the main package's CommonJS setup.
|
|
46
|
+
|