@spikonado/sprocket 0.3.3 → 0.3.4-dev.0723ea286bd91244bffbfa3258490e0176dbd64a

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 (43) hide show
  1. package/README.md +15 -0
  2. package/bin/sprocket.js +1 -1
  3. package/lib/launcher.js +36 -10
  4. package/lib/update-api.js +5 -0
  5. package/lib/update.js +1036 -0
  6. package/package.json +6 -6
  7. package/web/_app/immutable/assets/0.D9kFaRQb.css +2 -0
  8. package/web/_app/immutable/assets/2.CMU7pdv8.css +1 -0
  9. package/web/_app/immutable/chunks/2EswWPt9.js +70 -0
  10. package/web/_app/immutable/chunks/Bb3byk3I.js +1 -0
  11. package/web/_app/immutable/chunks/CH-DwAqy.js +1 -0
  12. package/web/_app/immutable/chunks/CirtoWSJ.js +3 -0
  13. package/web/_app/immutable/chunks/{mPrToSgq.js → CrHmoVyY.js} +1 -1
  14. package/web/_app/immutable/chunks/D9pQdF5A.js +6 -0
  15. package/web/_app/immutable/chunks/{PSXYTcvE.js → VSK6LhsJ.js} +1 -1
  16. package/web/_app/immutable/chunks/{CeNjyCLa.js → aSUXxYi9.js} +2 -2
  17. package/web/_app/immutable/chunks/mWKhuXx1.js +1 -0
  18. package/web/_app/immutable/entry/app.BBG1Yap2.js +2 -0
  19. package/web/_app/immutable/entry/start.Cvp5ASMH.js +1 -0
  20. package/web/_app/immutable/nodes/0.CgqhmoX9.js +1 -0
  21. package/web/_app/immutable/nodes/1.Bww2K8_U.js +1 -0
  22. package/web/_app/immutable/nodes/2.Duq09sCo.js +127 -0
  23. package/web/_app/immutable/nodes/3.DxMC56lQ.js +1 -0
  24. package/web/_app/immutable/nodes/4.DNmFN8Yx.js +1 -0
  25. package/web/_app/version.json +1 -1
  26. package/web/callback.html +16 -16
  27. package/web/index.html +13 -13
  28. package/web/pair.html +16 -17
  29. package/web/_app/immutable/assets/0.Btn1dfCy.css +0 -2
  30. package/web/_app/immutable/chunks/BQbJFoq8.js +0 -1
  31. package/web/_app/immutable/chunks/BxbMz3h1.js +0 -1
  32. package/web/_app/immutable/chunks/CrsnnmTA.js +0 -1
  33. package/web/_app/immutable/chunks/D-3DgMVM.js +0 -3
  34. package/web/_app/immutable/chunks/D_7QcTZV.js +0 -6
  35. package/web/_app/immutable/chunks/Dtk4_9sS.js +0 -64
  36. package/web/_app/immutable/chunks/OmCPj9EG.js +0 -7
  37. package/web/_app/immutable/entry/app.D45zMGUe.js +0 -2
  38. package/web/_app/immutable/entry/start.DjZ5YK4X.js +0 -1
  39. package/web/_app/immutable/nodes/0.mG7tw7cg.js +0 -1
  40. package/web/_app/immutable/nodes/1.C19uY9DR.js +0 -1
  41. package/web/_app/immutable/nodes/2.Bq6t6SjB.js +0 -127
  42. package/web/_app/immutable/nodes/3.DBnPhkDo.js +0 -1
  43. package/web/_app/immutable/nodes/4.C52Ki53w.js +0 -1
package/README.md CHANGED
@@ -63,6 +63,9 @@ Override with `SPROCKET_DATA_DIR`.
63
63
 
64
64
  | Command | Behavior |
65
65
  | --------------------------- | ------------------------------------------------------------------------------ |
66
+ | `sprocket update` | Update a global npm, bun, pnpm, or yarn install on the current channel. |
67
+ | `sprocket update --check` | Report whether an update is available without installing. |
68
+ | `sprocket upgrade` | Alias for `update`. |
66
69
  | `sprocket serve` | Run the local server in the foreground without launching a client. |
67
70
  | `sprocket serve --api-only` | Serve only `/api`; intended for development (see [Development](#development)). |
68
71
 
@@ -105,12 +108,21 @@ bun dev
105
108
  After creating a Convex deployment and configuring AuthKit, give the deployment an API key for each model provider you want to enable.
106
109
 
107
110
  This runs Vite at `http://localhost:5173` and the Rust API at `http://127.0.0.1:7731`, with development state kept in `.sprocket-dev` inside the repository.
111
+ It targets the dev Convex deployment. To run against the production Convex
112
+ deployment with `~/.sprocket` state instead:
113
+
114
+ ```sh
115
+ bun dev:prod
116
+ ```
117
+
108
118
  To develop against Electron instead, run:
109
119
 
110
120
  ```sh
111
121
  bun dev:desktop
112
122
  ```
113
123
 
124
+ The `dev:prod` / `dev:prod:desktop` variants use the production Convex deployment and `~/.sprocket`.
125
+
114
126
  ### Building and testing
115
127
 
116
128
  ```sh
@@ -132,6 +144,9 @@ Published installers come from GitHub Releases; the `sprocket` CLI is published
132
144
  ## Troubleshooting
133
145
 
134
146
  - If `17731` is already occupied, set `SPROCKET_PORT` before launching.
147
+ - If installed sign-in cannot save or restore its native session, check that
148
+ your operating system credential service is available. Linux development
149
+ environments need a working Secret Service provider.
135
150
  - If `sprocket` opens the browser instead of the desktop app, install `sprocket-desktop` from [GitHub Releases](https://github.com/spikonado/sprocket/releases) onto `PATH`, or set `SPROCKET_DESKTOP_EXECUTABLE`.
136
151
  - Unsigned macOS and Windows desktop builds may need a Gatekeeper / SmartScreen override the first time you open them.
137
152
  - Contact [aarav@spikonado.com](mailto:aarav@spikonado.com) for help.
package/bin/sprocket.js CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  import { launch } from '../lib/launcher.js';
4
4
 
5
- launch(process.argv.slice(2));
5
+ await launch(process.argv.slice(2));
package/lib/launcher.js CHANGED
@@ -2,7 +2,8 @@ import { spawnSync } from 'node:child_process';
2
2
  import { accessSync, chmodSync, constants, readFileSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import path from 'node:path';
5
- import { fileURLToPath } from 'node:url';
5
+
6
+ import { createHost, parseUpdateArgs, runUpdateCli, UPDATE_API_FILENAME } from './update.js';
6
7
 
7
8
  const require = createRequire(import.meta.url);
8
9
 
@@ -74,20 +75,45 @@ export function run(binary, args, options = {}) {
74
75
  return result.status ?? 1;
75
76
  }
76
77
 
77
- export function launch(args) {
78
+ export function nativeChildEnvironment(env, staticDir, updateNode, updateScript) {
79
+ const next = {
80
+ ...env,
81
+ SPROCKET_STATIC_DIR: env.SPROCKET_STATIC_DIR || staticDir,
82
+ SPROCKET_UPDATE_NODE: updateNode,
83
+ SPROCKET_UPDATE_SCRIPT: updateScript
84
+ };
85
+ delete next.SPROCKET_UPDATE_MANAGED;
86
+ return next;
87
+ }
88
+
89
+ export async function launch(args, options = {}) {
90
+ const env = { ...(options.env ?? process.env) };
91
+ delete env.SPROCKET_UPDATE_MANAGED;
92
+ const parsed = parseUpdateArgs(args);
93
+ if (parsed.kind !== 'none') {
94
+ const code = await runUpdateCli(parsed, options.host ?? createHost({ env }));
95
+ process.exitCode = code;
96
+ return code;
97
+ }
98
+
78
99
  try {
79
- const packageRoot = path.dirname(fileURLToPath(import.meta.url));
80
- const staticDir = path.resolve(packageRoot, '../web');
81
- const binary = resolveNativeBinary();
82
- ensureExecutable(binary);
100
+ const libDir = options.libDir ?? import.meta.dirname;
101
+ const staticDir = path.resolve(libDir, '../web');
102
+ const binary = (options.resolveBinary ?? resolveNativeBinary)();
103
+ (options.ensureExecutable ?? ensureExecutable)(binary);
83
104
  process.exitCode = run(binary, args, {
84
- env: {
85
- ...process.env,
86
- SPROCKET_STATIC_DIR: process.env.SPROCKET_STATIC_DIR || staticDir
87
- }
105
+ env: nativeChildEnvironment(
106
+ env,
107
+ staticDir,
108
+ options.execPath ?? process.execPath,
109
+ path.resolve(libDir, UPDATE_API_FILENAME)
110
+ ),
111
+ spawn: options.spawn
88
112
  });
113
+ return process.exitCode;
89
114
  } catch (error) {
90
115
  console.error(`sprocket: ${error.message}`);
91
116
  process.exitCode = 1;
117
+ return 1;
92
118
  }
93
119
  }
@@ -0,0 +1,5 @@
1
+ import { runUpdateApi } from './update.js';
2
+
3
+ const { exitCode, payload } = await runUpdateApi(process.argv[2]);
4
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
5
+ process.exitCode = exitCode;