opencodekit 0.9.0 → 0.9.1
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 +35 -43
- package/dist/index.js +16 -4
- package/dist/template/.opencode/README.md +13 -9
- package/dist/template/.opencode/agent/build.md +16 -0
- package/dist/template/.opencode/agent/rush.md +9 -0
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/compaction.ts +87 -4
- package/dist/template/.opencode/plugin/skill-mcp.ts +1 -1
- package/dist/template/.opencode/skill/chrome-devtools/SKILL.md +88 -0
- package/dist/template/.opencode/skill/polar/SKILL.md +92 -0
- package/package.json +63 -51
package/README.md
CHANGED
|
@@ -24,22 +24,13 @@ A pre-configured OpenCode distribution featuring:
|
|
|
24
24
|
### Option 1: Using CLI (Recommended)
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
# 1.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ock init
|
|
35
|
-
cd my-opencode-project
|
|
36
|
-
|
|
37
|
-
# 3. Configure OpenCodeKit
|
|
38
|
-
ock setup
|
|
39
|
-
|
|
40
|
-
# 4. Explore
|
|
41
|
-
ock agent list
|
|
42
|
-
ock skill list
|
|
27
|
+
# 1. Create new project with npx
|
|
28
|
+
npx opencodekit init my-project
|
|
29
|
+
cd my-project
|
|
30
|
+
|
|
31
|
+
# 2. Or install globally
|
|
32
|
+
npm install -g opencodekit
|
|
33
|
+
ock init my-project
|
|
43
34
|
```
|
|
44
35
|
|
|
45
36
|
**See [CLI.md](./CLI.md) for complete CLI documentation**
|
|
@@ -73,13 +64,12 @@ create test.txt with "Hello OpenCodeKit"
|
|
|
73
64
|
|
|
74
65
|
```
|
|
75
66
|
build (Primary Orchestrator - 70% of work)
|
|
76
|
-
├→ @
|
|
77
|
-
├→ @
|
|
78
|
-
├→ @
|
|
79
|
-
├→ @
|
|
80
|
-
├→ @
|
|
81
|
-
├→ @
|
|
82
|
-
├→ @orchestrator (Multi-agent coordination)
|
|
67
|
+
├→ @rush (Fast agent for simple tasks)
|
|
68
|
+
├→ @planner (Complex planning ≥3 phases)
|
|
69
|
+
├→ @review (Code review + security + debugging)
|
|
70
|
+
├→ @scout (External research, library docs, GitHub patterns)
|
|
71
|
+
├→ @explore (Fast codebase search)
|
|
72
|
+
├→ @vision (UI/UX, mockups, visual analysis)
|
|
83
73
|
└→ @general (Fallback)
|
|
84
74
|
|
|
85
75
|
Background Plugins:
|
|
@@ -88,10 +78,10 @@ Background Plugins:
|
|
|
88
78
|
• truncator (Dynamic output truncation)
|
|
89
79
|
|
|
90
80
|
Supporting:
|
|
91
|
-
•
|
|
92
|
-
•
|
|
93
|
-
•
|
|
94
|
-
• Custom Tools (memory-*, observation, ast-grep)
|
|
81
|
+
• 30+ Skills (domain expertise loaded on-demand)
|
|
82
|
+
• 26+ Commands (workflow shortcuts)
|
|
83
|
+
• 3 MCP Services (context7, exa, gh_grep) + skill-embedded MCPs
|
|
84
|
+
• Custom Tools (memory-*, observation, ast-grep, lsp-*)
|
|
95
85
|
• Beads task tracking (`bd` CLI for multi-session workflows)
|
|
96
86
|
• Manual Handoffs (clean phase transitions)
|
|
97
87
|
```
|
|
@@ -181,20 +171,21 @@ session({
|
|
|
181
171
|
Is it a simple task?
|
|
182
172
|
✓ → Use build directly (70% of work)
|
|
183
173
|
|
|
174
|
+
Need speed over depth?
|
|
175
|
+
✓ → @rush (fast agent, same capabilities)
|
|
176
|
+
|
|
184
177
|
Complex task (≥3 phases)?
|
|
185
|
-
✓ → @
|
|
178
|
+
✓ → @planner (creates implementation plan)
|
|
186
179
|
|
|
187
180
|
Need research?
|
|
188
|
-
✓ → @
|
|
189
|
-
✓ → @
|
|
190
|
-
✓ → @docs (quick API reference)
|
|
191
|
-
✓ → @finder (codebase search)
|
|
181
|
+
✓ → @scout (library docs + GitHub patterns)
|
|
182
|
+
✓ → @explore (codebase search)
|
|
192
183
|
|
|
193
184
|
Quality gate before deployment?
|
|
194
|
-
✓ → @
|
|
185
|
+
✓ → @review (security + code review + debugging)
|
|
195
186
|
|
|
196
|
-
|
|
197
|
-
✓ → @
|
|
187
|
+
UI/UX work?
|
|
188
|
+
✓ → @vision (mockups, visual analysis, accessibility)
|
|
198
189
|
|
|
199
190
|
Everything else?
|
|
200
191
|
✓ → @general (fallback)
|
|
@@ -226,15 +217,15 @@ Everything else?
|
|
|
226
217
|
|
|
227
218
|
You've successfully set up OpenCodeKit when:
|
|
228
219
|
|
|
229
|
-
- ✅
|
|
220
|
+
- ✅ Agent files in place (.opencode/agent/\*.md)
|
|
230
221
|
- ✅ Build handles 70%+ directly
|
|
231
|
-
- ✅ Commands work (
|
|
232
|
-
- ✅ Skills load
|
|
222
|
+
- ✅ Commands work (/commit, /pr, /design, /fix, /implement)
|
|
223
|
+
- ✅ Skills load on-demand (30+ skills)
|
|
233
224
|
- ✅ Delegation is clear (build → specialized subagents)
|
|
234
225
|
- ✅ `/handoff` creates portable bundles (.opencode/memory/handoffs/)
|
|
235
|
-
- ✅ MCP services configured (
|
|
226
|
+
- ✅ MCP services configured (context7, gh_grep + skill-embedded)
|
|
236
227
|
- ✅ Background plugins active (enforcer, compactor, truncator)
|
|
237
|
-
- ✅ Custom tools available (memory
|
|
228
|
+
- ✅ Custom tools available (memory-_, observation, ast-grep, lsp-_)
|
|
238
229
|
- ✅ Environment variables set (.opencode/.env with API keys)
|
|
239
230
|
|
|
240
231
|
---
|
|
@@ -260,9 +251,10 @@ You've successfully set up OpenCodeKit when:
|
|
|
260
251
|
|
|
261
252
|
---
|
|
262
253
|
|
|
263
|
-
**OpenCodeKit v0.
|
|
254
|
+
**OpenCodeKit v0.9.1**
|
|
264
255
|
**Architecture**: Two-layer (Memory + Beads + Git)
|
|
265
|
-
**
|
|
256
|
+
**Package**: `npx opencodekit` to scaffold new projects
|
|
257
|
+
**New in v0.9.1**: Memory & Compaction plugin merge, session.start auto-load hook
|
|
266
258
|
**Ready for**: Daily production use
|
|
267
259
|
|
|
268
|
-
Enjoy your streamlined agent system with clean phase transitions!
|
|
260
|
+
Enjoy your streamlined agent system with clean phase transitions!
|
package/dist/index.js
CHANGED
|
@@ -750,7 +750,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
750
750
|
// package.json
|
|
751
751
|
var package_default = {
|
|
752
752
|
name: "opencodekit",
|
|
753
|
-
version: "0.9.
|
|
753
|
+
version: "0.9.1",
|
|
754
754
|
description: "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
755
755
|
type: "module",
|
|
756
756
|
repository: {
|
|
@@ -764,7 +764,10 @@ var package_default = {
|
|
|
764
764
|
bin: {
|
|
765
765
|
ock: "dist/index.js"
|
|
766
766
|
},
|
|
767
|
-
files: [
|
|
767
|
+
files: [
|
|
768
|
+
"dist",
|
|
769
|
+
"README.md"
|
|
770
|
+
],
|
|
768
771
|
scripts: {
|
|
769
772
|
dev: "bun run src/index.ts",
|
|
770
773
|
build: "bun build src/index.ts --outdir dist --target node && mkdir -p dist/template && rsync -av --exclude=node_modules --exclude=dist --exclude=.git --exclude=coverage --exclude=.next --exclude=.turbo --exclude=logs --exclude=package-lock.json .opencode/ dist/template/.opencode/",
|
|
@@ -776,7 +779,14 @@ var package_default = {
|
|
|
776
779
|
lint: "biome check .",
|
|
777
780
|
"lint:fix": "biome check --fix ."
|
|
778
781
|
},
|
|
779
|
-
keywords: [
|
|
782
|
+
keywords: [
|
|
783
|
+
"cli",
|
|
784
|
+
"opencodekit",
|
|
785
|
+
"template",
|
|
786
|
+
"agents",
|
|
787
|
+
"mcp",
|
|
788
|
+
"opencode"
|
|
789
|
+
],
|
|
780
790
|
author: "OpenCodeKit",
|
|
781
791
|
license: "MIT",
|
|
782
792
|
engines: {
|
|
@@ -799,7 +809,9 @@ var package_default = {
|
|
|
799
809
|
"@types/node": "^22.10.1",
|
|
800
810
|
typescript: "^5.7.2"
|
|
801
811
|
},
|
|
802
|
-
trustedDependencies: [
|
|
812
|
+
trustedDependencies: [
|
|
813
|
+
"@beads/bd"
|
|
814
|
+
]
|
|
803
815
|
};
|
|
804
816
|
|
|
805
817
|
// src/commands/agent.ts
|
|
@@ -186,7 +186,7 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
186
186
|
|
|
187
187
|
## MCP Services
|
|
188
188
|
|
|
189
|
-
**Enabled by default (
|
|
189
|
+
**Enabled by default (3 total):**
|
|
190
190
|
|
|
191
191
|
1. **context7** - Up-to-date library documentation (37.6k+ libraries)
|
|
192
192
|
- Requires: CONTEXT7_API_KEY
|
|
@@ -200,16 +200,19 @@ ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
|
200
200
|
- No API key needed (public service)
|
|
201
201
|
- GitHub: https://github.com/Shachlan/grep.app-mcp
|
|
202
202
|
|
|
203
|
-
**
|
|
203
|
+
**Skill-Embedded MCP (load on-demand):**
|
|
204
204
|
|
|
205
|
-
4. **
|
|
205
|
+
4. **figma** - Extract Figma layouts and design tokens
|
|
206
206
|
- Requires: FIGMA_API_KEY
|
|
207
|
-
-
|
|
208
|
-
- Enable: Set `"Framelink MCP for Figma": { "enabled": true }` in opencode.json
|
|
207
|
+
- Use: `skill({ name: "figma" })` then `skill_mcp()`
|
|
209
208
|
|
|
210
209
|
5. **playwright** - Browser automation for testing
|
|
211
210
|
- No API key needed
|
|
212
|
-
- Use
|
|
211
|
+
- Use: `skill({ name: "playwright" })` then `skill_mcp()`
|
|
212
|
+
|
|
213
|
+
6. **chrome-devtools** - DevTools for debugging and performance
|
|
214
|
+
- No API key needed
|
|
215
|
+
- Use: `skill({ name: "chrome-devtools" })` then `skill_mcp()`
|
|
213
216
|
|
|
214
217
|
---
|
|
215
218
|
|
|
@@ -326,7 +329,8 @@ fi
|
|
|
326
329
|
|
|
327
330
|
---
|
|
328
331
|
|
|
329
|
-
**OpenCodeKit v0.
|
|
332
|
+
**OpenCodeKit v0.9.1**
|
|
330
333
|
**Architecture:** Two-Layer (Memory + Beads + Git)
|
|
331
|
-
**New in v0.
|
|
332
|
-
**
|
|
334
|
+
**New in v0.9.1:** Memory & Compaction plugin merge, session.start auto-load hook
|
|
335
|
+
**Package:** `npx opencodekit` to scaffold new projects
|
|
336
|
+
**Last Updated:** January 2, 2026
|
|
@@ -57,6 +57,22 @@ Use LSP tools for safe, semantic refactoring. Use `lsp_rename` to rename functio
|
|
|
57
57
|
|
|
58
58
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
59
59
|
|
|
60
|
+
### AST-Grep
|
|
61
|
+
|
|
62
|
+
Semantic code search/replace - smarter than regex:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
# Search patterns
|
|
66
|
+
ast-grep pattern="console.log($$$)" # Find all console.log
|
|
67
|
+
ast-grep pattern="async function $NAME($$$) { $$$ }" # Find async functions
|
|
68
|
+
ast-grep pattern="const [$S, $SET] = useState($$$)" # Find React hooks
|
|
69
|
+
|
|
70
|
+
# Replace (dry run first)
|
|
71
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" dryRun=true
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
75
|
+
|
|
60
76
|
## Anti-Hallucination
|
|
61
77
|
|
|
62
78
|
**Before work:** Check bead spec if doing feature work (`bd show <id>`)
|
|
@@ -57,6 +57,15 @@ Use `lsp_rename` to rename symbols across the codebase - faster than manual find
|
|
|
57
57
|
|
|
58
58
|
**Caveat**: LSP tools modify files directly. Re-read before further edits.
|
|
59
59
|
|
|
60
|
+
### AST-Grep (Semantic Search/Replace)
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
ast-grep pattern="console.log($$$)" # Find console.log
|
|
64
|
+
ast-grep pattern="oldFunc($$$)" rewrite="newFunc($$$)" # Replace function calls
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Pattern syntax**: `$NAME` = single node, `$$$` = zero or more nodes
|
|
68
|
+
|
|
60
69
|
## Pre-Action Checks
|
|
61
70
|
|
|
62
71
|
Before mutations (edit, write, delete):
|
|
@@ -1,16 +1,93 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import * as path from "path";
|
|
1
3
|
import type { Plugin } from "@opencode-ai/plugin";
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
|
-
* Compaction Plugin
|
|
6
|
+
* Memory & Compaction Plugin
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Combines memory auto-loading with session compaction customization:
|
|
9
|
+
* 1. Auto-load memory on session start (session.start hook)
|
|
10
|
+
* 2. Inject memory + beads context into compaction
|
|
11
|
+
* 3. Custom compaction prompt for context continuity
|
|
8
12
|
*/
|
|
13
|
+
|
|
14
|
+
// Memory paths
|
|
15
|
+
const getGlobalUserMemoryPath = () =>
|
|
16
|
+
path.join(process.env.HOME || "~", ".config/opencode/memory/user.md");
|
|
17
|
+
|
|
18
|
+
const getProjectMemoryPath = (directory: string) =>
|
|
19
|
+
path.join(directory, ".opencode/memory");
|
|
20
|
+
|
|
21
|
+
// Load memory files for injection
|
|
22
|
+
const loadMemoryContext = async (directory: string): Promise<string[]> => {
|
|
23
|
+
const context: string[] = [];
|
|
24
|
+
|
|
25
|
+
// 1. Global user memory (cross-project preferences)
|
|
26
|
+
const globalUserPath = getGlobalUserMemoryPath();
|
|
27
|
+
if (fs.existsSync(globalUserPath)) {
|
|
28
|
+
try {
|
|
29
|
+
const content = fs.readFileSync(globalUserPath, "utf-8");
|
|
30
|
+
if (content.trim() && !content.includes("<!-- ")) {
|
|
31
|
+
context.push(`## User Profile (Global)\n${content}`);
|
|
32
|
+
}
|
|
33
|
+
} catch {}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// 2. Project memory files
|
|
37
|
+
const projectMemoryPath = getProjectMemoryPath(directory);
|
|
38
|
+
if (fs.existsSync(projectMemoryPath)) {
|
|
39
|
+
const files = [
|
|
40
|
+
"project/commands.md",
|
|
41
|
+
"project/conventions.md",
|
|
42
|
+
"project/gotchas.md",
|
|
43
|
+
"project/architecture.md",
|
|
44
|
+
];
|
|
45
|
+
for (const file of files) {
|
|
46
|
+
const filePath = path.join(projectMemoryPath, file);
|
|
47
|
+
if (fs.existsSync(filePath)) {
|
|
48
|
+
try {
|
|
49
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
50
|
+
// Only include if has actual content (not just template)
|
|
51
|
+
if (content.trim() && !content.includes("<!-- ")) {
|
|
52
|
+
const name = path.basename(file, ".md");
|
|
53
|
+
context.push(`## Project ${name}\n${content}`);
|
|
54
|
+
}
|
|
55
|
+
} catch {}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return context;
|
|
61
|
+
};
|
|
62
|
+
|
|
9
63
|
export const CompactionPlugin: Plugin = async (ctx) => {
|
|
10
64
|
const { $, directory } = ctx;
|
|
11
65
|
|
|
12
66
|
return {
|
|
67
|
+
// 1. Auto-load memory context on session start
|
|
68
|
+
"session.start": async (
|
|
69
|
+
_input: unknown,
|
|
70
|
+
output: { additionalContext?: string },
|
|
71
|
+
) => {
|
|
72
|
+
const memoryContext = await loadMemoryContext(directory);
|
|
73
|
+
|
|
74
|
+
if (memoryContext.length > 0) {
|
|
75
|
+
output.additionalContext = `
|
|
76
|
+
# Memory Context (Auto-loaded)
|
|
77
|
+
|
|
78
|
+
${memoryContext.join("\n\n")}
|
|
79
|
+
`;
|
|
80
|
+
console.log(
|
|
81
|
+
`[compaction] Injected ${memoryContext.length} memory contexts into session`,
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
// 2. Inject context into compaction
|
|
13
87
|
"experimental.session.compacting": async (input, output) => {
|
|
88
|
+
// Load memory context for compaction
|
|
89
|
+
const memoryContext = await loadMemoryContext(directory);
|
|
90
|
+
|
|
14
91
|
// Inject beads state if available
|
|
15
92
|
let beadsContext = "";
|
|
16
93
|
try {
|
|
@@ -26,9 +103,15 @@ export const CompactionPlugin: Plugin = async (ctx) => {
|
|
|
26
103
|
// Beads not available, skip
|
|
27
104
|
}
|
|
28
105
|
|
|
29
|
-
// Inject custom context
|
|
106
|
+
// Inject custom context with memory
|
|
107
|
+
const memorySection =
|
|
108
|
+
memoryContext.length > 0
|
|
109
|
+
? `\n## Persistent Memory\n${memoryContext.join("\n\n")}\n`
|
|
110
|
+
: "";
|
|
111
|
+
|
|
30
112
|
output.context.push(`## Session Context
|
|
31
113
|
${beadsContext}
|
|
114
|
+
${memorySection}
|
|
32
115
|
## Memory Files to Check
|
|
33
116
|
- .opencode/memory/project/gotchas.md - Non-obvious behaviors discovered
|
|
34
117
|
- .opencode/memory/project/commands.md - Build/test commands learned
|
|
@@ -53,7 +53,7 @@ function parseYamlFrontmatter(content: string): {
|
|
|
53
53
|
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
54
54
|
|
|
55
55
|
const indent = line.search(/\S/);
|
|
56
|
-
const keyMatch = trimmed.match(/^(\w+):\s*(.*)$/);
|
|
56
|
+
const keyMatch = trimmed.match(/^([\w-]+):\s*(.*)$/);
|
|
57
57
|
|
|
58
58
|
if (keyMatch) {
|
|
59
59
|
const [, key, value] = keyMatch;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chrome-devtools
|
|
3
|
+
description: Chrome DevTools for debugging, performance analysis, and browser automation. Use when debugging web apps, analyzing performance, inspecting network requests, or automating browser interactions.
|
|
4
|
+
mcp:
|
|
5
|
+
chrome-devtools:
|
|
6
|
+
command: npx
|
|
7
|
+
args: ["-y", "chrome-devtools-mcp@latest", "--stdio"]
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Chrome DevTools (MCP)
|
|
11
|
+
|
|
12
|
+
Control and inspect a live Chrome browser via Chrome DevTools Protocol. Debug, analyze performance, inspect network, and automate browser interactions.
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
skill_mcp(skill_name="chrome-devtools", tool_name="take_snapshot")
|
|
18
|
+
skill_mcp(skill_name="chrome-devtools", tool_name="navigate_page", arguments='{"type": "url", "url": "https://example.com"}')
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
### Input
|
|
24
|
+
|
|
25
|
+
| Tool | Description | Parameters |
|
|
26
|
+
| --------------- | -------------------- | ---------------------------- |
|
|
27
|
+
| `click` | Click element | `uid` |
|
|
28
|
+
| `fill` | Type text | `uid`, `value` |
|
|
29
|
+
| `fill_form` | Fill multiple fields | `elements` array |
|
|
30
|
+
| `hover` | Hover element | `uid` |
|
|
31
|
+
| `press_key` | Press key | `key` (e.g., "Enter") |
|
|
32
|
+
| `drag` | Drag element | `from_uid`, `to_uid` |
|
|
33
|
+
| `upload_file` | Upload file | `uid`, `filePath` |
|
|
34
|
+
| `handle_dialog` | Handle dialog | `action`: "accept"/"dismiss" |
|
|
35
|
+
|
|
36
|
+
### Navigation
|
|
37
|
+
|
|
38
|
+
| Tool | Description | Parameters |
|
|
39
|
+
| --------------- | ------------- | ---------------------------------------------- |
|
|
40
|
+
| `navigate_page` | Navigate | `type`: "url"/"back"/"forward"/"reload", `url` |
|
|
41
|
+
| `new_page` | Open new page | `url` |
|
|
42
|
+
| `list_pages` | List pages | - |
|
|
43
|
+
| `select_page` | Switch page | `pageIdx` |
|
|
44
|
+
| `close_page` | Close page | `pageIdx` |
|
|
45
|
+
| `wait_for` | Wait for text | `text`, `timeout` |
|
|
46
|
+
|
|
47
|
+
### Debugging
|
|
48
|
+
|
|
49
|
+
| Tool | Description | Parameters |
|
|
50
|
+
| ----------------------- | ------------------ | --------------------------- |
|
|
51
|
+
| `take_snapshot` | A11y tree snapshot | `verbose` |
|
|
52
|
+
| `take_screenshot` | Screenshot | `uid`, `fullPage`, `format` |
|
|
53
|
+
| `evaluate_script` | Run JS | `function`, `args` |
|
|
54
|
+
| `list_console_messages` | Console logs | `types` filter |
|
|
55
|
+
| `get_console_message` | Get message | `msgid` |
|
|
56
|
+
|
|
57
|
+
### Network
|
|
58
|
+
|
|
59
|
+
| Tool | Description | Parameters |
|
|
60
|
+
| ----------------------- | --------------- | --------------------------- |
|
|
61
|
+
| `list_network_requests` | List requests | `resourceTypes`, `pageSize` |
|
|
62
|
+
| `get_network_request` | Request details | `reqid` |
|
|
63
|
+
|
|
64
|
+
### Performance
|
|
65
|
+
|
|
66
|
+
| Tool | Description | Parameters |
|
|
67
|
+
| ----------------------------- | ----------- | ----------------------------- |
|
|
68
|
+
| `performance_start_trace` | Start trace | `reload`, `autoStop` |
|
|
69
|
+
| `performance_stop_trace` | Stop trace | - |
|
|
70
|
+
| `performance_analyze_insight` | Analyze | `insightSetId`, `insightName` |
|
|
71
|
+
|
|
72
|
+
### Emulation
|
|
73
|
+
|
|
74
|
+
| Tool | Description | Parameters |
|
|
75
|
+
| ------------- | ------------------ | ---------------------------------------- |
|
|
76
|
+
| `emulate` | Emulate conditions | `networkConditions`, `cpuThrottlingRate` |
|
|
77
|
+
| `resize_page` | Resize viewport | `width`, `height` |
|
|
78
|
+
|
|
79
|
+
## Tips
|
|
80
|
+
|
|
81
|
+
- **Always `take_snapshot` first** to get element `uid`s
|
|
82
|
+
- **Element uids change** after navigation - take fresh snapshot
|
|
83
|
+
- **Network conditions**: "Slow 3G", "Fast 3G", "Offline"
|
|
84
|
+
|
|
85
|
+
## vs Playwright
|
|
86
|
+
|
|
87
|
+
- **chrome-devtools**: Performance profiling, network inspection, console - Chrome only
|
|
88
|
+
- **playwright**: Cross-browser testing - Chrome, Firefox, WebKit
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: polar
|
|
3
|
+
description: Polar payment platform integration for monetization, subscriptions, and license keys. Use when implementing checkout, managing products, or building customer portals.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Polar Integration
|
|
7
|
+
|
|
8
|
+
Polar is a merchant-of-record platform for digital products, subscriptions, and license keys.
|
|
9
|
+
|
|
10
|
+
## What I Do
|
|
11
|
+
|
|
12
|
+
- Guide implementation of Polar checkout and payments
|
|
13
|
+
- Help with subscription management and billing
|
|
14
|
+
- Assist with license key validation
|
|
15
|
+
- Set up webhook handlers for payment events
|
|
16
|
+
|
|
17
|
+
## When to Use Me
|
|
18
|
+
|
|
19
|
+
- Implementing checkout flow for a product
|
|
20
|
+
- Adding subscription billing to an app
|
|
21
|
+
- Setting up license key validation
|
|
22
|
+
- Building a customer portal
|
|
23
|
+
- Handling payment webhooks
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @polar-sh/sdk
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
import { Polar } from "@polar-sh/sdk";
|
|
33
|
+
|
|
34
|
+
const polar = new Polar({
|
|
35
|
+
accessToken: process.env.POLAR_ACCESS_TOKEN!,
|
|
36
|
+
server: "production", // or "sandbox"
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Key APIs
|
|
41
|
+
|
|
42
|
+
| API | Purpose |
|
|
43
|
+
| ----------------------- | --------------------------------- |
|
|
44
|
+
| `polar.products.*` | Create/manage products and prices |
|
|
45
|
+
| `polar.checkouts.*` | Create checkout sessions |
|
|
46
|
+
| `polar.subscriptions.*` | Manage subscriptions |
|
|
47
|
+
| `polar.orders.*` | View order history |
|
|
48
|
+
| `polar.customers.*` | Customer management |
|
|
49
|
+
| `polar.licenseKeys.*` | Issue and validate licenses |
|
|
50
|
+
|
|
51
|
+
## Environment Variables
|
|
52
|
+
|
|
53
|
+
| Variable | Description |
|
|
54
|
+
| ---------------------- | ------------------------------- |
|
|
55
|
+
| `POLAR_ACCESS_TOKEN` | Organization Access Token (OAT) |
|
|
56
|
+
| `POLAR_WEBHOOK_SECRET` | Webhook signing secret |
|
|
57
|
+
|
|
58
|
+
## Common Patterns
|
|
59
|
+
|
|
60
|
+
### Create Checkout
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
const checkout = await polar.checkouts.create({
|
|
64
|
+
productId: "prod_xxx",
|
|
65
|
+
successUrl: "https://myapp.com/success",
|
|
66
|
+
});
|
|
67
|
+
// Redirect to checkout.url
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Validate License Key
|
|
71
|
+
|
|
72
|
+
```typescript
|
|
73
|
+
const result = await polar.licenseKeys.validate({
|
|
74
|
+
key: "XXXX-XXXX-XXXX-XXXX",
|
|
75
|
+
organizationId: "org_xxx",
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Handle Webhook
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import { validateEvent } from "@polar-sh/sdk/webhooks";
|
|
83
|
+
|
|
84
|
+
const event = validateEvent(body, signature, process.env.POLAR_WEBHOOK_SECRET!);
|
|
85
|
+
// event.type: "subscription.created", "order.created", etc.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Links
|
|
89
|
+
|
|
90
|
+
- [Dashboard](https://polar.sh)
|
|
91
|
+
- [API Docs](https://docs.polar.sh/api-reference)
|
|
92
|
+
- [SDK](https://www.npmjs.com/package/@polar-sh/sdk)
|
package/package.json
CHANGED
|
@@ -1,53 +1,65 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
2
|
+
"name": "opencodekit",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "CLI tool for bootstrapping and managing OpenCodeKit projects",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/opencodekit/opencodekit-template.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public",
|
|
12
|
+
"registry": "https://registry.npmjs.org"
|
|
13
|
+
},
|
|
14
|
+
"bin": {
|
|
15
|
+
"ock": "dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "bun run src/index.ts",
|
|
23
|
+
"build": "bun build src/index.ts --outdir dist --target node && mkdir -p dist/template && rsync -av --exclude=node_modules --exclude=dist --exclude=.git --exclude=coverage --exclude=.next --exclude=.turbo --exclude=logs --exclude=package-lock.json .opencode/ dist/template/.opencode/",
|
|
24
|
+
"compile": "bun build src/index.ts --compile --outfile ock",
|
|
25
|
+
"compile:binary": "bun build src/index.ts --compile --outfile bin/ock",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"test": "bun test",
|
|
28
|
+
"test:watch": "bun test --watch",
|
|
29
|
+
"lint": "biome check .",
|
|
30
|
+
"lint:fix": "biome check --fix ."
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"cli",
|
|
34
|
+
"opencodekit",
|
|
35
|
+
"template",
|
|
36
|
+
"agents",
|
|
37
|
+
"mcp",
|
|
38
|
+
"opencode"
|
|
39
|
+
],
|
|
40
|
+
"author": "OpenCodeKit",
|
|
41
|
+
"license": "MIT",
|
|
42
|
+
"engines": {
|
|
43
|
+
"bun": ">=1.3.2"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@clack/prompts": "^0.7.0",
|
|
47
|
+
"@opencode-ai/plugin": "^1.0.141",
|
|
48
|
+
"beads-village": "^1.3.3",
|
|
49
|
+
"cac": "^6.7.14",
|
|
50
|
+
"cli-table3": "^0.6.5",
|
|
51
|
+
"ora": "^9.0.0",
|
|
52
|
+
"picocolors": "^1.1.1",
|
|
53
|
+
"zod": "^3.23.8"
|
|
54
|
+
},
|
|
55
|
+
"devDependencies": {
|
|
56
|
+
"@beads/bd": "^0.29.0",
|
|
57
|
+
"@biomejs/biome": "^1.9.4",
|
|
58
|
+
"@types/bun": "latest",
|
|
59
|
+
"@types/node": "^22.10.1",
|
|
60
|
+
"typescript": "^5.7.2"
|
|
61
|
+
},
|
|
62
|
+
"trustedDependencies": [
|
|
63
|
+
"@beads/bd"
|
|
64
|
+
]
|
|
53
65
|
}
|