Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/sh
node scripts/privacy-check.cjs --staged || exit 1
node scripts/build.cjs --check || exit 1
16 changes: 16 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,19 @@ jobs:
- run: npm run privacy
- run: node scripts/privacy-check.cjs --tracked
- run: node scripts/privacy-check.cjs --history
browser-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
# Playwright is a test-only tool; the app itself still has no dependencies.
- run: npm install --no-save playwright@1.55.0
- run: npx playwright install --with-deps chromium
- run: npm run test:e2e
- uses: actions/upload-artifact@v4
if: always()
with:
name: smoke-screenshots
path: test-results/
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@
!/src/
/src/*
!/src/index.html
!/src/app/
/src/app/*
!/src/app/shell.html
!/src/app/styles.css
!/src/app/js/
/src/app/js/*
!/src/app/js/i18n.js
!/src/app/js/model.js
!/src/app/js/storage.js
!/src/app/js/exchange.js
!/src/app/js/views.js
!/src/app/js/editing.js
!/src/app/js/boot.js
!/docs/
/docs/*
!/docs/PUBLIC.md
!/docs/STATUS.md
!/scripts/
/scripts/*
!/scripts/build.cjs
!/scripts/privacy-check.cjs
!/scripts/release.cjs
!/tests/
Expand All @@ -20,6 +34,10 @@
/tests/public/*
!/tests/public/core.cjs
!/tests/public/excel.cjs
!/tests/public/storage.cjs
!/tests/e2e/
/tests/e2e/*
!/tests/e2e/smoke.cjs
!/.githooks/
/.githooks/*
!/.githooks/pre-commit
Expand Down
37 changes: 31 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Open `src/index.html` in a modern Edge or Chrome browser. No installation, depen

English is the primary language; Simplified Chinese is available from the language button at the bottom of the sidebar. Saved language preferences are respected. Built-in project names, sample tasks and default groups use English in both languages. User-entered project names, task names and people are preserved without translation.

Data stays in the current browser. Copying the HTML does not copy your projects: export a JSON bundle regularly for backup. There is no login, server sync, collaboration or access isolation.
Data stays in the current browser. Copying the HTML does not copy your projects: export a JSON bundle regularly for backup. The header shows how much browser storage is used. A red banner appears when a save fails and stays until data is saved again; a yellow banner warns when storage is more than 80% full. There is no login, server sync, collaboration or access isolation.

### Features and workflow

Expand All @@ -27,7 +27,7 @@ Use **Export Excel** to download a blank creation template or a copy of the curr

The controlled v3 template includes Project, Plan, NewTasks, Groups, Instructions and hidden Metadata sheets, plus Instructions_zh for Chinese guidance. Project contains the name and status date. Plan has 21 columns: A:K for scheduling and L:U for group1–group10. NewTasks adds column V, Parent WBS, to specify hierarchy. Groups configures ten stable slots. WBS uniquely matches workbook rows to web tasks; calculated fields are read-only.

Wrong projects, stale revisions, changed read-only fields, missing rows, formulas and invalid values reject the entire import. A failed save preserves existing data. Up to three recovery points are retained in each project before updates and can be restored from the export panel. Keep separate JSON backups for long-term storage.
Wrong projects, stale revisions, changed read-only fields, missing rows, formulas and invalid values reject the entire import. A failed save preserves existing data. Up to three recovery points are retained in each project before updates and can be restored from the export panel. A recovery point holds project data and settings only; restoring it keeps the current version snapshots and audit log. Keep separate JSON backups for long-term storage.

Data sheets and Instructions use English in Arial 9 pt. Instructions_zh provides the Chinese translation in DengXian 9 pt, regardless of the interface language. User input is preserved. Empty Plan sheets omit empty data-validation nodes to avoid Excel repair prompts.

Expand All @@ -37,14 +37,33 @@ See the [Excel v3.0 contract](docs/PUBLIC.md#excel-v30-controlled-exchange) for

### Development and validation

Node.js 22 or newer is required. There are no third-party dependencies.
Node.js 22 or newer is required. The app has no third-party dependencies.

`src/index.html` is a generated single file. Edit the readable sources in `src/app/` and rebuild:

| Source | Contents |
| --- | --- |
| `src/app/shell.html` | Page markup |
| `src/app/styles.css` | Design tokens and styles |
| `src/app/js/i18n.js` | All interface text and messages (English and Chinese), `t(key, ...args)` |
| `src/app/js/model.js` | Dates, validation, scheduling, groups, project bundles |
| `src/app/js/storage.js` | Browser workspace, saving, storage usage and save banner |
| `src/app/js/exchange.js` | Excel and JSON import/export |
| `src/app/js/views.js` | Gantt, table, cards, people views and sidebar |
| `src/app/js/editing.js` | Dialogs, inline edits, dragging, versions, project actions |
| `src/app/js/boot.js` | Event wiring and start-up (must stay last) |

```sh
npm test
npm run build # regenerate src/index.html from src/app/
npm test # build freshness check + 56 logic checks (no dependencies)
npm run test:e2e # browser smoke test; needs: npm install --no-save playwright && npx playwright install chromium
npm run format # optional: Prettier formatting for sources and tests
npm run privacy
npm run release
```

Add every new interface string to both languages in `src/app/js/i18n.js`; `npm test` fails when a key is missing in either language.

`public-release/` is an allowlisted copy for public distribution. Review it before publishing. Original cases, screenshots, old templates and development records were removed from this workspace under prior authorization. Keep user data and browser exports outside the repository; publish from the reviewed copy rather than an entire local working directory.

After initializing Git in a reviewed public copy, run `npm run prepare-hooks` to enable commit and push checks. GitHub Actions runs the same checks. The allowlist, one-way identifier fingerprints and credential scanning help block known leaks; new business data, documents and logs still require review. Do not bypass ignore rules with force-add. Exported JSON and Excel files may contain private data.
Expand All @@ -71,14 +90,20 @@ Excel 数据表和 Instructions 固定为英文、Arial 9 号;新增 Instructi

## 开发与验证

需要 Node.js 22 或更新版本,无第三方依赖。
需要 Node.js 22 或更新版本,应用本身无第三方依赖。

`src/index.html` 是生成的单文件。请修改 `src/app/` 下的源码(页面结构、样式、`js/` 下按职责拆分的脚本),再运行构建:

```sh
npm test
npm run build # 由 src/app/ 重新生成 src/index.html
npm test # 构建一致性检查 + 56 项逻辑检查(无依赖)
npm run test:e2e # 浏览器冒烟测试;需先 npm install --no-save playwright && npx playwright install chromium
npm run privacy
npm run release
```

所有界面文字和提示统一写在 `src/app/js/i18n.js`,中英文必须同时提供;缺少任一语言时 `npm test` 会失败。页面顶部显示浏览器存储用量;保存失败时出现红色横幅并保持到再次保存成功,用量超过 80% 时出现黄色提醒。恢复点只保存项目数据和设置,恢复时保留当前的版本快照与审计记录。

`public-release/` 是面向公开仓库的白名单副本。历史案例、截图、旧模板和开发记录已按授权从当前目录清理;用户数据与浏览器导出不应上传。应从该副本建立公开仓库,避免直接同步整个本地工作目录。

在公开副本初始化 Git 后,运行 `npm run prepare-hooks` 启用提交/推送检查。GitHub Actions 在提交后运行同样检查。白名单、单向标识指纹和凭据扫描帮助阻断已知泄漏;新加入的业务数据、文档及日志仍需人工审核,不要使用强制添加绕过忽略规则。用户导出的 JSON / Excel 可能包含私有数据,应留在仓库外。
Expand Down
6 changes: 3 additions & 3 deletions docs/PUBLIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ English is the primary repository and documentation language. Simplified Chinese

Only files listed in `PUBLIC_FILES` in `scripts/privacy-check.cjs` may be published. Ignore rules exclude everything by default and allow reviewed files individually; additions require review and an allowlist update. Original sources, historical evidence, Excel cases, exports, screenshots, temporary files, machine configuration and personal context stay local.

Run `npm test`, `npm run privacy` and `npm run release`. Review `public-release/` and initialize the public repository from that independent, scanned copy without the original directory's history. Run `npm run prepare-hooks`: commits scan staged contents, and pushes check tracked files and all local commit history. CI runs after upload and cannot replace local scanning.
`src/index.html` is generated from the sources in `src/app/` by `npm run build`; commit both, and `npm test` fails when they differ. Run `npm test`, `npm run privacy` and `npm run release`. Review `public-release/` and initialize the public repository from that independent, scanned copy without the original directory's history. Run `npm run prepare-hooks`: commits scan staged contents, and pushes check tracked files and all local commit history. CI runs after upload and cannot replace local scanning.

The scanner checks the allowlist, credentials, email addresses and local paths. One-way fingerprints block known source identifiers without reconstructing their names in code or tests. Embedded Excel XML is decoded and scanned too. Public source excludes original cases, people and task data. Scanning cannot cover every future input; user JSON and Excel exports are private exchange files and must stay outside the source repository.

Expand Down Expand Up @@ -46,7 +46,7 @@ Enter progress as 25% or 0.25, not numeric 25. Lag is a signed integer, duration

Update templates bind projectId and a SHA-256 source revision digest. Re-export after changes to web data, configuration, versions or audit. Each blank creation template import creates an independent project. Import validates and recalculates a candidate copy, then previews before/after values and derived changes. Cancellation does not save. Changes to memory or saved workspace during preview reject the commit.

Each project retains up to three recovery points before updates. Restoring also preserves the state before restoration. Candidate data, recovery points and audit commit through a single localStorage write; failures never partially update data. Recovery points still depend on browser storage, so export JSON for long-term backups.
Each project retains up to three recovery points before updates. A recovery point stores project data and settings only (user-entered task fields; derived dates and roll-ups are recalculated); version snapshots are stored the same compact way. Restoring keeps the current snapshots and audit log and also preserves the state before restoration. Candidate data, recovery points and audit commit through a single localStorage write; failures never partially update data. Recovery points still depend on browser storage, so export JSON for long-term backups.

v1.0 has no project identity or revision digest and only updates existing subtasks after an explicit target choice, retaining its 14-column contract. v2 retains the 14/15-column, three-role contract and explicitly adapts it to the first three stable groups. v3 uses 21/22 columns and all ten groups as the current full export format. None of these formats accepts formula inputs, Excel macros or external connections.

Expand All @@ -62,7 +62,7 @@ Original local designs are reference material only. This public contract exclude

公开仓库仅允许 `scripts/privacy-check.cjs` 中 PUBLIC_FILES 列出的文件。忽略规则默认排除所有内容,再逐项开放;新文件需要审核并修改白名单。原始来源、历史证据、Excel 案例、导出包、截图、临时文件、机器配置和个人上下文保留本地。

运行 `npm test`、`npm run privacy`、`npm run release`,审核 `public-release/` 后从该副本建立公开仓库。执行 `npm run prepare-hooks`,提交时扫描暂存内容,推送前检查已跟踪内容及所有本地提交历史。CI 在上传后运行,不能代替本地扫描。公开仓库必须从已扫描的独立副本初始化,不携带原始目录的历史。
`src/index.html` 由 `npm run build` 从 `src/app/` 源码生成,两者需一并提交,不一致时 `npm test` 失败。运行 `npm test`、`npm run privacy`、`npm run release`,审核 `public-release/` 后从该副本建立公开仓库。执行 `npm run prepare-hooks`,提交时扫描暂存内容,推送前检查已跟踪内容及所有本地提交历史。CI 在上传后运行,不能代替本地扫描。公开仓库必须从已扫描的独立副本初始化,不携带原始目录的历史。

扫描采用白名单和凭据、邮箱、本机路径规则;以单向指纹阻断已知来源标识,不在程序或测试中拼接还原旧名称。同时解码 HTML 内嵌 Excel XML。公开源码不包含原始案例、人员或任务数据。扫描不能覆盖所有未来输入;用户 JSON / Excel 是私有交换文件,不应上传源码仓库。

Expand Down
22 changes: 20 additions & 2 deletions docs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ Updated: 2026-10-25 (Asia/Shanghai).
- Controlled Excel v3, protected calculated cells, explicit 21/22-field mappings, group configuration, preview, source revision checks and downloads as new files. Legacy 14-column spreadsheet import remains positionally compatible; source-specific aliases have been removed. Legacy JSON requires a declared three-slot mapping.
- Public source allowlist and irreversible identifier fingerprints with submission/push hooks. Historical source files, old templates, development images, raw audit records and old Git backups have been removed under explicit user authorization. The public repository was deleted and recreated under the same name, with a new repository identity and clean Git history; only the 13 reviewed files were uploaded.

## Current change: English-first repository
## Current change: audit #1 fixes (data safety and maintainability)

- Storage growth: version snapshots and Excel recovery points now store only user-entered fields; dates, roll-ups and statuses are recalculated when used. Recovery points no longer embed version history or the audit log, and restoring one keeps the current snapshots and audit. Existing workspaces are compacted when loaded. Measured with 800 sub-tasks and 3 recovery points: 4 snapshots took 4.1 MB before (the next save exceeded the browser limit) and now take 1.2 MB; 8 snapshots take 1.8 MB.
- Save failures: the one-time alert is replaced by a persistent banner with "Export JSON backup" and "Retry save"; it stays until a save succeeds. The header shows storage usage, and a warning banner appears above 80%.
- People view: the assignment matrix header now includes the timeline column, so person columns line up (renamed from "RACI", which it was not).
- Maintainability: `src/index.html` is generated by `scripts/build.cjs` from readable sources in `src/app/` (markup, styles and seven scripts). Removed unused code (v1 workbook export and its embedded template, the unused v2 workbook builder, hidden legacy inputs, legacy three-role roll-ups, about 50 unused text keys). CSS override layers were merged; computed styles of every element were compared before and after in 15 browser scenarios with zero differences. All interface text and messages, including over 80 previously English-only errors, now come from one bilingual dictionary. The stale design comment and the third-party theme name in the old workbook template are gone.
- Tests: `npm test` checks that the build is current and runs 56 logic checks (new: storage, banner, matrix and translation-key checks). `npm run test:e2e` adds a 15-check Playwright smoke test (two widths, all views, inline edit, drag, dialogs, language, save-failure banner, reload), also run in CI with screenshots uploaded.
- Not changed: the scheduling rules, Excel v3 contract and project data model. Workbooks exported before this change may be reported as stale once, because snapshot compaction changes the revision digest; export a fresh workbook.

## Previous change: English-first repository

- README and public release conventions now present English first, followed by Simplified Chinese. Existing Chinese guidance is retained in the same allowlisted files.
- Initial HTML language and fallback labels use English. English remains the default interface language; saved Chinese preferences and user-entered text are preserved. Excel continues to provide English data sheets and separate Chinese instructions.
Expand Down Expand Up @@ -46,7 +55,16 @@ Updated: 2026-10-25 (Asia/Shanghai).

更新:2026-10-25(Asia/Shanghai)。

### 本次变更:英语优先
### 本次变更:审计 #1 修复(数据安全与可维护性)

- 存储增长:版本快照和 Excel 恢复点只保存用户输入的字段,日期、汇总和状态在使用时重新计算;恢复点不再包含版本历史和审计日志,恢复时保留当前快照与审计。已有工作区在加载时自动压缩。实测 800 个子任务、3 个恢复点:4 个快照原占 4.1 MB(再保存一次即超出浏览器上限),现为 1.2 MB;8 个快照为 1.8 MB。
- 保存失败:一次性弹窗改为常驻横幅,提供“导出 JSON 备份”和“重试保存”,直到保存成功才消失;头部显示存储用量,超过 80% 时显示提醒。
- 人员视图:分工矩阵补齐时间轴表头,人员列不再错位(原名 RACI 已改为“主任务 × 人员分工矩阵”)。
- 可维护性:`src/index.html` 由 `scripts/build.cjs` 从 `src/app/` 的可读源码生成;删除无用代码(v1 导出及内嵌模板、未使用的 v2 构建函数、隐藏的旧输入框、旧三角色汇总、约 50 个无用文案键);合并 CSS 覆盖层,15 个浏览器场景下所有元素的计算样式前后完全一致;全部界面文字和提示(含 80 余条原先只有英文的报错)统一来自中英双语字典;清除过时的设计注释和旧模板中的第三方主题名。
- 测试:`npm test` 检查构建是否最新并运行 56 项逻辑检查;`npm run test:e2e` 提供 15 项 Playwright 冒烟测试,CI 同步运行并上传截图。
- 未改变:排程规则、Excel v3 合约和项目数据模型。本次之前导出的工作簿可能会被提示过期一次,重新导出即可。

### 上次变更:英语优先

- README 和公开发布约定以英语为主,随后保留完整中文说明。
- HTML 初始语言标记及初始文案改为英文;继续保留中文切换、已保存的语言偏好和用户原文。Excel 数据表维持英文,中文说明保留在 Instructions_zh。
Expand Down
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"name": "project-workspace",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"scripts": {
"test": "node tests/public/core.cjs && node tests/public/excel.cjs",
"build": "node scripts/build.cjs",
"check:build": "node scripts/build.cjs --check",
"test": "node scripts/build.cjs --check && node tests/public/core.cjs && node tests/public/excel.cjs && node tests/public/storage.cjs",
"test:e2e": "node tests/e2e/smoke.cjs",
"format": "npx --yes prettier@3.9.10 --print-width 110 --write \"src/app/**/*.{js,css}\" \"scripts/*.cjs\" \"tests/**/*.cjs\"",
"privacy": "node scripts/privacy-check.cjs",
"release": "node scripts/release.cjs",
"prepare-hooks": "node -e \"const fs=require('node:fs'),cp=require('node:child_process');for(const f of ['pre-commit','pre-push'])fs.chmodSync('.githooks/'+f,0o755);cp.execFileSync('git',['config','core.hooksPath','.githooks']);\""
Expand Down
Loading
Loading