werkmeister-core 0.92.2 → 0.93.0
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/CHANGELOG.md +2 -0
- package/dist/harness/claude/hooks_gen.js +4 -3
- package/dist/strategies/icm.js +4 -0
- package/dist/strategies/icm_templates.d.ts +4 -0
- package/dist/strategies/icm_templates.js +11 -0
- package/dist/workspace_prompts.d.ts +2 -0
- package/dist/workspace_prompts.js +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -50,7 +50,7 @@ import { info } from "../../reporter.js";
|
|
|
50
50
|
import { repoDirs } from "../../standards.js";
|
|
51
51
|
import { tempHomeWrapper } from "../../temp_home.js";
|
|
52
52
|
// biome-ignore lint/suspicious/noImportCycles: jira→harness→…→issue_tracker (SW-188); SW-411
|
|
53
|
-
import { readAutonomous, readAutoStop, readModel } from "../../workspace_prompts.js";
|
|
53
|
+
import { readAutonomous, readAutoStop, readGrants, readModel } from "../../workspace_prompts.js";
|
|
54
54
|
import { AUTONOMOUS_DENY, cli, pluginTool } from "../autonomous_deny.js";
|
|
55
55
|
import { CODEX_HOOKS_FILE, CODEX_LAUNCH, writeCodexConfig } from "../codex/index.js";
|
|
56
56
|
// biome-ignore lint/suspicious/noImportCycles: jira→harness→…→issue_tracker (SW-188); SW-411
|
|
@@ -505,6 +505,7 @@ export function workspaceAllowRules(workspaceRoot, autonomous = readAutonomous(w
|
|
|
505
505
|
const extra = hostServices.filter((s) => !services.includes(s));
|
|
506
506
|
const any = services.length > 0 || extra.length > 0;
|
|
507
507
|
const rules = buildAllowRules(any ? feature : "", services, any ? loadServices() : {}, any ? loadArchetypes() : {}, wrapper, builtClis, extra, reposConfig);
|
|
508
|
+
rules.push(...readGrants(workspaceRoot).flatMap(cli));
|
|
508
509
|
if (!autonomous)
|
|
509
510
|
return rules;
|
|
510
511
|
// Exact: `--prefix`, `--dir`/`-C` reach another workspace, `--script-shell` runs any file.
|
|
@@ -527,8 +528,8 @@ function builtCliWrappers(workspaceRoot) {
|
|
|
527
528
|
export function workspaceAskRules(workspaceRoot) {
|
|
528
529
|
const tempHome = tempHomeWrapper(workspaceRoot);
|
|
529
530
|
const nodeTest = [
|
|
530
|
-
`Bash(${tempHome} env WERKMEISTER_ROOT=* node --test
|
|
531
|
-
`Bash(${tempHome} --no-wait env WERKMEISTER_ROOT=* node --test
|
|
531
|
+
`Bash(${tempHome} env WERKMEISTER_ROOT=* node --test*)`,
|
|
532
|
+
`Bash(${tempHome} --no-wait env WERKMEISTER_ROOT=* node --test*)`,
|
|
532
533
|
// SW-720: the probe form werkmeister-context.md names; an ask, so auto mode prompts instead of denying it.
|
|
533
534
|
`Bash(${tempHome} node --test*)`,
|
|
534
535
|
`Bash(${tempHome} --no-wait node --test*)`,
|
package/dist/strategies/icm.js
CHANGED
|
@@ -177,6 +177,10 @@ function renderContract(dir, stage, v, step0 = "") {
|
|
|
177
177
|
"## Outputs",
|
|
178
178
|
...c.outputs.map((o) => `- ${o}`),
|
|
179
179
|
"",
|
|
180
|
+
"## Pre-approved",
|
|
181
|
+
...(stage.grants ?? []).map((g) => g.endsWith(":*") ? `- \`werkmeister ${g.slice(0, -2)} …\`` : `- \`werkmeister ${g}\``),
|
|
182
|
+
"- Every other command asks. Read and edit files with Read, Edit and Write, never a `python3` heredoc or `python3 -c`, which no run pre-approves (SW-807).",
|
|
183
|
+
"",
|
|
180
184
|
...(v.autonomous
|
|
181
185
|
? ["## Self-check", c.selfCheck ?? SELF_CHECK]
|
|
182
186
|
: ["## Human check", c.humanCheck, "", askLine(v.questionTool)]),
|
|
@@ -46,6 +46,8 @@ export interface Stage {
|
|
|
46
46
|
gate?: string;
|
|
47
47
|
/** Which _shared/standards.md rows the contract names. */
|
|
48
48
|
standards: "none" | "all";
|
|
49
|
+
/** SW-807: `werkmeister` subcommands this stage runs, pre-approved for the whole run; init reads them from here, never from the rendered CONTEXT.md, which the agent can edit. */
|
|
50
|
+
grants?: string[];
|
|
49
51
|
contract(v: IcmVars): Contract;
|
|
50
52
|
}
|
|
51
53
|
export declare const askLine: (tool?: string) => string;
|
|
@@ -58,3 +60,5 @@ export declare function stageDirs(stages: Stage[]): string[];
|
|
|
58
60
|
export declare function proposeDir(stages: Stage[]): string | null;
|
|
59
61
|
/** The stage dir whose output holds PR files: propose, else the last stage (spike, SW-83). */
|
|
60
62
|
export declare function prDir(stages: Stage[]): string;
|
|
63
|
+
/** Every stage's grants for *workType*, once each: granted for the whole run (SW-807). */
|
|
64
|
+
export declare function stageGrants(workType: string): string[];
|
|
@@ -128,6 +128,9 @@ const exerciseFormat = (col) => `a \`| check | result | ${col} |\` table whose r
|
|
|
128
128
|
// SW-736: `changeset status --since` reads git history, so before the commit it failed on an entry just written (sw-699, sw-755).
|
|
129
129
|
const RELEASE_AFTER_COMMIT = "Run the repo's release check (the `Release check:` command in `werkmeister-context.md`) after the commit, not before: a check that compares the branch with its base in git history does not see an uncommitted release entry.";
|
|
130
130
|
const LINT = "the repo's lint command (the `<lint> &&` head of the test command in `werkmeister-context.md`, when it has one, which the PR gate's lint row runs) and fix what it fails, release entry included.";
|
|
131
|
+
// SW-807: exact, this workspace's own issue only. The feature, gate and status commands keep asking:
|
|
132
|
+
// each can reach shared infra, another workspace or the real ~/.werkmeister from agent-editable input.
|
|
133
|
+
const START_GRANTS = ["issue start", "issue view"];
|
|
131
134
|
const propose = {
|
|
132
135
|
name: "propose",
|
|
133
136
|
job: "acceptance walk and PR files",
|
|
@@ -180,6 +183,7 @@ const noCommitPlan = (group) => group.length
|
|
|
180
183
|
const feature = [
|
|
181
184
|
{
|
|
182
185
|
name: "research",
|
|
186
|
+
grants: START_GRANTS,
|
|
183
187
|
job: "inventory the code, surface decisions",
|
|
184
188
|
writes: "`output/inventory.md`, `output/decisions.md`",
|
|
185
189
|
check: "answer every open question in `decisions.md`",
|
|
@@ -293,6 +297,7 @@ const feature = [
|
|
|
293
297
|
const bugfix = [
|
|
294
298
|
{
|
|
295
299
|
name: "reproduce",
|
|
300
|
+
grants: START_GRANTS,
|
|
296
301
|
job: "reproduce and locate the root cause",
|
|
297
302
|
writes: "`output/repro.md`",
|
|
298
303
|
check: "agree the root cause",
|
|
@@ -398,6 +403,7 @@ const bugfix = [
|
|
|
398
403
|
const refactor = [
|
|
399
404
|
{
|
|
400
405
|
name: "scope",
|
|
406
|
+
grants: START_GRANTS,
|
|
401
407
|
job: "fix the boundary and the invariants",
|
|
402
408
|
writes: "`output/scope.md`",
|
|
403
409
|
check: "agree what must not change",
|
|
@@ -465,6 +471,7 @@ const refactor = [
|
|
|
465
471
|
const spike = [
|
|
466
472
|
{
|
|
467
473
|
name: "questions",
|
|
474
|
+
grants: START_GRANTS,
|
|
468
475
|
job: "frame what the spike must answer",
|
|
469
476
|
writes: "`output/questions.md`",
|
|
470
477
|
check: "agree the questions and what settles them",
|
|
@@ -536,3 +543,7 @@ export function proposeDir(stages) {
|
|
|
536
543
|
export function prDir(stages) {
|
|
537
544
|
return proposeDir(stages) ?? stageDirs(stages)[stages.length - 1];
|
|
538
545
|
}
|
|
546
|
+
/** Every stage's grants for *workType*, once each: granted for the whole run (SW-807). */
|
|
547
|
+
export function stageGrants(workType) {
|
|
548
|
+
return [...new Set(templateFor(workType).flatMap((s) => s.grants ?? []))];
|
|
549
|
+
}
|
|
@@ -28,6 +28,8 @@ export declare function isTrue(value: unknown): boolean;
|
|
|
28
28
|
* through `loadConfigFile`, which logs — the same reason as `readContextStrategy`.
|
|
29
29
|
*/
|
|
30
30
|
export declare function readAutonomous(workspaceRoot: string): boolean;
|
|
31
|
+
/** SW-807: an ICM workspace's stage grants, for the whole run and either mode; none for another strategy. */
|
|
32
|
+
export declare function readGrants(workspaceRoot: string): string[];
|
|
31
33
|
/** The workspace's `auto_stop` input (#231); unset follows `autonomous` (SW-39). */
|
|
32
34
|
export declare function readAutoStop(workspaceRoot: string): boolean;
|
|
33
35
|
/**
|
|
@@ -25,6 +25,7 @@ import { resolveModel } from "./model_tiers.js";
|
|
|
25
25
|
import { ProcError, run as procRun } from "./proc.js";
|
|
26
26
|
import { loadProjects } from "./projects.js";
|
|
27
27
|
import { info, warn } from "./reporter.js";
|
|
28
|
+
import { stageGrants } from "./strategies/icm_templates.js";
|
|
28
29
|
import { STRATEGY_IDS } from "./strategies/types.js";
|
|
29
30
|
function isDir(p) {
|
|
30
31
|
try {
|
|
@@ -136,6 +137,12 @@ export function isTrue(value) {
|
|
|
136
137
|
export function readAutonomous(workspaceRoot) {
|
|
137
138
|
return isTrue(readWorkspaceField(workspaceRoot, "autonomous"));
|
|
138
139
|
}
|
|
140
|
+
/** SW-807: an ICM workspace's stage grants, for the whole run and either mode; none for another strategy. */
|
|
141
|
+
export function readGrants(workspaceRoot) {
|
|
142
|
+
if (String(readWorkspaceField(workspaceRoot, "context_strategy") ?? "").trim() !== "icm")
|
|
143
|
+
return [];
|
|
144
|
+
return stageGrants(String(readWorkspaceField(workspaceRoot, "work_type") ?? ""));
|
|
145
|
+
}
|
|
139
146
|
/** The workspace's `auto_stop` input (#231); unset follows `autonomous` (SW-39). */
|
|
140
147
|
export function readAutoStop(workspaceRoot) {
|
|
141
148
|
const value = readWorkspaceField(workspaceRoot, "auto_stop");
|
package/package.json
CHANGED