codeport 0.3.0 → 0.3.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/index.js +30 -30
- package/package.json +4 -1
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __cpRequire } from "node:module"; const require = __cpRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// src/index.ts
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// src/api.ts
|
|
8
8
|
var ApiError = class extends Error {
|
|
9
9
|
constructor(status, message) {
|
|
10
10
|
super(message);
|
|
@@ -84,7 +84,7 @@ async function errorText(res, fallback) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
//
|
|
87
|
+
// src/auth-flow.ts
|
|
88
88
|
import { z } from "zod";
|
|
89
89
|
var Email = z.string().trim().toLowerCase().email();
|
|
90
90
|
var Code = z.string().trim().regex(/^\d{6}$/, "the code has 6 digits");
|
|
@@ -145,7 +145,7 @@ var AuthFlow = class {
|
|
|
145
145
|
}
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
//
|
|
148
|
+
// src/credentials.ts
|
|
149
149
|
import { mkdir, readFile, rm, writeFile, chmod } from "node:fs/promises";
|
|
150
150
|
import { homedir } from "node:os";
|
|
151
151
|
import path from "node:path";
|
|
@@ -209,7 +209,7 @@ async function defaultStore() {
|
|
|
209
209
|
return await KeyringStore.tryCreate() ?? new FileStore();
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
//
|
|
212
|
+
// src/server.ts
|
|
213
213
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
214
214
|
import { z as z2 } from "zod";
|
|
215
215
|
var text = (t) => ({ content: [{ type: "text", text: t }] });
|
|
@@ -299,11 +299,11 @@ function createServer(flow2, tools, version) {
|
|
|
299
299
|
return server2;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
//
|
|
302
|
+
// src/project-tools.ts
|
|
303
303
|
import path6 from "node:path";
|
|
304
304
|
import { stat as stat2 } from "node:fs/promises";
|
|
305
305
|
|
|
306
|
-
// packages/detectors/dist/files.js
|
|
306
|
+
// ../../packages/detectors/dist/files.js
|
|
307
307
|
import { readdir, readFile as readFile2, stat } from "node:fs/promises";
|
|
308
308
|
import path2 from "node:path";
|
|
309
309
|
var IGNORED_DIRS = /* @__PURE__ */ new Set([
|
|
@@ -386,10 +386,10 @@ function subdir(files, dir) {
|
|
|
386
386
|
return { list: () => keys, read: (rel) => files.read(prefix + rel) };
|
|
387
387
|
}
|
|
388
388
|
|
|
389
|
-
// packages/detectors/dist/analyze.js
|
|
389
|
+
// ../../packages/detectors/dist/analyze.js
|
|
390
390
|
import path4 from "node:path";
|
|
391
391
|
|
|
392
|
-
// packages/app-profile/dist/schema.js
|
|
392
|
+
// ../../packages/app-profile/dist/schema.js
|
|
393
393
|
import { z as z3 } from "zod";
|
|
394
394
|
var Source = z3.enum(["detector", "llm", "user"]);
|
|
395
395
|
var AppKind = z3.enum(["web", "api", "worker", "static", "fullstack"]);
|
|
@@ -445,7 +445,7 @@ var AppProfile = z3.object({
|
|
|
445
445
|
load: Load.default({ source: "detector" })
|
|
446
446
|
});
|
|
447
447
|
|
|
448
|
-
// packages/detectors/dist/common.js
|
|
448
|
+
// ../../packages/detectors/dist/common.js
|
|
449
449
|
var ServiceSet = class {
|
|
450
450
|
map = /* @__PURE__ */ new Map();
|
|
451
451
|
add(hit, evidence) {
|
|
@@ -477,7 +477,7 @@ function firstExisting(files, candidates) {
|
|
|
477
477
|
return candidates.find((c) => set.has(c));
|
|
478
478
|
}
|
|
479
479
|
|
|
480
|
-
// packages/detectors/dist/catalog.js
|
|
480
|
+
// ../../packages/detectors/dist/catalog.js
|
|
481
481
|
var NPM_SERVICES = {
|
|
482
482
|
pg: [{ type: "database", engine: "postgres" }],
|
|
483
483
|
postgres: [{ type: "database", engine: "postgres" }],
|
|
@@ -723,7 +723,7 @@ var IGNORED_ENV = /* @__PURE__ */ new Set([
|
|
|
723
723
|
]);
|
|
724
724
|
var TEST_ENV = /^(PLAYWRIGHT|CYPRESS|VITEST|JEST|CI_|GITHUB_)/;
|
|
725
725
|
|
|
726
|
-
// packages/detectors/dist/env.js
|
|
726
|
+
// ../../packages/detectors/dist/env.js
|
|
727
727
|
var ENV_FILES = /(^|\/)\.env\.(example|sample|template|local\.example)$/;
|
|
728
728
|
var SOURCE = /\.(js|cjs|mjs|jsx|ts|tsx|mts|cts|py|vue|svelte|astro)$/;
|
|
729
729
|
var TEST_PATH = /(^|\/)(tests?|__tests__|e2e|cypress|playwright|spec)\/|\.(test|spec)\.[a-z]+$|(^|\/)(playwright|vitest|jest|cypress)\.config\./i;
|
|
@@ -767,7 +767,7 @@ function detectEnv(files) {
|
|
|
767
767
|
return { env, evidence: found };
|
|
768
768
|
}
|
|
769
769
|
|
|
770
|
-
// packages/detectors/dist/node.js
|
|
770
|
+
// ../../packages/detectors/dist/node.js
|
|
771
771
|
function readPackageJson(files, rel = "package.json") {
|
|
772
772
|
const raw = files.read(rel);
|
|
773
773
|
if (!raw)
|
|
@@ -921,7 +921,7 @@ function detectNode(files, fallbackName, inheritedPm) {
|
|
|
921
921
|
};
|
|
922
922
|
}
|
|
923
923
|
|
|
924
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
924
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/error.js
|
|
925
925
|
function getLineColFromPtr(string, ptr) {
|
|
926
926
|
let lines = string.slice(0, ptr).split(/\r?\n/);
|
|
927
927
|
return [lines.length, lines.pop().length + 1];
|
|
@@ -965,7 +965,7 @@ ${codeblock}`, options);
|
|
|
965
965
|
}
|
|
966
966
|
};
|
|
967
967
|
|
|
968
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/primitive.js
|
|
968
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/primitive.js
|
|
969
969
|
function parseString(ctx) {
|
|
970
970
|
let startPtr = ctx.p;
|
|
971
971
|
let c = ctx.s.charCodeAt(ctx.p++);
|
|
@@ -1066,7 +1066,7 @@ function parseString(ctx) {
|
|
|
1066
1066
|
TomlError.x("unfinished string", ctx, startPtr);
|
|
1067
1067
|
}
|
|
1068
1068
|
|
|
1069
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/date.js
|
|
1069
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/date.js
|
|
1070
1070
|
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
|
|
1071
1071
|
var TomlDate = class _TomlDate extends Date {
|
|
1072
1072
|
#hasDate = false;
|
|
@@ -1181,7 +1181,7 @@ var TomlDate = class _TomlDate extends Date {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
};
|
|
1183
1183
|
|
|
1184
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/extract.js
|
|
1184
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/extract.js
|
|
1185
1185
|
function isDigit(char, base = 10) {
|
|
1186
1186
|
return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
|
|
1187
1187
|
}
|
|
@@ -1390,7 +1390,7 @@ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
|
|
|
1390
1390
|
}
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/util.js
|
|
1393
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/util.js
|
|
1394
1394
|
function skipComment(ctx) {
|
|
1395
1395
|
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
1396
1396
|
let c = ctx.s.charCodeAt(ctx.p);
|
|
@@ -1416,7 +1416,7 @@ function skipVoid(ctx, banNewLines, banComments) {
|
|
|
1416
1416
|
}
|
|
1417
1417
|
}
|
|
1418
1418
|
|
|
1419
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/struct.js
|
|
1419
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/struct.js
|
|
1420
1420
|
function parseKey(ctx, end = 61) {
|
|
1421
1421
|
let startPtr;
|
|
1422
1422
|
let state = 0;
|
|
@@ -1533,7 +1533,7 @@ function parseArray(ctx) {
|
|
|
1533
1533
|
TomlError.x("unfinished array", ctx, startPtr);
|
|
1534
1534
|
}
|
|
1535
1535
|
|
|
1536
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/parse.js
|
|
1536
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/parse.js
|
|
1537
1537
|
function peekTable(ctx, key, table, meta, type) {
|
|
1538
1538
|
let t = table;
|
|
1539
1539
|
let m = meta;
|
|
@@ -1676,10 +1676,10 @@ function parse(toml, options = {}) {
|
|
|
1676
1676
|
return res;
|
|
1677
1677
|
}
|
|
1678
1678
|
|
|
1679
|
-
// node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/stringify.js
|
|
1679
|
+
// ../../node_modules/.pnpm/smol-toml@1.9.1/node_modules/smol-toml/dist/stringify.js
|
|
1680
1680
|
var HAS_WELLFORMED = !!"".isWellFormed;
|
|
1681
1681
|
|
|
1682
|
-
// packages/detectors/dist/python.js
|
|
1682
|
+
// ../../packages/detectors/dist/python.js
|
|
1683
1683
|
var DOC_TOOLS = /^(sphinx|mkdocs|alabaster|furo|myst-parser|pydata-sphinx-theme|docutils|recommonmark)/;
|
|
1684
1684
|
function normalizePyName(spec) {
|
|
1685
1685
|
const m = spec.trim().match(/^([A-Za-z0-9][A-Za-z0-9._-]*)/);
|
|
@@ -1795,7 +1795,7 @@ function detectPython(files, fallbackName, inheritedLock) {
|
|
|
1795
1795
|
};
|
|
1796
1796
|
}
|
|
1797
1797
|
|
|
1798
|
-
// packages/detectors/dist/dotnet.js
|
|
1798
|
+
// ../../packages/detectors/dist/dotnet.js
|
|
1799
1799
|
import path3 from "node:path";
|
|
1800
1800
|
var PROJECT_FILE = /\.(cs|fs)proj$/;
|
|
1801
1801
|
function properties(xml) {
|
|
@@ -2114,7 +2114,7 @@ function detectDotnet(files) {
|
|
|
2114
2114
|
return { apps, warnings };
|
|
2115
2115
|
}
|
|
2116
2116
|
|
|
2117
|
-
// packages/detectors/dist/analyze.js
|
|
2117
|
+
// ../../packages/detectors/dist/analyze.js
|
|
2118
2118
|
function hasManifest(files, dir) {
|
|
2119
2119
|
const view = subdir(files, dir);
|
|
2120
2120
|
return view.list().includes("package.json") || pythonManifests(view).length > 0;
|
|
@@ -2248,7 +2248,7 @@ async function analyzeDirectory(dir) {
|
|
|
2248
2248
|
return analyzeFiles(await fromDirectory(dir), path4.basename(path4.resolve(dir)));
|
|
2249
2249
|
}
|
|
2250
2250
|
|
|
2251
|
-
//
|
|
2251
|
+
// src/format.ts
|
|
2252
2252
|
var runtimeName = (lang) => lang === "typescript" || lang === "javascript" ? "Node.js" : lang === "python" ? "Python" : lang === "csharp" || lang === "fsharp" ? ".NET" : lang;
|
|
2253
2253
|
var money = (v) => v >= 100 ? `$${Math.round(v).toLocaleString("en-US")}` : `$${v.toFixed(2)}`;
|
|
2254
2254
|
var range = (r) => Math.abs(r.high - r.low) < 5e-3 ? money(r.low) : `${money(r.low)}\u2013${money(r.high)}`;
|
|
@@ -2350,7 +2350,7 @@ function formatRecommendation(r) {
|
|
|
2350
2350
|
return out.join("\n");
|
|
2351
2351
|
}
|
|
2352
2352
|
|
|
2353
|
-
//
|
|
2353
|
+
// src/projects.ts
|
|
2354
2354
|
import { mkdir as mkdir2, readFile as readFile3, writeFile as writeFile2 } from "node:fs/promises";
|
|
2355
2355
|
import { homedir as homedir2 } from "node:os";
|
|
2356
2356
|
import path5 from "node:path";
|
|
@@ -2397,7 +2397,7 @@ async function repoOf(dir) {
|
|
|
2397
2397
|
}
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
2400
|
-
//
|
|
2400
|
+
// src/project-tools.ts
|
|
2401
2401
|
var NOT_SIGNED_IN = "Not signed in to Codeport. Ask the user for their work email and call auth_start.";
|
|
2402
2402
|
var ProjectTools = class {
|
|
2403
2403
|
constructor(api2, store2, projects = new ProjectMap(), cwd = () => process.cwd()) {
|
|
@@ -2528,10 +2528,10 @@ var usd = (r) => {
|
|
|
2528
2528
|
return Math.abs(r.high - r.low) < 5e-3 ? f(r.low) : `${f(r.low)}\u2013${f(r.high)}`;
|
|
2529
2529
|
};
|
|
2530
2530
|
|
|
2531
|
-
//
|
|
2532
|
-
var VERSION = "0.3.
|
|
2531
|
+
// src/version.ts
|
|
2532
|
+
var VERSION = "0.3.1";
|
|
2533
2533
|
|
|
2534
|
-
//
|
|
2534
|
+
// src/index.ts
|
|
2535
2535
|
var apiUrl = process.env.CODEPORT_API_URL ?? "https://api.codeport.diy";
|
|
2536
2536
|
var api = new CodeportApi(apiUrl);
|
|
2537
2537
|
var store = await defaultStore();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeport",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Codeport MCP server: analyze your project's stack, estimate hosting cost and pick where to host it",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -28,5 +28,8 @@
|
|
|
28
28
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
29
29
|
"@napi-rs/keyring": "^2.1.2",
|
|
30
30
|
"zod": "^3.25.76"
|
|
31
|
+
},
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"provenance": false
|
|
31
34
|
}
|
|
32
35
|
}
|