@bendyline/gezel-mcp 1.0.5 → 1.0.7
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/index.d.ts +19 -17
- package/dist/index.js +166 -34
- package/dist/server.js +2359 -1116
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export { BranchPrioritizedPulls, PullWithHeadRef, prioritizePullsForCurrentBranch } from '@bendyline/gezel';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Frozen inventory of every MCP tool the gezel-mcp server registers.
|
|
3
5
|
*
|
|
@@ -18,7 +20,7 @@
|
|
|
18
20
|
* whose names come from the applied type's manifest, not from this frozen
|
|
19
21
|
* contract. Registration guards them against colliding with these names.
|
|
20
22
|
*/
|
|
21
|
-
declare const ALWAYS_REGISTERED_TOOLS: readonly ["search_memory", "save_memory", "list_memories", "list_dir", "read_file", "read_files", "stat", "write_file", "append_to_file", "replace_in_file", "replace_lines", "apply_patch", "insert_at_marker", "delete_path", "make_dir", "rename", "copy_artifact_to_workspace", "validate", "npm_install", "list_package_scripts", "run_package_script", "run_npx", "run_nodejs_script", "derive_file", "list_packages", "run_playwright_script", "list_artifacts", "read_artifact", "write_artifact", "grep_artifact", "browser_find_page_element", "list_documents", "read_document", "write_document", "delete_document", "search_documents", "list_gezels", "create_gezel", "list_gilde", "list_project_types", "apply_project_type", "start_project_from_type", "
|
|
23
|
+
declare const ALWAYS_REGISTERED_TOOLS: readonly ["search_memory", "save_memory", "list_memories", "list_dir", "read_file", "read_files", "stat", "write_file", "append_to_file", "replace_in_file", "replace_lines", "apply_patch", "insert_at_marker", "delete_path", "make_dir", "rename", "copy_artifact_to_workspace", "validate", "npm_install", "list_package_scripts", "run_package_script", "run_npx", "run_nodejs_script", "derive_file", "list_packages", "run_playwright_script", "list_artifacts", "read_artifact", "write_artifact", "grep_artifact", "browser_find_page_element", "list_documents", "read_document", "write_document", "delete_document", "search_documents", "list_gezels", "create_gezel", "list_gilde", "list_project_types", "apply_project_type", "start_project_from_type", "export_ai_app", "import_ai_app", "ensure_gezel", "update_gezel", "message_gezel", "ask_gezel", "ask_specialist", "delegate_developer", "consult_developer", "delegate_designer", "consult_designer", "delegate_reviewer", "consult_reviewer", "delegate_planner", "consult_planner", "delegate_researcher", "consult_researcher", "delegate_builder", "consult_builder", "delegate_writer", "consult_writer", "delegate_image_generator", "consult_image_generator", "delegate_voorman", "consult_voorman", "delegate_meester", "consult_meester", "ask_user_question", "list_projects", "start_project", "fetch_repo", "fetch_diff", "update_project", "list_project_gezels", "add_gezel_to_project", "remove_gezel_from_project", "list_suggested_work", "enable_suggested_work", "disable_suggested_work", "list_tasks", "get_task", "create_task", "start_plan", "update_task", "set_outcomes", "verify_outcome", "add_verification_step", "spawn_task_instances", "list_task_children", "set_task_status", "activate_task", "assign_task", "add_task_step", "advance_task_step", "read_task_notes", "write_task_note", "search_history", "search_sessions", "how_do_i", "render_image", "generate_image", "describe_image", "read_image_metadata", "generate_video", "transcribe_audio", "synthesize_speech", "fetch_url", "web_search", "wikipedia_search", "wikipedia_read", "search", "grep_files", "find_files", "diff_files", "read_image_as_base64", "outline_file", "find_symbol", "read_symbol", "find_references", "map_repo", "search_code", "file_review", "list_file_issues", "get_file_issue", "set_file_issue_status", "security_scan", "security_overview", "scan_findings", "map_attack_surface", "list_dependencies", "trace_taint", "search_docs", "read_doc_as_markdown", "search_images", "find_similar_images", "describe_folder", "find_entity", "list_entity_mentions", "list_archive", "extract_archive", "run_git", "list_scripts", "run_installed_script", "get_script_run", "list_craftbooks", "suggest_craftbook", "invoke_craftbook", "import_skill", "craftbook_read", "craftbook_write", "craftbook_add_step", "set_step_deliverable", "craftbook_remove_step", "craftbook_reorder_steps", "craftbook_set_entry", "craftbook_update", "export_task_craftbook", "github_pr_list", "github_pr_view", "github_pr_files", "github_pr_file", "github_pr_diff", "github_pr_comments", "github_pr_comment", "github_pr_create", "github_workflow_runs", "github_check_status"];
|
|
22
24
|
/**
|
|
23
25
|
* Tools registered only when their feature or session-context gate is set
|
|
24
26
|
* in the env. Keep contextual/compatibility tools here so inventory users
|
|
@@ -60,6 +62,21 @@ declare const CONDITIONALLY_REGISTERED_TOOLS: {
|
|
|
60
62
|
readonly envValue: "1";
|
|
61
63
|
readonly modelFacing: false;
|
|
62
64
|
};
|
|
65
|
+
readonly list_tables: {
|
|
66
|
+
readonly envVar: "GEZEL_TABLES_ENABLED";
|
|
67
|
+
readonly envValue: "1";
|
|
68
|
+
readonly modelFacing: true;
|
|
69
|
+
};
|
|
70
|
+
readonly describe_table: {
|
|
71
|
+
readonly envVar: "GEZEL_TABLES_ENABLED";
|
|
72
|
+
readonly envValue: "1";
|
|
73
|
+
readonly modelFacing: true;
|
|
74
|
+
};
|
|
75
|
+
readonly query_table: {
|
|
76
|
+
readonly envVar: "GEZEL_TABLES_ENABLED";
|
|
77
|
+
readonly envValue: "1";
|
|
78
|
+
readonly modelFacing: true;
|
|
79
|
+
};
|
|
63
80
|
readonly draft_email: {
|
|
64
81
|
readonly envVar: "GEZEL_MAIL_ENABLED";
|
|
65
82
|
readonly envValue: "1";
|
|
@@ -362,19 +379,4 @@ declare function unavailableToolsForPlatform(platform: NodeJS.Platform, options?
|
|
|
362
379
|
linuxSystemdAvailable?: boolean;
|
|
363
380
|
}): readonly string[];
|
|
364
381
|
|
|
365
|
-
|
|
366
|
-
headRef: string;
|
|
367
|
-
}
|
|
368
|
-
interface BranchPrioritizedPulls<T extends PullWithHeadRef> {
|
|
369
|
-
pulls: T[];
|
|
370
|
-
currentBranch?: string;
|
|
371
|
-
matchingCount: number;
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Put open PRs for the checked-out branch first without disturbing the
|
|
375
|
-
* provider's order inside either group. Callers can then safely treat the
|
|
376
|
-
* first result as the default only when `matchingCount > 0`.
|
|
377
|
-
*/
|
|
378
|
-
declare function prioritizePullsForCurrentBranch<T extends PullWithHeadRef>(pulls: readonly T[], currentBranch?: string): BranchPrioritizedPulls<T>;
|
|
379
|
-
|
|
380
|
-
export { ALWAYS_REGISTERED_TOOLS, type AlwaysRegisteredToolName, BUILTIN_TOOL_NAMES, type BranchPrioritizedPulls, CANONICAL_TOOL_NAMES, CONDITIONALLY_REGISTERED_TOOLS, type CanonicalToolName, type CanonicalToolRegistryEntry, type ConditionallyRegisteredToolName, type FileContent, LEGACY_SPELLING_BY_CANONICAL, LEGACY_TOOL_NAMES, type LegacyToolName, type PullWithHeadRef, RENAMED_TOOLS, RESERVED_TOOL_NAMES, TOOL_NAME_TOMBSTONES, TOOL_REGISTRY, type ToolNameTombstone, type ToolRegistrationGate, type ValidateCheck, type ValidateResult, canUseLinuxSystemdDenyNet, canonicalToolName, formatValidateResult, normalizeToolNameSpelling, prioritizePullsForCurrentBranch, resolveToolNameSpelling, unavailableToolsForPlatform, validateFile };
|
|
382
|
+
export { ALWAYS_REGISTERED_TOOLS, type AlwaysRegisteredToolName, BUILTIN_TOOL_NAMES, CANONICAL_TOOL_NAMES, CONDITIONALLY_REGISTERED_TOOLS, type CanonicalToolName, type CanonicalToolRegistryEntry, type ConditionallyRegisteredToolName, type FileContent, LEGACY_SPELLING_BY_CANONICAL, LEGACY_TOOL_NAMES, type LegacyToolName, RENAMED_TOOLS, RESERVED_TOOL_NAMES, TOOL_NAME_TOMBSTONES, TOOL_REGISTRY, type ToolNameTombstone, type ToolRegistrationGate, type ValidateCheck, type ValidateResult, canUseLinuxSystemdDenyNet, canonicalToolName, formatValidateResult, normalizeToolNameSpelling, resolveToolNameSpelling, unavailableToolsForPlatform, validateFile };
|
package/dist/index.js
CHANGED
|
@@ -50,8 +50,8 @@ var ALWAYS_REGISTERED_TOOLS = [
|
|
|
50
50
|
"list_project_types",
|
|
51
51
|
"apply_project_type",
|
|
52
52
|
"start_project_from_type",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
53
|
+
"export_ai_app",
|
|
54
|
+
"import_ai_app",
|
|
55
55
|
"ensure_gezel",
|
|
56
56
|
"update_gezel",
|
|
57
57
|
"message_gezel",
|
|
@@ -131,7 +131,9 @@ var ALWAYS_REGISTERED_TOOLS = [
|
|
|
131
131
|
"fetch_url",
|
|
132
132
|
"web_search",
|
|
133
133
|
"wikipedia_search",
|
|
134
|
+
"wikipedia_read",
|
|
134
135
|
// Search / files
|
|
136
|
+
"search",
|
|
135
137
|
"grep_files",
|
|
136
138
|
"find_files",
|
|
137
139
|
"diff_files",
|
|
@@ -238,6 +240,14 @@ var CONDITIONALLY_REGISTERED_TOOLS = {
|
|
|
238
240
|
envValue: "1",
|
|
239
241
|
modelFacing: false
|
|
240
242
|
},
|
|
243
|
+
// Observation-table tools — registered only for projects that actually hold
|
|
244
|
+
// a tabular corpus (the chat manager sets GEZEL_TABLES_ENABLED after a
|
|
245
|
+
// directory probe). The tool listing is injected into every system prompt,
|
|
246
|
+
// so three tools a project can never use are pure prompt cost at depth —
|
|
247
|
+
// and a model that sees a tool tends to reach for it.
|
|
248
|
+
list_tables: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
|
|
249
|
+
describe_table: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
|
|
250
|
+
query_table: { envVar: "GEZEL_TABLES_ENABLED", envValue: "1", modelFacing: true },
|
|
241
251
|
// Email write tools — registered only for mail-enabled projects (the chat
|
|
242
252
|
// manager sets GEZEL_MAIL_ENABLED when project.mail is configured).
|
|
243
253
|
draft_email: { envVar: "GEZEL_MAIL_ENABLED", envValue: "1", modelFacing: true },
|
|
@@ -256,6 +266,9 @@ var CONDITIONALLY_REGISTERED_TOOLS = {
|
|
|
256
266
|
modelFacing: true
|
|
257
267
|
}
|
|
258
268
|
};
|
|
269
|
+
var HOST_CALLBACK_TOOLS = Object.freeze(
|
|
270
|
+
/* @__PURE__ */ new Set(["request_tool_permission"])
|
|
271
|
+
);
|
|
259
272
|
var RENAMED_TOOLS = {
|
|
260
273
|
readdir: "list_dir",
|
|
261
274
|
readFile: "read_file",
|
|
@@ -380,7 +393,95 @@ function resolveToolNameSpelling(requested, knownNames) {
|
|
|
380
393
|
}
|
|
381
394
|
|
|
382
395
|
// src/validate.ts
|
|
396
|
+
import ts2 from "typescript";
|
|
397
|
+
|
|
398
|
+
// src/source-validation.ts
|
|
383
399
|
import ts from "typescript";
|
|
400
|
+
var DIAG_BLOCK_COMMENT_UNCLOSED = 1010;
|
|
401
|
+
var DIAG_TEMPLATE_UNTERMINATED = 1160;
|
|
402
|
+
var DIAG_TOKEN_EXPECTED = 1005;
|
|
403
|
+
function locateUnterminatedConstruct(body, scriptKind = ts.ScriptKind.JS) {
|
|
404
|
+
const sf = parseFor(body, scriptKind);
|
|
405
|
+
const first = parseDiagnosticsOf(sf)?.[0];
|
|
406
|
+
if (!first || first.start == null) return null;
|
|
407
|
+
if (first.start < body.trimEnd().length) return null;
|
|
408
|
+
if (first.code === DIAG_BLOCK_COMMENT_UNCLOSED) {
|
|
409
|
+
const start2 = locateTrailingBlockComment(body, scriptKind);
|
|
410
|
+
if (start2 !== null) return { start: start2, label: "block comment", closer: "*/" };
|
|
411
|
+
}
|
|
412
|
+
const closer = closerForDiagnostic(first);
|
|
413
|
+
if (!closer) return null;
|
|
414
|
+
const relatedStart = first.relatedInformation?.[0]?.start;
|
|
415
|
+
if (typeof relatedStart === "number") {
|
|
416
|
+
return { start: relatedStart, label: labelForCloser(closer), closer };
|
|
417
|
+
}
|
|
418
|
+
const start = locateNodeSpanningEnd(body, closer, scriptKind);
|
|
419
|
+
return start === null ? null : { start, label: labelForCloser(closer), closer };
|
|
420
|
+
}
|
|
421
|
+
function parseFor(source, scriptKind) {
|
|
422
|
+
const ext = scriptKind === ts.ScriptKind.TSX ? "tsx" : scriptKind === ts.ScriptKind.TS ? "ts" : scriptKind === ts.ScriptKind.JSX ? "jsx" : "js";
|
|
423
|
+
return ts.createSourceFile(
|
|
424
|
+
`unterminated-probe.${ext}`,
|
|
425
|
+
source,
|
|
426
|
+
ts.ScriptTarget.ES2022,
|
|
427
|
+
/*setParentNodes*/
|
|
428
|
+
false,
|
|
429
|
+
scriptKind
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
function parseDiagnosticsOf(sf) {
|
|
433
|
+
return sf.parseDiagnostics;
|
|
434
|
+
}
|
|
435
|
+
function closerForDiagnostic(diag) {
|
|
436
|
+
if (diag.code === DIAG_BLOCK_COMMENT_UNCLOSED) return "*/";
|
|
437
|
+
if (diag.code === DIAG_TEMPLATE_UNTERMINATED) return "`";
|
|
438
|
+
if (diag.code === DIAG_TOKEN_EXPECTED) {
|
|
439
|
+
const text = ts.flattenDiagnosticMessageText(diag.messageText, " ");
|
|
440
|
+
const quoted = /^'(.{1,2})' expected/.exec(text);
|
|
441
|
+
const token = quoted?.[1];
|
|
442
|
+
return token && ["}", ")", "]"].includes(token) ? token : null;
|
|
443
|
+
}
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
function labelForCloser(closer) {
|
|
447
|
+
switch (closer) {
|
|
448
|
+
case "*/":
|
|
449
|
+
return "block comment";
|
|
450
|
+
case "`":
|
|
451
|
+
return "template literal";
|
|
452
|
+
case "}":
|
|
453
|
+
return "{ ... } block";
|
|
454
|
+
case ")":
|
|
455
|
+
return "( ... ) group";
|
|
456
|
+
case "]":
|
|
457
|
+
return "[ ... ] list";
|
|
458
|
+
default:
|
|
459
|
+
return "construct";
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
function locateTrailingBlockComment(body, scriptKind) {
|
|
463
|
+
const repaired = `${body}*/`;
|
|
464
|
+
const sf = parseFor(repaired, scriptKind);
|
|
465
|
+
const ranges = ts.getLeadingCommentRanges(repaired, sf.endOfFileToken.pos) ?? [];
|
|
466
|
+
const trailing = ranges.find((r) => r.end === repaired.length);
|
|
467
|
+
return trailing ? trailing.pos : null;
|
|
468
|
+
}
|
|
469
|
+
function locateNodeSpanningEnd(body, closer, scriptKind) {
|
|
470
|
+
const repaired = `${body}${closer}`;
|
|
471
|
+
const sf = parseFor(repaired, scriptKind);
|
|
472
|
+
let best = null;
|
|
473
|
+
const visit = (node) => {
|
|
474
|
+
const start = node.getStart(sf);
|
|
475
|
+
if (node.end === repaired.length && start < repaired.length) {
|
|
476
|
+
if (best === null || start > best) best = start;
|
|
477
|
+
}
|
|
478
|
+
ts.forEachChild(node, visit);
|
|
479
|
+
};
|
|
480
|
+
ts.forEachChild(sf, visit);
|
|
481
|
+
return best;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// src/validate.ts
|
|
384
485
|
function validateFile(path, content) {
|
|
385
486
|
const lower = path.toLowerCase();
|
|
386
487
|
if (lower.endsWith(".html") || lower.endsWith(".htm")) {
|
|
@@ -452,6 +553,20 @@ function buildExcerpt(text, targetLine, context = 2) {
|
|
|
452
553
|
var SCRIPT_RE = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
|
453
554
|
var SCRIPT_OPEN_RE = /<script\b[^>]*>/gi;
|
|
454
555
|
var SCRIPT_CLOSE_RE = /<\/script\s*>/gi;
|
|
556
|
+
var INERT_WITHOUT_SCRIPT = [
|
|
557
|
+
{ re: /<canvas\b/i, what: "<canvas> element" },
|
|
558
|
+
{
|
|
559
|
+
re: /\son(?:click|change|input|submit|keydown|keyup|keypress|mousedown|mouseup|mousemove|mouseover|mouseout|touchstart|touchend|touchmove|load|focus|blur|error|scroll|resize)\s*=/i,
|
|
560
|
+
what: "inline event-handler attribute"
|
|
561
|
+
}
|
|
562
|
+
];
|
|
563
|
+
function inertMarkupWithoutScript(html) {
|
|
564
|
+
for (const { re, what } of INERT_WITHOUT_SCRIPT) {
|
|
565
|
+
const m = re.exec(html);
|
|
566
|
+
if (m) return { what, line: (html.slice(0, m.index).match(/\n/g)?.length ?? 0) + 1 };
|
|
567
|
+
}
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
455
570
|
function validateHtml(_path, content) {
|
|
456
571
|
if (!content.text) {
|
|
457
572
|
return [
|
|
@@ -470,6 +585,18 @@ function validateHtml(_path, content) {
|
|
|
470
585
|
const opens = (html.match(SCRIPT_OPEN_RE) ?? []).length;
|
|
471
586
|
const closes = (html.match(SCRIPT_CLOSE_RE) ?? []).length;
|
|
472
587
|
if (opens === 0) {
|
|
588
|
+
const inert = inertMarkupWithoutScript(html);
|
|
589
|
+
if (inert) {
|
|
590
|
+
checks.push({
|
|
591
|
+
ok: false,
|
|
592
|
+
name: "script-tag-present",
|
|
593
|
+
message: `page has a ${inert.what} but no <script> at all \u2014 this markup is inert, so nothing on the page can run`,
|
|
594
|
+
location: { line: inert.line },
|
|
595
|
+
excerpt: buildExcerpt(html, inert.line, 2),
|
|
596
|
+
fixHint: "the page is missing its JavaScript entirely \u2014 a syntax pass on markup alone is not evidence it works. Add the <script> block that drives it, then re-validate."
|
|
597
|
+
});
|
|
598
|
+
return checks;
|
|
599
|
+
}
|
|
473
600
|
checks.push({
|
|
474
601
|
ok: true,
|
|
475
602
|
name: "script-tag-present",
|
|
@@ -508,8 +635,24 @@ function validateHtml(_path, content) {
|
|
|
508
635
|
const openIdx = m.index ?? 0;
|
|
509
636
|
const openLine = (html.slice(0, openIdx).match(/\n/g)?.length ?? 0) + 1;
|
|
510
637
|
scripts.push({ body, attrs, openLine });
|
|
511
|
-
const parseError = isModuleScript(attrs) ? tryParseSource(body,
|
|
638
|
+
const parseError = isModuleScript(attrs) ? tryParseSource(body, ts2.ScriptKind.JS) : tryParseFunctionBody(body);
|
|
512
639
|
if (parseError) {
|
|
640
|
+
const unterminated = locateUnterminatedConstruct(body);
|
|
641
|
+
if (unterminated) {
|
|
642
|
+
const before = body.slice(0, unterminated.start);
|
|
643
|
+
const newlines = before.match(/\n/g)?.length ?? 0;
|
|
644
|
+
const fileLine2 = openLine + newlines;
|
|
645
|
+
const col2 = newlines > 0 ? unterminated.start - before.lastIndexOf("\n") : void 0;
|
|
646
|
+
checks.push({
|
|
647
|
+
ok: false,
|
|
648
|
+
name: scriptIdx === 1 ? "script-body-parses" : `script-body-parses[${scriptIdx}]`,
|
|
649
|
+
message: `unterminated ${unterminated.label} \u2014 it swallows the rest of the script, so nothing on the page runs`,
|
|
650
|
+
location: { line: fileLine2, ...col2 ? { col: col2 } : {} },
|
|
651
|
+
excerpt: buildExcerpt(html, fileLine2, 2),
|
|
652
|
+
fixHint: `add the missing \`${unterminated.closer}\` where that construct should end. The defect is at line ${fileLine2}, not at the end of the script \u2014 do not edit or remove the </script> tag.`
|
|
653
|
+
});
|
|
654
|
+
return checks;
|
|
655
|
+
}
|
|
513
656
|
const locMatch = parseError.match(/line (\d+)(?:.*?col(?:umn)?\s*(\d+))?/i);
|
|
514
657
|
const scriptInternalLine = locMatch ? Number(locMatch[1]) : 1;
|
|
515
658
|
const col = locMatch?.[2] ? Number(locMatch[2]) : void 0;
|
|
@@ -589,15 +732,15 @@ function validateUniqueTopLevelFunctions(scripts) {
|
|
|
589
732
|
const seen = /* @__PURE__ */ new Map();
|
|
590
733
|
let count = 0;
|
|
591
734
|
for (const script of scripts) {
|
|
592
|
-
const sf =
|
|
735
|
+
const sf = ts2.createSourceFile(
|
|
593
736
|
"inline-script.js",
|
|
594
737
|
script.body,
|
|
595
|
-
|
|
738
|
+
ts2.ScriptTarget.ES2022,
|
|
596
739
|
true,
|
|
597
|
-
|
|
740
|
+
ts2.ScriptKind.JS
|
|
598
741
|
);
|
|
599
742
|
for (const statement of sf.statements) {
|
|
600
|
-
if (!
|
|
743
|
+
if (!ts2.isFunctionDeclaration(statement) || !statement.name) continue;
|
|
601
744
|
count += 1;
|
|
602
745
|
const relative = sf.getLineAndCharacterOfPosition(statement.name.getStart(sf));
|
|
603
746
|
const line = script.openLine + relative.line;
|
|
@@ -622,18 +765,18 @@ function validateUniqueTopLevelFunctions(scripts) {
|
|
|
622
765
|
};
|
|
623
766
|
}
|
|
624
767
|
function tryParseSource(source, scriptKind) {
|
|
625
|
-
const fileName = scriptKind ===
|
|
626
|
-
const output =
|
|
768
|
+
const fileName = scriptKind === ts2.ScriptKind.TSX ? "source.tsx" : "source.js";
|
|
769
|
+
const output = ts2.transpileModule(source, {
|
|
627
770
|
fileName,
|
|
628
771
|
reportDiagnostics: true,
|
|
629
|
-
compilerOptions: { target:
|
|
772
|
+
compilerOptions: { target: ts2.ScriptTarget.ES2022, module: ts2.ModuleKind.ESNext }
|
|
630
773
|
});
|
|
631
774
|
const diagnostics = output.diagnostics?.filter(
|
|
632
|
-
(diagnostic) => diagnostic.category ===
|
|
775
|
+
(diagnostic) => diagnostic.category === ts2.DiagnosticCategory.Error && diagnostic.file !== void 0 && diagnostic.start !== void 0
|
|
633
776
|
);
|
|
634
777
|
if (!diagnostics || diagnostics.length === 0) return null;
|
|
635
778
|
const first = diagnostics[0];
|
|
636
|
-
const message =
|
|
779
|
+
const message = ts2.flattenDiagnosticMessageText(first.messageText, "\n");
|
|
637
780
|
const { line, character } = first.file.getLineAndCharacterOfPosition(first.start);
|
|
638
781
|
return `${message} at line ${line + 1}, col ${character + 1}`;
|
|
639
782
|
}
|
|
@@ -651,11 +794,11 @@ function validateJsTs(path, content) {
|
|
|
651
794
|
}
|
|
652
795
|
const checks = [fileNonEmptyCheck(content)];
|
|
653
796
|
const lower = path.toLowerCase();
|
|
654
|
-
const scriptKind = lower.endsWith(".tsx") ?
|
|
655
|
-
const sf =
|
|
797
|
+
const scriptKind = lower.endsWith(".tsx") ? ts2.ScriptKind.TSX : lower.endsWith(".ts") ? ts2.ScriptKind.TS : lower.endsWith(".jsx") ? ts2.ScriptKind.JSX : ts2.ScriptKind.JS;
|
|
798
|
+
const sf = ts2.createSourceFile(
|
|
656
799
|
path,
|
|
657
800
|
content.text,
|
|
658
|
-
|
|
801
|
+
ts2.ScriptTarget.ES2022,
|
|
659
802
|
/*setParentNodes*/
|
|
660
803
|
true,
|
|
661
804
|
scriptKind
|
|
@@ -678,12 +821,12 @@ function validateJsTs(path, content) {
|
|
|
678
821
|
checks.push({
|
|
679
822
|
ok: true,
|
|
680
823
|
name: "parses",
|
|
681
|
-
detail: `${scriptKind ===
|
|
824
|
+
detail: `${scriptKind === ts2.ScriptKind.TS || scriptKind === ts2.ScriptKind.TSX ? "TypeScript" : "JavaScript"} parses cleanly`
|
|
682
825
|
});
|
|
683
826
|
return checks;
|
|
684
827
|
}
|
|
685
828
|
const first = diags[0];
|
|
686
|
-
const msg =
|
|
829
|
+
const msg = ts2.flattenDiagnosticMessageText(first.messageText, "\n");
|
|
687
830
|
const { line, character } = sf.getLineAndCharacterOfPosition(first.start);
|
|
688
831
|
checks.push({
|
|
689
832
|
ok: false,
|
|
@@ -699,11 +842,11 @@ function findNestedStaticModuleDeclaration(sf) {
|
|
|
699
842
|
let found = null;
|
|
700
843
|
const visit = (node) => {
|
|
701
844
|
if (found) return;
|
|
702
|
-
if ((
|
|
845
|
+
if ((ts2.isImportDeclaration(node) || ts2.isExportDeclaration(node) || ts2.isExportAssignment(node)) && node.parent !== sf) {
|
|
703
846
|
found = node;
|
|
704
847
|
return;
|
|
705
848
|
}
|
|
706
|
-
|
|
849
|
+
ts2.forEachChild(node, visit);
|
|
707
850
|
};
|
|
708
851
|
visit(sf);
|
|
709
852
|
return found;
|
|
@@ -882,21 +1025,10 @@ function unavailableToolsForPlatform(platform, options = {}) {
|
|
|
882
1025
|
return DENY_NET_TOOLS;
|
|
883
1026
|
}
|
|
884
1027
|
|
|
885
|
-
// src/
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const matching = [];
|
|
890
|
-
const others = [];
|
|
891
|
-
for (const pull of pulls) {
|
|
892
|
-
(pull.headRef === branch ? matching : others).push(pull);
|
|
893
|
-
}
|
|
894
|
-
return {
|
|
895
|
-
pulls: [...matching, ...others],
|
|
896
|
-
currentBranch: branch,
|
|
897
|
-
matchingCount: matching.length
|
|
898
|
-
};
|
|
899
|
-
}
|
|
1028
|
+
// src/index.ts
|
|
1029
|
+
import {
|
|
1030
|
+
prioritizePullsForCurrentBranch
|
|
1031
|
+
} from "@bendyline/gezel";
|
|
900
1032
|
export {
|
|
901
1033
|
ALWAYS_REGISTERED_TOOLS,
|
|
902
1034
|
BUILTIN_TOOL_NAMES,
|