@homenshum/convex-mcp-nodebench 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +137 -0
- package/dist/__tests__/tools.test.d.ts +1 -0
- package/dist/__tests__/tools.test.js +267 -0
- package/dist/__tests__/tools.test.js.map +1 -0
- package/dist/db.d.ts +10 -0
- package/dist/db.js +125 -0
- package/dist/db.js.map +1 -0
- package/dist/gotchaSeed.d.ts +126 -0
- package/dist/gotchaSeed.js +147 -0
- package/dist/gotchaSeed.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +118 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/componentTools.d.ts +2 -0
- package/dist/tools/componentTools.js +131 -0
- package/dist/tools/componentTools.js.map +1 -0
- package/dist/tools/cronTools.d.ts +2 -0
- package/dist/tools/cronTools.js +142 -0
- package/dist/tools/cronTools.js.map +1 -0
- package/dist/tools/deploymentTools.d.ts +2 -0
- package/dist/tools/deploymentTools.js +222 -0
- package/dist/tools/deploymentTools.js.map +1 -0
- package/dist/tools/functionTools.d.ts +2 -0
- package/dist/tools/functionTools.js +293 -0
- package/dist/tools/functionTools.js.map +1 -0
- package/dist/tools/integrationBridgeTools.d.ts +2 -0
- package/dist/tools/integrationBridgeTools.js +294 -0
- package/dist/tools/integrationBridgeTools.js.map +1 -0
- package/dist/tools/learningTools.d.ts +2 -0
- package/dist/tools/learningTools.js +155 -0
- package/dist/tools/learningTools.js.map +1 -0
- package/dist/tools/methodologyTools.d.ts +2 -0
- package/dist/tools/methodologyTools.js +163 -0
- package/dist/tools/methodologyTools.js.map +1 -0
- package/dist/tools/schemaTools.d.ts +2 -0
- package/dist/tools/schemaTools.js +346 -0
- package/dist/tools/schemaTools.js.map +1 -0
- package/dist/tools/toolRegistry.d.ts +5 -0
- package/dist/tools/toolRegistry.js +308 -0
- package/dist/tools/toolRegistry.js.map +1 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { getDb } from "../db.js";
|
|
2
|
+
import { getQuickRef } from "./toolRegistry.js";
|
|
3
|
+
export const learningTools = [
|
|
4
|
+
{
|
|
5
|
+
name: "convex_record_gotcha",
|
|
6
|
+
description: "Record a Convex-specific gotcha, edge case, or pattern for future reference. Stored persistently and searchable via full-text search. Categories: validator, schema, function, deployment, auth, performance, general.",
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
key: {
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Short unique identifier (e.g., 'v-optional-default-undefined', 'cron-overlap-race')",
|
|
13
|
+
},
|
|
14
|
+
content: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "Detailed description of the gotcha: what happened, why, and how to avoid it",
|
|
17
|
+
},
|
|
18
|
+
category: {
|
|
19
|
+
type: "string",
|
|
20
|
+
enum: ["validator", "schema", "function", "deployment", "auth", "performance", "general"],
|
|
21
|
+
description: "Category of the gotcha",
|
|
22
|
+
},
|
|
23
|
+
severity: {
|
|
24
|
+
type: "string",
|
|
25
|
+
enum: ["critical", "warning", "info"],
|
|
26
|
+
description: "How severe this gotcha is",
|
|
27
|
+
},
|
|
28
|
+
tags: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Comma-separated tags for searchability",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
required: ["key", "content", "category"],
|
|
34
|
+
},
|
|
35
|
+
handler: async (args) => {
|
|
36
|
+
const db = getDb();
|
|
37
|
+
// Upsert: update if exists, insert if not
|
|
38
|
+
const existing = db.prepare("SELECT id FROM convex_gotchas WHERE key = ?").get(args.key);
|
|
39
|
+
if (existing) {
|
|
40
|
+
db.prepare("UPDATE convex_gotchas SET content = ?, category = ?, severity = ?, tags = ?, source = 'user', updated_at = datetime('now') WHERE key = ?").run(args.content, args.category, args.severity || "warning", args.tags || "", args.key);
|
|
41
|
+
return {
|
|
42
|
+
action: "updated",
|
|
43
|
+
key: args.key,
|
|
44
|
+
quickRef: getQuickRef("convex_record_gotcha"),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
db.prepare("INSERT INTO convex_gotchas (key, content, category, severity, tags, source) VALUES (?, ?, ?, ?, ?, 'user')").run(args.key, args.content, args.category, args.severity || "warning", args.tags || "");
|
|
48
|
+
return {
|
|
49
|
+
action: "created",
|
|
50
|
+
key: args.key,
|
|
51
|
+
quickRef: getQuickRef("convex_record_gotcha"),
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "convex_search_gotchas",
|
|
57
|
+
description: "Search the persistent Convex gotcha database using full-text search. Returns relevant gotchas, edge cases, and patterns. Always search before starting a new Convex implementation to avoid known pitfalls.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
query: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "What you're about to implement or the issue you're hitting (e.g., 'array validator', 'index query order', 'action runtime')",
|
|
64
|
+
},
|
|
65
|
+
category: {
|
|
66
|
+
type: "string",
|
|
67
|
+
enum: ["validator", "schema", "function", "deployment", "auth", "performance", "general"],
|
|
68
|
+
description: "Optional: filter by category",
|
|
69
|
+
},
|
|
70
|
+
limit: {
|
|
71
|
+
type: "number",
|
|
72
|
+
description: "Max results (default 10)",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
required: ["query"],
|
|
76
|
+
},
|
|
77
|
+
handler: async (args) => {
|
|
78
|
+
const db = getDb();
|
|
79
|
+
const limit = args.limit || 10;
|
|
80
|
+
let results;
|
|
81
|
+
try {
|
|
82
|
+
// FTS5 search
|
|
83
|
+
let sql = `
|
|
84
|
+
SELECT g.*, rank
|
|
85
|
+
FROM convex_gotchas g
|
|
86
|
+
JOIN convex_gotchas_fts fts ON g.id = fts.rowid
|
|
87
|
+
WHERE convex_gotchas_fts MATCH ?
|
|
88
|
+
`;
|
|
89
|
+
const params = [args.query];
|
|
90
|
+
if (args.category) {
|
|
91
|
+
sql += " AND g.category = ?";
|
|
92
|
+
params.push(args.category);
|
|
93
|
+
}
|
|
94
|
+
sql += " ORDER BY rank LIMIT ?";
|
|
95
|
+
params.push(limit);
|
|
96
|
+
results = db.prepare(sql).all(...params);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Fallback to LIKE search with JS-side BM25 scoring
|
|
100
|
+
let sql = "SELECT * FROM convex_gotchas WHERE (key LIKE ? OR content LIKE ? OR tags LIKE ?)";
|
|
101
|
+
const likeTerm = `%${args.query}%`;
|
|
102
|
+
const params = [likeTerm, likeTerm, likeTerm];
|
|
103
|
+
if (args.category) {
|
|
104
|
+
sql += " AND category = ?";
|
|
105
|
+
params.push(args.category);
|
|
106
|
+
}
|
|
107
|
+
sql += " LIMIT 100"; // Fetch more, then rank and trim
|
|
108
|
+
const raw = db.prepare(sql).all(...params);
|
|
109
|
+
// BM25-style scoring on LIKE results (field-weighted)
|
|
110
|
+
const queryTerms = args.query.toLowerCase().match(/[a-z_]+/g) ?? [];
|
|
111
|
+
if (queryTerms.length > 0 && raw.length > 1) {
|
|
112
|
+
const avgLen = raw.reduce((s, r) => s + (r.content?.length ?? 0), 0) / raw.length || 1;
|
|
113
|
+
const scored = raw.map((r) => {
|
|
114
|
+
const keyText = (r.key ?? "").toLowerCase();
|
|
115
|
+
const contentText = (r.content ?? "").toLowerCase();
|
|
116
|
+
const tagsText = (r.tags ?? "").toLowerCase();
|
|
117
|
+
const dl = contentText.length;
|
|
118
|
+
let score = 0;
|
|
119
|
+
for (const qt of queryTerms) {
|
|
120
|
+
// Field-weighted term frequency: key 3x, tags 2x, content 1x
|
|
121
|
+
const keyHits = (keyText.match(new RegExp(qt, "g")) ?? []).length * 3;
|
|
122
|
+
const tagHits = (tagsText.match(new RegExp(qt, "g")) ?? []).length * 2;
|
|
123
|
+
const contentHits = (contentText.match(new RegExp(qt, "g")) ?? []).length;
|
|
124
|
+
const tf = keyHits + tagHits + contentHits;
|
|
125
|
+
if (tf === 0)
|
|
126
|
+
continue;
|
|
127
|
+
// BM25 saturation + length normalization
|
|
128
|
+
const k1 = 1.2, b = 0.75;
|
|
129
|
+
score += (tf * (k1 + 1)) / (tf + k1 * (1 - b + b * (dl / avgLen)));
|
|
130
|
+
}
|
|
131
|
+
return { ...r, _score: score };
|
|
132
|
+
});
|
|
133
|
+
scored.sort((a, b) => b._score - a._score);
|
|
134
|
+
results = scored.slice(0, limit);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
results = raw.slice(0, limit);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
totalResults: results.length,
|
|
142
|
+
gotchas: results.map((r) => ({
|
|
143
|
+
key: r.key,
|
|
144
|
+
content: r.content,
|
|
145
|
+
category: r.category,
|
|
146
|
+
severity: r.severity,
|
|
147
|
+
tags: r.tags,
|
|
148
|
+
source: r.source,
|
|
149
|
+
})),
|
|
150
|
+
quickRef: getQuickRef("convex_search_gotchas"),
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
];
|
|
155
|
+
//# sourceMappingURL=learningTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"learningTools.js","sourceRoot":"","sources":["../../src/tools/learningTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAS,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,wNAAwN;QAC1N,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE;oBACH,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qFAAqF;iBACnG;gBACD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AAC,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;wBACrE,CAAC;wBACD,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;oBACjC,CAAC,CAAC,CAAC;oBACH,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;oBAC3C,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBACnC,CAAC;qBAAM,CAAC;oBACN,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;YAED,OAAO;gBACL,YAAY,EAAE,OAAO,CAAC,MAAM;gBAC5B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC;oBAChC,GAAG,EAAE,CAAC,CAAC,GAAG;oBACV,OAAO,EAAE,CAAC,CAAC,OAAO;oBAClB,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,QAAQ,EAAE,CAAC,CAAC,QAAQ;oBACpB,IAAI,EAAE,CAAC,CAAC,IAAI;oBACZ,MAAM,EAAE,CAAC,CAAC,MAAM;iBACjB,CAAC,CAAC;gBACH,QAAQ,EAAE,WAAW,CAAC,uBAAuB,CAAC;aAC/C,CAAC;QACJ,CAAC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { findTools, REGISTRY } from "./toolRegistry.js";
|
|
2
|
+
import { getQuickRef } from "./toolRegistry.js";
|
|
3
|
+
// ── Methodology Content ─────────────────────────────────────────────
|
|
4
|
+
const METHODOLOGY_CONTENT = {
|
|
5
|
+
overview: {
|
|
6
|
+
title: "convex-mcp-nodebench Methodology Overview",
|
|
7
|
+
description: "All available methodologies for Convex development with self-instruct guidance.",
|
|
8
|
+
steps: [
|
|
9
|
+
"1. convex_schema_audit — Audit schema.ts for anti-patterns before any schema change",
|
|
10
|
+
"2. convex_function_compliance — Ensure all functions have validators and correct registration",
|
|
11
|
+
"3. convex_deploy_verification — Pre-deploy quality gate with comprehensive checks",
|
|
12
|
+
"4. convex_knowledge_management — Record and search gotchas to prevent repeat mistakes",
|
|
13
|
+
"5. convex_index_optimization — Analyze query patterns and suggest optimal indexes",
|
|
14
|
+
],
|
|
15
|
+
tools: ["convex_discover_tools", "convex_get_methodology"],
|
|
16
|
+
},
|
|
17
|
+
convex_schema_audit: {
|
|
18
|
+
title: "Schema Audit Methodology",
|
|
19
|
+
description: "Systematically verify your Convex schema.ts for correctness, performance, and best practices.",
|
|
20
|
+
steps: [
|
|
21
|
+
"1. Run convex_audit_schema to scan schema.ts for anti-patterns (deprecated validators, reserved field names, missing indexes)",
|
|
22
|
+
"2. Review each issue by severity: fix CRITICAL first, then WARNING, then INFO",
|
|
23
|
+
"3. Run convex_suggest_indexes to find query patterns that need index support",
|
|
24
|
+
"4. Add suggested indexes to schema.ts with proper naming (by_field1_and_field2)",
|
|
25
|
+
"5. Run convex_check_validator_coverage to ensure all functions have arg + return validators",
|
|
26
|
+
"6. Run convex_audit_schema again to verify all issues are resolved",
|
|
27
|
+
"7. Run convex_pre_deploy_gate before deploying",
|
|
28
|
+
],
|
|
29
|
+
tools: ["convex_audit_schema", "convex_suggest_indexes", "convex_check_validator_coverage", "convex_pre_deploy_gate"],
|
|
30
|
+
},
|
|
31
|
+
convex_function_compliance: {
|
|
32
|
+
title: "Function Compliance Methodology",
|
|
33
|
+
description: "Ensure all Convex functions follow best practices for registration, validators, and access control.",
|
|
34
|
+
steps: [
|
|
35
|
+
"1. Run convex_audit_functions to scan all exported functions for issues",
|
|
36
|
+
"2. Fix critical issues: add missing args/returns validators, switch to new syntax",
|
|
37
|
+
"3. Review public vs internal: sensitive functions (admin, delete, purge, migrate) should be internal",
|
|
38
|
+
"4. Run convex_check_function_refs to validate all api.x.y and internal.x.y references",
|
|
39
|
+
"5. Fix any direct function passing (use api.x.y references instead)",
|
|
40
|
+
"6. Check for action-from-action anti-patterns (extract to helper functions)",
|
|
41
|
+
"7. Re-run convex_audit_functions to verify compliance",
|
|
42
|
+
],
|
|
43
|
+
tools: ["convex_audit_functions", "convex_check_function_refs", "convex_check_validator_coverage"],
|
|
44
|
+
},
|
|
45
|
+
convex_deploy_verification: {
|
|
46
|
+
title: "Deploy Verification Methodology",
|
|
47
|
+
description: "Comprehensive pre-deployment checklist ensuring your Convex project is ready to ship.",
|
|
48
|
+
steps: [
|
|
49
|
+
"1. Run convex_audit_schema — fix all critical schema issues",
|
|
50
|
+
"2. Run convex_audit_functions — fix all critical function issues",
|
|
51
|
+
"3. Run convex_check_env_vars — ensure all required env vars are set",
|
|
52
|
+
"4. Run convex_pre_deploy_gate — this runs the full gate check",
|
|
53
|
+
"5. Fix all blockers reported by the gate",
|
|
54
|
+
"6. Run npx convex deploy only after the gate passes",
|
|
55
|
+
"7. Record any new gotchas discovered during deploy with convex_record_gotcha",
|
|
56
|
+
],
|
|
57
|
+
tools: ["convex_audit_schema", "convex_audit_functions", "convex_check_env_vars", "convex_pre_deploy_gate", "convex_record_gotcha"],
|
|
58
|
+
},
|
|
59
|
+
convex_knowledge_management: {
|
|
60
|
+
title: "Knowledge Management Methodology",
|
|
61
|
+
description: "Build and leverage a persistent knowledge base of Convex gotchas, edge cases, and patterns.",
|
|
62
|
+
steps: [
|
|
63
|
+
"1. BEFORE implementing: run convex_search_gotchas with your task description",
|
|
64
|
+
"2. Apply any relevant gotchas to your implementation plan",
|
|
65
|
+
"3. During development: if you hit a non-obvious issue, record it with convex_record_gotcha",
|
|
66
|
+
"4. After fixing bugs: record the root cause and fix as a gotcha",
|
|
67
|
+
"5. Categories: validator, schema, function, deployment, auth, performance, general",
|
|
68
|
+
"6. Use severity levels: critical (will break), warning (may cause issues), info (best practice)",
|
|
69
|
+
],
|
|
70
|
+
tools: ["convex_search_gotchas", "convex_record_gotcha"],
|
|
71
|
+
},
|
|
72
|
+
convex_index_optimization: {
|
|
73
|
+
title: "Index Optimization Methodology",
|
|
74
|
+
description: "Optimize query performance by analyzing access patterns and adding appropriate indexes.",
|
|
75
|
+
steps: [
|
|
76
|
+
"1. Run convex_suggest_indexes to scan all query patterns",
|
|
77
|
+
"2. Review each suggestion: does the query pattern warrant an index?",
|
|
78
|
+
"3. For composite queries, ensure index field order matches query filter order",
|
|
79
|
+
"4. Add indexes to schema.ts following naming convention: by_field1_and_field2",
|
|
80
|
+
"5. Remember: index fields must be queried in the SAME ORDER they are defined",
|
|
81
|
+
"6. If you need different query orders, create separate indexes",
|
|
82
|
+
"7. Run convex_audit_schema to verify index naming conventions",
|
|
83
|
+
],
|
|
84
|
+
tools: ["convex_suggest_indexes", "convex_audit_schema"],
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
// ── Tool Definitions ────────────────────────────────────────────────
|
|
88
|
+
export const methodologyTools = [
|
|
89
|
+
{
|
|
90
|
+
name: "convex_get_methodology",
|
|
91
|
+
description: "Get step-by-step guidance for Convex development workflows. Topics: overview, convex_schema_audit, convex_function_compliance, convex_deploy_verification, convex_knowledge_management, convex_index_optimization. Call with 'overview' to see all available methodologies.",
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: "object",
|
|
94
|
+
properties: {
|
|
95
|
+
topic: {
|
|
96
|
+
type: "string",
|
|
97
|
+
enum: [
|
|
98
|
+
"overview",
|
|
99
|
+
"convex_schema_audit",
|
|
100
|
+
"convex_function_compliance",
|
|
101
|
+
"convex_deploy_verification",
|
|
102
|
+
"convex_knowledge_management",
|
|
103
|
+
"convex_index_optimization",
|
|
104
|
+
],
|
|
105
|
+
description: "Which methodology to explain",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
required: ["topic"],
|
|
109
|
+
},
|
|
110
|
+
handler: async (args) => {
|
|
111
|
+
const content = METHODOLOGY_CONTENT[args.topic];
|
|
112
|
+
if (!content) {
|
|
113
|
+
return {
|
|
114
|
+
error: `Unknown topic: ${args.topic}`,
|
|
115
|
+
availableTopics: Object.keys(METHODOLOGY_CONTENT),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
...content,
|
|
120
|
+
quickRef: getQuickRef("convex_get_methodology"),
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "convex_discover_tools",
|
|
126
|
+
description: "Search for available convex-mcp-nodebench tools by keyword, category, or task description. Returns matching tools with descriptions and quickRefs to guide your next action.",
|
|
127
|
+
inputSchema: {
|
|
128
|
+
type: "object",
|
|
129
|
+
properties: {
|
|
130
|
+
query: {
|
|
131
|
+
type: "string",
|
|
132
|
+
description: "What you want to do (e.g., 'check schema', 'deploy', 'find gotchas', 'audit functions')",
|
|
133
|
+
},
|
|
134
|
+
category: {
|
|
135
|
+
type: "string",
|
|
136
|
+
enum: ["schema", "function", "deployment", "learning", "methodology", "integration"],
|
|
137
|
+
description: "Optional: filter by tool category",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: ["query"],
|
|
141
|
+
},
|
|
142
|
+
handler: async (args) => {
|
|
143
|
+
let results = findTools(args.query);
|
|
144
|
+
if (args.category) {
|
|
145
|
+
results = results.filter((r) => r.category === args.category);
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
totalTools: REGISTRY.length,
|
|
149
|
+
matchingTools: results.length,
|
|
150
|
+
tools: results.map((r) => ({
|
|
151
|
+
name: r.name,
|
|
152
|
+
category: r.category,
|
|
153
|
+
phase: r.phase,
|
|
154
|
+
complexity: r.complexity,
|
|
155
|
+
tags: r.tags,
|
|
156
|
+
quickRef: r.quickRef,
|
|
157
|
+
})),
|
|
158
|
+
quickRef: getQuickRef("convex_discover_tools"),
|
|
159
|
+
};
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
//# sourceMappingURL=methodologyTools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methodologyTools.js","sourceRoot":"","sources":["../../src/tools/methodologyTools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD,uEAAuE;AAEvE,MAAM,mBAAmB,GAA6F;IACpH,QAAQ,EAAE;QACR,KAAK,EAAE,2CAA2C;QAClD,WAAW,EAAE,iFAAiF;QAC9F,KAAK,EAAE;YACL,qFAAqF;YACrF,+FAA+F;YAC/F,mFAAmF;YACnF,uFAAuF;YACvF,mFAAmF;SACpF;QACD,KAAK,EAAE,CAAC,uBAAuB,EAAE,wBAAwB,CAAC;KAC3D;IACD,mBAAmB,EAAE;QACnB,KAAK,EAAE,0BAA0B;QACjC,WAAW,EAAE,+FAA+F;QAC5G,KAAK,EAAE;YACL,+HAA+H;YAC/H,+EAA+E;YAC/E,8EAA8E;YAC9E,iFAAiF;YACjF,6FAA6F;YAC7F,oEAAoE;YACpE,gDAAgD;SACjD;QACD,KAAK,EAAE,CAAC,qBAAqB,EAAE,wBAAwB,EAAE,iCAAiC,EAAE,wBAAwB,CAAC;KACtH;IACD,0BAA0B,EAAE;QAC1B,KAAK,EAAE,iCAAiC;QACxC,WAAW,EAAE,qGAAqG;QAClH,KAAK,EAAE;YACL,yEAAyE;YACzE,mFAAmF;YACnF,sGAAsG;YACtG,uFAAuF;YACvF,qEAAqE;YACrE,6EAA6E;YAC7E,uDAAuD;SACxD;QACD,KAAK,EAAE,CAAC,wBAAwB,EAAE,4BAA4B,EAAE,iCAAiC,CAAC;KACnG;IACD,0BAA0B,EAAE;QAC1B,KAAK,EAAE,iCAAiC;QACxC,WAAW,EAAE,uFAAuF;QACpG,KAAK,EAAE;YACL,6DAA6D;YAC7D,kEAAkE;YAClE,qEAAqE;YACrE,+DAA+D;YAC/D,0CAA0C;YAC1C,q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