@haystackeditor/cli 0.15.12 → 0.15.13
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/index.js +16 -2
- package/dist/utils/git.js +4 -4
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -42,7 +42,12 @@ import { schemaCommand, listSchemas } from './commands/schema-cmd.js';
|
|
|
42
42
|
import { registerWebhook, listWebhooks, rotateWebhookSecret, setWebhookEnabled, listDeliveries, replayDelivery, } from './commands/webhooks.js';
|
|
43
43
|
import { editRulesCommand, validateRulesCommand } from './commands/rules.js';
|
|
44
44
|
import { headlessLoginCommand, headlessLogoutCommand, listTokensCommand, revokeTokenCommand, } from './commands/tokens.js';
|
|
45
|
-
|
|
45
|
+
// `mcp` is imported lazily inside its command action (below), NOT at the top level.
|
|
46
|
+
// It is the only module that pulls in `@modelcontextprotocol/sdk`; keeping it out of
|
|
47
|
+
// the startup import graph means a missing/broken SDK can never crash core commands
|
|
48
|
+
// like `triage`/`submit`. (0.15.12 shipped `mcp.js` but published its package.json
|
|
49
|
+
// WITHOUT `@modelcontextprotocol/sdk`, so the eager import here hard-crashed every
|
|
50
|
+
// command at startup with ERR_MODULE_NOT_FOUND.)
|
|
46
51
|
// pr-state read helpers (parsePrRef, prReadCommand) are imported by the MCP
|
|
47
52
|
// server directly from ./commands/pr.js; no top-level CLI command is wired
|
|
48
53
|
// here. The previous `pr <ref> [show|merge|snooze|dismiss]` and `fix <ref>`
|
|
@@ -818,10 +823,19 @@ program
|
|
|
818
823
|
.description('Run a stdio MCP server exposing Haystack tools to Claude Code, Cursor, etc.')
|
|
819
824
|
.action(async () => {
|
|
820
825
|
try {
|
|
826
|
+
// Lazy import: only this command needs @modelcontextprotocol/sdk, so we keep it
|
|
827
|
+
// out of the startup graph (see the note where the eager import used to be).
|
|
828
|
+
const { runMcpServer } = await import('./commands/mcp.js');
|
|
821
829
|
await runMcpServer();
|
|
822
830
|
}
|
|
823
831
|
catch (err) {
|
|
824
|
-
|
|
832
|
+
const code = err?.code;
|
|
833
|
+
if (code === 'ERR_MODULE_NOT_FOUND') {
|
|
834
|
+
console.error(chalk.red('mcp server failed:'), 'the @modelcontextprotocol/sdk package is missing. Reinstall the CLI to pull it in (e.g. `npm i -g @haystackeditor/cli@latest`).');
|
|
835
|
+
}
|
|
836
|
+
else {
|
|
837
|
+
console.error(chalk.red('mcp server failed:'), err instanceof Error ? err.message : err);
|
|
838
|
+
}
|
|
825
839
|
process.exit(1);
|
|
826
840
|
}
|
|
827
841
|
});
|
package/dist/utils/git.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides functions for git operations: branch management, push, remote parsing.
|
|
5
5
|
*/
|
|
6
|
-
import { execSync } from 'child_process';
|
|
6
|
+
import { execFileSync, execSync } from 'child_process';
|
|
7
7
|
import * as fs from 'fs';
|
|
8
8
|
import * as os from 'os';
|
|
9
9
|
import * as path from 'path';
|
|
@@ -369,7 +369,7 @@ export function getCommitMessagesSinceBase(baseBranch) {
|
|
|
369
369
|
/** True if `ref` resolves to a commit in the current repo. */
|
|
370
370
|
function gitRefResolves(ref) {
|
|
371
371
|
try {
|
|
372
|
-
|
|
372
|
+
execFileSync('git', ['rev-parse', '--verify', '--quiet', '--', `${ref}^{commit}`], {
|
|
373
373
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
374
374
|
});
|
|
375
375
|
return true;
|
|
@@ -382,7 +382,7 @@ function gitRefResolves(ref) {
|
|
|
382
382
|
function gitIsAncestor(ancestor, descendant) {
|
|
383
383
|
try {
|
|
384
384
|
// exit 0 => ancestor; exit 1 => not; both non-throwing for us via stdio pipe
|
|
385
|
-
|
|
385
|
+
execFileSync('git', ['merge-base', '--is-ancestor', '--', ancestor, descendant], {
|
|
386
386
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
387
387
|
});
|
|
388
388
|
return true;
|
|
@@ -440,7 +440,7 @@ export function resolveDiffBaseRef(baseBranch) {
|
|
|
440
440
|
// if <base> was rewound on the remote).
|
|
441
441
|
let fetched = false;
|
|
442
442
|
try {
|
|
443
|
-
|
|
443
|
+
execFileSync('git', ['fetch', 'origin', `+refs/heads/${baseBranch}:${remoteRef}`], {
|
|
444
444
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
445
445
|
});
|
|
446
446
|
fetched = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haystackeditor/cli",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.13",
|
|
4
4
|
"description": "Set up Haystack for your project — automated PR review, triage, and merge queue",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"url": "https://github.com/haystackeditor/haystack-review/issues"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@modelcontextprotocol/sdk": "1.26.0",
|
|
37
38
|
"chalk": "5.6.2",
|
|
38
39
|
"commander": "12.1.0",
|
|
39
40
|
"fast-glob": "3.3.3",
|