@double-codeing/flow2spec 3.1.0 → 3.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.
@@ -19,7 +19,9 @@ alwaysApply: true
19
19
  | `switchAgentVerification: false` | 落盘侧自验,不交叉 |
20
20
  | 文件不存在 | 所有字段均视为 `false` |
21
21
 
22
- **Claude Code**:若已启用 `f2s-config-inject` PreToolUse hook,调用 `f2s-*` Skill 时会注入配置摘要;**文件缺失、JSON 损坏或 hook 异常时也会注入说明与默认语义**,不静默。仍建议在存疑或刚改过配置时用 `Read` 与磁盘核对。
22
+ **Claude Code**:`f2s-config-session` `SessionStart` 注入一次配置摘要;`f2s-config-inject` 在 `PreToolUse` 仅作为守门提示,提醒调用 `f2s-*` Skill 前首步必须 `Read("flow2spec.config.json")`。两者都**不替代**本条 Read 要求。
23
+
24
+ **Cursor / Codex**:配置读取仍走文本约束(Cursor:本规则 `alwaysApply`;Codex:根 `AGENTS.md` 与 `.codex/topics/f2s-config-check.md`),不依赖 hook 自动读取配置。
23
25
 
24
26
  ### changeTracking(变更追踪)
25
27
 
@@ -89,6 +89,19 @@ alwaysApply: true
89
89
 
90
90
  **例外(应显式否定)**:A、B 两种做法在逻辑上均正确,但项目已做出**排他性选择**时,须写出「不用 B」——不说清楚,读者无法判断 B 是否仍可选。
91
91
 
92
+ ## 知识库版本自检(sessionStart 自动触发;每日首次,仅 updateCheck.enabled=true 时)
93
+
94
+ Cursor 由 `flow2spec init cursor` 写入 **`.cursor/hooks.json`**,在 `sessionStart` 自动执行 `node .cursor/hooks/f2s-update-check.js`;脚本通过 `additional_context` 把升级提示注入会话。Codex 由 `flow2spec init codex` 写入 **`.codex/hooks.json`**,在 `SessionStart` 的 `startup|resume` 事件自动执行 `node .codex/hooks/f2s-update-check.js`。
95
+
96
+ **规则层双保险**(与脚本缓存互为备份):
97
+
98
+ 1. 读 `flow2spec.config.json` → 若 `updateCheck.enabled` 不为 `true`,跳过,不做任何提示。
99
+ 2. 读 `.Knowledge/update-check.json` → 若文件存在且 `checkedAt` 与今日为同一自然日(`new Date(checkedAt).toDateString() === new Date().toDateString()`),**跳过,不执行脚本,不做任何提示**。
100
+ 3. 上述两步均未跳过时:执行当前 agent 配置根下的更新检测脚本(Cursor:`node .cursor/hooks/f2s-update-check.js`;Codex:`node .codex/hooks/f2s-update-check.js`),解析标准输出的 JSON:
101
+ - 若含 `hookSpecificOutput.additionalContext`:**告知用户**该内容(建议执行 `/f2s-kb-upgrade`)。
102
+ - 无输出或解析失败:静默,不提示。
103
+ 4. 以上步骤出现任何错误,静默跳过,不影响正常对话。
104
+
92
105
  ## 主题创作(Topic Authoring)指针
93
106
 
94
107
  新增或修改 `.Knowledge/topics/<topic>.md`、调整 `manifest-routing.topicDependencies`、删除 / 迁移 topic 时,**创作侧** 准则以 **`rules/f2s-topic-authoring.*`** 为单一事实源(**Cursor/Claude**:`rules/f2s-topic-authoring.mdc`;**Codex**:`.codex/topics/f2s-topic-authoring.md`)。本入口为**消费侧**(如何按已有 topic 路由 / 读取 / 兜底),与之并存;硬冲突时以本入口为准。`f2s-kb-build` / `f2s-kb-add` / `f2s-kb-feat` / `f2s-kb-fix` / `f2s-kb-sync` / `f2s-kb-migrate` / `f2s-kb-rm` 在涉及 topic 落盘前须 Read 该条全文。
@@ -1,9 +1,9 @@
1
1
  ---
2
2
  name: f2s-git-commit
3
- description: 代码写完后提交 Git:检查变更与知识库覆盖;生成带 emoji 首行的提交说明后**可直接 commit**(须在当条回复展示首行,不要求用户单独确认 commit);**git pull 类拉取须用户先确认**。触发:f2s-git-commit、提交代码、git commit、帮我提交
3
+ description: 代码写完后提交 Git:默认检查变更与知识库覆盖;用户明确要求“快捷提交”时跳过知识库覆盖检查;生成带 emoji 首行的提交说明后**可直接 commit**(须在当条回复展示首行,不要求用户单独确认 commit);**git pull 类拉取须用户先确认**。触发:f2s-git-commit、提交代码、快捷提交、git commit、帮我提交
4
4
  ---
5
5
 
6
- > 执行口径:本技能代用户执行 git 操作;不使用 `git add -A` / `git add .`,不跳过 hooks(`--no-verify`),不自动 push。**`git pull` / `git fetch` 合并入本地前必须取得用户对「拉取」的明确确认**;`git commit` 不要求单独一轮「确认」交互(见步骤 3–4)。
6
+ > 执行口径:本技能代用户执行 git 操作;不使用 `git add -A` / `git add .`,不跳过 hooks(`--no-verify`),不自动 push。**`git pull` / `git fetch` 合并入本地前必须取得用户对「拉取」的明确确认**;`git commit` 不要求单独一轮「确认」交互(见步骤 3–4)。用户明确要求“快捷提交”时,仅跳过步骤 2 知识库覆盖检查,其余安全步骤照常执行。
7
7
 
8
8
  ## 编排(主 / 子 agent)
9
9
 
@@ -14,6 +14,17 @@ description: 代码写完后提交 Git:检查变更与知识库覆盖;生成
14
14
 
15
15
  ## 强制流程
16
16
 
17
+ ### 快捷提交模式
18
+
19
+ 当用户本轮明确说出 **“快捷提交”**、**“快速提交”** 或 **“quick commit”** 时,进入快捷提交模式:
20
+
21
+ - 跳过 **步骤 2:知识库覆盖检查**,不读取 `.Knowledge/topics/` / `.Knowledge/stock-docs/` 做覆盖判断。
22
+ - 不提示用户先运行 `f2s-kb-sync` / `f2s-kb-feat`。
23
+ - **不跳过**步骤 1 的变更读取与冲突标记检查。
24
+ - **不跳过**步骤 3 的提交信息生成与展示。
25
+ - **不跳过**步骤 4 的精确 `git add <文件列表>`、正常 `git commit` 与 git hooks。
26
+ - **不得**因快捷提交使用 `git add -A` / `git add .` / `--no-verify` / 自动 push。
27
+
17
28
  ### 步骤 1:读取变更(只读)
18
29
 
19
30
  ```bash
@@ -38,7 +49,9 @@ git diff HEAD
38
49
  请先解决冲突后再提交。
39
50
  ```
40
51
 
41
- ### 步骤 2:知识库覆盖检查(必须)
52
+ ### 步骤 2:知识库覆盖检查(默认必须;快捷提交跳过)
53
+
54
+ 若处于**快捷提交模式**,本步骤直接跳过,并在步骤 5 收尾提示中说明“已按快捷提交跳过知识库覆盖检查”。
42
55
 
43
56
  **先判断 `.Knowledge/` 是否存在:**
44
57
 
@@ -160,6 +173,9 @@ git commit -m "<步骤 3 定稿的完整提交信息>"
160
173
 
161
174
  [若跳过了步骤 2(.Knowledge 不存在)]
162
175
  💡 项目尚未初始化 Flow2Spec 知识库,如需接入可运行:flow2spec init
176
+
177
+ [若快捷提交跳过了步骤 2]
178
+ ⚡ 已按快捷提交跳过知识库覆盖检查。
163
179
  ```
164
180
 
165
181
  ## 约束
@@ -168,7 +184,7 @@ git commit -m "<步骤 3 定稿的完整提交信息>"
168
184
  - 禁止 `--no-verify`,hook 失败须修复后重试。
169
185
  - 禁止 `--amend` 已推送的 commit,除非用户明确要求。
170
186
  - 禁止自动 push,commit 完成后停止。
171
- - 知识库未覆盖时必须提示,但最终是否补录由用户决定(选 B 不阻塞)。
187
+ - 默认模式下知识库未覆盖时必须提示,但最终是否补录由用户决定(选 B 不阻塞);快捷提交模式下跳过知识库覆盖检查,不提示补录选项。
172
188
  - **`git pull` / `git pull --rebase` / 会改写当前分支工作区内容的 `git fetch` 后续合并操作**:**必须**先向用户说明目的与风险,**取得用户对「拉取」的明确确认**(如用户回复「确认 pull」)后再执行;**禁止**为 commit 而顺带静默 pull。
173
189
  - **`git commit`**:**不要求**用户单独回复「确认」;但**禁止完全不展示**拟提交首行就执行 commit(须在当条回复中可见首行后再执行)。
174
190
  - 提交信息**首行**须符合步骤 3 的 **emoji + type** 格式(用户已合规给出时可保留)。
@@ -179,7 +195,7 @@ git commit -m "<步骤 3 定稿的完整提交信息>"
179
195
  1. 步骤 1 是否检查了 merge conflict(必须为是)。
180
196
  2. 是否区分了 staged / unstaged / untracked 三类文件(必须为是)。
181
197
  3. 是否用了 `git add -A` / `git add .`(必须为否)。
182
- 4. 知识库检查是否执行或有明确跳过理由(必须为是)。
198
+ 4. 知识库检查是否执行或有明确跳过理由(快捷提交 / `.Knowledge` 不存在)(必须为是)。
183
199
  5. 步骤 3 是否基于 `git diff` 实际内容生成提交信息(必须为是,而非仅 `--stat`)。
184
200
  6. 执行 commit 前是否在当条回复中**展示了拟提交首行**(必须为是);**不得**要求用户单独「确认 commit」才执行(与策略一致)。
185
201
  7. 提交信息**首行**是否为 `<emoji> <type>[(scope)]: <简述>` 且 emoji 与 type 与上表一致(合并 revert 等例外须在展示中说明)。