@alis-build/design-system 0.24.0 → 0.24.1

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/check.mjs CHANGED
@@ -238,11 +238,12 @@ function styles() {
238
238
  function words() {
239
239
  const { terms } = JSON.parse(readFileSync(join(here, 'words.json'), 'utf8'))
240
240
  // Longest first, and each match blanked before the next looks: "Idea brief"
241
- // is one finding, not that and "idea" again.
241
+ // is one finding, not that and "idea" again. A word with a slash on either
242
+ // side is a path (ideas/${id}), a dotted one is code (ideas.length).
242
243
  const retired = terms
243
244
  .flatMap((term) => term.retired.map((text) => ({ text, name: term.name })))
244
245
  .sort((a, b) => b.text.length - a.text.length)
245
- .map((each) => ({ ...each, pattern: new RegExp(`(?<![\\w./-])${escape(each.text).replace(/ /g, '\\s+')}(?![\\w-]|[./]\\w)`, 'gi') }))
246
+ .map((each) => ({ ...each, pattern: new RegExp(`(?<![\\w./-])${escape(each.text).replace(/ /g, '\\s+')}(?![\\w/-]|\\.\\w)`, 'gi') }))
246
247
 
247
248
  const sources = ['.svelte', '.vue', '.html', '.jsx', '.tsx', '.js', '.ts', '.mjs']
248
249
  const missing = paths.filter((path) => !existsSync(path))
@@ -382,12 +383,22 @@ function unlogged(code) {
382
383
  }
383
384
 
384
385
  // Calls back with each quoted string in code, and its offset, skipping
385
- // comments. A quote that doesn't close on its line is an apostrophe, not a
386
- // string.
386
+ // comments and regular expressions. A quote that doesn't close on its line is
387
+ // an apostrophe, not a string.
387
388
  function quoted(code, each) {
388
389
  for (let i = 0; i < code.length; i++) {
389
390
  const c = code[i]
390
- if (c === '/' && code[i + 1] === '/') {
391
+ if (c === '/' && code[i + 1] !== '/' && code[i + 1] !== '*' && startsRegex(code, i)) {
392
+ // To the closing slash, past escapes and character classes ([/`]).
393
+ let j = i + 1
394
+ for (let inClass = false; j < code.length && code[j] !== '\n'; j++) {
395
+ if (code[j] === '\\') j++
396
+ else if (code[j] === '[') inClass = true
397
+ else if (code[j] === ']') inClass = false
398
+ else if (code[j] === '/' && !inClass) break
399
+ }
400
+ i = j
401
+ } else if (c === '/' && code[i + 1] === '/') {
391
402
  const end = code.indexOf('\n', i)
392
403
  if (end < 0) return
393
404
  i = end
@@ -424,6 +435,16 @@ function quoted(code, each) {
424
435
  }
425
436
  }
426
437
 
438
+ // A slash opens a regular expression where a value is expected: after an
439
+ // operator or an opening bracket, at the start, or after return; after a name,
440
+ // a number or a closing bracket it divides.
441
+ function startsRegex(code, i) {
442
+ let j = i - 1
443
+ while (j >= 0 && /\s/.test(code[j])) j--
444
+ if (j < 0 || '(,=:[!&|?{};+-*%<>~^'.includes(code[j])) return true
445
+ return /\b(?:return|typeof|case|do|else|in|of|void|yield|await)$/.test(code.slice(Math.max(0, j - 5), j + 1))
446
+ }
447
+
427
448
  // A --declared file, as text. In JSON a stylesheet is a string with its line
428
449
  // breaks escaped, so its strings are read as they would arrive too.
429
450
  function readDeclared(file) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alis-build/design-system",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
4
4
  "description": "The AlisX design system for coding agents: tokens, product CSS, component markup, capability marks, words and rules.",
5
5
  "keywords": ["alisx", "design-system", "design-tokens", "css"],
6
6
  "homepage": "https://alisx.com",
package/rules/words.md CHANGED
@@ -49,6 +49,11 @@ output, a chat is not a thread, and Sharing is not permissions. `words.json`
49
49
  gives the code word beside the name where they differ, so you can tell which
50
50
  you are holding.
51
51
 
52
+ **Words written for Alis use the names too**: instructions, tool and field
53
+ descriptions. A model repeats what it reads, so "a new idea" there becomes "a
54
+ new idea" in a reply. A resource path (`ideas/*/streams/*`) is code and stays
55
+ as it is; the check leaves a word beside a slash alone.
56
+
52
57
  ## The verbs
53
58
 
54
59
  New, Add and Upload are in [buttons.md](buttons.md) § Naming the action. The