@wntic/ocm 0.1.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.
Files changed (64) hide show
  1. package/README.md +286 -0
  2. package/bin/ocm.ts +7 -0
  3. package/loader/config.js +47 -0
  4. package/loader/core.d.ts +256 -0
  5. package/loader/core.js +40 -0
  6. package/loader/discovery.js +162 -0
  7. package/loader/links.js +193 -0
  8. package/loader/lint.js +83 -0
  9. package/loader/manifest.js +158 -0
  10. package/loader/marketplace.js +199 -0
  11. package/loader/materialize.js +218 -0
  12. package/loader/mcp.js +124 -0
  13. package/loader/mutations.js +102 -0
  14. package/loader/ocm-loader.js +21 -0
  15. package/loader/paths.js +20 -0
  16. package/loader/registry.js +163 -0
  17. package/loader/search.js +55 -0
  18. package/loader/source.js +100 -0
  19. package/loader/sync.js +151 -0
  20. package/loader/trust.js +114 -0
  21. package/loader/ui-dialog.js +46 -0
  22. package/loader/ui-marketplaces.js +187 -0
  23. package/loader/ui-plugins.js +101 -0
  24. package/loader/ui-trust.js +68 -0
  25. package/loader/ui.js +109 -0
  26. package/package.json +32 -0
  27. package/src/commands/doctor-config.ts +79 -0
  28. package/src/commands/doctor-links.ts +170 -0
  29. package/src/commands/doctor.ts +144 -0
  30. package/src/commands/info.ts +159 -0
  31. package/src/commands/list.ts +44 -0
  32. package/src/commands/marketplace.ts +99 -0
  33. package/src/commands/plugins.ts +127 -0
  34. package/src/commands/search.ts +86 -0
  35. package/src/commands/trust.ts +146 -0
  36. package/src/commands/update-report.ts +123 -0
  37. package/src/commands/update.ts +160 -0
  38. package/src/commands/validate-files.ts +145 -0
  39. package/src/commands/validate.ts +77 -0
  40. package/src/discovery.ts +36 -0
  41. package/src/findings.ts +33 -0
  42. package/src/git.ts +24 -0
  43. package/src/index.ts +175 -0
  44. package/src/install.ts +15 -0
  45. package/src/loader.ts +185 -0
  46. package/src/manifest-lint.ts +189 -0
  47. package/src/migrate.ts +117 -0
  48. package/src/paths.ts +22 -0
  49. package/src/probe.ts +52 -0
  50. package/src/registry.ts +25 -0
  51. package/src/renames.ts +83 -0
  52. package/src/report.ts +13 -0
  53. package/src/types.ts +70 -0
  54. package/template/marketplace.json +17 -0
  55. package/template/plugins/demo-kit/agents/reviewer.md +20 -0
  56. package/template/plugins/demo-kit/commands/tdd.md +12 -0
  57. package/template/plugins/demo-kit/mcp.json +3 -0
  58. package/template/plugins/demo-kit/plugin/notify.js +4 -0
  59. package/template/plugins/demo-kit/plugin.json +6 -0
  60. package/template/plugins/demo-kit/skills/code-review/SKILL.md +21 -0
  61. package/template/plugins/release-kit/commands/ship.md +11 -0
  62. package/template/plugins/release-kit/commands.claude/ship.md +11 -0
  63. package/template/plugins/release-kit/plugin.json +6 -0
  64. package/template/plugins/release-kit/skills/release-notes/SKILL.md +14 -0
package/src/report.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { OCM_REGISTRY_FILE } from "./paths"
2
+
3
+ export function reportWarnings(warnings: string[]): void {
4
+ for (const warning of warnings) console.error(` warning: ${warning}`)
5
+ }
6
+
7
+ export function reportRestart(changed: number): void {
8
+ if (changed > 0) console.log("restart opencode to activate")
9
+ }
10
+
11
+ export function reportUpgrade(wasV1: boolean): void {
12
+ if (wasV1) console.error(`registry upgraded v1 → v2 (${OCM_REGISTRY_FILE})`)
13
+ }
package/src/types.ts ADDED
@@ -0,0 +1,70 @@
1
+ export type ComponentType = "agent" | "command" | "skill" | "plugin" | "mcp"
2
+
3
+ // the merged manifest cached in the registry: marketplace entry >
4
+ // plugin.json > filesystem inference (spec 06)
5
+ export type PluginManifest = {
6
+ description?: string
7
+ category?: string
8
+ tags?: string[]
9
+ keywords?: string[]
10
+ version?: string
11
+ homepage?: string
12
+ license?: string
13
+ defaultEnabled?: boolean
14
+ mcpServers?: string
15
+ // fields where marketplace.json and plugin.json disagreed; the marketplace
16
+ // entry won by precedence, and info annotates them (spec 09)
17
+ conflicts?: string[]
18
+ }
19
+
20
+ export interface DiscoveredPlugin {
21
+ name: string
22
+ dir: string
23
+ source: string
24
+ components: Partial<Record<ComponentType, string[]>>
25
+ manifest: PluginManifest
26
+ }
27
+
28
+ export interface MarketplacePlugin {
29
+ source: string
30
+ components: Partial<Record<ComponentType, string[]>>
31
+ enabled: boolean
32
+ // names the marketplace that already provides this plugin name; set only
33
+ // while the collision exists, and the plugin stays disabled until it clears
34
+ collision?: string
35
+ installedAt: string | null
36
+ version: string | null
37
+ manifest: PluginManifest
38
+ }
39
+
40
+ export interface MarketplaceEntry {
41
+ url: string
42
+ dir: string
43
+ local: boolean
44
+ addedAt: string
45
+ mode: "auto" | "explicit"
46
+ ref: string | null
47
+ // set when the source was a github tree url: discovery roots here while
48
+ // git operations run against the clone root
49
+ subdir?: string | null
50
+ revision: string | null
51
+ syncIntervalMs: number | null
52
+ trust: {
53
+ code: "none" | "granted" | "denied"
54
+ grantedAt?: string
55
+ fingerprint?: string
56
+ // per-component hashes recorded at grant time; absent on grants written
57
+ // before spec 07, which approve everything (spec 07)
58
+ components?: Record<string, string>
59
+ }
60
+ // set by the loader when executable components changed since the grant;
61
+ // cleared by the next trust decision (spec 07)
62
+ trustPending?: boolean
63
+ lastSync: { at: string; ok: boolean; error: string | null } | null
64
+ plugins: Record<string, MarketplacePlugin>
65
+ }
66
+
67
+ export interface Registry {
68
+ version: 2
69
+ marketplaces: Record<string, MarketplaceEntry>
70
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/wntic/ocm/main/schema/marketplace-v1.json",
3
+ "name": "demo-marketplace",
4
+ "description": "Example ocm marketplace",
5
+ "plugins": [
6
+ {
7
+ "name": "demo-kit",
8
+ "source": "./plugins/demo-kit",
9
+ "description": "One component of every type ocm ships"
10
+ },
11
+ {
12
+ "name": "release-kit",
13
+ "source": "./plugins/release-kit",
14
+ "description": "Release helpers, authored for both opencode and Claude Code"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Reviews code for correctness, security and readability before merge
3
+ mode: subagent
4
+ tools:
5
+ read: true
6
+ edit: false
7
+ bash: false
8
+ model: inherit
9
+ ---
10
+
11
+ You are a strict code reviewer.
12
+
13
+ Review the provided changes and report:
14
+
15
+ 1. **Correctness** — logic errors, edge cases, race conditions
16
+ 2. **Security** — injection, secrets exposure, unsafe deserialization
17
+ 3. **Readability** — naming, dead code, misleading comments
18
+
19
+ For every finding give: file:line, severity (critical/warning/note), and a suggested fix.
20
+ End with a verdict: approve, approve-with-comments, or request-changes.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Write a failing test first, then minimal implementation
3
+ agent: build
4
+ ---
5
+
6
+ Implement the following using strict TDD: $ARGUMENTS
7
+
8
+ Workflow:
9
+ 1. Write a failing test that captures the requirement
10
+ 2. Run the test, confirm it fails for the expected reason
11
+ 3. Write the minimal implementation that makes it pass
12
+ 4. Refactor while keeping the test green
@@ -0,0 +1,3 @@
1
+ {
2
+ "time": { "type": "local", "command": ["date"], "enabled": true }
3
+ }
@@ -0,0 +1,4 @@
1
+ export default {
2
+ id: "demo-kit-notify",
3
+ server: async () => ({}),
4
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "description": "One command, agent, skill, plugin and mcp server — the demo kit",
3
+ "version": "0.1.0",
4
+ "category": "example",
5
+ "tags": ["demo"]
6
+ }
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: code-review
3
+ description: Structured checklist for reviewing pull requests
4
+ license: MIT
5
+ compatibility: opencode
6
+ ---
7
+
8
+ ## What I do
9
+
10
+ Guide a structured code review using this checklist:
11
+
12
+ 1. Tests — are new behaviors covered?
13
+ 2. Errors — are failures handled explicitly?
14
+ 3. Contracts — do types and APIs match usage?
15
+ 4. Performance — any obvious N+1 or unbounded work?
16
+ 5. Docs — are public interfaces documented?
17
+
18
+ ## When to use me
19
+
20
+ Use when reviewing a PR, a diff, or freshly written code.
21
+ Produce findings as `file:line — severity — suggestion`.
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: Cut a release for the current project
3
+ agent: build
4
+ ---
5
+
6
+ Ship a release: $ARGUMENTS
7
+
8
+ Workflow:
9
+ 1. Confirm the version bump (patch, minor, major) with the user
10
+ 2. Draft the release notes from the commits since the last tag
11
+ 3. Tag the release and push the tag
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: Cut a release for the current project
3
+ argument-hint: <patch|minor|major>
4
+ ---
5
+
6
+ Ship a release: $ARGUMENTS
7
+
8
+ Workflow:
9
+ 1. Confirm the version bump (patch, minor, major) with the user
10
+ 2. Draft the release notes from the commits since the last tag
11
+ 3. Tag the release and push the tag
@@ -0,0 +1,6 @@
1
+ {
2
+ "description": "Ship a release and write its notes — the cross-tool demo kit",
3
+ "version": "0.1.0",
4
+ "category": "example",
5
+ "tags": ["release"]
6
+ }
@@ -0,0 +1,14 @@
1
+ ---
2
+ name: release-notes
3
+ description: Draft release notes from a commit range
4
+ ---
5
+
6
+ ## What I do
7
+
8
+ Draft release notes from the commits between two refs, grouped as
9
+ Added, Changed and Fixed.
10
+
11
+ ## When to use me
12
+
13
+ Use when preparing a release. Produce notes as a markdown file with one
14
+ section per group and a bullet per commit, quoting the commit subject.