@procedures/server 0.9.0 → 0.9.2
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 +25 -0
- package/README.md +3 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/procedures/server.start.d.ts +2 -1
- package/dist/procedures/server.start.d.ts.map +1 -1
- package/dist/procedures/server.start.js +8 -0
- package/dist/procedures/server.start.js.map +1 -1
- package/dist/procedures/server.status.d.ts +2 -1
- package/dist/procedures/server.status.d.ts.map +1 -1
- package/dist/procedures/server.status.js +8 -0
- package/dist/procedures/server.status.js.map +1 -1
- package/dist/procedures/server.stop.d.ts +2 -1
- package/dist/procedures/server.stop.d.ts.map +1 -1
- package/dist/procedures/server.stop.js +8 -0
- package/dist/procedures/server.stop.js.map +1 -1
- package/package.json +4 -4
- package/src/procedures/server.start.ts +11 -2
- package/src/procedures/server.status.ts +11 -2
- package/src/procedures/server.stop.ts +11 -2
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* The procedure came from `@procedures/peer`: it belongs to the host. The lockfiles stay in the
|
|
6
6
|
* peer package, because the peer of `mark --server` writes them.
|
|
7
7
|
*/
|
|
8
|
-
import { type Effects, type Procedure } from "@procedures/client";
|
|
8
|
+
import { type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
9
9
|
import type { ServerStartInput, ServerStartOutput } from "../types.js";
|
|
10
10
|
export declare const serverStartProcedure: Procedure<ServerStartInput, ServerStartOutput, {
|
|
11
11
|
description: string;
|
|
12
12
|
effects: Effects;
|
|
13
13
|
args: string[];
|
|
14
14
|
shorts: Record<string, string>;
|
|
15
|
+
fsRoot: FsRootRules;
|
|
15
16
|
}>;
|
|
16
17
|
export type { ServerStartInput, ServerStartOutput };
|
|
17
18
|
//# sourceMappingURL=server.start.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.start.d.ts","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.start.d.ts","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGjH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAiFvE,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAC1C,gBAAgB,EAChB,iBAAiB,EACjB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,EAAE,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAwHtG,CAAC;AAEX,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -76,6 +76,13 @@ function findCliPath() {
|
|
|
76
76
|
// Fallback: try mark in PATH (will fail if not installed globally)
|
|
77
77
|
return "mark";
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It starts
|
|
81
|
+
* a mark server without the root, and it writes the log and the lock files in `~/.mark`.
|
|
82
|
+
*/
|
|
83
|
+
const START_UNDER_A_ROOT = {
|
|
84
|
+
refuse: "it starts a mark server process without the root, and it writes the log and the lock files in the home folder (~/.mark)",
|
|
85
|
+
};
|
|
79
86
|
export const serverStartProcedure = createProcedure()
|
|
80
87
|
.path(["server", "start"])
|
|
81
88
|
.input(serverStartInputSchema)
|
|
@@ -85,6 +92,7 @@ export const serverStartProcedure = createProcedure()
|
|
|
85
92
|
// The daemon loads the procedure packages of the workspace. The procedure moves server.log
|
|
86
93
|
// over server.log.1.
|
|
87
94
|
effects: { reads: ["fs", "server"], writes: ["fs", "network", "process", "server"] },
|
|
95
|
+
fsRoot: START_UNDER_A_ROOT,
|
|
88
96
|
args: [],
|
|
89
97
|
shorts: { port: "p", host: "h" },
|
|
90
98
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.start.js","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"server.start.js","sourceRoot":"","sources":["../../src/procedures/server.start.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAkD,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAGhF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAClD,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,C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QAED,qBAAqB;QACrB,MAAM,QAAQ,GAAG,mBAAmB,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,QAAQ,IAAI,CAAC,MAAM,WAAW,CAAC,QAAQ,CAAC,CAAC,KAAK,OAAO,EAAE,CAAC;YAC1D,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,GAAG,EAAE,QAAQ,CAAC,GAAG;gBACjB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;gBAC3B,OAAO,EAAE,QAAQ;gBACjB,OAAO,EAAE,uBAAuB,QAAQ,CAAC,GAAG,GAAG;aAChD,CAAC;QACJ,CAAC;IACH,CAAC;IAED,+DAA+D;IAC/D,IAAI,KAAK,CAAC,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,IAAI;YACJ,QAAQ,EAAE,UAAU,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,MAAM;YACzE,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE,wBAAwB,KAAK,CAAC,GAAG,qBAAqB;SAChE,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,iCAAiC,QAAQ,eAAe;KAClE,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
6
|
*/
|
|
7
|
-
import { type Effects, type Procedure } from "@procedures/client";
|
|
7
|
+
import { type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
8
8
|
import type { ServerStatusInput, ServerStatusOutput } from "../types.js";
|
|
9
9
|
export declare const serverStatusProcedure: Procedure<ServerStatusInput, ServerStatusOutput, {
|
|
10
10
|
description: string;
|
|
11
11
|
effects: Effects;
|
|
12
12
|
output: string;
|
|
13
|
+
fsRoot: FsRootRules;
|
|
13
14
|
}>;
|
|
14
15
|
export type { ServerStatusInput, ServerStatusOutput };
|
|
15
16
|
//# sourceMappingURL=server.status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.status.d.ts","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.status.d.ts","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGjH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AA6CzE,eAAO,MAAM,qBAAqB,EAAE,SAAS,CAC3C,iBAAiB,EACjB,kBAAkB,EAClB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAuFtE,CAAC;AAEX,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -36,6 +36,13 @@ function formatUptime(startedAt) {
|
|
|
36
36
|
const hours = Math.floor((diff % 86400) / 3600);
|
|
37
37
|
return `${days}d ${hours}h`;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It reads
|
|
41
|
+
* the lock files in `~/.mark`, which hold the tokens of the servers, and it deletes the old ones.
|
|
42
|
+
*/
|
|
43
|
+
const STATUS_UNDER_A_ROOT = {
|
|
44
|
+
refuse: "it reads the lock files in the home folder (~/.mark), which hold the tokens of the servers, and it deletes the old ones",
|
|
45
|
+
};
|
|
39
46
|
export const serverStatusProcedure = createProcedure()
|
|
40
47
|
.path(["server", "status"])
|
|
41
48
|
.input(serverStatusInputSchema)
|
|
@@ -44,6 +51,7 @@ export const serverStatusProcedure = createProcedure()
|
|
|
44
51
|
description: "Get CLI server status",
|
|
45
52
|
// It deletes the lockfile of a server that does not answer
|
|
46
53
|
effects: { reads: ["fs", "server"], writes: ["fs"], idempotent: true },
|
|
54
|
+
fsRoot: STATUS_UNDER_A_ROOT,
|
|
47
55
|
args: [],
|
|
48
56
|
shorts: { port: "p" },
|
|
49
57
|
output: "text",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.status.js","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"server.status.js","sourceRoot":"","sources":["../../src/procedures/server.status.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAkD,MAAM,oBAAoB,CAAC;AACjH,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,qBAAqB,EAAqB,MAAM,2BAA2B,CAAC;AACzI,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAGlF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AAClD,MAAM,QAAQ,GAAG,IAAI,CA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AAC,UAAU,EAAE,CAAC;QAChB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,iDAAiD;SAC3D,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,GAAG,KAAK,CAAC,MAAM,wBAAwB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;KACnE,CAAC;AACJ,CAAC,CAAC;KACD,KAAK,EAAE,CAAC"}
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*
|
|
5
5
|
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
6
|
*/
|
|
7
|
-
import { type Effects, type Procedure } from "@procedures/client";
|
|
7
|
+
import { type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
8
8
|
import type { ServerStopInput, ServerStopOutput } from "../types.js";
|
|
9
9
|
export declare const serverStopProcedure: Procedure<ServerStopInput, ServerStopOutput, {
|
|
10
10
|
description: string;
|
|
11
11
|
effects: Effects;
|
|
12
|
+
fsRoot: FsRootRules;
|
|
12
13
|
}>;
|
|
13
14
|
export type { ServerStopInput, ServerStopOutput };
|
|
14
15
|
//# sourceMappingURL=server.stop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.stop.d.ts","sourceRoot":"","sources":["../../src/procedures/server.stop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.stop.d.ts","sourceRoot":"","sources":["../../src/procedures/server.stop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA+B,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGjH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA6BrE,eAAO,MAAM,mBAAmB,EAAE,SAAS,CACzC,eAAe,EACf,gBAAgB,EAChB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAuFtD,CAAC;AAEX,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -20,6 +20,13 @@ function killProcess(pid, signal = "SIGTERM") {
|
|
|
20
20
|
return false;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It reads
|
|
25
|
+
* and deletes the lock files in `~/.mark`, and it stops the server processes of the host.
|
|
26
|
+
*/
|
|
27
|
+
const STOP_UNDER_A_ROOT = {
|
|
28
|
+
refuse: "it reads and deletes the lock files in the home folder (~/.mark), and it stops the server processes of the host",
|
|
29
|
+
};
|
|
23
30
|
export const serverStopProcedure = createProcedure()
|
|
24
31
|
.path(["server", "stop"])
|
|
25
32
|
.input(serverStopInputSchema)
|
|
@@ -28,6 +35,7 @@ export const serverStopProcedure = createProcedure()
|
|
|
28
35
|
description: "Stop running CLI server",
|
|
29
36
|
// It stops the servers of the lockfiles and deletes their lockfiles
|
|
30
37
|
effects: { reads: ["fs", "server"], writes: ["fs", "server"], idempotent: true },
|
|
38
|
+
fsRoot: STOP_UNDER_A_ROOT,
|
|
31
39
|
args: [],
|
|
32
40
|
shorts: { port: "p" },
|
|
33
41
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.stop.js","sourceRoot":"","sources":["../../src/procedures/server.stop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"server.stop.js","sourceRoot":"","sources":["../../src/procedures/server.stop.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,UAAU,EAAkD,MAAM,oBAAoB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
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.2",
|
|
5
5
|
"description": "A standalone procedure server: load procedure packages and serve them over HTTP and WebSocket with a token and an expose list. Its procedures server.start, server.stop and server.status manage the background server of the mark CLI.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"server",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"provenance": true
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@procedures/client": "0.9.
|
|
64
|
-
"@procedures/peer": "0.9.
|
|
63
|
+
"@procedures/client": "0.9.2",
|
|
64
|
+
"@procedures/peer": "0.9.2",
|
|
65
65
|
"zod": "^4.6.5"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@mark1russell7/cue": "^1.0.0",
|
|
69
|
-
"@procedures/fs": "0.9.
|
|
69
|
+
"@procedures/fs": "0.9.2",
|
|
70
70
|
"@types/node": "^22.0.0",
|
|
71
71
|
"typescript": "^7.0.2",
|
|
72
72
|
"vitest": "^5.0.3"
|
|
@@ -10,7 +10,7 @@ import { spawn } from "node:child_process";
|
|
|
10
10
|
import * as fs from "node:fs";
|
|
11
11
|
import * as path from "node:path";
|
|
12
12
|
import * as os from "node:os";
|
|
13
|
-
import { createProcedure, zodAdapter, type Effects, type Procedure } from "@procedures/client";
|
|
13
|
+
import { createProcedure, zodAdapter, type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
14
14
|
import { checkServer, readLockfileForPort } from "@procedures/peer/lockfile";
|
|
15
15
|
import { ServerStartOutputSchema, serverStartInputSchema } from "../schemas.js";
|
|
16
16
|
import type { ServerStartInput, ServerStartOutput } from "../types.js";
|
|
@@ -86,10 +86,18 @@ function findCliPath(): string {
|
|
|
86
86
|
return "mark";
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
+
/**
|
|
90
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It starts
|
|
91
|
+
* a mark server without the root, and it writes the log and the lock files in `~/.mark`.
|
|
92
|
+
*/
|
|
93
|
+
const START_UNDER_A_ROOT: FsRootRules = {
|
|
94
|
+
refuse: "it starts a mark server process without the root, and it writes the log and the lock files in the home folder (~/.mark)",
|
|
95
|
+
};
|
|
96
|
+
|
|
89
97
|
export const serverStartProcedure: Procedure<
|
|
90
98
|
ServerStartInput,
|
|
91
99
|
ServerStartOutput,
|
|
92
|
-
{ description: string; effects: Effects; args: string[]; shorts: Record<string, string
|
|
100
|
+
{ description: string; effects: Effects; args: string[]; shorts: Record<string, string>; fsRoot: FsRootRules }
|
|
93
101
|
> = createProcedure()
|
|
94
102
|
.path(["server", "start"])
|
|
95
103
|
.input(serverStartInputSchema)
|
|
@@ -99,6 +107,7 @@ export const serverStartProcedure: Procedure<
|
|
|
99
107
|
// The daemon loads the procedure packages of the workspace. The procedure moves server.log
|
|
100
108
|
// over server.log.1.
|
|
101
109
|
effects: { reads: ["fs", "server"], writes: ["fs", "network", "process", "server"] },
|
|
110
|
+
fsRoot: START_UNDER_A_ROOT,
|
|
102
111
|
args: [],
|
|
103
112
|
shorts: { port: "p", host: "h" },
|
|
104
113
|
})
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as path from "node:path";
|
|
9
9
|
import * as os from "node:os";
|
|
10
|
-
import { createProcedure, zodAdapter, type Effects, type Procedure } from "@procedures/client";
|
|
10
|
+
import { createProcedure, zodAdapter, type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
11
11
|
import { checkServer, readAllLockfiles, readLockfileForPort, removeLockfileForPort, type LockfileData } from "@procedures/peer/lockfile";
|
|
12
12
|
import { ServerStatusOutputSchema, serverStatusInputSchema } from "../schemas.js";
|
|
13
13
|
import type { ServerStatusInput, ServerStatusOutput } from "../types.js";
|
|
@@ -47,10 +47,18 @@ function formatUptime(startedAt: string): string {
|
|
|
47
47
|
return `${days}d ${hours}h`;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It reads
|
|
52
|
+
* the lock files in `~/.mark`, which hold the tokens of the servers, and it deletes the old ones.
|
|
53
|
+
*/
|
|
54
|
+
const STATUS_UNDER_A_ROOT: FsRootRules = {
|
|
55
|
+
refuse: "it reads the lock files in the home folder (~/.mark), which hold the tokens of the servers, and it deletes the old ones",
|
|
56
|
+
};
|
|
57
|
+
|
|
50
58
|
export const serverStatusProcedure: Procedure<
|
|
51
59
|
ServerStatusInput,
|
|
52
60
|
ServerStatusOutput,
|
|
53
|
-
{ description: string; effects: Effects; output: string }
|
|
61
|
+
{ description: string; effects: Effects; output: string; fsRoot: FsRootRules }
|
|
54
62
|
> = createProcedure()
|
|
55
63
|
.path(["server", "status"])
|
|
56
64
|
.input(serverStatusInputSchema)
|
|
@@ -59,6 +67,7 @@ export const serverStatusProcedure: Procedure<
|
|
|
59
67
|
description: "Get CLI server status",
|
|
60
68
|
// It deletes the lockfile of a server that does not answer
|
|
61
69
|
effects: { reads: ["fs", "server"], writes: ["fs"], idempotent: true },
|
|
70
|
+
fsRoot: STATUS_UNDER_A_ROOT,
|
|
62
71
|
args: [],
|
|
63
72
|
shorts: { port: "p" },
|
|
64
73
|
output: "text",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* The procedure came from `@procedures/peer`: it belongs to the host.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { createProcedure, zodAdapter, type Effects, type Procedure } from "@procedures/client";
|
|
8
|
+
import { createProcedure, zodAdapter, type Effects, type FsRootRules, type Procedure } from "@procedures/client";
|
|
9
9
|
import { checkServer, readAllLockfiles, readLockfileForPort, removeLockfileForPort, type LockfileData } from "@procedures/peer/lockfile";
|
|
10
10
|
import { ServerStopOutputSchema, serverStopInputSchema } from "../schemas.js";
|
|
11
11
|
import type { ServerStopInput, ServerStopOutput } from "../types.js";
|
|
@@ -29,10 +29,18 @@ function killProcess(pid: number, signal: NodeJS.Signals = "SIGTERM"): boolean {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/**
|
|
33
|
+
* The rule under a root of the files (roadmap R33, tracker item O36): a root refuses it. It reads
|
|
34
|
+
* and deletes the lock files in `~/.mark`, and it stops the server processes of the host.
|
|
35
|
+
*/
|
|
36
|
+
const STOP_UNDER_A_ROOT: FsRootRules = {
|
|
37
|
+
refuse: "it reads and deletes the lock files in the home folder (~/.mark), and it stops the server processes of the host",
|
|
38
|
+
};
|
|
39
|
+
|
|
32
40
|
export const serverStopProcedure: Procedure<
|
|
33
41
|
ServerStopInput,
|
|
34
42
|
ServerStopOutput,
|
|
35
|
-
{ description: string; effects: Effects }
|
|
43
|
+
{ description: string; effects: Effects; fsRoot: FsRootRules }
|
|
36
44
|
> = createProcedure()
|
|
37
45
|
.path(["server", "stop"])
|
|
38
46
|
.input(serverStopInputSchema)
|
|
@@ -41,6 +49,7 @@ export const serverStopProcedure: Procedure<
|
|
|
41
49
|
description: "Stop running CLI server",
|
|
42
50
|
// It stops the servers of the lockfiles and deletes their lockfiles
|
|
43
51
|
effects: { reads: ["fs", "server"], writes: ["fs", "server"], idempotent: true },
|
|
52
|
+
fsRoot: STOP_UNDER_A_ROOT,
|
|
44
53
|
args: [],
|
|
45
54
|
shorts: { port: "p" },
|
|
46
55
|
})
|