codeblog-app 2.2.4 → 2.2.6
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/package.json +7 -7
- package/src/auth/oauth.ts +14 -0
- package/src/config/index.ts +1 -0
- package/src/tui/app.tsx +19 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "codeblog-app",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.6",
|
|
5
5
|
"description": "CLI client for CodeBlog — the forum where AI writes the posts",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"typescript": "5.8.2"
|
|
57
57
|
},
|
|
58
58
|
"optionalDependencies": {
|
|
59
|
-
"codeblog-app-darwin-arm64": "2.2.
|
|
60
|
-
"codeblog-app-darwin-x64": "2.2.
|
|
61
|
-
"codeblog-app-linux-arm64": "2.2.
|
|
62
|
-
"codeblog-app-linux-x64": "2.2.
|
|
63
|
-
"codeblog-app-windows-x64": "2.2.
|
|
59
|
+
"codeblog-app-darwin-arm64": "2.2.6",
|
|
60
|
+
"codeblog-app-darwin-x64": "2.2.6",
|
|
61
|
+
"codeblog-app-linux-arm64": "2.2.6",
|
|
62
|
+
"codeblog-app-linux-x64": "2.2.6",
|
|
63
|
+
"codeblog-app-windows-x64": "2.2.6"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@ai-sdk/anthropic": "^3.0.44",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@opentui/core": "^0.1.79",
|
|
72
72
|
"@opentui/solid": "^0.1.79",
|
|
73
73
|
"ai": "^6.0.86",
|
|
74
|
-
"codeblog-mcp": "^2.1.
|
|
74
|
+
"codeblog-mcp": "^2.1.5",
|
|
75
75
|
"drizzle-orm": "1.0.0-beta.12-a5629fb",
|
|
76
76
|
"fuzzysort": "^3.1.0",
|
|
77
77
|
"hono": "4.10.7",
|
package/src/auth/oauth.ts
CHANGED
|
@@ -24,6 +24,20 @@ export namespace OAuth {
|
|
|
24
24
|
} catch (err) {
|
|
25
25
|
log.warn("failed to sync API key to MCP config", { error: String(err) })
|
|
26
26
|
}
|
|
27
|
+
// Fetch agent name and save to CLI config
|
|
28
|
+
try {
|
|
29
|
+
const meRes = await fetch(`${base}/api/v1/agents/me`, {
|
|
30
|
+
headers: { Authorization: `Bearer ${key}` },
|
|
31
|
+
})
|
|
32
|
+
if (meRes.ok) {
|
|
33
|
+
const meData = await meRes.json() as { agent?: { name?: string } }
|
|
34
|
+
if (meData.agent?.name) {
|
|
35
|
+
await Config.save({ activeAgent: meData.agent.name })
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
} catch (err) {
|
|
39
|
+
log.warn("failed to fetch agent info", { error: String(err) })
|
|
40
|
+
}
|
|
27
41
|
log.info("authenticated with api key")
|
|
28
42
|
} else if (token) {
|
|
29
43
|
await Auth.set({ type: "jwt", value: token, username })
|
package/src/config/index.ts
CHANGED
package/src/tui/app.tsx
CHANGED
|
@@ -85,6 +85,25 @@ function App() {
|
|
|
85
85
|
const cfg = await Config.load()
|
|
86
86
|
if (cfg.activeAgent) {
|
|
87
87
|
setActiveAgent(cfg.activeAgent)
|
|
88
|
+
} else if (loggedIn()) {
|
|
89
|
+
// If logged in but no activeAgent cached, fetch from API
|
|
90
|
+
const { Auth } = await import("../auth")
|
|
91
|
+
const tok = await Auth.get()
|
|
92
|
+
if (tok?.type === "apikey" && tok.value) {
|
|
93
|
+
try {
|
|
94
|
+
const base = await Config.url()
|
|
95
|
+
const res = await fetch(`${base}/api/v1/agents/me`, {
|
|
96
|
+
headers: { Authorization: `Bearer ${tok.value}` },
|
|
97
|
+
})
|
|
98
|
+
if (res.ok) {
|
|
99
|
+
const data = await res.json() as { agent?: { name?: string } }
|
|
100
|
+
if (data.agent?.name) {
|
|
101
|
+
setActiveAgent(data.agent.name)
|
|
102
|
+
await Config.save({ activeAgent: data.agent.name })
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} catch {}
|
|
106
|
+
}
|
|
88
107
|
}
|
|
89
108
|
} catch {}
|
|
90
109
|
|