@moskala/oneagent-templates 0.3.1 → 0.4.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 CHANGED
@@ -201,3 +201,54 @@ Follow the team coding standards documented in Notion.
201
201
  ```
202
202
 
203
203
  Skills, plugins, and rules are all optional.
204
+
205
+ ---
206
+
207
+ ## `extends`
208
+
209
+ Templates can inherit from other templates using the `extends` field. The child template only needs to define what it **adds** — skills, plugins, and rules from the parent are merged automatically.
210
+
211
+ ```yaml
212
+ name: my-react-template
213
+ description: Our React starter
214
+ extends: https://github.com/moskalakamil/oneagent-template
215
+
216
+ skills:
217
+ - repo: https://github.com/anthropics/skills
218
+ skill: frontend-design
219
+ plugins:
220
+ - target: claude
221
+ id: frontend-design@claude-plugins-official
222
+ ```
223
+
224
+ ### What `extends` accepts
225
+
226
+ | Value | Example | Description |
227
+ |-------|---------|-------------|
228
+ | Builtin template name | `extends: default` | Inherits from one of the built-in templates (`default`, `react`, `react-native`) |
229
+ | GitHub URL | `extends: https://github.com/org/template` | Inherits from a remote template (supports `/tree/branch/subdir` URLs) |
230
+
231
+ ### Merge behavior
232
+
233
+ | Field | Behavior |
234
+ |-------|----------|
235
+ | `skills` | `[...parent.skills, ...own.skills]` |
236
+ | `plugins` | `[...parent.plugins, ...own.plugins]` |
237
+ | `rules` | `[...parent.rules, ...own.rules]` |
238
+ | `instructions` | **Not inherited** — each template has its own `instructions.md` |
239
+
240
+ ### Chaining
241
+
242
+ Extends is recursive. The built-in templates form a chain:
243
+
244
+ ```
245
+ react-native → react → default
246
+ ```
247
+
248
+ - `default` defines 7 skills and 9 plugins
249
+ - `react` adds 7 skills and 2 plugins (total after merge: 14 skills, 11 plugins)
250
+ - `react-native` adds 5 skills (total after merge: 19 skills, 11 plugins)
251
+
252
+ ### Limitations
253
+
254
+ Remote templates (fetched from GitHub) can only extend other remote templates via URL — not built-in template names.
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ // src/index.ts
2
+ import path from "path";
3
+ import fs from "fs/promises";
4
+ import { fileURLToPath } from "url";
5
+ import { parseTemplateYaml, resolveExtends } from "@moskala/oneagent-core";
6
+ var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
7
+ var TEMPLATE_NAMES = ["default", "react", "react-native"];
8
+ async function loadTemplate(name) {
9
+ const templateDir = path.join(__dirname2, "templates", name);
10
+ const [yamlText, instructions] = await Promise.all([
11
+ fs.readFile(path.join(templateDir, "template.yml"), "utf-8"),
12
+ fs.readFile(path.join(templateDir, "instructions.md"), "utf-8")
13
+ ]);
14
+ const parsed = parseTemplateYaml(yamlText, name);
15
+ const rulesDir = path.join(templateDir, "rules");
16
+ let rules = [];
17
+ try {
18
+ const ruleFiles = await fs.readdir(rulesDir);
19
+ rules = await Promise.all(ruleFiles.filter((f) => f.endsWith(".md")).map(async (f) => ({
20
+ name: path.basename(f, ".md"),
21
+ content: await fs.readFile(path.join(rulesDir, f), "utf-8")
22
+ })));
23
+ } catch {}
24
+ const base = { ...parsed, instructions, rules };
25
+ return resolveExtends(base, (n) => resolveBuiltinTemplate(n));
26
+ }
27
+ async function resolveBuiltinTemplate(name) {
28
+ if (!TEMPLATE_NAMES.includes(name))
29
+ return null;
30
+ return loadTemplate(name);
31
+ }
32
+ var BUILTIN_TEMPLATE_NAMES = TEMPLATE_NAMES;
33
+ var BUILTIN_TEMPLATE_META = [
34
+ { name: "default", description: "General programming starter" },
35
+ { name: "react", description: "React / Next.js project starter" },
36
+ { name: "react-native", description: "React Native / Expo project starter" }
37
+ ];
38
+ export {
39
+ resolveBuiltinTemplate,
40
+ BUILTIN_TEMPLATE_NAMES,
41
+ BUILTIN_TEMPLATE_META
42
+ };
@@ -0,0 +1,3 @@
1
+ # Project Instructions
2
+
3
+ Add your AI instructions here.
@@ -0,0 +1,36 @@
1
+ name: default
2
+ description: General programming starter
3
+ skills:
4
+ - repo: https://github.com/vercel-labs/skills
5
+ skill: find-skills
6
+ - repo: https://github.com/obra/superpowers
7
+ skill: writing-skills
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: opencode
30
+ id: oh-my-opencode
31
+ - target: opencode
32
+ id: "@plannotator/opencode"
33
+ - target: opencode
34
+ id: "@openspoon/subtask2"
35
+ - target: opencode
36
+ id: micode
@@ -0,0 +1,15 @@
1
+ # Project Instructions
2
+
3
+ This is a React project. Follow modern React best practices.
4
+
5
+ ## Stack
6
+
7
+ - React 18+
8
+ - TypeScript
9
+ - Prefer functional components and hooks
10
+
11
+ ## Guidelines
12
+
13
+ - Use composition over inheritance
14
+ - Keep components small and focused
15
+ - Colocate state as close to where it's used as possible
@@ -0,0 +1,23 @@
1
+ name: react
2
+ description: React / Next.js project starter
3
+ extends: default
4
+ skills:
5
+ - repo: https://github.com/anthropics/skills
6
+ skill: frontend-design
7
+ - repo: https://github.com/vercel-labs/agent-skills
8
+ skill: vercel-react-best-practices
9
+ - repo: https://github.com/vercel-labs/agent-skills
10
+ skill: vercel-composition-patterns
11
+ - repo: https://github.com/obra/superpowers
12
+ skill: brainstorming
13
+ - repo: https://github.com/coreyhaines31/marketingskills
14
+ skill: seo-audit
15
+ - repo: https://github.com/vercel-labs/next-skills
16
+ skill: next-best-practices
17
+ - repo: https://github.com/wshobson/agents
18
+ skill: react-state-management
19
+ plugins:
20
+ - target: claude
21
+ id: frontend-design@claude-plugins-official
22
+ - target: claude
23
+ id: typescript-lsp@claude-plugins-official
@@ -0,0 +1,15 @@
1
+ # Project Instructions
2
+
3
+ This is a React Native project. Target both iOS and Android.
4
+
5
+ ## Stack
6
+
7
+ - React Native with Expo
8
+ - TypeScript
9
+ - Prefer functional components and hooks
10
+
11
+ ## Guidelines
12
+
13
+ - Use `StyleSheet.create` for styles
14
+ - Avoid platform-specific code unless necessary; use `Platform.select` when needed
15
+ - Prefer Expo SDK APIs over bare React Native APIs
@@ -0,0 +1,14 @@
1
+ name: react-native
2
+ description: React Native / Expo project starter
3
+ extends: react
4
+ skills:
5
+ - repo: https://github.com/vercel-labs/agent-skills
6
+ skill: vercel-react-native-skills
7
+ - repo: https://github.com/callstackincubator/agent-skills
8
+ skill: react-native-best-practices
9
+ - repo: https://github.com/callstackincubator/agent-skills
10
+ skill: upgrading-react-native
11
+ - repo: https://github.com/expo/skills
12
+ skill: upgrading-expo
13
+ - repo: https://github.com/conorluddy/ios-simulator-skill
14
+ skill: ios-simulator-skill
package/package.json CHANGED
@@ -1,22 +1,28 @@
1
1
  {
2
2
  "name": "@moskala/oneagent-templates",
3
- "version": "0.3.1",
3
+ "version": "0.4.1",
4
4
  "type": "module",
5
5
  "description": "Built-in templates for oneagent",
6
6
  "license": "MIT",
7
- "module": "./src/index.ts",
8
- "main": "./src/index.ts",
7
+ "module": "./dist/index.js",
8
+ "main": "./dist/index.js",
9
9
  "exports": {
10
- ".": "./src/index.ts"
10
+ ".": {
11
+ "bun": "./src/index.ts",
12
+ "types": "./src/index.ts",
13
+ "default": "./dist/index.js"
14
+ }
11
15
  },
12
16
  "files": [
13
- "src"
17
+ "src",
18
+ "dist"
14
19
  ],
15
20
  "scripts": {
21
+ "build": "bun ./scripts/build.ts",
16
22
  "typecheck": "tsc --noEmit"
17
23
  },
18
24
  "dependencies": {
19
- "@moskala/oneagent-core": "0.2.5"
25
+ "@moskala/oneagent-core": "0.3.1"
20
26
  },
21
27
  "devDependencies": {
22
28
  "@types/bun": "latest",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
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
+ import { type TemplatePlugin, type TemplateDefinition, parseTemplateYaml, resolveExtends } from "@moskala/oneagent-core";
5
5
 
6
6
  export type { TemplatePlugin, TemplateDefinition };
7
7
 
@@ -19,7 +19,7 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
19
19
  fs.readFile(path.join(templateDir, "instructions.md"), "utf-8"),
20
20
  ]);
21
21
 
22
- const { description, skills, plugins } = parseTemplateYaml(yamlText, name);
22
+ const parsed = parseTemplateYaml(yamlText, name);
23
23
 
24
24
  const rulesDir = path.join(templateDir, "rules");
25
25
  let rules: Array<{ name: string; content: string }> = [];
@@ -37,7 +37,8 @@ async function loadTemplate(name: BuiltinTemplateName): Promise<TemplateDefiniti
37
37
  // No rules directory — fine
38
38
  }
39
39
 
40
- return { name, description, skills, plugins, instructions, rules };
40
+ const base = { ...parsed, instructions, rules };
41
+ return resolveExtends(base, (n) => resolveBuiltinTemplate(n));
41
42
  }
42
43
 
43
44
  export async function resolveBuiltinTemplate(name: string): Promise<TemplateDefinition | null> {
@@ -3,8 +3,8 @@ description: General programming starter
3
3
  skills:
4
4
  - repo: https://github.com/vercel-labs/skills
5
5
  skill: find-skills
6
- - repo: https://github.com/anthropics/skills
7
- skill: skill-creator
6
+ - repo: https://github.com/obra/superpowers
7
+ skill: writing-skills
8
8
  - repo: https://github.com/github/awesome-copilot
9
9
  skill: conventional-commit
10
10
  - repo: https://github.com/oldwinter/skills
@@ -1,20 +1,7 @@
1
1
  name: react
2
2
  description: React / Next.js project starter
3
+ extends: default
3
4
  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
5
  - repo: https://github.com/anthropics/skills
19
6
  skill: frontend-design
20
7
  - repo: https://github.com/vercel-labs/agent-skills
@@ -30,25 +17,7 @@ skills:
30
17
  - repo: https://github.com/wshobson/agents
31
18
  skill: react-state-management
32
19
  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
20
  - target: claude
44
21
  id: frontend-design@claude-plugins-official
45
22
  - target: claude
46
23
  id: typescript-lsp@claude-plugins-official
47
- - target: opencode
48
- id: oh-my-opencode
49
- - target: opencode
50
- id: "@plannotator/opencode"
51
- - target: opencode
52
- id: "@openspoon/subtask2"
53
- - target: opencode
54
- id: micode
@@ -1,34 +1,7 @@
1
1
  name: react-native
2
2
  description: React Native / Expo project starter
3
+ extends: react
3
4
  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
5
  - repo: https://github.com/vercel-labs/agent-skills
33
6
  skill: vercel-react-native-skills
34
7
  - repo: https://github.com/callstackincubator/agent-skills
@@ -39,26 +12,3 @@ skills:
39
12
  skill: upgrading-expo
40
13
  - repo: https://github.com/conorluddy/ios-simulator-skill
41
14
  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: opencode
58
- id: oh-my-opencode
59
- - target: opencode
60
- id: "@plannotator/opencode"
61
- - target: opencode
62
- id: "@openspoon/subtask2"
63
- - target: opencode
64
- id: micode