@ngockhoale/ckit 0.4.3 → 0.4.5
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/dist/src/team/engine.js +11 -5
- package/package.json +1 -1
package/dist/src/team/engine.js
CHANGED
|
@@ -211,17 +211,23 @@ 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}[
|
|
215
|
-
const
|
|
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)(
|
|
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
|
+
/** "In your reply, add a summary": shapes the answer, never the workspace. */
|
|
219
|
+
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
220
|
/** PF-MODES: the owner asked for a read-only result (question, analysis, review) - no team may change files.
|
|
219
221
|
* 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
222
|
export const isReadOnlyGoal = (goal) => {
|
|
221
|
-
const g = goal.replace(/\[[^\]]*\]/g, ' ').replace(/[^\S\n]+/g, ' ').trim(), first = [...g.matchAll(READ_ONLY_RE)][0];
|
|
223
|
+
const g = goal.replace(/\[[^\]]*\]/g, ' ').replace(/[^\S\n]+/g, ' ').trim(), first = [...g.matchAll(READ_ONLY_RE)][0], nw = NO_WRITE_RE.exec(g);
|
|
224
|
+
const asks = (t, how = HOW_TO_RE) => CHANGE_RE.test(t.replace(READ_ONLY_RE, ' ').replace(REPLY_RE, ' ').replace(how, ' '));
|
|
225
|
+
// 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;
|
|
222
228
|
if (!first || (first.index ?? 0) > 25)
|
|
223
229
|
return false;
|
|
224
|
-
return !
|
|
230
|
+
return !asks(g);
|
|
225
231
|
};
|
|
226
232
|
/** The Director's "TEAMS: a, b" line: the configured teams it activates (lowercased ids), or null when absent. */
|
|
227
233
|
export function parseTeams(text) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngockhoale/ckit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
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": {
|