cli.commands/v1

The pocketone command tree. Every operation of every wire contract linked into the binary is a command under remote, with no code: pocketone remote restore to --at -2h calls restore/v1's RestoreTo on the project's remote. An extension replaces one of those commands by providing the same path, or adds commands of its own. One provider per path; when two extensions provide the same path, pocketone.yaml picks one.

A keyed contract (by command path), in the developer's pocketone process (commands.go).

Use

The generated commands, for any contract:

  • Path: remote, the contract id's words, then the operation: restore/v1's restore_to is remote restore to, mail.suppression/v1's check is remote mail suppression check, remote/v1's status is remote status (clicmdv1.PathOf).
  • Flags: one per field of the operation's input (--at, --email, --campaign), plus --json for the whole input (@file, - for stdin) and --remote (a remote's name or a URL; default: the project's default remote). Times take RFC 3339, a local time (2026-11-10 15:00) or a duration from now (-2h).
  • Output: the answer as JSON; streams print one JSON line per entry until Ctrl-C.
  • Auth: the remote's saved login (pocketone login), or P1_TOKEN in CI.
  • Not commands: public operations that take or return a raw body (an unsubscribe page, a mail provider's webhook); they're for browsers and services.

A remote that doesn't offer the contract answers "this remote doesn't offer restore/v1".

Provide

Provide a command in your extension's Register. The same path as a generated command replaces it; a new path adds one:

clicmdv1.Contract.Provide(app, clicmdv1.Command{
	Path:  "remote rehash",
	Short: "Rehash every stored password",
	Flags: func(fs *pflag.FlagSet) { fs.Bool("dry-run", false, "only count") },
	Run: func(c *clicmdv1.Ctx, args []string) error {
		caller, err := c.Caller("rehash/v1") // the command's remote, with its login
		if err != nil {
			return err
		}
		return caller.Call(c, "POST", "", nil, nil)
	},
})

and declare Implements: extkit.IDs("cli.commands/v1"). Two providers of one path fail the start until pocketone.yaml picks:

providers:
  cli.commands/v1:
    remote rehash: rehasher

A binary builds its tree with clicmdv1.Mount(app, rootCmd) once the app's contracts are sealed; the standard set does it in Register. Commands already on the tree (remote add, remote whoami) stay unless a provider replaces them.

Extensions

Extension
desktop provides

License

MIT