@chalksurf/cli 0.2.0 → 0.2.2
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/README.md +26 -22
- package/dist/bin/chalksurf.js +11 -4
- package/dist/commands/auth.js +19 -12
- package/dist/commands/exercise.js +182 -10
- package/dist/commands/job.js +108 -40
- package/dist/commands/org.js +10 -6
- package/dist/commands/profile.js +97 -0
- package/dist/commands/sheet.js +325 -31
- package/dist/lib/api-client.js +11 -2
- package/dist/lib/command-options.js +61 -0
- package/dist/lib/config-store.js +188 -10
- package/dist/lib/import-output.js +14 -0
- package/dist/lib/manifest.js +24 -0
- package/dist/lib/session.js +27 -0
- package/dist/lib/translation-languages.js +15 -0
- package/dist/lib/user-jobs.js +6 -0
- package/docs/agents.md +76 -14
- package/docs/examples/exercise-import-manifest.json +1 -0
- package/docs/examples/exercise-sheet-solution-import-manifest.json +13 -0
- package/docs/manifest.md +25 -3
- package/docs/manual.md +72 -11
- package/package.json +1 -1
- package/schemas/exercise-import-manifest.schema.json +12 -0
- package/schemas/exercise-sheet-solution-import-manifest.schema.json +104 -0
package/docs/manual.md
CHANGED
|
@@ -4,16 +4,25 @@ Use this flow when a person is driving the CLI directly from a terminal.
|
|
|
4
4
|
|
|
5
5
|
## Authentication
|
|
6
6
|
|
|
7
|
-
Interactive login stores the token and base URL in
|
|
7
|
+
Interactive login stores the token and base URL in a named profile:
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
chalksurf auth login --base-url https://api.
|
|
10
|
+
chalksurf auth login --profile prod-cztamas --base-url https://chalksurf-api.fly.dev
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
The same command also works with piped stdin:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
printf '%s' "$CHALKSURF_TOKEN" | chalksurf auth login
|
|
16
|
+
printf '%s' "$CHALKSURF_TOKEN" | chalksurf auth login \
|
|
17
|
+
--profile prod-cztamas \
|
|
18
|
+
--base-url https://chalksurf-api.fly.dev \
|
|
19
|
+
--with-token
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Set the profile you want to use by default in your terminal workflow:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
chalksurf profile use prod-cztamas
|
|
17
26
|
```
|
|
18
27
|
|
|
19
28
|
Check what the CLI will use for the current session:
|
|
@@ -24,9 +33,10 @@ chalksurf auth status
|
|
|
24
33
|
|
|
25
34
|
Config resolution rules:
|
|
26
35
|
|
|
27
|
-
- `--
|
|
28
|
-
- `
|
|
29
|
-
-
|
|
36
|
+
- `--profile` overrides `CHALKSURF_PROFILE`, which overrides the stored default profile.
|
|
37
|
+
- `--base-url` overrides `CHALKSURF_BASE_URL`, which overrides the active profile.
|
|
38
|
+
- `CHALKSURF_TOKEN` overrides the active profile token.
|
|
39
|
+
- `--organization` overrides manifest `organizationId`, which overrides `CHALKSURF_ORGANIZATION_ID`, which overrides the active profile.
|
|
30
40
|
|
|
31
41
|
## Organization Selection
|
|
32
42
|
|
|
@@ -42,6 +52,12 @@ Store a default organization for future commands:
|
|
|
42
52
|
chalksurf org use org_123
|
|
43
53
|
```
|
|
44
54
|
|
|
55
|
+
Store a default organization in a different profile without changing your default profile:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
chalksurf --profile prod-codex org use org_456
|
|
59
|
+
```
|
|
60
|
+
|
|
45
61
|
Override it for one command:
|
|
46
62
|
|
|
47
63
|
```bash
|
|
@@ -56,7 +72,7 @@ Import one sheet and wait for the background job to finish:
|
|
|
56
72
|
chalksurf sheet import ./fixtures/algebra.pdf --wait
|
|
57
73
|
```
|
|
58
74
|
|
|
59
|
-
Import one sheet, override its title, and request an English translation
|
|
75
|
+
Import one sheet, override its title, and request an English translation after import:
|
|
60
76
|
|
|
61
77
|
```bash
|
|
62
78
|
chalksurf sheet import ./fixtures/algebra.pdf \
|
|
@@ -79,6 +95,7 @@ Import exercises into an existing sheet:
|
|
|
79
95
|
```bash
|
|
80
96
|
chalksurf exercise import ./fixtures/problem-set.pdf \
|
|
81
97
|
--sheet-id 00000000-0000-4000-8000-000000000001 \
|
|
98
|
+
--translate-to english \
|
|
82
99
|
--wait
|
|
83
100
|
```
|
|
84
101
|
|
|
@@ -91,6 +108,15 @@ chalksurf exercise import-solution \
|
|
|
91
108
|
--wait
|
|
92
109
|
```
|
|
93
110
|
|
|
111
|
+
Import a separate solution file for an existing exercise sheet:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
chalksurf sheet import-solutions \
|
|
115
|
+
00000000-0000-4000-8000-000000000001 \
|
|
116
|
+
./fixtures/sheet-solutions.pdf \
|
|
117
|
+
--wait
|
|
118
|
+
```
|
|
119
|
+
|
|
94
120
|
Import from a remote URL:
|
|
95
121
|
|
|
96
122
|
```bash
|
|
@@ -110,6 +136,18 @@ Sheet import manifests use top-level `sheets[]`. Each sheet has one destination
|
|
|
110
136
|
|
|
111
137
|
## Working With Jobs
|
|
112
138
|
|
|
139
|
+
List recent jobs:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
chalksurf job list
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Include jobs already viewed or dismissed in the web UI:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
chalksurf job list --include-viewed --include-dismissed
|
|
149
|
+
```
|
|
150
|
+
|
|
113
151
|
Read one job:
|
|
114
152
|
|
|
115
153
|
```bash
|
|
@@ -122,7 +160,29 @@ Wait on one or more jobs later:
|
|
|
122
160
|
chalksurf job wait job_123 job_124
|
|
123
161
|
```
|
|
124
162
|
|
|
125
|
-
`--wait` on an import command means the
|
|
163
|
+
`--wait` on an import command means the parsed content has been saved before the command exits. Requested translations run as separate jobs; use `--json` to capture their job IDs or `chalksurf job list` to inspect them later.
|
|
164
|
+
|
|
165
|
+
## Searching From The CLI
|
|
166
|
+
|
|
167
|
+
Search commands default to `--ownership own`, which means resources in the selected organization.
|
|
168
|
+
|
|
169
|
+
Find exercise sheets by title:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
chalksurf sheet search --text "OKTV 2014"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Find exercises by text:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
chalksurf exercise search --text "binomial theorem" --language english
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Search public resources instead:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
chalksurf sheet search --text "OKTV" --ownership public
|
|
185
|
+
```
|
|
126
186
|
|
|
127
187
|
## Troubleshooting
|
|
128
188
|
|
|
@@ -132,11 +192,12 @@ Missing auth:
|
|
|
132
192
|
chalksurf auth status
|
|
133
193
|
```
|
|
134
194
|
|
|
135
|
-
Use
|
|
195
|
+
Use profiles when switching between local, staging, production, humans, and agents:
|
|
136
196
|
|
|
137
197
|
```bash
|
|
138
|
-
|
|
139
|
-
chalksurf auth login --base-url https://
|
|
198
|
+
chalksurf auth login --profile staging-cztamas --base-url https://chalksurf-api-staging.fly.dev
|
|
199
|
+
chalksurf auth login --profile prod-cztamas --base-url https://chalksurf-api.fly.dev
|
|
200
|
+
chalksurf profile use prod-cztamas
|
|
140
201
|
```
|
|
141
202
|
|
|
142
203
|
Use JSON mode when you need exact machine-readable output:
|
package/package.json
CHANGED
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
"type": "string",
|
|
15
15
|
"minLength": 1
|
|
16
16
|
},
|
|
17
|
+
"translateTo": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"minItems": 1,
|
|
20
|
+
"uniqueItems": true,
|
|
21
|
+
"items": {
|
|
22
|
+
"$ref": "#/$defs/translateLanguage"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
17
25
|
"wait": {
|
|
18
26
|
"type": "boolean"
|
|
19
27
|
},
|
|
@@ -30,6 +38,10 @@
|
|
|
30
38
|
"type": "string",
|
|
31
39
|
"minLength": 1
|
|
32
40
|
},
|
|
41
|
+
"translateLanguage": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": ["english", "hungarian", "german", "french", "spanish", "italian"]
|
|
44
|
+
},
|
|
33
45
|
"localSource": {
|
|
34
46
|
"type": "object",
|
|
35
47
|
"additionalProperties": false,
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/knowledge-maps/chalksurf/blob/main/packages/cli/schemas/exercise-sheet-solution-import-manifest.schema.json",
|
|
4
|
+
"title": "ChalkSurf Exercise Sheet Solution Import Manifest",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["sources"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"organizationId": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"minLength": 1
|
|
12
|
+
},
|
|
13
|
+
"exerciseSheetId": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"minLength": 1
|
|
16
|
+
},
|
|
17
|
+
"wait": {
|
|
18
|
+
"type": "boolean"
|
|
19
|
+
},
|
|
20
|
+
"sources": {
|
|
21
|
+
"type": "array",
|
|
22
|
+
"minItems": 1,
|
|
23
|
+
"items": {
|
|
24
|
+
"$ref": "#/$defs/source"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"$defs": {
|
|
29
|
+
"nonEmptyString": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 1
|
|
32
|
+
},
|
|
33
|
+
"localSource": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"required": ["kind", "path"],
|
|
37
|
+
"properties": {
|
|
38
|
+
"sourceId": {
|
|
39
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
40
|
+
},
|
|
41
|
+
"kind": {
|
|
42
|
+
"const": "local"
|
|
43
|
+
},
|
|
44
|
+
"path": {
|
|
45
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
46
|
+
},
|
|
47
|
+
"relativePath": {
|
|
48
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"directorySource": {
|
|
53
|
+
"type": "object",
|
|
54
|
+
"additionalProperties": false,
|
|
55
|
+
"required": ["kind", "path"],
|
|
56
|
+
"properties": {
|
|
57
|
+
"sourceId": {
|
|
58
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
59
|
+
},
|
|
60
|
+
"kind": {
|
|
61
|
+
"const": "directory"
|
|
62
|
+
},
|
|
63
|
+
"path": {
|
|
64
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
65
|
+
},
|
|
66
|
+
"relativeRoot": {
|
|
67
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"urlSource": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": ["kind", "url"],
|
|
75
|
+
"properties": {
|
|
76
|
+
"sourceId": {
|
|
77
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
78
|
+
},
|
|
79
|
+
"kind": {
|
|
80
|
+
"const": "url"
|
|
81
|
+
},
|
|
82
|
+
"url": {
|
|
83
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
84
|
+
},
|
|
85
|
+
"relativePath": {
|
|
86
|
+
"$ref": "#/$defs/nonEmptyString"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"source": {
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{
|
|
93
|
+
"$ref": "#/$defs/localSource"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"$ref": "#/$defs/directorySource"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"$ref": "#/$defs/urlSource"
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|