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:
@@ -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.
|
||||
Reference in New Issue
Block a user