@acryldev/blends 1.7.14 → 1.7.16

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.
@@ -0,0 +1,107 @@
1
+ /**
2
+ * A product on Arch Linux (and Omarchy, which is Arch): a portable tarball beside the .deb, and a PKGBUILD that installs it. The tarball is the
3
+ * app folder electron-builder lays out (`linux-unpacked`) under `lib/`, a launcher, a .desktop file and the icon; the PKGBUILD downloads the tarball
4
+ * of the product's GitHub release and puts it in /opt/<name>, with the launcher on the PATH.
5
+ */
6
+
7
+ /** Arch's names for the CPUs the products are built for. */
8
+ export const ARCH_LINUX_CPU = { x64: 'x86_64', arm64: 'aarch64' }
9
+
10
+ /**
11
+ * What Electron needs on Arch: the libraries electron-builder's .deb depends on (libgtk-3-0, libnotify4, libnss3, libxss1, libxtst6, xdg-utils,
12
+ * libatspi2.0-0, libuuid1, libsecret-1-0, libasound2) under their Arch names, and git, which the app runs (it ships its own on macOS only).
13
+ */
14
+ export const ARCH_LINUX_DEPENDS = [
15
+ 'gtk3',
16
+ 'libnotify',
17
+ 'nss',
18
+ 'libxss',
19
+ 'libxtst',
20
+ 'xdg-utils',
21
+ 'at-spi2-core',
22
+ 'util-linux-libs',
23
+ 'libsecret',
24
+ 'alsa-lib',
25
+ 'git',
26
+ ]
27
+
28
+ /**
29
+ * The launcher at the top of the tarball. It finds the app beside itself through any symlink (the PKGBUILD links it into /usr/bin), lets Electron
30
+ * pick Wayland or X11 (Omarchy runs Hyprland on Wayland), and turns Chromium's sandbox off only where it cannot run: a chrome-sandbox that is not
31
+ * setuid root (an unpacked tarball) on a kernel that refuses unprivileged user namespaces (Ubuntu 24.04's AppArmor default). Arch allows them.
32
+ */
33
+ export function launcherScript(exe) {
34
+ return `#!/bin/sh
35
+ # ${exe}: starts the app in lib/ beside this file.
36
+ here=$(dirname -- "$(readlink -f -- "$0")")
37
+ set -- --ozone-platform-hint=auto "$@"
38
+ if [ ! -u "$here/lib/chrome-sandbox" ] && ! unshare -Ur true 2>/dev/null; then set -- --no-sandbox "$@"; fi
39
+ exec "$here/lib/${exe}" "$@"
40
+ `
41
+ }
42
+
43
+ /** The menu entry; Exec and Icon name the launcher and icon the PKGBUILD installs. */
44
+ export function desktopEntry({ exe, product, description }) {
45
+ return `[Desktop Entry]
46
+ Type=Application
47
+ Name=${product}
48
+ Comment=${description}
49
+ Exec=${exe} %U
50
+ Icon=${exe}
51
+ Terminal=false
52
+ Categories=Development;
53
+ StartupWMClass=${product}
54
+ `
55
+ }
56
+
57
+ /** The tarball a release carries for a CPU: `ACRYL-Control-Center-linux-x64.tar.gz`. */
58
+ export const tarballName = (fileName, arch) => `${fileName}-linux-${arch}.tar.gz`
59
+
60
+ /**
61
+ * The PKGBUILD for a release: one package for every CPU whose tarball is given (`tarballs: { x64: sha256, arm64: sha256 }`), each downloaded from
62
+ * the release's own assets. `version` is the release's (0.2.6 for the tag v0.2.6).
63
+ */
64
+ export function pkgbuildText({ exe, product, description, version, repo, fileName, tarballs }) {
65
+ if (!/^\d+\.\d+\.\d+$/u.test(version))
66
+ throw new Error(`pkgbuild: ${version} is not a release version (like 0.2.6)`)
67
+ if (!/^[\w.-]+\/[\w.-]+$/u.test(repo))
68
+ throw new Error(`pkgbuild: ${repo} is not a GitHub repository (owner/name)`)
69
+ const cpus = Object.keys(tarballs).filter((arch) => ARCH_LINUX_CPU[arch] !== undefined)
70
+ if (cpus.length === 0)
71
+ throw new Error('pkgbuild: no Linux tarball (x64 or arm64) to install from')
72
+ const quote = (text) => `'${text.replaceAll("'", '')}'`
73
+ const perCpu = cpus.flatMap((arch) => {
74
+ const cpu = ARCH_LINUX_CPU[arch]
75
+ const url = `https://github.com/${repo}/releases/download/v${version}/${tarballName(fileName, arch)}`
76
+ return [
77
+ `source_${cpu}=("${exe}-${version}-${cpu}.tar.gz::${url}")`,
78
+ `sha256sums_${cpu}=('${tarballs[arch]}')`,
79
+ ]
80
+ })
81
+ return `# ${product} for Arch Linux and Omarchy: makepkg -si installs the release's tarball in /opt/${exe}.
82
+ # Maintainer: ACRYL Blends <build@acryldev.dev>
83
+ pkgname=${exe}-bin
84
+ pkgver=${version}
85
+ pkgrel=1
86
+ pkgdesc=${quote(description)}
87
+ arch=(${cpus.map((arch) => `'${ARCH_LINUX_CPU[arch]}'`).join(' ')})
88
+ url='https://github.com/${repo}'
89
+ license=('MIT')
90
+ depends=(${ARCH_LINUX_DEPENDS.map((name) => `'${name}'`).join(' ')})
91
+ provides=('${exe}')
92
+ conflicts=('${exe}')
93
+ options=('!strip' '!debug')
94
+ ${perCpu.join('\n')}
95
+
96
+ package() {
97
+ install -d "$pkgdir/opt/${exe}" "$pkgdir/usr/bin"
98
+ cp -a "$srcdir/${exe}/." "$pkgdir/opt/${exe}/"
99
+ # Chromium's sandbox helper must be setuid root, as the .deb installs it.
100
+ chmod 4755 "$pkgdir/opt/${exe}/lib/chrome-sandbox"
101
+ ln -s "/opt/${exe}/${exe}" "$pkgdir/usr/bin/${exe}"
102
+ install -Dm644 "$srcdir/${exe}/${exe}.desktop" "$pkgdir/usr/share/applications/${exe}.desktop"
103
+ install -Dm644 "$srcdir/${exe}/${exe}.png" "$pkgdir/usr/share/pixmaps/${exe}.png"
104
+ if [ -f "$srcdir/${exe}/LICENSE" ]; then install -Dm644 "$srcdir/${exe}/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"; fi
105
+ }
106
+ `
107
+ }
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * node scripts/pack-blank-mac.mjs [--out <dir>] [--arch arm64|x64]
7
7
  * node scripts/pack-blank-mac.mjs --from acrylblends.small-crm [--product "Small CRM"] a registry blueprint as its own product
8
- * node scripts/pack-blank-mac.mjs --from ../apps/acryl-ade --product "ACRYL ADE" --tag-prefix ade-v a product of a repository that releases several
8
+ * node scripts/pack-blank-mac.mjs --from ../my-blend --product "My Blend" --tag-prefix my-blend-v a product of a repository that releases several
9
9
  * npx @acryldev/blends pack --from . --product "ACRYL ADE" the same from a Blend's own repository, with the published packages
10
10
  *
11
11
  * The DMG carries the app itself: the frame and the Blank app it builds in, with Electron's own Node, so it needs no Node, npm or git. The bundle is
@@ -31,6 +31,7 @@ import {
31
31
  import { tmpdir } from 'node:os'
32
32
  import { basename, dirname, join, resolve } from 'node:path'
33
33
  import { fileURLToPath, pathToFileURL } from 'node:url'
34
+ import { desktopEntry, launcherScript, tarballName } from './lib/arch-linux.mjs'
34
35
  import { createSource, repositoryOnlyIn } from './lib/create-source.mjs'
35
36
 
36
37
  const root = resolve(dirname(fileURLToPath(import.meta.url)), '..')
@@ -450,6 +451,8 @@ const DESCRIPTION =
450
451
  : `${PRODUCT}, an ACRYL Blends app (${from}), in the frame: change it from the chat.`
451
452
  const FILE_NAME =
452
453
  from === undefined ? 'ACRYL-Blends-Blank' : PRODUCT.replace(/[^A-Za-z0-9]+/gu, '-')
454
+ /** The program's name on Linux: acryl-control-center. */
455
+ const EXE = FILE_NAME.toLowerCase()
453
456
  // Seal the bundle ad hoc, after the builder has laid it out and before the DMG is made. With no signing step the main program keeps Electron's linker
454
457
  // signature (identifier `Electron`, no sealed resources, Info.plist not bound), so the bundle was not sealed and `codesign --verify --deep --strict` failed.
455
458
  // An ad hoc seal makes every file of the bundle part of the signature: an app that writes into its own bundle shows at once. No hardened runtime: the
@@ -514,6 +517,8 @@ manifest.build = {
514
517
  category: 'Development',
515
518
  icon: appIcon,
516
519
  maintainer: 'ACRYL Blends <build@acryldev.dev>',
520
+ // One name for the program on every Linux: the .deb's, the tarball's launcher and the PKGBUILD's (acryl-control-center).
521
+ executableName: EXE,
517
522
  },
518
523
  ...(platform === 'mac' ? { afterPack: join(work, 'seal-bundle.cjs') } : {}),
519
524
  }
@@ -695,4 +700,27 @@ for (const file of readdirSync(out))
695
700
  if (file.endsWith(EXTENSION)) rmSync(join(out, file), { force: true })
696
701
  const target = join(out, `${FILE_NAME}-${platform}-${arch}${EXTENSION}`)
697
702
  cpSync(join(app, 'dist', produced[0]), target)
703
+ // 7. On Linux also a portable tarball (Arch Linux, Omarchy, any distribution without dpkg): the app folder the builder laid out for the .deb, under
704
+ // lib/, with a launcher, a menu entry and the icon (lib/arch-linux.mjs). `acrylblends pkgbuild` makes the PKGBUILD that installs it.
705
+ if (platform === 'linux') {
706
+ const unpacked = readdirSync(join(app, 'dist')).find((name) => /^linux.*-unpacked$/u.test(name))
707
+ if (unpacked === undefined)
708
+ throw new Error('electron-builder left no linux-unpacked folder for the tarball')
709
+ const portable = join(work, 'portable', EXE)
710
+ rmSync(join(work, 'portable'), { recursive: true, force: true })
711
+ mkdirSync(portable, { recursive: true })
712
+ execFileSync('cp', ['-a', join(app, 'dist', unpacked), join(portable, 'lib')])
713
+ writeFileSync(join(portable, EXE), launcherScript(EXE), { mode: 0o755 })
714
+ writeFileSync(
715
+ join(portable, `${EXE}.desktop`),
716
+ desktopEntry({ exe: EXE, product: PRODUCT, description: DESCRIPTION }),
717
+ )
718
+ cpSync(appIcon, join(portable, `${EXE}.png`))
719
+ // The app's licence, which the PKGBUILD installs where Arch looks for it (/usr/share/licenses).
720
+ if (existsSync(join(app, 'LICENSE'))) cpSync(join(app, 'LICENSE'), join(portable, 'LICENSE'))
721
+ const tarball = join(out, tarballName(FILE_NAME, arch))
722
+ rmSync(tarball, { force: true })
723
+ execFileSync('tar', ['-czf', tarball, '-C', join(work, 'portable'), EXE])
724
+ log(`portable: ${tarball} (${String(Math.round(statSync(tarball).size / 1024 / 1024))} MB)`)
725
+ }
698
726
  log(`done: ${target} (${String(Math.round(statSync(target).size / 1024 / 1024))} MB)`)
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * `acrylblends pkgbuild --dir <release files> --product "Name" --version 0.2.6 --repo owner/name`: the PKGBUILD (Arch Linux, Omarchy) for a release,
4
+ * written into <dir> beside the Linux tarballs `acrylblends pack` made there; it installs from the release's own assets, so it goes up with them.
5
+ */
6
+ import { createHash } from 'node:crypto'
7
+ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
8
+ import { join, resolve } from 'node:path'
9
+ import { parseArgs } from 'node:util'
10
+ import { pkgbuildText, tarballName } from './lib/arch-linux.mjs'
11
+
12
+ const { values } = parseArgs({
13
+ options: {
14
+ dir: { type: 'string' },
15
+ product: { type: 'string' },
16
+ version: { type: 'string' },
17
+ repo: { type: 'string' },
18
+ },
19
+ })
20
+ for (const name of ['dir', 'product', 'version', 'repo'])
21
+ if (values[name] === undefined) {
22
+ console.error(
23
+ `pkgbuild: --${name} is missing (acrylblends pkgbuild --dir out --product "Name" --version 0.2.6 --repo owner/name)`,
24
+ )
25
+ process.exit(2)
26
+ }
27
+ const dir = resolve(values.dir)
28
+ const product = values.product
29
+ const fileName = product.replace(/[^A-Za-z0-9]+/gu, '-')
30
+ const tarballs = {}
31
+ for (const arch of ['x64', 'arm64']) {
32
+ const file = join(dir, tarballName(fileName, arch))
33
+ if (existsSync(file))
34
+ tarballs[arch] = createHash('sha256').update(readFileSync(file)).digest('hex')
35
+ }
36
+ const text = pkgbuildText({
37
+ exe: fileName.toLowerCase(),
38
+ product,
39
+ description: `${product}, an ACRYL Blends app`,
40
+ version: values.version.replace(/^v/u, ''),
41
+ repo: values.repo,
42
+ fileName,
43
+ tarballs,
44
+ })
45
+ writeFileSync(join(dir, 'PKGBUILD'), text)
46
+ console.log(`pkgbuild: ${join(dir, 'PKGBUILD')} for ${Object.keys(tarballs).join(', ')}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/blends",
3
- "version": "1.7.14",
3
+ "version": "1.7.16",
4
4
  "description": "The Acryl web framework (import { Acryl } from \"acrylblends\") and the acrylblends command that scaffolds Cordis apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/builder",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The agent's tools for building the app it runs in: write, install, read, list and remove extensions, with real results.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -6,7 +6,7 @@
6
6
  "provides": [],
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
- "@acryldev/blends-core": "0.6.0",
9
+ "@acryldev/blends-core": "0.6.1",
10
10
  "@acryldev/plugin-hub-core": "0.2.3"
11
11
  },
12
12
  "mount": "mount it after agent and extensions: root.plugin(builder, { dir: join(root, 'plugins') }); dir must be an extensions source",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/extensions",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Install, update, remove and reload plugins while the app runs; a failed update brings the previous version back; a ledger of every change.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -6,7 +6,7 @@
6
6
  "provides": ["extensions"],
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
- "@acryldev/blends-core": "0.6.0"
9
+ "@acryldev/blends-core": "0.6.1"
10
10
  },
11
11
  "mount": "mount it after instance: root.plugin(extensions, { sources: [{ dir: join(root, 'plugins'), trust: 'install' }] })",
12
12
  "entries": {
@@ -68,6 +68,11 @@ export interface Metadata {
68
68
  readonly license?: string
69
69
  /** Anything but an explicit `public` is private: `save` never pushes a private app to a public remote. */
70
70
  readonly visibility?: 'private' | 'public'
71
+ /**
72
+ * Where the app came from, written by @acryldev/create-blends: a registry Blend at a version (`acrylblends.notes#0.3.1`) or a GitHub
73
+ * repository at a tag (`github:ana/notes#v0.2.0`). `acrylblends update` brings that source's newer releases in.
74
+ */
75
+ readonly from?: string
71
76
  }
72
77
 
73
78
  /** Which Blueprint, at which version, a Blend was made from. */
@@ -142,6 +147,7 @@ const METADATA_FIELDS = new Set([
142
147
  'description',
143
148
  'license',
144
149
  'visibility',
150
+ 'from',
145
151
  ])
146
152
  const SPEC_FIELDS = new Set(['runtime', 'extends', 'lineage', 'parameters', 'rows', 'overrides'])
147
153
  const ROW_FIELDS = new Set(['id', 'name', 'config', 'disabled'])
@@ -208,6 +214,8 @@ export function validate(document: unknown, known?: Iterable<string>): Diagnosti
208
214
  metadata.visibility !== 'public'
209
215
  )
210
216
  add('schema-error', 'metadata.visibility', "must be 'private' or 'public'")
217
+ if (metadata.from !== undefined && (typeof metadata.from !== 'string' || metadata.from.trim() === ''))
218
+ add('schema-error', 'metadata.from', "must name a source such as 'acrylblends.notes#0.3.1' or 'github:ana/notes#v0.2.0'")
211
219
  }
212
220
 
213
221
  const spec = document.spec
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/manifest",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The app as data: blend.yaml lists ordered plugin rows with config, parameters and on/off switches; validated, composed and locked.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "yaml": "2.9.0",
10
- "@acryldev/blends-core": "0.6.0"
10
+ "@acryldev/blends-core": "0.6.1"
11
11
  },
12
12
  "mount": "in src/app.ts: const manifest = loadManifest(join(chosen.root, 'blend.yaml')); await compose(root, manifest, registry)",
13
13
  "entries": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acryldev/plugin-share",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Share plugins between people. Pull one someone released into the running app: fetched without running anything, checked by digest and for every OS, then installed live. Publish one, only as a plan a person confirmed.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -7,7 +7,7 @@
7
7
  "dependencies": {
8
8
  "@deepseek-ai/cordis": "4.0.4",
9
9
  "@acryldev/app-persistence": "0.1.6",
10
- "@acryldev/blends-core": "0.6.0",
10
+ "@acryldev/blends-core": "0.6.1",
11
11
  "@acryldev/plugin-hub-core": "0.2.3",
12
12
  "yaml": "2.9.0"
13
13
  },
@@ -27,8 +27,8 @@ import {
27
27
  type Visibility,
28
28
  withId,
29
29
  withLicense,
30
- withVersion,
31
30
  withPlacement,
31
+ withVersion,
32
32
  withVisibility,
33
33
  } from '@acryldev/app-persistence'
34
34
 
@@ -294,7 +294,8 @@ function writeListing(
294
294
  // The release this share tags: when planListing moved past an existing tag, the app carries the new version in both files.
295
295
  const version = listing.tag.replace(/^v/u, '')
296
296
  const bumped = typeof pkg.version === 'string' && pkg.version !== version
297
- if (bumped || (pkg.version === undefined && identity.version !== version)) text = withVersion(text, version)
297
+ if (bumped || (pkg.version === undefined && identity.version !== version))
298
+ text = withVersion(text, version)
298
299
  if (text !== manifestText) writeFileSync(join(appRoot, 'blend.yaml'), text)
299
300
  const before = Array.isArray(pkg.keywords)
300
301
  ? pkg.keywords.filter((word): word is string => typeof word === 'string')