-
Notifications
You must be signed in to change notification settings - Fork 0
feat(skill-loader): include sibling .md files and script contents #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
d245fc4
68a5c8b
6ebf6d8
590d265
4740642
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,3 +33,6 @@ yarn.lock | |
| test-injection/ | ||
| notepad.md | ||
| oauth-success.html | ||
|
|
||
| # Session files | ||
| session-*.md | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| 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. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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---/) | ||
|
|
@@ -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') | ||
|
|
@@ -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\`\`\`` | ||
| } | ||
| return header | ||
| }).join('\n\n') + | ||
| '\n</supporting-files>\n\n' | ||
| : '' | ||
|
|
||
|
|
@@ -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([ | ||
|
|
@@ -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([ | ||
|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. logic: comment says "loaded first" but in 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 AIThis 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] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: if
f.contentcontains 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