Move harness profiles between host and Docker and stop silent draft retargeting
Native installs left Docker-era harness profiles in harnesses.json, so every authoring launch failed trying to reach a Docker service, and a retained draft bound to the old Docker server was silently projected onto the configured one. - harness: add Profile.Mode and VerifyDockerLink as the single mode/verification helpers. `harness setup --host` configures or converts a host profile and clears docker_directory; reconfiguring a Docker-linked profile re-verifies the recorded directory still owns compose.yaml and fails naming it instead of saving a link that cannot launch. Setup's summary and `harness list` (via the new List/ListView shape) report the resulting mode and, for Docker, the directory, without changing the stored Config schema. - setup-native.py: after build/install-skill it writes host (no docker_directory) profiles for the detected harnesses, defaulting to the detected OpenCode profile rather than a stale pi default, taking models from --model or the existing valid profile and never inventing one; it clears a stale Docker link and preserves unrelated keys/profiles. Detection-only: no harness install, upgrade or download. - draft: add Draft.Resolve, the shared mismatch helper, which projects a draft onto the configured server and returns a dual-URL notice. CLI validate/submit and the TUI draft browser use it so a foreign draft is never silently retargeted; the TUI pre-wraps the notice to the panel width. - Tests cover the Docker->host and host->host transitions, the missing-directory failure, installer write/migration (Python), and the CLI/TUI notice, using the real config file path in a temp dir. - Update help text, README, docs and the packaged authoring skill reference to describe host as the default and the Docker-linked case.
This commit is contained in:
@@ -30,6 +30,22 @@ func (d Draft) ForServer(server string) Draft {
|
||||
return d
|
||||
}
|
||||
|
||||
// Resolve projects this retained draft onto the configured server and reports a
|
||||
// user-visible notice when the draft was created against a different server.
|
||||
// The projection through ForServer keeps cross-server publication create-only,
|
||||
// so the original version never leaks; the notice names both URLs so neither the
|
||||
// CLI nor the TUI silently retargets a foreign draft. The returned notice is
|
||||
// empty when the draft already matches (or records no server).
|
||||
func (d Draft) Resolve(configured string) (Draft, string) {
|
||||
resolved := d.ForServer(configured)
|
||||
if d.Server == "" || d.Server == configured {
|
||||
return resolved, ""
|
||||
}
|
||||
return resolved, fmt.Sprintf(
|
||||
"draft was created against %s but this client is configured for %s; publishing to %s as a new pipeline (version numbers do not carry over)",
|
||||
d.Server, configured, configured)
|
||||
}
|
||||
|
||||
func Directory() (string, error) {
|
||||
if dir := os.Getenv("PIPELINES_DRAFT_DIR"); dir != "" {
|
||||
return filepath.Abs(dir)
|
||||
|
||||
Reference in New Issue
Block a user