alnair 0.1.0 → 0.1.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.
- package/dist/cli.js +5 -5
- package/dist/integrations/mcp-resolve.js +2 -2
- package/dist/integrations/paths.js +25 -17
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { mark } from "alnair-sdk";
|
|
2
2
|
import pc from "picocolors";
|
|
3
3
|
import { init } from "./init.js";
|
|
4
|
+
import { status } from "./status.js";
|
|
5
|
+
import { login } from "./login.js";
|
|
6
|
+
import { logs } from "./logs.js";
|
|
7
|
+
import { inspect } from "./inspect.js";
|
|
8
|
+
import { mint } from "./mint.js";
|
|
4
9
|
const HELP = `
|
|
5
10
|
${mark("brand")} ${pc.bold("Alnair")}
|
|
6
11
|
|
|
@@ -28,27 +33,22 @@ export async function main(args) {
|
|
|
28
33
|
return;
|
|
29
34
|
}
|
|
30
35
|
if (cmd === "status") {
|
|
31
|
-
const { status } = await import("./status.js");
|
|
32
36
|
await status({ cwd: process.cwd() });
|
|
33
37
|
return;
|
|
34
38
|
}
|
|
35
39
|
if (cmd === "login") {
|
|
36
|
-
const { login } = await import("./login.js");
|
|
37
40
|
await login();
|
|
38
41
|
return;
|
|
39
42
|
}
|
|
40
43
|
if (cmd === "logs") {
|
|
41
|
-
const { logs } = await import("./logs.js");
|
|
42
44
|
await logs({ cwd: process.cwd() });
|
|
43
45
|
return;
|
|
44
46
|
}
|
|
45
47
|
if (cmd === "inspect") {
|
|
46
|
-
const { inspect } = await import("./inspect.js");
|
|
47
48
|
await inspect({ cwd: process.cwd(), token: args[1] });
|
|
48
49
|
return;
|
|
49
50
|
}
|
|
50
51
|
if (cmd === "mint") {
|
|
51
|
-
const { mint } = await import("./mint.js");
|
|
52
52
|
await mint({ cwd: process.cwd(), args: args.slice(1) });
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolve the local Alnair MCP server command for this monorepo / install.
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { resolveMcpServerRelativePath } from "./paths.js";
|
|
5
5
|
export function resolveAlnairMcpEntry(cwd) {
|
|
6
|
-
const local =
|
|
6
|
+
const local = resolveMcpServerRelativePath(cwd);
|
|
7
7
|
if (local) {
|
|
8
8
|
return { command: "node", args: [local] };
|
|
9
9
|
}
|
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
* Resolve Alnair package paths for installed projects (npm) and monorepo dev.
|
|
3
3
|
*/
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
|
-
import { dirname, join
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
export function cliPackageVersion() {
|
|
8
8
|
try {
|
|
9
9
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
const
|
|
11
|
-
|
|
10
|
+
for (const rel of ["../package.json", "../../package.json"]) {
|
|
11
|
+
const pkgPath = join(here, rel);
|
|
12
|
+
if (existsSync(pkgPath)) {
|
|
13
|
+
const raw = readFileSync(pkgPath, "utf8");
|
|
14
|
+
return JSON.parse(raw).version ?? "0.1.0";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
12
17
|
}
|
|
13
18
|
catch {
|
|
14
|
-
|
|
19
|
+
/* fall through */
|
|
15
20
|
}
|
|
21
|
+
return "0.1.0";
|
|
16
22
|
}
|
|
17
23
|
/** Absolute path to alnair-sdk gate.js for git hooks, when present. */
|
|
18
24
|
export function resolveGatePath(cwd) {
|
|
@@ -32,23 +38,25 @@ function gateCandidates(cwd) {
|
|
|
32
38
|
/** Built hook script shipped inside the alnair CLI package. */
|
|
33
39
|
export function resolveBundledHook(name) {
|
|
34
40
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
41
|
+
const bundled = join(here, "hooks", `${name}.js`);
|
|
42
|
+
if (existsSync(bundled))
|
|
43
|
+
return bundled;
|
|
35
44
|
return join(here, "../hooks", `${name}.js`);
|
|
36
45
|
}
|
|
37
|
-
|
|
46
|
+
/** Portable relative path for MCP config (no absolute machine paths). */
|
|
47
|
+
export function resolveMcpServerRelativePath(cwd) {
|
|
38
48
|
const candidates = [
|
|
39
|
-
join(
|
|
40
|
-
join(
|
|
49
|
+
join("node_modules", "alnair-mcp", "dist", "server.js"),
|
|
50
|
+
join("packages", "mcp", "dist", "server.js"),
|
|
41
51
|
];
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
/* ignore */
|
|
48
|
-
}
|
|
49
|
-
for (const candidate of candidates) {
|
|
50
|
-
if (existsSync(candidate))
|
|
51
|
-
return candidate;
|
|
52
|
+
for (const rel of candidates) {
|
|
53
|
+
if (existsSync(join(cwd, rel)))
|
|
54
|
+
return rel;
|
|
52
55
|
}
|
|
53
56
|
return null;
|
|
54
57
|
}
|
|
58
|
+
/** @deprecated use resolveMcpServerRelativePath */
|
|
59
|
+
export function resolveMcpServerPath(cwd) {
|
|
60
|
+
const rel = resolveMcpServerRelativePath(cwd);
|
|
61
|
+
return rel ? join(cwd, rel) : null;
|
|
62
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alnair",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Give AI agents secure, temporary permissions — alnair init",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"node": ">=18"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"alnair-sdk": "^0.1.
|
|
35
|
+
"alnair-sdk": "^0.1.1",
|
|
36
36
|
"picocolors": "^1.1.1"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|