@otto-code/cli 0.7.5 → 0.7.6
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/cli.js +22 -2
- package/dist/commands/agent/delete.js +1 -1
- package/dist/commands/agent/detach.d.ts +9 -0
- package/dist/commands/agent/detach.js +38 -0
- package/dist/commands/agent/index.js +9 -1
- package/dist/commands/agent/open.d.ts +11 -0
- package/dist/commands/agent/open.js +61 -0
- package/dist/commands/agent/run.d.ts +35 -0
- package/dist/commands/agent/run.js +142 -49
- package/dist/commands/agent/update.d.ts +33 -0
- package/dist/commands/agent/update.js +72 -25
- package/dist/commands/clone.d.ts +17 -0
- package/dist/commands/clone.js +65 -0
- package/dist/commands/daemon/local-daemon.d.ts +15 -1
- package/dist/commands/daemon/local-daemon.js +12 -5
- package/dist/commands/daemon/pair.js +6 -2
- package/dist/commands/heartbeat/index.d.ts +3 -0
- package/dist/commands/heartbeat/index.js +139 -0
- package/dist/commands/hub/cloud-device-authorization.d.ts +45 -0
- package/dist/commands/hub/cloud-device-authorization.js +92 -0
- package/dist/commands/hub/device-authorization.d.ts +37 -0
- package/dist/commands/hub/device-authorization.js +87 -0
- package/dist/commands/hub/index.d.ts +30 -0
- package/dist/commands/hub/index.js +85 -0
- package/dist/commands/hub-disabled.d.ts +22 -0
- package/dist/commands/hub-disabled.js +34 -0
- package/dist/commands/onboard.js +6 -2
- package/dist/commands/open.d.ts +2 -0
- package/dist/commands/open.js +22 -17
- package/dist/commands/schedule/create.d.ts +1 -0
- package/dist/commands/schedule/create.js +1 -0
- package/dist/commands/schedule/index.js +6 -6
- package/dist/commands/schedule/inspect.js +3 -0
- package/dist/commands/schedule/logs.js +2 -1
- package/dist/commands/schedule/ls.js +3 -1
- package/dist/commands/schedule/pause.js +2 -1
- package/dist/commands/schedule/resume.js +2 -1
- package/dist/commands/schedule/run-once.js +2 -1
- package/dist/commands/schedule/shared.d.ts +3 -0
- package/dist/commands/schedule/shared.js +35 -23
- package/dist/commands/schedule/update.js +2 -1
- package/dist/commands/script/index.d.ts +3 -0
- package/dist/commands/script/index.js +19 -0
- package/dist/commands/script/ls.d.ts +6 -0
- package/dist/commands/script/ls.js +20 -0
- package/dist/commands/script/schema.d.ts +5 -0
- package/dist/commands/script/schema.js +13 -0
- package/dist/commands/script/shared.d.ts +11 -0
- package/dist/commands/script/shared.js +59 -0
- package/dist/commands/script/start.d.ts +6 -0
- package/dist/commands/script/start.js +23 -0
- package/dist/commands/script/stop.d.ts +6 -0
- package/dist/commands/script/stop.js +23 -0
- package/dist/commands/workspace/archive.d.ts +12 -0
- package/dist/commands/workspace/archive.js +41 -0
- package/dist/commands/workspace/create.d.ts +49 -0
- package/dist/commands/workspace/create.js +114 -0
- package/dist/commands/workspace/index.d.ts +3 -0
- package/dist/commands/workspace/index.js +30 -0
- package/dist/commands/workspace/ls.d.ts +7 -0
- package/dist/commands/workspace/ls.js +28 -0
- package/dist/commands/workspace/shared.d.ts +12 -0
- package/dist/commands/workspace/shared.js +20 -0
- package/dist/output/pairing.d.ts +8 -0
- package/dist/output/pairing.js +24 -0
- package/dist/utils/client.d.ts +9 -0
- package/dist/utils/client.js +9 -0
- package/dist/utils/duration.d.ts +1 -1
- package/dist/utils/duration.js +8 -7
- package/package.json +9 -7
package/dist/utils/duration.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parse duration string to milliseconds.
|
|
3
|
-
* Supports formats like: 5m, 30s, 1h, 2h30m, 90, etc.
|
|
3
|
+
* Supports formats like: 5m, 30s, 1h, 2h30m, 1d, 90, etc.
|
|
4
4
|
* If no unit is specified, assumes seconds.
|
|
5
5
|
*/
|
|
6
6
|
export function parseDuration(input) {
|
|
@@ -9,13 +9,14 @@ export function parseDuration(input) {
|
|
|
9
9
|
if (/^\d+$/.test(trimmed)) {
|
|
10
10
|
return parseInt(trimmed, 10) * 1000;
|
|
11
11
|
}
|
|
12
|
+
if (!/^(?:\d+[smhd])+$/.test(trimmed)) {
|
|
13
|
+
throw new Error(`Invalid duration format: ${input}. Use formats like: 5m, 30s, 1h, 2h30m, 1d`);
|
|
14
|
+
}
|
|
12
15
|
// Parse duration with units
|
|
13
16
|
let totalMs = 0;
|
|
14
|
-
const regex = /(\d+)([
|
|
17
|
+
const regex = /(\d+)([smhd])/g;
|
|
15
18
|
let match;
|
|
16
|
-
let hasMatch = false;
|
|
17
19
|
while ((match = regex.exec(trimmed)) !== null) {
|
|
18
|
-
hasMatch = true;
|
|
19
20
|
const value = parseInt(match[1], 10);
|
|
20
21
|
const unit = match[2];
|
|
21
22
|
switch (unit) {
|
|
@@ -28,11 +29,11 @@ export function parseDuration(input) {
|
|
|
28
29
|
case "h":
|
|
29
30
|
totalMs += value * 60 * 60 * 1000;
|
|
30
31
|
break;
|
|
32
|
+
case "d":
|
|
33
|
+
totalMs += value * 24 * 60 * 60 * 1000;
|
|
34
|
+
break;
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
|
-
if (!hasMatch) {
|
|
34
|
-
throw new Error(`Invalid duration format: ${input}. Use formats like: 5m, 30s, 1h, 2h30m`);
|
|
35
|
-
}
|
|
36
37
|
return totalMs;
|
|
37
38
|
}
|
|
38
39
|
//# sourceMappingURL=duration.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otto-code/cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Otto CLI - control your AI coding agents from the command line",
|
|
5
5
|
"license": "AGPL-3.0-or-later",
|
|
6
6
|
"bin": {
|
|
@@ -21,23 +21,25 @@
|
|
|
21
21
|
"build:clean": "npm run clean && npm run build",
|
|
22
22
|
"prepack": "npm run build:clean",
|
|
23
23
|
"typecheck": "tsgo --noEmit",
|
|
24
|
-
"test": "npm run test:local",
|
|
24
|
+
"test": "npm run test:unit && npm run test:local",
|
|
25
|
+
"test:unit": "vitest run src",
|
|
25
26
|
"test:local": "tsx tests/run-all.ts",
|
|
26
27
|
"test:e2e": "npm run test:local",
|
|
27
28
|
"test:e2e:lifecycle": "npx tsx tests/e2e/agent-lifecycle.test.ts"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"@clack/prompts": "^1.0.0",
|
|
31
|
-
"@otto-code/brain": "0.7.
|
|
32
|
-
"@otto-code/client": "0.7.
|
|
33
|
-
"@otto-code/protocol": "0.7.
|
|
34
|
-
"@otto-code/server": "0.7.
|
|
32
|
+
"@otto-code/brain": "0.7.6",
|
|
33
|
+
"@otto-code/client": "0.7.6",
|
|
34
|
+
"@otto-code/protocol": "0.7.6",
|
|
35
|
+
"@otto-code/server": "0.7.6",
|
|
35
36
|
"chalk": "^5.3.0",
|
|
36
37
|
"commander": "^12.0.0",
|
|
37
38
|
"mime-types": "^2.1.35",
|
|
38
39
|
"tree-kill": "^1.2.2",
|
|
39
40
|
"ws": "^8.21.0",
|
|
40
|
-
"yaml": "^2.8.4"
|
|
41
|
+
"yaml": "^2.8.4",
|
|
42
|
+
"zod": "^4.4.3"
|
|
41
43
|
},
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@types/mime-types": "^3.0.1",
|