job-pro 1.0.29 → 1.0.31

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 (2) hide show
  1. package/dist/index.js +17 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -198,6 +198,7 @@ VERBS (same surface for every company)
198
198
  --remember + persist answers to profile.custom
199
199
  --batch <file|-> apply to many post_ids (one/line)
200
200
  --debug-submit-to <url> verify wire format
201
+ --debug-submit ↑ shorthand → httpbin.org/post
201
202
  --really-submit actually fire (env-gated)
202
203
  --allow-stale-session bypass 30-day session-age gate
203
204
  memory list | get <k> | set k=v | event <kind> [payload] | clear
@@ -452,7 +453,12 @@ async function runCompany(adapter, company, rawArgs) {
452
453
  const schemaOnly = args.includes("--schema");
453
454
  const interactive = args.includes("--interactive");
454
455
  const remember = args.includes("--remember");
455
- const { args: aDebug, value: debugUrl } = popFlagValue(args, "--debug-submit-to");
456
+ let { args: aDebug, value: debugUrl } = popFlagValue(args, "--debug-submit-to");
457
+ // Shorthand: `--debug-submit` without URL → default httpbin echo.
458
+ if (!debugUrl && aDebug.includes("--debug-submit")) {
459
+ aDebug = aDebug.filter((a) => a !== "--debug-submit");
460
+ debugUrl = "https://httpbin.org/post";
461
+ }
456
462
  const { args: aForm, value: formFilePath } = popFlagValue(aDebug, "--form-file");
457
463
  const { args: aBatch, value: batchPath } = popFlagValue(aForm, "--batch");
458
464
  // Batch mode: read post_ids from a file (or stdin if "-"). Each non-empty,
@@ -495,7 +501,15 @@ async function runCompany(adapter, company, rawArgs) {
495
501
  }
496
502
  const session = loadSession(company);
497
503
  const out = [];
504
+ // Progress to stderr (so stdout JSON stays clean for pipes). Only when
505
+ // not --compact AND not piping stdout (interactive TTY).
506
+ const showProgress = !compact && process.stderr.isTTY && postIds.length > 1;
507
+ let progressIdx = 0;
498
508
  for (const id of postIds) {
509
+ progressIdx++;
510
+ if (showProgress) {
511
+ process.stderr.write(`\r[${progressIdx}/${postIds.length}] ${id.padEnd(28)}\x1b[K`);
512
+ }
499
513
  try {
500
514
  const schemaResult = (await fetchSchema.call(adapter, id));
501
515
  if (!schemaResult.ok || !schemaResult.schema) {
@@ -530,6 +544,8 @@ async function runCompany(adapter, company, rawArgs) {
530
544
  out.push({ post_id: id, ok: false, message: err instanceof Error ? err.message : String(err) });
531
545
  }
532
546
  }
547
+ if (showProgress)
548
+ process.stderr.write(`\r\x1b[K`);
533
549
  const okCount = out.filter((r) => r.ok).length;
534
550
  return emit({ mode: debugUrl ? "batch-debug" : "batch-dry-run", company, total: out.length, ok_count: okCount, results: out }, compact);
535
551
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "job-pro",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "Query Chinese big-tech campus recruiting from your terminal. 50 companies, all 50 live. 46 via each company's own API; the 4 with no public canonical feed (Hikvision, CICC, Cainiao, WeBank) surfaced via Liepin as a clearly-labeled third-party fallback. No signup, no token, no server.",
5
5
  "homepage": "https://job.ha7ch.com",
6
6
  "repository": "https://github.com/HA7CH/job-pro",