@contentrain/mcp 2.2.0 → 2.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/dist/{apply-manager-B7BrL-ZW.mjs → apply-manager-SLCRLHN_.mjs} +1 -1
- package/dist/{apply-manager-B7BrL-ZW.mjs.map → apply-manager-SLCRLHN_.mjs.map} +1 -1
- package/dist/{astro-parser-BVoGjA6M.mjs → astro-parser-LNjEspnf.mjs} +3 -3
- package/dist/{astro-parser-BVoGjA6M.mjs.map → astro-parser-LNjEspnf.mjs.map} +1 -1
- package/dist/{branch-lifecycle-AwBJIheA.d.mts → branch-lifecycle-D4W0WIs4.d.mts} +1 -1
- package/dist/{branch-lifecycle-AwBJIheA.d.mts.map → branch-lifecycle-D4W0WIs4.d.mts.map} +1 -1
- package/dist/{compiler-BZXAN4Ir.mjs → compiler-CNzm2Y2I.mjs} +2 -2
- package/dist/{compiler-BZXAN4Ir.mjs.map → compiler-CNzm2Y2I.mjs.map} +1 -1
- package/dist/{compiler-sfc.cjs-tFlmtjrJ.mjs → compiler-sfc.cjs-y0B0L3MH.mjs} +2 -2
- package/dist/{compiler-sfc.cjs-tFlmtjrJ.mjs.map → compiler-sfc.cjs-y0B0L3MH.mjs.map} +1 -1
- package/dist/{content-manager-BgxF3dHu.d.mts → content-manager-DWo3G64y.d.mts} +2 -2
- package/dist/{content-manager-BgxF3dHu.d.mts.map → content-manager-DWo3G64y.d.mts.map} +1 -1
- package/dist/core/apply-manager.mjs +1 -1
- package/dist/core/config.d.mts +1 -1
- package/dist/core/content-manager.d.mts +1 -1
- package/dist/core/context.d.mts +1 -1
- package/dist/core/contracts/index.d.mts +1 -1
- package/dist/core/doctor.mjs +2 -2
- package/dist/core/graph-builder.mjs +2 -2
- package/dist/core/model-manager.d.mts +1 -1
- package/dist/core/ops/index.d.mts +2 -2
- package/dist/core/overlay-reader.d.mts +1 -1
- package/dist/core/overlay-reader.mjs +1 -1
- package/dist/core/scan-config.mjs +1 -1
- package/dist/core/scanner.mjs +3 -3
- package/dist/core/validator/index.d.mts +1 -1
- package/dist/core/validator/index.mjs +1 -1
- package/dist/{detect-wVSI9VuY.mjs → detect-CdDU4Ew_.mjs} +98 -5
- package/dist/detect-CdDU4Ew_.mjs.map +1 -0
- package/dist/{doctor-pw8EWRFR.mjs → doctor-BwJ_nmqS.mjs} +2 -2
- package/dist/{doctor-pw8EWRFR.mjs.map → doctor-BwJ_nmqS.mjs.map} +1 -1
- package/dist/errors-e0YdjooK.mjs +126 -0
- package/dist/errors-e0YdjooK.mjs.map +1 -0
- package/dist/git/branch-lifecycle.d.mts +1 -1
- package/dist/git/transaction.d.mts +1 -1
- package/dist/{graph-builder-CRUX_8mA.mjs → graph-builder-DK4Mh8Tn.mjs} +2 -2
- package/dist/{graph-builder-CRUX_8mA.mjs.map → graph-builder-DK4Mh8Tn.mjs.map} +1 -1
- package/dist/index.mjs +9 -9
- package/dist/{node-wC-z3NoZ.mjs → node-BxujauDw.mjs} +1 -1
- package/dist/{node-wC-z3NoZ.mjs.map → node-BxujauDw.mjs.map} +1 -1
- package/dist/{overlay-reader-BOb105gS.mjs → overlay-reader-DNaVsgiS.mjs} +1 -1
- package/dist/{overlay-reader-BOb105gS.mjs.map → overlay-reader-DNaVsgiS.mjs.map} +1 -1
- package/dist/paths-enT2coeX.mjs +27 -0
- package/dist/paths-enT2coeX.mjs.map +1 -0
- package/dist/providers/github/index.d.mts +1 -1
- package/dist/providers/github/index.mjs +2 -1
- package/dist/providers/github/index.mjs.map +1 -1
- package/dist/providers/gitlab/index.d.mts +1 -1
- package/dist/providers/gitlab/index.mjs +2 -1
- package/dist/providers/gitlab/index.mjs.map +1 -1
- package/dist/providers/local/index.d.mts +1 -1
- package/dist/{scan-config-BGUflS8t.mjs → scan-config-BlNLRCMx.mjs} +1 -1
- package/dist/{scan-config-BGUflS8t.mjs.map → scan-config-BlNLRCMx.mjs.map} +1 -1
- package/dist/{scanner-VOwrKLGC.mjs → scanner-CGWhmpDz.mjs} +6 -6
- package/dist/{scanner-VOwrKLGC.mjs.map → scanner-CGWhmpDz.mjs.map} +1 -1
- package/dist/server/http/index.d.mts +1 -1
- package/dist/server/http/index.mjs +9 -9
- package/dist/{server-RWxCofdl.mjs → server-CUZnuHQx.mjs} +20 -9
- package/dist/server-CUZnuHQx.mjs.map +1 -0
- package/dist/{server-vA1tM7DA.d.mts → server-DLauBiu2.d.mts} +2 -2
- package/dist/{server-vA1tM7DA.d.mts.map → server-DLauBiu2.d.mts.map} +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.mjs +9 -9
- package/dist/{source-map-generator-BIEiz3If.mjs → source-map-generator-Bvbu-kM5.mjs} +1 -1
- package/dist/{source-map-generator-BIEiz3If.mjs.map → source-map-generator-Bvbu-kM5.mjs.map} +1 -1
- package/dist/{svelte-parser-Bll-1SK0.mjs → svelte-parser-DaFK9iY0.mjs} +3 -3
- package/dist/{svelte-parser-Bll-1SK0.mjs.map → svelte-parser-DaFK9iY0.mjs.map} +1 -1
- package/dist/tsx-parser-C3XsIrwU.mjs +2 -0
- package/dist/{tsx-parser-B_aI_C2r.mjs → tsx-parser-md1N0Niu.mjs} +1 -1
- package/dist/{tsx-parser-B_aI_C2r.mjs.map → tsx-parser-md1N0Niu.mjs.map} +1 -1
- package/dist/util/detect.d.mts.map +1 -1
- package/dist/util/detect.mjs +1 -1
- package/dist/{validator-D5VncJ8M.mjs → validator-ChiYk6ap.mjs} +1 -1
- package/dist/{validator-D5VncJ8M.mjs.map → validator-ChiYk6ap.mjs.map} +1 -1
- package/dist/{vue-parser-COig4Y1a.mjs → vue-parser-CHxDohd8.mjs} +3 -3
- package/dist/{vue-parser-COig4Y1a.mjs.map → vue-parser-CHxDohd8.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/detect-wVSI9VuY.mjs.map +0 -1
- package/dist/paths-BU6E-oDs.mjs +0 -52
- package/dist/paths-BU6E-oDs.mjs.map +0 -1
- package/dist/server-RWxCofdl.mjs.map +0 -1
- package/dist/tsx-parser-ChduVwKJ.mjs +0 -2
- /package/dist/{index-DDX-qYNw.d.mts → index-w8QHThNS.d.mts} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
//#region src/providers/shared/errors.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error shapes for API-backed providers, and the mapping from those shapes
|
|
4
|
+
* into Contentrain's structured error envelope.
|
|
5
|
+
*
|
|
6
|
+
* Two common error shapes in the provider SDKs we use:
|
|
7
|
+
*
|
|
8
|
+
* - **Octokit** (`@octokit/rest`) — rejects with an `Error` that has a
|
|
9
|
+
* top-level `.status` number set to the HTTP status code.
|
|
10
|
+
* - **Gitbeaker** (`@gitbeaker/rest`) — rejects with a plain `Error` whose
|
|
11
|
+
* `.cause` includes `{ response: { status } }`.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* HTTP status behind a provider SDK rejection, or `undefined` when the error
|
|
15
|
+
* is not an HTTP failure (a local git error, a programming mistake, …).
|
|
16
|
+
*
|
|
17
|
+
* We deliberately do NOT fall back to substring matching on the error
|
|
18
|
+
* message — that leniency can silently mask other failures (forbidden repo,
|
|
19
|
+
* deleted project, rate limits) and produce the wrong answer. If either SDK
|
|
20
|
+
* ever stops populating the status field, the regression surfaces in tests
|
|
21
|
+
* rather than being papered over at the reader layer.
|
|
22
|
+
*/
|
|
23
|
+
function extractHttpStatus(error) {
|
|
24
|
+
if (typeof error !== "object" || error === null) return void 0;
|
|
25
|
+
const direct = error.status;
|
|
26
|
+
if (typeof direct === "number") return direct;
|
|
27
|
+
const nested = error.cause?.response?.status;
|
|
28
|
+
return typeof nested === "number" ? nested : void 0;
|
|
29
|
+
}
|
|
30
|
+
/** Unified "is this a 404?" helper for API-backed providers. */
|
|
31
|
+
function isNotFoundError(error) {
|
|
32
|
+
return extractHttpStatus(error) === 404;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Provider SDK messages are written for a human reading a terminal, not for an
|
|
36
|
+
* agent deciding what to do next. Octokit appends a documentation URL to most
|
|
37
|
+
* messages and embeds the raw JSON response body on validation failures.
|
|
38
|
+
*
|
|
39
|
+
* The vendor text still carries the only specifics we have ("Reference already
|
|
40
|
+
* exists", which field failed), so it is kept as a parenthetical detail rather
|
|
41
|
+
* than discarded — but the doc links are noise for an agent, and an embedded
|
|
42
|
+
* body can be arbitrarily long, so URLs are stripped and the result is capped.
|
|
43
|
+
*/
|
|
44
|
+
function sanitiseDetail(error) {
|
|
45
|
+
const collapsed = (error?.message ?? String(error)).replace(/\s*-?\s*https?:\/\/\S+/g, "").replace(/\s+/g, " ").trim();
|
|
46
|
+
return collapsed.length > 200 ? `${collapsed.slice(0, 197)}…` : collapsed;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* GitHub signals rate limiting with 403 plus an exhausted remaining-quota
|
|
50
|
+
* header (secondary limits use 403 too), and with 429 on some endpoints.
|
|
51
|
+
* Checking the header first keeps a genuine permission 403 from being
|
|
52
|
+
* reported as a rate limit.
|
|
53
|
+
*/
|
|
54
|
+
function isRateLimited(error, status) {
|
|
55
|
+
if (status === 429) return true;
|
|
56
|
+
if (status !== 403) return false;
|
|
57
|
+
const remaining = (error.response?.headers)?.["x-ratelimit-remaining"];
|
|
58
|
+
if (remaining !== void 0) return String(remaining) === "0";
|
|
59
|
+
return /\brate limit\b/i.test(error.message ?? "");
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Map a provider SDK rejection onto the same structured envelope the local git
|
|
63
|
+
* paths already produce (`code` + `agent_hint` + `developer_action`). Returns
|
|
64
|
+
* `undefined` for anything that is not a recognisable provider HTTP failure,
|
|
65
|
+
* so local git errors and ordinary exceptions pass through untouched.
|
|
66
|
+
*/
|
|
67
|
+
function mapProviderError(error) {
|
|
68
|
+
const status = extractHttpStatus(error);
|
|
69
|
+
if (status === void 0) return void 0;
|
|
70
|
+
const detail = sanitiseDetail(error);
|
|
71
|
+
const withDetail = (summary) => detail ? `${summary} (${detail})` : summary;
|
|
72
|
+
if (isRateLimited(error, status)) return {
|
|
73
|
+
error: withDetail("The git provider rejected the request because the API rate limit is exhausted."),
|
|
74
|
+
code: "PROVIDER_RATE_LIMITED",
|
|
75
|
+
agent_hint: "Do not retry immediately — the limit is time-based. Stop the current operation and report it to the developer.",
|
|
76
|
+
developer_action: "Wait for the rate-limit window to reset, or use a token with a higher quota."
|
|
77
|
+
};
|
|
78
|
+
switch (status) {
|
|
79
|
+
case 401: return {
|
|
80
|
+
error: withDetail("The git provider rejected the credentials."),
|
|
81
|
+
code: "PROVIDER_UNAUTHORIZED",
|
|
82
|
+
agent_hint: "The token is missing, malformed, or expired. Not retryable — ask the developer to fix the credentials.",
|
|
83
|
+
developer_action: "Check the provider token configured for this Contentrain server and reissue it if it has expired."
|
|
84
|
+
};
|
|
85
|
+
case 403: return {
|
|
86
|
+
error: withDetail("The git provider denied access to this resource."),
|
|
87
|
+
code: "PROVIDER_FORBIDDEN",
|
|
88
|
+
agent_hint: "The credentials are valid but lack permission for this operation. Not retryable — report which operation was refused.",
|
|
89
|
+
developer_action: "Grant the token write access to the repository, or check whether branch protection or SSO authorisation is blocking it."
|
|
90
|
+
};
|
|
91
|
+
case 404: return {
|
|
92
|
+
error: withDetail("The git provider could not find the requested resource."),
|
|
93
|
+
code: "PROVIDER_NOT_FOUND",
|
|
94
|
+
agent_hint: "The repository, branch, or path does not exist — or the token cannot see it, which also returns 404. Verify the target before retrying.",
|
|
95
|
+
developer_action: "Confirm the repository and branch names in the Contentrain config, and that the token can reach a private repository."
|
|
96
|
+
};
|
|
97
|
+
case 409: return {
|
|
98
|
+
error: withDetail("The git provider reported a conflict."),
|
|
99
|
+
code: "PROVIDER_CONFLICT",
|
|
100
|
+
agent_hint: "The branch moved between read and write. Re-read the current state and rebuild the change before retrying once.",
|
|
101
|
+
developer_action: "Usually a concurrent write to the same branch; retrying the operation normally resolves it."
|
|
102
|
+
};
|
|
103
|
+
case 422: return {
|
|
104
|
+
error: withDetail("The git provider rejected the request as invalid."),
|
|
105
|
+
code: "PROVIDER_VALIDATION_FAILED",
|
|
106
|
+
agent_hint: "Well-formed but semantically rejected (e.g. the ref already exists, or a name is invalid). Do not retry unchanged.",
|
|
107
|
+
developer_action: "Inspect the detail above — a stale branch left over from an earlier run is the common cause."
|
|
108
|
+
};
|
|
109
|
+
default:
|
|
110
|
+
if (status >= 500) return {
|
|
111
|
+
error: withDetail("The git provider is unavailable."),
|
|
112
|
+
code: "PROVIDER_UNAVAILABLE",
|
|
113
|
+
agent_hint: "A server-side failure on the provider. Safe to retry once after a short pause; if it persists, stop and report it.",
|
|
114
|
+
developer_action: "Check the provider status page."
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
error: withDetail(`The git provider returned HTTP ${status}.`),
|
|
118
|
+
code: "PROVIDER_REQUEST_FAILED",
|
|
119
|
+
agent_hint: "An unmapped provider failure. Report the status and detail to the developer rather than retrying blindly."
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { mapProviderError as n, isNotFoundError as t };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=errors-e0YdjooK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors-e0YdjooK.mjs","names":[],"sources":["../src/providers/shared/errors.ts"],"sourcesContent":["/**\n * Error shapes for API-backed providers, and the mapping from those shapes\n * into Contentrain's structured error envelope.\n *\n * Two common error shapes in the provider SDKs we use:\n *\n * - **Octokit** (`@octokit/rest`) — rejects with an `Error` that has a\n * top-level `.status` number set to the HTTP status code.\n * - **Gitbeaker** (`@gitbeaker/rest`) — rejects with a plain `Error` whose\n * `.cause` includes `{ response: { status } }`.\n */\n\n/**\n * HTTP status behind a provider SDK rejection, or `undefined` when the error\n * is not an HTTP failure (a local git error, a programming mistake, …).\n *\n * We deliberately do NOT fall back to substring matching on the error\n * message — that leniency can silently mask other failures (forbidden repo,\n * deleted project, rate limits) and produce the wrong answer. If either SDK\n * ever stops populating the status field, the regression surfaces in tests\n * rather than being papered over at the reader layer.\n */\nexport function extractHttpStatus(error: unknown): number | undefined {\n if (typeof error !== 'object' || error === null) return undefined\n const direct = (error as { status?: number }).status\n if (typeof direct === 'number') return direct\n const nested = (error as { cause?: { response?: { status?: number } } }).cause?.response?.status\n return typeof nested === 'number' ? nested : undefined\n}\n\n/** Unified \"is this a 404?\" helper for API-backed providers. */\nexport function isNotFoundError(error: unknown): boolean {\n return extractHttpStatus(error) === 404\n}\n\n/**\n * Provider SDK messages are written for a human reading a terminal, not for an\n * agent deciding what to do next. Octokit appends a documentation URL to most\n * messages and embeds the raw JSON response body on validation failures.\n *\n * The vendor text still carries the only specifics we have (\"Reference already\n * exists\", which field failed), so it is kept as a parenthetical detail rather\n * than discarded — but the doc links are noise for an agent, and an embedded\n * body can be arbitrarily long, so URLs are stripped and the result is capped.\n */\nfunction sanitiseDetail(error: unknown): string {\n const raw = (error as { message?: string } | undefined)?.message ?? String(error)\n const withoutUrls = raw.replace(/\\s*-?\\s*https?:\\/\\/\\S+/g, '')\n const collapsed = withoutUrls.replace(/\\s+/g, ' ').trim()\n return collapsed.length > 200 ? `${collapsed.slice(0, 197)}…` : collapsed\n}\n\n/**\n * GitHub signals rate limiting with 403 plus an exhausted remaining-quota\n * header (secondary limits use 403 too), and with 429 on some endpoints.\n * Checking the header first keeps a genuine permission 403 from being\n * reported as a rate limit.\n */\nfunction isRateLimited(error: unknown, status: number): boolean {\n if (status === 429) return true\n if (status !== 403) return false\n const headers = (error as { response?: { headers?: Record<string, unknown> } }).response?.headers\n const remaining = headers?.['x-ratelimit-remaining']\n if (remaining !== undefined) return String(remaining) === '0'\n return /\\brate limit\\b/i.test((error as { message?: string }).message ?? '')\n}\n\nexport interface ProviderErrorInfo {\n error: string\n code: string\n agent_hint: string\n developer_action?: string\n}\n\n/**\n * Map a provider SDK rejection onto the same structured envelope the local git\n * paths already produce (`code` + `agent_hint` + `developer_action`). Returns\n * `undefined` for anything that is not a recognisable provider HTTP failure,\n * so local git errors and ordinary exceptions pass through untouched.\n */\nexport function mapProviderError(error: unknown): ProviderErrorInfo | undefined {\n const status = extractHttpStatus(error)\n if (status === undefined) return undefined\n\n const detail = sanitiseDetail(error)\n const withDetail = (summary: string): string => (detail ? `${summary} (${detail})` : summary)\n\n if (isRateLimited(error, status)) {\n return {\n error: withDetail('The git provider rejected the request because the API rate limit is exhausted.'),\n code: 'PROVIDER_RATE_LIMITED',\n agent_hint: 'Do not retry immediately — the limit is time-based. Stop the current operation and report it to the developer.',\n developer_action: 'Wait for the rate-limit window to reset, or use a token with a higher quota.',\n }\n }\n\n switch (status) {\n case 401:\n return {\n error: withDetail('The git provider rejected the credentials.'),\n code: 'PROVIDER_UNAUTHORIZED',\n agent_hint: 'The token is missing, malformed, or expired. Not retryable — ask the developer to fix the credentials.',\n developer_action: 'Check the provider token configured for this Contentrain server and reissue it if it has expired.',\n }\n case 403:\n return {\n error: withDetail('The git provider denied access to this resource.'),\n code: 'PROVIDER_FORBIDDEN',\n agent_hint: 'The credentials are valid but lack permission for this operation. Not retryable — report which operation was refused.',\n developer_action: 'Grant the token write access to the repository, or check whether branch protection or SSO authorisation is blocking it.',\n }\n case 404:\n return {\n error: withDetail('The git provider could not find the requested resource.'),\n code: 'PROVIDER_NOT_FOUND',\n agent_hint: 'The repository, branch, or path does not exist — or the token cannot see it, which also returns 404. Verify the target before retrying.',\n developer_action: 'Confirm the repository and branch names in the Contentrain config, and that the token can reach a private repository.',\n }\n case 409:\n return {\n error: withDetail('The git provider reported a conflict.'),\n code: 'PROVIDER_CONFLICT',\n agent_hint: 'The branch moved between read and write. Re-read the current state and rebuild the change before retrying once.',\n developer_action: 'Usually a concurrent write to the same branch; retrying the operation normally resolves it.',\n }\n case 422:\n return {\n error: withDetail('The git provider rejected the request as invalid.'),\n code: 'PROVIDER_VALIDATION_FAILED',\n agent_hint: 'Well-formed but semantically rejected (e.g. the ref already exists, or a name is invalid). Do not retry unchanged.',\n developer_action: 'Inspect the detail above — a stale branch left over from an earlier run is the common cause.',\n }\n default:\n if (status >= 500) {\n return {\n error: withDetail('The git provider is unavailable.'),\n code: 'PROVIDER_UNAVAILABLE',\n agent_hint: 'A server-side failure on the provider. Safe to retry once after a short pause; if it persists, stop and report it.',\n developer_action: 'Check the provider status page.',\n }\n }\n return {\n error: withDetail(`The git provider returned HTTP ${status}.`),\n code: 'PROVIDER_REQUEST_FAILED',\n agent_hint: 'An unmapped provider failure. Report the status and detail to the developer rather than retrying blindly.',\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAgB,kBAAkB,OAAoC;AACpE,KAAI,OAAO,UAAU,YAAY,UAAU,KAAM,QAAO,KAAA;CACxD,MAAM,SAAU,MAA8B;AAC9C,KAAI,OAAO,WAAW,SAAU,QAAO;CACvC,MAAM,SAAU,MAAyD,OAAO,UAAU;AAC1F,QAAO,OAAO,WAAW,WAAW,SAAS,KAAA;;;AAI/C,SAAgB,gBAAgB,OAAyB;AACvD,QAAO,kBAAkB,MAAM,KAAK;;;;;;;;;;;;AAatC,SAAS,eAAe,OAAwB;CAG9C,MAAM,aAFO,OAA4C,WAAW,OAAO,MAAM,EACzD,QAAQ,2BAA2B,GAAG,CAChC,QAAQ,QAAQ,IAAI,CAAC,MAAM;AACzD,QAAO,UAAU,SAAS,MAAM,GAAG,UAAU,MAAM,GAAG,IAAI,CAAC,KAAK;;;;;;;;AASlE,SAAS,cAAc,OAAgB,QAAyB;AAC9D,KAAI,WAAW,IAAK,QAAO;AAC3B,KAAI,WAAW,IAAK,QAAO;CAE3B,MAAM,aADW,MAA+D,UAAU,WAC9D;AAC5B,KAAI,cAAc,KAAA,EAAW,QAAO,OAAO,UAAU,KAAK;AAC1D,QAAO,kBAAkB,KAAM,MAA+B,WAAW,GAAG;;;;;;;;AAgB9E,SAAgB,iBAAiB,OAA+C;CAC9E,MAAM,SAAS,kBAAkB,MAAM;AACvC,KAAI,WAAW,KAAA,EAAW,QAAO,KAAA;CAEjC,MAAM,SAAS,eAAe,MAAM;CACpC,MAAM,cAAc,YAA6B,SAAS,GAAG,QAAQ,IAAI,OAAO,KAAK;AAErF,KAAI,cAAc,OAAO,OAAO,CAC9B,QAAO;EACL,OAAO,WAAW,iFAAiF;EACnG,MAAM;EACN,YAAY;EACZ,kBAAkB;EACnB;AAGH,SAAQ,QAAR;EACE,KAAK,IACH,QAAO;GACL,OAAO,WAAW,6CAA6C;GAC/D,MAAM;GACN,YAAY;GACZ,kBAAkB;GACnB;EACH,KAAK,IACH,QAAO;GACL,OAAO,WAAW,mDAAmD;GACrE,MAAM;GACN,YAAY;GACZ,kBAAkB;GACnB;EACH,KAAK,IACH,QAAO;GACL,OAAO,WAAW,0DAA0D;GAC5E,MAAM;GACN,YAAY;GACZ,kBAAkB;GACnB;EACH,KAAK,IACH,QAAO;GACL,OAAO,WAAW,wCAAwC;GAC1D,MAAM;GACN,YAAY;GACZ,kBAAkB;GACnB;EACH,KAAK,IACH,QAAO;GACL,OAAO,WAAW,oDAAoD;GACtE,MAAM;GACN,YAAY;GACZ,kBAAkB;GACnB;EACH;AACE,OAAI,UAAU,IACZ,QAAO;IACL,OAAO,WAAW,mCAAmC;IACrD,MAAM;IACN,YAAY;IACZ,kBAAkB;IACnB;AAEH,UAAO;IACL,OAAO,WAAW,kCAAkC,OAAO,GAAG;IAC9D,MAAM;IACN,YAAY;IACb"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RemoteDeleteResult, c as checkBranchHealth, d as deleteRemoteBranch, f as isRefMerged, i as RemoteBranchList, l as classifyMergedBranches, m as pruneMergedRemoteBranches, n as BranchHealthCheck, o as RemotePruneResult, p as listRemoteCrBranches, r as CleanupResult, s as branchDiff, t as BranchDiffResult, u as cleanupMergedBranches } from "../branch-lifecycle-
|
|
1
|
+
import { a as RemoteDeleteResult, c as checkBranchHealth, d as deleteRemoteBranch, f as isRefMerged, i as RemoteBranchList, l as classifyMergedBranches, m as pruneMergedRemoteBranches, n as BranchHealthCheck, o as RemotePruneResult, p as listRemoteCrBranches, r as CleanupResult, s as branchDiff, t as BranchDiffResult, u as cleanupMergedBranches } from "../branch-lifecycle-D4W0WIs4.mjs";
|
|
2
2
|
export { BranchDiffResult, BranchHealthCheck, CleanupResult, RemoteBranchList, RemoteDeleteResult, RemotePruneResult, branchDiff, checkBranchHealth, classifyMergedBranches, cleanupMergedBranches, deleteRemoteBranch, isRefMerged, listRemoteCrBranches, pruneMergedRemoteBranches };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as readText, r as pathExists } from "./fs-DLbVB-Ek.mjs";
|
|
2
|
-
import { a as classifyFile, i as autoDetectSourceDirs, n as SCAN_EXTENSIONS, o as discoverFiles } from "./scan-config-
|
|
2
|
+
import { a as classifyFile, i as autoDetectSourceDirs, n as SCAN_EXTENSIONS, o as discoverFiles } from "./scan-config-BlNLRCMx.mjs";
|
|
3
3
|
import { dirname, extname, join, relative } from "node:path";
|
|
4
4
|
//#region src/core/graph-builder.ts
|
|
5
5
|
const MAX_ORPHANS = 10;
|
|
@@ -159,4 +159,4 @@ async function buildGraph(projectRoot, options) {
|
|
|
159
159
|
//#endregion
|
|
160
160
|
export { buildGraph as t };
|
|
161
161
|
|
|
162
|
-
//# sourceMappingURL=graph-builder-
|
|
162
|
+
//# sourceMappingURL=graph-builder-DK4Mh8Tn.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph-builder-CRUX_8mA.mjs","names":[],"sources":["../src/core/graph-builder.ts"],"sourcesContent":["import type { FileCategory, GraphNode, ProjectGraph } from '@contentrain/types'\nimport { join, relative, dirname, extname } from 'node:path'\nimport { readText, pathExists } from '../util/fs.js'\nimport {\n SCAN_EXTENSIONS,\n classifyFile,\n autoDetectSourceDirs,\n discoverFiles,\n} from './scan-config.js'\n\nexport interface BuildGraphOptions {\n paths?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst MAX_ORPHANS = 10\n\n// ---------------------------------------------------------------------------\n// Import extraction\n// ---------------------------------------------------------------------------\n\nconst IMPORT_RE = /(?:import|export)\\s+.*?from\\s+['\"]([^'\"]+)['\"]|(?:import|require)\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction extractImportPaths(content: string): string[] {\n const paths: string[] = []\n let m: RegExpExecArray | null\n // Reset lastIndex before use since we reuse the regex\n IMPORT_RE.lastIndex = 0\n while ((m = IMPORT_RE.exec(content)) !== null) {\n const p = m[1] ?? m[2]\n if (p && isLocalImport(p)) {\n paths.push(p)\n }\n }\n return paths\n}\n\nfunction isLocalImport(p: string): boolean {\n return p.startsWith('.') || p.startsWith('/')\n}\n\n// ---------------------------------------------------------------------------\n// Component name extraction from imports\n// ---------------------------------------------------------------------------\n\nconst NAMED_IMPORT_RE = /import\\s+(?:type\\s+)?(?:(\\w+)(?:\\s*,\\s*)?)?(?:\\{([^}]*)\\})?\\s+from\\s+['\"][^'\"]+['\"]/g\nconst DEFAULT_IMPORT_RE = /import\\s+(?:type\\s+)?(\\w+)\\s+from\\s+['\"][^'\"]+['\"]/g\n\nfunction isPascalCase(name: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*$/.test(name)\n}\n\nfunction extractComponentNames(content: string): string[] {\n const names = new Set<string>()\n\n // Default imports: `import Button from '...'`\n DEFAULT_IMPORT_RE.lastIndex = 0\n let m: RegExpExecArray | null\n while ((m = DEFAULT_IMPORT_RE.exec(content)) !== null) {\n const name = m[1]\n if (name && isPascalCase(name)) {\n names.add(name)\n }\n }\n\n // Named imports: `import { Button, useHook } from '...'`\n NAMED_IMPORT_RE.lastIndex = 0\n while ((m = NAMED_IMPORT_RE.exec(content)) !== null) {\n // Default part before destructuring\n const defaultName = m[1]\n if (defaultName && isPascalCase(defaultName)) {\n names.add(defaultName)\n }\n // Destructured names\n const namedPart = m[2]\n if (namedPart) {\n for (const segment of namedPart.split(',')) {\n // Handle `Foo as Bar` — take the local name (Bar)\n const parts = segment.trim().split(/\\s+as\\s+/)\n const localName = (parts[1] ?? parts[0])?.trim()\n if (localName && isPascalCase(localName)) {\n names.add(localName)\n }\n }\n }\n }\n\n return [...names]\n}\n\n// ---------------------------------------------------------------------------\n// String counting (estimate)\n// ---------------------------------------------------------------------------\n\nconst STRING_SINGLE_RE = /'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/g\nconst STRING_DOUBLE_RE = /\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"/g\nconst STRING_TEMPLATE_RE = /`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`/g\n\nfunction countStrings(content: string): number {\n // Strip import/export/require lines first so their string literals don't count\n const stripped = content.replace(/^(?:import|export)\\s+.*$/gm, '')\n .replace(/\\brequire\\s*\\([^)]*\\)/g, '')\n\n const singles = stripped.match(STRING_SINGLE_RE)?.length ?? 0\n const doubles = stripped.match(STRING_DOUBLE_RE)?.length ?? 0\n const templates = stripped.match(STRING_TEMPLATE_RE)?.length ?? 0\n\n return singles + doubles + templates\n}\n\n// ---------------------------------------------------------------------------\n// Import path resolution\n// ---------------------------------------------------------------------------\n\nconst RESOLVE_EXTENSIONS = [...SCAN_EXTENSIONS]\nconst RESOLVE_INDEX_FILES = ['index.ts', 'index.tsx', 'index.js']\n\nasync function resolveImportPath(\n importPath: string,\n importerDir: string,\n projectRoot: string,\n): Promise<string | null> {\n const base = importPath.startsWith('/')\n ? join(projectRoot, importPath)\n : join(importerDir, importPath)\n\n // If it already has an extension, check directly\n if (extname(base)) {\n if (await pathExists(base)) {\n return base\n }\n return null\n }\n\n // Try adding extensions\n for (const ext of RESOLVE_EXTENSIONS) {\n const candidate = base + ext\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n // Try index files inside directory\n for (const idx of RESOLVE_INDEX_FILES) {\n const candidate = join(base, idx)\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Main\n// ---------------------------------------------------------------------------\n\ninterface FileInfo {\n relPath: string\n imports: string[]\n components: string[]\n strings: number\n category: FileCategory\n}\n\nexport async function buildGraph(\n projectRoot: string,\n options?: BuildGraphOptions,\n): Promise<ProjectGraph> {\n const scanDirs = options?.paths ?? await autoDetectSourceDirs(projectRoot)\n\n // ---- File discovery (shared with scanner) ----\n const filePaths = await discoverFiles(projectRoot, {\n paths: scanDirs,\n include: options?.include,\n exclude: options?.exclude,\n })\n\n // ---- Pass 1: Parse each file ----\n const fileMap = new Map<string, FileInfo>()\n\n const parsePromises = filePaths.map(async (relPath) => {\n const absPath = join(projectRoot, relPath)\n const content = await readText(absPath)\n if (content === null) return\n\n const imports = extractImportPaths(content)\n const components = extractComponentNames(content)\n const strings = countStrings(content)\n const category = classifyFile(relPath)\n\n fileMap.set(relPath, { relPath, imports, components, strings, category })\n })\n\n await Promise.all(parsePromises)\n\n // ---- Pass 2: Resolve imports and build reverse lookup ----\n const usedByMap = new Map<string, Set<string>>()\n\n // Initialize usedBy sets\n for (const relPath of fileMap.keys()) {\n usedByMap.set(relPath, new Set())\n }\n\n const resolvePromises: Promise<void>[] = []\n\n for (const [relPath, info] of fileMap) {\n const importerAbsDir = dirname(join(projectRoot, relPath))\n\n for (const rawImport of info.imports) {\n resolvePromises.push(\n resolveImportPath(rawImport, importerAbsDir, projectRoot).then((resolved) => {\n if (!resolved) return\n const resolvedRel = relative(projectRoot, resolved)\n const targetSet = usedByMap.get(resolvedRel)\n if (targetSet) {\n targetSet.add(relPath)\n }\n }),\n )\n }\n }\n\n await Promise.all(resolvePromises)\n\n // ---- Build nodes ----\n const pages: GraphNode[] = []\n const components: GraphNode[] = []\n const layouts: GraphNode[] = []\n const orphanCandidates: string[] = []\n\n let totalStrings = 0\n\n for (const [relPath, info] of fileMap) {\n const usedBy = [...(usedByMap.get(relPath) ?? [])].toSorted((a, b) => a.localeCompare(b))\n totalStrings += info.strings\n\n // Filter out nodes with 0 strings — not relevant for content extraction\n if (info.strings === 0 && info.category !== 'other') continue\n\n const node: GraphNode = {\n file: relPath,\n category: info.category,\n imports: info.imports,\n used_by: usedBy,\n strings: info.strings,\n }\n\n // Only attach components list for pages\n if (info.category === 'page' && info.components.length > 0) {\n node.components = info.components\n }\n\n switch (info.category) {\n case 'page':\n pages.push(node)\n break\n case 'component':\n components.push(node)\n break\n case 'layout':\n layouts.push(node)\n break\n default:\n // Orphan = \"other\" category with no inbound references and no outbound imports\n if (usedBy.length === 0 && info.imports.length === 0) {\n orphanCandidates.push(relPath)\n }\n break\n }\n }\n\n return {\n pages: pages.toSorted((a, b) => a.file.localeCompare(b.file)),\n components: components.toSorted((a, b) => a.file.localeCompare(b.file)),\n layouts: layouts.toSorted((a, b) => a.file.localeCompare(b.file)),\n orphan_files: orphanCandidates.toSorted((a, b) => a.localeCompare(b)).slice(0, MAX_ORPHANS),\n stats: {\n total_files: fileMap.size,\n total_components: components.length,\n total_pages: pages.length,\n total_strings_estimate: totalStrings,\n },\n }\n}\n"],"mappings":";;;;AAgBA,MAAM,cAAc;AAMpB,MAAM,YAAY;AAElB,SAAS,mBAAmB,SAA2B;CACrD,MAAM,QAAkB,EAAE;CAC1B,IAAI;AAEJ,WAAU,YAAY;AACtB,SAAQ,IAAI,UAAU,KAAK,QAAQ,MAAM,MAAM;EAC7C,MAAM,IAAI,EAAE,MAAM,EAAE;AACpB,MAAI,KAAK,cAAc,EAAE,CACvB,OAAM,KAAK,EAAE;;AAGjB,QAAO;;AAGT,SAAS,cAAc,GAAoB;AACzC,QAAO,EAAE,WAAW,IAAI,IAAI,EAAE,WAAW,IAAI;;AAO/C,MAAM,kBAAkB;AACxB,MAAM,oBAAoB;AAE1B,SAAS,aAAa,MAAuB;AAC3C,QAAO,sBAAsB,KAAK,KAAK;;AAGzC,SAAS,sBAAsB,SAA2B;CACxD,MAAM,wBAAQ,IAAI,KAAa;AAG/B,mBAAkB,YAAY;CAC9B,IAAI;AACJ,SAAQ,IAAI,kBAAkB,KAAK,QAAQ,MAAM,MAAM;EACrD,MAAM,OAAO,EAAE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{ FileCategory, GraphNode, ProjectGraph } from '@contentrain/types'\nimport { join, relative, dirname, extname } from 'node:path'\nimport { readText, pathExists } from '../util/fs.js'\nimport {\n SCAN_EXTENSIONS,\n classifyFile,\n autoDetectSourceDirs,\n discoverFiles,\n} from './scan-config.js'\n\nexport interface BuildGraphOptions {\n paths?: string[]\n include?: string[]\n exclude?: string[]\n}\n\nconst MAX_ORPHANS = 10\n\n// ---------------------------------------------------------------------------\n// Import extraction\n// ---------------------------------------------------------------------------\n\nconst IMPORT_RE = /(?:import|export)\\s+.*?from\\s+['\"]([^'\"]+)['\"]|(?:import|require)\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*\\)/g\n\nfunction extractImportPaths(content: string): string[] {\n const paths: string[] = []\n let m: RegExpExecArray | null\n // Reset lastIndex before use since we reuse the regex\n IMPORT_RE.lastIndex = 0\n while ((m = IMPORT_RE.exec(content)) !== null) {\n const p = m[1] ?? m[2]\n if (p && isLocalImport(p)) {\n paths.push(p)\n }\n }\n return paths\n}\n\nfunction isLocalImport(p: string): boolean {\n return p.startsWith('.') || p.startsWith('/')\n}\n\n// ---------------------------------------------------------------------------\n// Component name extraction from imports\n// ---------------------------------------------------------------------------\n\nconst NAMED_IMPORT_RE = /import\\s+(?:type\\s+)?(?:(\\w+)(?:\\s*,\\s*)?)?(?:\\{([^}]*)\\})?\\s+from\\s+['\"][^'\"]+['\"]/g\nconst DEFAULT_IMPORT_RE = /import\\s+(?:type\\s+)?(\\w+)\\s+from\\s+['\"][^'\"]+['\"]/g\n\nfunction isPascalCase(name: string): boolean {\n return /^[A-Z][a-zA-Z0-9]*$/.test(name)\n}\n\nfunction extractComponentNames(content: string): string[] {\n const names = new Set<string>()\n\n // Default imports: `import Button from '...'`\n DEFAULT_IMPORT_RE.lastIndex = 0\n let m: RegExpExecArray | null\n while ((m = DEFAULT_IMPORT_RE.exec(content)) !== null) {\n const name = m[1]\n if (name && isPascalCase(name)) {\n names.add(name)\n }\n }\n\n // Named imports: `import { Button, useHook } from '...'`\n NAMED_IMPORT_RE.lastIndex = 0\n while ((m = NAMED_IMPORT_RE.exec(content)) !== null) {\n // Default part before destructuring\n const defaultName = m[1]\n if (defaultName && isPascalCase(defaultName)) {\n names.add(defaultName)\n }\n // Destructured names\n const namedPart = m[2]\n if (namedPart) {\n for (const segment of namedPart.split(',')) {\n // Handle `Foo as Bar` — take the local name (Bar)\n const parts = segment.trim().split(/\\s+as\\s+/)\n const localName = (parts[1] ?? parts[0])?.trim()\n if (localName && isPascalCase(localName)) {\n names.add(localName)\n }\n }\n }\n }\n\n return [...names]\n}\n\n// ---------------------------------------------------------------------------\n// String counting (estimate)\n// ---------------------------------------------------------------------------\n\nconst STRING_SINGLE_RE = /'[^'\\\\]*(?:\\\\.[^'\\\\]*)*'/g\nconst STRING_DOUBLE_RE = /\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"/g\nconst STRING_TEMPLATE_RE = /`[^`\\\\]*(?:\\\\.[^`\\\\]*)*`/g\n\nfunction countStrings(content: string): number {\n // Strip import/export/require lines first so their string literals don't count\n const stripped = content.replace(/^(?:import|export)\\s+.*$/gm, '')\n .replace(/\\brequire\\s*\\([^)]*\\)/g, '')\n\n const singles = stripped.match(STRING_SINGLE_RE)?.length ?? 0\n const doubles = stripped.match(STRING_DOUBLE_RE)?.length ?? 0\n const templates = stripped.match(STRING_TEMPLATE_RE)?.length ?? 0\n\n return singles + doubles + templates\n}\n\n// ---------------------------------------------------------------------------\n// Import path resolution\n// ---------------------------------------------------------------------------\n\nconst RESOLVE_EXTENSIONS = [...SCAN_EXTENSIONS]\nconst RESOLVE_INDEX_FILES = ['index.ts', 'index.tsx', 'index.js']\n\nasync function resolveImportPath(\n importPath: string,\n importerDir: string,\n projectRoot: string,\n): Promise<string | null> {\n const base = importPath.startsWith('/')\n ? join(projectRoot, importPath)\n : join(importerDir, importPath)\n\n // If it already has an extension, check directly\n if (extname(base)) {\n if (await pathExists(base)) {\n return base\n }\n return null\n }\n\n // Try adding extensions\n for (const ext of RESOLVE_EXTENSIONS) {\n const candidate = base + ext\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n // Try index files inside directory\n for (const idx of RESOLVE_INDEX_FILES) {\n const candidate = join(base, idx)\n if (await pathExists(candidate)) {\n return candidate\n }\n }\n\n return null\n}\n\n// ---------------------------------------------------------------------------\n// Main\n// ---------------------------------------------------------------------------\n\ninterface FileInfo {\n relPath: string\n imports: string[]\n components: string[]\n strings: number\n category: FileCategory\n}\n\nexport async function buildGraph(\n projectRoot: string,\n options?: BuildGraphOptions,\n): Promise<ProjectGraph> {\n const scanDirs = options?.paths ?? await autoDetectSourceDirs(projectRoot)\n\n // ---- File discovery (shared with scanner) ----\n const filePaths = await discoverFiles(projectRoot, {\n paths: scanDirs,\n include: options?.include,\n exclude: options?.exclude,\n })\n\n // ---- Pass 1: Parse each file ----\n const fileMap = new Map<string, FileInfo>()\n\n const parsePromises = filePaths.map(async (relPath) => {\n const absPath = join(projectRoot, relPath)\n const content = await readText(absPath)\n if (content === null) return\n\n const imports = extractImportPaths(content)\n const components = extractComponentNames(content)\n const strings = countStrings(content)\n const category = classifyFile(relPath)\n\n fileMap.set(relPath, { relPath, imports, components, strings, category })\n })\n\n await Promise.all(parsePromises)\n\n // ---- Pass 2: Resolve imports and build reverse lookup ----\n const usedByMap = new Map<string, Set<string>>()\n\n // Initialize usedBy sets\n for (const relPath of fileMap.keys()) {\n usedByMap.set(relPath, new Set())\n }\n\n const resolvePromises: Promise<void>[] = []\n\n for (const [relPath, info] of fileMap) {\n const importerAbsDir = dirname(join(projectRoot, relPath))\n\n for (const rawImport of info.imports) {\n resolvePromises.push(\n resolveImportPath(rawImport, importerAbsDir, projectRoot).then((resolved) => {\n if (!resolved) return\n const resolvedRel = relative(projectRoot, resolved)\n const targetSet = usedByMap.get(resolvedRel)\n if (targetSet) {\n targetSet.add(relPath)\n }\n }),\n )\n }\n }\n\n await Promise.all(resolvePromises)\n\n // ---- Build nodes ----\n const pages: GraphNode[] = []\n const components: GraphNode[] = []\n const layouts: GraphNode[] = []\n const orphanCandidates: string[] = []\n\n let totalStrings = 0\n\n for (const [relPath, info] of fileMap) {\n const usedBy = [...(usedByMap.get(relPath) ?? [])].toSorted((a, b) => a.localeCompare(b))\n totalStrings += info.strings\n\n // Filter out nodes with 0 strings — not relevant for content extraction\n if (info.strings === 0 && info.category !== 'other') continue\n\n const node: GraphNode = {\n file: relPath,\n category: info.category,\n imports: info.imports,\n used_by: usedBy,\n strings: info.strings,\n }\n\n // Only attach components list for pages\n if (info.category === 'page' && info.components.length > 0) {\n node.components = info.components\n }\n\n switch (info.category) {\n case 'page':\n pages.push(node)\n break\n case 'component':\n components.push(node)\n break\n case 'layout':\n layouts.push(node)\n break\n default:\n // Orphan = \"other\" category with no inbound references and no outbound imports\n if (usedBy.length === 0 && info.imports.length === 0) {\n orphanCandidates.push(relPath)\n }\n break\n }\n }\n\n return {\n pages: pages.toSorted((a, b) => a.file.localeCompare(b.file)),\n components: components.toSorted((a, b) => a.file.localeCompare(b.file)),\n layouts: layouts.toSorted((a, b) => a.file.localeCompare(b.file)),\n orphan_files: orphanCandidates.toSorted((a, b) => a.localeCompare(b)).slice(0, MAX_ORPHANS),\n stats: {\n total_files: fileMap.size,\n total_components: components.length,\n total_pages: pages.length,\n total_strings_estimate: totalStrings,\n },\n }\n}\n"],"mappings":";;;;AAgBA,MAAM,cAAc;AAMpB,MAAM,YAAY;AAElB,SAAS,mBAAmB,SAA2B;CACrD,MAAM,QAAkB,EAAE;CAC1B,IAAI;AAEJ,WAAU,YAAY;AACtB,SAAQ,IAAI,UAAU,KAAK,QAAQ,MAAM,MAAM;EAC7C,MAAM,IAAI,EAAE,MAAM,EAAE;AACpB,MAAI,KAAK,cAAc,EAAE,CACvB,OAAM,KAAK,EAAE;;AAGjB,QAAO;;AAGT,SAAS,cAAc,GAAoB;AACzC,QAAO,EAAE,WAAW,IAAI,IAAI,EAAE,WAAW,IAAI;;AAO/C,MAAM,kBAAkB;AACx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GAAG,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,GAAG,YAAY;EAC3F,OAAO;GACL,aAAa,QAAQ;GACrB,kBAAkB,WAAW;GAC7B,aAAa,MAAM;GACnB,wBAAwB;GACzB;EACF"}
|
package/dist/index.mjs
CHANGED
|
@@ -11,16 +11,16 @@ import "./branch-lifecycle-BAfgSQBv.mjs";
|
|
|
11
11
|
import "./id-DV_T9Ic8.mjs";
|
|
12
12
|
import "./transaction-1SPznNt3.mjs";
|
|
13
13
|
import "./local-8dJ5NIWL.mjs";
|
|
14
|
-
import "./detect-
|
|
14
|
+
import "./detect-CdDU4Ew_.mjs";
|
|
15
15
|
import "./annotations-D3tlsF38.mjs";
|
|
16
|
-
import { n as createServer } from "./server-
|
|
17
|
-
import "./validator-
|
|
18
|
-
import "./scan-config-
|
|
19
|
-
import "./graph-builder-
|
|
20
|
-
import "./scanner-
|
|
21
|
-
import "./tsx-parser-
|
|
22
|
-
import "./apply-manager-
|
|
23
|
-
import "./doctor-
|
|
16
|
+
import { n as createServer } from "./server-CUZnuHQx.mjs";
|
|
17
|
+
import "./validator-ChiYk6ap.mjs";
|
|
18
|
+
import "./scan-config-BlNLRCMx.mjs";
|
|
19
|
+
import "./graph-builder-DK4Mh8Tn.mjs";
|
|
20
|
+
import "./scanner-CGWhmpDz.mjs";
|
|
21
|
+
import "./tsx-parser-md1N0Niu.mjs";
|
|
22
|
+
import "./apply-manager-SLCRLHN_.mjs";
|
|
23
|
+
import "./doctor-BwJ_nmqS.mjs";
|
|
24
24
|
import { resolve } from "node:path";
|
|
25
25
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
26
26
|
//#region src/index.ts
|
|
@@ -297,4 +297,4 @@ var w = async (t, s) => i().then((r) => r.transform(t, s)), l = async (t, s) =>
|
|
|
297
297
|
//#endregion
|
|
298
298
|
export { P as compile, b as convertToTSX, l as parse, g as teardown, w as transform };
|
|
299
299
|
|
|
300
|
-
//# sourceMappingURL=node-
|
|
300
|
+
//# sourceMappingURL=node-BxujauDw.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-wC-z3NoZ.mjs","names":["g","y","v","w","b","d","m","c","f"],"sources":["../../../node_modules/.pnpm/@astrojs+compiler@2.13.1/node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js","../../../node_modules/.pnpm/@astrojs+compiler@2.13.1/node_modules/@astrojs/compiler/dist/node/index.js"],"sourcesContent":["import g from\"crypto\";import _ from\"fs\";import{TextDecoder as b,TextEncoder as v}from\"util\";globalThis.fs||Object.defineProperty(globalThis,\"fs\",{value:_});globalThis.process||Object.defineProperties(globalThis,\"process\",{value:process});globalThis.crypto||Object.defineProperty(globalThis,\"crypto\",{value:g.webcrypto?g.webcrypto:{getRandomValues(m){return g.randomFillSync(m)}}});globalThis.performance||Object.defineProperty(globalThis,\"performance\",{value:{now(){let[m,o]=process.hrtime();return m*1e3+o/1e6}}});var y=new v(\"utf-8\"),w=new b(\"utf-8\");var d=class{constructor(){this.argv=[\"js\"],this.env={},this.exit=t=>{t!==0&&console.warn(\"exit code:\",t)},this._exitPromise=new Promise(t=>{this._resolveExitPromise=t}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let o=(t,e)=>{this.mem.setUint32(t+0,e,!0),this.mem.setUint32(t+4,Math.floor(e/4294967296),!0)},n=t=>{let e=this.mem.getUint32(t+0,!0),s=this.mem.getInt32(t+4,!0);return e+s*4294967296},r=t=>{let e=this.mem.getFloat64(t,!0);if(e===0)return;if(!isNaN(e))return e;let s=this.mem.getUint32(t,!0);return this._values[s]},l=(t,e)=>{if(typeof e==\"number\"&&e!==0){if(isNaN(e)){this.mem.setUint32(t+4,2146959360,!0),this.mem.setUint32(t,0,!0);return}this.mem.setFloat64(t,e,!0);return}if(e===void 0){this.mem.setFloat64(t,0,!0);return}let i=this._ids.get(e);i===void 0&&(i=this._idPool.pop(),i===void 0&&(i=this._values.length),this._values[i]=e,this._goRefCounts[i]=0,this._ids.set(e,i)),this._goRefCounts[i]++;let a=0;switch(typeof e){case\"object\":e!==null&&(a=1);break;case\"string\":a=2;break;case\"symbol\":a=3;break;case\"function\":a=4;break}this.mem.setUint32(t+4,2146959360|a,!0),this.mem.setUint32(t,i,!0)},c=t=>{let e=n(t+0),s=n(t+8);return new Uint8Array(this._inst.exports.mem.buffer,e,s)},f=t=>{let e=n(t+0),s=n(t+8),i=new Array(s);for(let a=0;a<s;a++)i[a]=r(e+a*8);return i},u=t=>{let e=n(t+0),s=n(t+8);return w.decode(new DataView(this._inst.exports.mem.buffer,e,s))},h=Date.now()-performance.now();this.importObject={gojs:{\"runtime.wasmExit\":t=>{t>>>=0;let e=this.mem.getInt32(t+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(e)},\"runtime.wasmWrite\":t=>{t>>>=0;let e=n(t+8),s=n(t+16),i=this.mem.getInt32(t+24,!0);_.writeSync(e,new Uint8Array(this._inst.exports.mem.buffer,s,i))},\"runtime.resetMemoryDataView\":t=>{t>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},\"runtime.nanotime1\":t=>{t>>>=0,o(t+8,(h+performance.now())*1e6)},\"runtime.walltime\":t=>{t>>>=0;let e=new Date().getTime();o(t+8,e/1e3),this.mem.setInt32(t+16,e%1e3*1e6,!0)},\"runtime.scheduleTimeoutEvent\":t=>{t>>>=0;let e=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(e,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(e);)console.warn(\"scheduleTimeoutEvent: missed timeout event\"),this._resume()},n(t+8)+1)),this.mem.setInt32(t+16,e,!0)},\"runtime.clearTimeoutEvent\":t=>{t>>>=0;let e=this.mem.getInt32(t+8,!0);clearTimeout(this._scheduledTimeouts.get(e)),this._scheduledTimeouts.delete(e)},\"runtime.getRandomData\":t=>{t>>>=0,globalThis.crypto.getRandomValues(c(t+8))},\"syscall/js.finalizeRef\":t=>{t>>>=0;let e=this.mem.getUint32(t+8,!0);if(this._goRefCounts[e]--,this._goRefCounts[e]===0){let s=this._values[e];this._values[e]=null,this._ids.delete(s),this._idPool.push(e)}},\"syscall/js.stringVal\":t=>{t>>>=0,l(t+24,u(t+8))},\"syscall/js.valueGet\":t=>{t>>>=0;let e=Reflect.get(r(t+8),u(t+16));t=this._inst.exports.getsp()>>>0,l(t+32,e)},\"syscall/js.valueSet\":t=>{t>>>=0,Reflect.set(r(t+8),u(t+16),r(t+32))},\"syscall/js.valueDelete\":t=>{t>>>=0,Reflect.deleteProperty(r(t+8),u(t+16))},\"syscall/js.valueIndex\":t=>{t>>>=0,l(t+24,Reflect.get(r(t+8),n(t+16)))},\"syscall/js.valueSetIndex\":t=>{t>>>=0,Reflect.set(r(t+8),n(t+16),r(t+24))},\"syscall/js.valueCall\":t=>{t>>>=0;try{let e=r(t+8),s=Reflect.get(e,u(t+16)),i=f(t+32),a=Reflect.apply(s,e,i);t=this._inst.exports.getsp()>>>0,l(t+56,a),this.mem.setUint8(t+64,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+56,e),this.mem.setUint8(t+64,0)}},\"syscall/js.valueInvoke\":t=>{t>>>=0;try{let e=r(t+8),s=f(t+16),i=Reflect.apply(e,void 0,s);t=this._inst.exports.getsp()>>>0,l(t+40,i),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+40,e),this.mem.setUint8(t+48,0)}},\"syscall/js.valueNew\":t=>{t>>>=0;try{let e=r(t+8),s=f(t+16),i=Reflect.construct(e,s);t=this._inst.exports.getsp()>>>0,l(t+40,i),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+40,e),this.mem.setUint8(t+48,0)}},\"syscall/js.valueLength\":t=>{t>>>=0,o(t+16,Number.parseInt(r(t+8).length))},\"syscall/js.valuePrepareString\":t=>{t>>>=0;let e=y.encode(String(r(t+8)));l(t+16,e),o(t+24,e.length)},\"syscall/js.valueLoadString\":t=>{t>>>=0;let e=r(t+8);c(t+16).set(e)},\"syscall/js.valueInstanceOf\":t=>{t>>>=0,this.mem.setUint8(t+24,r(t+8)instanceof r(t+16)?1:0)},\"syscall/js.copyBytesToGo\":t=>{t>>>=0;let e=c(t+8),s=r(t+32);if(!(s instanceof Uint8Array||s instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=s.subarray(0,e.length);e.set(i),o(t+40,i.length),this.mem.setUint8(t+48,1)},\"syscall/js.copyBytesToJS\":t=>{t>>>=0;let e=r(t+8),s=c(t+16);if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=s.subarray(0,e.length);e.set(i),o(t+40,i.length),this.mem.setUint8(t+48,1)},debug:t=>{console.log(t)}}}}async run(o){if(!(o instanceof WebAssembly.Instance))throw new Error(\"Go.run: WebAssembly.Instance expected\");this._inst=o,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[Number.NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(Number.POSITIVE_INFINITY),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096,r=h=>{let t=n,e=y.encode(`${h}\\0`);return new Uint8Array(this.mem.buffer,n,e.length).set(e),n+=e.length,n%8!==0&&(n+=8-n%8),t},l=this.argv.length,c=[];this.argv.forEach(h=>{c.push(r(h))}),c.push(0),Object.keys(this.env).sort().forEach(h=>{c.push(r(`${h}=${this.env[h]}`))}),c.push(0);let u=n;c.forEach(h=>{this.mem.setUint32(n,h,!0),this.mem.setUint32(n+4,0,!0),n+=8}),this._inst.exports.run(l,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error(\"Go program has already exited\");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(o){let n=this;return function(){let r={id:o,this:this,args:arguments};return n._pendingEvent=r,n._resume(),r.result}}};export{d as a};\n","import{a as c}from\"../chunk-W5DTLHV4.js\";import{promises as m}from\"fs\";import{fileURLToPath as f}from\"url\";var w=async(t,s)=>i().then(r=>r.transform(t,s)),l=async(t,s)=>i().then(r=>r.parse(t,s)),b=async(t,s)=>i().then(r=>r.convertToTSX(t,s)),P=async t=>{let{default:s}=await import(`data:text/javascript;charset=utf-8;base64,${Buffer.from(t).toString(\"base64\")}`);return s},n,g=()=>{n=void 0,globalThis[\"@astrojs/compiler\"]=void 0},i=()=>(n||(n=d().catch(t=>{throw n=void 0,t})),n),y=async(t,s)=>{let r;return r=await(async()=>{let o=await m.readFile(t).then(e=>e.buffer);return WebAssembly.instantiate(new Uint8Array(o),s)})(),r},d=async()=>{let t=new c,s=await y(f(new URL(\"../astro.wasm\",import.meta.url)),t.importObject);t.run(s.instance);let r=globalThis[\"@astrojs/compiler\"];return{transform:(a,o)=>new Promise(e=>{try{e(r.transform(a,o||{}))}catch(p){throw n=void 0,p}}),parse:(a,o)=>new Promise(e=>e(r.parse(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,ast:JSON.parse(e.ast)})),convertToTSX:(a,o)=>new Promise(e=>e(r.convertToTSX(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,map:JSON.parse(e.map)}))}};export{P as compile,b as convertToTSX,l as parse,g as teardown,w as transform};\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;AAA4F,WAAW,MAAI,OAAO,eAAe,YAAW,MAAK,EAAC,OAAM,GAAE,CAAC;AAAC,WAAW,WAAS,OAAO,iBAAiB,YAAW,WAAU,EAAC,OAAM,SAAQ,CAAC;AAAC,WAAW,UAAQ,OAAO,eAAe,YAAW,UAAS,EAAC,OAAMA,IAAE,YAAUA,IAAE,YAAU,EAAC,gBAAgB,GAAE;AAAC,QAAOA,IAAE,eAAe,EAAE;GAAE,EAAC,CAAC;AAAC,WAAW,eAAa,OAAO,eAAe,YAAW,eAAc,E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AE,IAAIC,KAAC,EAAC,IAAE,MAAM,EAAEC,cAAE,IAAI,IAAI,iBAAgB,OAAO,KAAK,IAAI,CAAC,EAAC,EAAE,aAAa;AAAC,GAAE,IAAI,EAAE,SAAS;CAAC,IAAI,IAAE,WAAW;AAAqB,QAAM;EAAC,YAAW,GAAE,MAAI,IAAI,SAAQ,MAAG;AAAC,OAAG;AAAC,MAAE,EAAE,UAAU,GAAE,KAAG,EAAE,CAAC,CAAC;YAAO,GAAE;AAAC,UAAM,IAAE,KAAK,GAAE;;IAAI;EAAC,QAAO,GAAE,MAAI,IAAI,SAAQ,MAAG,EAAE,EAAE,MAAM,GAAE,KAAG,EAAE,CAAC,CAAC,CAAC,CAAC,OAAM,MAAG;AAAC,SAAM,IAAE,KAAK,GAAE;IAAG,CAAC,MAAK,OAAI;GAAC,GAAG;GAAE,KAAI,KAAK,MAAM,EAAE,IAAI;GAAC,EAAE;EAAC,eAAc,GAAE,MAAI,IAAI,SAAQ,MAAG,EAAE,EAAE,aAAa,GAAE,KAAG,EAAE,CAAC,CAAC,CAAC,CAAC,OAAM,MAAG;AAAC,SAAM,IAAE,KAAK,GAAE;IAAG,CAAC,MAAK,OAAI;GAAC,GAAG;GAAE,KAAI,KAAK,MAAM,EAAE,IAAI;GAAC,EAAE;EAAC"}
|
|
1
|
+
{"version":3,"file":"node-BxujauDw.mjs","names":["g","y","v","w","b","d","m","c","f"],"sources":["../../../node_modules/.pnpm/@astrojs+compiler@2.13.1/node_modules/@astrojs/compiler/dist/chunk-W5DTLHV4.js","../../../node_modules/.pnpm/@astrojs+compiler@2.13.1/node_modules/@astrojs/compiler/dist/node/index.js"],"sourcesContent":["import g from\"crypto\";import _ from\"fs\";import{TextDecoder as b,TextEncoder as v}from\"util\";globalThis.fs||Object.defineProperty(globalThis,\"fs\",{value:_});globalThis.process||Object.defineProperties(globalThis,\"process\",{value:process});globalThis.crypto||Object.defineProperty(globalThis,\"crypto\",{value:g.webcrypto?g.webcrypto:{getRandomValues(m){return g.randomFillSync(m)}}});globalThis.performance||Object.defineProperty(globalThis,\"performance\",{value:{now(){let[m,o]=process.hrtime();return m*1e3+o/1e6}}});var y=new v(\"utf-8\"),w=new b(\"utf-8\");var d=class{constructor(){this.argv=[\"js\"],this.env={},this.exit=t=>{t!==0&&console.warn(\"exit code:\",t)},this._exitPromise=new Promise(t=>{this._resolveExitPromise=t}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let o=(t,e)=>{this.mem.setUint32(t+0,e,!0),this.mem.setUint32(t+4,Math.floor(e/4294967296),!0)},n=t=>{let e=this.mem.getUint32(t+0,!0),s=this.mem.getInt32(t+4,!0);return e+s*4294967296},r=t=>{let e=this.mem.getFloat64(t,!0);if(e===0)return;if(!isNaN(e))return e;let s=this.mem.getUint32(t,!0);return this._values[s]},l=(t,e)=>{if(typeof e==\"number\"&&e!==0){if(isNaN(e)){this.mem.setUint32(t+4,2146959360,!0),this.mem.setUint32(t,0,!0);return}this.mem.setFloat64(t,e,!0);return}if(e===void 0){this.mem.setFloat64(t,0,!0);return}let i=this._ids.get(e);i===void 0&&(i=this._idPool.pop(),i===void 0&&(i=this._values.length),this._values[i]=e,this._goRefCounts[i]=0,this._ids.set(e,i)),this._goRefCounts[i]++;let a=0;switch(typeof e){case\"object\":e!==null&&(a=1);break;case\"string\":a=2;break;case\"symbol\":a=3;break;case\"function\":a=4;break}this.mem.setUint32(t+4,2146959360|a,!0),this.mem.setUint32(t,i,!0)},c=t=>{let e=n(t+0),s=n(t+8);return new Uint8Array(this._inst.exports.mem.buffer,e,s)},f=t=>{let e=n(t+0),s=n(t+8),i=new Array(s);for(let a=0;a<s;a++)i[a]=r(e+a*8);return i},u=t=>{let e=n(t+0),s=n(t+8);return w.decode(new DataView(this._inst.exports.mem.buffer,e,s))},h=Date.now()-performance.now();this.importObject={gojs:{\"runtime.wasmExit\":t=>{t>>>=0;let e=this.mem.getInt32(t+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(e)},\"runtime.wasmWrite\":t=>{t>>>=0;let e=n(t+8),s=n(t+16),i=this.mem.getInt32(t+24,!0);_.writeSync(e,new Uint8Array(this._inst.exports.mem.buffer,s,i))},\"runtime.resetMemoryDataView\":t=>{t>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},\"runtime.nanotime1\":t=>{t>>>=0,o(t+8,(h+performance.now())*1e6)},\"runtime.walltime\":t=>{t>>>=0;let e=new Date().getTime();o(t+8,e/1e3),this.mem.setInt32(t+16,e%1e3*1e6,!0)},\"runtime.scheduleTimeoutEvent\":t=>{t>>>=0;let e=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(e,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(e);)console.warn(\"scheduleTimeoutEvent: missed timeout event\"),this._resume()},n(t+8)+1)),this.mem.setInt32(t+16,e,!0)},\"runtime.clearTimeoutEvent\":t=>{t>>>=0;let e=this.mem.getInt32(t+8,!0);clearTimeout(this._scheduledTimeouts.get(e)),this._scheduledTimeouts.delete(e)},\"runtime.getRandomData\":t=>{t>>>=0,globalThis.crypto.getRandomValues(c(t+8))},\"syscall/js.finalizeRef\":t=>{t>>>=0;let e=this.mem.getUint32(t+8,!0);if(this._goRefCounts[e]--,this._goRefCounts[e]===0){let s=this._values[e];this._values[e]=null,this._ids.delete(s),this._idPool.push(e)}},\"syscall/js.stringVal\":t=>{t>>>=0,l(t+24,u(t+8))},\"syscall/js.valueGet\":t=>{t>>>=0;let e=Reflect.get(r(t+8),u(t+16));t=this._inst.exports.getsp()>>>0,l(t+32,e)},\"syscall/js.valueSet\":t=>{t>>>=0,Reflect.set(r(t+8),u(t+16),r(t+32))},\"syscall/js.valueDelete\":t=>{t>>>=0,Reflect.deleteProperty(r(t+8),u(t+16))},\"syscall/js.valueIndex\":t=>{t>>>=0,l(t+24,Reflect.get(r(t+8),n(t+16)))},\"syscall/js.valueSetIndex\":t=>{t>>>=0,Reflect.set(r(t+8),n(t+16),r(t+24))},\"syscall/js.valueCall\":t=>{t>>>=0;try{let e=r(t+8),s=Reflect.get(e,u(t+16)),i=f(t+32),a=Reflect.apply(s,e,i);t=this._inst.exports.getsp()>>>0,l(t+56,a),this.mem.setUint8(t+64,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+56,e),this.mem.setUint8(t+64,0)}},\"syscall/js.valueInvoke\":t=>{t>>>=0;try{let e=r(t+8),s=f(t+16),i=Reflect.apply(e,void 0,s);t=this._inst.exports.getsp()>>>0,l(t+40,i),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+40,e),this.mem.setUint8(t+48,0)}},\"syscall/js.valueNew\":t=>{t>>>=0;try{let e=r(t+8),s=f(t+16),i=Reflect.construct(e,s);t=this._inst.exports.getsp()>>>0,l(t+40,i),this.mem.setUint8(t+48,1)}catch(e){t=this._inst.exports.getsp()>>>0,l(t+40,e),this.mem.setUint8(t+48,0)}},\"syscall/js.valueLength\":t=>{t>>>=0,o(t+16,Number.parseInt(r(t+8).length))},\"syscall/js.valuePrepareString\":t=>{t>>>=0;let e=y.encode(String(r(t+8)));l(t+16,e),o(t+24,e.length)},\"syscall/js.valueLoadString\":t=>{t>>>=0;let e=r(t+8);c(t+16).set(e)},\"syscall/js.valueInstanceOf\":t=>{t>>>=0,this.mem.setUint8(t+24,r(t+8)instanceof r(t+16)?1:0)},\"syscall/js.copyBytesToGo\":t=>{t>>>=0;let e=c(t+8),s=r(t+32);if(!(s instanceof Uint8Array||s instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=s.subarray(0,e.length);e.set(i),o(t+40,i.length),this.mem.setUint8(t+48,1)},\"syscall/js.copyBytesToJS\":t=>{t>>>=0;let e=r(t+8),s=c(t+16);if(!(e instanceof Uint8Array||e instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=s.subarray(0,e.length);e.set(i),o(t+40,i.length),this.mem.setUint8(t+48,1)},debug:t=>{console.log(t)}}}}async run(o){if(!(o instanceof WebAssembly.Instance))throw new Error(\"Go.run: WebAssembly.Instance expected\");this._inst=o,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[Number.NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(Number.POSITIVE_INFINITY),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096,r=h=>{let t=n,e=y.encode(`${h}\\0`);return new Uint8Array(this.mem.buffer,n,e.length).set(e),n+=e.length,n%8!==0&&(n+=8-n%8),t},l=this.argv.length,c=[];this.argv.forEach(h=>{c.push(r(h))}),c.push(0),Object.keys(this.env).sort().forEach(h=>{c.push(r(`${h}=${this.env[h]}`))}),c.push(0);let u=n;c.forEach(h=>{this.mem.setUint32(n,h,!0),this.mem.setUint32(n+4,0,!0),n+=8}),this._inst.exports.run(l,u),this.exited&&this._resolveExitPromise(),await this._exitPromise}_resume(){if(this.exited)throw new Error(\"Go program has already exited\");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(o){let n=this;return function(){let r={id:o,this:this,args:arguments};return n._pendingEvent=r,n._resume(),r.result}}};export{d as a};\n","import{a as c}from\"../chunk-W5DTLHV4.js\";import{promises as m}from\"fs\";import{fileURLToPath as f}from\"url\";var w=async(t,s)=>i().then(r=>r.transform(t,s)),l=async(t,s)=>i().then(r=>r.parse(t,s)),b=async(t,s)=>i().then(r=>r.convertToTSX(t,s)),P=async t=>{let{default:s}=await import(`data:text/javascript;charset=utf-8;base64,${Buffer.from(t).toString(\"base64\")}`);return s},n,g=()=>{n=void 0,globalThis[\"@astrojs/compiler\"]=void 0},i=()=>(n||(n=d().catch(t=>{throw n=void 0,t})),n),y=async(t,s)=>{let r;return r=await(async()=>{let o=await m.readFile(t).then(e=>e.buffer);return WebAssembly.instantiate(new Uint8Array(o),s)})(),r},d=async()=>{let t=new c,s=await y(f(new URL(\"../astro.wasm\",import.meta.url)),t.importObject);t.run(s.instance);let r=globalThis[\"@astrojs/compiler\"];return{transform:(a,o)=>new Promise(e=>{try{e(r.transform(a,o||{}))}catch(p){throw n=void 0,p}}),parse:(a,o)=>new Promise(e=>e(r.parse(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,ast:JSON.parse(e.ast)})),convertToTSX:(a,o)=>new Promise(e=>e(r.convertToTSX(a,o||{}))).catch(e=>{throw n=void 0,e}).then(e=>({...e,map:JSON.parse(e.map)}))}};export{P as compile,b as convertToTSX,l as parse,g as teardown,w as transform};\n"],"x_google_ignoreList":[0,1],"mappings":";;;;;AAA4F,WAAW,MAAI,OAAO,eAAe,YAAW,MAAK,EAAC,OAAM,GAAE,CAAC;AAAC,WAAW,WAAS,OAAO,iBAAiB,YAAW,WAAU,EAAC,OAAM,SAAQ,CAAC;AAAC,WAAW,UAAQ,OAAO,eAAe,YAAW,UAAS,EAAC,OAAMA,IAAE,YAAUA,IAAE,YAAU,EAAC,gBAAgB,GAAE;AAAC,QAAOA,IAAE,eAAe,EAAE;GAAE,EAAC,CAAC;AAAC,WAAW,eAAa,OAAO,eAAe,YAAW,eAAc,EAAC,OAAM,EAAC,MAAK;CAAC,IAAG,CAAC,GAAE,KAAG,QAAQ,QAAQ;AAAC,QAAO,IAAE,MAAI,IAAE;GAAK,EAAC,CAAC;AAAC,IAAIC,MAAE,IAAIC,YAAE,QAAQ,EAACC,MAAE,IAAIC,YAAE,QAAQ;AAAC,IAAIC,MAAE,MAAK;CAAC,cAAa;AAAC,OAAK,OAAK,CAAC,KAAK,EAAC,KAAK,MAAI,EAAE,EAAC,KAAK,QAAK,MAAG;AAAC,SAAI,KAAG,QAAQ,KAAK,cAAa,EAAE;KAAE,KAAK,eAAa,IAAI,SAAQ,MAAG;AAAC,QAAK,sBAAoB;IAAG,EAAC,KAAK,gBAAc,MAAK,KAAK,qCAAmB,IAAI,KAAG,EAAC,KAAK,yBAAuB;EAAE,IAAI,KAAG,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OAAI;GAAC,GAAG;GAAE,KAAI,KAAK,MAAM,EAAE,IAAI;GAAC,EAAE;EAAC,eAAc,GAAE,MAAI,IAAI,SAAQ,MAAG,EAAE,EAAE,aAAa,GAAE,KAAG,EAAE,CAAC,CAAC,CAAC,CAAC,OAAM,MAAG;AAAC,SAAM,IAAE,KAAK,GAAE;IAAG,CAAC,MAAK,OAAI;GAAC,GAAG;GAAE,KAAI,KAAK,MAAM,EAAE,IAAI;GAAC,EAAE;EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay-reader-
|
|
1
|
+
{"version":3,"file":"overlay-reader-DNaVsgiS.mjs","names":[],"sources":["../src/core/overlay-reader.ts"],"sourcesContent":["import type { FileChange, RepoReader } from './contracts/index.js'\n\n/**\n * A RepoReader that overlays a set of pending FileChanges on top of an\n * underlying reader. Used in the remote-provider write path so helpers\n * like {@link import('./context.js').buildContextChange} and\n * {@link import('./validator/project.js').validateProject} see the\n * post-change state — the state the pending commit is about to produce\n * — rather than the pre-change base branch.\n *\n * Semantics:\n *\n * - `readFile(path)` — returns pending `content` when the overlay maps\n * the path; falls back to the base reader otherwise. A pending delete\n * (`content: null`) surfaces as \"missing\" (throws, matching\n * `RepoReader.readFile`'s missing-file contract).\n *\n * - `listDirectory(path)` — merges the base directory listing with\n * pending additions that live directly in the same folder, removes\n * entries whose pending change is a delete, and de-duplicates the\n * result. Pending paths in nested subdirectories surface only at\n * their own listings.\n *\n * - `fileExists(path)` — pending adds → `true`, pending deletes →\n * `false`, otherwise delegates.\n *\n * The overlay keys are canonicalised to match the FileChange contract:\n * forward slashes, no leading `/`, no `..` segments (FileChanges are\n * required to respect these invariants).\n */\nexport class OverlayReader implements RepoReader {\n private readonly overlay: Map<string, FileChange>\n\n constructor(\n private readonly base: RepoReader,\n pendingChanges: FileChange[],\n ) {\n this.overlay = new Map()\n for (const change of pendingChanges) {\n this.overlay.set(normalise(change.path), change)\n }\n }\n\n async readFile(path: string, ref?: string): Promise<string> {\n const key = normalise(path)\n const pending = this.overlay.get(key)\n if (pending) {\n if (pending.content === null) {\n throw new Error(`OverlayReader: \"${path}\" is marked for deletion`)\n }\n return pending.content\n }\n return this.base.readFile(path, ref)\n }\n\n async listDirectory(path: string, ref?: string): Promise<string[]> {\n const baseEntries = await this.base.listDirectory(path, ref)\n const dirKey = normalise(path)\n const prefix = dirKey === '' ? '' : `${dirKey}/`\n\n const direct = [...this.overlay.entries()]\n .filter(([key]) => key.startsWith(prefix))\n .map(([key, change]) => ({\n name: key.slice(prefix.length).split('/')[0] ?? '',\n isNested: key.slice(prefix.length).includes('/'),\n deleted: change.content === null,\n }))\n .filter(entry => entry.name.length > 0)\n\n // For nested pending paths (e.g. overlay at `dir/sub/a.json` when\n // listing `dir`), the immediate child directory `sub` must surface\n // even though no pending change targets it directly.\n const deleted = new Set(\n direct.filter(e => e.deleted && !e.isNested).map(e => e.name),\n )\n const added = direct\n .filter(e => !e.deleted)\n .map(e => e.name)\n\n const result = baseEntries.filter(n => !deleted.has(n))\n for (const name of added) {\n if (!result.includes(name)) result.push(name)\n }\n return result\n }\n\n async fileExists(path: string, ref?: string): Promise<boolean> {\n const key = normalise(path)\n const pending = this.overlay.get(key)\n if (pending) return pending.content !== null\n return this.base.fileExists(path, ref)\n }\n}\n\nfunction normalise(path: string): string {\n return path.replace(/^\\/+/, '')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAa,gBAAb,MAAiD;CAC/C;CAEA,YACE,MACA,gBACA;AAFiB,OAAA,OAAA;AAGjB,OAAK,0BAAU,IAAI,KAAK;AACxB,OAAK,MAAM,UAAU,eACnB,MAAK,QAAQ,IAAI,UAAU,OAAO,KAAK,EAAE,OAAO;;CAIpD,MAAM,SAAS,MAAc,KAA+B;EAC1D,MAAM,MAAM,UAAU,KAAK;EAC3B,MAAM,UAAU,KAAK,QAAQ,IAAI,IAAI;AACrC,MAAI,SAAS;AACX,OAAI,QAAQ,YAAY,KACt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G"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//#region src/providers/shared/paths.ts
|
|
2
|
+
/**
|
|
3
|
+
* Normalise an optional contentRoot — strip leading/trailing slashes,
|
|
4
|
+
* treat `''`, `/` and `undefined` as "no prefix". Used by API-backed
|
|
5
|
+
* providers (GitHub, GitLab, future Bitbucket) to anchor content-relative
|
|
6
|
+
* paths against a repo subdirectory when Contentrain lives under a
|
|
7
|
+
* monorepo path like `apps/web/.contentrain/`.
|
|
8
|
+
*/
|
|
9
|
+
function normaliseContentRoot(raw) {
|
|
10
|
+
if (!raw || raw === "/" || raw === "") return "";
|
|
11
|
+
return raw.replace(/^\/+|\/+$/g, "");
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a content-root-relative path to a repo-relative path. The result
|
|
15
|
+
* always uses forward slashes and has no leading slash — the form every
|
|
16
|
+
* REST git API consumes for `file_path` / `path` query parameters and the
|
|
17
|
+
* Git Data API tree entries.
|
|
18
|
+
*/
|
|
19
|
+
function resolveRepoPath(contentRoot, relativePath) {
|
|
20
|
+
const prefix = normaliseContentRoot(contentRoot);
|
|
21
|
+
const cleanPath = relativePath.replace(/^\/+/, "");
|
|
22
|
+
return prefix ? `${prefix}/${cleanPath}` : cleanPath;
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { resolveRepoPath as t };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=paths-enT2coeX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths-enT2coeX.mjs","names":[],"sources":["../src/providers/shared/paths.ts"],"sourcesContent":["/**\n * Normalise an optional contentRoot — strip leading/trailing slashes,\n * treat `''`, `/` and `undefined` as \"no prefix\". Used by API-backed\n * providers (GitHub, GitLab, future Bitbucket) to anchor content-relative\n * paths against a repo subdirectory when Contentrain lives under a\n * monorepo path like `apps/web/.contentrain/`.\n */\nexport function normaliseContentRoot(raw?: string): string {\n if (!raw || raw === '/' || raw === '') return ''\n return raw.replace(/^\\/+|\\/+$/g, '')\n}\n\n/**\n * Resolve a content-root-relative path to a repo-relative path. The result\n * always uses forward slashes and has no leading slash — the form every\n * REST git API consumes for `file_path` / `path` query parameters and the\n * Git Data API tree entries.\n */\nexport function resolveRepoPath(contentRoot: string | undefined, relativePath: string): string {\n const prefix = normaliseContentRoot(contentRoot)\n const cleanPath = relativePath.replace(/^\\/+/, '')\n return prefix ? `${prefix}/${cleanPath}` : cleanPath\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,qBAAqB,KAAsB;AACzD,KAAI,CAAC,OAAO,QAAQ,OAAO,QAAQ,GAAI,QAAO;AAC9C,QAAO,IAAI,QAAQ,cAAc,GAAG;;;;;;;;AAStC,SAAgB,gBAAgB,aAAiC,cAA8B;CAC7F,MAAM,SAAS,qBAAqB,YAAY;CAChD,MAAM,YAAY,aAAa,QAAQ,QAAQ,GAAG;AAClD,QAAO,SAAS,GAAG,OAAO,GAAG,cAAc"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as RepoReader, g as RepoProvider, h as ProviderCapabilities, i as CommitAuthor, m as MergeResult, n as Branch, o as FileDiff, r as Commit, t as ApplyPlanInput } from "../../index-
|
|
1
|
+
import { _ as RepoReader, g as RepoProvider, h as ProviderCapabilities, i as CommitAuthor, m as MergeResult, n as Branch, o as FileDiff, r as Commit, t as ApplyPlanInput } from "../../index-w8QHThNS.mjs";
|
|
2
2
|
import { Octokit } from "@octokit/rest";
|
|
3
3
|
|
|
4
4
|
//#region src/providers/github/app-auth.d.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as isNotFoundError } from "../../errors-e0YdjooK.mjs";
|
|
2
|
+
import { t as resolveRepoPath } from "../../paths-enT2coeX.mjs";
|
|
2
3
|
import { CONTENTRAIN_BRANCH } from "@contentrain/types";
|
|
3
4
|
import { createPrivateKey, createSign } from "node:crypto";
|
|
4
5
|
//#region src/providers/github/app-auth.ts
|