alnair 0.1.0
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/README.md +15 -0
- package/dist/backend.js +86 -0
- package/dist/bin.js +7 -0
- package/dist/cli.js +58 -0
- package/dist/detect.js +115 -0
- package/dist/hooks/claude-grant.js +45 -0
- package/dist/hooks/cursor-grant.js +77 -0
- package/dist/init.js +172 -0
- package/dist/inspect.js +62 -0
- package/dist/integrations/agents-md.js +41 -0
- package/dist/integrations/bootstrap.js +64 -0
- package/dist/integrations/claude-hooks.js +70 -0
- package/dist/integrations/claude.js +48 -0
- package/dist/integrations/codex.js +38 -0
- package/dist/integrations/cursor.js +77 -0
- package/dist/integrations/hooks.js +73 -0
- package/dist/integrations/mcp-resolve.js +11 -0
- package/dist/integrations/mcp.js +31 -0
- package/dist/integrations/paths.js +54 -0
- package/dist/login.js +11 -0
- package/dist/logs.js +58 -0
- package/dist/mint.js +76 -0
- package/dist/status.js +47 -0
- package/dist/ui.js +64 -0
- package/dist/whoami.js +24 -0
- package/package.json +43 -0
package/dist/ui.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { mark } from "alnair-sdk";
|
|
2
|
+
import pc from "picocolors";
|
|
3
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
4
|
+
export { sleep };
|
|
5
|
+
export function blank() {
|
|
6
|
+
console.log();
|
|
7
|
+
}
|
|
8
|
+
/** ▣ Welcome / section marker — Alnair brand */
|
|
9
|
+
export function diamond(text) {
|
|
10
|
+
console.log(` ${mark("brand")} ${pc.bold(text)}`);
|
|
11
|
+
}
|
|
12
|
+
/** Soft body copy under a mark */
|
|
13
|
+
export function copy(text) {
|
|
14
|
+
console.log(` ${pc.dim(text)}`);
|
|
15
|
+
}
|
|
16
|
+
/** Horizontal rule */
|
|
17
|
+
export function rule() {
|
|
18
|
+
console.log(` ${pc.dim("────────────────────────────────────────")}`);
|
|
19
|
+
}
|
|
20
|
+
/** ✓ done — only shown when something was actually found / succeeded */
|
|
21
|
+
export function check(text) {
|
|
22
|
+
console.log(` ${pc.green("✓")} ${text}`);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* ▣ working… then clears to nothing (caller prints ✓ Ready after).
|
|
26
|
+
*/
|
|
27
|
+
export async function working(label, work) {
|
|
28
|
+
process.stdout.write(` ${mark("brand")} ${label}`);
|
|
29
|
+
const started = Date.now();
|
|
30
|
+
try {
|
|
31
|
+
await work();
|
|
32
|
+
const elapsed = Date.now() - started;
|
|
33
|
+
if (elapsed < 420)
|
|
34
|
+
await sleep(420 - elapsed);
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
process.stdout.write(`\r${" ".repeat(label.length + 8)}\r`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Keep the mark line visible — for the sequence of creating steps */
|
|
41
|
+
export async function workingKeep(label, work) {
|
|
42
|
+
console.log(` ${mark("brand")} ${label}`);
|
|
43
|
+
const started = Date.now();
|
|
44
|
+
await work();
|
|
45
|
+
const elapsed = Date.now() - started;
|
|
46
|
+
if (elapsed < 380)
|
|
47
|
+
await sleep(380 - elapsed);
|
|
48
|
+
}
|
|
49
|
+
export function code(text) {
|
|
50
|
+
console.log(` ${pc.cyan(text)}`);
|
|
51
|
+
}
|
|
52
|
+
export function label(title) {
|
|
53
|
+
console.log(` ${pc.dim(title)}`);
|
|
54
|
+
}
|
|
55
|
+
export function value(text) {
|
|
56
|
+
console.log(` ${text}`);
|
|
57
|
+
}
|
|
58
|
+
export function nest(text) {
|
|
59
|
+
console.log(` ${pc.dim("└─")} ${text}`);
|
|
60
|
+
}
|
|
61
|
+
/** Lifecycle stamp for logs / inspect */
|
|
62
|
+
export function stamp(state, text) {
|
|
63
|
+
console.log(` ${mark(state)} ${text}`);
|
|
64
|
+
}
|
package/dist/whoami.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { blank, check, copy, diamond } from "./ui.js";
|
|
5
|
+
export async function whoami() {
|
|
6
|
+
blank();
|
|
7
|
+
diamond("Alnair identity");
|
|
8
|
+
blank();
|
|
9
|
+
try {
|
|
10
|
+
const raw = await readFile(join(homedir(), ".alnair", "identity.json"), "utf8");
|
|
11
|
+
const identity = JSON.parse(raw);
|
|
12
|
+
if (!identity.owner || !identity.expiresAt || new Date(identity.expiresAt).getTime() <= Date.now()) {
|
|
13
|
+
copy("Not connected. Run `alnair login`.");
|
|
14
|
+
blank();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
check(`Connected as ${identity.ownerName || identity.owner}`);
|
|
18
|
+
copy(identity.owner);
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
copy("Not connected. Run `alnair login`.");
|
|
22
|
+
}
|
|
23
|
+
blank();
|
|
24
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alnair",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Give AI agents secure, temporary permissions — alnair init",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"alnair": "./dist/bin.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc -p tsconfig.json",
|
|
14
|
+
"prepare": "npm run build"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/CamiloJac/seren.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"alnair",
|
|
23
|
+
"ai",
|
|
24
|
+
"agents",
|
|
25
|
+
"permissions",
|
|
26
|
+
"capabilities",
|
|
27
|
+
"mcp",
|
|
28
|
+
"claude",
|
|
29
|
+
"cursor"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=18"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"alnair-sdk": "^0.1.0",
|
|
36
|
+
"picocolors": "^1.1.1"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.8.6",
|
|
40
|
+
"typescript": "^5.6.3"
|
|
41
|
+
},
|
|
42
|
+
"license": "MIT"
|
|
43
|
+
}
|