@nick848/ft 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/locales/en.json CHANGED
@@ -3,7 +3,6 @@
3
3
  "error.karpathyMissing": "andrej-karpathy-skills not found. See https://github.com/multica-ai/andrej-karpathy-skills or copy rule files manually.",
4
4
  "error.cometNonInteractive": "Comet failed in non-interactive (IDE) environment.",
5
5
  "error.cometUseTerminal": "Run in system terminal: comet <command>",
6
- "hint.gitnexusOptional": "Tip: install GitNexus for code intelligence (npm install -g gitnexus)",
7
6
  "init.injectModeQuestion": "How should Karpathy rules be injected?",
8
7
  "init.injectModeManual": "1) Manually select target tools (recommended)",
9
8
  "init.injectModeAuto": "2) Auto-detect current environment",
@@ -15,9 +14,6 @@
15
14
  "init.runningComet": "Running comet init...",
16
15
  "init.success": "✓ FT initialization complete",
17
16
  "init.nextStep": "Next: run /ft-fill-context in your IDE to complete project context",
18
- "mcp.writeSuccess": "MCP config written: {{path}}",
19
- "mcp.manualTitle": "⚠️ Cannot write MCP config. Add the following to {{path}}:",
20
- "mcp.pressKey": "Press any key to continue...",
21
17
  "gate.fillContextFirst": "Complete /ft-fill-context first — fill all [NEEDS LLM INPUT] placeholders in AGENTS.md before Comet workflow commands.",
22
18
  "fillContext.title": "AGENTS.md Context Fill Task",
23
19
  "fillContext.goal": "Edit `AGENTS.md` directly and replace `[NEEDS LLM INPUT]` with project-specific content.",
@@ -30,16 +26,99 @@
30
26
  "fillContext.reference": "Reference (from AGENTS-BAK.md)",
31
27
  "fillContext.backupNote": "Backup merge notes",
32
28
  "fillContext.backupMerge": "Regenerate template sections from backup; append custom sections from backup to the end with <!-- migrated from AGENTS-BAK.md -->",
33
- "graph.setupGuide": "GitNexus not installed. Run:",
34
- "graph.alreadyInstalled": "GitNexus is installed.",
35
- "graph.handoffSummary": "Graph Summary",
36
- "graph.handoffPrompt": "Guidance Prompt",
37
- "graph.handoffPromptBody": "For upcoming coding tasks, prioritize GitNexus MCP tools (get_symbol, get_callers, query) for symbol-level dependencies instead of blind full-repo scans.",
38
- "graph.handoffTimestamp": "Update AGENTS.md Timestamp",
39
- "graph.timestampUpdated": "Graph refresh timestamp updated in AGENTS.md.",
40
- "graph.summaryFailed": "Could not fetch graph summary (gitnexus query --summary failed).",
41
- "graph.statusTitle": "GitNexus Status",
42
- "graph.statusInstalled": "Installed",
43
- "graph.statusGraph": "Graph directory",
44
- "graph.statusIndexFiles": "Index files"
29
+ "init.cursorCommandsInjected": "Installed {{count}} Cursor slash commands to .cursor/commands/",
30
+ "init.figmaIntro": "We recommend configuring Figma Developer MCP so AI can read Figma designs during development.",
31
+ "init.figmaDocsHint": "Generate a Personal Access Token in Figma account settings:",
32
+ "init.figmaConfigureQuestion": "Configure Figma Developer MCP now? (You can skip and add it later in Cursor Settings)",
33
+ "init.figmaSkipped": "Skipped Figma MCP setup. Before /ft-build, ensure Figma/Lanhu links or MCP are available.",
34
+ "init.figmaApiKeyQuestion": "Enter your Figma Personal Access Token (API Key):",
35
+ "init.figmaApiKeyRequired": "API Key cannot be empty",
36
+ "init.figmaConfigured": "Figma Developer MCP written to {{path}}",
37
+ "init.figmaGitignoreHint": "Note: API Key is stored in .cursor/mcp.json — add it to .gitignore to avoid leaking secrets.",
38
+ "build.title": "FT Build — Visual Design Fidelity",
39
+ "build.mandatory": "**Prefer** obtaining visual designs (Figma / Lanhu) before coding. If unavailable, supplement via the options below or skip — the build flow **will not be blocked**.",
40
+ "build.stepFetch": "1. Obtain visual designs (priority order)",
41
+ "build.stepFetchDetail": "1. Use Figma Developer MCP (`get_figma_data`, `download_figma_images`) to fetch design data\n2. Check the Visual Design section in `AGENTS.md` for Figma / Lanhu links\n3. Confirm the design URL and frame/node for the current task with the user",
42
+ "build.designLinksFromAgents": "Visual design info from AGENTS.md",
43
+ "build.figmaMcpStatus": "2. Figma MCP status",
44
+ "build.figmaMcpReady": "✓ Figma Developer MCP detected. Fetch design data via MCP before coding.",
45
+ "build.figmaMcpMissing": "✗ Figma Developer MCP not detected. Supplement API Key below, or skip and continue build.",
46
+ "build.fidelityRules": "3. Visual fidelity standards",
47
+ "build.fidelityRulesDetail": "- When designs exist, match strictly: layout, spacing, colors, typography, radius, shadows, icons, and assets\n- Do not invent UI elements absent from the design\n- Keep component hierarchy aligned with design frames/layers\n- Follow responsive/adaptation rules from design specs or AGENTS.md",
48
+ "build.supplement": "4. Supplement visual design info (optional, non-blocking)",
49
+ "build.supplementDetail": "When designs or MCP are not ready, pick an option below — or skip; build will continue.",
50
+ "build.supplementQuestion": "Visual designs incomplete — choose next step:",
51
+ "build.supplementApiKey": "Supplement Figma API Key (write to .cursor/mcp.json)",
52
+ "build.supplementDesignLink": "Supplement Figma / Lanhu design link",
53
+ "build.supplementSkip": "Skip and continue build",
54
+ "build.supplementSkipped": "Skipped visual design supplement — continuing build.",
55
+ "build.supplementDesignLinkQuestion": "Enter Figma or Lanhu design link:",
56
+ "build.supplementDesignLinkRequired": "Link cannot be empty",
57
+ "build.supplementLinkNoted": "Design link noted: {{link}} (consider adding to AGENTS.md → Visual Design)",
58
+ "build.supplementMcpRestartHint": "Reconnect figma-developer-mcp in Cursor Settings → MCP for the API Key to take effect.",
59
+ "build.supplementNonInteractive": "Non-interactive terminal: ask the user in chat for Figma API Key or design link, or to skip; build continues regardless.",
60
+ "build.nextStep": "5. Next step",
61
+ "build.nextStepDetail": "Comet build starts below regardless of design availability. Match designs strictly when available; otherwise proceed with existing context and align later.",
62
+ "build.visualSpec": "3.5 Visual spec (mandatory)",
63
+ "build.visualSpecDetail": "Before coding, read `.cursor/skills/visual-fidelity/SKILL.md` and work against `.ft/visual-spec.md` and `.ft/visual-checklist.json`.",
64
+ "build.visualSpecWritten": "✓ Visual spec: {{path}}",
65
+ "build.visualChecklistWritten": "✓ Acceptance checklist: {{path}}",
66
+ "build.figmaTokensExtracted": "✓ Auto-extracted {{count}} design tokens from Figma API",
67
+ "build.figmaTokensEmpty": "⚠ Figma API returned no tokens (supplement visual-spec via MCP manually)",
68
+ "build.visualSkillPath": "✓ Visual fidelity skill: {{path}}",
69
+ "build.checklistSummary": "Checklist: {{passed}} passed / {{pending}} pending / {{total}} total",
70
+ "build.agentMustReadSkill": "→ Agent: read visual-fidelity skill before coding; output acceptance report and update checklist after.",
71
+ "tweak.title": "FT Tweak — Visual Regression Guard",
72
+ "tweak.regressionIntro": "When fixing visual issues, items with passed status must not regress. Run full checklist after every fix.",
73
+ "tweak.agentMustReadSkill": "→ Agent: read visual-fidelity skill Tweak section; run full regression check after fix.",
74
+ "hotfix.title": "FT Hotfix — Visual Regression Guard",
75
+ "hotfix.regressionIntro": "Hotfixes follow the same visual regression protocol: passed items must not regress; run full checklist after every fix.",
76
+ "hotfix.agentMustReadSkill": "→ Agent: read visual-fidelity skill Tweak/Hotfix section; run full regression check after fix.",
77
+ "regression.specPath": "Visual spec: {{path}}",
78
+ "regression.specMissing": "⚠ .ft/visual-spec.md not found — run /ft-build first",
79
+ "regression.checklistSummary": "Checklist: {{passed}} passed (locked) / {{pending}} pending / {{failed}} failed / {{total}} total",
80
+ "regression.lockedItems": "Locked items (must not regress)",
81
+ "regression.checklistMissing": "⚠ .ft/visual-checklist.json not found — run /ft-build first",
82
+ "regression.skillPath": "Visual fidelity skill: {{path}}",
83
+ "regression.protocol": "Regression-safe fix protocol",
84
+ "regression.protocolDetail": "1. Fix only the reported issue (one dimension: spacing / color / typography)\n2. Do not rewrite page layout or remove verified CSS variables for local fixes\n3. Re-verify entire checklist — all passed items must stay passed\n4. Output visual acceptance report with regression table",
85
+ "regression.designContext": "Design context (AGENTS.md)",
86
+ "verify.title": "FT Verify — Visual Acceptance & Pixel Diff",
87
+ "verify.intro": "Review checklist status and optionally run Playwright pixel diff, then continue Comet verify workflow.",
88
+ "verify.checklistGate": "1. Checklist status",
89
+ "verify.checklistSummary": "Checklist: {{passed}} passed / {{pending}} pending / {{failed}} failed / {{total}} total",
90
+ "verify.checklistFailed": "⚠ Failed items exist — fix before marking passed",
91
+ "verify.checklistPending": "⚠ Pending items exist — complete visual acceptance",
92
+ "verify.checklistMissing": "⚠ .ft/visual-checklist.json not found — run /ft-build first",
93
+ "verify.visualDiff": "2. Pixel-level visual diff (Playwright)",
94
+ "verify.configPath": "Config: {{path}}",
95
+ "verify.visualDiffDisabled": "Pixel diff disabled (visual-verify.json → enabled: false)",
96
+ "verify.enableHint": "To enable: edit .ft/visual-verify.json, then run /ft-visual-tools-install to install deps",
97
+ "verify.scriptPath": "Diff script: {{path}}",
98
+ "verify.depsMissing": "⚠ playwright / pixelmatch / pngjs not found",
99
+ "verify.depsInstall": "One-step install: run /ft-visual-tools-install in IDE, or `ft slash visual-tools-install` in terminal",
100
+ "verify.screensConfigured": "Configured screens:",
101
+ "verify.runningDiff": "Running pixel diff...",
102
+ "verify.visualDiffPassed": "✓ All pixel diffs passed",
103
+ "verify.visualDiffFailed": "✗ Pixel diff failed — see diff images in .ft/visual-diffs/",
104
+ "verify.nextStepDetail": "Comet verify workflow continues below.",
105
+ "verify.agentInstruction": "→ Agent: if diff fails, fix UI against baselines and update visual-checklist; first-time baselines: node scripts/visual-diff.mjs --update (or FT package script path).",
106
+ "init.visualSkillInjected": "Installed visual-fidelity skill ({{count}} files) to .cursor/skills/",
107
+ "init.visualSpecScaffolded": "Scaffolded .ft/visual-spec.md, visual-checklist.json, and visual-verify.json",
108
+ "cursor.commandsSynced": "Synced {{count}} Cursor slash commands to .cursor/commands/",
109
+ "cursor.skillsSynced": "Synced visual-fidelity skill ({{count}} files) to .cursor/skills/",
110
+ "cursor.commandsHint": "Type / in Cursor Agent chat to use /ft-fill-context and other commands",
111
+ "visualTools.title": "FT Visual Tools — Install Pixel Diff Dependencies",
112
+ "visualTools.intro": "Install all tools required for /ft-verify pixel diff: playwright, pixelmatch, pngjs, and Chromium.",
113
+ "visualTools.noPackageJson": "package.json not found — initialize an npm/pnpm project in the project root first",
114
+ "visualTools.packageManager": "Detected package manager: **{{pm}}**",
115
+ "visualTools.depsAlreadyInstalled": "✓ playwright / pixelmatch / pngjs already installed — skipping deps",
116
+ "visualTools.installingDeps": "Installing: {{packages}}",
117
+ "visualTools.depsInstalled": "✓ Dependencies installed",
118
+ "visualTools.depsInstallFailed": "✗ Dependency install failed — check network or install manually",
119
+ "visualTools.installingBrowsers": "Installing Playwright Chromium browser…",
120
+ "visualTools.browsersInstallFailed": "✗ Chromium install failed — try: npx playwright install chromium",
121
+ "visualTools.verifyFailed": "✗ Dependencies still missing after install — check node_modules",
122
+ "visualTools.success": "✓ Visual diff tools installed",
123
+ "visualTools.nextStep": "Next: enable pixel diff in .ft/visual-verify.json, then run /ft-verify"
45
124
  }
@@ -3,7 +3,6 @@
3
3
  "error.karpathyMissing": "未检测到 andrej-karpathy-skills,请参考 https://github.com/multica-ai/andrej-karpathy-skills 安装,或手动复制规则文件后重试",
4
4
  "error.cometNonInteractive": "Comet 在非交互环境(IDE)中执行失败。",
5
5
  "error.cometUseTerminal": "请在系统终端执行:comet <command>",
6
- "hint.gitnexusOptional": "提示:可安装 GitNexus 增强代码认知(npm install -g gitnexus)",
7
6
  "init.injectModeQuestion": "请选择 andrej-karpathy-skills 规则的注入方式:",
8
7
  "init.injectModeManual": "1) 手动选择目标工具(推荐)",
9
8
  "init.injectModeAuto": "2) 自动检测当前环境",
@@ -15,9 +14,6 @@
15
14
  "init.runningComet": "正在执行 comet init...",
16
15
  "init.success": "✓ FT 初始化完成",
17
16
  "init.nextStep": "下一步:在 IDE 中执行 /ft-fill-context 完善项目上下文",
18
- "mcp.writeSuccess": "已写入 MCP 配置:{{path}}",
19
- "mcp.manualTitle": "⚠️ 无法自动写入 MCP 配置,请手动将以下内容添加到 {{path}} 中:",
20
- "mcp.pressKey": "完成后按任意键继续...",
21
17
  "gate.fillContextFirst": "请先完成 /ft-fill-context,将 AGENTS.md 中的 [NEEDS LLM INPUT] 占位符填充完毕后再执行 Comet 流程命令。",
22
18
  "fillContext.title": "AGENTS.md 上下文填充任务",
23
19
  "fillContext.goal": "请直接编辑 `AGENTS.md` 文件,将 `[NEEDS LLM INPUT]` 替换为具体内容。",
@@ -30,16 +26,99 @@
30
26
  "fillContext.reference": "参考内容(来自 AGENTS-BAK.md)",
31
27
  "fillContext.backupNote": "备份合并说明",
32
28
  "fillContext.backupMerge": "模板内字段请参考旧内容重新生成;超模板自定义章节须原样追加到 AGENTS.md 末尾,并添加注释 <!-- 以下内容来自 AGENTS-BAK.md,已自动迁移 -->",
33
- "graph.setupGuide": "GitNexus 未安装。请执行:",
34
- "graph.alreadyInstalled": "GitNexus 已安装。",
35
- "graph.handoffSummary": "图谱摘要",
36
- "graph.handoffPrompt": "引导提示词",
37
- "graph.handoffPromptBody": "在后续编码任务中,请优先使用 GitNexus MCP 工具(如 get_symbol、get_callers、query)获取符号级依赖与调用关系,避免盲目全文扫描。",
38
- "graph.handoffTimestamp": "更新 AGENTS.md 时间戳",
39
- "graph.timestampUpdated": "已更新 AGENTS.md 中的图谱刷新时间。",
40
- "graph.summaryFailed": "无法获取图谱摘要(gitnexus query --summary 失败)。",
41
- "graph.statusTitle": "GitNexus 状态",
42
- "graph.statusInstalled": "已安装",
43
- "graph.statusGraph": "图谱目录",
44
- "graph.statusIndexFiles": "索引文件数"
29
+ "init.cursorCommandsInjected": "已安装 {{count}} 个 Cursor Slash 命令到 .cursor/commands/",
30
+ "init.figmaIntro": "建议配置 Figma Developer MCP,以便 AI 在开发时读取 Figma 视觉稿。",
31
+ "init.figmaDocsHint": "在 Figma 账户设置中生成 Personal Access Token:",
32
+ "init.figmaConfigureQuestion": "是否现在配置 Figma Developer MCP?(可跳过,稍后在 Cursor 设置中手动添加)",
33
+ "init.figmaSkipped": "已跳过 Figma MCP 配置。使用 /ft-build 前请确保已提供 Figma/蓝湖链接或手动配置 MCP。",
34
+ "init.figmaApiKeyQuestion": "请输入 Figma Personal Access Token(API Key):",
35
+ "init.figmaApiKeyRequired": "API Key 不能为空",
36
+ "init.figmaConfigured": "已写入 Figma Developer MCP 配置:{{path}}",
37
+ "init.figmaGitignoreHint": "提示:API Key 已写入 .cursor/mcp.json,建议将 .cursor/mcp.json 加入 .gitignore 避免泄露。",
38
+ "build.title": "FT Build — 视觉稿还原约束",
39
+ "build.mandatory": "**优先**在编码前获取并对齐视觉稿(Figma / 蓝湖等)。若暂时无法获取,可通过下方选项补充或跳过,**不会中断** build 流程。",
40
+ "build.stepFetch": "1. 获取视觉稿(按优先级)",
41
+ "build.stepFetchDetail": "1. 使用 Figma Developer MCP(`get_figma_data`、`download_figma_images`)读取设计数据\n2. 查阅 `AGENTS.md`「视觉稿」章节中的 Figma / 蓝湖链接\n3. 向用户确认当前任务对应的设计稿链接与 frame/node",
42
+ "build.designLinksFromAgents": "AGENTS.md 中的视觉稿信息",
43
+ "build.figmaMcpStatus": "2. Figma MCP 状态",
44
+ "build.figmaMcpReady": "✓ 已检测到 Figma Developer MCP 配置。请通过 MCP 拉取设计数据后再编码。",
45
+ "build.figmaMcpMissing": "✗ 未检测到 Figma Developer MCP。可通过下方选项补充 API Key,或跳过并继续 build。",
46
+ "build.fidelityRules": "3. 视觉还原标准",
47
+ "build.fidelityRulesDetail": "- 有视觉稿时严格还原:布局、间距、颜色、字体、圆角、阴影、图标与切图\n- 不得凭猜测补充设计中不存在的 UI 元素\n- 组件层级与命名尽量与设计稿 frame/layer 结构一致\n- 响应式/适配规则以设计稿标注或 AGENTS.md 说明为准",
48
+ "build.supplement": "4. 补充视觉稿信息(可选,不阻塞)",
49
+ "build.supplementDetail": "视觉稿或 MCP 未就绪时,请选择一项补充;也可跳过,build 流程将继续执行。",
50
+ "build.supplementQuestion": "视觉稿获取不完整,请选择下一步:",
51
+ "build.supplementApiKey": "补充 Figma API Key(写入 .cursor/mcp.json)",
52
+ "build.supplementDesignLink": "补充 Figma / 蓝湖设计链接",
53
+ "build.supplementSkip": "跳过,继续 build",
54
+ "build.supplementSkipped": "已跳过视觉稿补充,继续 build 流程。",
55
+ "build.supplementDesignLinkQuestion": "请输入 Figma 或蓝湖设计链接:",
56
+ "build.supplementDesignLinkRequired": "链接不能为空",
57
+ "build.supplementLinkNoted": "已记录设计链接:{{link}}(建议同步写入 AGENTS.md「视觉稿」章节)",
58
+ "build.supplementMcpRestartHint": "提示:请在 Cursor Settings → MCP 中重连 figma-developer-mcp 使 API Key 生效。",
59
+ "build.supplementNonInteractive": "非交互终端:请在对话中请用户补充 Figma API Key 或设计链接,或选择跳过;build 流程将继续。",
60
+ "build.nextStep": "5. 下一步",
61
+ "build.nextStepDetail": "无论是否已获取视觉稿,下方将继续 Comet build 工作流。有视觉稿时按标准严格还原;暂无时先按现有信息推进,待补充后再对齐。",
62
+ "build.visualSpec": "3.5 视觉规格单(强制)",
63
+ "build.visualSpecDetail": "编码前必须阅读 `.cursor/skills/visual-fidelity/SKILL.md`,并对照 `.ft/visual-spec.md` 与 `.ft/visual-checklist.json` 工作。",
64
+ "build.visualSpecWritten": "✓ 视觉规格单:{{path}}",
65
+ "build.visualChecklistWritten": "✓ 验收清单:{{path}}",
66
+ "build.figmaTokensExtracted": "✓ 已从 Figma API 自动提取 {{count}} 个 design token",
67
+ "build.figmaTokensEmpty": "⚠ Figma API 未返回 token(请通过 MCP 手动补充 visual-spec)",
68
+ "build.visualSkillPath": "✓ 视觉还原 Skill:{{path}}",
69
+ "build.checklistSummary": "验收项:{{passed}} 已通过 / {{pending}} 待验 / 共 {{total}} 项",
70
+ "build.agentMustReadSkill": "→ Agent:编码前读取 visual-fidelity skill;编码后输出视觉验收报告并更新 checklist。",
71
+ "tweak.title": "FT Tweak — 视觉回归防护",
72
+ "tweak.regressionIntro": "修复视觉问题时,已通过(passed)的验收项不得回退。每次修复后必须全量回归检查。",
73
+ "tweak.agentMustReadSkill": "→ Agent:读取 visual-fidelity skill 的 Tweak 章节,修复后全量回归验收。",
74
+ "hotfix.title": "FT Hotfix — 视觉回归防护",
75
+ "hotfix.regressionIntro": "紧急修复同样适用视觉回归协议:已通过(passed)的验收项不得回退,修复后必须全量回归检查。",
76
+ "hotfix.agentMustReadSkill": "→ Agent:读取 visual-fidelity skill 的 Tweak/Hotfix 章节,修复后全量回归验收。",
77
+ "regression.specPath": "视觉规格单:{{path}}",
78
+ "regression.specMissing": "⚠ 未找到 .ft/visual-spec.md — 建议先执行 /ft-build 生成规格单",
79
+ "regression.checklistSummary": "验收项:{{passed}} 已通过(锁定)/ {{pending}} 待验 / {{failed}} 失败 / 共 {{total}} 项",
80
+ "regression.lockedItems": "已锁定项(修复时不得回退)",
81
+ "regression.checklistMissing": "⚠ 未找到 .ft/visual-checklist.json — 建议先执行 /ft-build",
82
+ "regression.skillPath": "视觉还原 Skill:{{path}}",
83
+ "regression.protocol": "回归修复协议",
84
+ "regression.protocolDetail": "1. 仅修复当前报告的问题(单维度:间距 / 颜色 / 字号)\n2. 禁止为局部修复重写整页布局或删除已验收的 CSS 变量\n3. 修复后逐项核对 checklist — 所有 passed 项必须保持 passed\n4. 输出视觉验收报告(含回归对照表)",
85
+ "regression.designContext": "设计稿上下文(AGENTS.md)",
86
+ "verify.title": "FT Verify — 视觉验收与像素对比",
87
+ "verify.intro": "验收 checklist 状态并可选运行 Playwright 像素 diff,随后继续 Comet verify 工作流。",
88
+ "verify.checklistGate": "1. 验收清单状态",
89
+ "verify.checklistSummary": "验收项:{{passed}} 已通过 / {{pending}} 待验 / {{failed}} 失败 / 共 {{total}} 项",
90
+ "verify.checklistFailed": "⚠ 存在 failed 项 — 请修复后再标记 passed",
91
+ "verify.checklistPending": "⚠ 存在 pending 项 — 请完成视觉验收",
92
+ "verify.checklistMissing": "⚠ 未找到 .ft/visual-checklist.json — 建议先执行 /ft-build",
93
+ "verify.visualDiff": "2. 像素级视觉对比(Playwright)",
94
+ "verify.configPath": "配置文件:{{path}}",
95
+ "verify.visualDiffDisabled": "像素对比已禁用(visual-verify.json → enabled: false)",
96
+ "verify.enableHint": "启用步骤:编辑 .ft/visual-verify.json,然后执行 /ft-visual-tools-install 安装依赖",
97
+ "verify.scriptPath": "对比脚本:{{path}}",
98
+ "verify.depsMissing": "⚠ 未检测到 playwright / pixelmatch / pngjs",
99
+ "verify.depsInstall": "一键安装:在 IDE 执行 /ft-visual-tools-install,或终端运行 `ft slash visual-tools-install`",
100
+ "verify.screensConfigured": "已配置页面:",
101
+ "verify.runningDiff": "正在运行像素对比...",
102
+ "verify.visualDiffPassed": "✓ 像素对比全部通过",
103
+ "verify.visualDiffFailed": "✗ 像素对比未通过 — 查看 .ft/visual-diffs/ 中的 diff 图",
104
+ "verify.nextStepDetail": "下方将继续 Comet verify 工作流。",
105
+ "verify.agentInstruction": "→ Agent:若 diff 失败,对照 baseline 修复 UI 并更新 visual-checklist;首次建立 baseline 可运行 node scripts/visual-diff.mjs --update(或通过 ft 包内脚本路径)。",
106
+ "init.visualSkillInjected": "已安装 visual-fidelity skill({{count}} 个文件)到 .cursor/skills/",
107
+ "init.visualSpecScaffolded": "已生成 .ft/visual-spec.md、visual-checklist.json 与 visual-verify.json 模板",
108
+ "cursor.commandsSynced": "已同步 {{count}} 个 Cursor Slash 命令到 .cursor/commands/",
109
+ "cursor.skillsSynced": "已同步 visual-fidelity skill({{count}} 个文件)到 .cursor/skills/",
110
+ "cursor.commandsHint": "在 Cursor Agent 聊天框输入 / 即可看到 /ft-fill-context 等命令",
111
+ "visualTools.title": "FT Visual Tools — 一键安装像素对比依赖",
112
+ "visualTools.intro": "安装 /ft-verify 像素 diff 所需的全部工具:playwright、pixelmatch、pngjs,以及 Chromium 浏览器。",
113
+ "visualTools.noPackageJson": "未找到 package.json — 请先在项目根目录初始化 npm/pnpm 项目",
114
+ "visualTools.packageManager": "检测到包管理器:**{{pm}}**",
115
+ "visualTools.depsAlreadyInstalled": "✓ playwright / pixelmatch / pngjs 已安装,跳过依赖安装",
116
+ "visualTools.installingDeps": "正在安装:{{packages}}",
117
+ "visualTools.depsInstalled": "✓ 依赖安装完成",
118
+ "visualTools.depsInstallFailed": "✗ 依赖安装失败 — 请检查网络或手动安装",
119
+ "visualTools.installingBrowsers": "正在安装 Playwright Chromium 浏览器…",
120
+ "visualTools.browsersInstallFailed": "✗ Chromium 安装失败 — 可手动运行 npx playwright install chromium",
121
+ "visualTools.verifyFailed": "✗ 安装后仍未检测到全部依赖,请检查 node_modules",
122
+ "visualTools.success": "✓ 视觉对比工具安装完成",
123
+ "visualTools.nextStep": "下一步:编辑 .ft/visual-verify.json 启用像素对比,然后执行 /ft-verify"
45
124
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nick848/ft",
3
- "version": "0.1.0",
4
- "description": "Frontend Toolkit — CLI orchestration layer for Comet, Karpathy rules, and GitNexus",
3
+ "version": "0.1.1",
4
+ "description": "Frontend Toolkit — CLI orchestration layer for Comet and Karpathy rules",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ft": "./dist/index.js"
@@ -10,6 +10,9 @@
10
10
  "dist",
11
11
  "templates",
12
12
  "rules-templates",
13
+ "cursor-commands-templates",
14
+ "skills-templates",
15
+ "scripts",
13
16
  "locales",
14
17
  "README.md",
15
18
  "LICENSE"
@@ -34,7 +37,6 @@
34
37
  "cursor",
35
38
  "codex",
36
39
  "opencode",
37
- "gitnexus",
38
40
  "agents"
39
41
  ],
40
42
  "author": "nick848",
@@ -47,7 +49,6 @@
47
49
  "chalk": "^5.4.1",
48
50
  "commander": "^13.1.0",
49
51
  "cosmiconfig": "^9.0.0",
50
- "deepmerge": "^4.3.1",
51
52
  "execa": "^9.5.2",
52
53
  "handlebars": "^4.7.8",
53
54
  "inquirer": "^12.4.2",
@@ -0,0 +1,193 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * FT visual diff — run from project root via `ft slash verify`.
4
+ * Requires project devDependencies: playwright, pixelmatch, pngjs
5
+ *
6
+ * Install: npm i -D playwright pixelmatch pngjs && npx playwright install chromium
7
+ * Update baselines: node <ft>/scripts/visual-diff.mjs --update
8
+ */
9
+ import { createRequire } from 'node:module';
10
+ import {
11
+ existsSync,
12
+ mkdirSync,
13
+ readFileSync,
14
+ writeFileSync,
15
+ } from 'node:fs';
16
+ import path from 'node:path';
17
+
18
+ const projectRoot = process.cwd();
19
+ const requireFromProject = createRequire(path.join(projectRoot, 'package.json'));
20
+
21
+ function loadDependency(name) {
22
+ try {
23
+ return requireFromProject(name);
24
+ } catch {
25
+ console.error(
26
+ `Missing dependency "${name}". Install in project root:\n` +
27
+ ' npm i -D playwright pixelmatch pngjs\n' +
28
+ ' npx playwright install chromium',
29
+ );
30
+ process.exit(2);
31
+ }
32
+ }
33
+
34
+ const CONFIG_PATH = path.join(projectRoot, '.ft', 'visual-verify.json');
35
+ const UPDATE_BASELINES = process.argv.includes('--update');
36
+
37
+ function readConfig() {
38
+ if (!existsSync(CONFIG_PATH)) {
39
+ console.error(`Config not found: ${CONFIG_PATH}`);
40
+ console.error('Run `ft slash verify` to scaffold, then edit screens.');
41
+ process.exit(2);
42
+ }
43
+ return JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
44
+ }
45
+
46
+ function rgbaToHex(r, g, b) {
47
+ const byte = (v) => Math.round(v).toString(16).padStart(2, '0');
48
+ return `#${byte(r)}${byte(g)}${byte(b)}`;
49
+ }
50
+
51
+ async function compareImages(baselinePath, actualPath, diffPath, threshold) {
52
+ const { PNG } = loadDependency('pngjs');
53
+ const pixelmatch = loadDependency('pixelmatch');
54
+
55
+ const baseline = PNG.sync.read(readFileSync(baselinePath));
56
+ const actual = PNG.sync.read(readFileSync(actualPath));
57
+
58
+ if (baseline.width !== actual.width || baseline.height !== actual.height) {
59
+ return {
60
+ passed: false,
61
+ diffPixels: baseline.width * baseline.height,
62
+ diffPercent: 100,
63
+ error: `Size mismatch: baseline ${baseline.width}x${baseline.height}, actual ${actual.width}x${actual.height}`,
64
+ };
65
+ }
66
+
67
+ const diff = new PNG({ width: baseline.width, height: baseline.height });
68
+ const diffPixels = pixelmatch(
69
+ baseline.data,
70
+ actual.data,
71
+ diff.data,
72
+ baseline.width,
73
+ baseline.height,
74
+ { threshold: threshold / 100 },
75
+ );
76
+
77
+ const totalPixels = baseline.width * baseline.height;
78
+ const diffPercent = (diffPixels / totalPixels) * 100;
79
+ const passed = diffPercent <= threshold;
80
+
81
+ if (!passed || diffPixels > 0) {
82
+ writeFileSync(diffPath, PNG.sync.write(diff));
83
+ }
84
+
85
+ return { passed, diffPixels, diffPercent };
86
+ }
87
+
88
+ async function main() {
89
+ const config = readConfig();
90
+ if (!config.enabled) {
91
+ console.log('Visual diff disabled in .ft/visual-verify.json (enabled: false).');
92
+ console.log(JSON.stringify({ passed: true, results: [], skipped: true }));
93
+ process.exit(0);
94
+ }
95
+
96
+ if (!config.screens?.length) {
97
+ console.error('No screens configured in visual-verify.json');
98
+ process.exit(2);
99
+ }
100
+
101
+ const { chromium } = loadDependency('playwright');
102
+ const outputDir = path.resolve(projectRoot, config.outputDir ?? '.ft/visual-diffs');
103
+ mkdirSync(outputDir, { recursive: true });
104
+
105
+ const browser = await chromium.launch({ headless: true });
106
+ const results = [];
107
+
108
+ try {
109
+ for (const screen of config.screens) {
110
+ const viewport = screen.viewport ?? { width: 1280, height: 720 };
111
+ const baselinePath = path.resolve(projectRoot, screen.baseline);
112
+ const actualPath = path.join(outputDir, `${screen.id}-actual.png`);
113
+ const diffPath = path.join(outputDir, `${screen.id}-diff.png`);
114
+ const url = `${config.baseUrl.replace(/\/$/, '')}${screen.path}`;
115
+
116
+ mkdirSync(path.dirname(baselinePath), { recursive: true });
117
+
118
+ const context = await browser.newContext({ viewport });
119
+ const page = await context.newPage();
120
+
121
+ try {
122
+ await page.goto(url, { waitUntil: 'networkidle', timeout: 30000 });
123
+ await page.screenshot({ path: actualPath, fullPage: false });
124
+
125
+ if (UPDATE_BASELINES || !existsSync(baselinePath)) {
126
+ writeFileSync(baselinePath, readFileSync(actualPath));
127
+ results.push({
128
+ id: screen.id,
129
+ passed: true,
130
+ diffPixels: 0,
131
+ diffPercent: 0,
132
+ baseline: screen.baseline,
133
+ actual: path.relative(projectRoot, actualPath),
134
+ updated: true,
135
+ });
136
+ console.log(`✓ Baseline updated: ${screen.baseline}`);
137
+ continue;
138
+ }
139
+
140
+ const comparison = await compareImages(
141
+ baselinePath,
142
+ actualPath,
143
+ diffPath,
144
+ config.threshold ?? 0.1,
145
+ );
146
+
147
+ results.push({
148
+ id: screen.id,
149
+ passed: comparison.passed,
150
+ diffPixels: comparison.diffPixels,
151
+ diffPercent: Number(comparison.diffPercent.toFixed(4)),
152
+ baseline: screen.baseline,
153
+ actual: path.relative(projectRoot, actualPath),
154
+ diff: comparison.diffPixels > 0 ? path.relative(projectRoot, diffPath) : undefined,
155
+ error: comparison.error,
156
+ });
157
+
158
+ const status = comparison.passed ? '✓' : '✗';
159
+ const pct = comparison.diffPercent.toFixed(2);
160
+ console.log(
161
+ `${status} ${screen.id}: ${pct}% diff (${comparison.diffPixels} px)` +
162
+ (comparison.error ? ` — ${comparison.error}` : ''),
163
+ );
164
+ } catch (err) {
165
+ results.push({
166
+ id: screen.id,
167
+ passed: false,
168
+ diffPixels: 0,
169
+ diffPercent: 100,
170
+ baseline: screen.baseline,
171
+ actual: path.relative(projectRoot, actualPath),
172
+ error: err.message,
173
+ });
174
+ console.error(`✗ ${screen.id}: ${err.message}`);
175
+ } finally {
176
+ await context.close();
177
+ }
178
+ }
179
+ } finally {
180
+ await browser.close();
181
+ }
182
+
183
+ const passed = results.every((r) => r.passed);
184
+ const report = { passed, results };
185
+ console.log(JSON.stringify(report));
186
+
187
+ process.exit(passed ? 0 : 1);
188
+ }
189
+
190
+ main().catch((err) => {
191
+ console.error(err);
192
+ process.exit(1);
193
+ });
@@ -0,0 +1,77 @@
1
+ ---
2
+ name: visual-fidelity
3
+ description: >-
4
+ Enforces pixel-level visual design fidelity from Figma/Lanhu specs. Reads
5
+ .ft/visual-spec.md and .ft/visual-checklist.json before coding. Use during
6
+ /ft-build, /ft-tweak, /ft-hotfix, or any UI implementation from design files.
7
+ Requires acceptance checklist pass and full regression re-check after changes.
8
+ ---
9
+
10
+ # Visual Fidelity
11
+
12
+ ## Before coding
13
+
14
+ 1. Read `.ft/visual-spec.md` and `.ft/visual-checklist.json`
15
+ 2. If Figma MCP is available, call `get_figma_data` for the frame/node in the spec
16
+ 3. Update the spec with extracted tokens — **never guess** colors, spacing, or typography
17
+ 4. Mark unknown values as `TBD`; do not invent UI elements absent from the design
18
+
19
+ ## While coding
20
+
21
+ - Use design tokens / CSS variables from the spec — no hardcoded magic numbers
22
+ - Map Figma layers to code components in the Component Map table
23
+ - One frame per task; do not mix unrelated screens in one edit
24
+
25
+ ## After coding
26
+
27
+ Output a **Visual Acceptance Report** using this template:
28
+
29
+ ```markdown
30
+ ## 视觉验收报告
31
+
32
+ ### 本次变更
33
+ - 问题/任务:…
34
+ - 改动文件:…(仅列必要文件)
35
+
36
+ ### 验收对照
37
+ | 验收项 ID | 状态 | 设计值 | 实现值 |
38
+ |-----------|------|--------|--------|
39
+ | … | ✅/❌ | … | … |
40
+
41
+ ### 回归检查(已通过项必须保持 ✅)
42
+ | 验收项 ID | 状态 | 说明 |
43
+ |-----------|------|------|
44
+ | … | ✅ 保持 | … |
45
+ ```
46
+
47
+ Update `.ft/visual-checklist.json`: set `status` to `passed` only when design and implementation match.
48
+
49
+ ## Verify / pixel diff
50
+
51
+ During `/ft-verify`:
52
+
53
+ 1. Review checklist — no `failed` items should remain before sign-off
54
+ 2. If `.ft/visual-verify.json` has `enabled: true`, pixel diff runs automatically
55
+ 3. On diff failure, inspect `.ft/visual-diffs/*-diff.png` and fix UI
56
+ 4. First-time baselines: `node <ft-package>/scripts/visual-diff.mjs --update`
57
+
58
+ ## Tweak / hotfix regression protocol
59
+
60
+ When fixing a visual issue:
61
+
62
+ 1. Read checklist — list all items with `status: "passed"` (**locked items**)
63
+ 2. Fix **one dimension** at a time (spacing OR color OR typography)
64
+ 3. Do **not** rewrite layout or remove CSS variables to fix a local issue
65
+ 4. After fix, re-run **full checklist** — every locked item must remain `passed`
66
+ 5. If a locked item regresses, revert the breaking change before continuing
67
+
68
+ ## Forbidden
69
+
70
+ - Inventing UI elements not in the design
71
+ - Hardcoding colors/spacing when tokens exist in the spec
72
+ - Marking checklist items `passed` without verifying values
73
+ - Fixing issue B by undoing a verified fix for issue A
74
+
75
+ ## Additional resources
76
+
77
+ - Acceptance item schema: [checklist-schema.md](checklist-schema.md)
@@ -0,0 +1,33 @@
1
+ # Visual Checklist Schema
2
+
3
+ `.ft/visual-checklist.json` structure:
4
+
5
+ ```json
6
+ {
7
+ "version": 1,
8
+ "frame": "Frame name or TBD",
9
+ "figmaNodeId": "optional node id",
10
+ "items": [
11
+ {
12
+ "id": "unique-kebab-id",
13
+ "category": "color | spacing | typography | layout | asset | other",
14
+ "description": "Human-readable acceptance criterion",
15
+ "designValue": "Expected value from design",
16
+ "cssVariable": "optional --token-name",
17
+ "status": "pending | passed | failed"
18
+ }
19
+ ]
20
+ }
21
+ ```
22
+
23
+ ## Status rules
24
+
25
+ | Status | Meaning |
26
+ |--------|---------|
27
+ | `pending` | Not yet verified |
28
+ | `passed` | Verified match — **locked** during tweak/hotfix |
29
+ | `failed` | Known mismatch — must fix before marking passed |
30
+
31
+ ## ID naming
32
+
33
+ Use `{category}-{element}-{property}`: e.g. `spacing-header-margin-bottom`, `color-cta-background`.
@@ -27,6 +27,10 @@
27
27
 
28
28
  [NEEDS LLM INPUT]
29
29
 
30
+ ## Visual Design
31
+
32
+ [NEEDS LLM INPUT]
33
+
30
34
  ## Mini Program Info
31
35
 
32
36
  [NEEDS LLM INPUT]
@@ -41,6 +45,4 @@
41
45
 
42
46
  ## AI Working Guide
43
47
 
44
- {{gitnexus_condition}}
45
-
46
- - Graph last refreshed: not initialized
48
+ - Prefer Comet ecosystem tools (e.g. CodeGraph) for code analysis; follow project MCP and Comet workflow configuration.
@@ -27,6 +27,10 @@
27
27
 
28
28
  [NEEDS LLM INPUT]
29
29
 
30
+ ## 视觉稿
31
+
32
+ [NEEDS LLM INPUT]
33
+
30
34
  ## 小程序信息
31
35
 
32
36
  [NEEDS LLM INPUT]
@@ -41,6 +45,4 @@
41
45
 
42
46
  ## AI 工作指南
43
47
 
44
- {{gitnexus_condition}}
45
-
46
- - 图谱最后刷新时间: 未初始化
48
+ - 代码分析优先使用 Comet 生态工具(如 CodeGraph),遵循项目已配置的 MCP 与 Comet 工作流。