@ngockhoale/ckit 0.4.3 → 0.4.4

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.
@@ -211,17 +211,21 @@ const READ_ONLY_RE = /(?<![\p{L}])read[ -]?only(?![\p{L}])|(?<![\p{L}])(?:review
211
211
  const CHANGE_RE = /(?<![\p{L}])(?:fix|implement|add|change|modify|edit|update|create|write|refactor|rename|delete|remove|build|patch|apply|install|sửa|thêm|đổi|thay đổi|tạo|xóa|xoá|viết|cài)(?![\p{L}])/iu;
212
212
  /** "how to fix", "cách sửa", "làm sao để thêm": a change that is described or explained, not requested. */
213
213
  const HOW_TO_HEAD = String.raw `(?<![\p{L}])(?:how (?:to|do (?:i|we|you)|should (?:i|we)|would (?:i|we|you)|can (?:i|we))|cách(?: để)?|làm (?:sao|thế nào)(?: để)?|tại sao phải|why (?:to|should (?:i|we))) `;
214
- const HOW_TO_RE = new RegExp(String.raw `${HOW_TO_HEAD}[^.,;!?\n]*?(?=$|[.,;!?\n]| (?:rồi|then|and|also|sau đó|và|với|plus)(?![\p{L}]))`, 'gimu'); // the clause ends at punctuation or a conjunction
215
- const HOW_TO_FULL_RE = new RegExp(String.raw `${HOW_TO_HEAD}[^.,;!?\n]*`, 'gimu'); // with an explicit no-write directive: the clause runs to punctuation
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
+ 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)(?![\p{L}])[^.\n]{0,20}(?<![\p{L}])(?:files?|code|anything|the repo|the project)(?![\p{L}])|(?<![\p{L}])no (?:code |file )?changes(?![\p{L}])|không (?:được )?(?:sửa|thay đổi|chỉnh sửa)/iu;
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
218
218
  /** PF-MODES: the owner asked for a read-only result (question, analysis, review) - no team may change files.
219
219
  * 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
220
  export const isReadOnlyGoal = (goal) => {
221
- const g = goal.replace(/\[[^\]]*\]/g, ' ').replace(/[^\S\n]+/g, ' ').trim(), first = [...g.matchAll(READ_ONLY_RE)][0];
221
+ 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, ' '));
223
+ // 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;
222
226
  if (!first || (first.index ?? 0) > 25)
223
227
  return false;
224
- return !CHANGE_RE.test(g.replace(READ_ONLY_RE, ' ').replace(NO_WRITE_RE.test(g) ? HOW_TO_FULL_RE : HOW_TO_RE, ' '));
228
+ return !asks(g);
225
229
  };
226
230
  /** The Director's "TEAMS: a, b" line: the configured teams it activates (lowercased ids), or null when absent. */
227
231
  export function parseTeams(text) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngockhoale/ckit",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
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": {