werkmeister-core 0.93.10 → 0.94.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 +19 -0
- package/dist/cache.js +2 -3
- package/dist/daemon_client.js +2 -4
- package/dist/fixture_workspace.js +1 -1
- package/dist/generate.d.ts +0 -8
- package/dist/generate.js +4 -18
- package/dist/global_config.d.ts +23 -16
- package/dist/global_config.js +31 -28
- package/dist/harness/claude/hooks_gen.d.ts +1 -0
- package/dist/harness/claude/hooks_gen.js +16 -10
- package/dist/lifecycle.js +13 -5
- package/dist/locks.js +2 -3
- package/dist/machine_setup.d.ts +5 -7
- package/dist/machine_setup.js +49 -15
- package/dist/migrate.js +13 -9
- package/dist/pr_lifecycle.js +1 -1
- package/dist/sandbox.js +1 -1
- package/dist/scaffold.d.ts +2 -0
- package/dist/scaffold.js +20 -0
- package/dist/slots.js +2 -3
- package/dist/strategies/icm.js +3 -2
- package/dist/web_servers.js +14 -2
- package/dist/workspace_token.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# sandbox-core
|
|
2
2
|
|
|
3
|
+
## 0.94.0
|
|
4
|
+
|
|
5
|
+
## 0.93.12
|
|
6
|
+
|
|
7
|
+
### Patch Changes
|
|
8
|
+
|
|
9
|
+
- 034f5e5: `machine migrate` now rewrites a workspace's `with-temp-home` wrapper whenever it differs from the one this CLI writes, even when the workspace's hooks and permission rules are already current. `machine migrate --check` reports such a workspace as stale (SW-416).
|
|
10
|
+
- d8d8593: `machine config --write`, `machine setup` and `machine migrate` now refuse to write the machine config or `env.sh` from inside any container, even with `WERKMEISTER_FEATURE` unset, the same way compose generation has refused since SW-554. The two guards are now one, `refuseInsideContainer`, and `WERKMEISTER_CONFIG_FILE` still lets a scratch run write (SW-572).
|
|
11
|
+
- 28242eb: `WERKMEISTER_CONFIG_FILE` now moves all of werkmeister's state with the config: locks, reconcile state, the issue cache, the daemon's `mcp-token`, its pid and log files, workspace tokens, VS Code terminal pid files and the legacy `slots.json`. Before, these stayed in the real `~/.werkmeister`. A process with a relocated config therefore no longer touches the real home. With the variable unset, every path is the same as before (SW-622).
|
|
12
|
+
- 23a4c40: Once `machine setup` has run on a fresh install, `machine setup --check` no longer fails with "no standards tree". When `overrides.standards_dir` is unset, the standards tree now defaults to `~/.werkmeister/standards`, which `machine setup` creates with a README describing the module layout and never overwrites; before that first run, `--check` names the folder it would create. The old default pointed inside the package, at a folder it never shipped. The "Claude Code standards access" step now offers that folder on the first run too, instead of skipping. A configured `overrides.standards_dir` is unchanged, and setup never creates it (SW-640).
|
|
13
|
+
- 15e1b2a: `generate-certs.sh` now pins its own locale (`LC_ALL=C`; every value it handles is an ASCII hostname), so the certificate step of `machine setup` no longer depends on the caller's locale. When the script fails, it prints the line that failed and its exit code, and setup's step points at that line instead of reporting only the exit code (SW-642).
|
|
14
|
+
- a962638: `machine setup` no longer installs the ponytail plugin on every machine. Like superpowers, it is now an optional plugin, and the wizard asks about each optional plugin separately. A machine that already has ponytail keeps it, setup keeps it current, and `machine setup --check` does not report it either way (SW-643).
|
|
15
|
+
|
|
16
|
+
## 0.93.11
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- cbf52b7: The waiting queue no longer drops a queued feature without telling its session. When the grant's start fails after admission (a failed `compose up`, for example), the session's waiting state is cleared and it is told to rerun `werkmeister feature up`. A waiter whose slot lease is gone is started from its workspace instead of being dequeued (SW-848).
|
|
21
|
+
|
|
3
22
|
## 0.93.10
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/cache.js
CHANGED
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
* at worst re-fetches one key). Go SQLite only if entries reach the thousands.
|
|
20
20
|
*/
|
|
21
21
|
import { promises as fs } from "node:fs";
|
|
22
|
-
import os from "node:os";
|
|
23
22
|
import path from "node:path";
|
|
24
|
-
import {
|
|
23
|
+
import { envVar, sandboxHome } from "./config.js";
|
|
25
24
|
function cacheFilePath() {
|
|
26
|
-
return envVar("CACHE_FILE") || path.join(
|
|
25
|
+
return envVar("CACHE_FILE") || path.join(sandboxHome(), "issue-cache.json");
|
|
27
26
|
}
|
|
28
27
|
async function readStore() {
|
|
29
28
|
try {
|
package/dist/daemon_client.js
CHANGED
|
@@ -5,10 +5,8 @@
|
|
|
5
5
|
* Built-in `fetch` only — this ships inside the extension bundle.
|
|
6
6
|
*/
|
|
7
7
|
import * as fs from "node:fs";
|
|
8
|
-
import * as os from "node:os";
|
|
9
8
|
import * as path from "node:path";
|
|
10
|
-
import { envVar } from "./config.js";
|
|
11
|
-
import { dotDir } from "./dot_dir.js";
|
|
9
|
+
import { envVar, sandboxHome } from "./config.js";
|
|
12
10
|
import { SandboxError } from "./errors.js";
|
|
13
11
|
import { load } from "./global_config.js";
|
|
14
12
|
import { warn } from "./reporter.js";
|
|
@@ -50,7 +48,7 @@ function readToken(file) {
|
|
|
50
48
|
export function daemonToken(workspaceRoot) {
|
|
51
49
|
return (envVar("MCP_TOKEN") ||
|
|
52
50
|
(workspaceRoot ? readToken(workspaceTokenFile(workspaceRoot)) : null) ||
|
|
53
|
-
readToken(path.join(
|
|
51
|
+
readToken(path.join(sandboxHome(), "mcp-token")));
|
|
54
52
|
}
|
|
55
53
|
/**
|
|
56
54
|
* Thrown when the werkmeister daemon is not reachable: nothing is listening at {@link daemonUrl},
|
|
@@ -19,7 +19,7 @@ import { prDir, stageDirs, templateFor } from "./strategies/icm_templates.js";
|
|
|
19
19
|
const NAME = /^[a-z0-9][a-z0-9-]*$/;
|
|
20
20
|
const QUEUE_ENTRY = /^([a-z0-9][a-z0-9-]*)(?::(\d+)(?::([a-z0-9][a-z0-9-]*(?:,[a-z0-9][a-z0-9-]*)*))?)?$/;
|
|
21
21
|
// The only config.yaml keys --config may add: others (jira, github_ingest, paths…) reach real services or repos from a pre-approved run.
|
|
22
|
-
const CONFIG_KEYS = ["budget"];
|
|
22
|
+
const CONFIG_KEYS = ["budget", "workspace_ask_rules"];
|
|
23
23
|
export const FIXTURE_FEATURE = "demo";
|
|
24
24
|
export const FIXTURE_BRANCH = "me/demo";
|
|
25
25
|
export const FIXTURE_REPO_SLUG = "o/app";
|
package/dist/generate.d.ts
CHANGED
|
@@ -36,14 +36,6 @@ export declare function loadWorkspaceEnvVars(workspaceRoot: string): Record<stri
|
|
|
36
36
|
* start one for a repo with no container running.
|
|
37
37
|
*/
|
|
38
38
|
export declare function onDemandServices(servicesConfig: Record<string, unknown>, localServices: string[], workspaceRoot: string): string[];
|
|
39
|
-
/**
|
|
40
|
-
* SW-554: the host's Docker reads the compose file, but inside a container `sandboxRoot()`
|
|
41
|
-
* is the container's /app, so the install's script mount would name a path the host lacks
|
|
42
|
-
* and the install would run an empty script and exit 0. `WERKMEISTER_FEATURE` cannot be the
|
|
43
|
-
* test (a caller may unset it); Docker's marker is. A relocated config is a scratch run, as
|
|
44
|
-
* for the machine config (SW-354).
|
|
45
|
-
*/
|
|
46
|
-
export declare function refuseComposeInsideContainer(dockerenv?: string): void;
|
|
47
39
|
/**
|
|
48
40
|
* Generate `<workspace>/compose.yml` for *feature*.
|
|
49
41
|
*
|
package/dist/generate.js
CHANGED
|
@@ -18,9 +18,9 @@ import { candidateServiceNames } from "./archetypes.js";
|
|
|
18
18
|
import { applyCaches } from "./build_caches.js";
|
|
19
19
|
import { projectName } from "./compose.js";
|
|
20
20
|
import { COMPOSE_FILE, migrateWorkspaceCompose } from "./compose_file.js";
|
|
21
|
-
import { baselineUpstream, containerOf, DEFAULT_CPUS, DEFAULT_SETUP_CPUS, dotDir,
|
|
22
|
-
import { SandboxError } from "./errors.js";
|
|
21
|
+
import { baselineUpstream, containerOf, DEFAULT_CPUS, DEFAULT_SETUP_CPUS, dotDir, IDLE_SERVICE_TYPES, infraRoot, loadArchetypes, loadCaches, loadPorts, loadReposConfig, loadServices, loadSetupServices, resolveWorkspace, SHARED_VOLUME_MARKER, sandboxRoot, stateInfraRoot, } from "./config.js";
|
|
23
22
|
import { loadFeatureRouters } from "./feature_routing.js";
|
|
23
|
+
import { refuseInsideContainer } from "./global_config.js";
|
|
24
24
|
import { buildSandboxContextMd } from "./harness/claude/claude_md.js";
|
|
25
25
|
import { sandboxLock } from "./locks.js";
|
|
26
26
|
import { workspaceServices } from "./registry_sync.js";
|
|
@@ -728,27 +728,13 @@ function renderFeatureCompose(feature, slot, localServices, config, workspaceOve
|
|
|
728
728
|
const body = YAML.stringify(compose, { indentSeq: false, singleQuote: true });
|
|
729
729
|
return [outPath, header + body, "built-in"];
|
|
730
730
|
}
|
|
731
|
-
/**
|
|
732
|
-
* SW-554: the host's Docker reads the compose file, but inside a container `sandboxRoot()`
|
|
733
|
-
* is the container's /app, so the install's script mount would name a path the host lacks
|
|
734
|
-
* and the install would run an empty script and exit 0. `WERKMEISTER_FEATURE` cannot be the
|
|
735
|
-
* test (a caller may unset it); Docker's marker is. A relocated config is a scratch run, as
|
|
736
|
-
* for the machine config (SW-354).
|
|
737
|
-
*/
|
|
738
|
-
export function refuseComposeInsideContainer(dockerenv = "/.dockerenv") {
|
|
739
|
-
if (fs.existsSync(dockerenv) && !envVar("CONFIG_FILE")) {
|
|
740
|
-
throw new SandboxError(`Refusing to write ${COMPOSE_FILE} from inside a container: the host's Docker reads it, ` +
|
|
741
|
-
`and the werkmeister root here is the container's (${sandboxRoot()}).\n` +
|
|
742
|
-
" Run it from the host, or set WERKMEISTER_CONFIG_FILE to a scratch file.", "INSIDE_CONTAINER");
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
731
|
/**
|
|
746
732
|
* Generate `<workspace>/compose.yml` for *feature*.
|
|
747
733
|
*
|
|
748
734
|
* Returns the path to the generated workspace compose file.
|
|
749
735
|
*/
|
|
750
736
|
export function generateFeatureCompose(feature, slot, localServices, config = null, workspaceOverride = null, source = "werkmeister CLI") {
|
|
751
|
-
|
|
737
|
+
refuseInsideContainer(COMPOSE_FILE);
|
|
752
738
|
const [outPath, content, kind] = renderFeatureCompose(feature, slot, localServices, config, workspaceOverride, source);
|
|
753
739
|
fs.writeFileSync(outPath, content);
|
|
754
740
|
success(`Generated compose (${kind}): ${outPath}`);
|
|
@@ -783,7 +769,7 @@ export const GATE_COMPOSE_FILE = "compose.gate.yml";
|
|
|
783
769
|
* compose.yml's: their running containers lack the branch's container settings (SW-118).
|
|
784
770
|
*/
|
|
785
771
|
export function renderGateCompose(feature, slot, localServices, services, workspace) {
|
|
786
|
-
|
|
772
|
+
refuseInsideContainer(COMPOSE_FILE);
|
|
787
773
|
const [outPath, content] = renderFeatureCompose(feature, slot, localServices, { services }, workspace, "werkmeister pr gate");
|
|
788
774
|
const gate = YAML.parse(content)?.services ?? {};
|
|
789
775
|
const current = YAML.parse(fs.readFileSync(outPath, "utf8"))?.services ?? {};
|
package/dist/global_config.d.ts
CHANGED
|
@@ -51,26 +51,24 @@ export { configPath, modelPricingYamlPath, portsYamlPath, sandboxHome, servicesL
|
|
|
51
51
|
export declare function envShPath(): string;
|
|
52
52
|
/**
|
|
53
53
|
* Root of the code-standards source tree (`overrides.standards_dir` →
|
|
54
|
-
*
|
|
54
|
+
* `~/.werkmeister/standards`).
|
|
55
55
|
*
|
|
56
56
|
* The standards are one organization's *content*; the CLI is a reusable tool.
|
|
57
57
|
* This is the seam between them — point it at any directory laid out the way
|
|
58
58
|
* `loadStandardsModules` expects and `werkmeister standards check` gates it there
|
|
59
|
-
* too.
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* too. The default sits beside the registry files, outside the package: the
|
|
60
|
+
* tree must stay writable (`notes graduate` commits into it) and survive an
|
|
61
|
+
* upgrade, and `machine setup` seeds it (SW-640).
|
|
62
62
|
*/
|
|
63
63
|
export declare function standardsDirPath(): string;
|
|
64
64
|
/**
|
|
65
65
|
* Describe why the standards tree is unusable, or "" when it is fine.
|
|
66
66
|
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* a
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* routing table and no standards skills, and nothing says so. Every
|
|
73
|
-
* human-facing entry point reports this; the fail-open paths still don't.
|
|
67
|
+
* A missing tree reads as "no modules" to the loader, which carries on: right
|
|
68
|
+
* for a hook that must never block a launch, wrong for anything a human is
|
|
69
|
+
* watching (a workspace inits with an empty routing table and no standards
|
|
70
|
+
* skills, and nothing says so). Every human-facing entry point reports this;
|
|
71
|
+
* the fail-open paths still don't.
|
|
74
72
|
*/
|
|
75
73
|
export declare function standardsDirProblem(): string;
|
|
76
74
|
/**
|
|
@@ -191,12 +189,21 @@ export declare const _GITHUB_ORG_PROMPT: PromptSpec;
|
|
|
191
189
|
/** Ingress prompts — driven by `werkmeister machine setup`, alongside `_CONFIG_PROMPTS`. */
|
|
192
190
|
export declare const _INGRESS_PROMPTS: readonly PromptSpec[];
|
|
193
191
|
/**
|
|
194
|
-
* True inside any
|
|
195
|
-
* (`
|
|
196
|
-
*
|
|
197
|
-
* config layer does not import compose, docker and k8s.
|
|
192
|
+
* True inside any container: Docker writes `/.dockerenv`. Not the feature env
|
|
193
|
+
* (`WERKMEISTER_FEATURE`): a caller can unset it, and another workspace's
|
|
194
|
+
* container or a devcontainer lacks it (SW-554, SW-572).
|
|
198
195
|
*/
|
|
199
|
-
export declare function insideContainer(
|
|
196
|
+
export declare function insideContainer(dockerenv?: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Refuse to write a host file from inside a container. A workspace container
|
|
199
|
+
* runs with HOME set to the host home and the host's `~/.werkmeister`
|
|
200
|
+
* bind-mounted read-write, and its werkmeister root is the container's /app: a
|
|
201
|
+
* machine config written there pins the host to /app (SW-354), and a compose.yml
|
|
202
|
+
* names /app paths the host's Docker lacks (SW-554). A relocated config
|
|
203
|
+
* (`WERKMEISTER_CONFIG_FILE`) is a scratch run and writes, and so is a file
|
|
204
|
+
* under the container's own temp dir (a temp-HOME test, e.g. `machine migrate`).
|
|
205
|
+
*/
|
|
206
|
+
export declare function refuseInsideContainer(file: string, dockerenv?: string): void;
|
|
200
207
|
/** Write the config YAML (creating ~/.werkmeister/ as needed). */
|
|
201
208
|
export declare function save(cfg: GlobalConfig): string;
|
|
202
209
|
/** Render the `export WERKMEISTER_*=…` shell text from the config. */
|
package/dist/global_config.js
CHANGED
|
@@ -24,7 +24,7 @@ import * as fs from "node:fs";
|
|
|
24
24
|
import * as os from "node:os";
|
|
25
25
|
import * as path from "node:path";
|
|
26
26
|
import * as YAML from "yaml";
|
|
27
|
-
import { configPath,
|
|
27
|
+
import { configPath, DOT_DIR, envVar, expandUser, loadConfig, modelPricingYamlPath, portsYamlPath, sandboxHome, servicesLocalYamlPath, servicesYamlPath, } from "./config.js";
|
|
28
28
|
import { SandboxError } from "./errors.js";
|
|
29
29
|
// biome-ignore lint/suspicious/noImportCycles: global_config↔projects; SW-411
|
|
30
30
|
import { projectProblems } from "./projects.js";
|
|
@@ -53,32 +53,30 @@ export function envShPath() {
|
|
|
53
53
|
// Those exports (see _ENV_MAP) remain as the fallback for a shell.
|
|
54
54
|
/**
|
|
55
55
|
* Root of the code-standards source tree (`overrides.standards_dir` →
|
|
56
|
-
*
|
|
56
|
+
* `~/.werkmeister/standards`).
|
|
57
57
|
*
|
|
58
58
|
* The standards are one organization's *content*; the CLI is a reusable tool.
|
|
59
59
|
* This is the seam between them — point it at any directory laid out the way
|
|
60
60
|
* `loadStandardsModules` expects and `werkmeister standards check` gates it there
|
|
61
|
-
* too.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
61
|
+
* too. The default sits beside the registry files, outside the package: the
|
|
62
|
+
* tree must stay writable (`notes graduate` commits into it) and survive an
|
|
63
|
+
* upgrade, and `machine setup` seeds it (SW-640).
|
|
64
64
|
*/
|
|
65
65
|
export function standardsDirPath() {
|
|
66
66
|
const override = load()["overrides"]?.["standards_dir"];
|
|
67
67
|
if (override) {
|
|
68
68
|
return path.resolve(expandUser(String(override)));
|
|
69
69
|
}
|
|
70
|
-
return path.join(
|
|
70
|
+
return path.join(sandboxHome(), "standards");
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* Describe why the standards tree is unusable, or "" when it is fine.
|
|
74
74
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* a
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* routing table and no standards skills, and nothing says so. Every
|
|
81
|
-
* human-facing entry point reports this; the fail-open paths still don't.
|
|
75
|
+
* A missing tree reads as "no modules" to the loader, which carries on: right
|
|
76
|
+
* for a hook that must never block a launch, wrong for anything a human is
|
|
77
|
+
* watching (a workspace inits with an empty routing table and no standards
|
|
78
|
+
* skills, and nothing says so). Every human-facing entry point reports this;
|
|
79
|
+
* the fail-open paths still don't.
|
|
82
80
|
*/
|
|
83
81
|
export function standardsDirProblem() {
|
|
84
82
|
const dir = standardsDirPath();
|
|
@@ -390,24 +388,28 @@ const _HEADER = "# Global werkmeister configuration — single source of truth.\
|
|
|
390
388
|
"# Managed by `werkmeister machine config`; safe to hand-edit, then run " +
|
|
391
389
|
"`werkmeister machine config --check`.\n";
|
|
392
390
|
/**
|
|
393
|
-
* True inside any
|
|
394
|
-
* (`
|
|
395
|
-
*
|
|
396
|
-
* config layer does not import compose, docker and k8s.
|
|
391
|
+
* True inside any container: Docker writes `/.dockerenv`. Not the feature env
|
|
392
|
+
* (`WERKMEISTER_FEATURE`): a caller can unset it, and another workspace's
|
|
393
|
+
* container or a devcontainer lacks it (SW-554, SW-572).
|
|
397
394
|
*/
|
|
398
|
-
export function insideContainer(
|
|
399
|
-
return
|
|
395
|
+
export function insideContainer(dockerenv = "/.dockerenv") {
|
|
396
|
+
return fs.existsSync(dockerenv);
|
|
400
397
|
}
|
|
401
398
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
*
|
|
399
|
+
* Refuse to write a host file from inside a container. A workspace container
|
|
400
|
+
* runs with HOME set to the host home and the host's `~/.werkmeister`
|
|
401
|
+
* bind-mounted read-write, and its werkmeister root is the container's /app: a
|
|
402
|
+
* machine config written there pins the host to /app (SW-354), and a compose.yml
|
|
403
|
+
* names /app paths the host's Docker lacks (SW-554). A relocated config
|
|
404
|
+
* (`WERKMEISTER_CONFIG_FILE`) is a scratch run and writes, and so is a file
|
|
405
|
+
* under the container's own temp dir (a temp-HOME test, e.g. `machine migrate`).
|
|
406
406
|
*/
|
|
407
|
-
function refuseInsideContainer(file) {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
407
|
+
export function refuseInsideContainer(file, dockerenv = "/.dockerenv") {
|
|
408
|
+
// Absolute only: compose callers pass the bare name, which must not resolve against a /tmp cwd.
|
|
409
|
+
const scratch = path.isAbsolute(file) && file.startsWith(os.tmpdir() + path.sep);
|
|
410
|
+
if (insideContainer(dockerenv) && !envVar("CONFIG_FILE") && !scratch) {
|
|
411
|
+
throw new SandboxError(`Refusing to write ${file} from inside a container: the host's werkmeister reads it, ` +
|
|
412
|
+
"and the werkmeister root here is the container's /app.\n" +
|
|
411
413
|
" Run it from the host, or set WERKMEISTER_CONFIG_FILE to a scratch file.", "INSIDE_CONTAINER");
|
|
412
414
|
}
|
|
413
415
|
}
|
|
@@ -503,7 +505,8 @@ export function writeEnvSh(cfg) {
|
|
|
503
505
|
// ~/.zshenv managed block
|
|
504
506
|
// ---------------------------------------------------------------------------
|
|
505
507
|
function managedBlock() {
|
|
506
|
-
|
|
508
|
+
// The shell reads it at login, before any WERKMEISTER_CONFIG_FILE: the default home's name.
|
|
509
|
+
const home = DOT_DIR;
|
|
507
510
|
return (`${_ZSH_BEGIN}\n` +
|
|
508
511
|
"# Managed by `werkmeister machine config` — do not edit; regenerated on `werkmeister machine config`.\n" +
|
|
509
512
|
`[ -f "$HOME/${home}/env.sh" ] && . "$HOME/${home}/env.sh"\n` +
|
|
@@ -117,6 +117,7 @@ export declare function workspaceAllowRules(workspaceRoot: string, autonomous?:
|
|
|
117
117
|
* SW-473: `--exec-runs` runs the registry's rows on the host, so its forms of the pre-approved fixture
|
|
118
118
|
* wrapper and built CLI ask first. The CLI takes it only as the first fixture option, so a prefix catches it.
|
|
119
119
|
* SW-510: `node --test <file>` through the temp-HOME wrapper runs any file, one the agent just wrote too.
|
|
120
|
+
* SW-842: config.yaml `workspace_ask_rules: false` drops the node --test asks; the --exec-runs ones always stay.
|
|
120
121
|
*/
|
|
121
122
|
export declare function workspaceAskRules(workspaceRoot: string): string[];
|
|
122
123
|
/** The deny rules this workspace should have: AUTONOMOUS_DENY while `autonomous` is on. */
|
|
@@ -47,6 +47,7 @@ import { parse as parseYaml } from "yaml";
|
|
|
47
47
|
import { candidateServiceNames, containerTestCommand, isPlainChain, serviceTestCommand, wrappedTestCommand, } from "../../archetypes.js";
|
|
48
48
|
import { dotDir, expandUser, getReposRoot, loadArchetypes, loadReposConfig, loadServices, sandboxHome, sandboxRoot, } from "../../config.js";
|
|
49
49
|
import { frozenInstalls } from "../../fragment_detect/workspace.js";
|
|
50
|
+
import { load as loadGlobalConfig } from "../../global_config.js";
|
|
50
51
|
import { workspaceServices } from "../../registry_sync.js";
|
|
51
52
|
import { info } from "../../reporter.js";
|
|
52
53
|
import { repoDirs } from "../../standards.js";
|
|
@@ -585,19 +586,24 @@ function builtCliWrappers(workspaceRoot) {
|
|
|
585
586
|
* SW-473: `--exec-runs` runs the registry's rows on the host, so its forms of the pre-approved fixture
|
|
586
587
|
* wrapper and built CLI ask first. The CLI takes it only as the first fixture option, so a prefix catches it.
|
|
587
588
|
* SW-510: `node --test <file>` through the temp-HOME wrapper runs any file, one the agent just wrote too.
|
|
589
|
+
* SW-842: config.yaml `workspace_ask_rules: false` drops the node --test asks; the --exec-runs ones always stay.
|
|
588
590
|
*/
|
|
589
591
|
export function workspaceAskRules(workspaceRoot) {
|
|
590
592
|
const tempHome = tempHomeWrapper(workspaceRoot);
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
593
|
+
// Only the boolean turns them off: a typo or string keeps the asks. Every settings writer and migrate read them here.
|
|
594
|
+
const nodeTestOff = loadGlobalConfig()["workspace_ask_rules"] === false;
|
|
595
|
+
const nodeTest = nodeTestOff
|
|
596
|
+
? []
|
|
597
|
+
: [
|
|
598
|
+
`Bash(${tempHome} env WERKMEISTER_ROOT=* node --test*)`,
|
|
599
|
+
`Bash(${tempHome} --no-wait env WERKMEISTER_ROOT=* node --test*)`,
|
|
600
|
+
// SW-720: the probe form werkmeister-context.md names; an ask, so auto mode prompts instead of denying it.
|
|
601
|
+
`Bash(${tempHome} node --test*)`,
|
|
602
|
+
`Bash(${tempHome} --no-wait node --test*)`,
|
|
603
|
+
// The same form in the service's container, where a host without node_modules runs it.
|
|
604
|
+
`Bash(docker exec * ${tempHome} node --test*)`,
|
|
605
|
+
`Bash(docker exec * ${tempHome} --no-wait node --test*)`,
|
|
606
|
+
];
|
|
601
607
|
const builtClis = builtCliWrappers(workspaceRoot);
|
|
602
608
|
if (!builtClis.length)
|
|
603
609
|
return nodeTest;
|
package/dist/lifecycle.js
CHANGED
|
@@ -864,7 +864,8 @@ export function grantInBackground() {
|
|
|
864
864
|
async function grantWaitersNow() {
|
|
865
865
|
const started = [];
|
|
866
866
|
for (const feature of readQueue()) {
|
|
867
|
-
|
|
867
|
+
// A lease pruned by a process that can't see the folder must not cost the waiter its start (SW-848).
|
|
868
|
+
const workspace = readLeases()[feature]?.workspace || workspaceForFeature(feature);
|
|
868
869
|
if (!workspace) {
|
|
869
870
|
await dequeue(feature);
|
|
870
871
|
continue;
|
|
@@ -887,10 +888,17 @@ async function grantWaitersNow() {
|
|
|
887
888
|
}
|
|
888
889
|
catch (e) {
|
|
889
890
|
// One waiter's failed re-up (HOST_LOAD, NO_COMPOSE, ...) must not end the pass for the rest (SW-737).
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
const message = `Could not start '${feature}' from the waiting queue: ${e.message}`;
|
|
892
|
+
warn(message);
|
|
893
|
+
// Admission already dropped it (never fits, or a start that failed after admit): only its session can act (SW-682, SW-848).
|
|
894
|
+
if (!readQueue().includes(feature)) {
|
|
895
|
+
clearWaiting(workspace);
|
|
896
|
+
// A never-fits rerun would fail the same way; its message already says what to change.
|
|
897
|
+
const neverFits = e instanceof SandboxError && e.code === "NEVER_FITS";
|
|
898
|
+
writeNudge(workspace, neverFits
|
|
899
|
+
? message
|
|
900
|
+
: `${message}\nIt left the queue: run \`werkmeister feature up\` to queue it again.`);
|
|
901
|
+
}
|
|
894
902
|
continue;
|
|
895
903
|
}
|
|
896
904
|
// Backfill (SW-675): a later waiter may fit; admission itself holds the room for a starved head.
|
package/dist/locks.js
CHANGED
|
@@ -27,11 +27,10 @@
|
|
|
27
27
|
* insufficient.
|
|
28
28
|
*/
|
|
29
29
|
import * as fs from "node:fs";
|
|
30
|
-
import * as os from "node:os";
|
|
31
30
|
import * as path from "node:path";
|
|
32
31
|
import { setTimeout as sleep } from "node:timers/promises";
|
|
33
|
-
import {
|
|
34
|
-
const lockDir = () => path.join(
|
|
32
|
+
import { sandboxHome } from "./config.js";
|
|
33
|
+
const lockDir = () => path.join(sandboxHome(), "locks");
|
|
35
34
|
// Poll interval (seconds) for the retry loop.
|
|
36
35
|
const _RETRY_INTERVAL = 0.1;
|
|
37
36
|
/** True when the PID recorded in the lock file no longer belongs to a live process. */
|
package/dist/machine_setup.d.ts
CHANGED
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
* this repo serves at `.claude-plugin/marketplace.json`) — carries the
|
|
15
15
|
* ops skills. An install of its old name (`sandbox-tools@sandbox`) is // name-check: ignore
|
|
16
16
|
* swapped out once the new one is in;
|
|
17
|
-
* * the **
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the wizard asks and the answer is yes. Nothing references it, so a
|
|
21
|
-
* decline is reported ok rather than as drift;
|
|
17
|
+
* * the **optional plugins** (user scope: superpowers, ponytail) — each
|
|
18
|
+
* installed only when the wizard asks and the answer is yes, then kept
|
|
19
|
+
* current. A decline is reported ok rather than as drift;
|
|
22
20
|
* * the **companion sandbox-workspace checkout** under the repos root —
|
|
23
21
|
* `werkmeister workspace new` creates each workspace root as a worktree of it
|
|
24
22
|
* (plain-directory fallback with a warning when it is missing). Which repo
|
|
@@ -500,8 +498,8 @@ export interface RunSetupOptions {
|
|
|
500
498
|
skipSudo?: boolean;
|
|
501
499
|
/** Install Telepresence via Homebrew when it is missing or stale. */
|
|
502
500
|
installTelepresence?: boolean;
|
|
503
|
-
/**
|
|
504
|
-
|
|
501
|
+
/** Names from OPTIONAL_PLUGINS to install when missing (the wizard asks for each). */
|
|
502
|
+
optionalPlugins?: readonly string[];
|
|
505
503
|
/** Map the werkmeister YAML schemas in VS Code's user settings (the wizard asks first). */
|
|
506
504
|
mapEditorSchemas?: boolean;
|
|
507
505
|
/** Install the bundled Werkmeister Workspaces VS Code extension (the wizard asks first). */
|
package/dist/machine_setup.js
CHANGED
|
@@ -14,11 +14,9 @@
|
|
|
14
14
|
* this repo serves at `.claude-plugin/marketplace.json`) — carries the
|
|
15
15
|
* ops skills. An install of its old name (`sandbox-tools@sandbox`) is // name-check: ignore
|
|
16
16
|
* swapped out once the new one is in;
|
|
17
|
-
* * the **
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* the wizard asks and the answer is yes. Nothing references it, so a
|
|
21
|
-
* decline is reported ok rather than as drift;
|
|
17
|
+
* * the **optional plugins** (user scope: superpowers, ponytail) — each
|
|
18
|
+
* installed only when the wizard asks and the answer is yes, then kept
|
|
19
|
+
* current. A decline is reported ok rather than as drift;
|
|
22
20
|
* * the **companion sandbox-workspace checkout** under the repos root —
|
|
23
21
|
* `werkmeister workspace new` creates each workspace root as a worktree of it
|
|
24
22
|
* (plain-directory fallback with a warning when it is missing). Which repo
|
|
@@ -55,12 +53,12 @@ import * as path from "node:path";
|
|
|
55
53
|
import { applyEdits, modify, parse as parseJsonc } from "jsonc-parser";
|
|
56
54
|
import { expandUser, getReposRoot, isFixture, sandboxHome, sandboxRoot, servicesLocalYamlPath, } from "./config.js";
|
|
57
55
|
import { daemonUrl } from "./daemon_client.js";
|
|
58
|
-
import { configPath, loadIngress, loadJira, loadPaths as loadPathsSection, loadWorkspaceRepo, modelPricingYamlPath, portsYamlPath, secretsPath, standardsDirPath, } from "./global_config.js";
|
|
56
|
+
import { configPath, load, loadIngress, loadJira, loadPaths as loadPathsSection, loadWorkspaceRepo, modelPricingYamlPath, portsYamlPath, secretsPath, standardsDirPath, } from "./global_config.js";
|
|
59
57
|
import { JIRA_PLACEHOLDERS } from "./jira-rest.js";
|
|
60
58
|
import { LEGACY_PLUGIN_NAME, PLUGIN_NAME, pluginDriftWarnings } from "./plugin_check.js";
|
|
61
59
|
import { ProcError, run } from "./proc.js";
|
|
62
60
|
import { syncRegistry } from "./registry_sync.js";
|
|
63
|
-
import { DEFAULT_MODEL_PRICING_YAML, DEFAULT_PORTS_YAML, renderSecretsEnv, renderServicesLocalYaml, seedFile, } from "./scaffold.js";
|
|
61
|
+
import { DEFAULT_MODEL_PRICING_YAML, DEFAULT_PORTS_YAML, renderSecretsEnv, renderServicesLocalYaml, STANDARDS_README, seedFile, } from "./scaffold.js";
|
|
64
62
|
import { BREW_FORMULA, DOWNLOAD_HINT, INSTALL_HINT, MIN_VERSION, parseVersion, versionLt, } from "./telepresence.js";
|
|
65
63
|
import { PLAYWRIGHT_VERSION } from "./test_run.js";
|
|
66
64
|
import { appEntry, DAEMON_LABEL, daemonPlistPath, MCP, stop as stopWebServer, } from "./web_servers.js";
|
|
@@ -83,11 +81,6 @@ export const REQUIRED_PLUGINS = [
|
|
|
83
81
|
marketplace: "werkmeister",
|
|
84
82
|
source: "jbbz-sandbox/werkmeister@main",
|
|
85
83
|
},
|
|
86
|
-
{
|
|
87
|
-
name: "ponytail",
|
|
88
|
-
marketplace: "ponytail",
|
|
89
|
-
source: "DietrichGebert/ponytail",
|
|
90
|
-
},
|
|
91
84
|
];
|
|
92
85
|
/**
|
|
93
86
|
* The plugin and marketplace as named before SW-9. Claude Code has no alias for a
|
|
@@ -171,6 +164,13 @@ export const OPTIONAL_PLUGINS = [
|
|
|
171
164
|
source: "anthropics/claude-plugins-official",
|
|
172
165
|
note: "brainstorming/planning skills; writes plans under docs/superpowers/",
|
|
173
166
|
},
|
|
167
|
+
{
|
|
168
|
+
// A coding-style plugin: opt-in, not required (SW-643). A machine that has it keeps it current.
|
|
169
|
+
name: "ponytail",
|
|
170
|
+
marketplace: "ponytail",
|
|
171
|
+
source: "DietrichGebert/ponytail",
|
|
172
|
+
note: "smallest-change coding style; the ICM contracts use it when loaded",
|
|
173
|
+
},
|
|
174
174
|
];
|
|
175
175
|
// The workspace ROOT is itself a worktree of this dedicated repo on the same
|
|
176
176
|
// <user>/<workspace> branch as the repo worktrees inside it. Everything
|
|
@@ -711,8 +711,36 @@ export function syncRegistryConfigs(checkOnly, options = {}) {
|
|
|
711
711
|
steps.push({ label, ok: false, detail: `could not write ${secrets}: ${e}` });
|
|
712
712
|
}
|
|
713
713
|
}
|
|
714
|
+
steps.push(seedStandardsDir(checkOnly));
|
|
714
715
|
return steps;
|
|
715
716
|
}
|
|
717
|
+
/**
|
|
718
|
+
* SW-640: seed the default standards tree, so a fresh install has one. A
|
|
719
|
+
* configured `overrides.standards_dir` is the person's to provide: `machine
|
|
720
|
+
* config --check` names it when missing, and this never creates it.
|
|
721
|
+
*/
|
|
722
|
+
function seedStandardsDir(checkOnly) {
|
|
723
|
+
const label = "config standards/";
|
|
724
|
+
const dir = standardsDirPath();
|
|
725
|
+
if (load()["overrides"]?.["standards_dir"]) {
|
|
726
|
+
return { label, ok: true, detail: `overrides.standards_dir → ${dir}` };
|
|
727
|
+
}
|
|
728
|
+
if (fs.existsSync(dir))
|
|
729
|
+
return { label, ok: true, detail: `present at ${dir}` };
|
|
730
|
+
if (checkOnly)
|
|
731
|
+
return { label, ok: true, detail: `absent — would create ${dir}` };
|
|
732
|
+
try {
|
|
733
|
+
seedFile(path.join(dir, "README.md"), STANDARDS_README);
|
|
734
|
+
return {
|
|
735
|
+
label,
|
|
736
|
+
ok: true,
|
|
737
|
+
detail: `created ${dir} — add standard modules, or point overrides.standards_dir at a shared tree`,
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
catch (e) {
|
|
741
|
+
return { label, ok: false, detail: `could not write ${dir}: ${e}` };
|
|
742
|
+
}
|
|
743
|
+
}
|
|
716
744
|
// --- TLS certificates for the ingress hostnames -----------------------------
|
|
717
745
|
/**
|
|
718
746
|
* Locate `bin/generate-certs.sh`, walking up from the CLI package root.
|
|
@@ -794,7 +822,13 @@ export function syncIngressCerts(checkOnly, options, interactive) {
|
|
|
794
822
|
}
|
|
795
823
|
const rc = (interactive ?? defaultInteractiveRunner)(cmd);
|
|
796
824
|
if (rc !== 0) {
|
|
797
|
-
return [
|
|
825
|
+
return [
|
|
826
|
+
{
|
|
827
|
+
label,
|
|
828
|
+
ok: false,
|
|
829
|
+
detail: `generate-certs.sh failed (exit ${rc}); its failing line is printed above`,
|
|
830
|
+
},
|
|
831
|
+
];
|
|
798
832
|
}
|
|
799
833
|
const detail = `${ingress.certs_dir} covers ${hostnames.join(", ")}`;
|
|
800
834
|
if (options.skipSudo) {
|
|
@@ -1785,7 +1819,7 @@ export async function runSetup(options = {}) {
|
|
|
1785
1819
|
steps.push({
|
|
1786
1820
|
label: "claude CLI",
|
|
1787
1821
|
ok: false,
|
|
1788
|
-
detail:
|
|
1822
|
+
detail: "not found on PATH — the Claude Code plugins cannot be " +
|
|
1789
1823
|
"installed without it. Install Claude Code from " +
|
|
1790
1824
|
"https://claude.com/claude-code (the VS Code extension alone does not " +
|
|
1791
1825
|
"put `claude` on PATH), then re-run `werkmeister machine setup`.",
|
|
@@ -1804,7 +1838,7 @@ export async function runSetup(options = {}) {
|
|
|
1804
1838
|
}
|
|
1805
1839
|
}
|
|
1806
1840
|
for (const spec of OPTIONAL_PLUGINS) {
|
|
1807
|
-
steps.push(...syncOptionalPlugin(spec, claudePluginsDir, runner, checkOnly, options.
|
|
1841
|
+
steps.push(...syncOptionalPlugin(spec, claudePluginsDir, runner, checkOnly, options.optionalPlugins?.includes(spec.name) ?? false));
|
|
1808
1842
|
}
|
|
1809
1843
|
}
|
|
1810
1844
|
// Fall back to the gh-derived default so a machine configured before this
|
package/dist/migrate.js
CHANGED
|
@@ -14,7 +14,7 @@ import * as os from "node:os";
|
|
|
14
14
|
import * as path from "node:path";
|
|
15
15
|
import { parse as parseYaml } from "yaml";
|
|
16
16
|
import { COMPOSE_FILE, LEGACY_COMPOSE_FILE } from "./compose_file.js";
|
|
17
|
-
import { configPath, envVar, expandUser, servicesLocalYamlPath, servicesYamlPath, workspacesRoot, } from "./config.js";
|
|
17
|
+
import { configPath, envVar, expandUser, sandboxHome, servicesLocalYamlPath, servicesYamlPath, workspacesRoot, } from "./config.js";
|
|
18
18
|
import { docker } from "./docker.js";
|
|
19
19
|
import { DOT_DIR, dotDir } from "./dot_dir.js";
|
|
20
20
|
import { writeFixtureWrapper } from "./fixture_workspace.js";
|
|
@@ -24,7 +24,7 @@ import { HARNESS_IDS } from "./harness/types.js";
|
|
|
24
24
|
import { installPrWatchSchedule, prWatchScheduleState, } from "./machine_setup.js";
|
|
25
25
|
import { resolveModel } from "./model_tiers.js";
|
|
26
26
|
import { syncRegistry } from "./registry_sync.js";
|
|
27
|
-
import { tempHomeWrapper, writeTempHomeWrapper } from "./temp_home.js";
|
|
27
|
+
import { TEMP_HOME_SCRIPT, tempHomeWrapper, writeTempHomeWrapper } from "./temp_home.js";
|
|
28
28
|
import { writeWorkspaceConfig } from "./workspace_init.js";
|
|
29
29
|
import { readModel, readWorkspaceField } from "./workspace_prompts.js";
|
|
30
30
|
export const LEGACY_DOT_DIR = ".sandbox";
|
|
@@ -289,9 +289,8 @@ export async function migrate(opts = {}) {
|
|
|
289
289
|
steps.push(...nounGroupSteps(wsRoot, checkOnly), modelStep(wsRoot, checkOnly));
|
|
290
290
|
return steps;
|
|
291
291
|
}
|
|
292
|
-
// What the CLI wrote with a pre-SW-186 spelling: hook commands
|
|
292
|
+
// What the CLI wrote with a pre-SW-186 spelling: hook commands.
|
|
293
293
|
const PRE_SW186_HOOK = /werkmeister (?:hooks (?:gate|pr-guard|agent-state)|stop --if-idle)/;
|
|
294
|
-
const PRE_SW186_WAIT = "werkmeister wait-load";
|
|
295
294
|
function readJson(file) {
|
|
296
295
|
try {
|
|
297
296
|
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
@@ -300,7 +299,7 @@ function readJson(file) {
|
|
|
300
299
|
return null;
|
|
301
300
|
}
|
|
302
301
|
}
|
|
303
|
-
/** True when *dir*'s hooks
|
|
302
|
+
/** True when *dir*'s hooks or permission rules are out of date, or its with-temp-home differs from this CLI's (SW-416). */
|
|
304
303
|
function workspaceStale(dir) {
|
|
305
304
|
const settingsFile = path.join(dir, ".claude", "settings.json");
|
|
306
305
|
// Never inited by this CLI: `workspace init` writes it, not migrate.
|
|
@@ -320,14 +319,19 @@ function workspaceStale(dir) {
|
|
|
320
319
|
AGENT_STATE_EVENTS.some((e) => !agentState(e));
|
|
321
320
|
const wanted = workspaceAllowRules(dir);
|
|
322
321
|
// SW-521: a rule werkmeister recorded but no longer generates (`Bash(node:*)`) stays allowed until a refresh.
|
|
323
|
-
const
|
|
322
|
+
const record = readJson(path.join(dotDir(dir), "claude-permissions.json"));
|
|
323
|
+
const recorded = record?.["allow"] ?? [];
|
|
324
|
+
const askWanted = workspaceAskRules(dir);
|
|
325
|
+
// SW-842: an ask the machine opt-out no longer wants is stale too, so migrate removes it.
|
|
326
|
+
const recordedAsk = record?.["ask"] ?? [];
|
|
324
327
|
return (missingEvents ||
|
|
325
328
|
PRE_SW186_HOOK.test(fs.readFileSync(settingsFile, "utf8")) ||
|
|
326
329
|
wanted.some((r) => !allow.has(r)) ||
|
|
327
330
|
recorded.some((r) => !wanted.includes(r)) ||
|
|
328
331
|
workspaceDenyRules(dir).some((r) => !deny.has(r)) ||
|
|
329
|
-
|
|
330
|
-
|
|
332
|
+
askWanted.some((r) => !ask.has(r)) ||
|
|
333
|
+
recordedAsk.some((r) => !askWanted.includes(r)) ||
|
|
334
|
+
(fs.existsSync(wrapper) && fs.readFileSync(wrapper, "utf8") !== TEMP_HOME_SCRIPT));
|
|
331
335
|
}
|
|
332
336
|
/**
|
|
333
337
|
* SW-161: drop the pre-rename `SANDBOX_MCP_TOKEN` and set `WERKMEISTER_MCP_TOKEN` from
|
|
@@ -340,7 +344,7 @@ function secretsStep(checkOnly) {
|
|
|
340
344
|
if (!/^\s*SANDBOX_MCP_TOKEN=/m.test(text)) {
|
|
341
345
|
return { label, ok: true, detail: "no pre-rename keys" };
|
|
342
346
|
}
|
|
343
|
-
const tokenFile = path.join(
|
|
347
|
+
const tokenFile = path.join(sandboxHome(), "mcp-token");
|
|
344
348
|
const token = fs.existsSync(tokenFile) ? fs.readFileSync(tokenFile, "utf8").trim() : "";
|
|
345
349
|
if (!token) {
|
|
346
350
|
return {
|
package/dist/pr_lifecycle.js
CHANGED
|
@@ -2709,7 +2709,7 @@ export function abandonWorkspace(ws, why) {
|
|
|
2709
2709
|
fs.writeFileSync(path.join(ws, "closeout.md"), renderCloseout(files, "not closed (abandoned)", `Abandoned: ${why}`));
|
|
2710
2710
|
}
|
|
2711
2711
|
/** The VS Code extension's terminal.ts writes one file per session shell pid here, holding its cwd (SW-421). */
|
|
2712
|
-
const vscodeTerminalsDir = () => path.join(
|
|
2712
|
+
const vscodeTerminalsDir = () => path.join(sandboxHome(), "vscode-terminals");
|
|
2713
2713
|
const isIn = (ws, dir) => dir === ws || dir.startsWith(ws + path.sep);
|
|
2714
2714
|
/** Shell pid → cwd of the extension's session terminals whose cwd is in *ws*. */
|
|
2715
2715
|
function vscodeSessionsIn(ws, dir) {
|
package/dist/sandbox.js
CHANGED
|
@@ -1140,7 +1140,7 @@ export async function resolveWorkspaceDir(name) {
|
|
|
1140
1140
|
return target;
|
|
1141
1141
|
}
|
|
1142
1142
|
/** Root for throwaway PR-reconcile session dirs (one per `<repo>-<number>`). */
|
|
1143
|
-
const reconcileRoot = () => path.join(
|
|
1143
|
+
const reconcileRoot = () => path.join(sandboxHome(), "reconcile");
|
|
1144
1144
|
/** A chat-session key that names a PR-reconcile dir instead of a workspace. */
|
|
1145
1145
|
const RECONCILE_PREFIX = "reconcile:";
|
|
1146
1146
|
/** Map a reconcile key (`reconcile:<slug>`) to its dir under `reconcileRoot`. */
|
package/dist/scaffold.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export declare function renderServicesLocalYaml(k8sContext: string): string;
|
|
|
44
44
|
* machine without touching them.
|
|
45
45
|
*/
|
|
46
46
|
export declare function seedFile(target: string, content: string, mode?: number): SeedResult;
|
|
47
|
+
/** The README `machine setup` seeds into the default standards tree (SW-640). */
|
|
48
|
+
export declare const STANDARDS_README = "# Coding standards\n\nwerkmeister reads this folder's standard modules into each workspace. Each\nworkspace gets a routing table, the `w9r-*-standard` skills and the\n`_shared/standards.md` rows. `werkmeister standards check` validates the folder.\n\nA module is `<domain>.md` or `<domain>/STANDARD.md`, with frontmatter:\n\n ---\n domain: testing\n applies_to: [\"**/*.test.ts\"]\n phase: [implement, review]\n summary: One line on what the module covers.\n ---\n\nTo share one tree across a team, clone it and set `overrides.standards_dir`\nto its path in `~/.werkmeister/config.yaml`. `machine setup` writes this\nfile only when it is missing and never overwrites it.\n";
|
|
47
49
|
/**
|
|
48
50
|
* The `archetypes:` and `mcp_servers:` registries. Owned by werkmeister, not
|
|
49
51
|
* by any app repo: `standards:` keys must match a docs/standards/<key>.md
|
package/dist/scaffold.js
CHANGED
|
@@ -127,6 +127,26 @@ export function seedFile(target, content, mode = 0o644) {
|
|
|
127
127
|
fs.chmodSync(target, mode);
|
|
128
128
|
return { path: target, status: "created" };
|
|
129
129
|
}
|
|
130
|
+
/** The README `machine setup` seeds into the default standards tree (SW-640). */
|
|
131
|
+
export const STANDARDS_README = `# Coding standards
|
|
132
|
+
|
|
133
|
+
werkmeister reads this folder's standard modules into each workspace. Each
|
|
134
|
+
workspace gets a routing table, the \`w9r-*-standard\` skills and the
|
|
135
|
+
\`_shared/standards.md\` rows. \`werkmeister standards check\` validates the folder.
|
|
136
|
+
|
|
137
|
+
A module is \`<domain>.md\` or \`<domain>/STANDARD.md\`, with frontmatter:
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
domain: testing
|
|
141
|
+
applies_to: ["**/*.test.ts"]
|
|
142
|
+
phase: [implement, review]
|
|
143
|
+
summary: One line on what the module covers.
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
To share one tree across a team, clone it and set \`overrides.standards_dir\`
|
|
147
|
+
to its path in \`~/.werkmeister/config.yaml\`. \`machine setup\` writes this
|
|
148
|
+
file only when it is missing and never overwrites it.
|
|
149
|
+
`;
|
|
130
150
|
// ---------------------------------------------------------------------------
|
|
131
151
|
// Registry defaults (werkmeister-owned; merged under every repo's fragment)
|
|
132
152
|
// ---------------------------------------------------------------------------
|
package/dist/slots.js
CHANGED
|
@@ -19,11 +19,10 @@
|
|
|
19
19
|
* Every lease read-modify-write is under `~/.werkmeister/locks/allocate.lock`.
|
|
20
20
|
*/
|
|
21
21
|
import * as fs from "node:fs";
|
|
22
|
-
import * as os from "node:os";
|
|
23
22
|
import * as path from "node:path";
|
|
24
23
|
// biome-ignore lint/suspicious/noImportCycles: compose↔slots; SW-411
|
|
25
24
|
import { workspaceForFeature } from "./compose.js";
|
|
26
|
-
import { baselineUpstream,
|
|
25
|
+
import { baselineUpstream, loadPorts, loadServices, sandboxHome, slotPortRange } from "./config.js";
|
|
27
26
|
import { docker } from "./docker.js";
|
|
28
27
|
import { SandboxError } from "./errors.js";
|
|
29
28
|
import { sandboxLock } from "./locks.js";
|
|
@@ -393,7 +392,7 @@ export async function featureServices(feature) {
|
|
|
393
392
|
* as forgotten -- they have no live state to migrate.
|
|
394
393
|
*/
|
|
395
394
|
export async function migrateSlotsJson() {
|
|
396
|
-
const legacy = path.join(
|
|
395
|
+
const legacy = path.join(sandboxHome(), "slots.json");
|
|
397
396
|
if (!fs.existsSync(legacy)) {
|
|
398
397
|
return;
|
|
399
398
|
}
|
package/dist/strategies/icm.js
CHANGED
|
@@ -24,8 +24,9 @@ import { _INPUT_FIELDS, isTrue, loadConfigFile, loadSandboxServiceConfigs, } fro
|
|
|
24
24
|
import { stageDecisions } from "./icm_decisions.js";
|
|
25
25
|
import { askLine, prDir, proposeDir, SELF_CHECK, stageDirs, templateFor, } from "./icm_templates.js";
|
|
26
26
|
import { renderIssueRef } from "./issue_section.js";
|
|
27
|
-
const PONYTAIL_ROW = "| ponytail |
|
|
28
|
-
"in every session. Invoke the `ponytail` skill only if that line is missing
|
|
27
|
+
const PONYTAIL_ROW = "| ponytail | optional plugin (SW-643): when installed, its SessionStart hook prints `PONYTAIL MODE ACTIVE` " +
|
|
28
|
+
"in every session. Invoke the `ponytail` skill only if that line is missing and the skill is listed; " +
|
|
29
|
+
"without the plugin, make the smallest change that fully solves the task " +
|
|
29
30
|
"| any code edit |";
|
|
30
31
|
function list(s) {
|
|
31
32
|
return (s ?? "")
|
package/dist/web_servers.js
CHANGED
|
@@ -24,7 +24,7 @@ import * as fs from "node:fs";
|
|
|
24
24
|
import * as net from "node:net";
|
|
25
25
|
import * as os from "node:os";
|
|
26
26
|
import * as path from "node:path";
|
|
27
|
-
import {
|
|
27
|
+
import { monorepoRoot, sandboxHome, sandboxRoot, sharedProxySkipReason } from "./config.js";
|
|
28
28
|
import { daemonPort } from "./daemon_client.js";
|
|
29
29
|
import { ProcError, run } from "./proc.js";
|
|
30
30
|
import { error, info, success, warn } from "./reporter.js";
|
|
@@ -139,7 +139,7 @@ async function freePort(port) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
function stateDir() {
|
|
142
|
-
const d =
|
|
142
|
+
const d = sandboxHome();
|
|
143
143
|
fs.mkdirSync(d, { recursive: true });
|
|
144
144
|
return d;
|
|
145
145
|
}
|
|
@@ -345,6 +345,13 @@ export function appEntryPath(app) {
|
|
|
345
345
|
* without it, an already-running server that still serves is left as-is.
|
|
346
346
|
*/
|
|
347
347
|
export async function start(app = DASHBOARD, build = true, force = false) {
|
|
348
|
+
// The servers own fixed machine ports; a relocated home can't see their PID files,
|
|
349
|
+
// so it would free the port out from under the host's (SW-622, as for Caddy in SW-279).
|
|
350
|
+
const skip = sharedProxySkipReason();
|
|
351
|
+
if (skip) {
|
|
352
|
+
info(`${app.label}: ${skip}; leaving the machine's server on port ${app.port} alone`);
|
|
353
|
+
return serves(app.port);
|
|
354
|
+
}
|
|
348
355
|
const [running, pid] = isRunning(app);
|
|
349
356
|
// Never bounce ourselves. `werkmeister infra connect` is a tool on apps/werkmeister-mcp, and it
|
|
350
357
|
// reaches infra.up() -> startAll(): a stale dist/ would otherwise make this
|
|
@@ -476,6 +483,11 @@ export async function stop(app = DASHBOARD) {
|
|
|
476
483
|
info(`${app.label} is kept up by launchd (${DAEMON_LABEL}); leaving it running`);
|
|
477
484
|
return false;
|
|
478
485
|
}
|
|
486
|
+
const skip = sharedProxySkipReason();
|
|
487
|
+
if (skip) {
|
|
488
|
+
info(`${app.label}: ${skip}; leaving the machine's server on port ${app.port} alone`);
|
|
489
|
+
return false;
|
|
490
|
+
}
|
|
479
491
|
const [running, pid] = isRunning(app);
|
|
480
492
|
if (!running || pid === null) {
|
|
481
493
|
fs.rmSync(pidFile(app), { force: true });
|
package/dist/workspace_token.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { randomBytes } from "node:crypto";
|
|
12
12
|
import * as fs from "node:fs";
|
|
13
|
-
import * as os from "node:os";
|
|
14
13
|
import * as path from "node:path";
|
|
14
|
+
import { sandboxHome } from "./config.js";
|
|
15
15
|
import { dotDir } from "./dot_dir.js";
|
|
16
16
|
export const WORKSPACE_TOKEN_FILE = "token";
|
|
17
17
|
export function tokensDir() {
|
|
18
|
-
return path.join(
|
|
18
|
+
return path.join(sandboxHome(), "tokens");
|
|
19
19
|
}
|
|
20
20
|
/** The token a container in this workspace sends, git-ignored (worktrees.ts). */
|
|
21
21
|
export function workspaceTokenFile(workspaceRoot) {
|
package/package.json
CHANGED