@phreshos/cli 0.1.10 → 0.1.12
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/README.md +4 -15
- package/dist/build-template.js +2 -2
- package/dist/cli.js +0 -2
- package/dist/derive.js +0 -5
- package/dist/init.js +0 -11
- package/dist/pack.js +0 -6
- package/dist/program-release.js +4 -1
- package/dist/project.js +0 -2
- package/dist/template/package.json +2 -2
- package/dist/template/phresh.config.ts +1 -1
- package/dist/template.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -151,8 +151,6 @@ export default defineConfig({
|
|
|
151
151
|
|
|
152
152
|
description: "A file manager",
|
|
153
153
|
|
|
154
|
-
apiDocs: "api.md",
|
|
155
|
-
|
|
156
154
|
icon: "icon.png",
|
|
157
155
|
|
|
158
156
|
buildCommand: "bun run build",
|
|
@@ -397,20 +395,11 @@ are the canonical locations the package just created. An explicit
|
|
|
397
395
|
`start: false` crosses with its half; an omitted value remains omitted
|
|
398
396
|
and means `true`. At least one declared half must resolve to true.
|
|
399
397
|
|
|
400
|
-
When `apiDocs` is declared, its Markdown file is copied to `api-docs.md` and
|
|
401
|
-
the packaged description names that canonical entry point. A missing declared
|
|
402
|
-
file is an error, not an undocumented Program.
|
|
403
|
-
|
|
404
|
-
The document covers only what the Program owns: its capabilities, operation
|
|
405
|
-
and event names, payloads, behavior, state, and Program-defined failures. It
|
|
406
|
-
does not explain how to find a Program, obtain an Endpoint, publish or ask, or
|
|
407
|
-
register a subscription. Those are system contracts documented once by the
|
|
408
|
-
SDKs; `api-docs.md` supplies only the Program-specific meaning carried through
|
|
409
|
-
them.
|
|
410
|
-
|
|
411
398
|
There is **no wrapping directory**: `program.json`, `server/`, `client/`,
|
|
412
|
-
optional `icon.png
|
|
413
|
-
directory it installs into from your program's `identity`.
|
|
399
|
+
and optional `icon.png` sit at the package's root, and the system names the
|
|
400
|
+
directory it installs into from your program's `identity`. Service API
|
|
401
|
+
documentation belongs to the live service that exposes it and is therefore
|
|
402
|
+
not part of the Program package.
|
|
414
403
|
|
|
415
404
|
Nothing about the system moves because this exists. `program.json` is
|
|
416
405
|
still the only thing the system reads, and a package assembled by hand
|
package/dist/build-template.js
CHANGED
|
@@ -6,8 +6,8 @@ import AdmZip from "adm-zip";
|
|
|
6
6
|
import { readConfig } from "./project.js";
|
|
7
7
|
const repository = "PhreshOS/phresh-program";
|
|
8
8
|
const release = {
|
|
9
|
-
version: "0.1.
|
|
10
|
-
sha256: "
|
|
9
|
+
version: "0.1.2",
|
|
10
|
+
sha256: "dba5f1fd868c46501d5bd3463f4f8f0e098c7a231cb75794c01118689dc69339"
|
|
11
11
|
};
|
|
12
12
|
const archiveUrl = `https://github.com/${repository}/archive/refs/tags/v${release.version}.zip`;
|
|
13
13
|
const output = resolve(import.meta.dirname, "template");
|
package/dist/cli.js
CHANGED
|
@@ -46,7 +46,6 @@ describe(program.command("create")
|
|
|
46
46
|
describe(program.command("init")
|
|
47
47
|
.description("initialize an existing Program project")
|
|
48
48
|
.option("--name <name>", "human-readable Program name")
|
|
49
|
-
.option("--api-docs <path>", "official Program API documentation")
|
|
50
49
|
.option("--build-command <command>", "prepare production files before use")
|
|
51
50
|
.option("--server", "include a Server endpoint")
|
|
52
51
|
.option("--server-location <path>", "production Server directory")
|
|
@@ -60,7 +59,6 @@ describe(program.command("init")
|
|
|
60
59
|
.action(async function (options) {
|
|
61
60
|
await init({
|
|
62
61
|
name: options.name,
|
|
63
|
-
apiDocs: options.apiDocs,
|
|
64
62
|
buildCommand: options.buildCommand,
|
|
65
63
|
server: options.server === true || options.serverLocation !== undefined || options.serverStartCommand !== undefined,
|
|
66
64
|
serverLocation: options.serverLocation,
|
package/dist/derive.js
CHANGED
|
@@ -27,11 +27,6 @@ export default function derive(config, directory, which) {
|
|
|
27
27
|
name: config.name,
|
|
28
28
|
version: config.version,
|
|
29
29
|
description: config.description,
|
|
30
|
-
// Like the icon, the document stays where the author put it for an
|
|
31
|
-
// attached run. Installation and packaging give it its canonical
|
|
32
|
-
// name; the runtime receives an absolute source path here because a
|
|
33
|
-
// derived description has no file beside which to resolve it.
|
|
34
|
-
apiDocs: config.apiDocs && resolve(directory, config.apiDocs),
|
|
35
30
|
// Where it already is. Unlike pack, which gives it its canonical
|
|
36
31
|
// name, this points into the authoring tree and leaves it alone.
|
|
37
32
|
icon: config.icon && resolve(directory, config.icon),
|
package/dist/init.js
CHANGED
|
@@ -47,15 +47,6 @@ export default async function init(options = {}, directory = process.cwd(), core
|
|
|
47
47
|
const name = options.name ?? (interactive ? await ask("This name is shown to people; the package name remains the Program identity.", "What name should people see?", manifest.name) : undefined);
|
|
48
48
|
if (name !== undefined && name.trim().length === 0)
|
|
49
49
|
throw new Error("--name must not be empty");
|
|
50
|
-
let apiDocs = options.apiDocs;
|
|
51
|
-
if (interactive && apiDocs === undefined) {
|
|
52
|
-
const suggested = ["api-docs.md", "README.md"].find(file => existsSync(resolve(directory, file)));
|
|
53
|
-
if (await yes("API documentation explains only the services this Program itself provides.", "Does this Program provide API documentation?", false)) {
|
|
54
|
-
apiDocs = await ask("The path is resolved from the project root and becomes the official API entry point.", "Where is the API documentation file?", suggested);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (apiDocs !== undefined && apiDocs.trim().length === 0)
|
|
58
|
-
throw new Error("An API documentation path must not be empty");
|
|
59
50
|
let buildCommand = options.buildCommand;
|
|
60
51
|
if (interactive && buildCommand === undefined) {
|
|
61
52
|
const suggested = manifest.scripts?.build && projectScript(directory, manifest.packageManager, "build");
|
|
@@ -118,7 +109,6 @@ export default async function init(options = {}, directory = process.cwd(), core
|
|
|
118
109
|
name,
|
|
119
110
|
version: manifest.version,
|
|
120
111
|
description: manifest.description,
|
|
121
|
-
apiDocs,
|
|
122
112
|
buildCommand
|
|
123
113
|
};
|
|
124
114
|
const config = server
|
|
@@ -147,7 +137,6 @@ function compose(config) {
|
|
|
147
137
|
field("name", config.name),
|
|
148
138
|
field("version", config.version),
|
|
149
139
|
field("description", config.description),
|
|
150
|
-
field("apiDocs", config.apiDocs),
|
|
151
140
|
field("buildCommand", config.buildCommand),
|
|
152
141
|
half("server", config.server && {
|
|
153
142
|
location: config.server.location,
|
package/dist/pack.js
CHANGED
|
@@ -44,8 +44,6 @@ export default async function pack(directory = process.cwd()) {
|
|
|
44
44
|
}
|
|
45
45
|
if (config.icon)
|
|
46
46
|
file(zip, directory, config.icon, "icon.png", "Program icon");
|
|
47
|
-
if (config.apiDocs)
|
|
48
|
-
document(zip, directory, config.apiDocs);
|
|
49
47
|
zip.addFile("program.json", Buffer.from(JSON.stringify(program(config, version), null, 4) + "\n"));
|
|
50
48
|
const archive = `${config.identity}@${version ?? "0.0.0"}.zip`;
|
|
51
49
|
const bytes = zip.toBuffer();
|
|
@@ -64,7 +62,6 @@ function program(config, version) {
|
|
|
64
62
|
name: config.name,
|
|
65
63
|
version,
|
|
66
64
|
description: config.description,
|
|
67
|
-
apiDocs: config.apiDocs ? "api-docs.md" : undefined,
|
|
68
65
|
icon: config.icon ? "icon.png" : undefined,
|
|
69
66
|
...config.server && { server: { location: "server", start: config.server.start, installCommand: config.server.installCommand, startCommand: config.server.startCommand } },
|
|
70
67
|
...config.client && { client: { location: "client", start: config.client.start, title: config.client.title, size: config.client.size, position: config.client.position, layer: config.client.layer, minimize: config.client.minimize } }
|
|
@@ -78,9 +75,6 @@ function place(zip, directory, location, half) {
|
|
|
78
75
|
throw new Error(`The ${half} files are not at ${location} — nothing was built there`);
|
|
79
76
|
zip.addLocalFolder(from, half);
|
|
80
77
|
}
|
|
81
|
-
function document(zip, directory, location) {
|
|
82
|
-
file(zip, directory, location, "api-docs.md", "API documentation file");
|
|
83
|
-
}
|
|
84
78
|
function file(zip, directory, location, target, label) {
|
|
85
79
|
const from = resolve(directory, location);
|
|
86
80
|
if (!existsSync(from) || !statSync(from).isFile())
|
package/dist/program-release.js
CHANGED
|
@@ -5,6 +5,10 @@ import { tmpdir } from "node:os";
|
|
|
5
5
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
6
6
|
import AdmZip from "adm-zip";
|
|
7
7
|
const officialPrograms = {
|
|
8
|
+
phresh: {
|
|
9
|
+
identity: "phresh-program",
|
|
10
|
+
repository: "PhreshOS/phresh-program"
|
|
11
|
+
},
|
|
8
12
|
setup: {
|
|
9
13
|
identity: "setup",
|
|
10
14
|
repository: "PhreshOS/setup-program"
|
|
@@ -95,7 +99,6 @@ async function readProgram(directory, release) {
|
|
|
95
99
|
throw new Error("A published Program package cannot choose its installed storage");
|
|
96
100
|
return {
|
|
97
101
|
...value,
|
|
98
|
-
...pathField(value, directory, "apiDocs", "api-docs.md"),
|
|
99
102
|
...pathField(value, directory, "icon", "icon.png"),
|
|
100
103
|
...half(value, directory, "server"),
|
|
101
104
|
...half(value, directory, "client")
|
package/dist/project.js
CHANGED
|
@@ -43,8 +43,6 @@ function coherent(config) {
|
|
|
43
43
|
if (config[field] !== undefined && typeof config[field] !== "string")
|
|
44
44
|
throw new Error(`A program's ${field} must be text`);
|
|
45
45
|
}
|
|
46
|
-
if (config.apiDocs !== undefined && (typeof config.apiDocs !== "string" || config.apiDocs.trim().length === 0))
|
|
47
|
-
throw new Error("A program's apiDocs must be a non-empty path");
|
|
48
46
|
if (config.buildCommand !== undefined && (typeof config.buildCommand !== "string" || config.buildCommand.trim().length === 0))
|
|
49
47
|
throw new Error("A program's buildCommand must be non-empty text");
|
|
50
48
|
for (const half of ["server", "client"]) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "phresh-program",
|
|
3
3
|
"private": true,
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "phresh dev",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"react-dom": "^19.2.8"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@phreshos/cli": "^0.1.
|
|
19
|
+
"@phreshos/cli": "^0.1.12",
|
|
20
20
|
"@types/node": "^26.2.0",
|
|
21
21
|
"@types/react": "^19.2.18",
|
|
22
22
|
"@types/react-dom": "^19.2.4",
|
|
@@ -22,7 +22,7 @@ export default defineConfig({
|
|
|
22
22
|
// these values determines the Program's identity.
|
|
23
23
|
name: "Phresh Program",
|
|
24
24
|
description: "A simple counter whose state lives on the Server.",
|
|
25
|
-
version: "0.1.
|
|
25
|
+
version: "0.1.2",
|
|
26
26
|
|
|
27
27
|
// Markdown entry point for the API owned by this Program. It documents the
|
|
28
28
|
// counter service contract; PhreshOS endpoint mechanics belong in PhreshOS
|
package/dist/template.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phreshos/cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
|
|
4
|
+
"version": "0.1.12",
|
|
5
5
|
"description": "The Phresh command-line interface for Program projects and system management.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=20.10"
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"packageManager": "bun@1.3.14",
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@clack/prompts": "^1.7.0",
|
|
50
|
-
|
|
50
|
+
"@phreshos/core": "^0.1.4",
|
|
51
51
|
"adm-zip": "^0.6.0",
|
|
52
52
|
"commander": "^15.0.0",
|
|
53
53
|
"picocolors": "^1.1.1"
|