@ngockhoale/ckit 0.4.5 → 0.4.6

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.
@@ -215,6 +215,8 @@ const HOW_TO_RE = new RegExp(String.raw `${HOW_TO_HEAD}[^\n]*?(?=$|\n|[,;!?]|\.(
215
215
  const HOW_TO_SENT_RE = new RegExp(String.raw `${HOW_TO_HEAD}[^\n]*?(?=$|\n|[;!?]|\.(?=\s|$))`, 'gimu'); // before an explicit no-write order: the explained clause runs to its sentence end
216
216
  /** The owner forbade writing in so many words (not only a "read-only" label): "do not change any files", "no code changes", "không sửa". */
217
217
  const NO_WRITE_RE = /(?<![\p{L}])(?:(?:do not|don't|dont|never|without) (?:change|changing|modify|modifying|edit|editing|touch|touching|write|writing) (?:(?:any(?: of the)?|the|a single) )?(?:files?|code|anything|the repo|the project|the codebase)(?![\p{L}])(?!,? (?:except|outside|other than|besides|beyond|apart from|in production|else)(?![\p{L}]))|no (?:code |file )?changes(?![\p{L}])(?!,? (?:except|outside|other than|besides|beyond|apart from|in production|else)(?![\p{L}]))|không (?:được )?(?:sửa|thay đổi|chỉnh sửa)(?: (?:file|code|gì))?(?![\p{L}])(?!,? (?:file |code )?(?:ngoài|trừ)(?![\p{L}])))/iu; // a whole no-write order; one whose object is directly limited ("files outside docs/", "file ngoài docs/") is a scope, not read-only
218
+ /** The owner takes back what came before: "Correction:", "actually", "instead", "đính chính", "à không". */
219
+ const CORRECTION_RE = /(?<![\p{L}])(?:correction|actually|instead|on second thought|scratch that|forget that|change of plan|đính chính|à không|thay vào đó|thôi)(?![\p{L}])[^.;!?\n]{0,20}$/iu;
218
220
  /** "In your reply, add a summary": shapes the answer, never the workspace. */
219
221
  const REPLY_RE = /(?<![\p{L}])(?:in|to|into) (?:your|the) (?:reply|answer|response|report|summary|explanation|câu trả lời)(?![\p{L}])[^.;!?\n]*|(?<![\p{L}])(?:trong|vào) (?:câu trả lời|báo cáo|phần trả lời)[^.;!?\n]*/giu;
220
222
  /** PF-MODES: the owner asked for a read-only result (question, analysis, review) - no team may change files.
@@ -223,8 +225,8 @@ export const isReadOnlyGoal = (goal) => {
223
225
  const g = goal.replace(/\[[^\]]*\]/g, ' ').replace(/[^\S\n]+/g, ' ').trim(), first = [...g.matchAll(READ_ONLY_RE)][0], nw = NO_WRITE_RE.exec(g);
224
226
  const asks = (t, how = HOW_TO_RE) => CHANGE_RE.test(t.replace(READ_ONLY_RE, ' ').replace(REPLY_RE, ' ').replace(how, ' '));
225
227
  // an explicit whole no-write order (anywhere) wins when nothing before it asks for a change: the rest is to be explained, never done
226
- if (nw && !asks(g.slice(0, nw.index), HOW_TO_SENT_RE))
227
- return true;
228
+ if (nw && (!asks(g.slice(0, nw.index), HOW_TO_SENT_RE) || CORRECTION_RE.test(g.slice(Math.max(0, nw.index - 40), nw.index))))
229
+ return true; // a correction ("Correction: do not change any files") overrides the earlier write request
228
230
  if (!first || (first.index ?? 0) > 25)
229
231
  return false;
230
232
  return !asks(g);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ckit",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "CKit — local Agent Company: a Director plus BA / Implement / QC teams running your own codex, claude and omp CLIs, with a web Mission Control (ckit gui).",
5
5
  "type": "module",
6
6
  "bin": {