@hivemindai/mcp-server 0.4.1 → 0.4.3
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/cli/commands/guard.d.ts +1 -1
- package/dist/cli/commands/guard.d.ts.map +1 -1
- package/dist/cli/commands/guard.js +33 -36
- package/dist/cli/commands/guard.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +106 -48
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/release.d.ts.map +1 -1
- package/dist/cli/commands/release.js +3 -3
- package/dist/cli/commands/release.js.map +1 -1
- package/dist/cli/index.js +14 -9
- package/dist/cli/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function guard(): Promise<void>;
|
|
1
|
+
export declare function guard(args?: string[]): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=guard.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/guard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/guard.ts"],"names":[],"mappings":"AAiCA,wBAAsB,KAAK,CAAC,IAAI,GAAE,MAAM,EAAO,iBAuG9C"}
|
|
@@ -12,11 +12,11 @@ function loadCredentials() {
|
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function getAgentName() {
|
|
16
|
-
|
|
17
|
-
return process.env.HIVEMIND_AGENT ?? `claude-${process.pid}`;
|
|
15
|
+
function getAgentName(input) {
|
|
16
|
+
return process.env.HIVEMIND_AGENT ?? (input.session_id ? `claude-${input.session_id}` : `claude-${process.ppid}`);
|
|
18
17
|
}
|
|
19
|
-
export async function guard() {
|
|
18
|
+
export async function guard(args = []) {
|
|
19
|
+
const policiesOnly = args.includes("--policies-only");
|
|
20
20
|
// Read hook input from stdin
|
|
21
21
|
let input;
|
|
22
22
|
try {
|
|
@@ -24,20 +24,17 @@ export async function guard() {
|
|
|
24
24
|
input = JSON.parse(raw);
|
|
25
25
|
}
|
|
26
26
|
catch {
|
|
27
|
-
// Can't parse stdin — allow the tool call (don't block on hook errors)
|
|
28
27
|
process.exit(0);
|
|
29
28
|
}
|
|
30
29
|
const filePath = input.tool_input?.file_path;
|
|
31
30
|
if (!filePath) {
|
|
32
|
-
// No file path (e.g. Bash tool) — allow
|
|
33
31
|
process.exit(0);
|
|
34
32
|
}
|
|
35
33
|
const creds = loadCredentials();
|
|
36
34
|
if (!creds) {
|
|
37
|
-
// No credentials — not in cloud mode, allow
|
|
38
35
|
process.exit(0);
|
|
39
36
|
}
|
|
40
|
-
const agent = getAgentName();
|
|
37
|
+
const agent = getAgentName(input);
|
|
41
38
|
const headers = {
|
|
42
39
|
Authorization: `Bearer ${creds.api_key}`,
|
|
43
40
|
"Content-Type": "application/json",
|
|
@@ -68,37 +65,37 @@ export async function guard() {
|
|
|
68
65
|
catch {
|
|
69
66
|
// Policy check failed — don't block on network errors
|
|
70
67
|
}
|
|
71
|
-
// 2. Acquire lock
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
68
|
+
// 2. Acquire lock (skip if --policies-only)
|
|
69
|
+
if (!policiesOnly) {
|
|
70
|
+
try {
|
|
71
|
+
const lockRes = await fetch(`${creds.api_url}/v1/locks/${encodeURIComponent(resource)}`, {
|
|
72
|
+
method: "POST",
|
|
73
|
+
headers,
|
|
74
|
+
body: JSON.stringify({ agent }),
|
|
75
|
+
});
|
|
76
|
+
if (lockRes.ok) {
|
|
77
|
+
const lockData = await lockRes.json();
|
|
78
|
+
if (lockData.locked) {
|
|
79
|
+
process.exit(0);
|
|
80
|
+
}
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
process.
|
|
82
|
+
if (lockRes.status === 409) {
|
|
83
|
+
const lockData = await lockRes.json();
|
|
84
|
+
const holder = lockData.held_by?.agent ?? "unknown";
|
|
85
|
+
if (holder === agent) {
|
|
86
|
+
process.exit(0);
|
|
87
|
+
}
|
|
88
|
+
process.stderr.write(`BLOCKED: ${resource} is locked by ${holder}.\n\n` +
|
|
89
|
+
`Another agent is editing this file. To override:\n` +
|
|
90
|
+
`1. hivemind_approvals(action: "request", channel: "general", description: "Need to edit ${resource}, locked by ${holder}")\n` +
|
|
91
|
+
`2. Wait for approval\n` +
|
|
92
|
+
`3. hivemind_lock(action: "acquire", resource: "${resource}", force_correlation_id: "<correlation_id>")\n`);
|
|
93
|
+
process.exit(2);
|
|
91
94
|
}
|
|
92
|
-
process.stderr.write(`BLOCKED: ${resource} is locked by ${holder}.\n\n` +
|
|
93
|
-
`Another agent is editing this file. To override:\n` +
|
|
94
|
-
`1. hivemind_approvals(action: "request", channel: "general", description: "Need to edit ${resource}, locked by ${holder}")\n` +
|
|
95
|
-
`2. Wait for approval\n` +
|
|
96
|
-
`3. hivemind_lock(action: "acquire", resource: "${resource}", force_correlation_id: "<correlation_id>")\n`);
|
|
97
|
-
process.exit(2);
|
|
98
95
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
catch {
|
|
97
|
+
// Lock request failed — don't block on network errors
|
|
98
|
+
}
|
|
102
99
|
}
|
|
103
100
|
// Default: allow
|
|
104
101
|
process.exit(0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard.js","sourceRoot":"","sources":["../../../src/cli/commands/guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAA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,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC;aAChC,CACF,CAAC;YAEF,IAAI,OAAO,CAAC,EAAE,EAAE,CAAC;gBACf,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtC,IAAI,QAAQ,CAAC,MAAM,EAAE,CAAC;oBACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;YACH,CAAC;YAED,IAAI,OAAO,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;gBAC3B,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;gBACtC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,KAAK,IAAI,SAAS,CAAC;gBAEpD,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;oBACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBAClB,CAAC;gBAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,YAAY,QAAQ,iBAAiB,MAAM,OAAO;oBAClD,oDAAoD;oBACpD,2FAA2F,QAAQ,eAAe,MAAM,MAAM;oBAC9H,wBAAwB;oBACxB,kDAAkD,QAAQ,gDAAgD,CAC3G,CAAC;gBACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,sDAAsD;QACxD,CAAC;IACH,CAAC;IAED,iBAAiB;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function init(): Promise<void>;
|
|
1
|
+
export declare function init(args?: string[]): Promise<void>;
|
|
2
2
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAyFA,wBAAsB,IAAI,CAAC,IAAI,GAAE,MAAM,EAAO,iBAmH7C"}
|
|
@@ -2,27 +2,34 @@ import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
const HIVEMIND_SECTION_START = "<!-- hivemind:start -->";
|
|
4
4
|
const HIVEMIND_SECTION_END = "<!-- hivemind:end -->";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
### Rule 1: Announce your task IMMEDIATELY
|
|
5
|
+
function buildClaudeMd(mode) {
|
|
6
|
+
const rules = [];
|
|
7
|
+
// Rule 1 — always present
|
|
8
|
+
rules.push(`### Rule 1: Announce your task IMMEDIATELY
|
|
11
9
|
|
|
12
10
|
As your FIRST action when starting any task, BEFORE reading files or planning, call:
|
|
13
11
|
\`\`\`
|
|
14
12
|
hivemind_publish(channel: "general", event_type: "task.created", data: {"description": "<what you are about to do>"})
|
|
15
13
|
\`\`\`
|
|
16
|
-
Also call \`hivemind_status()\` to see what other agents are working on
|
|
17
|
-
|
|
18
|
-
|
|
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
|
|
19
18
|
|
|
20
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.
|
|
21
20
|
|
|
22
21
|
If a lock blocks you: another agent is editing that file. Request approval to override, or work on a different file.
|
|
23
|
-
If a policy blocks you: the file requires human approval. Request approval and wait
|
|
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
|
|
24
26
|
|
|
25
|
-
|
|
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
|
|
26
33
|
|
|
27
34
|
After completing work, publish what you did:
|
|
28
35
|
\`\`\`
|
|
@@ -30,59 +37,78 @@ hivemind_publish(channel: "general", event_type: "task.completed", data: {"descr
|
|
|
30
37
|
\`\`\`
|
|
31
38
|
Also publish \`decision.made\` when choosing between approaches, \`task.blocked\` when stuck, and \`bug.found\` when discovering bugs.
|
|
32
39
|
|
|
33
|
-
Do NOT publish routine activity (file reads, retries, lint fixes). Only publish outcomes and decisions
|
|
40
|
+
Do NOT publish routine activity (file reads, retries, lint fixes). Only publish outcomes and decisions.`);
|
|
41
|
+
return `${HIVEMIND_SECTION_START}
|
|
42
|
+
## Hivemind — MANDATORY agent coordination
|
|
43
|
+
|
|
44
|
+
This project uses Hivemind for multi-agent coordination. You MUST follow ALL of these rules. They are not optional.
|
|
45
|
+
|
|
46
|
+
${rules.join("\n\n")}
|
|
34
47
|
${HIVEMIND_SECTION_END}`;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
}
|
|
49
|
+
function buildHooksConfig(mode) {
|
|
50
|
+
if (mode === "events-only") {
|
|
51
|
+
return null; // No hooks
|
|
52
|
+
}
|
|
53
|
+
const hooks = {};
|
|
54
|
+
if (mode === "full") {
|
|
55
|
+
hooks.PreToolUse = [
|
|
56
|
+
{
|
|
57
|
+
matcher: "Edit|Write",
|
|
58
|
+
hooks: [{ type: "command", command: "hivemind guard", timeout: 10 }],
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
hooks.PostToolUse = [
|
|
38
62
|
{
|
|
39
63
|
matcher: "Edit|Write",
|
|
40
|
-
hooks: [
|
|
41
|
-
{
|
|
42
|
-
type: "command",
|
|
43
|
-
command: "hivemind guard",
|
|
44
|
-
timeout: 10,
|
|
45
|
-
},
|
|
46
|
-
],
|
|
64
|
+
hooks: [{ type: "command", command: "hivemind release", timeout: 10 }],
|
|
47
65
|
},
|
|
48
|
-
]
|
|
49
|
-
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
else if (mode === "no-locks") {
|
|
69
|
+
hooks.PreToolUse = [
|
|
50
70
|
{
|
|
51
71
|
matcher: "Edit|Write",
|
|
52
|
-
hooks: [
|
|
53
|
-
{
|
|
54
|
-
type: "command",
|
|
55
|
-
command: "hivemind release",
|
|
56
|
-
timeout: 10,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
72
|
+
hooks: [{ type: "command", command: "hivemind guard --policies-only", timeout: 10 }],
|
|
59
73
|
},
|
|
60
|
-
]
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
74
|
+
];
|
|
75
|
+
// No PostToolUse — no locks to release
|
|
76
|
+
}
|
|
77
|
+
return hooks;
|
|
78
|
+
}
|
|
79
|
+
export async function init(args = []) {
|
|
80
|
+
const mode = args.includes("--events-only")
|
|
81
|
+
? "events-only"
|
|
82
|
+
: args.includes("--no-locks")
|
|
83
|
+
? "no-locks"
|
|
84
|
+
: "full";
|
|
64
85
|
const cwd = process.cwd();
|
|
65
86
|
const claudeMdPath = join(cwd, "CLAUDE.md");
|
|
66
87
|
console.log("Hivemind Init\n");
|
|
88
|
+
if (mode !== "full") {
|
|
89
|
+
console.log(` Mode: ${mode}\n`);
|
|
90
|
+
}
|
|
67
91
|
// --- 1. Update CLAUDE.md ---
|
|
92
|
+
const claudeMdContent = buildClaudeMd(mode);
|
|
68
93
|
if (existsSync(claudeMdPath)) {
|
|
69
94
|
const existing = readFileSync(claudeMdPath, "utf-8");
|
|
70
95
|
if (existing.includes(HIVEMIND_SECTION_START)) {
|
|
71
96
|
const before = existing.slice(0, existing.indexOf(HIVEMIND_SECTION_START));
|
|
72
97
|
const after = existing.slice(existing.indexOf(HIVEMIND_SECTION_END) + HIVEMIND_SECTION_END.length);
|
|
73
|
-
writeFileSync(claudeMdPath, before +
|
|
98
|
+
writeFileSync(claudeMdPath, before + claudeMdContent + after);
|
|
74
99
|
console.log(" Updated Hivemind section in CLAUDE.md");
|
|
75
100
|
}
|
|
76
101
|
else {
|
|
77
|
-
writeFileSync(claudeMdPath, existing.trimEnd() + "\n\n" +
|
|
102
|
+
writeFileSync(claudeMdPath, existing.trimEnd() + "\n\n" + claudeMdContent + "\n");
|
|
78
103
|
console.log(" Added Hivemind section to CLAUDE.md");
|
|
79
104
|
}
|
|
80
105
|
}
|
|
81
106
|
else {
|
|
82
|
-
writeFileSync(claudeMdPath, `# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n${
|
|
107
|
+
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`);
|
|
83
108
|
console.log(" Created CLAUDE.md with Hivemind instructions");
|
|
84
109
|
}
|
|
85
110
|
// --- 2. Configure Claude Code hooks ---
|
|
111
|
+
const hooksConfig = buildHooksConfig(mode);
|
|
86
112
|
const claudeDir = join(cwd, ".claude");
|
|
87
113
|
const settingsPath = join(claudeDir, "settings.local.json");
|
|
88
114
|
mkdirSync(claudeDir, { recursive: true });
|
|
@@ -95,32 +121,64 @@ export async function init() {
|
|
|
95
121
|
// If parse fails, start fresh
|
|
96
122
|
}
|
|
97
123
|
}
|
|
98
|
-
//
|
|
124
|
+
// Filter out any existing hivemind hooks
|
|
99
125
|
const existingHooks = (settings.hooks ?? {});
|
|
100
126
|
const newHooks = { ...existingHooks };
|
|
101
|
-
// Filter out any existing hivemind hooks, then add ours
|
|
102
127
|
for (const event of ["PreToolUse", "PostToolUse"]) {
|
|
103
128
|
const existing = (existingHooks[event] ?? []);
|
|
104
129
|
const filtered = existing.filter((h) => {
|
|
105
|
-
// Keep hooks that aren't hivemind
|
|
106
130
|
const cmds = h.hooks?.map((hh) => hh.command ?? "") ?? [];
|
|
107
131
|
return !cmds.some((c) => c.startsWith("hivemind "));
|
|
108
132
|
});
|
|
109
|
-
|
|
110
|
-
|
|
133
|
+
if (hooksConfig && hooksConfig[event]) {
|
|
134
|
+
newHooks[event] = [...filtered, ...hooksConfig[event]];
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
// No hivemind hooks for this event — keep only non-hivemind hooks
|
|
138
|
+
newHooks[event] = filtered.length > 0 ? filtered : [];
|
|
139
|
+
if (newHooks[event].length === 0) {
|
|
140
|
+
delete newHooks[event];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
111
143
|
}
|
|
112
|
-
settings.hooks = newHooks;
|
|
144
|
+
settings.hooks = Object.keys(newHooks).length > 0 ? newHooks : undefined;
|
|
145
|
+
if (!settings.hooks)
|
|
146
|
+
delete settings.hooks;
|
|
113
147
|
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + "\n");
|
|
114
|
-
|
|
115
|
-
|
|
148
|
+
if (hooksConfig) {
|
|
149
|
+
console.log(" Configured Claude Code hooks in .claude/settings.local.json");
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
console.log(" Cleaned hooks from .claude/settings.local.json (events-only mode)");
|
|
153
|
+
}
|
|
154
|
+
// --- 3. Summary ---
|
|
155
|
+
if (mode === "full") {
|
|
156
|
+
console.log(`
|
|
116
157
|
Done! Hivemind is now active in this project:
|
|
117
158
|
|
|
118
159
|
- CLAUDE.md: Agent instructions for publishing events
|
|
119
160
|
- Hooks: Auto-lock files before edit, auto-release after
|
|
120
161
|
- Hooks: Auto-check approval policies before edit
|
|
121
162
|
|
|
122
|
-
Locks and policies are
|
|
123
|
-
to remember to call hivemind_lock or hivemind_approvals manually.
|
|
163
|
+
Locks and policies are enforced automatically.
|
|
124
164
|
`);
|
|
165
|
+
}
|
|
166
|
+
else if (mode === "no-locks") {
|
|
167
|
+
console.log(`
|
|
168
|
+
Done! Hivemind is now active in this project:
|
|
169
|
+
|
|
170
|
+
- CLAUDE.md: Agent instructions for publishing events
|
|
171
|
+
- Hooks: Auto-check approval policies before edit
|
|
172
|
+
- No file locking (use this when agents work on separate branches)
|
|
173
|
+
`);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
console.log(`
|
|
177
|
+
Done! Hivemind is now active in this project:
|
|
178
|
+
|
|
179
|
+
- CLAUDE.md: Agent instructions for publishing events
|
|
180
|
+
- No hooks (agents coordinate via events only)
|
|
181
|
+
`);
|
|
182
|
+
}
|
|
125
183
|
}
|
|
126
184
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AACzD,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AACzD,MAAM,oBAAoB,GAAG,uBAAuB,CAAC;AAIrD,SAAS,aAAa,CAAC,IAAc;IACnC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,0BAA0B;IAC1B,KAAK,CAAC,IAAI,CAAC;;;;;;yEAM4D,CAAC,CAAC;IAEzE,wCAAwC;IACxC,IAAI,IAAI,KAAK,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AAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;IAC/E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,qEAAqE,CAAC,CAAC;IACrF,CAAC;IAED,qBAAqB;IAErB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC;;;;;;;;CAQf,CAAC,CAAC;IACD,CAAC;SAAM,IAAI,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC;;;;;;CAMf,CAAC,CAAC;IACD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC;;;;;CAKf,CAAC,CAAC;IACD,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/release.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/release.ts"],"names":[],"mappings":"AAgCA,wBAAsB,OAAO,kBA0C5B"}
|
|
@@ -12,8 +12,8 @@ function loadCredentials() {
|
|
|
12
12
|
return null;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function getAgentName() {
|
|
16
|
-
return process.env.HIVEMIND_AGENT ?? `claude-${process.
|
|
15
|
+
function getAgentName(input) {
|
|
16
|
+
return process.env.HIVEMIND_AGENT ?? (input.session_id ? `claude-${input.session_id}` : `claude-${process.ppid}`);
|
|
17
17
|
}
|
|
18
18
|
export async function release() {
|
|
19
19
|
let input;
|
|
@@ -32,7 +32,7 @@ export async function release() {
|
|
|
32
32
|
if (!creds) {
|
|
33
33
|
process.exit(0);
|
|
34
34
|
}
|
|
35
|
-
const agent = getAgentName();
|
|
35
|
+
const agent = getAgentName(input);
|
|
36
36
|
// Make path relative
|
|
37
37
|
const cwd = input.cwd ?? process.cwd();
|
|
38
38
|
let resource = filePath;
|
|
@@ -1 +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;
|
|
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,CAAC;AACpH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,IAAI,KAAgB,CAAC;IACrB,IAAI,CAAC;QACH,MAAM,GAAG,GAA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AAC;AAClB,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -7,15 +7,16 @@ import { init } from "./commands/init.js";
|
|
|
7
7
|
import { guard } from "./commands/guard.js";
|
|
8
8
|
import { release } from "./commands/release.js";
|
|
9
9
|
const command = process.argv[2];
|
|
10
|
+
const args = process.argv.slice(3);
|
|
10
11
|
const commands = {
|
|
11
|
-
login,
|
|
12
|
-
whoami,
|
|
13
|
-
logout,
|
|
14
|
-
status,
|
|
15
|
-
switch: switchOrg,
|
|
16
|
-
init,
|
|
17
|
-
guard,
|
|
18
|
-
release,
|
|
12
|
+
login: () => login(),
|
|
13
|
+
whoami: () => whoami(),
|
|
14
|
+
logout: () => logout(),
|
|
15
|
+
status: () => status(),
|
|
16
|
+
switch: () => switchOrg(),
|
|
17
|
+
init: (a) => init(a),
|
|
18
|
+
guard: (a) => guard(a),
|
|
19
|
+
release: () => release(),
|
|
19
20
|
};
|
|
20
21
|
async function main() {
|
|
21
22
|
if (!command || command === "--help" || command === "-h") {
|
|
@@ -30,6 +31,10 @@ Commands:
|
|
|
30
31
|
switch Switch to a different organization
|
|
31
32
|
init Add Hivemind instructions to CLAUDE.md + set up hooks
|
|
32
33
|
|
|
34
|
+
Init options:
|
|
35
|
+
--no-locks Skip file locking (for teams using separate branches)
|
|
36
|
+
--events-only Events only, no hooks (lightweight coordination)
|
|
37
|
+
|
|
33
38
|
Options:
|
|
34
39
|
--help Show this help message
|
|
35
40
|
`.trim());
|
|
@@ -41,7 +46,7 @@ Options:
|
|
|
41
46
|
console.error(`Run "hivemind --help" for usage.`);
|
|
42
47
|
process.exit(1);
|
|
43
48
|
}
|
|
44
|
-
await handler();
|
|
49
|
+
await handler(args);
|
|
45
50
|
}
|
|
46
51
|
main().catch((err) => {
|
|
47
52
|
console.error(err instanceof Error ? err.message : String(err));
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],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