@turri-dev/cli 0.2.3-next.fea0bd9 → 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.
Files changed (94) hide show
  1. package/README.md +52 -56
  2. package/dist/chat-idle.d.ts +2 -2
  3. package/dist/chat-idle.js +2 -2
  4. package/dist/chats.d.ts +0 -10
  5. package/dist/chats.js +0 -23
  6. package/dist/cli.js +32 -5
  7. package/dist/config-edit.js +1 -3
  8. package/dist/config.d.ts +6 -21
  9. package/dist/config.js +3 -16
  10. package/dist/conformance-switch.d.ts +7 -17
  11. package/dist/conformance-switch.js +21 -46
  12. package/dist/drift-cli.js +1 -1
  13. package/dist/extension.d.ts +16 -12
  14. package/dist/extension.js +247 -238
  15. package/dist/genome.js +5 -48
  16. package/dist/graph.js +3 -5
  17. package/dist/host-session.d.ts +4 -15
  18. package/dist/host-session.js +2 -4
  19. package/dist/host.d.ts +1 -3
  20. package/dist/host.js +1 -4
  21. package/dist/identity.js +0 -1
  22. package/dist/init-config.d.ts +0 -1
  23. package/dist/init-config.js +2 -9
  24. package/dist/installed-providers.d.ts +1 -1
  25. package/dist/installed-providers.js +2 -2
  26. package/dist/loop-cli.d.ts +4 -3
  27. package/dist/loop-cli.js +13 -11
  28. package/dist/loop-tools.js +5 -10
  29. package/dist/new-project.js +2 -2
  30. package/dist/pi-launch.js +1 -1
  31. package/dist/pi.js +6 -6
  32. package/dist/plain/check.d.ts +1 -8
  33. package/dist/plain/check.js +3 -38
  34. package/dist/regenerate/activity.d.ts +0 -7
  35. package/dist/regenerate/activity.js +2 -20
  36. package/dist/regenerate/failure-reports.d.ts +28 -0
  37. package/dist/regenerate/failure-reports.js +79 -0
  38. package/dist/regenerate/jobs-tree.js +1 -1
  39. package/dist/regenerate/jobs.d.ts +2 -0
  40. package/dist/regenerate/jobs.js +4 -0
  41. package/dist/regenerate/ledger-view.d.ts +11 -24
  42. package/dist/regenerate/ledger-view.js +14 -60
  43. package/dist/regenerate/ledger.d.ts +1 -14
  44. package/dist/regenerate/ledger.js +1 -1
  45. package/dist/regenerate/loop.d.ts +40 -58
  46. package/dist/regenerate/loop.js +209 -126
  47. package/dist/regenerate/regenerate.d.ts +0 -2
  48. package/dist/regenerate/regenerate.js +0 -14
  49. package/dist/regenerate/standing.js +1 -1
  50. package/dist/regenerate/testing-steps.d.ts +11 -0
  51. package/dist/regenerate/testing-steps.js +22 -3
  52. package/dist/regenerate-cli.js +18 -9
  53. package/dist/self-invocation.js +5 -8
  54. package/dist/sentinel.js +3 -3
  55. package/dist/skill.d.ts +0 -11
  56. package/dist/skill.js +0 -9
  57. package/dist/stacks.js +1 -1
  58. package/dist/tools.js +2 -3
  59. package/docs/README.md +0 -2
  60. package/docs/authoring-plain.md +3 -3
  61. package/docs/chats.md +1 -3
  62. package/docs/claude-subscription.md +6 -6
  63. package/docs/config.md +11 -13
  64. package/docs/deploy.md +1 -1
  65. package/docs/development.md +2 -3
  66. package/docs/headless.md +4 -3
  67. package/docs/hosting.md +7 -7
  68. package/docs/installation.md +4 -0
  69. package/docs/parser.md +2 -2
  70. package/docs/regenerating.md +12 -10
  71. package/docs/sentinel.md +3 -3
  72. package/docs/skills-and-gates.md +3 -8
  73. package/docs/using.md +11 -18
  74. package/genome/rules/test-plain-files.md +15 -7
  75. package/genome/rules/turri-regeneration.md +4 -9
  76. package/genome/skills/convert-old-syntax/SKILL.md +5 -5
  77. package/package.json +1 -1
  78. package/dist/advisor-chat.d.ts +0 -63
  79. package/dist/advisor-chat.js +0 -290
  80. package/dist/change-plain-cli.d.ts +0 -1
  81. package/dist/change-plain-cli.js +0 -55
  82. package/dist/ledger-cli.d.ts +0 -1
  83. package/dist/ledger-cli.js +0 -50
  84. package/dist/ledger-tools.d.ts +0 -10
  85. package/dist/ledger-tools.js +0 -64
  86. package/dist/regenerate/advisor-records.d.ts +0 -93
  87. package/dist/regenerate/advisor-records.js +0 -110
  88. package/dist/regenerate/advisor-runs.d.ts +0 -87
  89. package/dist/regenerate/advisor-runs.js +0 -327
  90. package/dist/regenerate/test-advisor.d.ts +0 -101
  91. package/dist/regenerate/test-advisor.js +0 -379
  92. package/dist/spec-tools.d.ts +0 -36
  93. package/dist/spec-tools.js +0 -128
  94. package/docs/test-advisor.md +0 -110
@@ -1,20 +1,20 @@
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
3
  import { adoptLegacyConfig, CONFIG_FILE, CONFIG_KEYS, configForSpec, readConfigFile, readProjectConfig, stackConfigFileIn, stackForModule, stackOf, stacksOf } from "./config.js";
6
4
  import { withSetting, writeSetting } from "./config-edit.js";
7
5
  /**
8
6
  * 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.
7
+ * 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";
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 /turri-config conformance-tests true. Nothing was started.";
18
18
  /** Whether a module's functional specs are conformance tested: its stack's `conformance-tests:` over the project's. */
19
19
  export function conformanceTestsOn(plainFile) {
20
20
  try {
@@ -65,44 +65,19 @@ 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
+ ].join("\n")
69
73
  : [
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, or /turri-config conformance-tests true.",
74
+ "They are off here (conformance-tests: false, or unset). They make each change take about twice as long, so the person",
75
+ "keeps them off to iterate fast, and turning them on is theirs alone. While off, no conformance tests are written or run,",
76
+ "no conformance testing script either, and conform is refused. Test plain files already there are",
77
+ "kept, and not tested. When you think conformance tests are worth it here - the person asks for tests, a functional spec",
78
+ "could go wrong silently, or the coding agent keeps failing at one - tell them in a line or two why, and what it costs.",
79
+ "They decide, and turn them on with /conform - which also tests what is built - or /turri-config conformance-tests true.",
77
80
  ].join("\n"),
78
81
  "</conformance-tests>",
79
82
  ].join("\n");
80
83
  }
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
  /**
@@ -39,11 +38,6 @@ export type { TurriHost } from "./chats.ts";
39
38
  export declare function createTurriCore(host?: TurriHost, options?: {
40
39
  persist?: boolean;
41
40
  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
41
  }): TurriCore;
48
42
  /** The session of this process: pi-launch.ts's, or one made as pi first builds the extension (`pi -e src/extension.ts`). */
49
43
  export declare function processSession(make?: () => TurriCore): TurriCore;
@@ -54,6 +48,13 @@ export default extension;
54
48
  * chat has asked for work yet.
55
49
  */
56
50
  export declare function sessionLoop(session: TurriCore): WorkLoop;
51
+ /** The functional specs a command's words name first, each as module:func-id - a comma after one allowed - and the words after them. */
52
+ export declare function funcIdsNamedFirst(words: string[]): {
53
+ funcIds: string[];
54
+ rest: string[];
55
+ };
56
+ /** Whether a /conform's words after its functional specs ask for a pulse a functional spec - "one by one", "separately". */
57
+ export declare function asksOneByOne(words: string): boolean;
57
58
  /**
58
59
  * What a slash command showed the person: kept in the chat, where they read it, and put in the conversation as well -
59
60
  * unseen there - so that when they speak of it next ("fix it"), the agent knows what they saw. A command runs outside
@@ -64,10 +65,15 @@ export declare function shownAfterCommand(pi: ExtensionAPI, ctx: ExtensionContex
64
65
  /** The command is in the chat already, above it (echoCommand): the text alone. */
65
66
  echoed?: boolean, react?: string): void;
66
67
  /**
67
- * What the agent does once /regenerate has started pulses: a command's output alone leaves the chat silent, and the
68
- * person wondering whether to wait. It says what runs, and that they need not - and starts nothing itself.
68
+ * What the agent does once /regenerate or /conform has started pulses: a command's output alone leaves the chat silent,
69
+ * and the person wondering whether to wait. It says what runs, and that they need not - and starts nothing itself.
69
70
  */
70
71
  export declare const COMMAND_STARTED_REACTION: string;
72
+ /**
73
+ * What the agent does when /conform started nothing: answers it at once - why, and what would let it start - and offers
74
+ * to do that, rather than leave the person with a refusal and a silent chat.
75
+ */
76
+ export declare const CONFORM_REFUSED_REACTION: string;
71
77
  export declare const COMMAND_OUTCOME = "turri_command_outcome";
72
78
  interface CommandOutcome {
73
79
  command: string;
@@ -125,13 +131,11 @@ export declare function machineNeeds(cwd: string, work?: (cwd: string) => Return
125
131
  export declare function projectConfigBlock(root: string): string;
126
132
  /**
127
133
  * Conformance tests turned on, for the session: `conformance-tests: true` written where the module's value comes from
128
- * (conformance-switch.ts), and every open chat's tools switched to match - what the chat's turn_on_conformance_tests and a
129
- * host's turnOnConformanceTests both do. `plainFile`, absolute or from the project, picks the module whose stack's file
134
+ * (conformance-switch.ts) - what /conform does when they are off, and a host's turnOnConformance. Every chat is told at
135
+ * its next turn. `plainFile`, absolute or from the project, picks the module whose stack's file
130
136
  * is written when that names the key. Returns the file written, from the project. Starts no conformance pulse.
131
137
  */
132
138
  export declare function turnOnConformance(core: TurriCore, plainFile?: string): string;
133
- /** The session's test advisor, when it has one: the chat's and a host's - never pi's print, json and rpc modes'. */
134
- export declare function sessionAdvisor(session: TurriCore): TestAdvisor | undefined;
135
139
  export { fromWorkingDir };
136
140
  /**
137
141
  * 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