@gtkx/config 2.0.0-beta.11 → 2.0.0-beta.12

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 (67) hide show
  1. package/README.md +2 -2
  2. package/dist/builtin-elements.d.ts +11 -0
  3. package/dist/builtin-elements.d.ts.map +1 -0
  4. package/dist/builtin-elements.js +329 -0
  5. package/dist/builtin-elements.js.map +1 -0
  6. package/dist/config-dependencies.d.ts +5 -3
  7. package/dist/config-dependencies.d.ts.map +1 -1
  8. package/dist/config-dependencies.js +54 -22
  9. package/dist/config-dependencies.js.map +1 -1
  10. package/dist/config-error.d.ts.map +1 -1
  11. package/dist/config-error.js.map +1 -1
  12. package/dist/config-reloader.d.ts.map +1 -1
  13. package/dist/config-reloader.js +2 -8
  14. package/dist/config-reloader.js.map +1 -1
  15. package/dist/config-source.d.ts +3 -1
  16. package/dist/config-source.d.ts.map +1 -1
  17. package/dist/config-source.js +17 -2
  18. package/dist/config-source.js.map +1 -1
  19. package/dist/config.d.ts +34 -10
  20. package/dist/config.d.ts.map +1 -1
  21. package/dist/config.js +56 -2
  22. package/dist/config.js.map +1 -1
  23. package/dist/deploy.d.ts +64 -6
  24. package/dist/deploy.d.ts.map +1 -1
  25. package/dist/deploy.js +168 -10
  26. package/dist/deploy.js.map +1 -1
  27. package/dist/index.d.ts +2 -2
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/internal.d.ts +2 -2
  31. package/dist/internal.d.ts.map +1 -1
  32. package/dist/internal.js +2 -2
  33. package/dist/internal.js.map +1 -1
  34. package/dist/loader.d.ts +2 -0
  35. package/dist/loader.d.ts.map +1 -1
  36. package/dist/loader.js +15 -20
  37. package/dist/loader.js.map +1 -1
  38. package/dist/resource-base-path.d.ts.map +1 -1
  39. package/dist/schema-text.d.ts.map +1 -1
  40. package/dist/user-event-signals.d.ts.map +1 -1
  41. package/dist/virtual.d.ts +1 -1
  42. package/dist/virtual.d.ts.map +1 -1
  43. package/dist/virtual.js +3 -2
  44. package/dist/virtual.js.map +1 -1
  45. package/dist/vite-plugin.d.ts +2 -0
  46. package/dist/vite-plugin.d.ts.map +1 -1
  47. package/dist/vite-plugin.js +4 -3
  48. package/dist/vite-plugin.js.map +1 -1
  49. package/dist/vite-root.d.ts.map +1 -1
  50. package/package.json +14 -29
  51. package/src/builtin-elements.ts +338 -0
  52. package/src/config-dependencies.ts +61 -27
  53. package/src/config-error.ts +5 -3
  54. package/src/config-reloader.ts +2 -11
  55. package/src/config-source.ts +25 -2
  56. package/src/config.ts +65 -4
  57. package/src/deploy.ts +204 -25
  58. package/src/index.ts +9 -2
  59. package/src/internal.ts +2 -2
  60. package/src/loader.ts +24 -29
  61. package/src/virtual.ts +5 -4
  62. package/src/vite-plugin.ts +9 -2
  63. package/dist/static-dependencies.d.ts +0 -3
  64. package/dist/static-dependencies.d.ts.map +0 -1
  65. package/dist/static-dependencies.js +0 -350
  66. package/dist/static-dependencies.js.map +0 -1
  67. package/src/static-dependencies.ts +0 -464
package/src/config.ts CHANGED
@@ -30,7 +30,8 @@ type ResolvedReactCompilerOptions = ReactCompilerOptions & {
30
30
  type Config = z.infer<typeof configSchema>;
31
31
  type ModuleExport = z.infer<typeof moduleExportSchema>;
32
32
  type ElementPropsExport = z.infer<typeof elementPropsSchema>;
33
- type ElementConfigEntry = z.infer<typeof elementConfigSchema>;
33
+ /** Overrides for one GLib type in `elements.config`, keyed by its registered type name. */
34
+ type ElementConfigOptions = z.infer<typeof elementConfigSchema>;
34
35
 
35
36
  type McpSettings = {
36
37
  tools: string[];
@@ -63,8 +64,10 @@ const COMPILATION_MODES = ["infer", "syntax", "annotation", "all"] as const;
63
64
  const PANIC_THRESHOLDS = ["none", "critical_errors", "all_errors"] as const;
64
65
  const REACT_COMPILER_TARGET = "19";
65
66
 
66
- const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"')
67
- .refine((library) => !IMPLICIT_LIBRARIES.has(library), { error: "is bound implicitly; remove it" });
67
+ const librarySchema = girLibrary('must be of the form "Name-Version", such as "Adw-1"').refine(
68
+ (library) => !IMPLICIT_LIBRARIES.has(library),
69
+ { error: "is bound implicitly; remove it" },
70
+ );
68
71
 
69
72
  const librariesSchema = z
70
73
  .array(librarySchema, { error: "must be a non-empty string array or omitted" })
@@ -79,7 +82,9 @@ const applicationIdSchema = z
79
82
  const reactCompilerSchema = z.union([
80
83
  z.boolean(),
81
84
  z.strictObject({
85
+ /** Which functions the React Compiler processes. */
82
86
  compilationMode: z.enum(COMPILATION_MODES).optional(),
87
+ /** Which React Compiler diagnostics fail the build. */
83
88
  panicThreshold: z.enum(PANIC_THRESHOLDS).optional(),
84
89
  }),
85
90
  ]);
@@ -97,22 +102,35 @@ const userEventSignalsSchema = z.record(
97
102
 
98
103
  const moduleExportSchema = z.strictObject(
99
104
  {
105
+ /** Module specifier containing the named export. */
100
106
  module: z.string({ error: "must be a module specifier" }).min(1, { error: "must be a module specifier" }),
107
+ /** Name of the export to import from the module. */
101
108
  export: z.string({ error: "must be an export name" }).min(1, { error: "must be an export name" }),
102
109
  },
103
110
  { error: "must be a { module, export } object" },
104
111
  );
105
112
 
106
113
  const elementPropsSchema = moduleExportSchema.extend({
114
+ /**
115
+ * How the exported props are combined: `intersection` is inherited; `factory` applies only to this type.
116
+ * Defaults to `intersection`.
117
+ */
107
118
  composition: z.enum(["factory", "intersection"]).optional(),
119
+ /** Props that can only be set when the element is created; changing them afterward throws. */
108
120
  constructOnly: z.array(z.string()).optional(),
109
121
  });
110
122
 
123
+ /** Schema for one element override and the source of {@link ElementConfigOptions}. */
111
124
  const elementConfigSchema = z.strictObject({
125
+ /** Component export that wraps the generated element. */
112
126
  component: moduleExportSchema.optional(),
127
+ /** Additional props type to combine with the generated element props. */
113
128
  props: elementPropsSchema.optional(),
129
+ /** Whether the parent container creates this element's GObject instead of the element constructing its own. */
114
130
  isLazy: z.boolean({ error: "must be a boolean" }).optional(),
131
+ /** Accepted child GLib type names to show in the generated element documentation. */
115
132
  acceptedChildTypes: z.array(z.string()).optional(),
133
+ /** GObject properties to leave out of generated props, such as properties managed by an element behavior. */
116
134
  omittedProps: z
117
135
  .array(
118
136
  z.string({ error: "must be a non-empty property name" }).min(1, {
@@ -124,24 +142,42 @@ const elementConfigSchema = z.strictObject({
124
142
  });
125
143
 
126
144
  const elementsSchema = z.strictObject({
145
+ /** Path, relative to the project root, of the module exporting the element behavior map. */
127
146
  behaviors: z
128
147
  .string({ error: "must be a path to a module exporting element behaviors" })
129
148
  .min(1, { error: "must be a path to a module exporting element behaviors" })
130
149
  .optional(),
150
+ /**
151
+ * Element configuration overrides keyed by GLib type name, such as `GtkWidget`.
152
+ * @see {@link ElementConfigOptions} for the fields accepted by each entry.
153
+ */
131
154
  config: z.record(z.string(), elementConfigSchema).optional(),
132
155
  });
133
156
 
134
157
  const agentsSchema = z.strictObject({
158
+ /**
159
+ * Whether codegen maintains the GTKX rules in `AGENTS.md` and creates a missing `CLAUDE.md` import.
160
+ * Defaults to `true`.
161
+ */
135
162
  rules: z.boolean({ error: "must be a boolean" }).optional(),
163
+ /** Whether codegen writes the generated element reference to `.gtkx/reference`. Defaults to `true`. */
136
164
  reference: z.boolean({ error: "must be a boolean" }).optional(),
137
165
  });
138
166
 
139
167
  const mcpSchema = z.strictObject({
168
+ /**
169
+ * Tool name patterns applied in order: `*` matches any text and a leading `!` excludes matches.
170
+ * Omitted, empty, or exclusion-only lists start with all tools; other lists start with none.
171
+ */
140
172
  tools: z
141
173
  .array(z.string({ error: "must be a tool name pattern" }).min(1, { error: "must be a tool name pattern" }), {
142
174
  error: "must be an array of tool name patterns",
143
175
  })
144
176
  .optional(),
177
+ /**
178
+ * Whether the MCP server exposes only inspection and reference tools, excluding app interactions.
179
+ * Defaults to `false`.
180
+ */
145
181
  readOnly: z.boolean({ error: "must be a boolean" }).optional(),
146
182
  });
147
183
 
@@ -158,6 +194,7 @@ const graduatedFutureSchema = z
158
194
  .strict();
159
195
 
160
196
  const deprecationsSchema = z.strictObject({
197
+ /** Deprecation identifiers whose warnings are suppressed. There are currently no accepted identifiers. */
161
198
  silence: z
162
199
  .array(z.never({ error: "does not name a current deprecation" }), {
163
200
  error: "must be an array of current deprecation ids",
@@ -167,17 +204,38 @@ const deprecationsSchema = z.strictObject({
167
204
 
168
205
  /** Schema every `gtkx.config.ts` is validated against, and the source of the {@link Config} type. */
169
206
  const configSchema = z.strictObject({
207
+ /**
208
+ * Additional GIR libraries to bind, such as `WebKit-6.0`.
209
+ * Adwaita and GTK are included implicitly and must not be listed.
210
+ */
170
211
  libraries: librariesSchema.optional(),
212
+ /** Additional GIR search directories. Relative paths are resolved from the project root. */
171
213
  girPath: z.array(z.string(), { error: "must be an array of strings if provided" }).optional(),
214
+ /** Required GApplication identifier, such as `com.example.Tasks`. */
172
215
  applicationId: applicationIdSchema,
216
+ /** Whether to enable the React Compiler, or options passed to it. Enabled by default. */
173
217
  reactCompiler: reactCompilerSchema.optional(),
218
+ /**
219
+ * Whether GTKX generates project bindings. Set to `false` to reuse an installed binding store.
220
+ * Defaults to `true`.
221
+ */
174
222
  codegen: z.boolean({ error: "must be a boolean" }).optional(),
223
+ /**
224
+ * Additional signals to suppress during React property updates, keyed by GLib type name.
225
+ * Entries extend the built-in signal lists.
226
+ */
175
227
  userEventSignals: userEventSignalsSchema.optional(),
228
+ /** Custom element behaviors and overrides for generated components, props, and documentation. */
176
229
  elements: elementsSchema.optional(),
230
+ /** Path to an icon theme directory or a single application icon file, relative to the project root. */
177
231
  applicationIcon: text("must be a path to an icon theme directory or a single icon file").optional(),
232
+ /** Application metadata, bundled runtime settings, and packaging options used by `gtkx deploy`. */
178
233
  deploy: deploySchema.optional(),
234
+ /** Controls the project instructions and reference files generated for coding agents. */
179
235
  agents: agentsSchema.optional(),
236
+ /** Default tool selection and access mode for the project's MCP server. Command-line flags take precedence. */
180
237
  mcp: mcpSchema.optional(),
238
+ /** Controls warnings for deprecated configuration and behavior. */
181
239
  deprecations: deprecationsSchema.optional(),
182
240
  });
183
241
 
@@ -242,7 +300,7 @@ const resolveLazyElements = (elements: Config["elements"]): string[] =>
242
300
 
243
301
  const elementEntryValues = <T>(
244
302
  elements: Config["elements"],
245
- pick: (entry: ElementConfigEntry) => T | undefined,
303
+ pick: (entry: ElementConfigOptions) => T | undefined,
246
304
  ): Record<string, T> =>
247
305
  Object.fromEntries(
248
306
  Object.entries(elements?.config ?? {}).flatMap(([type, entry]) => {
@@ -299,5 +357,8 @@ export {
299
357
  type McpSettings,
300
358
  type ResolvedReactCompilerOptions,
301
359
  type Config,
360
+ type ElementConfigOptions,
361
+ type ElementPropsExport,
362
+ type ModuleExport,
302
363
  type ResolvedConfig,
303
364
  };
package/src/deploy.ts CHANGED
@@ -1,14 +1,5 @@
1
1
  import { z } from "zod";
2
- import {
3
- fileExtension,
4
- flag,
5
- girLibrary,
6
- relativePathRecord,
7
- text,
8
- textList,
9
- textRecord,
10
- url,
11
- } from "./schema-text.ts";
2
+ import { fileExtension, flag, girLibrary, relativePathRecord, text, textList, textRecord, url } from "./schema-text.ts";
12
3
 
13
4
  const DEB_COMPRESSIONS = ["gzip", "none", "xz", "zstd"] as const;
14
5
  const DEB_SIGN_METHODS = ["debsign", "dpkg-sig"] as const;
@@ -69,50 +60,89 @@ const minimumLibraryVersionsSchema = z.record(girLibrary(LIBRARY_ID_ERROR), mini
69
60
  });
70
61
 
71
62
  const relationsSchema = z.strictObject({
63
+ /** Package relations expressed in Debian dependency syntax. */
72
64
  deb: textList("Debian package relation", "must be an array of Debian package relations").optional(),
65
+ /** Package relations expressed in RPM dependency syntax. */
73
66
  rpm: textList("RPM package relation", "must be an array of RPM package relations").optional(),
74
67
  });
75
68
 
76
69
  const developerSchema = z.strictObject({
70
+ /** Reverse-DNS developer identifier, derived from the application ID when omitted. */
77
71
  id: text("must be a reverse-DNS developer id").optional(),
72
+ /** Developer or organization name. Defaults to the author in package.json. */
78
73
  name: text("must be a developer or organization name").optional(),
74
+ /** Maintainer email address. Defaults to the author's email in package.json. */
79
75
  email: text("must be an email address").optional(),
80
76
  });
81
77
 
78
+ /** One software-center screenshot in `deploy.screenshots`. Either `url` or `file` must be set. */
79
+ type DeployScreenshotOptions = z.infer<typeof screenshotSchema>;
80
+
81
+ /** Screenshot entry schema and the source of {@link DeployScreenshotOptions}. */
82
82
  const screenshotSchema = z
83
83
  .strictObject({
84
+ /** Absolute URL of a PNG or JPEG screenshot. Takes precedence over `file`. */
84
85
  url: url("must be an absolute URL to a PNG or JPEG").optional(),
86
+ /** Screenshot path relative to the project root, resolved against `screenshotBaseUrl`. */
85
87
  file: text("must be an image path relative to the project root").optional(),
88
+ /** Caption displayed with the screenshot in software centers. */
86
89
  caption: text("must be a screenshot caption").optional(),
90
+ /** Marks the primary screenshot. Only the first entry set to `true` is used. */
87
91
  isDefault: flag(BOOLEAN_ERROR).optional(),
88
92
  })
89
93
  .refine((entry) => entry.url !== undefined || entry.file !== undefined, {
90
94
  error: "must have either a `url` or a `file`",
91
95
  });
92
96
 
97
+ /** One AppStream release-history entry in `deploy.releases`. */
98
+ type DeployReleaseOptions = z.infer<typeof releaseSchema>;
99
+
100
+ /** Release-history entry schema and the source of {@link DeployReleaseOptions}. */
93
101
  const releaseSchema = z.strictObject({
102
+ /** Application version described by this release. */
94
103
  version: text(VERSION_ERROR),
104
+ /** Release date in `YYYY-MM-DD` format. */
95
105
  date: z.iso.date({ error: "must be an ISO date (YYYY-MM-DD)" }),
106
+ /** AppStream release classification. */
96
107
  type: z.enum(RELEASE_TYPES, { error: "must be one of development, snapshot, stable" }).optional(),
108
+ /** AppStream update urgency. */
97
109
  urgency: z.enum(RELEASE_URGENCIES, { error: "must be one of critical, high, low, medium" }).optional(),
110
+ /** Release notes, with each entry rendered as a paragraph. */
98
111
  notes: textList("release note paragraph", "must be an array of release note paragraphs").optional(),
112
+ /** Absolute URL containing further details about the release. */
99
113
  url: url(URL_ERROR).optional(),
100
114
  });
101
115
 
116
+ /** One file extension and MIME type registered through `deploy.fileAssociations`. */
117
+ type DeployFileAssociationOptions = z.infer<typeof fileAssociationSchema>;
118
+
119
+ /** File association schema and the source of {@link DeployFileAssociationOptions}. */
102
120
  const fileAssociationSchema = z.strictObject({
121
+ /** File extension to associate with the application, without a leading dot. */
103
122
  extension: fileExtension("must be a file extension without a leading dot"),
123
+ /** MIME type registered for the file extension. */
104
124
  mimeType: text("must be a MIME type such as text/plain"),
125
+ /** Human-readable description of the file type. */
105
126
  description: text("must be a description of the file type").optional(),
106
127
  });
107
128
 
129
+ /** One desktop launcher action in `deploy.desktopActions`, keyed by its action ID. */
130
+ type DeployDesktopActionOptions = z.infer<typeof desktopActionSchema>;
131
+
132
+ /** Desktop launcher action schema and the source of {@link DeployDesktopActionOptions}. */
108
133
  const desktopActionSchema = z.strictObject({
134
+ /** Action label shown in the desktop launcher menu. */
109
135
  name: text("must be an action name"),
136
+ /** Arguments passed to the application when the action is activated. */
110
137
  args: textList("argument", "must be an array of arguments appended to Exec").optional(),
138
+ /** Icon theme name used for the action. */
111
139
  icon: text("must be an icon name").optional(),
112
140
  });
113
141
 
114
142
  const brandingSchema = z.strictObject({
143
+ /** Primary AppStream branding color for light mode, in `#rrggbb` format. */
115
144
  light: hexColorSchema,
145
+ /** Primary AppStream branding color for dark mode, in `#rrggbb` format. */
116
146
  dark: hexColorSchema,
117
147
  });
118
148
 
@@ -120,12 +150,16 @@ const brandingSchema = z.strictObject({
120
150
  * A `deploy.extraFiles` entry in object form: the source file, resolved against the project root, that is
121
151
  * installed at the entry's prefix-relative destination, and the octal mode it is installed with.
122
152
  */
123
- type DeployExtraFileOptions = Record<"source", string> & {
153
+ type DeployExtraFileOptions = {
154
+ /** Source file path, resolved relative to the project root. */
155
+ source: string;
124
156
  /** Octal file mode. Setuid and setgid bits are rejected. */
125
157
  mode?: string | undefined;
126
158
  };
127
159
  const extraFileSchema: z.ZodType<DeployExtraFileOptions> = z.strictObject({
160
+ /** Source file path, resolved relative to the project root. */
128
161
  source: text(SOURCE_PATH_ERROR),
162
+ /** Octal file mode. Setuid and setgid bits are rejected. */
129
163
  mode: z
130
164
  .string({ error: FILE_MODE_ERROR })
131
165
  .regex(FILE_MODE_PATTERN, { error: FILE_MODE_ERROR })
@@ -140,7 +174,7 @@ const extraFileEntrySchema = z.union([text(SOURCE_PATH_ERROR), extraFileSchema],
140
174
  const launcherEnvSchema = z.record(
141
175
  z.string({ error: LAUNCHER_ENV_NAME_ERROR }).regex(LAUNCHER_ENV_NAME_PATTERN, { error: LAUNCHER_ENV_NAME_ERROR }),
142
176
  z.string({ error: LAUNCHER_ENV_ERROR }).refine((value) => !value.includes("\0"), { error: LAUNCHER_ENV_ERROR }),
143
- { error: (issue) => issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR },
177
+ { error: (issue) => (issue.code === "invalid_key" ? LAUNCHER_ENV_NAME_ERROR : LAUNCHER_ENV_ERROR) },
144
178
  );
145
179
 
146
180
  const nodeFlagsSchema = z.array(
@@ -154,192 +188,337 @@ const nodeFlagsSchema = z.array(
154
188
  * The `deploy.node` options: where the Node.js runtime bundled with the application comes from, the version it
155
189
  * is expected to be, whether its binary is stripped, and whether the launcher enables the compile cache.
156
190
  */
157
- type DeployNodeOptions = Partial<
158
- Record<"source", "download" | "host" | "path" | undefined> &
159
- Record<"path", string | undefined> &
160
- Record<"shouldStrip" | "shouldUseCompileCache", boolean | undefined>
161
- > & {
191
+ type DeployNodeOptions = {
192
+ /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
193
+ source?: "download" | "host" | "path" | undefined;
162
194
  /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
163
195
  version?: string | undefined;
196
+ /** Node.js executable path relative to the project root, required when `source` is `path`. */
197
+ path?: string | undefined;
198
+ /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
199
+ shouldStrip?: boolean | undefined;
200
+ /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
201
+ shouldUseCompileCache?: boolean | undefined;
164
202
  };
165
203
  const nodeRuntimeSchema: z.ZodType<DeployNodeOptions> = z.strictObject({
204
+ /** Runtime source: an official download, the running Node.js executable, or `path`. Defaults to `download`. */
166
205
  source: z.enum(NODE_SOURCES, { error: "must be one of download, host, path" }).optional(),
206
+ /** Expected Node.js version. Downloaded runtimes default to exactly 26.8.2 when omitted. */
167
207
  version: text("must be a Node.js version such as 26.7.0").optional(),
208
+ /** Node.js executable path relative to the project root, required when `source` is `path`. */
168
209
  path: text("must be a path to a node binary").optional(),
210
+ /** Strip the runtime when its architecture matches the host and `strip` is available. Defaults to `true`. */
169
211
  shouldStrip: flag(BOOLEAN_ERROR).optional(),
212
+ /** Enable Node.js compile caching in the generated launcher. Defaults to `true`. */
170
213
  shouldUseCompileCache: flag(BOOLEAN_ERROR).optional(),
171
214
  });
172
215
 
173
216
  const scriptsSchema = z.strictObject({
217
+ /** Shell script run before installing a Debian or RPM package. */
174
218
  preInstall: text(SCRIPT_ERROR).optional(),
219
+ /** Shell script run after installing a Debian or RPM package. */
175
220
  postInstall: text(SCRIPT_ERROR).optional(),
221
+ /** Shell script run before removing a Debian or RPM package. */
176
222
  preRemove: text(SCRIPT_ERROR).optional(),
223
+ /** Shell script run after removing a Debian or RPM package. */
177
224
  postRemove: text(SCRIPT_ERROR).optional(),
178
225
  });
179
226
 
227
+ const toolsSchema = z.strictObject({
228
+ /** nFPM executable name or path relative to the project root. Defaults to a verified pinned download. */
229
+ nfpm: text("must be an nFPM executable name or path").optional(),
230
+ });
231
+
180
232
  const debSchema = z.strictObject({
233
+ /** Debian package name. Defaults to `deploy.binaryName`. */
181
234
  packageName: text("must be a Debian package name").optional(),
235
+ /** Debian archive section, derived from the application categories when omitted. */
182
236
  section: text("must be a Debian archive section").optional(),
237
+ /** Debian package priority. Defaults to `optional`. */
183
238
  priority: text("must be a Debian priority").optional(),
239
+ /** Compression used for the Debian package payload. */
184
240
  compression: z.enum(DEB_COMPRESSIONS, { error: "must be one of gzip, none, xz, zstd" }).optional(),
185
- fields: textRecord("must be a control field value", "must be a record of control field names to values")
186
- .optional(),
241
+ /** Additional Debian control fields, keyed by field name. */
242
+ fields: textRecord("must be a control field value", "must be a record of control field names to values").optional(),
187
243
  });
188
244
 
189
245
  const rpmSchema = z.strictObject({
246
+ /** RPM package name. Defaults to `deploy.binaryName`. */
190
247
  packageName: text("must be an RPM package name").optional(),
248
+ /** RPM package group, derived from the application categories when omitted. */
191
249
  group: text("must be an RPM group").optional(),
250
+ /** Compression used for the RPM package payload. */
192
251
  compression: z.enum(RPM_COMPRESSIONS, { error: "must be one of gzip, lzma, xz, zstd" }).optional(),
252
+ /** Installation prefixes that the RPM package allows users to relocate. */
193
253
  prefixes: textList("prefix", "must be an array of relocation prefixes").optional(),
194
254
  });
195
255
 
196
256
  const appimageSchema = z.strictObject({
257
+ /** Output file name, derived from the application name, version, and architecture when omitted. */
197
258
  fileName: text("must be an output file name").optional(),
259
+ /** Compression explicitly requested from appimagetool. */
198
260
  compression: z.literal("zstd", { error: "must be zstd" }).optional(),
261
+ /** AppImage update information string embedded in the executable. */
199
262
  updateInformation: text("must be an AppImage update information string").optional(),
263
+ /** Custom AppImage runtime file path, resolved relative to the project root. */
200
264
  runtimeFile: text("must be a path to an AppImage runtime file").optional(),
201
265
  });
202
266
 
203
267
  const flatpakSourceSchema = z.strictObject({
268
+ /** Public HTTP or HTTPS Git repository URL. Defaults to the project's Git remote. */
204
269
  url: url("must be an absolute git URL").optional(),
270
+ /** Git tag to build, pinned to its commit when `commit` is omitted. */
205
271
  tag: text("must be a git tag").optional(),
272
+ /** Git commit to build. Defaults to the configured tag's commit or the current HEAD. */
206
273
  commit: text("must be a git commit sha").optional(),
207
274
  });
208
275
 
209
276
  const flatpakSchema = z.strictObject({
277
+ /** Package local build output or build from a pinned Git source inside the SDK. Defaults to `prebuilt`. */
210
278
  mode: z.enum(FLATPAK_MODES, { error: 'must be "prebuilt" or "source"' }).optional(),
279
+ /** Flatpak runtime ID. Defaults to `org.gnome.Platform`. */
211
280
  runtime: text("must be a runtime id").optional(),
281
+ /** Flatpak runtime branch. Defaults to `50`. */
212
282
  runtimeVersion: text('must be a runtime branch such as "50"').optional(),
283
+ /** Build SDK ID. Defaults to `org.gnome.Sdk`. */
213
284
  sdk: text("must be an SDK id").optional(),
285
+ /** Node.js SDK extension used in source mode. Defaults to `org.freedesktop.Sdk.Extension.node26`. */
214
286
  nodeExtension: text("must be a Node SDK extension id").optional(),
287
+ /** Additional SDK extension IDs included in the build environment. */
215
288
  sdkExtensions: textList("SDK extension id", "must be an array of SDK extension ids").optional(),
289
+ /** Optional Flatpak base application ID. */
216
290
  base: text("must be a base app id").optional(),
291
+ /** Branch of the base application. */
217
292
  baseVersion: text("must be a base app version").optional(),
293
+ /** Exported application branch. Defaults to `stable`. */
218
294
  branch: text("must be a branch name").optional(),
295
+ /** Sandbox permissions added to display, IPC, and GPU defaults. Negations remove matching defaults. */
219
296
  finishArgs: textList("finish argument", "must be an array of flatpak finish arguments").optional(),
297
+ /** Patterns added to header, pkg-config, and static-library cleanup defaults. An empty array disables cleanup. */
220
298
  cleanup: textList("cleanup pattern", "must be an array of cleanup patterns").optional(),
299
+ /** Additional shell commands appended to the application's Flatpak build commands. */
221
300
  buildCommands: textList("shell command", "must be an array of shell commands").optional(),
301
+ /** Additional Flatpak manifest modules built before the application module. */
222
302
  modules: z.array(z.unknown(), { error: "must be an array of flatpak module objects" }).optional(),
303
+ /** Git repository and revision used for source builds. */
223
304
  source: flatpakSourceSchema.optional(),
305
+ /** Package manager used for offline source builds, detected from the project's lockfiles when omitted. */
224
306
  packageManager: z.enum(PACKAGE_MANAGERS, { error: "must be one of npm, pnpm, yarn" }).optional(),
307
+ /** Lockfile path relative to the project root. Defaults to the selected package manager's standard lockfile. */
225
308
  lockfile: text("must be a path to a lockfile").optional(),
309
+ /** Runtime repository URL embedded in the bundle. Defaults to Flathub's `.flatpakrepo` URL. */
226
310
  runtimeRepo: url("must be an absolute .flatpakrepo URL").optional(),
311
+ /** Emit a `.flatpak` bundle in addition to the local repository. Defaults to `true`. */
227
312
  shouldEmitBundle: flag(BOOLEAN_ERROR).optional(),
313
+ /** Install the built application into the current user's Flatpak installation. Defaults to `false`. */
228
314
  shouldInstall: flag(BOOLEAN_ERROR).optional(),
315
+ /** Allow flatpak-builder to use rofiles-fuse. Set to `false` where FUSE is unavailable. */
229
316
  shouldUseRofilesFuse: flag(BOOLEAN_ERROR).optional(),
230
317
  });
231
318
 
232
319
  const debSigningSchema = z.strictObject({
320
+ /** PGP private key file used to sign the Debian package. */
233
321
  keyFile: text(KEY_FILE_ERROR),
322
+ /** PGP signing key ID. */
234
323
  keyId: text(KEY_ID_ERROR).optional(),
324
+ /** Debian package signing method. */
235
325
  method: z.enum(DEB_SIGN_METHODS, { error: 'must be "debsign" or "dpkg-sig"' }).optional(),
326
+ /** Debian signature role. */
236
327
  type: z.enum(DEB_SIGN_TYPES, { error: "must be one of archive, maint, origin" }).optional(),
328
+ /** Name and email address recorded as the signer. */
237
329
  signer: text("must be a signer name and email").optional(),
238
330
  });
239
331
 
240
332
  const rpmSigningSchema = z.strictObject({
333
+ /** PGP private key file used to sign the RPM package. */
241
334
  keyFile: text(KEY_FILE_ERROR),
335
+ /** PGP signing key ID. */
242
336
  keyId: text(KEY_ID_ERROR).optional(),
243
337
  });
244
338
 
245
339
  const flatpakSigningSchema = z.strictObject({
340
+ /** GPG key ID used to sign the Flatpak bundle. */
246
341
  gpgKeyId: text("must be a GPG key id"),
342
+ /** GPG home directory containing the signing key. */
247
343
  gpgHomeDir: text("must be a path to a GPG home directory").optional(),
248
344
  });
249
345
 
250
346
  const appimageSigningSchema = z.strictObject({
347
+ /** GPG key ID used by appimagetool to sign the AppImage. */
251
348
  gpgKeyId: text("must be a GPG key id"),
252
349
  });
253
350
 
254
351
  const signingSchema = z.strictObject({
352
+ /** AppImage signing options. */
255
353
  appimage: appimageSigningSchema.optional(),
354
+ /** Debian package signing options. */
256
355
  deb: debSigningSchema.optional(),
356
+ /** Flatpak bundle signing options. */
257
357
  flatpak: flatpakSigningSchema.optional(),
358
+ /** RPM package signing options. */
258
359
  rpm: rpmSigningSchema.optional(),
259
360
  });
260
361
 
261
362
  const extraRelationsSchema = z.strictObject({
363
+ /** Recommended packages that extend the application's functionality. */
262
364
  recommends: relationsSchema.optional(),
365
+ /** Suggested companion packages. */
263
366
  suggests: relationsSchema.optional(),
367
+ /** Package names or capabilities supplied by this package. */
264
368
  provides: relationsSchema.optional(),
369
+ /** Packages that cannot be installed alongside this package. */
265
370
  conflicts: relationsSchema.optional(),
371
+ /** Packages whose files this package may replace. */
266
372
  replaces: relationsSchema.optional(),
373
+ /** Debian packages made incompatible by installing this package. Uses the `deb` entries. */
267
374
  breaks: relationsSchema.optional(),
375
+ /** Debian dependencies required before unpacking this package. Uses the `deb` entries. */
268
376
  preDepends: relationsSchema.optional(),
269
377
  });
270
378
 
271
379
  const deploySchema = z.strictObject({
380
+ /** Package formats to build. Defaults to `["flatpak"]`; overridden by `gtkx deploy --target`. */
272
381
  targets: z
273
382
  .array(z.enum(DEPLOY_TARGET_NAMES, { error: "must be one of appimage, deb, flatpak, rpm" }), {
274
383
  error: "must be an array of deploy targets",
275
384
  })
276
385
  .optional(),
386
+ /** Target CPU architectures. Defaults to the host architecture; overridden by `gtkx deploy --arch`. */
277
387
  architectures: z
278
388
  .array(z.enum(DEPLOY_ARCH_NAMES, { error: "must be one of arm64, x64" }), {
279
389
  error: "must be an array of deploy architectures",
280
390
  })
281
391
  .optional(),
392
+ /** Deployment directory relative to the project root. Defaults to `build`, with packages in its `out` directory. */
282
393
  outDir: text("must be a directory path relative to the project root").optional(),
394
+ /** Display name, derived from package.json's name or the application ID when omitted. */
283
395
  name: text("must be the display name shown in the launcher").optional(),
396
+ /** Generic application description shown by desktop launchers, such as `Text Editor`. */
284
397
  genericName: text("must be a generic application name").optional(),
398
+ /** Launcher command name, derived from package.json's name or the application ID when omitted. */
285
399
  binaryName: text("must be a kebab-case command name").optional(),
400
+ /** Application version. Defaults to the version in package.json. */
286
401
  version: text(VERSION_ERROR).optional(),
402
+ /** Debian packaging revision and RPM release. Defaults to `1`. */
287
403
  release: text("must be a packaging revision").optional(),
404
+ /** Non-negative Debian and RPM version epoch, omitted from package metadata unless configured. */
288
405
  epoch: z.int({ error: EPOCH_ERROR }).min(0, { error: EPOCH_ERROR }).optional(),
406
+ /** Single-line summary without a trailing period. Defaults to the first line of package.json's description. */
289
407
  summary: text("must be a single-line summary without a trailing period").optional(),
408
+ /** Long description as paragraphs. Defaults to the summary when omitted or empty. */
290
409
  description: textList("description paragraph", "must be an array of description paragraphs").optional(),
410
+ /** Search keywords included in the desktop entry and AppStream metadata. */
291
411
  keywords: textList("search keyword", "must be an array of search keywords").optional(),
412
+ /** Freedesktop application categories used by launchers, software centers, and package metadata. */
292
413
  categories: textList("freedesktop category", "must be an array of freedesktop categories").optional(),
414
+ /** Supported MIME types, combined with types from file associations and URL protocols. */
293
415
  mimeTypes: textList("MIME type", "must be an array of MIME types").optional(),
416
+ /** Developer identity and package maintainer details. */
294
417
  developer: developerSchema.optional(),
418
+ /** Application license as an SPDX expression. Defaults to the license in package.json. */
295
419
  license: text(SPDX_ERROR).optional(),
420
+ /** License file path relative to the project root, detected from common LICENSE or COPYING names when omitted. */
296
421
  licenseFile: text("must be a path to a license file").optional(),
422
+ /** SPDX license expression for the AppStream metadata. Defaults to `CC0-1.0`. */
297
423
  metadataLicense: text(SPDX_ERROR).optional(),
424
+ /** Copyright notice. Defaults to the build year and developer name. */
298
425
  copyright: text("must be a copyright line").optional(),
426
+ /** Application homepage URL. Defaults to the homepage in package.json. */
299
427
  homepage: url(URL_ERROR).optional(),
428
+ /** Additional AppStream links keyed by their purpose, such as `bugtracker` or `help`. */
300
429
  urls: z
301
430
  .partialRecord(z.enum(URL_KINDS), url(URL_ERROR), {
302
431
  error: "must be a record of AppStream url kinds to URLs",
303
432
  })
304
433
  .optional(),
434
+ /**
435
+ * Screenshots for software centers. Each entry requires a `url` or `file`.
436
+ * @see {@link DeployScreenshotOptions} for the fields accepted by each entry.
437
+ */
305
438
  screenshots: z.array(screenshotSchema, { error: "must be an array of screenshots" }).optional(),
439
+ /** Base URL for screenshot files, inferred from a GitHub or GitLab remote when omitted. */
306
440
  screenshotBaseUrl: url("must be an absolute base URL").optional(),
441
+ /** Primary branding colors included in AppStream metadata. */
307
442
  branding: brandingSchema.optional(),
443
+ /** OARS 1.1 content-rating attributes mapped to their intensities. */
308
444
  contentRating: z
309
445
  .record(z.string(), z.enum(OARS_INTENSITIES, { error: "must be one of intense, mild, moderate, none" }), {
310
446
  error: "must be a record of OARS 1.1 attribute ids to intensities",
311
447
  })
312
448
  .optional(),
449
+ /**
450
+ * AppStream release history, sorted newest first. Defaults to the application version and build date.
451
+ * @see {@link DeployReleaseOptions} for the fields accepted by each entry.
452
+ */
313
453
  releases: z.array(releaseSchema, { error: "must be an array of releases" }).optional(),
454
+ /** Application arguments included in the desktop entry's launch command. */
314
455
  execArgs: textList("argument", "must be an array of arguments appended to Exec").optional(),
456
+ /** Environment variables exported by the generated launcher. Keys must be POSIX environment names. */
315
457
  launcherEnv: launcherEnvSchema.optional(),
458
+ /** Node.js flags placed before the application bundle in the generated launcher. */
316
459
  nodeFlags: nodeFlagsSchema.optional(),
317
- fileAssociations: z
318
- .array(fileAssociationSchema, { error: "must be an array of file associations" })
319
- .optional(),
460
+ /**
461
+ * File extensions and MIME types registered for the application.
462
+ * @see {@link DeployFileAssociationOptions} for the fields accepted by each entry.
463
+ */
464
+ fileAssociations: z.array(fileAssociationSchema, { error: "must be an array of file associations" }).optional(),
465
+ /** URL schemes handled by the application, registered as `x-scheme-handler` MIME types. */
320
466
  protocols: textList("URL scheme", "must be an array of URL schemes").optional(),
467
+ /**
468
+ * Desktop launcher actions keyed by action ID.
469
+ * @see {@link DeployDesktopActionOptions} for the fields accepted by each entry.
470
+ */
321
471
  desktopActions: z
322
472
  .record(z.string(), desktopActionSchema, { error: "must be a record of action ids to actions" })
323
473
  .optional(),
324
- desktopEntry: textRecord("must be a desktop entry value", "must be a record of desktop entry keys to values")
325
- .optional(),
474
+ /**
475
+ * Additional desktop entry keys, overriding non-reserved generated values.
476
+ * `DBusActivatable` and `Version` are rejected; use `deploy.isDbusActivatable` for D-Bus activation.
477
+ */
478
+ desktopEntry: textRecord(
479
+ "must be a desktop entry value",
480
+ "must be a record of desktop entry keys to values",
481
+ ).optional(),
482
+ /** Additional XML fragments appended to the AppStream component. */
326
483
  metainfoExtra: textList("AppStream XML fragment", "must be an array of AppStream XML fragments").optional(),
484
+ /** Enable D-Bus activation in the desktop entry and generate a session bus service file. Defaults to `false`. */
327
485
  isDbusActivatable: flag(BOOLEAN_ERROR).optional(),
486
+ /** Extra files keyed by destination inside the install prefix, with source paths relative to the project root. */
328
487
  extraFiles: relativePathRecord(
329
488
  "must be a destination path inside the install prefix, without a leading slash or a .. segment",
330
489
  extraFileEntrySchema,
331
490
  "must be a record of prefix-relative destinations to source paths or { source, mode } entries",
332
491
  ).optional(),
492
+ /** Minimum runtime library versions keyed by GIR library ID, used when deriving package dependencies. */
333
493
  minimumLibraryVersions: minimumLibraryVersionsSchema.optional(),
494
+ /** Additional Debian and RPM dependencies merged with automatically detected dependencies. */
334
495
  depends: relationsSchema.optional(),
496
+ /** Additional package relationships for Debian and RPM. */
335
497
  relations: extraRelationsSchema.optional(),
498
+ /** Installation and removal scripts for Debian and RPM packages. */
336
499
  scripts: scriptsSchema.optional(),
500
+ /** Node.js runtime bundled with prebuilt packages and launcher compile-cache settings. */
337
501
  node: nodeRuntimeSchema.optional(),
502
+ /** Overrides for executables used to build packages. */
503
+ tools: toolsSchema.optional(),
504
+ /** Per-format package signing options. */
338
505
  signing: signingSchema.optional(),
506
+ /** AppImage packaging options. */
339
507
  appimage: appimageSchema.optional(),
508
+ /** Debian package metadata and compression options. */
340
509
  deb: debSchema.optional(),
510
+ /** Flatpak runtime, sandbox, build, and distribution options. */
341
511
  flatpak: flatpakSchema.optional(),
512
+ /** RPM package metadata and compression options. */
342
513
  rpm: rpmSchema.optional(),
343
514
  });
344
515
 
345
- export { deploySchema, type DeployExtraFileOptions, type DeployNodeOptions };
516
+ export {
517
+ deploySchema,
518
+ type DeployDesktopActionOptions,
519
+ type DeployExtraFileOptions,
520
+ type DeployFileAssociationOptions,
521
+ type DeployNodeOptions,
522
+ type DeployReleaseOptions,
523
+ type DeployScreenshotOptions,
524
+ };