Initial release with production deploy config.

Add GitAtlas deploy assets, DATA_FILE support for isolated server data, and port documentation for sourcing.simosen.cn.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-15 00:52:31 +08:00
commit e9939ef9dc
45 changed files with 14376 additions and 0 deletions
@@ -0,0 +1,60 @@
# SaaS Admin Productization Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add productized SaaS administration: roles, user management, user disablement, plugin token lifecycle, token usage tracking, and an admin center UI.
**Architecture:** Extend the existing JSON store and HTTP API without introducing a database migration framework. First user becomes admin, later users are buyers. Admin-only endpoints expose user summaries and allow status changes; plugin token endpoints gain disable/delete and usage metadata.
**Tech Stack:** Vanilla Node HTTP server, JSON persistence, vanilla HTML/CSS/JS frontend, Node test runner.
---
### Task 1: Backend Role And Admin APIs
**Files:**
- Modify: `src/store.js`
- Modify: `src/server.js`
- Test: `tests/server.test.js`
- [x] Add tests for first user admin, later buyer, admin user list, disable behavior.
- [x] Implement role/status defaults in `JsonStore.createUser` and `publicUser`.
- [x] Add `JsonStore.listUsersWithStats`, `updateUserStatus`.
- [x] Add `requireAdmin` in server and `/api/admin/users`, `/api/admin/users/:id/status`.
- [x] Run focused server tests, then full test suite.
### Task 2: Plugin Token Lifecycle
**Files:**
- Modify: `src/store.js`
- Modify: `src/server.js`
- Test: `tests/server.test.js`
- [x] Add tests for token usage count/last used, disabling token, deleting token.
- [x] Add token fields `status`, `usageCount`, `lastUsedAt`.
- [x] Add store methods `touchPluginToken`, `updatePluginTokenStatus`, `deletePluginToken`.
- [x] Add API endpoints `PATCH /api/plugin-tokens/:id` and `DELETE /api/plugin-tokens/:id`.
- [x] Block disabled token capture.
### Task 3: Admin Center UI
**Files:**
- Modify: `public/index.html`
- Modify: `public/app.js`
- Modify: `public/styles.css`
- [x] Add admin navigation item hidden for non-admin.
- [x] Load admin users when admin view opens.
- [x] Render admin center with user list, stats, status action.
- [x] Enhance plugin token panel with status, usage count, last used, disable/delete actions.
- [x] Keep Buyer Atelier visual system.
### Task 4: Verification
**Files:**
- Test: all
- [ ] Run `node --check public/app.js && npm run check && npm test`.
- [ ] Restart local server if needed.
- [ ] Browser verify admin center and plugin panel desktop/mobile.
- [ ] Confirm no temporary QA files remain.
@@ -0,0 +1,73 @@
# AI Engine And Token Billing Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add administrator-managed large-model configuration, user-facing AI analysis actions, and AI token billing through redemption codes.
**Architecture:** Extend the existing JSON store with `aiSettings`, `aiTokens`, and `aiTokenLogs`. Add an OpenAI-compatible AI client abstraction so official providers and proxy/base-url providers all use one request path. Admins configure model access; users consume AI actions through server endpoints that estimate/charge AI tokens.
**Tech Stack:** Node.js HTTP server, JSON store, OpenAI-compatible chat completions over `fetch`, vanilla HTML/CSS/JS frontend, Node test runner.
---
### Task 1: Server Tests
**Files:**
- Modify: `tests/server.test.js`
- [ ] Add tests for admin-only AI settings.
- [ ] Add tests for AI token redemption codes.
- [ ] Add tests for AI analysis using a fake AI client and token deduction.
- [ ] Add tests for insufficient AI tokens.
### Task 2: AI Core Module
**Files:**
- Create: `src/ai.js`
- [ ] Add `DEFAULT_AI_SETTINGS`.
- [ ] Add settings normalization and public masking.
- [ ] Add OpenAI-compatible request handling.
- [ ] Add prompt builders for item analysis, procurement reports, and rule generation.
- [ ] Add token estimation helpers.
### Task 3: Store Extensions
**Files:**
- Modify: `src/store.js`
- Modify: `src/auth.js`
- [ ] Add `aiTokens` to users and public users.
- [ ] Extend credit codes to include `aiTokens`.
- [ ] Add `aiSettings` and encrypted API key storage.
- [ ] Add AI token deduction logs.
### Task 4: API Routes
**Files:**
- Modify: `src/server.js`
- [ ] Add admin routes for AI settings and connection testing.
- [ ] Add user route `/api/ai/analyze`.
- [ ] Require AI token balance before calling the model.
- [ ] Deduct AI tokens after successful model use.
### Task 5: Frontend UI
**Files:**
- Modify: `public/index.html`
- Modify: `public/app.js`
- Modify: `public/styles.css`
- [ ] Add admin AI configuration panel in management center.
- [ ] Extend redemption code UI with AI token amount.
- [ ] Show AI token balance on account/admin user rows.
- [ ] Add AI analysis actions in item detail.
- [ ] Keep visual language aligned with jade/paper/brass product UI.
### Task 6: Verification
- [ ] Run `npm test`.
- [ ] Run JS syntax checks.
- [ ] Restart local service.
- [ ] Verify AI settings UI and item detail AI action with browser screenshots.
@@ -0,0 +1,58 @@
# Brand And Share Assets Implementation Plan
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Add a category-neutral product logo, favicon, extension icons, and WeChat-friendly social sharing metadata and image.
**Architecture:** Keep deterministic brand sources as SVG files under `public/assets`, derive raster formats with ImageMagick, and dynamically render absolute Open Graph URLs when serving HTML. Reuse the same logo across the landing page, authenticated shell, startup state, and extension.
**Tech Stack:** HTML, CSS, SVG, PNG/ICO, Node.js HTTP server, Node test runner, ImageMagick.
---
### Task 1: Add metadata regression coverage
**Files:**
- Modify: `tests/server.test.js`
- [ ] Add a server test that requests `/` and verifies title, description, favicon, Open Graph fields, absolute share image URL, and share image availability.
- [ ] Run `npm test -- tests/server.test.js` and verify the new test fails before implementation.
### Task 2: Create brand assets
**Files:**
- Create: `public/assets/brand-mark.svg`
- Create: `public/assets/brand-lockup.svg`
- Create: `public/assets/share-card.svg`
- Create: `public/assets/share-card.png`
- Create: `public/favicon.ico`
- Create: `extension/icons/icon16.png`
- Create: `extension/icons/icon32.png`
- Create: `extension/icons/icon48.png`
- Create: `extension/icons/icon128.png`
- [ ] Build the vector logo and share card from the approved jade, paper, brass, and cinnabar visual system.
- [ ] Rasterize the share image, favicon, and extension icon sizes with ImageMagick.
- [ ] Inspect dimensions and file formats.
### Task 3: Connect metadata and brand UI
**Files:**
- Modify: `public/index.html`
- Modify: `public/styles.css`
- Modify: `src/server.js`
- Modify: `extension/manifest.json`
- Modify: `extension/popup.html`
- Modify: `extension/popup.css`
- [ ] Add SEO, Open Graph, Twitter Card, favicon, and application icon metadata.
- [ ] Replace text-only brand marks with the reusable SVG mark.
- [ ] Render HTML share-origin placeholders to absolute URLs in the server.
- [ ] Add extension icons and generic product naming.
### Task 4: Verify
- [ ] Run `npm test`.
- [ ] Run syntax checks for server, frontend, and extension JavaScript.
- [ ] Start the server and verify metadata/assets over HTTP.
- [ ] Inspect the rendered homepage and share image.
@@ -0,0 +1,33 @@
# 全品类选品采购品牌与分享资产设计
## 产品定位
系统品牌从“直播饰品选品采购”向“全品类机会选品采购台”延展。现阶段饰品直播仍是首个业务模板,但品牌资产不再绑定某个类目,能够覆盖后续服饰、家居、百货等商品选品。
## Logo 方向
- 保留现有翡翠绿、米白、黄铜金和少量朱砂红,延续高级买手工具气质。
- 图形使用“选品扫描框 + 商品标签/机会钻石 + 多平台节点”的抽象组合。
- 不依赖中文单字,确保 favicon、浏览器插件、小尺寸场景中仍能清晰识别。
- 输出主标识 SVG、浏览器 favicon.ico、多个插件 PNG 尺寸。
## 分享体验
- 页面标题:`选品采购台|竞品采集、货源匹配与采购决策`
- 页面描述:`采集淘宝、小红书等平台商品线索,匹配 1688 货源,完成筛选、利润测算、拿样与采购决策。`
- 微信及社交分享使用 1200×630 PNG 分享封面。
- Open Graph 图片地址由服务端根据当前访问域名生成绝对 URL,兼容本地和云端部署。
## 页面接入
- 登录首页、启动页、侧栏品牌标识统一使用新 logo。
- 保留现有饰品直播首期业务文案,不在本次改动中重写业务规则。
- 浏览器插件使用同一套图标,名称升级为通用“选品采购采集器”。
## 验收
- 浏览器标签页显示 favicon。
- 首页、启动页、侧栏和插件显示统一 logo。
- 首页 HTML 包含完整 `description`、Open Graph、Twitter Card 和微信友好分享信息。
- 分享图、logo、favicon 均能通过本地服务正常访问。
- 全量自动化测试、JavaScript 语法检查通过。