jobkompass-cli 0.2.0 → 0.4.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/README.md +25 -0
- package/dist/index.js +55 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,6 +23,31 @@ 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
|
+
## Folders
|
|
27
|
+
Resumes and cover letters can be filed into the same folders you see in Documents (one folder per document).
|
|
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
|
+
Cover letters work the same way:
|
|
41
|
+
|
|
42
|
+
jk coverletters move --folder "Archive - Cover Letters" --ids <id1>,<id2> # moves right away (--dry-run to preview)
|
|
43
|
+
jk coverletters move --folder "Archive - Cover Letters" --all # DRY RUN: every letter not already in the folder
|
|
44
|
+
jk coverletters move --folder "Archive - Cover Letters" --all --unfiled-only # DRY RUN: only letters in no folder yet
|
|
45
|
+
jk coverletters move --folder "Archive - Cover Letters" --all --unfiled-only --yes # actually moves
|
|
46
|
+
|
|
47
|
+
`--all` is always a dry run unless `--yes`. Letters already in the folder come back in `alreadyInFolder`;
|
|
48
|
+
with `--unfiled-only`, letters filed in another folder come back in `skipped` as `in_other_folder`.
|
|
49
|
+
Same result shape as `jk resumes move`.
|
|
50
|
+
|
|
26
51
|
## Resume questions: never invent a number
|
|
27
52
|
Strong bullets carry numbers. Only the human knows them, so the API asks instead of guessing.
|
|
28
53
|
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,9 @@ import { Command } from "commander";
|
|
|
5
5
|
import { readFileSync as readFileSync2 } from "fs";
|
|
6
6
|
|
|
7
7
|
// src/commands.ts
|
|
8
|
+
function parseList(raw) {
|
|
9
|
+
return [...new Set(raw.split(",").map((s) => s.trim()).filter(Boolean))];
|
|
10
|
+
}
|
|
8
11
|
var jobWriteOpts = [
|
|
9
12
|
{ flag: "--compensation <c>", api: "compensation", type: "str" },
|
|
10
13
|
{ flag: "--keywords <json>", api: "keywords", type: "json", desc: '["kw1","kw2"]' },
|
|
@@ -233,8 +236,38 @@ var commands = [
|
|
|
233
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" }
|
|
234
237
|
]
|
|
235
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)" }
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
// folders
|
|
253
|
+
{ name: "folders list", desc: "List document folders with resume/cover letter counts", method: "GET", path: "/agent/folders", opts: [] },
|
|
236
254
|
// coverletters
|
|
237
255
|
{ name: "coverletters list", desc: "List cover letters (metadata)", method: "GET", path: "/agent/coverletters", opts: [] },
|
|
256
|
+
{
|
|
257
|
+
name: "coverletters move",
|
|
258
|
+
desc: "File cover letters into a folder (only the folder changes; nothing is deleted). Bulk is a dry run unless --yes",
|
|
259
|
+
method: "POST",
|
|
260
|
+
path: "/agent/coverletters/move",
|
|
261
|
+
itemNoun: "cover letter",
|
|
262
|
+
opts: [
|
|
263
|
+
{ flag: "--folder <name|id>", api: "folder", type: "str", required: true, desc: "Folder id or exact name (case-insensitive); see 'jk folders list'" },
|
|
264
|
+
{ flag: "--ids <ids>", api: "coverLetterIds", type: "list", desc: "Comma-separated cover letter ids" },
|
|
265
|
+
{ flag: "--all", api: "all", type: "bool", desc: "Every cover letter not already in the folder (dry run unless --yes)" },
|
|
266
|
+
{ flag: "--unfiled-only", api: "unfiledOnly", type: "bool", desc: "With --all: only cover letters in no folder yet" },
|
|
267
|
+
{ flag: "--dry-run", api: "dryRun", type: "bool", desc: "Show what would move; change nothing" },
|
|
268
|
+
{ flag: "--yes", api: "confirm", type: "bool", desc: "Confirm a bulk move (--all)" }
|
|
269
|
+
]
|
|
270
|
+
},
|
|
238
271
|
{
|
|
239
272
|
name: "coverletters get",
|
|
240
273
|
desc: "Get a cover letter with content",
|
|
@@ -508,8 +541,24 @@ function renderPretty(data) {
|
|
|
508
541
|
}
|
|
509
542
|
return String(data);
|
|
510
543
|
}
|
|
511
|
-
function
|
|
544
|
+
function isMoveResult(data) {
|
|
545
|
+
const d = data;
|
|
546
|
+
return Boolean(d && typeof d === "object" && typeof d.dryRun === "boolean" && d.counts && d.folder && Array.isArray(d.moved));
|
|
547
|
+
}
|
|
548
|
+
function renderMove(r, itemNoun = "resume") {
|
|
549
|
+
const verb = r.dryRun ? "DRY RUN: would move" : "Moved";
|
|
550
|
+
const lines = [
|
|
551
|
+
`${verb} ${r.counts.moved} of ${r.counts.total} ${itemNoun}(s) into '${r.folder.name}' (${r.folder.id}).`,
|
|
552
|
+
`Already in folder: ${r.counts.alreadyInFolder}. Skipped: ${r.counts.skipped}.`
|
|
553
|
+
];
|
|
554
|
+
if (r.moved.length) lines.push("", ...r.moved.map((m) => ` ${m.id} ${m.name}`));
|
|
555
|
+
if (r.skipped.length) lines.push("", "Skipped:", ...r.skipped.map((s) => ` ${s.id} ${s.name ?? ""} (${s.reason})`));
|
|
556
|
+
if (r.hint) lines.push("", r.hint);
|
|
557
|
+
return lines.join("\n");
|
|
558
|
+
}
|
|
559
|
+
function formatOutput(data, machine, itemNoun) {
|
|
512
560
|
if (machine) return JSON.stringify(data, null, 2);
|
|
561
|
+
if (isMoveResult(data)) return renderMove(data, itemNoun);
|
|
513
562
|
if (data && typeof data === "object" && !Array.isArray(data)) {
|
|
514
563
|
const { notice, ...rest } = data;
|
|
515
564
|
if (typeof notice === "string" && notice) return `Notice: ${notice}
|
|
@@ -520,7 +569,7 @@ ${renderPretty(rest)}`;
|
|
|
520
569
|
}
|
|
521
570
|
function emit(data, opts = {}) {
|
|
522
571
|
const machine = Boolean(opts.json) || !process.stdout.isTTY;
|
|
523
|
-
process.stdout.write(formatOutput(data, machine) + "\n");
|
|
572
|
+
process.stdout.write(formatOutput(data, machine, opts.itemNoun) + "\n");
|
|
524
573
|
}
|
|
525
574
|
|
|
526
575
|
// src/dates.ts
|
|
@@ -542,7 +591,7 @@ function toIso(d) {
|
|
|
542
591
|
// package.json
|
|
543
592
|
var package_default = {
|
|
544
593
|
name: "jobkompass-cli",
|
|
545
|
-
version: "0.
|
|
594
|
+
version: "0.4.0",
|
|
546
595
|
description: "Agent-first CLI for JobKompass \u2014 run your job search from the terminal, or let an AI agent run it for you.",
|
|
547
596
|
license: "MIT",
|
|
548
597
|
type: "module",
|
|
@@ -604,6 +653,8 @@ function coerceOpt(spec, raw) {
|
|
|
604
653
|
case "bool":
|
|
605
654
|
return true;
|
|
606
655
|
// value-less flag
|
|
656
|
+
case "list":
|
|
657
|
+
return parseList(String(raw));
|
|
607
658
|
case "json":
|
|
608
659
|
try {
|
|
609
660
|
const text = String(raw);
|
|
@@ -659,7 +710,7 @@ function register(spec) {
|
|
|
659
710
|
}
|
|
660
711
|
try {
|
|
661
712
|
const data = spec.method === "GET" || spec.method === "DELETE" ? await apiRequest(spec.method, spec.path, { query: payload }) : await apiRequest(spec.method, spec.path, { body: payload });
|
|
662
|
-
emit(data, { json: Boolean(program.opts().json) });
|
|
713
|
+
emit(data, { json: Boolean(program.opts().json), itemNoun: spec.itemNoun });
|
|
663
714
|
} catch (err) {
|
|
664
715
|
if (err instanceof CliError) fatal(err.code, err.message, err.hint, err.exitCode);
|
|
665
716
|
throw err;
|
package/package.json
CHANGED