cortex-agents 1.0.0
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/.opencode/agents/build.md +160 -0
- package/.opencode/agents/debug.md +141 -0
- package/.opencode/agents/devops.md +109 -0
- package/.opencode/agents/fullstack.md +84 -0
- package/.opencode/agents/plan.md +188 -0
- package/.opencode/agents/security.md +90 -0
- package/.opencode/agents/testing.md +89 -0
- package/.opencode/skills/code-quality/SKILL.md +251 -0
- package/.opencode/skills/deployment-automation/SKILL.md +258 -0
- package/.opencode/skills/git-workflow/SKILL.md +281 -0
- package/.opencode/skills/security-hardening/SKILL.md +209 -0
- package/.opencode/skills/testing-strategies/SKILL.md +159 -0
- package/.opencode/skills/web-development/SKILL.md +122 -0
- package/LICENSE +17 -0
- package/README.md +172 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +174 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +42 -0
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +3 -0
- package/dist/tools/branch.d.ts +35 -0
- package/dist/tools/branch.d.ts.map +1 -0
- package/dist/tools/branch.js +176 -0
- package/dist/tools/cortex.d.ts +11 -0
- package/dist/tools/cortex.d.ts.map +1 -0
- package/dist/tools/cortex.js +149 -0
- package/dist/tools/plan.d.ts +59 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +177 -0
- package/dist/tools/session.d.ts +36 -0
- package/dist/tools/session.d.ts.map +1 -0
- package/dist/tools/session.js +175 -0
- package/dist/tools/worktree.d.ts +45 -0
- package/dist/tools/worktree.d.ts.map +1 -0
- package/dist/tools/worktree.js +198 -0
- package/package.json +55 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-development
|
|
3
|
+
description: Full-stack web development patterns, best practices, and architectural guidance for modern web applications
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: opencode
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Web Development Skill
|
|
9
|
+
|
|
10
|
+
This skill provides comprehensive guidance for building modern web applications.
|
|
11
|
+
|
|
12
|
+
## When to Use
|
|
13
|
+
|
|
14
|
+
Use this skill when:
|
|
15
|
+
- Starting a new web project
|
|
16
|
+
- Adding features to existing web apps
|
|
17
|
+
- Refactoring frontend or backend code
|
|
18
|
+
- Designing APIs
|
|
19
|
+
- Choosing technology stack
|
|
20
|
+
|
|
21
|
+
## Frontend Architecture
|
|
22
|
+
|
|
23
|
+
### Component Design
|
|
24
|
+
- Single Responsibility Principle
|
|
25
|
+
- Composition over inheritance
|
|
26
|
+
- Controlled vs uncontrolled components
|
|
27
|
+
- Container/Presentational pattern
|
|
28
|
+
- Custom hooks for reusable logic
|
|
29
|
+
|
|
30
|
+
### State Management
|
|
31
|
+
- Local state (useState, useReducer)
|
|
32
|
+
- Global state (Redux, Zustand, Context)
|
|
33
|
+
- Server state (React Query, SWR)
|
|
34
|
+
- Form state (React Hook Form)
|
|
35
|
+
- URL state (React Router)
|
|
36
|
+
|
|
37
|
+
### Performance Optimization
|
|
38
|
+
- Memoization (useMemo, useCallback, React.memo)
|
|
39
|
+
- Code splitting and lazy loading
|
|
40
|
+
- Virtualization for long lists
|
|
41
|
+
- Image optimization
|
|
42
|
+
- Bundle size monitoring
|
|
43
|
+
|
|
44
|
+
### Styling Approaches
|
|
45
|
+
- CSS-in-JS (styled-components, emotion)
|
|
46
|
+
- Utility-first CSS (Tailwind)
|
|
47
|
+
- CSS Modules
|
|
48
|
+
- SCSS/Sass
|
|
49
|
+
- CSS Variables for theming
|
|
50
|
+
|
|
51
|
+
## Backend Architecture
|
|
52
|
+
|
|
53
|
+
### API Design
|
|
54
|
+
- RESTful principles
|
|
55
|
+
- GraphQL schema design
|
|
56
|
+
- Versioning strategies
|
|
57
|
+
- Pagination patterns
|
|
58
|
+
- Filtering and sorting
|
|
59
|
+
|
|
60
|
+
### Database Patterns
|
|
61
|
+
- Repository pattern
|
|
62
|
+
- Unit of Work
|
|
63
|
+
- CQRS (Command Query Responsibility Segregation)
|
|
64
|
+
- Event sourcing
|
|
65
|
+
- Database migrations
|
|
66
|
+
|
|
67
|
+
### Authentication & Authorization
|
|
68
|
+
- JWT implementation
|
|
69
|
+
- Session-based auth
|
|
70
|
+
- OAuth 2.0 / OpenID Connect
|
|
71
|
+
- Role-based access control
|
|
72
|
+
- API key management
|
|
73
|
+
|
|
74
|
+
### Error Handling
|
|
75
|
+
- Consistent error responses
|
|
76
|
+
- HTTP status codes
|
|
77
|
+
- Error logging and monitoring
|
|
78
|
+
- User-friendly error messages
|
|
79
|
+
- Retry strategies
|
|
80
|
+
|
|
81
|
+
## Fullstack Patterns
|
|
82
|
+
|
|
83
|
+
### Data Flow
|
|
84
|
+
- Unidirectional data flow
|
|
85
|
+
- State normalization
|
|
86
|
+
- Optimistic updates
|
|
87
|
+
- Real-time updates (WebSockets, SSE)
|
|
88
|
+
- Offline-first architecture
|
|
89
|
+
|
|
90
|
+
### Security
|
|
91
|
+
- Input validation and sanitization
|
|
92
|
+
- Output encoding
|
|
93
|
+
- CSRF protection
|
|
94
|
+
- Content Security Policy
|
|
95
|
+
- Secure headers
|
|
96
|
+
|
|
97
|
+
### Testing Strategy
|
|
98
|
+
- Unit tests for business logic
|
|
99
|
+
- Integration tests for APIs
|
|
100
|
+
- Component tests for UI
|
|
101
|
+
- E2E tests for critical paths
|
|
102
|
+
- Visual regression testing
|
|
103
|
+
|
|
104
|
+
## Technology Recommendations
|
|
105
|
+
|
|
106
|
+
### Frontend Stacks
|
|
107
|
+
- React + TypeScript + Vite + Tailwind
|
|
108
|
+
- Vue 3 + TypeScript + Vite + Pinia
|
|
109
|
+
- Next.js (fullstack React)
|
|
110
|
+
- SvelteKit
|
|
111
|
+
|
|
112
|
+
### Backend Stacks
|
|
113
|
+
- Node.js + Express/Fastify/NestJS
|
|
114
|
+
- Python + FastAPI/Django
|
|
115
|
+
- Go + Gin/Echo
|
|
116
|
+
- Rust + Actix/Axum
|
|
117
|
+
|
|
118
|
+
### Databases
|
|
119
|
+
- PostgreSQL (relational)
|
|
120
|
+
- MongoDB (document)
|
|
121
|
+
- Redis (cache/sessions)
|
|
122
|
+
- Elasticsearch (search)
|
package/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
Copyright 2024 OpenCode K2P5 Agents Contributors
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# cortex-agents
|
|
2
|
+
|
|
3
|
+
Enhanced agents for [OpenCode](https://opencode.ai) with k2p5 model, worktree workflow, and plan persistence.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Pre-implementation workflow**: Build and Debug agents ask about branch/worktree before making changes
|
|
8
|
+
- **Plan persistence**: Plans saved to `.cortex/plans/` with mermaid diagrams
|
|
9
|
+
- **Session summaries**: Key decisions recorded in `.cortex/sessions/`
|
|
10
|
+
- **Worktree support**: Create isolated worktrees in `../.worktrees/` for parallel development
|
|
11
|
+
- **Agent handoff**: Plan agent hands off to Build/Debug with user confirmation
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Option 1: Add to config (Recommended)
|
|
16
|
+
|
|
17
|
+
Add the plugin to your `opencode.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"$schema": "https://opencode.ai/config.json",
|
|
22
|
+
"plugin": ["cortex-agents"]
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
OpenCode will auto-install via Bun at startup.
|
|
27
|
+
|
|
28
|
+
### Option 2: Use the CLI helper
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx cortex-agents install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This adds the plugin to your global `~/.config/opencode/opencode.json`.
|
|
35
|
+
|
|
36
|
+
### Option 3: Global npm install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npm install -g cortex-agents
|
|
40
|
+
cortex-agents install
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## CLI Commands
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx cortex-agents install # Add to opencode.json config
|
|
47
|
+
npx cortex-agents uninstall # Remove from config
|
|
48
|
+
npx cortex-agents status # Check installation status
|
|
49
|
+
npx cortex-agents help # Show help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Agents
|
|
53
|
+
|
|
54
|
+
### Primary Agents
|
|
55
|
+
|
|
56
|
+
| Agent | Description |
|
|
57
|
+
|-------|-------------|
|
|
58
|
+
| **build** | Full-access development with branch/worktree workflow |
|
|
59
|
+
| **plan** | Read-only analysis with plan persistence and handoff |
|
|
60
|
+
| **debug** | Deep troubleshooting with hotfix workflow |
|
|
61
|
+
|
|
62
|
+
### Subagents (@mention)
|
|
63
|
+
|
|
64
|
+
| Agent | Description |
|
|
65
|
+
|-------|-------------|
|
|
66
|
+
| **@fullstack** | End-to-end feature implementation |
|
|
67
|
+
| **@testing** | Test writing and coverage analysis |
|
|
68
|
+
| **@security** | Security audit and vulnerability detection |
|
|
69
|
+
| **@devops** | CI/CD and deployment automation |
|
|
70
|
+
|
|
71
|
+
## Tools
|
|
72
|
+
|
|
73
|
+
All tools are bundled with the plugin and available automatically.
|
|
74
|
+
|
|
75
|
+
### Cortex Management
|
|
76
|
+
- `cortex_init` - Initialize `.cortex` directory
|
|
77
|
+
- `cortex_status` - Check cortex status
|
|
78
|
+
|
|
79
|
+
### Branch Management
|
|
80
|
+
- `branch_create` - Create feature/bugfix/hotfix branch
|
|
81
|
+
- `branch_status` - Get current branch and status
|
|
82
|
+
- `branch_switch` - Switch to existing branch
|
|
83
|
+
|
|
84
|
+
### Worktree Management
|
|
85
|
+
- `worktree_create` - Create worktree in `../.worktrees/`
|
|
86
|
+
- `worktree_list` - List all worktrees
|
|
87
|
+
- `worktree_remove` - Remove worktree
|
|
88
|
+
- `worktree_open` - Get command to open terminal in worktree
|
|
89
|
+
|
|
90
|
+
### Plan Management
|
|
91
|
+
- `plan_save` - Save plan to `.cortex/plans/`
|
|
92
|
+
- `plan_list` - List saved plans
|
|
93
|
+
- `plan_load` - Load a plan
|
|
94
|
+
- `plan_delete` - Delete a plan
|
|
95
|
+
|
|
96
|
+
### Session Management
|
|
97
|
+
- `session_save` - Save session summary with decisions
|
|
98
|
+
- `session_list` - List recent sessions
|
|
99
|
+
- `session_load` - Load a session summary
|
|
100
|
+
|
|
101
|
+
## Skills
|
|
102
|
+
|
|
103
|
+
| Skill | Description |
|
|
104
|
+
|-------|-------------|
|
|
105
|
+
| **web-development** | Full-stack patterns and best practices |
|
|
106
|
+
| **testing-strategies** | Comprehensive testing approaches |
|
|
107
|
+
| **security-hardening** | Security best practices |
|
|
108
|
+
| **deployment-automation** | CI/CD and infrastructure |
|
|
109
|
+
| **code-quality** | Refactoring and maintainability |
|
|
110
|
+
| **git-workflow** | Branching and worktree workflows |
|
|
111
|
+
|
|
112
|
+
## Workflow Example
|
|
113
|
+
|
|
114
|
+
### Feature Development
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
1. User: "I want to add user authentication"
|
|
118
|
+
|
|
119
|
+
2. Plan Agent:
|
|
120
|
+
- Analyzes codebase
|
|
121
|
+
- Creates plan with mermaid diagrams
|
|
122
|
+
- Saves to .cortex/plans/2024-02-22-feature-user-auth.md
|
|
123
|
+
- Asks: "Plan saved. Switch to Build agent?"
|
|
124
|
+
|
|
125
|
+
3. User: "Yes"
|
|
126
|
+
|
|
127
|
+
4. Build Agent:
|
|
128
|
+
- Loads plan from .cortex/plans/
|
|
129
|
+
- Checks git status (on main)
|
|
130
|
+
- Asks: "Create branch or worktree?"
|
|
131
|
+
- User: "Create branch"
|
|
132
|
+
- Creates feature/user-authentication
|
|
133
|
+
- Implements following the plan
|
|
134
|
+
- Saves session summary with decisions
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## .cortex Directory
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
<project-root>/
|
|
141
|
+
└── .cortex/
|
|
142
|
+
├── config.json # Project configuration
|
|
143
|
+
├── .gitignore # Ignores sessions, keeps plans
|
|
144
|
+
├── plans/ # Implementation plans (git tracked)
|
|
145
|
+
│ └── YYYY-MM-DD-type-slug.md
|
|
146
|
+
└── sessions/ # Session summaries (gitignored)
|
|
147
|
+
└── YYYY-MM-DD-session-id.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Branch Naming
|
|
151
|
+
|
|
152
|
+
| Type | Prefix | Example |
|
|
153
|
+
|------|--------|---------|
|
|
154
|
+
| Feature | `feature/` | `feature/user-authentication` |
|
|
155
|
+
| Bugfix | `bugfix/` | `bugfix/login-validation` |
|
|
156
|
+
| Hotfix | `hotfix/` | `hotfix/security-patch` |
|
|
157
|
+
| Refactor | `refactor/` | `refactor/api-cleanup` |
|
|
158
|
+
| Docs | `docs/` | `docs/api-reference` |
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
Default model: `kimi-for-coding/k2p5`
|
|
163
|
+
|
|
164
|
+
## Requirements
|
|
165
|
+
|
|
166
|
+
- OpenCode >= 1.0.0
|
|
167
|
+
- Node.js >= 18.0.0
|
|
168
|
+
- Git (for branch/worktree features)
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
Apache-2.0
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
const VERSION = "2.1.0";
|
|
5
|
+
const PLUGIN_NAME = "cortex-agents";
|
|
6
|
+
function findOpencodeConfig() {
|
|
7
|
+
// Check local first
|
|
8
|
+
const localPath = path.join(process.cwd(), "opencode.json");
|
|
9
|
+
if (fs.existsSync(localPath)) {
|
|
10
|
+
return { path: localPath, isGlobal: false };
|
|
11
|
+
}
|
|
12
|
+
// Check global
|
|
13
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
14
|
+
const globalPath = path.join(homeDir, ".config", "opencode", "opencode.json");
|
|
15
|
+
if (fs.existsSync(globalPath)) {
|
|
16
|
+
return { path: globalPath, isGlobal: true };
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function readConfig(configPath) {
|
|
21
|
+
try {
|
|
22
|
+
const content = fs.readFileSync(configPath, "utf-8");
|
|
23
|
+
return JSON.parse(content);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function writeConfig(configPath, config) {
|
|
30
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
31
|
+
}
|
|
32
|
+
function install() {
|
|
33
|
+
console.log(`Installing ${PLUGIN_NAME} v${VERSION}...\n`);
|
|
34
|
+
const configInfo = findOpencodeConfig();
|
|
35
|
+
if (!configInfo) {
|
|
36
|
+
// Create global config
|
|
37
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || "";
|
|
38
|
+
const globalDir = path.join(homeDir, ".config", "opencode");
|
|
39
|
+
const globalPath = path.join(globalDir, "opencode.json");
|
|
40
|
+
if (!fs.existsSync(globalDir)) {
|
|
41
|
+
fs.mkdirSync(globalDir, { recursive: true });
|
|
42
|
+
}
|
|
43
|
+
const newConfig = {
|
|
44
|
+
$schema: "https://opencode.ai/config.json",
|
|
45
|
+
plugin: [PLUGIN_NAME],
|
|
46
|
+
};
|
|
47
|
+
writeConfig(globalPath, newConfig);
|
|
48
|
+
console.log(`Created global config: ${globalPath}`);
|
|
49
|
+
console.log(`Added plugin: ${PLUGIN_NAME}`);
|
|
50
|
+
console.log("\nRestart OpenCode to load the plugin.");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const config = readConfig(configInfo.path);
|
|
54
|
+
// Ensure plugin array exists
|
|
55
|
+
if (!config.plugin) {
|
|
56
|
+
config.plugin = [];
|
|
57
|
+
}
|
|
58
|
+
// Check if already installed
|
|
59
|
+
if (config.plugin.includes(PLUGIN_NAME)) {
|
|
60
|
+
console.log(`Plugin already installed in ${configInfo.isGlobal ? "global" : "local"} config.`);
|
|
61
|
+
console.log(`Config: ${configInfo.path}`);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
// Add plugin
|
|
65
|
+
config.plugin.push(PLUGIN_NAME);
|
|
66
|
+
writeConfig(configInfo.path, config);
|
|
67
|
+
console.log(`Added plugin to ${configInfo.isGlobal ? "global" : "local"} config.`);
|
|
68
|
+
console.log(`Config: ${configInfo.path}`);
|
|
69
|
+
console.log("\nRestart OpenCode to load the plugin.");
|
|
70
|
+
}
|
|
71
|
+
function uninstall() {
|
|
72
|
+
console.log(`Uninstalling ${PLUGIN_NAME}...\n`);
|
|
73
|
+
const configInfo = findOpencodeConfig();
|
|
74
|
+
if (!configInfo) {
|
|
75
|
+
console.log("No OpenCode config found. Nothing to uninstall.");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const config = readConfig(configInfo.path);
|
|
79
|
+
if (!config.plugin || !config.plugin.includes(PLUGIN_NAME)) {
|
|
80
|
+
console.log("Plugin not found in config. Nothing to uninstall.");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
// Remove plugin
|
|
84
|
+
config.plugin = config.plugin.filter((p) => p !== PLUGIN_NAME);
|
|
85
|
+
writeConfig(configInfo.path, config);
|
|
86
|
+
console.log(`Removed plugin from ${configInfo.isGlobal ? "global" : "local"} config.`);
|
|
87
|
+
console.log(`Config: ${configInfo.path}`);
|
|
88
|
+
console.log("\nRestart OpenCode to apply changes.");
|
|
89
|
+
}
|
|
90
|
+
function status() {
|
|
91
|
+
console.log(`${PLUGIN_NAME} v${VERSION}\n`);
|
|
92
|
+
const configInfo = findOpencodeConfig();
|
|
93
|
+
if (!configInfo) {
|
|
94
|
+
console.log("Status: NOT INSTALLED");
|
|
95
|
+
console.log("\nNo OpenCode config found.");
|
|
96
|
+
console.log("Run 'npx cortex-agents install' to set up.");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const config = readConfig(configInfo.path);
|
|
100
|
+
const isInstalled = config.plugin?.includes(PLUGIN_NAME);
|
|
101
|
+
console.log(`Status: ${isInstalled ? "INSTALLED" : "NOT INSTALLED"}`);
|
|
102
|
+
console.log(`Config: ${configInfo.path} (${configInfo.isGlobal ? "global" : "local"})`);
|
|
103
|
+
if (isInstalled) {
|
|
104
|
+
console.log("\nPlugin is configured. OpenCode will auto-install via Bun at startup.");
|
|
105
|
+
console.log("\nIncluded components:");
|
|
106
|
+
console.log(" - 5 tool modules (cortex, worktree, branch, plan, session)");
|
|
107
|
+
console.log(" - 7 agents (build, plan, debug, fullstack, testing, security, devops)");
|
|
108
|
+
console.log(" - 6 skills (web-dev, testing, security, deployment, code-quality, git-workflow)");
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
console.log("\nRun 'npx cortex-agents install' to add to config.");
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function help() {
|
|
115
|
+
console.log(`${PLUGIN_NAME} v${VERSION}
|
|
116
|
+
|
|
117
|
+
Enhanced agents for OpenCode with k2p5 model, worktree workflow, and plan persistence.
|
|
118
|
+
|
|
119
|
+
USAGE:
|
|
120
|
+
npx ${PLUGIN_NAME} <command>
|
|
121
|
+
|
|
122
|
+
COMMANDS:
|
|
123
|
+
install Add plugin to opencode.json config
|
|
124
|
+
uninstall Remove plugin from opencode.json config
|
|
125
|
+
status Show plugin installation status
|
|
126
|
+
help Show this help message
|
|
127
|
+
|
|
128
|
+
EXAMPLES:
|
|
129
|
+
npx ${PLUGIN_NAME} install # Add to config (OpenCode auto-installs)
|
|
130
|
+
npx ${PLUGIN_NAME} status # Check if installed
|
|
131
|
+
|
|
132
|
+
MANUAL INSTALLATION:
|
|
133
|
+
Add to your opencode.json:
|
|
134
|
+
{
|
|
135
|
+
"plugin": ["${PLUGIN_NAME}"]
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
INCLUDED TOOLS:
|
|
139
|
+
cortex_init, cortex_status - .cortex directory management
|
|
140
|
+
worktree_create, worktree_list, worktree_remove, worktree_open
|
|
141
|
+
branch_create, branch_status, branch_switch
|
|
142
|
+
plan_save, plan_list, plan_load, plan_delete
|
|
143
|
+
session_save, session_list, session_load
|
|
144
|
+
|
|
145
|
+
INCLUDED AGENTS:
|
|
146
|
+
@build - Pre-implementation workflow with branch/worktree prompts
|
|
147
|
+
@plan - Create and save implementation plans with mermaid diagrams
|
|
148
|
+
@debug - Pre-fix workflow with hotfix worktree support
|
|
149
|
+
|
|
150
|
+
For more info: https://github.com/your-org/${PLUGIN_NAME}
|
|
151
|
+
`);
|
|
152
|
+
}
|
|
153
|
+
// Parse command
|
|
154
|
+
const command = process.argv[2] || "help";
|
|
155
|
+
switch (command) {
|
|
156
|
+
case "install":
|
|
157
|
+
install();
|
|
158
|
+
break;
|
|
159
|
+
case "uninstall":
|
|
160
|
+
uninstall();
|
|
161
|
+
break;
|
|
162
|
+
case "status":
|
|
163
|
+
status();
|
|
164
|
+
break;
|
|
165
|
+
case "help":
|
|
166
|
+
case "--help":
|
|
167
|
+
case "-h":
|
|
168
|
+
help();
|
|
169
|
+
break;
|
|
170
|
+
default:
|
|
171
|
+
console.error(`Unknown command: ${command}`);
|
|
172
|
+
console.error("Run 'npx cortex-agents help' for usage.");
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AASlD,eAAO,MAAM,gBAAgB,EAAE,MAsC9B,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Import all tool modules
|
|
2
|
+
import * as cortex from "./tools/cortex";
|
|
3
|
+
import * as worktree from "./tools/worktree";
|
|
4
|
+
import * as branch from "./tools/branch";
|
|
5
|
+
import * as plan from "./tools/plan";
|
|
6
|
+
import * as session from "./tools/session";
|
|
7
|
+
export const K2P5AgentsPlugin = async ({ client }) => {
|
|
8
|
+
await client.app.log({
|
|
9
|
+
body: {
|
|
10
|
+
service: "k2p5-agents",
|
|
11
|
+
level: "info",
|
|
12
|
+
message: "K2P5 Agents Plugin v2.1.0 initialized - tools, agents, and skills loaded",
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
tool: {
|
|
17
|
+
// Cortex tools - .cortex directory management
|
|
18
|
+
cortex_init: cortex.init,
|
|
19
|
+
cortex_status: cortex.status,
|
|
20
|
+
// Worktree tools - git worktree management
|
|
21
|
+
worktree_create: worktree.create,
|
|
22
|
+
worktree_list: worktree.list,
|
|
23
|
+
worktree_remove: worktree.remove,
|
|
24
|
+
worktree_open: worktree.open,
|
|
25
|
+
// Branch tools - git branch operations
|
|
26
|
+
branch_create: branch.create,
|
|
27
|
+
branch_status: branch.status,
|
|
28
|
+
branch_switch: branch.switch_,
|
|
29
|
+
// Plan tools - implementation plan persistence
|
|
30
|
+
plan_save: plan.save,
|
|
31
|
+
plan_list: plan.list,
|
|
32
|
+
plan_load: plan.load,
|
|
33
|
+
plan_delete: plan.delete_,
|
|
34
|
+
// Session tools - session summaries with decisions
|
|
35
|
+
session_save: session.save,
|
|
36
|
+
session_list: session.list,
|
|
37
|
+
session_load: session.load,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
// Default export for OpenCode plugin system
|
|
42
|
+
export default K2P5AgentsPlugin;
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":""}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const create: {
|
|
2
|
+
description: string;
|
|
3
|
+
args: {
|
|
4
|
+
name: import("zod").ZodString;
|
|
5
|
+
type: import("zod").ZodEnum<{
|
|
6
|
+
feature: "feature";
|
|
7
|
+
bugfix: "bugfix";
|
|
8
|
+
hotfix: "hotfix";
|
|
9
|
+
refactor: "refactor";
|
|
10
|
+
docs: "docs";
|
|
11
|
+
test: "test";
|
|
12
|
+
chore: "chore";
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
execute(args: {
|
|
16
|
+
name: string;
|
|
17
|
+
type: "feature" | "bugfix" | "hotfix" | "refactor" | "docs" | "test" | "chore";
|
|
18
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
19
|
+
};
|
|
20
|
+
export declare const status: {
|
|
21
|
+
description: string;
|
|
22
|
+
args: {};
|
|
23
|
+
execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
24
|
+
};
|
|
25
|
+
export declare const switch_: {
|
|
26
|
+
description: string;
|
|
27
|
+
args: {
|
|
28
|
+
branch: import("zod").ZodString;
|
|
29
|
+
};
|
|
30
|
+
execute(args: {
|
|
31
|
+
branch: string;
|
|
32
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
33
|
+
};
|
|
34
|
+
export { switch_ as switch };
|
|
35
|
+
//# sourceMappingURL=branch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.ts","sourceRoot":"","sources":["../../src/tools/branch.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;CA8CjB,CAAC;AAEH,eAAO,MAAM,MAAM;;;;CAiGjB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;CAmClB,CAAC;AAGH,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
|