@synopackageland/cli 0.53.7 → 0.53.8

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.53.8 (2026-11-11)
4
+
5
+ - The ready-to-paste `ui_secret_ignores` entry printed by `build` and project `check` now lists every flagged text. Texts longer than 200 characters were left out, which in minified output (non-ASCII escaped as `\uXXXX`) dropped long translated strings; now every text up to the 4096-character `match` limit is listed untruncated, exactly as `match` needs it. Error lines stay truncated, and known token signatures are still never printed.
6
+ - `check` prints one entry per file instead of one per finding, so a file with several kinds of hits no longer gets duplicate entries. When the file already has an entry, the paste is a complete replacement that keeps its reviewed texts, drops stale ones and adds the new hits.
7
+ - Pasted values are written as ASCII-only YAML strings, so they parse back to exactly the flagged text.
8
+
3
9
  ## 0.53.7 (2026-11-11)
4
10
 
5
11
  - The v2 operation registry accepts the SDK 0.53.33 AI semantics: `ai` classes `propose`, `local` and `one-click`, and optional `consent`, `targets`, `risk`, `tier`, `undo`, `audit`, `mcp`, `dynamicProvider` and `labels`. `ctl generate`, `check` and description validation refuse invalid values with the field named.
@@ -64,11 +64,21 @@ export declare function staleUiIgnores(problems: UiProblem[], ignores: ResolvedU
64
64
  export declare function showUiMatch(text: string, limit?: number): string;
65
65
  /** A logical file with a bundler-looking hash (Name-AbCd1234.js) becomes Name-[hash].js. */
66
66
  export declare function suggestUiIgnoreFile(file: string): string;
67
+ /** The longest `match` text readUiSecretIgnores accepts. */
68
+ export declare const UI_MATCH_LIMIT = 4096;
67
69
  /**
68
- * A ready-to-paste ui_secret_ignores block for reviewed false positives. Texts that
69
- * look like real tokens or exceed 200 characters are left for the developer to copy.
70
+ * A YAML double-quoted scalar that parses back to exactly `text`. Only printable
71
+ * ASCII is written raw, so no YAML line-break or BOM rule can alter the value.
70
72
  */
71
- export declare function uiIgnoreSuggestion(problems: UiProblem[], moduleVersion?: string): string;
73
+ export declare function yamlQuote(text: string): string;
74
+ /**
75
+ * A ready-to-paste ui_secret_ignores block for reviewed false positives, one entry per
76
+ * file with every flagged text, untruncated, exactly as `match` needs it. Pass the
77
+ * resolved ignores so a file that already has an entry gets a complete replacement.
78
+ * Texts that look like real tokens are never printed, and texts over UI_MATCH_LIMIT
79
+ * cannot be listed; both leave a comment instead.
80
+ */
81
+ export declare function uiIgnoreSuggestion(problems: UiProblem[], moduleVersion?: string, ignores?: ResolvedUiSecretIgnore[]): string;
72
82
  export declare function describeUiProblem(problem: UiProblem): string;
73
83
  export declare function scanUiTree(root: string, ignores?: ResolvedUiSecretIgnore[], moduleVersion?: string, packed?: boolean): UiProblem[];
74
84
  /** Returns the resolved ignores; record them with storedUiSecretIgnores. */
@@ -28,7 +28,7 @@ export function readUiSecretIgnores(value) {
28
28
  if (match === undefined)
29
29
  return item.file.includes(UI_HASH_TOKEN);
30
30
  return !match.length || new Set(match).size !== match.length ||
31
- match.some(text => typeof text !== "string" || !text || text.length > 4096);
31
+ match.some(text => typeof text !== "string" || !text || text.length > UI_MATCH_LIMIT);
32
32
  }))
33
33
  throw invalid();
34
34
  // Replace one token with an inert character so the exact-path rules still reject
@@ -253,35 +253,53 @@ export function showUiMatch(text, limit = 80) {
253
253
  export function suggestUiIgnoreFile(file) {
254
254
  return file.replace(/^(.*\/)?([^/]*[-.])[A-Za-z0-9_-]{8}(\.[A-Za-z0-9]+)$/, (_all, dir = "", stem, ext) => `${dir}${stem}${UI_HASH_TOKEN}${ext}`);
255
255
  }
256
+ /** The longest `match` text readUiSecretIgnores accepts. */
257
+ export const UI_MATCH_LIMIT = 4096;
256
258
  /**
257
- * A ready-to-paste ui_secret_ignores block for reviewed false positives. Texts that
258
- * look like real tokens or exceed 200 characters are left for the developer to copy.
259
+ * A YAML double-quoted scalar that parses back to exactly `text`. Only printable
260
+ * ASCII is written raw, so no YAML line-break or BOM rule can alter the value.
259
261
  */
260
- export function uiIgnoreSuggestion(problems, moduleVersion) {
262
+ export function yamlQuote(text) {
263
+ return JSON.stringify(text).replace(/[^\x20-\x7e]/g, char => `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`);
264
+ }
265
+ /**
266
+ * A ready-to-paste ui_secret_ignores block for reviewed false positives, one entry per
267
+ * file with every flagged text, untruncated, exactly as `match` needs it. Pass the
268
+ * resolved ignores so a file that already has an entry gets a complete replacement.
269
+ * Texts that look like real tokens are never printed, and texts over UI_MATCH_LIMIT
270
+ * cannot be listed; both leave a comment instead.
271
+ */
272
+ export function uiIgnoreSuggestion(problems, moduleVersion, ignores = []) {
261
273
  const byFile = new Map();
262
- const manual = new Set();
263
274
  for (const problem of problems) {
264
275
  if (SOURCE_MAP_PATTERNS.includes(problem.pattern) || !problem.matches)
265
276
  continue;
266
277
  const file = logicalUiFile(problem.file, moduleVersion);
267
- const texts = byFile.get(file) ?? [];
278
+ const entry = byFile.get(file) ?? { texts: [], redacted: 0, long: 0 };
268
279
  for (const text of problem.matches) {
269
- if (text.length > 200 || showUiMatch(text, Infinity).startsWith("<redacted"))
270
- manual.add(file);
280
+ if (showUiMatch(text, Infinity).startsWith("<redacted"))
281
+ entry.redacted++;
282
+ else if (text.length > UI_MATCH_LIMIT)
283
+ entry.long++;
271
284
  else
272
- texts.push(text);
285
+ entry.texts.push(text);
273
286
  }
274
- byFile.set(file, texts);
287
+ byFile.set(file, entry);
275
288
  }
276
289
  if (!byFile.size)
277
290
  return "";
278
291
  const lines = ["ui_secret_ignores:"];
279
- for (const [file, texts] of byFile) {
280
- lines.push(` - file: ${JSON.stringify(suggestUiIgnoreFile(file))}`, " reason: \"<why this is a false positive>\"", " match:");
281
- for (const text of unique(texts))
282
- lines.push(` - ${JSON.stringify(text)}`);
283
- if (manual.has(file) || !texts.length)
284
- lines.push(` # copy any other flagged text from ui/${file} after review`);
292
+ for (const [file, { texts, redacted, long }] of byFile) {
293
+ const existing = ignores.find(item => item.file === file);
294
+ if (existing)
295
+ lines.push(` # replaces the existing entry for ui/${existing.pattern ?? existing.file}`);
296
+ lines.push(` - file: ${yamlQuote(existing?.pattern ?? suggestUiIgnoreFile(file))}`, ` reason: ${existing ? yamlQuote(existing.reason) : "\"<why this is a false positive>\""}`, " match:");
297
+ for (const text of unique([...existing?.match ?? [], ...texts]))
298
+ lines.push(` - ${yamlQuote(text)}`);
299
+ if (redacted)
300
+ lines.push(` # copy from ui/${file} after review: ${redacted} flagged text(s) look like real tokens and are not printed`);
301
+ if (long)
302
+ lines.push(` # ${long} flagged text(s) in ui/${file} exceed ${UI_MATCH_LIMIT} characters and cannot be listed; shorten them`);
285
303
  }
286
304
  return lines.join("\n");
287
305
  }
@@ -322,7 +340,7 @@ export function enforcePublicUi(root, ignores = [], moduleVersion) {
322
340
  console.warn(`[UI_SECRET_IGNORED] ui/${problem.file}: ${problem.pattern}; ${problem.ignoredBy ? `matched ui/${problem.ignoredBy}; ` : ""}reason: ${problem.ignored}`);
323
341
  const errors = problems.filter(item => !item.ignored);
324
342
  if (errors.length) {
325
- const paste = uiIgnoreSuggestion(errors, moduleVersion);
343
+ const paste = uiIgnoreSuggestion(errors, moduleVersion, resolved);
326
344
  throw Object.assign(new Error(errors.map(describeUiProblem).join("\n") +
327
345
  (paste ? `\nOnly if every hit is a reviewed false positive, add to dsm-package.yaml:\n${paste}` : "")), { code: "PUBLIC_UI_UNSAFE", hint: "Files under ui/ are public. Remove credentials and source maps; only false positives may use ui_secret_ignores with a reason and match." });
328
346
  }
package/dist/validate.js CHANGED
@@ -78,14 +78,24 @@ export function validateProject(project, _options = {}) {
78
78
  try {
79
79
  // Scan JS/CSS as build packs it (minified), so printed match texts agree with build.
80
80
  const raw = scanUiTree(dir, [], undefined, true).map(item => ({ ...item, file: prefix + item.file }));
81
- for (const stale of staleUiIgnores(raw, ignores))
81
+ const staleList = staleUiIgnores(raw, ignores);
82
+ for (const stale of staleList)
82
83
  problems.push({
83
84
  code: "UI_SECRET_IGNORE_STALE", span: { file: "dsm-package.yaml", line: 1, column: 1 },
84
85
  message: `ui_secret_ignores ui/${stale.entry} match ${showUiMatch(stale.match)} no longer occurs in ui/${stale.file}`,
85
86
  suggestion: "Remove the stale match (or the whole entry) after reviewing the file again.",
86
87
  });
87
- for (const item of applyUiIgnores(raw, ignores)) {
88
- const paste = item.ignored ? "" : uiIgnoreSuggestion([item]);
88
+ const applied = applyUiIgnores(raw, ignores);
89
+ // One complete entry per file, on its first unexempted finding, so pasting never duplicates a file.
90
+ const pasted = new Set();
91
+ // A replacement entry keeps only listed texts that still occur.
92
+ const current = ignores.map(ignore => ignore.match
93
+ ? { ...ignore, match: ignore.match.filter(text => !staleList.some(stale => stale.file === ignore.file && stale.match === text)) } : ignore);
94
+ for (const item of applied) {
95
+ const paste = item.ignored || pasted.has(item.file) ? "" :
96
+ uiIgnoreSuggestion(applied.filter(other => !other.ignored && other.file === item.file), undefined, current);
97
+ if (paste)
98
+ pasted.add(item.file);
89
99
  const finding = {
90
100
  code: item.ignored ? "UI_SECRET_IGNORED" : "PUBLIC_UI_UNSAFE",
91
101
  span: { file: `ui/${item.file}`, line: 1, column: 1 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synopackageland/cli",
3
- "version": "0.53.7",
3
+ "version": "0.53.8",
4
4
  "description": "Syno Package Land Developer Kit CLI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,8 @@ ui_secret_ignores:
19
19
 
20
20
  Only listed texts are exempt: a new hit in the same file still fails, and a
21
21
  listed text that disappears fails as stale. `build` and `check` print a
22
- ready-to-paste entry for each failing file; paste it only after review.
22
+ ready-to-paste entry for each failing file that lists every flagged text in
23
+ full (or replaces the file's existing entry); paste it only after review.
23
24
  Exceptions are recorded in the SPK as resolved files and reported during
24
25
  inspection. They never allow source maps and do not bypass repository secret
25
26
  checks. See docs/release-checks.md.