@moskala/oneagent-templates 0.2.5 → 0.3.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/README.md ADDED
@@ -0,0 +1,203 @@
1
+ # Creating oneagent templates
2
+
3
+ This guide explains how to build a custom oneagent template that others can use.
4
+
5
+ ---
6
+
7
+ ## Repository structure
8
+
9
+ Template files must live at the **root** of the repository:
10
+
11
+ ```
12
+ your-template/ ← GitHub repo root
13
+ template.yml # required
14
+ instructions.md # required
15
+ rules/ # optional
16
+ rule-name.md
17
+ another-rule.md
18
+ ```
19
+
20
+ Install with:
21
+ ```sh
22
+ npx oneagent init --template https://github.com/your-org/your-template
23
+ ```
24
+
25
+ ### Templates inside a subdirectory
26
+
27
+ If you want to keep the template in a subdirectory (e.g. in a monorepo), put the files there and point to it using a GitHub tree URL:
28
+
29
+ ```
30
+ your-repo/
31
+ packages/
32
+ my-template/
33
+ template.yml
34
+ instructions.md
35
+ rules/
36
+ ```
37
+
38
+ ```sh
39
+ npx oneagent init --template https://github.com/your-org/your-repo/tree/main/packages/my-template
40
+ ```
41
+
42
+ ### Pointing to a specific branch
43
+
44
+ ```sh
45
+ npx oneagent init --template https://github.com/your-org/your-template/tree/next
46
+ ```
47
+
48
+ ---
49
+
50
+ ## `template.yml`
51
+
52
+ The manifest file. `name` and `description` are required; everything else is optional.
53
+
54
+ ```yaml
55
+ name: my-template
56
+ description: Short description shown in the interactive picker
57
+
58
+ skills:
59
+ - repo: https://github.com/vercel-labs/skills
60
+ skill: vercel-react-best-practices
61
+ - repo: https://github.com/vercel-labs/skills
62
+ skill: vercel-composition-patterns
63
+
64
+ plugins:
65
+ - target: claude
66
+ id: typescript-lsp@claude-plugins-official
67
+ - target: cursor
68
+ id: vercel
69
+ - target: copilot
70
+ id: some-plugin@some-marketplace
71
+ - target: opencode
72
+ id: opencode-wakatime
73
+ ```
74
+
75
+ ### `name`
76
+
77
+ Identifier shown in logs and the setup summary. Use lowercase, hyphenated.
78
+
79
+ ### `description`
80
+
81
+ One-line description shown in the interactive template picker.
82
+
83
+ ### `skills`
84
+
85
+ Skills to install. Each entry specifies a GitHub repository and the skill name within it — matching the `npx skills add <repo> --skill <name>` command.
86
+
87
+ ```yaml
88
+ skills:
89
+ - repo: https://github.com/vercel-labs/skills
90
+ skill: vercel-react-best-practices
91
+ - repo: https://github.com/remotion-dev/skills
92
+ skill: remotion-best-practices
93
+ ```
94
+
95
+ Installed after symlinks are set up, so they land in `.oneagent/skills/` and get distributed to all configured agents automatically.
96
+
97
+ ### `plugins`
98
+
99
+ Agent plugins to install. Each entry has:
100
+
101
+ | Field | Description |
102
+ |-------|-------------|
103
+ | `target` | Which agent to install the plugin for |
104
+ | `id` | Plugin identifier as expected by that agent's install command |
105
+
106
+ How each target installs:
107
+
108
+ | Target | Method | Notes |
109
+ |--------|--------|-------|
110
+ | `claude` | `claude plugin install <id>` | Via Claude Code CLI |
111
+ | `copilot` | `copilot plugin install <id>` | Via GitHub Copilot CLI |
112
+ | `opencode` | Added to `"plugin"` array in `opencode.json` | Config-based |
113
+ | `cursor` | Not automated | User sees: `Run in Cursor chat: /add-plugin <id>` |
114
+ | `windsurf` | Not supported yet | Skipped silently |
115
+
116
+ Only plugins for agents the user selected during `init` are installed.
117
+
118
+ ---
119
+
120
+ ## `instructions.md`
121
+
122
+ The main AI instructions file. Written to `.oneagent/instructions.md` and distributed to all configured agents.
123
+
124
+ Write it as if you're explaining the project to an AI assistant — stack, conventions, what to avoid.
125
+
126
+ ```md
127
+ # Project Instructions
128
+
129
+ This is a TypeScript monorepo using pnpm workspaces.
130
+
131
+ ## Stack
132
+
133
+ - Node.js 20, TypeScript 5
134
+ - Fastify for the API
135
+ - Drizzle ORM with PostgreSQL
136
+
137
+ ## Conventions
138
+
139
+ - No floating promises — always handle async errors explicitly
140
+ - Use `zod` for validation at API boundaries
141
+ - Tests live next to source files as `*.test.ts`
142
+ ```
143
+
144
+ ---
145
+
146
+ ## `rules/` directory
147
+
148
+ Optional. Each `.md` file becomes a rule in `.oneagent/rules/` and is distributed to all agents that support rules (Claude Code, Cursor, Windsurf, etc.).
149
+
150
+ ### Minimal rule
151
+
152
+ ```md
153
+ # No console.log in production
154
+
155
+ Remove all `console.log` calls before committing. Use a structured logger instead.
156
+ ```
157
+
158
+ ### Rule with frontmatter
159
+
160
+ ```md
161
+ ---
162
+ applyTo: "**/*.ts"
163
+ ---
164
+ # TypeScript conventions
165
+
166
+ - Never use `any` — use `unknown` and narrow the type explicitly
167
+ - Prefer `type` over `interface` for object shapes
168
+ - Always annotate function return types
169
+ ```
170
+
171
+ `applyTo` is a glob that scopes the rule to specific files. Omit it to apply the rule globally.
172
+
173
+ ### File naming
174
+
175
+ Rule files are named after their filename (without `.md`). Use lowercase, hyphenated names:
176
+
177
+ ```
178
+ rules/
179
+ no-console.md
180
+ typescript-conventions.md
181
+ commit-style.md
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Minimal example
187
+
188
+ The smallest valid template is two files:
189
+
190
+ `template.yml`:
191
+ ```yaml
192
+ name: my-template
193
+ description: My team's standard setup
194
+ ```
195
+
196
+ `instructions.md`:
197
+ ```md
198
+ # Project Instructions
199
+
200
+ Follow the team coding standards documented in Notion.
201
+ ```
202
+
203
+ Skills, plugins, and rules are all optional.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moskala/oneagent-templates",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Built-in templates for oneagent",
6
6
  "license": "MIT",
@@ -15,6 +15,9 @@
15
15
  "scripts": {
16
16
  "typecheck": "tsc --noEmit"
17
17
  },
18
+ "dependencies": {
19
+ "@moskala/oneagent-core": "0.2.5"
20
+ },
18
21
  "devDependencies": {
19
22
  "@types/bun": "latest",
20
23
  "typescript": "^5"
package/src/index.ts CHANGED
@@ -1,16 +1,11 @@
1
1
  import path from "path";
2
2
  import fs from "fs/promises";
3
3
  import { fileURLToPath } from "url";
4
+ import { type TemplatePlugin, type TemplateDefinition, parseTemplateYaml } from "@moskala/oneagent-core";
4
5
 
5
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ export type { TemplatePlugin, TemplateDefinition };
6
7
 
7
- export interface TemplateDefinition {
8
- name: string;
9
- description: string;
10
- skills: string[];
11
- instructions: string;
12
- rules: Array<{ name: string; content: string }>;
13
- }
8
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
14
9
 
15
10
  type BuiltinTemplateName = "default" | "react" | "react-native";
16
11
 
@@ -24,19 +19,7 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
24
19
  fs.readFile(path.join(templateDir, "instructions.md"), "utf-8"),
25
20
  ]);
26
21
 
27
- // Minimal YAML parsing for our simple structure
28
- const descMatch = yamlText.match(/^description:\s*(.+)$/m);
29
- const description = descMatch?.[1]?.trim() ?? "";
30
-
31
- const skills: string[] = [];
32
- const skillsBlockMatch = yamlText.match(/^skills:\s*\n((?: - .+\n?)*)/m);
33
- if (skillsBlockMatch) {
34
- const lines = skillsBlockMatch[1]!.split("\n").filter(Boolean);
35
- for (const line of lines) {
36
- const skill = line.replace(/^\s*-\s*/, "").trim();
37
- if (skill) skills.push(skill);
38
- }
39
- }
22
+ const { description, skills, plugins } = parseTemplateYaml(yamlText, name);
40
23
 
41
24
  const rulesDir = path.join(templateDir, "rules");
42
25
  let rules: Array<{ name: string; content: string }> = [];
@@ -54,7 +37,7 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
54
37
  // No rules directory — fine
55
38
  }
56
39
 
57
- return { name, description, skills, instructions, rules };
40
+ return { name, description, skills, plugins, instructions, rules };
58
41
  }
59
42
 
60
43
  export async function resolveBuiltinTemplate(name: string): Promise<TemplateDefinition | null> {
@@ -63,3 +46,14 @@ export async function resolveBuiltinTemplate(name: string): Promise<TemplateDefi
63
46
  }
64
47
 
65
48
  export const BUILTIN_TEMPLATE_NAMES: readonly string[] = TEMPLATE_NAMES;
49
+
50
+ export interface BuiltinTemplateMeta {
51
+ name: string;
52
+ description: string;
53
+ }
54
+
55
+ export const BUILTIN_TEMPLATE_META: BuiltinTemplateMeta[] = [
56
+ { name: "default", description: "General programming starter" },
57
+ { name: "react", description: "React / Next.js project starter" },
58
+ { name: "react-native", description: "React Native / Expo project starter" },
59
+ ];
@@ -1,3 +1,46 @@
1
1
  name: default
2
2
  description: General programming starter
3
- skills: []
3
+ skills:
4
+ - repo: https://github.com/vercel-labs/skills
5
+ skill: find-skills
6
+ - repo: https://github.com/anthropics/skills
7
+ skill: skill-creator
8
+ - repo: https://github.com/github/awesome-copilot
9
+ skill: conventional-commit
10
+ - repo: https://github.com/oldwinter/skills
11
+ skill: github-cli
12
+ - repo: https://github.com/supercent-io/skills-template
13
+ skill: code-review
14
+ - repo: https://github.com/vercel-labs/agent-skills
15
+ skill: web-design-guidelines
16
+ - repo: https://github.com/coreyhaines31/marketingskills
17
+ skill: copywriting
18
+ plugins:
19
+ - target: claude
20
+ id: context7@claude-plugins-official
21
+ - target: claude
22
+ id: superpowers@claude-plugins-official
23
+ - target: claude
24
+ id: code-simplifier@claude-plugins-official
25
+ - target: claude
26
+ id: security-guidance@claude-plugins-official
27
+ - target: claude
28
+ id: claude-md-management@claude-plugins-official
29
+ - target: cursor
30
+ id: context7-plugin
31
+ - target: cursor
32
+ id: superpowers
33
+ - target: cursor
34
+ id: parallel
35
+ - target: cursor
36
+ id: runlayer
37
+ - target: cursor
38
+ id: cursor-team-kit
39
+ - target: opencode
40
+ id: oh-my-opencode
41
+ - target: opencode
42
+ id: "@plannotator/opencode"
43
+ - target: opencode
44
+ id: "@openspoon/subtask2"
45
+ - target: opencode
46
+ id: micode
@@ -1,5 +1,66 @@
1
1
  name: react
2
2
  description: React / Next.js project starter
3
3
  skills:
4
- - vercel-labs/vercel-react-best-practices
5
- - vercel-labs/vercel-composition-patterns
4
+ - repo: https://github.com/vercel-labs/skills
5
+ skill: find-skills
6
+ - repo: https://github.com/anthropics/skills
7
+ skill: skill-creator
8
+ - repo: https://github.com/github/awesome-copilot
9
+ skill: conventional-commit
10
+ - repo: https://github.com/oldwinter/skills
11
+ skill: github-cli
12
+ - repo: https://github.com/supercent-io/skills-template
13
+ skill: code-review
14
+ - repo: https://github.com/vercel-labs/agent-skills
15
+ skill: web-design-guidelines
16
+ - repo: https://github.com/coreyhaines31/marketingskills
17
+ skill: copywriting
18
+ - repo: https://github.com/anthropics/skills
19
+ skill: frontend-design
20
+ - repo: https://github.com/vercel-labs/agent-skills
21
+ skill: vercel-react-best-practices
22
+ - repo: https://github.com/vercel-labs/agent-skills
23
+ skill: vercel-composition-patterns
24
+ - repo: https://github.com/obra/superpowers
25
+ skill: brainstorming
26
+ - repo: https://github.com/coreyhaines31/marketingskills
27
+ skill: seo-audit
28
+ - repo: https://github.com/vercel-labs/next-skills
29
+ skill: next-best-practices
30
+ - repo: https://github.com/wshobson/agents
31
+ skill: react-state-management
32
+ plugins:
33
+ - target: claude
34
+ id: context7@claude-plugins-official
35
+ - target: claude
36
+ id: superpowers@claude-plugins-official
37
+ - target: claude
38
+ id: code-simplifier@claude-plugins-official
39
+ - target: claude
40
+ id: security-guidance@claude-plugins-official
41
+ - target: claude
42
+ id: claude-md-management@claude-plugins-official
43
+ - target: claude
44
+ id: frontend-design@claude-plugins-official
45
+ - target: claude
46
+ id: typescript-lsp@claude-plugins-official
47
+ - target: cursor
48
+ id: context7-plugin
49
+ - target: cursor
50
+ id: superpowers
51
+ - target: cursor
52
+ id: parallel
53
+ - target: cursor
54
+ id: runlayer
55
+ - target: cursor
56
+ id: cursor-team-kit
57
+ - target: cursor
58
+ id: vercel
59
+ - target: opencode
60
+ id: oh-my-opencode
61
+ - target: opencode
62
+ id: "@plannotator/opencode"
63
+ - target: opencode
64
+ id: "@openspoon/subtask2"
65
+ - target: opencode
66
+ id: micode
@@ -1,3 +1,74 @@
1
1
  name: react-native
2
2
  description: React Native / Expo project starter
3
- skills: []
3
+ skills:
4
+ - repo: https://github.com/vercel-labs/skills
5
+ skill: find-skills
6
+ - repo: https://github.com/anthropics/skills
7
+ skill: skill-creator
8
+ - repo: https://github.com/github/awesome-copilot
9
+ skill: conventional-commit
10
+ - repo: https://github.com/oldwinter/skills
11
+ skill: github-cli
12
+ - repo: https://github.com/supercent-io/skills-template
13
+ skill: code-review
14
+ - repo: https://github.com/vercel-labs/agent-skills
15
+ skill: web-design-guidelines
16
+ - repo: https://github.com/coreyhaines31/marketingskills
17
+ skill: copywriting
18
+ - repo: https://github.com/anthropics/skills
19
+ skill: frontend-design
20
+ - repo: https://github.com/vercel-labs/agent-skills
21
+ skill: vercel-react-best-practices
22
+ - repo: https://github.com/vercel-labs/agent-skills
23
+ skill: vercel-composition-patterns
24
+ - repo: https://github.com/obra/superpowers
25
+ skill: brainstorming
26
+ - repo: https://github.com/coreyhaines31/marketingskills
27
+ skill: seo-audit
28
+ - repo: https://github.com/vercel-labs/next-skills
29
+ skill: next-best-practices
30
+ - repo: https://github.com/wshobson/agents
31
+ skill: react-state-management
32
+ - repo: https://github.com/vercel-labs/agent-skills
33
+ skill: vercel-react-native-skills
34
+ - repo: https://github.com/callstackincubator/agent-skills
35
+ skill: react-native-best-practices
36
+ - repo: https://github.com/callstackincubator/agent-skills
37
+ skill: upgrading-react-native
38
+ - repo: https://github.com/expo/skills
39
+ skill: upgrading-expo
40
+ - repo: https://github.com/conorluddy/ios-simulator-skill
41
+ skill: ios-simulator-skill
42
+ plugins:
43
+ - target: claude
44
+ id: context7@claude-plugins-official
45
+ - target: claude
46
+ id: superpowers@claude-plugins-official
47
+ - target: claude
48
+ id: code-simplifier@claude-plugins-official
49
+ - target: claude
50
+ id: security-guidance@claude-plugins-official
51
+ - target: claude
52
+ id: claude-md-management@claude-plugins-official
53
+ - target: claude
54
+ id: frontend-design@claude-plugins-official
55
+ - target: claude
56
+ id: typescript-lsp@claude-plugins-official
57
+ - target: cursor
58
+ id: context7-plugin
59
+ - target: cursor
60
+ id: superpowers
61
+ - target: cursor
62
+ id: parallel
63
+ - target: cursor
64
+ id: runlayer
65
+ - target: cursor
66
+ id: cursor-team-kit
67
+ - target: opencode
68
+ id: oh-my-opencode
69
+ - target: opencode
70
+ id: "@plannotator/opencode"
71
+ - target: opencode
72
+ id: "@openspoon/subtask2"
73
+ - target: opencode
74
+ id: micode