Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sisyphus-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ jobs:
- user.email: sisyphus-dev-ai@users.noreply.github.com
PROMPT_EOF
)
jq --arg append "$PROMPT_APPEND" '.agents.Sisyphus.prompt_append = $append' "$OMO_JSON" > /tmp/omo.json && mv /tmp/omo.json "$OMO_JSON"
jq --arg append "$PROMPT_APPEND" '.agents.Musashi.prompt_append = $append' "$OMO_JSON" > /tmp/omo.json && mv /tmp/omo.json "$OMO_JSON"

mkdir -p ~/.local/share/opencode
echo "$OPENCODE_AUTH_JSON" > ~/.local/share/opencode/auth.json
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ yarn.lock
test-injection/
notepad.md
oauth-success.html

# Session files
session-*.md
12 changes: 12 additions & 0 deletions assets/oh-my-opencode.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -5110,6 +5110,18 @@
}
}
},
"category_skills": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
},
"claude_code": {
"type": "object",
"properties": {
Expand Down
8 changes: 4 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"@clack/prompts": "^0.11.0",
"@code-yeongyu/comment-checker": "^0.6.1",
"@modelcontextprotocol/sdk": "^1.25.1",
"@opencode-ai/plugin": "^1.1.19",
"@opencode-ai/sdk": "^1.1.19",
"@opencode-ai/plugin": "^1.1.30",
"@opencode-ai/sdk": "1.1.30",
"@types/express": "^5.0.6",
"@types/turndown": "^5.0.6",
"commander": "^14.0.2",
Expand Down
4 changes: 4 additions & 0 deletions src/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ export const GitMasterConfigSchema = z.object({
include_co_authored_by: z.boolean().default(true),
})

export const CategorySkillsConfigSchema = z.record(z.string(), z.array(z.string()))

export const OhMyOpenCodeConfigSchema = z.object({
$schema: z.string().optional(),
disabled_mcps: z.array(AnyMcpNameSchema).optional(),
Expand All @@ -359,6 +361,7 @@ export const OhMyOpenCodeConfigSchema = z.object({
disabled_commands: z.array(BuiltinCommandNameSchema).optional(),
agents: AgentOverridesSchema.optional(),
categories: CategoriesConfigSchema.optional(),
category_skills: CategorySkillsConfigSchema.optional(),
claude_code: ClaudeCodeConfigSchema.optional(),
sisyphus_agent: SisyphusAgentConfigSchema.optional(),
comment_checker: CommentCheckerConfigSchema.optional(),
Expand Down Expand Up @@ -389,6 +392,7 @@ export type RalphLoopConfig = z.infer<typeof RalphLoopConfigSchema>
export type NotificationConfig = z.infer<typeof NotificationConfigSchema>
export type CategoryConfig = z.infer<typeof CategoryConfigSchema>
export type CategoriesConfig = z.infer<typeof CategoriesConfigSchema>
export type CategorySkillsConfig = z.infer<typeof CategorySkillsConfigSchema>
export type BuiltinCategoryName = z.infer<typeof BuiltinCategoryNameSchema>
export type GitMasterConfig = z.infer<typeof GitMasterConfigSchema>

Expand Down
45 changes: 45 additions & 0 deletions src/features/builtin-skills/linearis/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: linearis
description: (opencode - Skill) Linear CLI tool for issue tracking. Use for creating, listing, updating issues, projects, and cycles. Optimized for LLMs with JSON output.
---

# Linearis Skill

Linearis is a high-performance CLI tool for Linear.app that outputs structured JSON data. It is designed for LLM agents.

## Usage

Always use `npx linearis` to execute commands.

### Common Commands

**Issues**
- List issues: `npx linearis issues list -l 10`
- Read issue: `npx linearis issues read ABC-123`
- Create issue: `npx linearis issues create "Title" --team ABC --description "Desc"`
- Update issue: `npx linearis issues update ABC-123 --status "In Progress"`
- Search: `npx linearis issues search "query" --team ABC`

**Projects & Cycles**
- List projects: `npx linearis projects list`
- List cycles: `npx linearis cycles list --team ABC`
- Read cycle: `npx linearis cycles read "Sprint 1" --team ABC`

**Users & Teams**
- List users: `npx linearis users list`
- List teams: `npx linearis teams list`

### Output Format

All commands output structured JSON. You can parse this with `jq` or read it directly.

### Best Practices

1. **IDs**: Use `ABC-123` format for issues.
2. **Context**: If team/project is ambiguous, the tool will error. Be specific with `--team` or `--project` flags.
3. **Embeds**: `issues read` includes file embeds. Use `npx linearis embeds download <url>` to fetch them.

## Authentication

Authentication is handled via `~/.linear_api_token` or `LINEAR_API_TOKEN` env var.
If authentication fails, ask the user to provide a Linear API token.
21 changes: 16 additions & 5 deletions src/features/opencode-skill-loader/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type { SkillScope, SkillMetadata, LoadedSkill, LazyContentLoader } from "
import type { SkillMcpConfig } from "../skill-mcp-manager/types"
import { collectMdFilesRecursive, parseAllowedTools, validateShellConfig } from "./utils"
import { preprocessShellCommands, executeShellBlock, substituteShellVariables } from "./shell-preprocessing"
import { discoverSupportingFiles, formatSize } from "./supporting-files"
import { discoverSupportingFiles, formatSize, getLanguageFromExtension } from "./supporting-files"

function parseSkillMcpConfigFromFrontmatter(content: string): SkillMcpConfig | undefined {
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)
Expand Down Expand Up @@ -75,7 +75,7 @@ export async function loadSkillFromPath(
const mcpJsonMcp = await loadMcpJsonFromDir(resolvedPath)
const mcpConfig = mcpJsonMcp || frontmatterMcp

const subdirFiles = await collectMdFilesRecursive(resolvedPath, 0, 3, '')
const subdirFiles = await collectMdFilesRecursive(resolvedPath, 0, 3, '', new Set(['SKILL.md']))
const mergedContent = subdirFiles.length > 0
? '\n\n<!-- Merged from subdirectories (alphabetical by path) -->\n\n' +
subdirFiles.map(f => f.content).join('\n\n')
Expand All @@ -84,7 +84,14 @@ export async function loadSkillFromPath(
const supportingFiles = await discoverSupportingFiles(resolvedPath)
const supportingFilesSection = supportingFiles.length > 0
? '\n<supporting-files>\n' +
supportingFiles.map(f => `${f.relativePath} (${formatSize(f.sizeBytes)})`).join('\n') +
supportingFiles.map(f => {
const header = `${f.relativePath} (${formatSize(f.sizeBytes)})`
if (f.content) {
const lang = getLanguageFromExtension(f.extension)
return `${header}\n\`\`\`${lang}\n${f.content}\n\`\`\``
Comment on lines +89 to +91
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: if f.content contains triple backticks (```), the markdown rendering will break. Consider escaping or warning about this edge case in large codebases. Do skills typically contain files with triple backticks in their content?

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/features/opencode-skill-loader/loader.ts
Line: 89:91

Comment:
**style:** if `f.content` contains triple backticks (\`\`\`), the markdown rendering will break. Consider escaping or warning about this edge case in large codebases. Do skills typically contain files with triple backticks in their content?

How can I resolve this? If you propose a fix, please make it concise.

}
return header
}).join('\n\n') +
'\n</supporting-files>\n\n'
: ''

Expand Down Expand Up @@ -211,6 +218,7 @@ export async function loadProjectSkills(): Promise<Record<string, CommandDefinit

export async function loadOpencodeGlobalSkills(): Promise<Record<string, CommandDefinition>> {
// Support both singular (oh-my-opencode convention) and plural (vercel-labs/add-skill convention)
// Plural takes priority (loaded last to override) as it's the newer convention
const skillsSingular = join(homedir(), ".config", "opencode", "skill")
const skillsPlural = join(homedir(), ".config", "opencode", "skills")
const [singular, plural] = await Promise.all([
Expand All @@ -222,6 +230,7 @@ export async function loadOpencodeGlobalSkills(): Promise<Record<string, Command

export async function loadOpencodeProjectSkills(): Promise<Record<string, CommandDefinition>> {
// Support both singular (oh-my-opencode convention) and plural (vercel-labs/add-skill convention)
// Plural takes priority (loaded last to override) as it's the newer convention
const skillsSingular = join(process.cwd(), ".opencode", "skill")
const skillsPlural = join(process.cwd(), ".opencode", "skills")
const [singular, plural] = await Promise.all([
Expand Down Expand Up @@ -294,22 +303,24 @@ export async function discoverProjectClaudeSkills(): Promise<LoadedSkill[]> {

export async function discoverOpencodeGlobalSkills(): Promise<LoadedSkill[]> {
// Support both singular (oh-my-opencode convention) and plural (vercel-labs/add-skill convention)
// Plural takes priority (loaded first) as it's the newer convention
const skillsSingular = join(homedir(), ".config", "opencode", "skill")
const skillsPlural = join(homedir(), ".config", "opencode", "skills")
const [singular, plural] = await Promise.all([
loadSkillsFromDir(skillsSingular, "opencode"),
loadSkillsFromDir(skillsPlural, "opencode"),
])
return [...singular, ...plural]
return [...plural, ...singular]
Comment on lines +306 to +313
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: comment says "loaded first" but in [...plural, ...singular], plural is actually first in the array. For LoadedSkill[] arrays, order matters differently than for Record conversion. In lines 228 and 240, [...singular, ...plural] gives plural priority via skillsToRecord() (last wins). Here, [...plural, ...singular] puts plural first, which may not give it priority depending on how the array is consumed downstream.

verify the intended priority behavior matches the comment and implementation. Does the order matter for LoadedSkill[] arrays in the same way as for Record conversion, or is first-in-array actually the correct priority here?

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/features/opencode-skill-loader/loader.ts
Line: 306:313

Comment:
**logic:** comment says "loaded first" but in `[...plural, ...singular]`, plural is actually first in the array. For `LoadedSkill[]` arrays, order matters differently than for `Record` conversion. In lines 228 and 240, `[...singular, ...plural]` gives plural priority via `skillsToRecord()` (last wins). Here, `[...plural, ...singular]` puts plural first, which may not give it priority depending on how the array is consumed downstream.

verify the intended priority behavior matches the comment and implementation. Does the order matter for LoadedSkill[] arrays in the same way as for Record conversion, or is first-in-array actually the correct priority here?

How can I resolve this? If you propose a fix, please make it concise.

}

export async function discoverOpencodeProjectSkills(): Promise<LoadedSkill[]> {
// Support both singular (oh-my-opencode convention) and plural (vercel-labs/add-skill convention)
// Plural takes priority (loaded first) as it's the newer convention
const skillsSingular = join(process.cwd(), ".opencode", "skill")
const skillsPlural = join(process.cwd(), ".opencode", "skills")
const [singular, plural] = await Promise.all([
loadSkillsFromDir(skillsSingular, "opencode-project"),
loadSkillsFromDir(skillsPlural, "opencode-project"),
])
return [...singular, ...plural]
return [...plural, ...singular]
}
18 changes: 9 additions & 9 deletions src/features/opencode-skill-loader/skill-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe("resolveMultipleSkillsAsync", () => {
expect(result.notFound).toEqual([])
const gitMasterContent = result.resolved.get("git-master")
expect(gitMasterContent).not.toContain("Ultraworked with")
expect(gitMasterContent).not.toContain("Co-authored-by: Sisyphus")
expect(gitMasterContent).not.toContain("Co-authored-by: Musashi")
})

it("should inject watermark when enabled (default)", async () => {
Expand All @@ -197,8 +197,8 @@ describe("resolveMultipleSkillsAsync", () => {
// #then: watermark section is injected
expect(result.resolved.size).toBe(1)
const gitMasterContent = result.resolved.get("git-master")
expect(gitMasterContent).toContain("Ultraworked with [Sisyphus]")
expect(gitMasterContent).toContain("Co-authored-by: Sisyphus")
expect(gitMasterContent).toContain("Ultraworked with [Musashi]")
expect(gitMasterContent).toContain("Co-authored-by: Musashi")
})

it("should inject only footer when co-author is disabled", async () => {
Expand All @@ -216,8 +216,8 @@ describe("resolveMultipleSkillsAsync", () => {

// #then: only footer is injected
const gitMasterContent = result.resolved.get("git-master")
expect(gitMasterContent).toContain("Ultraworked with [Sisyphus]")
expect(gitMasterContent).not.toContain("Co-authored-by: Sisyphus")
expect(gitMasterContent).toContain("Ultraworked with [Musashi]")
expect(gitMasterContent).not.toContain("Co-authored-by: Musashi")
})

it("should inject watermark by default when no config provided", async () => {
Expand All @@ -230,8 +230,8 @@ describe("resolveMultipleSkillsAsync", () => {
// #then: watermark is injected (default is ON)
expect(result.resolved.size).toBe(1)
const gitMasterContent = result.resolved.get("git-master")
expect(gitMasterContent).toContain("Ultraworked with [Sisyphus]")
expect(gitMasterContent).toContain("Co-authored-by: Sisyphus")
expect(gitMasterContent).toContain("Ultraworked with [Musashi]")
expect(gitMasterContent).toContain("Co-authored-by: Musashi")
})

it("should inject only co-author when footer is disabled", async () => {
Expand All @@ -249,8 +249,8 @@ describe("resolveMultipleSkillsAsync", () => {

// #then: only co-author is injected
const gitMasterContent = result.resolved.get("git-master")
expect(gitMasterContent).not.toContain("Ultraworked with [Sisyphus]")
expect(gitMasterContent).toContain("Co-authored-by: Sisyphus")
expect(gitMasterContent).not.toContain("Ultraworked with [Musashi]")
expect(gitMasterContent).toContain("Co-authored-by: Musashi")
})

it("should handle empty array", async () => {
Expand Down
8 changes: 4 additions & 4 deletions src/features/opencode-skill-loader/skill-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ async function getAllSkills(): Promise<LoadedSkill[]> {
}

async function extractSkillTemplate(skill: LoadedSkill): Promise<string> {
if (skill.path) {
const content = readFileSync(skill.path, "utf-8")
const { body } = parseFrontmatter(content)
return body.trim()
if (skill.lazyContent) {
const fullTemplate = await skill.lazyContent.load()
const templateMatch = fullTemplate.match(/<skill-instruction>([\s\S]*?)<\/skill-instruction>/)
return templateMatch ? templateMatch[1].trim() : fullTemplate
}
return skill.definition.template || ""
}
Expand Down
19 changes: 10 additions & 9 deletions src/features/opencode-skill-loader/supporting-files.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,16 @@ describe("supporting-files", () => {
expect(files.find((f) => f.relativePath === "package.json")).toBeTruthy()
})

it("limits to 20 files and filters by size", async () => {
// Create 25 small files
for (let i = 0; i < 25; i++) {
await fs.writeFile(join(tmpDir, `file${i}.txt`), "content")
}
it("limits to 25 files and filters by size", async () => {
// Create 30 small files
for (let i = 0; i < 30; i++) {
await fs.writeFile(join(tmpDir, `file${i}.txt`), "content")
}

const files = await discoverSupportingFiles(tmpDir)
const files = await discoverSupportingFiles(tmpDir)

expect(files.length).toBeLessThanOrEqual(20)
})
expect(files.length).toBeLessThanOrEqual(25)
})

it("filters out files larger than 1MB", async () => {
// Create a small file
Expand All @@ -96,7 +96,7 @@ describe("supporting-files", () => {
expect(files.find((f) => f.relativePath === "visible.txt")).toBeTruthy()
})

it("includes file metadata", async () => {
it("includes file metadata and content for small files", async () => {
await fs.writeFile(join(tmpDir, "config.json"), '{"key":"value"}')

const files = await discoverSupportingFiles(tmpDir)
Expand All @@ -106,6 +106,7 @@ describe("supporting-files", () => {
expect(file.absolutePath).toBe(join(tmpDir, "config.json"))
expect(file.extension).toBe(".json")
expect(file.sizeBytes).toBeGreaterThan(0)
expect(file.content).toBe('{"key":"value"}')
})
})
})
Loading
Loading