@agentbridge1/cli 0.0.10 → 0.0.11
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/build-info.json +3 -3
- package/dist/commands/watch.js +116 -9
- package/dist/contract-intelligence.js +45 -18
- package/dist/contract-verdict.js +9 -2
- package/dist/domain-keywords.js +119 -0
- package/dist/index.js +4 -0
- package/dist/intent-parser.js +8 -20
- package/dist/mcp/agentbridge-mcp.js +124 -26
- package/dist/mcp/agentbridge-mcp.js.map +4 -4
- package/dist/proof-parser.js +24 -25
- package/dist/test-runner.js +134 -46
- package/package.json +1 -1
|
@@ -21020,24 +21020,127 @@ var import_node_path2 = require("node:path");
|
|
|
21020
21020
|
// src/session.ts
|
|
21021
21021
|
var import_node_child_process2 = require("node:child_process");
|
|
21022
21022
|
|
|
21023
|
-
// src/
|
|
21024
|
-
var
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21023
|
+
// src/domain-keywords.ts
|
|
21024
|
+
var DOMAIN_KEYWORDS = {
|
|
21025
|
+
auth: [
|
|
21026
|
+
"auth",
|
|
21027
|
+
"login",
|
|
21028
|
+
"logout",
|
|
21029
|
+
"session",
|
|
21030
|
+
"token",
|
|
21031
|
+
"oauth",
|
|
21032
|
+
"jwt",
|
|
21033
|
+
"password",
|
|
21034
|
+
"signin",
|
|
21035
|
+
"sign-in",
|
|
21036
|
+
"signup",
|
|
21037
|
+
"sign-up",
|
|
21038
|
+
"register",
|
|
21039
|
+
"registration",
|
|
21040
|
+
"credential",
|
|
21041
|
+
"credentials",
|
|
21042
|
+
"permission",
|
|
21043
|
+
"permissions",
|
|
21044
|
+
"role",
|
|
21045
|
+
"roles",
|
|
21046
|
+
"unauthorized",
|
|
21047
|
+
"unauthenticated",
|
|
21048
|
+
"authenticate",
|
|
21049
|
+
"authentication",
|
|
21050
|
+
"authorize",
|
|
21051
|
+
"authorization"
|
|
21052
|
+
],
|
|
21053
|
+
database: [
|
|
21054
|
+
"database",
|
|
21055
|
+
"db",
|
|
21056
|
+
"schema",
|
|
21057
|
+
"migration",
|
|
21058
|
+
"migrate",
|
|
21059
|
+
"prisma",
|
|
21060
|
+
"sql",
|
|
21061
|
+
"query",
|
|
21062
|
+
"table",
|
|
21063
|
+
"column",
|
|
21064
|
+
"index",
|
|
21065
|
+
"model",
|
|
21066
|
+
"entity",
|
|
21067
|
+
"seed",
|
|
21068
|
+
"orm"
|
|
21069
|
+
],
|
|
21070
|
+
payments: [
|
|
21071
|
+
"payment",
|
|
21072
|
+
"payments",
|
|
21073
|
+
"billing",
|
|
21074
|
+
"stripe",
|
|
21075
|
+
"invoice",
|
|
21076
|
+
"subscription",
|
|
21077
|
+
"checkout",
|
|
21078
|
+
"webhook",
|
|
21079
|
+
"charge"
|
|
21080
|
+
],
|
|
21029
21081
|
api: ["api", "endpoint", "route", "handler", "controller", "request", "response", "rest", "graphql"],
|
|
21030
|
-
ui: [
|
|
21031
|
-
|
|
21082
|
+
ui: [
|
|
21083
|
+
"ui",
|
|
21084
|
+
"style",
|
|
21085
|
+
"css",
|
|
21086
|
+
"component",
|
|
21087
|
+
"page",
|
|
21088
|
+
"layout",
|
|
21089
|
+
"copy",
|
|
21090
|
+
"design",
|
|
21091
|
+
"render",
|
|
21092
|
+
"display",
|
|
21093
|
+
"view",
|
|
21094
|
+
"frontend",
|
|
21095
|
+
"html",
|
|
21096
|
+
"template",
|
|
21097
|
+
"dashboard",
|
|
21098
|
+
"button",
|
|
21099
|
+
"theme"
|
|
21100
|
+
],
|
|
21101
|
+
mcp: ["mcp", "agentbridge", "cursor", "rules", "configuration", "config", "setup", "install"],
|
|
21032
21102
|
tests: ["test", "tests", "spec", "vitest", "jest", "coverage", "proof"]
|
|
21033
21103
|
};
|
|
21104
|
+
var BOUNDARY_ALNUM = "a-z0-9";
|
|
21105
|
+
var REGEX_CACHE = /* @__PURE__ */ new Map();
|
|
21106
|
+
function escapeRegex2(value) {
|
|
21107
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
21108
|
+
}
|
|
21109
|
+
function keywordRegex(keyword) {
|
|
21110
|
+
const normalized = keyword.trim().toLowerCase();
|
|
21111
|
+
const cached2 = REGEX_CACHE.get(normalized);
|
|
21112
|
+
if (cached2) return cached2;
|
|
21113
|
+
const pattern = `(^|[^${BOUNDARY_ALNUM}])${escapeRegex2(normalized)}([^${BOUNDARY_ALNUM}]|$)`;
|
|
21114
|
+
const compiled = new RegExp(pattern);
|
|
21115
|
+
REGEX_CACHE.set(normalized, compiled);
|
|
21116
|
+
return compiled;
|
|
21117
|
+
}
|
|
21118
|
+
function matchesKeywordBoundary(text, keyword) {
|
|
21119
|
+
const normalizedText = text.toLowerCase();
|
|
21120
|
+
return keywordRegex(keyword).test(normalizedText);
|
|
21121
|
+
}
|
|
21122
|
+
function matchesAnyKeywordBoundary(text, keywords) {
|
|
21123
|
+
return keywords.some((keyword) => matchesKeywordBoundary(text, keyword));
|
|
21124
|
+
}
|
|
21125
|
+
function matchesDomainKeywords(text, domain) {
|
|
21126
|
+
return matchesAnyKeywordBoundary(text, DOMAIN_KEYWORDS[domain]);
|
|
21127
|
+
}
|
|
21128
|
+
function detectDomainFromKeywords(text, domainOrder = ["auth", "database", "payments", "api", "ui", "mcp", "tests"]) {
|
|
21129
|
+
for (const domain of domainOrder) {
|
|
21130
|
+
if (matchesDomainKeywords(text, domain)) return domain;
|
|
21131
|
+
}
|
|
21132
|
+
return null;
|
|
21133
|
+
}
|
|
21134
|
+
|
|
21135
|
+
// src/intent-parser.ts
|
|
21136
|
+
var ACTIONS = ["fix", "add", "update", "refactor", "remove", "migrate", "rename", "revert", "delete", "implement", "improve", "patch"];
|
|
21034
21137
|
var SYMPTOMS = {
|
|
21035
21138
|
"401": ["401", "unauthorized", "unauthenticated"],
|
|
21036
21139
|
"403": ["403", "forbidden"],
|
|
21037
21140
|
"404": ["404", "not found", "notfound"],
|
|
21038
21141
|
"500": ["500", "internal server error", "server error"],
|
|
21039
21142
|
"null": ["null", "undefined", "nan", "nil"],
|
|
21040
|
-
"crash": ["crash", "crashes", "crashed", "exception", "throws", "throw"],
|
|
21143
|
+
"crash": ["crash", "crashes", "crashed", "crashing", "exception", "throws", "throw"],
|
|
21041
21144
|
"loop": ["loop", "infinite loop", "recursion"],
|
|
21042
21145
|
"hang": ["hang", "hangs", "timeout", "deadlock"],
|
|
21043
21146
|
"slow": ["slow", "performance", "latency", "memory leak", "memory"],
|
|
@@ -21050,20 +21153,17 @@ var PASCAL_RE = /\b([A-Z][a-z]+(?:[A-Z][a-z]*)+)\b/g;
|
|
|
21050
21153
|
var CAMEL_FN_RE = /\b([a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+)\b/g;
|
|
21051
21154
|
var QUOTED_RE = /"([^"]+)"|'([^']+)'/g;
|
|
21052
21155
|
function detectDomain(lower) {
|
|
21053
|
-
|
|
21054
|
-
if (keywords.some((kw) => lower.includes(kw))) return domain;
|
|
21055
|
-
}
|
|
21056
|
-
return null;
|
|
21156
|
+
return detectDomainFromKeywords(lower);
|
|
21057
21157
|
}
|
|
21058
21158
|
function detectAction(lower) {
|
|
21059
21159
|
for (const action of ACTIONS) {
|
|
21060
|
-
if (
|
|
21160
|
+
if (matchesKeywordBoundary(lower, action)) return action;
|
|
21061
21161
|
}
|
|
21062
21162
|
return null;
|
|
21063
21163
|
}
|
|
21064
21164
|
function detectSymptom(lower) {
|
|
21065
21165
|
for (const [symptom, patterns] of Object.entries(SYMPTOMS)) {
|
|
21066
|
-
if (
|
|
21166
|
+
if (matchesAnyKeywordBoundary(lower, patterns)) return symptom;
|
|
21067
21167
|
}
|
|
21068
21168
|
return null;
|
|
21069
21169
|
}
|
|
@@ -21423,31 +21523,29 @@ var GENERIC_PROFILE = "generic";
|
|
|
21423
21523
|
function unique(values) {
|
|
21424
21524
|
return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
|
|
21425
21525
|
}
|
|
21426
|
-
|
|
21427
|
-
|
|
21428
|
-
return keywords.some((keyword) => lower.includes(keyword));
|
|
21429
|
-
}
|
|
21526
|
+
var MCP_ENTITY_KEYWORDS = ["mcp", "agentbridge", "cursor"];
|
|
21527
|
+
var MCP_ACTION_KEYWORDS = ["rule", "rules", "install", "setup", "config", "configuration"];
|
|
21430
21528
|
function detectProfiles(intent) {
|
|
21431
21529
|
const profiles = [];
|
|
21432
|
-
if (
|
|
21530
|
+
if (matchesAnyKeywordBoundary(intent, MCP_ENTITY_KEYWORDS) && matchesAnyKeywordBoundary(intent, MCP_ACTION_KEYWORDS)) {
|
|
21433
21531
|
profiles.push(MCP_RULE_PROFILE);
|
|
21434
21532
|
}
|
|
21435
|
-
if (
|
|
21533
|
+
if (matchesDomainKeywords(intent, "auth")) {
|
|
21436
21534
|
profiles.push(AUTH_PROFILE);
|
|
21437
21535
|
}
|
|
21438
|
-
if (
|
|
21536
|
+
if (matchesDomainKeywords(intent, "database")) {
|
|
21439
21537
|
profiles.push(DB_PROFILE);
|
|
21440
21538
|
}
|
|
21441
|
-
if (
|
|
21539
|
+
if (matchesDomainKeywords(intent, "ui")) {
|
|
21442
21540
|
profiles.push(UI_PROFILE);
|
|
21443
21541
|
}
|
|
21444
|
-
if (
|
|
21542
|
+
if (matchesDomainKeywords(intent, "api")) {
|
|
21445
21543
|
profiles.push(API_PROFILE);
|
|
21446
21544
|
}
|
|
21447
|
-
if (
|
|
21545
|
+
if (matchesDomainKeywords(intent, "tests")) {
|
|
21448
21546
|
profiles.push(TEST_PROFILE);
|
|
21449
21547
|
}
|
|
21450
|
-
if (
|
|
21548
|
+
if (matchesDomainKeywords(intent, "payments")) {
|
|
21451
21549
|
profiles.push(PAYMENTS_PROFILE);
|
|
21452
21550
|
}
|
|
21453
21551
|
return profiles.length > 0 ? profiles : [GENERIC_PROFILE];
|