@turri-dev/cli 0.2.3 → 0.2.4-next.240620d
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/README.md +2 -2
- package/dist/chat-idle.d.ts +2 -2
- package/dist/chat-idle.js +2 -2
- package/dist/chats.d.ts +0 -10
- package/dist/chats.js +0 -23
- package/dist/cli.js +2 -5
- package/dist/config-edit.js +1 -3
- package/dist/config.d.ts +6 -21
- package/dist/config.js +3 -16
- package/dist/conformance-switch.d.ts +7 -17
- package/dist/conformance-switch.js +21 -46
- package/dist/drift-cli.js +1 -1
- package/dist/extension.d.ts +2 -10
- package/dist/extension.js +109 -205
- package/dist/genome.js +5 -48
- package/dist/graph.js +3 -5
- package/dist/host-session.d.ts +4 -15
- package/dist/host-session.js +2 -4
- package/dist/host.d.ts +1 -3
- package/dist/host.js +1 -4
- package/dist/identity.js +0 -1
- package/dist/init-config.d.ts +0 -1
- package/dist/init-config.js +2 -9
- package/dist/installed-providers.d.ts +1 -1
- package/dist/installed-providers.js +1 -1
- package/dist/loop-cli.d.ts +4 -3
- package/dist/loop-cli.js +13 -11
- package/dist/loop-tools.js +5 -10
- package/dist/new-project.js +2 -2
- package/dist/pi-launch.js +1 -1
- package/dist/pi.js +6 -6
- package/dist/plain/check.d.ts +1 -8
- package/dist/plain/check.js +3 -38
- package/dist/regenerate/activity.d.ts +0 -7
- package/dist/regenerate/activity.js +2 -20
- package/dist/regenerate/failure-reports.d.ts +28 -0
- package/dist/regenerate/failure-reports.js +79 -0
- package/dist/regenerate/jobs-tree.js +1 -1
- package/dist/regenerate/jobs.d.ts +2 -0
- package/dist/regenerate/jobs.js +4 -0
- package/dist/regenerate/ledger-view.d.ts +11 -24
- package/dist/regenerate/ledger-view.js +14 -60
- package/dist/regenerate/ledger.d.ts +1 -14
- package/dist/regenerate/ledger.js +1 -1
- package/dist/regenerate/loop.d.ts +37 -60
- package/dist/regenerate/loop.js +165 -101
- package/dist/regenerate/regenerate.d.ts +0 -2
- package/dist/regenerate/regenerate.js +0 -14
- package/dist/regenerate/standing.js +1 -1
- package/dist/regenerate/testing-steps.d.ts +11 -0
- package/dist/regenerate/testing-steps.js +22 -3
- package/dist/regenerate-cli.js +18 -9
- package/dist/self-invocation.js +4 -7
- package/dist/sentinel.js +3 -3
- package/dist/skill.d.ts +0 -11
- package/dist/skill.js +0 -9
- package/dist/stacks.js +1 -1
- package/dist/tools.js +2 -3
- package/docs/README.md +0 -2
- package/docs/authoring-plain.md +3 -3
- package/docs/chats.md +1 -3
- package/docs/config.md +10 -12
- package/docs/deploy.md +1 -1
- package/docs/development.md +2 -3
- package/docs/headless.md +4 -3
- package/docs/hosting.md +6 -6
- package/docs/parser.md +2 -2
- package/docs/regenerating.md +12 -10
- package/docs/sentinel.md +3 -3
- package/docs/skills-and-gates.md +3 -8
- package/docs/using.md +10 -18
- package/genome/rules/test-plain-files.md +15 -7
- package/genome/rules/turri-regeneration.md +4 -9
- package/genome/skills/convert-old-syntax/SKILL.md +5 -5
- package/package.json +1 -1
- package/dist/advisor-chat.d.ts +0 -63
- package/dist/advisor-chat.js +0 -290
- package/dist/change-plain-cli.d.ts +0 -1
- package/dist/change-plain-cli.js +0 -55
- package/dist/ledger-cli.d.ts +0 -1
- package/dist/ledger-cli.js +0 -50
- package/dist/ledger-tools.d.ts +0 -10
- package/dist/ledger-tools.js +0 -64
- package/dist/regenerate/advisor-records.d.ts +0 -93
- package/dist/regenerate/advisor-records.js +0 -110
- package/dist/regenerate/advisor-runs.d.ts +0 -87
- package/dist/regenerate/advisor-runs.js +0 -327
- package/dist/regenerate/test-advisor.d.ts +0 -101
- package/dist/regenerate/test-advisor.js +0 -379
- package/dist/spec-tools.d.ts +0 -36
- package/dist/spec-tools.js +0 -128
- package/docs/test-advisor.md +0 -110
package/dist/genome.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync,
|
|
1
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { Command, MemorySaver } from "@langchain/langgraph";
|
|
4
4
|
import { compileSkill } from "./graph.js";
|
|
@@ -9,10 +9,7 @@ import { clearOfStop, describeToolCall, describeToolResult, withStopSignal } fro
|
|
|
9
9
|
import { createLiveReviewer } from "./review/live.js";
|
|
10
10
|
import { loadSkill, readRubric } from "./skill.js";
|
|
11
11
|
import { createAskUserTool, createEndQuestionsTool, createReviewTools, createWriteArtifactTool, withReviewNote } from "./tools.js";
|
|
12
|
-
import { DECLINED, DISMISSED } from "./ask.js";
|
|
13
12
|
import { createQuestioning, levelOf, questioningQuestion } from "./questioning.js";
|
|
14
|
-
import { createSpecDiffTools } from "./spec-tools.js";
|
|
15
|
-
const CHANGE_PLAIN = "change_plain";
|
|
16
13
|
/** The conversation's tools a skill acts on the work loop with - never pi built-ins. */
|
|
17
14
|
const LOOP_TOOLS = ["regenerate", "drift", "halt", "conform"];
|
|
18
15
|
/** How much of what the agent said before a question is shown with it: its end, where the brief is. */
|
|
@@ -78,41 +75,20 @@ async function runStoppable(opts) {
|
|
|
78
75
|
const startQuestioning = (level, from) => (questioning = createQuestioning({ level: levelOf(level), phases: skill.questioning, from, onChange: keepQuestioning }));
|
|
79
76
|
if (capsQuestions && resumed?.questioning !== undefined)
|
|
80
77
|
startQuestioning(resumed.questioning.level, resumed.questioning);
|
|
81
|
-
// The step running now, and whether each of its answers is a spec change: then the next question waits until the last
|
|
82
|
-
// answer is written, and a change the agent decides itself needs no answer before it.
|
|
83
|
-
let currentStep = "";
|
|
84
|
-
const diffPerAnswer = () => skill.diffPerAnswer.includes(currentStep);
|
|
85
|
-
const holdsQuestions = capsQuestions || (skill.diffPerAnswer.length > 0 && opts.askUser !== undefined);
|
|
86
78
|
const questions = {
|
|
87
|
-
refusal: (confirmsPhase) =>
|
|
88
|
-
? "This question was not asked: the last answer is not in the spec yet. Every answer in this phase is a spec " +
|
|
89
|
-
"change, built at once - write it with change_plain first, then ask."
|
|
90
|
-
: questioning?.refusal(confirmsPhase),
|
|
79
|
+
refusal: (confirmsPhase) => questioning?.refusal(confirmsPhase),
|
|
91
80
|
answered: (confirmsPhase) => questioning?.answered(confirmsPhase),
|
|
92
81
|
end: () => questioning?.end() ?? "No questioning level was chosen: ask what the phase needs.",
|
|
93
82
|
};
|
|
94
|
-
// A skill whose unit of work is a spec change gets change_plain: the change is applied
|
|
95
|
-
// and its build queued in one step.
|
|
96
|
-
const diffs = opts.renderQueue !== undefined && skill.allowedTools.includes(CHANGE_PLAIN)
|
|
97
|
-
? createSpecDiffTools({
|
|
98
|
-
loop: opts.renderQueue,
|
|
99
|
-
cwd: opts.cwd,
|
|
100
|
-
liveReview: liveProxy,
|
|
101
|
-
paced: skill.paced,
|
|
102
|
-
free: diffPerAnswer,
|
|
103
|
-
})
|
|
104
|
-
: undefined;
|
|
105
83
|
// What the agent says between its questions - a brief to confirm, a plan - reaches the person only with
|
|
106
84
|
// the next question: the session it talks in is its own, and nobody reads it.
|
|
107
85
|
let said = "";
|
|
108
86
|
/** A new message of the agent's has started, and has said nothing yet. */
|
|
109
87
|
let saidFresh = false;
|
|
110
88
|
if (opts.askUser !== undefined) {
|
|
111
|
-
customTools.push(createAskUserTool(opts.askUser, (
|
|
89
|
+
customTools.push(createAskUserTool(opts.askUser, () => {
|
|
112
90
|
said = "";
|
|
113
|
-
|
|
114
|
-
diffs?.pace.answered(!confirmsPhase && answer !== DISMISSED && answer !== DECLINED);
|
|
115
|
-
}, () => said, holdsQuestions ? questions : undefined));
|
|
91
|
+
}, () => said, capsQuestions ? questions : undefined));
|
|
116
92
|
if (capsQuestions)
|
|
117
93
|
customTools.push(createEndQuestionsTool(questions));
|
|
118
94
|
}
|
|
@@ -125,14 +101,12 @@ async function runStoppable(opts) {
|
|
|
125
101
|
customTools.push(tool);
|
|
126
102
|
}
|
|
127
103
|
}
|
|
128
|
-
if (diffs !== undefined)
|
|
129
|
-
customTools.push(...diffs.tools);
|
|
130
104
|
customTools.push(...(opts.sharedTools ?? []));
|
|
131
105
|
// Its write and edit reach the project's ***plain only - not the code, a release, or what an app it started writes.
|
|
132
106
|
customTools.push(...plainWriteTools(opts.cwd).filter((tool) => skill.allowedTools.includes(tool.name)));
|
|
133
107
|
const names = customTools.map((tool) => tool.name);
|
|
134
108
|
// Tools this harness provides are never pi built-ins, even when it did not provide them.
|
|
135
|
-
const builtins = skill.allowedTools.filter((t) => !names.includes(t) &&
|
|
109
|
+
const builtins = skill.allowedTools.filter((t) => !names.includes(t) && !LOOP_TOOLS.includes(t));
|
|
136
110
|
const executor = await createExecutor({
|
|
137
111
|
cwd: opts.cwd,
|
|
138
112
|
customTools,
|
|
@@ -203,11 +177,6 @@ async function runStoppable(opts) {
|
|
|
203
177
|
});
|
|
204
178
|
manifest.sessionFile = executor.sessionFile;
|
|
205
179
|
writeManifest(runDir, manifest);
|
|
206
|
-
// Built renders were lost with the process; queue what the specs hold that is not built.
|
|
207
|
-
if (resumed !== undefined && opts.renderQueue !== undefined) {
|
|
208
|
-
for (const file of plainFilesIn(opts.cwd))
|
|
209
|
-
void opts.renderQueue.bringUp(file, { specChange: true }).catch(() => undefined);
|
|
210
|
-
}
|
|
211
180
|
if (liveStep !== undefined && liveProxy !== undefined) {
|
|
212
181
|
const continuous = liveStep.gate.continuous;
|
|
213
182
|
holder.reviewer = createLiveReviewer({
|
|
@@ -243,7 +212,6 @@ async function runStoppable(opts) {
|
|
|
243
212
|
writeManifest(runDir, manifest);
|
|
244
213
|
},
|
|
245
214
|
beforeStep: async (step) => {
|
|
246
|
-
currentStep = step;
|
|
247
215
|
if (!capsQuestions)
|
|
248
216
|
return;
|
|
249
217
|
// The first question of the first phase is the harness's: how many the capped phases may ask.
|
|
@@ -295,17 +263,6 @@ function writeManifest(runDir, manifest) {
|
|
|
295
263
|
manifest.updatedAt = new Date().toISOString();
|
|
296
264
|
writeFileSync(join(runDir, MANIFEST), JSON.stringify(manifest, null, 2));
|
|
297
265
|
}
|
|
298
|
-
/** The .plain files at the top of a project. */
|
|
299
|
-
function plainFilesIn(dir) {
|
|
300
|
-
try {
|
|
301
|
-
return readdirSync(dir)
|
|
302
|
-
.filter((name) => name.endsWith(".plain"))
|
|
303
|
-
.map((name) => join(dir, name));
|
|
304
|
-
}
|
|
305
|
-
catch {
|
|
306
|
-
return [];
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
266
|
/** Whether there is a run of this skill here that was interrupted, and could be resumed. */
|
|
310
267
|
export function interruptedRun(runDir, skillName) {
|
|
311
268
|
const manifest = readManifest(resolve(runDir));
|
package/dist/graph.js
CHANGED
|
@@ -49,13 +49,11 @@ export function endsOnQuestion(reply) {
|
|
|
49
49
|
return /\?$/.test(last.replace(/[*_`)\]"'\s]+$/, ""));
|
|
50
50
|
}
|
|
51
51
|
/** Sent when a step's turn ended on a question in its reply: no one reads it, and the step is not done. */
|
|
52
|
-
function unansweredQuestionPrompt(
|
|
52
|
+
function unansweredQuestionPrompt(step) {
|
|
53
53
|
return [
|
|
54
54
|
"Your turn ended on a question in your reply. No one reads it: the person sees only what ask_user asks, and",
|
|
55
55
|
`the step ends when your turn does - so step '${step.name}' would end here, not done.`,
|
|
56
|
-
|
|
57
|
-
? "If it is truly the person's to decide, ask it with ask_user. Otherwise decide it yourself."
|
|
58
|
-
: `'${skill.name}' asks the person nothing more: decide it yourself, as a careful engineer would, and say what you chose.`,
|
|
56
|
+
"If it is truly the person's to decide, ask it with ask_user. Otherwise decide it yourself.",
|
|
59
57
|
`Then carry on with step '${step.name}' until all of it is done, and end your turn only then.`,
|
|
60
58
|
].join("\n");
|
|
61
59
|
}
|
|
@@ -124,7 +122,7 @@ export function compileSkill(opts) {
|
|
|
124
122
|
// A question in the reply reaches no one - the person sees only what ask_user asks - and the step ends with the
|
|
125
123
|
// turn: back to the work, so a step is not left half done on a question nobody answers.
|
|
126
124
|
for (let nudges = 0; nudges < QUESTION_NUDGES && endsOnQuestion(reply); nudges += 1) {
|
|
127
|
-
reply = await ask(opts.executor, unansweredQuestionPrompt(
|
|
125
|
+
reply = await ask(opts.executor, unansweredQuestionPrompt(step));
|
|
128
126
|
}
|
|
129
127
|
let artifact = "";
|
|
130
128
|
try {
|
package/dist/host-session.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type AgentSession, type ExtensionFactory, type ExtensionUIContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import type { AskUserIO } from "./ask.ts";
|
|
3
3
|
import { type ChatInfo, type TurriHost } from "./chats.ts";
|
|
4
|
-
import { type EvaluateOutcome } from "./advisor-chat.ts";
|
|
5
4
|
import type { JobRegistry } from "./regenerate/jobs.ts";
|
|
6
5
|
import type { WorkLoop } from "./regenerate/loop.ts";
|
|
7
6
|
import type { Notice, NoticeAnswer } from "./notice.ts";
|
|
@@ -81,16 +80,6 @@ export interface Turri {
|
|
|
81
80
|
} | {
|
|
82
81
|
refused: string;
|
|
83
82
|
};
|
|
84
|
-
/**
|
|
85
|
-
* The test advisor asked to evaluate functional specs, as the chat's `evaluate_tests` does - for a host's own way in,
|
|
86
|
-
* a button on a functional spec: `module:func-id`s, or func-ids of `plainFile`'s module, even a text judged already and
|
|
87
|
-
* whatever `test-advisor` says, `reason` given to it as context. It returns at once; each verdict comes to the chat the
|
|
88
|
-
* person looks at, as the advisor's verdicts do - a yes starting a turn that writes the scenarios, a no a line.
|
|
89
|
-
*/
|
|
90
|
-
evaluateTests(funcIds: string[], options?: {
|
|
91
|
-
plainFile?: string;
|
|
92
|
-
reason?: string;
|
|
93
|
-
}): EvaluateOutcome;
|
|
94
83
|
/**
|
|
95
84
|
* Every value /turri-config offers for a setting after `typed` - what its completions compute, in their order, but
|
|
96
85
|
* whole: uncapped, and without "unset", which a host draws itself; the values alone, not `<key> <value>`. A model
|
|
@@ -99,10 +88,10 @@ export interface Turri {
|
|
|
99
88
|
*/
|
|
100
89
|
settingChoices(key: string, typed?: string): string[];
|
|
101
90
|
/**
|
|
102
|
-
* Conformance tests turned on, as the
|
|
103
|
-
* the module's value comes from - its stack's `config.turri.<stack>.yaml` when
|
|
104
|
-
* `config.turri.yaml` -
|
|
105
|
-
*
|
|
91
|
+
* Conformance tests turned on, as /conform does before it tests - the person's decision, a host's switch for it:
|
|
92
|
+
* `conformance-tests: true` written where the module's value comes from - its stack's `config.turri.<stack>.yaml` when
|
|
93
|
+
* that sets the key, else `config.turri.yaml` - the chats' conform no longer refused. `plainFile`, absolute or from the
|
|
94
|
+
* project, picks the module; omitted,
|
|
106
95
|
* the project's. Returns the file written, from the project. Starts no conformance pulse: that is `conform`'s.
|
|
107
96
|
*/
|
|
108
97
|
turnOnConformanceTests(plainFile?: string): string;
|
package/dist/host-session.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { createAgentSession, DefaultResourceLoader, getAgentDir, SessionManager } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { lastRun } from "./chat-records.js";
|
|
3
3
|
import { interruptChat } from "./chats.js";
|
|
4
|
-
import { evaluateTests } from "./advisor-chat.js";
|
|
5
4
|
import { reachable, ruleNames, settingCandidates } from "./config-command.js";
|
|
6
5
|
import { settingOf } from "./config-edit.js";
|
|
7
|
-
import { createTurriCore,
|
|
6
|
+
import { createTurriCore, sessionLoop, turnOnConformance } from "./extension.js";
|
|
8
7
|
import { stopDeployed } from "./regenerate/release.js";
|
|
9
8
|
import { prepareCheck } from "./sentinel-check.js";
|
|
10
9
|
/** turri's session in a host, in the process's working folder - the project's. */
|
|
11
10
|
export async function createTurri(options = {}) {
|
|
12
11
|
const { dialogs, uiContext, extensions = [], agentDir = getAgentDir(), sessionDir, restore, ...host } = options;
|
|
13
|
-
const core = createTurriCore(host, { persist: true,
|
|
12
|
+
const core = createTurriCore(host, { persist: true, ...(dialogs !== undefined ? { dialogs } : {}) });
|
|
14
13
|
const cwd = core.cwd;
|
|
15
14
|
core.setDriver({
|
|
16
15
|
async create(chat, sessionFile) {
|
|
@@ -73,7 +72,6 @@ export async function createTurri(options = {}) {
|
|
|
73
72
|
decline: async (id) => core.decline(id),
|
|
74
73
|
notices: () => core.notices(),
|
|
75
74
|
check: (request) => core.check(() => prepareCheck(cwd, request)),
|
|
76
|
-
evaluateTests: (funcIds, options) => evaluateTests(cwd, sessionAdvisor(core), funcIds, options),
|
|
77
75
|
turnOnConformanceTests: (plainFile) => turnOnConformance(core, plainFile),
|
|
78
76
|
settingChoices: (key, typed = "") => {
|
|
79
77
|
const setting = settingOf(key, ruleNames());
|
package/dist/host.d.ts
CHANGED
|
@@ -28,13 +28,11 @@ export { conceptsOf, type ModuleConcept } from "./plain/module-concepts.ts";
|
|
|
28
28
|
export { conceptBeingTyped, findConcepts } from "./plain/concepts.ts";
|
|
29
29
|
export { plainGraph, type PlainConceptNode, type PlainGraph, type PlainItemNode, type PlainLink, type PlainModuleNode, type PlainScenario, type PlainSection, type PlainTestPlainFileNode } from "./plain/graph.ts";
|
|
30
30
|
export { isStack, STDLIB_KINDS, stdlibTemplates, type StdlibKind, type StdlibTemplate } from "./stdlib.ts";
|
|
31
|
-
export { createWorkLoop, describeModules, functionalityCompletion,
|
|
31
|
+
export { createWorkLoop, describeModules, functionalityCompletion, type DriftReport, type ModuleStatus, type PlannedPulse, type WorkLoop } from "./regenerate/loop.ts";
|
|
32
32
|
export { projectStanding, type ModuleStanding, type StandingOptions } from "./regenerate/standing.ts";
|
|
33
33
|
export { requiresOrder } from "./regenerate/requires.ts";
|
|
34
34
|
export { createJobRegistry, defaultParallelJobs, type Job, type JobRegistry, type PulseCases, type PulseSpec } from "./regenerate/jobs.ts";
|
|
35
35
|
export { describeTurnIncident, onModelEvent, type TranscriptEntry } from "./regenerate/activity.ts";
|
|
36
36
|
export { sweepOrphanedGroups } from "./regenerate/shell.ts";
|
|
37
|
-
export { readAdvisor, textHash, type AdvisorEntry, type AdvisorFile, type AdvisorReport, type AdvisorState } from "./regenerate/advisor-records.ts";
|
|
38
|
-
export type { EvaluateOutcome } from "./advisor-chat.ts";
|
|
39
37
|
export { ledgerDir, onLedgerEvent, readLedger, type AgentRef, type LedgerEntry, type LedgerEvent, type LedgerKind, type LedgerQuery } from "./regenerate/ledger.ts";
|
|
40
38
|
export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews, type PulseView, type RunView } from "./regenerate/ledger-view.ts";
|
package/dist/host.js
CHANGED
|
@@ -42,15 +42,12 @@ export { plainGraph } from "./plain/graph.js";
|
|
|
42
42
|
// The standard library: every template, what it is, what it imports, and its conformance template or stack.
|
|
43
43
|
export { isStack, STDLIB_KINDS, stdlibTemplates } from "./stdlib.js";
|
|
44
44
|
// The work: what is built, what is left, and the jobs that build it.
|
|
45
|
-
export { createWorkLoop, describeModules, functionalityCompletion
|
|
45
|
+
export { createWorkLoop, describeModules, functionalityCompletion } from "./regenerate/loop.js";
|
|
46
46
|
export { projectStanding } from "./regenerate/standing.js";
|
|
47
47
|
export { requiresOrder } from "./regenerate/requires.js";
|
|
48
48
|
export { createJobRegistry, defaultParallelJobs } from "./regenerate/jobs.js";
|
|
49
49
|
export { describeTurnIncident, onModelEvent } from "./regenerate/activity.js";
|
|
50
50
|
export { sweepOrphanedGroups } from "./regenerate/shell.js";
|
|
51
|
-
// The test advisor: what it made of each functional spec of a module - pending, yes, no or failed, with its report - by
|
|
52
|
-
// func-id, an entry current while its hash is textHash of the functional spec's text; and what an evaluation came to.
|
|
53
|
-
export { readAdvisor, textHash } from "./regenerate/advisor-records.js";
|
|
54
51
|
// What turri did, as facts: the ledger, heard live and read back - this session's pulses and every earlier one's.
|
|
55
52
|
export { ledgerDir, onLedgerEvent, readLedger } from "./regenerate/ledger.js";
|
|
56
53
|
export { asJob, describePulseView, describeRuns, earlierPulses, ledgerProjects, pulseView, runViews } from "./regenerate/ledger-view.js";
|
package/dist/identity.js
CHANGED
|
@@ -67,7 +67,6 @@ const IDENTITY_BEFORE = [
|
|
|
67
67
|
" allow-to-stop-jobs in config.turri.yaml are about pulses. \"Job\" in what you read is a pulse; say pulse.",
|
|
68
68
|
];
|
|
69
69
|
const IDENTITY_AFTER = [
|
|
70
|
-
"- mutate, in a skill's activity, is change_plain: a spec change written and regenerated in one step.",
|
|
71
70
|
"- Regenerate is the word for what you do to the code: never grow, grew or grown - older text, a tool's description",
|
|
72
71
|
" or a report may still say it, and means regenerate.",
|
|
73
72
|
];
|
package/dist/init-config.d.ts
CHANGED
|
@@ -113,7 +113,6 @@ export declare const DEFAULTS: {
|
|
|
113
113
|
readonly allowToStopJobs: true;
|
|
114
114
|
readonly releaseAfterPulse: true;
|
|
115
115
|
readonly sentinel: "ask";
|
|
116
|
-
readonly testAdvisor: true;
|
|
117
116
|
readonly testingScriptsRunOn: "in-place";
|
|
118
117
|
readonly turnLimit: 120;
|
|
119
118
|
readonly compactAt: 100000;
|
package/dist/init-config.js
CHANGED
|
@@ -229,7 +229,6 @@ export const DEFAULTS = {
|
|
|
229
229
|
allowToStopJobs: true,
|
|
230
230
|
releaseAfterPulse: true,
|
|
231
231
|
sentinel: "ask",
|
|
232
|
-
testAdvisor: true,
|
|
233
232
|
testingScriptsRunOn: "in-place",
|
|
234
233
|
turnLimit: 120,
|
|
235
234
|
compactAt: 100000,
|
|
@@ -257,8 +256,8 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
|
|
|
257
256
|
"# one to use it. docs/config.md has them all.",
|
|
258
257
|
"",
|
|
259
258
|
"# Whether functional specs are conformance tested: black-box tests of the built software against the scenarios of",
|
|
260
|
-
"# their test plain files, run with the whole suite as more lands.
|
|
261
|
-
"#
|
|
259
|
+
"# their test plain files, run with the whole suite as more lands. They make each change take about twice as long.",
|
|
260
|
+
"# false: none - no scenarios written or tested. /conform in the chat turns them on, or true here.",
|
|
262
261
|
"conformance-tests: false",
|
|
263
262
|
"",
|
|
264
263
|
"# Whether the code and its tests are reviewed once they pass - two reviews at most, the second weighed by the arbiter.",
|
|
@@ -279,11 +278,6 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
|
|
|
279
278
|
"# before it first opens in a session; true: it opens without asking; false: none.",
|
|
280
279
|
`sentinel: ${DEFAULTS.sentinel}`,
|
|
281
280
|
"",
|
|
282
|
-
"# Whether turri checks, in the background, each new or changed functional spec with no scenarios - could it fail",
|
|
283
|
-
"# silently, be read two ways, cost a lot when wrong - and when it needs testing, writes its test reqs, conformance",
|
|
284
|
-
"# testing script and scenarios itself. false: only the scenarios you ask for are written.",
|
|
285
|
-
`test-advisor: ${DEFAULTS.testAdvisor}`,
|
|
286
|
-
"",
|
|
287
281
|
"# What the testing scripts run on: in-place - the code itself; copy - a fresh copy of it.",
|
|
288
282
|
`testing-scripts-run-on: ${DEFAULTS.testingScriptsRunOn}`,
|
|
289
283
|
"",
|
|
@@ -366,7 +360,6 @@ export function quickStartConfig(vendor = "other", bedrock, models) {
|
|
|
366
360
|
role("judge", strong, "judges a failing conformance run - as judge-model, which it wins over"),
|
|
367
361
|
role("arbiter", strong, "weighs a second review"),
|
|
368
362
|
role("debugger", strong, "a fresh look at unit tests that keep failing the same way"),
|
|
369
|
-
role("advisor", coding, "the test advisor: which functional specs need scenarios"),
|
|
370
363
|
"",
|
|
371
364
|
].join("\n");
|
|
372
365
|
}
|
|
@@ -5,7 +5,7 @@ import { ModelRegistry, ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
|
5
5
|
*
|
|
6
6
|
* In a chat, pi loads the person's installed pi packages itself, and turri's agents take the providers from the
|
|
7
7
|
* conversation's model registry (pi.ts `inheritProviders`). A command with no conversation - `turri regenerate`,
|
|
8
|
-
* `turri
|
|
8
|
+
* `turri conform`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
|
|
9
9
|
* process, and only the providers they register are kept. turri's own extension, when an older turri installed it into
|
|
10
10
|
* every pi, is loaded as nothing meanwhile (`LOADING_PROVIDERS`): it would start a session of its own.
|
|
11
11
|
*/
|
|
@@ -6,7 +6,7 @@ import { createAgentSessionServices, getAgentDir, ModelRegistry, ModelRuntime }
|
|
|
6
6
|
*
|
|
7
7
|
* In a chat, pi loads the person's installed pi packages itself, and turri's agents take the providers from the
|
|
8
8
|
* conversation's model registry (pi.ts `inheritProviders`). A command with no conversation - `turri regenerate`,
|
|
9
|
-
* `turri
|
|
9
|
+
* `turri conform`, doctor's model check, init-config - has none: here they are loaded the way pi loads them, once a
|
|
10
10
|
* process, and only the providers they register are kept. turri's own extension, when an older turri installed it into
|
|
11
11
|
* every pi, is loaded as nothing meanwhile (`LOADING_PROVIDERS`): it would start a session of its own.
|
|
12
12
|
*/
|
package/dist/loop-cli.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type DriftReport, type ModuleStatus, type WorkLoop } from "./regenerate/loop.ts";
|
|
2
2
|
import { type ModuleState } from "./run-report.ts";
|
|
3
3
|
/**
|
|
4
|
-
* What every command that builds - `turri regenerate`, `conform
|
|
4
|
+
* What every command that builds - `turri regenerate`, `conform` - does around its own
|
|
5
5
|
* request of the work loop, as the chat does it: the project's models, a job that fails run once more and, failing again,
|
|
6
6
|
* diagnosed, a line as each job starts and ends; then the loop run until nothing more can start, how each job ended,
|
|
7
|
-
* and exit 1 when any failed or a module is not complete. With `dryRun`,
|
|
8
|
-
*
|
|
7
|
+
* and exit 1 when any failed or a module is not complete. With `dryRun`, `ask` is a look ahead (`WorkLoop.lookAhead`): the work is
|
|
8
|
+
* planned, the prompt of the next pulse of each codebase printed from the plan kept, and nothing runs.
|
|
9
9
|
*/
|
|
10
10
|
export declare function runLoop(options: {
|
|
11
11
|
plainFile: string;
|
|
@@ -15,6 +15,7 @@ export declare function runLoop(options: {
|
|
|
15
15
|
report?: string;
|
|
16
16
|
/** The command, as the report gives it: its name and its arguments. */
|
|
17
17
|
command?: string[];
|
|
18
|
+
/** Plan and print the next pulses, starting nothing - `ask` a look ahead. */
|
|
18
19
|
dryRun?: boolean;
|
|
19
20
|
/** Start over, unasked, a codebase that has to be on a module it now requires (`--start-over`). */
|
|
20
21
|
startOver?: boolean;
|
package/dist/loop-cli.js
CHANGED
|
@@ -10,18 +10,18 @@ import { ledgerWanted, startLedger } from "./regenerate/ledger.js";
|
|
|
10
10
|
import { tryItCommand } from "./regenerate/delivery.js";
|
|
11
11
|
import { describeDiagnosis, diagnoseFailure } from "./regenerate/diagnose.js";
|
|
12
12
|
import { createJobRegistry, pulseName } from "./regenerate/jobs.js";
|
|
13
|
-
import { createWorkLoop, describeModules, functionalityCompletion
|
|
13
|
+
import { createWorkLoop, describeModules, functionalityCompletion } from "./regenerate/loop.js";
|
|
14
14
|
import { MODULES_DIR, projectDirOf } from "./regenerate/paths.js";
|
|
15
15
|
import { exportModule } from "./regenerate/release.js";
|
|
16
16
|
import { listFiles } from "./regenerate/testing.js";
|
|
17
17
|
import { startRunReport } from "./run-report.js";
|
|
18
18
|
import { configKeyOptions, optionValue } from "./cli-options.js";
|
|
19
19
|
/**
|
|
20
|
-
* What every command that builds - `turri regenerate`, `conform
|
|
20
|
+
* What every command that builds - `turri regenerate`, `conform` - does around its own
|
|
21
21
|
* request of the work loop, as the chat does it: the project's models, a job that fails run once more and, failing again,
|
|
22
22
|
* diagnosed, a line as each job starts and ends; then the loop run until nothing more can start, how each job ended,
|
|
23
|
-
* and exit 1 when any failed or a module is not complete. With `dryRun`,
|
|
24
|
-
*
|
|
23
|
+
* and exit 1 when any failed or a module is not complete. With `dryRun`, `ask` is a look ahead (`WorkLoop.lookAhead`): the work is
|
|
24
|
+
* planned, the prompt of the next pulse of each codebase printed from the plan kept, and nothing runs.
|
|
25
25
|
*/
|
|
26
26
|
export async function runLoop(options) {
|
|
27
27
|
const plainFile = resolve(options.plainFile);
|
|
@@ -110,7 +110,6 @@ async function runLoopReporting(options) {
|
|
|
110
110
|
cwd: process.cwd(),
|
|
111
111
|
...(model !== undefined ? { modelFor: () => model } : {}),
|
|
112
112
|
...(planner !== undefined ? { plannerModel: planner } : {}),
|
|
113
|
-
...(options.dryRun === true ? { dryRun: true } : {}),
|
|
114
113
|
});
|
|
115
114
|
report?.attach({
|
|
116
115
|
jobs: () => registry.list(),
|
|
@@ -146,13 +145,16 @@ async function runLoopReporting(options) {
|
|
|
146
145
|
}
|
|
147
146
|
}
|
|
148
147
|
if (options.dryRun === true) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
148
|
+
// The next pulse of each codebase, from the plan the look ahead kept - the one regenerate would start.
|
|
149
|
+
for (const status of planned) {
|
|
150
|
+
const first = status.planned[0];
|
|
151
|
+
if (first === undefined || first.afterCode === true || first.planning === true)
|
|
153
152
|
continue;
|
|
154
|
-
}
|
|
155
|
-
|
|
153
|
+
const next = await loop.plannedPulse(`planned-${status.module}-1`);
|
|
154
|
+
if (next === undefined)
|
|
155
|
+
continue;
|
|
156
|
+
console.log(`\n${c.bold(`${next.module}: ${next.title}`)}${next.track === "conformance" ? c.dim(" (conformance)") : ""}`);
|
|
157
|
+
console.log(next.task ?? c.dim(next.why ?? "(no task)"));
|
|
156
158
|
}
|
|
157
159
|
process.exit(0);
|
|
158
160
|
}
|
package/dist/loop-tools.js
CHANGED
|
@@ -3,7 +3,6 @@ import { refuseTestPlainFile } from "./test-plain-files.js";
|
|
|
3
3
|
import { basename, relative, resolve } from "node:path";
|
|
4
4
|
import { defineTool } from "@earendil-works/pi-coding-agent";
|
|
5
5
|
import { Type } from "typebox";
|
|
6
|
-
import { advisingNote } from "./advisor-chat.js";
|
|
7
6
|
import { CONFIG_FILE, readProjectConfig, stackConfigFile, stackForModule, stackNamed, stacksOf, withStack } from "./config.js";
|
|
8
7
|
import { checkPlainFile, formatCheckResults } from "./plain/check.js";
|
|
9
8
|
import { describeDrift, describeModules } from "./regenerate/loop.js";
|
|
@@ -18,15 +17,14 @@ export const GUIDANCE_PARAM = Type.Optional(Type.String({
|
|
|
18
17
|
"the user said it, or as you understood it. A strong preference for the planner, within its limits. Omit when there is none.",
|
|
19
18
|
}));
|
|
20
19
|
export const WORKING_DIR_PARAM = Type.Optional(Type.String({
|
|
21
|
-
description: "The folder
|
|
22
|
-
"(e.g. \"plain\"). plain_file
|
|
23
|
-
"plain/hubspot.plain. Default: where " +
|
|
20
|
+
description: "The folder the .plain files are in, relative to where turri was started - as if it had been started there " +
|
|
21
|
+
"(e.g. \"plain\"). plain_file is then relative to it - hubspot.plain, not plain/hubspot.plain. Default: where " +
|
|
24
22
|
"turri was started.",
|
|
25
23
|
}));
|
|
26
24
|
export const MODEL_PARAM = Type.Optional(Type.String({
|
|
27
25
|
description: "The model for the agents of this one call: a provider/model-id, or its name as the user said it. " +
|
|
28
26
|
"Omitted: the model chosen for this kind of work with engine, else the conversation's. " +
|
|
29
|
-
"To change it for every later
|
|
27
|
+
"To change it for every later pulse, use engine instead.",
|
|
30
28
|
}));
|
|
31
29
|
export const STACK_PARAM = Type.Optional(Type.String({
|
|
32
30
|
description: "In a project of stacks: the stack that builds this module - its config.turri.<stack>.yaml over config.turri.yaml, " +
|
|
@@ -218,10 +216,7 @@ export function regenerateTool(options) {
|
|
|
218
216
|
: again.length > 0
|
|
219
217
|
? await loop.regenerateAgain(plainFile, again, request)
|
|
220
218
|
: await loop.bringUp(plainFile, request);
|
|
221
|
-
|
|
222
|
-
// The functional specs the test advisor took up, for the agent to say so rather than offer their scenarios.
|
|
223
|
-
const advising = advisingNote(loop, plainFile);
|
|
224
|
-
return advising === "" ? reply : { ...reply, content: [...reply.content, { type: "text", text: advising }] };
|
|
219
|
+
return loopReply(loop, statuses, options.wait !== undefined ? options.wait(ctx, given.wait) : given.wait === true);
|
|
225
220
|
});
|
|
226
221
|
},
|
|
227
222
|
});
|
|
@@ -237,7 +232,7 @@ export function driftTool(options) {
|
|
|
237
232
|
"with nothing left, it says the module is fully regenerated. It plans nothing and starts nothing, and calls no model.",
|
|
238
233
|
promptSnippet: "drift: what is left to regenerate in a module, code and conformance tests - starting nothing",
|
|
239
234
|
promptGuidelines: [
|
|
240
|
-
"Use drift when the user asks what is left to build, whether a module is up to date with its spec, or what changed since it was last regenerated. To see the next pulse's prompt
|
|
235
|
+
"Use drift when the user asks what is left to build, whether a module is up to date with its spec, or what changed since it was last regenerated. To see how it is planned into pulses, and the next pulse's prompt, use pulses with plain_file.",
|
|
241
236
|
],
|
|
242
237
|
parameters: Type.Object({
|
|
243
238
|
plain_file: Type.Optional(Type.String({ description: "Path to the .plain file. Omitted: the module the project's config.turri.yaml names" })),
|
package/dist/new-project.js
CHANGED
|
@@ -15,8 +15,8 @@ export const NEW_PROJECT = [
|
|
|
15
15
|
" chosen again.",
|
|
16
16
|
"4. The unit testing script: keep one turri already finds; otherwise start cultivate with implement-unit-testing-script,",
|
|
17
17
|
" plainFile the new module. It runs in the background: go straight on - the module's pulses wait for the script.",
|
|
18
|
-
" Tests only
|
|
19
|
-
" order: the ***test reqs*** - the stack's conformance template - then cultivate with",
|
|
18
|
+
" Tests only once conformance tests are on: they make each change take about twice as long, so the person turns them",
|
|
19
|
+
" on - asked for tests, tell them /conform does - then in this order: the ***test reqs*** - the stack's conformance template - then cultivate with",
|
|
20
20
|
" implement-conformance-testing-script, in the background too, then the scenarios.",
|
|
21
21
|
"5. The first functional spec: the smallest thing that runs and shows something - the server answers GET / with the",
|
|
22
22
|
" app's name, the CLI prints its usage - with no test plain file, unless they asked for tests. parse, fix",
|
package/dist/pi-launch.js
CHANGED
|
@@ -70,7 +70,7 @@ if (interactive) {
|
|
|
70
70
|
args.splice(asked, 1);
|
|
71
71
|
restore = saved;
|
|
72
72
|
}
|
|
73
|
-
driveTerminal(processSession(() => createTurriCore({}, { persist: true
|
|
73
|
+
driveTerminal(processSession(() => createTurriCore({}, { persist: true })),
|
|
74
74
|
// With none of the person's chats saved - only the sentinel's - pi starts a fresh one, and every saved chat is opened beside it.
|
|
75
75
|
restore !== undefined ? { restore, skipFirst: restore.chats.some((chat) => chat.role === undefined) } : {});
|
|
76
76
|
}
|
package/dist/pi.js
CHANGED
|
@@ -8,7 +8,7 @@ import { maskToolResults } from "./regenerate/masking.js";
|
|
|
8
8
|
import { withListArguments } from "./regenerate/list-arguments.js";
|
|
9
9
|
import { checkAgainstScript, ENVIRONMENT_ERROR_TOOL, EnvironmentError, environmentErrorTool, sandboxGapOf } from "./regenerate/environment-error.js";
|
|
10
10
|
import { MODULES_DIR, projectRootOf, sessionsDir } from "./regenerate/paths.js";
|
|
11
|
-
import { currentStopSignal, describeToolCall, describeToolResult, JobStoppedError,
|
|
11
|
+
import { currentStopSignal, describeToolCall, describeToolResult, JobStoppedError, reportActivity, reportNow, reportAgent, reportTranscript, reportModelEvent, reportUsage, } from "./regenerate/activity.js";
|
|
12
12
|
import { debugLogOf, startDebugLog } from "./regenerate/debug-log.js";
|
|
13
13
|
import { firstLine, record } from "./regenerate/ledger.js";
|
|
14
14
|
let thinkingSource;
|
|
@@ -330,20 +330,20 @@ async function askOnce(session, text, onDelta) {
|
|
|
330
330
|
lastCallReport = now;
|
|
331
331
|
const block = update.partial.content[update.contentIndex];
|
|
332
332
|
const size = callChars >= 1000 ? `${(callChars / 1000).toFixed(1)}k` : `${callChars}`;
|
|
333
|
-
reportNow(`writing ${block?.name
|
|
333
|
+
reportNow(`writing ${block?.name ?? "a tool"} call · ${size} chars`, { keepSince: true });
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
337
|
if (event.type === "tool_execution_start") {
|
|
338
338
|
toolStarted.set(event.toolCallId, Date.now());
|
|
339
339
|
const args = JSON.stringify(event.args ?? {});
|
|
340
|
-
transcript({ kind: "tool", text: `${
|
|
340
|
+
transcript({ kind: "tool", text: `${event.toolName} ${clipText(args, MAX_TOOL_ARGS)}`, full: `${event.toolName} ${args}` });
|
|
341
341
|
const took = Date.now() - stepStarted;
|
|
342
342
|
// Which agent made the call, by its role: several work in one pulse.
|
|
343
343
|
const role = agentRoles.get(session);
|
|
344
344
|
const line = `${role !== undefined ? `(${role}) ` : ""}${describeToolCall(event.toolName, event.args)}`;
|
|
345
345
|
reportActivity(took >= 1000 ? `${line} (model ${seconds(took)})` : line);
|
|
346
|
-
reportNow(`running ${
|
|
346
|
+
reportNow(`running ${event.toolName}`);
|
|
347
347
|
}
|
|
348
348
|
if (event.type === "tool_execution_end") {
|
|
349
349
|
failing = event.isError ? (event.toolName === failingTool ? failing + 1 : 1) : 0;
|
|
@@ -352,9 +352,9 @@ async function askOnce(session, text, onDelta) {
|
|
|
352
352
|
// A call its tool refuses never reaches the tool, so no guard on the tools sees it: an agent can
|
|
353
353
|
// make the same bad call, worded a little differently, thousands of times. Its turn ends here, and
|
|
354
354
|
// the harness goes on from there, as after any turn.
|
|
355
|
-
reportActivity(` stopped the agent's turn: ${failing} ${
|
|
355
|
+
reportActivity(` stopped the agent's turn: ${failing} ${event.toolName} calls failed in a row`);
|
|
356
356
|
debugLogOf(session)?.note(`turn stopped: ${failing} ${event.toolName} calls failed in a row`);
|
|
357
|
-
stopTurn(session, `${failing} ${
|
|
357
|
+
stopTurn(session, `${failing} ${event.toolName} calls failed in a row`);
|
|
358
358
|
}
|
|
359
359
|
const output = resultText(event.result);
|
|
360
360
|
const started = toolStarted.get(event.toolCallId);
|
package/dist/plain/check.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Static validation of ***plain, using this repo's own parser - `turri parse`, the chat's `parse`, and the check
|
|
3
|
-
* `
|
|
3
|
+
* `regenerate` runs on the module it is given.
|
|
4
4
|
*
|
|
5
5
|
* It parses each module with its test plain files, resolves its imports and required modules, and reports every error
|
|
6
6
|
* the parser can see without generating anything. The parser's errors come one at a time, the first it meets, as the
|
|
@@ -55,13 +55,6 @@ export declare function resolvePlainTargets(target: string): string[];
|
|
|
55
55
|
* project's test folder, once, at the end.
|
|
56
56
|
*/
|
|
57
57
|
export declare function checkPlainTargets(target: string, templateDirs?: string[]): CheckResult[];
|
|
58
|
-
/**
|
|
59
|
-
* The check of what a ***plain change touched, shared by `change_plain` and `turri change-plain`: each module it
|
|
60
|
-
* touched, an import module as the modules that import it read it, and each test plain file as its module - by its
|
|
61
|
-
* folder - is parsed with its test plain files; a test plain file the change put where it does not belong is refused
|
|
62
|
-
* as `parse` refuses it. A file the change deleted is checked through the module it belonged to.
|
|
63
|
-
*/
|
|
64
|
-
export declare function checkTouchedPlain(paths: string[]): CheckResult[];
|
|
65
58
|
/**
|
|
66
59
|
* One line per file, plus the parser's message under any that failed and turri's next step, or every problem turri
|
|
67
60
|
* found; a module that passed, its functional specs under it, each with its test plain file and its scenarios - and
|
package/dist/plain/check.js
CHANGED
|
@@ -2,12 +2,12 @@ import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { basename, extname, join, relative, resolve, sep } from "node:path";
|
|
3
3
|
import { testDirOf } from "../config.js";
|
|
4
4
|
import { projectDirOf, resolveTemplateDirs } from "../regenerate/paths.js";
|
|
5
|
-
import {
|
|
5
|
+
import { isImportModule } from "../regenerate/requires.js";
|
|
6
6
|
import { testingGap } from "../regenerate/testing-steps.js";
|
|
7
7
|
import { missingBaseFolder } from "../regenerate/base-folder.js";
|
|
8
8
|
import { conformanceTestsOn } from "../conformance-switch.js";
|
|
9
9
|
import { testedFuncIds } from "../regenerate/records.js";
|
|
10
|
-
import {
|
|
10
|
+
import { projectModules, strayTestPlainFiles, testPlainFileRefusal } from "../test-plain-files.js";
|
|
11
11
|
import { plainFileParser, PLAIN_SOURCE_FILE_EXTENSION, PREVIOUS_SYNTAX_HINT, readPlainSourceMetadata, REQUIRES_DIRECTIVE } from "./parser.js";
|
|
12
12
|
import { ACCEPTANCE_TESTS, CONFORMANCE_TESTS, getFunctionalSpecs, TEST_PLAIN_FILES, } from "./spec.js";
|
|
13
13
|
/** Whether a parser error is one the previous ***plain syntax makes. */
|
|
@@ -67,7 +67,7 @@ function testingGapsOf(moduleName, path, tree, projectDir, templateDirs) {
|
|
|
67
67
|
if (!conformanceTestsOn(path)) {
|
|
68
68
|
const tested = testedFuncIds(tree);
|
|
69
69
|
return tested.length > 0
|
|
70
|
-
? [`its scenarios are not tested - ${tested.map((funcId) => `${moduleName}:${funcId}`).join(", ")}: conformance tests are off (conformance-tests: false, or unset).
|
|
70
|
+
? [`its scenarios are not tested - ${tested.map((funcId) => `${moduleName}:${funcId}`).join(", ")}: conformance tests are off (conformance-tests: false, or unset). /conform in the chat turns them on, or conformance-tests: true in config.turri.yaml.`]
|
|
71
71
|
: [];
|
|
72
72
|
}
|
|
73
73
|
const tips = tipsAbove(moduleName, projectDir);
|
|
@@ -192,41 +192,6 @@ export function checkPlainTargets(target, templateDirs = []) {
|
|
|
192
192
|
}
|
|
193
193
|
return results;
|
|
194
194
|
}
|
|
195
|
-
/**
|
|
196
|
-
* The check of what a ***plain change touched, shared by `change_plain` and `turri change-plain`: each module it
|
|
197
|
-
* touched, an import module as the modules that import it read it, and each test plain file as its module - by its
|
|
198
|
-
* folder - is parsed with its test plain files; a test plain file the change put where it does not belong is refused
|
|
199
|
-
* as `parse` refuses it. A file the change deleted is checked through the module it belonged to.
|
|
200
|
-
*/
|
|
201
|
-
export function checkTouchedPlain(paths) {
|
|
202
|
-
const modules = new Set();
|
|
203
|
-
const results = [];
|
|
204
|
-
for (const given of paths) {
|
|
205
|
-
const path = resolve(given);
|
|
206
|
-
const place = testPlaceOf(path);
|
|
207
|
-
if (place !== undefined && !place.directory) {
|
|
208
|
-
const stray = strayTestPlainFiles(place.projectDir).find((found) => resolve(place.projectDir, found.file) === path);
|
|
209
|
-
if (stray !== undefined) {
|
|
210
|
-
results.push({ file: path, ok: false, errorType: "a test plain file outside its module's folder", problems: [`${stray.file} - ${stray.problem}`] });
|
|
211
|
-
continue;
|
|
212
|
-
}
|
|
213
|
-
const owner = moduleOfTestPlainFile(path);
|
|
214
|
-
if (owner?.plainFile !== undefined)
|
|
215
|
-
modules.add(owner.plainFile);
|
|
216
|
-
else if (owner !== undefined)
|
|
217
|
-
results.push({ file: path, ok: false, errorType: "a test plain file outside a module's folder", problems: [`${shown(path, place.projectDir)} - no module ${owner.module}`] });
|
|
218
|
-
continue;
|
|
219
|
-
}
|
|
220
|
-
if (!existsSync(path))
|
|
221
|
-
continue;
|
|
222
|
-
const importing = isImportModule(path) ? importingModules(path) : [];
|
|
223
|
-
for (const module of importing.length > 0 ? importing : [path])
|
|
224
|
-
modules.add(resolve(module));
|
|
225
|
-
}
|
|
226
|
-
for (const module of modules)
|
|
227
|
-
results.push(checkPlainFile(module));
|
|
228
|
-
return results;
|
|
229
|
-
}
|
|
230
195
|
/** Columns padded to their widest cell, each line indented under the module's. */
|
|
231
196
|
function columns(rows) {
|
|
232
197
|
const widths = rows.reduce((acc, row) => row.map((cell, index) => Math.max(acc[index] ?? 0, cell.length)), []);
|