orkeon-code 1.0.0-rc.2 → 1.0.0-rc.3

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.
Files changed (46) hide show
  1. package/.orkeon-runtime +3 -2
  2. package/.orkeon-version +1 -1
  3. package/README.fr.md +1 -1
  4. package/README.md +1 -1
  5. package/orkeon-code +307 -74
  6. package/orkeon-code.ps1 +20 -4
  7. package/package.json +2 -1
  8. package/scripts/dev-run.sh +139 -0
  9. package/src/commands/_lib/status/messages.ts +2 -1
  10. package/src/commands/_lib/status/meta.ts +5 -4
  11. package/src/crews/.orkeon/orkeon.d.ts +1 -1
  12. package/src/crews/_probe-shared-memory/probe.ork.ts +3 -3
  13. package/src/crews/advisor/crew.ork.ts +1 -1
  14. package/src/crews/agent-run/crew.ork.ts +1 -1
  15. package/src/crews/code-review/crew.ork.ts +1 -1
  16. package/src/crews/dev-batches/crew.ork.ts +1 -1
  17. package/src/crews/dev-change/domain/change-render.ts +1 -1
  18. package/src/crews/dev-learn/application/messages.ts +5 -0
  19. package/src/crews/dev-learn/application/prompts.ts +13 -16
  20. package/src/crews/dev-learn/application/run-dev-learn.ts +15 -12
  21. package/src/crews/dev-learn/crew.ork.ts +1 -1
  22. package/src/crews/dev-learn/domain/learn-answer.ts +38 -13
  23. package/src/crews/dev-learn/domain/markers.ts +10 -0
  24. package/src/crews/dev-learn/domain/messages.ts +13 -4
  25. package/src/crews/dev-plan/crew.ork.ts +1 -1
  26. package/src/crews/dev-plan/domain/plan-render.ts +3 -3
  27. package/src/crews/dev-spec/domain/spec-render.ts +3 -3
  28. package/src/crews/dev-verify/crew.ork.ts +1 -1
  29. package/src/crews/git-commit/application/draft.ts +22 -18
  30. package/src/crews/git-commit/application/messages.ts +2 -0
  31. package/src/crews/git-commit/application/run-git-commit.ts +4 -2
  32. package/src/crews/git-commit/crew.ork.ts +1 -1
  33. package/src/crews/init-verifiers/crew.ork.ts +1 -1
  34. package/src/crews/main-loop/application/run-main-loop.ts +1 -1
  35. package/src/crews/project-init/crew.ork.ts +1 -1
  36. package/src/crews/session-compact/crew.ork.ts +1 -1
  37. package/src/crews/shared-memory-admit/crew.ork.ts +1 -1
  38. package/src/shared/application/dev/messages.ts +3 -0
  39. package/src/shared/application/dev/preflight.ts +9 -4
  40. package/src/shared/domain/dev/learn-proposals.ts +48 -10
  41. package/src/shared/domain/dev/markers.ts +20 -0
  42. package/src/shared/domain/dev/messages.ts +12 -0
  43. package/src/shared/domain/dev/plan-format.ts +1 -1
  44. package/src/shared/domain/dev/work-folder.ts +2 -1
  45. package/src/shared/domain/git/close.ts +10 -8
  46. package/src/shared/domain/git/messages.ts +21 -0
@@ -15,7 +15,7 @@
15
15
  // Input (globalThis.inputs): { batch: "F<n>", plan?: string | null, mode?: "fast" | "full" | "resume", gateOnly?: boolean,
16
16
  // hooks?: the /hooks registry, effort?: "low" | "medium" | "high" | "xhigh" | "max" | null,
17
17
  // concurrency?: number, maxInstances?: number, memoryRecall?: false (a session rule denies it) }
18
- // Run standalone: bash scripts/run-crew.sh src/crews/dev-verify/crew.ork.ts --inputs '{"batch":"F1","gateOnly":true}'
18
+ // Run standalone: ./orkeon-code run dev-verify --inputs '{"batch":"F1","gateOnly":true}'
19
19
  //
20
20
  // Budget: under full, the build (900 s), the whole suite (900 s) and three validations
21
21
  // (300 s each) can all run, plus the model's own time: one hour of wall time.
@@ -5,7 +5,7 @@ import type { CrewMemory, Files, Llm, Shell } from "../../../shared/application/
5
5
  import type { PromptPair } from "../../../shared/domain/types.ts";
6
6
  import { normalizeCommitMessage, commitSubject, isCommitPermitted, untrackedPaths } from "../domain/commit.ts";
7
7
  import { GIT_STATUS_COMMAND, changedPaths, gitDiffCommand } from "../../../shared/domain/git/close.ts";
8
- import { commitFiles } from "../../../shared/application/git/commit-files.ts";
8
+ import { commitFiles, gitReason, runGit } from "../../../shared/application/git/commit-files.ts";
9
9
  import { WORKSPACE } from "../../../shared/domain/vfs.ts";
10
10
  import { committed } from "./messages.ts";
11
11
  import { refusedLine as refused } from "../../../shared/application/git/messages.ts";
@@ -25,9 +25,15 @@ export interface WorkTree {
25
25
  note?: string;
26
26
  }
27
27
 
28
+ /** The working tree's status, or why git could not give it: a failed `git status` (no git where the
29
+ * crew runs, no repository) writes nothing on stdout, which must not read as a clean tree. */
30
+ export type StatusRead = { ok: true; status: string } | { ok: false; reason: string };
31
+
28
32
  /** The working tree's status, as the selection of the commit's files reads it. */
29
- export async function readStatus(shell: Shell): Promise<string> {
30
- return (await shell.run(GIT_STATUS_COMMAND)).stdout;
33
+ export async function readStatus(shell: Shell): Promise<StatusRead> {
34
+ const r = await runGit(shell, GIT_STATUS_COMMAND);
35
+ // A timeout or a denial of the runtime ends with exit -1, git's reason on stderr (`[Command timed out]`).
36
+ return r.exitCode !== 0 ? { ok: false, reason: gitReason(r) } : { ok: true, status: r.stdout };
31
37
  }
32
38
 
33
39
  /** The lines of `status` that name one of `files` (either side of a rename). */
@@ -47,29 +53,27 @@ function cut(text: string, max: number, what: string): string {
47
53
  }
48
54
 
49
55
  /**
50
- * Snapshot the working tree (mode B — shell, and the files for the new ones).
51
- * With a `scope`, the snapshot shows the selected files alone: their status lines
52
- * and their diff, which is what the commit will hold, and carries the author's note
53
- * when it holds a non-blank one.
56
+ * Snapshot the working tree (mode B — shell, and the files for the new ones) for the
57
+ * selected files alone: their lines of the status readStatus gave, and their diff,
58
+ * which is what the commit will hold, with the author's note when it holds a
59
+ * non-blank one. The status is never read here again.
54
60
  */
55
61
  export async function inspectWorkTree(
56
62
  shell: Shell,
57
- files?: Pick<Files, "read">,
58
- scope?: { status: string; files: readonly string[]; note?: string },
63
+ files: Pick<Files, "read">,
64
+ scope: { status: string; files: readonly string[]; note?: string },
59
65
  ): Promise<WorkTree> {
60
- const status = scope ? statusOf(scope.status, scope.files) : await readStatus(shell);
61
- const diff = (await shell.run(scope ? gitDiffCommand(scope.files) : "git diff HEAD")).stdout;
66
+ const status = statusOf(scope.status, scope.files);
67
+ const diff = (await shell.run(gitDiffCommand(scope.files))).stdout;
62
68
  const branch = (await shell.run("git branch --show-current")).stdout.trim();
63
69
  const recent = (await shell.run("git log --oneline -10")).stdout;
64
70
  const untracked: WorkTree["untracked"] = [];
65
- if (files) {
66
- for (const path of untrackedPaths(status).slice(0, MAX_NEW_FILES)) {
67
- try {
68
- untracked.push({ path, content: await files.read(`${WORKSPACE}/${path}`, MAX_NEW_FILE_CHARS + 1) });
69
- } catch { /* unreadable (binary, gone): the status still names it */ }
70
- }
71
+ for (const path of untrackedPaths(status).slice(0, MAX_NEW_FILES)) {
72
+ try {
73
+ untracked.push({ path, content: await files.read(`${WORKSPACE}/${path}`, MAX_NEW_FILE_CHARS + 1) });
74
+ } catch { /* unreadable (binary, gone): the status still names it */ }
71
75
  }
72
- const note = (scope?.note ?? "").trim();
76
+ const note = (scope.note ?? "").trim();
73
77
  return { status, diff, branch, recent, untracked, ...(note.length > 0 ? { note } : {}) };
74
78
  }
75
79
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  export const commitRefusedLog = (reason: string): string => `git-commit refused: ${reason}`;
4
4
  export const NOTHING_TO_COMMIT_CLEAN_TREE = "Nothing to commit — working tree clean.";
5
+ export const statusUnreadable = (reason: string): string =>
6
+ `✗ the working tree could not be read, nothing was committed: git status failed: ${reason}`;
5
7
  export const noChangeUnder = (paths: string): string => `no change under ${paths}`;
6
8
  export const notThroughShell = (paths: string): string => `${paths} cannot go through the shell (commit by hand)`;
7
9
  export const workFolderLeftOut = (count: number, folder: string): string =>
@@ -17,7 +17,7 @@ import { inspectWorkTree, draftCommitMessage, commitSelected, readStatus } from
17
17
  import {
18
18
  commitRefusal, commitSubject, inputFlag, isCommitPermitted, namedPaths, secretLikePaths,
19
19
  } from "../domain/commit.ts";
20
- import { commitRefusedLog, draftFlagged, noChangeUnder, NOTHING_OUTSIDE_WORK_FOLDER, NOTHING_TO_COMMIT_CLEAN_TREE, notThroughShell, secretRefused, workFolderLeftOut } from "./messages.ts";
20
+ import { commitRefusedLog, draftFlagged, noChangeUnder, NOTHING_OUTSIDE_WORK_FOLDER, NOTHING_TO_COMMIT_CLEAN_TREE, notThroughShell, secretRefused, statusUnreadable, workFolderLeftOut } from "./messages.ts";
21
21
  import { pushedToOrigin as pushedLine, refusedLine as refused } from "../../../shared/application/git/messages.ts";
22
22
 
23
23
  export interface GitCommitDeps {
@@ -52,7 +52,9 @@ export async function runGitCommit(input: Record<string, unknown>, deps: GitComm
52
52
  return refused(permitted.reason);
53
53
  }
54
54
 
55
- const status = await readStatus(shell);
55
+ const read = await readStatus(shell);
56
+ if (!read.ok) return statusUnreadable(read.reason);
57
+ const status = read.status;
56
58
  if (status.trim().length === 0) {
57
59
  return NOTHING_TO_COMMIT_CLEAN_TREE;
58
60
  }
@@ -4,7 +4,7 @@
4
4
  // GitCommit crew (/commit) — exp 07 SPEC §4.3. Composition root of
5
5
  // application/run-git-commit: it wires the ports and delegates the whole flow.
6
6
  //
7
- // Run standalone: bash scripts/run-crew.sh src/crews/git-commit/crew.ork.ts
7
+ // Run standalone: ./orkeon-code run git-commit
8
8
  // Via REPL: /commit → script-host.runCrewAsync("git-commit", {})
9
9
  //
10
10
  // Input (threaded by /commit, commands/_lib/git/commit.ts):
@@ -7,7 +7,7 @@
7
7
  // No tools: the body reads through the Files port and calls extract and complete,
8
8
  // which take none.
9
9
  //
10
- // Run standalone: bash scripts/run-crew.sh src/crews/init-verifiers/crew.ork.ts
10
+ // Run standalone: ./orkeon-code run init-verifiers
11
11
 
12
12
  import { CrewBuilder, publishCrew } from "../../shared/infrastructure/globals.ts";
13
13
  import { orkeonAgent, orkeonFiles } from "../../shared/infrastructure/orkeon/wiring.ts";
@@ -94,7 +94,7 @@ export interface LoadedCatalogue {
94
94
  * The catalogue, decided at load time — module scope is synchronous — from the
95
95
  * inputs alone: the launching command resolved the mode (the session's too) and
96
96
  * the extra tools before the crew loads, so the catalogue, the act call and the
97
- * host gate all run in the same mode. Launched without a mode (scripts/run-crew.sh),
97
+ * host gate all run in the same mode. Launched without a mode (orkeon-code run),
98
98
  * the turn runs in `default`. That run is headless: no operator to ask and no
99
99
  * session rules, so a gate turned on (the example settings do) REFUSES each call
100
100
  * the mode would ask about — every write, every command, every network read — and
@@ -4,7 +4,7 @@
4
4
  // ProjectInit crew (/init) — exp 07 SPEC §4.1. Composition root of application/run-project-init.
5
5
  // Scans the workspace, detects build/test/lint conventions, writes AGENTS.md.
6
6
  //
7
- // Run standalone: bash scripts/run-crew.sh src/crews/project-init/crew.ork.ts
7
+ // Run standalone: ./orkeon-code run project-init
8
8
 
9
9
  import { CrewBuilder, publishCrew } from "../../shared/infrastructure/globals.ts";
10
10
  import { orkeonAgent, orkeonCodeIndex, orkeonFiles } from "../../shared/infrastructure/orkeon/wiring.ts";
@@ -9,7 +9,7 @@
9
9
  // writes the state file of the dev batch in progress (.orkeon/dev/<code>/
10
10
  // state-F<n>.md) when a step command named one (session state workflow_active).
11
11
  //
12
- // Run standalone: bash scripts/run-crew.sh src/crews/session-compact/crew.ork.ts
12
+ // Run standalone: ./orkeon-code run session-compact
13
13
 
14
14
  import { CrewBuilder, inputs, publishCrew } from "../../shared/infrastructure/globals.ts";
15
15
  import {
@@ -8,7 +8,7 @@
8
8
  //
9
9
  // Input (globalThis.inputs): { admit: { id, sha1 }[] } — the candidates the command confirmed, with the sha1 of the
10
10
  // file text shown: a file changed since is not admitted.
11
- // Run standalone: bash scripts/run-crew.sh src/crews/shared-memory-admit/crew.ork.ts --inputs '{"admit":[{"id":"<id>","sha1":"<sha1 of its file>"}]}'
11
+ // Run standalone: ./orkeon-code run shared-memory-admit --inputs '{"admit":[{"id":"<id>","sha1":"<sha1 of its file>"}]}'
12
12
  //
13
13
  // No tool callbacks: the admitter has no tool and makes no model call, so there is no tool call to guard.
14
14
 
@@ -72,6 +72,9 @@ export const identityOk = (name: string, email: string): string => `preflight
72
72
  export const BRANCH_NONE = "branch: none checked out (a detached HEAD?): check out the work branch";
73
73
  export const changesOutsideWorkFolder = (count: number, paths: string): string =>
74
74
  `preflight ⚠ tree: ${count} change(s) outside the work folder (${paths}): a close commits only its batch's files`;
75
+ /** A status git could not give: the tree is not known clean, and each batch's close will stop on the same failure. */
76
+ export const treeStatusFailed = (reason: string): string =>
77
+ `preflight ⚠ tree: git status failed: ${reason} (a batch's close stops while git cannot read the tree)`;
75
78
 
76
79
  // question-round.ts, settle-questions.ts
77
80
  export const REWRITE_REFUSED = "the rewrite was refused";
@@ -2,11 +2,14 @@
2
2
  // without format problems, a sheet for every batch not done, an order the dependencies allow, git's
3
3
  // identity (each batch's close commits) and a current branch. A ✗ stops the run before any launch; a
4
4
  // tree changed outside the work folder and `.orkeon/` is a ⚠ only (a close commits the files its batch
5
- // touched, by name). The plan's facts come read; git is asked here.
5
+ // touched, by name), and so is a status git could not give, never read as a clean tree. The plan's facts
6
+ // come read; git is asked here.
6
7
  import type { Shell } from "../ports.ts";
7
- import { readIdentity, runGit } from "../git/commit-files.ts";
8
+ import { gitReason, readIdentity, runGit } from "../git/commit-files.ts";
8
9
  import { GIT_CURRENT_BRANCH_COMMAND, GIT_STATUS_COMMAND, changedPaths } from "../../domain/git/close.ts";
9
- import { BRANCH_NONE, PLAN_NONE, SHEETS_OK, changesOutsideWorkFolder, identityMissing, identityOk, noSheetFor } from "./messages.ts";
10
+ import {
11
+ BRANCH_NONE, PLAN_NONE, SHEETS_OK, changesOutsideWorkFolder, identityMissing, identityOk, noSheetFor, treeStatusFailed,
12
+ } from "./messages.ts";
10
13
 
11
14
  export interface PreflightInput {
12
15
  /** The plan as the user reads it, `workbench/demo/DEMO-PLAN.md`; null when the code has none. */
@@ -59,7 +62,9 @@ export async function preflight(deps: { shell: Pick<Shell, "run"> }, input: Pref
59
62
  else lines.push(`preflight ✓ branch: ${name}`);
60
63
 
61
64
  const status = await runGit(deps.shell, GIT_STATUS_COMMAND);
62
- if (status.exitCode === 0) {
65
+ if (status.exitCode !== 0) {
66
+ lines.push(treeStatusFailed(gitReason(status)));
67
+ } else {
63
68
  const work = input.workFolder.replace(/\/+$/, "");
64
69
  const own = (p: string): boolean => p === work || p.startsWith(`${work}/`) || p.startsWith(".orkeon/");
65
70
  const others = changedPaths(status.stdout).filter((p) => !own(p));
@@ -2,7 +2,11 @@
2
2
  // `<work>/learn-<date>/proposals.json` for --accept and --refuse to read, and the lines
3
3
  // those print. A decision applies nothing: it prints the change to make. Pure, no IO.
4
4
  import { sha1Hex } from "../sha1.ts";
5
- import { acceptedHarness, acceptedRepository, hasTheWrongShape, THE_TOP_LEVEL } from "./messages.ts";
5
+ import { ORKEON_CODE_DESTINATIONS } from "./markers.ts";
6
+ import {
7
+ acceptedHarness, acceptedNotAHarnessRule, acceptedNotAnOrkeonCodeChange, acceptedOrkeonCode, acceptedRepository,
8
+ hasTheWrongShape, THE_TOP_LEVEL,
9
+ } from "./messages.ts";
6
10
 
7
11
  export const LEARN_FOLDER_PATTERN: RegExp = /^learn-\d{4}-\d{2}-\d{2}$/;
8
12
  export function learnFolderName(date: string): string {
@@ -11,7 +15,7 @@ export function learnFolderName(date: string): string {
11
15
  export const PROPOSALS_JSON = "proposals.json";
12
16
  export const PROPOSALS_MD = "PROPOSALS.md";
13
17
 
14
- export type OwnerKind = "repository" | "harness";
18
+ export type OwnerKind = "repository" | "orkeon-code" | "harness";
15
19
  export type CheckKind = "test" | "analyzer" | "architecture-test" | "gate" | "rule";
16
20
  /** removes: the motif takes a wrong line out of its owner and adds none. */
17
21
  export type MotifStatus = "new" | "refines" | "replaces" | "removes";
@@ -50,7 +54,7 @@ type Obj = Record<string, unknown>;
50
54
  class Shape extends Error {}
51
55
  const fieldPath = (at: string, key: string): string => (at === "" ? key : `${at}.${key}`);
52
56
 
53
- const OWNER_KINDS: readonly string[] = ["repository", "harness"];
57
+ const OWNER_KINDS: readonly string[] = ["repository", "orkeon-code", "harness"];
54
58
  const CHECK_KINDS: readonly string[] = ["test", "analyzer", "architecture-test", "gate", "rule"];
55
59
  const STATUSES: readonly string[] = ["new", "refines", "replaces", "removes"];
56
60
  const FILTERS: readonly string[] = ["recurrence", "prevention", "novelty"];
@@ -150,13 +154,29 @@ export function serializeProposalsFile(file: ProposalsFile): string {
150
154
 
151
155
  // ---- the lines a decision prints ----
152
156
 
153
- const HARNESS_SOURCE = /^\.devcontainer\/harness\/packs\/[^/]+\/claude\/(.+)$/;
157
+ /** The start of every harness owner's path: a repository pack, in the orkeon-workshop repository. */
158
+ export const HARNESS_REPO_PACKS = ".devcontainer/harness/packs/repo-";
154
159
 
155
- /** The harness owner's file in the orkeon-workshop repository → its deployed copy in the checkout, or null. */
160
+ /** A name of a path segment a rule may carry: non-empty, no edge space, no backslash, not dots alone. */
161
+ function isPlainSegment(segment: string | undefined): segment is string {
162
+ return segment !== undefined && segment !== "" && segment === segment.trim() && !segment.includes("\\")
163
+ && !/^\.+$/.test(segment);
164
+ }
165
+
166
+ /** A harness owner, a rule of a repository pack (`<HARNESS_REPO_PACKS><name>/claude/rules/<file>`, name and file
167
+ * plain segments, no deeper folder) → its deployed copy in the checkout; any other path → null. */
156
168
  export function deployedHarnessPath(path: string): string | null {
157
- const m = HARNESS_SOURCE.exec(path);
158
- if (!m || m[1].split("/").some((s) => s === "" || s === "." || s === "..")) return null;
159
- return `.claude/${m[1]}`;
169
+ if (!path.startsWith(HARNESS_REPO_PACKS)) return null;
170
+ const [name, claude, rules, file, ...deeper] = path.slice(HARNESS_REPO_PACKS.length).split("/");
171
+ if (!isPlainSegment(name) || claude !== "claude" || rules !== "rules" || !isPlainSegment(file) || deeper.length > 0) {
172
+ return null;
173
+ }
174
+ return `.claude/rules/${file}`;
175
+ }
176
+
177
+ /** Whether a harness owner's path is a rule of a repository pack, the only harness file a motif may own. */
178
+ export function isHarnessRule(path: string): boolean {
179
+ return deployedHarnessPath(path) !== null;
160
180
  }
161
181
 
162
182
  export function patchLines(motif: Motif): string[] {
@@ -167,10 +187,28 @@ export function patchLines(motif: Motif): string[] {
167
187
  ];
168
188
  }
169
189
 
170
- /** The lines printed for a motif: the patch for a harness owner, the change to make for a repository owner. */
190
+ /** Whether an Orkeon Code motif keeps to the rules its owner, never read, sets: a listed destination, status new and
191
+ * no line removed. */
192
+ export function isOrkeonCodeChange(motif: Pick<Motif, "owner" | "status" | "linesRemoved">): boolean {
193
+ return ORKEON_CODE_DESTINATIONS.includes(motif.owner.path) && motif.status === "new"
194
+ && motif.linesRemoved.every((l) => l.trim() === "");
195
+ }
196
+
197
+ /** The lines printed for a motif: the patch for an Orkeon Code or a harness owner, the change to make for a
198
+ * repository owner. The owner rules are checked again, since a proposals.json may come from before them or be edited
199
+ * by hand: a harness owner that is no rule of a repository pack, or an Orkeon Code motif off its rules, is said in
200
+ * one line with no patch. */
171
201
  export function acceptLines(motif: Motif): string[] {
202
+ if (motif.owner.kind === "harness" && !isHarnessRule(motif.owner.path)) {
203
+ return [acceptedNotAHarnessRule(motif.id, motif.title, motif.owner.path)];
204
+ }
205
+ if (motif.owner.kind === "orkeon-code" && !isOrkeonCodeChange(motif)) {
206
+ return [acceptedNotAnOrkeonCodeChange(motif.id, motif.title, motif.owner.path)];
207
+ }
172
208
  const head = motif.owner.kind === "harness"
173
209
  ? acceptedHarness(motif.id, motif.title)
174
- : acceptedRepository(motif.id, motif.title, motif.owner.path);
210
+ : motif.owner.kind === "orkeon-code"
211
+ ? acceptedOrkeonCode(motif.id, motif.title)
212
+ : acceptedRepository(motif.id, motif.title, motif.owner.path);
175
213
  return [head, ...patchLines(motif).map((l) => ` ${l}`)];
176
214
  }
@@ -105,3 +105,23 @@ export const OPEN_TDD_LINE = "TDD: RED [ ] GREEN [ ] COST [ ]";
105
105
  export const TEST_POLICY_SECTION = "Test policy and scopes";
106
106
  /** The head of a step's test table, in a sheet and in a correction step. */
107
107
  export const STEP_TESTS_TABLE_HEAD = ["| # | Test | Level | Project | Ids |", "|---|------|-------|---------|-----|"];
108
+
109
+ // ── The owners /dev-learn may name ──────────────────────────────────────────
110
+
111
+ /** The files of Orkeon Code a motif may name, paths in the orkeon-code repository, which the learner's prompt lists
112
+ * and both its answer check and `--accept` read: the behaviour of each crew's prompt (changed first, ADR 0003), the
113
+ * design rules a plan classifies, the writers of the plan's, the spec's and the change brief's format, this file
114
+ * (the patterns and headings by which every reader of those formats reads them back), the gate's mechanical checks,
115
+ * then the charters of the auditor and of the reviewer. Each one is a file of this repository
116
+ * (tests/repository/learn-destinations). */
117
+ export const ORKEON_CODE_DESTINATIONS: readonly string[] = [
118
+ "docs/crew-prompts.md",
119
+ "src/shared/domain/dev/design-rules.ts",
120
+ "src/crews/dev-plan/domain/plan-render.ts",
121
+ "src/crews/dev-spec/domain/spec-render.ts",
122
+ "src/crews/dev-change/domain/change-render.ts",
123
+ "src/shared/domain/dev/markers.ts",
124
+ "src/crews/dev-verify/domain/gate.ts",
125
+ "src/crews/dev-verify/domain/auditor-charter.ts",
126
+ "src/shared/domain/dev/reviewer-charter.ts",
127
+ ];
@@ -224,6 +224,18 @@ export const hasTheWrongShape = (what: string): string => `${what} has the wrong
224
224
  export const fieldHasTheWrongShape = (file: string, field: string): string => `${file}: ${field} has the wrong shape`;
225
225
  export const acceptedHarness = (id: string, title: string): string =>
226
226
  `accepted ${id} — ${title}: a harness file is never edited here; apply this in the orkeon-workshop repository:`;
227
+ export const acceptedOrkeonCode = (id: string, title: string): string =>
228
+ `accepted ${id} — ${title}: an Orkeon Code file is never edited here; apply this in the orkeon-code repository, ` +
229
+ "a document with its French twin under docs/fr/, a prompt's behaviour first (ADR 0003):";
230
+ /** A harness owner that is no rule of a repository pack (one of a proposals.json from before the rule): /dev-learn
231
+ * has no patch for it now, whether the file still exists or not. */
232
+ export const acceptedNotAHarnessRule = (id: string, title: string, path: string): string =>
233
+ `accepted ${id} — ${title}: ${path} is not a rule of a repository pack, the only harness file /dev-learn ` +
234
+ "patches now: no patch to apply; run /dev-learn again for a current owner";
235
+ /** An Orkeon Code owner off its rules (one of a proposals.json from before them, or edited by hand). */
236
+ export const acceptedNotAnOrkeonCodeChange = (id: string, title: string, path: string): string =>
237
+ `accepted ${id} — ${title}: /dev-learn patches ${path} only as a listed Orkeon Code destination, with status new ` +
238
+ "and no line removed, which this motif is not: no patch to apply; run /dev-learn again for a current owner";
227
239
  export const acceptedRepository = (id: string, title: string, path: string): string =>
228
240
  `accepted ${id} — ${title}: ${path} is not edited by /dev-learn; make the change in a batch (/dev-spec <code> refactor, or by hand):`;
229
241
 
@@ -155,7 +155,7 @@ export function parseBatchSheet(text: string): BatchSheet {
155
155
  return sheet;
156
156
  }
157
157
 
158
- /** Behaviour steps = steps with a TDD line (none under "Build and tests", plan-template.md:131). */
158
+ /** Behaviour steps = steps with a TDD line; a step under "Build and tests" carries none, so it never counts. */
159
159
  export function sheetProgress(sheet: BatchSheet): SheetProgress {
160
160
  const p: SheetProgress = { behaviourSteps: 0, red: 0, green: 0, cost: 0, complete: 0 };
161
161
  for (const s of sheet.steps) {
@@ -13,7 +13,8 @@ export type WorkDirCheck = { ok: true; folder: string } | { ok: false; reason: s
13
13
  // Python's str.isprintable() refuses the Other categories and every separator but the space.
14
14
  const NON_PRINTABLE = /[\p{C}\p{Zl}\p{Zp}]|(?! )\p{Zs}/u;
15
15
 
16
- /** Normalised as learn-candidates.py:61-63; folder "" when the value is empty. */
16
+ /** The work folder as a repository pack names it: tabs and line breaks dropped, trimmed, every leading "./" and
17
+ * trailing "/" taken off; folder "" when the value is empty. */
17
18
  export function normalizeWorkDir(raw: string): WorkDirCheck {
18
19
  let w = raw.replace(/[\t\r\n]/g, "").trim();
19
20
  for (;;) {
@@ -2,7 +2,10 @@
2
2
  // explicit list, never the work folder), the command lines that commit, push and
3
3
  // merge them, and the pull request body and command handed over. Pure: nothing
4
4
  // here runs a command; shared/application/git runs these lines through the Shell port.
5
- import { ASSUMPTIONS_HEADING, ASSUMPTIONS_BY_ID_HEAD, FILES_PER_LAYER_HEADING, noIdentityStop } from "./messages.ts";
5
+ import {
6
+ ASSUMPTIONS_HEADING, ASSUMPTIONS_BY_ID_HEAD, FILES_PER_LAYER_HEADING, IDENTITY_ENV_HANDOVER, IDENTITY_ENV_INTRO,
7
+ IDENTITY_HANDOVER, IDENTITY_PS_HANDOVER, IDENTITY_PS_INTRO, noIdentityStop,
8
+ } from "./messages.ts";
6
9
 
7
10
  /** Q-10's switch: `true` asks the close to open the pull request itself. Omitted = false. */
8
11
  export const DEV_PR_AUTO_CONFIG_KEY = "dev.prAuto";
@@ -38,17 +41,16 @@ export function parseGitIdent(stdout: string): GitIdent | null {
38
41
  return { name: m[1].trim(), email: m[2] };
39
42
  }
40
43
 
41
- /** The two commands that give git an identity; the user types them with their own name and email. */
42
- export const IDENTITY_HANDOVER: readonly string[] = [
43
- "git config --global user.name \"<your name>\"",
44
- "git config --global user.email <your email>",
45
- ];
46
-
47
- /** The stop when git has no identity: git's reason, then the two commands, one per line. Never an invented identity. */
44
+ /** The stop when git has no identity: git's reason, the two commands, then the four variables, in a POSIX shell and
45
+ * in PowerShell (the only way where git reads no ~/.gitconfig), one per line. Never an invented identity. */
48
46
  export function identityStop(detail: string, rerun: string): string {
49
47
  return [
50
48
  noIdentityStop(detail, rerun),
51
49
  ...IDENTITY_HANDOVER.map((c) => ` ${c}`),
50
+ IDENTITY_ENV_INTRO,
51
+ ...IDENTITY_ENV_HANDOVER.map((c) => ` ${c}`),
52
+ IDENTITY_PS_INTRO,
53
+ ...IDENTITY_PS_HANDOVER.map((c) => ` ${c}`),
52
54
  ].join("\n");
53
55
  }
54
56
 
@@ -3,6 +3,27 @@
3
3
 
4
4
  export const noIdentityStop = (detail: string, rerun: string): string =>
5
5
  `✗ stopped: git has no identity for the commit (${detail}). Set one in a terminal, then re-run ${rerun}:`;
6
+ /** The two commands that give git an identity; the user types them with their own name and email. Docker mode copies
7
+ * the host's user.name and user.email into the container, so they serve there too once orkeon-code is relaunched. */
8
+ export const IDENTITY_HANDOVER: readonly string[] = [
9
+ "git config --global user.name \"<your name>\"",
10
+ "git config --global user.email <your email>",
11
+ ];
12
+ /** Before the variables of IDENTITY_ENV_HANDOVER: the other way, the only one where git reads no ~/.gitconfig. */
13
+ export const IDENTITY_ENV_INTRO =
14
+ "Or set these four variables before orkeon-code, the only way in a confined session with a HOME of its own, " +
15
+ "where git reads no ~/.gitconfig; in a POSIX shell:";
16
+ /** The four variables git reads before any configuration file, which the runtime hands to a command (Orkeon #404). */
17
+ export const IDENTITY_ENV_HANDOVER: readonly string[] = [
18
+ "export GIT_AUTHOR_NAME=\"<your name>\" GIT_COMMITTER_NAME=\"<your name>\"",
19
+ "export GIT_AUTHOR_EMAIL=<your email> GIT_COMMITTER_EMAIL=<your email>",
20
+ ];
21
+ /** Before the variables of IDENTITY_PS_HANDOVER: the same four in PowerShell (orkeon-code.ps1 forwards them). */
22
+ export const IDENTITY_PS_INTRO = "or in PowerShell:";
23
+ export const IDENTITY_PS_HANDOVER: readonly string[] = [
24
+ "$env:GIT_AUTHOR_NAME = \"<your name>\"; $env:GIT_COMMITTER_NAME = \"<your name>\"",
25
+ "$env:GIT_AUTHOR_EMAIL = \"<your email>\"; $env:GIT_COMMITTER_EMAIL = \"<your email>\"",
26
+ ];
6
27
 
7
28
  // ── The body of a pull request ──────────────────────────────────────────
8
29