jobkompass-cli 0.1.5 → 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.
Files changed (3) hide show
  1. package/README.md +37 -2
  2. package/dist/index.js +174 -6
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,7 +10,7 @@ Run your JobKompass job search from the terminal — or let an AI agent (Claude
10
10
  `JK_BASE_URL` overrides the target deployment (defaults to the live one).
11
11
 
12
12
  ## For agents
13
- - Run `jk schema` once — it returns every route, param, and type as JSON.
13
+ - Run `jk schema` once — it returns every route, param, and type as JSON, plus `workflows.resumeQuestions` (the never-invent-a-number flow).
14
14
  - Output is JSON whenever stdout is piped. Exit codes: 0 ok, 1 your mistake (read `error.hint`), 2 server/network.
15
15
  - Destructive commands need `--yes`. Nothing ever prompts.
16
16
 
@@ -23,7 +23,42 @@ Run your JobKompass job search from the terminal — or let an AI agent (Claude
23
23
  jk resumes list
24
24
  jk resources add --title "Salary guide" --url "https://..."
25
25
 
26
- Resume templates: `jake` (default) or `mar` (Calibri-style, competencies-forward — use `--core-competencies` and `--early-career`). Run `jk resumes add --help` for all fields.
26
+ ## Folders
27
+ Resumes can be filed into the same folders you see in Documents (one folder per resume).
28
+ Moving only changes the folder: content is never touched and nothing is deleted.
29
+
30
+ jk folders list # id, name, resumeCount, coverLetterCount
31
+ jk resumes move --folder "archived resumes" --ids <id1>,<id2> # moves right away (--dry-run to preview)
32
+ jk resumes move --folder "archived resumes" --all-except-favorites # DRY RUN: lists what would move
33
+ jk resumes move --folder "archived resumes" --all-except-favorites --yes # actually moves
34
+
35
+ `--folder` takes an id or an exact name (case-insensitive); an unknown or ambiguous name is an error, so pass the id.
36
+ `--all-except-favorites` selects every resume not starred as a favorite and is always a dry run unless `--yes`.
37
+ Returns `{dryRun, folder, moved, skipped, alreadyInFolder, counts: {moved, skipped, alreadyInFolder, total}}`;
38
+ on a dry run `moved` lists what would move. Favorites and ids that aren't yours come back in `skipped` with a reason.
39
+
40
+ ## Resume questions: never invent a number
41
+ Strong bullets carry numbers. Only the human knows them, so the API asks instead of guessing.
42
+
43
+ jk resumes questions --id <baseResumeId> [--job <jobId>] [--ai] # before writing
44
+ jk resumes answer --id <baseResumeId> --answers '[{"id":"<question id>","answer":"about 40 a day"}]'
45
+ jk resumes get --id <baseResumeId> # shows saved bulletAnswers
46
+ jk resumes add ... --job <jobId> [--ai-questions] # response: questions + scorecard
47
+ jk resumes tailor --base <resumeId> --job <jobId> [--template mar] [--instructions "lead with the data work"]
48
+ # server writes it, using saved answers
49
+
50
+ `resumes add` / `update` return `{id, name, fileUrl, questions, questionSource, scorecard, rule}`.
51
+ Questions are built-in by default (free, instant); `--ai-questions` / `--ai` asks the model instead and never rewrites
52
+ your content. Relay questions to your human, save their answers with `jk resumes answer`, and every later resume reuses them.
53
+
54
+ `resumes tailor` saves the same result as tailoring in the app: your saved resume preferences plus `--instructions`,
55
+ your default template (unless `--template`), the app's document name, the "what changed" marks and must-haves shown in
56
+ Documents, and the job's `resumeUsed`. Passing an already-tailored resume as `--base` writes from the original base it
57
+ came from, with that base's saved answers. The raw API also takes `preferences` (a JSON array) to replace the saved ones.
58
+ If `--template` is above your plan, tailoring still runs with `jake` and prints a notice (the `notice` field in `--json`)
59
+ instead of failing.
60
+
61
+ Resume templates: `jake` (default), `joseph` (Calibri-style, competencies-forward: use `--core-competencies` and `--early-career`) or `mar` (Times serif, categorized skills). Joseph and Mar need a paid plan. Run `jk resumes add --help` for all fields.
27
62
 
28
63
  ## Keys
29
64
  A key carries full access to one account's data. Name each key after where it lives
package/dist/index.js CHANGED
@@ -2,8 +2,12 @@
2
2
 
3
3
  // src/index.ts
4
4
  import { Command } from "commander";
5
+ import { readFileSync as readFileSync2 } from "fs";
5
6
 
6
7
  // src/commands.ts
8
+ function parseList(raw) {
9
+ return [...new Set(raw.split(",").map((s) => s.trim()).filter(Boolean))];
10
+ }
7
11
  var jobWriteOpts = [
8
12
  { flag: "--compensation <c>", api: "compensation", type: "str" },
9
13
  { flag: "--keywords <json>", api: "keywords", type: "json", desc: '["kw1","kw2"]' },
@@ -16,6 +20,27 @@ var jobWriteOpts = [
16
20
  { flag: "--coverletter-used <name>", api: "coverLetterUsed", type: "str" },
17
21
  { flag: "--notes <text>", api: "notes", type: "str" }
18
22
  ];
23
+ var prepWriteOpts = [
24
+ { flag: "--job-id <id>", api: "jobId", type: "str" },
25
+ { flag: "--interviewer-name <n>", api: "interviewerName", type: "str" },
26
+ { flag: "--interviewer-role <r>", api: "interviewerRole", type: "str" },
27
+ { flag: "--interviewer-email <e>", api: "interviewerEmail", type: "str" },
28
+ { flag: "--interview-date <d>", api: "interviewDate", type: "str" },
29
+ { flag: "--meeting-link <url>", api: "meetingLink", type: "str" },
30
+ { flag: "--phone-backup <p>", api: "phoneBackup", type: "str" },
31
+ { flag: "--compensation-target <c>", api: "compensationTarget", type: "str" },
32
+ { flag: "--resume-used <name>", api: "resumeUsed", type: "str" },
33
+ { flag: "--status <s>", api: "status", type: "str", desc: "upcoming|ready|completed|archived" },
34
+ { flag: "--elevator-pitch <text>", api: "elevatorPitch", type: "str" },
35
+ { flag: "--role-summary <text>", api: "roleSummary", type: "str" },
36
+ { flag: "--flashcards <json>", api: "flashcards", type: "json", desc: "JSON or @file.json; replaces the array" },
37
+ { flag: "--stories <json>", api: "stories", type: "json", desc: "JSON or @file.json; replaces the array" },
38
+ { flag: "--requirement-matches <json>", api: "requirementMatches", type: "json", desc: "JSON or @file.json" },
39
+ { flag: "--questions <json>", api: "questionsToAsk", type: "json", desc: "JSON or @file.json" },
40
+ { flag: "--traps <json>", api: "trapsAndGuardrails", type: "json", desc: "JSON or @file.json" },
41
+ { flag: "--checklist <json>", api: "checklist", type: "json", desc: "JSON or @file.json" },
42
+ { flag: "--call-notes <text>", api: "callNotes", type: "str" }
43
+ ];
19
44
  var resourceWriteOpts = [
20
45
  { flag: "--description <text>", api: "description", type: "str" },
21
46
  { flag: "--notes <text>", api: "notes", type: "str" },
@@ -99,6 +124,16 @@ var commands = [
99
124
  path: "/agent/resumes/duplicate",
100
125
  opts: [{ flag: "--id <id>", api: "id", type: "str", required: true }]
101
126
  },
127
+ {
128
+ name: "resumes share",
129
+ desc: "Get a public link to a resume's PDF (--off makes it private)",
130
+ method: "POST",
131
+ path: "/agent/resumes/share",
132
+ opts: [
133
+ { flag: "--id <id>", api: "id", type: "str", required: true },
134
+ { flag: "--off", api: "off", type: "bool" }
135
+ ]
136
+ },
102
137
  {
103
138
  name: "resumes delete",
104
139
  desc: "Delete a resume + stored file",
@@ -130,7 +165,9 @@ var commands = [
130
165
  { flag: "--early-career <json>", api: "earlyCareer", type: "json", desc: "(Joseph template) [{title,company,location?,date}]" },
131
166
  { flag: "--additional-info <json>", api: "additionalInfo", type: "json", desc: '{"languages"?:[...],"references"?}' },
132
167
  { flag: "--target-company <name>", api: "targetCompany", type: "str", desc: "Included in the saved resume's name" },
133
- { flag: "--template <id>", api: "template", type: "str", desc: "Template id: jake (default), joseph or mar" }
168
+ { flag: "--template <id>", api: "template", type: "str", desc: "Template id: jake (default), joseph or mar" },
169
+ { flag: "--job <id>", api: "jobId", type: "str", desc: "Saved job this targets: scorecard must-haves + context for --ai-questions" },
170
+ { flag: "--ai-questions", api: "aiQuestions", type: "bool", desc: "Ask the model for sharper questions (slower). Your content is never rewritten" }
134
171
  ]
135
172
  },
136
173
  {
@@ -155,9 +192,65 @@ var commands = [
155
192
  { flag: "--core-competencies <json>", api: "coreCompetencies", type: "json", desc: '(Joseph template) ["Technical Support",...]' },
156
193
  { flag: "--early-career <json>", api: "earlyCareer", type: "json", desc: "(Joseph template) [{title,company,location?,date}]" },
157
194
  { flag: "--additional-info <json>", api: "additionalInfo", type: "json", desc: '{"languages"?:[...],"references"?}' },
158
- { flag: "--template <id>", api: "template", type: "str", desc: "Switch template: jake, joseph or mar" }
195
+ { flag: "--template <id>", api: "template", type: "str", desc: "Switch template: jake, joseph or mar" },
196
+ { flag: "--job <id>", api: "jobId", type: "str", desc: "Saved job this targets: scorecard must-haves + context for --ai-questions" },
197
+ { flag: "--ai-questions", api: "aiQuestions", type: "bool", desc: "Ask the model for sharper questions (slower). Your content is never rewritten" }
198
+ ]
199
+ },
200
+ {
201
+ name: "resumes questions",
202
+ desc: "Questions about bullets missing a number, before generating (ask your human, then 'jk resumes answer')",
203
+ method: "GET",
204
+ path: "/agent/resumes/questions",
205
+ opts: [
206
+ { flag: "--id <id>", api: "id", type: "str", required: true },
207
+ { flag: "--job <id>", api: "jobId", type: "str", desc: "Saved job to target" },
208
+ { flag: "--ai", api: "ai", type: "bool", desc: "Ask the model (slower); default is built-in questions" }
209
+ ]
210
+ },
211
+ {
212
+ name: "resumes answer",
213
+ desc: "Save your human's answers as facts on the base resume (reused by every later resume)",
214
+ method: "POST",
215
+ path: "/agent/resumes/answers",
216
+ opts: [
217
+ { flag: "--id <id>", api: "id", type: "str", required: true, desc: "Resume the questions came from (a tailored resume saves onto its base)" },
218
+ {
219
+ flag: "--answers <json>",
220
+ api: "answers",
221
+ type: "json",
222
+ required: true,
223
+ desc: '[{"id":"<question id>","answer":"..."}] or [{"section","index","bullet","answer"}]; JSON or @file.json'
224
+ }
225
+ ]
226
+ },
227
+ {
228
+ name: "resumes tailor",
229
+ desc: "Server-side tailoring of a resume to a saved job, using saved answers; makes a NEW resume PDF",
230
+ method: "POST",
231
+ path: "/agent/resumes/tailor",
232
+ opts: [
233
+ { flag: "--base <id>", api: "base", type: "str", required: true, desc: "Resume to tailor from (not modified)" },
234
+ { flag: "--job <id>", api: "jobId", type: "str", required: true },
235
+ { flag: "--template <id>", api: "template", type: "str", desc: "jake, joseph or mar (default: your default template, then the base's)" },
236
+ { flag: "--instructions <text>", api: "instructions", type: "str", desc: "One-off instruction (wording and emphasis only, never new facts); added after your saved resume preferences" }
237
+ ]
238
+ },
239
+ {
240
+ name: "resumes move",
241
+ desc: "File resumes into a folder (only the folder changes; nothing is deleted). Bulk is a dry run unless --yes",
242
+ method: "POST",
243
+ path: "/agent/resumes/move",
244
+ opts: [
245
+ { flag: "--folder <name|id>", api: "folder", type: "str", required: true, desc: "Folder id or exact name (case-insensitive); see 'jk folders list'" },
246
+ { flag: "--ids <ids>", api: "resumeIds", type: "list", desc: "Comma-separated resume ids" },
247
+ { flag: "--all-except-favorites", api: "allExceptFavorites", type: "bool", desc: "Every resume that is not a favorite (dry run unless --yes)" },
248
+ { flag: "--dry-run", api: "dryRun", type: "bool", desc: "Show what would move; change nothing" },
249
+ { flag: "--yes", api: "confirm", type: "bool", desc: "Confirm a bulk move (--all-except-favorites)" }
159
250
  ]
160
251
  },
252
+ // folders
253
+ { name: "folders list", desc: "List document folders with resume/cover letter counts", method: "GET", path: "/agent/folders", opts: [] },
161
254
  // coverletters
162
255
  { name: "coverletters list", desc: "List cover letters (metadata)", method: "GET", path: "/agent/coverletters", opts: [] },
163
256
  {
@@ -261,6 +354,52 @@ var commands = [
261
354
  confirm: true,
262
355
  opts: [{ flag: "--id <id>", api: "id", type: "str", required: true }]
263
356
  },
357
+ // interview preps
358
+ {
359
+ name: "preps list",
360
+ desc: "List interview prep decks",
361
+ method: "GET",
362
+ path: "/agent/interviewpreps",
363
+ opts: [{ flag: "--job-id <id>", api: "jobId", type: "str" }]
364
+ },
365
+ {
366
+ name: "preps get",
367
+ desc: "Get one interview prep deck in full",
368
+ method: "GET",
369
+ path: "/agent/interviewpreps/get",
370
+ opts: [{ flag: "--id <id>", api: "id", type: "str", required: true }]
371
+ },
372
+ {
373
+ name: "preps add",
374
+ desc: "Create an interview prep deck",
375
+ method: "POST",
376
+ path: "/agent/interviewpreps",
377
+ opts: [
378
+ { flag: "--company <c>", api: "company", type: "str", required: true },
379
+ { flag: "--role <r>", api: "role", type: "str", required: true },
380
+ ...prepWriteOpts
381
+ ]
382
+ },
383
+ {
384
+ name: "preps update",
385
+ desc: "Update an interview prep deck (array flags replace the whole array)",
386
+ method: "PATCH",
387
+ path: "/agent/interviewpreps",
388
+ opts: [
389
+ { flag: "--id <id>", api: "id", type: "str", required: true },
390
+ { flag: "--company <c>", api: "company", type: "str" },
391
+ { flag: "--role <r>", api: "role", type: "str" },
392
+ ...prepWriteOpts
393
+ ]
394
+ },
395
+ {
396
+ name: "preps delete",
397
+ desc: "Delete an interview prep deck",
398
+ method: "DELETE",
399
+ path: "/agent/interviewpreps",
400
+ confirm: true,
401
+ opts: [{ flag: "--id <id>", api: "id", type: "str", required: true }]
402
+ },
264
403
  // threads (read-only)
265
404
  { name: "threads list", desc: "List AI chat threads", method: "GET", path: "/agent/threads", opts: [] },
266
405
  {
@@ -387,9 +526,35 @@ function renderPretty(data) {
387
526
  }
388
527
  return String(data);
389
528
  }
529
+ function isMoveResult(data) {
530
+ const d = data;
531
+ return Boolean(d && typeof d === "object" && typeof d.dryRun === "boolean" && d.counts && d.folder && Array.isArray(d.moved));
532
+ }
533
+ function renderMove(r) {
534
+ const verb = r.dryRun ? "DRY RUN: would move" : "Moved";
535
+ const lines = [
536
+ `${verb} ${r.counts.moved} of ${r.counts.total} resume(s) into '${r.folder.name}' (${r.folder.id}).`,
537
+ `Already in folder: ${r.counts.alreadyInFolder}. Skipped: ${r.counts.skipped}.`
538
+ ];
539
+ if (r.moved.length) lines.push("", ...r.moved.map((m) => ` ${m.id} ${m.name}`));
540
+ if (r.skipped.length) lines.push("", "Skipped:", ...r.skipped.map((s) => ` ${s.id} ${s.name ?? ""} (${s.reason})`));
541
+ if (r.hint) lines.push("", r.hint);
542
+ return lines.join("\n");
543
+ }
544
+ function formatOutput(data, machine) {
545
+ if (machine) return JSON.stringify(data, null, 2);
546
+ if (isMoveResult(data)) return renderMove(data);
547
+ if (data && typeof data === "object" && !Array.isArray(data)) {
548
+ const { notice, ...rest } = data;
549
+ if (typeof notice === "string" && notice) return `Notice: ${notice}
550
+
551
+ ${renderPretty(rest)}`;
552
+ }
553
+ return renderPretty(data);
554
+ }
390
555
  function emit(data, opts = {}) {
391
- const machine = opts.json || !process.stdout.isTTY;
392
- process.stdout.write((machine ? JSON.stringify(data, null, 2) : renderPretty(data)) + "\n");
556
+ const machine = Boolean(opts.json) || !process.stdout.isTTY;
557
+ process.stdout.write(formatOutput(data, machine) + "\n");
393
558
  }
394
559
 
395
560
  // src/dates.ts
@@ -411,7 +576,7 @@ function toIso(d) {
411
576
  // package.json
412
577
  var package_default = {
413
578
  name: "jobkompass-cli",
414
- version: "0.1.5",
579
+ version: "0.3.0",
415
580
  description: "Agent-first CLI for JobKompass \u2014 run your job search from the terminal, or let an AI agent run it for you.",
416
581
  license: "MIT",
417
582
  type: "module",
@@ -473,9 +638,12 @@ function coerceOpt(spec, raw) {
473
638
  case "bool":
474
639
  return true;
475
640
  // value-less flag
641
+ case "list":
642
+ return parseList(String(raw));
476
643
  case "json":
477
644
  try {
478
- return JSON.parse(String(raw));
645
+ const text = String(raw);
646
+ return JSON.parse(text.startsWith("@") ? readFileSync2(text.slice(1), "utf8") : text);
479
647
  } catch {
480
648
  fatal("invalid_option", `Option ${spec.flag.split(" ")[0]} must be valid JSON`, `Example: '${spec.desc ?? "[...]"}'`, 1);
481
649
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jobkompass-cli",
3
- "version": "0.1.5",
3
+ "version": "0.3.0",
4
4
  "description": "Agent-first CLI for JobKompass — run your job search from the terminal, or let an AI agent run it for you.",
5
5
  "license": "MIT",
6
6
  "type": "module",