ilml-plugin-linkedin 1.17.0 → 1.17.1
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 +3 -0
- package/dist/syncConnections.mjs +29 -28
- package/dist/version.mjs +1 -1
- package/ilml-plugin.json +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.17.1
|
|
4
|
+
- **Fixed: `sync-connections` was saving a contact's name with their headline glued onto it** (e.g. "Bijan SaniiSoftware Industry Executive" instead of "Bijan Sanii"). On the connections page LinkedIn puts the name and headline inside one link, and the scan read them concatenated with no separator. It now reads the name from the rendered first line only, so new scans store clean names. (Contacts already saved with a glued name still work — the name is display-only — and are tidied separately.) No schema change.
|
|
5
|
+
|
|
3
6
|
## 1.17.0
|
|
4
7
|
- **Duplicate contacts are now prevented at the source, automatically — no command to run.** A person can appear on LinkedIn under two different URLs (a permanent id-based one and their custom-name one), and different parts of the plugin used to save them as two separate contacts. Two things fix this at the root: (1) whenever any command visits a profile, the plugin records the other URL LinkedIn redirects it to; (2) every write now checks whether you already have that person under any of their known URLs before creating a record — so a second copy isn't created in the first place. Works across all flows (apply, enrich, visit, sync), adds no profile visits, and needs nothing from you. Collapsing contacts that were *already* duplicated before this version is a separate follow-up. No schema change.
|
|
5
8
|
|
package/dist/syncConnections.mjs
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var Pe=Object.defineProperty;var B=(e,t)=>{for(var o in t)Pe(e,o,{get:t[o],enumerable:!0})};import{pathToFileURL as uo}from"url";var Y={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},Ue={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6};function M(e){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return null;let o=parseInt(t[1],10),n=parseInt(t[2],10),s=t[3].toUpperCase()==="PM";return s&&o!==12&&(o+=12),!s&&o===12&&(o=0),{hours:o,minutes:n}}function J(e,t){if(!e)return null;let o=e.trim();if(!o)return null;if(t=t||new Date,/^just\s*now$/i.test(o))return t.toISOString();if(/^today\b/i.test(o)||/^\d{1,2}:\d{2}\s*(AM|PM)$/i.test(o)){let l=M(o),c=new Date(t);return l?c.setHours(l.hours,l.minutes,0,0):c.setHours(0,0,0,0),c.toISOString()}let n=o.match(/^(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)\s*(.*)/i);if(n){let l=Ue[n[1].toLowerCase()],c=M(n[2]||""),a=new Date(t),u=a.getDay()-l;return u<=0&&(u+=7),a.setDate(a.getDate()-u),c?a.setHours(c.hours,c.minutes,0,0):a.setHours(0,0,0,0),a.toISOString()}let s=o.match(/^([A-Z][a-z]+)\s+(\d{1,2}),?\s+(\d{4})\s*(.*)/i);if(s){let l=Y[s[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(s[2],10),a=parseInt(s[3],10),f=M(s[4]||"");return new Date(a,l,c,f?.hours||0,f?.minutes||0,0,0).toISOString()}let r=o.match(/^([A-Z][a-z]+)\s+(\d{1,2}),\s*(.*)/i);if(r){let l=Y[r[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(r[2],10),a=M(r[3]||""),f=t.getFullYear(),u=new Date(f,l,c,a?.hours||0,a?.minutes||0,0,0);return u>t&&u.setFullYear(f-1),u.toISOString()}let i=o.match(/^([A-Z][a-z]+)\s+(\d{1,2})\s*(.*)/i);if(i){let l=Y[i[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(i[2],10),a=M(i[3]||""),f=t.getFullYear(),u=new Date(f,l,c,a?.hours||0,a?.minutes||0,0,0);return u>t&&u.setFullYear(f-1),u.toISOString()}return null}async function P(e){let t=Math.floor(Math.random()*2001),o=e+t;return new Promise(n=>setTimeout(n,o))}import{getPluginConfig as qe}from"@ilivemylife/graph-sdk";var Be=await qe();for(let[e,t]of Object.entries(Be))process.env[e]===void 0&&(process.env[e]=t);var Je=process.env.LINKEDIN_NAME,
|
|
1
|
+
var Pe=Object.defineProperty;var B=(e,t)=>{for(var o in t)Pe(e,o,{get:t[o],enumerable:!0})};import{pathToFileURL as uo}from"url";var Y={jan:0,feb:1,mar:2,apr:3,may:4,jun:5,jul:6,aug:7,sep:8,oct:9,nov:10,dec:11},Ue={sunday:0,monday:1,tuesday:2,wednesday:3,thursday:4,friday:5,saturday:6};function M(e){let t=e.match(/(\d{1,2}):(\d{2})\s*(AM|PM)/i);if(!t)return null;let o=parseInt(t[1],10),n=parseInt(t[2],10),s=t[3].toUpperCase()==="PM";return s&&o!==12&&(o+=12),!s&&o===12&&(o=0),{hours:o,minutes:n}}function J(e,t){if(!e)return null;let o=e.trim();if(!o)return null;if(t=t||new Date,/^just\s*now$/i.test(o))return t.toISOString();if(/^today\b/i.test(o)||/^\d{1,2}:\d{2}\s*(AM|PM)$/i.test(o)){let l=M(o),c=new Date(t);return l?c.setHours(l.hours,l.minutes,0,0):c.setHours(0,0,0,0),c.toISOString()}let n=o.match(/^(Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday)\s*(.*)/i);if(n){let l=Ue[n[1].toLowerCase()],c=M(n[2]||""),a=new Date(t),u=a.getDay()-l;return u<=0&&(u+=7),a.setDate(a.getDate()-u),c?a.setHours(c.hours,c.minutes,0,0):a.setHours(0,0,0,0),a.toISOString()}let s=o.match(/^([A-Z][a-z]+)\s+(\d{1,2}),?\s+(\d{4})\s*(.*)/i);if(s){let l=Y[s[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(s[2],10),a=parseInt(s[3],10),f=M(s[4]||"");return new Date(a,l,c,f?.hours||0,f?.minutes||0,0,0).toISOString()}let r=o.match(/^([A-Z][a-z]+)\s+(\d{1,2}),\s*(.*)/i);if(r){let l=Y[r[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(r[2],10),a=M(r[3]||""),f=t.getFullYear(),u=new Date(f,l,c,a?.hours||0,a?.minutes||0,0,0);return u>t&&u.setFullYear(f-1),u.toISOString()}let i=o.match(/^([A-Z][a-z]+)\s+(\d{1,2})\s*(.*)/i);if(i){let l=Y[i[1].toLowerCase().slice(0,3)];if(l===void 0)return null;let c=parseInt(i[2],10),a=M(i[3]||""),f=t.getFullYear(),u=new Date(f,l,c,a?.hours||0,a?.minutes||0,0,0);return u>t&&u.setFullYear(f-1),u.toISOString()}return null}async function P(e){let t=Math.floor(Math.random()*2001),o=e+t;return new Promise(n=>setTimeout(n,o))}import{getPluginConfig as qe}from"@ilivemylife/graph-sdk";var Be=await qe();for(let[e,t]of Object.entries(Be))process.env[e]===void 0&&(process.env[e]=t);var Je=process.env.LINKEDIN_NAME,_=Object.freeze({DRAFT:"draft",CONFIRMED:"confirmed",REJECTED:"rejected",NEEDS_REVIEW:"needs_review",SENT:"sent"}),$o=Object.freeze(new Set([_.DRAFT,_.CONFIRMED,_.NEEDS_REVIEW])),He=Object.freeze(new Set([_.DRAFT,_.CONFIRMED,_.REJECTED,_.NEEDS_REVIEW]));import"dotenv/config";import*as y from"fs";import*as S from"path";import{fileURLToPath as We}from"url";var Ve=We(import.meta.url),Ye=S.dirname(S.dirname(Ve)),I=process.env.DATA_DIR?S.resolve(process.env.DATA_DIR,"collected-profiles"):S.join(Ye,"collected-profiles"),G=S.join(I,"people.json"),xo=S.join(I,"jobs.json"),Io=S.join(I,"quota.json"),Do=S.join(I,"conversations.json"),Ro=S.join(I,"sync-state.json"),Oo=S.join(I,"application-questions.json"),_o=S.join(I,"profile-history"),ce=(e,t)=>{let o=parseInt(e,10);return Number.isInteger(o)&&o>=0?o:t},jo=ce(process.env.CONNECT_MAX_DAILY,20),No=ce(process.env.CONNECT_MAX_WEEKLY,100),L=null,Ge=null,Ke=null,ze=null,Qe=null,Xe=null;function le(){L=null,Ge=null,Ke=null,ze=null,Qe=null,Xe=null}function ae(){y.existsSync(I)||y.mkdirSync(I,{recursive:!0})}function Ze(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";y.writeFileSync(n,o);for(let s=0;s<3;s++)try{y.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 et(e,t){if(!y.existsSync(e))return null;try{let o=JSON.parse(y.readFileSync(e,"utf-8"));try{y.copyFileSync(e,e+".backup")}catch{}return o}catch(o){console.error(`[!] ${t} is corrupted: ${o.message}`),console.error(` File: ${S.resolve(e)}`);let n=e+".backup";if(y.existsSync(n))try{let s=JSON.parse(y.readFileSync(n,"utf-8"));console.error(` Restored from ${n}`);try{y.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{y.copyFileSync(e,e+".corrupted")}catch{}return null}}function H(e){if(!e)return null;let t=e.match(/\/in\/([^/?#]+)/);return t?t[1].toLowerCase():null}function U(){return L||(ae(),L=et(G,"people.json")||{},L)}function ue(e){ae(),L=e;try{Ze(G,e)}catch(t){console.error(`[!] Failed to save people.json: ${t.message}`),console.error(` Path: ${S.resolve(G)}`)}}import st from"puppeteer";import{addExtra as rt}from"puppeteer-extra";import it from"puppeteer-extra-plugin-stealth";import fe from"fs";import tt from"path";var ot="cookies.json";function nt(){let e=process.env.ILML_SCOPE_DIR;return e?tt.join(e,"plugins-state","linkedin","cookies.json"):ot}function pe(){let e=nt();if(!fe.existsSync(e))throw new Error(`Cookies not found at ${e}. Run: ilml linkedin login`);let t;try{t=fe.readFileSync(e,"utf-8")}catch(n){throw new Error(`Failed to read cookies at ${e}: ${n.message}. Run: ilml linkedin login`)}let o;try{o=JSON.parse(t)}catch{throw new Error(`Cookies file at ${e} is corrupted (invalid JSON). Run: ilml linkedin login`)}if(!Array.isArray(o)||o.length===0)throw new Error(`Cookies file at ${e} is empty or not an array. Run: ilml linkedin login`);return o}var de=rt(st);de.use(it());async function me(){let e=await de.launch({headless:!1,defaultViewport:null,protocolTimeout:3e5}),t=async()=>{console.log(`
|
|
2
2
|
Closing browser...`);try{await e.close()}catch{}process.exit(0)};process.on("SIGINT",t),process.on("SIGTERM",t);let o=await e.newPage();await o.evaluateOnNewDocument(()=>{Object.defineProperty(navigator,"webdriver",{get:()=>{}})});try{let n=pe();await o.setCookie(...n),console.log(" Browser launched, cookies loaded.")}catch(n){console.error(`
|
|
3
3
|
[!] ${n.message}
|
|
4
|
-
`),await e.close(),process.exit(1)}return{browser:e,page:o}}import"dotenv/config";import*as
|
|
4
|
+
`),await e.close(),process.exit(1)}return{browser:e,page:o}}import"dotenv/config";import*as $ from"fs";import*as R from"path";import{fileURLToPath as pt}from"url";import"dotenv/config";import{createGraphClient as ct,resolveToken as lt}from"@ilivemylife/graph-sdk";import{config as at}from"dotenv";at();var he=lt()||process.env.TOKEN;he||(console.error(`
|
|
5
5
|
[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.
|
|
6
6
|
`),console.error(" Easiest way:"),console.error(" 1. npm install -g @ilivemylife/graph-sdk"),console.error(` 2. ilml login your@email.com yourpassword
|
|
7
7
|
`),console.error(` Or add ILML_TOKEN=... to .env
|
|
8
8
|
`),process.exit(1));var ge=ct({token:he});function ut(e){if(!e||e<1e3)return`${e||0}ms`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let o=Math.floor(t/60),n=t%60;return n?`${o}m ${n}s`:`${o}m`}function ft({scriptName:e,mode:t,status:o,error:n,duration:s}){let r=o==="error"?"\u2717":o==="quota-reached"?"\u26A0":"\u2713",i=new Date().toISOString().slice(0,16).replace("T"," "),l=s?` ${ut(s)}`:"",c=o==="error"?`error${n?`: ${String(n).slice(0,80)}`:""}`:o==="quota-reached"?"daily quota reached":"done",a=t&&t!=="default"?` (${t})`:"";return`${r} ${e}${a} \u2014 ${c} \u2014 ${i}${l}`}async function ye({scriptName:e,mode:t,status:o,summaryLines:n,error:s,duration:r}){let i=process.env.NODE_RUN_REPORTS;if(!i||!Array.isArray(n)||n.length===0)return;let c=`**${ft({scriptName:e,mode:t,status:o,error:s,duration:r})}**
|
|
9
9
|
|
|
10
10
|
${n.join(`
|
|
11
|
-
`)}`;try{await ge.addMessage(i,c)}catch(a){console.error(`[runReport] Failed to post end-of-session message: ${a.message}`)}}var dt=pt(import.meta.url),mt=D.dirname(D.dirname(dt)),K=process.env.DATA_DIR?D.resolve(process.env.DATA_DIR,"collected-profiles"):D.join(mt,"collected-profiles"),z=D.join(K,"run-log.json");function ht(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";k.writeFileSync(n,o);for(let s=0;s<3;s++)try{k.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 Se(){try{if(!k.existsSync(z))return{runs:[]};let e=JSON.parse(k.readFileSync(z,"utf-8"));return!e.runs||!Array.isArray(e.runs)?{runs:[]}:e}catch{return{runs:[]}}}function we(e){k.existsSync(K)||k.mkdirSync(K,{recursive:!0});try{ht(z,e)}catch(t){console.error(`[!] Failed to save run-log.json: ${t.message}`)}}function be(e,t="default"){let o=Se();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 n=new Date,s={timestamp:n.toISOString(),script:e,mode:t,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),we(o),{script:e,mode:t,startTime:n.getTime(),runIndex:o.runs.length-1}}function Q(e,t,o=null,n=null){if(!e)return;let s=null;try{let i=Se(),l=i.runs[e.runIndex];if(l&&l.status==="running"&&l.script===e.script)l.status=t,l.result=t,l.duration=Date.now()-e.startTime,l.stats=o,l.error=n,s=l.duration;else{let c=i.runs.find(a=>a.script===e.script&&a.status==="running"&&a.timestamp===new Date(e.startTime).toISOString());c&&(c.status=t,c.result=t,c.duration=Date.now()-e.startTime,c.stats=o,c.error=n,s=c.duration)}we(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=t==="error"?"error":o&&o.dailyLimitHit?"quota-reached":"done";ye({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 p from"fs";import*as re from"os";import*as m from"path";import{fileURLToPath as Yt}from"url";var ee={};B(ee,{NAME:()=>yt,VERSION:()=>gt,up:()=>bt});import*as $ from"fs";import*as W from"path";var gt=1,yt="normalize-jobs-and-questions",St=["description","techStack","jobTags","seniority","employmentType","industries","jobFunction","postedTime","applicantCount","companySize","workplaceType","contractType","isEasyApply","applyType","companyUrl","scoutedAt","lastSeen"],wt=50;function X(e){return $.existsSync(e)?JSON.parse($.readFileSync(e,"utf-8")):null}function Z(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{$.writeFileSync(n,o)}catch(s){try{$.unlinkSync(n)}catch{}throw s}try{$.renameSync(n,e)}catch(s){try{$.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 bt(e,t){let o=W.join(e,"jobs.json"),n=W.join(t,"scouted-jobs.json"),s=W.join(e,"application-questions.json"),r=X(o)||{},i=X(n)||{},l=0,c=[];for(let f of Object.keys(r)){if(!i[f])continue;let u=i[f],d=r[f];for(let g of St)u[g]!=null&&d[g]==null&&(d[g]=u[g]);c.push(f),l++}l>0?(Z(o,r),console.log(` Phase 1: Merged ${l} scouted jobs into jobs.json`)):console.log(" Phase 1: No overlapping jobs to merge");let a=X(s);if(a&&Array.isArray(a.applications)){let f={},u=0;for(let d of a.applications){let g=d.jobId||"unknown";f[g]||(f[g]={applications:[]});let y=(d.questions||[]).map(h=>{let F={type:h.type||"input",question:h.question||"",answer:h.answer||""};return h.options&&(h.options.length<=wt?F.options=h.options:(F.optionsOmitted=!0,u++)),h.page&&(F.page=h.page),h.wasPreFilled&&(F.wasPreFilled=!0),h.wasRetry&&(F.wasRetry=!0),F});f[g].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||y.length,questions:y})}Z(s,f),console.log(` Phase 2: Rekeyed ${a.applications.length} applications by jobId (${Object.keys(f).length} unique jobs)`),u>0&&console.log(` Phase 2: Stripped bloated options from ${u} questions`)}else a&&!a.applications?console.log(" Phase 2: application-questions.json already in keyed format"):console.log(" Phase 2: No application-questions.json found");if(c.length>0){for(let f of c)delete i[f];Z(n,i),console.log(` Phase 3: Removed ${c.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 te={};B(te,{NAME:()=>kt,VERSION:()=>vt,up:()=>Ct});import*as A from"fs";import*as ve from"path";var vt=2,kt="reset-unread-flags";function $t(e){return A.existsSync(e)?JSON.parse(A.readFileSync(e,"utf-8")):null}function At(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{A.writeFileSync(n,o)}catch(s){try{A.unlinkSync(n)}catch{}throw s}try{A.renameSync(n,e)}catch(s){try{A.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 Ct(e){let t=ve.join(e,"conversations.json"),o=$t(t);if(!o){console.log(" conversations.json not found \u2014 nothing to reset.");return}let n=0;for(let s of Object.keys(o))o[s].unread===!0&&(o[s].unread=!1,n++);if(n===0){console.log(" No stale unread flags found \u2014 nothing to do.");return}At(t,o),console.log(` Reset unread=false on ${n} conversations. Run 'ilml linkedin sync-all' to re-establish real unread state from LinkedIn.`)}var oe={};B(oe,{NAME:()=>Tt,VERSION:()=>Et,up:()=>Ot});import*as C from"fs";import*as ke from"path";var Et=3,Tt="recompute-last-message-by",xt=new Set(["draft","confirmed","rejected","needs_review"]);function It(e){return C.existsSync(e)?JSON.parse(C.readFileSync(e,"utf-8")):null}function Dt(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{C.writeFileSync(n,o)}catch(s){try{C.unlinkSync(n)}catch{}throw s}try{C.renameSync(n,e)}catch(s){try{C.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}}function Rt(e,t){if(!e||e.length===0)return"them";let o=e.filter(r=>!xt.has(r.status));if(o.length===0)return"them";let n=o.map(r=>({m:r,t:Date.parse(r.time)})).filter(r=>Number.isFinite(r.t)).sort((r,i)=>i.t-r.t).map(r=>r.m),s=n.length>0?n:[...o].reverse();for(let r of s){let i=r.sender;if(i===t)return"me";if(i!=="Unknown"&&i!=="")return"them"}return"them"}async function Ot(e){let t=ke.join(e,"conversations.json"),o=It(t);if(!o){console.log(" conversations.json not found \u2014 nothing to recompute.");return}let n=process.env.LINKEDIN_NAME;if(!n||typeof n!="string"||!n.trim())throw new Error(`LINKEDIN_NAME env var is not set. Migration v003 needs your display name to determine which messages are yours vs theirs. Set LINKEDIN_NAME in your .env (or run "ilml plugin config linkedin set LINKEDIN_NAME 'Your Name'") and retry.`);let s=0,r=0,i=0;for(let l of Object.keys(o)){let c=o[l];if(!c||typeof c!="object")continue;Object.prototype.hasOwnProperty.call(c,"_cardSynced")&&(delete c._cardSynced,r++);let a=Array.isArray(c.messages)?c.messages:[],f=Rt(a,n),u=f==="me"?"awaiting_reply":"unanswered_by_us";c.lastMessageBy!==f&&i++,c.lastMessageBy=f,c.conversationStatus=u,s++}if(s===0){console.log(" No conversations to recompute.");return}Dt(t,o),console.log(` Recomputed lastMessageBy + conversationStatus on ${s} conversations.`),console.log(` ${i} had stale lastMessageBy (now corrected).`),r>0&&console.log(` Cleaned ${r} leftover _cardSynced flags.`),console.log(" Re-run 'ilml linkedin enrich' if you want actionNeeded / summary / autoTags to also update.")}var ne={};B(ne,{NAME:()=>jt,VERSION:()=>_t,up:()=>Mt});import*as E from"fs";import*as $e from"path";var _t=4,jt="split-connection-timestamps",Nt=new Set(["pending","sent_without_note","sent_with_note","sent_without_note_upsell"]);function Ft(e){if(!E.existsSync(e))return null;let t=E.readFileSync(e,"utf-8");return t.charCodeAt(0)===65279&&(t=t.slice(1)),JSON.parse(t)}function Lt(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{E.writeFileSync(n,o)}catch(s){try{E.unlinkSync(n)}catch{}throw s}try{E.renameSync(n,e)}catch(s){try{E.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 Mt(e){let t=$e.join(e,"people.json"),o=Ft(t);if(!o||typeof o!="object"){console.log(" people.json not found \u2014 nothing to migrate.");return}let n=0,s=0;for(let r of Object.keys(o)){let i=o[r];!i||typeof i!="object"||(s++,Nt.has(i.connectionStatus)&&i.connectionDate&&!i.requestedConnectionAt&&(i.requestedConnectionAt=i.connectionDate,i.connectionDate=null,n++))}if(n===0){console.log(` Scanned ${s} people \u2014 none needed the connectionDate\u2192requestedConnectionAt move.`);return}Lt(t,o),console.log(` Moved connectionDate \u2192 requestedConnectionAt on ${n} still-pending people (of ${s} scanned).`),console.log(' connectionDate now means "accepted on" only; requestedConnectionAt means "requested on".')}import"dotenv/config";import*as v from"path";import{fileURLToPath as Pt}from"url";var Ut=Pt(import.meta.url),qt=v.dirname(v.dirname(Ut)),q=process.env.DATA_DIR?v.resolve(process.env.DATA_DIR,"market-research"):v.join(qt,"market-research"),ln=v.join(q,"scouted-jobs.json"),an=v.join(q,"discovered-people.json"),un=v.join(q,"visit-log.json"),fn=v.join(q,"companies.json"),pn=v.join(q,"job-decisions.json");function Ae(){Bt=null,Jt=null,Ht=null,Wt=null,Vt=null}var Bt=null;var Jt=null;var Ht=null;var Wt=null;var Vt=null;var Gt=Yt(import.meta.url),Kt=m.dirname(Gt),zt=m.dirname(m.dirname(Kt));function Qt(e){return e&&(e==="~"?re.homedir():e.startsWith("~/")||e.startsWith("~\\")?m.join(re.homedir(),e.slice(2)):e)}var T=process.env.DATA_DIR?m.resolve(Qt(process.env.DATA_DIR)):zt,j=m.join(T,"collected-profiles"),N=m.join(T,"market-research"),b=m.join(T,".schema-version"),Ce=[m.join(j,".schema-version"),m.join(N,".schema-version")],R=4,I=[{version:1,module:ee},{version:2,module:te},{version:3,module:oe},{version:4,module:ne}];(function(){I.sort((n,s)=>n.version-s.version);let t=new Set;for(let n of I){if(!Number.isInteger(n.version)||n.version<1)throw new Error(`MIGRATION_REGISTRY: invalid version ${JSON.stringify(n.version)} (must be positive integer)`);if(t.has(n.version))throw new Error(`MIGRATION_REGISTRY: duplicate version v${n.version}`);t.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 o=I.length?I[I.length-1].version:0;if(o!==R)throw new Error(`MIGRATION_REGISTRY: highest version v${o} but CURRENT_SCHEMA_VERSION=${R}. Forgot to bump CURRENT_SCHEMA_VERSION when adding the new migration?`);for(let n=0;n<I.length;n++){let s=n+1;if(I[n].version!==s)throw new Error(`MIGRATION_REGISTRY: gap detected \u2014 expected v${s} at position ${n} but found v${I[n].version}`)}})();function Ie(){process.env.DATA_DIR!==void 0&&process.env.DATA_DIR.trim()===""&&process.env.DATA_DIR.length>0&&(console.error(`
|
|
11
|
+
`)}`;try{await ge.addMessage(i,c)}catch(a){console.error(`[runReport] Failed to post end-of-session message: ${a.message}`)}}var dt=pt(import.meta.url),mt=R.dirname(R.dirname(dt)),K=process.env.DATA_DIR?R.resolve(process.env.DATA_DIR,"collected-profiles"):R.join(mt,"collected-profiles"),z=R.join(K,"run-log.json");function ht(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";$.writeFileSync(n,o);for(let s=0;s<3;s++)try{$.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 Se(){try{if(!$.existsSync(z))return{runs:[]};let e=JSON.parse($.readFileSync(z,"utf-8"));return!e.runs||!Array.isArray(e.runs)?{runs:[]}:e}catch{return{runs:[]}}}function we(e){$.existsSync(K)||$.mkdirSync(K,{recursive:!0});try{ht(z,e)}catch(t){console.error(`[!] Failed to save run-log.json: ${t.message}`)}}function be(e,t="default"){let o=Se();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 n=new Date,s={timestamp:n.toISOString(),script:e,mode:t,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),we(o),{script:e,mode:t,startTime:n.getTime(),runIndex:o.runs.length-1}}function Q(e,t,o=null,n=null){if(!e)return;let s=null;try{let i=Se(),l=i.runs[e.runIndex];if(l&&l.status==="running"&&l.script===e.script)l.status=t,l.result=t,l.duration=Date.now()-e.startTime,l.stats=o,l.error=n,s=l.duration;else{let c=i.runs.find(a=>a.script===e.script&&a.status==="running"&&a.timestamp===new Date(e.startTime).toISOString());c&&(c.status=t,c.result=t,c.duration=Date.now()-e.startTime,c.stats=o,c.error=n,s=c.duration)}we(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=t==="error"?"error":o&&o.dailyLimitHit?"quota-reached":"done";ye({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 p from"fs";import*as re from"os";import*as h from"path";import{fileURLToPath as Yt}from"url";var ee={};B(ee,{NAME:()=>yt,VERSION:()=>gt,up:()=>bt});import*as A from"fs";import*as W from"path";var gt=1,yt="normalize-jobs-and-questions",St=["description","techStack","jobTags","seniority","employmentType","industries","jobFunction","postedTime","applicantCount","companySize","workplaceType","contractType","isEasyApply","applyType","companyUrl","scoutedAt","lastSeen"],wt=50;function X(e){return A.existsSync(e)?JSON.parse(A.readFileSync(e,"utf-8")):null}function Z(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{A.writeFileSync(n,o)}catch(s){try{A.unlinkSync(n)}catch{}throw s}try{A.renameSync(n,e)}catch(s){try{A.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 bt(e,t){let o=W.join(e,"jobs.json"),n=W.join(t,"scouted-jobs.json"),s=W.join(e,"application-questions.json"),r=X(o)||{},i=X(n)||{},l=0,c=[];for(let f of Object.keys(r)){if(!i[f])continue;let u=i[f],m=r[f];for(let g of St)u[g]!=null&&m[g]==null&&(m[g]=u[g]);c.push(f),l++}l>0?(Z(o,r),console.log(` Phase 1: Merged ${l} scouted jobs into jobs.json`)):console.log(" Phase 1: No overlapping jobs to merge");let a=X(s);if(a&&Array.isArray(a.applications)){let f={},u=0;for(let m of a.applications){let g=m.jobId||"unknown";f[g]||(f[g]={applications:[]});let v=(m.questions||[]).map(d=>{let w={type:d.type||"input",question:d.question||"",answer:d.answer||""};return d.options&&(d.options.length<=wt?w.options=d.options:(w.optionsOmitted=!0,u++)),d.page&&(w.page=d.page),d.wasPreFilled&&(w.wasPreFilled=!0),d.wasRetry&&(w.wasRetry=!0),w});f[g].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||v.length,questions:v})}Z(s,f),console.log(` Phase 2: Rekeyed ${a.applications.length} applications by jobId (${Object.keys(f).length} unique jobs)`),u>0&&console.log(` Phase 2: Stripped bloated options from ${u} questions`)}else a&&!a.applications?console.log(" Phase 2: application-questions.json already in keyed format"):console.log(" Phase 2: No application-questions.json found");if(c.length>0){for(let f of c)delete i[f];Z(n,i),console.log(` Phase 3: Removed ${c.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 te={};B(te,{NAME:()=>kt,VERSION:()=>vt,up:()=>Ct});import*as C from"fs";import*as ve from"path";var vt=2,kt="reset-unread-flags";function $t(e){return C.existsSync(e)?JSON.parse(C.readFileSync(e,"utf-8")):null}function At(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{C.writeFileSync(n,o)}catch(s){try{C.unlinkSync(n)}catch{}throw s}try{C.renameSync(n,e)}catch(s){try{C.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 Ct(e){let t=ve.join(e,"conversations.json"),o=$t(t);if(!o){console.log(" conversations.json not found \u2014 nothing to reset.");return}let n=0;for(let s of Object.keys(o))o[s].unread===!0&&(o[s].unread=!1,n++);if(n===0){console.log(" No stale unread flags found \u2014 nothing to do.");return}At(t,o),console.log(` Reset unread=false on ${n} conversations. Run 'ilml linkedin sync-all' to re-establish real unread state from LinkedIn.`)}var oe={};B(oe,{NAME:()=>Tt,VERSION:()=>Et,up:()=>Ot});import*as E from"fs";import*as ke from"path";var Et=3,Tt="recompute-last-message-by",xt=new Set(["draft","confirmed","rejected","needs_review"]);function It(e){return E.existsSync(e)?JSON.parse(E.readFileSync(e,"utf-8")):null}function Dt(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{E.writeFileSync(n,o)}catch(s){try{E.unlinkSync(n)}catch{}throw s}try{E.renameSync(n,e)}catch(s){try{E.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}}function Rt(e,t){if(!e||e.length===0)return"them";let o=e.filter(r=>!xt.has(r.status));if(o.length===0)return"them";let n=o.map(r=>({m:r,t:Date.parse(r.time)})).filter(r=>Number.isFinite(r.t)).sort((r,i)=>i.t-r.t).map(r=>r.m),s=n.length>0?n:[...o].reverse();for(let r of s){let i=r.sender;if(i===t)return"me";if(i!=="Unknown"&&i!=="")return"them"}return"them"}async function Ot(e){let t=ke.join(e,"conversations.json"),o=It(t);if(!o){console.log(" conversations.json not found \u2014 nothing to recompute.");return}let n=process.env.LINKEDIN_NAME;if(!n||typeof n!="string"||!n.trim())throw new Error(`LINKEDIN_NAME env var is not set. Migration v003 needs your display name to determine which messages are yours vs theirs. Set LINKEDIN_NAME in your .env (or run "ilml plugin config linkedin set LINKEDIN_NAME 'Your Name'") and retry.`);let s=0,r=0,i=0;for(let l of Object.keys(o)){let c=o[l];if(!c||typeof c!="object")continue;Object.prototype.hasOwnProperty.call(c,"_cardSynced")&&(delete c._cardSynced,r++);let a=Array.isArray(c.messages)?c.messages:[],f=Rt(a,n),u=f==="me"?"awaiting_reply":"unanswered_by_us";c.lastMessageBy!==f&&i++,c.lastMessageBy=f,c.conversationStatus=u,s++}if(s===0){console.log(" No conversations to recompute.");return}Dt(t,o),console.log(` Recomputed lastMessageBy + conversationStatus on ${s} conversations.`),console.log(` ${i} had stale lastMessageBy (now corrected).`),r>0&&console.log(` Cleaned ${r} leftover _cardSynced flags.`),console.log(" Re-run 'ilml linkedin enrich' if you want actionNeeded / summary / autoTags to also update.")}var ne={};B(ne,{NAME:()=>jt,VERSION:()=>_t,up:()=>Mt});import*as T from"fs";import*as $e from"path";var _t=4,jt="split-connection-timestamps",Nt=new Set(["pending","sent_without_note","sent_with_note","sent_without_note_upsell"]);function Ft(e){if(!T.existsSync(e))return null;let t=T.readFileSync(e,"utf-8");return t.charCodeAt(0)===65279&&(t=t.slice(1)),JSON.parse(t)}function Lt(e,t){let o=JSON.stringify(t,null,2),n=e+".tmp";try{T.writeFileSync(n,o)}catch(s){try{T.unlinkSync(n)}catch{}throw s}try{T.renameSync(n,e)}catch(s){try{T.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 Mt(e){let t=$e.join(e,"people.json"),o=Ft(t);if(!o||typeof o!="object"){console.log(" people.json not found \u2014 nothing to migrate.");return}let n=0,s=0;for(let r of Object.keys(o)){let i=o[r];!i||typeof i!="object"||(s++,Nt.has(i.connectionStatus)&&i.connectionDate&&!i.requestedConnectionAt&&(i.requestedConnectionAt=i.connectionDate,i.connectionDate=null,n++))}if(n===0){console.log(` Scanned ${s} people \u2014 none needed the connectionDate\u2192requestedConnectionAt move.`);return}Lt(t,o),console.log(` Moved connectionDate \u2192 requestedConnectionAt on ${n} still-pending people (of ${s} scanned).`),console.log(' connectionDate now means "accepted on" only; requestedConnectionAt means "requested on".')}import"dotenv/config";import*as k from"path";import{fileURLToPath as Pt}from"url";var Ut=Pt(import.meta.url),qt=k.dirname(k.dirname(Ut)),q=process.env.DATA_DIR?k.resolve(process.env.DATA_DIR,"market-research"):k.join(qt,"market-research"),ln=k.join(q,"scouted-jobs.json"),an=k.join(q,"discovered-people.json"),un=k.join(q,"visit-log.json"),fn=k.join(q,"companies.json"),pn=k.join(q,"job-decisions.json");function Ae(){Bt=null,Jt=null,Ht=null,Wt=null,Vt=null}var Bt=null;var Jt=null;var Ht=null;var Wt=null;var Vt=null;var Gt=Yt(import.meta.url),Kt=h.dirname(Gt),zt=h.dirname(h.dirname(Kt));function Qt(e){return e&&(e==="~"?re.homedir():e.startsWith("~/")||e.startsWith("~\\")?h.join(re.homedir(),e.slice(2)):e)}var x=process.env.DATA_DIR?h.resolve(Qt(process.env.DATA_DIR)):zt,N=h.join(x,"collected-profiles"),F=h.join(x,"market-research"),b=h.join(x,".schema-version"),Ce=[h.join(N,".schema-version"),h.join(F,".schema-version")],O=4,D=[{version:1,module:ee},{version:2,module:te},{version:3,module:oe},{version:4,module:ne}];(function(){D.sort((n,s)=>n.version-s.version);let t=new Set;for(let n of D){if(!Number.isInteger(n.version)||n.version<1)throw new Error(`MIGRATION_REGISTRY: invalid version ${JSON.stringify(n.version)} (must be positive integer)`);if(t.has(n.version))throw new Error(`MIGRATION_REGISTRY: duplicate version v${n.version}`);t.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 o=D.length?D[D.length-1].version:0;if(o!==O)throw new Error(`MIGRATION_REGISTRY: highest version v${o} but CURRENT_SCHEMA_VERSION=${O}. Forgot to bump CURRENT_SCHEMA_VERSION when adding the new migration?`);for(let n=0;n<D.length;n++){let s=n+1;if(D[n].version!==s)throw new Error(`MIGRATION_REGISTRY: gap detected \u2014 expected v${s} at position ${n} but found v${D[n].version}`)}})();function Ie(){process.env.DATA_DIR!==void 0&&process.env.DATA_DIR.trim()===""&&process.env.DATA_DIR.length>0&&(console.error(`
|
|
12
12
|
[FATAL] DATA_DIR is set to whitespace ("${process.env.DATA_DIR}"). Either unset it or set a real path.
|
|
13
|
-
`),process.exit(1));try{p.mkdirSync(
|
|
14
|
-
[FATAL] Cannot create DATA_DIR (${
|
|
15
|
-
`),process.exit(1))}let e;try{e=p.statSync(
|
|
16
|
-
[FATAL] DATA_DIR (${
|
|
13
|
+
`),process.exit(1));try{p.mkdirSync(x,{recursive:!0})}catch(t){t.code!=="EEXIST"&&(console.error(`
|
|
14
|
+
[FATAL] Cannot create DATA_DIR (${x}): ${t.message}`),console.error(` Fix the path or permissions and try again.
|
|
15
|
+
`),process.exit(1))}let e;try{e=p.statSync(x)}catch(t){console.error(`
|
|
16
|
+
[FATAL] DATA_DIR (${x}) is not accessible: ${t.message}
|
|
17
17
|
`),process.exit(1)}e.isDirectory()||(console.error(`
|
|
18
|
-
[FATAL] DATA_DIR (${
|
|
19
|
-
`),process.exit(1));for(let t of[
|
|
18
|
+
[FATAL] DATA_DIR (${x}) 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.
|
|
19
|
+
`),process.exit(1));for(let t of[N,F]){let o;try{o=p.lstatSync(t)}catch(n){if(n.code==="ENOENT")continue;throw n}o.isSymbolicLink()&&(console.error(`
|
|
20
20
|
[FATAL] Data subdirectory is a symbolic link: ${t}`),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.
|
|
21
|
-
`),process.exit(1))}}var
|
|
22
|
-
[FATAL] Another plugin process is currently running migrations:`),console.error(` PID: ${t.pid}`),console.error(` Started at: ${t.startedAt||"(unknown)"}`),console.error(` Lock file: ${
|
|
21
|
+
`),process.exit(1))}}var j=h.join(x,".migration-lock");function Xt(){let e=JSON.stringify({pid:process.pid,startedAt:new Date().toISOString()},null,2);try{return p.writeFileSync(j,e,{flag:"wx"}),!0}catch(n){if(n.code!=="EEXIST")throw n}let t;try{t=JSON.parse(p.readFileSync(j,"utf-8"))}catch{t=null}if(t&&Number.isInteger(t.pid)){let n=!1;try{process.kill(t.pid,0),n=!0}catch(i){i.code==="EPERM"&&(n=!0)}let s=24*60*60*1e3,r=1/0;if(t.startedAt){let i=Date.parse(t.startedAt);Number.isNaN(i)||(r=Date.now()-i)}n&&r<s&&(console.error(`
|
|
22
|
+
[FATAL] Another plugin process is currently running migrations:`),console.error(` PID: ${t.pid}`),console.error(` Started at: ${t.startedAt||"(unknown)"}`),console.error(` Lock file: ${j}
|
|
23
23
|
`),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.
|
|
24
|
-
`),process.exit(1)),n&&r>=s&&console.log(` Lock holder PID ${t.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${t?.pid??"?"} found \u2014 taking over.`);let o=
|
|
24
|
+
`),process.exit(1)),n&&r>=s&&console.log(` Lock holder PID ${t.pid} is alive but lock is older than 24h \u2014 assuming PID reuse, taking over.`)}console.log(` Stale migration lock from PID ${t?.pid??"?"} found \u2014 taking over.`);let o=j+".tmp";try{return p.writeFileSync(o,e),p.renameSync(o,j),!0}catch(n){try{p.unlinkSync(o)}catch{}throw new Error(`Failed to take over stale migration lock: ${n.message}`)}}function ie(){try{if(JSON.parse(p.readFileSync(j,"utf-8")).pid!==process.pid)return;p.unlinkSync(j)}catch{}}var Ee=!1;function Zt(){if(Ee)return;Ee=!0;let e=()=>{try{ie()}catch{}process.exit(1)};for(let t of["SIGINT","SIGTERM","SIGHUP"])try{process.on(t,e)}catch{}}function eo(){if(p.existsSync(b))return;let e=[],t=[];for(let r of Ce)if(p.existsSync(r))try{e.push({file:r,schema:V(r)})}catch(i){t.push({file:r,err:i.message})}if(t.length>0){console.error(`
|
|
25
25
|
[FATAL] Legacy .schema-version file(s) corrupted \u2014 cannot determine current schema version:`);for(let r of t)console.error(` ${r.file}: ${r.err}`);console.error(`
|
|
26
26
|
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.
|
|
27
27
|
`),process.exit(1)}if(e.length===0)return;let o=e.map(r=>r.schema.version);if(new Set(o).size>1){console.error(`
|
|
@@ -30,36 +30,37 @@ ${n.join(`
|
|
|
30
30
|
[FATAL] ${b} 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.
|
|
31
31
|
`),process.exit(1)}let t=to(e);return t===null&&(console.error(`
|
|
32
32
|
[FATAL] ${b} 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.
|
|
33
|
-
`),process.exit(1)),t}function De(e){try{p.chmodSync(e,384)}catch{}}function oo(e){if(Ie(),p.existsSync(b))try{if(p.lstatSync(b).isSymbolicLink())throw new Error(`SCHEMA_FILE is a symbolic link: ${b}. 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 t=b+".tmp";try{p.writeFileSync(t,JSON.stringify(e,null,2)),De(t),p.renameSync(t,b)}catch(o){try{p.unlinkSync(t)}catch{}throw o}}function xe(e,t){if(!p.existsSync(e))return;let o=`.pre-v${String(t).padStart(3,"0")}.backup`,n=p.readdirSync(e).filter(l=>{let c=l.toLowerCase();if(c.includes(".backup")||c===".schema-version"||c.endsWith(".tmp"))return!1;try{return p.statSync(
|
|
34
|
-
[FATAL] Your data schema is at v${t}, but this plugin build only understands up to v${
|
|
35
|
-
`),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${
|
|
33
|
+
`),process.exit(1)),t}function De(e){try{p.chmodSync(e,384)}catch{}}function oo(e){if(Ie(),p.existsSync(b))try{if(p.lstatSync(b).isSymbolicLink())throw new Error(`SCHEMA_FILE is a symbolic link: ${b}. 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 t=b+".tmp";try{p.writeFileSync(t,JSON.stringify(e,null,2)),De(t),p.renameSync(t,b)}catch(o){try{p.unlinkSync(t)}catch{}throw o}}function xe(e,t){if(!p.existsSync(e))return;let o=`.pre-v${String(t).padStart(3,"0")}.backup`,n=p.readdirSync(e).filter(l=>{let c=l.toLowerCase();if(c.includes(".backup")||c===".schema-version"||c.endsWith(".tmp"))return!1;try{return p.statSync(h.join(e,l)).isFile()}catch{return!1}}),s=0,r=0,i=[];for(let l of n){let c=h.join(e,l),a=h.join(e,l+o);if(p.existsSync(a)){r++;continue}try{Oe(c,a),s++}catch(f){i.push({file:l,err:f.message})}}if(i.length>0){let l=new Error(`Failed to back up ${i.length} file(s) in ${h.basename(e)}/: `+i.map(c=>`${c.file} (${c.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 ${h.basename(e)}/ (${o})${l}`)}}var se=!1;async function Re(){if(se)return;Ie(),co();let t=Te().version;if(t===O){se=!0;return}Zt(),Xt(),process.on("exit",ie),t>O&&(console.error(`
|
|
34
|
+
[FATAL] Your data schema is at v${t}, but this plugin build only understands up to v${O}.`),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.
|
|
35
|
+
`),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${O}.
|
|
36
36
|
`),process.exit(1)),console.log(`
|
|
37
|
-
\u{1F4E6} Schema migration: v${t} \u2192 v${
|
|
37
|
+
\u{1F4E6} Schema migration: v${t} \u2192 v${O}`);let o=lo();if(!o.ok){console.error(`
|
|
38
38
|
[FATAL] Cannot migrate \u2014 current data is corrupted:`);for(let s of o.broken)console.error(` ${s.dir}/${s.file}: ${s.err}`);console.error(`
|
|
39
39
|
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'.
|
|
40
|
-
`),process.exit(1)}let n=
|
|
41
|
-
Running migration v${String(s.version).padStart(3,"0")}...`);let r=`v${String(s.version).padStart(3,"0")}`,i=`.pre-${r}.backup`;try{xe(
|
|
40
|
+
`),process.exit(1)}let n=D.filter(s=>s.version>t);for(let s of n){console.log(`
|
|
41
|
+
Running migration v${String(s.version).padStart(3,"0")}...`);let r=`v${String(s.version).padStart(3,"0")}`,i=`.pre-${r}.backup`;try{xe(N,s.version),xe(F,s.version)}catch(c){console.error(`
|
|
42
42
|
[FATAL] Pre-migration backup failed for ${r}: ${c.message}`),console.error(" Migration NOT applied. Repair the underlying issue (disk space, permissions, locked files)"),console.error(` and re-run the plugin command.
|
|
43
|
-
`),process.exit(1)}let l=s.module;try{await l.up(
|
|
43
|
+
`),process.exit(1)}let l=s.module;try{await l.up(N,F)}catch(c){console.error(`
|
|
44
44
|
[FATAL] Migration ${r} failed: ${c.message}`),console.error(` Attempting auto-rollback from ${i} files...`);try{let a=ao(i);a.ok?(console.error(` \u2713 Auto-rollback restored ${a.restored} files. Schema stays at v${t}.`),console.error(` The migration will be retried on next plugin command. Fix the root cause first.
|
|
45
45
|
`)):(console.error(` [!] Auto-rollback INCOMPLETE: ${a.error}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
46
46
|
`))}catch(a){console.error(` [!] Auto-rollback CRASHED while restoring: ${a.message}`),console.error(` Manual recovery: copy *${i} files back over the originals.
|
|
47
47
|
`)}process.exit(1)}try{let c=new Date().toISOString(),a={version:s.version,name:l.NAME||r,appliedAt:c},f=Te();f.version=s.version,f.migratedAt=c,f.migrations=f.migrations||[],f.migrations.push(a),oo(f)}catch(c){console.error(`
|
|
48
48
|
[FATAL] Migration ${r} applied successfully but schema version file could NOT be updated: ${c.message}`),console.error(` Your data is in the v${s.version} state but .schema-version still shows v${t}.`),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.
|
|
49
49
|
`),process.exit(1)}console.log(` \u2713 Migration ${r} complete`)}try{le()}catch{}try{Ae()}catch{}se=!0,ie(),console.log(`
|
|
50
|
-
\u2713 Schema is now at v${
|
|
51
|
-
`)}var no=[/\.json\.tmp$/,/\.schema-version\.tmp$/,/\.backup\.tmp$/];function so(e){let t=e.toLowerCase();return no.some(o=>o.test(t))}var ro=6e4;function io(){let e=Date.now(),t=[];for(let o of[
|
|
50
|
+
\u2713 Schema is now at v${O}
|
|
51
|
+
`)}var no=[/\.json\.tmp$/,/\.schema-version\.tmp$/,/\.backup\.tmp$/];function so(e){let t=e.toLowerCase();return no.some(o=>o.test(t))}var ro=6e4;function io(){let e=Date.now(),t=[];for(let o of[x,N,F]){if(!p.existsSync(o))continue;let n;try{n=p.readdirSync(o)}catch{continue}for(let s of n){if(!so(s))continue;let r=h.join(o,s);try{let i=p.statSync(r);if(!i.isFile()||e-i.mtimeMs<ro)continue;t.push({dir:o,file:s,fullPath:r})}catch{}}}return t}function co({verbose:e=!1}={}){let t=io();if(t.length===0)return e&&console.log(" No orphan .tmp files found."),0;let o=0;for(let n of t)try{p.unlinkSync(n.fullPath),o++,e&&console.log(` Removed orphan: ${h.basename(n.dir)}/${n.file}`)}catch(s){console.warn(` [!] Could not remove orphan ${n.fullPath}: ${s.message}`)}return!e&&o>0&&console.log(` Cleaned up ${o} orphan .tmp file(s) from previous run.`),o}function lo(){let e=[];for(let t of[N,F]){if(!p.existsSync(t))continue;let o=p.readdirSync(t).filter(n=>{let s=n.toLowerCase();return s.endsWith(".json")&&!s.includes(".backup")});for(let n of o){let s=h.join(t,n);try{V(s)}catch(r){e.push({dir:h.basename(t),file:n,err:r.message})}}}return e.length===0?{ok:!0}:{ok:!1,broken:e}}function ao(e){let t=[],o=[];for(let r of[N,F]){if(!p.existsSync(r))continue;let i=p.readdirSync(r).filter(l=>l.endsWith(e));for(let l of i){let c=h.join(r,l),a=l.slice(0,-e.length),f=h.join(r,a);try{a.toLowerCase().endsWith(".json")?V(c):p.accessSync(c,p.constants.R_OK),t.push({backupPath:c,originalPath:f,fileName:l,dir:r})}catch(u){o.push(`${h.basename(r)}/${l}: ${u.message}`)}}}if(o.length>0)return{ok:!1,error:o.join("; "),restored:0};let n=0,s=[];for(let{backupPath:r,originalPath:i,fileName:l,dir:c}of t)try{Oe(r,i),n++}catch(a){s.push(`${h.basename(c)}/${l}: ${a.message}`)}return s.length>0?{ok:!1,error:s.join("; "),restored:n}:{ok:!0,restored:n}}function Oe(e,t){let o=t+".tmp";try{p.copyFileSync(e,o),De(o)}catch(n){try{p.unlinkSync(o)}catch{}throw n}try{p.renameSync(o,t)}catch(n){try{p.unlinkSync(o)}catch{}if(n.code==="EPERM"||n.code==="EBUSY"){let s=new Error(`File locked: ${t} (${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}}function fo(){let e={list:!1,full:!1,max:1/0,dryRun:!1,verbose:!1};for(let t of process.argv.slice(2))t==="--list"?e.list=!0:t==="--full"?e.full=!0:t==="--dry-run"?e.dryRun=!0:t==="--verbose"?e.verbose=!0:t.startsWith("--max=")&&(e.max=parseInt(t.split("=")[1],10));return e}function po(){let e=U(),t=Object.values(e),o=t.length,n={};for(let r of t){let i=r.connectionStatus||"(none)";n[i]=(n[i]||0)+1}let s={};for(let r of t){for(let i of r.sources||[])s[i]=(s[i]||0)+1;(!r.sources||r.sources.length===0)&&(s["(no source)"]=(s["(no source)"]||0)+1)}console.log(`
|
|
52
52
|
=== People Database: ${o} entries ===
|
|
53
53
|
`),console.log("By connection status:");for(let[r,i]of Object.entries(n).sort((l,c)=>c[1]-l[1]))console.log(` ${r.padEnd(30)} ${i}`);console.log(`
|
|
54
|
-
By source:`);for(let[r,i]of Object.entries(s).sort((l,c)=>c[1]-l[1]))console.log(` ${r.padEnd(30)} ${i}`);console.log()}async function mo(e){let t="https://www.linkedin.com/mynetwork/invite-connect/connections/";console.log(`Navigating to ${t}`),await e.goto(t,{waitUntil:"domcontentloaded",timeout:6e4}),await P(3e3);let o=e.url();if(o.includes("/login")||o.includes("/authwall"))throw new Error("Redirected to login \u2014 cookies expired. Run: npm run login");try{await e.waitForSelector('main a[href*="/in/"]',{timeout:15e3})}catch{console.warn("\u26A0 No connection cards found after 15s. Page may have changed layout.")}let n=await e.evaluate(()=>{let i=((document.querySelector("main")||document.body).innerText||"").match(/([\d,]+)\s+connections?/i);return i?parseInt(i[1].replace(/,/g,""),10):null});return n&&console.log(` LinkedIn reports: ${n.toLocaleString()} connections`),n}async function je(e){return e.evaluate(()=>{let o=(document.querySelector("main")||document.body).querySelectorAll('a[href*="/in/"]'),n={};for(let
|
|
55
|
-
`)
|
|
54
|
+
By source:`);for(let[r,i]of Object.entries(s).sort((l,c)=>c[1]-l[1]))console.log(` ${r.padEnd(30)} ${i}`);console.log()}async function mo(e){let t="https://www.linkedin.com/mynetwork/invite-connect/connections/";console.log(`Navigating to ${t}`),await e.goto(t,{waitUntil:"domcontentloaded",timeout:6e4}),await P(3e3);let o=e.url();if(o.includes("/login")||o.includes("/authwall"))throw new Error("Redirected to login \u2014 cookies expired. Run: npm run login");try{await e.waitForSelector('main a[href*="/in/"]',{timeout:15e3})}catch{console.warn("\u26A0 No connection cards found after 15s. Page may have changed layout.")}let n=await e.evaluate(()=>{let i=((document.querySelector("main")||document.body).innerText||"").match(/([\d,]+)\s+connections?/i);return i?parseInt(i[1].replace(/,/g,""),10):null});return n&&console.log(` LinkedIn reports: ${n.toLocaleString()} connections`),n}async function je(e){return e.evaluate(()=>{let o=(document.querySelector("main")||document.body).querySelectorAll('a[href*="/in/"]'),n={};for(let i of o){let l=i.getAttribute("href");if(!l)continue;let c;try{let a=new URL(l,location.origin);c=a.origin+a.pathname.replace(/\/+$/,"")}catch{continue}n[c]||(n[c]=[]),n[c].push(i)}let s=[],r=i=>((i&&(i.innerText||i.textContent)||"").trim().split(`
|
|
55
|
+
`)[0]||"").trim();for(let[i,l]of Object.entries(n)){let c=null;for(let d of l){let w=r(d);!w||d.querySelector("img")||(!c||w.length<r(c).length)&&(c=d)}let a=r(c)||null,f=c||l[0];for(let d=0;d<10&&f?.parentElement;d++){f=f.parentElement;let w=f.innerText||"";if((w.includes("Connected on")||w.includes("Message"))&&(w.match(/Connected on/g)||[]).length<=1)break}let u=(f?.innerText||"").split(`
|
|
56
|
+
`).map(d=>d.trim()).filter(Boolean),m=null,g=null,v=u.indexOf(a);if(v>=0&&v+1<u.length){let d=u[v+1];!d.startsWith("Connected on")&&d!=="Message"&&(m=d)}for(let d of u)if(d.startsWith("Connected on")){g=d;break}s.push({profileUrl:i,name:a,title:m,time:g})}return s})}async function Ne(e){return e.evaluate(()=>{let t=document.querySelector("main")||document.body,o=null,n=[t,...t.querySelectorAll("div, section")];for(let r of n){let i=getComputedStyle(r);if((i.overflowY==="auto"||i.overflowY==="scroll")&&r.scrollHeight>r.clientHeight+10){o=r;break}}o&&o.scrollBy(0,800),window.scrollBy(0,800);let s=document.querySelectorAll("button");for(let r of s){let i=r.textContent?.trim().toLowerCase()||"";if((i.includes("load more")||i.includes("show more"))&&r.getBoundingClientRect().height>0)return r.click(),"clicked"}return o?"scrolled":"window-scroll"})}async function ho(e,t){let{max:o,verbose:n,dryRun:s}=t,r=new Map,i=0,l=0,c=3,a=10;for(;;){i++;let f=await je(e),u=0;for(let g of f)g.profileUrl&&(r.has(g.profileUrl)||(r.set(g.profileUrl,g),u++));if(n?console.log(` Round #${i}: ${u} new | Total: ${r.size}`):process.stdout.write(`\r Connections found: ${r.size} (page #${i})`),!s&&i%a===0&&(Me(Array.from(r.values()),!1),n&&console.log(` \u{1F4BE} Saved progress (${r.size} connections)`)),r.size>=o){console.log(`
|
|
56
57
|
Reached --max=${o}, stopping.`);break}if(u===0){if(l++,l>=c){console.log(`
|
|
57
|
-
${c} rounds with no new cards \u2014 end of list.`);break}}else l=0;let
|
|
58
|
-
`),Array.from(r.values())}async function go(e,t){let{max:o,verbose:n}=t,s=U(),r=new Set;for(let[f,u]of Object.entries(s))u.connectionStatus==="connected"&&u.sources?.includes("sync-connections")&&r.add(f);console.log(` Known synced connections in DB: ${r.size}`);let i=new Map,l=0,c=0,a=3;for(;;){l++;let f=await je(e),u=0,
|
|
59
|
-
Reached --max=${o}, stopping.`);break}if(u===0&&
|
|
58
|
+
${c} rounds with no new cards \u2014 end of list.`);break}}else l=0;let m=await Ne(e);n&&m==="clicked"&&console.log(' \u2192 Clicked "Load more"'),await P(2e3)}return n||process.stdout.write(`
|
|
59
|
+
`),Array.from(r.values())}async function go(e,t){let{max:o,verbose:n}=t,s=U(),r=new Set;for(let[f,u]of Object.entries(s))u.connectionStatus==="connected"&&u.sources?.includes("sync-connections")&&r.add(f);console.log(` Known synced connections in DB: ${r.size}`);let i=new Map,l=0,c=0,a=3;for(;;){l++;let f=await je(e),u=0,m=0;for(let d of f)d.profileUrl&&(i.has(d.profileUrl)||(i.set(d.profileUrl,d),r.has(d.profileUrl)?m++:u++));let g=Array.from(i.values()).filter(d=>!r.has(d.profileUrl)).length;if(n?console.log(` Round #${l}: ${u} new, ${m} known | New total: ${g}`):process.stdout.write(`\r New connections: ${g} (page #${l})`),g>=o){console.log(`
|
|
60
|
+
Reached --max=${o}, stopping.`);break}if(u===0&&m>0){if(c++,c>=a){console.log(`
|
|
60
61
|
${a} consecutive pages of known connections \u2014 caught up.`);break}}else if(u>0)c=0;else if(c++,c>=a){console.log(`
|
|
61
|
-
${a} empty rounds \u2014 end of list.`);break}let
|
|
62
|
-
`),Array.from(i.values())}var Fe=new Set(["pending","sent_with_note","sent_without_note","sent_without_note_upsell"]);function _e(e){return typeof e=="string"?e.replace(/\s+/g," ").trim().toLowerCase():""}function Le(e){let t=new Map;for(let[o,n]of Object.entries(e)){let s=H(n.profileUrl||o);s&&!t.has(s)&&t.set(s,o)}for(let[o,n]of Object.entries(e))for(let s of n.aliases||[])s&&!t.has(s)&&t.set(s,o);return t}function yo(e,t){let o=[],n=Le(t);for(let s of e){if(!s.profileUrl)continue;let r=n.get(H(s.profileUrl)),i=r?t[r]:void 0;i&&Fe.has(i.connectionStatus)&&o.push({...s,previousStatus:i.connectionStatus})}return o}function Me(e,t){let o=U(),n=new Date().toISOString(),s=n.slice(0,10),r={newPeople:0,updatedToConnected:0,alreadyConnected:0,flaggedDuplicates:0,flagged:[]},i=Le(o),l=new Map;for(let[c,a]of Object.entries(o)){if(!Fe.has(a.connectionStatus))continue;let f=_e(a.name);f&&(l.has(f)||l.set(f,[]),l.get(f).push(c))}for(let c of e){if(!c.profileUrl)continue;let a=H(c.profileUrl),f=a?i.get(a):null,u=f?o[f]:void 0;if(u){if(u.connectionStatus!=="connected"){u.connectionStatus="connected";let
|
|
62
|
+
${a} empty rounds \u2014 end of list.`);break}let v=await Ne(e);n&&v==="clicked"&&console.log(' \u2192 Clicked "Load more"'),await P(2e3)}return n||process.stdout.write(`
|
|
63
|
+
`),Array.from(i.values())}var Fe=new Set(["pending","sent_with_note","sent_without_note","sent_without_note_upsell"]);function _e(e){return typeof e=="string"?e.replace(/\s+/g," ").trim().toLowerCase():""}function Le(e){let t=new Map;for(let[o,n]of Object.entries(e)){let s=H(n.profileUrl||o);s&&!t.has(s)&&t.set(s,o)}for(let[o,n]of Object.entries(e))for(let s of n.aliases||[])s&&!t.has(s)&&t.set(s,o);return t}function yo(e,t){let o=[],n=Le(t);for(let s of e){if(!s.profileUrl)continue;let r=n.get(H(s.profileUrl)),i=r?t[r]:void 0;i&&Fe.has(i.connectionStatus)&&o.push({...s,previousStatus:i.connectionStatus})}return o}function Me(e,t){let o=U(),n=new Date().toISOString(),s=n.slice(0,10),r={newPeople:0,updatedToConnected:0,alreadyConnected:0,flaggedDuplicates:0,flagged:[]},i=Le(o),l=new Map;for(let[c,a]of Object.entries(o)){if(!Fe.has(a.connectionStatus))continue;let f=_e(a.name);f&&(l.has(f)||l.set(f,[]),l.get(f).push(c))}for(let c of e){if(!c.profileUrl)continue;let a=H(c.profileUrl),f=a?i.get(a):null,u=f?o[f]:void 0;if(u){if(u.connectionStatus!=="connected"){u.connectionStatus="connected";let m=c.time?J(c.time.replace(/^Connected\s+on\s+/i,"")):null;u.connectedAt=m||n,u.connectionDate=(m||n).slice(0,10),u.lastUpdated=n,r.updatedToConnected++}else if(r.alreadyConnected++,c.time&&(!u.connectedAt||!u.connectionDate)){let m=J(c.time.replace(/^Connected\s+on\s+/i,""));m&&(u.connectedAt||(u.connectedAt=m),u.connectionDate||(u.connectionDate=m.slice(0,10)),u.lastUpdated=n)}c.name&&!u.name&&(u.name=c.name),c.title&&(u.title=c.title),u.sources||(u.sources=[]),u.sources.includes("sync-connections")||u.sources.push("sync-connections"),u.lastSeen=s,u.seenCount=(u.seenCount||1)+1,u.lastUpdated=n}else{let m={name:c.name,title:c.title,location:null,company:null,connectionDegree:"1st",connectionsCount:null,mutualConnections:null,photoUrl:null,hasVerifiedBadge:!1,firstSeen:s,lastSeen:s,seenCount:1,sources:["sync-connections"],connectionStatus:"connected",connectionDate:s,connectionMethod:null,messageSent:null,jobIds:[],lastUpdated:n},g=_e(c.name),v=g?l.get(g)||[]:[];v.length&&(m.possibleDuplicateOf=[...v],r.flaggedDuplicates++,r.flagged.push({name:c.name,candidates:v.length})),o[c.profileUrl]=m,a&&i.set(a,c.profileUrl),r.newPeople++}}return t||ue(o),r}function So(e,t,o,n,s,r){if(console.log(`
|
|
63
64
|
\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\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(` Sync Connections Summary (${r})`),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"),s&&console.log(` LinkedIn header: ${s.toLocaleString()}`),console.log(` Connections scraped: ${e.length}`),console.log(` New people added: ${o.newPeople}`),console.log(` Updated to connected: ${o.updatedToConnected}`),console.log(` Already connected: ${o.alreadyConnected}`),t.length>0){console.log(`
|
|
64
65
|
Newly accepted (${t.length}):`);for(let i of t)console.log(` \u2713 ${i.name||"Unknown"} (was: ${i.previousStatus})`)}if(o.flaggedDuplicates>0){console.log(`
|
|
65
66
|
\u26A0 Possible duplicates (${o.flaggedDuplicates}) \u2014 new connection shares a name with a still-pending person (likely the same person accepting under a vanity url we couldn't match by slug). Flagged for review, NOT merged:`);for(let i of o.flagged||[])console.log(` ? ${i.name||"Unknown"}${i.candidates>1?` (${i.candidates} candidates)`:""}`)}n&&console.log(`
|
package/dist/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{readFileSync as e}from"fs";import{fileURLToPath as r}from"url";function i(){return"1.17.
|
|
1
|
+
import{readFileSync as e}from"fs";import{fileURLToPath as r}from"url";function i(){return"1.17.1";try{let n=new URL("./ilml-plugin.json",import.meta.url);return JSON.parse(e(r(n),"utf-8")).version}catch{return"unknown"}}console.log(`ilml-plugin-linkedin ${i()}`);
|
package/ilml-plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linkedin",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.1",
|
|
4
4
|
"description": "Reference ilml plugin: keep a local mirror of your LinkedIn data with AI-assisted workflows",
|
|
5
5
|
"commands": {
|
|
6
6
|
"help": { "run": "node dist/help.mjs", "description": "List all commands with descriptions; or `help <cmd>` for detailed info on one command (usage, flags, ban-risk, when-to-use). Reads ilml-plugin.json directly.", "usage": "ilml linkedin help [<cmd>]", "useWhen": "You forgot what a command does, or you're an AI agent picking the right tool." },
|
package/package.json
CHANGED