ilml-plugin-linkedin 1.6.0 → 1.8.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/CHANGELOG.md +17 -0
- package/dist/applyQueue.mjs +18 -18
- package/dist/daily.mjs +16 -16
- package/dist/enrichProfiles.mjs +264 -0
- package/dist/funnelRunner.mjs +47 -47
- package/dist/messageBot.mjs +31 -31
- package/dist/migrationCli.mjs +17 -17
- package/dist/profileHistory.mjs +9 -0
- package/dist/run.mjs +57 -58
- package/dist/scout.mjs +42 -42
- package/dist/syncAll.mjs +114 -114
- package/dist/verifyAbout.mjs +214 -0
- package/dist/viewers.mjs +70 -70
- package/dist/visit.mjs +115 -115
- package/ilml-plugin.json +3 -1
- package/package.json +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.0
|
|
4
|
+
- **Profile scrape works again on the 2026 LinkedIn DOM.** LinkedIn rebuilt the profile page with obfuscated class hashes and dropped `<h1>` and `section[id]` anchors, which silently broke `viewProfile()` and `sendConnectionRequest()`'s profile-info extraction — every visit had been returning all-null since the redesign. The new extractor uses structural anchors only: the name lives in the first `<h2>` inside `<main>` that isn't a section header; the top card is the nearest ancestor whose direct children include a contentful `<p>` (excluding connection-degree badges and pronoun chips); the About section is found by `<h2>About</h2>` walking to its `<section>` ancestor. Tested across recruiter, founder, and engineer profiles. `<h1>` is still tried first as a fallback in case LinkedIn ever reverts.
|
|
5
|
+
- **India / Pakistan location filter no longer leaks.** Three connection requests went to India-based recruiters in the last two weeks despite `FUNNEL_EXCLUDE_LOCATIONS=India,Pakistan`. Root cause: the live page-evaluate occasionally returned `null` for the location element (DOM variation, A/B render, or Premium-overlay timing), so `shouldExcludeLocation(null, ['India',...])` returned `false` and the connect proceeded — even though `people.json` already had the location stored from a prior visit. Fix is defense-in-depth: (1) early-skip *before* navigating, using the stored people.json location when known; (2) inside `sendConnectionRequest`, fall back to the stored location when the live scrape returned null; logs distinguish `(live)` vs `(stored)` so the trail is debuggable.
|
|
6
|
+
- **Profile data now accumulates organically across normal flows.** Every existing place we open a profile — `apply` (funnel connect path), `outreach` (Lifebot qualification), `funnel` (view-only mode), `visit` — now persists the scraped profile via `upsertPerson` so people.json fills in over time without dedicated mass-visit batches. New fields captured per visit (when LinkedIn renders them): `currentCompany`, `currentSchool`, `connectionsLevel`, `mutualConnectionsCount`, `followers`, `openToWork`, `hiring`, `topSkills` (top 3), `availableSections` (which h2 sections were on the page), in addition to the existing name/title/location/about. All fields gracefully `null` when LinkedIn hides them, and `MERGE_FIELDS` keeps the previously-known value rather than overwriting with null — so a render that happens to skip a section never erases what we already knew about that person.
|
|
7
|
+
- **Profile-history versioning — see how a contact's profile changed over time.** When a tracked content field changes between visits (e.g. someone's `title` goes from "Software Engineer" → "Engineering Manager", or `openToWork` flips on, or `currentCompany` changes), the previous full state is snapshotted to `<DATA_DIR>/collected-profiles/profile-history/<slug>.json` *before* people.json is overwritten with the new state. Snapshot is taken only when both old and new have real observations and they differ — null-or-empty transitions ("we just learned this" or "LinkedIn hid the field this render") are NOT treated as changes. Tracked fields that trigger a snapshot: `name`, `title`, `location`, `currentCompany`, `currentSchool`, `connectionDegree`, `hasVerifiedBadge`, `openToWork`, `hiring`, `about`, `topSkills`. Noisy fields (`followers`, `connectionsLevel`, `mutualConnectionsCount`, `availableSections`, `photoUrl`) are captured but never trigger.
|
|
8
|
+
- **New `ilml linkedin profile-history` command** — read-only CLI over the snapshots, no browser. Modes: `profile-history <slug-or-url>` shows one person's full history with OLD/NEW diffs per field; `--all` lists everyone with any history sorted by recency; `--since=YYYY-MM-DD` shows all change events in a window; `--field=title --since=...` filters to changes of a single field (e.g. `--field=currentCompany --since=2026-04-01` answers "who changed jobs this month"). Works fully offline against local files.
|
|
9
|
+
- **New `ilml linkedin verify-about` command** — diagnostic that visits one or more profiles and prints what was scraped, with a verdict per profile (`OK` or `ABOUT MISSING`, etc.). Useful when LinkedIn changes the DOM again — run it to see whether the parser still works before the next mass operation. Modes: `<url>` (single), `--pick=N` (random N from people.json), `--pick=N --has-about` (regression check on already-enriched).
|
|
10
|
+
- `enrich-profiles` (mass-enrichment script) is shipped but **not exposed in the manifest** and ships with a tiny default cap (10 visits/session) and explicit ban-risk warning in the help text. Idle profile visits with no follow-up action are exactly the pattern LinkedIn previously flagged with an account warning, so the safer path is the organic accumulation above. The script remains available as `node dist/enrichProfiles.mjs` for users who understand the trade-off.
|
|
11
|
+
- **enrich-profiles is now configurable per audience** — replaced the hard-coded `--recruiters` flag (regex `recruiter|sourcer|talent|staffing`) with the generic `--match-title=<regex>`. Pass any case-insensitive regex over LinkedIn's headline text: `--match-title="founder|ceo"`, `--match-title="investor|VC|venture"`, `--match-title="engineering manager|director of"`. Works on top of `--connections`. Default: no title filter (full queue).
|
|
12
|
+
- **enrich-profiles makes monotonic progress instead of random sampling.** Within each priority tier the queue is now sorted by `lastFullVisitAt` ascending — never-fully-visited profiles first, then oldest-visited next — so two consecutive runs never re-visit the same person until the entire long tail has been touched at least once. Previously the within-tier order was random, which meant after a couple of runs we'd start picking already-visited people again and the long tail could take months to converge. The marker is set automatically inside `upsertPerson` when incoming data carries `availableSections` (the field is only ever populated by `viewProfile()` — list-scrape upserts from `sync` / `syncConnections` don't update it, so `lastFullVisitAt` truly tracks "real profile page visit, not a list-card sighting").
|
|
13
|
+
- No schema migration. The new fields on people.json are additive — old entries simply lack them (read as `null`/`undefined`) and `upsertPerson` populates them on the next visit. The new `profile-history/` subdirectory is created on first snapshot. `CURRENT_SCHEMA_VERSION` unchanged.
|
|
14
|
+
|
|
15
|
+
## 1.7.0
|
|
16
|
+
- **`apply` no longer waits for Enter to close the browser at end of session.** The script now closes the browser and exits immediately after the final summary (success, error, or quota reached). Previously a `Press Enter to close browser...` prompt blocked the process on stdin — closing the browser window manually left a hung Node process that kept the run flagged `status: running` in `run-log.json` until someone came back to the terminal and pressed Enter.
|
|
17
|
+
- **Fixes a Windows-only race that could post a stale end-of-session report to `NODE_RUN_REPORTS`.** When the stdin wait above was interrupted with Ctrl+C, the `^C` byte could resolve the `process.stdin.once('data')` await *before* the SIGINT handler reached `process.exit(0)`. Execution then fell through to `endRun` with whatever `sessionStats.dailyLimitHit` was set at that moment — sending a misleading `quota-reached` push for an interrupted, not actually-completed, run. Removing the wait removes the race.
|
|
18
|
+
- Internal: removed the post-funnel `process.stdin.once('data')` block in `run.mjs` (was gated by `!jobUrlsFile && !--no-wait`); dropped the now-redundant `--no-wait` argument that `daily.mjs` was passing to `run.mjs`. No schema change — runtime behavior only.
|
|
19
|
+
|
|
3
20
|
## 1.6.0
|
|
4
21
|
- **`sync-all` now preserves your LinkedIn unread badges by default.** Until now, opening the local sync would silently mark every unread thread as read on LinkedIn — burning your main attention signal in the LinkedIn UI itself. Starting in 1.6.0 the default behavior is the opposite: unread threads are scanned (preview, sender, time read off the sidebar card) but never *opened*, so they stay bold in linkedin.com until you read them yourself. The previous opt-in `--skip-unread` flag is no longer needed and is silently accepted as a no-op for back-compat with existing scripts.
|
|
5
22
|
- **New section in the sync report — `STILL UNREAD ON LINKEDIN`.** When the sync finishes, the report lists every conversation that's still unread on LinkedIn, enriched with the local DB context (category, summary, person title/company) when we already know the contact. This is the daily "what landed in my inbox while I wasn't looking" view, all from the terminal, with zero impact on the bold markers. New conversations show as `(no DB context)` so you immediately spot strangers vs. people you've talked to before.
|
package/dist/applyQueue.mjs
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ie=Object.defineProperty;var se=(e,n)=>{for(var o in n)Ie(e,o,{get:n[o],enumerable:!0})};import"dotenv/config";import*as E from"fs";import*as _ from"path";import{fileURLToPath as Jo}from"url";import{execFileSync as Uo}from"child_process";import"dotenv/config";import*as m from"fs";import*as g from"path";import{fileURLToPath as Ee}from"url";var De=Ee(import.meta.url),Ce=g.dirname(g.dirname(De)),O=process.env.DATA_DIR?g.resolve(process.env.DATA_DIR,"collected-profiles"):g.join(Ce,"collected-profiles"),Ne=g.join(O,"people.json"),Ko=g.join(O,"jobs.json"),zo=g.join(O,"quota.json"),Xo=g.join(O,"conversations.json"),Zo=g.join(O,"sync-state.json"),en=g.join(O,"application-questions.json"),on=g.join(O,"profile-history");var L=null,xe=null,_e=null,Fe=null,Le=null,Pe=null;function re(){L=null,xe=null,_e=null,Fe=null,Le=null,Pe=null}function Me(){m.existsSync(O)||m.mkdirSync(O,{recursive:!0})}function Je(e,n){if(!m.existsSync(e))return null;try{let o=JSON.parse(m.readFileSync(e,"utf-8"));try{m.copyFileSync(e,e+".backup")}catch{}return o}catch(o){console.error(`[!] ${n} is corrupted: ${o.message}`),console.error(` File: ${g.resolve(e)}`);let t=e+".backup";if(m.existsSync(t))try{let s=JSON.parse(m.readFileSync(t,"utf-8"));console.error(` Restored from ${t}`);try{m.copyFileSync(t,e)}catch{}return s}catch{console.error(" Backup also corrupted!")}console.error(` Starting with empty data. Old file preserved as ${e}.corrupted`);try{m.copyFileSync(e,e+".corrupted")}catch{}return null}}function ie(){return L||(Me(),L=Je(Ne,"people.json")||{},L)}import"dotenv/config";import*as v from"fs";import*as b from"path";import{fileURLToPath as Ue}from"url";var qe=Ue(import.meta.url),Be=b.dirname(b.dirname(qe)),D=process.env.DATA_DIR?b.resolve(process.env.DATA_DIR,"market-research"):b.join(Be,"market-research"),ce=b.join(D,"scouted-jobs.json"),rn=b.join(D,"discovered-people.json"),cn=b.join(D,"visit-log.json"),ln=b.join(D,"companies.json"),Ve=b.join(D,"job-decisions.json");function Ge(){v.existsSync(D)||v.mkdirSync(D,{recursive:!0})}function We(e,n){let o=JSON.stringify(n,null,2),t=e+".tmp";v.writeFileSync(t,o);for(let s=0;s<3;s++)try{v.renameSync(t,e);return}catch(r){if(s<2&&(r.code==="EPERM"||r.code==="EBUSY")){let i=Date.now();for(;Date.now()-i<200;);continue}throw r}}function le(e){try{if(v.existsSync(e))return JSON.parse(v.readFileSync(e,"utf-8"))}catch{}return null}function ae(){P=null,M=null,Ye=null,He=null,Qe=null}var P=null;function V(){return P||(P=le(ce)||{},P)}function ue(e,n){if(!e)return;Ge();let o=V(),t=new Date().toISOString().slice(0,10);if(o[e]){for(let[s,r]of Object.entries(n))r!=null&&(o[e][s]=r);o[e].lastSeen=t}else o[e]={...n,scoutedAt:t,lastSeen:t};try{We(ce,o)}catch(s){console.error(`[!] Failed to save scouted-jobs.json: ${s.message}`)}}var M=null;function fe(){return M||(M=le(Ve)||{},M)}var Ye=null;var He=null;var Qe=null;var Ke=new Set(["java","c#",".net","scala","python","typescript","javascript","react","node.js","aws","azure","docker","kubernetes","microservices","graphql","rest","sql","postgresql","mongodb","kafka","redis","ci/cd","terraform","spring"]),ze=new Set(["iot","machine learning","ai","data engineering","spark","go","rust","kotlin","next.js","devops","sre"]),pe=["vancouver","british columbia"],Xe=["canada","montreal","quebec","alberta","calgary","ottawa"],Ze=["toronto","ontario"],eo=["india","pakistan","nigeria","philippines"];function oo(e,n={}){let o=0,t=(e.techStack||[]).map(a=>a.toLowerCase()),s=0,r=0;for(let a of t)Ke.has(a)&&s++,ze.has(a)&&r++;if(o+=Math.min(s*6,24),o+=Math.min(r*3,6),e.salary){let a=no(e.salary);a&&(a>=15e4?o+=20:a>=12e4?o+=15:a>=1e5?o+=10:a>=8e4?o+=5:a>=100&&a<1e3?o+=15:a>=70&&a<1e3&&(o+=10))}let i=(e.location||"").toLowerCase(),u=/remote/i.test(i)||e.workplaceType==="remote";eo.some(a=>i.includes(a))?o-=30:u&&/united states|usa|\bus\b/i.test(i)?o+=25:u&&pe.some(a=>i.includes(a))?o+=22:u?o+=20:pe.some(a=>i.includes(a))?o+=18:Xe.some(a=>i.includes(a))?o+=10:Ze.some(a=>i.includes(a))&&(o+=5),e.isEasyApply&&(o+=5);let l=(e.seniority||"").toLowerCase();l.includes("senior")||l.includes("lead")||l.includes("staff")?o+=10:l.includes("mid")?o+=5:(l.includes("entry")||l.includes("intern"))&&(o-=10),e.recruiterUrl&&(n.conversationRecruiters?.has(e.recruiterUrl)?o+=20:n.connectedRecruiters?.has(e.recruiterUrl)?o+=15:o+=3);let f=new Set(e.jobTags||[]);return f.has("managerial")?o+=8:f.has("senior-ic")&&(o+=5),f.has("junior")&&(o-=15),f.has("consultant")&&(o-=3),Math.max(0,Math.min(100,o))}function G(e=10,n={}){let{easyApplyOnly:o=!0}=n,t=V(),s=ie(),r=new Set,i=new Set;for(let[h,d]of Object.entries(s))d.connectionStatus==="connected"&&r.add(h);let u={connectedRecruiters:r,conversationRecruiters:i},l=fe(),f=new Set(["applied","skipped","expired","archived"]);return Object.entries(t).filter(([h,d])=>{if(typeof d!="object"||o&&!d.isEasyApply||d.applied)return!1;let y=l[h];return!(y&&f.has(y.status))}).map(([h,d])=>({jobId:h,score:oo(d,u),job:d})).sort((h,d)=>{if(d.score!==h.score)return d.score-h.score;let y=h.job.scoutedAt||h.job.postedTime||"";return(d.job.scoutedAt||d.job.postedTime||"").localeCompare(y)}).slice(0,e)}function no(e){if(!e)return null;let n=e.match(/[\$£€CAD\s]*([\d,]+(?:\.\d+)?)\s*[kK]?/g);if(!n||n.length===0)return null;let o=n.map(t=>{let s=parseFloat(t.replace(/[^\d.]/g,""));return t.toLowerCase().includes("k")&&(s*=1e3),s}).filter(t=>t>0);return o.length>=2?(o[0]+o[1])/2:o.length===1?o[0]:null}import"dotenv/config";import*as $ from"fs";import*as T from"path";import{fileURLToPath as lo}from"url";import"dotenv/config";import{createGraphClient as to,resolveToken as so}from"@ilivemylife/graph-sdk";import{config as ro}from"dotenv";ro();var de=so()||process.env.TOKEN;de||(console.error(`
|
|
2
2
|
[FATAL] No iLiveMyLife token found.`),console.error(" The bot uses Lifebot AI to decide which jobs to apply for"),console.error(` and how to fill application forms. It cannot work without it.
|
|
3
3
|
`),console.error(" Easiest way:"),console.error(" 1. npm install -g @ilivemylife/graph-sdk"),console.error(` 2. ilml login your@email.com yourpassword
|
|
4
4
|
`),console.error(` Or add ILML_TOKEN=... to .env
|
|
5
5
|
`),process.exit(1));var he=to({token:de});function io(e){if(!e||e<1e3)return`${e||0}ms`;let n=Math.round(e/1e3);if(n<60)return`${n}s`;let o=Math.floor(n/60),t=n%60;return t?`${o}m ${t}s`:`${o}m`}function co({scriptName:e,mode:n,status:o,error:t,duration:s}){let r=o==="error"?"\u2717":o==="quota-reached"?"\u26A0":"\u2713",i=new Date().toISOString().slice(0,16).replace("T"," "),u=s?` ${io(s)}`:"",l=o==="error"?`error${t?`: ${String(t).slice(0,80)}`:""}`:o==="quota-reached"?"daily quota reached":"done",f=n&&n!=="default"?` (${n})`:"";return`${r} ${e}${f} \u2014 ${l} \u2014 ${i}${u}`}async function me({scriptName:e,mode:n,status:o,summaryLines:t,error:s,duration:r}){let i=process.env.NODE_RUN_REPORTS;if(!i||!Array.isArray(t)||t.length===0)return;let l=`**${co({scriptName:e,mode:n,status:o,error:s,duration:r})}**
|
|
6
6
|
|
|
7
7
|
${t.join(`
|
|
8
|
-
`)}`;try{await he.addMessage(i,l)}catch(f){console.error(`[runReport] Failed to post end-of-session message: ${f.message}`)}}var ao=lo(import.meta.url),uo=
|
|
8
|
+
`)}`;try{await he.addMessage(i,l)}catch(f){console.error(`[runReport] Failed to post end-of-session message: ${f.message}`)}}var ao=lo(import.meta.url),uo=T.dirname(T.dirname(ao)),W=process.env.DATA_DIR?T.resolve(process.env.DATA_DIR,"collected-profiles"):T.join(uo,"collected-profiles"),Y=T.join(W,"run-log.json");function fo(e,n){let o=JSON.stringify(n,null,2),t=e+".tmp";$.writeFileSync(t,o);for(let s=0;s<3;s++)try{$.renameSync(t,e);return}catch(r){if(s<2&&(r.code==="EPERM"||r.code==="EBUSY")){let i=Date.now();for(;Date.now()-i<200;);continue}throw r}}function ge(){try{if(!$.existsSync(Y))return{runs:[]};let e=JSON.parse($.readFileSync(Y,"utf-8"));return!e.runs||!Array.isArray(e.runs)?{runs:[]}:e}catch{return{runs:[]}}}function ye(e){$.existsSync(W)||$.mkdirSync(W,{recursive:!0});try{fo(Y,e)}catch(n){console.error(`[!] Failed to save run-log.json: ${n.message}`)}}function Se(e,n="default"){let o=ge();for(let i of o.runs)i.status==="running"&&(i.status="interrupted",i.result="interrupted",i.timestamp&&(i.duration=Date.now()-new Date(i.timestamp).getTime()));let t=new Date,s={timestamp:t.toISOString(),script:e,mode:n,status:"running",result:null,duration:null,stats:null,error:null};o.runs.push(s);let r=Date.now()-30*24*60*60*1e3;return o.runs=o.runs.filter(i=>new Date(i.timestamp).getTime()>r),ye(o),{script:e,mode:n,startTime:t.getTime(),runIndex:o.runs.length-1}}function H(e,n,o=null,t=null){if(!e)return;let s=null;try{let i=ge(),u=i.runs[e.runIndex];if(u&&u.status==="running"&&u.script===e.script)u.status=n,u.result=n,u.duration=Date.now()-e.startTime,u.stats=o,u.error=t,s=u.duration;else{let l=i.runs.find(f=>f.script===e.script&&f.status==="running"&&f.timestamp===new Date(e.startTime).toISOString());l&&(l.status=n,l.result=n,l.duration=Date.now()-e.startTime,l.stats=o,l.error=t,s=l.duration)}ye(i)}catch(i){console.error(`[runLog] Failed to end run: ${i.message}`)}let r=o&&Array.isArray(o.summaryLines)?o.summaryLines:null;if(r&&r.length>0&&process.env.NODE_RUN_REPORTS){let i=n==="error"?"error":o&&o.dailyLimitHit?"quota-reached":"done";me({scriptName:e.script,mode:e.mode,status:i,summaryLines:r,error:t,duration:s??Date.now()-e.startTime}).catch(u=>console.error(`[runLog] postRunReport failed: ${u.message}`))}}import"dotenv/config";import*as c from"fs";import*as ee from"os";import*as p from"path";import{fileURLToPath as ko}from"url";var z={};se(z,{NAME:()=>ho,VERSION:()=>po,up:()=>yo});import*as w from"fs";import*as J from"path";var po=1,ho="normalize-jobs-and-questions",mo=["description","techStack","jobTags","seniority","employmentType","industries","jobFunction","postedTime","applicantCount","companySize","workplaceType","contractType","isEasyApply","applyType","companyUrl","scoutedAt","lastSeen"],go=50;function Q(e){return w.existsSync(e)?JSON.parse(w.readFileSync(e,"utf-8")):null}function K(e,n){let o=JSON.stringify(n,null,2),t=e+".tmp";try{w.writeFileSync(t,o)}catch(s){try{w.unlinkSync(t)}catch{}throw s}try{w.renameSync(t,e)}catch(s){try{w.unlinkSync(t)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function yo(e,n){let o=J.join(e,"jobs.json"),t=J.join(n,"scouted-jobs.json"),s=J.join(e,"application-questions.json"),r=Q(o)||{},i=Q(t)||{},u=0,l=[];for(let a of Object.keys(r)){if(!i[a])continue;let h=i[a],d=r[a];for(let y of mo)h[y]!=null&&d[y]==null&&(d[y]=h[y]);l.push(a),u++}u>0?(K(o,r),console.log(` Phase 1: Merged ${u} scouted jobs into jobs.json`)):console.log(" Phase 1: No overlapping jobs to merge");let f=Q(s);if(f&&Array.isArray(f.applications)){let a={},h=0;for(let d of f.applications){let y=d.jobId||"unknown";a[y]||(a[y]={applications:[]});let B=(d.questions||[]).map(j=>{let F={type:j.type||"input",question:j.question||"",answer:j.answer||""};return j.options&&(j.options.length<=go?F.options=j.options:(F.optionsOmitted=!0,h++)),j.page&&(F.page=j.page),j.wasPreFilled&&(F.wasPreFilled=!0),j.wasRetry&&(F.wasRetry=!0),F});a[y].applications.push({applicationId:d.applicationId,date:d.date,result:d.result||"submitted",formPages:d.formPages||null,duration:d.duration||null,retries:d.retries||0,failedField:d.failedField||null,questionCount:d.questionCount||B.length,questions:B})}K(s,a),console.log(` Phase 2: Rekeyed ${f.applications.length} applications by jobId (${Object.keys(a).length} unique jobs)`),h>0&&console.log(` Phase 2: Stripped bloated options from ${h} questions`)}else f&&!f.applications?console.log(" Phase 2: application-questions.json already in keyed format"):console.log(" Phase 2: No application-questions.json found");if(l.length>0){for(let a of l)delete i[a];K(t,i),console.log(` Phase 3: Removed ${l.length} merged entries from scouted-jobs.json (${Object.keys(i).length} remaining)`)}else console.log(" Phase 3: No entries to remove from scouted-jobs.json")}var X={};se(X,{NAME:()=>bo,VERSION:()=>So,up:()=>wo});import*as k from"fs";import*as be from"path";var So=2,bo="reset-unread-flags";function vo(e){return k.existsSync(e)?JSON.parse(k.readFileSync(e,"utf-8")):null}function $o(e,n){let o=JSON.stringify(n,null,2),t=e+".tmp";try{k.writeFileSync(t,o)}catch(s){try{k.unlinkSync(t)}catch{}throw s}try{k.renameSync(t,e)}catch(s){try{k.unlinkSync(t)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function wo(e){let n=be.join(e,"conversations.json"),o=vo(n);if(!o){console.log(" conversations.json not found \u2014 nothing to reset.");return}let t=0;for(let s of Object.keys(o))o[s].unread===!0&&(o[s].unread=!1,t++);if(t===0){console.log(" No stale unread flags found \u2014 nothing to do.");return}$o(n,o),console.log(` Reset unread=false on ${t} conversations. Run 'ilml linkedin sync-all' to re-establish real unread state from LinkedIn.`)}var jo=ko(import.meta.url),Ao=p.dirname(jo),Oo=p.dirname(p.dirname(Ao));function Ro(e){return e&&(e==="~"?ee.homedir():e.startsWith("~/")||e.startsWith("~\\")?p.join(ee.homedir(),e.slice(2)):e)}var A=process.env.DATA_DIR?p.resolve(Ro(process.env.DATA_DIR)):Oo,N=p.join(A,"collected-profiles"),x=p.join(A,"market-research"),S=p.join(A,".schema-version"),ve=[p.join(N,".schema-version"),p.join(x,".schema-version")],I=2,R=[{version:1,module:z},{version:2,module:X}];(function(){R.sort((t,s)=>t.version-s.version);let n=new Set;for(let t of R){if(!Number.isInteger(t.version)||t.version<1)throw new Error(`MIGRATION_REGISTRY: invalid version ${JSON.stringify(t.version)} (must be positive integer)`);if(n.has(t.version))throw new Error(`MIGRATION_REGISTRY: duplicate version v${t.version}`);n.add(t.version);let s=t.module;if(!s||typeof s.up!="function")throw new Error(`MIGRATION_REGISTRY: v${t.version} module is missing up()`);if(s.VERSION!==void 0&&s.VERSION!==t.version)throw new Error(`MIGRATION_REGISTRY: v${t.version} entry does not match module VERSION (${s.VERSION}). Drift between registry and module \u2014 pick one source of truth.`)}let o=R.length?R[R.length-1].version:0;if(o!==I)throw new Error(`MIGRATION_REGISTRY: highest version v${o} but CURRENT_SCHEMA_VERSION=${I}. Forgot to bump CURRENT_SCHEMA_VERSION when adding the new migration?`);for(let t=0;t<R.length;t++){let s=t+1;if(R[t].version!==s)throw new Error(`MIGRATION_REGISTRY: gap detected \u2014 expected v${s} at position ${t} but found v${R[t].version}`)}})();function je(){process.env.DATA_DIR!==void 0&&process.env.DATA_DIR.trim()===""&&process.env.DATA_DIR.length>0&&(console.error(`
|
|
9
9
|
[FATAL] DATA_DIR is set to whitespace ("${process.env.DATA_DIR}"). Either unset it or set a real path.
|
|
10
|
-
`),process.exit(1));try{c.mkdirSync(
|
|
11
|
-
[FATAL] Cannot create DATA_DIR (${
|
|
12
|
-
`),process.exit(1))}let e;try{e=c.statSync(
|
|
13
|
-
[FATAL] DATA_DIR (${
|
|
10
|
+
`),process.exit(1));try{c.mkdirSync(A,{recursive:!0})}catch(n){n.code!=="EEXIST"&&(console.error(`
|
|
11
|
+
[FATAL] Cannot create DATA_DIR (${A}): ${n.message}`),console.error(` Fix the path or permissions and try again.
|
|
12
|
+
`),process.exit(1))}let e;try{e=c.statSync(A)}catch(n){console.error(`
|
|
13
|
+
[FATAL] DATA_DIR (${A}) is not accessible: ${n.message}
|
|
14
14
|
`),process.exit(1)}e.isDirectory()||(console.error(`
|
|
15
|
-
[FATAL] DATA_DIR (${
|
|
15
|
+
[FATAL] DATA_DIR (${A}) exists but is NOT a directory.`),console.error(` Looks like a typo \u2014 your DATA_DIR points at a file. Fix the path and try again.
|
|
16
16
|
`),process.exit(1));for(let n of[N,x]){let o;try{o=c.lstatSync(n)}catch(t){if(t.code==="ENOENT")continue;throw t}o.isSymbolicLink()&&(console.error(`
|
|
17
17
|
[FATAL] Data subdirectory is a symbolic link: ${n}`),console.error(" Refusing to follow \u2014 backup code would copy whatever the link points at."),console.error(` If this is intentional, replace the symlink with the real directory.
|
|
18
|
-
`),process.exit(1))}}var C=p.join(
|
|
18
|
+
`),process.exit(1))}}var C=p.join(A,".migration-lock");function To(){let e=JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()},null,2);try{return c.writeFileSync(C,e,{flag:"wx"}),!0}catch(t){if(t.code!=="EEXIST")throw t}let n;try{n=JSON.parse(c.readFileSync(C,"utf-8"))}catch{n=null}if(n&&Number.isInteger(n.pid)){let t=!1;try{process.kill(n.pid,0),t=!0}catch(i){i.code==="EPERM"&&(t=!0)}let s=24*60*60*1e3,r=1/0;if(n.startedAt){let i=Date.parse(n.startedAt);Number.isNaN(i)||(r=Date.now()-i)}t&&r<s&&(console.error(`
|
|
19
19
|
[FATAL] Another plugin process is currently running migrations:`),console.error(` PID: ${n.pid}`),console.error(` Started at: ${n.startedAt||"(unknown)"}`),console.error(` Lock file: ${C}
|
|
20
20
|
`),console.error(" Wait for it to finish, or if you're sure it's not actually running,"),console.error(` delete the lock file manually and re-run.
|
|
21
|
-
`),process.exit(1)),t&&r>=s&&console.log(` Lock holder PID ${n.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${n?.pid??"?"} found \u2014 taking over.`);let o=C+".tmp";try{return c.writeFileSync(o,e),c.renameSync(o,C),!0}catch(t){try{c.unlinkSync(o)}catch{}throw new Error(`Failed to take over stale migration lock: ${t.message}`)}}function oe(){try{if(JSON.parse(c.readFileSync(C,"utf-8")).pid!==process.pid)return;c.unlinkSync(C)}catch{}}var $e=!1;function
|
|
21
|
+
`),process.exit(1)),t&&r>=s&&console.log(` Lock holder PID ${n.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${n?.pid??"?"} found \u2014 taking over.`);let o=C+".tmp";try{return c.writeFileSync(o,e),c.renameSync(o,C),!0}catch(t){try{c.unlinkSync(o)}catch{}throw new Error(`Failed to take over stale migration lock: ${t.message}`)}}function oe(){try{if(JSON.parse(c.readFileSync(C,"utf-8")).pid!==process.pid)return;c.unlinkSync(C)}catch{}}var $e=!1;function Io(){if($e)return;$e=!0;let e=()=>{try{oe()}catch{}process.exit(1)};for(let n of["SIGINT","SIGTERM","SIGHUP"])try{process.on(n,e)}catch{}}function Eo(){if(c.existsSync(S))return;let e=[],n=[];for(let r of ve)if(c.existsSync(r))try{e.push({file:r,schema:U(r)})}catch(i){n.push({file:r,err:i.message})}if(n.length>0){console.error(`
|
|
22
22
|
[FATAL] Legacy .schema-version file(s) corrupted \u2014 cannot determine current schema version:`);for(let r of n)console.error(` ${r.file}: ${r.err}`);console.error(`
|
|
23
23
|
Repair the file(s) (likely just an integer 'version' field \u2014 see another working DATA_DIR`),console.error(` or default to {"version":1,"migrations":[]} if you're sure you're on schema v1) and try again.
|
|
24
24
|
`),process.exit(1)}if(e.length===0)return;let o=e.map(r=>r.schema.version);if(new Set(o).size>1){console.error(`
|
|
@@ -27,29 +27,29 @@ ${t.join(`
|
|
|
27
27
|
[FATAL] ${S} is not valid JSON: ${o.message}`),console.error(" Refusing to proceed \u2014 silently treating it as 'fresh install' would re-apply"),console.error(" every migration on top of already-migrated data and corrupt it."),console.error(' Repair the file (set it to {"version":N,"migrations":[...]} matching your real state)'),console.error(` or restore from the *.pre-vNNN.backup files if you have them.
|
|
28
28
|
`),process.exit(1)}let n=Do(e);return n===null&&(console.error(`
|
|
29
29
|
[FATAL] ${S} has invalid structure:`),console.error(` ${JSON.stringify(e)?.slice(0,200)||"(unparseable)"}`),console.error(' Expected shape: { "version": <integer>, "migrations": [...] }'),console.error(` Repair the file or restore from a backup.
|
|
30
|
-
`),process.exit(1)),n}function
|
|
31
|
-
[FATAL] Your data schema is at v${n}, but this plugin build only understands up to v${
|
|
32
|
-
`),console.error(" Options:"),console.error(" A) Re-install the newer plugin version that produced this schema, then"),console.error(" (if you really want to downgrade) run 'rollback-data --confirm' first,"),console.error(" then re-install the older plugin version."),console.error(` B) Manually restore your data from the *.pre-vNNN.backup files matching v${
|
|
30
|
+
`),process.exit(1)),n}function Ae(e){try{c.chmodSync(e,384)}catch{}}function Co(e){if(je(),c.existsSync(S))try{if(c.lstatSync(S).isSymbolicLink())throw new Error(`SCHEMA_FILE is a symbolic link: ${S}. Refusing to write through it (potential symlink attack). Remove the link and re-run.`)}catch(o){if(o.message?.includes("symbolic link"))throw o}let n=S+".tmp";try{c.writeFileSync(n,JSON.stringify(e,null,2)),Ae(n),c.renameSync(n,S)}catch(o){try{c.unlinkSync(n)}catch{}throw o}}function ke(e,n){if(!c.existsSync(e))return;let o=`.pre-v${String(n).padStart(3,"0")}.backup`,t=c.readdirSync(e).filter(u=>{let l=u.toLowerCase();if(l.includes(".backup")||l===".schema-version"||l.endsWith(".tmp"))return!1;try{return c.statSync(p.join(e,u)).isFile()}catch{return!1}}),s=0,r=0,i=[];for(let u of t){let l=p.join(e,u),f=p.join(e,u+o);if(c.existsSync(f)){r++;continue}try{Re(l,f),s++}catch(a){i.push({file:u,err:a.message})}}if(i.length>0){let u=new Error(`Failed to back up ${i.length} file(s) in ${p.basename(e)}/: `+i.map(l=>`${l.file} (${l.err})`).join(", "));throw u.code="BACKUP_INCOMPLETE",u}if(s>0||r>0){let u=r>0?` (${r} pre-existing backup(s) preserved)`:"";console.log(` Backed up ${s} files in ${p.basename(e)}/ (${o})${u}`)}}var Z=!1;async function Oe(){if(Z)return;je(),Lo();let n=we().version;if(n===I){Z=!0;return}Io(),To(),process.on("exit",oe),n>I&&(console.error(`
|
|
31
|
+
[FATAL] Your data schema is at v${n}, but this plugin build only understands up to v${I}.`),console.error(" This usually means you downgraded the plugin without rolling back data."),console.error(` Operating on the newer-format data with this build would risk corrupting it.
|
|
32
|
+
`),console.error(" Options:"),console.error(" A) Re-install the newer plugin version that produced this schema, then"),console.error(" (if you really want to downgrade) run 'rollback-data --confirm' first,"),console.error(" then re-install the older plugin version."),console.error(` B) Manually restore your data from the *.pre-vNNN.backup files matching v${I}.
|
|
33
33
|
`),process.exit(1)),console.log(`
|
|
34
|
-
\u{1F4E6} Schema migration: v${n} \u2192 v${
|
|
34
|
+
\u{1F4E6} Schema migration: v${n} \u2192 v${I}`);let o=Po();if(!o.ok){console.error(`
|
|
35
35
|
[FATAL] Cannot migrate \u2014 current data is corrupted:`);for(let s of o.broken)console.error(` ${s.dir}/${s.file}: ${s.err}`);console.error(`
|
|
36
36
|
Migration ABORTED. No backups taken, no files modified.`),console.error(" Repair the file(s) above (restore from your own backup, or fix manually)"),console.error(` and try again. To inspect: 'ilml linkedin migrate-status'.
|
|
37
|
-
`),process.exit(1)}let t=
|
|
37
|
+
`),process.exit(1)}let t=R.filter(s=>s.version>n);for(let s of t){console.log(`
|
|
38
38
|
Running migration v${String(s.version).padStart(3,"0")}...`);let r=`v${String(s.version).padStart(3,"0")}`,i=`.pre-${r}.backup`;try{ke(N,s.version),ke(x,s.version)}catch(l){console.error(`
|
|
39
39
|
[FATAL] Pre-migration backup failed for ${r}: ${l.message}`),console.error(" Migration NOT applied. Repair the underlying issue (disk space, permissions, locked files)"),console.error(` and re-run the plugin command.
|
|
40
40
|
`),process.exit(1)}let u=s.module;try{await u.up(N,x)}catch(l){console.error(`
|
|
41
|
-
[FATAL] Migration ${r} failed: ${l.message}`),console.error(` Attempting auto-rollback from ${i} files...`);try{let f=
|
|
41
|
+
[FATAL] Migration ${r} failed: ${l.message}`),console.error(` Attempting auto-rollback from ${i} files...`);try{let f=Mo(i);f.ok?(console.error(` \u2713 Auto-rollback restored ${f.restored} files. Schema stays at v${n}.`),console.error(` The migration will be retried on next plugin command. Fix the root cause first.
|
|
42
42
|
`)):(console.error(` [!] Auto-rollback INCOMPLETE: ${f.error}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
43
43
|
`))}catch(f){console.error(` [!] Auto-rollback CRASHED while restoring: ${f.message}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
44
44
|
`)}process.exit(1)}try{let l=new Date().toISOString(),f={version:s.version,name:u.NAME||r,appliedAt:l},a=we();a.version=s.version,a.migratedAt=l,a.migrations=a.migrations||[],a.migrations.push(f),Co(a)}catch(l){console.error(`
|
|
45
45
|
[FATAL] Migration ${r} applied successfully but schema version file could NOT be updated: ${l.message}`),console.error(` Your data is in the v${s.version} state but .schema-version still shows v${n}.`),console.error(` On next plugin command the runner will try to re-apply ${r}. If that migration is`),console.error(` idempotent (most are), it will succeed harmlessly. If you're unsure, run 'data-cleanup' and contact support.
|
|
46
46
|
`),process.exit(1)}console.log(` \u2713 Migration ${r} complete`)}try{re()}catch{}try{ae()}catch{}Z=!0,oe(),console.log(`
|
|
47
|
-
\u2713 Schema is now at v${
|
|
48
|
-
`)}var No=[/\.json\.tmp$/,/\.schema-version\.tmp$/,/\.backup\.tmp$/];function xo(e){let n=e.toLowerCase();return No.some(o=>o.test(n))}var _o=6e4;function Fo(){let e=Date.now(),n=[];for(let o of[
|
|
47
|
+
\u2713 Schema is now at v${I}
|
|
48
|
+
`)}var No=[/\.json\.tmp$/,/\.schema-version\.tmp$/,/\.backup\.tmp$/];function xo(e){let n=e.toLowerCase();return No.some(o=>o.test(n))}var _o=6e4;function Fo(){let e=Date.now(),n=[];for(let o of[A,N,x]){if(!c.existsSync(o))continue;let t;try{t=c.readdirSync(o)}catch{continue}for(let s of t){if(!xo(s))continue;let r=p.join(o,s);try{let i=c.statSync(r);if(!i.isFile()||e-i.mtimeMs<_o)continue;n.push({dir:o,file:s,fullPath:r})}catch{}}}return n}function Lo({verbose:e=!1}={}){let n=Fo();if(n.length===0)return e&&console.log(" No orphan .tmp files found."),0;let o=0;for(let t of n)try{c.unlinkSync(t.fullPath),o++,e&&console.log(` Removed orphan: ${p.basename(t.dir)}/${t.file}`)}catch(s){console.warn(` [!] Could not remove orphan ${t.fullPath}: ${s.message}`)}return!e&&o>0&&console.log(` Cleaned up ${o} orphan .tmp file(s) from previous run.`),o}function Po(){let e=[];for(let n of[N,x]){if(!c.existsSync(n))continue;let o=c.readdirSync(n).filter(t=>{let s=t.toLowerCase();return s.endsWith(".json")&&!s.includes(".backup")});for(let t of o){let s=p.join(n,t);try{U(s)}catch(r){e.push({dir:p.basename(n),file:t,err:r.message})}}}return e.length===0?{ok:!0}:{ok:!1,broken:e}}function Mo(e){let n=[],o=[];for(let r of[N,x]){if(!c.existsSync(r))continue;let i=c.readdirSync(r).filter(u=>u.endsWith(e));for(let u of i){let l=p.join(r,u),f=u.slice(0,-e.length),a=p.join(r,f);try{f.toLowerCase().endsWith(".json")?U(l):c.accessSync(l,c.constants.R_OK),n.push({backupPath:l,originalPath:a,fileName:u,dir:r})}catch(h){o.push(`${p.basename(r)}/${u}: ${h.message}`)}}}if(o.length>0)return{ok:!1,error:o.join("; "),restored:0};let t=0,s=[];for(let{backupPath:r,originalPath:i,fileName:u,dir:l}of n)try{Re(r,i),t++}catch(f){s.push(`${p.basename(l)}/${u}: ${f.message}`)}return s.length>0?{ok:!1,error:s.join("; "),restored:t}:{ok:!0,restored:t}}function Re(e,n){let o=n+".tmp";try{c.copyFileSync(e,o),Ae(o)}catch(t){try{c.unlinkSync(o)}catch{}throw t}try{c.renameSync(o,n)}catch(t){try{c.unlinkSync(o)}catch{}if(t.code==="EPERM"||t.code==="EBUSY"){let s=new Error(`File locked: ${n} (${t.code}). On Windows this is usually antivirus / Search Indexer / the file open in another app. Close anything that might be holding it and re-run.`);throw s.code=t.code,s}throw t}}var qo=Jo(import.meta.url),Bo=_.dirname(qo),ne=process.env.DATA_DIR?_.resolve(process.env.DATA_DIR,"collected-profiles"):_.join(Bo,"collected-profiles");await Oe();var te=process.argv.slice(2),Te=parseInt(te.find(e=>e.startsWith("--max="))?.split("=")[1]||"50"),q=parseInt(te.find(e=>e.startsWith("--min-score="))?.split("=")[1]||"50"),Vo=te.includes("--list");function Go(){let n=G(20,{easyApplyOnly:!0}).filter(o=>o.score>=q);if(console.log(`
|
|
49
49
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`),console.log(` APPLY QUEUE (${n.length} jobs, min score ${q})`),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"),n.length===0)console.log(" No jobs in queue. Run: npm run scout");else for(let o=0;o<n.length;o++){let{score:t,job:s,jobId:r}=n[o],i=(s.techStack||[]).slice(0,4).join(", ");console.log(` ${String(o+1).padStart(2)}. [${t}] ${(s.title||"?").slice(0,35)} @ ${(s.company||"?").slice(0,20)}`),console.log(` ${s.salary||"no salary"} | ${s.location||"?"} | ${i||"no tech"}`),console.log(` ${s.url}`)}console.log(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
50
50
|
`)}async function Wo(){if(console.log(`
|
|
51
51
|
LinkedIn Apply Queue
|
|
52
|
-
`),
|
|
52
|
+
`),Vo){Go();return}let n=G(Te*3,{easyApplyOnly:!0}).filter(r=>r.score>=q).slice(0,Te);if(n.length===0){console.log(` No jobs to apply. Run: npm run scout
|
|
53
53
|
`);return}console.log(` Applying to ${n.length} jobs (score >= ${q}):
|
|
54
54
|
`);for(let{score:r,job:i}of n)console.log(` [${r}] ${(i.title||"?").slice(0,40)} @ ${(i.company||"?").slice(0,20)}`);E.existsSync(ne)||E.mkdirSync(ne,{recursive:!0});let o=_.join(ne,"apply-queue-urls.json"),t=n.map(({job:r,jobId:i})=>({url:r.url,title:r.title,company:r.company,location:r.location,salary:r.salary}));E.writeFileSync(o,JSON.stringify(t,null,2)),console.log(`
|
|
55
55
|
Generated ${o} with ${t.length} jobs`);for(let{jobId:r}of n)ue(r,{queued:!0,queuedAt:new Date().toISOString().slice(0,10)});let s=Se("apply-queue",`${n.length} jobs`);console.log(`
|
package/dist/daily.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var Te=Object.defineProperty;var Z=(e,o)=>{for(var t in o)Te(e,t,{get:o[t],enumerable:!0})};import{execFileSync as
|
|
1
|
+
var Te=Object.defineProperty;var Z=(e,o)=>{for(var t in o)Te(e,t,{get:o[t],enumerable:!0})};import{execFileSync as Co}from"child_process";import"dotenv/config";import*as S from"fs";import*as R from"path";import{fileURLToPath as Fe}from"url";import"dotenv/config";import{createGraphClient as Ee,resolveToken as De}from"@ilivemylife/graph-sdk";import{config as Ne}from"dotenv";Ne();var ee=De()||process.env.TOKEN;ee||(console.error(`
|
|
2
2
|
[FATAL] No iLiveMyLife token found.`),console.error(" The bot uses Lifebot AI to decide which jobs to apply for"),console.error(` and how to fill application forms. It cannot work without it.
|
|
3
3
|
`),console.error(" Easiest way:"),console.error(" 1. npm install -g @ilivemylife/graph-sdk"),console.error(` 2. ilml login your@email.com yourpassword
|
|
4
4
|
`),console.error(` Or add ILML_TOKEN=... to .env
|
|
5
|
-
`),process.exit(1));var oe=Ee({token:ee});function
|
|
5
|
+
`),process.exit(1));var oe=Ee({token:ee});function Ce(e){if(!e||e<1e3)return`${e||0}ms`;let o=Math.round(e/1e3);if(o<60)return`${o}s`;let t=Math.floor(o/60),n=o%60;return n?`${t}m ${n}s`:`${t}m`}function xe({scriptName:e,mode:o,status:t,error:n,duration:s}){let r=t==="error"?"\u2717":t==="quota-reached"?"\u26A0":"\u2713",i=new Date().toISOString().slice(0,16).replace("T"," "),l=s?` ${Ce(s)}`:"",a=t==="error"?`error${n?`: ${String(n).slice(0,80)}`:""}`:t==="quota-reached"?"daily quota reached":"done",u=o&&o!=="default"?` (${o})`:"";return`${r} ${e}${u} \u2014 ${a} \u2014 ${i}${l}`}async function ne({scriptName:e,mode:o,status:t,summaryLines:n,error:s,duration:r}){let i=process.env.NODE_RUN_REPORTS;if(!i||!Array.isArray(n)||n.length===0)return;let a=`**${xe({scriptName:e,mode:o,status:t,error:s,duration:r})}**
|
|
6
6
|
|
|
7
7
|
${n.join(`
|
|
8
|
-
`)}`;try{await oe.addMessage(i,a)}catch(u){console.error(`[runReport] Failed to post end-of-session message: ${u.message}`)}}var Fe=_e(import.meta.url),Le=R.dirname(R.dirname(Fe)),B=process.env.DATA_DIR?R.resolve(process.env.DATA_DIR,"collected-profiles"):R.join(Le,"collected-profiles"),q=R.join(B,"run-log.json");function Pe(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";S.writeFileSync(n,t);for(let s=0;s<3;s++)try{S.renameSync(n,e);return}catch(r){if(s<2&&(r.code==="EPERM"||r.code==="EBUSY")){let i=Date.now();for(;Date.now()-i<200;);continue}throw r}}function te(){try{if(!S.existsSync(q))return{runs:[]};let e=JSON.parse(S.readFileSync(q,"utf-8"));return!e.runs||!Array.isArray(e.runs)?{runs:[]}:e}catch{return{runs:[]}}}function se(e){S.existsSync(B)||S.mkdirSync(B,{recursive:!0});try{Pe(q,e)}catch(o){console.error(`[!] Failed to save run-log.json: ${o.message}`)}}function re(e,o="default"){let t=te();for(let i of t.runs)i.status==="running"&&(i.status="interrupted",i.result="interrupted",i.timestamp&&(i.duration=Date.now()-new Date(i.timestamp).getTime()));let n=new Date,s={timestamp:n.toISOString(),script:e,mode:o,status:"running",result:null,duration:null,stats:null,error:null};t.runs.push(s);let r=Date.now()-30*24*60*60*1e3;return t.runs=t.runs.filter(i=>new Date(i.timestamp).getTime()>r),se(t),{script:e,mode:o,startTime:n.getTime(),runIndex:t.runs.length-1}}function ie(e,o,t=null,n=null){if(!e)return;let s=null;try{let i=te(),l=i.runs[e.runIndex];if(l&&l.status==="running"&&l.script===e.script)l.status=o,l.result=o,l.duration=Date.now()-e.startTime,l.stats=t,l.error=n,s=l.duration;else{let a=i.runs.find(u=>u.script===e.script&&u.status==="running"&&u.timestamp===new Date(e.startTime).toISOString());a&&(a.status=o,a.result=o,a.duration=Date.now()-e.startTime,a.stats=t,a.error=n,s=a.duration)}se(i)}catch(i){console.error(`[runLog] Failed to end run: ${i.message}`)}let r=t&&Array.isArray(t.summaryLines)?t.summaryLines:null;if(r&&r.length>0&&process.env.NODE_RUN_REPORTS){let i=o==="error"?"error":t&&t.dailyLimitHit?"quota-reached":"done";ne({scriptName:e.script,mode:e.mode,status:i,summaryLines:r,error:n,duration:s??Date.now()-e.startTime}).catch(l=>console.error(`[runLog] postRunReport failed: ${l.message}`))}}import"dotenv/config";import*as d from"fs";import*as m from"path";import{fileURLToPath as Me}from"url";var Je=Me(import.meta.url),Ue=m.dirname(m.dirname(Je)),A=process.env.DATA_DIR?m.resolve(process.env.DATA_DIR,"collected-profiles"):m.join(Ue,"collected-profiles"),Qo=m.join(A,"people.json"),Ho=m.join(A,"jobs.json"),Be=m.join(A,"quota.json"),zo=m.join(A,"conversations.json"),Ko=m.join(A,"sync-state.json"),Xo=m.join(A,"application-questions.json"),F=20,L=100,qe=null,Ve=null,I=null,Ye=null,Ge=null,We=null;function ce(){qe=null,Ve=null,I=null,Ye=null,Ge=null,We=null}function Qe(){d.existsSync(A)||d.mkdirSync(A,{recursive:!0})}function He(e,o){if(!d.existsSync(e))return null;try{let t=JSON.parse(d.readFileSync(e,"utf-8"));try{d.copyFileSync(e,e+".backup")}catch{}return t}catch(t){console.error(`[!] ${o} is corrupted: ${t.message}`),console.error(` File: ${m.resolve(e)}`);let n=e+".backup";if(d.existsSync(n))try{let s=JSON.parse(d.readFileSync(n,"utf-8"));console.error(` Restored from ${n}`);try{d.copyFileSync(n,e)}catch{}return s}catch{console.error(" Backup also corrupted!")}console.error(` Starting with empty data. Old file preserved as ${e}.corrupted`);try{d.copyFileSync(e,e+".corrupted")}catch{}return null}}function le(){return new Date().toISOString().split("T")[0]}function ze(){return I||(Qe(),I=He(Be,"quota.json"),(!I||!I.connections)&&(I={connections:[]}),I)}function ae(){let e=ze(),o=new Date;o.setDate(o.getDate()-7);let t=o.toISOString().split("T")[0];return e.connections.filter(n=>n.date>=t)}function ue(){let e=ae(),o=le(),t=e.filter(a=>a.date===o).length,n=e.length,s=t>=F,r=n>=L,i=!s&&!r,l={allowed:i,daily:{sent:t,max:F},weekly:{sent:n,max:L}};return i||(l.reason=s?`Daily limit reached (${t}/${F})`:`Weekly limit reached (${n}/${L})`),l}function fe(){let e=ae(),o=le(),t=e.filter(s=>s.date===o).length,n=e.length;return{daily:{sent:t,max:F,remaining:F-t},weekly:{sent:n,max:L,remaining:L-n}}}import"dotenv/config";import*as c from"fs";import*as H from"os";import*as f from"path";import{fileURLToPath as go}from"url";var G={};Z(G,{NAME:()=>Xe,VERSION:()=>Ke,up:()=>oo});import*as b from"fs";import*as J from"path";var Ke=1,Xe="normalize-jobs-and-questions",Ze=["description","techStack","jobTags","seniority","employmentType","industries","jobFunction","postedTime","applicantCount","companySize","workplaceType","contractType","isEasyApply","applyType","companyUrl","scoutedAt","lastSeen"],eo=50;function V(e){return b.existsSync(e)?JSON.parse(b.readFileSync(e,"utf-8")):null}function Y(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";try{b.writeFileSync(n,t)}catch(s){try{b.unlinkSync(n)}catch{}throw s}try{b.renameSync(n,e)}catch(s){try{b.unlinkSync(n)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function oo(e,o){let t=J.join(e,"jobs.json"),n=J.join(o,"scouted-jobs.json"),s=J.join(e,"application-questions.json"),r=V(t)||{},i=V(n)||{},l=0,a=[];for(let p of Object.keys(r)){if(!i[p])continue;let j=i[p],h=r[p];for(let O of Ze)j[O]!=null&&h[O]==null&&(h[O]=j[O]);a.push(p),l++}l>0?(Y(t,r),console.log(` Phase 1: Merged ${l} scouted jobs into jobs.json`)):console.log(" Phase 1: No overlapping jobs to merge");let u=V(s);if(u&&Array.isArray(u.applications)){let p={},j=0;for(let h of u.applications){let O=h.jobId||"unknown";p[O]||(p[O]={applications:[]});let X=(h.questions||[]).map($=>{let C={type:$.type||"input",question:$.question||"",answer:$.answer||""};return $.options&&($.options.length<=eo?C.options=$.options:(C.optionsOmitted=!0,j++)),$.page&&(C.page=$.page),$.wasPreFilled&&(C.wasPreFilled=!0),$.wasRetry&&(C.wasRetry=!0),C});p[O].applications.push({applicationId:h.applicationId,date:h.date,result:h.result||"submitted",formPages:h.formPages||null,duration:h.duration||null,retries:h.retries||0,failedField:h.failedField||null,questionCount:h.questionCount||X.length,questions:X})}Y(s,p),console.log(` Phase 2: Rekeyed ${u.applications.length} applications by jobId (${Object.keys(p).length} unique jobs)`),j>0&&console.log(` Phase 2: Stripped bloated options from ${j} questions`)}else u&&!u.applications?console.log(" Phase 2: application-questions.json already in keyed format"):console.log(" Phase 2: No application-questions.json found");if(a.length>0){for(let p of a)delete i[p];Y(n,i),console.log(` Phase 3: Removed ${a.length} merged entries from scouted-jobs.json (${Object.keys(i).length} remaining)`)}else console.log(" Phase 3: No entries to remove from scouted-jobs.json")}var W={};Z(W,{NAME:()=>to,VERSION:()=>no,up:()=>io});import*as v from"fs";import*as pe from"path";var no=2,to="reset-unread-flags";function so(e){return v.existsSync(e)?JSON.parse(v.readFileSync(e,"utf-8")):null}function ro(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";try{v.writeFileSync(n,t)}catch(s){try{v.unlinkSync(n)}catch{}throw s}try{v.renameSync(n,e)}catch(s){try{v.unlinkSync(n)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function io(e){let o=pe.join(e,"conversations.json"),t=so(o);if(!t){console.log(" conversations.json not found \u2014 nothing to reset.");return}let n=0;for(let s of Object.keys(t))t[s].unread===!0&&(t[s].unread=!1,n++);if(n===0){console.log(" No stale unread flags found \u2014 nothing to do.");return}ro(o,t),console.log(` Reset unread=false on ${n} conversations. Run 'ilml linkedin sync-all' to re-establish real unread state from LinkedIn.`)}import"dotenv/config";import*as y from"path";import{fileURLToPath as co}from"url";var lo=co(import.meta.url),ao=y.dirname(y.dirname(lo)),P=process.env.DATA_DIR?y.resolve(process.env.DATA_DIR,"market-research"):y.join(ao,"market-research"),nn=y.join(P,"scouted-jobs.json"),tn=y.join(P,"discovered-people.json"),sn=y.join(P,"visit-log.json"),rn=y.join(P,"companies.json"),cn=y.join(P,"job-decisions.json");function de(){uo=null,fo=null,po=null,mo=null,ho=null}var uo=null;var fo=null;var po=null;var mo=null;var ho=null;var yo=go(import.meta.url),So=f.dirname(yo),bo=f.dirname(f.dirname(So));function vo(e){return e&&(e==="~"?H.homedir():e.startsWith("~/")||e.startsWith("~\\")?f.join(H.homedir(),e.slice(2)):e)}var w=process.env.DATA_DIR?f.resolve(vo(process.env.DATA_DIR)):bo,N=f.join(w,"collected-profiles"),x=f.join(w,"market-research"),g=f.join(w,".schema-version"),me=[f.join(N,".schema-version"),f.join(x,".schema-version")],T=2,k=[{version:1,module:G},{version:2,module:W}];(function(){k.sort((n,s)=>n.version-s.version);let o=new Set;for(let n of k){if(!Number.isInteger(n.version)||n.version<1)throw new Error(`MIGRATION_REGISTRY: invalid version ${JSON.stringify(n.version)} (must be positive integer)`);if(o.has(n.version))throw new Error(`MIGRATION_REGISTRY: duplicate version v${n.version}`);o.add(n.version);let s=n.module;if(!s||typeof s.up!="function")throw new Error(`MIGRATION_REGISTRY: v${n.version} module is missing up()`);if(s.VERSION!==void 0&&s.VERSION!==n.version)throw new Error(`MIGRATION_REGISTRY: v${n.version} entry does not match module VERSION (${s.VERSION}). Drift between registry and module \u2014 pick one source of truth.`)}let t=k.length?k[k.length-1].version:0;if(t!==T)throw new Error(`MIGRATION_REGISTRY: highest version v${t} but CURRENT_SCHEMA_VERSION=${T}. Forgot to bump CURRENT_SCHEMA_VERSION when adding the new migration?`);for(let n=0;n<k.length;n++){let s=n+1;if(k[n].version!==s)throw new Error(`MIGRATION_REGISTRY: gap detected \u2014 expected v${s} at position ${n} but found v${k[n].version}`)}})();function Se(){process.env.DATA_DIR!==void 0&&process.env.DATA_DIR.trim()===""&&process.env.DATA_DIR.length>0&&(console.error(`
|
|
8
|
+
`)}`;try{await oe.addMessage(i,a)}catch(u){console.error(`[runReport] Failed to post end-of-session message: ${u.message}`)}}var _e=Fe(import.meta.url),Le=R.dirname(R.dirname(_e)),B=process.env.DATA_DIR?R.resolve(process.env.DATA_DIR,"collected-profiles"):R.join(Le,"collected-profiles"),V=R.join(B,"run-log.json");function Pe(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";S.writeFileSync(n,t);for(let s=0;s<3;s++)try{S.renameSync(n,e);return}catch(r){if(s<2&&(r.code==="EPERM"||r.code==="EBUSY")){let i=Date.now();for(;Date.now()-i<200;);continue}throw r}}function te(){try{if(!S.existsSync(V))return{runs:[]};let e=JSON.parse(S.readFileSync(V,"utf-8"));return!e.runs||!Array.isArray(e.runs)?{runs:[]}:e}catch{return{runs:[]}}}function se(e){S.existsSync(B)||S.mkdirSync(B,{recursive:!0});try{Pe(V,e)}catch(o){console.error(`[!] Failed to save run-log.json: ${o.message}`)}}function re(e,o="default"){let t=te();for(let i of t.runs)i.status==="running"&&(i.status="interrupted",i.result="interrupted",i.timestamp&&(i.duration=Date.now()-new Date(i.timestamp).getTime()));let n=new Date,s={timestamp:n.toISOString(),script:e,mode:o,status:"running",result:null,duration:null,stats:null,error:null};t.runs.push(s);let r=Date.now()-30*24*60*60*1e3;return t.runs=t.runs.filter(i=>new Date(i.timestamp).getTime()>r),se(t),{script:e,mode:o,startTime:n.getTime(),runIndex:t.runs.length-1}}function ie(e,o,t=null,n=null){if(!e)return;let s=null;try{let i=te(),l=i.runs[e.runIndex];if(l&&l.status==="running"&&l.script===e.script)l.status=o,l.result=o,l.duration=Date.now()-e.startTime,l.stats=t,l.error=n,s=l.duration;else{let a=i.runs.find(u=>u.script===e.script&&u.status==="running"&&u.timestamp===new Date(e.startTime).toISOString());a&&(a.status=o,a.result=o,a.duration=Date.now()-e.startTime,a.stats=t,a.error=n,s=a.duration)}se(i)}catch(i){console.error(`[runLog] Failed to end run: ${i.message}`)}let r=t&&Array.isArray(t.summaryLines)?t.summaryLines:null;if(r&&r.length>0&&process.env.NODE_RUN_REPORTS){let i=o==="error"?"error":t&&t.dailyLimitHit?"quota-reached":"done";ne({scriptName:e.script,mode:e.mode,status:i,summaryLines:r,error:n,duration:s??Date.now()-e.startTime}).catch(l=>console.error(`[runLog] postRunReport failed: ${l.message}`))}}import"dotenv/config";import*as d from"fs";import*as h from"path";import{fileURLToPath as Me}from"url";var Je=Me(import.meta.url),Ue=h.dirname(h.dirname(Je)),k=process.env.DATA_DIR?h.resolve(process.env.DATA_DIR,"collected-profiles"):h.join(Ue,"collected-profiles"),Ho=h.join(k,"people.json"),Qo=h.join(k,"jobs.json"),Be=h.join(k,"quota.json"),zo=h.join(k,"conversations.json"),Ko=h.join(k,"sync-state.json"),Xo=h.join(k,"application-questions.json"),Zo=h.join(k,"profile-history"),_=20,L=100,Ve=null,qe=null,I=null,We=null,Ye=null,Ge=null;function ce(){Ve=null,qe=null,I=null,We=null,Ye=null,Ge=null}function He(){d.existsSync(k)||d.mkdirSync(k,{recursive:!0})}function Qe(e,o){if(!d.existsSync(e))return null;try{let t=JSON.parse(d.readFileSync(e,"utf-8"));try{d.copyFileSync(e,e+".backup")}catch{}return t}catch(t){console.error(`[!] ${o} is corrupted: ${t.message}`),console.error(` File: ${h.resolve(e)}`);let n=e+".backup";if(d.existsSync(n))try{let s=JSON.parse(d.readFileSync(n,"utf-8"));console.error(` Restored from ${n}`);try{d.copyFileSync(n,e)}catch{}return s}catch{console.error(" Backup also corrupted!")}console.error(` Starting with empty data. Old file preserved as ${e}.corrupted`);try{d.copyFileSync(e,e+".corrupted")}catch{}return null}}function le(){return new Date().toISOString().split("T")[0]}function ze(){return I||(He(),I=Qe(Be,"quota.json"),(!I||!I.connections)&&(I={connections:[]}),I)}function ae(){let e=ze(),o=new Date;o.setDate(o.getDate()-7);let t=o.toISOString().split("T")[0];return e.connections.filter(n=>n.date>=t)}function ue(){let e=ae(),o=le(),t=e.filter(a=>a.date===o).length,n=e.length,s=t>=_,r=n>=L,i=!s&&!r,l={allowed:i,daily:{sent:t,max:_},weekly:{sent:n,max:L}};return i||(l.reason=s?`Daily limit reached (${t}/${_})`:`Weekly limit reached (${n}/${L})`),l}function fe(){let e=ae(),o=le(),t=e.filter(s=>s.date===o).length,n=e.length;return{daily:{sent:t,max:_,remaining:_-t},weekly:{sent:n,max:L,remaining:L-n}}}import"dotenv/config";import*as c from"fs";import*as Q from"os";import*as f from"path";import{fileURLToPath as go}from"url";var Y={};Z(Y,{NAME:()=>Xe,VERSION:()=>Ke,up:()=>oo});import*as b from"fs";import*as J from"path";var Ke=1,Xe="normalize-jobs-and-questions",Ze=["description","techStack","jobTags","seniority","employmentType","industries","jobFunction","postedTime","applicantCount","companySize","workplaceType","contractType","isEasyApply","applyType","companyUrl","scoutedAt","lastSeen"],eo=50;function q(e){return b.existsSync(e)?JSON.parse(b.readFileSync(e,"utf-8")):null}function W(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";try{b.writeFileSync(n,t)}catch(s){try{b.unlinkSync(n)}catch{}throw s}try{b.renameSync(n,e)}catch(s){try{b.unlinkSync(n)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function oo(e,o){let t=J.join(e,"jobs.json"),n=J.join(o,"scouted-jobs.json"),s=J.join(e,"application-questions.json"),r=q(t)||{},i=q(n)||{},l=0,a=[];for(let p of Object.keys(r)){if(!i[p])continue;let O=i[p],m=r[p];for(let A of Ze)O[A]!=null&&m[A]==null&&(m[A]=O[A]);a.push(p),l++}l>0?(W(t,r),console.log(` Phase 1: Merged ${l} scouted jobs into jobs.json`)):console.log(" Phase 1: No overlapping jobs to merge");let u=q(s);if(u&&Array.isArray(u.applications)){let p={},O=0;for(let m of u.applications){let A=m.jobId||"unknown";p[A]||(p[A]={applications:[]});let X=(m.questions||[]).map($=>{let x={type:$.type||"input",question:$.question||"",answer:$.answer||""};return $.options&&($.options.length<=eo?x.options=$.options:(x.optionsOmitted=!0,O++)),$.page&&(x.page=$.page),$.wasPreFilled&&(x.wasPreFilled=!0),$.wasRetry&&(x.wasRetry=!0),x});p[A].applications.push({applicationId:m.applicationId,date:m.date,result:m.result||"submitted",formPages:m.formPages||null,duration:m.duration||null,retries:m.retries||0,failedField:m.failedField||null,questionCount:m.questionCount||X.length,questions:X})}W(s,p),console.log(` Phase 2: Rekeyed ${u.applications.length} applications by jobId (${Object.keys(p).length} unique jobs)`),O>0&&console.log(` Phase 2: Stripped bloated options from ${O} questions`)}else u&&!u.applications?console.log(" Phase 2: application-questions.json already in keyed format"):console.log(" Phase 2: No application-questions.json found");if(a.length>0){for(let p of a)delete i[p];W(n,i),console.log(` Phase 3: Removed ${a.length} merged entries from scouted-jobs.json (${Object.keys(i).length} remaining)`)}else console.log(" Phase 3: No entries to remove from scouted-jobs.json")}var G={};Z(G,{NAME:()=>to,VERSION:()=>no,up:()=>io});import*as v from"fs";import*as pe from"path";var no=2,to="reset-unread-flags";function so(e){return v.existsSync(e)?JSON.parse(v.readFileSync(e,"utf-8")):null}function ro(e,o){let t=JSON.stringify(o,null,2),n=e+".tmp";try{v.writeFileSync(n,t)}catch(s){try{v.unlinkSync(n)}catch{}throw s}try{v.renameSync(n,e)}catch(s){try{v.unlinkSync(n)}catch{}if(s.code==="EPERM"||s.code==="EBUSY"){let r=new Error(`File locked: ${e} (${s.code}). On Windows usually antivirus / file explorer / open editor. Close it and re-run.`);throw r.code=s.code,r}throw s}}async function io(e){let o=pe.join(e,"conversations.json"),t=so(o);if(!t){console.log(" conversations.json not found \u2014 nothing to reset.");return}let n=0;for(let s of Object.keys(t))t[s].unread===!0&&(t[s].unread=!1,n++);if(n===0){console.log(" No stale unread flags found \u2014 nothing to do.");return}ro(o,t),console.log(` Reset unread=false on ${n} conversations. Run 'ilml linkedin sync-all' to re-establish real unread state from LinkedIn.`)}import"dotenv/config";import*as y from"path";import{fileURLToPath as co}from"url";var lo=co(import.meta.url),ao=y.dirname(y.dirname(lo)),P=process.env.DATA_DIR?y.resolve(process.env.DATA_DIR,"market-research"):y.join(ao,"market-research"),tn=y.join(P,"scouted-jobs.json"),sn=y.join(P,"discovered-people.json"),rn=y.join(P,"visit-log.json"),cn=y.join(P,"companies.json"),ln=y.join(P,"job-decisions.json");function de(){uo=null,fo=null,po=null,ho=null,mo=null}var uo=null;var fo=null;var po=null;var ho=null;var mo=null;var yo=go(import.meta.url),So=f.dirname(yo),bo=f.dirname(f.dirname(So));function vo(e){return e&&(e==="~"?Q.homedir():e.startsWith("~/")||e.startsWith("~\\")?f.join(Q.homedir(),e.slice(2)):e)}var w=process.env.DATA_DIR?f.resolve(vo(process.env.DATA_DIR)):bo,N=f.join(w,"collected-profiles"),C=f.join(w,"market-research"),g=f.join(w,".schema-version"),he=[f.join(N,".schema-version"),f.join(C,".schema-version")],T=2,j=[{version:1,module:Y},{version:2,module:G}];(function(){j.sort((n,s)=>n.version-s.version);let o=new Set;for(let n of j){if(!Number.isInteger(n.version)||n.version<1)throw new Error(`MIGRATION_REGISTRY: invalid version ${JSON.stringify(n.version)} (must be positive integer)`);if(o.has(n.version))throw new Error(`MIGRATION_REGISTRY: duplicate version v${n.version}`);o.add(n.version);let s=n.module;if(!s||typeof s.up!="function")throw new Error(`MIGRATION_REGISTRY: v${n.version} module is missing up()`);if(s.VERSION!==void 0&&s.VERSION!==n.version)throw new Error(`MIGRATION_REGISTRY: v${n.version} entry does not match module VERSION (${s.VERSION}). Drift between registry and module \u2014 pick one source of truth.`)}let t=j.length?j[j.length-1].version:0;if(t!==T)throw new Error(`MIGRATION_REGISTRY: highest version v${t} but CURRENT_SCHEMA_VERSION=${T}. Forgot to bump CURRENT_SCHEMA_VERSION when adding the new migration?`);for(let n=0;n<j.length;n++){let s=n+1;if(j[n].version!==s)throw new Error(`MIGRATION_REGISTRY: gap detected \u2014 expected v${s} at position ${n} but found v${j[n].version}`)}})();function Se(){process.env.DATA_DIR!==void 0&&process.env.DATA_DIR.trim()===""&&process.env.DATA_DIR.length>0&&(console.error(`
|
|
9
9
|
[FATAL] DATA_DIR is set to whitespace ("${process.env.DATA_DIR}"). Either unset it or set a real path.
|
|
10
10
|
`),process.exit(1));try{c.mkdirSync(w,{recursive:!0})}catch(o){o.code!=="EEXIST"&&(console.error(`
|
|
11
11
|
[FATAL] Cannot create DATA_DIR (${w}): ${o.message}`),console.error(` Fix the path or permissions and try again.
|
|
@@ -13,41 +13,41 @@ ${n.join(`
|
|
|
13
13
|
[FATAL] DATA_DIR (${w}) is not accessible: ${o.message}
|
|
14
14
|
`),process.exit(1)}e.isDirectory()||(console.error(`
|
|
15
15
|
[FATAL] DATA_DIR (${w}) exists but is NOT a directory.`),console.error(` Looks like a typo \u2014 your DATA_DIR points at a file. Fix the path and try again.
|
|
16
|
-
`),process.exit(1));for(let o of[N,
|
|
16
|
+
`),process.exit(1));for(let o of[N,C]){let t;try{t=c.lstatSync(o)}catch(n){if(n.code==="ENOENT")continue;throw n}t.isSymbolicLink()&&(console.error(`
|
|
17
17
|
[FATAL] Data subdirectory is a symbolic link: ${o}`),console.error(" Refusing to follow \u2014 backup code would copy whatever the link points at."),console.error(` If this is intentional, replace the symlink with the real directory.
|
|
18
18
|
`),process.exit(1))}}var D=f.join(w,".migration-lock");function $o(){let e=JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()},null,2);try{return c.writeFileSync(D,e,{flag:"wx"}),!0}catch(n){if(n.code!=="EEXIST")throw n}let o;try{o=JSON.parse(c.readFileSync(D,"utf-8"))}catch{o=null}if(o&&Number.isInteger(o.pid)){let n=!1;try{process.kill(o.pid,0),n=!0}catch(i){i.code==="EPERM"&&(n=!0)}let s=24*60*60*1e3,r=1/0;if(o.startedAt){let i=Date.parse(o.startedAt);Number.isNaN(i)||(r=Date.now()-i)}n&&r<s&&(console.error(`
|
|
19
19
|
[FATAL] Another plugin process is currently running migrations:`),console.error(` PID: ${o.pid}`),console.error(` Started at: ${o.startedAt||"(unknown)"}`),console.error(` Lock file: ${D}
|
|
20
20
|
`),console.error(" Wait for it to finish, or if you're sure it's not actually running,"),console.error(` delete the lock file manually and re-run.
|
|
21
|
-
`),process.exit(1)),n&&r>=s&&console.log(` Lock holder PID ${o.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${o?.pid??"?"} found \u2014 taking over.`);let t=D+".tmp";try{return c.writeFileSync(t,e),c.renameSync(t,D),!0}catch(n){try{c.unlinkSync(t)}catch{}throw new Error(`Failed to take over stale migration lock: ${n.message}`)}}function z(){try{if(JSON.parse(c.readFileSync(D,"utf-8")).pid!==process.pid)return;c.unlinkSync(D)}catch{}}var
|
|
21
|
+
`),process.exit(1)),n&&r>=s&&console.log(` Lock holder PID ${o.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${o?.pid??"?"} found \u2014 taking over.`);let t=D+".tmp";try{return c.writeFileSync(t,e),c.renameSync(t,D),!0}catch(n){try{c.unlinkSync(t)}catch{}throw new Error(`Failed to take over stale migration lock: ${n.message}`)}}function z(){try{if(JSON.parse(c.readFileSync(D,"utf-8")).pid!==process.pid)return;c.unlinkSync(D)}catch{}}var me=!1;function wo(){if(me)return;me=!0;let e=()=>{try{z()}catch{}process.exit(1)};for(let o of["SIGINT","SIGTERM","SIGHUP"])try{process.on(o,e)}catch{}}function ko(){if(c.existsSync(g))return;let e=[],o=[];for(let r of he)if(c.existsSync(r))try{e.push({file:r,schema:U(r)})}catch(i){o.push({file:r,err:i.message})}if(o.length>0){console.error(`
|
|
22
22
|
[FATAL] Legacy .schema-version file(s) corrupted \u2014 cannot determine current schema version:`);for(let r of o)console.error(` ${r.file}: ${r.err}`);console.error(`
|
|
23
23
|
Repair the file(s) (likely just an integer 'version' field \u2014 see another working DATA_DIR`),console.error(` or default to {"version":1,"migrations":[]} if you're sure you're on schema v1) and try again.
|
|
24
24
|
`),process.exit(1)}if(e.length===0)return;let t=e.map(r=>r.schema.version);if(new Set(t).size>1){console.error(`
|
|
25
25
|
[FATAL] Legacy .schema-version files disagree:`);for(let r of e)console.error(` ${r.file}: v${r.schema.version}`);console.error(" This means a previous migration crashed between writing the two files."),console.error(` Reconcile manually (delete the wrong one, keep the right one), then re-run.
|
|
26
|
-
`),process.exit(1)}let n=e[0].schema,s=g+".tmp";try{c.writeFileSync(s,JSON.stringify(n,null,2)),c.renameSync(s,g)}catch(r){try{c.unlinkSync(s)}catch{}throw r}for(let r of
|
|
26
|
+
`),process.exit(1)}let n=e[0].schema,s=g+".tmp";try{c.writeFileSync(s,JSON.stringify(n,null,2)),c.renameSync(s,g)}catch(r){try{c.unlinkSync(s)}catch{}throw r}for(let r of he)if(c.existsSync(r))try{c.unlinkSync(r)}catch{}console.log(` Consolidated legacy .schema-version files \u2192 ${g}`)}function jo(e){if(e===null||typeof e!="object"||Array.isArray(e))return null;let o=Number(e.version);return!Number.isFinite(o)||o<0||!Number.isInteger(o)?null:(e.version=o,Array.isArray(e.migrations)||(e.migrations=[]),e)}function U(e){let o=c.readFileSync(e,"utf-8");return o.charCodeAt(0)===65279&&(o=o.slice(1)),JSON.parse(o)}function ge(){if(ko(),!c.existsSync(g))return{version:0,migrations:[]};let e;try{e=U(g)}catch(t){if(t.code==="ENOENT")return{version:0,migrations:[]};console.error(`
|
|
27
27
|
[FATAL] ${g} is not valid JSON: ${t.message}`),console.error(" Refusing to proceed \u2014 silently treating it as 'fresh install' would re-apply"),console.error(" every migration on top of already-migrated data and corrupt it."),console.error(' Repair the file (set it to {"version":N,"migrations":[...]} matching your real state)'),console.error(` or restore from the *.pre-vNNN.backup files if you have them.
|
|
28
28
|
`),process.exit(1)}let o=jo(e);return o===null&&(console.error(`
|
|
29
29
|
[FATAL] ${g} has invalid structure:`),console.error(` ${JSON.stringify(e)?.slice(0,200)||"(unparseable)"}`),console.error(' Expected shape: { "version": <integer>, "migrations": [...] }'),console.error(` Repair the file or restore from a backup.
|
|
30
|
-
`),process.exit(1)),o}function be(e){try{c.chmodSync(e,384)}catch{}}function Oo(e){if(Se(),c.existsSync(g))try{if(c.lstatSync(g).isSymbolicLink())throw new Error(`SCHEMA_FILE is a symbolic link: ${g}. Refusing to write through it (potential symlink attack). Remove the link and re-run.`)}catch(t){if(t.message?.includes("symbolic link"))throw t}let o=g+".tmp";try{c.writeFileSync(o,JSON.stringify(e,null,2)),be(o),c.renameSync(o,g)}catch(t){try{c.unlinkSync(o)}catch{}throw t}}function ye(e,o){if(!c.existsSync(e))return;let t=`.pre-v${String(o).padStart(3,"0")}.backup`,n=c.readdirSync(e).filter(l=>{let a=l.toLowerCase();if(a.includes(".backup")||a===".schema-version"||a.endsWith(".tmp"))return!1;try{return c.statSync(f.join(e,l)).isFile()}catch{return!1}}),s=0,r=0,i=[];for(let l of n){let a=f.join(e,l),u=f.join(e,l+t);if(c.existsSync(u)){r++;continue}try{$e(a,u),s++}catch(p){i.push({file:l,err:p.message})}}if(i.length>0){let l=new Error(`Failed to back up ${i.length} file(s) in ${f.basename(e)}/: `+i.map(a=>`${a.file} (${a.err})`).join(", "));throw l.code="BACKUP_INCOMPLETE",l}if(s>0||r>0){let l=r>0?` (${r} pre-existing backup(s) preserved)`:"";console.log(` Backed up ${s} files in ${f.basename(e)}/ (${t})${l}`)}}var
|
|
30
|
+
`),process.exit(1)),o}function be(e){try{c.chmodSync(e,384)}catch{}}function Oo(e){if(Se(),c.existsSync(g))try{if(c.lstatSync(g).isSymbolicLink())throw new Error(`SCHEMA_FILE is a symbolic link: ${g}. Refusing to write through it (potential symlink attack). Remove the link and re-run.`)}catch(t){if(t.message?.includes("symbolic link"))throw t}let o=g+".tmp";try{c.writeFileSync(o,JSON.stringify(e,null,2)),be(o),c.renameSync(o,g)}catch(t){try{c.unlinkSync(o)}catch{}throw t}}function ye(e,o){if(!c.existsSync(e))return;let t=`.pre-v${String(o).padStart(3,"0")}.backup`,n=c.readdirSync(e).filter(l=>{let a=l.toLowerCase();if(a.includes(".backup")||a===".schema-version"||a.endsWith(".tmp"))return!1;try{return c.statSync(f.join(e,l)).isFile()}catch{return!1}}),s=0,r=0,i=[];for(let l of n){let a=f.join(e,l),u=f.join(e,l+t);if(c.existsSync(u)){r++;continue}try{$e(a,u),s++}catch(p){i.push({file:l,err:p.message})}}if(i.length>0){let l=new Error(`Failed to back up ${i.length} file(s) in ${f.basename(e)}/: `+i.map(a=>`${a.file} (${a.err})`).join(", "));throw l.code="BACKUP_INCOMPLETE",l}if(s>0||r>0){let l=r>0?` (${r} pre-existing backup(s) preserved)`:"";console.log(` Backed up ${s} files in ${f.basename(e)}/ (${t})${l}`)}}var H=!1;async function ve(){if(H)return;Se(),Eo();let o=ge().version;if(o===T){H=!0;return}wo(),$o(),process.on("exit",z),o>T&&(console.error(`
|
|
31
31
|
[FATAL] Your data schema is at v${o}, but this plugin build only understands up to v${T}.`),console.error(" This usually means you downgraded the plugin without rolling back data."),console.error(` Operating on the newer-format data with this build would risk corrupting it.
|
|
32
32
|
`),console.error(" Options:"),console.error(" A) Re-install the newer plugin version that produced this schema, then"),console.error(" (if you really want to downgrade) run 'rollback-data --confirm' first,"),console.error(" then re-install the older plugin version."),console.error(` B) Manually restore your data from the *.pre-vNNN.backup files matching v${T}.
|
|
33
33
|
`),process.exit(1)),console.log(`
|
|
34
34
|
\u{1F4E6} Schema migration: v${o} \u2192 v${T}`);let t=Do();if(!t.ok){console.error(`
|
|
35
35
|
[FATAL] Cannot migrate \u2014 current data is corrupted:`);for(let s of t.broken)console.error(` ${s.dir}/${s.file}: ${s.err}`);console.error(`
|
|
36
36
|
Migration ABORTED. No backups taken, no files modified.`),console.error(" Repair the file(s) above (restore from your own backup, or fix manually)"),console.error(` and try again. To inspect: 'ilml linkedin migrate-status'.
|
|
37
|
-
`),process.exit(1)}let n=
|
|
38
|
-
Running migration v${String(s.version).padStart(3,"0")}...`);let r=`v${String(s.version).padStart(3,"0")}`,i=`.pre-${r}.backup`;try{ye(N,s.version),ye(
|
|
37
|
+
`),process.exit(1)}let n=j.filter(s=>s.version>o);for(let s of n){console.log(`
|
|
38
|
+
Running migration v${String(s.version).padStart(3,"0")}...`);let r=`v${String(s.version).padStart(3,"0")}`,i=`.pre-${r}.backup`;try{ye(N,s.version),ye(C,s.version)}catch(a){console.error(`
|
|
39
39
|
[FATAL] Pre-migration backup failed for ${r}: ${a.message}`),console.error(" Migration NOT applied. Repair the underlying issue (disk space, permissions, locked files)"),console.error(` and re-run the plugin command.
|
|
40
|
-
`),process.exit(1)}let l=s.module;try{await l.up(N,
|
|
40
|
+
`),process.exit(1)}let l=s.module;try{await l.up(N,C)}catch(a){console.error(`
|
|
41
41
|
[FATAL] Migration ${r} failed: ${a.message}`),console.error(` Attempting auto-rollback from ${i} files...`);try{let u=No(i);u.ok?(console.error(` \u2713 Auto-rollback restored ${u.restored} files. Schema stays at v${o}.`),console.error(` The migration will be retried on next plugin command. Fix the root cause first.
|
|
42
42
|
`)):(console.error(` [!] Auto-rollback INCOMPLETE: ${u.error}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
43
43
|
`))}catch(u){console.error(` [!] Auto-rollback CRASHED while restoring: ${u.message}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
44
44
|
`)}process.exit(1)}try{let a=new Date().toISOString(),u={version:s.version,name:l.NAME||r,appliedAt:a},p=ge();p.version=s.version,p.migratedAt=a,p.migrations=p.migrations||[],p.migrations.push(u),Oo(p)}catch(a){console.error(`
|
|
45
45
|
[FATAL] Migration ${r} applied successfully but schema version file could NOT be updated: ${a.message}`),console.error(` Your data is in the v${s.version} state but .schema-version still shows v${o}.`),console.error(` On next plugin command the runner will try to re-apply ${r}. If that migration is`),console.error(` idempotent (most are), it will succeed harmlessly. If you're unsure, run 'data-cleanup' and contact support.
|
|
46
|
-
`),process.exit(1)}console.log(` \u2713 Migration ${r} complete`)}try{ce()}catch{}try{de()}catch{}
|
|
46
|
+
`),process.exit(1)}console.log(` \u2713 Migration ${r} complete`)}try{ce()}catch{}try{de()}catch{}H=!0,z(),console.log(`
|
|
47
47
|
\u2713 Schema is now at v${T}
|
|
48
|
-
`)}var
|
|
49
|
-
${"\u2550".repeat(50)}`),console.log(` STEP: ${e}`),console.log("\u2550".repeat(50)),Oe)return console.log(` [DRY RUN] Would run: node ${o} ${t.join(" ")}`),!0;try{return
|
|
50
|
-
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`),console.log(` DAILY PIPELINE (${e})`),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");let o=
|
|
51
|
-
\u26A0 Funnel skipped: ${r.reason}`),n.funnel="skipped_quota")}E("scout")&&(n.scout=
|
|
48
|
+
`)}var Ao=[/\.json\.tmp$/,/\.schema-version\.tmp$/,/\.backup\.tmp$/];function Ro(e){let o=e.toLowerCase();return Ao.some(t=>t.test(o))}var Io=6e4;function To(){let e=Date.now(),o=[];for(let t of[w,N,C]){if(!c.existsSync(t))continue;let n;try{n=c.readdirSync(t)}catch{continue}for(let s of n){if(!Ro(s))continue;let r=f.join(t,s);try{let i=c.statSync(r);if(!i.isFile()||e-i.mtimeMs<Io)continue;o.push({dir:t,file:s,fullPath:r})}catch{}}}return o}function Eo({verbose:e=!1}={}){let o=To();if(o.length===0)return e&&console.log(" No orphan .tmp files found."),0;let t=0;for(let n of o)try{c.unlinkSync(n.fullPath),t++,e&&console.log(` Removed orphan: ${f.basename(n.dir)}/${n.file}`)}catch(s){console.warn(` [!] Could not remove orphan ${n.fullPath}: ${s.message}`)}return!e&&t>0&&console.log(` Cleaned up ${t} orphan .tmp file(s) from previous run.`),t}function Do(){let e=[];for(let o of[N,C]){if(!c.existsSync(o))continue;let t=c.readdirSync(o).filter(n=>{let s=n.toLowerCase();return s.endsWith(".json")&&!s.includes(".backup")});for(let n of t){let s=f.join(o,n);try{U(s)}catch(r){e.push({dir:f.basename(o),file:n,err:r.message})}}}return e.length===0?{ok:!0}:{ok:!1,broken:e}}function No(e){let o=[],t=[];for(let r of[N,C]){if(!c.existsSync(r))continue;let i=c.readdirSync(r).filter(l=>l.endsWith(e));for(let l of i){let a=f.join(r,l),u=l.slice(0,-e.length),p=f.join(r,u);try{u.toLowerCase().endsWith(".json")?U(a):c.accessSync(a,c.constants.R_OK),o.push({backupPath:a,originalPath:p,fileName:l,dir:r})}catch(O){t.push(`${f.basename(r)}/${l}: ${O.message}`)}}}if(t.length>0)return{ok:!1,error:t.join("; "),restored:0};let n=0,s=[];for(let{backupPath:r,originalPath:i,fileName:l,dir:a}of o)try{$e(r,i),n++}catch(u){s.push(`${f.basename(a)}/${l}: ${u.message}`)}return s.length>0?{ok:!1,error:s.join("; "),restored:n}:{ok:!0,restored:n}}function $e(e,o){let t=o+".tmp";try{c.copyFileSync(e,t),be(t)}catch(n){try{c.unlinkSync(t)}catch{}throw n}try{c.renameSync(t,o)}catch(n){try{c.unlinkSync(t)}catch{}if(n.code==="EPERM"||n.code==="EBUSY"){let s=new Error(`File locked: ${o} (${n.code}). On Windows this is usually antivirus / Search Indexer / the file open in another app. Close anything that might be holding it and re-run.`);throw s.code=n.code,s}throw n}}await ve();var M=process.argv.slice(2),K=new Set((M.find(e=>e.startsWith("--skip="))?.split("=")[1]||"").split(",").filter(Boolean)),we=new Set((M.find(e=>e.startsWith("--only="))?.split("=")[1]||"").split(",").filter(Boolean)),Oe=M.includes("--dry-run"),Ae=M.includes("--jobs"),Re=M.includes("--comms"),ke=["apply-queue","apply","funnel","scout","visit"],je=["sync","today"],Ie=Ae?ke:Re?je:[...ke,...je];function E(e){return we.size>0?we.has(e):!K.has(e)&&Ie.includes(e)}function F(e,o,t=[],{optional:n=!1}={}){if(console.log(`
|
|
49
|
+
${"\u2550".repeat(50)}`),console.log(` STEP: ${e}`),console.log("\u2550".repeat(50)),Oe)return console.log(` [DRY RUN] Would run: node ${o} ${t.join(" ")}`),!0;try{return Co("node",[o,...t],{stdio:"inherit",timeout:18e6}),console.log(` \u2713 ${e} completed`),!0}catch(s){return n?(console.log(` \u26A0 ${e} failed (optional): ${s.message?.slice(0,80)}`),!1):(console.error(` \u2717 ${e} failed: ${s.message?.slice(0,80)}`),!1)}}async function xo(){let e=Ae?"jobs":Re?"comms":"full";console.log(`
|
|
50
|
+
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`),console.log(` DAILY PIPELINE (${e})`),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");let o=Ie.filter(E);console.log(` Steps: ${o.join(" \u2192 ")}`),K.size>0&&console.log(` Skipping: ${[...K].join(", ")}`),Oe&&console.log(" [DRY RUN MODE]");let t=re("daily",e),n={};if(E("apply-queue")&&(n["apply-queue"]=F("Apply Queue (scored jobs)","applyQueue.mjs",["--max=50","--min-score=50"],{optional:!0})),E("apply")){let r=fe();n.apply=F("Apply from Search","run.mjs",[],{optional:!0})}if(E("funnel")&&!E("apply")){let r=ue();r.allowed?n.funnel=F("Connection Funnel","funnelRunner.mjs",["--max=20"],{optional:!0}):(console.log(`
|
|
51
|
+
\u26A0 Funnel skipped: ${r.reason}`),n.funnel="skipped_quota")}E("scout")&&(n.scout=F("Scout Jobs for Tomorrow","scout.mjs",["--max=300","--verbose"],{optional:!0})),E("sync")&&(n.sync=F("Sync Inbox","syncAll.mjs")),E("today")&&(n.today=F("Daily Report","syncAll.mjs",["--today"])),console.log(`
|
|
52
52
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550`),console.log(" PIPELINE COMPLETE"),console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");for(let[r,i]of Object.entries(n))console.log(` ${i===!0?"\u2713":i===!1?"\u2717":"\u26A0"} ${r}: ${i===!0?"success":i===!1?"failed":i}`);console.log(`\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550
|
|
53
|
-
`);let s=Object.values(n).some(r=>r===!1);ie(t,s?"partial":"success",n)}
|
|
53
|
+
`);let s=Object.values(n).some(r=>r===!1);ie(t,s?"partial":"success",n)}xo().catch(e=>{console.error("Daily pipeline failed:",e),process.exit(1)});
|