symmetry-cli 1.0.21 → 1.0.22

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/setup.js ADDED
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SetupCommand = void 0;
4
+ const symmetry_core_1 = require("symmetry-core");
5
+ class SetupCommand {
6
+ static async execute() {
7
+ symmetry_core_1.logger.info("🔍 Checking for running LLM servers...");
8
+ const providers = [
9
+ new symmetry_core_1.OllamaProvider(),
10
+ new symmetry_core_1.OpenWebUIProvider(),
11
+ new symmetry_core_1.LMStudioProvider(),
12
+ new symmetry_core_1.LlamaCppProvider(),
13
+ ];
14
+ for (const provider of providers) {
15
+ const server = await provider.detectServer();
16
+ if (server) {
17
+ await provider.setup();
18
+ symmetry_core_1.logger.info(`📝 Configuration file created at: ${symmetry_core_1.BaseProvider.DEFAULT_CONFIG_PATH}/provider.yaml`);
19
+ return;
20
+ }
21
+ }
22
+ symmetry_core_1.logger.error("❌ No supported LLM servers detected.");
23
+ }
24
+ }
25
+ exports.SetupCommand = SetupCommand;
package/dist/start.js ADDED
@@ -0,0 +1,45 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ var _a;
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.SymmetryCLI = void 0;
9
+ const symmetry_core_1 = require("symmetry-core");
10
+ const os_1 = __importDefault(require("os"));
11
+ const path_1 = __importDefault(require("path"));
12
+ const promises_1 = __importDefault(require("fs/promises"));
13
+ const setup_1 = require("./setup");
14
+ class SymmetryCLI {
15
+ static async initialize(configPath) {
16
+ try {
17
+ const hasConfig = await this.getConfigExists(configPath);
18
+ if (!hasConfig) {
19
+ symmetry_core_1.logger.info("🔄 First-time setup detected, running initialization...");
20
+ await setup_1.SetupCommand.execute();
21
+ }
22
+ const client = new symmetry_core_1.SymmetryClient(configPath);
23
+ await client.init();
24
+ }
25
+ catch (error) {
26
+ if (error instanceof Error) {
27
+ symmetry_core_1.logger.error("Failed to initialize:", error.message);
28
+ }
29
+ process.exit(1);
30
+ }
31
+ }
32
+ static async getConfigExists(configPath) {
33
+ try {
34
+ await promises_1.default.access(configPath);
35
+ return true;
36
+ }
37
+ catch (_b) {
38
+ return false;
39
+ }
40
+ }
41
+ }
42
+ exports.SymmetryCLI = SymmetryCLI;
43
+ _a = SymmetryCLI;
44
+ SymmetryCLI.DEFAULT_CONFIG_DIR = path_1.default.join(os_1.default.homedir(), ".config", "symmetry");
45
+ SymmetryCLI.DEFAULT_CONFIG_PATH = path_1.default.join(_a.DEFAULT_CONFIG_DIR, "provider.yaml");
package/dist/symmetry.js CHANGED
@@ -8,13 +8,32 @@ const commander_1 = require("commander");
8
8
  const symmetry_core_1 = require("symmetry-core");
9
9
  const os_1 = __importDefault(require("os"));
10
10
  const path_1 = __importDefault(require("path"));
11
+ const setup_1 = require("./setup");
12
+ const start_1 = require("./start");
11
13
  const program = new commander_1.Command();
12
14
  program
13
15
  .version("1.0.14")
14
16
  .description("symmetry cli")
15
- .option("-c, --config <path>", "Path to config file", path_1.default.join(os_1.default.homedir(), ".config", "symmetry", "provider.yaml"))
17
+ .option("-c, --config <path>", "Path to config file", path_1.default.join(os_1.default.homedir(), ".config", "symmetry", "provider.yaml"));
18
+ program
19
+ .command("setup")
20
+ .description("Manually run setup to detect and configure local LLM servers")
16
21
  .action(async () => {
17
- const client = new symmetry_core_1.SymmetryProvider(program.opts().config);
18
- await client.init();
22
+ try {
23
+ await setup_1.SetupCommand.execute();
24
+ }
25
+ catch (error) {
26
+ symmetry_core_1.logger.error("Setup failed:", error);
27
+ process.exit(1);
28
+ }
29
+ });
30
+ program
31
+ .command("start")
32
+ .description("Start the Symmetry provider")
33
+ .action(async () => {
34
+ await start_1.SymmetryCLI.initialize(program.opts().config);
35
+ });
36
+ program.action(async () => {
37
+ await start_1.SymmetryCLI.initialize(program.opts().config);
19
38
  });
20
39
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "symmetry-cli",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "dist/symmetry.js",
6
6
  "bin": "dist/symmetry.js",
@@ -23,7 +23,8 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "commander": "^12.1.0",
26
- "symmetry-core": "^1.0.19"
26
+ "js-yaml": "^4.1.0",
27
+ "symmetry-core": "^1.0.21"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/jest": "^29.5.12",