@chalksurf/cli 0.2.4 → 0.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.
package/docs/agents.md CHANGED
@@ -65,7 +65,9 @@ The CLI and MCP surface are backed by the same agent resource contracts in `pack
65
65
  - Patch-style writes require `expectedUpdatedAt` from a fresh `get` call.
66
66
  - Exercise updates require shared-usage care. Use `exercise usage` first when the exercise might appear outside the target sheet.
67
67
  - Validate proposed LaTeX with `exercise validate-latex` before applying content updates.
68
- - No delete or transfer-between-organization agent primitive is intentionally exposed.
68
+ - Use `exercise labels` / `list_exercise_labels` before writing labels. Exercise create and update reject labels outside the canonical taxonomy.
69
+ - Delete and visibility tools are exposed, but destructive writes require exact resource-ID confirmation and current `expectedUpdatedAt` values where applicable.
70
+ - No transfer-between-organization agent primitive is intentionally exposed.
69
71
 
70
72
  Write receipts are the agent audit log. Preserve them in run notes or user-visible summaries when the user needs to double-check what changed.
71
73
 
@@ -76,22 +78,38 @@ Use these commands after authentication and organization selection:
76
78
  | Goal | CLI command |
77
79
  | --- | --- |
78
80
  | Fetch one sheet | `chalksurf sheet get SHEET_ID --json` |
81
+ | List owned sheet versions | `chalksurf sheet versions SHEET_ID --json` |
82
+ | Fetch one owned sheet version | `chalksurf sheet version SHEET_ID VERSION_ID --json` |
79
83
  | Get a sheet repair queue | `chalksurf sheet issues SHEET_ID --json` |
84
+ | Create a sheet | `chalksurf sheet create --input-json JSON --json` |
80
85
  | Copy a sheet | `chalksurf sheet copy SHEET_ID "New name" --exercise-copy-mode keep_references --json` |
81
86
  | Create an editable variant sheet | `chalksurf sheet copy SHEET_ID "Variant name" --exercise-copy-mode copy_all_exercises --json` |
82
87
  | Append existing exercises to a sheet | `chalksurf sheet append SHEET_ID EXERCISE_ID... --json` |
83
88
  | Patch sheet metadata | `chalksurf sheet update SHEET_ID --expected-updated-at ISO --patch-json JSON --json` |
89
+ | Set sheet visibility | `chalksurf sheet set-visibility SHEET_ID --public --expected-updated-at ISO --confirm-make-public-resource-id SHEET_ID --json` |
90
+ | Delete a sheet | `chalksurf sheet delete SHEET_ID --expected-updated-at ISO --confirm-resource-id SHEET_ID --json` |
84
91
  | List folders | `chalksurf sheet folder list --json` |
85
92
  | Create a folder | `chalksurf sheet folder create "Folder name" --parent-id FOLDER_ID --json` |
86
93
  | Rename a folder | `chalksurf sheet folder rename FOLDER_ID "New name" --json` |
94
+ | Delete an empty folder | `chalksurf sheet folder delete FOLDER_ID --confirm-resource-id FOLDER_ID --json` |
87
95
  | Fetch one exercise | `chalksurf exercise get EXERCISE_ID --json` |
96
+ | List valid exercise labels | `chalksurf exercise labels --json` |
88
97
  | Inspect exercise usage | `chalksurf exercise usage EXERCISE_ID --json` |
98
+ | Create an exercise | `chalksurf exercise create --input-json JSON --json` |
89
99
  | Copy one exercise | `chalksurf exercise copy EXERCISE_ID --json` |
90
100
  | Patch exercise fields | `chalksurf exercise update EXERCISE_ID --expected-updated-at ISO --patch-json JSON --json` |
101
+ | Set exercise visibility | `chalksurf exercise set-visibility EXERCISE_ID --public --expected-updated-at ISO --confirm-make-public-resource-id EXERCISE_ID --json` |
102
+ | Delete an unused exercise | `chalksurf exercise delete EXERCISE_ID --expected-updated-at ISO --confirm-resource-id EXERCISE_ID --json` |
91
103
  | Validate LaTeX snippets | `chalksurf exercise validate-latex --snippet "path=value" --json` |
104
+ | Send user-consented feedback | `chalksurf feedback user --message "..." --user-consent --json` |
105
+ | Send agent-observed feedback | `chalksurf feedback agent --message "..." --json` |
92
106
 
93
107
  When appending private exercises to a public sheet, the CLI requires `--confirm-make-exercises-public` because the append makes those exercises public.
94
108
 
109
+ For `--private`, visibility commands do not require `--confirm-make-public-resource-id`. If visibility controls are disabled for the selected organization/user, the CLI and MCP return `feature_disabled`.
110
+
111
+ For deletes, fetch the resource immediately before deleting, use that `updated_at` as `--expected-updated-at`, and pass the target ID again as `--confirm-resource-id`. Exercise deletes fail while the exercise is used by any active sheet. Folder deletes fail unless the folder has no child folders and no active child sheets.
112
+
95
113
  ## Repair Workflow: Fix LaTeX Errors In A Sheet
96
114
 
97
115
  1. Fetch the sheet and issue queue:
@@ -148,29 +166,47 @@ MCP clients should use tool discovery from the client. The ChalkSurf MCP endpoin
148
166
  | `org list` | `list_organizations` |
149
167
  | `exercise search` | `search_exercises` |
150
168
  | `exercise get` | `get_exercise` |
169
+ | `exercise labels` | `list_exercise_labels` |
151
170
  | `exercise usage` | `get_exercise_usage` |
171
+ | `exercise create` | `create_exercise` |
152
172
  | `exercise copy` | `copy_exercise` |
153
173
  | `exercise update` | `update_exercise` |
174
+ | `exercise set-visibility` | `set_exercise_visibility` |
175
+ | `exercise delete` | `delete_exercise` |
154
176
  | `exercise validate-latex` | `validate_latex_snippets` |
155
177
  | `exercise import` | `import_exercise` |
156
178
  | `exercise import-solution` | `import_exercise_solution` |
157
179
  | `sheet search` | `search_sheets` |
158
180
  | `sheet get` | `get_sheet` |
181
+ | `sheet versions` | `list_sheet_versions` |
182
+ | `sheet version` | `get_sheet_version` |
159
183
  | `sheet issues` | `get_sheet_issues` |
184
+ | `sheet create` | `create_sheet` |
160
185
  | `sheet copy` | `copy_sheet` |
161
186
  | `sheet append` | `append_exercises_to_sheet` |
162
187
  | `sheet update` | `update_sheet` |
188
+ | `sheet set-visibility` | `set_sheet_visibility` |
189
+ | `sheet delete` | `delete_sheet` |
163
190
  | `sheet import` | `import_sheet` |
164
191
  | `sheet import-solutions` | `import_sheet_solutions` |
165
192
  | `sheet folder list` | `list_folders` |
166
193
  | `sheet folder create` | `create_folder` |
167
194
  | `sheet folder rename` | `rename_folder` |
195
+ | `sheet folder delete` | `delete_folder` |
168
196
  | `job list` | `list_jobs` |
169
197
  | `job get` | `get_job` |
170
198
  | `job wait` | `wait_for_jobs` |
199
+ | `feedback user` | `send_user_feedback` |
200
+ | `feedback agent` | `send_agent_feedback` |
171
201
 
172
202
  MCP calls authenticate through ChalkSurf OAuth, not CLI tokens. Read tools require `chalksurf:read`; write tools require `chalksurf:write` plus a write grant for the requested `organizationId`. Each organization-scoped MCP call must pass `organizationId`.
173
203
 
204
+ ## Feedback
205
+
206
+ Use `feedback user` / `send_user_feedback` only when the user explicitly agrees to send feedback. The command requires `--user-consent`; the MCP input requires `userConsent: true`. Good cases include user-requested bug reports, feature requests, visible frustration, or a request that cannot currently be completed through the CLI or MCP surface.
207
+
208
+ Use `feedback agent` / `send_agent_feedback` for agent-observed problems, such as an API behavior that differs from the docs, an MCP response that is internally inconsistent, or a missing capability discovered while completing a task. Do not present agent feedback as user feedback unless the user explicitly asks you to send it on their behalf.
209
+
174
210
  ## Manifest Design
175
211
 
176
212
  Prefer manifests over large positional argument lists.
@@ -17,6 +17,8 @@ The CLI uses stable exit codes so automation can branch without parsing human te
17
17
 
18
18
  These same codes are mirrored in `error.exitCode` and `error.code` inside the JSON envelope.
19
19
 
20
+ API errors may also include `error.agentErrorCode`, a stable ChalkSurf agent error code such as `precondition_failed`, `confirmation_required`, `invalid_label`, or `resource_in_use`.
21
+
20
22
  ## JSON Envelope
21
23
 
22
24
  In `--json` mode, stdout contains a stable envelope:
package/docs/manual.md CHANGED
@@ -193,6 +193,13 @@ chalksurf sheet get 00000000-0000-4000-8000-000000000001 --json
193
193
  chalksurf exercise get 00000000-0000-4000-8000-000000000002 --json
194
194
  ```
195
195
 
196
+ Inspect sheet version history and one stored snapshot:
197
+
198
+ ```bash
199
+ chalksurf sheet versions 00000000-0000-4000-8000-000000000001 --json
200
+ chalksurf sheet version 00000000-0000-4000-8000-000000000001 00000000-0000-4000-8000-000000000003 --json
201
+ ```
202
+
196
203
  List sheet issues that are useful for repair workflows:
197
204
 
198
205
  ```bash
package/docs/mcp.md CHANGED
@@ -36,28 +36,46 @@ Treat write receipts as an agent audit log. They are suitable for user-visible s
36
36
  | `list_organizations` | read | List organizations granted to the MCP client. |
37
37
  | `search_exercises` | read | Search exercises by text, labels, status, ownership, age, difficulty, or semantic query. |
38
38
  | `get_exercise` | read | Fetch full details for one visible exercise. |
39
+ | `list_exercise_labels` | read | List the canonical exercise label taxonomy agents may write to exercises. |
39
40
  | `get_exercise_usage` | read | Inspect which sheets use one visible exercise. |
41
+ | `create_exercise` | write | Create one exercise in the selected organization. |
40
42
  | `copy_exercise` | write | Copy one visible exercise into the selected organization. |
43
+ | `delete_exercise` | write | Soft-delete one unused writable exercise after `updated_at` and exact-ID confirmation checks. |
41
44
  | `update_exercise` | write | Patch exercise fields with an `updated_at` precondition and shared-usage acknowledgement. |
45
+ | `set_exercise_visibility` | write | Make one writable exercise public or private when visibility controls are enabled. |
42
46
  | `import_exercise` | write | Queue an exercise import from MCP files or HTTPS URLs. |
43
47
  | `import_exercise_solution` | write | Queue a solution import for one exercise. |
44
48
  | `search_sheets` | read | Search visible sheets, optionally by readiness issues. |
45
49
  | `get_sheet` | read | Fetch full details for one visible sheet. |
50
+ | `list_sheet_versions` | read | List version history for one sheet owned by the granted organization. |
51
+ | `get_sheet_version` | read | Fetch one owned sheet version snapshot with referenced exercise details. |
46
52
  | `get_sheet_issues` | read | Fetch actionable sheet issues: invalid LaTeX, missing translations, missing solutions, and missing scores. |
53
+ | `create_sheet` | write | Create one exercise sheet in the selected organization. |
47
54
  | `copy_sheet` | write | Copy a visible sheet, either keeping exercise references or copying all visible exercises. |
55
+ | `delete_sheet` | write | Soft-delete one writable sheet after `updated_at` and exact-ID confirmation checks. |
48
56
  | `update_sheet` | write | Patch sheet metadata with an `updated_at` precondition. |
57
+ | `set_sheet_visibility` | write | Make one writable sheet public or private when visibility controls are enabled. |
49
58
  | `append_exercises_to_sheet` | write | Append existing visible exercises to the end of one writable sheet. |
50
59
  | `list_folders` | read | List sheet folders in the selected organization. |
51
60
  | `create_folder` | write | Create a sheet folder. |
52
61
  | `rename_folder` | write | Rename a sheet folder. |
62
+ | `delete_folder` | write | Delete one empty sheet folder after exact-ID confirmation. |
53
63
  | `validate_latex_snippets` | read | Validate proposed LaTeX snippets before writing. |
54
64
  | `import_sheet` | write | Queue sheet imports from MCP files or HTTPS URLs. |
55
65
  | `import_sheet_solutions` | write | Queue solution import for an existing sheet. |
56
66
  | `list_jobs` | read | List jobs in the granted organization. |
57
67
  | `get_job` | read | Fetch one job. |
58
68
  | `wait_for_jobs` | read | Wait for one or more jobs to complete. |
69
+ | `send_user_feedback` | read | Send user-consented product feedback, bug reports, or blocked-request reports. |
70
+ | `send_agent_feedback` | read | Send agent-observed API, MCP, CLI, or documentation feedback. |
59
71
 
60
- No MCP tool currently deletes resources or transfers resources between organizations.
72
+ Delete tools require exact `confirmResourceId` matching the target ID. Exercise and sheet deletes also require the latest `expectedUpdatedAt`. Exercise deletes fail while the exercise is used by an active sheet, and folder deletes fail unless the folder is empty.
73
+
74
+ Visibility tools respect the existing ChalkSurf visibility feature flag. If visibility controls are disabled, they return `feature_disabled`. Publicization requires `confirmMakePublicResourceId`; private visibility changes do not.
75
+
76
+ No MCP tool currently transfers resources between organizations.
77
+
78
+ `send_user_feedback` and `send_agent_feedback` are not read-only operations, but they require only the `chalksurf:read` OAuth scope because they do not mutate ChalkSurf exercises, sheets, or folders. Use `send_user_feedback` only after the user explicitly agrees to send feedback. Use `send_agent_feedback` when the agent itself observes inconsistent behavior, inaccurate docs, or missing agent-facing API coverage.
61
79
 
62
80
  ## Common Workflows
63
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chalksurf/cli",
3
- "version": "0.2.4",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "engines": {
@@ -27,7 +27,7 @@
27
27
  "prepack": "npm run build",
28
28
  "build": "node --import tsx ./scripts/build.ts",
29
29
  "lint": "eslint .",
30
- "type-check": "tsc --noEmit --project ./tsconfig.json",
30
+ "type-check": "tsgo --noEmit --project ./tsconfig.json --checkers 2",
31
31
  "test": "vitest --config ./vitest.config.ts --run --maxWorkers=1",
32
32
  "test:watch": "vitest --config ./vitest.config.ts --watch --maxWorkers=1",
33
33
  "smoke-pack": "node --import tsx ./scripts/smoke-pack.ts"
@@ -40,9 +40,10 @@
40
40
  "devDependencies": {
41
41
  "@types/node": "^24.10.1",
42
42
  "@types/yargs": "^17.0.35",
43
+ "@typescript/native-preview": "^7.0.0-dev.20260527.2",
43
44
  "esbuild": "^0.27.0",
44
45
  "tsx": "^4.20.6",
45
- "typescript": "^5.0.0",
46
+ "typescript": "^6.0.3",
46
47
  "vitest": "^4.1.2"
47
48
  }
48
49
  }