@lordierclaw/bluenote 0.4.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 (60) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +217 -0
  3. package/dist/bin.d.ts +2 -0
  4. package/dist/bin.js +10 -0
  5. package/dist/bin.js.map +1 -0
  6. package/dist/cli.d.ts +4 -0
  7. package/dist/cli.js +37 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/commands/daemon.d.ts +2 -0
  10. package/dist/commands/daemon.js +163 -0
  11. package/dist/commands/daemon.js.map +1 -0
  12. package/dist/commands/doctor.d.ts +2 -0
  13. package/dist/commands/doctor.js +113 -0
  14. package/dist/commands/doctor.js.map +1 -0
  15. package/dist/commands/help.d.ts +3 -0
  16. package/dist/commands/help.js +25 -0
  17. package/dist/commands/help.js.map +1 -0
  18. package/dist/commands/tui.d.ts +2 -0
  19. package/dist/commands/tui.js +63 -0
  20. package/dist/commands/tui.js.map +1 -0
  21. package/dist/commands/version.d.ts +2 -0
  22. package/dist/commands/version.js +17 -0
  23. package/dist/commands/version.js.map +1 -0
  24. package/dist/commands/web.d.ts +2 -0
  25. package/dist/commands/web.js +63 -0
  26. package/dist/commands/web.js.map +1 -0
  27. package/dist/daemon/paths.d.ts +3 -0
  28. package/dist/daemon/paths.js +29 -0
  29. package/dist/daemon/paths.js.map +1 -0
  30. package/dist/daemon/router.d.ts +38 -0
  31. package/dist/daemon/router.js +107 -0
  32. package/dist/daemon/router.js.map +1 -0
  33. package/dist/daemon/server.d.ts +13 -0
  34. package/dist/daemon/server.js +78 -0
  35. package/dist/daemon/server.js.map +1 -0
  36. package/dist/daemon/token.d.ts +1 -0
  37. package/dist/daemon/token.js +11 -0
  38. package/dist/daemon/token.js.map +1 -0
  39. package/dist/types.d.ts +11 -0
  40. package/dist/types.js +3 -0
  41. package/dist/types.js.map +1 -0
  42. package/dist/utils/command-discovery.d.ts +31 -0
  43. package/dist/utils/command-discovery.js +162 -0
  44. package/dist/utils/command-discovery.js.map +1 -0
  45. package/dist/utils/daemon-state.d.ts +21 -0
  46. package/dist/utils/daemon-state.js +99 -0
  47. package/dist/utils/daemon-state.js.map +1 -0
  48. package/dist/utils/lazy-import.d.ts +1 -0
  49. package/dist/utils/lazy-import.js +10 -0
  50. package/dist/utils/lazy-import.js.map +1 -0
  51. package/dist/utils/package-info.d.ts +15 -0
  52. package/dist/utils/package-info.js +49 -0
  53. package/dist/utils/package-info.js.map +1 -0
  54. package/dist/utils/runtime-requirements.d.ts +8 -0
  55. package/dist/utils/runtime-requirements.js +26 -0
  56. package/dist/utils/runtime-requirements.js.map +1 -0
  57. package/dist/utils/write.d.ts +1 -0
  58. package/dist/utils/write.js +9 -0
  59. package/dist/utils/write.js.map +1 -0
  60. package/package.json +34 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # BlueNote Distribution CLI
2
+
3
+ `@lordierclaw/bluenote` is the official BlueNote app entrypoint and top-level command router. It exposes the `bluenote` and `bn` binaries, keeps distribution commands lightweight, and launches optional WebUI/TUI clients through their public executables.
4
+
5
+ ## Role in BlueNote
6
+
7
+ This repo owns:
8
+
9
+ - top-level `bluenote`/`bn` command routing
10
+ - `--help`, `version`, and `doctor`
11
+ - minimal local daemon lifecycle and capability reporting
12
+ - optional client discovery in explicit `auto`, `path`, and `built` runtime modes
13
+ - distribution packaging and install guidance
14
+
15
+ It does not own core note behavior, browser UI implementation, or terminal UI implementation. Those live in `@lordierclaw/bluenote-core`, `@lordierclaw/bluenote-webui`, and `@lordierclaw/bluenote-term`.
16
+
17
+ ## Install
18
+
19
+ For non-technical users, use the installer scripts. They are interactive by default and safely select only the distribution CLI (`@lordierclaw/bluenote`) unless you opt into the WebUI, built TUI, or all clients. The default registry is npmjs; GitHub Packages is available when you have token/auth configured.
20
+
21
+ Linux/macOS:
22
+
23
+ ```sh
24
+ ./scripts/install.sh
25
+ ./scripts/install.sh --dry-run
26
+ ./scripts/install.sh --yes
27
+ ./scripts/install.sh --with-web
28
+ ./scripts/install.sh --with-tui
29
+ ./scripts/install.sh --all
30
+ ./scripts/install.sh --registry github
31
+ ./scripts/uninstall.sh --dry-run
32
+ ./scripts/uninstall.sh
33
+ ```
34
+
35
+ Windows PowerShell:
36
+
37
+ ```powershell
38
+ .\scripts\install.ps1 -Interactive
39
+ .\scripts\install.ps1 -DryRun
40
+ .\scripts\install.ps1 -Yes
41
+ .\scripts\install.ps1 -WithWeb
42
+ .\scripts\install.ps1 -WithTui
43
+ .\scripts\install.ps1 -All
44
+ .\scripts\install.ps1 -Registry github
45
+ .\scripts\uninstall.ps1 -DryRun
46
+ .\scripts\uninstall.ps1
47
+ ```
48
+
49
+ Installer options:
50
+
51
+ - Linux/macOS install: `--interactive`, `--yes`, `--with-web`, `--with-tui`, `--all`, `--tag <tag>`, `--registry npm|github`, `--client-mode path|built|auto`, `--dry-run`.
52
+ - Windows install: `-Interactive`, `-Yes`, `-WithWeb`, `-WithTui`, `-All`, `-Tag`, `-Registry npm|github`, `-ClientMode path|built|auto`, `-DryRun`.
53
+ - Linux/macOS uninstall: `--purge-config`, `--purge-cache`, `--purge-data`, `--dry-run`.
54
+ - Windows uninstall: `-PurgeConfig`, `-PurgeCache`, `-PurgeData`, `-DryRun`.
55
+
56
+ The installer runs preflight checks before mutating state, detects common conflicts, and in interactive mode offers safe upgrade, repair, skip, or abort choices when conflicts are found. Non-interactive `--yes` / `-Yes` fails safely on unknown conflicts rather than overwriting. Failed partial installs print recovery guidance and attempt best-effort rollback of artifacts created during the current run.
57
+
58
+ Uninstall stops the daemon first when possible and removes `@lordierclaw/bluenote`, `@lordierclaw/bluenote-webui`, and managed built terminal client artifacts/packages. Normal install and uninstall preserve user notes/config/data. `--purge-data` / `-PurgeData` is the only destructive user-data path and requires the exact typed confirmation phrase `delete my bluenote data`.
59
+
60
+ The default `auto` client mode lets `bluenote web` and `bluenote tui` prefer installer-managed built client artifacts from `BLUENOTE_BUILT_CLIENT_DIR` when present, then fall back to `PATH` discovery for `bluenote-webui` and `bluenote-term`. Use `--client-mode path|built|auto` on a launch command, or set `BLUENOTE_CLIENT_MODE=path|built|auto`, to force or inspect a runtime mode. The user TUI path uses a built terminal artifact/package and does not auto-install Bun or require Bun at runtime. `bluenote doctor` runs after installation and reports each client as `built`, `path`, `missing`, or `broken`.
61
+
62
+ Manual npm install is also supported for advanced users:
63
+
64
+ ```sh
65
+ npm install -g @lordierclaw/bluenote
66
+ npm install -g @lordierclaw/bluenote-webui # optional
67
+ npm install -g @lordierclaw/bluenote-term # optional built TUI package when available
68
+ bluenote doctor
69
+ ```
70
+
71
+ Run clients through the distribution command after starting the daemon:
72
+
73
+ ```sh
74
+ bluenote daemon start
75
+ bluenote web
76
+ # or
77
+ bluenote tui
78
+ ```
79
+
80
+ `bn` is the same binary alias as `bluenote`.
81
+
82
+ ## Local development
83
+
84
+ Expected sibling checkout layout:
85
+
86
+ ```text
87
+ ../bluenote-core
88
+ ../bluenote-webui
89
+ ../bluenote-term
90
+ ../bluenote
91
+ ```
92
+
93
+ Manual source-link setup before all packages are published:
94
+
95
+ ```sh
96
+ # 1. Distribution CLI.
97
+ cd ../bluenote
98
+ npm ci --include=dev
99
+ npm run check
100
+ npm link
101
+ bluenote doctor
102
+
103
+ # 2. Optional browser client.
104
+ cd ../bluenote-webui
105
+ npm ci --include=dev
106
+ npm run check
107
+ npm link
108
+ bluenote doctor
109
+
110
+ # 3. Optional terminal client. Link from the public package workspace.
111
+ cd ../bluenote-term
112
+ bun install
113
+ bun run check
114
+ cd packages/term
115
+ bun link
116
+ cd ../..
117
+ bluenote doctor
118
+ ```
119
+
120
+ If linked commands are not visible, add npm's global command directory and Bun's command directory to `PATH`:
121
+
122
+ ```sh
123
+ export PATH="$(npm prefix -g)/bin:$HOME/.bun/bin:$PATH"
124
+ ```
125
+
126
+ ```fish
127
+ fish_add_path -U (npm prefix -g)/bin
128
+ fish_add_path -U ~/.bun/bin
129
+ ```
130
+
131
+ ```cmd
132
+ for /f "delims=" %i in ('npm prefix -g') do set "NPM_PREFIX=%i"
133
+ if exist "%NPM_PREFIX%\bin" (set "PATH=%NPM_PREFIX%\bin;%USERPROFILE%\.bun\bin;%PATH%") else (set "PATH=%NPM_PREFIX%;%USERPROFILE%\.bun\bin;%PATH%")
134
+ ```
135
+
136
+ ```powershell
137
+ $npmPrefix = npm prefix -g
138
+ $npmBin = if (Test-Path (Join-Path $npmPrefix "bin")) { Join-Path $npmPrefix "bin" } else { $npmPrefix }
139
+ $env:Path = "$npmBin;$HOME\.bun\bin;$env:Path"
140
+ ```
141
+
142
+ Fast local install/uninstall scripts are available for sibling checkout development:
143
+
144
+ ```sh
145
+ ./scripts/dev-install-local.sh --all --dry-run
146
+ ./scripts/dev-install-local.sh --all
147
+ ./scripts/dev-uninstall-local.sh --all --dry-run
148
+ ./scripts/dev-uninstall-local.sh --all
149
+ ```
150
+
151
+ ```powershell
152
+ .\scripts\dev-install-local.ps1 -All -DryRun
153
+ .\scripts\dev-install-local.ps1 -All
154
+ .\scripts\dev-uninstall-local.ps1 -All -DryRun
155
+ .\scripts\dev-uninstall-local.ps1 -All
156
+ ```
157
+
158
+ Default local install mode links the distribution CLI and WebUI. Add `--tui`/`-Tui` or use `--all`/`-All` to include the Bun-based terminal package from `../bluenote-term/packages/term`. Use `--skip-check`/`-SkipCheck` to skip repo checks and `--dry-run`/`-DryRun` to print commands without changing global links.
159
+
160
+ For release-like local verification without publishing, pack local artifacts and install them into an isolated temporary npm prefix with separate BlueNote config/data/cache paths:
161
+
162
+ ```sh
163
+ ./scripts/dev-verify-local.sh --web --dry-run
164
+ ./scripts/dev-verify-local.sh --web
165
+ # Include both optional clients when local package verification is available:
166
+ ./scripts/dev-verify-local.sh --all
167
+ ```
168
+
169
+ ```powershell
170
+ .\scripts\dev-verify-local.ps1 -Web -DryRun
171
+ .\scripts\dev-verify-local.ps1 -Web
172
+ # Include both optional clients when local package verification is available:
173
+ .\scripts\dev-verify-local.ps1 -All
174
+ ```
175
+
176
+ Use `--keep-temp`/`-KeepTemp` to preserve the temporary prefix and isolated state directories for inspection after a verification run.
177
+
178
+ ## Scripts
179
+
180
+ ```sh
181
+ npm run typecheck
182
+ npm run test
183
+ npm run build
184
+ npm run check
185
+ npm run version:status
186
+ npm run version:status -- --allow-git-deps
187
+ ./scripts/dev-install-local.sh --all --dry-run
188
+ ./scripts/dev-uninstall-local.sh --all --dry-run
189
+ ./scripts/dev-verify-local.sh --web --dry-run
190
+ node dist/bin.js --help
191
+ node dist/bin.js version
192
+ node dist/bin.js doctor
193
+ ```
194
+
195
+ `npm run version:status` checks the four sibling package names and versions. npm run version:status is the release check and requires exact published version dependencies for BlueNote packages. Development mode may use pinned Git deps when you intentionally pass `--allow-git-deps` for a local-only workspace.
196
+
197
+ ## Packaging and versions
198
+
199
+ The package name is `@lordierclaw/bluenote`; published binaries are `bluenote` and `bn`.
200
+
201
+ The distribution depends on `@lordierclaw/bluenote-core` for headless behavior. Optional clients are installed separately and discovered as `bluenote-webui` and `bluenote-term` executables on `PATH`.
202
+
203
+ Release mode must use published version deps for BlueNote packages. The distribution package now pins `@lordierclaw/bluenote-core` to the exact published semver used by the coordinated BlueNote release, while `--allow-git-deps` remains available only for local development workspaces that intentionally opt into Git-pinned dependencies.
204
+
205
+ ## Cross-platform notes
206
+
207
+ - Supported distribution runtime: Node.js `>=16.14 <17 || >=18`.
208
+ - Basic distribution commands do not require Bun.
209
+ - The terminal client uses Bun/OpenTUI and should be installed separately.
210
+ - The daemon is local-only and passes client connection details through environment variables without printing bearer tokens.
211
+ - Use `bluenote doctor` after install/link changes to verify PATH, daemon state, and optional clients.
212
+
213
+ ## Related packages
214
+
215
+ - `@lordierclaw/bluenote-core`: headless note model, storage, search, AI config/queue/provider behavior, and public core APIs.
216
+ - `@lordierclaw/bluenote-webui`: optional local browser client and localhost server/proxy.
217
+ - `@lordierclaw/bluenote-term`: optional terminal/TUI client and terminal command API.
package/dist/bin.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/bin.js ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const cli_1 = require("./cli");
5
+ (0, cli_1.main)(process.argv.slice(2)).catch((error) => {
6
+ const message = error instanceof Error ? error.message : String(error);
7
+ process.stderr.write(`${message}\n`);
8
+ process.exitCode = 1;
9
+ });
10
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";;;AACA,+BAA4B;AAE5B,IAAA,UAAI,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACtE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAA;IACpC,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAA;AACtB,CAAC,CAAC,CAAA"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { CommandIo } from "./types";
2
+ export declare const COMMANDS: readonly ["tui", "web", "daemon", "doctor", "version"];
3
+ export declare function run(args?: string[], io?: CommandIo): Promise<number>;
4
+ export declare function main(args?: string[], io?: CommandIo): Promise<number>;
package/dist/cli.js ADDED
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMMANDS = void 0;
4
+ exports.run = run;
5
+ exports.main = main;
6
+ const daemon_1 = require("./commands/daemon");
7
+ const doctor_1 = require("./commands/doctor");
8
+ const help_1 = require("./commands/help");
9
+ const tui_1 = require("./commands/tui");
10
+ const version_1 = require("./commands/version");
11
+ const web_1 = require("./commands/web");
12
+ const write_1 = require("./utils/write");
13
+ exports.COMMANDS = ["tui", "web", "daemon", "doctor", "version"];
14
+ async function run(args = [], io = {}) {
15
+ const [command, ...commandArgs] = args;
16
+ if (!command || command === "--help" || command === "-h" || command === "help") {
17
+ return (0, help_1.runHelp)(commandArgs, io);
18
+ }
19
+ if (command === "version" || command === "--version")
20
+ return (0, version_1.runVersion)(commandArgs, io);
21
+ if (command === "doctor")
22
+ return (0, doctor_1.runDoctor)(commandArgs, io);
23
+ if (command === "daemon")
24
+ return (0, daemon_1.runDaemon)(commandArgs, io);
25
+ if (command === "tui")
26
+ return (0, tui_1.runTui)(commandArgs, io);
27
+ if (command === "web")
28
+ return (0, web_1.runWeb)(commandArgs, io);
29
+ (0, write_1.write)(io.stderr || process.stderr, `Unknown command: ${command}\nRun "bluenote --help" for usage.\n`);
30
+ return 1;
31
+ }
32
+ async function main(args = process.argv.slice(2), io) {
33
+ const exitCode = await run(args, io);
34
+ process.exitCode = exitCode;
35
+ return exitCode;
36
+ }
37
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AAWA,kBAeC;AAED,oBAIC;AA/BD,8CAA6C;AAC7C,8CAA6C;AAC7C,0CAAyC;AACzC,wCAAuC;AACvC,gDAA+C;AAC/C,wCAAuC;AACvC,yCAAqC;AAExB,QAAA,QAAQ,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAA;AAEvE,KAAK,UAAU,GAAG,CAAC,OAAiB,EAAE,EAAE,KAAgB,EAAE;IAC/D,MAAM,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,GAAG,IAAI,CAAA;IAEtC,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QAC/E,OAAO,IAAA,cAAO,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IACjC,CAAC;IAED,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,WAAW;QAAE,OAAO,IAAA,oBAAU,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IACxF,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAA,kBAAS,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAC3D,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAA,kBAAS,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAC3D,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,IAAA,YAAM,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IACrD,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,IAAA,YAAM,EAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAErD,IAAA,aAAK,EAAC,EAAE,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,EAAE,oBAAoB,OAAO,sCAAsC,CAAC,CAAA;IACrG,OAAO,CAAC,CAAA;AACV,CAAC;AAEM,KAAK,UAAU,IAAI,CAAC,OAAiB,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAc;IAC/E,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;IACpC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC3B,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { CommandIo } from "../types";
2
+ export declare function runDaemon(args?: string[], io?: CommandIo): Promise<number>;
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.runDaemon = runDaemon;
7
+ const child_process_1 = require("child_process");
8
+ const path_1 = __importDefault(require("path"));
9
+ const paths_1 = require("../daemon/paths");
10
+ const token_1 = require("../daemon/token");
11
+ const server_1 = require("../daemon/server");
12
+ const package_info_1 = require("../utils/package-info");
13
+ const daemon_state_1 = require("../utils/daemon-state");
14
+ const write_1 = require("../utils/write");
15
+ const HELP_TEXT = `BlueNote daemon
16
+
17
+ Usage: bluenote daemon <start|status|stop>
18
+
19
+ Commands:
20
+ start Start the local BlueNote daemon
21
+ status Show daemon status and health
22
+ stop Stop the local BlueNote daemon
23
+ `;
24
+ function binPath() {
25
+ return path_1.default.resolve(__dirname, "..", "bin.js");
26
+ }
27
+ function parseServeArgs(args, env = process.env) {
28
+ const parsed = { token: env.BLUENOTE_DAEMON_SERVE_TOKEN };
29
+ for (let index = 0; index < args.length; index += 1) {
30
+ const value = args[index];
31
+ if (value === "--state" && args[index + 1])
32
+ parsed.statePath = args[++index];
33
+ else if (value === "--version" && args[index + 1])
34
+ parsed.version = args[++index];
35
+ }
36
+ return parsed;
37
+ }
38
+ async function waitForRunning(env, deadlineMs) {
39
+ const deadline = Date.now() + deadlineMs;
40
+ let latest = await (0, daemon_state_1.readDaemonStatus)(env);
41
+ while (Date.now() < deadline) {
42
+ latest = await (0, daemon_state_1.readDaemonStatus)(env);
43
+ if (latest.state === "running")
44
+ return latest;
45
+ await new Promise((resolve) => setTimeout(resolve, 50));
46
+ }
47
+ return latest;
48
+ }
49
+ async function startDaemon(io) {
50
+ const stdout = io.stdout || process.stdout;
51
+ const stderr = io.stderr || process.stderr;
52
+ const env = io.env || process.env;
53
+ const existing = await (0, daemon_state_1.readDaemonStatus)(env);
54
+ if (existing.state === "running" && existing.metadata) {
55
+ (0, write_1.write)(stdout, `BlueNote daemon already running\nstatus: running\nendpoint: ${existing.metadata.url}\npid: ${existing.metadata.pid}\n`);
56
+ return 0;
57
+ }
58
+ if (existing.state === "stale")
59
+ (0, daemon_state_1.removeDaemonMetadata)(env);
60
+ const statePath = (0, paths_1.getDaemonStatePath)(env);
61
+ const token = (0, token_1.createDaemonToken)();
62
+ const version = (0, package_info_1.readOwnPackageInfo)().version;
63
+ const spawn = io.spawn || child_process_1.spawn;
64
+ let child;
65
+ try {
66
+ child = spawn(process.execPath, [binPath(), "daemon", "serve", "--state", statePath, "--version", version], {
67
+ detached: true,
68
+ stdio: "ignore",
69
+ env: { ...env, BLUENOTE_DAEMON_SERVE_TOKEN: token },
70
+ });
71
+ child.unref();
72
+ }
73
+ catch (error) {
74
+ const message = error instanceof Error ? error.message : String(error);
75
+ (0, write_1.write)(stderr, `Unable to start BlueNote daemon: ${message}\n`);
76
+ return 1;
77
+ }
78
+ const status = await waitForRunning(env, 5000);
79
+ if (status.state !== "running" || !status.metadata) {
80
+ if (child?.pid) {
81
+ try {
82
+ process.kill(child.pid, "SIGTERM");
83
+ }
84
+ catch {
85
+ // best effort cleanup for failed starts
86
+ }
87
+ }
88
+ (0, write_1.write)(stderr, "Unable to start BlueNote daemon: health check did not become ready.\n");
89
+ return 1;
90
+ }
91
+ (0, write_1.write)(stdout, `BlueNote daemon started\nstatus: running\nendpoint: ${status.metadata.url}\npid: ${status.metadata.pid}\n`);
92
+ return 0;
93
+ }
94
+ async function statusDaemon(io) {
95
+ const stdout = io.stdout || process.stdout;
96
+ const status = await (0, daemon_state_1.readDaemonStatus)(io.env || process.env);
97
+ (0, write_1.write)(stdout, `status: ${status.state}\n`);
98
+ (0, write_1.write)(stdout, `endpoint: ${status.metadata ? status.metadata.url : "unavailable"}\n`);
99
+ (0, write_1.write)(stdout, `pid: ${status.metadata?.pid || "unavailable"}\n`);
100
+ (0, write_1.write)(stdout, `token: ${status.metadata?.token ? "present" : "missing"}\n`);
101
+ (0, write_1.write)(stdout, `health: ${status.healthOk ? "ok" : status.state === "stopped" ? "not checked" : "failed"}\n`);
102
+ return 0;
103
+ }
104
+ async function stopDaemon(io) {
105
+ const stdout = io.stdout || process.stdout;
106
+ const env = io.env || process.env;
107
+ const status = await (0, daemon_state_1.readDaemonStatus)(env);
108
+ if (!status.metadata) {
109
+ (0, write_1.write)(stdout, "BlueNote daemon is not running.\nstatus: stopped\n");
110
+ return 0;
111
+ }
112
+ if (status.state === "running") {
113
+ try {
114
+ await (0, daemon_state_1.requestJson)(`${status.metadata.url}/shutdown`, { method: "POST", token: status.metadata.token, timeoutMs: 1500 });
115
+ }
116
+ catch {
117
+ try {
118
+ process.kill(status.metadata.pid, "SIGTERM");
119
+ }
120
+ catch {
121
+ // best effort
122
+ }
123
+ }
124
+ }
125
+ else {
126
+ try {
127
+ process.kill(status.metadata.pid, "SIGTERM");
128
+ }
129
+ catch {
130
+ // best effort
131
+ }
132
+ }
133
+ (0, daemon_state_1.removeDaemonMetadata)(env);
134
+ (0, write_1.write)(stdout, "BlueNote daemon stopped\nstatus: stopped\n");
135
+ return 0;
136
+ }
137
+ async function runDaemon(args = [], io = {}) {
138
+ const stdout = io.stdout || process.stdout;
139
+ const stderr = io.stderr || process.stderr;
140
+ const command = args[0];
141
+ if (!command || command === "--help" || command === "-h" || command === "help") {
142
+ (0, write_1.write)(stdout, HELP_TEXT);
143
+ return 0;
144
+ }
145
+ if (command === "serve") {
146
+ const parsed = parseServeArgs(args.slice(1), io.env || process.env);
147
+ if (!parsed.statePath || !parsed.token || !parsed.version) {
148
+ (0, write_1.write)(stderr, "Missing daemon serve arguments.\n");
149
+ return 1;
150
+ }
151
+ await (0, server_1.startDaemonServer)({ statePath: parsed.statePath, token: parsed.token, version: parsed.version });
152
+ return 0;
153
+ }
154
+ if (command === "start")
155
+ return await startDaemon(io);
156
+ if (command === "status")
157
+ return await statusDaemon(io);
158
+ if (command === "stop")
159
+ return await stopDaemon(io);
160
+ (0, write_1.write)(stderr, `Unknown daemon command: ${command}\nRun "bluenote daemon --help" for usage.\n`);
161
+ return 1;
162
+ }
163
+ //# sourceMappingURL=daemon.js.map
@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