@hivemindai/mcp-server 0.6.1 → 0.6.2

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 (110) hide show
  1. package/dist/__tests__/config.test.js 2.map +1 -0
  2. package/dist/__tests__/credentials.test 2.js +126 -0
  3. package/dist/__tests__/credentials.test.d.ts 2.map +1 -0
  4. package/dist/__tests__/editor-config.test.d 2.ts +2 -0
  5. package/dist/__tests__/editor-config.test.js 2.map +1 -0
  6. package/dist/__tests__/format.test.d.ts 2.map +1 -0
  7. package/dist/__tests__/format.test.js 2.map +1 -0
  8. package/dist/__tests__/helpers/mock-server 2.js +107 -0
  9. package/dist/__tests__/helpers/mock-server.d 2.ts +79 -0
  10. package/dist/__tests__/helpers/mock-server.d.ts 2.map +1 -0
  11. package/dist/__tests__/helpers/mock-server.js 2.map +1 -0
  12. package/dist/__tests__/remember.test 2.js +152 -0
  13. package/dist/__tests__/tools-context.test 2.js +107 -0
  14. package/dist/__tests__/tools-context.test.js 2.map +1 -0
  15. package/dist/__tests__/tools-knowledge.test.d 2.ts +2 -0
  16. package/dist/__tests__/tools-knowledge.test.d.ts 2.map +1 -0
  17. package/dist/__tests__/tools-plans.test.d 2.ts +2 -0
  18. package/dist/__tests__/tools-plans.test.js 2.map +1 -0
  19. package/dist/__tests__/tools-schedules.test.js 2.map +1 -0
  20. package/dist/__tests__/tools-skills.test.d 2.ts +2 -0
  21. package/dist/__tests__/tools-skills.test.d.ts 2.map +1 -0
  22. package/dist/__tests__/tools-skills.test.js 2.map +1 -0
  23. package/dist/__tests__/tools-tasks.test 2.js +83 -0
  24. package/dist/__tests__/tools-tasks.test.d 2.ts +2 -0
  25. package/dist/__tests__/tools-triggers.test.d 2.ts +2 -0
  26. package/dist/__tests__/tools-workflows.test.d.ts 2.map +1 -0
  27. package/dist/__tests__/tools.test.d.ts 2.map +1 -0
  28. package/dist/cli/commands/context-inject 2.js +112 -0
  29. package/dist/cli/commands/context-inject.d 2.ts +2 -0
  30. package/dist/cli/commands/context-inject.d.ts 2.map +1 -0
  31. package/dist/cli/commands/context-inject.js 2.map +1 -0
  32. package/dist/cli/commands/doc 2.js +144 -0
  33. package/dist/cli/commands/doc.d.ts 2.map +1 -0
  34. package/dist/cli/commands/doc.js 2.map +1 -0
  35. package/dist/cli/commands/git-hook 2.js +79 -0
  36. package/dist/cli/commands/git-hook.d 3.ts +2 -0
  37. package/dist/cli/commands/git-hook.js 2.map +1 -0
  38. package/dist/cli/commands/guard 2.js +122 -0
  39. package/dist/cli/commands/guard.d.ts 2.map +1 -0
  40. package/dist/cli/commands/init 2.js +227 -0
  41. package/dist/cli/commands/init.d 2.ts +2 -0
  42. package/dist/cli/commands/init.d.ts 2.map +1 -0
  43. package/dist/cli/commands/init.js 2.map +1 -0
  44. package/dist/cli/commands/login 2.js +120 -0
  45. package/dist/cli/commands/login.d.ts 3.map +1 -0
  46. package/dist/cli/commands/logout 2.js +21 -0
  47. package/dist/cli/commands/logout.js 3.map +1 -0
  48. package/dist/cli/commands/release.d 3.ts +2 -0
  49. package/dist/cli/commands/release.d.ts 2.map +1 -0
  50. package/dist/cli/commands/release.js 2.map +1 -0
  51. package/dist/cli/commands/skill 2.js +185 -0
  52. package/dist/cli/commands/skill-inject 2.js +194 -0
  53. package/dist/cli/commands/skill-inject.d 2.ts +2 -0
  54. package/dist/cli/commands/skill-inject.d.ts 2.map +1 -0
  55. package/dist/cli/commands/skill-inject.js 2.map +1 -0
  56. package/dist/cli/commands/skill.d 2.ts +2 -0
  57. package/dist/cli/commands/status 2.js +45 -0
  58. package/dist/cli/commands/status.d.ts 2.map +1 -0
  59. package/dist/cli/commands/status.d.ts 3.map +1 -0
  60. package/dist/cli/commands/status.js 2.map +1 -0
  61. package/dist/cli/commands/switch 2.js +88 -0
  62. package/dist/cli/commands/switch 3.js +88 -0
  63. package/dist/cli/commands/switch.js 2.map +1 -0
  64. package/dist/cli/commands/whoami.d 2.ts +2 -0
  65. package/dist/cli/commands/whoami.d 3.ts +2 -0
  66. package/dist/cli/commands/whoami.d.ts 2.map +1 -0
  67. package/dist/cli/commands/whoami.js 2.map +1 -0
  68. package/dist/cli/commands/whoami.js 3.map +1 -0
  69. package/dist/cli/credentials.js 2.map +1 -0
  70. package/dist/cli/editor-config 2.js +109 -0
  71. package/dist/cli/editor-config.d 2.ts +9 -0
  72. package/dist/cli/editor-config.d.ts 2.map +1 -0
  73. package/dist/cli/editor-config.js 2.map +1 -0
  74. package/dist/cli/index 2.d 2.ts +2 -0
  75. package/dist/cli/index 2.d.ts 2.map +1 -0
  76. package/dist/cli/index 2.js 2.map +1 -0
  77. package/dist/cli/index 3.js +63 -0
  78. package/dist/cli/index 4.js +68 -0
  79. package/dist/cli/index.js 2.map +1 -0
  80. package/dist/tools/approvals.d.ts 2.map +1 -0
  81. package/dist/tools/blockers 2.js +24 -0
  82. package/dist/tools/blockers.d 2.ts +21 -0
  83. package/dist/tools/blockers.d.ts 2.map +1 -0
  84. package/dist/tools/handoffs.d.ts 2.map +1 -0
  85. package/dist/tools/knowledge.d.ts 2.map +1 -0
  86. package/dist/tools/knowledge.js 3.map +1 -0
  87. package/dist/tools/lock.d 2.ts +24 -0
  88. package/dist/tools/lock.d.ts 2.map +1 -0
  89. package/dist/tools/lock.js 2.map +1 -0
  90. package/dist/tools/plans.d 2.ts +5 -0
  91. package/dist/tools/publish.d 2.ts +24 -0
  92. package/dist/tools/publish.d.ts 2.map +1 -0
  93. package/dist/tools/query 2.js +41 -0
  94. package/dist/tools/query.d 2.ts +27 -0
  95. package/dist/tools/query.js 2.map +1 -0
  96. package/dist/tools/remember.js 2.map +1 -0
  97. package/dist/tools/skills 2.js +273 -0
  98. package/dist/tools/skills.js 2.map +1 -0
  99. package/dist/tools/status.d.ts 2.map +1 -0
  100. package/dist/tools/status.js 2.map +1 -0
  101. package/dist/tools/subscribe.js 2.map +1 -0
  102. package/dist/tools/tasks 2.js +51 -0
  103. package/dist/tools/teams.d 2.ts +4 -0
  104. package/dist/tools/teams.js 2.map +1 -0
  105. package/dist/tools/triggers 2.js +212 -0
  106. package/dist/tools/triggers.d 2.ts +5 -0
  107. package/dist/tools/triggers.d.ts 2.map +1 -0
  108. package/dist/tools/triggers.d.ts 3.map +1 -0
  109. package/dist/tools/workflows.d.ts 2.map +1 -0
  110. package/package.json +3 -3
@@ -0,0 +1,122 @@
1
+ import { readFileSync, existsSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ function loadCredentials() {
4
+ const credPath = join(process.env.HOME ?? process.env.USERPROFILE ?? ".", ".hivemind", "credentials.json");
5
+ if (!existsSync(credPath))
6
+ return null;
7
+ try {
8
+ const creds = JSON.parse(readFileSync(credPath, "utf-8"));
9
+ return { api_key: creds.api_key, api_url: creds.api_url };
10
+ }
11
+ catch {
12
+ return null;
13
+ }
14
+ }
15
+ function getAgentName(input) {
16
+ return process.env.HIVEMIND_AGENT ?? (input.session_id ? `claude-${input.session_id}` : `claude-${process.ppid}`);
17
+ }
18
+ export async function guard(args = []) {
19
+ const policiesOnly = args.includes("--policies-only");
20
+ // Read hook input from stdin
21
+ let input;
22
+ try {
23
+ const raw = readFileSync(0, "utf-8");
24
+ input = JSON.parse(raw);
25
+ }
26
+ catch {
27
+ process.exit(0);
28
+ }
29
+ const filePath = input.tool_input?.file_path;
30
+ if (!filePath) {
31
+ process.exit(0);
32
+ }
33
+ const creds = loadCredentials();
34
+ if (!creds) {
35
+ process.exit(0);
36
+ }
37
+ const agent = getAgentName(input);
38
+ const headers = {
39
+ Authorization: `Bearer ${creds.api_key}`,
40
+ "Content-Type": "application/json",
41
+ };
42
+ // Make the file path relative to cwd for cleaner resource names
43
+ const cwd = input.cwd ?? process.cwd();
44
+ let resource = filePath;
45
+ if (resource.startsWith(cwd)) {
46
+ resource = resource.slice(cwd.length).replace(/^\//, "");
47
+ }
48
+ // 1. Check policies
49
+ try {
50
+ const policyRes = await fetch(`${creds.api_url}/v1/approvals/policies/check?resource=${encodeURIComponent(resource)}`, { headers });
51
+ if (policyRes.ok) {
52
+ const policyData = await policyRes.json();
53
+ if (policyData.requires_approval) {
54
+ const policies = policyData.matching_policies
55
+ .map((p) => ` - ${p.description} (pattern: ${p.resource_pattern})`)
56
+ .join("\n");
57
+ process.stderr.write(`BLOCKED: ${resource} requires approval.\n\nMatching policies:\n${policies}\n\n` +
58
+ `To proceed, request approval:\n` +
59
+ ` hivemind_approvals(action: "request", channel: "general", description: "Need to edit ${resource}")\n` +
60
+ `Then wait for approval before retrying.\n`);
61
+ process.exit(2);
62
+ }
63
+ }
64
+ }
65
+ catch {
66
+ // Policy check failed — don't block on network errors
67
+ }
68
+ // 2. Non-blocking conflict check (informational only)
69
+ try {
70
+ const controller = new AbortController();
71
+ const timeout = setTimeout(() => controller.abort(), 3000);
72
+ const conflictRes = await fetch(`${creds.api_url}/v1/intelligence/conflicts/check?files=${encodeURIComponent(resource)}`, { headers, signal: controller.signal });
73
+ clearTimeout(timeout);
74
+ if (conflictRes.ok) {
75
+ const conflictData = await conflictRes.json();
76
+ if (conflictData.conflicts?.length > 0) {
77
+ for (const c of conflictData.conflicts) {
78
+ process.stderr.write(`WARNING: ${c.file} was recently modified by ${c.agent} ("${c.description}" at ${c.modified_at})\n` +
79
+ `Consider coordinating with the other agent before proceeding.\n\n`);
80
+ }
81
+ }
82
+ }
83
+ }
84
+ catch {
85
+ // Conflict check is informational — don't block on errors
86
+ }
87
+ // 3. Acquire lock (skip if --policies-only)
88
+ if (!policiesOnly) {
89
+ try {
90
+ const lockRes = await fetch(`${creds.api_url}/v1/locks/${encodeURIComponent(resource)}`, {
91
+ method: "POST",
92
+ headers,
93
+ body: JSON.stringify({ agent }),
94
+ });
95
+ if (lockRes.ok) {
96
+ const lockData = await lockRes.json();
97
+ if (lockData.locked) {
98
+ process.exit(0);
99
+ }
100
+ }
101
+ if (lockRes.status === 409) {
102
+ const lockData = await lockRes.json();
103
+ const holder = lockData.held_by?.agent ?? "unknown";
104
+ if (holder === agent) {
105
+ process.exit(0);
106
+ }
107
+ process.stderr.write(`BLOCKED: ${resource} is locked by ${holder}.\n\n` +
108
+ `Another agent is editing this file. To override:\n` +
109
+ `1. hivemind_approvals(action: "request", channel: "general", description: "Need to edit ${resource}, locked by ${holder}")\n` +
110
+ `2. Wait for approval\n` +
111
+ `3. hivemind_lock(action: "acquire", resource: "${resource}", force_correlation_id: "<correlation_id>")\n`);
112
+ process.exit(2);
113
+ }
114
+ }
115
+ catch {
116
+ // Lock request failed — don't block on network errors
117
+ }
118
+ }
119
+ // Default: allow
120
+ process.exit(0);
121
+ }
122
+ //# sourceMappingURL=guard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/guard.ts"],"names":[],"mappings":"AAiCA,wBAAsB,KAAK,CAAC,IAAI,GAAE,MAAM,EAAO,iBA+H9C"}
@@ -0,0 +1,227 @@
1
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ const HIVEMIND_SECTION_START = "<!-- hivemind:start -->";
4
+ const HIVEMIND_SECTION_END = "<!-- hivemind:end -->";
5
+ function buildClaudeMd(mode) {
6
+ const rules = [];
7
+ // Rule 1 — always present
8
+ rules.push(`### Rule 1: Announce your task IMMEDIATELY
9
+
10
+ As your FIRST action when starting any task, BEFORE reading files or planning, call:
11
+ \`\`\`
12
+ hivemind_publish(channel: "general", event_type: "task.created", data: {"description": "<what you are about to do>"})
13
+ \`\`\`
14
+ Also call \`hivemind_status()\` to see what other agents are working on.`);
15
+ // Rule 2 — enforcement (varies by mode)
16
+ if (mode === "full") {
17
+ rules.push(`### Rule 2: Locks and policies are enforced automatically
18
+
19
+ File locks and approval policies are enforced by hooks. If your edit is blocked, you will see an error message explaining why and what to do. Follow those instructions.
20
+
21
+ If a lock blocks you: another agent is editing that file. Request approval to override, or work on a different file.
22
+ If a policy blocks you: the file requires human approval. Request approval and wait.`);
23
+ }
24
+ else if (mode === "no-locks") {
25
+ rules.push(`### Rule 2: Approval policies are enforced automatically
26
+
27
+ Approval policies are enforced by hooks. If your edit is blocked because a file requires approval, you will see an error message explaining why and what to do. Follow those instructions.`);
28
+ }
29
+ // events-only: no Rule 2
30
+ // Publish outcomes — always present
31
+ const ruleNum = mode === "events-only" ? 2 : 3;
32
+ rules.push(`### Rule ${ruleNum}: Publish outcomes
33
+
34
+ After completing work, publish what you did:
35
+ \`\`\`
36
+ hivemind_publish(channel: "general", event_type: "task.completed", data: {"description": "<what you did>", "files_changed": ["file1.ts", "file2.ts"]})
37
+ \`\`\`
38
+ Also publish \`decision.made\` when choosing between approaches, \`task.blocked\` when stuck, and \`bug.found\` when discovering bugs.
39
+
40
+ Do NOT publish routine activity (file reads, retries, lint fixes). Only publish outcomes and decisions.`);
41
+ // Skills note — always present
42
+ const skillRuleNum = ruleNum + 1;
43
+ rules.push(`### Rule ${skillRuleNum}: Skills are injected automatically
44
+
45
+ When you edit files, relevant project skills are automatically loaded into your context.
46
+ You can also search for skills explicitly: \`hivemind_skill(action: "search", query: "...")\``);
47
+ return `${HIVEMIND_SECTION_START}
48
+ ## Hivemind — MANDATORY agent coordination
49
+
50
+ This project uses Hivemind for multi-agent coordination. You MUST follow ALL of these rules. They are not optional.
51
+
52
+ ${rules.join("\n\n")}
53
+ ${HIVEMIND_SECTION_END}`;
54
+ }
55
+ function buildHooksConfig(mode) {
56
+ const hooks = {};
57
+ // Skill injection runs in ALL modes (even events-only) — it never blocks
58
+ const skillInjectHook = {
59
+ matcher: "Edit|Write|Bash",
60
+ hooks: [{ type: "command", command: "hivemind skill-inject", timeout: 5 }],
61
+ };
62
+ if (mode === "full") {
63
+ hooks.PreToolUse = [
64
+ skillInjectHook,
65
+ {
66
+ matcher: "Edit|Write",
67
+ hooks: [{ type: "command", command: "hivemind guard", timeout: 10 }],
68
+ },
69
+ ];
70
+ hooks.PostToolUse = [
71
+ {
72
+ matcher: "Edit|Write",
73
+ hooks: [{ type: "command", command: "hivemind release", timeout: 10 }],
74
+ },
75
+ ];
76
+ }
77
+ else if (mode === "no-locks") {
78
+ hooks.PreToolUse = [
79
+ skillInjectHook,
80
+ {
81
+ matcher: "Edit|Write",
82
+ hooks: [{ type: "command", command: "hivemind guard --policies-only", timeout: 10 }],
83
+ },
84
+ ];
85
+ // No PostToolUse — no locks to release
86
+ }
87
+ else {
88
+ // events-only: skill injection only
89
+ hooks.PreToolUse = [skillInjectHook];
90
+ }
91
+ return hooks;
92
+ }
93
+ export async function init(args = []) {
94
+ const mode = args.includes("--events-only")
95
+ ? "events-only"
96
+ : args.includes("--no-locks")
97
+ ? "no-locks"
98
+ : "full";
99
+ const cwd = process.cwd();
100
+ const claudeMdPath = join(cwd, "CLAUDE.md");
101
+ console.log("Hivemind Init\n");
102
+ if (mode !== "full") {
103
+ console.log(` Mode: ${mode}\n`);
104
+ }
105
+ // --- 1. Update CLAUDE.md ---
106
+ const claudeMdContent = buildClaudeMd(mode);
107
+ if (existsSync(claudeMdPath)) {
108
+ const existing = readFileSync(claudeMdPath, "utf-8");
109
+ if (existing.includes(HIVEMIND_SECTION_START)) {
110
+ const before = existing.slice(0, existing.indexOf(HIVEMIND_SECTION_START));
111
+ const after = existing.slice(existing.indexOf(HIVEMIND_SECTION_END) + HIVEMIND_SECTION_END.length);
112
+ writeFileSync(claudeMdPath, before + claudeMdContent + after);
113
+ console.log(" Updated Hivemind section in CLAUDE.md");
114
+ }
115
+ else {
116
+ writeFileSync(claudeMdPath, existing.trimEnd() + "\n\n" + claudeMdContent + "\n");
117
+ console.log(" Added Hivemind section to CLAUDE.md");
118
+ }
119
+ }
120
+ else {
121
+ writeFileSync(claudeMdPath, `# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n${claudeMdContent}\n`);
122
+ console.log(" Created CLAUDE.md with Hivemind instructions");
123
+ }
124
+ // --- 2. Configure Claude Code hooks ---
125
+ const hooksConfig = buildHooksConfig(mode);
126
+ const claudeDir = join(cwd, ".claude");
127
+ const settingsPath = join(claudeDir, "settings.local.json");
128
+ mkdirSync(claudeDir, { recursive: true });
129
+ let settings = {};
130
+ if (existsSync(settingsPath)) {
131
+ try {
132
+ settings = JSON.parse(readFileSync(settingsPath, "utf-8"));
133
+ }
134
+ catch {
135
+ // If parse fails, start fresh
136
+ }
137
+ }
138
+ // Filter out any existing hivemind hooks
139
+ const existingHooks = (settings.hooks ?? {});
140
+ const newHooks = { ...existingHooks };
141
+ for (const event of ["PreToolUse", "PostToolUse"]) {
142
+ const existing = (existingHooks[event] ?? []);
143
+ const filtered = existing.filter((h) => {
144
+ const cmds = h.hooks?.map((hh) => hh.command ?? "") ?? [];
145
+ return !cmds.some((c) => c.startsWith("hivemind "));
146
+ });
147
+ if (hooksConfig && hooksConfig[event]) {
148
+ newHooks[event] = [...filtered, ...hooksConfig[event]];
149
+ }
150
+ else {
151
+ // No hivemind hooks for this event — keep only non-hivemind hooks
152
+ newHooks[event] = filtered.length > 0 ? filtered : [];
153
+ if (newHooks[event].length === 0) {
154
+ delete newHooks[event];
155
+ }
156
+ }
157
+ }
158
+ settings.hooks = Object.keys(newHooks).length > 0 ? newHooks : undefined;
159
+ if (!settings.hooks)
160
+ delete settings.hooks;
161
+ writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
162
+ console.log(" Configured Claude Code hooks in .claude/settings.local.json");
163
+ // --- 3. Install git post-commit hook ---
164
+ const gitDir = join(cwd, ".git");
165
+ if (existsSync(gitDir)) {
166
+ const hooksDir = join(gitDir, "hooks");
167
+ mkdirSync(hooksDir, { recursive: true });
168
+ const postCommitPath = join(hooksDir, "post-commit");
169
+ const hookScript = `#!/bin/sh
170
+ # Hivemind auto-instrumentation — publishes commit events
171
+ hivemind git-hook post-commit 2>/dev/null || true
172
+ `;
173
+ if (existsSync(postCommitPath)) {
174
+ const existing = readFileSync(postCommitPath, "utf-8");
175
+ if (existing.includes("hivemind git-hook")) {
176
+ console.log(" Git post-commit hook already installed");
177
+ }
178
+ else {
179
+ // Append to existing hook
180
+ writeFileSync(postCommitPath, existing.trimEnd() + "\n\n" + hookScript);
181
+ console.log(" Appended Hivemind to existing git post-commit hook");
182
+ }
183
+ }
184
+ else {
185
+ writeFileSync(postCommitPath, hookScript, { mode: 0o755 });
186
+ console.log(" Installed git post-commit hook (auto-publishes commit events)");
187
+ }
188
+ }
189
+ else {
190
+ console.log(" No .git directory found — skipped git hook installation");
191
+ }
192
+ // --- 4. Summary ---
193
+ if (mode === "full") {
194
+ console.log(`
195
+ Done! Hivemind is now active in this project:
196
+
197
+ - CLAUDE.md: Agent instructions for publishing events
198
+ - Hooks: Auto-lock files before edit, auto-release after
199
+ - Hooks: Auto-check approval policies before edit
200
+ - Hooks: Auto-inject skills based on file patterns and tools
201
+ - Git hook: Auto-publishes commit events to Hivemind
202
+
203
+ Locks and policies are enforced automatically.
204
+ `);
205
+ }
206
+ else if (mode === "no-locks") {
207
+ console.log(`
208
+ Done! Hivemind is now active in this project:
209
+
210
+ - CLAUDE.md: Agent instructions for publishing events
211
+ - Hooks: Auto-check approval policies before edit
212
+ - Hooks: Auto-inject skills based on file patterns and tools
213
+ - Git hook: Auto-publishes commit events to Hivemind
214
+ - No file locking (use this when agents work on separate branches)
215
+ `);
216
+ }
217
+ else {
218
+ console.log(`
219
+ Done! Hivemind is now active in this project:
220
+
221
+ - CLAUDE.md: Agent instructions for publishing events
222
+ - Hooks: Auto-inject skills based on file patterns and tools
223
+ - Git hook: Auto-publishes commit events to Hivemind
224
+ `);
225
+ }
226
+ }
227
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1,2 @@
1
+ export declare function init(args?: string[]): Promise<void>;
2
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAyFA,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAAO,iBAoJ7C"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot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,CAAC;YAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;YACvD,IAAI,QAAQ,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;gBAC3C,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;YAC1D,CAAC;iBAAM,CAAC;gBACN,0BAA0B;gBAC1B,aAAa,CAAC,cAAc,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,UAAU,CAAC,CAAC;gBACxE,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;YACtE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,cAAc,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,iEAAiE,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;IAC3E,CAAC;IAED,qBAAqB;IAErB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;CAUf,CAAC,CAAC;IACD,CAAC;SAAM,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC;;;;;;;;CAQf,CAAC,CAAC;IACD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC;;;;;;CAMf,CAAC,CAAC;IACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { createServer } from "node:http";
2
+ import { execSync } from "node:child_process";
3
+ import { URL } from "node:url";
4
+ import { writeCredentials, readCredentials } from "../credentials.js";
5
+ import { configureMcpEditors } from "../editor-config.js";
6
+ const LOGIN_TIMEOUT_MS = 120_000;
7
+ const PROD_DASHBOARD_URL = "https://hivemindai.dev";
8
+ const LOCAL_DASHBOARD_URL = "http://localhost:3000";
9
+ async function detectDashboardUrl() {
10
+ if (process.env.HIVEMIND_DASHBOARD_URL) {
11
+ return process.env.HIVEMIND_DASHBOARD_URL;
12
+ }
13
+ // Check if local dashboard is running
14
+ try {
15
+ const controller = new AbortController();
16
+ const timeout = setTimeout(() => controller.abort(), 1000);
17
+ const res = await fetch(LOCAL_DASHBOARD_URL, { signal: controller.signal, method: "HEAD" });
18
+ clearTimeout(timeout);
19
+ if (res.ok || res.status === 307) {
20
+ console.log("Local dashboard detected at localhost:3000\n");
21
+ return LOCAL_DASHBOARD_URL;
22
+ }
23
+ }
24
+ catch {
25
+ // not running
26
+ }
27
+ return PROD_DASHBOARD_URL;
28
+ }
29
+ function openBrowser(url) {
30
+ const platform = process.platform;
31
+ try {
32
+ if (platform === "darwin") {
33
+ execSync(`open "${url}"`);
34
+ }
35
+ else if (platform === "win32") {
36
+ execSync(`start "" "${url}"`);
37
+ }
38
+ else {
39
+ execSync(`xdg-open "${url}"`);
40
+ }
41
+ }
42
+ catch {
43
+ console.log(`\nOpen this URL in your browser:\n ${url}\n`);
44
+ }
45
+ }
46
+ export async function login() {
47
+ const existing = readCredentials();
48
+ if (existing) {
49
+ console.log(`Already logged in as ${existing.email} (org: ${existing.org_name}).`);
50
+ console.log(`Run "hivemind logout" first to re-authenticate.`);
51
+ process.exit(0);
52
+ }
53
+ const dashboardUrl = await detectDashboardUrl();
54
+ const creds = await new Promise((resolve, reject) => {
55
+ const server = createServer((req, res) => {
56
+ if (!req.url?.startsWith("/callback")) {
57
+ res.writeHead(404);
58
+ res.end("Not found");
59
+ return;
60
+ }
61
+ const url = new URL(req.url, `http://localhost`);
62
+ const apiKey = url.searchParams.get("key");
63
+ // Support both new (org_id) and legacy (project_id) dashboard responses
64
+ const orgId = url.searchParams.get("org_id") || url.searchParams.get("project_id") || "";
65
+ const orgName = url.searchParams.get("org_name") || url.searchParams.get("project_name") || "";
66
+ const orgSlug = url.searchParams.get("org_slug") || "";
67
+ const email = url.searchParams.get("email") || "";
68
+ const apiUrl = url.searchParams.get("api_url");
69
+ if (!apiKey) {
70
+ res.writeHead(400, { "Content-Type": "text/html" });
71
+ res.end("<html><body><h2>Missing required parameters.</h2><p>Please try again.</p></body></html>");
72
+ return;
73
+ }
74
+ const credentials = {
75
+ api_key: apiKey,
76
+ api_url: apiUrl ?? "https://hivemind.convex.site",
77
+ org_id: orgId,
78
+ org_name: orgName,
79
+ org_slug: orgSlug,
80
+ email,
81
+ };
82
+ res.writeHead(200, { "Content-Type": "text/html" });
83
+ res.end(`<html><body>
84
+ <h2>Authenticated!</h2>
85
+ <p>You can close this tab and return to your terminal.</p>
86
+ </body></html>`);
87
+ server.close();
88
+ resolve(credentials);
89
+ });
90
+ server.listen(0, "127.0.0.1", () => {
91
+ const addr = server.address();
92
+ if (!addr || typeof addr === "string") {
93
+ reject(new Error("Failed to start local server"));
94
+ return;
95
+ }
96
+ const port = addr.port;
97
+ const callbackUrl = encodeURIComponent(`http://localhost:${port}/callback`);
98
+ const authUrl = `${dashboardUrl}/cli-auth?port=${port}&callback_url=${callbackUrl}`;
99
+ console.log("Opening browser to sign in...\n");
100
+ openBrowser(authUrl);
101
+ });
102
+ setTimeout(() => {
103
+ server.close();
104
+ reject(new Error("Login timed out. Please try again."));
105
+ }, LOGIN_TIMEOUT_MS);
106
+ });
107
+ writeCredentials(creds);
108
+ const editors = configureMcpEditors();
109
+ console.log(`Authenticated as ${creds.email}`);
110
+ console.log(`Org: ${creds.org_name} (${creds.org_id})`);
111
+ console.log(`API key stored in ~/.hivemind/credentials.json`);
112
+ if (editors.claudeCode) {
113
+ console.log(`Claude Code MCP config updated`);
114
+ }
115
+ if (editors.cursor) {
116
+ console.log(`Cursor MCP config updated`);
117
+ }
118
+ console.log(`\nRestart Claude Code to start using Hivemind.`);
119
+ }
120
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/login.ts"],"names":[],"mappings":"AA6CA,wBAAsB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAwF3C"}
@@ -0,0 +1,21 @@
1
+ import { deleteCredentials } from "../credentials.js";
2
+ import { removeMcpEditorConfigs } from "../editor-config.js";
3
+ export async function logout() {
4
+ const deleted = deleteCredentials();
5
+ const editors = removeMcpEditorConfigs();
6
+ if (!deleted && !editors.claudeCode && !editors.cursor) {
7
+ console.log("Already logged out.");
8
+ return;
9
+ }
10
+ if (deleted) {
11
+ console.log("✓ Credentials removed");
12
+ }
13
+ if (editors.claudeCode) {
14
+ console.log("✓ Claude Code MCP config removed");
15
+ }
16
+ if (editors.cursor) {
17
+ console.log("✓ Cursor MCP config removed");
18
+ }
19
+ console.log("\nLogged out successfully.");
20
+ }
21
+ //# sourceMappingURL=logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["../../../src/cli/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,MAAM,CAAC,KAAK,UAAU,MAAM;IAC1B,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,sBAAsB,EAAE,CAAC;IAEzC,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACvD,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACnC,OAAO;IACT,CAAC;IAED,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;IAClD,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function release(): Promise<void>;
2
+ //# sourceMappingURL=release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/release.ts"],"names":[],"mappings":"AAgCA,wBAAsB,OAAO,kBA0C5B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"release.js","sourceRoot":"","sources":["../../../src/cli/commands/release.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAYjC,SAAS,eAAe;IACtB,MAAM,QAAQ,GAAG,IAAI,CACnB,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,GAAG,EAClD,WAAW,EACX,kBAAkB,CACnB,CAAC;IACF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAgB;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,UAAU,OAAO,CAAC,IAAI,EAAE,CAAC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