goals-cli 0.0.0-stage → 1.3.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +130 -2
  3. package/dist/args.js +96 -0
  4. package/dist/auth/command.js +16 -0
  5. package/dist/auth/help.js +82 -0
  6. package/dist/auth/list.js +41 -0
  7. package/dist/auth/login.js +203 -0
  8. package/dist/auth/logout.js +25 -0
  9. package/dist/auth/select.js +30 -0
  10. package/dist/auth/status.js +43 -0
  11. package/dist/auth/use.js +10 -0
  12. package/dist/cli.js +112 -0
  13. package/dist/commands/export-help.js +49 -0
  14. package/dist/commands/export.js +194 -0
  15. package/dist/commands/goal-flags.js +111 -0
  16. package/dist/commands/goal-format.js +95 -0
  17. package/dist/commands/goal-help.js +214 -0
  18. package/dist/commands/goal-read.js +80 -0
  19. package/dist/commands/goal-write.js +186 -0
  20. package/dist/commands/goal.js +15 -0
  21. package/dist/commands/initiative-help.js +38 -0
  22. package/dist/commands/initiative.js +81 -0
  23. package/dist/commands/list-output.js +13 -0
  24. package/dist/commands/skill-help.js +18 -0
  25. package/dist/commands/skill.js +36 -0
  26. package/dist/credentials.js +270 -0
  27. package/dist/deps.js +46 -0
  28. package/dist/dispatch.js +16 -0
  29. package/dist/endpoints.js +82 -0
  30. package/dist/errors.js +29 -0
  31. package/dist/help.js +105 -0
  32. package/dist/http.js +199 -0
  33. package/dist/iso-week.js +18 -0
  34. package/dist/open-browser.js +47 -0
  35. package/dist/output.js +29 -0
  36. package/dist/vendor/cli-contract/index.js +26 -0
  37. package/dist/vendor/quarterly-markdown/dateFormat.js +101 -0
  38. package/dist/vendor/quarterly-markdown/generate.js +450 -0
  39. package/dist/vendor/quarterly-markdown/htmlToPlainText.js +101 -0
  40. package/dist/vendor/quarterly-markdown/index.js +4 -0
  41. package/dist/vendor/quarterly-markdown/types.js +1 -0
  42. package/dist/vendor/quarterly-markdown/year.js +45 -0
  43. package/dist/version.js +9 -0
  44. package/package.json +37 -4
  45. package/skills/goals-cli/REFERENCE.md +212 -0
  46. package/skills/goals-cli/SKILL.md +12 -0
@@ -0,0 +1,212 @@
1
+ # Goals CLI reference
2
+
3
+ The `goals` command-line tool reads and changes the Goals app data of the account you
4
+ authorize: quarterly, weekly, daily and adhoc goals, initiatives, and the same markdown
5
+ summary the webapp exports. This reference is versioned with the CLI, so it always describes
6
+ the installed commands.
7
+
8
+ ## Install and log in
9
+
10
+ Install the CLI globally with `npm i -g goals-cli`, or run it without installing through
11
+ `npx goals-cli ...`. The CLI needs Node.js 20 or newer. Check what is installed with
12
+ `goals --version`.
13
+
14
+ `goals auth login` starts a browser approval: the CLI prints an approval URL and a
15
+ verification code on stderr and waits while you open the URL and type the code in the
16
+ browser. No flags are needed for the production app. Pass `--webapp-url` together with
17
+ `--convex-url` only for a local or self-hosted deployment.
18
+
19
+ ```bash
20
+ goals --version
21
+ goals auth login
22
+ goals auth login --name local --env dev --webapp-url http://localhost:3000 --convex-url http://127.0.0.1:3211
23
+ goals auth status
24
+ ```
25
+
26
+ If a command exits 1 with a `Not logged in` message, ask the user to run `goals auth login`
27
+ themselves: the approval needs a human in a browser. Do not try to log in on their behalf.
28
+
29
+ ## Identities
30
+
31
+ One machine can hold several credentials. Each login is stored under an identity label:
32
+ `--name <label>` picks the label, otherwise the environment qualifier (`--env`) is used, and
33
+ otherwise `default`. `goals auth list` shows every stored identity and marks the default with
34
+ `*`; `goals auth use <label>` changes the default; `goals auth logout` revokes the credential
35
+ and removes it from this machine.
36
+
37
+ Every data command accepts `--as <label>` to choose an identity for that one invocation. The
38
+ `GOALS_AS` environment variable does the same when the flag is absent. Selection order is:
39
+ `--as`, then `GOALS_AS`, then the default identity, then the only stored identity.
40
+
41
+ ```bash
42
+ goals auth login --name dev --env dev
43
+ goals auth list
44
+ goals auth use dev
45
+ goals auth status --as dev --json
46
+ goals auth logout --as dev
47
+ ```
48
+
49
+ ## Conventions
50
+
51
+ Exit codes: `0` success, `1` runtime, backend or authentication failure, `2` usage error.
52
+ Usage errors start with `Usage:` on stderr. stdout carries data only; progress and
53
+ diagnostics go to stderr, so `goals ... > file.md` is safe.
54
+
55
+ List before you use an ID. Goal, initiative and domain IDs come from `goals goal list`,
56
+ `goals initiative list` and `goals goal get <id> --json`; never guess an ID. Add `--json` for
57
+ scripts and parse the JSON instead of the tables. Tables are for humans.
58
+
59
+ `goals goal delete` requires `--yes` and sends nothing without it. It deletes the goal and all
60
+ of its child goals, and keeps the goal-log history. Weekly and daily goals require `--week`
61
+ for `complete` and `reopen`; the error names the current ISO week. Quarterly goals default to
62
+ the first week of the quarter server-side, and a quarterly goal created without `--week` also
63
+ uses the first week of the quarter.
64
+
65
+ Scopes for `goal list`: `quarterly` needs `--year` and `--quarter`; `weekly` and `daily` need
66
+ `--year`, `--quarter` and `--week`; `adhoc` needs `--year` and rejects `--quarter`. `--domain`
67
+ applies to adhoc goals only and cannot be combined with `--no-adhoc` on export.
68
+
69
+ Scopes for `goal create`: weekly and daily goals use `--parent <id>` (the parent quarterly/weekly
70
+ goal); daily also needs `--day`, and `--week` is optional and defaults to the current ISO week.
71
+ Adhoc goals take optional `--year` and `--week` that default to now, but `--week` is required
72
+ when `--year` is not the current ISO year. Quarterly goals need `--year` and `--quarter` and
73
+ omit `week` unless `--week` is passed.
74
+
75
+ ## Command map
76
+
77
+ ```bash
78
+ goals auth login
79
+ goals auth login --name dev --env dev
80
+ goals auth logout
81
+ goals auth logout --as dev
82
+ goals auth status
83
+ goals auth status --as dev --json
84
+ goals auth list
85
+ goals auth list --json
86
+ goals auth use dev
87
+ ```
88
+
89
+ ```bash
90
+ goals goal list --year 2026 --quarter 3
91
+ goals goal list --scope weekly --year 2026 --quarter 3 --week 31
92
+ goals goal list --scope daily --year 2026 --quarter 3 --week 31
93
+ goals goal list --scope adhoc --year 2026
94
+ goals goal list --year 2026 --quarter 3 --initiative <initiative-id> --limit 50 --json
95
+ goals goal get <goal-id>
96
+ goals goal get <goal-id> --json
97
+ goals goal create --scope quarterly --year 2026 --quarter 3 --title "Ship the beta" --details "Beta scope" --initiative <initiative-id>
98
+ goals goal create --scope weekly --parent <quarterly-goal-id> --title "Draft the launch"
99
+ goals goal create --scope daily --parent <weekly-goal-id> --day tue --title "Call the printer"
100
+ goals goal create --scope adhoc --year 2026 --week 31 --title "Book the venue" --domain <domain-id>
101
+ goals goal rename <goal-id> --title "Ship the beta"
102
+ goals goal complete <goal-id> --week 31
103
+ goals goal complete <goal-id> --include-children
104
+ goals goal reopen <goal-id> --week 31
105
+ goals goal reopen <goal-id> --include-children
106
+ goals goal delete <goal-id> --yes
107
+ ```
108
+
109
+ ```bash
110
+ goals initiative list
111
+ goals initiative list --limit 50 --json
112
+ goals initiative get <initiative-id>
113
+ goals initiative get <initiative-id> --json
114
+ ```
115
+
116
+ ```bash
117
+ goals export markdown --year 2026
118
+ goals export markdown --year 2026 --quarter 3
119
+ goals export markdown --year 2026 --quarter 3 --completed-only
120
+ goals export markdown --year 2026 --quarter 3 --goal <goal-id>
121
+ goals export markdown --year 2026 --quarter 3 --domain <domain-id>
122
+ goals export markdown --year 2026 --quarter 3 --domain uncategorized
123
+ goals export markdown --year 2026 --quarter 3 --no-adhoc
124
+ goals export markdown --year 2026 --out goals-2026.md --as dev
125
+ ```
126
+
127
+ ```bash
128
+ goals skill activate
129
+ ```
130
+
131
+ ## Recipes
132
+
133
+ ### Recipe a: Export a whole year as markdown
134
+
135
+ Print every quarter of the year, in order, then write the same document to a file.
136
+
137
+ ```bash
138
+ goals export markdown --year 2026
139
+ goals export markdown --year 2026 --out goals-2026.md
140
+ ```
141
+
142
+ ### Recipe b: Export one quarter
143
+
144
+ Add `--quarter` to get that quarter's document only.
145
+
146
+ ```bash
147
+ goals export markdown --year 2026 --quarter 3
148
+ ```
149
+
150
+ ### Recipe c: Export a quarter, completed goals only
151
+
152
+ `--completed-only` mirrors the webapp's completed export.
153
+
154
+ ```bash
155
+ goals export markdown --year 2026 --quarter 3 --completed-only
156
+ ```
157
+
158
+ ### Recipe d: Export selected goals or a domain
159
+
160
+ Read the goal IDs from `goals goal list --json` first. `--goal` is repeatable and needs
161
+ `--quarter`. Use `--domain <domain-id>` (the `domainId` from `goals goal get <id> --json`) or
162
+ the literal `uncategorized` for adhoc goals without a domain. `--domain` cannot be combined
163
+ with `--no-adhoc`.
164
+
165
+ ```bash
166
+ goals goal list --year 2026 --quarter 3 --json
167
+ goals export markdown --year 2026 --quarter 3 --goal <goal-id> --goal <goal-id>
168
+ goals export markdown --year 2026 --quarter 3 --domain <domain-id>
169
+ goals export markdown --year 2026 --quarter 3 --domain uncategorized
170
+ goals export markdown --year 2026 --quarter 3 --no-adhoc
171
+ ```
172
+
173
+ ### Recipe e: List this week's goals
174
+
175
+ Work out the current year, quarter (1-4) and ISO week first; `date +%G` prints the ISO year
176
+ and `date +%V` the ISO week on Linux and macOS.
177
+
178
+ ```bash
179
+ goals goal list --scope weekly --year 2026 --quarter 3 --week 31
180
+ goals goal list --scope daily --year 2026 --quarter 3 --week 31
181
+ ```
182
+
183
+ ### Recipe f: Create a quarterly goal with weekly and daily children
184
+
185
+ Create the parent first and read its id from the `Created <scope> goal <id>.` line on stdout,
186
+ then pass it as `--parent`. Weekly and daily goals default `--week` to the current ISO week.
187
+
188
+ ```bash
189
+ goals goal create --scope quarterly --year 2026 --quarter 3 --title "Ship the beta"
190
+ goals goal create --scope weekly --parent <quarterly-goal-id> --title "Draft the launch"
191
+ goals goal create --scope daily --parent <weekly-goal-id> --day tue --title "Call the printer"
192
+ ```
193
+
194
+ ### Recipe g: Mark a daily task complete
195
+
196
+ Find the goal id with `--json`, then complete it. `--week` is required for weekly and daily
197
+ goals.
198
+
199
+ ```bash
200
+ goals goal list --scope daily --year 2026 --quarter 3 --week 31 --json
201
+ goals goal complete <goal-id> --week 31
202
+ ```
203
+
204
+ ### Recipe h: Switch identities
205
+
206
+ List the stored labels, set a default, or pass `--as` for a single command.
207
+
208
+ ```bash
209
+ goals auth list
210
+ goals auth use dev
211
+ goals goal list --year 2026 --quarter 3 --as dev
212
+ ```
@@ -0,0 +1,12 @@
1
+ ---
2
+ name: goals-cli
3
+ description: Read and manage the user's Goals app data (quarterly, weekly, daily and adhoc goals, initiatives, markdown exports) with the `goals` command-line tool. Use when asked to list, create, complete or export goals, e.g. "export all my goals for 2026 as markdown".
4
+ ---
5
+
6
+ # Goals CLI
7
+
8
+ This is a stub. The full, versioned guidance ships with the installed CLI and is always up to date.
9
+
10
+ Run `goals skill activate` and follow what it prints. It needs no login and makes no network call.
11
+
12
+ If `goals` is not found, install it with `npm i -g goals-cli` (or use `npx goals-cli skill activate`).