reset-framework-cli 0.2.0

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.
Files changed (37) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +47 -0
  3. package/package.json +31 -0
  4. package/src/commands/build.js +115 -0
  5. package/src/commands/dev.js +160 -0
  6. package/src/commands/doctor.js +89 -0
  7. package/src/commands/init.js +629 -0
  8. package/src/commands/package.js +63 -0
  9. package/src/index.js +214 -0
  10. package/src/lib/context.js +66 -0
  11. package/src/lib/framework.js +55 -0
  12. package/src/lib/logger.js +11 -0
  13. package/src/lib/output.js +65 -0
  14. package/src/lib/process.js +165 -0
  15. package/src/lib/project.js +357 -0
  16. package/src/lib/toolchain.js +62 -0
  17. package/src/lib/ui.js +244 -0
  18. package/templates/basic/README.md +15 -0
  19. package/templates/basic/frontend/README.md +73 -0
  20. package/templates/basic/frontend/eslint.config.js +23 -0
  21. package/templates/basic/frontend/index.html +13 -0
  22. package/templates/basic/frontend/package.json +31 -0
  23. package/templates/basic/frontend/public/favicon.svg +1 -0
  24. package/templates/basic/frontend/public/icons.svg +24 -0
  25. package/templates/basic/frontend/src/App.css +138 -0
  26. package/templates/basic/frontend/src/App.tsx +72 -0
  27. package/templates/basic/frontend/src/assets/hero.png +0 -0
  28. package/templates/basic/frontend/src/assets/react.svg +1 -0
  29. package/templates/basic/frontend/src/assets/vite.svg +1 -0
  30. package/templates/basic/frontend/src/index.css +111 -0
  31. package/templates/basic/frontend/src/lib/reset.ts +16 -0
  32. package/templates/basic/frontend/src/main.tsx +10 -0
  33. package/templates/basic/frontend/tsconfig.app.json +24 -0
  34. package/templates/basic/frontend/tsconfig.json +7 -0
  35. package/templates/basic/frontend/tsconfig.node.json +26 -0
  36. package/templates/basic/frontend/vite.config.ts +6 -0
  37. package/templates/basic/reset.config.json +29 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jan Kordoš
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to do so, subject to the
10
+ following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # reset-framework-cli
2
+
3
+ `reset-framework-cli` is the developer-facing command-line interface for Reset Framework.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g reset-framework-cli
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ - `reset-framework-cli create-app my-app`
14
+ - `reset-framework-cli dev`
15
+ - `reset-framework-cli build`
16
+ - `reset-framework-cli package`
17
+ - `reset-framework-cli doctor`
18
+
19
+ ## Package boundary
20
+
21
+ - `reset-framework-cli` orchestrates the framework.
22
+ - `@reset-framework/native` provides the CMake-based runtime source package.
23
+ - `@reset-framework/sdk` provides the frontend bridge package.
24
+ - `@reset-framework/schema` provides the config schema package.
25
+
26
+ ## How it works
27
+
28
+ - `reset-framework-cli dev` and `reset-framework-cli build` compile the native runtime into an app-local cache under `.reset/framework`.
29
+ - The generated desktop app is assembled under `.reset/build`.
30
+ - On first native build, the CLI will reuse an existing vcpkg toolchain when available, or bootstrap one into `~/.reset-framework-cli/vcpkg`.
31
+ - The CLI remains thin. Native platform logic lives in the native package, not in command code.
32
+
33
+ ## Requirements
34
+
35
+ - Node.js `>= 20.19.0`
36
+ - CMake
37
+ - Ninja
38
+ - Git
39
+ - A native compiler toolchain for the target platform
40
+
41
+ ## Publish model
42
+
43
+ `reset-framework-cli` should be published only after:
44
+
45
+ 1. `@reset-framework/schema`
46
+ 2. `@reset-framework/sdk`
47
+ 3. `@reset-framework/native`
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "reset-framework-cli",
3
+ "version": "0.2.0",
4
+ "type": "module",
5
+ "description": "Command-line tooling for Reset Framework.",
6
+ "license": "MIT",
7
+ "publishConfig": {
8
+ "access": "public"
9
+ },
10
+ "engines": {
11
+ "node": ">=20.19.0"
12
+ },
13
+ "dependencies": {
14
+ "@reset-framework/native": "0.2.0",
15
+ "@reset-framework/schema": "0.2.0",
16
+ "@reset-framework/sdk": "0.2.0"
17
+ },
18
+ "bin": {
19
+ "reset-framework-cli": "./src/index.js"
20
+ },
21
+ "files": [
22
+ "src",
23
+ "templates",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "scripts": {
28
+ "start": "node ./src/index.js",
29
+ "doctor": "node ./src/index.js doctor"
30
+ }
31
+ }
@@ -0,0 +1,115 @@
1
+ import { buildFrameworkRuntime } from "../lib/framework.js"
2
+ import { stageMacOSAppBundle } from "../lib/output.js"
3
+ import { resolveNpmCommand, runCommand } from "../lib/process.js"
4
+ import {
5
+ assertAppProject,
6
+ assertFrameworkInstall,
7
+ loadResetConfig,
8
+ resolveAppOutputPaths,
9
+ resolveAppPaths,
10
+ resolveConfigPath,
11
+ resolveFrontendDir,
12
+ resolveFrameworkBuildPaths,
13
+ resolveFrameworkPaths
14
+ } from "../lib/project.js"
15
+ import {
16
+ createProgress,
17
+ printBanner,
18
+ printKeyValueTable,
19
+ printSection,
20
+ printStatusTable
21
+ } from "../lib/ui.js"
22
+
23
+ export const description = "Build the frontend, runtime, and final desktop app bundle"
24
+
25
+ export async function run(context) {
26
+ const dryRun = Boolean(context.flags["dry-run"])
27
+ const skipFrontend = Boolean(context.flags["skip-frontend"])
28
+ const skipRuntime = Boolean(context.flags["skip-runtime"])
29
+ const skipStage = Boolean(context.flags["skip-stage"])
30
+
31
+ const appPaths = resolveAppPaths(context.projectRoot)
32
+ const frameworkPaths = resolveFrameworkPaths()
33
+ assertAppProject(appPaths)
34
+ assertFrameworkInstall(frameworkPaths)
35
+ const config = loadResetConfig(appPaths)
36
+ assertAppProject(appPaths, config)
37
+ const outputPaths = resolveAppOutputPaths(appPaths, config)
38
+ const configPath = resolveConfigPath(appPaths)
39
+ const frontendDir = resolveFrontendDir(appPaths, config)
40
+ const frameworkBuildPaths = resolveFrameworkBuildPaths(appPaths)
41
+ const steps = [
42
+ !skipFrontend ? "Build frontend" : null,
43
+ !skipRuntime ? "Build runtime" : null,
44
+ !skipStage ? "Stage desktop bundle" : null
45
+ ].filter(Boolean)
46
+
47
+ printBanner("reset-framework-cli build", description)
48
+ printSection("Project")
49
+ printKeyValueTable([
50
+ ["Config", configPath],
51
+ ["Frontend", frontendDir],
52
+ ["Output", outputPaths.appBundlePath]
53
+ ])
54
+ console.log("")
55
+
56
+ printSection("Plan")
57
+ printStatusTable([
58
+ [skipFrontend ? "skip" : "ready", "Frontend", skipFrontend ? "Skipping frontend build" : "Build static frontend assets"],
59
+ [skipRuntime ? "skip" : "ready", "Runtime", skipRuntime ? "Skipping release runtime build" : "Configure and build the native runtime"],
60
+ [skipStage ? "skip" : "ready", "Bundle", skipStage ? "Skipping app bundle staging" : "Assemble the final desktop app bundle"]
61
+ ])
62
+
63
+ if (dryRun) {
64
+ console.log("")
65
+ printSection("Dry run")
66
+ printStatusTable(
67
+ steps.length > 0
68
+ ? steps.map((step) => ["plan", step, "No changes will be written"])
69
+ : [["warn", "Nothing to do", "All build phases were skipped"]]
70
+ )
71
+ return
72
+ }
73
+
74
+ if (steps.length === 0) {
75
+ console.log("")
76
+ printSection("Result")
77
+ printStatusTable([["warn", "Nothing to do", "All build phases were skipped"]])
78
+ return
79
+ }
80
+
81
+ console.log("")
82
+ const progress = createProgress(steps.length, "Build")
83
+
84
+ if (!skipFrontend) {
85
+ await runCommand(resolveNpmCommand(), ["run", "build"], {
86
+ cwd: frontendDir,
87
+ dryRun
88
+ })
89
+ progress.tick("Frontend assets built")
90
+ }
91
+
92
+ if (!skipRuntime) {
93
+ await buildFrameworkRuntime(frameworkPaths, frameworkBuildPaths, "release", {
94
+ cwd: appPaths.appRoot,
95
+ dryRun
96
+ })
97
+ progress.tick("Native runtime built")
98
+ }
99
+
100
+ if (!skipStage) {
101
+ await stageMacOSAppBundle(frameworkBuildPaths, appPaths, config, {
102
+ dryRun,
103
+ outputPaths,
104
+ configPath
105
+ })
106
+ progress.tick("Desktop app bundle staged")
107
+ }
108
+
109
+ console.log("")
110
+ printSection("Result")
111
+ printStatusTable([
112
+ ["done", "Build output", outputPaths.outputRoot],
113
+ ["done", "Desktop app", outputPaths.appBundlePath]
114
+ ])
115
+ }
@@ -0,0 +1,160 @@
1
+ import { buildFrameworkRuntime } from "../lib/framework.js"
2
+ import {
3
+ registerChildCleanup,
4
+ resolveNpmCommand,
5
+ spawnCommand,
6
+ waitForProcessExit,
7
+ waitForUrl
8
+ } from "../lib/process.js"
9
+ import {
10
+ assertAppProject,
11
+ assertFrameworkInstall,
12
+ loadResetConfig,
13
+ resolveAppPaths,
14
+ resolveConfigPath,
15
+ resolveDevServerOptions,
16
+ resolveFrontendDir,
17
+ resolveFrameworkBuildPaths,
18
+ resolveFrameworkPaths
19
+ } from "../lib/project.js"
20
+ import {
21
+ createProgress,
22
+ printBanner,
23
+ printKeyValueTable,
24
+ printSection,
25
+ printStatusTable
26
+ } from "../lib/ui.js"
27
+
28
+ export const description = "Run the frontend dev server and native host"
29
+
30
+ export async function run(context) {
31
+ const dryRun = Boolean(context.flags["dry-run"])
32
+ const skipFrontend = Boolean(context.flags["skip-frontend"])
33
+ const skipRuntime = Boolean(context.flags["skip-runtime"])
34
+ const noOpen = Boolean(context.flags["no-open"])
35
+
36
+ const appPaths = resolveAppPaths(context.projectRoot)
37
+ const frameworkPaths = resolveFrameworkPaths()
38
+ assertAppProject(appPaths)
39
+ assertFrameworkInstall(frameworkPaths)
40
+ const config = loadResetConfig(appPaths)
41
+ assertAppProject(appPaths, config)
42
+ const devServer = resolveDevServerOptions(config)
43
+ const configPath = resolveConfigPath(appPaths)
44
+ const frontendDir = resolveFrontendDir(appPaths, config)
45
+ const frameworkBuildPaths = resolveFrameworkBuildPaths(appPaths)
46
+ const steps = [
47
+ !skipRuntime ? "Build native runtime" : null,
48
+ !skipFrontend ? "Start frontend dev server" : null,
49
+ !noOpen ? "Launch desktop window" : null
50
+ ].filter(Boolean)
51
+
52
+ printBanner("reset-framework-cli dev", description)
53
+ printSection("Project")
54
+ printKeyValueTable([
55
+ ["Config", configPath],
56
+ ["Frontend", frontendDir],
57
+ ["Dev URL", config.frontend.devUrl]
58
+ ])
59
+ console.log("")
60
+
61
+ printSection("Plan")
62
+ printStatusTable([
63
+ [skipRuntime ? "skip" : "ready", "Runtime", skipRuntime ? "Reusing existing native dev build" : "Configure and build the native runtime"],
64
+ [skipFrontend ? "skip" : "ready", "Frontend", skipFrontend ? "Expecting an already running dev server" : "Start the frontend dev server and wait for readiness"],
65
+ [noOpen ? "skip" : "ready", "Window", noOpen ? "Do not launch the desktop window" : "Start the native host with the active project config"]
66
+ ])
67
+
68
+ if (dryRun) {
69
+ console.log("")
70
+ printSection("Dry run")
71
+ printStatusTable(
72
+ steps.length > 0
73
+ ? steps.map((step) => ["plan", step, "No processes will be started"])
74
+ : [["warn", "Nothing to do", "All dev phases were skipped"]]
75
+ )
76
+ return
77
+ }
78
+
79
+ if (steps.length === 0) {
80
+ console.log("")
81
+ printSection("Result")
82
+ printStatusTable([["warn", "Nothing to do", "All dev phases were skipped"]])
83
+ return
84
+ }
85
+
86
+ console.log("")
87
+ const progress = createProgress(steps.length, "Dev")
88
+
89
+ if (!skipRuntime) {
90
+ await buildFrameworkRuntime(frameworkPaths, frameworkBuildPaths, "dev", {
91
+ cwd: appPaths.appRoot,
92
+ dryRun
93
+ })
94
+ progress.tick("Native runtime built")
95
+ }
96
+
97
+ const children = []
98
+
99
+ if (!skipFrontend) {
100
+ const frontendProcess = spawnCommand(resolveNpmCommand(), [
101
+ "run",
102
+ "dev",
103
+ "--",
104
+ "--host",
105
+ devServer.host,
106
+ "--port",
107
+ devServer.port,
108
+ "--strictPort"
109
+ ], {
110
+ cwd: frontendDir,
111
+ dryRun
112
+ })
113
+
114
+ if (frontendProcess) {
115
+ children.push(frontendProcess)
116
+ await waitForUrl(config.frontend.devUrl)
117
+ progress.tick("Frontend dev server is reachable")
118
+ }
119
+ }
120
+
121
+ if (!noOpen) {
122
+ const appProcess = spawnCommand(frameworkBuildPaths.devAppBinary, [], {
123
+ cwd: appPaths.appRoot,
124
+ env: {
125
+ RESET_CONFIG_PATH: configPath,
126
+ RESET_FRONTEND_DEV_URL: config.frontend.devUrl
127
+ },
128
+ dryRun
129
+ })
130
+
131
+ if (appProcess) {
132
+ children.push(appProcess)
133
+ progress.tick("Desktop window launched")
134
+ }
135
+ }
136
+
137
+ if (children.length === 0) {
138
+ return
139
+ }
140
+
141
+ console.log("")
142
+ printSection("Runtime")
143
+ printStatusTable([
144
+ ["done", "Frontend", config.frontend.devUrl],
145
+ ["done", "Config", configPath]
146
+ ])
147
+ console.log(" Press Ctrl+C to stop")
148
+
149
+ const cleanup = registerChildCleanup(children)
150
+
151
+ try {
152
+ await Promise.race([
153
+ ...children.map((child, index) =>
154
+ waitForProcessExit(child, index === 0 ? "dev process" : "native host")
155
+ )
156
+ ])
157
+ } finally {
158
+ cleanup()
159
+ }
160
+ }
@@ -0,0 +1,89 @@
1
+ import { existsSync } from "node:fs"
2
+
3
+ import {
4
+ getAppChecks,
5
+ getFrameworkChecks,
6
+ loadResetConfig,
7
+ resolveFrontendDir,
8
+ resolveAppPaths,
9
+ resolveConfigPath,
10
+ resolveFrameworkPaths
11
+ } from "../lib/project.js"
12
+ import { findVcpkgToolchainFile } from "../lib/toolchain.js"
13
+ import {
14
+ printBanner,
15
+ printKeyValueTable,
16
+ printSection,
17
+ printStatusTable
18
+ } from "../lib/ui.js"
19
+
20
+ export const description = "Inspect the current project layout"
21
+
22
+ export async function run(context) {
23
+ const appPaths = resolveAppPaths(context.projectRoot)
24
+ const frameworkPaths = resolveFrameworkPaths()
25
+
26
+ let config = null
27
+
28
+ if (existsSync(resolveConfigPath(appPaths))) {
29
+ config = loadResetConfig(appPaths)
30
+ }
31
+
32
+ printBanner("reset-framework-cli doctor", description)
33
+
34
+ printSection("App project")
35
+
36
+ const appChecks = [...getAppChecks(appPaths)]
37
+ if (config) {
38
+ appChecks.unshift(["frontend", resolveFrontendDir(appPaths, config)])
39
+ }
40
+
41
+ printStatusTable(
42
+ appChecks.map(([label, filePath]) => [
43
+ existsSync(filePath) ? "ok" : "missing",
44
+ label,
45
+ filePath
46
+ ])
47
+ )
48
+
49
+ console.log("")
50
+ printSection("Framework installation")
51
+
52
+ printStatusTable(
53
+ getFrameworkChecks(frameworkPaths).map(([label, filePath]) => [
54
+ existsSync(filePath) ? "ok" : "missing",
55
+ label,
56
+ filePath
57
+ ])
58
+ )
59
+
60
+ console.log("")
61
+ printSection("Framework packages")
62
+ printKeyValueTable([
63
+ ["Native", `${frameworkPaths.frameworkPackage.packageName}@${frameworkPaths.frameworkPackage.version}`],
64
+ ["SDK", `${frameworkPaths.sdkPackage.packageName}@${frameworkPaths.sdkPackage.version}`],
65
+ ["Schema", `${frameworkPaths.schemaPackage.packageName}@${frameworkPaths.schemaPackage.version}`]
66
+ ])
67
+
68
+ console.log("")
69
+ printSection("Native toolchain")
70
+ const vcpkgToolchainFile = findVcpkgToolchainFile()
71
+ printStatusTable([
72
+ [vcpkgToolchainFile ? "ok" : "warn", "Framework source", frameworkPaths.frameworkRoot],
73
+ [vcpkgToolchainFile ? "ok" : "warn", "vcpkg toolchain", vcpkgToolchainFile ?? "Will be bootstrapped on first native build"]
74
+ ])
75
+
76
+ if (config) {
77
+ console.log("")
78
+ printSection("Config")
79
+ printKeyValueTable([
80
+ ["Name", config.name],
81
+ ["Product", config.productName],
82
+ ["App ID", config.appId],
83
+ ["Frontend", config.project.frontendDir],
84
+ ["Styling", config.project.styling],
85
+ ["Dev URL", config.frontend.devUrl],
86
+ ["Output", config.build.outputDir]
87
+ ])
88
+ }
89
+ }