startx 0.9.4 → 0.9.9
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/apps/cli/package.json +3 -1
- package/apps/cli/src/commands/common/hashing.ts +34 -0
- package/apps/cli/src/commands/common/ping.ts +11 -0
- package/apps/cli/src/commands/common/random.ts +41 -0
- package/apps/cli/src/commands/i-command.ts +6 -0
- package/apps/cli/src/commands/index.ts +6 -0
- package/apps/cli/src/index.ts +6 -4
- package/apps/cli/tsconfig.json +4 -6
- package/apps/startx-cli/dist/index.mjs +52 -52
- package/configs/eslint-config/src/configs/base.ts +26 -11
- package/package.json +2 -2
- package/packages/@db/drizzle/tsconfig.json +2 -8
- package/packages/@db/sqlite/tsconfig.json +2 -8
- package/packages/@repo/env/package.json +2 -1
- package/packages/@repo/env/src/utils.ts +7 -6
- package/packages/@repo/lib/src/events/i-event.ts +1 -1
- package/packages/aix/eslint.config.ts +4 -0
- package/packages/aix/package.json +53 -0
- package/packages/aix/src/aix.ts +519 -0
- package/packages/aix/src/index.ts +3 -0
- package/packages/aix/src/lib/convertor/schema-convertor.ts +108 -0
- package/packages/aix/src/lib/convertor/variable-resolver.ts +161 -0
- package/packages/aix/src/lib/tokenizer/index.ts +1 -0
- package/packages/aix/src/lib/tokenizer/tokenizer.ts +42 -0
- package/packages/aix/src/providers/ai-chat.ts +25 -0
- package/packages/aix/src/providers/ai-event.ts +21 -0
- package/packages/aix/src/providers/ai-interface.ts +236 -0
- package/packages/aix/src/providers/ai-prompt.ts +14 -0
- package/packages/aix/src/providers/default-models.ts +471 -0
- package/packages/aix/src/providers/index.ts +1 -0
- package/packages/aix/src/providers/openai/openai.ts +139 -0
- package/packages/aix/src/providers/providers.ts +39 -0
- package/packages/aix/src/providers/types.ts +54 -0
- package/packages/aix/src/tools/generic/database.ts +290 -0
- package/packages/aix/src/tools/generic/forecast.ts +216 -0
- package/packages/aix/src/tools/generic/index.ts +4 -0
- package/packages/aix/src/tools/generic/planner.ts +114 -0
- package/packages/aix/src/tools/generic/summarizer.ts +101 -0
- package/packages/aix/src/tools/i-tool.ts +33 -0
- package/packages/aix/src/tools/index.ts +2 -0
- package/packages/aix/src/tools/system/index.ts +297 -0
- package/packages/aix/src/tools/tool-manager.ts +241 -0
- package/packages/aix/src/tools/types.ts +109 -0
- package/packages/aix/tsconfig.json +7 -0
- package/packages/aix/vitest.config.ts +3 -0
- package/pnpm-workspace.yaml +7 -0
- package/turbo.json +0 -1
- package/apps/cli/src/commands/ping.ts +0 -10
package/apps/cli/package.json
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@inquirer/prompts": "^8.3.0",
|
|
31
31
|
"@repo/logger": "workspace:*",
|
|
32
|
+
"@repo/lib": "workspace:*",
|
|
32
33
|
"commander": "^14.0.0"
|
|
33
34
|
},
|
|
34
35
|
"startx": {
|
|
@@ -40,7 +41,8 @@
|
|
|
40
41
|
"commander"
|
|
41
42
|
],
|
|
42
43
|
"requiredDeps": [
|
|
43
|
-
"@repo/logger"
|
|
44
|
+
"@repo/logger",
|
|
45
|
+
"@repo/lib"
|
|
44
46
|
],
|
|
45
47
|
"requiredDevDeps": [
|
|
46
48
|
"typescript-config"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HashingModule } from "@repo/lib/hashing-module";
|
|
2
|
+
import { logger } from "@repo/logger";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { ICommand } from "../i-command.js";
|
|
5
|
+
|
|
6
|
+
class HashingCommand extends ICommand {
|
|
7
|
+
command = new Command("hash")
|
|
8
|
+
.argument("<password>", "String to hash")
|
|
9
|
+
.description("Hash a string")
|
|
10
|
+
.action(this.run.bind(this));
|
|
11
|
+
|
|
12
|
+
async run(password: string) {
|
|
13
|
+
const hash = await HashingModule.hash(password);
|
|
14
|
+
|
|
15
|
+
logger.info(`Hash for "${password}": ${hash}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class HashingCompareCommand extends ICommand {
|
|
20
|
+
command = new Command("hash:compare")
|
|
21
|
+
.argument("<password>", "Original string")
|
|
22
|
+
.argument("<hash>", "Hash to compare")
|
|
23
|
+
.description("Compare a string against a hash")
|
|
24
|
+
.action(this.run.bind(this));
|
|
25
|
+
|
|
26
|
+
async run(password: string, hash: string) {
|
|
27
|
+
logger.info(`Comparing password: "${password}" against hash: "${hash}"`);
|
|
28
|
+
|
|
29
|
+
const compare = await HashingModule.compare(password, hash);
|
|
30
|
+
|
|
31
|
+
logger.info(`Hash for "${password}": ${compare ? "Valid" : "Invalid"}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export const HashingCommands = [new HashingCommand(), new HashingCompareCommand()];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { logger } from "@repo/logger";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { ICommand } from "../i-command.js";
|
|
4
|
+
|
|
5
|
+
export class PingCommand extends ICommand {
|
|
6
|
+
command = new Command("ping").description("Ping the CLI").action(this.run.bind(this));
|
|
7
|
+
|
|
8
|
+
run() {
|
|
9
|
+
logger.info("pong");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Random } from "@repo/lib";
|
|
2
|
+
import { logger } from "@repo/logger";
|
|
3
|
+
import { Command } from "commander";
|
|
4
|
+
import { ICommand } from "../i-command.js";
|
|
5
|
+
|
|
6
|
+
export class RandomCommand extends ICommand {
|
|
7
|
+
command = new Command("random")
|
|
8
|
+
.argument("<type>", "Type to generate (uuid, string, number, boolean)")
|
|
9
|
+
.option("-l, --length <number>", "Length of string or digits of number")
|
|
10
|
+
.option("-e, --encoding <type>", "Encoding for string (default: hex)")
|
|
11
|
+
.description("Generate random data")
|
|
12
|
+
.action(this.run.bind(this));
|
|
13
|
+
|
|
14
|
+
run(type: string, options: { length?: string; encoding?: BufferEncoding }) {
|
|
15
|
+
switch (type.toLowerCase()) {
|
|
16
|
+
case "uuid": {
|
|
17
|
+
logger.info(`UUID: ${Random.generateUUID()}`);
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
case "string": {
|
|
21
|
+
const length = options.length ? parseInt(options.length, 10) : 16;
|
|
22
|
+
const encoding = options.encoding || "hex";
|
|
23
|
+
logger.info(`String: ${Random.generateString(length, encoding)}`);
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case "number": {
|
|
27
|
+
const digits = options.length ? parseInt(options.length, 10) : 6;
|
|
28
|
+
logger.info(`Number: ${Random.generateNumber(digits)}`);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case "boolean": {
|
|
32
|
+
logger.info(`Boolean: ${Random.generateBoolean()}`);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
logger.error(`Unknown type "${type}". Valid types: uuid, string, number, boolean`);
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { HashingCommands } from "./common/hashing.js";
|
|
2
|
+
import { PingCommand } from "./common/ping.js";
|
|
3
|
+
import { RandomCommand } from "./common/random.js";
|
|
4
|
+
import { ICommand } from "./i-command.js";
|
|
5
|
+
|
|
6
|
+
export const commands: ICommand[] = [new PingCommand(), new RandomCommand(), ...HashingCommands];
|
package/apps/cli/src/index.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import { commands } from "./commands/index.js";
|
|
3
|
+
import packageJson from "../../../package.json" with { type: "json" };
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
import { version, name, description } from "../../../package.json";
|
|
5
|
+
const { version, name, description } = packageJson;
|
|
5
6
|
|
|
6
7
|
const program = new Command();
|
|
7
8
|
|
|
8
9
|
program.name(name).description(description).version(version);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
for (const cmd of commands) {
|
|
12
|
+
program.addCommand(cmd.command);
|
|
13
|
+
}
|
|
12
14
|
program.parse(process.argv);
|
package/apps/cli/tsconfig.json
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "typescript-config/tsconfig.node.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"resolveJsonModule": true
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"paths": {
|
|
6
|
+
"@/*": ["./src/*"]
|
|
7
|
+
}
|
|
9
8
|
},
|
|
10
|
-
|
|
11
9
|
"include": ["src/**/*.ts"]
|
|
12
10
|
}
|