@spunto/build 0.27.0 → 0.28.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spunto/build",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "Spunto's shared Build engine — the devcontainer image protocol and VS Code extension registry clients, with no database, no HTTP framework and no UI.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -488,11 +488,14 @@ function buildLocalFeatureInstallScript(featureId: string, scriptFile: string):
488
488
 
489
489
  /**
490
490
  * A feature whose install script the caller hands over as text — embedded in the recipe like a
491
- * local one. What an app that serves its own feature gives (Spunto IDE's `ide.feature`, RFC 0059):
492
- * no registry in between, and the recipe's text, so its key, moves with the script.
491
+ * local one. What an app that serves its own feature gives (`feature.install`, RFC 0064): no
492
+ * registry in between, and the recipe's text, so its key, moves with the script. `entrypoint`: what
493
+ * a devcontainer-feature.json would declare — an executable the script installs, started at every
494
+ * start of the box (FEATURE_ENTRYPOINTS_FILE), registered once the script succeeded.
493
495
  */
494
- function buildInlineFeatureInstallScript(featureId: string, scriptContent: string): string {
496
+ function buildInlineFeatureInstallScript(featureId: string, scriptContent: string, entrypoint?: string): string {
495
497
  const encoded = b64(scriptContent)
498
+ if (entrypoint !== undefined && !/^\/[\w./-]+$/.test(entrypoint)) throw new Error(`entrypoint must be an absolute path, got ${JSON.stringify(entrypoint)}`)
496
499
  return [
497
500
  `echo "[feature] ${featureId}: running local install script..."`,
498
501
  `echo "${encoded}" | base64 -d > /tmp/_mp_feature.sh`,
@@ -506,6 +509,9 @@ function buildInlineFeatureInstallScript(featureId: string, scriptContent: strin
506
509
  ` echo "[feature] ${featureId} ✗ FAILED (exit $_LOCAL_EXIT)"`,
507
510
  ` exit $_LOCAL_EXIT`,
508
511
  `fi`,
512
+ ...(entrypoint
513
+ ? [`echo "${entrypoint}" >> ${FEATURE_ENTRYPOINTS_STAGING_FILE}`, `echo "[feature] ${featureId}: registered entrypoint ${entrypoint}"`]
514
+ : []),
509
515
  `echo "[feature] ${featureId} ✓ installed"`,
510
516
  ].join("\n")
511
517
  }
@@ -513,13 +519,13 @@ function buildInlineFeatureInstallScript(featureId: string, scriptContent: strin
513
519
  export type ResolvedFeature = { id: string; script: string; ociRef?: string }
514
520
 
515
521
  function resolveFeatures(
516
- features: { id: string; ociRef?: string; options?: Record<string, string>; script?: string }[],
522
+ features: { id: string; ociRef?: string; options?: Record<string, string>; script?: string; entrypoint?: string }[],
517
523
  warnId?: string,
518
524
  ): ResolvedFeature[] {
519
525
  const resolved: ResolvedFeature[] = []
520
526
  for (const f of features) {
521
527
  if (f.script) {
522
- resolved.push({ id: f.id, script: buildInlineFeatureInstallScript(f.id, f.script) })
528
+ resolved.push({ id: f.id, script: buildInlineFeatureInstallScript(f.id, f.script, f.entrypoint) })
523
529
  continue
524
530
  }
525
531
  const known = AVAILABLE_FEATURES.find((af) => af.id === f.id)
@@ -619,7 +625,7 @@ function spuntoPackOptions(params: { sshGatewayPublicKey?: string; codeServerInP
619
625
  // content, plus the version guard this copy never had: `set -as terminal-features` only exists from
620
626
  // tmux 3.2, and on an older base (Debian bullseye ships 3.1c) every client attaching to a worker
621
627
  // terminal got an "invalid option" banner to dismiss. The frontend's half of the clipboard story is
622
- // unchanged — see apps/next/lib/terminal-clipboard.ts.
628
+ // unchanged — see apps/dashboard/lib/terminal-clipboard.ts.
623
629
 
624
630
  // ─── code-server user settings ───────────────────────────────────────────────
625
631
  //
@@ -751,8 +757,11 @@ export function defaultVscodeUserSettings(opts?: {
751
757
  export const IMAGE_RECIPE_VERSION = 5
752
758
 
753
759
  export function buildImageScript(params: {
754
- /** `script`: the feature's install script itself, embedded as is (an app that serves its own). */
755
- features: { id: string; ociRef?: string; options?: Record<string, string>; script?: string }[]
760
+ /**
761
+ * `script`: the feature's install script itself, embedded as is (an app that serves its own), and
762
+ * `entrypoint` what it installs to run at every start, as a devcontainer-feature.json would say.
763
+ */
764
+ features: { id: string; ociRef?: string; options?: Record<string, string>; script?: string; entrypoint?: string }[]
756
765
  vscodeExtensions?: string[]
757
766
  sshGatewayPublicKey?: string
758
767
  /**