@0dai-dev/cli 3.1.6 → 3.1.7
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/bin/0dai.js +115 -1
- package/package.json +1 -1
package/bin/0dai.js
CHANGED
|
@@ -807,6 +807,50 @@ function cmdDoctor(target) {
|
|
|
807
807
|
console.log(` ${mark.padEnd(22)} ${c.name}${hint}`);
|
|
808
808
|
}
|
|
809
809
|
|
|
810
|
+
// --- agent CLIs check ---
|
|
811
|
+
const AGENT_CLIS = [
|
|
812
|
+
{ name: "claude", pkg: "@anthropic-ai/claude-code", bin: "claude", install: "npm i -g @anthropic-ai/claude-code", altAuth: "Pro/Team subscription" },
|
|
813
|
+
{ name: "codex", pkg: "@openai/codex", bin: "codex", install: "npm i -g @openai/codex", altAuth: "ChatGPT Pro subscription" },
|
|
814
|
+
{ name: "gemini", pkg: "@google/gemini-cli", bin: "gemini", install: "npm i -g @google/gemini-cli", altAuth: null },
|
|
815
|
+
{ name: "aider", pkg: null, bin: "aider", install: "pip install aider-chat", altAuth: null },
|
|
816
|
+
{ name: "opencode", pkg: null, bin: "opencode", install: "go install github.com/nichochar/opencode@latest", altAuth: null },
|
|
817
|
+
];
|
|
818
|
+
const { execFileSync: _ef2 } = require("child_process");
|
|
819
|
+
let updatesAvailable = 0;
|
|
820
|
+
console.log("\n agent CLIs:");
|
|
821
|
+
for (const cli of AGENT_CLIS) {
|
|
822
|
+
let installed = false, ver = null;
|
|
823
|
+
try {
|
|
824
|
+
const out = _ef2(cli.bin, ["--version"], { timeout: 3000 }).toString().trim();
|
|
825
|
+
installed = true;
|
|
826
|
+
const m = out.match(/(\d+\.\d+\.\d+)/);
|
|
827
|
+
if (m) ver = m[1];
|
|
828
|
+
} catch {}
|
|
829
|
+
|
|
830
|
+
if (installed) {
|
|
831
|
+
let latest = null;
|
|
832
|
+
if (cli.pkg) {
|
|
833
|
+
try {
|
|
834
|
+
const npmOut = _ef2("npm", ["view", cli.pkg, "version"], { timeout: 5000 }).toString().trim();
|
|
835
|
+
if (npmOut.match(/^\d+\.\d+\.\d+$/)) latest = npmOut;
|
|
836
|
+
} catch {}
|
|
837
|
+
}
|
|
838
|
+
if (latest && ver && latest !== ver) {
|
|
839
|
+
updatesAvailable++;
|
|
840
|
+
console.log(` ${W}update${R2} ${cli.name} ${D}${ver} → ${latest}${R2}`);
|
|
841
|
+
console.log(` ${D}→ ${cli.install}${R2}`);
|
|
842
|
+
} else {
|
|
843
|
+
console.log(` ${G}ok${R2} ${cli.name}${ver ? ` ${D}v${ver}${R2}` : ""}`);
|
|
844
|
+
}
|
|
845
|
+
} else {
|
|
846
|
+
console.log(` ${D}—${R2} ${cli.name} ${D}not installed${R2}`);
|
|
847
|
+
console.log(` ${D}→ ${cli.install}${cli.altAuth ? ` (or ${cli.altAuth})` : ""}${R2}`);
|
|
848
|
+
}
|
|
849
|
+
}
|
|
850
|
+
if (updatesAvailable) {
|
|
851
|
+
console.log(`\n ${D}Run: 0dai update${R2} to update all`);
|
|
852
|
+
}
|
|
853
|
+
|
|
810
854
|
// --- swarm check ---
|
|
811
855
|
const swarmDir = path.join(ai, "swarm");
|
|
812
856
|
const countDir = (d) => { try { return fs.readdirSync(d).filter(f => f.endsWith(".json")).length; } catch { return 0; } };
|
|
@@ -888,6 +932,74 @@ function cmdValidate(target) {
|
|
|
888
932
|
}
|
|
889
933
|
}
|
|
890
934
|
|
|
935
|
+
// --- Update agent CLIs ---
|
|
936
|
+
function cmdUpdate(args) {
|
|
937
|
+
const { execFileSync: _ef3, execSync } = require("child_process");
|
|
938
|
+
const dryRun = args.includes("--dry-run");
|
|
939
|
+
|
|
940
|
+
const CLIS = [
|
|
941
|
+
{ name: "0dai", pkg: "@0dai-dev/cli", bin: "0dai", type: "npm" },
|
|
942
|
+
{ name: "claude", pkg: "@anthropic-ai/claude-code",bin: "claude", type: "npm" },
|
|
943
|
+
{ name: "codex", pkg: "@openai/codex", bin: "codex", type: "npm" },
|
|
944
|
+
{ name: "gemini", pkg: "@google/gemini-cli", bin: "gemini", type: "npm" },
|
|
945
|
+
{ name: "aider", pkg: "aider-chat", bin: "aider", type: "pip" },
|
|
946
|
+
{ name: "opencode",pkg: null, bin: "opencode",type: "go" },
|
|
947
|
+
];
|
|
948
|
+
|
|
949
|
+
let updated = 0;
|
|
950
|
+
for (const cli of CLIS) {
|
|
951
|
+
let installed = false, ver = null;
|
|
952
|
+
try {
|
|
953
|
+
const out = _ef3(cli.bin, ["--version"], { timeout: 3000 }).toString().trim();
|
|
954
|
+
installed = true;
|
|
955
|
+
const m = out.match(/(\d+\.\d+\.\d+)/);
|
|
956
|
+
if (m) ver = m[1];
|
|
957
|
+
} catch {}
|
|
958
|
+
|
|
959
|
+
if (!installed) continue;
|
|
960
|
+
|
|
961
|
+
let latest = null;
|
|
962
|
+
if (cli.type === "npm" && cli.pkg) {
|
|
963
|
+
try { latest = _ef3("npm", ["view", cli.pkg, "version"], { timeout: 5000 }).toString().trim(); } catch {}
|
|
964
|
+
} else if (cli.type === "pip" && cli.pkg) {
|
|
965
|
+
try {
|
|
966
|
+
const out = _ef3("pip", ["index", "versions", cli.pkg], { timeout: 8000, encoding: "utf8" });
|
|
967
|
+
const m = out.match(/LATEST:\s*(\d+\.\d+\.\d+)/i) || out.match(/(\d+\.\d+\.\d+)/);
|
|
968
|
+
if (m) latest = m[1];
|
|
969
|
+
} catch {}
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
if (!latest || latest === ver) {
|
|
973
|
+
console.log(` ${cli.name} ${ver || ""} — up to date`);
|
|
974
|
+
continue;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
console.log(` ${cli.name} ${ver} → ${latest}`);
|
|
978
|
+
if (dryRun) { updated++; continue; }
|
|
979
|
+
|
|
980
|
+
try {
|
|
981
|
+
if (cli.type === "npm") {
|
|
982
|
+
log(`updating ${cli.name}...`);
|
|
983
|
+
execSync(`npm install -g ${cli.pkg}@latest`, { timeout: 60000, stdio: "pipe" });
|
|
984
|
+
log(`${cli.name} updated to ${latest}`);
|
|
985
|
+
updated++;
|
|
986
|
+
} else if (cli.type === "pip") {
|
|
987
|
+
log(`updating ${cli.name}...`);
|
|
988
|
+
execSync(`pip install --upgrade ${cli.pkg}`, { timeout: 60000, stdio: "pipe" });
|
|
989
|
+
log(`${cli.name} updated to ${latest}`);
|
|
990
|
+
updated++;
|
|
991
|
+
}
|
|
992
|
+
} catch (e) {
|
|
993
|
+
log(`failed to update ${cli.name}: ${e.message.split("\n")[0]}`);
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
if (updated) {
|
|
997
|
+
log(`${dryRun ? "would update" : "updated"} ${updated} CLI(s)`);
|
|
998
|
+
} else {
|
|
999
|
+
log("all CLIs are up to date");
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
|
|
891
1003
|
// --- Session reflection --- (dogfood feedback #36)
|
|
892
1004
|
function cmdReflect(target, args) {
|
|
893
1005
|
const ai = path.join(target, "ai");
|
|
@@ -1912,6 +2024,7 @@ async function main() {
|
|
|
1912
2024
|
case "doctor": cmdDoctor(target); break;
|
|
1913
2025
|
case "validate": cmdValidate(target); break;
|
|
1914
2026
|
case "reflect": cmdReflect(target, args); break;
|
|
2027
|
+
case "update": cmdUpdate(args); break;
|
|
1915
2028
|
case "metrics": cmdMetrics(target); break;
|
|
1916
2029
|
case "portfolio": cmdPortfolio(); break;
|
|
1917
2030
|
case "status": cmdStatus(target); break;
|
|
@@ -1960,7 +2073,8 @@ async function main() {
|
|
|
1960
2073
|
console.log(" sync Update ai/ layer (via API) [--dry-run] [--quiet]");
|
|
1961
2074
|
console.log(" detect Show detected stack");
|
|
1962
2075
|
console.log(" doctor Check health + credentials checklist");
|
|
1963
|
-
|
|
2076
|
+
console.log(" update Update all installed agent CLIs to latest [--dry-run]");
|
|
2077
|
+
console.log(" validate Validate ai/ layer completeness");
|
|
1964
2078
|
console.log(" reflect Session reflection: delivered, delegation rate, blockers");
|
|
1965
2079
|
console.log(" metrics Effectiveness score: adoption funnel, sessions, delegation");
|
|
1966
2080
|
console.log(" portfolio All tracked projects: score, sessions, agents, last activity");
|