@agentbridge1/cli 0.0.9 → 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.
@@ -0,0 +1,119 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DOMAIN_KEYWORDS = void 0;
4
+ exports.matchesKeywordBoundary = matchesKeywordBoundary;
5
+ exports.matchesAnyKeywordBoundary = matchesAnyKeywordBoundary;
6
+ exports.matchesDomainKeywords = matchesDomainKeywords;
7
+ exports.detectDomainFromKeywords = detectDomainFromKeywords;
8
+ exports.DOMAIN_KEYWORDS = {
9
+ auth: [
10
+ "auth",
11
+ "login",
12
+ "logout",
13
+ "session",
14
+ "token",
15
+ "oauth",
16
+ "jwt",
17
+ "password",
18
+ "signin",
19
+ "sign-in",
20
+ "signup",
21
+ "sign-up",
22
+ "register",
23
+ "registration",
24
+ "credential",
25
+ "credentials",
26
+ "permission",
27
+ "permissions",
28
+ "role",
29
+ "roles",
30
+ "unauthorized",
31
+ "unauthenticated",
32
+ "authenticate",
33
+ "authentication",
34
+ "authorize",
35
+ "authorization",
36
+ ],
37
+ database: [
38
+ "database",
39
+ "db",
40
+ "schema",
41
+ "migration",
42
+ "migrate",
43
+ "prisma",
44
+ "sql",
45
+ "query",
46
+ "table",
47
+ "column",
48
+ "index",
49
+ "model",
50
+ "entity",
51
+ "seed",
52
+ "orm",
53
+ ],
54
+ payments: [
55
+ "payment",
56
+ "payments",
57
+ "billing",
58
+ "stripe",
59
+ "invoice",
60
+ "subscription",
61
+ "checkout",
62
+ "webhook",
63
+ "charge",
64
+ ],
65
+ api: ["api", "endpoint", "route", "handler", "controller", "request", "response", "rest", "graphql"],
66
+ ui: [
67
+ "ui",
68
+ "style",
69
+ "css",
70
+ "component",
71
+ "page",
72
+ "layout",
73
+ "copy",
74
+ "design",
75
+ "render",
76
+ "display",
77
+ "view",
78
+ "frontend",
79
+ "html",
80
+ "template",
81
+ "dashboard",
82
+ "button",
83
+ "theme",
84
+ ],
85
+ mcp: ["mcp", "agentbridge", "cursor", "rules", "configuration", "config", "setup", "install"],
86
+ tests: ["test", "tests", "spec", "vitest", "jest", "coverage", "proof"],
87
+ };
88
+ const BOUNDARY_ALNUM = "a-z0-9";
89
+ const REGEX_CACHE = new Map();
90
+ function escapeRegex(value) {
91
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
92
+ }
93
+ function keywordRegex(keyword) {
94
+ const normalized = keyword.trim().toLowerCase();
95
+ const cached = REGEX_CACHE.get(normalized);
96
+ if (cached)
97
+ return cached;
98
+ const pattern = `(^|[^${BOUNDARY_ALNUM}])${escapeRegex(normalized)}([^${BOUNDARY_ALNUM}]|$)`;
99
+ const compiled = new RegExp(pattern);
100
+ REGEX_CACHE.set(normalized, compiled);
101
+ return compiled;
102
+ }
103
+ function matchesKeywordBoundary(text, keyword) {
104
+ const normalizedText = text.toLowerCase();
105
+ return keywordRegex(keyword).test(normalizedText);
106
+ }
107
+ function matchesAnyKeywordBoundary(text, keywords) {
108
+ return keywords.some((keyword) => matchesKeywordBoundary(text, keyword));
109
+ }
110
+ function matchesDomainKeywords(text, domain) {
111
+ return matchesAnyKeywordBoundary(text, exports.DOMAIN_KEYWORDS[domain]);
112
+ }
113
+ function detectDomainFromKeywords(text, domainOrder = ["auth", "database", "payments", "api", "ui", "mcp", "tests"]) {
114
+ for (const domain of domainOrder) {
115
+ if (matchesDomainKeywords(text, domain))
116
+ return domain;
117
+ }
118
+ return null;
119
+ }
@@ -13,7 +13,10 @@ function normalizePath(path) {
13
13
  }
14
14
  function isAgentbridgeLocalPath(path) {
15
15
  const normalized = normalizePath(path);
16
- return normalized === ".agentbridge" || normalized.startsWith(".agentbridge/");
16
+ const lower = normalized.toLowerCase();
17
+ if (lower === ".agentbridge" || lower.endsWith("/.agentbridge"))
18
+ return true;
19
+ return lower.includes(".agentbridge/");
17
20
  }
18
21
  function isRenameOrCopy(xy) {
19
22
  return xy.includes("R") || xy.includes("C");
package/dist/index.js CHANGED
@@ -262,6 +262,10 @@ async function main() {
262
262
  if (command === "--help" || command === "help") {
263
263
  usage(undefined, { exitCode: 0, stream: "stdout" });
264
264
  }
265
+ if (command === "--version" || command === "-V" || command === "-v") {
266
+ (0, version_1.runVersion)();
267
+ return;
268
+ }
265
269
  // --help on any subcommand
266
270
  if (flags["--help"] === "true") {
267
271
  usage(command, { exitCode: 0, stream: "stdout" });
@@ -1,28 +1,20 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseIntent = parseIntent;
4
+ exports.buildTaskSpecificCriteria = buildTaskSpecificCriteria;
2
5
  /**
3
6
  * Intent parser — extracts structured task specification from a raw intent string.
4
7
  * All logic is deterministic: no LLM, no external calls.
5
8
  */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.parseIntent = parseIntent;
8
- exports.buildTaskSpecificCriteria = buildTaskSpecificCriteria;
9
+ const domain_keywords_1 = require("./domain-keywords");
9
10
  const ACTIONS = ["fix", "add", "update", "refactor", "remove", "migrate", "rename", "revert", "delete", "implement", "improve", "patch"];
10
- const DOMAIN_KEYWORD_MAP = {
11
- auth: ["auth", "login", "logout", "session", "token", "oauth", "jwt", "password", "signin", "signup", "sign-in", "sign-up", "register", "credential", "permission", "role"],
12
- database: ["database", "db", "schema", "migration", "migrate", "prisma", "sql", "query", "table", "column", "index", "model", "seed", "orm"],
13
- payments: ["payment", "payments", "billing", "stripe", "invoice", "subscription", "checkout", "webhook"],
14
- api: ["api", "endpoint", "route", "handler", "controller", "request", "response", "rest", "graphql"],
15
- ui: ["ui", "style", "css", "component", "page", "layout", "copy", "design", "render", "display", "view", "frontend", "html", "template"],
16
- mcp: ["mcp", "agentbridge", "cursor", "rules"],
17
- tests: ["test", "tests", "spec", "vitest", "jest", "coverage", "proof"],
18
- };
19
11
  const SYMPTOMS = {
20
12
  "401": ["401", "unauthorized", "unauthenticated"],
21
13
  "403": ["403", "forbidden"],
22
14
  "404": ["404", "not found", "notfound"],
23
15
  "500": ["500", "internal server error", "server error"],
24
16
  "null": ["null", "undefined", "nan", "nil"],
25
- "crash": ["crash", "crashes", "crashed", "exception", "throws", "throw"],
17
+ "crash": ["crash", "crashes", "crashed", "crashing", "exception", "throws", "throw"],
26
18
  "loop": ["loop", "infinite loop", "recursion"],
27
19
  "hang": ["hang", "hangs", "timeout", "deadlock"],
28
20
  "slow": ["slow", "performance", "latency", "memory leak", "memory"],
@@ -40,22 +32,18 @@ const CAMEL_FN_RE = /\b([a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)+)\b/g;
40
32
  // Quoted phrase
41
33
  const QUOTED_RE = /"([^"]+)"|'([^']+)'/g;
42
34
  function detectDomain(lower) {
43
- for (const [domain, keywords] of Object.entries(DOMAIN_KEYWORD_MAP)) {
44
- if (keywords.some((kw) => lower.includes(kw)))
45
- return domain;
46
- }
47
- return null;
35
+ return (0, domain_keywords_1.detectDomainFromKeywords)(lower);
48
36
  }
49
37
  function detectAction(lower) {
50
38
  for (const action of ACTIONS) {
51
- if (lower.startsWith(action) || lower.includes(` ${action} `))
39
+ if ((0, domain_keywords_1.matchesKeywordBoundary)(lower, action))
52
40
  return action;
53
41
  }
54
42
  return null;
55
43
  }
56
44
  function detectSymptom(lower) {
57
45
  for (const [symptom, patterns] of Object.entries(SYMPTOMS)) {
58
- if (patterns.some((p) => lower.includes(p)))
46
+ if ((0, domain_keywords_1.matchesAnyKeywordBoundary)(lower, patterns))
59
47
  return symptom;
60
48
  }
61
49
  return null;
@@ -13,6 +13,11 @@ function normalizePath(path) {
13
13
  function isProofNoiseFile(file) {
14
14
  const normalized = normalizePath(file);
15
15
  const lower = normalized.toLowerCase();
16
+ if (lower === ".agentbridge" ||
17
+ lower.endsWith("/.agentbridge") ||
18
+ lower.includes(".agentbridge/")) {
19
+ return true;
20
+ }
16
21
  if (lower === "agentbridge.md" ||
17
22
  lower === ".cursor" ||
18
23
  lower.startsWith(".cursor/")) {
@@ -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
  }
@@ -21205,6 +21305,9 @@ function normalizePath2(path) {
21205
21305
  function isProofNoiseFile(file) {
21206
21306
  const normalized = normalizePath2(file);
21207
21307
  const lower = normalized.toLowerCase();
21308
+ if (lower === ".agentbridge" || lower.endsWith("/.agentbridge") || lower.includes(".agentbridge/")) {
21309
+ return true;
21310
+ }
21208
21311
  if (lower === "agentbridge.md" || lower === ".cursor" || lower.startsWith(".cursor/")) {
21209
21312
  return true;
21210
21313
  }
@@ -21420,31 +21523,29 @@ var GENERIC_PROFILE = "generic";
21420
21523
  function unique(values) {
21421
21524
  return [...new Set(values.map((value) => value.trim()).filter(Boolean))];
21422
21525
  }
21423
- function matchIntent(intent, keywords) {
21424
- const lower = intent.toLowerCase();
21425
- return keywords.some((keyword) => lower.includes(keyword));
21426
- }
21526
+ var MCP_ENTITY_KEYWORDS = ["mcp", "agentbridge", "cursor"];
21527
+ var MCP_ACTION_KEYWORDS = ["rule", "rules", "install", "setup", "config", "configuration"];
21427
21528
  function detectProfiles(intent) {
21428
21529
  const profiles = [];
21429
- if (matchIntent(intent, ["mcp"]) && matchIntent(intent, ["rule", "rules", "install", "setup", "config", "configuration"])) {
21530
+ if (matchesAnyKeywordBoundary(intent, MCP_ENTITY_KEYWORDS) && matchesAnyKeywordBoundary(intent, MCP_ACTION_KEYWORDS)) {
21430
21531
  profiles.push(MCP_RULE_PROFILE);
21431
21532
  }
21432
- if (matchIntent(intent, ["auth", "login", "session", "token", "oauth"])) {
21533
+ if (matchesDomainKeywords(intent, "auth")) {
21433
21534
  profiles.push(AUTH_PROFILE);
21434
21535
  }
21435
- if (matchIntent(intent, ["database", "db", "schema", "migration", "prisma", "sql"])) {
21536
+ if (matchesDomainKeywords(intent, "database")) {
21436
21537
  profiles.push(DB_PROFILE);
21437
21538
  }
21438
- if (matchIntent(intent, ["ui", "style", "css", "copy", "layout", "component"])) {
21539
+ if (matchesDomainKeywords(intent, "ui")) {
21439
21540
  profiles.push(UI_PROFILE);
21440
21541
  }
21441
- if (matchIntent(intent, ["api", "endpoint", "route", "handler", "controller"])) {
21542
+ if (matchesDomainKeywords(intent, "api")) {
21442
21543
  profiles.push(API_PROFILE);
21443
21544
  }
21444
- if (matchIntent(intent, ["test", "tests", "vitest", "jest", "proof"])) {
21545
+ if (matchesDomainKeywords(intent, "tests")) {
21445
21546
  profiles.push(TEST_PROFILE);
21446
21547
  }
21447
- if (matchIntent(intent, ["payment", "payments", "billing", "stripe", "webhook"])) {
21548
+ if (matchesDomainKeywords(intent, "payments")) {
21448
21549
  profiles.push(PAYMENTS_PROFILE);
21449
21550
  }
21450
21551
  return profiles.length > 0 ? profiles : [GENERIC_PROFILE];
@@ -21691,7 +21792,9 @@ function normalizePath3(path) {
21691
21792
  }
21692
21793
  function isAgentbridgeLocalPath(path) {
21693
21794
  const normalized = normalizePath3(path);
21694
- return normalized === ".agentbridge" || normalized.startsWith(".agentbridge/");
21795
+ const lower = normalized.toLowerCase();
21796
+ if (lower === ".agentbridge" || lower.endsWith("/.agentbridge")) return true;
21797
+ return lower.includes(".agentbridge/");
21695
21798
  }
21696
21799
  function isRenameOrCopy(xy) {
21697
21800
  return xy.includes("R") || xy.includes("C");