GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #73 from jamespaulengay/feature/stackpress-desktop · stackpress/stackpress@29aa864

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • bin
    • stackpress.mjs
  • package.json
  • packages
    • stackpress-desktop
      • LICENSE
      • README.md
      • package.json
      • plans
        • README.md
      • src
        • MenuRegistry.ts
        • config.ts
        • electron.d.ts
        • events
          • build.ts
          • dev.ts
          • index.ts
          • package.ts
        • index.ts
        • manifest.ts
        • plugin.ts
        • routeRules.ts
        • runtime.ts
        • scripts
          • build.ts
          • dev.ts
          • index.ts
          • main.ts
          • package.ts
          • preload.ts
        • types.ts
      • tests
        • MenuRegistry.test.ts
        • build-event.test.ts
        • config.test.ts
        • dev-event.test.ts
        • error-messages.test.ts
        • manifest.test.ts
        • package-event.test.ts
        • plugin.test.ts
        • routeRules.test.ts
        • runtime-route-guard.test.ts
        • runtime.test.ts
        • security.test.ts
      • tsconfig.cjs.json
      • tsconfig.esm.json
      • tsconfig.json
    • stackpress/src
      • index.ts
  • templates/blog
    • config
      • desktop.routes-exact.ts
      • desktop.routes-wildcard.ts
      • desktop.ts
    • package.json
    • plugins/app
      • plugin.ts
  • tests
    • skills-installer.test.mjs
  • yarn.lock

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bin/stackpress.mjs‎

Copy file name to clipboardExpand all lines: bin/stackpress.mjs
+84-2Lines changed: 84 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from 'node:fs/promises';
1515
import os from 'node:os';
1616
import path from 'node:path';
17+
import { spawn } from 'node:child_process';
1718
import { fileURLToPath } from 'node:url';
1819

1920
// supported skill installer shortcuts and their default homes
@@ -128,7 +129,7 @@ function parseArgs(args) {
128129
const [command, ...rest] = args;
129130

130131
if (!command) {
131-
throw new Error('Missing command. Usage: stackpress <skills|create>');
132+
throw new Error('Missing command. Usage: stackpress <event|skills|create>');
132133
}
133134

134135
if (command === 'create') {
@@ -139,7 +140,17 @@ function parseArgs(args) {
139140
return parseSkillsArgs(rest);
140141
}
141142

142-
throw new Error(`Unknown command "${command}". Usage: stackpress <skills|create>`);
143+
return parseRuntimeArgs(args);
144+
}
145+
146+
/**
147+
* Treats every non-installer command as a Stackpress runtime event.
148+
*/
149+
function parseRuntimeArgs(args) {
150+
return {
151+
command: 'runtime',
152+
args
153+
};
143154
}
144155

145156
/**
@@ -287,6 +298,11 @@ async function main() {
287298
return;
288299
}
289300

301+
if (options.command === 'runtime') {
302+
await runRuntimeCommand(root, options);
303+
return;
304+
}
305+
290306
await runSkillsCommand(root, options);
291307
}
292308

@@ -450,6 +466,68 @@ async function runSkillsCommand(root, options) {
450466
}
451467
}
452468

469+
/**
470+
* Returns the executable used to run the TypeScript Stackpress runtime CLI.
471+
*/
472+
async function resolveRuntimeCommand(root) {
473+
const runtimeBin = path.join(root, 'packages', 'stackpress-server', 'bin.ts');
474+
475+
if (!await safeStat(runtimeBin)) {
476+
throw new Error(
477+
'This lightweight Stackpress executable only bundles the create and '
478+
+ 'skills commands. Run framework events from an installed Stackpress '
479+
+ 'project, or install this monorepo before using runtime commands.'
480+
);
481+
}
482+
483+
const extension = process.platform === 'win32' ? '.cmd' : '';
484+
const localTsx = path.join(root, 'node_modules', '.bin', `tsx${extension}`);
485+
const runner = await safeStat(localTsx) ? localTsx : `tsx${extension}`;
486+
487+
return {
488+
args: [runtimeBin],
489+
runner
490+
};
491+
}
492+
493+
/**
494+
* Delegates normal Stackpress events to the framework runtime CLI.
495+
*/
496+
async function runRuntimeCommand(root, options) {
497+
const command = await resolveRuntimeCommand(root);
498+
499+
return await new Promise((resolve, reject) => {
500+
const child = spawn(command.runner, [...command.args, ...options.args], {
501+
cwd: process.cwd(),
502+
env: process.env,
503+
stdio: 'inherit'
504+
});
505+
506+
child.on('error', (error) => {
507+
if (error?.code === 'ENOENT') {
508+
reject(new Error(
509+
'Unable to run Stackpress runtime commands because tsx was not '
510+
+ 'found. Run yarn install from the repository root, then try again.'
511+
));
512+
return;
513+
}
514+
515+
reject(error);
516+
});
517+
518+
child.on('exit', (code, signal) => {
519+
if (signal) {
520+
process.kill(process.pid, signal);
521+
return;
522+
}
523+
524+
process.exitCode = code ?? 1;
525+
resolve();
526+
});
527+
});
528+
}
529+
530+
453531
/**
454532
* Reads file metadata and treats missing files as undefined.
455533
*/
@@ -471,10 +549,13 @@ async function safeStat(file) {
471549
function usage() {
472550
return [
473551
'Usage:',
552+
' stackpress <event> [options]',
474553
' stackpress create [--dry-run]',
475554
' stackpress skills --target <codex|claude|opencode|path> [--force] [--dry-run]',
476555
'',
477556
'Examples:',
557+
' stackpress develop --b config/develop -v',
558+
' stackpress serve --b config/preview -v',
478559
' stackpress create',
479560
' stackpress skills --target codex',
480561
' stackpress skills --target claude',
@@ -499,6 +580,7 @@ export {
499580
copySkills,
500581
createProject,
501582
parseArgs,
583+
resolveRuntimeCommand,
502584
resolveTargetDirectory
503585
};
504586

Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@
1818
"build:core": "yarn server build && yarn schema build && yarn sql build",
1919
"build:main": "yarn api build && yarn stackpress build",
2020
"build:util": "yarn csrf build && yarn language build && yarn email build && yarn ai build",
21+
"build:desktop": "yarn desktop build",
2122
"ai": "yarn --cwd packages/stackpress-ai",
2223
"build:view": "yarn view build && yarn session build && yarn admin build",
2324
"admin": "yarn --cwd packages/stackpress-admin",
2425
"api": "yarn --cwd packages/stackpress-api",
2526
"csrf": "yarn --cwd packages/stackpress-csrf",
27+
"desktop": "yarn --cwd packages/stackpress-desktop",
2628
"email": "yarn --cwd packages/stackpress-email",
2729
"language": "yarn --cwd packages/stackpress-language",
2830
"schema": "yarn --cwd packages/stackpress-schema",
Collapse file

‎packages/stackpress-desktop/LICENSE‎

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Stackpress
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 whom the Software is
10+
furnished to do so, subject to the 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.

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.