Repository navigation
v1.2.2 — Workspace addressing, UI audit, import roots, file logging · 工作区寻址、控件审计、导入根、文件日志
English · 中文
English
Changes since v1.2.0, covering the v1.2.1 and v1.2.2 change sets. Everything ships with zero new npm dependencies.
Workspace addressing rebuilt · 工作区寻址重建(v1.2.1)
Fixes the "project landed in the wrong place" class of bugs at the root:
- New projects require a registered workspace. The new-project dialog gains a workspace dropdown (read-only
GET /codeflow/api/workspaces) and a computed absolute-path preview. Requests without a registered workspace are rejected (400/409) — the plugin never creates or registers workspace roots on its own, and nothing is written to disk on rejection. - One explicit resolution chain. Binding → project directory → session cwd, longest-prefix matched against the workspace registry at each step; unresolvable now hard-fails with a candidate list. The old "first registered workspace" fallback — the source of projects silently landing elsewhere — is deleted.
- Canvas sessions belong to their workspace. When the host exposes workspace entities, dedicated sessions are created with a
workspaceIdand attached to that workspace group instead of landing in "未分组". - Directory-tree picker for import. The import dialog's path field gains a 浏览… button over the read-only
GET /codeflow/api/browse: directories only, symlinks/junctions never followed, 500 entries per level, 5 s timeout, keyboard-first (↑/↓/Enter/Backspace/Esc).
Audited UI · 可点击控件全部有绑定(v1.2.2)
Every clickable control in the canvas now has a manifest, a binding and an audit trail:
lib/ui/actions.jsis the single source of truth (73 controls).tests/buttons.mjsstatically proves each is registered with at least one binding path; the generator injectswindow.__CF_ACTION_MANIFEST__for an in-canvas real-click self-test; the rest are covered by a manual checklist.- The audit found and fixed four real defects: the toolbar 「耦合分析」 button had never been click-bound (HTML-disabled, reachable only via right-click); the session chip was a focusable fake button (now opens the dedicated-session view); and the ✕ buttons of the drop confirm / progress / conflict dialogs were dead — close/cancel is now delegated once on
#cf-dialog.
Conservative import roots · 导入只认真实项目根(v1.2.2)
Nested "shell-wrapped" imports no longer guess:
- All three import channels (archive drop, folder drop, path/dialog import) share one conservative root resolver (
lib/import/root-detect.js). After stripping an archive's outermost layer, descending continues only for project markers / obvious shell names / same-name-as-parent. proj/srckeepsprojas the root; an unmarked single-link shell answers 400SHELL_AMBIGUOUSinstead of inventing a project name; empty shells 400; multi-project parents keep the parent with amultiProjectwarning.tests/import-shells.mjscovers 51 fixture × channel combinations.
File logging · 工作与报错日志(v1.2.2)
- The plugin writes a JSONL log
codeflow.logat its install root: 5 MiB rotation (one.1kept), serialized writes, degrade-don't-crash. It records lifecycle, import, coupling and HTTP/UI errors — never prompts, source code, graph JSON, cookies or tokens (key-name redaction + truncation). - The canvas reports
ui.action/ui.error/ui.selftestviaPOST /codeflow/api/log(whitelisted, 64 KiB cap, 20 per batch).CODEFLOW_LOG=offdisables;CODEFLOW_LOG_FILEoverrides the path. tests/architecture.mjspins the layering: logging/root-detect have zero domain dependencies, the import pipeline never touchesreq/res, the static import graph is acyclic.
macOS field diagnostic kit · macOS 现场诊断套件
A standalone diagnostic suite for macOS issues, attached above as codeflow-mac-kit-1.2.2.zip (also in-repo at tests/mac/):
- Host-side checks: environment, package integrity, canvas document, HTTP boot, paths/Unicode, deterministic import, archives/Finder drop, undo
- A DevTools console probe for keyboard/IME/trackpad/context-menu/drag/UI behavior
- Markdown/JSON report writer with filtering and redaction, a double-clickable
.commandlauncher, a manual checklist and a report template - Documents known macOS findings: Finder's
__MACOSX/._*scanned as source, missing 7z/rar tools, wheel-to-zoom, noisComposingguard
Full changelog: v1.2.0...v1.2.2
中文
自 v1.2.0 起的改动,合并 v1.2.1 与 v1.2.2 两个变更集。零新增 npm 依赖。
工作区寻址重建(v1.2.1)
从根上治「项目落到错的地方」这一类问题:
- 新建项目必须选已登记的工作区。 新建对话框新增工作区下拉(数据来自只读的
GET /codeflow/api/workspaces)与最终绝对路径预览。请求缺少已登记工作区时直接拒绝(400/409)——插件绝不自己创建或登记工作区根目录,被拒时磁盘上什么都不多出来。 - 工作区寻址只剩一条显式链。 绑定 → 项目目录 → 会话 cwd,逐档对工作区注册表做最长前缀匹配;解析不出就硬失败并给出候选清单。旧的「取第一个已登记工作区」回退——项目悄悄落到别处的根源——已删除。
- 画布会话归属自己的工作区。 宿主提供工作区实体时,专用会话以
workspaceId创建并 attach 进该工作区分组,不再落进「未分组」。 - 导入新增目录树选择器。 导入对话框路径框右侧新增「浏览…」,底层是只读的
GET /codeflow/api/browse:只列目录、不跟符号链接/junction、单层 500 项、5 秒超时、键盘优先(↑/↓/Enter/Backspace/Esc)。
可点击控件全部有绑定(v1.2.2)
画布上每个可点击控件现在都有清单、有绑定、有审计:
lib/ui/actions.js是单一事实来源(73 个控件)。tests/buttons.mjs静态证明每个控件都登记且至少有一条绑定路径;生成器注入window.__CF_ACTION_MANIFEST__供画布内真实点击自检;其余路径由手动清单逐项验收。- 审计揪出并修复了四个真实缺陷:「耦合分析」工具栏按钮从未绑过 click(HTML 里 disabled,只能从右键进入);会话 chip 是可聚焦但无动作的假按钮(现在点开「画布专用会话」);拖拽确认/进度/冲突三个对话框的 ✕ 是死按钮——close/cancel 现在由
#cf-dialog上的一次事件委托统一兜底。
导入只认真实项目根(v1.2.2)
外壳套外壳的导入不再猜:
- 三条导入通道(拖拽压缩包、拖拽文件夹、路径/对话框导入)共用一个保守根解析器(
lib/import/root-detect.js)。压缩包先按既有语义剥最外层,之后只有「项目标记 / 明显外壳名 / 与父同名」才继续下钻。 proj/src保留proj作为根;无标记的单链外壳直接答 400SHELL_AMBIGUOUS,绝不生成名字/根目录错误的项目;空壳 400;多项目父目录保留父目录并记multiProject警告。tests/import-shells.mjs覆盖 51 个「夹具 × 通道」组合。
工作与报错日志(v1.2.2)
- 插件在安装根目录写 JSONL 日志
codeflow.log:5 MiB 轮转(保留一个.1)、串行写、失败降级不崩。记录生命周期、导入、耦合分析与 HTTP/UI 错误——绝不记录提示词、源码、图 JSON、Cookie 或 Token(按键名脱敏 + 截断)。 - 画布通过
POST /codeflow/api/log上报ui.action/ui.error/ui.selftest(白名单、64 KiB 上限、单批 20 条)。CODEFLOW_LOG=off关闭;CODEFLOW_LOG_FILE覆盖路径。 tests/architecture.mjs钉住分层:logging/root-detect 零领域依赖、导入管道不接触req/res、静态 import 图无环。
macOS 现场诊断套件
面向 macOS 问题的独立诊断套件,见上方附件 codeflow-mac-kit-1.2.2.zip(仓库内也有 tests/mac/):
- 宿主侧检查:环境、包完整性、画布文档、HTTP 启动、路径/Unicode、确定性导入、压缩包与 Finder 拖拽、撤销
- 一份 DevTools 控制台探针,覆盖键盘/输入法/触控板/右键菜单/拖拽/UI 行为
- 报告写入器(Markdown/JSON,支持过滤与脱敏)、双击即用的
.command启动器、手动测试清单与报告模板 - 记录了已知的 macOS 现象:Finder 压缩包里的
__MACOSX/._*会被当源码扫描、缺少 7z/rar 工具、滚轮缩放、缺isComposing守卫
完整变更:v1.2.0...v1.2.2