@matterailab/orbcode 0.1.5 → 0.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/dist/index.js +11 -4
- package/dist/utils/updateCheck.js +22 -3
- package/package.json +5 -2
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ Usage:
|
|
|
14
14
|
orbcode "<prompt>" start an interactive session with an initial prompt
|
|
15
15
|
orbcode login sign in to MatterAI
|
|
16
16
|
orbcode update install the latest version from npm
|
|
17
|
+
orbcode update --force force a global install even if this CLI doesn't look global
|
|
17
18
|
orbcode -p "<prompt>" run a single prompt non-interactively (prints only the final response)
|
|
18
19
|
orbcode -p "…" --yolo non-interactive with auto-approved edits/commands
|
|
19
20
|
orbcode --model <id> use a specific model for this run
|
|
@@ -22,7 +23,7 @@ Usage:
|
|
|
22
23
|
orbcode --help show this help
|
|
23
24
|
`);
|
|
24
25
|
}
|
|
25
|
-
async function runUpdate() {
|
|
26
|
+
async function runUpdate(force) {
|
|
26
27
|
const latest = await fetchLatestNpmVersion(PACKAGE_NAME);
|
|
27
28
|
if (latest === null) {
|
|
28
29
|
console.error("Could not reach the npm registry. Check your network connection and try again.");
|
|
@@ -34,13 +35,18 @@ async function runUpdate() {
|
|
|
34
35
|
}
|
|
35
36
|
console.log(`Updating ${PRODUCT_NAME} v${VERSION} → v${latest}…`);
|
|
36
37
|
const global = isGlobalInstall();
|
|
37
|
-
if (!global) {
|
|
38
|
+
if (!global && !force) {
|
|
38
39
|
const root = await getGlobalInstallRoot();
|
|
39
|
-
console.error(`This CLI was not installed globally (
|
|
40
|
+
console.error(`This CLI was not installed globally (entrypoint = ${process.argv[1] || import.meta.url || "<unknown>"}).\n` +
|
|
40
41
|
`To update a local/dev install, run \`npm install -g ${PACKAGE_NAME}@latest\` manually, or \`npm install\` inside the source checkout.` +
|
|
41
42
|
(root ? `\nGlobal install root detected at: ${root}` : ""));
|
|
42
43
|
return 1;
|
|
43
44
|
}
|
|
45
|
+
if (!global && force) {
|
|
46
|
+
const root = await getGlobalInstallRoot();
|
|
47
|
+
console.warn(`Warning: forcing global install even though this CLI doesn't look like a global install.` +
|
|
48
|
+
(root ? ` Detected global root: ${root}.` : ""));
|
|
49
|
+
}
|
|
44
50
|
clearUpdateCache();
|
|
45
51
|
const code = await runNpmUpdate(PACKAGE_NAME);
|
|
46
52
|
if (code === 0) {
|
|
@@ -72,7 +78,8 @@ async function main() {
|
|
|
72
78
|
return;
|
|
73
79
|
}
|
|
74
80
|
if (args[0] === "update") {
|
|
75
|
-
const
|
|
81
|
+
const force = args.includes("--force") || args.includes("-f");
|
|
82
|
+
const code = await runUpdate(force);
|
|
76
83
|
process.exit(code);
|
|
77
84
|
}
|
|
78
85
|
const model = takeFlagValue(args, "model") ?? takeFlagValue(args, "m");
|
|
@@ -142,11 +142,30 @@ export function runNpmUpdate(pkg) {
|
|
|
142
142
|
* update command can surface a friendlier message for local/dev installs.
|
|
143
143
|
*/
|
|
144
144
|
export function isGlobalInstall() {
|
|
145
|
-
//
|
|
146
|
-
//
|
|
147
|
-
|
|
145
|
+
// argv[1] is whatever the shell handed to node, which is the *symlink* path
|
|
146
|
+
// (`<prefix>/bin/orbcode`) for a global npm install — not the real file. We
|
|
147
|
+
// have to resolve symlinks; otherwise the `node_modules/@matterailab/...`
|
|
148
|
+
// substring never appears and a perfectly valid global install looks local.
|
|
149
|
+
const here = resolveEntrypoint();
|
|
148
150
|
return /node_modules[\\/]@matterailab[\\/]orbcode/.test(here);
|
|
149
151
|
}
|
|
152
|
+
function resolveEntrypoint() {
|
|
153
|
+
const argvPath = process.argv[1];
|
|
154
|
+
if (argvPath) {
|
|
155
|
+
try {
|
|
156
|
+
return fs.realpathSync(argvPath);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
// fall through to import.meta.url
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// import.meta.url is the real file:// URL of the running module, which
|
|
163
|
+
// already points inside node_modules for a global install.
|
|
164
|
+
if (typeof import.meta.url === "string" && import.meta.url) {
|
|
165
|
+
return import.meta.url;
|
|
166
|
+
}
|
|
167
|
+
return "";
|
|
168
|
+
}
|
|
150
169
|
/** Best-effort: run `npm root -g` so we can show the install location. */
|
|
151
170
|
export async function getGlobalInstallRoot() {
|
|
152
171
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterailab/orbcode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "OrbCode CLI — agentic coding in your terminal, powered by Axon models by MatterAI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,5 +58,8 @@
|
|
|
58
58
|
"ai",
|
|
59
59
|
"coding-agent"
|
|
60
60
|
],
|
|
61
|
-
"license": "MIT"
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"overrides": {
|
|
63
|
+
"formdata-node": "^6.0.3"
|
|
64
|
+
}
|
|
62
65
|
}
|