initial stock report portal

This commit is contained in:
houhuan
2026-08-16 17:23:53 +08:00
commit b6a433ed40
11 changed files with 222 additions and 0 deletions
@@ -0,0 +1,54 @@
# Stock Report Portal 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:** Build a static stock-report portal with category navigation, calendar browsing, indexed HTML reports, and an upload-friendly rebuild script.
**Architecture:** A single-page vanilla JavaScript application reads `data/reports.json`, renders category/month/date views, and opens source HTML reports from `reports/`. A Node.js script scans report paths and emits the index, keeping storage simple and automation-friendly.
**Tech Stack:** HTML5, CSS3, vanilla JavaScript, Node.js standard library only.
## Global Constraints
- No database, framework, or runtime server is required to serve the site.
- Report storage uses `reports/<category>/<YYYY>/<MM>/`.
- The browser-facing index contract uses `data/reports.json`.
- Empty and malformed data must render a recoverable empty state.
---
### Task 1: Create the static portal shell
**Files:**
- Create: `index.html`
- Create: `styles.css`
- Create: `app.js`
- Create: `data/reports.json`
- [ ] Add semantic layout for sidebar categories, dashboard header, calendar, report list, and recent reports.
- [ ] Add responsive CSS with a dark research-terminal visual style and accessible focus states.
- [ ] Implement loading of `data/reports.json`, category filtering, month navigation, date selection, search, and report links.
- [ ] Seed representative records and make all relative paths deploy-safe.
### Task 2: Add representative report fixtures and index rebuild tooling
**Files:**
- Create: `reports/daily-review/2026/08/2026-08-16-market-review.html`
- Create: `reports/intraday/2026/08/2026-08-16-ai-sector.html`
- Create: `scripts/build-index.mjs`
- Create: `README.md`
- [ ] Write the rebuild script using Node standard library and the filename convention `YYYY-MM-DD-slug.html`.
- [ ] Preserve category labels and derive title, summary, tags, and path for each record.
- [ ] Add deployment and automation instructions, including the upload-then-rebuild workflow.
- [ ] Run the rebuild script and verify the generated JSON contains both fixtures.
### Task 3: Validate the complete static site
**Files:**
- Modify: `data/reports.json`
- [ ] Run `node scripts/build-index.mjs`.
- [ ] Serve the root with a local static server and request `index.html`, `app.js`, and both report files.
- [ ] Parse the generated JSON and verify every indexed path exists.
- [ ] Check the site for broken relative references and report the final upload directory.
@@ -0,0 +1,28 @@
# Stock Report Portal Design
## Goal
Create a deployable static website for browsing HTML stock reports generated by OpenClaw or Hermes.
## Product shape
- Home page presents report categories such as Daily Review, Intraday Projects, Sector Watch, and Stock Tracking.
- Category pages show reports grouped by year and month, with a calendar-style date grid and a report list for the selected date.
- Each report opens its original HTML file in the same portal shell, preserving the source report content.
- A recent-reports area and category counts make the home page useful even before a date is selected.
## Data contract
Reports live under `reports/<category>/<YYYY>/<MM>/`. The website reads `data/reports.json`, whose records contain `id`, `category`, `date`, `title`, `summary`, `tags`, and `path`. A small rebuild script scans HTML files and regenerates the index, so uploads can be automated without hand-editing JSON.
## Technology and deployment
Use a dependency-free static site: HTML, CSS, and vanilla JavaScript. It can be uploaded to Nginx, Apache, object storage, or any static hosting service. The first version has no database, login, or server runtime requirement.
## Interaction and failure behavior
The site supports category filtering, month navigation, date selection, report search, and a direct report URL. Missing or malformed index data shows a clear empty state instead of a broken page. The rebuild script ignores non-HTML files and reports malformed filenames without stopping the whole rebuild.
## Future extension
The stable JSON contract leaves room for an upload webhook, authentication, full-text search, and database migration later without changing the browser-facing information architecture.