job-pro 1.0.8 → 1.0.10
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/dist/apply.js +11 -1
- package/dist/index.js +15 -3
- package/package.json +1 -1
package/dist/apply.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// Fields beyond first_name / last_name / email / phone / resume are
|
|
14
14
|
// passed through to whatever per-company custom question matches their
|
|
15
15
|
// `name` (e.g. `linkedin_url`, `nationality`).
|
|
16
|
-
import { readFileSync, existsSync, statSync } from "node:fs";
|
|
16
|
+
import { readFileSync, writeFileSync, existsSync, statSync } from "node:fs";
|
|
17
17
|
import { homedir } from "node:os";
|
|
18
18
|
import { basename, join } from "node:path";
|
|
19
19
|
import { withPage, injectCookies } from "./cdp.js";
|
|
@@ -91,6 +91,16 @@ export function loadProfile() {
|
|
|
91
91
|
export function profileTemplate() {
|
|
92
92
|
return { path: PROFILE_PATH, template: TEMPLATE };
|
|
93
93
|
}
|
|
94
|
+
/** Persist a profile back to disk. Used by `apply --remember`. */
|
|
95
|
+
export function saveProfile(profile) {
|
|
96
|
+
try {
|
|
97
|
+
writeFileSync(PROFILE_PATH, JSON.stringify(profile, null, 2) + "\n", "utf8");
|
|
98
|
+
return { ok: true, path: PROFILE_PATH };
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
return { ok: false, message: `could not write ${PROFILE_PATH}: ${err instanceof Error ? err.message : err}` };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
94
104
|
/** Fill in known answers from the profile; flag any unanswered required fields. */
|
|
95
105
|
export function stageApplication(schema, profile) {
|
|
96
106
|
const staged = [];
|
package/dist/index.js
CHANGED
|
@@ -50,7 +50,7 @@ import * as geely from "./geely.js";
|
|
|
50
50
|
import * as webank from "./webank.js";
|
|
51
51
|
import * as horizonrobotics from "./horizonrobotics.js";
|
|
52
52
|
import * as cambricon from "./cambricon.js";
|
|
53
|
-
import { loadProfile, loadSession, profileTemplate, stageApplication, submitApplication, executeFeishu3Step, executeMokaApply, executeBeisenWecruit, executeBeisenITalent, executeCdpRealBrowser, buildFormTemplate, applyFormFile, promptUnansweredFields, formatStaged, } from "./apply.js";
|
|
53
|
+
import { loadProfile, loadSession, profileTemplate, saveProfile, stageApplication, submitApplication, executeFeishu3Step, executeMokaApply, executeBeisenWecruit, executeBeisenITalent, executeCdpRealBrowser, buildFormTemplate, applyFormFile, promptUnansweredFields, formatStaged, } from "./apply.js";
|
|
54
54
|
import { createInterface } from "node:readline";
|
|
55
55
|
import { memoryList, memoryGet, memorySet, memoryEvent, memoryClear, } from "./memory.js";
|
|
56
56
|
import { writeFileSync, mkdirSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
@@ -164,6 +164,7 @@ VERBS (same surface for every company)
|
|
|
164
164
|
--print-form emit a fillable JSON template
|
|
165
165
|
--form-file <path> merge per-job answers
|
|
166
166
|
--interactive prompt for unanswered fields
|
|
167
|
+
--remember + persist answers to profile.custom
|
|
167
168
|
--batch <file|-> apply to many post_ids (one/line)
|
|
168
169
|
--debug-submit-to <url> verify wire format
|
|
169
170
|
--really-submit actually fire (env-gated)
|
|
@@ -417,6 +418,7 @@ async function runCompany(adapter, company, rawArgs) {
|
|
|
417
418
|
const reallySubmit = args.includes("--really-submit");
|
|
418
419
|
const printForm = args.includes("--print-form");
|
|
419
420
|
const interactive = args.includes("--interactive");
|
|
421
|
+
const remember = args.includes("--remember");
|
|
420
422
|
const { args: aDebug, value: debugUrl } = popFlagValue(args, "--debug-submit-to");
|
|
421
423
|
const { args: aForm, value: formFilePath } = popFlagValue(aDebug, "--form-file");
|
|
422
424
|
const { args: aBatch, value: batchPath } = popFlagValue(aForm, "--batch");
|
|
@@ -501,7 +503,7 @@ async function runCompany(adapter, company, rawArgs) {
|
|
|
501
503
|
void aBatch;
|
|
502
504
|
const postId = args[0];
|
|
503
505
|
if (!postId)
|
|
504
|
-
die(`usage: job-pro ${company} apply <post_id> [--print-form | --form-file <path> | --interactive | --batch <file>] [--debug-submit-to <url> | --really-submit]`);
|
|
506
|
+
die(`usage: job-pro ${company} apply <post_id> [--print-form | --form-file <path> | --interactive [--remember] | --batch <file>] [--debug-submit-to <url> | --really-submit]`);
|
|
505
507
|
const fetchSchema = adapter.fetchApplicationSchema;
|
|
506
508
|
if (typeof fetchSchema !== "function") {
|
|
507
509
|
return emit({
|
|
@@ -573,7 +575,17 @@ async function runCompany(adapter, company, rawArgs) {
|
|
|
573
575
|
...effectiveProfile,
|
|
574
576
|
custom: { ...(effectiveProfile.custom ?? {}), ...overrides },
|
|
575
577
|
};
|
|
576
|
-
|
|
578
|
+
const collectedCount = Object.keys(overrides).length;
|
|
579
|
+
console.log(`\nCollected ${collectedCount} answer(s). Staging now…\n`);
|
|
580
|
+
if (remember && collectedCount > 0) {
|
|
581
|
+
const saved = saveProfile(effectiveProfile);
|
|
582
|
+
if (saved.ok) {
|
|
583
|
+
console.log(`Saved ${collectedCount} answer(s) to ${saved.path} (custom.*).\n`);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
console.error(`--remember failed: ${saved.message}`);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
577
589
|
}
|
|
578
590
|
const staged = stageApplication(sr.schema, effectiveProfile);
|
|
579
591
|
const session = loadSession(company);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "job-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
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",
|