@lite-fsm/cli 0.1.0 → 0.1.1

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 (89) hide show
  1. package/README.md +130 -0
  2. package/dist/bin/lite-fsm.js +6714 -5
  3. package/package.json +6 -4
  4. package/dist/bin/lite-fsm.d.cts +0 -2
  5. package/dist/bin/lite-fsm.d.ts +0 -2
  6. package/dist/cli/context.d.cts +0 -21
  7. package/dist/cli/context.d.ts +0 -21
  8. package/dist/cli/context.js +0 -0
  9. package/dist/cli/create-program.d.cts +0 -6
  10. package/dist/cli/create-program.d.ts +0 -6
  11. package/dist/cli/create-program.js +0 -48
  12. package/dist/cli/diagnostics.d.cts +0 -15
  13. package/dist/cli/diagnostics.d.ts +0 -15
  14. package/dist/cli/diagnostics.js +0 -13
  15. package/dist/cli/node-fs.d.cts +0 -2
  16. package/dist/cli/node-fs.d.ts +0 -2
  17. package/dist/cli/node-fs.js +0 -33
  18. package/dist/cli/result.d.cts +0 -6
  19. package/dist/cli/result.d.ts +0 -6
  20. package/dist/cli/result.js +0 -8
  21. package/dist/export-graph/command.d.cts +0 -8
  22. package/dist/export-graph/command.d.ts +0 -8
  23. package/dist/export-graph/command.js +0 -30
  24. package/dist/export-graph/export-document.d.cts +0 -38
  25. package/dist/export-graph/export-document.d.ts +0 -38
  26. package/dist/export-graph/export-document.js +0 -35
  27. package/dist/export-graph/options.d.cts +0 -21
  28. package/dist/export-graph/options.d.ts +0 -21
  29. package/dist/export-graph/options.js +0 -40
  30. package/dist/export-graph/run-export-graph.d.cts +0 -10
  31. package/dist/export-graph/run-export-graph.d.ts +0 -10
  32. package/dist/export-graph/run-export-graph.js +0 -53
  33. package/dist/export-graph/source-bundle.d.cts +0 -12
  34. package/dist/export-graph/source-bundle.d.ts +0 -12
  35. package/dist/export-graph/source-bundle.js +0 -48
  36. package/dist/export-graph/write-output.d.cts +0 -10
  37. package/dist/export-graph/write-output.d.ts +0 -10
  38. package/dist/export-graph/write-output.js +0 -24
  39. package/dist/output/format-diagnostics.d.cts +0 -6
  40. package/dist/output/format-diagnostics.d.ts +0 -6
  41. package/dist/output/format-diagnostics.js +0 -33
  42. package/dist/output/stable-json.d.cts +0 -1
  43. package/dist/output/stable-json.d.ts +0 -1
  44. package/dist/output/stable-json.js +0 -72
  45. package/dist/project/build-project-graph.d.cts +0 -19
  46. package/dist/project/build-project-graph.d.ts +0 -19
  47. package/dist/project/build-project-graph.js +0 -64
  48. package/dist/project/create-project-host.d.cts +0 -4
  49. package/dist/project/create-project-host.d.ts +0 -4
  50. package/dist/project/create-project-host.js +0 -11
  51. package/dist/project/module-resolver.d.cts +0 -15
  52. package/dist/project/module-resolver.d.ts +0 -15
  53. package/dist/project/module-resolver.js +0 -111
  54. package/dist/project/source-cache.d.cts +0 -11
  55. package/dist/project/source-cache.d.ts +0 -11
  56. package/dist/project/source-cache.js +0 -55
  57. package/dist/project/tsconfig.d.cts +0 -15
  58. package/dist/project/tsconfig.d.ts +0 -15
  59. package/dist/project/tsconfig.js +0 -116
  60. package/dist/visualize/command.d.cts +0 -9
  61. package/dist/visualize/command.d.ts +0 -9
  62. package/dist/visualize/command.js +0 -35
  63. package/dist/visualize/http.d.cts +0 -11
  64. package/dist/visualize/http.d.ts +0 -11
  65. package/dist/visualize/http.js +0 -65
  66. package/dist/visualize/open-browser.d.cts +0 -22
  67. package/dist/visualize/open-browser.d.ts +0 -22
  68. package/dist/visualize/open-browser.js +0 -45
  69. package/dist/visualize/options.d.cts +0 -16
  70. package/dist/visualize/options.d.ts +0 -16
  71. package/dist/visualize/options.js +0 -51
  72. package/dist/visualize/routes.d.cts +0 -2
  73. package/dist/visualize/routes.d.ts +0 -2
  74. package/dist/visualize/routes.js +0 -24
  75. package/dist/visualize/run-visualize.d.cts +0 -32
  76. package/dist/visualize/run-visualize.d.ts +0 -32
  77. package/dist/visualize/run-visualize.js +0 -81
  78. package/dist/visualize/server.d.cts +0 -40
  79. package/dist/visualize/server.d.ts +0 -40
  80. package/dist/visualize/server.js +0 -90
  81. package/dist/visualize/session.d.cts +0 -34
  82. package/dist/visualize/session.d.ts +0 -34
  83. package/dist/visualize/session.js +0 -137
  84. package/dist/visualize/static-assets.d.cts +0 -17
  85. package/dist/visualize/static-assets.d.ts +0 -17
  86. package/dist/visualize/static-assets.js +0 -87
  87. package/dist/visualize/types.d.cts +0 -65
  88. package/dist/visualize/types.d.ts +0 -65
  89. package/dist/visualize/types.js +0 -0
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @lite-fsm/cli
2
+
3
+ Alpha command line tools for `lite-fsm`. The `lite-fsm` binary can create starter React projects, add generated-store machines, export a project graph JSON document, and run a local Visualizer session for a TypeScript project.
4
+
5
+ The CLI uses `@lite-fsm/graph` for static analysis. It does not run your app, call reducers, execute effects, or evaluate user code.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install --save-dev @lite-fsm/cli
11
+ ```
12
+
13
+ After installation, the `lite-fsm` command is available.
14
+
15
+ ## Commands
16
+
17
+ | Command | Purpose |
18
+ | -------------- | ---------------------------------------------------------------------- |
19
+ | `create` | Create a starter Next.js or Vite React project wired to lite-fsm. |
20
+ | `add-machine` | Add a domain machine to a generated `src/store`. |
21
+ | `export-graph` | Build a project graph and write a JSON export document. |
22
+ | `visualize` | Build a project graph and launch the bundled local Visualizer session. |
23
+
24
+ ## Create a Project
25
+
26
+ Create a Next.js starter:
27
+
28
+ ```bash
29
+ lite-fsm create my-app --template next
30
+ ```
31
+
32
+ Create a Vite starter:
33
+
34
+ ```bash
35
+ lite-fsm create my-app --template vite
36
+ ```
37
+
38
+ Tailwind CSS is enabled by default. To create the same starter without Tailwind:
39
+
40
+ ```bash
41
+ lite-fsm create my-app --template vite --css none
42
+ ```
43
+
44
+ The generated project includes TypeScript, alias `@/*`, `@lite-fsm/core`, `@lite-fsm/react`, `@lite-fsm/middleware`, `immer`, and a minimal store under `src/store`.
45
+
46
+ ## Add a Machine
47
+
48
+ From the root of a project created by `lite-fsm create`, add a domain machine:
49
+
50
+ ```bash
51
+ lite-fsm add-machine user-session
52
+ ```
53
+
54
+ This creates `src/store/machines/user-session.ts`, registers `userSession` in `src/store/index.ts`, and adds `userSession.Events` to `src/store/types.ts`.
55
+
56
+ The v1 command accepts names in `kebab-case`, `snake_case`, or `camelCase` and always uses the generated store layout under `src/store`.
57
+
58
+ ## Export a Graph
59
+
60
+ ```bash
61
+ lite-fsm export-graph --entry store/index.ts --out lite-fsm.graph.json --tsconfig tsconfig.json
62
+ ```
63
+
64
+ Minimal source shape:
65
+
66
+ ```ts
67
+ // store/index.ts
68
+ import { MachineManager, createMachine } from "@lite-fsm/core";
69
+
70
+ export const lamp = createMachine({
71
+ config: {
72
+ OFF: { SWITCH: "ON" },
73
+ ON: { SWITCH: "OFF" },
74
+ },
75
+ initialState: "OFF",
76
+ initialContext: {},
77
+ });
78
+
79
+ export const manager = MachineManager({ lamp });
80
+ ```
81
+
82
+ The export document includes the graph, project files, source hashes, CLI diagnostics, and optional source text when `--include-source` is passed.
83
+
84
+ ## Run the Visualizer
85
+
86
+ ```bash
87
+ lite-fsm visualize --entry store/index.ts
88
+ ```
89
+
90
+ By default, `visualize` starts a local server on `127.0.0.1:3030`, opens a browser, and keeps the process running until interrupted.
91
+
92
+ Useful options:
93
+
94
+ ```bash
95
+ lite-fsm visualize --entry store/index.ts --tsconfig tsconfig.json --port 3031 --no-open
96
+ ```
97
+
98
+ ## Options
99
+
100
+ `create`:
101
+
102
+ - `<project-name>` - required relative target directory. Nested paths such as `apps/demo` are supported when the parent directory already exists.
103
+ - `--template <next|vite>` - required framework template.
104
+ - `--css <tailwind|none>` - styling preset, defaults to `tailwind`.
105
+ - `--package-manager <pnpm|npm|yarn|bun>` - package manager for scaffold, install, and next steps, defaults to `npm`.
106
+ - `--install` / `--no-install` - install dependencies after generation, defaults to `--install`.
107
+
108
+ `add-machine`:
109
+
110
+ - `<name>` - required machine name in `kebab-case`, `snake_case`, or `camelCase`. The command runs relative to the current working directory and supports the store shape generated by `lite-fsm create`.
111
+
112
+ `export-graph`:
113
+
114
+ - `--entry <path>` - required TypeScript entry file where the selected `MachineManager(...)` is visible.
115
+ - `--out <path>` - required output JSON path.
116
+ - `--tsconfig <path>` - optional explicit TypeScript config.
117
+ - `--include-source` - embed discovered source file text in the JSON document.
118
+
119
+ `visualize`:
120
+
121
+ - `--entry <path>` - required TypeScript entry file.
122
+ - `--tsconfig <path>` - optional explicit TypeScript config.
123
+ - `--port <number>` - local Visualizer port, defaults to `3030`.
124
+ - `--no-open` - print the session URL without opening a browser.
125
+
126
+ ## Documentation
127
+
128
+ - [Full documentation](https://alexandergureev.github.io/lite-fsm/)
129
+ - [CLI package guide](https://alexandergureev.github.io/lite-fsm/packages/cli)
130
+ - [CLI API reference](https://alexandergureev.github.io/lite-fsm/api/cli)