@phreshos/cli 0.1.71 → 0.1.73
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,7 +1,7 @@
|
|
|
1
1
|
import { parseExecuteRequest } from "@phreshos/core";
|
|
2
2
|
import { defineCommand } from "../contract/command.js";
|
|
3
3
|
import { value } from "../contract/schema.js";
|
|
4
|
-
import { clientOverrideOptions, endpointOptions, option, serverOverrideOptions, timeoutOption, withJson } from "./options.js";
|
|
4
|
+
import { clientOverrideOptions, endpointOptions, processOptions, option, serverOverrideOptions, timeoutOption, withJson } from "./options.js";
|
|
5
5
|
import { dataOutput, endpointActionPresentation, endpointOutput, endpointPresentation, eventOutput, eventPresentation, lifecyclePresentation, valuePresentation } from "./schemas.js";
|
|
6
6
|
import { connected } from "./connection.js";
|
|
7
7
|
import { bounded, clientLaunch, payload, serverLaunch } from "./input.js";
|
|
@@ -115,6 +115,38 @@ export default function endpointCommands(root, connect) {
|
|
|
115
115
|
event: options.event,
|
|
116
116
|
...(options.timeout === undefined ? {} : { timeout: timeout(options.timeout) })
|
|
117
117
|
}));
|
|
118
|
+
const memory = defineCommand(endpoints, {
|
|
119
|
+
name: "memory",
|
|
120
|
+
description: "read and change one running Client's memory"
|
|
121
|
+
});
|
|
122
|
+
defineCommand(memory, {
|
|
123
|
+
name: "get",
|
|
124
|
+
description: executeDescription("endpoint", "memoryGet"),
|
|
125
|
+
requiresSystem: true,
|
|
126
|
+
options: withJson(...processOptions, option("--key <key>", "Memory key", { mandatory: true })),
|
|
127
|
+
output: dataOutput(value.any("JSON value or null"), "The Client memory value", valuePresentation)
|
|
128
|
+
}, ({ options }) => executeMemory(connect, options, "memoryGet", { key: options.key }));
|
|
129
|
+
defineCommand(memory, {
|
|
130
|
+
name: "set",
|
|
131
|
+
description: executeDescription("endpoint", "memorySet"),
|
|
132
|
+
requiresSystem: true,
|
|
133
|
+
options: withJson(...processOptions, option("--key <key>", "Memory key", { mandatory: true }), option("--value <json>", "JSON value", { mandatory: true })),
|
|
134
|
+
output: dataOutput(value.any("Stored JSON value"), "The stored value", valuePresentation)
|
|
135
|
+
}, ({ options }) => executeMemory(connect, options, "memorySet", { key: options.key, value: payload(options.value) }));
|
|
136
|
+
defineCommand(memory, {
|
|
137
|
+
name: "delete",
|
|
138
|
+
description: executeDescription("endpoint", "memoryDelete"),
|
|
139
|
+
requiresSystem: true,
|
|
140
|
+
options: withJson(...processOptions, option("--key <key>", "Memory key", { mandatory: true })),
|
|
141
|
+
output: dataOutput(value.boolean("Whether the key existed"), "Deletion result", valuePresentation)
|
|
142
|
+
}, ({ options }) => executeMemory(connect, options, "memoryDelete", { key: options.key }));
|
|
143
|
+
defineCommand(memory, {
|
|
144
|
+
name: "entries",
|
|
145
|
+
description: executeDescription("endpoint", "memoryEntries"),
|
|
146
|
+
requiresSystem: true,
|
|
147
|
+
options: withJson(...processOptions),
|
|
148
|
+
output: dataOutput(value.any("Key-value entries"), "The Client memory entries", valuePresentation)
|
|
149
|
+
}, ({ options }) => executeMemory(connect, options, "memoryEntries"));
|
|
118
150
|
}
|
|
119
151
|
async function executeEndpoint(connect, options, operation) {
|
|
120
152
|
const request = parseExecuteRequest({
|
|
@@ -129,3 +161,7 @@ async function executeEndpoint(connect, options, operation) {
|
|
|
129
161
|
function timeout(value) {
|
|
130
162
|
return value === undefined ? undefined : bounded(value, "--timeout", 1);
|
|
131
163
|
}
|
|
164
|
+
async function executeMemory(connect, options, operation, fields = {}) {
|
|
165
|
+
const request = parseExecuteRequest({ $domain: "endpoint", $operation: operation, process: options.process, ...(options.program ? { program: options.program } : {}), ...fields });
|
|
166
|
+
return connected(connect, system => system.execute(request));
|
|
167
|
+
}
|
|
@@ -35,6 +35,10 @@ export const executeCommandPaths = Object.freeze({
|
|
|
35
35
|
"endpoint.publish": ["endpoint", "publish"],
|
|
36
36
|
"endpoint.wait": ["endpoint", "wait"],
|
|
37
37
|
"endpoint.waitLifecycle": ["endpoint", "waitLifecycle"],
|
|
38
|
+
"endpoint.memoryGet": ["endpoint", "memory", "get"],
|
|
39
|
+
"endpoint.memorySet": ["endpoint", "memory", "set"],
|
|
40
|
+
"endpoint.memoryDelete": ["endpoint", "memory", "delete"],
|
|
41
|
+
"endpoint.memoryEntries": ["endpoint", "memory", "entries"],
|
|
38
42
|
"service.list": ["service", "list"],
|
|
39
43
|
"service.search": ["service", "search"],
|
|
40
44
|
"service.inspect": ["service", "inspect"],
|
package/dist/system/lifecycle.js
CHANGED
|
@@ -169,10 +169,14 @@ export default class SystemLifecycle {
|
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
await service.register(definition(installation, await nodeExecutable()));
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
// A background container service has no automatic-startup capability.
|
|
173
|
+
// Restoring its running state must not invoke an unsupported setting.
|
|
174
|
+
if (state.automaticStartup) {
|
|
175
|
+
if (state.enabled)
|
|
176
|
+
await service.enable();
|
|
177
|
+
else
|
|
178
|
+
await service.disable();
|
|
179
|
+
}
|
|
176
180
|
if (state.running) {
|
|
177
181
|
await this.launchService();
|
|
178
182
|
await this.waitUntilReady();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.73",
|
|
5
5
|
"description": "The Phresh command-line interface for Program projects and system management.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.10"
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"packageManager": "bun@1.3.14",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@clack/prompts": "^1.7.0",
|
|
50
|
-
"@phreshos/core": "^0.1.
|
|
51
|
-
"@phreshos/node": "^0.1.
|
|
50
|
+
"@phreshos/core": "^0.1.62",
|
|
51
|
+
"@phreshos/node": "^0.1.34",
|
|
52
52
|
"adm-zip": "^0.6.0",
|
|
53
53
|
"commander": "^15.0.0",
|
|
54
54
|
"picocolors": "^1.1.1"
|