@schuttdev/gigai 0.3.0 → 0.3.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.
@@ -1682,6 +1682,31 @@ async function runInit() {
1682
1682
  console.log(` Run 'gigai pair' to generate a new one.
1683
1683
  `);
1684
1684
  }
1685
+ function splitCommand(input3) {
1686
+ const tokens = [];
1687
+ let current = "";
1688
+ let inQuote = null;
1689
+ for (const ch of input3.trim()) {
1690
+ if (inQuote) {
1691
+ if (ch === inQuote) {
1692
+ inQuote = null;
1693
+ } else {
1694
+ current += ch;
1695
+ }
1696
+ } else if (ch === '"' || ch === "'") {
1697
+ inQuote = ch;
1698
+ } else if (ch === " " || ch === " ") {
1699
+ if (current) {
1700
+ tokens.push(current);
1701
+ current = "";
1702
+ }
1703
+ } else {
1704
+ current += ch;
1705
+ }
1706
+ }
1707
+ if (current) tokens.push(current);
1708
+ return { command: tokens[0] ?? input3.trim(), args: tokens.slice(1) };
1709
+ }
1685
1710
  async function loadConfigFile(path) {
1686
1711
  const configPath = resolve5(path ?? "gigai.config.json");
1687
1712
  const raw = await readFile5(configPath, "utf8");
@@ -1694,16 +1719,19 @@ async function saveConfig(config, path) {
1694
1719
  async function wrapCli() {
1695
1720
  const { config, path } = await loadConfigFile();
1696
1721
  const name = await input2({ message: "Tool name:", required: true });
1697
- const command = await input2({ message: "Command:", required: true });
1722
+ const commandInput = await input2({
1723
+ message: "Command (as you'd run it in your terminal):",
1724
+ required: true
1725
+ });
1698
1726
  const description = await input2({ message: "Description:", required: true });
1699
- const argsStr = await input2({ message: "Default args (space-separated, optional):" });
1700
1727
  const timeoutStr = await input2({ message: "Timeout in ms (optional):", default: "30000" });
1728
+ const { command, args } = splitCommand(commandInput);
1701
1729
  const tool = {
1702
1730
  type: "cli",
1703
1731
  name,
1704
1732
  command,
1705
1733
  description,
1706
- ...argsStr && { args: argsStr.split(" ").filter(Boolean) },
1734
+ ...args.length > 0 && { args },
1707
1735
  timeout: parseInt(timeoutStr, 10)
1708
1736
  };
1709
1737
  config.tools.push(tool);
package/dist/index.js CHANGED
@@ -4,12 +4,12 @@
4
4
  import { defineCommand, runMain } from "citty";
5
5
 
6
6
  // src/version.ts
7
- var VERSION = "0.3.0";
7
+ var VERSION = "0.3.1";
8
8
 
9
9
  // src/index.ts
10
10
  async function requireServer() {
11
11
  try {
12
- return await import("./dist-H6URC2HQ.js");
12
+ return await import("./dist-DTBR4X7U.js");
13
13
  } catch {
14
14
  console.error("Server dependencies not installed.");
15
15
  console.error("Run: npm install -g @schuttdev/gigai");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schuttdev/gigai",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "gigai": "dist/index.js"