@schoolai/shipyard-mcp 0.2.2 → 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/apps/hook/dist/{index.js → index.cjs} +716 -58
- package/apps/server/dist/{chunk-BWP37ADP.js → chunk-GDVRDX7Z.js} +54 -7
- package/apps/server/dist/{chunk-76JWRTPI.js → chunk-I7UCM5RO.js} +486 -45
- package/apps/server/dist/{dist-ORKL4P3L.js → dist-QXOKL75H.js} +37 -1
- package/apps/server/dist/index.js +1428 -402
- package/apps/server/dist/{input-request-manager-73GSTOIB.js → input-request-manager-IF6M76G4.js} +2 -2
- package/package.json +3 -3
- package/apps/server/dist/chunk-E5DWX2WU.js +0 -180
- package/apps/server/dist/server-identity-6PHKR2FY.js +0 -12
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@schoolai/shipyard-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Shipyard MCP server and CLI tools for distributed planning with CRDTs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mcp-server-shipyard": "./apps/server/dist/index.js",
|
|
8
|
-
"shipyard-hook": "./apps/hook/dist/index.
|
|
8
|
+
"shipyard-hook": "./apps/hook/dist/index.cjs"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"apps/server/dist",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"import": "./apps/server/dist/index.js"
|
|
20
20
|
},
|
|
21
21
|
"./hook": {
|
|
22
|
-
"
|
|
22
|
+
"require": "./apps/hook/dist/index.cjs"
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"engines": {
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadEnv,
|
|
3
|
-
logger
|
|
4
|
-
} from "./chunk-GSGLHRWX.js";
|
|
5
|
-
|
|
6
|
-
// src/server-identity.ts
|
|
7
|
-
import { execSync as execSync2 } from "child_process";
|
|
8
|
-
import os from "os";
|
|
9
|
-
import { basename } from "path";
|
|
10
|
-
|
|
11
|
-
// src/config/env/github.ts
|
|
12
|
-
import { execSync } from "child_process";
|
|
13
|
-
import { z } from "zod";
|
|
14
|
-
function getTokenFromGhCli() {
|
|
15
|
-
try {
|
|
16
|
-
const token = execSync("gh auth token", {
|
|
17
|
-
encoding: "utf-8",
|
|
18
|
-
timeout: 5e3,
|
|
19
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
20
|
-
// Suppress stderr
|
|
21
|
-
}).trim();
|
|
22
|
-
if (token) {
|
|
23
|
-
return token;
|
|
24
|
-
}
|
|
25
|
-
} catch {
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
var schema = z.object({
|
|
30
|
-
GITHUB_USERNAME: z.string().optional(),
|
|
31
|
-
GITHUB_TOKEN: z.string().optional().transform((val) => val || getTokenFromGhCli() || null),
|
|
32
|
-
SHIPYARD_ARTIFACTS: z.string().optional().transform((val) => {
|
|
33
|
-
if (!val) return true;
|
|
34
|
-
const setting = val.toLowerCase();
|
|
35
|
-
return setting !== "disabled" && setting !== "false" && setting !== "0";
|
|
36
|
-
})
|
|
37
|
-
});
|
|
38
|
-
var githubConfig = loadEnv(schema);
|
|
39
|
-
|
|
40
|
-
// src/server-identity.ts
|
|
41
|
-
var cachedUsername = null;
|
|
42
|
-
var usernameResolved = false;
|
|
43
|
-
var cachedRepoName = null;
|
|
44
|
-
function getRepositoryFullName() {
|
|
45
|
-
if (cachedRepoName !== null) {
|
|
46
|
-
return cachedRepoName || null;
|
|
47
|
-
}
|
|
48
|
-
try {
|
|
49
|
-
const repoName = execSync2("gh repo view --json nameWithOwner --jq .nameWithOwner", {
|
|
50
|
-
encoding: "utf-8",
|
|
51
|
-
timeout: 5e3,
|
|
52
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
53
|
-
}).trim();
|
|
54
|
-
if (!repoName) {
|
|
55
|
-
cachedRepoName = "";
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
cachedRepoName = repoName;
|
|
59
|
-
return cachedRepoName;
|
|
60
|
-
} catch {
|
|
61
|
-
cachedRepoName = "";
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async function getGitHubUsername() {
|
|
66
|
-
if (usernameResolved && cachedUsername) {
|
|
67
|
-
return cachedUsername;
|
|
68
|
-
}
|
|
69
|
-
if (githubConfig.GITHUB_USERNAME) {
|
|
70
|
-
cachedUsername = githubConfig.GITHUB_USERNAME;
|
|
71
|
-
usernameResolved = true;
|
|
72
|
-
logger.info({ username: cachedUsername }, "Using GITHUB_USERNAME from env");
|
|
73
|
-
return cachedUsername;
|
|
74
|
-
}
|
|
75
|
-
if (githubConfig.GITHUB_TOKEN) {
|
|
76
|
-
const username = await getUsernameFromToken(githubConfig.GITHUB_TOKEN);
|
|
77
|
-
if (username) {
|
|
78
|
-
cachedUsername = username;
|
|
79
|
-
usernameResolved = true;
|
|
80
|
-
logger.info({ username }, "Resolved username from GITHUB_TOKEN via API");
|
|
81
|
-
return cachedUsername;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
const cliUsername = getUsernameFromCLI();
|
|
85
|
-
if (cliUsername) {
|
|
86
|
-
cachedUsername = cliUsername;
|
|
87
|
-
usernameResolved = true;
|
|
88
|
-
logger.info({ username: cliUsername }, "Resolved username from gh CLI");
|
|
89
|
-
return cachedUsername;
|
|
90
|
-
}
|
|
91
|
-
const gitUsername = getUsernameFromGitConfig();
|
|
92
|
-
if (gitUsername) {
|
|
93
|
-
cachedUsername = gitUsername;
|
|
94
|
-
usernameResolved = true;
|
|
95
|
-
logger.warn({ username: gitUsername }, "Using git config user.name (UNVERIFIED)");
|
|
96
|
-
return cachedUsername;
|
|
97
|
-
}
|
|
98
|
-
const osUsername = process.env.USER || process.env.USERNAME;
|
|
99
|
-
if (osUsername) {
|
|
100
|
-
cachedUsername = osUsername.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
101
|
-
usernameResolved = true;
|
|
102
|
-
logger.warn(
|
|
103
|
-
{ username: cachedUsername, original: osUsername },
|
|
104
|
-
"Using sanitized OS username (UNVERIFIED)"
|
|
105
|
-
);
|
|
106
|
-
return cachedUsername;
|
|
107
|
-
}
|
|
108
|
-
usernameResolved = true;
|
|
109
|
-
throw new Error(
|
|
110
|
-
'GitHub username required but could not be determined.\n\nConfigure ONE of:\n1. GITHUB_USERNAME=your-username (explicit)\n2. GITHUB_TOKEN=ghp_xxx (will fetch from API)\n3. gh auth login (uses CLI)\n4. git config --global user.name "your-username"\n5. Set USER or USERNAME environment variable\n\nFor remote agents: Use option 1 or 2'
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
async function getUsernameFromToken(token) {
|
|
114
|
-
try {
|
|
115
|
-
const response = await fetch("https://api.github.com/user", {
|
|
116
|
-
headers: {
|
|
117
|
-
Authorization: `Bearer ${token}`,
|
|
118
|
-
Accept: "application/vnd.github.v3+json",
|
|
119
|
-
"User-Agent": "shipyard-mcp-server"
|
|
120
|
-
},
|
|
121
|
-
signal: AbortSignal.timeout(5e3)
|
|
122
|
-
});
|
|
123
|
-
if (!response.ok) return null;
|
|
124
|
-
const user = await response.json();
|
|
125
|
-
return user.login || null;
|
|
126
|
-
} catch (error) {
|
|
127
|
-
logger.debug({ error }, "GitHub API failed");
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
function getUsernameFromCLI() {
|
|
132
|
-
try {
|
|
133
|
-
const username = execSync2("gh api user --jq .login", {
|
|
134
|
-
encoding: "utf-8",
|
|
135
|
-
timeout: 5e3,
|
|
136
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
137
|
-
}).trim();
|
|
138
|
-
return username || null;
|
|
139
|
-
} catch {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function getUsernameFromGitConfig() {
|
|
144
|
-
try {
|
|
145
|
-
const username = execSync2("git config user.name", {
|
|
146
|
-
encoding: "utf-8",
|
|
147
|
-
timeout: 5e3,
|
|
148
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
149
|
-
}).trim();
|
|
150
|
-
return username || null;
|
|
151
|
-
} catch {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
function getGitBranch() {
|
|
156
|
-
try {
|
|
157
|
-
return execSync2("git branch --show-current", {
|
|
158
|
-
encoding: "utf-8",
|
|
159
|
-
timeout: 2e3,
|
|
160
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
161
|
-
}).trim() || void 0;
|
|
162
|
-
} catch {
|
|
163
|
-
return void 0;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function getEnvironmentContext() {
|
|
167
|
-
return {
|
|
168
|
-
projectName: basename(process.cwd()) || void 0,
|
|
169
|
-
branch: getGitBranch(),
|
|
170
|
-
hostname: os.hostname(),
|
|
171
|
-
repo: getRepositoryFullName() || void 0
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export {
|
|
176
|
-
githubConfig,
|
|
177
|
-
getRepositoryFullName,
|
|
178
|
-
getGitHubUsername,
|
|
179
|
-
getEnvironmentContext
|
|
180
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getEnvironmentContext,
|
|
3
|
-
getGitHubUsername,
|
|
4
|
-
getRepositoryFullName
|
|
5
|
-
} from "./chunk-E5DWX2WU.js";
|
|
6
|
-
import "./chunk-GSGLHRWX.js";
|
|
7
|
-
import "./chunk-JSBRDJBE.js";
|
|
8
|
-
export {
|
|
9
|
-
getEnvironmentContext,
|
|
10
|
-
getGitHubUsername,
|
|
11
|
-
getRepositoryFullName
|
|
12
|
-
};
|