@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.
@@ -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/intent-parser.ts
21024
- var ACTIONS = ["fix", "add", "update", "refactor", "remove", "migrate", "rename", "revert", "delete", "implement", "improve", "patch"];
21025
- var DOMAIN_KEYWORD_MAP = {
21026
- auth: ["auth", "login", "logout", "session", "token", "oauth", "jwt", "password", "signin", "signup", "sign-in", "sign-up", "register", "credential", "permission", "role"],
21027
- database: ["database", "db", "schema", "migration", "migrate", "prisma", "sql", "query", "table", "column", "index", "model", "seed", "orm"],
21028
- payments: ["payment", "payments", "billing", "stripe", "invoice", "subscription", "checkout", "webhook"],
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: ["ui", "style", "css", "component", "page", "layout", "copy", "design", "render", "display", "view", "frontend", "html", "template"],
21031
- mcp: ["mcp", "agentbridge", "cursor", "rules"],
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
- for (const [domain, keywords] of Object.entries(DOMAIN_KEYWORD_MAP)) {
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 (lower.startsWith(action) || lower.includes(` ${action} `)) return action;
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 (patterns.some((p) => lower.includes(p))) return symptom;
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
- function matchIntent(intent, keywords) {
21427
- const lower = intent.toLowerCase();
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 (matchIntent(intent, ["mcp"]) && matchIntent(intent, ["rule", "rules", "install", "setup", "config", "configuration"])) {
21530
+ if (matchesAnyKeywordBoundary(intent, MCP_ENTITY_KEYWORDS) && matchesAnyKeywordBoundary(intent, MCP_ACTION_KEYWORDS)) {
21433
21531
  profiles.push(MCP_RULE_PROFILE);
21434
21532
  }
21435
- if (matchIntent(intent, ["auth", "login", "session", "token", "oauth"])) {
21533
+ if (matchesDomainKeywords(intent, "auth")) {
21436
21534
  profiles.push(AUTH_PROFILE);
21437
21535
  }
21438
- if (matchIntent(intent, ["database", "db", "schema", "migration", "prisma", "sql"])) {
21536
+ if (matchesDomainKeywords(intent, "database")) {
21439
21537
  profiles.push(DB_PROFILE);
21440
21538
  }
21441
- if (matchIntent(intent, ["ui", "style", "css", "copy", "layout", "component"])) {
21539
+ if (matchesDomainKeywords(intent, "ui")) {
21442
21540
  profiles.push(UI_PROFILE);
21443
21541
  }
21444
- if (matchIntent(intent, ["api", "endpoint", "route", "handler", "controller"])) {
21542
+ if (matchesDomainKeywords(intent, "api")) {
21445
21543
  profiles.push(API_PROFILE);
21446
21544
  }
21447
- if (matchIntent(intent, ["test", "tests", "vitest", "jest", "proof"])) {
21545
+ if (matchesDomainKeywords(intent, "tests")) {
21448
21546
  profiles.push(TEST_PROFILE);
21449
21547
  }
21450
- if (matchIntent(intent, ["payment", "payments", "billing", "stripe", "webhook"])) {
21548
+ if (matchesDomainKeywords(intent, "payments")) {
21451
21549
  profiles.push(PAYMENTS_PROFILE);
21452
21550
  }
21453
21551
  return profiles.length > 0 ? profiles : [GENERIC_PROFILE];