01Run it
Replace the <placeholders> with your own values, or use the builder below.
p202 goal update <id>02What you get
Pick the shape you need. People get a table. Add
--json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 goal updateSet flags below; the command updates as you type.
04Flags
18 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --afterstring | Goal ids that must be reached first, comma-separated |
| --countstring | Reached on the Nth matching event (default 1) |
| --definitionstring | The whole definition as JSON (exclusive with the quick flags) |
| --eventstring | Trigger: the event name that reaches the goal |
| --file, -Fstring | Read the definition JSON from a file (- for stdin) |
| --installbool | Trigger: the install itself |
| --namestring | Goal name (unique per owner) |
| --no-valuebool | Tracked, not paid (value none) |
| --no-windowbool | Remove the window (update) |
| --repeatstring | How often it can be reached (default once): once, eachonceeach |
| --repeat-maxstring | With --repeat each: the most times it can be reached (1-10000; required for a --sum-prop goal) |
| --sum-gtestring | The running-sum threshold |
| --sum-propstring | Reached when the running sum of this property (or $revenue) reaches --sum-gte |
| --valuestring | Fixed value of reaching the goal, e.g. 4.00 |
| --value-from-propertystring | Value from an event property (default the event's revenue) |
| --wherestring | Conditions on the event, "<prop> <op> <value>", several separated by ; (ANDed); ops: eq, neq, gt, gte, lt, lte, in, exists |
| --within-daysstring | Only events within this many days of --within-from |
| --within-fromstring | Window anchor: install, clickinstallclick |
05How it works
Replaces the goal's definition with a new version. --definition/--file give the whole
new definition; the quick flags change only their part of the current one. The same
definition again is not a new version. Past conversions keep their version until
p202 goal reevaluate <id> --apply.
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands goal update --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
- This command writes. Add
--stagedto record it as a proposal a person applies withp202 change apply.
{
"path": "p202 goal update",
"use": "update <id>",
"short": "Edit a goal (a new version; conversions keep the version that produced them)",
"long": "Replaces the goal's definition with a new version. --definition/--file give the whole\nnew definition; the quick flags change only their part of the current one. The same\ndefinition again is not a new version. Past conversions keep their version until\n`p202 goal reevaluate <id> --apply`.",
"runnable": true,
"flags": [
{
"name": "after",
"type": "string",
"default": "",
"usage": "Goal ids that must be reached first, comma-separated",
"required": false
},
{
"name": "count",
"type": "string",
"default": "",
"usage": "Reached on the Nth matching event (default 1)",
"required": false
},
{
"name": "definition",
"type": "string",
"default": "",
"usage": "The whole definition as JSON (exclusive with the quick flags)",
"required": false
},
{
"name": "event",
"type": "string",
"default": "",
"usage": "Trigger: the event name that reaches the goal",
"required": false
},
{
"name": "file",
"shorthand": "F",
"type": "string",
"default": "",
"usage": "Read the definition JSON from a file (- for stdin)",
"required": false
},
{
"name": "install",
"type": "bool",
"default": "false",
"usage": "Trigger: the install itself",
"required": false
},
{
"name": "name",
"type": "string",
"default": "",
"usage": "Goal name (unique per owner)",
"required": false
},
{
"name": "no-value",
"type": "bool",
"default": "false",
"usage": "Tracked, not paid (value none)",
"required": false
},
{
"name": "no-window",
"type": "bool",
"default": "false",
"usage": "Remove the window (update)",
"required": false
},
{
"name": "repeat",
"type": "string",
"default": "",
"usage": "How often it can be reached (default once): once, each",
"allowed_values": [
"once",
"each"
],
"required": false
},
{
"name": "repeat-max",
"type": "string",
"default": "",
"usage": "With --repeat each: the most times it can be reached (1-10000; required for a --sum-prop goal)",
"required": false
},
{
"name": "sum-gte",
"type": "string",
"default": "",
"usage": "The running-sum threshold",
"required": false
},
{
"name": "sum-prop",
"type": "string",
"default": "",
"usage": "Reached when the running sum of this property (or $revenue) reaches --sum-gte",
"required": false
},
{
"name": "value",
"type": "string",
"default": "",
"usage": "Fixed value of reaching the goal, e.g. 4.00",
"required": false
},
{
"name": "value-from-property",
"type": "string",
"default": "",
"usage": "Value from an event property (default the event's revenue)",
"required": false
},
{
"name": "where",
"type": "string",
"default": "",
"usage": "Conditions on the event, \"<prop> <op> <value>\", several separated by ; (ANDed); ops: eq, neq, gt, gte, lt, lte, in, exists",
"required": false
},
{
"name": "within-days",
"type": "string",
"default": "",
"usage": "Only events within this many days of --within-from",
"required": false
},
{
"name": "within-from",
"type": "string",
"default": "",
"usage": "Window anchor: install, click",
"allowed_values": [
"install",
"click"
],
"required": false
}
]
}