@basegrid_tech/mcp 0.12.0 → 0.13.1

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.
Files changed (2) hide show
  1. package/dist/index.js +126 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -28,6 +28,11 @@ var DEFAULT_WORKSPACE = {
28
28
  iconColor: "#6b7280",
29
29
  order: 0
30
30
  };
31
+ var QUICK_COMMAND_LIMITS = {
32
+ maxCommands: 40,
33
+ maxLabel: 80,
34
+ maxBody: 4e3
35
+ };
31
36
 
32
37
  // ../shared/src/agent-defaults.ts
33
38
  var DEFAULT_AGENT_COMMANDS = {
@@ -134,6 +139,66 @@ var DEFAULT_NO_PROXY_HOSTS = [
134
139
  ];
135
140
  var DEFAULT_NO_PROXY = DEFAULT_NO_PROXY_HOSTS.join(",");
136
141
 
142
+ // ../shared/src/quick-commands.ts
143
+ function normalizeQuickCommands(input) {
144
+ if (!Array.isArray(input)) return [];
145
+ const seenIds = /* @__PURE__ */ new Set();
146
+ const result = [];
147
+ for (const raw of input) {
148
+ if (result.length >= QUICK_COMMAND_LIMITS.maxCommands) break;
149
+ const cmd = normalizeOne(raw, seenIds);
150
+ if (cmd) {
151
+ seenIds.add(cmd.id);
152
+ result.push(cmd);
153
+ }
154
+ }
155
+ return result;
156
+ }
157
+ function normalizeOne(raw, seenIds) {
158
+ if (!raw || typeof raw !== "object") return null;
159
+ const obj = raw;
160
+ const id = ensureUniqueId(typeof obj.id === "string" ? obj.id.trim() : "", seenIds);
161
+ if (!id) return null;
162
+ const label = clampString(obj.label, QUICK_COMMAND_LIMITS.maxLabel);
163
+ if (!label) return null;
164
+ const scope = normalizeScope(obj.scope);
165
+ const kind = obj.kind === "terminal" ? "terminal" : obj.kind === "agent" ? "agent" : null;
166
+ if (!kind) return null;
167
+ if (kind === "agent") {
168
+ const prompt = clampString(obj.prompt, QUICK_COMMAND_LIMITS.maxBody);
169
+ if (!prompt) return null;
170
+ const agentType = typeof obj.agentType === "string" ? obj.agentType : "claude";
171
+ const model = clampString(obj.model, QUICK_COMMAND_LIMITS.maxLabel);
172
+ return { id, label, scope, kind, agentType, prompt, ...model ? { model } : {} };
173
+ }
174
+ const command = clampString(obj.command, QUICK_COMMAND_LIMITS.maxBody);
175
+ if (!command) return null;
176
+ return {
177
+ id,
178
+ label,
179
+ scope,
180
+ kind,
181
+ command,
182
+ appendEnter: obj.appendEnter !== false
183
+ };
184
+ }
185
+ function normalizeScope(_scope) {
186
+ return { type: "global" };
187
+ }
188
+ function clampString(value, max) {
189
+ if (typeof value !== "string") return "";
190
+ return value.trim().slice(0, max);
191
+ }
192
+ function ensureUniqueId(id, seenIds) {
193
+ if (!id) return "";
194
+ if (!seenIds.has(id)) return id;
195
+ for (let i = 2; i < 1e3; i++) {
196
+ const candidate = `${id}-${i}`;
197
+ if (!seenIds.has(candidate)) return candidate;
198
+ }
199
+ return "";
200
+ }
201
+
137
202
  // ../server/src/default-workflows.ts
138
203
  var DEFAULT_TASK_WORKFLOW_ID = "system:default-task-workflow";
139
204
  function buildDefaultTaskWorkflow() {
@@ -392,6 +457,22 @@ function createSchema() {
392
457
  fallback_args TEXT
393
458
  );
394
459
 
460
+ -- Quick commands (\u043F\u043E\u0440\u0442 \u0444\u0438\u0447\u0438 \u0438\u0437 orca): \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u044C\u0441\u043A\u0438\u0435 \u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u043A\u043E\u043C\u0430\u043D\u0434\u044B.
461
+ -- kind='agent' \u2192 \u0437\u0430\u043F\u0443\u0441\u043A \u0430\u0433\u0435\u043D\u0442\u0430 \u0441 \u043F\u0440\u043E\u043C\u043F\u0442\u043E\u043C; kind='terminal' \u2192 \u0448\u0435\u043B\u043B-\u043A\u043E\u043C\u0430\u043D\u0434\u0430.
462
+ -- scope \u0445\u0440\u0430\u043D\u0438\u0442\u0441\u044F JSON-\u0441\u0442\u0440\u043E\u043A\u043E\u0439 \u0434\u043B\u044F \u0431\u0443\u0434\u0443\u0449\u0435\u0439 \u043F\u0440\u0438\u0432\u044F\u0437\u043A\u0438 \u043A \u043F\u0440\u043E\u0435\u043A\u0442\u0443 (\u0441\u0435\u0439\u0447\u0430\u0441 global).
463
+ CREATE TABLE IF NOT EXISTS quick_commands (
464
+ id TEXT PRIMARY KEY,
465
+ label TEXT NOT NULL,
466
+ kind TEXT NOT NULL,
467
+ scope TEXT NOT NULL DEFAULT '{"type":"global"}',
468
+ agent_type TEXT,
469
+ prompt TEXT,
470
+ model TEXT,
471
+ command TEXT,
472
+ append_enter INTEGER NOT NULL DEFAULT 1,
473
+ position INTEGER NOT NULL DEFAULT 0
474
+ );
475
+
395
476
  CREATE TABLE IF NOT EXISTS remote_hosts (
396
477
  id TEXT PRIMARY KEY,
397
478
  label TEXT NOT NULL,
@@ -1409,6 +1490,7 @@ function loadConfig() {
1409
1490
  const projects = loadProjects(d);
1410
1491
  const agentCommands = loadAgentCommands(d);
1411
1492
  const workflows = loadWorkflows(d);
1493
+ const quickCommands = loadQuickCommands(d);
1412
1494
  const remoteHosts = loadRemoteHosts(d);
1413
1495
  const tasks = loadTasks(d);
1414
1496
  const workspaces = loadWorkspaces(d);
@@ -1418,6 +1500,7 @@ function loadConfig() {
1418
1500
  projects,
1419
1501
  agentCommands: Object.keys(agentCommands).length > 0 ? agentCommands : { ...DEFAULT_AGENT_COMMANDS },
1420
1502
  workflows,
1503
+ quickCommands,
1421
1504
  remoteHosts,
1422
1505
  tasks,
1423
1506
  workspaces,
@@ -1523,6 +1606,28 @@ function loadWorkflows(d) {
1523
1606
  const rows = d.prepare("SELECT * FROM workflows").all();
1524
1607
  return rows.map(rowToWorkflow);
1525
1608
  }
1609
+ function loadQuickCommands(d) {
1610
+ const rows = d.prepare("SELECT * FROM quick_commands ORDER BY position ASC").all();
1611
+ const raw = rows.map((r) => ({
1612
+ id: r.id,
1613
+ label: r.label,
1614
+ kind: r.kind,
1615
+ scope: r.scope ? safeParseJson(r.scope) : { type: "global" },
1616
+ agentType: r.agent_type ?? void 0,
1617
+ prompt: r.prompt ?? void 0,
1618
+ model: r.model ?? void 0,
1619
+ command: r.command ?? void 0,
1620
+ appendEnter: r.append_enter !== 0
1621
+ }));
1622
+ return normalizeQuickCommands(raw);
1623
+ }
1624
+ function safeParseJson(s) {
1625
+ try {
1626
+ return JSON.parse(s);
1627
+ } catch {
1628
+ return void 0;
1629
+ }
1630
+ }
1526
1631
  function loadAgentCommands(d) {
1527
1632
  const rows = d.prepare("SELECT * FROM agent_commands").all();
1528
1633
  const result = {};
@@ -1612,6 +1717,26 @@ function saveConfig(config) {
1612
1717
  w.workspaceId ?? "personal"
1613
1718
  );
1614
1719
  }
1720
+ d.prepare("DELETE FROM quick_commands").run();
1721
+ const insertQuickCommand = d.prepare(
1722
+ `INSERT INTO quick_commands (id, label, kind, scope, agent_type, prompt, model, command, append_enter, position)
1723
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
1724
+ );
1725
+ const normalizedQuickCommands = normalizeQuickCommands(config.quickCommands ?? []);
1726
+ normalizedQuickCommands.forEach((q, index) => {
1727
+ insertQuickCommand.run(
1728
+ q.id,
1729
+ q.label,
1730
+ q.kind,
1731
+ JSON.stringify(q.scope),
1732
+ q.kind === "agent" ? q.agentType : null,
1733
+ q.kind === "agent" ? q.prompt : null,
1734
+ q.kind === "agent" ? q.model ?? null : null,
1735
+ q.kind === "terminal" ? q.command : null,
1736
+ q.kind === "terminal" && q.appendEnter ? 1 : 0,
1737
+ index
1738
+ );
1739
+ });
1615
1740
  d.prepare("DELETE FROM agent_commands").run();
1616
1741
  const insertAgent = d.prepare(
1617
1742
  "INSERT INTO agent_commands (agent_type, command, args, headless_args, fallback_command, fallback_args) VALUES (?, ?, ?, ?, ?, ?)"
@@ -3637,7 +3762,7 @@ console.warn = (...args) => _origError("[mcp:warn]", ...args);
3637
3762
  console.error = (...args) => _origError("[mcp:error]", ...args);
3638
3763
  async function main() {
3639
3764
  configManager.init();
3640
- const version = true ? "0.12.0" : createRequire(import.meta.url)("../package.json").version;
3765
+ const version = true ? "0.13.1" : createRequire(import.meta.url)("../package.json").version;
3641
3766
  const server = createMcpServer(version);
3642
3767
  const transport = new StdioServerTransport();
3643
3768
  await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basegrid_tech/mcp",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "BaseGrid MCP server — task management, git, and workflow tools for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -42,8 +42,8 @@
42
42
  "zod": "^4.3.6"
43
43
  },
44
44
  "devDependencies": {
45
- "@basegrid/server": "0.12.0",
46
- "@basegrid/shared": "0.12.0",
45
+ "@basegrid/server": "0.13.1",
46
+ "@basegrid/shared": "0.13.1",
47
47
  "tsup": "^8.5.1",
48
48
  "tsx": "^4.21.0",
49
49
  "typescript": "^6.0.3"