devanvil 0.0.0-stage → 2.1.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/LICENSE +21 -0
- package/README.ar.md +113 -0
- package/README.md +272 -2
- package/SECURITY.md +49 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +664 -0
- package/dist/core/contract-drift.d.ts +49 -0
- package/dist/core/contract-drift.js +312 -0
- package/dist/core/converters.d.ts +18 -0
- package/dist/core/converters.js +989 -0
- package/dist/core/cron.d.ts +33 -0
- package/dist/core/cron.js +309 -0
- package/dist/core/crypto.d.ts +59 -0
- package/dist/core/crypto.js +260 -0
- package/dist/core/curl.d.ts +17 -0
- package/dist/core/curl.js +174 -0
- package/dist/core/diff.d.ts +36 -0
- package/dist/core/diff.js +148 -0
- package/dist/core/encoding.d.ts +3 -0
- package/dist/core/encoding.js +143 -0
- package/dist/core/importers.d.ts +65 -0
- package/dist/core/importers.js +361 -0
- package/dist/core/jwt.d.ts +39 -0
- package/dist/core/jwt.js +269 -0
- package/dist/core/llm-tokens.d.ts +38 -0
- package/dist/core/llm-tokens.js +125 -0
- package/dist/core/log-analyzer.d.ts +30 -0
- package/dist/core/log-analyzer.js +155 -0
- package/dist/core/network.d.ts +72 -0
- package/dist/core/network.js +185 -0
- package/dist/core/oauth-protobuf.d.ts +74 -0
- package/dist/core/oauth-protobuf.js +396 -0
- package/dist/core/openapi.d.ts +27 -0
- package/dist/core/openapi.js +257 -0
- package/dist/core/pipeline.d.ts +28 -0
- package/dist/core/pipeline.js +154 -0
- package/dist/core/regex.d.ts +50 -0
- package/dist/core/regex.js +360 -0
- package/dist/core/runner.d.ts +53 -0
- package/dist/core/runner.js +250 -0
- package/dist/core/secrets.d.ts +87 -0
- package/dist/core/secrets.js +603 -0
- package/dist/core/security.d.ts +34 -0
- package/dist/core/security.js +301 -0
- package/dist/core/sql-explain.d.ts +50 -0
- package/dist/core/sql-explain.js +259 -0
- package/dist/core/tls.d.ts +44 -0
- package/dist/core/tls.js +169 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +31 -0
- package/dist/server/app.d.ts +31 -0
- package/dist/server/app.js +359 -0
- package/dist/server/http-proxy.d.ts +55 -0
- package/dist/server/http-proxy.js +373 -0
- package/dist/server/http-utils.d.ts +28 -0
- package/dist/server/http-utils.js +118 -0
- package/dist/server/load-tester.d.ts +53 -0
- package/dist/server/load-tester.js +137 -0
- package/dist/server/mcp.d.ts +35 -0
- package/dist/server/mcp.js +470 -0
- package/dist/server/mock-store.d.ts +38 -0
- package/dist/server/mock-store.js +238 -0
- package/dist/server/plugin-loader.d.ts +61 -0
- package/dist/server/plugin-loader.js +305 -0
- package/dist/server/recorder-store.d.ts +35 -0
- package/dist/server/recorder-store.js +147 -0
- package/dist/server/routes/network-routes.d.ts +3 -0
- package/dist/server/routes/network-routes.js +441 -0
- package/dist/server/routes/tools-routes.d.ts +3 -0
- package/dist/server/routes/tools-routes.js +299 -0
- package/dist/server/routes/workspace-routes.d.ts +3 -0
- package/dist/server/routes/workspace-routes.js +262 -0
- package/dist/server/webhook-store.d.ts +29 -0
- package/dist/server/webhook-store.js +100 -0
- package/dist/server/workspace-store.d.ts +91 -0
- package/dist/server/workspace-store.js +448 -0
- package/dist/server/ws-probe.d.ts +34 -0
- package/dist/server/ws-probe.js +291 -0
- package/dist/ui/app.js +290 -0
- package/dist/ui/favicon.svg +14 -0
- package/dist/ui/index.html +83 -0
- package/dist/ui/logo.png +0 -0
- package/dist/ui/styles.css +694 -0
- package/dist/ui/tools-data.js +719 -0
- package/dist/ui/tools-network.js +769 -0
- package/dist/ui/tools-ops.js +299 -0
- package/dist/ui/tools-pro.js +500 -0
- package/dist/ui/tools-security.js +397 -0
- package/dist/ui/tools-v12.js +765 -0
- package/dist/ui/tools-v13.js +321 -0
- package/dist/ui/tools-v20.js +563 -0
- package/dist/ui/tools-v21.js +411 -0
- package/package.json +75 -4
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
const { h, api, toast, copyText, registerTool } = window.DevAnvil;
|
|
4
|
+
|
|
5
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
6
|
+
// 9. Cron Expression & Timestamp Studio
|
|
7
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
8
|
+
registerTool({
|
|
9
|
+
id: 'cron-time',
|
|
10
|
+
group: 'Scheduling & Ops',
|
|
11
|
+
name: 'Cron & Time',
|
|
12
|
+
icon: '⏱',
|
|
13
|
+
subtitle: 'Cron expression explainer, next-10 UTC scheduler & Unix Epoch/ISO-8601 inspector',
|
|
14
|
+
keywords: ['cron', 'schedule', 'timestamp', 'epoch', 'unix', 'iso8601', 'time'],
|
|
15
|
+
render(root) {
|
|
16
|
+
const cronIn = h('input', { type: 'text', class: 'mono', value: '*/15 9-17 * * 1-5', style: { flex: '1', fontSize: '15px', fontWeight: '700' } });
|
|
17
|
+
const cronDesc = h('div', { class: 'finding info' }, '');
|
|
18
|
+
const cronRuns = h('pre', { class: 'code-box' }, '');
|
|
19
|
+
|
|
20
|
+
async function evalCron() {
|
|
21
|
+
try {
|
|
22
|
+
const res = await api('/api/cron', { body: { expression: cronIn.value, count: 10 } });
|
|
23
|
+
cronDesc.textContent = res.description;
|
|
24
|
+
cronDesc.className = 'finding info';
|
|
25
|
+
cronRuns.textContent = res.nextRuns.map((r, i) => `${String(i + 1).padStart(2, '0')}. ${r}`).join('\n');
|
|
26
|
+
} catch (err) {
|
|
27
|
+
cronDesc.textContent = err.message;
|
|
28
|
+
cronDesc.className = 'finding critical';
|
|
29
|
+
cronRuns.textContent = '';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const cronPresets = [
|
|
34
|
+
['Every 5m', '*/5 * * * *'],
|
|
35
|
+
['Workdays 9-17', '*/15 9-17 * * 1-5'],
|
|
36
|
+
['Daily 02:30', '30 2 * * *'],
|
|
37
|
+
['Weekly Sun', '0 0 * * SUN'],
|
|
38
|
+
['Monthly 1st', '@monthly'],
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
// Timestamp Studio
|
|
42
|
+
const tsIn = h('input', { type: 'text', class: 'mono', value: 'now', placeholder: 'now, 1795800000, 1795800000000, or 2026-11-28T19:00:00Z', style: { flex: '1' } });
|
|
43
|
+
const tsGrid = h('div', { class: 'kv-grid' });
|
|
44
|
+
|
|
45
|
+
async function evalTs() {
|
|
46
|
+
try {
|
|
47
|
+
const res = await api('/api/timestamp', { body: { input: tsIn.value } });
|
|
48
|
+
tsGrid.textContent = '';
|
|
49
|
+
const pairs = [
|
|
50
|
+
['Detected Format', res.detectedFormat],
|
|
51
|
+
['ISO-8601 (UTC)', res.isoUtc],
|
|
52
|
+
['RFC-2822', res.rfc2822],
|
|
53
|
+
['Unix Seconds', String(res.unixSeconds)],
|
|
54
|
+
['Unix Milliseconds', String(res.unixMillis)],
|
|
55
|
+
['Unix Nanoseconds', res.unixNanos],
|
|
56
|
+
['Relative', res.relative],
|
|
57
|
+
['Day / ISO Week', `Day ${res.dayOfYear} · W${res.isoWeek}`],
|
|
58
|
+
];
|
|
59
|
+
for (const [k, v] of pairs) {
|
|
60
|
+
tsGrid.appendChild(
|
|
61
|
+
h(
|
|
62
|
+
'div',
|
|
63
|
+
{ class: 'stat-tile', style: { cursor: 'pointer' }, title: 'Click to copy', onClick: () => copyText(v, `Copied ${k}`) },
|
|
64
|
+
h('div', { class: 'stat-label' }, k),
|
|
65
|
+
h('div', { class: 'stat-val' }, v),
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
} catch (err) {
|
|
70
|
+
toast(err.message, 'err');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const layout = h(
|
|
75
|
+
'div',
|
|
76
|
+
{ class: 'grid-2' },
|
|
77
|
+
h(
|
|
78
|
+
'div',
|
|
79
|
+
{ class: 'card' },
|
|
80
|
+
h('h2', { class: 'card-title' }, 'Cron Schedule Studio (UTC)'),
|
|
81
|
+
h('div', { class: 'row' }, cronIn, h('button', { type: 'button', class: 'btn btn-primary', onClick: evalCron }, 'Explain')),
|
|
82
|
+
h(
|
|
83
|
+
'div',
|
|
84
|
+
{ class: 'row' },
|
|
85
|
+
cronPresets.map(([label, expr]) =>
|
|
86
|
+
h(
|
|
87
|
+
'button',
|
|
88
|
+
{
|
|
89
|
+
type: 'button',
|
|
90
|
+
class: 'btn btn-ghost btn-xs',
|
|
91
|
+
onClick: () => {
|
|
92
|
+
cronIn.value = expr;
|
|
93
|
+
void evalCron();
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
label,
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
),
|
|
100
|
+
cronDesc,
|
|
101
|
+
h('label', { class: 'field-label' }, 'Next 10 Scheduled Executions (UTC)'),
|
|
102
|
+
cronRuns,
|
|
103
|
+
),
|
|
104
|
+
h(
|
|
105
|
+
'div',
|
|
106
|
+
{ class: 'card' },
|
|
107
|
+
h('h2', { class: 'card-title' }, 'Timestamp & Epoch Converter'),
|
|
108
|
+
h(
|
|
109
|
+
'div',
|
|
110
|
+
{ class: 'row' },
|
|
111
|
+
tsIn,
|
|
112
|
+
h('button', { type: 'button', class: 'btn btn-primary btn-sm', onClick: evalTs }, 'Inspect'),
|
|
113
|
+
h('button', { type: 'button', class: 'btn btn-ghost btn-sm', onClick: () => { tsIn.value = 'now'; void evalTs(); } }, 'Now'),
|
|
114
|
+
),
|
|
115
|
+
tsGrid,
|
|
116
|
+
),
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
root.appendChild(layout);
|
|
120
|
+
void evalCron();
|
|
121
|
+
void evalTs();
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
126
|
+
// 10. Dev Utilities (CIDR, Chmod Matrix, Color/WCAG Contrast, HTTP Codes)
|
|
127
|
+
// ───────────────────────────────────────────────────────────────────────────
|
|
128
|
+
registerTool({
|
|
129
|
+
id: 'dev-utils',
|
|
130
|
+
group: 'Scheduling & Ops',
|
|
131
|
+
name: 'Network, Chmod & Color',
|
|
132
|
+
icon: '⌘',
|
|
133
|
+
subtitle: 'IPv4 CIDR subnet calculator, Linux chmod matrix, WCAG color contrast & HTTP reference',
|
|
134
|
+
keywords: ['cidr', 'subnet', 'ip', 'chmod', 'permissions', 'color', 'wcag', 'contrast', 'http status'],
|
|
135
|
+
render(root) {
|
|
136
|
+
// --- CIDR ---
|
|
137
|
+
const cidrIn = h('input', { type: 'text', class: 'mono', value: '10.24.0.15/20', style: { flex: '1' } });
|
|
138
|
+
const cidrGrid = h('div', { class: 'kv-grid' });
|
|
139
|
+
async function evalCidr() {
|
|
140
|
+
try {
|
|
141
|
+
const c = await api('/api/utils/cidr', { body: { cidr: cidrIn.value } });
|
|
142
|
+
cidrGrid.textContent = '';
|
|
143
|
+
const items = [
|
|
144
|
+
['Normalized CIDR', c.cidr],
|
|
145
|
+
['Subnet Mask', c.subnetMask],
|
|
146
|
+
['Wildcard Mask', c.wildcardMask],
|
|
147
|
+
['Network Address', c.networkAddress],
|
|
148
|
+
['Broadcast', c.broadcastAddress],
|
|
149
|
+
['Host Range', `${c.firstHost} - ${c.lastHost}`],
|
|
150
|
+
['Usable Hosts', c.usableHosts.toLocaleString()],
|
|
151
|
+
['Class / Scope', `Class ${c.ipClass} · ${c.isPrivate ? 'Private' : 'Public'}`],
|
|
152
|
+
];
|
|
153
|
+
for (const [k, v] of items) {
|
|
154
|
+
cidrGrid.appendChild(h('div', { class: 'stat-tile' }, h('div', { class: 'stat-label' }, k), h('div', { class: 'stat-val' }, v)));
|
|
155
|
+
}
|
|
156
|
+
} catch (err) {
|
|
157
|
+
toast(err.message, 'err');
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// --- Chmod interactive matrix ---
|
|
162
|
+
const chmodState = {
|
|
163
|
+
owner: { r: true, w: true, x: true },
|
|
164
|
+
group: { r: true, w: false, x: true },
|
|
165
|
+
others: { r: true, w: false, x: true },
|
|
166
|
+
};
|
|
167
|
+
const chmodResult = h('div', { class: 'row' });
|
|
168
|
+
|
|
169
|
+
function refreshChmod() {
|
|
170
|
+
const calc = (g) => (g.r ? 4 : 0) + (g.w ? 2 : 0) + (g.x ? 1 : 0);
|
|
171
|
+
const sym = (g) => `${g.r ? 'r' : '-'}${g.w ? 'w' : '-'}${g.x ? 'x' : '-'}`;
|
|
172
|
+
const octal = `${calc(chmodState.owner)}${calc(chmodState.group)}${calc(chmodState.others)}`;
|
|
173
|
+
const symbolic = `${sym(chmodState.owner)}${sym(chmodState.group)}${sym(chmodState.others)}`;
|
|
174
|
+
chmodResult.textContent = '';
|
|
175
|
+
chmodResult.appendChild(h('span', { class: 'badge badge-ok' }, `Octal: ${octal}`));
|
|
176
|
+
chmodResult.appendChild(h('span', { class: 'badge badge-info' }, `Symbolic: ${symbolic}`));
|
|
177
|
+
chmodResult.appendChild(
|
|
178
|
+
h('button', { type: 'button', class: 'btn btn-ghost btn-xs', onClick: () => copyText(`chmod ${octal} <file>`, 'Copied chmod command') }, `Copy: chmod ${octal}`),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const chmodTable = h(
|
|
183
|
+
'table',
|
|
184
|
+
{ class: 'chmod-table' },
|
|
185
|
+
h('thead', {}, h('tr', {}, h('th', {}, 'Scope'), h('th', {}, 'Read (4)'), h('th', {}, 'Write (2)'), h('th', {}, 'Execute (1)'))),
|
|
186
|
+
h(
|
|
187
|
+
'tbody',
|
|
188
|
+
{},
|
|
189
|
+
['owner', 'group', 'others'].map((scope) =>
|
|
190
|
+
h(
|
|
191
|
+
'tr',
|
|
192
|
+
{},
|
|
193
|
+
h('td', { style: { fontWeight: '600', textTransform: 'capitalize' } }, scope),
|
|
194
|
+
['r', 'w', 'x'].map((perm) =>
|
|
195
|
+
h(
|
|
196
|
+
'td',
|
|
197
|
+
{},
|
|
198
|
+
h('input', {
|
|
199
|
+
type: 'checkbox',
|
|
200
|
+
checked: chmodState[scope][perm],
|
|
201
|
+
onChange: (e) => {
|
|
202
|
+
chmodState[scope][perm] = e.target.checked;
|
|
203
|
+
refreshChmod();
|
|
204
|
+
},
|
|
205
|
+
}),
|
|
206
|
+
),
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
),
|
|
210
|
+
),
|
|
211
|
+
);
|
|
212
|
+
|
|
213
|
+
// --- Color & WCAG Contrast ---
|
|
214
|
+
const fgIn = h('input', { type: 'text', class: 'mono', value: '#F59E0B', style: { width: '115px' } });
|
|
215
|
+
const bgIn = h('input', { type: 'text', class: 'mono', value: '#0B0D11', style: { width: '115px' } });
|
|
216
|
+
const contrastPreview = h('div', { class: 'contrast-preview' }, h('div', { style: { fontSize: '18px', fontWeight: '700' } }, 'DevAnvil Typography Sample'), h('div', { style: { fontSize: '13px', marginTop: '4px' } }, 'Checking WCAG 2.1 AA / AAA accessibility contrast ratio locally.'));
|
|
217
|
+
const contrastBadges = h('div', { class: 'row' });
|
|
218
|
+
|
|
219
|
+
async function evalContrast() {
|
|
220
|
+
try {
|
|
221
|
+
const res = await api('/api/utils/color', { body: { foreground: fgIn.value, background: bgIn.value } });
|
|
222
|
+
contrastPreview.style.color = res.foreground.hex;
|
|
223
|
+
contrastPreview.style.background = res.background.hex;
|
|
224
|
+
contrastBadges.textContent = '';
|
|
225
|
+
contrastBadges.appendChild(h('span', { class: 'badge badge-info' }, `Ratio ${res.ratio}:1`));
|
|
226
|
+
contrastBadges.appendChild(h('span', { class: `badge ${res.aaNormal ? 'badge-ok' : 'badge-err'}` }, `AA Normal ${res.aaNormal ? 'PASS' : 'FAIL'}`));
|
|
227
|
+
contrastBadges.appendChild(h('span', { class: `badge ${res.aaaNormal ? 'badge-ok' : 'badge-warn'}` }, `AAA Normal ${res.aaaNormal ? 'PASS' : 'FAIL'}`));
|
|
228
|
+
contrastBadges.appendChild(h('span', { class: 'badge badge-subtle' }, `${res.foreground.rgbCss} · ${res.foreground.hslCss}`));
|
|
229
|
+
} catch (err) {
|
|
230
|
+
toast(err.message, 'err');
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// --- HTTP Status Search ---
|
|
235
|
+
const httpQuery = h('input', { type: 'text', placeholder: 'Filter HTTP status codes (e.g. 429, redirect, timeout)…', onInput: () => void loadHttpStatuses() });
|
|
236
|
+
const httpList = h('div', { class: 'stack', style: { maxHeight: '260px', overflowY: 'auto' } });
|
|
237
|
+
|
|
238
|
+
async function loadHttpStatuses() {
|
|
239
|
+
try {
|
|
240
|
+
const res = await api(`/api/utils/http-statuses?q=${encodeURIComponent(httpQuery.value)}`);
|
|
241
|
+
httpList.textContent = '';
|
|
242
|
+
for (const s of res.statuses) {
|
|
243
|
+
const cls = s.code < 200 ? 'badge-info' : s.code < 300 ? 'badge-ok' : s.code < 400 ? 'badge-warn' : 'badge-err';
|
|
244
|
+
httpList.appendChild(
|
|
245
|
+
h(
|
|
246
|
+
'div',
|
|
247
|
+
{ class: 'list-item' },
|
|
248
|
+
h('div', { class: 'row' }, h('span', { class: `badge ${cls}` }, String(s.code)), h('strong', {}, s.title)),
|
|
249
|
+
h('div', { style: { fontSize: '12px', color: 'var(--text-muted)' } }, s.description),
|
|
250
|
+
),
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
} catch (err) {
|
|
254
|
+
toast(err.message, 'err');
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const layout = h(
|
|
259
|
+
'div',
|
|
260
|
+
{ class: 'grid-2' },
|
|
261
|
+
h(
|
|
262
|
+
'div',
|
|
263
|
+
{ class: 'card' },
|
|
264
|
+
h('h2', { class: 'card-title' }, 'IPv4 CIDR Subnet Calculator'),
|
|
265
|
+
h('div', { class: 'row' }, cidrIn, h('button', { type: 'button', class: 'btn btn-primary btn-sm', onClick: evalCidr }, 'Calculate')),
|
|
266
|
+
cidrGrid,
|
|
267
|
+
),
|
|
268
|
+
h(
|
|
269
|
+
'div',
|
|
270
|
+
{ class: 'card' },
|
|
271
|
+
h('h2', { class: 'card-title' }, 'Linux chmod Permission Matrix'),
|
|
272
|
+
chmodTable,
|
|
273
|
+
chmodResult,
|
|
274
|
+
),
|
|
275
|
+
h(
|
|
276
|
+
'div',
|
|
277
|
+
{ class: 'card' },
|
|
278
|
+
h('h2', { class: 'card-title' }, 'Color Converter & WCAG 2.1 Contrast Checker'),
|
|
279
|
+
h('div', { class: 'row' }, h('span', { style: { fontSize: '12px' } }, 'FG:'), fgIn, h('span', { style: { fontSize: '12px' } }, 'BG:'), bgIn, h('button', { type: 'button', class: 'btn btn-primary btn-sm', onClick: evalContrast }, 'Check')),
|
|
280
|
+
contrastPreview,
|
|
281
|
+
contrastBadges,
|
|
282
|
+
),
|
|
283
|
+
h(
|
|
284
|
+
'div',
|
|
285
|
+
{ class: 'card' },
|
|
286
|
+
h('h2', { class: 'card-title' }, 'HTTP Status Code Reference'),
|
|
287
|
+
httpQuery,
|
|
288
|
+
httpList,
|
|
289
|
+
),
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
root.appendChild(layout);
|
|
293
|
+
void evalCidr();
|
|
294
|
+
refreshChmod();
|
|
295
|
+
void evalContrast();
|
|
296
|
+
void loadHttpStatuses();
|
|
297
|
+
},
|
|
298
|
+
});
|
|
299
|
+
})();
|