@voodocs/cli 3.0.0 → 3.0.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.
@@ -16,7 +16,7 @@ This module provides the command-line interface for VooDocs.
16
16
  import click
17
17
  from typing import Optional
18
18
 
19
- __version__ = "3.0.0"
19
+ __version__ = "3.0.1"
20
20
 
21
21
 
22
22
  @click.group()
@@ -0,0 +1,138 @@
1
+ """
2
+ ⊢companion_files:expansion
3
+ ∂{re,typing}
4
+ ⚠{python≥3.7}
5
+ ⊨{∀abbrev→expanded}
6
+ 🔒{read-only}
7
+ ⚡{O(n)|n=text-length}
8
+ """
9
+
10
+ """
11
+ DarkArts v3.0.0 - Abbreviation Expansion for Companion Files
12
+
13
+ Expands abbreviated text in companion files to full human-readable form.
14
+ """
15
+
16
+ import re
17
+ from typing import Dict
18
+
19
+ # Import abbreviation dictionary from v3.0.0
20
+ import sys
21
+ from pathlib import Path
22
+ sys.path.insert(0, str(Path(__file__).parent))
23
+ from darkarts_abbreviations import ABBREVIATIONS
24
+
25
+
26
+ def expand_abbreviations(text: str) -> str:
27
+ """
28
+ Expand abbreviations in text to full human-readable form.
29
+
30
+ Args:
31
+ text: Text containing abbreviations (e.g., "u auth svc w/ JWT tok gen")
32
+
33
+ Returns:
34
+ Expanded text (e.g., "user authentication service with JWT token generation")
35
+
36
+ Examples:
37
+ >>> expand_abbreviations("u auth svc")
38
+ 'user authentication service'
39
+ >>> expand_abbreviations("ret JWT tok|null")
40
+ 'return JWT token or null'
41
+ """
42
+ # Sort by length (longest first) to avoid partial matches
43
+ sorted_abbrevs = sorted(ABBREVIATIONS.keys(), key=len, reverse=True)
44
+
45
+ expanded = text
46
+ for abbrev in sorted_abbrevs:
47
+ full = ABBREVIATIONS[abbrev]
48
+ # Use word boundaries to avoid partial replacements
49
+ pattern = r'\b' + re.escape(abbrev) + r'\b'
50
+ expanded = re.sub(pattern, full, expanded, flags=re.IGNORECASE)
51
+
52
+ return expanded
53
+
54
+
55
+ def expand_pattern_shortcuts(text: str) -> str:
56
+ """
57
+ Expand pattern shortcuts to human-readable descriptions.
58
+
59
+ Args:
60
+ text: Text containing pattern shortcuts (e.g., "id:uuid, pw≥8")
61
+
62
+ Returns:
63
+ Expanded text (e.g., "id must be valid UUID, password must be at least 8 characters")
64
+
65
+ Examples:
66
+ >>> expand_pattern_shortcuts("email:email")
67
+ 'email must be valid email address'
68
+ >>> expand_pattern_shortcuts("pw≥8")
69
+ 'password must be at least 8 characters'
70
+ """
71
+ pattern_expansions = {
72
+ r':uuid': ' must be valid UUID',
73
+ r':email': ' must be valid email address',
74
+ r':url': ' must be valid URL',
75
+ r':json': ' must be valid JSON',
76
+ r':jwt': ' must be valid JWT token',
77
+ r':hash': ' must be cryptographic hash',
78
+ r':enc': ' must be encrypted',
79
+ r'≥(\d+)': r' must be at least \1 characters',
80
+ r'≤(\d+)': r' must be at most \1 characters',
81
+ r'>(\d+)': r' must be greater than \1',
82
+ r'<(\d+)': r' must be less than \1',
83
+ r'\[(\d+),(\d+)\]': r' must be between \1 and \2',
84
+ r'∈\{([^}]+)\}': r' must be one of: \1'
85
+ }
86
+
87
+ expanded = text
88
+ for pattern, replacement in pattern_expansions.items():
89
+ expanded = re.sub(pattern, replacement, expanded)
90
+
91
+ return expanded
92
+
93
+
94
+ def expand_companion_content(content: str, expand_patterns: bool = True, expand_abbrevs: bool = True) -> str:
95
+ """
96
+ Expand all abbreviations and patterns in companion file content.
97
+
98
+ Args:
99
+ content: Raw companion file content
100
+ expand_patterns: Whether to expand pattern shortcuts
101
+ expand_abbrevs: Whether to expand abbreviations
102
+
103
+ Returns:
104
+ Fully expanded human-readable content
105
+
106
+ Examples:
107
+ >>> content = "⊢{u auth svc}\\n⊳{email:email,pw≥8}"
108
+ >>> expand_companion_content(content)
109
+ '⊢{user authentication service}\\n⊳{email must be valid email address, password must be at least 8 characters}'
110
+ """
111
+ expanded = content
112
+
113
+ if expand_patterns:
114
+ expanded = expand_pattern_shortcuts(expanded)
115
+
116
+ if expand_abbrevs:
117
+ expanded = expand_abbreviations(expanded)
118
+
119
+ return expanded
120
+
121
+
122
+ def expand_symbol_content(symbol_text: str) -> str:
123
+ """
124
+ Expand content within a specific symbol notation (e.g., ⊢{...}, ∂{...}).
125
+
126
+ Args:
127
+ symbol_text: Text inside symbol braces
128
+
129
+ Returns:
130
+ Expanded text
131
+
132
+ Examples:
133
+ >>> expand_symbol_content("u auth svc w/ JWT tok gen")
134
+ 'user authentication service with JWT token generation'
135
+ """
136
+ expanded = expand_abbreviations(symbol_text)
137
+ expanded = expand_pattern_shortcuts(expanded)
138
+ return expanded
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voodocs/cli",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "AI-Native Symbolic Documentation System - The world's first documentation tool using mathematical notation with semantic validation",
5
5
  "main": "voodocs_cli.py",
6
6
  "bin": {
@@ -64,6 +64,7 @@
64
64
  "lib/darkarts/exceptions.py",
65
65
  "lib/darkarts/telemetry.py",
66
66
  "lib/darkarts/companion_files.py",
67
+ "lib/darkarts/companion_files_expansion.py",
67
68
  "lib/darkarts/darkarts_abbreviations.py",
68
69
  "lib/darkarts/darkarts_patterns.py",
69
70
  "lib/darkarts/darkarts_symbols.py",