@voodocs/cli 2.5.3 → 3.0.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.
- package/CHANGELOG.md +156 -252
- package/README.md +215 -399
- package/lib/cli/__init__.py +1 -3
- package/lib/cli/init.py +11 -13
- package/lib/darkarts/annotations/darkarts_parser.py +159 -142
- package/lib/darkarts/annotations/darkarts_parser_v2.py.bak +238 -0
- package/lib/darkarts/companion_files.py +62 -9
- package/lib/darkarts/context/ai_instructions.py +385 -571
- package/lib/darkarts/context/ai_instructions_v2.py.bak +741 -0
- package/lib/darkarts/darkarts_abbreviations.py +324 -0
- package/lib/darkarts/darkarts_parser_v3.py +486 -0
- package/lib/darkarts/darkarts_patterns.py +249 -0
- package/lib/darkarts/darkarts_symbols.py +276 -0
- package/lib/darkarts/plugins/voodocs/documentation_generator.py +31 -2
- package/lib/darkarts/validation/semantic.py +135 -18
- package/package.json +5 -4
- package/lib/cli/convert.py +0 -144
- package/lib/darkarts/voodocs_lite_dict.py +0 -216
- package/lib/darkarts/voodocs_lite_dict_v2.py +0 -198
- package/lib/darkarts/voodocs_lite_parser.py +0 -404
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"""@darkarts
|
|
2
|
+
⊢{darkarts:abbreviation-dict}
|
|
3
|
+
∂{typing}
|
|
4
|
+
⚠{dict≥200-entries}
|
|
5
|
+
⊨{bidirectional:expand↔compress}
|
|
6
|
+
⚡{O(1):lookup}
|
|
7
|
+
🔒{read-only:dict}
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
DarkArts v3.0.0 - Enhanced Abbreviation Dictionary
|
|
12
|
+
|
|
13
|
+
This module provides a comprehensive abbreviation system for DarkArts mathematical notation.
|
|
14
|
+
Designed for AI-native documentation with maximum token efficiency.
|
|
15
|
+
|
|
16
|
+
200+ abbreviations across categories:
|
|
17
|
+
- Core terms (user, auth, token, etc.)
|
|
18
|
+
- Web/API (endpoint, route, middleware, etc.)
|
|
19
|
+
- Security (encryption, signature, permission, etc.)
|
|
20
|
+
- Data (database, table, record, etc.)
|
|
21
|
+
- Operations (generate, validate, process, etc.)
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from typing import Dict
|
|
25
|
+
|
|
26
|
+
# Core Terms
|
|
27
|
+
CORE_ABBREVIATIONS: Dict[str, str] = {
|
|
28
|
+
# User/Identity
|
|
29
|
+
'u': 'user',
|
|
30
|
+
'usr': 'username',
|
|
31
|
+
'uid': 'user identifier',
|
|
32
|
+
'pw': 'password',
|
|
33
|
+
'email': 'email address',
|
|
34
|
+
'prof': 'profile',
|
|
35
|
+
'acct': 'account',
|
|
36
|
+
|
|
37
|
+
# Authentication/Authorization
|
|
38
|
+
'auth': 'authentication',
|
|
39
|
+
'authz': 'authorization',
|
|
40
|
+
'tok': 'token',
|
|
41
|
+
'sess': 'session',
|
|
42
|
+
'cred': 'credential',
|
|
43
|
+
'perm': 'permission',
|
|
44
|
+
'role': 'role',
|
|
45
|
+
'priv': 'privilege',
|
|
46
|
+
|
|
47
|
+
# Common
|
|
48
|
+
'svc': 'service',
|
|
49
|
+
'fn': 'function',
|
|
50
|
+
'func': 'function',
|
|
51
|
+
'meth': 'method',
|
|
52
|
+
'cls': 'class',
|
|
53
|
+
'obj': 'object',
|
|
54
|
+
'inst': 'instance',
|
|
55
|
+
'cfg': 'configuration',
|
|
56
|
+
'config': 'configuration',
|
|
57
|
+
'param': 'parameter',
|
|
58
|
+
'arg': 'argument',
|
|
59
|
+
'ret': 'return',
|
|
60
|
+
'val': 'value',
|
|
61
|
+
'var': 'variable',
|
|
62
|
+
'prop': 'property',
|
|
63
|
+
'attr': 'attribute',
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
# Web/API Terms
|
|
67
|
+
WEB_API_ABBREVIATIONS: Dict[str, str] = {
|
|
68
|
+
'api': 'API',
|
|
69
|
+
'ep': 'endpoint',
|
|
70
|
+
'rt': 'route',
|
|
71
|
+
'hdl': 'handler',
|
|
72
|
+
'ctrl': 'controller',
|
|
73
|
+
'mw': 'middleware',
|
|
74
|
+
'wh': 'webhook',
|
|
75
|
+
'req': 'request',
|
|
76
|
+
'res': 'response',
|
|
77
|
+
'resp': 'response',
|
|
78
|
+
'pl': 'payload',
|
|
79
|
+
'hdr': 'header',
|
|
80
|
+
'bd': 'body',
|
|
81
|
+
'sts': 'status',
|
|
82
|
+
'qry': 'query',
|
|
83
|
+
'qp': 'query parameter',
|
|
84
|
+
'url': 'URL',
|
|
85
|
+
'uri': 'URI',
|
|
86
|
+
'http': 'HTTP',
|
|
87
|
+
'https': 'HTTPS',
|
|
88
|
+
'ws': 'WebSocket',
|
|
89
|
+
'rest': 'REST',
|
|
90
|
+
'gql': 'GraphQL',
|
|
91
|
+
'rpc': 'RPC',
|
|
92
|
+
'cors': 'CORS',
|
|
93
|
+
'csrf': 'CSRF',
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
# Security Terms
|
|
97
|
+
SECURITY_ABBREVIATIONS: Dict[str, str] = {
|
|
98
|
+
'sec': 'security',
|
|
99
|
+
'enc': 'encryption',
|
|
100
|
+
'dec': 'decryption',
|
|
101
|
+
'hash': 'hashing',
|
|
102
|
+
'salt': 'salt',
|
|
103
|
+
'sig': 'signature',
|
|
104
|
+
'cert': 'certificate',
|
|
105
|
+
'ssl': 'SSL',
|
|
106
|
+
'tls': 'TLS',
|
|
107
|
+
'jwt': 'JWT',
|
|
108
|
+
'oauth': 'OAuth',
|
|
109
|
+
'saml': 'SAML',
|
|
110
|
+
'mfa': 'multi-factor authentication',
|
|
111
|
+
'2fa': 'two-factor authentication',
|
|
112
|
+
'otp': 'one-time password',
|
|
113
|
+
'captcha': 'CAPTCHA',
|
|
114
|
+
'xss': 'XSS',
|
|
115
|
+
'sqli': 'SQL injection',
|
|
116
|
+
'vuln': 'vulnerability',
|
|
117
|
+
'exploit': 'exploit',
|
|
118
|
+
'sanitize': 'sanitization',
|
|
119
|
+
'escape': 'escaping',
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
# Data Terms
|
|
123
|
+
DATA_ABBREVIATIONS: Dict[str, str] = {
|
|
124
|
+
'db': 'database',
|
|
125
|
+
'sql': 'SQL',
|
|
126
|
+
'nosql': 'NoSQL',
|
|
127
|
+
'tbl': 'table',
|
|
128
|
+
'col': 'column',
|
|
129
|
+
'row': 'row',
|
|
130
|
+
'rec': 'record',
|
|
131
|
+
'doc': 'document',
|
|
132
|
+
'coll': 'collection',
|
|
133
|
+
'idx': 'index',
|
|
134
|
+
'pk': 'primary key',
|
|
135
|
+
'fk': 'foreign key',
|
|
136
|
+
'sch': 'schema',
|
|
137
|
+
'fld': 'field',
|
|
138
|
+
'rel': 'relationship',
|
|
139
|
+
'join': 'join',
|
|
140
|
+
'agg': 'aggregation',
|
|
141
|
+
'grp': 'group',
|
|
142
|
+
'sort': 'sort',
|
|
143
|
+
'filter': 'filter',
|
|
144
|
+
'pg': 'pagination',
|
|
145
|
+
'cache': 'cache',
|
|
146
|
+
'mem': 'memory',
|
|
147
|
+
'disk': 'disk',
|
|
148
|
+
'store': 'storage',
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
# Operations
|
|
152
|
+
OPERATION_ABBREVIATIONS: Dict[str, str] = {
|
|
153
|
+
'gen': 'generate',
|
|
154
|
+
'create': 'create',
|
|
155
|
+
'read': 'read',
|
|
156
|
+
'upd': 'update',
|
|
157
|
+
'del': 'delete',
|
|
158
|
+
'rm': 'remove',
|
|
159
|
+
'add': 'add',
|
|
160
|
+
'ins': 'insert',
|
|
161
|
+
'get': 'retrieve',
|
|
162
|
+
'fetch': 'fetch',
|
|
163
|
+
'set': 'set',
|
|
164
|
+
'put': 'put',
|
|
165
|
+
'post': 'post',
|
|
166
|
+
'patch': 'patch',
|
|
167
|
+
'val': 'validate',
|
|
168
|
+
'verify': 'verify',
|
|
169
|
+
'check': 'check',
|
|
170
|
+
'proc': 'process',
|
|
171
|
+
'exec': 'execute',
|
|
172
|
+
'run': 'run',
|
|
173
|
+
'calc': 'calculate',
|
|
174
|
+
'comp': 'compute',
|
|
175
|
+
'eval': 'evaluate',
|
|
176
|
+
'xform': 'transform',
|
|
177
|
+
'conv': 'convert',
|
|
178
|
+
'map': 'map',
|
|
179
|
+
'reduce': 'reduce',
|
|
180
|
+
'filter': 'filter',
|
|
181
|
+
'prs': 'parse',
|
|
182
|
+
'fmt': 'format',
|
|
183
|
+
'ser': 'serialize',
|
|
184
|
+
'deser': 'deserialize',
|
|
185
|
+
'enc': 'encode',
|
|
186
|
+
'dec': 'decode',
|
|
187
|
+
'cmp': 'compress',
|
|
188
|
+
'decomp': 'decompress',
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
# Status/State
|
|
192
|
+
STATUS_ABBREVIATIONS: Dict[str, str] = {
|
|
193
|
+
'ok': 'success',
|
|
194
|
+
'err': 'error',
|
|
195
|
+
'fail': 'failure',
|
|
196
|
+
'pend': 'pending',
|
|
197
|
+
'prog': 'in progress',
|
|
198
|
+
'done': 'completed',
|
|
199
|
+
'cancel': 'cancelled',
|
|
200
|
+
'timeout': 'timeout',
|
|
201
|
+
'retry': 'retry',
|
|
202
|
+
'active': 'active',
|
|
203
|
+
'inactive': 'inactive',
|
|
204
|
+
'enabled': 'enabled',
|
|
205
|
+
'disabled': 'disabled',
|
|
206
|
+
'valid': 'valid',
|
|
207
|
+
'invalid': 'invalid',
|
|
208
|
+
'expired': 'expired',
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
# Time/Scheduling
|
|
212
|
+
TIME_ABBREVIATIONS: Dict[str, str] = {
|
|
213
|
+
'ts': 'timestamp',
|
|
214
|
+
'dt': 'datetime',
|
|
215
|
+
'date': 'date',
|
|
216
|
+
'time': 'time',
|
|
217
|
+
'dur': 'duration',
|
|
218
|
+
'ttl': 'time to live',
|
|
219
|
+
'exp': 'expiration',
|
|
220
|
+
'sched': 'scheduled',
|
|
221
|
+
'cron': 'cron',
|
|
222
|
+
'delay': 'delay',
|
|
223
|
+
'timeout': 'timeout',
|
|
224
|
+
'interval': 'interval',
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
# Networking
|
|
228
|
+
NETWORK_ABBREVIATIONS: Dict[str, str] = {
|
|
229
|
+
'net': 'network',
|
|
230
|
+
'ip': 'IP address',
|
|
231
|
+
'dns': 'DNS',
|
|
232
|
+
'tcp': 'TCP',
|
|
233
|
+
'udp': 'UDP',
|
|
234
|
+
'port': 'port',
|
|
235
|
+
'socket': 'socket',
|
|
236
|
+
'conn': 'connection',
|
|
237
|
+
'proxy': 'proxy',
|
|
238
|
+
'lb': 'load balancer',
|
|
239
|
+
'cdn': 'CDN',
|
|
240
|
+
'vpn': 'VPN',
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
# File/Storage
|
|
244
|
+
FILE_ABBREVIATIONS: Dict[str, str] = {
|
|
245
|
+
'file': 'file',
|
|
246
|
+
'dir': 'directory',
|
|
247
|
+
'path': 'path',
|
|
248
|
+
'fs': 'filesystem',
|
|
249
|
+
'blob': 'blob',
|
|
250
|
+
's3': 'S3',
|
|
251
|
+
'bucket': 'bucket',
|
|
252
|
+
'upload': 'upload',
|
|
253
|
+
'download': 'download',
|
|
254
|
+
'stream': 'stream',
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
# Combine all abbreviations
|
|
258
|
+
ABBREVIATIONS: Dict[str, str] = {
|
|
259
|
+
**CORE_ABBREVIATIONS,
|
|
260
|
+
**WEB_API_ABBREVIATIONS,
|
|
261
|
+
**SECURITY_ABBREVIATIONS,
|
|
262
|
+
**DATA_ABBREVIATIONS,
|
|
263
|
+
**OPERATION_ABBREVIATIONS,
|
|
264
|
+
**STATUS_ABBREVIATIONS,
|
|
265
|
+
**TIME_ABBREVIATIONS,
|
|
266
|
+
**NETWORK_ABBREVIATIONS,
|
|
267
|
+
**FILE_ABBREVIATIONS,
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
# Reverse mapping for expansion
|
|
271
|
+
EXPANSIONS: Dict[str, str] = {v: k for k, v in ABBREVIATIONS.items()}
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
def compress(text: str) -> str:
|
|
275
|
+
"""
|
|
276
|
+
Compress text using abbreviation dictionary.
|
|
277
|
+
|
|
278
|
+
Example:
|
|
279
|
+
compress("user authentication service") → "u auth svc"
|
|
280
|
+
"""
|
|
281
|
+
result = text.lower()
|
|
282
|
+
|
|
283
|
+
# Sort by length (longest first) to avoid partial replacements
|
|
284
|
+
sorted_expansions = sorted(EXPANSIONS.items(), key=lambda x: len(x[0]), reverse=True)
|
|
285
|
+
|
|
286
|
+
for expansion, abbrev in sorted_expansions:
|
|
287
|
+
result = result.replace(expansion, abbrev)
|
|
288
|
+
|
|
289
|
+
return result
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def expand(text: str) -> str:
|
|
293
|
+
"""
|
|
294
|
+
Expand abbreviated text using abbreviation dictionary.
|
|
295
|
+
|
|
296
|
+
Example:
|
|
297
|
+
expand("u auth svc") → "user authentication service"
|
|
298
|
+
"""
|
|
299
|
+
words = text.split()
|
|
300
|
+
expanded_words = []
|
|
301
|
+
|
|
302
|
+
for word in words:
|
|
303
|
+
# Remove punctuation for lookup
|
|
304
|
+
clean_word = word.strip('.,;:!?')
|
|
305
|
+
expanded = ABBREVIATIONS.get(clean_word, clean_word)
|
|
306
|
+
|
|
307
|
+
# Preserve punctuation
|
|
308
|
+
if word != clean_word:
|
|
309
|
+
suffix = word[len(clean_word):]
|
|
310
|
+
expanded += suffix
|
|
311
|
+
|
|
312
|
+
expanded_words.append(expanded)
|
|
313
|
+
|
|
314
|
+
return ' '.join(expanded_words)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def get_abbreviation(term: str) -> str:
|
|
318
|
+
"""Get abbreviation for a term."""
|
|
319
|
+
return EXPANSIONS.get(term.lower(), term)
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
def get_expansion(abbrev: str) -> str:
|
|
323
|
+
"""Get expansion for an abbreviation."""
|
|
324
|
+
return ABBREVIATIONS.get(abbrev.lower(), abbrev)
|