Skip to content

v1.2.2 — Workspace addressing, UI audit, import roots, file logging · 工作区寻址、控件审计、导入根、文件日志

Choose a tag to compare

@TheLiudawei TheLiudawei released this 01 Nov 14:27
· 18 commits to main since this release

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 workspaceId and 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.js is the single source of truth (73 controls). tests/buttons.mjs statically proves each is registered with at least one binding path; the generator injects window.__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/src keeps proj as the root; an unmarked single-link shell answers 400 SHELL_AMBIGUOUS instead of inventing a project name; empty shells 400; multi-project parents keep the parent with a multiProject warning. tests/import-shells.mjs covers 51 fixture × channel combinations.

File logging · 工作与报错日志(v1.2.2)

  • The plugin writes a JSONL log codeflow.log at its install root: 5 MiB rotation (one .1 kept), 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.selftest via POST /codeflow/api/log (whitelisted, 64 KiB cap, 20 per batch). CODEFLOW_LOG=off disables; CODEFLOW_LOG_FILE overrides the path.
  • tests/architecture.mjs pins the layering: logging/root-detect have zero domain dependencies, the import pipeline never touches req/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 .command launcher, a manual checklist and a report template
  • Documents known macOS findings: Finder's __MACOSX/._* scanned as source, missing 7z/rar tools, wheel-to-zoom, no isComposing guard

Full changelog: v1.2.0...v1.2.2


中文

English

自 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 作为根;无标记的单链外壳直接答 400 SHELL_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