@synopackageland/cli 0.54.9 → 0.54.11
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/CHANGELOG.md +8 -0
- package/README.md +1 -1
- package/dist/bin.js +3 -1
- package/dist/ctl/generate.js +1 -1
- package/dist/spk/check-payload.js +22 -8
- package/dist/standalone/manifest.d.ts +9 -1
- package/dist/standalone/manifest.js +9 -5
- package/dist/standalone/public-ui.d.ts +18 -0
- package/dist/standalone/public-ui.js +122 -7
- package/docs/catalog-text.md +2 -1
- package/package.json +15 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.54.11 (2026-11-22)
|
|
4
|
+
|
|
5
|
+
- `ctl generate` (and `--check`) no longer needs store text: it does not read the project `.env`, ignores `--catalog`/`SYNOPKGLAND_CATALOG`, and accepts a manifest without `description`. It previously failed when the catalog had no release notes for the current version, or when no `.env` supplied the catalog. `check`, `build` and `inspect` still require the catalog text as before.
|
|
6
|
+
|
|
7
|
+
## 0.54.10 (2026-11-21)
|
|
8
|
+
|
|
9
|
+
- `check <spk>` and `inspect` scan public `ui/` files over 64 MiB instead of rejecting them with `SPK_UI_UNSAFE`: a larger file (such as a Go CGI) is streamed in 16 MiB windows with 1 MiB overlap, so a match longer than 1 MiB is still flagged but reported by its first 1 MiB. Executables keep their binary-pattern scanning.
|
|
10
|
+
|
|
3
11
|
## 0.54.9 (2026-11-18)
|
|
4
12
|
|
|
5
13
|
- Use SDK 0.53.51 by default.
|
package/README.md
CHANGED
|
@@ -594,7 +594,7 @@ Use `synopkgland host add nas --url https://nas.example:5001 --username alice`
|
|
|
594
594
|
to register and authenticate a NAS in OS secure storage. A bare host name uses
|
|
595
595
|
`https://<host>:5001`; provide a full URL for a different scheme or port.
|
|
596
596
|
The CLI loads only `DSM_*` and `SYNOPKGLAND_*` variables from `.env`; set other
|
|
597
|
-
process variables in the shell. `host list --json`
|
|
597
|
+
process variables in the shell. `ctl generate` does not read `.env`. `host list --json`
|
|
598
598
|
checks sessions; `ctl list --host nas --json` discovers all approved task-level
|
|
599
599
|
commands and their schemas. Run the listed alias/command with typed flags,
|
|
600
600
|
`--help` and `--dry-run`; writes require `--yes`. There is no mutable current
|
package/dist/bin.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
import { loadDotEnv } from "./load-env.js";
|
|
3
3
|
import { runCli } from "./cli.js";
|
|
4
4
|
import { terminalSafe } from "./terminal-text.js";
|
|
5
|
-
|
|
5
|
+
// `ctl generate` is an offline gate: it must not depend on a local secret file.
|
|
6
|
+
if (!(process.argv[2] === "ctl" && process.argv[3] === "generate"))
|
|
7
|
+
loadDotEnv();
|
|
6
8
|
// Package deployment is explicit; this CLI does not publish releases.
|
|
7
9
|
// Successful completion leaves Node's default 0 or the command's exitCode intact.
|
|
8
10
|
runCli(process.argv).catch((error) => {
|
package/dist/ctl/generate.js
CHANGED
|
@@ -5,7 +5,7 @@ export async function generateCommand(args) {
|
|
|
5
5
|
const check = args.includes('--check'), rest = args.filter(a => a !== '--check' && a !== '--json');
|
|
6
6
|
if (rest.length)
|
|
7
7
|
throw Error('Usage: synopkgland ctl generate [--check] [--json]');
|
|
8
|
-
const loaded = loadStandaloneManifest(process.cwd());
|
|
8
|
+
const loaded = loadStandaloneManifest(process.cwd(), { storeText: false });
|
|
9
9
|
if (!loaded.ok)
|
|
10
10
|
throw Error(loaded.errors.map(e => e.message).join('\n'));
|
|
11
11
|
const result = await generateOperations(loaded.manifest, async (command, argv, options) => {
|
|
@@ -3,10 +3,12 @@ import { posix } from "node:path";
|
|
|
3
3
|
import * as tar from "tar";
|
|
4
4
|
import { ARCH_ELF_MACHINE } from "./dsm-spec.js";
|
|
5
5
|
import { archiveInventory, formatArchiveIssue } from './archive-inventory.js';
|
|
6
|
-
import { applyUiIgnores, logicalUiFile, publicUiReport, resolveUiSecretIgnores, staleUiIgnores, uiFileProblems } from "../standalone/public-ui.js";
|
|
6
|
+
import { applyUiIgnores, logicalUiFile, publicUiReport, resolveUiSecretIgnores, staleUiIgnores, uiFileProblems, UiStreamScanner } from "../standalone/public-ui.js";
|
|
7
7
|
const XZ_MAGIC = Buffer.from([0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00]);
|
|
8
8
|
const ELF_MAGIC = Buffer.from("\x7fELF", "latin1");
|
|
9
9
|
const MAX_TEXT = 1024 * 1024;
|
|
10
|
+
/** ui/ files up to this size are scanned whole; larger ones (e.g. a Go CGI) are streamed in windows. */
|
|
11
|
+
const MAX_UI_IN_MEMORY = 64 * MAX_TEXT;
|
|
10
12
|
const HEAD_BYTES = 20;
|
|
11
13
|
/** `section:key`: a DSM string reference rather than literal text. */
|
|
12
14
|
const STRING_REF = /^([A-Za-z0-9_]+):([A-Za-z0-9_]+)$/;
|
|
@@ -40,16 +42,24 @@ async function scanPayload(payloadPath, wanted, findings) {
|
|
|
40
42
|
if (entry.type !== "File")
|
|
41
43
|
return;
|
|
42
44
|
const file = { path, head: Buffer.alloc(0) };
|
|
43
|
-
const
|
|
45
|
+
const ui = path.startsWith("ui/");
|
|
46
|
+
const keep = wanted(path) && (entry.size ?? 0) <= (ui ? MAX_UI_IN_MEMORY : MAX_TEXT);
|
|
47
|
+
// Only the payload's own ui/ files need a secret scan at any size.
|
|
48
|
+
const stream = !keep && ui && wanted(path) ? new UiStreamScanner(path.slice(3)) : undefined;
|
|
44
49
|
const chunks = [];
|
|
45
50
|
entry.on("data", (chunk) => {
|
|
46
51
|
if (file.head.length < HEAD_BYTES)
|
|
47
52
|
file.head = Buffer.concat([file.head, chunk]).subarray(0, HEAD_BYTES);
|
|
48
53
|
if (keep)
|
|
49
54
|
chunks.push(chunk);
|
|
55
|
+
stream?.write(chunk);
|
|
56
|
+
});
|
|
57
|
+
entry.on("end", () => {
|
|
58
|
+
if (keep)
|
|
59
|
+
file.content = Buffer.concat(chunks);
|
|
60
|
+
if (stream)
|
|
61
|
+
file.problems = stream.end();
|
|
50
62
|
});
|
|
51
|
-
entry.on("end", () => { if (keep)
|
|
52
|
-
file.content = Buffer.concat(chunks); });
|
|
53
63
|
files.push(file);
|
|
54
64
|
},
|
|
55
65
|
});
|
|
@@ -174,11 +184,12 @@ export async function checkPayload(payloadPath, info, findings, policy = {}) {
|
|
|
174
184
|
}
|
|
175
185
|
const scanned = [];
|
|
176
186
|
for (const file of ui) {
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
const raw = file.content !== undefined ? uiFileProblems(file.path.slice(3), file.content) : file.problems;
|
|
188
|
+
if (raw === undefined) {
|
|
189
|
+
// Not reached for a fully read tar; fail closed if a ui/ file was never scanned.
|
|
190
|
+
findings.add("SPK_UI_UNSAFE", "Public UI file could not be scanned.", at(file.path));
|
|
179
191
|
continue;
|
|
180
192
|
}
|
|
181
|
-
const raw = uiFileProblems(file.path.slice(3), file.content);
|
|
182
193
|
scanned.push(...raw);
|
|
183
194
|
// Inspection may run on SPKs from others: report patterns, never the flagged text.
|
|
184
195
|
const problems = applyUiIgnores(raw, ignores, policy.moduleVersion);
|
|
@@ -190,5 +201,8 @@ export async function checkPayload(payloadPath, info, findings, policy = {}) {
|
|
|
190
201
|
}
|
|
191
202
|
for (const stale of staleUiIgnores(scanned, ignores, policy.moduleVersion))
|
|
192
203
|
findings.add("SPK_UI_UNSAFE", "A recorded ui_secret_ignores match no longer occurs in this file; rebuild the SPK.", at(`ui/${stale.file}`));
|
|
193
|
-
|
|
204
|
+
const report = publicUiReport(ui.filter(file => file.content !== undefined).map(file => ({ file: file.path, content: file.content.toString("utf8") })));
|
|
205
|
+
// Streamed files are not minify-checked, but a source map in one is still reported.
|
|
206
|
+
const streamedMaps = ui.filter(file => file.problems?.some(problem => ["source-map-file", "sourceMappingURL"].includes(problem.pattern))).map(file => file.path);
|
|
207
|
+
return streamedMaps.length ? { ...report, sourceMapFree: false, sourceMaps: [...report.sourceMaps, ...streamedMaps] } : report;
|
|
194
208
|
}
|
|
@@ -190,7 +190,15 @@ export type ManifestResult = {
|
|
|
190
190
|
errors: StandaloneError[];
|
|
191
191
|
};
|
|
192
192
|
export declare const KNOWN_FIELDS: Set<string>;
|
|
193
|
-
export
|
|
193
|
+
export interface ManifestLoadOptions {
|
|
194
|
+
/**
|
|
195
|
+
* false skips store text: no catalog is read (so no release notes are
|
|
196
|
+
* required) and description may be absent. For commands, such as
|
|
197
|
+
* `ctl generate`, that never write INFO or SPK metadata.
|
|
198
|
+
*/
|
|
199
|
+
storeText?: boolean;
|
|
200
|
+
}
|
|
201
|
+
export declare function loadStandaloneManifest(root: string, options?: ManifestLoadOptions): ManifestResult;
|
|
194
202
|
/**
|
|
195
203
|
* The runtime registers routes from the manifest's methods: a policy for
|
|
196
204
|
* another method, or an App method with an SDK name, would refuse to start.
|
|
@@ -133,7 +133,7 @@ class Collector {
|
|
|
133
133
|
return value;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
export function loadStandaloneManifest(root) {
|
|
136
|
+
export function loadStandaloneManifest(root, options = {}) {
|
|
137
137
|
const file = join(root, STANDALONE_MANIFEST);
|
|
138
138
|
if (!existsSync(file)) {
|
|
139
139
|
return {
|
|
@@ -164,12 +164,12 @@ export function loadStandaloneManifest(root) {
|
|
|
164
164
|
c.fail("STANDALONE_MANIFEST_YAML", `${STANDALONE_MANIFEST} must be a YAML object.`);
|
|
165
165
|
return { ok: false, errors: c.errors };
|
|
166
166
|
}
|
|
167
|
-
const manifest = readManifest(raw, c);
|
|
167
|
+
const manifest = readManifest(raw, c, options.storeText !== false);
|
|
168
168
|
return manifest && c.errors.length === 0
|
|
169
169
|
? { ok: true, manifest }
|
|
170
170
|
: { ok: false, errors: c.errors };
|
|
171
171
|
}
|
|
172
|
-
function readManifest(raw, c) {
|
|
172
|
+
function readManifest(raw, c, storeText) {
|
|
173
173
|
let uiSecretIgnores = [];
|
|
174
174
|
try {
|
|
175
175
|
uiSecretIgnores = readUiSecretIgnores(raw.ui_secret_ignores);
|
|
@@ -229,11 +229,13 @@ function readManifest(raw, c) {
|
|
|
229
229
|
c.fail("STANDALONE_OS_MIN_VER_INVALID", `root templates require DSM ${DEFAULT_MIN_DSM} or later.`);
|
|
230
230
|
}
|
|
231
231
|
const displayname = c.text(raw.displayname, "displayname");
|
|
232
|
-
const catalogPath = activeCatalogPath();
|
|
232
|
+
const catalogPath = storeText ? activeCatalogPath() : undefined;
|
|
233
233
|
// With a catalog, its entry is the only source of store text; the manifest must not repeat it.
|
|
234
234
|
const description = catalogPath
|
|
235
235
|
? catalogOwnedFields(raw, c, catalogPath)
|
|
236
|
-
:
|
|
236
|
+
: storeText || raw.description !== undefined
|
|
237
|
+
? c.text(raw.description, "description")
|
|
238
|
+
: STORE_TEXT_SKIPPED;
|
|
237
239
|
const maintainer = c.text(raw.maintainer, "maintainer");
|
|
238
240
|
let metadata;
|
|
239
241
|
if (raw.metadata !== undefined)
|
|
@@ -754,6 +756,8 @@ function readManifest(raw, c) {
|
|
|
754
756
|
}
|
|
755
757
|
return manifest;
|
|
756
758
|
}
|
|
759
|
+
/** Description placeholder when store text is not loaded; never written to INFO. */
|
|
760
|
+
const STORE_TEXT_SKIPPED = "(store text not loaded)";
|
|
757
761
|
/** Reports hand-written store text next to a catalog; returns the placeholder the catalog replaces. */
|
|
758
762
|
function catalogOwnedFields(raw, c, catalogPath) {
|
|
759
763
|
const found = [];
|
|
@@ -43,6 +43,24 @@ export declare function uiFiles(root: string): string[];
|
|
|
43
43
|
/** Run before computing content addresses or mobile asset inventories. */
|
|
44
44
|
export declare function minifyUiTree(root: string, skip?: string[]): void;
|
|
45
45
|
export declare function uiFileProblems(file: string, input: string | Buffer): UiProblem[];
|
|
46
|
+
/** Bytes of each streamed window that own match starts; the rest is context. */
|
|
47
|
+
export declare const UI_STREAM_CHUNK: number;
|
|
48
|
+
/** Trailing context: a match that starts in a chunk is seen whole if it is at most this long. */
|
|
49
|
+
export declare const UI_STREAM_OVERLAP: number;
|
|
50
|
+
/**
|
|
51
|
+
* uiFileProblems for a file too large to hold in memory, fed in arbitrary pieces.
|
|
52
|
+
* The file is cut into chunks; each is scanned with UI_STREAM_LEAD bytes before it and
|
|
53
|
+
* UI_STREAM_OVERLAP bytes after it, and a window keeps only the matches that start
|
|
54
|
+
* inside its own chunk, so every match is counted once and seen whole unless it is
|
|
55
|
+
* longer than the overlap (then it is still flagged, by its first UI_STREAM_OVERLAP bytes).
|
|
56
|
+
* Cuts never split a UTF-8 sequence, so text decodes as it would in one piece.
|
|
57
|
+
*/
|
|
58
|
+
export declare class UiStreamScanner {
|
|
59
|
+
#private;
|
|
60
|
+
constructor(file: string, chunk?: number, overlap?: number);
|
|
61
|
+
write(piece: Buffer): void;
|
|
62
|
+
end(): UiProblem[];
|
|
63
|
+
}
|
|
46
64
|
export declare function logicalUiFile(file: string, moduleVersion?: string): string;
|
|
47
65
|
/**
|
|
48
66
|
* `ignores` must already be resolved to exact logical files (see resolveUiSecretIgnores).
|
|
@@ -156,26 +156,47 @@ const PASSWORD_CAPTIONS = new Set([
|
|
|
156
156
|
"passwort", "benutzerpasswort", "mot de passe", "mot de passe utilisateur",
|
|
157
157
|
"contraseña", "contraseña de usuario", "password utente",
|
|
158
158
|
]);
|
|
159
|
-
|
|
159
|
+
/** The raw regex hits behind credentialLiterals, with their positions; render with `literal`. */
|
|
160
|
+
function credentialLiteralMatches(content, bundle, from = 0, to = content.length) {
|
|
160
161
|
const found = [];
|
|
161
162
|
const literals = /(?:^|[,{])\s*(?:"(password|secret)"|'(password|secret)'|(password|secret))\s*:\s*(?:"([^"\r\n]+)"|'([^'\r\n]+)'|`([^`$\r\n]+)`|(\d+(?:\.\d+)?)\b)/gi;
|
|
162
|
-
for (const match of
|
|
163
|
+
for (const match of matchesIn(literals, content, from, to)) {
|
|
163
164
|
const key = match[1] ?? match[2] ?? match[3];
|
|
164
165
|
const value = match[4] ?? match[5] ?? match[6] ?? match[7];
|
|
165
166
|
const caption = value.replace(/\\(?:u([0-9a-f]{4})|x([0-9a-f]{2}))/gi, (_escape, unicode, hex) => String.fromCharCode(parseInt(unicode ?? hex, 16))).toLowerCase();
|
|
166
167
|
if (key.toLowerCase() === "password" && PASSWORD_CAPTIONS.has(caption))
|
|
167
168
|
continue;
|
|
168
|
-
found.push(match
|
|
169
|
+
found.push(match);
|
|
169
170
|
}
|
|
170
171
|
const assignments = /(?<![\w$"'`])(?:password|secret)\s*=\s*(?:"[^"\r\n]+"|'[^'\r\n]+'|`[^`$\r\n]+`|\d+(?:\.\d+)?\b)|["'`](?:password|secret)=[^"'`\s]+/gi;
|
|
171
|
-
for (const match of
|
|
172
|
-
found.push(match
|
|
172
|
+
for (const match of matchesIn(assignments, content, from, to))
|
|
173
|
+
found.push(match);
|
|
173
174
|
// Unquoted values in environment/config/HTML text; JS variable assignments are not literals.
|
|
174
175
|
if (!bundle)
|
|
175
|
-
for (const match of
|
|
176
|
-
found.push(match
|
|
176
|
+
for (const match of matchesIn(/(?<![\w$])(?:password|secret)\s*=\s*[^\s"'`<>{};,]+/gi, content, from, to))
|
|
177
|
+
found.push(match);
|
|
178
|
+
return found;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Global matches that start in [from, to). Searching begins at `from`, so lookbehinds
|
|
182
|
+
* still see the text before it while `^` and earlier matches cannot reach into it.
|
|
183
|
+
*/
|
|
184
|
+
function matchesIn(pattern, content, from = 0, to = content.length) {
|
|
185
|
+
const re = new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`);
|
|
186
|
+
const found = [];
|
|
187
|
+
re.lastIndex = from;
|
|
188
|
+
for (let match = re.exec(content); match && match.index < to; match = re.exec(content)) {
|
|
189
|
+
found.push(match);
|
|
190
|
+
if (match[0] === "")
|
|
191
|
+
re.lastIndex++;
|
|
192
|
+
}
|
|
177
193
|
return found;
|
|
178
194
|
}
|
|
195
|
+
/** Only the object-literal form starts with its delimiter; reports omit it. */
|
|
196
|
+
const literal = (match) => match[0].replace(/^[,{]?\s*/, "");
|
|
197
|
+
function credentialLiterals(content, bundle) {
|
|
198
|
+
return credentialLiteralMatches(content, bundle).map(literal);
|
|
199
|
+
}
|
|
179
200
|
const unique = (items) => [...new Set(items)];
|
|
180
201
|
const allMatches = (pattern, content) => unique([...content.matchAll(new RegExp(pattern.source, pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`))].map(match => match[0]));
|
|
181
202
|
export function uiFileProblems(file, input) {
|
|
@@ -200,6 +221,100 @@ export function uiFileProblems(file, input) {
|
|
|
200
221
|
found.push({ file, pattern: "credential-literal", matches: literals });
|
|
201
222
|
return found;
|
|
202
223
|
}
|
|
224
|
+
/** Bytes of each streamed window that own match starts; the rest is context. */
|
|
225
|
+
export const UI_STREAM_CHUNK = 16 * 1024 * 1024;
|
|
226
|
+
/** Trailing context: a match that starts in a chunk is seen whole if it is at most this long. */
|
|
227
|
+
export const UI_STREAM_OVERLAP = 1024 * 1024;
|
|
228
|
+
/** Leading context, so lookbehinds and `^` at a chunk start see the bytes before it. */
|
|
229
|
+
const UI_STREAM_LEAD = 4096;
|
|
230
|
+
/**
|
|
231
|
+
* uiFileProblems for a file too large to hold in memory, fed in arbitrary pieces.
|
|
232
|
+
* The file is cut into chunks; each is scanned with UI_STREAM_LEAD bytes before it and
|
|
233
|
+
* UI_STREAM_OVERLAP bytes after it, and a window keeps only the matches that start
|
|
234
|
+
* inside its own chunk, so every match is counted once and seen whole unless it is
|
|
235
|
+
* longer than the overlap (then it is still flagged, by its first UI_STREAM_OVERLAP bytes).
|
|
236
|
+
* Cuts never split a UTF-8 sequence, so text decodes as it would in one piece.
|
|
237
|
+
*/
|
|
238
|
+
export class UiStreamScanner {
|
|
239
|
+
#file;
|
|
240
|
+
#chunk;
|
|
241
|
+
#overlap;
|
|
242
|
+
#pending = [];
|
|
243
|
+
#size = 0;
|
|
244
|
+
#lead = Buffer.alloc(0);
|
|
245
|
+
#executable;
|
|
246
|
+
#head = Buffer.alloc(0);
|
|
247
|
+
#found = new Map();
|
|
248
|
+
constructor(file, chunk = UI_STREAM_CHUNK, overlap = UI_STREAM_OVERLAP) {
|
|
249
|
+
if (!(chunk > 0 && overlap > 0))
|
|
250
|
+
throw new Error("UiStreamScanner needs a positive chunk and overlap");
|
|
251
|
+
this.#file = file;
|
|
252
|
+
this.#chunk = chunk;
|
|
253
|
+
this.#overlap = overlap;
|
|
254
|
+
}
|
|
255
|
+
write(piece) {
|
|
256
|
+
if (this.#executable === undefined) {
|
|
257
|
+
this.#head = Buffer.concat([this.#head, piece]);
|
|
258
|
+
// PE needs its header offset at 60 and the header behind it; 4 KiB covers real files.
|
|
259
|
+
if (this.#head.length < 4096) {
|
|
260
|
+
this.#pending.push(piece);
|
|
261
|
+
this.#size += piece.length;
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
this.#executable = isExecutable(this.#head);
|
|
265
|
+
}
|
|
266
|
+
this.#pending.push(piece);
|
|
267
|
+
this.#size += piece.length;
|
|
268
|
+
while (this.#size >= this.#chunk + this.#overlap)
|
|
269
|
+
this.#scan(false);
|
|
270
|
+
}
|
|
271
|
+
end() {
|
|
272
|
+
if (this.#executable === undefined)
|
|
273
|
+
this.#executable = isExecutable(this.#head);
|
|
274
|
+
this.#scan(true);
|
|
275
|
+
return [...this.#found].map(([pattern, matches]) => ({ file: this.#file, pattern, ...(matches ? { matches: [...matches] } : {}) }));
|
|
276
|
+
}
|
|
277
|
+
#scan(last) {
|
|
278
|
+
const data = Buffer.concat(this.#pending);
|
|
279
|
+
// Own [0, cut); a continuation byte (10xxxxxx) never starts a cut.
|
|
280
|
+
let cut = last ? data.length : this.#chunk;
|
|
281
|
+
if (!this.#executable)
|
|
282
|
+
while (cut < data.length && (data[cut] & 0xc0) === 0x80)
|
|
283
|
+
cut++;
|
|
284
|
+
const decode = (bytes) => bytes.toString(this.#executable ? "latin1" : "utf8");
|
|
285
|
+
const lead = decode(this.#lead), owned = decode(data.subarray(0, cut));
|
|
286
|
+
const text = lead + owned + decode(data.subarray(cut));
|
|
287
|
+
const start = lead.length, end = start + owned.length;
|
|
288
|
+
const add = (pattern, matches) => {
|
|
289
|
+
if (!this.#found.has(pattern))
|
|
290
|
+
this.#found.set(pattern, matches ? new Set() : undefined);
|
|
291
|
+
for (const match of matches ?? [])
|
|
292
|
+
this.#found.get(pattern).add(match);
|
|
293
|
+
};
|
|
294
|
+
const name = basename(this.#file).toLowerCase();
|
|
295
|
+
if (name === ".env" || name.startsWith(".env."))
|
|
296
|
+
add("environment-file");
|
|
297
|
+
if (this.#file.toLowerCase().endsWith(".map"))
|
|
298
|
+
add("source-map-file");
|
|
299
|
+
if (matchesIn(SOURCE_MAP_COMMENT, text, start, end).length)
|
|
300
|
+
add("sourceMappingURL");
|
|
301
|
+
for (const [pattern, match] of this.#executable ? BINARY_SECRET_PATTERNS : SECRET_PATTERNS) {
|
|
302
|
+
const hits = matchesIn(match, text, start, end).map(hit => hit[0]);
|
|
303
|
+
if (hits.length)
|
|
304
|
+
add(pattern, hits);
|
|
305
|
+
}
|
|
306
|
+
if (!this.#executable) {
|
|
307
|
+
const hits = credentialLiteralMatches(text, isUiBundle(this.#file), start, end).map(literal);
|
|
308
|
+
if (hits.length)
|
|
309
|
+
add("credential-literal", hits);
|
|
310
|
+
}
|
|
311
|
+
const before = Buffer.concat([this.#lead, data.subarray(0, cut)]);
|
|
312
|
+
this.#lead = Buffer.from(before.subarray(Math.max(0, before.length - UI_STREAM_LEAD)));
|
|
313
|
+
const rest = data.subarray(cut);
|
|
314
|
+
this.#pending = rest.length ? [Buffer.from(rest)] : [];
|
|
315
|
+
this.#size = rest.length;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
203
318
|
export function logicalUiFile(file, moduleVersion) {
|
|
204
319
|
const prefix = moduleVersion ? `app/${moduleVersion}/` : "";
|
|
205
320
|
return prefix && file.startsWith(prefix) ? `app/${file.slice(prefix.length)}` : file;
|
package/docs/catalog-text.md
CHANGED
|
@@ -23,7 +23,8 @@ packages:
|
|
|
23
23
|
Pass the file to `check`, `build` and `inspect` with `--catalog <catalog.yaml>`,
|
|
24
24
|
or set `SYNOPKGLAND_CATALOG` (also in the project `.env`; a relative path is
|
|
25
25
|
resolved from the current directory). Without either, the manifest's own text is
|
|
26
|
-
used as before.
|
|
26
|
+
used as before. `ctl generate` reads no store text: it ignores the catalog and
|
|
27
|
+
needs neither release notes nor `description`.
|
|
27
28
|
|
|
28
29
|
## What the build writes
|
|
29
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synopackageland/cli",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.11",
|
|
4
4
|
"description": "Syno Package Land Developer Kit CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,20 +26,6 @@
|
|
|
26
26
|
"docs/install-memory.md",
|
|
27
27
|
"docs/catalog-text.md"
|
|
28
28
|
],
|
|
29
|
-
"scripts": {
|
|
30
|
-
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
31
|
-
"build": "rm -rf dist && node scripts/prepare-native-http.mjs && tsc",
|
|
32
|
-
"test": "pnpm run build && node --import tsx --import ./test/helpers/strict-dsm-setup.ts --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
33
|
-
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
34
|
-
"test:scripts": "node --test scripts/test/gate.test.mjs scripts/test/release.test.mjs scripts/test/pack-docker.test.mjs scripts/test/npm-pack.test.mjs scripts/test/executor-bump.test.mjs scripts/test/smoke-exports.test.mjs scripts/test/parallel.test.mjs scripts/test/scaffold-matrix.test.mjs scripts/test/frontend-deps.test.mjs scripts/test/docker-gate.test.mjs scripts/test/gate-plan.test.mjs scripts/test/gates.test.mjs && python3 scripts/test/npm-publish.py",
|
|
35
|
-
"gates": "bash scripts/ci/gates.sh",
|
|
36
|
-
"gates:fast": "bash scripts/ci/gates.sh",
|
|
37
|
-
"prepublishOnly": "pnpm run build && node --input-type=module -e 'import {enforceRepositorySecrets} from \"./dist/secret-files.js\"; enforceRepositorySecrets(process.cwd())'",
|
|
38
|
-
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
39
|
-
"test:basic": "node --import tsx --test test/schema.test.ts test/standalone-manifest.test.ts test/native-arch.test.ts test/archive-inventory.test.ts test/secret-files.test.ts",
|
|
40
|
-
"check:dsm-contract": "node scripts/check-dsm-api-contract.mjs",
|
|
41
|
-
"check:dsm-hub": "node scripts/check-dsm-api-hub.mjs"
|
|
42
|
-
},
|
|
43
29
|
"dependencies": {
|
|
44
30
|
"@napi-rs/keyring": "^2.1.1",
|
|
45
31
|
"@synopackageland/templates": "~0.44.1",
|
|
@@ -102,5 +88,17 @@
|
|
|
102
88
|
"./native-layout": "./dist/standalone/native-layout.js",
|
|
103
89
|
"./e2e": "./dist/e2e/dsm.js"
|
|
104
90
|
},
|
|
105
|
-
"
|
|
106
|
-
|
|
91
|
+
"scripts": {
|
|
92
|
+
"check:docs": "node --test scripts/check-doc-versions.test.mjs && node scripts/check-doc-versions.mjs",
|
|
93
|
+
"build": "rm -rf dist && node scripts/prepare-native-http.mjs && tsc",
|
|
94
|
+
"test": "pnpm run build && node --import tsx --import ./test/helpers/strict-dsm-setup.ts --test --test-concurrency=${SYNOPKGLAND_GATE_JOBS:-3} test/*.test.ts test/ctl/*.test.ts",
|
|
95
|
+
"test:glossary": "node --test scripts/test/glossary-drift.test.mjs",
|
|
96
|
+
"test:scripts": "node --test scripts/test/gate.test.mjs scripts/test/release.test.mjs scripts/test/pack-docker.test.mjs scripts/test/npm-pack.test.mjs scripts/test/executor-bump.test.mjs scripts/test/smoke-exports.test.mjs scripts/test/parallel.test.mjs scripts/test/scaffold-matrix.test.mjs scripts/test/frontend-deps.test.mjs scripts/test/docker-gate.test.mjs scripts/test/gate-plan.test.mjs scripts/test/gates.test.mjs && python3 scripts/test/npm-publish.py",
|
|
97
|
+
"gates": "bash scripts/ci/gates.sh",
|
|
98
|
+
"gates:fast": "bash scripts/ci/gates.sh",
|
|
99
|
+
"gates:full": "bash scripts/ci/gates.sh --full",
|
|
100
|
+
"test:basic": "node --import tsx --test test/schema.test.ts test/standalone-manifest.test.ts test/native-arch.test.ts test/archive-inventory.test.ts test/secret-files.test.ts",
|
|
101
|
+
"check:dsm-contract": "node scripts/check-dsm-api-contract.mjs",
|
|
102
|
+
"check:dsm-hub": "node scripts/check-dsm-api-hub.mjs"
|
|
103
|
+
}
|
|
104
|
+
}
|