diff --git a/AGENTS.md b/AGENTS.md index a148d1f..8b31a8f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,7 +4,7 @@ This document provides instructions for AI agents working on the Alert Message C ## 🛠 Commands -### Development & Build +### Workspace Operations - **Install**: `bun install` - **Root Dev**: `bun run dev` (starts both server and web) - **Root Build**: `bun run build` @@ -25,6 +25,10 @@ This document provides instructions for AI agents working on the Alert Message C - **Dev**: `bun run dev` - **Build**: `bun run build` +### Testing +- No automated tests currently exist in the repository. If adding tests, use **Bun Test**. +- **Run Single Test**: `bun test path/to/file.test.ts` + --- ## 📜 Code Style & Conventions @@ -35,7 +39,7 @@ This document provides instructions for AI agents working on the Alert Message C - **Naming**: - Variables/Functions: `camelCase` - Components/Classes/Interfaces: `PascalCase` - - Database Tables: `snake_case` (e.g., `topic_group_chats`) + - Database Tables/Columns: `snake_case` (e.g., `topic_group_chats`) - URL Slugs: `kebab-case` ### 2. TypeScript & Type Safety @@ -46,7 +50,7 @@ This document provides instructions for AI agents working on the Alert Message C ### 3. Backend (Hono + Drizzle) - **Routing**: Group logic into sub-apps (e.g., `api.ts`, `auth.ts`, `webhook.ts`). -- **Database**: Use Drizzle ORM. Prefer relational queries where possible. +- **Database**: Use Drizzle ORM. Prefer relational queries where possible (`db.query.xxx.findMany`). - **Validation**: Use `@hono/zod-validator` for request validation. - **Logging**: Use the structured logger in `src/lib/logger.ts` (Pino). - **Pattern**: `logger.error({ err, context }, "Message")`. @@ -76,3 +80,4 @@ This document provides instructions for AI agents working on the Alert Message C - **Biome First**: Always run `bun run check` before concluding a task. - **Preserve Patterns**: Follow existing structure in `apps/server/src` and `apps/web/src`. - **Minimalism**: Fix bugs minimally. Avoid large refactors unless requested. +- **Context**: Agent-specific context is located in `@docs/`. Refer to `docs/copilot-context.md` for additional instructions. diff --git a/CHANGELOG.md b/CHANGELOG.md index ce625b5..718a1f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 **CHANGELOG** | [简体中文](./CHANGELOG.zh-CN.md) +## [1.4.0] - 2026-01-23 + +### Added +- **Global Topics**: Introduced a new topic type that broadcasts alerts to all users automatically. + - **User Requests**: All users can now request a topic to be "Global" during creation. + - **Admin Control**: Admins can promote any topic to "Global" or create new global topics via the Admin Dashboard. + - **Automatic Distribution**: Alerts sent to Global Topics are delivered to every registered user without requiring individual subscriptions. + - **UI Indicators**: Added "Global" badges and specialized management actions in the Topics and Admin views. + ## [1.3.3] - 2026-01-17 ### Added diff --git a/CHANGELOG.zh-CN.md b/CHANGELOG.zh-CN.md index a404100..097c82a 100644 --- a/CHANGELOG.zh-CN.md +++ b/CHANGELOG.zh-CN.md @@ -7,6 +7,15 @@ **更新日志** | [English](./CHANGELOG.md) +## [1.4.0] - 2026-01-23 + +### 新增 +- **全局话题 (Global Topics)**: 引入了全新的话题类型,可自动向所有用户广播告警。 + - **用户申请**: 现在所有用户在创建话题时都可以选择申请将其设为“全局话题”。 + - **管理员控制**: 管理员可以通过管理员后台将任何话题提升为“全局话题”,或直接创建新的全局话题。 + - **自动分发**: 发送到全局话题的告警将投递给每一位已注册的用户,无需用户手动订阅。 + - **UI 标识**: 在话题列表和管理员视图中增加了“全局”标识和专门的管理操作。 + ## [1.3.3] - 2026-01-17 ### 新增 diff --git a/apps/server/package.json b/apps/server/package.json index 343e5e3..a763c7e 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -1,6 +1,6 @@ { "name": "@alertmessagecenter/server", - "version": "1.3.3", + "version": "1.4.0", "scripts": { "dev": "bun run --env-file .env --watch src/index.ts", "start": "bun run src/index.ts", diff --git a/apps/server/src/api.ts b/apps/server/src/api.ts index d6d9c39..d84574e 100644 --- a/apps/server/src/api.ts +++ b/apps/server/src/api.ts @@ -150,7 +150,7 @@ api.post("/topics", requireAuth, zValidator("json", topicSchema), async (c) => { .insert(topics) .values({ ...body, - isGlobal: session.isAdmin ? (body.isGlobal ?? false) : false, + isGlobal: body.isGlobal ?? false, status, createdBy: session.id, approvedBy: session.isAdmin || session.isTrusted ? session.id : null, diff --git a/apps/web/package.json b/apps/web/package.json index b868989..b799dd4 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -1,6 +1,6 @@ { "name": "@alertmessagecenter/web", - "version": "1.3.3", + "version": "1.4.0", "type": "module", "scripts": { "dev": "bun run --env-file .env vite", diff --git a/apps/web/src/views/TopicsView.tsx b/apps/web/src/views/TopicsView.tsx index ad7e738..942433b 100644 --- a/apps/web/src/views/TopicsView.tsx +++ b/apps/web/src/views/TopicsView.tsx @@ -534,42 +534,52 @@ export default function TopicsView() { )} {currentUser && ( -
+ * Requires your personal token to identify you + as the sender. +
+ )}+ (Broadcast to ALL users. Requires Admin approval) +
+