jkunzandClaude Opus 5.5 7805d2ae4f feat: initial craftkit for the workspace.global webdesktop
Shared parts of the workspace.global Craft app wrappers: the frame-app shim, and the build step that downloads, verifies and unpacks a Craft app's released web build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 17:58:08 +00:00

@workspace.global/craftkit

The shared parts of the workspace.global Craft app wrappers: the shim that runs a Craft app's released WebAssembly build as a frame app in the webdesktop, and the build step that downloads, verifies and unpacks that build.

Issue Reporting and Security

For reporting bugs, issues, or security vulnerabilities, please visit community.foss.global/. This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a code.foss.global/ account to submit Pull Requests directly.

How a wrapper uses it

A wrapper package (@workspace.global/<app>) holds a manifest (workspace.app.json), a pin (upstream.json), a two-line shim page and these three pieces of code:

// ts_web/index.ts: bundled into dist_app/shim.js
import { startCraftShim } from '@workspace.global/craftkit/web';
startCraftShim({ appId: 'gridcraft', appName: 'GridCraft', bridge: 'gridcraft' });
// ts/index.ts: what the webdesktop server imports
import { getCraftWrapper } from '@workspace.global/craftkit';
export const { manifest, appDir, upstreamPin } = getCraftWrapper(packageDir);
// package.json scripts
"build": "tsbuild tsfolders --allowimplicitany && tsbundle && craftkit upstream",
"test": "tsbuild tsfolders --allowimplicitany && tstest test/ --verbose --timeout 60"

craftkit upstream downloads the pinned asset once into .nogit/upstream/, checks its size and sha256, and unpacks it unmodified into dist_app/app/. craftkit check lists what is wrong with the manifest and pin (also validateCraftWrapper() for the wrapper's test).

The shim

startCraftShim() loads ./app/index.html in an iframe on the shim page's origin and:

  • shows a loading notice until the app has started: its bridge's ready, or what its loader leaves on window (wasmBindings, <id>Load.readyMs), or 30 s after the page loaded
  • asks the webdesktop to raise the window when the user presses inside the app ({ wg: 1, type: 'focus' })
  • follows the webdesktop's light or dark mode itself and sets it as the iframe's color-scheme; the Craft apps take no theme from outside
  • for apps with a parent bridge (bridge: '<prefix>', loaded with ?host=parent): turns <prefix>:save into a browser download, reports the document name and unsaved state as the window title ({ wg: 1, type: 'title' }), and shows <prefix>:failed

Options: appQuery sets the app's own start flags (for example DeckCraft's blank), passQuery hands shim query parameters on (for example file), background sets the colours shown while loading.

Build and test

pnpm install
pnpm run build
pnpm test

License

MIT. The Craft apps the wrappers ship are dual-licensed MIT OR Apache-2.0 by their authors; their ArtCraft name and logos are trademarks that may be used only unmodified.

S
Description
Shared parts of the workspace.global Craft app wrappers: the frame-app shim, and the build step that downloads, verifies and unpacks a Craft app's released web build.
Readme
98 KiB
Languages
TypeScript 99.6%
JavaScript 0.4%