@turri-dev/cli 0.2.4-next.8422d0f → 0.2.4-next.efe96fe

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 (143) hide show
  1. package/README.md +5 -6
  2. package/dist/bedrock-region.js +3 -3
  3. package/dist/chat-idle.d.ts +2 -2
  4. package/dist/chat-idle.js +2 -2
  5. package/dist/chat-models.d.ts +1 -1
  6. package/dist/chat-models.js +1 -1
  7. package/dist/chat-scope.d.ts +1 -3
  8. package/dist/chats.d.ts +2 -12
  9. package/dist/chats.js +3 -26
  10. package/dist/cli.js +11 -30
  11. package/dist/config-edit.d.ts +20 -8
  12. package/dist/config-edit.js +29 -23
  13. package/dist/config.d.ts +62 -71
  14. package/dist/config.js +170 -125
  15. package/dist/conform-cli.js +14 -3
  16. package/dist/conformance-switch.d.ts +13 -22
  17. package/dist/conformance-switch.js +37 -59
  18. package/dist/drift-cli.js +1 -1
  19. package/dist/extension.d.ts +8 -10
  20. package/dist/extension.js +257 -429
  21. package/dist/genome.js +9 -48
  22. package/dist/graph.js +3 -5
  23. package/dist/host-session.d.ts +5 -16
  24. package/dist/host-session.js +4 -6
  25. package/dist/host.d.ts +2 -4
  26. package/dist/host.js +4 -7
  27. package/dist/identity.js +0 -1
  28. package/dist/init-config.d.ts +0 -1
  29. package/dist/init-config.js +3 -10
  30. package/dist/installed-providers.d.ts +1 -1
  31. package/dist/installed-providers.js +1 -1
  32. package/dist/loop-cli.d.ts +4 -3
  33. package/dist/loop-cli.js +13 -11
  34. package/dist/loop-tools.d.ts +37 -18
  35. package/dist/loop-tools.js +118 -58
  36. package/dist/new-project.js +2 -2
  37. package/dist/parse-cli.js +2 -2
  38. package/dist/pi-launch.js +4 -1
  39. package/dist/pi-settings.d.ts +4 -0
  40. package/dist/pi-settings.js +39 -0
  41. package/dist/pi.js +12 -9
  42. package/dist/plain/check.d.ts +2 -9
  43. package/dist/plain/check.js +6 -39
  44. package/dist/plain-files.js +4 -4
  45. package/dist/regenerate/activity.d.ts +0 -7
  46. package/dist/regenerate/activity.js +2 -20
  47. package/dist/regenerate/agent-env.d.ts +1 -1
  48. package/dist/regenerate/agent-env.js +3 -3
  49. package/dist/regenerate/agent-shell.js +5 -3
  50. package/dist/regenerate/audit.js +9 -0
  51. package/dist/regenerate/base-folder.d.ts +2 -2
  52. package/dist/regenerate/base-folder.js +1 -1
  53. package/dist/regenerate/cases.js +7 -0
  54. package/dist/regenerate/chunk-plan.d.ts +5 -0
  55. package/dist/regenerate/chunk-plan.js +16 -1
  56. package/dist/regenerate/drift.d.ts +4 -0
  57. package/dist/regenerate/drift.js +26 -6
  58. package/dist/regenerate/failure-reports.d.ts +28 -0
  59. package/dist/regenerate/failure-reports.js +79 -0
  60. package/dist/regenerate/job-panel.js +3 -1
  61. package/dist/regenerate/jobs-tree.js +1 -1
  62. package/dist/regenerate/jobs.d.ts +4 -2
  63. package/dist/regenerate/jobs.js +14 -10
  64. package/dist/regenerate/ledger-view.d.ts +11 -24
  65. package/dist/regenerate/ledger-view.js +14 -60
  66. package/dist/regenerate/ledger.d.ts +2 -15
  67. package/dist/regenerate/ledger.js +1 -1
  68. package/dist/regenerate/loop.d.ts +48 -62
  69. package/dist/regenerate/loop.js +296 -131
  70. package/dist/regenerate/model-names.d.ts +33 -0
  71. package/dist/regenerate/{engine.js → model-names.js} +2 -28
  72. package/dist/regenerate/paths.d.ts +1 -1
  73. package/dist/regenerate/paths.js +2 -2
  74. package/dist/regenerate/records.d.ts +11 -0
  75. package/dist/regenerate/records.js +15 -0
  76. package/dist/regenerate/regenerate.d.ts +0 -2
  77. package/dist/regenerate/regenerate.js +4 -15
  78. package/dist/regenerate/renames.js +4 -4
  79. package/dist/regenerate/requires.d.ts +7 -0
  80. package/dist/regenerate/requires.js +24 -18
  81. package/dist/regenerate/scripts-being-written.d.ts +4 -4
  82. package/dist/regenerate/scripts-being-written.js +3 -3
  83. package/dist/regenerate/spec-map.js +3 -3
  84. package/dist/regenerate/standing.js +1 -1
  85. package/dist/regenerate/submit-work.d.ts +2 -0
  86. package/dist/regenerate/submit-work.js +8 -3
  87. package/dist/regenerate/test-scripts.d.ts +2 -1
  88. package/dist/regenerate/test-scripts.js +33 -23
  89. package/dist/regenerate/testing-steps.d.ts +16 -5
  90. package/dist/regenerate/testing-steps.js +28 -9
  91. package/dist/regenerate-cli.js +18 -9
  92. package/dist/self-invocation.d.ts +11 -0
  93. package/dist/self-invocation.js +33 -7
  94. package/dist/sentinel.js +8 -5
  95. package/dist/{config-command.d.ts → settings.d.ts} +13 -8
  96. package/dist/{config-command.js → settings.js} +155 -24
  97. package/dist/setup.d.ts +2 -2
  98. package/dist/setup.js +7 -7
  99. package/dist/skill.d.ts +0 -11
  100. package/dist/skill.js +0 -9
  101. package/dist/tools.js +2 -3
  102. package/dist/turri-versions.js +2 -1
  103. package/docs/README.md +2 -4
  104. package/docs/authoring-plain.md +3 -3
  105. package/docs/chats.md +4 -7
  106. package/docs/claude-subscription.md +2 -2
  107. package/docs/config.md +55 -45
  108. package/docs/deploy.md +1 -1
  109. package/docs/development.md +3 -4
  110. package/docs/headless.md +6 -5
  111. package/docs/hosting.md +11 -11
  112. package/docs/parser.md +3 -3
  113. package/docs/regenerating.md +27 -19
  114. package/docs/sentinel.md +6 -6
  115. package/docs/skills-and-gates.md +4 -9
  116. package/docs/using.md +20 -37
  117. package/genome/rules/project-model.md +2 -1
  118. package/genome/rules/test-plain-files.md +15 -7
  119. package/genome/rules/turri-regeneration.md +6 -9
  120. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  121. package/genome/skills/implement-conformance-testing-script/SKILL.md +2 -2
  122. package/genome/skills/implement-unit-testing-script/SKILL.md +3 -3
  123. package/package.json +1 -1
  124. package/dist/advisor-chat.d.ts +0 -63
  125. package/dist/advisor-chat.js +0 -290
  126. package/dist/change-plain-cli.d.ts +0 -1
  127. package/dist/change-plain-cli.js +0 -55
  128. package/dist/ledger-cli.d.ts +0 -1
  129. package/dist/ledger-cli.js +0 -50
  130. package/dist/ledger-tools.d.ts +0 -10
  131. package/dist/ledger-tools.js +0 -64
  132. package/dist/regenerate/advisor-records.d.ts +0 -93
  133. package/dist/regenerate/advisor-records.js +0 -110
  134. package/dist/regenerate/advisor-runs.d.ts +0 -87
  135. package/dist/regenerate/advisor-runs.js +0 -327
  136. package/dist/regenerate/engine.d.ts +0 -52
  137. package/dist/regenerate/test-advisor.d.ts +0 -101
  138. package/dist/regenerate/test-advisor.js +0 -379
  139. package/dist/spec-tools.d.ts +0 -36
  140. package/dist/spec-tools.js +0 -128
  141. package/dist/stacks.d.ts +0 -13
  142. package/dist/stacks.js +0 -96
  143. package/docs/test-advisor.md +0 -110
@@ -1,21 +1,21 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { join, resolve } from "node:path";
3
- import { defineTool } from "@earendil-works/pi-coding-agent";
4
- import { Type } from "typebox";
5
- import { adoptLegacyConfig, CONFIG_FILE, CONFIG_KEYS, configForSpec, readConfigFile, readProjectConfig, stackConfigFileIn, stackForModule, stackOf, stacksOf } from "./config.js";
3
+ import { adoptLegacyConfig, CONFIG_FILE, CONFIG_KEYS, configForSpec, readConfigFile, readProjectConfig, moduleConfigFileIn, configModuleFor, moduleConfigsOf } from "./config.js";
6
4
  import { withSetting, writeSetting } from "./config-edit.js";
7
5
  /**
8
- * Whether a project's functional specs are conformance tested: `conformance-tests:` in its config, a stack's own over the
9
- * project's, false when unset. Off, nothing of conformance testing runs - no conformance pulse, no conformance testing
10
- * script, the test advisor and the chat's conform and evaluate_tests off; the test plain files there are kept, and not
11
- * tested. The chat always knows it, and how they are turned on: the person asking for tests, or agreeing to the chat's
12
- * offer of them, turns them on - for this session and the next, written into the config.
6
+ * Whether a project's functional specs are conformance tested: `conformance-tests:` in its config, a module's own file's
7
+ * over the project's, false when unset. Conformance testing is a validation step that makes each change take about twice as long,
8
+ * so it is off until the person turns it on - with /conform, or the setting - and they keep it off to iterate fast. Off,
9
+ * nothing of conformance testing runs - no conformance pulse, no conformance testing script, the
10
+ * chat's conform refused; the test plain files there are kept, and not tested. The chat never turns them on: it says why
11
+ * it wants them, and the person decides.
13
12
  */
14
- /** The chat's tools that run conformance testing: there while the tests are on. */
15
- export const CONFORMANCE_TOOLS = ["conform", "evaluate_tests"];
16
- /** The chat's tool that turns them on: there while they are off. */
17
- export const TURN_ON_TOOL = "turn_on_conformance_tests";
18
- /** Whether a module's functional specs are conformance tested: its stack's `conformance-tests:` over the project's. */
13
+ /** Why the chat's conform, or a skill that writes the conformance testing script, is refused while they are off. */
14
+ export const CONFORMANCE_OFF_REFUSAL = "Conformance tests are off for this project (conformance-tests: false, or unset), and turning them on is the person's " +
15
+ "decision: they make each change take about twice as long, and the person keeps them off to iterate fast. Tell the " +
16
+ "person, in a line or two, why you want conformance tests here; they decide, and turn them on with /conform - which " +
17
+ "also starts them - or /settings conformance-tests true. Nothing was started.";
18
+ /** Whether a module's functional specs are conformance tested: its own file's `conformance-tests:` over the project's. */
19
19
  export function conformanceTestsOn(plainFile) {
20
20
  try {
21
21
  return configForSpec(resolve(plainFile)).conformanceTests === true;
@@ -24,29 +24,29 @@ export function conformanceTestsOn(plainFile) {
24
24
  return false;
25
25
  }
26
26
  }
27
- /** Whether the project conformance tests anything: its own config, or a stack's - for the chat's tools, which are the project's. */
27
+ /** Whether the project conformance tests anything: its own config, or a module's own file - for the chat's tools, which are the project's. */
28
28
  export function conformanceTestsOnIn(project) {
29
29
  try {
30
- const stacks = [stackOf(project), ...stacksOf(project)].filter((stack) => stack !== undefined);
31
- return readProjectConfig(project).conformanceTests === true || stacks.some((stack) => readProjectConfig(project, stack).conformanceTests === true);
30
+ return readProjectConfig(project).conformanceTests === true || moduleConfigsOf(project).some((module) => readProjectConfig(project, module).conformanceTests === true);
32
31
  }
33
32
  catch {
34
33
  return false;
35
34
  }
36
35
  }
37
36
  /**
38
- * Turn conformance testing on: `conformance-tests: true` written where the module's value comes from - its stack's file
39
- * when that names the key, else config.turri.yaml - and in effect at once. Says which file.
37
+ * Turn conformance testing on: `conformance-tests: true` written where the module's value comes from - its config
38
+ * file, its own or one of a module it requires, when that names the key, else config.turri.yaml - and in effect at once.
39
+ * Says which file.
40
40
  */
41
41
  export function turnOnConformanceTests(project, plainFile) {
42
- const stack = plainFile !== undefined ? stackForModule(resolve(plainFile)) : stackOf(project);
43
- if (stack !== undefined) {
44
- const file = join(project, stackConfigFileIn(project, stack));
42
+ const module = plainFile !== undefined ? configModuleFor(resolve(plainFile)) : undefined;
43
+ if (module !== undefined) {
44
+ const file = join(project, moduleConfigFileIn(project, module));
45
45
  if (existsSync(file) && readConfigFile(file).conformanceTests !== undefined) {
46
46
  adoptLegacyConfig(project);
47
- const own = join(project, stackConfigFileIn(project, stack));
47
+ const own = join(project, moduleConfigFileIn(project, module));
48
48
  writeFileSync(own, withSetting(readFileSync(own, "utf8"), CONFIG_KEYS.conformanceTests, true));
49
- return stackConfigFileIn(project, stack);
49
+ return moduleConfigFileIn(project, module);
50
50
  }
51
51
  }
52
52
  writeSetting(project, CONFIG_KEYS.conformanceTests, true);
@@ -65,44 +65,22 @@ export function conformanceBlock(on) {
65
65
  "<conformance-tests>",
66
66
  what,
67
67
  on
68
- ? "They are on here (conformance-tests: true): functional specs with scenarios are conformance tested, and the test advisor checks new ones in the background."
68
+ ? [
69
+ "They are on here (conformance-tests: true): functional specs with scenarios are conformance tested once their code is",
70
+ "built. As you write or change a functional spec, judge whether it needs scenarios, as the rules on test plain files say,",
71
+ "and write them when it does - in the same change, a visible ***plain change the person reviews like any other.",
72
+ "Scenarios are tested only once their module has test reqs and the project a conformance testing script: when you",
73
+ "write scenarios and one of those is missing, write it first, in that order - the test reqs, then the script with",
74
+ "implement-conformance-testing-script - asking nothing: conformance tests on is the person's yes to them.",
75
+ ].join("\n")
69
76
  : [
70
- "They are off here (conformance-tests: false, or unset): no scenarios are written or tested, no conformance testing script, the test",
71
- "advisor is off, and conform and evaluate_tests are not among your tools. Test plain files already there are kept, and not tested.",
72
- `When the person asks for conformance tests, or testing scenarios, call ${TURN_ON_TOOL} - their asking is their yes - then`,
73
- "go on with what they asked: the test reqs, the conformance testing script, the scenarios.",
74
- "You may offer them yourself, once and in a line, never turning them on unasked: when a functional spec could go wrong",
75
- "silently, or the coding agent keeps failing at one - say what they would add, and ask. A yes, and you call the tool.",
76
- "Asked how they are turned on: by asking you, /conform - which turns them on and tests what is built - or /turri-config conformance-tests true.",
77
+ "They are off here (conformance-tests: false, or unset). They make each change take about twice as long, so the person",
78
+ "keeps them off to iterate fast, and turning them on is theirs alone. While off, no conformance tests are written or run,",
79
+ "no conformance testing script either, and conform is refused. Test plain files already there are",
80
+ "kept, and not tested. When you think conformance tests are worth it here - the person asks for tests, a functional spec",
81
+ "could go wrong silently, or the coding agent keeps failing at one - tell them in a line or two why, and what it costs.",
82
+ "They decide, and turn them on with /conform - which also tests what is built - or /settings conformance-tests true.",
77
83
  ].join("\n"),
78
84
  "</conformance-tests>",
79
85
  ].join("\n");
80
86
  }
81
- /**
82
- * turn_on_conformance_tests: the chat turns conformance testing on, the person having asked for it or agreed to it.
83
- * `turnOn` is the session's (extension.ts `turnOnConformance`): the setting written, every chat's tools switched - the
84
- * file written, from the project.
85
- */
86
- export function turnOnConformanceTestsTool(options) {
87
- return defineTool({
88
- name: TURN_ON_TOOL,
89
- label: "Turn on conformance tests",
90
- description: "Turn conformance tests on for this project - conformance-tests: true in its config, for this session and the next - " +
91
- "once the person asked for conformance tests or testing scenarios, or agreed when you offered them. conform and " +
92
- "evaluate_tests become your tools, the test advisor starts checking new functional specs, and the work loop writes " +
93
- "and runs the conformance tests of every functional spec with scenarios once its code is built. Never call it unasked.",
94
- promptSnippet: `${TURN_ON_TOOL}: turn conformance tests on, the person having asked for them or agreed`,
95
- parameters: Type.Object({
96
- plain_file: Type.Optional(Type.String({ description: "The module the tests are for: its stack's config is written when that names the key. Omitted: config.turri.yaml." })),
97
- }),
98
- async execute(_id, params) {
99
- const file = options.turnOn(params.plain_file);
100
- const text = `Conformance tests are on for this project now - conformance-tests: true, written in ${file}. Say so to the person in a line. ` +
101
- "conform and evaluate_tests are your tools from your next turn, and the test advisor checks new functional specs. Go on " +
102
- "with what they asked: the test reqs, the conformance testing script, the scenarios - in that order, only what is missing. " +
103
- "Functional specs with scenarios written already, their code built, are tested once the module is next regenerated: " +
104
- "call conform for them to have their tests written now.";
105
- return { content: [{ type: "text", text }], details: { file } };
106
- },
107
- });
108
- }
package/dist/drift-cli.js CHANGED
@@ -18,7 +18,7 @@ if (named === undefined) {
18
18
  }
19
19
  try {
20
20
  refuseTestPlainFile(named);
21
- const loop = createWorkLoop({ registry: createJobRegistry(), cwd: process.cwd(), planner: false, dryRun: true });
21
+ const loop = createWorkLoop({ registry: createJobRegistry(), cwd: process.cwd(), planner: false });
22
22
  console.log(describeDrift(loop.drift(named)));
23
23
  }
24
24
  catch (error) {
@@ -4,7 +4,6 @@ import { stackOnMachine } from "./stack.ts";
4
4
  import { createAskUserTool } from "./tools.ts";
5
5
  import { fromWorkingDir } from "./loop-tools.ts";
6
6
  import { type WorkLoop } from "./regenerate/loop.ts";
7
- import { type TestAdvisor } from "./regenerate/advisor-runs.ts";
8
7
  import { type AskUser, type AskUserIO } from "./ask.ts";
9
8
  import { type TurriCore, type TurriHost } from "./chats.ts";
10
9
  /**
@@ -15,6 +14,12 @@ import { type TurriCore, type TurriHost } from "./chats.ts";
15
14
  * exchange is therefore reported back, so the interview is visible while it happens and
16
15
  * survives in the tool's result afterwards.
17
16
  */
17
+ /**
18
+ * What a question gets with nobody to answer it - print, json and rpc modes. What is the agent's to decide it decides; the
19
+ * person's own files it leaves as they are, as it would have without their yes - a testing script it finds wrong is said,
20
+ * not rewritten.
21
+ */
22
+ export declare const NO_USER_ANSWER: string;
18
23
  export declare function askUserVia(ctx: ExtensionContext, onExchange: (question: string, answer: string, said?: string) => void,
19
24
  /** Given, "/btw ..." typed as an answer is a side question: answered with this, and the question asked again. */
20
25
  aside?: (question: string) => Promise<string>,
@@ -39,11 +44,6 @@ export type { TurriHost } from "./chats.ts";
39
44
  export declare function createTurriCore(host?: TurriHost, options?: {
40
45
  persist?: boolean;
41
46
  dialogs?: (chat: string) => AskUserIO | undefined;
42
- /**
43
- * Whether the session has a test advisor (docs/test-advisor.md): the terminal's chat and a host - never pi's print,
44
- * json and rpc modes, which end when the answer is printed, nor a headless command, which builds its own loop.
45
- */
46
- advisor?: boolean;
47
47
  }): TurriCore;
48
48
  /** The session of this process: pi-launch.ts's, or one made as pi first builds the extension (`pi -e src/extension.ts`). */
49
49
  export declare function processSession(make?: () => TurriCore): TurriCore;
@@ -137,13 +137,11 @@ export declare function machineNeeds(cwd: string, work?: (cwd: string) => Return
137
137
  export declare function projectConfigBlock(root: string): string;
138
138
  /**
139
139
  * Conformance tests turned on, for the session: `conformance-tests: true` written where the module's value comes from
140
- * (conformance-switch.ts), and every open chat's tools switched to match - what the chat's turn_on_conformance_tests and a
141
- * host's turnOnConformanceTests both do. `plainFile`, absolute or from the project, picks the module whose stack's file
140
+ * (conformance-switch.ts) - what /conform does when they are off, and a host's turnOnConformance. Every chat is told at
141
+ * its next turn. `plainFile`, absolute or from the project, picks the module whose own file
142
142
  * is written when that names the key. Returns the file written, from the project. Starts no conformance pulse.
143
143
  */
144
144
  export declare function turnOnConformance(core: TurriCore, plainFile?: string): string;
145
- /** The session's test advisor, when it has one: the chat's and a host's - never pi's print, json and rpc modes'. */
146
- export declare function sessionAdvisor(session: TurriCore): TestAdvisor | undefined;
147
145
  export { fromWorkingDir };
148
146
  /**
149
147
  * What the agent is to do with a job that just ended, unasked: what the project's guidance says to do then, or else say