@morphism-systems/plugin-bundle 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.
- package/README.md +30 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +112 -0
- package/package.json +36 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @morphism-systems/plugin-bundle
|
|
2
|
+
|
|
3
|
+
One-command Morphism setup. Installs MCP servers, scaffolds `.morphism/` config, and configures git hooks.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @morphism-systems/plugin-bundle install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
This will:
|
|
12
|
+
1. Add MCP server entries to `~/.claude/mcp.json`
|
|
13
|
+
2. Create `.morphism/config.json` in your project
|
|
14
|
+
3. Set up git hooks from `.githooks/`
|
|
15
|
+
|
|
16
|
+
## Individual Commands
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @morphism-systems/plugin-bundle mcp # MCP servers only
|
|
20
|
+
npx @morphism-systems/plugin-bundle config # .morphism/ config only
|
|
21
|
+
npx @morphism-systems/plugin-bundle hooks # Git hooks only
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Why Morphism
|
|
25
|
+
|
|
26
|
+
Governance-as-code with mathematical guarantees. [Learn more](https://morphism.systems).
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
|
|
7
|
+
// src/installers/mcp.ts
|
|
8
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
var MCP_ENTRIES = {
|
|
11
|
+
"morphism-math": {
|
|
12
|
+
command: "npx",
|
|
13
|
+
args: ["@morphism-systems/agentic-math"]
|
|
14
|
+
},
|
|
15
|
+
"morphism-governance": {
|
|
16
|
+
command: "npx",
|
|
17
|
+
args: ["@morphism-systems/mcp-server"]
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function installMcp(home) {
|
|
21
|
+
const claudeDir = join(home, ".claude");
|
|
22
|
+
const mcpPath = join(claudeDir, "mcp.json");
|
|
23
|
+
mkdirSync(claudeDir, { recursive: true });
|
|
24
|
+
let config = {};
|
|
25
|
+
if (existsSync(mcpPath)) {
|
|
26
|
+
try {
|
|
27
|
+
config = JSON.parse(readFileSync(mcpPath, "utf-8"));
|
|
28
|
+
} catch {
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const servers = config.mcpServers ?? {};
|
|
32
|
+
let added = 0;
|
|
33
|
+
for (const [name, entry] of Object.entries(MCP_ENTRIES)) {
|
|
34
|
+
if (!(name in servers)) {
|
|
35
|
+
servers[name] = entry;
|
|
36
|
+
added++;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
config.mcpServers = servers;
|
|
40
|
+
writeFileSync(mcpPath, JSON.stringify(config, null, 2) + "\n");
|
|
41
|
+
console.log(` MCP: ${added} server(s) added to ${mcpPath}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/installers/config.ts
|
|
45
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
46
|
+
import { join as join2 } from "path";
|
|
47
|
+
var DEFAULT_CONFIG = {
|
|
48
|
+
version: "0.1.0",
|
|
49
|
+
governance: {
|
|
50
|
+
kernel: "morphism-kernel",
|
|
51
|
+
invariants: 7,
|
|
52
|
+
tenets: 10
|
|
53
|
+
},
|
|
54
|
+
metrics: {
|
|
55
|
+
convergence_threshold: 1,
|
|
56
|
+
drift_threshold: 15
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
function installConfig(cwd) {
|
|
60
|
+
const morphismDir = join2(cwd, ".morphism");
|
|
61
|
+
if (existsSync2(join2(morphismDir, "config.json"))) {
|
|
62
|
+
console.log(" Config: .morphism/config.json already exists \u2014 skipping");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
mkdirSync2(morphismDir, { recursive: true });
|
|
66
|
+
writeFileSync2(
|
|
67
|
+
join2(morphismDir, "config.json"),
|
|
68
|
+
JSON.stringify(DEFAULT_CONFIG, null, 2) + "\n"
|
|
69
|
+
);
|
|
70
|
+
console.log(" Config: created .morphism/config.json");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/installers/hooks.ts
|
|
74
|
+
import { existsSync as existsSync3 } from "fs";
|
|
75
|
+
import { join as join3 } from "path";
|
|
76
|
+
import { execSync } from "child_process";
|
|
77
|
+
function installHooks(cwd) {
|
|
78
|
+
const hooksDir = join3(cwd, ".githooks");
|
|
79
|
+
if (!existsSync3(hooksDir)) {
|
|
80
|
+
console.log(" Hooks: no .githooks/ directory found \u2014 skipping");
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
execSync("git config core.hooksPath .githooks", { cwd, encoding: "utf-8" });
|
|
85
|
+
console.log(" Hooks: git hooks path set to .githooks/");
|
|
86
|
+
} catch {
|
|
87
|
+
console.log(" Hooks: failed to set git hooks path (not a git repo?)");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// src/index.ts
|
|
92
|
+
var program = new Command();
|
|
93
|
+
program.name("morphism-install").description("One-command Morphism setup \u2014 MCP servers, config, hooks").version("0.1.0");
|
|
94
|
+
program.command("install").description("Install everything: MCP servers, .morphism/ config, git hooks").action(() => {
|
|
95
|
+
const cwd = process.cwd();
|
|
96
|
+
const home = homedir();
|
|
97
|
+
console.log("Installing Morphism plugin bundle...\n");
|
|
98
|
+
installMcp(home);
|
|
99
|
+
installConfig(cwd);
|
|
100
|
+
installHooks(cwd);
|
|
101
|
+
console.log("\nDone. Run `morphism doctor` to verify setup.");
|
|
102
|
+
});
|
|
103
|
+
program.command("mcp").description("Install MCP server entries only").action(() => {
|
|
104
|
+
installMcp(homedir());
|
|
105
|
+
});
|
|
106
|
+
program.command("config").description("Scaffold .morphism/ config only").action(() => {
|
|
107
|
+
installConfig(process.cwd());
|
|
108
|
+
});
|
|
109
|
+
program.command("hooks").description("Install git hooks only").action(() => {
|
|
110
|
+
installHooks(process.cwd());
|
|
111
|
+
});
|
|
112
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@morphism-systems/plugin-bundle",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "One-command Morphism installer — MCP servers, skills, hooks, config",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"morphism-install": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup src/index.ts --format esm --dts --clean",
|
|
12
|
+
"typecheck": "tsc --noEmit",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"lint": "echo 'no lint configured'"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"morphism",
|
|
18
|
+
"governance",
|
|
19
|
+
"mcp",
|
|
20
|
+
"plugin",
|
|
21
|
+
"installer"
|
|
22
|
+
],
|
|
23
|
+
"license": "BUSL-1.1",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"commander": "^13.1.0",
|
|
29
|
+
"chalk": "^5.4.0"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"tsup": "^8.4.0",
|
|
33
|
+
"typescript": "^5.8.3",
|
|
34
|
+
"vitest": "^3.0.0"
|
|
35
|
+
}
|
|
36
|
+
}
|