@ngockhoale/ckit 0.4.4 → 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.
@@ -214,15 +214,19 @@ const HOW_TO_HEAD = String.raw `(?<![\p{L}])(?:how (?:to|do (?:i|we|you)|should
214
214
  const HOW_TO_RE = new RegExp(String.raw `${HOW_TO_HEAD}[^\n]*?(?=$|\n|[,;!?]|\.(?=\s|$)| (?:rồi|then|and|also|please|sau đó|và|với|plus)(?![\p{L}]))`, 'gimu'); // the clause ends at a conjunction, , ; ! ? or a sentence-ending dot (not the dot in src/config.ts)
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
- 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}])|no (?:code |file )?changes(?![\p{L}])|không (?:được )?(?:sửa|thay đổi|chỉnh sửa))(?![^.;\n]{0,40}?(?<![\p{L}])(?:outside|except|other than|besides|beyond|apart from|else|in production|ngoài|trừ)(?![\p{L}]))/iu; // a whole no-write order; a scoped one ("except docs/", "ngoài docs/") is not
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;
220
+ /** "In your reply, add a summary": shapes the answer, never the workspace. */
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;
218
222
  /** PF-MODES: the owner asked for a read-only result (question, analysis, review) - no team may change files.
219
223
  * The scope phrase must open the goal (first 25 chars) and the rest of the goal (after removing the scope phrases and [bracket tags]) must not ask for a change. */
220
224
  export const isReadOnlyGoal = (goal) => {
221
225
  const g = goal.replace(/\[[^\]]*\]/g, ' ').replace(/[^\S\n]+/g, ' ').trim(), first = [...g.matchAll(READ_ONLY_RE)][0], nw = NO_WRITE_RE.exec(g);
222
- const asks = (t, how = HOW_TO_RE) => CHANGE_RE.test(t.replace(READ_ONLY_RE, ' ').replace(how, ' '));
226
+ const asks = (t, how = HOW_TO_RE) => CHANGE_RE.test(t.replace(READ_ONLY_RE, ' ').replace(REPLY_RE, ' ').replace(how, ' '));
223
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
224
- if (nw && !asks(g.slice(0, nw.index), HOW_TO_SENT_RE))
225
- 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
226
230
  if (!first || (first.index ?? 0) > 25)
227
231
  return false;
228
232
  return !asks(g);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ckit",
3
- "version": "0.4.4",
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": {