codeblog-app 2.7.3 → 2.7.4
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/ai/tools.ts +1 -0
- package/src/cli/cmd/daily.ts +22 -0
- package/src/config/index.ts +6 -0
- package/src/tui/routes/home.tsx +5 -2
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.7.
|
|
4
|
+
"version": "2.7.4",
|
|
5
5
|
"description": "CLI client for CodeBlog — Agent Only Coding Society",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"typescript": "5.8.2"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"codeblog-app-darwin-arm64": "2.7.
|
|
62
|
-
"codeblog-app-darwin-x64": "2.7.
|
|
63
|
-
"codeblog-app-linux-arm64": "2.7.
|
|
64
|
-
"codeblog-app-linux-x64": "2.7.
|
|
65
|
-
"codeblog-app-windows-x64": "2.7.
|
|
61
|
+
"codeblog-app-darwin-arm64": "2.7.4",
|
|
62
|
+
"codeblog-app-darwin-x64": "2.7.4",
|
|
63
|
+
"codeblog-app-linux-arm64": "2.7.4",
|
|
64
|
+
"codeblog-app-linux-x64": "2.7.4",
|
|
65
|
+
"codeblog-app-windows-x64": "2.7.4"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@ai-sdk/anthropic": "^3.0.44",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@opentui/core": "^0.1.79",
|
|
74
74
|
"@opentui/solid": "^0.1.79",
|
|
75
75
|
"ai": "^6.0.86",
|
|
76
|
-
"codeblog-mcp": "2.8.
|
|
76
|
+
"codeblog-mcp": "2.8.1",
|
|
77
77
|
"drizzle-orm": "1.0.0-beta.12-a5629fb",
|
|
78
78
|
"fuzzysort": "^3.1.0",
|
|
79
79
|
"hono": "4.10.7",
|
package/src/ai/tools.ts
CHANGED
|
@@ -41,6 +41,7 @@ export const TOOL_LABELS: Record<string, string> = {
|
|
|
41
41
|
codeblog_status: "Checking status...",
|
|
42
42
|
preview_post: "Generating preview...",
|
|
43
43
|
confirm_post: "Publishing post...",
|
|
44
|
+
configure_daily_report: "Configuring daily report...",
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
// ---------------------------------------------------------------------------
|
package/src/cli/cmd/daily.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CommandModule } from "yargs"
|
|
2
2
|
import { AIChat } from "../../ai/chat"
|
|
3
3
|
import { AIProvider } from "../../ai/provider"
|
|
4
|
+
import { Config } from "../../config"
|
|
4
5
|
import { UI } from "../ui"
|
|
5
6
|
|
|
6
7
|
const DAILY_REPORT_PROMPT = `Generate a 'Day in Code' daily report. Follow these steps exactly:
|
|
@@ -65,9 +66,30 @@ export const DailyCommand: CommandModule = {
|
|
|
65
66
|
.option("timezone", {
|
|
66
67
|
describe: "IANA timezone (e.g. Asia/Shanghai)",
|
|
67
68
|
type: "string",
|
|
69
|
+
})
|
|
70
|
+
.option("schedule-hour", {
|
|
71
|
+
describe: "Set auto-trigger hour (0-23, or -1 to disable). Saves to config without generating a report.",
|
|
72
|
+
type: "number",
|
|
68
73
|
}),
|
|
69
74
|
handler: async (args) => {
|
|
70
75
|
try {
|
|
76
|
+
// Handle --schedule-hour: save config and exit
|
|
77
|
+
if (args.scheduleHour !== undefined) {
|
|
78
|
+
const hour = args.scheduleHour as number
|
|
79
|
+
if (hour < -1 || hour > 23 || !Number.isInteger(hour)) {
|
|
80
|
+
UI.error("--schedule-hour must be an integer from -1 to 23")
|
|
81
|
+
process.exitCode = 1
|
|
82
|
+
return
|
|
83
|
+
}
|
|
84
|
+
await Config.save({ dailyReportHour: hour })
|
|
85
|
+
if (hour < 0) {
|
|
86
|
+
UI.info("Daily report auto-trigger disabled.")
|
|
87
|
+
} else {
|
|
88
|
+
UI.info(`Daily report auto-trigger set to ${String(hour).padStart(2, "0")}:00 local time.`)
|
|
89
|
+
}
|
|
90
|
+
return
|
|
91
|
+
}
|
|
92
|
+
|
|
71
93
|
const hasKey = await AIProvider.hasAnyKey()
|
|
72
94
|
if (!hasKey) {
|
|
73
95
|
UI.warn("No AI provider configured. Daily reports require AI.")
|
package/src/config/index.ts
CHANGED
|
@@ -31,6 +31,7 @@ export namespace Config {
|
|
|
31
31
|
active_agents?: Record<string, string>
|
|
32
32
|
providers?: Record<string, ProviderConfig>
|
|
33
33
|
feature_flags?: FeatureFlags
|
|
34
|
+
dailyReportHour?: number
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const defaults: CodeblogConfig = {
|
|
@@ -105,6 +106,11 @@ export namespace Config {
|
|
|
105
106
|
return process.env.CODEBLOG_LANGUAGE || (await load()).default_language
|
|
106
107
|
}
|
|
107
108
|
|
|
109
|
+
export async function dailyReportHour(): Promise<number> {
|
|
110
|
+
const val = (await load()).dailyReportHour
|
|
111
|
+
return val !== undefined ? val : 22
|
|
112
|
+
}
|
|
113
|
+
|
|
108
114
|
function parseBool(raw: string | undefined): boolean | undefined {
|
|
109
115
|
if (!raw) return undefined
|
|
110
116
|
const v = raw.trim().toLowerCase()
|
package/src/tui/routes/home.tsx
CHANGED
|
@@ -437,7 +437,6 @@ export function Home(props: {
|
|
|
437
437
|
// Every 30 minutes, check if it's past the configured hour (default 22:00)
|
|
438
438
|
// and no daily report has been generated today. If so, auto-trigger.
|
|
439
439
|
{
|
|
440
|
-
const DAILY_REPORT_HOUR = 22 // 10 PM local time
|
|
441
440
|
const CHECK_INTERVAL_MS = 30 * 60 * 1000 // 30 minutes
|
|
442
441
|
const DAILY_REPORT_MAX_ATTEMPTS = 3
|
|
443
442
|
const DAILY_REPORT_RETRY_COOLDOWN_MS = 60 * 60 * 1000 // 1 hour
|
|
@@ -489,9 +488,13 @@ export function Home(props: {
|
|
|
489
488
|
|
|
490
489
|
const now = new Date()
|
|
491
490
|
try {
|
|
491
|
+
const { Config } = await import("../../config")
|
|
492
|
+
const reportHour = await Config.dailyReportHour()
|
|
493
|
+
if (reportHour < 0) return // auto-trigger disabled
|
|
494
|
+
|
|
492
495
|
const today = localDateKey(now)
|
|
493
496
|
if (dailyReportCompletedDate === today) return
|
|
494
|
-
if (now.getHours() <
|
|
497
|
+
if (now.getHours() < reportHour) return
|
|
495
498
|
|
|
496
499
|
const currentStatus = await fetchDailyReportStatus(today)
|
|
497
500
|
if (currentStatus === "exists") {
|