@gjsify/cli 0.64.60 → 0.64.61
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/dist/cli.gjs.mjs +98 -98
- package/lib/types/config-data.d.ts +14 -0
- package/lib/utils/app-metadata.d.ts +3 -1
- package/lib/utils/app-metadata.js +18 -0
- package/lib/utils/dev-link.js +23 -6
- package/package.json +20 -20
|
@@ -312,6 +312,8 @@ export interface ConfigDataTest {
|
|
|
312
312
|
/** Default runtimes when `--runtime` not specified. Default: `['gjs', 'node']`. */
|
|
313
313
|
runtimes?: Array<'gjs' | 'node'>;
|
|
314
314
|
}
|
|
315
|
+
/** The closed set of `gjsify::ai-involvement` values (ADR 0153). */
|
|
316
|
+
export type AiInvolvementLevel = 'none' | 'assisted' | 'agent-built';
|
|
315
317
|
/**
|
|
316
318
|
* The app metadata every install format needs — AppStream MetaInfo fields plus
|
|
317
319
|
* what a freedesktop `.desktop` entry is built from. Shared on purpose: a
|
|
@@ -421,6 +423,18 @@ export interface AppMetadata {
|
|
|
421
423
|
accentLight: string;
|
|
422
424
|
accentDark: string;
|
|
423
425
|
};
|
|
426
|
+
/**
|
|
427
|
+
* How much AI built the app (ADR 0153). Rendered as
|
|
428
|
+
* `<custom><value key="gjsify::ai-involvement">` (+ `gjsify::ai-disclosure`), which
|
|
429
|
+
* `gjsify site` and `gjsify webext listing` read. `disclosure` is ONE English sentence naming
|
|
430
|
+
* the parts AI produced and how they are reviewed; it is the gettext msgid, so it is
|
|
431
|
+
* translated through the app's catalogues and `ship` never folds a translated `<value>` into
|
|
432
|
+
* the metainfo (AppStream rejects a repeated custom key).
|
|
433
|
+
*/
|
|
434
|
+
aiInvolvement?: {
|
|
435
|
+
level: AiInvolvementLevel;
|
|
436
|
+
disclosure?: string;
|
|
437
|
+
};
|
|
424
438
|
/**
|
|
425
439
|
* Path to a scalable SVG icon; Flathub requires SVG
|
|
426
440
|
* (`/app/share/icons/hicolor/scalable/apps/<app-id>.svg`). When set, init
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { AppMetadata, DescriptionBlock } from '../types/config-data.js';
|
|
1
|
+
import type { AiInvolvementLevel, AppMetadata, DescriptionBlock } from '../types/config-data.js';
|
|
2
|
+
/** The `gjsify::ai-involvement` values ADR 0153 allows. */
|
|
3
|
+
export declare const AI_INVOLVEMENT_LEVELS: readonly AiInvolvementLevel[];
|
|
2
4
|
/** Everything a renderer needs that is not part of {@link AppMetadata} itself. */
|
|
3
5
|
export interface AppMetadataInputs {
|
|
4
6
|
/** Reverse-DNS application id — the MetaInfo `<id>` and the icon/desktop basename. */
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
// template+placeholder approach to stay legible. The `.desktop` entry stays
|
|
15
15
|
// template-based — it is flat `key=value`.
|
|
16
16
|
import { channelAllowsDonations } from './channel.js';
|
|
17
|
+
/** The `gjsify::ai-involvement` values ADR 0153 allows. */
|
|
18
|
+
export const AI_INVOLVEMENT_LEVELS = ['none', 'assisted', 'agent-built'];
|
|
17
19
|
/**
|
|
18
20
|
* The `.desktop` skeleton, as source rather than as a file to find at runtime.
|
|
19
21
|
*
|
|
@@ -321,6 +323,22 @@ function renderMetainfo(inputs, kind) {
|
|
|
321
323
|
lines.push(` <control>${escapeXml(c)}</control>`);
|
|
322
324
|
lines.push(' </recommends>');
|
|
323
325
|
}
|
|
326
|
+
// <custom> — ADR 0153. ONE value per key, never an `xml:lang` sibling: `appstreamcli validate`
|
|
327
|
+
// rejects a repeated key (`custom-key-duplicated`). The disclosure is translated by the
|
|
328
|
+
// READER through the app's catalogues, so `localizeMetadata` must not touch it either.
|
|
329
|
+
if (m.aiInvolvement !== undefined) {
|
|
330
|
+
const { level, disclosure } = m.aiInvolvement;
|
|
331
|
+
if (!AI_INVOLVEMENT_LEVELS.includes(level)) {
|
|
332
|
+
throw new Error(`${inputs.configKey}.aiInvolvement.level is ${JSON.stringify(level)}; expected one of ` +
|
|
333
|
+
`${AI_INVOLVEMENT_LEVELS.join(', ')} (ADR 0153). An unknown level is never guessed.`);
|
|
334
|
+
}
|
|
335
|
+
lines.push(' <custom>');
|
|
336
|
+
lines.push(` <value key="gjsify::ai-involvement">${escapeXml(level)}</value>`);
|
|
337
|
+
const sentence = disclosure?.trim().replace(/\s+/g, ' ');
|
|
338
|
+
if (sentence)
|
|
339
|
+
lines.push(` <value key="gjsify::ai-disclosure">${escapeXml(sentence)}</value>`);
|
|
340
|
+
lines.push(' </custom>');
|
|
341
|
+
}
|
|
324
342
|
lines.push('</component>');
|
|
325
343
|
return lines.join('\n') + '\n';
|
|
326
344
|
}
|
package/lib/utils/dev-link.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
// committed lockfile the moment a link is active, which is the one thing this
|
|
36
36
|
// feature promises not to do. `linkedNames` therefore applies after the lockfile
|
|
37
37
|
// is written and only to what gets fetched.
|
|
38
|
-
import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
38
|
+
import { existsSync, lstatSync, mkdirSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
39
39
|
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
40
40
|
import { discoverWorkspaces, filterWorkspaces } from '@gjsify/workspace';
|
|
41
41
|
import { linkDirSync } from './dir-link.js';
|
|
@@ -502,13 +502,16 @@ function linkAlreadyPointsAt(linkPath, target) {
|
|
|
502
502
|
export function scanDevLinks(consumerRoot, checkouts) {
|
|
503
503
|
const roots = [];
|
|
504
504
|
for (const checkout of checkouts) {
|
|
505
|
+
// A checkout that has since been DELETED still names the links the install
|
|
506
|
+
// left behind, so its spelled path counts as a root too — dangling links
|
|
507
|
+
// into it must be found and removed, not skipped (they include optional
|
|
508
|
+
// native packages of other platforms the host never installs).
|
|
509
|
+
roots.push(resolve(checkout));
|
|
505
510
|
try {
|
|
506
511
|
roots.push(realpathSync(checkout));
|
|
507
512
|
}
|
|
508
513
|
catch {
|
|
509
|
-
// Gone or unreadable:
|
|
510
|
-
// no links. A DANGLING link is not this function's business either —
|
|
511
|
-
// the installer extracts straight over one.
|
|
514
|
+
// Gone or unreadable: the spelled path above is all there is.
|
|
512
515
|
}
|
|
513
516
|
}
|
|
514
517
|
if (roots.length === 0)
|
|
@@ -524,7 +527,13 @@ export function scanDevLinks(consumerRoot, checkouts) {
|
|
|
524
527
|
target = realpathSync(pkg.dir);
|
|
525
528
|
}
|
|
526
529
|
catch {
|
|
527
|
-
|
|
530
|
+
// Dangling: judge it by where the link text points.
|
|
531
|
+
try {
|
|
532
|
+
target = resolve(dirname(pkg.dir), readlinkSync(pkg.dir));
|
|
533
|
+
}
|
|
534
|
+
catch {
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
528
537
|
}
|
|
529
538
|
if (!roots.some((root) => target === root || target.startsWith(root + sep)))
|
|
530
539
|
continue;
|
|
@@ -547,7 +556,15 @@ function packageNameAt(consumerRoot, dir) {
|
|
|
547
556
|
*/
|
|
548
557
|
export function retireDevLinks(consumerRoot, checkouts, keep) {
|
|
549
558
|
const stale = scanDevLinks(consumerRoot, checkouts).filter((link) => !keep.has(link.name));
|
|
550
|
-
|
|
559
|
+
// `scanDevLinks` already established "symlink into the checkout", dangling or
|
|
560
|
+
// not, so remove directly: `removeDevLinks` re-checks through `realpath` and
|
|
561
|
+
// would skip exactly the links whose target is gone.
|
|
562
|
+
const removed = [];
|
|
563
|
+
for (const link of stale) {
|
|
564
|
+
rmSync(link.linkPath, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
|
|
565
|
+
removed.push(link);
|
|
566
|
+
}
|
|
567
|
+
return removed;
|
|
551
568
|
}
|
|
552
569
|
/**
|
|
553
570
|
* Which of these links point at something that is not built.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.64.
|
|
3
|
+
"version": "0.64.61",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -142,22 +142,22 @@
|
|
|
142
142
|
"cli"
|
|
143
143
|
],
|
|
144
144
|
"dependencies": {
|
|
145
|
-
"@gjsify/blueprint": "0.64.
|
|
146
|
-
"@gjsify/buffer": "0.64.
|
|
147
|
-
"@gjsify/create-app": "0.64.
|
|
148
|
-
"@gjsify/node-globals": "0.64.
|
|
149
|
-
"@gjsify/node-polyfills": "0.64.
|
|
150
|
-
"@gjsify/npm-registry": "0.64.
|
|
151
|
-
"@gjsify/resolve-npm": "0.64.
|
|
152
|
-
"@gjsify/rolldown-plugin-gjsify": "0.64.
|
|
153
|
-
"@gjsify/vite-plugin-blueprint": "0.64.
|
|
154
|
-
"@gjsify/rolldown-plugin-pnp": "0.64.
|
|
155
|
-
"@gjsify/semver": "0.64.
|
|
156
|
-
"@gjsify/tar": "0.64.
|
|
157
|
-
"@gjsify/tsc": "0.64.
|
|
158
|
-
"@gjsify/utils": "0.64.
|
|
159
|
-
"@gjsify/web-polyfills": "0.64.
|
|
160
|
-
"@gjsify/workspace": "0.64.
|
|
145
|
+
"@gjsify/blueprint": "0.64.61",
|
|
146
|
+
"@gjsify/buffer": "0.64.61",
|
|
147
|
+
"@gjsify/create-app": "0.64.61",
|
|
148
|
+
"@gjsify/node-globals": "0.64.61",
|
|
149
|
+
"@gjsify/node-polyfills": "0.64.61",
|
|
150
|
+
"@gjsify/npm-registry": "0.64.61",
|
|
151
|
+
"@gjsify/resolve-npm": "0.64.61",
|
|
152
|
+
"@gjsify/rolldown-plugin-gjsify": "0.64.61",
|
|
153
|
+
"@gjsify/vite-plugin-blueprint": "0.64.61",
|
|
154
|
+
"@gjsify/rolldown-plugin-pnp": "0.64.61",
|
|
155
|
+
"@gjsify/semver": "0.64.61",
|
|
156
|
+
"@gjsify/tar": "0.64.61",
|
|
157
|
+
"@gjsify/tsc": "0.64.61",
|
|
158
|
+
"@gjsify/utils": "0.64.61",
|
|
159
|
+
"@gjsify/web-polyfills": "0.64.61",
|
|
160
|
+
"@gjsify/workspace": "0.64.61",
|
|
161
161
|
"acorn": "^8.17.0",
|
|
162
162
|
"cosmiconfig": "^9.0.2",
|
|
163
163
|
"get-tsconfig": "^4.14.0",
|
|
@@ -166,13 +166,13 @@
|
|
|
166
166
|
"yargs": "^18.0.0"
|
|
167
167
|
},
|
|
168
168
|
"devDependencies": {
|
|
169
|
-
"@gjsify/unit": "0.64.
|
|
169
|
+
"@gjsify/unit": "0.64.61",
|
|
170
170
|
"@types/yargs": "^17.0.35",
|
|
171
171
|
"typescript": "^6.0.3"
|
|
172
172
|
},
|
|
173
173
|
"peerDependencies": {
|
|
174
|
-
"@gjsify/oxfmt-native": "0.64.
|
|
175
|
-
"@gjsify/rolldown-native": "0.64.
|
|
174
|
+
"@gjsify/oxfmt-native": "0.64.61",
|
|
175
|
+
"@gjsify/rolldown-native": "0.64.61"
|
|
176
176
|
},
|
|
177
177
|
"peerDependenciesMeta": {
|
|
178
178
|
"@gjsify/oxfmt-native": {
|