@wipcomputer/universal-installer 2.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+
4
+
5
+ ## 2.1.1 (2026-02-21)
6
+
7
+ Add Universal Interface badges, agent-driven install prompt, fix description
8
+
9
+ ## 2.1.0 (2026-02-21)
10
+
11
+ Rename Six Doors to Universal Interface. Update all code and docs.
12
+
13
+ ## 2.0.0 (2026-02-20)
14
+
15
+ Major refactor. Reframed from "WIP Computer installer" to "the spec for agent-native software."
16
+
17
+ ### Added
18
+ - `detect.mjs` ... importable door detection module
19
+ - `SPEC.md` ... formal Six Doors specification
20
+ - `--dry-run` flag ... detect doors without installing
21
+ - `--json` flag ... machine-readable detection output
22
+ - `LICENSE` (MIT)
23
+ - `SKILL.md` with agent instructions
24
+ - `examples/minimal/` ... minimal six-door template
25
+
26
+ ### Changed
27
+ - README rewritten around Karpathy's sensor/actuator argument
28
+ - `install.mjs` now imports detection logic from `detect.mjs`
29
+ - Package name updated: `@wipcomputer/universal-installer`
30
+
31
+ ## 1.0.0 (2026-02-17)
32
+
33
+ Initial release. Universal installer for WIP.computer repos.
34
+
35
+ - Detects 6 door types: CLI, Module, MCP, OpenClaw, Skill, CC Hook
36
+ - Installs from GitHub URL, org/repo shorthand, or local path
37
+ - Supports any WIP.computer convention repo
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Parker Todd Brooks
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ ###### WIP Computer
2
+
3
+ [![npm](https://img.shields.io/npm/v/@wipcomputer/universal-installer)](https://www.npmjs.com/package/@wipcomputer/universal-installer) [![CLI / TUI](https://img.shields.io/badge/interface-CLI_/_TUI-black)](https://github.com/wipcomputer/wip-universal-installer/blob/main/install.mjs) [![OpenClaw Skill](https://img.shields.io/badge/interface-OpenClaw_Skill-black)](https://clawhub.ai/parkertoddbrooks/wip-universal-installer) [![Claude Code Skill](https://img.shields.io/badge/interface-Claude_Code_Skill-black)](https://github.com/wipcomputer/wip-universal-installer/blob/main/SKILL.md) [![Universal Interface Spec](https://img.shields.io/badge/Universal_Interface_Spec-black?style=flat&color=black)](https://github.com/wipcomputer/wip-universal-installer/blob/main/SPEC.md)
4
+
5
+ # Universal Installer
6
+
7
+ Here's how to build software in 2026.
8
+
9
+ ## The Problem
10
+
11
+ Most software is built for humans. GUIs, dashboards, web apps. Humans click buttons, fill forms, read screens.
12
+
13
+ But the users are changing. AI agents are the new users. They don't click. They call functions. They read instructions. They compose tools. They need a **universal interface** ... multiple ways into the same logic, native to however the consumer works.
14
+
15
+ Software built for humans doesn't work for agents. And software built only for agents doesn't work for humans. You need both.
16
+
17
+ ## The Karpathy Argument
18
+
19
+ Andrej Karpathy put it clearly:
20
+
21
+ > "I think the app store, the move to mobile, the concept of an app ... is an increasingly outdated concept. What matters are sensors and actuators. Sensors are things that convert physical state into digital state. Actuators are things that convert digital intent into physical change."
22
+ >
23
+ > "All LLMs care about are tools and the tools fall into this sensor/actuator divide. Software shouldn't be built into apps, but into small bespoke tools. Apps are for people. Tools are for LLMs, and increasingly, LLMs are the ones using software."
24
+
25
+ [Source](https://x.com/karpathy/status/2024583544157458452)
26
+
27
+ This is the future of software. Not apps. Tools. Sensors and actuators that agents compose together.
28
+
29
+ ## Sensors and Actuators
30
+
31
+ Every tool is a sensor, an actuator, or both:
32
+
33
+ **Sensors** convert state into data:
34
+ - Search the web (wip-grok search_web)
35
+ - Search X/Twitter (wip-grok search_x, wip-x search_recent)
36
+ - Fetch a post (wip-x fetch_post)
37
+ - Read bookmarks (wip-x get_bookmarks)
38
+ - Check system health (wip-healthcheck)
39
+
40
+ **Actuators** convert intent into action:
41
+ - Generate an image (wip-grok generate_image)
42
+ - Post a tweet (wip-x post_tweet)
43
+ - Guard a file from edits (wip-file-guard)
44
+ - Generate a video (wip-grok generate_video)
45
+
46
+ ## The Universal Interface
47
+
48
+ Agents don't all speak the same language. Some run shell commands. Some import modules. Some talk MCP. Some read markdown instructions.
49
+
50
+ So every tool should expose multiple interfaces into the same core logic:
51
+
52
+ | Interface | What | Who uses it |
53
+ |-----------|------|-------------|
54
+ | **CLI** | Shell command | Humans, any agent with bash |
55
+ | **Module** | ES import | Other tools, scripts |
56
+ | **MCP Server** | JSON-RPC over stdio | Claude Code, Cursor, any MCP client |
57
+ | **OpenClaw Plugin** | Lifecycle hooks + tools | OpenClaw agents |
58
+ | **Skill** | Markdown instructions (SKILL.md) | Any agent that reads files |
59
+ | **Claude Code Hook** | PreToolUse/Stop events | Claude Code |
60
+
61
+ Not every tool needs all six. Build what makes sense. But the more interfaces you expose, the more agents can use your tool.
62
+
63
+ See [SPEC.md](SPEC.md) for the full specification.
64
+
65
+ ## How to Build It
66
+
67
+ The architecture is simple. Four files:
68
+
69
+ ```
70
+ your-tool/
71
+ core.mjs <- pure logic, zero deps if possible
72
+ cli.mjs <- thin CLI wrapper
73
+ mcp-server.mjs <- MCP server wrapping core as tools
74
+ SKILL.md <- when/how to use it, for agents
75
+ ```
76
+
77
+ `core.mjs` does the work. Everything else is a thin wrapper. CLI parses argv and calls core. MCP server maps tools to core functions. SKILL.md teaches agents when to call what.
78
+
79
+ This means one codebase, one set of tests, multiple interfaces.
80
+
81
+ ## The Reference Installer
82
+
83
+ `wip-install` scans any repo, detects which interfaces exist, and installs them all. One command.
84
+
85
+ ```bash
86
+ # From GitHub
87
+ wip-install wipcomputer/wip-grok
88
+
89
+ # From a local path
90
+ wip-install /path/to/repo
91
+
92
+ # Detect only (no install)
93
+ wip-install --dry-run wipcomputer/wip-x
94
+
95
+ # Machine-readable output
96
+ wip-install --json /path/to/repo
97
+ ```
98
+
99
+ ### Example Output
100
+
101
+ ```
102
+ Installing: wip-grok
103
+ ────────────────────────────────────────
104
+ Detected 4 interface(s): cli, module, mcp, skill
105
+
106
+ ✓ CLI: wip-grok installed globally
107
+ ✓ Module: import from "core.mjs"
108
+ MCP Server detected: mcp-server.mjs
109
+ ✓ Skill: SKILL.md available
110
+
111
+ Done. 4 interface(s) processed.
112
+ ```
113
+
114
+ ### What It Detects
115
+
116
+ | Pattern | Interface | Install action |
117
+ |---------|-----------|---------------|
118
+ | `package.json` with `bin` | CLI | `npm install -g` |
119
+ | `main` or `exports` in `package.json` | Module | Reports import path |
120
+ | `mcp-server.mjs` | MCP | Prints `.mcp.json` config |
121
+ | `openclaw.plugin.json` | OpenClaw | Copies to `~/.openclaw/extensions/` |
122
+ | `SKILL.md` | Skill | Reports path |
123
+ | `guard.mjs` or `claudeCode.hook` | CC Hook | Adds to `~/.claude/settings.json` |
124
+
125
+ ## Install
126
+
127
+ Open your AI coding tool and say:
128
+
129
+ ```
130
+ Read the SPEC.md and SKILL.md at github.com/wipcomputer/wip-universal-installer.
131
+ Then explain to me:
132
+ 1. What is this tool?
133
+ 2. What does it do?
134
+ 3. What would it change or fix in our current system?
135
+
136
+ Then ask me:
137
+ - Do you have more questions?
138
+ - Do you want to integrate it into our system?
139
+ - Do you want to clone it (use as-is) or fork it (so you can contribute back if you find bugs)?
140
+ ```
141
+
142
+ Your agent will read the repo, explain the tool, and walk you through integration interactively.
143
+
144
+ Also see **[wip-release](https://github.com/wipcomputer/wip-release)** ... one-command release pipeline for agent-native software.
145
+
146
+ See [SPEC.md](SPEC.md) for the full Universal Interface specification.
147
+
148
+ ## Real Examples
149
+
150
+ | Tool | Type | Interfaces | What it does |
151
+ |------|------|------------|-------------|
152
+ | [wip-grok](https://github.com/wipcomputer/wip-grok) | Sensor + Actuator | CLI + Module + MCP + Skill | xAI Grok API: search web/X, generate images/video |
153
+ | [wip-x](https://github.com/wipcomputer/wip-x) | Sensor + Actuator | CLI + Module + MCP + Skill | X Platform API: read/write tweets, bookmarks |
154
+ | [wip-file-guard](https://github.com/wipcomputer/wip-file-guard) | Actuator | CLI + OpenClaw + CC Hook | Protect files from AI edits |
155
+ | [wip-healthcheck](https://github.com/wipcomputer/wip-healthcheck) | Sensor | CLI + Module | System health monitoring |
156
+
157
+ ## Supported Tools
158
+
159
+ Works with any AI agent or coding tool that can run shell commands:
160
+
161
+ | Tool | How |
162
+ |------|-----|
163
+ | Claude Code | CLI via bash, hooks via settings.json, MCP via .mcp.json |
164
+ | OpenAI Codex CLI | CLI via bash, skills via AGENTS.md |
165
+ | Cursor | CLI via terminal, MCP via config |
166
+ | Windsurf | CLI via terminal, MCP via config |
167
+ | OpenClaw | Plugins, skills, MCP |
168
+ | Any agent | CLI works everywhere. If it has a shell, it works. |
169
+
170
+ ---
171
+
172
+ ## License
173
+
174
+ MIT
175
+
176
+ Built by Parker Todd Brooks, with Claude Code and Lēsa (OpenClaw).
package/SKILL.md ADDED
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: wip-universal-installer
3
+ version: 2.1.1
4
+ description: Reference installer for agent-native software. Detects and installs all interfaces from any repo.
5
+ homepage: https://github.com/wipcomputer/wip-universal-installer
6
+ metadata:
7
+ category: dev-tools
8
+ capabilities:
9
+ - detect-interfaces
10
+ - install-cli
11
+ - install-mcp
12
+ - install-openclaw-plugin
13
+ - install-claude-code-hook
14
+ dependencies: []
15
+ interface: CLI
16
+ openclaw:
17
+ emoji: "🔌"
18
+ install:
19
+ env: []
20
+ author:
21
+ name: Parker Todd Brooks
22
+ ---
23
+
24
+ # wip-universal-installer
25
+
26
+ Reference installer for agent-native software. Scans a repo, detects which interfaces it exposes, and installs them all.
27
+
28
+ ## When to Use This Skill
29
+
30
+ **Use wip-install for:**
31
+ - Installing any repo that follows the Universal Interface pattern
32
+ - Detecting what interfaces a repo provides
33
+ - Setting up CLI tools, MCP servers, OpenClaw plugins, and Claude Code hooks in one command
34
+
35
+ **Use detect.mjs for:**
36
+ - Programmatically detecting interfaces in a repo
37
+ - Building custom installers or CI pipelines
38
+ - Validating that a repo follows the spec
39
+
40
+ ### Do NOT Use For
41
+
42
+ - Installing standard npm packages (use npm directly)
43
+ - Repos that don't follow the Universal Interface conventions
44
+ - Building or compiling code (this only installs)
45
+
46
+ ## API Reference
47
+
48
+ ### CLI
49
+
50
+ ```bash
51
+ wip-install /path/to/repo # install all interfaces
52
+ wip-install org/repo # clone from GitHub + install
53
+ wip-install --dry-run /path/to/repo # detect only, no changes
54
+ wip-install --json /path/to/repo # JSON output
55
+ ```
56
+
57
+ ### Module (detect.mjs)
58
+
59
+ ```javascript
60
+ import { detectInterfaces, describeInterfaces, detectInterfacesJSON } from './detect.mjs';
61
+
62
+ const { interfaces, pkg } = detectInterfaces('/path/to/repo');
63
+ console.log(describeInterfaces(interfaces));
64
+
65
+ const json = detectInterfacesJSON('/path/to/repo');
66
+ console.log(JSON.stringify(json, null, 2));
67
+ ```
68
+
69
+ ## Universal Interface
70
+
71
+ See [SPEC.md](https://github.com/wipcomputer/wip-universal-installer/blob/main/SPEC.md) for the full specification.
72
+
73
+ 1. **CLI** ... `package.json` bin field
74
+ 2. **Module** ... `package.json` main/exports
75
+ 3. **MCP Server** ... `mcp-server.mjs`
76
+ 4. **OpenClaw Plugin** ... `openclaw.plugin.json`
77
+ 5. **Skill** ... `SKILL.md`
78
+ 6. **Claude Code Hook** ... `guard.mjs` or `claudeCode.hook`
package/SPEC.md ADDED
@@ -0,0 +1,161 @@
1
+ # The Universal Interface Specification
2
+
3
+ Every tool is a sensor, an actuator, or both. Every tool should be accessible through multiple interfaces. We call this the Universal Interface.
4
+
5
+ This is the spec.
6
+
7
+ ## The Six Interfaces
8
+
9
+ ### 1. CLI
10
+
11
+ A shell command. The most universal interface. If it has a terminal, it works.
12
+
13
+ **Convention:** `package.json` with a `bin` field.
14
+
15
+ **Detection:** `pkg.bin` exists.
16
+
17
+ **Install:** `npm install -g .` or `npm link`.
18
+
19
+ ```json
20
+ {
21
+ "bin": {
22
+ "wip-grok": "./cli.mjs"
23
+ }
24
+ }
25
+ ```
26
+
27
+ ### 2. Module
28
+
29
+ An importable ES module. The programmatic interface. Other tools compose with it.
30
+
31
+ **Convention:** `package.json` with `main` or `exports` field. File is `core.mjs` by convention.
32
+
33
+ **Detection:** `pkg.main` or `pkg.exports` exists.
34
+
35
+ **Install:** `npm install <package>` or import directly from path.
36
+
37
+ ```json
38
+ {
39
+ "type": "module",
40
+ "main": "core.mjs",
41
+ "exports": {
42
+ ".": "./core.mjs",
43
+ "./cli": "./cli.mjs"
44
+ }
45
+ }
46
+ ```
47
+
48
+ ### 3. MCP Server
49
+
50
+ A JSON-RPC server implementing the Model Context Protocol. Any MCP-compatible agent can use it.
51
+
52
+ **Convention:** `mcp-server.mjs` (or `.js`, `.ts`) at the repo root. Uses `@modelcontextprotocol/sdk`.
53
+
54
+ **Detection:** One of `mcp-server.mjs`, `mcp-server.js`, `mcp-server.ts`, `dist/mcp-server.js` exists.
55
+
56
+ **Install:** Add to `.mcp.json`:
57
+
58
+ ```json
59
+ {
60
+ "tool-name": {
61
+ "command": "node",
62
+ "args": ["/path/to/mcp-server.mjs"]
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### 4. OpenClaw Plugin
68
+
69
+ A plugin for OpenClaw agents. Lifecycle hooks, tool registration, settings.
70
+
71
+ **Convention:** `openclaw.plugin.json` at the repo root.
72
+
73
+ **Detection:** `openclaw.plugin.json` exists.
74
+
75
+ **Install:** Copy to `~/.openclaw/extensions/<name>/`, run `npm install --omit=dev`.
76
+
77
+ ### 5. Skill (SKILL.md)
78
+
79
+ A markdown file that teaches agents when and how to use the tool. The instruction interface.
80
+
81
+ **Convention:** `SKILL.md` at the repo root. YAML frontmatter with name, version, description, metadata.
82
+
83
+ **Detection:** `SKILL.md` exists.
84
+
85
+ **Install:** Referenced by path. Agents read it when they need the tool.
86
+
87
+ ```yaml
88
+ ---
89
+ name: wip-grok
90
+ version: 1.0.0
91
+ description: xAI Grok API. Search the web, search X, generate images.
92
+ metadata:
93
+ category: search,media
94
+ capabilities:
95
+ - web-search
96
+ - image-generation
97
+ ---
98
+ ```
99
+
100
+ ### 6. Claude Code Hook
101
+
102
+ A hook that runs during Claude Code's tool lifecycle (PreToolUse, Stop, etc.).
103
+
104
+ **Convention:** `guard.mjs` at repo root, or `claudeCode.hook` in `package.json`.
105
+
106
+ **Detection:** `guard.mjs` exists, or `pkg.claudeCode.hook` is defined.
107
+
108
+ **Install:** Added to `~/.claude/settings.json` under `hooks`.
109
+
110
+ ```json
111
+ {
112
+ "hooks": {
113
+ "PreToolUse": [{
114
+ "matcher": "Edit|Write",
115
+ "hooks": [{
116
+ "type": "command",
117
+ "command": "node /path/to/guard.mjs",
118
+ "timeout": 5
119
+ }]
120
+ }]
121
+ }
122
+ }
123
+ ```
124
+
125
+ ## Architecture
126
+
127
+ Every repo that follows this spec has the same basic structure:
128
+
129
+ ```
130
+ your-tool/
131
+ core.mjs pure logic, zero or minimal deps
132
+ cli.mjs thin CLI wrapper around core
133
+ mcp-server.mjs MCP server wrapping core functions as tools
134
+ SKILL.md agent instructions with YAML frontmatter
135
+ package.json name, bin, main, exports, type: module
136
+ README.md human documentation
137
+ ```
138
+
139
+ Not every tool needs all six interfaces. Build the ones that make sense.
140
+
141
+ The minimum viable agent-native tool has two interfaces: **Module** (importable) and **Skill** (agent instructions). Add CLI for humans. Add MCP for agents that speak MCP. Add OpenClaw/CC Hook for specific platforms.
142
+
143
+ ## The Reference Installer
144
+
145
+ `wip-install` is the reference implementation. It scans a repo, detects which interfaces exist, and installs them all. One command.
146
+
147
+ ```bash
148
+ wip-install /path/to/repo # local
149
+ wip-install org/repo # from GitHub
150
+ wip-install --dry-run /path/to/repo # detect only
151
+ wip-install --json /path/to/repo # JSON output
152
+ ```
153
+
154
+ ## Examples
155
+
156
+ | Repo | Interfaces | Type |
157
+ |------|------------|------|
158
+ | [wip-grok](https://github.com/wipcomputer/wip-grok) | CLI + Module + MCP + Skill | Sensor + Actuator |
159
+ | [wip-x](https://github.com/wipcomputer/wip-x) | CLI + Module + MCP + Skill | Sensor + Actuator |
160
+ | [wip-file-guard](https://github.com/wipcomputer/wip-file-guard) | CLI + OpenClaw + CC Hook | Actuator |
161
+ | [wip-markdown-viewer](https://github.com/wipcomputer/wip-markdown-viewer) | CLI + Module | Actuator |
package/detect.mjs ADDED
@@ -0,0 +1,112 @@
1
+ /**
2
+ * wip-universal-installer/detect.mjs
3
+ * Interface detection logic. Scans a repo and reports which interfaces it exposes.
4
+ * Importable by other tools. Zero dependencies.
5
+ */
6
+
7
+ import { existsSync, readFileSync } from 'node:fs';
8
+ import { join, basename } from 'node:path';
9
+
10
+ function readJSON(path) {
11
+ try {
12
+ return JSON.parse(readFileSync(path, 'utf8'));
13
+ } catch {
14
+ return null;
15
+ }
16
+ }
17
+
18
+ /**
19
+ * Detect all interfaces in a repo.
20
+ * Returns { interfaces, pkg } where interfaces is an object keyed by interface type.
21
+ */
22
+ export function detectInterfaces(repoPath) {
23
+ const interfaces = {};
24
+ const pkg = readJSON(join(repoPath, 'package.json'));
25
+
26
+ // 1. CLI: package.json has bin entry
27
+ if (pkg?.bin) {
28
+ interfaces.cli = { bin: pkg.bin, name: pkg.name };
29
+ }
30
+
31
+ // 2. Module: package.json has main or exports
32
+ if (pkg?.main || pkg?.exports) {
33
+ interfaces.module = { main: pkg.main || pkg.exports };
34
+ }
35
+
36
+ // 3. MCP Server: mcp-server.mjs/js/ts or dist/mcp-server.js
37
+ const mcpFiles = ['mcp-server.mjs', 'mcp-server.js', 'mcp-server.ts', 'dist/mcp-server.js'];
38
+ for (const f of mcpFiles) {
39
+ if (existsSync(join(repoPath, f))) {
40
+ interfaces.mcp = { file: f, name: pkg?.name || basename(repoPath) };
41
+ break;
42
+ }
43
+ }
44
+
45
+ // 4. OpenClaw Plugin: openclaw.plugin.json exists
46
+ const ocPlugin = join(repoPath, 'openclaw.plugin.json');
47
+ if (existsSync(ocPlugin)) {
48
+ interfaces.openclaw = { config: readJSON(ocPlugin), path: ocPlugin };
49
+ }
50
+
51
+ // 5. Skill: SKILL.md exists
52
+ if (existsSync(join(repoPath, 'SKILL.md'))) {
53
+ interfaces.skill = { path: join(repoPath, 'SKILL.md') };
54
+ }
55
+
56
+ // 6. Claude Code Hook: guard.mjs or claudeCode.hook in package.json
57
+ if (pkg?.claudeCode?.hook) {
58
+ interfaces.claudeCodeHook = pkg.claudeCode.hook;
59
+ } else if (existsSync(join(repoPath, 'guard.mjs'))) {
60
+ interfaces.claudeCodeHook = {
61
+ event: 'PreToolUse',
62
+ matcher: 'Edit|Write',
63
+ command: `node "${join(repoPath, 'guard.mjs')}"`,
64
+ timeout: 5
65
+ };
66
+ }
67
+
68
+ return { interfaces, pkg };
69
+ }
70
+
71
+ /**
72
+ * Describe detected interfaces as a human-readable summary.
73
+ */
74
+ export function describeInterfaces(interfaces) {
75
+ const lines = [];
76
+ const names = Object.keys(interfaces);
77
+
78
+ if (names.length === 0) {
79
+ return 'No interfaces detected.';
80
+ }
81
+
82
+ if (interfaces.cli) {
83
+ const bins = typeof interfaces.cli.bin === 'string' ? [interfaces.cli.name] : Object.keys(interfaces.cli.bin);
84
+ lines.push(`CLI: ${bins.join(', ')}`);
85
+ }
86
+ if (interfaces.module) lines.push(`Module: ${JSON.stringify(interfaces.module.main)}`);
87
+ if (interfaces.mcp) lines.push(`MCP Server: ${interfaces.mcp.file}`);
88
+ if (interfaces.openclaw) lines.push(`OpenClaw Plugin: ${interfaces.openclaw.config?.name || 'detected'}`);
89
+ if (interfaces.skill) lines.push(`Skill: SKILL.md`);
90
+ if (interfaces.claudeCodeHook) lines.push(`Claude Code Hook: ${interfaces.claudeCodeHook.event || 'PreToolUse'}`);
91
+
92
+ return `${names.length} interface(s): ${names.join(', ')}\n${lines.map(l => ` ${l}`).join('\n')}`;
93
+ }
94
+
95
+ /**
96
+ * Detect interfaces and return a structured JSON-serializable result.
97
+ */
98
+ export function detectInterfacesJSON(repoPath) {
99
+ const { interfaces, pkg } = detectInterfaces(repoPath);
100
+ return {
101
+ repo: basename(repoPath),
102
+ package: pkg?.name || null,
103
+ version: pkg?.version || null,
104
+ interfaces: Object.fromEntries(
105
+ Object.entries(interfaces).map(([type, info]) => [type, {
106
+ detected: true,
107
+ ...info,
108
+ }])
109
+ ),
110
+ interfaceCount: Object.keys(interfaces).length,
111
+ };
112
+ }
@@ -0,0 +1,20 @@
1
+ # Minimal Universal Interface Template
2
+
3
+ The smallest possible agent-native tool. Four files, four interfaces.
4
+
5
+ ```
6
+ core.mjs ← your logic
7
+ cli.mjs ← thin CLI wrapper
8
+ mcp-server.mjs ← MCP server
9
+ SKILL.md ← agent instructions
10
+ package.json ← name, bin, exports
11
+ ```
12
+
13
+ Copy this folder, rename everything, replace `hello()` with your functions.
14
+
15
+ ## Test it
16
+
17
+ ```bash
18
+ node cli.mjs world # Hello, world!
19
+ wip-install --dry-run . # Detected 4 interface(s): cli, module, mcp, skill
20
+ ```
@@ -0,0 +1,28 @@
1
+ ---
2
+ name: my-tool
3
+ version: 1.0.0
4
+ description: A minimal example tool.
5
+ metadata:
6
+ category: example
7
+ capabilities:
8
+ - hello
9
+ author:
10
+ name: Your Name
11
+ ---
12
+
13
+ # my-tool
14
+
15
+ A minimal example of the six-door pattern.
16
+
17
+ ## When to Use This Skill
18
+
19
+ Use `hello` when you need to greet someone.
20
+
21
+ ## API Reference
22
+
23
+ ### hello(options)
24
+
25
+ ```javascript
26
+ import { hello } from './core.mjs';
27
+ hello({ name: 'world' }); // "Hello, world!"
28
+ ```
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { hello } from './core.mjs';
3
+ const name = process.argv[2];
4
+ console.log(hello({ name }));
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Minimal six-door tool template.
3
+ * Replace this with your actual logic.
4
+ */
5
+
6
+ export function hello({ name = 'world' } = {}) {
7
+ return `Hello, ${name}!`;
8
+ }
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+ import { hello } from './core.mjs';
5
+
6
+ const server = new Server(
7
+ { name: 'my-tool', version: '1.0.0' },
8
+ { capabilities: { tools: {} } }
9
+ );
10
+
11
+ server.setRequestHandler({ method: 'tools/list' }, async () => ({
12
+ tools: [{
13
+ name: 'hello',
14
+ description: 'Say hello',
15
+ inputSchema: {
16
+ type: 'object',
17
+ properties: { name: { type: 'string' } },
18
+ },
19
+ }],
20
+ }));
21
+
22
+ server.setRequestHandler({ method: 'tools/call' }, async (req) => ({
23
+ content: [{ type: 'text', text: hello(req.params.arguments) }],
24
+ }));
25
+
26
+ const transport = new StdioServerTransport();
27
+ await server.connect(transport);
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "my-tool",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "main": "core.mjs",
6
+ "bin": {
7
+ "my-tool": "./cli.mjs"
8
+ },
9
+ "exports": {
10
+ ".": "./core.mjs"
11
+ }
12
+ }
package/install.mjs ADDED
@@ -0,0 +1,280 @@
1
+ #!/usr/bin/env node
2
+ // wip-universal-installer/install.mjs
3
+ // Reference installer for agent-native software.
4
+ // Reads a repo, detects available interfaces, installs them all.
5
+
6
+ import { execSync } from 'node:child_process';
7
+ import { existsSync, readFileSync, writeFileSync, cpSync, mkdirSync } from 'node:fs';
8
+ import { join, basename, resolve } from 'node:path';
9
+ import { detectInterfaces, describeInterfaces, detectInterfacesJSON } from './detect.mjs';
10
+
11
+ const OPENCLAW_DIR = join(process.env.HOME, '.openclaw');
12
+ const EXTENSIONS_DIR = join(OPENCLAW_DIR, 'extensions');
13
+
14
+ // Flags
15
+ const args = process.argv.slice(2);
16
+ const DRY_RUN = args.includes('--dry-run');
17
+ const JSON_OUTPUT = args.includes('--json');
18
+ const target = args.find(a => !a.startsWith('--'));
19
+
20
+ function log(msg) { if (!JSON_OUTPUT) console.log(` ${msg}`); }
21
+ function ok(msg) { if (!JSON_OUTPUT) console.log(` ✓ ${msg}`); }
22
+ function skip(msg) { if (!JSON_OUTPUT) console.log(` - ${msg}`); }
23
+ function fail(msg) { if (!JSON_OUTPUT) console.error(` ✗ ${msg}`); }
24
+
25
+ function readJSON(path) {
26
+ try {
27
+ return JSON.parse(readFileSync(path, 'utf8'));
28
+ } catch {
29
+ return null;
30
+ }
31
+ }
32
+
33
+ function installCLI(repoPath, door) {
34
+ if (DRY_RUN) {
35
+ ok(`CLI: would install globally (dry run)`);
36
+ return true;
37
+ }
38
+ try {
39
+ execSync('npm install -g .', { cwd: repoPath, stdio: 'pipe' });
40
+ const binNames = typeof door.bin === 'string' ? [basename(repoPath)] : Object.keys(door.bin);
41
+ ok(`CLI: ${binNames.join(', ')} installed globally`);
42
+ return true;
43
+ } catch (e) {
44
+ try {
45
+ execSync('npm link', { cwd: repoPath, stdio: 'pipe' });
46
+ ok(`CLI: linked globally via npm link`);
47
+ return true;
48
+ } catch {
49
+ fail(`CLI: install failed. Run manually: cd "${repoPath}" && npm install -g .`);
50
+ return false;
51
+ }
52
+ }
53
+ }
54
+
55
+ function installOpenClaw(repoPath, door) {
56
+ const name = door.config?.name || basename(repoPath);
57
+ const dest = join(EXTENSIONS_DIR, name);
58
+
59
+ if (DRY_RUN) {
60
+ ok(`OpenClaw: would copy to ${dest} (dry run)`);
61
+ return true;
62
+ }
63
+
64
+ if (existsSync(dest)) {
65
+ skip(`OpenClaw: ${name} already installed at ${dest}`);
66
+ return true;
67
+ }
68
+
69
+ try {
70
+ mkdirSync(dest, { recursive: true });
71
+ cpSync(repoPath, dest, { recursive: true, filter: (src) => !src.includes('.git') });
72
+ ok(`OpenClaw: copied to ${dest}`);
73
+
74
+ if (existsSync(join(dest, 'package.json'))) {
75
+ try {
76
+ execSync('npm install --omit=dev', { cwd: dest, stdio: 'pipe' });
77
+ ok(`OpenClaw: dependencies installed`);
78
+ } catch {
79
+ skip(`OpenClaw: no deps needed`);
80
+ }
81
+ }
82
+ return true;
83
+ } catch (e) {
84
+ fail(`OpenClaw: copy failed. ${e.message}`);
85
+ return false;
86
+ }
87
+ }
88
+
89
+ function installClaudeCodeHook(repoPath, door) {
90
+ const settingsPath = join(process.env.HOME, '.claude', 'settings.json');
91
+ let settings = readJSON(settingsPath);
92
+
93
+ if (!settings) {
94
+ skip(`Claude Code: no settings.json found at ${settingsPath}`);
95
+ return false;
96
+ }
97
+
98
+ if (DRY_RUN) {
99
+ ok(`Claude Code: would add ${door.event || 'PreToolUse'} hook (dry run)`);
100
+ return true;
101
+ }
102
+
103
+ if (!settings.hooks) settings.hooks = {};
104
+ const event = door.event || 'PreToolUse';
105
+
106
+ if (!settings.hooks[event]) settings.hooks[event] = [];
107
+
108
+ const hookCommand = door.command || `node "${join(repoPath, 'guard.mjs')}"`;
109
+ const existing = settings.hooks[event].some(entry =>
110
+ entry.hooks?.some(h => h.command === hookCommand)
111
+ );
112
+
113
+ if (existing) {
114
+ skip(`Claude Code: ${event} hook already configured`);
115
+ return true;
116
+ }
117
+
118
+ settings.hooks[event].push({
119
+ matcher: door.matcher || undefined,
120
+ hooks: [{
121
+ type: 'command',
122
+ command: hookCommand,
123
+ timeout: door.timeout || 10
124
+ }]
125
+ });
126
+
127
+ try {
128
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
129
+ ok(`Claude Code: ${event} hook added to settings.json`);
130
+ return true;
131
+ } catch (e) {
132
+ fail(`Claude Code: failed to update settings.json. ${e.message}`);
133
+ return false;
134
+ }
135
+ }
136
+
137
+ async function main() {
138
+ if (!target || target === '--help' || target === '-h') {
139
+ console.log('');
140
+ console.log(' wip-install ... the reference installer for agent-native software');
141
+ console.log('');
142
+ console.log(' Usage:');
143
+ console.log(' wip-install /path/to/repo');
144
+ console.log(' wip-install https://github.com/org/repo');
145
+ console.log(' wip-install org/repo');
146
+ console.log('');
147
+ console.log(' Flags:');
148
+ console.log(' --dry-run Detect interfaces without installing anything');
149
+ console.log(' --json Output detection results as JSON');
150
+ console.log('');
151
+ console.log(' Interfaces it detects:');
152
+ console.log(' CLI ... package.json bin entry -> npm install -g');
153
+ console.log(' Module ... ESM main/exports -> importable');
154
+ console.log(' MCP Server ... mcp-server.mjs -> config for .mcp.json');
155
+ console.log(' OpenClaw ... openclaw.plugin.json -> copies to extensions/');
156
+ console.log(' Skill ... SKILL.md -> agent instructions');
157
+ console.log(' CC Hook ... guard.mjs or claudeCode.hook -> settings.json');
158
+ console.log('');
159
+ process.exit(0);
160
+ }
161
+
162
+ // Resolve target: GitHub URL, org/repo shorthand, or local path
163
+ let repoPath;
164
+
165
+ if (target.startsWith('http') || target.startsWith('git@') || target.match(/^[\w-]+\/[\w.-]+$/)) {
166
+ const url = target.match(/^[\w-]+\/[\w.-]+$/)
167
+ ? `https://github.com/${target}.git`
168
+ : target;
169
+ const repoName = basename(url).replace('.git', '');
170
+ repoPath = join('/tmp', `wip-install-${repoName}`);
171
+
172
+ log('');
173
+ log(`Cloning ${url}...`);
174
+ try {
175
+ if (existsSync(repoPath)) {
176
+ execSync(`rm -rf "${repoPath}"`);
177
+ }
178
+ execSync(`git clone "${url}" "${repoPath}"`, { stdio: 'pipe' });
179
+ ok(`Cloned to ${repoPath}`);
180
+ } catch (e) {
181
+ fail(`Clone failed: ${e.message}`);
182
+ process.exit(1);
183
+ }
184
+ } else {
185
+ repoPath = resolve(target);
186
+ if (!existsSync(repoPath)) {
187
+ fail(`Path not found: ${repoPath}`);
188
+ process.exit(1);
189
+ }
190
+ }
191
+
192
+ // JSON mode: detect and output
193
+ if (JSON_OUTPUT) {
194
+ const result = detectInterfacesJSON(repoPath);
195
+ console.log(JSON.stringify(result, null, 2));
196
+ if (DRY_RUN) process.exit(0);
197
+ // If not dry run, continue with install but suppress output
198
+ }
199
+
200
+ // Detect interfaces
201
+ const { interfaces, pkg } = detectInterfaces(repoPath);
202
+ const ifaceNames = Object.keys(interfaces);
203
+
204
+ if (ifaceNames.length === 0) {
205
+ skip('No installable interfaces detected.');
206
+ process.exit(0);
207
+ }
208
+
209
+ if (!JSON_OUTPUT) {
210
+ console.log('');
211
+ const repoName = basename(repoPath);
212
+ console.log(` Installing: ${repoName}${DRY_RUN ? ' (dry run)' : ''}`);
213
+ console.log(` ${'─'.repeat(40)}`);
214
+ log(`Detected ${ifaceNames.length} interface(s): ${ifaceNames.join(', ')}`);
215
+ console.log('');
216
+ }
217
+
218
+ if (DRY_RUN && !JSON_OUTPUT) {
219
+ // In dry run, show what would happen
220
+ console.log(describeInterfaces(interfaces));
221
+ console.log('');
222
+ console.log(' Dry run complete. No changes made.');
223
+ console.log('');
224
+ process.exit(0);
225
+ }
226
+
227
+ // Install each interface
228
+ let installed = 0;
229
+
230
+ if (interfaces.cli) {
231
+ installCLI(repoPath, interfaces.cli);
232
+ installed++;
233
+ }
234
+
235
+ if (interfaces.openclaw) {
236
+ installOpenClaw(repoPath, interfaces.openclaw);
237
+ installed++;
238
+ }
239
+
240
+ if (interfaces.claudeCodeHook) {
241
+ installClaudeCodeHook(repoPath, interfaces.claudeCodeHook);
242
+ installed++;
243
+ }
244
+
245
+ if (interfaces.mcp) {
246
+ if (!JSON_OUTPUT) {
247
+ console.log('');
248
+ log(`MCP Server detected: ${interfaces.mcp.file}`);
249
+ log(`Add to .mcp.json:`);
250
+ console.log(JSON.stringify({
251
+ [interfaces.mcp.name]: {
252
+ command: 'node',
253
+ args: [join(repoPath, interfaces.mcp.file)]
254
+ }
255
+ }, null, 2));
256
+ }
257
+ installed++;
258
+ }
259
+
260
+ if (interfaces.skill) {
261
+ ok(`Skill: SKILL.md available at ${interfaces.skill.path}`);
262
+ installed++;
263
+ }
264
+
265
+ if (interfaces.module) {
266
+ ok(`Module: import from "${interfaces.module.main}"`);
267
+ installed++;
268
+ }
269
+
270
+ if (!JSON_OUTPUT) {
271
+ console.log('');
272
+ console.log(` Done. ${installed} interface(s) processed.`);
273
+ console.log('');
274
+ }
275
+ }
276
+
277
+ main().catch(e => {
278
+ fail(e.message);
279
+ process.exit(1);
280
+ });
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@wipcomputer/universal-installer",
3
+ "version": "2.1.1",
4
+ "type": "module",
5
+ "description": "The reference installer for agent-native software. Detects interfaces (CLI, Module, MCP, OpenClaw, Skill, CC Hook) and installs them all.",
6
+ "main": "detect.mjs",
7
+ "bin": {
8
+ "wip-install": "./install.mjs"
9
+ },
10
+ "exports": {
11
+ ".": "./detect.mjs",
12
+ "./detect": "./detect.mjs",
13
+ "./install": "./install.mjs"
14
+ },
15
+ "scripts": {
16
+ "test": "node install.mjs --help"
17
+ },
18
+ "keywords": [
19
+ "installer",
20
+ "agent-native",
21
+ "sensor",
22
+ "actuator",
23
+ "universal-interface",
24
+ "claude-code",
25
+ "openclaw",
26
+ "mcp",
27
+ "cli"
28
+ ],
29
+ "author": "Parker Todd Brooks",
30
+ "license": "MIT",
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/wipcomputer/wip-universal-installer.git"
34
+ },
35
+ "homepage": "https://github.com/wipcomputer/wip-universal-installer"
36
+ }