jetic-cli 0.1.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/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +36 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/dev.d.ts +3 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +478 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +91 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +73 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/memory.d.ts +3 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +96 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +54 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/simulate-workflow.d.ts +46 -0
- package/dist/commands/simulate-workflow.d.ts.map +1 -0
- package/dist/commands/simulate-workflow.js +671 -0
- package/dist/commands/simulate-workflow.js.map +1 -0
- package/dist/commands/simulate.d.ts +3 -0
- package/dist/commands/simulate.d.ts.map +1 -0
- package/dist/commands/simulate.js +482 -0
- package/dist/commands/simulate.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/package.json +30 -0
- package/src/commands/config.ts +36 -0
- package/src/commands/dev.ts +451 -0
- package/src/commands/init.ts +64 -0
- package/src/commands/inspect.ts +47 -0
- package/src/commands/memory.ts +71 -0
- package/src/commands/scan.ts +22 -0
- package/src/commands/simulate-workflow.ts +794 -0
- package/src/commands/simulate.ts +512 -0
- package/src/index.ts +26 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { JeticMemory } from '@jetic/memory';
|
|
3
|
+
import * as readline from 'readline/promises';
|
|
4
|
+
import { stdin as input, stdout as output } from 'process';
|
|
5
|
+
|
|
6
|
+
export const memoryCommand = new Command('memory')
|
|
7
|
+
.description('Manage Jetic memory state')
|
|
8
|
+
.action(() => {
|
|
9
|
+
const allMemory = JeticMemory.getAllMemory();
|
|
10
|
+
|
|
11
|
+
let sn = 1;
|
|
12
|
+
const tableData: Array<{ 'S/N': number, KEY: string, TEXT: string }> = [];
|
|
13
|
+
|
|
14
|
+
for (const scope in allMemory) {
|
|
15
|
+
for (const key in allMemory[scope]) {
|
|
16
|
+
const value = allMemory[scope][key];
|
|
17
|
+
const text = typeof value === 'object' ? JSON.stringify(value) : String(value);
|
|
18
|
+
|
|
19
|
+
tableData.push({
|
|
20
|
+
'S/N': sn++,
|
|
21
|
+
'KEY': `${scope}:${key}`,
|
|
22
|
+
'TEXT': text.length > 50 ? text.substring(0, 47) + '...' : text
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (tableData.length === 0) {
|
|
28
|
+
console.log('Memory is empty.');
|
|
29
|
+
} else {
|
|
30
|
+
console.table(tableData, ['S/N', 'KEY', 'TEXT']);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
memoryCommand
|
|
35
|
+
.command('add')
|
|
36
|
+
.description('Add a new entry to memory interactively')
|
|
37
|
+
.action(async () => {
|
|
38
|
+
const rl = readline.createInterface({ input, output });
|
|
39
|
+
|
|
40
|
+
const keyInput = await rl.question('Key/Identifier: ');
|
|
41
|
+
if (!keyInput.trim()) {
|
|
42
|
+
console.log('Key is required.');
|
|
43
|
+
rl.close();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const textInput = await rl.question('Text: ');
|
|
48
|
+
rl.close();
|
|
49
|
+
|
|
50
|
+
const parts = keyInput.trim().split(':');
|
|
51
|
+
let scope = 'global';
|
|
52
|
+
let key = parts[0];
|
|
53
|
+
|
|
54
|
+
if (parts.length > 1) {
|
|
55
|
+
scope = parts[0];
|
|
56
|
+
key = parts.slice(1).join(':');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const memory = new JeticMemory({ scope });
|
|
60
|
+
await memory.set(key, textInput);
|
|
61
|
+
|
|
62
|
+
console.log(`\x1b[32m✓\x1b[0m Successfully added ${keyInput.trim()} to memory.`);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
memoryCommand
|
|
66
|
+
.command('clear')
|
|
67
|
+
.description('Clear memory')
|
|
68
|
+
.action(() => {
|
|
69
|
+
JeticMemory.clearAllMemory();
|
|
70
|
+
console.log('Memory cleared.');
|
|
71
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { loadConfig, writeJsonSync, ensureDirSync } from '@jetic/core';
|
|
3
|
+
import { ExpressScanner } from '@jetic/scanner';
|
|
4
|
+
import * as path from 'path';
|
|
5
|
+
|
|
6
|
+
export const scanCommand = new Command('scan')
|
|
7
|
+
.description('Scan the project for API routes')
|
|
8
|
+
.action(async () => {
|
|
9
|
+
console.log('Jetic API Intelligence\nScanning project...\n');
|
|
10
|
+
|
|
11
|
+
const config = loadConfig();
|
|
12
|
+
ensureDirSync(config.jeticDir);
|
|
13
|
+
|
|
14
|
+
const scanner = new ExpressScanner(config);
|
|
15
|
+
const model = await scanner.scan();
|
|
16
|
+
|
|
17
|
+
const modelPath = path.join(config.jeticDir, 'model.json');
|
|
18
|
+
writeJsonSync(modelPath, model);
|
|
19
|
+
|
|
20
|
+
console.log(`✓ Discovered ${model.endpoints.length} endpoints`);
|
|
21
|
+
console.log(`Behavioral model generated at ${modelPath}`);
|
|
22
|
+
});
|