aontu 0.63.0 → 0.64.0

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 (61) hide show
  1. package/README.md +6 -6
  2. package/dist/aontu.d.ts +3 -3
  3. package/dist/aontu.js +4 -6
  4. package/dist/aontu.js.map +1 -1
  5. package/dist/aontumodel.js +6 -12
  6. package/dist/aontumodel.js.map +1 -1
  7. package/dist/casing.d.ts +5 -0
  8. package/dist/casing.js +90 -0
  9. package/dist/casing.js.map +1 -0
  10. package/dist/cli.d.ts +2 -2
  11. package/dist/cli.js +147 -335
  12. package/dist/cli.js.map +1 -1
  13. package/dist/helpdoc.js +1 -1
  14. package/dist/helpdoc.js.map +1 -1
  15. package/dist/hints.js +3 -0
  16. package/dist/hints.js.map +1 -1
  17. package/dist/lsp.d.ts +1 -1
  18. package/dist/mcp.js +0 -36
  19. package/dist/mcp.js.map +1 -1
  20. package/dist/mod-tool.js +16 -1
  21. package/dist/mod-tool.js.map +1 -1
  22. package/dist/profile.d.ts +9 -0
  23. package/dist/profile.js +28 -0
  24. package/dist/profile.js.map +1 -0
  25. package/dist/trace.d.ts +21 -0
  26. package/dist/trace.js +107 -0
  27. package/dist/trace.js.map +1 -0
  28. package/dist/tsconfig.tsbuildinfo +1 -1
  29. package/dist/unify.js +1 -6
  30. package/dist/unify.js.map +1 -1
  31. package/dist/val/CmpFuncVal.d.ts +2 -0
  32. package/dist/val/CmpFuncVal.js +47 -13
  33. package/dist/val/CmpFuncVal.js.map +1 -1
  34. package/dist/val/NomFuncVal.js +11 -13
  35. package/dist/val/NomFuncVal.js.map +1 -1
  36. package/dist/val/ReferFuncVal.js +3 -0
  37. package/dist/val/ReferFuncVal.js.map +1 -1
  38. package/package.json +1 -1
  39. package/skill/tasks.md +9 -7
  40. package/src/aontu.ts +3 -8
  41. package/src/aontumodel.ts +6 -12
  42. package/src/casing.ts +95 -0
  43. package/src/cli.ts +162 -359
  44. package/src/helpdoc.ts +1 -1
  45. package/src/hints.ts +3 -0
  46. package/src/mcp.ts +0 -39
  47. package/src/mod-tool.ts +18 -1
  48. package/src/profile.ts +42 -0
  49. package/src/trace.ts +157 -0
  50. package/src/unify.ts +1 -6
  51. package/src/val/CmpFuncVal.ts +66 -20
  52. package/src/val/NomFuncVal.ts +3 -5
  53. package/src/val/ReferFuncVal.ts +4 -0
  54. package/dist/lower.d.ts +0 -23
  55. package/dist/lower.js +0 -528
  56. package/dist/lower.js.map +0 -1
  57. package/dist/render.d.ts +0 -53
  58. package/dist/render.js +0 -432
  59. package/dist/render.js.map +0 -1
  60. package/src/lower.ts +0 -586
  61. package/src/render.ts +0 -580
package/src/casing.ts ADDED
@@ -0,0 +1,95 @@
1
+ /* Copyright (c) 2026 Richard Rodger, MIT License */
2
+
3
+
4
+ function isUpper(c: string): boolean {
5
+ return 'A' <= c && c <= 'Z'
6
+ }
7
+
8
+ function isLower(c: string): boolean {
9
+ return 'a' <= c && c <= 'z'
10
+ }
11
+
12
+ function isDigit(c: string): boolean {
13
+ return '0' <= c && c <= '9'
14
+ }
15
+
16
+ function isASCII(c: string): boolean {
17
+ return (c.codePointAt(0) as number) < 0x80
18
+ }
19
+
20
+ export function splitWords(name: string): string[] {
21
+ const words: string[] = []
22
+ let cur = ''
23
+ const chars = Array.from(name)
24
+ for (let i = 0; i < chars.length; i++) {
25
+ const c = chars[i]
26
+ if ('_' === c || '-' === c || ' ' === c) {
27
+ if ('' !== cur) {
28
+ words.push(cur)
29
+ }
30
+ cur = ''
31
+ continue
32
+ }
33
+ if ('' !== cur) {
34
+ const prev = chars[i - 1]
35
+ const next = chars[i + 1]
36
+ const boundary = isASCII(c) && isASCII(prev) && (
37
+ (isUpper(c) && (isLower(prev) || isDigit(prev))) ||
38
+ (isDigit(c) !== isDigit(prev)) ||
39
+ (isUpper(c) && isUpper(prev) && undefined !== next && isLower(next)))
40
+ if (boundary) {
41
+ words.push(cur)
42
+ cur = ''
43
+ }
44
+ }
45
+ cur += c
46
+ }
47
+ if ('' !== cur) {
48
+ words.push(cur)
49
+ }
50
+ return words
51
+ }
52
+
53
+ export function lowerASCII(s: string): string {
54
+ return Array.from(s).map((c) =>
55
+ isUpper(c) ? String.fromCharCode(c.charCodeAt(0) + 32) : c).join('')
56
+ }
57
+
58
+ export function upperASCII(s: string): string {
59
+ return Array.from(s).map((c) =>
60
+ isLower(c) ? String.fromCharCode(c.charCodeAt(0) - 32) : c).join('')
61
+ }
62
+
63
+ // A word capitalised: the acronym set wins, so `id` is `ID` under a
64
+ // profile that lists it and `Id` under one that does not.
65
+ export function capitalise(word: string, acronyms: string[]): string {
66
+ const low = lowerASCII(word)
67
+ for (const a of acronyms) {
68
+ if (lowerASCII(a) === low) {
69
+ return a
70
+ }
71
+ }
72
+ const chars = Array.from(low)
73
+ return upperASCII(chars[0]) + chars.slice(1).join('')
74
+ }
75
+
76
+ // THE CASE STYLES, over the words. `nom` maps its own style names
77
+ // onto these.
78
+ export function caseName(name: string, style: string, acronyms: string[]): string {
79
+ const words = splitWords(name)
80
+ if ('snake' === style) {
81
+ return words.map(lowerASCII).join('_')
82
+ }
83
+ if ('screaming' === style) {
84
+ return words.map(upperASCII).join('_')
85
+ }
86
+ if ('kebab' === style) {
87
+ return words.map(lowerASCII).join('-')
88
+ }
89
+ const caps = words.map((w) => capitalise(w, acronyms))
90
+ if ('pascal' === style) {
91
+ return caps.join('')
92
+ }
93
+ // camel: the first word lower, and never an acronym.
94
+ return lowerASCII(words[0]) + caps.slice(1).join('')
95
+ }