@monadeo.com/grimoire-core 0.2.1 → 0.2.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.
- package/README.md +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -15
- package/package.json +1 -4
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ const client = new GrimoireClient();
|
|
|
11
11
|
const res = await client.search({ query: "revalidateTag", sources: [{ source: "nextjs" }] });
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Auth: browser login stores a refresh token in
|
|
14
|
+
Auth: browser login stores a refresh token in ~/.config/grimoire/credentials.json (0600); CI can set
|
|
15
15
|
`GRIMOIRE_AUTH_TOKEN` with a machine token instead.
|
|
16
16
|
|
|
17
17
|
Apache-2.0. Source: [monadeo/grimoire](https://github.com/monadeo/grimoire).
|
package/dist/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAmBA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAIrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAWrD;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAWD,wBAAsB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAmDrG"}
|
package/dist/auth.js
CHANGED
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
3
|
import { createServer } from "node:http";
|
|
3
|
-
import {
|
|
4
|
+
import { homedir } from "node:os";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
4
6
|
import { fetchWithTimeout } from "./http.js";
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
return
|
|
7
|
+
// Session storage is a 0600 file, not the OS keychain (Astro 2026-07-14):
|
|
8
|
+
// keychain ACLs are per binary, so every agent runtime spawning the MCP server
|
|
9
|
+
// re-prompted the user — gcloud and Codex accept the same file-based model.
|
|
10
|
+
// A machine token via GRIMOIRE_AUTH_TOKEN overrides interactive auth (CI only).
|
|
11
|
+
function credentialsPath() {
|
|
12
|
+
return join(process.env.XDG_CONFIG_HOME ?? join(homedir(), ".config"), "grimoire", "credentials.json");
|
|
11
13
|
}
|
|
12
14
|
export function storeRefreshToken(token) {
|
|
13
|
-
|
|
15
|
+
const path = credentialsPath();
|
|
16
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
17
|
+
writeFileSync(path, JSON.stringify({ refresh_token: token }) + "\n", { mode: 0o600 });
|
|
14
18
|
}
|
|
15
19
|
export function readRefreshToken() {
|
|
16
20
|
try {
|
|
17
|
-
|
|
21
|
+
const parsed = JSON.parse(readFileSync(credentialsPath(), "utf8"));
|
|
22
|
+
return typeof parsed.refresh_token === "string" && parsed.refresh_token !== ""
|
|
23
|
+
? parsed.refresh_token
|
|
24
|
+
: undefined;
|
|
18
25
|
}
|
|
19
26
|
catch {
|
|
20
27
|
return undefined;
|
|
21
28
|
}
|
|
22
29
|
}
|
|
23
30
|
export function clearRefreshToken() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
catch {
|
|
28
|
-
/* already gone */
|
|
29
|
-
}
|
|
31
|
+
if (existsSync(credentialsPath()))
|
|
32
|
+
rmSync(credentialsPath());
|
|
30
33
|
}
|
|
31
34
|
function base64url(buf) {
|
|
32
35
|
return buf.toString("base64url");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monadeo.com/grimoire-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"default": "./dist/index.js"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@napi-rs/keyring": "^1.3.0"
|
|
16
|
-
},
|
|
17
14
|
"devDependencies": {
|
|
18
15
|
"@types/node": "^26.1.0"
|
|
19
16
|
},
|