Documentation
¶
Index ¶
- func BuildUpEnv(p *devconfig.Project, preset *devconfig.Preset) []string
- func EnsureRegistered(cfg *devconfig.Config, root string) (string, error)
- func PresetServices(explicit []string, preset *devconfig.Preset) []string
- func SyncPorts(cfg *devconfig.Config, name, root string) ([]devconfig.Slot, error)
- type ClaimCmd
- type Cmd
- type ImportFromCmd
- type PresetActivateCmd
- type PresetAddCmd
- type PresetListCmd
- type PresetRemoveCmd
- type ProjectImportCmd
- type ProjectListCmd
- type ProjectPortsCmd
- type ProjectPresetCmd
- type ProjectPsCmd
- type ProjectRemoveCmd
- type ProjectRenameCmd
- type RegisterCmd
- type ReleaseToOrgCmd
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildUpEnv ¶
BuildUpEnv / PresetServices delegate to devconfig — the single source of truth shared with the local UI so CLI and UI build identical compose invocations.
func EnsureRegistered ¶
EnsureRegistered finds (or auto-registers) the project rooted at root in cfg, returning its registry name. Auto-registration mirrors `project import` so a bare `stack up` works before an explicit import. The caller saves cfg.
Types ¶
type ClaimCmd ¶
type ClaimCmd struct {
ProjectID string `` /* 133-byte string literal not displayed */
NewName string `` /* 163-byte string literal not displayed */
Console string `` /* 162-byte string literal not displayed */
}
ClaimCmd backs `w17ctl project claim`.
type Cmd ¶
type Cmd struct {
List ProjectListCmd `cmd:"" help:"List registered projects with their assigned host ports + active preset."`
ImportFrom ImportFromCmd `` /* 434-byte string literal not displayed */
Import ProjectImportCmd `cmd:"" help:"Register an existing w17 project (default: current dir) and allocate it unique host ports."`
Register RegisterCmd `` /* 335-byte string literal not displayed */
Remove ProjectRemoveCmd `cmd:"" help:"Unregister a project from the local registry (frees its assigned host ports for reuse)."`
Rename ProjectRenameCmd `` /* 313-byte string literal not displayed */
Ports ProjectPortsCmd `cmd:"" help:"Re-sync + show a project's assigned host ports (run after adding a connection / bundle)."`
Ps ProjectPsCmd `cmd:"" help:"Show running containers across ALL registered projects (docker compose ps per project)."`
ReleaseToOrg ReleaseToOrgCmd `` /* 213-byte string literal not displayed */
Claim ClaimCmd `` /* 165-byte string literal not displayed */
Preset ProjectPresetCmd `` /* 175-byte string literal not displayed */
}
Cmd is the `w17ctl project` parent — the dev-machine-local registry of installed w17 projects. It owns the unique host-port assignments w17ctl hands each project (so two projects' exposed ports never collide on one machine) and the per-project run presets. All state lives in `~/.w17/config.yaml` (devconfig) — NEVER the signed lock, because port maps + "run only admin on my laptop" presets are per-machine concerns, not shared reproducible build inputs.
type ImportFromCmd ¶
type ImportFromCmd struct {
Source string `` /* 166-byte string literal not displayed */
TargetID string `name:"project" placeholder:"ID" help:"Project to import INTO. Empty = read project_id from the lock."`
Initiative string `` /* 137-byte string literal not displayed */
LockPath string `` /* 217-byte string literal not displayed */
Console string `` /* 162-byte string literal not displayed */
Force bool `` /* 137-byte string literal not displayed */
}
ImportFromCmd implements `w17ctl project import-from` — folding a whole source project into this one.
Named `import-from` because `project import` already means something else and older: registering an existing project in the LOCAL registry and allocating it host ports. Reusing that name would have made two unrelated operations answer to one word.
What the console does, and why this command is thin ¶
Everything that matters happens server-side, because everything that matters needs the signing key: a signature binds the project it was minted for, so importing a history means RE-SIGNING every body under the target's scope. The console verifies each body under its original scope first and refuses the whole import if any fails — that ordering is what separates an import from a laundering machine, and it is not something a client may be trusted with.
The console also refuses unless the source's history is CONSISTENT (`w17ctl migrate verify-history` asks the same question), and unless no connection, table or message name is claimed by both projects.
The source is never touched ¶
Import is a copy of state. A refused or regretted import leaves the project it came from exactly as it was.
func (*ImportFromCmd) Run ¶
func (c *ImportFromCmd) Run() error
type PresetActivateCmd ¶
type PresetActivateCmd struct {
Project string `arg:"" help:"Project name."`
Name string `arg:"" optional:"" help:"Preset name to make default."`
Clear bool `name:"clear" help:"Reset to the full stack (no active preset)."`
}
func (*PresetActivateCmd) Run ¶
func (c *PresetActivateCmd) Run() error
type PresetAddCmd ¶
type PresetAddCmd struct {
Project string `arg:"" help:"Project name."`
Name string `arg:"" help:"Preset name."`
Services []string `name:"service" help:"Compose service to start (repeatable); empty = whole stack."`
Env []string `name:"env" help:"Extra env as KEY=VALUE (repeatable), layered on top of the managed port vars."`
}
func (*PresetAddCmd) Run ¶
func (c *PresetAddCmd) Run() error
type PresetListCmd ¶
type PresetListCmd struct {
Project string `arg:"" help:"Project name."`
}
func (*PresetListCmd) Run ¶
func (c *PresetListCmd) Run() error
type PresetRemoveCmd ¶
type PresetRemoveCmd struct {
Project string `arg:"" help:"Project name."`
Name string `arg:"" help:"Preset name."`
}
func (*PresetRemoveCmd) Run ¶
func (c *PresetRemoveCmd) Run() error
type ProjectImportCmd ¶
type ProjectImportCmd struct {
Path string `arg:"" optional:"" help:"Path to (or inside) the project; default current dir."`
}
func (*ProjectImportCmd) Run ¶
func (c *ProjectImportCmd) Run() error
type ProjectListCmd ¶
type ProjectListCmd struct{}
func (*ProjectListCmd) Run ¶
func (c *ProjectListCmd) Run() error
type ProjectPortsCmd ¶
type ProjectPortsCmd struct {
Name string `arg:"" optional:"" help:"Project name; default = the project in the current dir."`
Rebase bool `` /* 196-byte string literal not displayed */
}
func (*ProjectPortsCmd) Run ¶
func (c *ProjectPortsCmd) Run() error
type ProjectPresetCmd ¶
type ProjectPresetCmd struct {
Add PresetAddCmd `cmd:"" help:"Create / overwrite a preset: which services to start (--service) + env to layer (--env KEY=VALUE)."`
Remove PresetRemoveCmd `cmd:"" help:"Delete a preset."`
Activate PresetActivateCmd `cmd:"" help:"Set a preset as the default applied by a bare 'stack up' (or --clear to reset to the full stack)."`
List PresetListCmd `cmd:"" help:"List a project's presets."`
}
type ProjectPsCmd ¶
type ProjectPsCmd struct{}
func (*ProjectPsCmd) Run ¶
func (c *ProjectPsCmd) Run() error
type ProjectRemoveCmd ¶
type ProjectRemoveCmd struct {
Name string `arg:"" help:"Project name to unregister."`
}
func (*ProjectRemoveCmd) Run ¶
func (c *ProjectRemoveCmd) Run() error
type ProjectRenameCmd ¶
type ProjectRenameCmd struct {
NewName string `arg:"" help:"The name to key this checkout's entry under — normally the project: in w17/lock.yaml."`
Dir string `arg:"" optional:"" help:"Project directory (default: current)."`
}
ProjectRenameCmd re-keys this checkout's registry entry, keeping everything under it.
The missing repair. A project renamed in the console leaves the local registry holding the old key, which is legal and common — an owner may rename, and the key was written at `init` from whatever name existed then. `ResolveProject` takes the single entry for the directory and says the two names differ; this is what stops it saying so.
`remove` + `import` is NOT that repair, and the difference is the whole reason this exists: import allocates FRESH ports. a consumer's ports are inside the range their machine tunnels to the developer (16000-16099) and the allocator's default base is 14000, so reallocating could move their stack outside the range that makes it reachable at all. They read import's own help, saw "allocate it unique host ports", and stopped — which was right.
func (*ProjectRenameCmd) Run ¶
func (c *ProjectRenameCmd) Run() error
type RegisterCmd ¶
type RegisterCmd struct {
Name string `name:"name" placeholder:"NAME" help:"Register under this name. Empty uses the lock's project name."`
Org string `` /* 176-byte string literal not displayed */
LockPath string `` /* 160-byte string literal not displayed */
Console string `` /* 168-byte string literal not displayed */
}
RegisterCmd implements `w17ctl project register` — registering a project that ALREADY has a lock.
Why this is not `init` ¶
`init` is the wizard: it registers a project AND builds the lock from the answers it collects. It refuses an existing lock, and that refusal is right — rerunning it would rewrite connections, pinned migration targets, plugin activations and the generated_code declarations from defaults. Those are the state the lock exists to carry, and nobody can retype them accurately.
So a project generating against one console had no way onto another: `init` refused, `project import` is the LOCAL port registry (it never touches project_id), and `project import-from` folds one project into another that already exists. Pushing was the only thing that worked, and only because the console used to accept a write under an id it had never registered — the hole this command exists to replace.
What it does ¶
RegisterProject on the console → new project_id EditLock(adopt_project) → the console re-signs the lock SignAclLock, per domain → the console re-signs each ACL lock
Exactly one field of the lock changes. The console owns the edit and the signature; this command ships an intent and writes back what it gets, as the public split requires.
The permission locks ¶
A project that comes from another console carries ACL locks that console signed, and this one refuses to extend an allocation it cannot verify — so the next codegen failed, and the only ways on were to waive the check on the console's own machine or to delete the locks and renumber every permission. Each lock therefore goes through SignAclLock unchanged: the console verifies it against its own keys and the keys of the consoles its operator trusts, and signs the same allocation with its own key. Every id is kept. A lock this console already signed comes back as it was.
func (*RegisterCmd) Run ¶
func (c *RegisterCmd) Run() error
type ReleaseToOrgCmd ¶
type ReleaseToOrgCmd struct {
ProjectID string `name:"project" placeholder:"ID" help:"Project to offer. Empty = read project_id from the lock."`
TargetOrg string `name:"to" placeholder:"ORG_ID" help:"Organization to offer the project to. Empty WITHDRAWS a pending offer."`
Console string `` /* 162-byte string literal not displayed */
}
ReleaseToOrgCmd backs `w17ctl project release-to-org`.
func (*ReleaseToOrgCmd) Run ¶
func (c *ReleaseToOrgCmd) Run() error