grix-connector 1.1.3 → 1.1.4

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.
@@ -1,3 +1,3 @@
1
- import{execFile as p}from"node:child_process";import{join as u}from"node:path";import{promisify as v}from"node:util";const a=v(p),l=5e3;function m(e){const t=e.replace(/^[^0-9]*/,"").split(".");return[parseInt(t[0]??"0",10)||0,parseInt(t[1]??"0",10)||0]}function h(e,n){const[t,r]=m(e),[i,s]=m(n);return t>i||t===i&&r>=s}async function o(e,n=["--version"]){try{const{stdout:t}=await a(e,n,{timeout:l,encoding:"utf-8"});return{found:!0,version:(t||"").trim().split(`
2
- `)[0]?.trim()||null}}catch{return{found:!1,version:null}}}async function w(){const e=await o("node",["--version"]);return e.version?{found:!0,version:e.version.replace(/^v/,"")}:e}async function b(){if(process.platform==="win32"){const e=["npm",u(process.env.ProgramFiles||"C:\\Program Files","nodejs","npm.cmd"),u(process.env.APPDATA||"","npm","npm.cmd")];try{const{stdout:n}=await a("where.exe",["node"],{timeout:l,encoding:"utf-8"}),t=u(n.trim().split(`
3
- `)[0],"..");e.push(u(t,"npm.cmd"))}catch{}for(const n of e)try{const{stdout:t}=await a(n,["--version"],{timeout:l,encoding:"utf-8"});return{found:!0,version:t.trim()}}catch{}return{found:!1,version:null}}return o("npm",["--version"])}async function y(){const e=await o("curl",["--version"]);return e.version?{found:!0,version:e.version.split(" ")[0]?.trim()??null}:e}async function g(){const e=await o("gh",["--version"]);return e.version?{found:!0,version:e.version.match(/(\d+\.\d+\.\d+)/)?.[1]??e.version}:e}async function P(){const e=await o("brew",["--version"]);return e.version?{found:!0,version:e.version.match(/(\d+\.\d+\.\d+)/)?.[1]??e.version}:e}function V(e){return[{id:"node",label:"Node.js",minVersion:"18.0",detect:w},{id:"npm",label:"npm",minVersion:"9.0",detect:b},{id:"curl",label:"curl",minVersion:null,detect:y},{id:"gh",label:"GitHub CLI (gh)",minVersion:null,detect:g},...e!=="windows"?[{id:"brew",label:"Homebrew",minVersion:null,detect:P}]:[]]}async function k(e,n){const r=V(n).find(d=>d.id===e);if(!r)return{id:e,label:e,met:!1,version:null,minVersion:null,autoInstallable:!1};const{found:i,version:s}=await r.detect();let c=i;c&&r.minVersion&&s&&(c=h(s,r.minVersion));const f=I(e,n);return{id:e,label:r.label,met:c,version:s,minVersion:r.minVersion,autoInstallable:c?!1:f}}async function M(e,n){return await Promise.all(e.map(r=>k(r,n)))}function A(e){return e.every(n=>n.met)}function q(e){return e.filter(n=>!n.met)}function I(e,n){switch(e){case"node":case"npm":return!0;case"curl":return!0;case"gh":return!0;case"brew":return n==="macos";default:return!1}}export{A as allPrerequisitesMet,k as checkPrerequisite,M as checkPrerequisites,q as getMissingPrerequisites};
1
+ import{execFile as h}from"node:child_process";import{join as l}from"node:path";import{promisify as v}from"node:util";import{log as o}from"../log/logger.js";const u=v(h),m=5e3;function f(e){const t=e.replace(/^[^0-9]*/,"").split(".");return[parseInt(t[0]??"0",10)||0,parseInt(t[1]??"0",10)||0]}function g(e,n){const[t,r]=f(e),[c,i]=f(n);return t>c||t===c&&r>=i}async function s(e,n=["--version"]){try{const{stdout:t}=await u(e,n,{timeout:m,encoding:"utf-8"});return{found:!0,version:(t||"").trim().split(`
2
+ `)[0]?.trim()||null}}catch{return{found:!1,version:null}}}async function w(){const e=await s("node",["--version"]);return e.version?{found:!0,version:e.version.replace(/^v/,"")}:e}async function b(){if(process.platform==="win32"){o.info("preflight","[npm-detect] Starting Windows npm detection");const e=["npm",l(process.env.ProgramFiles||"C:\\Program Files","nodejs","npm.cmd"),l(process.env.APPDATA||"","npm","npm.cmd")];try{o.info("preflight","[npm-detect] Trying to locate node.exe via where.exe");const{stdout:n}=await u("where.exe",["node"],{timeout:m,encoding:"utf-8"}),t=l(n.trim().split(`
3
+ `)[0],".."),r=l(t,"npm.cmd");e.push(r),o.info("preflight",`[npm-detect] Inferred npm path from node: ${r}`)}catch(n){o.warn("preflight",`[npm-detect] Failed to locate node.exe: ${n instanceof Error?n.message:String(n)}`)}o.info("preflight",`[npm-detect] Will try ${e.length} paths: ${e.join(", ")}`);for(const n of e)try{o.info("preflight",`[npm-detect] Trying: ${n}`);const{stdout:t}=await u(n,["--version"],{timeout:m,encoding:"utf-8"}),r=t.trim();return o.info("preflight",`[npm-detect] SUCCESS at ${n}, version: ${r}`),{found:!0,version:r}}catch(t){o.warn("preflight",`[npm-detect] Failed at ${n}: ${t instanceof Error?t.message:String(t)}`)}return o.error("preflight","[npm-detect] All paths failed, npm not found"),{found:!1,version:null}}return s("npm",["--version"])}async function y(){const e=await s("curl",["--version"]);return e.version?{found:!0,version:e.version.split(" ")[0]?.trim()??null}:e}async function P(){const e=await s("gh",["--version"]);return e.version?{found:!0,version:e.version.match(/(\d+\.\d+\.\d+)/)?.[1]??e.version}:e}async function V(){const e=await s("brew",["--version"]);return e.version?{found:!0,version:e.version.match(/(\d+\.\d+\.\d+)/)?.[1]??e.version}:e}function x(e){return[{id:"node",label:"Node.js",minVersion:"18.0",detect:w},{id:"npm",label:"npm",minVersion:"9.0",detect:b},{id:"curl",label:"curl",minVersion:null,detect:y},{id:"gh",label:"GitHub CLI (gh)",minVersion:null,detect:P},...e!=="windows"?[{id:"brew",label:"Homebrew",minVersion:null,detect:V}]:[]]}async function k(e,n){const r=x(n).find(p=>p.id===e);if(!r)return{id:e,label:e,met:!1,version:null,minVersion:null,autoInstallable:!1};const{found:c,version:i}=await r.detect();let a=c;a&&r.minVersion&&i&&(a=g(i,r.minVersion));const d=C(e,n);return{id:e,label:r.label,met:a,version:i,minVersion:r.minVersion,autoInstallable:a?!1:d}}async function A(e,n){return await Promise.all(e.map(r=>k(r,n)))}function F(e){return e.every(n=>n.met)}function M(e){return e.filter(n=>!n.met)}function C(e,n){switch(e){case"node":case"npm":return!0;case"curl":return!0;case"gh":return!0;case"brew":return n==="macos";default:return!1}}export{F as allPrerequisitesMet,k as checkPrerequisite,A as checkPrerequisites,M as getMissingPrerequisites};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grix-connector",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "description": "Connect local AI coding agents (Claude, Codex, Gemini, Qwen, DeepSeek, Cursor, OpenCode, Pi, OpenHuman, Reasonix) to the Grix scheduling platform. Also serves as an OpenClaw plugin for Grix channel transport.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",