struere 0.4.0 → 0.4.2

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.
@@ -17612,6 +17612,51 @@ function scaffoldRole(cwd, name) {
17612
17612
  }
17613
17613
 
17614
17614
  // src/cli/commands/init.ts
17615
+ async function runInit(cwd) {
17616
+ const spinner = ora();
17617
+ let credentials = loadCredentials();
17618
+ if (!credentials) {
17619
+ console.log(source_default.yellow("Not logged in - authenticating..."));
17620
+ console.log();
17621
+ credentials = await performLogin();
17622
+ if (!credentials) {
17623
+ console.log(source_default.red("Authentication failed"));
17624
+ return false;
17625
+ }
17626
+ console.log();
17627
+ }
17628
+ console.log(source_default.green("\u2713"), "Logged in as", source_default.cyan(credentials.user.name || credentials.user.email));
17629
+ console.log(source_default.gray(" Organization:"), source_default.cyan(credentials.organization.name));
17630
+ console.log();
17631
+ const projectName = slugify(basename(cwd));
17632
+ spinner.start("Creating project structure");
17633
+ const scaffoldResult = scaffoldProjectV2(cwd, {
17634
+ projectName,
17635
+ orgId: credentials.organization.id,
17636
+ orgSlug: credentials.organization.slug,
17637
+ orgName: credentials.organization.name
17638
+ });
17639
+ spinner.succeed("Project structure created");
17640
+ for (const file of scaffoldResult.createdFiles) {
17641
+ console.log(source_default.green("\u2713"), `Created ${file}`);
17642
+ }
17643
+ console.log();
17644
+ spinner.start("Installing dependencies");
17645
+ const installResult = Bun.spawnSync(["bun", "install"], {
17646
+ cwd,
17647
+ stdout: "pipe",
17648
+ stderr: "pipe"
17649
+ });
17650
+ if (installResult.exitCode === 0) {
17651
+ spinner.succeed("Dependencies installed");
17652
+ } else {
17653
+ spinner.warn("Could not install dependencies automatically");
17654
+ console.log(source_default.gray(" Run"), source_default.cyan("bun install"), source_default.gray("manually"));
17655
+ }
17656
+ console.log();
17657
+ console.log(source_default.green("\u2713"), "Project initialized");
17658
+ return true;
17659
+ }
17615
17660
  var initCommand = new Command("init").description("Initialize a new Struere organization project").argument("[project-name]", "Project name").option("-y, --yes", "Skip prompts and use defaults").action(async (projectNameArg, options) => {
17616
17661
  const cwd = process.cwd();
17617
17662
  const spinner = ora();
@@ -17637,33 +17682,21 @@ var initCommand = new Command("init").description("Initialize a new Struere orga
17637
17682
  }
17638
17683
  let credentials = loadCredentials();
17639
17684
  if (!credentials) {
17640
- console.log(source_default.gray("Authentication required"));
17685
+ console.log(source_default.yellow("Not logged in - authenticating..."));
17641
17686
  console.log();
17642
17687
  credentials = await performLogin();
17643
17688
  if (!credentials) {
17644
17689
  console.log(source_default.red("Authentication failed"));
17645
17690
  process.exit(1);
17646
17691
  }
17647
- } else {
17648
- console.log(source_default.green("\u2713"), "Logged in as", source_default.cyan(credentials.user.name || credentials.user.email));
17649
- console.log(source_default.gray(" Organization:"), source_default.cyan(credentials.organization.name));
17650
17692
  console.log();
17651
17693
  }
17652
- if (!options.yes) {
17653
- const confirmed = await promptYesNo(`Initialize project for organization "${credentials.organization.name}"?`);
17654
- if (!confirmed) {
17655
- console.log();
17656
- console.log(source_default.gray("Cancelled"));
17657
- return;
17658
- }
17659
- }
17694
+ console.log(source_default.green("\u2713"), "Logged in as", source_default.cyan(credentials.user.name || credentials.user.email));
17695
+ console.log(source_default.gray(" Organization:"), source_default.cyan(credentials.organization.name));
17696
+ console.log();
17660
17697
  let projectName = projectNameArg;
17661
17698
  if (!projectName) {
17662
17699
  projectName = slugify(basename(cwd));
17663
- if (!options.yes) {
17664
- const confirmed = await promptText("Project name:", projectName);
17665
- projectName = confirmed || projectName;
17666
- }
17667
17700
  }
17668
17701
  projectName = slugify(projectName);
17669
17702
  spinner.start("Creating project structure");
@@ -17707,37 +17740,6 @@ var initCommand = new Command("init").description("Initialize a new Struere orga
17707
17740
  function slugify(name) {
17708
17741
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
17709
17742
  }
17710
- async function promptYesNo(message) {
17711
- process.stdout.write(source_default.gray(`${message} (Y/n) `));
17712
- const answer = await readLine();
17713
- return answer === "" || answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
17714
- }
17715
- async function promptText(message, defaultValue) {
17716
- process.stdout.write(source_default.gray(`${message} `));
17717
- process.stdout.write(source_default.cyan(`(${defaultValue}) `));
17718
- const answer = await readLine();
17719
- return answer || defaultValue;
17720
- }
17721
- function readLine() {
17722
- return new Promise((resolve) => {
17723
- let buffer = "";
17724
- if (process.stdin.isTTY) {
17725
- process.stdin.setRawMode(false);
17726
- }
17727
- process.stdin.setEncoding("utf8");
17728
- process.stdin.resume();
17729
- const onData = (data) => {
17730
- buffer += data;
17731
- if (buffer.includes(`
17732
- `)) {
17733
- process.stdin.removeListener("data", onData);
17734
- process.stdin.pause();
17735
- resolve(buffer.replace(/[\r\n]/g, "").trim());
17736
- }
17737
- };
17738
- process.stdin.on("data", onData);
17739
- });
17740
- }
17741
17743
 
17742
17744
  // src/cli/commands/dev.ts
17743
17745
  var import_chokidar = __toESM(require_chokidar(), 1);
@@ -17990,11 +17992,10 @@ var devCommand = new Command("dev").description("Sync all resources to developme
17990
17992
  console.log(source_default.bold("Struere Dev"));
17991
17993
  console.log();
17992
17994
  if (!hasProject(cwd)) {
17993
- console.log(source_default.yellow("No struere.json found"));
17995
+ console.log(source_default.yellow("No struere.json found - initializing project..."));
17994
17996
  console.log();
17995
- console.log(source_default.gray("Run"), source_default.cyan("struere init"), source_default.gray("to initialize this project"));
17997
+ await runInit(cwd);
17996
17998
  console.log();
17997
- process.exit(1);
17998
17999
  }
17999
18000
  const version = getProjectVersion(cwd);
18000
18001
  if (version === "1.0") {
@@ -18013,13 +18014,14 @@ var devCommand = new Command("dev").description("Sync all resources to developme
18013
18014
  let credentials = loadCredentials();
18014
18015
  const apiKey = getApiKey();
18015
18016
  if (!credentials && !apiKey) {
18016
- console.log(source_default.gray("Authentication required"));
18017
+ console.log(source_default.yellow("Not logged in - authenticating..."));
18017
18018
  console.log();
18018
18019
  credentials = await performLogin();
18019
18020
  if (!credentials) {
18020
18021
  console.log(source_default.red("Authentication failed"));
18021
18022
  process.exit(1);
18022
18023
  }
18024
+ console.log();
18023
18025
  }
18024
18026
  const claudeMdPath = join5(cwd, "CLAUDE.md");
18025
18027
  if (!existsSync5(claudeMdPath)) {
@@ -18031,17 +18033,13 @@ var devCommand = new Command("dev").description("Sync all resources to developme
18031
18033
  return message.includes("Unauthenticated") || message.includes("OIDC") || message.includes("token") || message.includes("expired");
18032
18034
  };
18033
18035
  const performSync = async () => {
18034
- try {
18035
- const resources = await loadAllResources(cwd);
18036
- const payload = extractSyncPayload(resources);
18037
- const result = await syncOrganization(payload);
18038
- if (!result.success) {
18039
- throw new Error(result.error || "Sync failed");
18040
- }
18041
- return true;
18042
- } catch (error) {
18043
- throw error;
18036
+ const resources = await loadAllResources(cwd);
18037
+ const payload = extractSyncPayload(resources);
18038
+ const result = await syncOrganization(payload);
18039
+ if (!result.success) {
18040
+ throw new Error(result.error || "Sync failed");
18044
18041
  }
18042
+ return true;
18045
18043
  };
18046
18044
  spinner.start("Loading resources");
18047
18045
  try {
@@ -18058,9 +18056,7 @@ var devCommand = new Command("dev").description("Sync all resources to developme
18058
18056
  spinner.succeed("Synced to development");
18059
18057
  } catch (error) {
18060
18058
  if (isAuthError(error)) {
18061
- spinner.fail("Session expired");
18062
- console.log();
18063
- console.log(source_default.gray("Re-authenticating..."));
18059
+ spinner.fail("Session expired - re-authenticating...");
18064
18060
  clearCredentials();
18065
18061
  credentials = await performLogin();
18066
18062
  if (!credentials) {
@@ -18106,9 +18102,7 @@ var devCommand = new Command("dev").description("Sync all resources to developme
18106
18102
  syncSpinner.succeed("Synced");
18107
18103
  } catch (error) {
18108
18104
  if (isAuthError(error)) {
18109
- syncSpinner.fail("Session expired");
18110
- console.log();
18111
- console.log(source_default.gray("Re-authenticating..."));
18105
+ syncSpinner.fail("Session expired - re-authenticating...");
18112
18106
  clearCredentials();
18113
18107
  const newCredentials = await performLogin();
18114
18108
  if (!newCredentials) {
@@ -18553,11 +18547,13 @@ var deployCommand = new Command("deploy").description("Deploy all agents to prod
18553
18547
  console.log(source_default.bold("Deploying Agents"));
18554
18548
  console.log();
18555
18549
  if (!hasProject(cwd)) {
18556
- console.log(source_default.yellow("No struere.json found"));
18550
+ console.log(source_default.yellow("No struere.json found - initializing project..."));
18557
18551
  console.log();
18558
- console.log(source_default.gray("Run"), source_default.cyan("struere init"), source_default.gray("to initialize this project"));
18552
+ const success = await runInit(cwd);
18553
+ if (!success) {
18554
+ process.exit(1);
18555
+ }
18559
18556
  console.log();
18560
- process.exit(1);
18561
18557
  }
18562
18558
  const version = getProjectVersion(cwd);
18563
18559
  if (version === "1.0") {
@@ -18573,15 +18569,17 @@ var deployCommand = new Command("deploy").description("Deploy all agents to prod
18573
18569
  }
18574
18570
  console.log(source_default.gray("Organization:"), source_default.cyan(project.organization.name));
18575
18571
  console.log();
18576
- const credentials = loadCredentials();
18572
+ let credentials = loadCredentials();
18577
18573
  const apiKey = getApiKey();
18578
18574
  if (!credentials && !apiKey) {
18579
- console.log(source_default.red("Not authenticated"));
18575
+ console.log(source_default.yellow("Not logged in - authenticating..."));
18580
18576
  console.log();
18581
- console.log(source_default.gray("Run"), source_default.cyan("struere login"), source_default.gray("to authenticate"));
18582
- console.log(source_default.gray("Or set"), source_default.cyan("STRUERE_API_KEY"), source_default.gray("environment variable"));
18577
+ credentials = await performLogin();
18578
+ if (!credentials) {
18579
+ console.log(source_default.red("Authentication failed"));
18580
+ process.exit(1);
18581
+ }
18583
18582
  console.log();
18584
- process.exit(1);
18585
18583
  }
18586
18584
  spinner.start("Loading resources");
18587
18585
  let resources;
@@ -18669,8 +18667,6 @@ var deployCommand = new Command("deploy").description("Deploy all agents to prod
18669
18667
  console.log();
18670
18668
  console.log(source_default.red("Error:"), error instanceof Error ? error.message : String(error));
18671
18669
  console.log();
18672
- console.log(source_default.gray("Try running"), source_default.cyan("struere login"), source_default.gray("to re-authenticate"));
18673
- console.log();
18674
18670
  process.exit(1);
18675
18671
  }
18676
18672
  });
@@ -18892,11 +18888,13 @@ var addCommand = new Command("add").description("Scaffold a new resource").argum
18892
18888
  const cwd = process.cwd();
18893
18889
  console.log();
18894
18890
  if (!hasProject(cwd)) {
18895
- console.log(source_default.yellow("No struere.json found"));
18891
+ console.log(source_default.yellow("No struere.json found - initializing project..."));
18896
18892
  console.log();
18897
- console.log(source_default.gray("Run"), source_default.cyan("struere init"), source_default.gray("to initialize this project"));
18893
+ const success = await runInit(cwd);
18894
+ if (!success) {
18895
+ process.exit(1);
18896
+ }
18898
18897
  console.log();
18899
- process.exit(1);
18900
18898
  }
18901
18899
  const version = getProjectVersion(cwd);
18902
18900
  if (version === "1.0") {
@@ -18970,11 +18968,13 @@ var statusCommand = new Command("status").description("Compare local vs remote s
18970
18968
  console.log(source_default.bold("Struere Status"));
18971
18969
  console.log();
18972
18970
  if (!hasProject(cwd)) {
18973
- console.log(source_default.yellow("No struere.json found"));
18971
+ console.log(source_default.yellow("No struere.json found - initializing project..."));
18974
18972
  console.log();
18975
- console.log(source_default.gray("Run"), source_default.cyan("struere init"), source_default.gray("to initialize this project"));
18973
+ const success = await runInit(cwd);
18974
+ if (!success) {
18975
+ process.exit(1);
18976
+ }
18976
18977
  console.log();
18977
- process.exit(1);
18978
18978
  }
18979
18979
  const version = getProjectVersion(cwd);
18980
18980
  if (version === "1.0") {
@@ -18990,14 +18990,17 @@ var statusCommand = new Command("status").description("Compare local vs remote s
18990
18990
  }
18991
18991
  console.log(source_default.gray("Organization:"), source_default.cyan(project.organization.name));
18992
18992
  console.log();
18993
- const credentials = loadCredentials();
18993
+ let credentials = loadCredentials();
18994
18994
  const apiKey = getApiKey();
18995
18995
  if (!credentials && !apiKey) {
18996
- console.log(source_default.red("Not authenticated"));
18996
+ console.log(source_default.yellow("Not logged in - authenticating..."));
18997
18997
  console.log();
18998
- console.log(source_default.gray("Run"), source_default.cyan("struere login"), source_default.gray("to authenticate"));
18998
+ credentials = await performLogin();
18999
+ if (!credentials) {
19000
+ console.log(source_default.red("Authentication failed"));
19001
+ process.exit(1);
19002
+ }
18999
19003
  console.log();
19000
- process.exit(1);
19001
19004
  }
19002
19005
  spinner.start("Loading local resources");
19003
19006
  let localResources;
@@ -19097,7 +19100,7 @@ var statusCommand = new Command("status").description("Compare local vs remote s
19097
19100
  // package.json
19098
19101
  var package_default = {
19099
19102
  name: "struere",
19100
- version: "0.4.0",
19103
+ version: "0.4.2",
19101
19104
  description: "Build, test, and deploy AI agents",
19102
19105
  keywords: [
19103
19106
  "ai",
@@ -1 +1 @@
1
- {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,eAAO,MAAM,UAAU,SAsFnB,CAAA"}
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,UAAU,SAwFnB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AASnC,eAAO,MAAM,aAAa,SAuJtB,CAAA"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAWnC,eAAO,MAAM,aAAa,SAyJtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAcnC,eAAO,MAAM,UAAU,SAgNnB,CAAA"}
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/dev.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAenC,eAAO,MAAM,UAAU,SAqMnB,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { Command } from 'commander';
2
+ export declare function runInit(cwd: string): Promise<boolean>;
2
3
  export declare const initCommand: Command;
3
4
  export declare function slugify(name: string): string;
4
5
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AASnC,eAAO,MAAM,WAAW,SA6GpB,CAAA;AAEJ,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5C"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AASnC,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAwD3D;AAED,eAAO,MAAM,WAAW,SAiGpB,CAAA;AAEJ,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK5C"}
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,eAAO,MAAM,aAAa,SA8JtB,CAAA"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,eAAO,MAAM,aAAa,SAmKtB,CAAA"}
package/dist/cli/index.js CHANGED
@@ -951,6 +951,51 @@ function scaffoldRole(cwd, name) {
951
951
  }
952
952
 
953
953
  // src/cli/commands/init.ts
954
+ async function runInit(cwd) {
955
+ const spinner = ora2();
956
+ let credentials = loadCredentials();
957
+ if (!credentials) {
958
+ console.log(chalk2.yellow("Not logged in - authenticating..."));
959
+ console.log();
960
+ credentials = await performLogin();
961
+ if (!credentials) {
962
+ console.log(chalk2.red("Authentication failed"));
963
+ return false;
964
+ }
965
+ console.log();
966
+ }
967
+ console.log(chalk2.green("\u2713"), "Logged in as", chalk2.cyan(credentials.user.name || credentials.user.email));
968
+ console.log(chalk2.gray(" Organization:"), chalk2.cyan(credentials.organization.name));
969
+ console.log();
970
+ const projectName = slugify(basename(cwd));
971
+ spinner.start("Creating project structure");
972
+ const scaffoldResult = scaffoldProjectV2(cwd, {
973
+ projectName,
974
+ orgId: credentials.organization.id,
975
+ orgSlug: credentials.organization.slug,
976
+ orgName: credentials.organization.name
977
+ });
978
+ spinner.succeed("Project structure created");
979
+ for (const file of scaffoldResult.createdFiles) {
980
+ console.log(chalk2.green("\u2713"), `Created ${file}`);
981
+ }
982
+ console.log();
983
+ spinner.start("Installing dependencies");
984
+ const installResult = Bun.spawnSync(["bun", "install"], {
985
+ cwd,
986
+ stdout: "pipe",
987
+ stderr: "pipe"
988
+ });
989
+ if (installResult.exitCode === 0) {
990
+ spinner.succeed("Dependencies installed");
991
+ } else {
992
+ spinner.warn("Could not install dependencies automatically");
993
+ console.log(chalk2.gray(" Run"), chalk2.cyan("bun install"), chalk2.gray("manually"));
994
+ }
995
+ console.log();
996
+ console.log(chalk2.green("\u2713"), "Project initialized");
997
+ return true;
998
+ }
954
999
  var initCommand = new Command2("init").description("Initialize a new Struere organization project").argument("[project-name]", "Project name").option("-y, --yes", "Skip prompts and use defaults").action(async (projectNameArg, options) => {
955
1000
  const cwd = process.cwd();
956
1001
  const spinner = ora2();
@@ -976,33 +1021,21 @@ var initCommand = new Command2("init").description("Initialize a new Struere org
976
1021
  }
977
1022
  let credentials = loadCredentials();
978
1023
  if (!credentials) {
979
- console.log(chalk2.gray("Authentication required"));
1024
+ console.log(chalk2.yellow("Not logged in - authenticating..."));
980
1025
  console.log();
981
1026
  credentials = await performLogin();
982
1027
  if (!credentials) {
983
1028
  console.log(chalk2.red("Authentication failed"));
984
1029
  process.exit(1);
985
1030
  }
986
- } else {
987
- console.log(chalk2.green("\u2713"), "Logged in as", chalk2.cyan(credentials.user.name || credentials.user.email));
988
- console.log(chalk2.gray(" Organization:"), chalk2.cyan(credentials.organization.name));
989
1031
  console.log();
990
1032
  }
991
- if (!options.yes) {
992
- const confirmed = await promptYesNo(`Initialize project for organization "${credentials.organization.name}"?`);
993
- if (!confirmed) {
994
- console.log();
995
- console.log(chalk2.gray("Cancelled"));
996
- return;
997
- }
998
- }
1033
+ console.log(chalk2.green("\u2713"), "Logged in as", chalk2.cyan(credentials.user.name || credentials.user.email));
1034
+ console.log(chalk2.gray(" Organization:"), chalk2.cyan(credentials.organization.name));
1035
+ console.log();
999
1036
  let projectName = projectNameArg;
1000
1037
  if (!projectName) {
1001
1038
  projectName = slugify(basename(cwd));
1002
- if (!options.yes) {
1003
- const confirmed = await promptText("Project name:", projectName);
1004
- projectName = confirmed || projectName;
1005
- }
1006
1039
  }
1007
1040
  projectName = slugify(projectName);
1008
1041
  spinner.start("Creating project structure");
@@ -1046,37 +1079,6 @@ var initCommand = new Command2("init").description("Initialize a new Struere org
1046
1079
  function slugify(name) {
1047
1080
  return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
1048
1081
  }
1049
- async function promptYesNo(message) {
1050
- process.stdout.write(chalk2.gray(`${message} (Y/n) `));
1051
- const answer = await readLine();
1052
- return answer === "" || answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
1053
- }
1054
- async function promptText(message, defaultValue) {
1055
- process.stdout.write(chalk2.gray(`${message} `));
1056
- process.stdout.write(chalk2.cyan(`(${defaultValue}) `));
1057
- const answer = await readLine();
1058
- return answer || defaultValue;
1059
- }
1060
- function readLine() {
1061
- return new Promise((resolve) => {
1062
- let buffer = "";
1063
- if (process.stdin.isTTY) {
1064
- process.stdin.setRawMode(false);
1065
- }
1066
- process.stdin.setEncoding("utf8");
1067
- process.stdin.resume();
1068
- const onData = (data) => {
1069
- buffer += data;
1070
- if (buffer.includes(`
1071
- `)) {
1072
- process.stdin.removeListener("data", onData);
1073
- process.stdin.pause();
1074
- resolve(buffer.replace(/[\r\n]/g, "").trim());
1075
- }
1076
- };
1077
- process.stdin.on("data", onData);
1078
- });
1079
- }
1080
1082
 
1081
1083
  // src/cli/commands/dev.ts
1082
1084
  import { Command as Command3 } from "commander";
@@ -1332,11 +1334,10 @@ var devCommand = new Command3("dev").description("Sync all resources to developm
1332
1334
  console.log(chalk3.bold("Struere Dev"));
1333
1335
  console.log();
1334
1336
  if (!hasProject(cwd)) {
1335
- console.log(chalk3.yellow("No struere.json found"));
1337
+ console.log(chalk3.yellow("No struere.json found - initializing project..."));
1336
1338
  console.log();
1337
- console.log(chalk3.gray("Run"), chalk3.cyan("struere init"), chalk3.gray("to initialize this project"));
1339
+ await runInit(cwd);
1338
1340
  console.log();
1339
- process.exit(1);
1340
1341
  }
1341
1342
  const version = getProjectVersion(cwd);
1342
1343
  if (version === "1.0") {
@@ -1355,13 +1356,14 @@ var devCommand = new Command3("dev").description("Sync all resources to developm
1355
1356
  let credentials = loadCredentials();
1356
1357
  const apiKey = getApiKey();
1357
1358
  if (!credentials && !apiKey) {
1358
- console.log(chalk3.gray("Authentication required"));
1359
+ console.log(chalk3.yellow("Not logged in - authenticating..."));
1359
1360
  console.log();
1360
1361
  credentials = await performLogin();
1361
1362
  if (!credentials) {
1362
1363
  console.log(chalk3.red("Authentication failed"));
1363
1364
  process.exit(1);
1364
1365
  }
1366
+ console.log();
1365
1367
  }
1366
1368
  const claudeMdPath = join5(cwd, "CLAUDE.md");
1367
1369
  if (!existsSync5(claudeMdPath)) {
@@ -1373,17 +1375,13 @@ var devCommand = new Command3("dev").description("Sync all resources to developm
1373
1375
  return message.includes("Unauthenticated") || message.includes("OIDC") || message.includes("token") || message.includes("expired");
1374
1376
  };
1375
1377
  const performSync = async () => {
1376
- try {
1377
- const resources = await loadAllResources(cwd);
1378
- const payload = extractSyncPayload(resources);
1379
- const result = await syncOrganization(payload);
1380
- if (!result.success) {
1381
- throw new Error(result.error || "Sync failed");
1382
- }
1383
- return true;
1384
- } catch (error) {
1385
- throw error;
1378
+ const resources = await loadAllResources(cwd);
1379
+ const payload = extractSyncPayload(resources);
1380
+ const result = await syncOrganization(payload);
1381
+ if (!result.success) {
1382
+ throw new Error(result.error || "Sync failed");
1386
1383
  }
1384
+ return true;
1387
1385
  };
1388
1386
  spinner.start("Loading resources");
1389
1387
  try {
@@ -1400,9 +1398,7 @@ var devCommand = new Command3("dev").description("Sync all resources to developm
1400
1398
  spinner.succeed("Synced to development");
1401
1399
  } catch (error) {
1402
1400
  if (isAuthError(error)) {
1403
- spinner.fail("Session expired");
1404
- console.log();
1405
- console.log(chalk3.gray("Re-authenticating..."));
1401
+ spinner.fail("Session expired - re-authenticating...");
1406
1402
  clearCredentials();
1407
1403
  credentials = await performLogin();
1408
1404
  if (!credentials) {
@@ -1448,9 +1444,7 @@ var devCommand = new Command3("dev").description("Sync all resources to developm
1448
1444
  syncSpinner.succeed("Synced");
1449
1445
  } catch (error) {
1450
1446
  if (isAuthError(error)) {
1451
- syncSpinner.fail("Session expired");
1452
- console.log();
1453
- console.log(chalk3.gray("Re-authenticating..."));
1447
+ syncSpinner.fail("Session expired - re-authenticating...");
1454
1448
  clearCredentials();
1455
1449
  const newCredentials = await performLogin();
1456
1450
  if (!newCredentials) {
@@ -1904,11 +1898,13 @@ var deployCommand = new Command6("deploy").description("Deploy all agents to pro
1904
1898
  console.log(chalk6.bold("Deploying Agents"));
1905
1899
  console.log();
1906
1900
  if (!hasProject(cwd)) {
1907
- console.log(chalk6.yellow("No struere.json found"));
1901
+ console.log(chalk6.yellow("No struere.json found - initializing project..."));
1908
1902
  console.log();
1909
- console.log(chalk6.gray("Run"), chalk6.cyan("struere init"), chalk6.gray("to initialize this project"));
1903
+ const success = await runInit(cwd);
1904
+ if (!success) {
1905
+ process.exit(1);
1906
+ }
1910
1907
  console.log();
1911
- process.exit(1);
1912
1908
  }
1913
1909
  const version = getProjectVersion(cwd);
1914
1910
  if (version === "1.0") {
@@ -1924,15 +1920,17 @@ var deployCommand = new Command6("deploy").description("Deploy all agents to pro
1924
1920
  }
1925
1921
  console.log(chalk6.gray("Organization:"), chalk6.cyan(project.organization.name));
1926
1922
  console.log();
1927
- const credentials = loadCredentials();
1923
+ let credentials = loadCredentials();
1928
1924
  const apiKey = getApiKey();
1929
1925
  if (!credentials && !apiKey) {
1930
- console.log(chalk6.red("Not authenticated"));
1926
+ console.log(chalk6.yellow("Not logged in - authenticating..."));
1931
1927
  console.log();
1932
- console.log(chalk6.gray("Run"), chalk6.cyan("struere login"), chalk6.gray("to authenticate"));
1933
- console.log(chalk6.gray("Or set"), chalk6.cyan("STRUERE_API_KEY"), chalk6.gray("environment variable"));
1928
+ credentials = await performLogin();
1929
+ if (!credentials) {
1930
+ console.log(chalk6.red("Authentication failed"));
1931
+ process.exit(1);
1932
+ }
1934
1933
  console.log();
1935
- process.exit(1);
1936
1934
  }
1937
1935
  spinner.start("Loading resources");
1938
1936
  let resources;
@@ -2020,8 +2018,6 @@ var deployCommand = new Command6("deploy").description("Deploy all agents to pro
2020
2018
  console.log();
2021
2019
  console.log(chalk6.red("Error:"), error instanceof Error ? error.message : String(error));
2022
2020
  console.log();
2023
- console.log(chalk6.gray("Try running"), chalk6.cyan("struere login"), chalk6.gray("to re-authenticate"));
2024
- console.log();
2025
2021
  process.exit(1);
2026
2022
  }
2027
2023
  });
@@ -2259,11 +2255,13 @@ var addCommand = new Command12("add").description("Scaffold a new resource").arg
2259
2255
  const cwd = process.cwd();
2260
2256
  console.log();
2261
2257
  if (!hasProject(cwd)) {
2262
- console.log(chalk12.yellow("No struere.json found"));
2258
+ console.log(chalk12.yellow("No struere.json found - initializing project..."));
2263
2259
  console.log();
2264
- console.log(chalk12.gray("Run"), chalk12.cyan("struere init"), chalk12.gray("to initialize this project"));
2260
+ const success = await runInit(cwd);
2261
+ if (!success) {
2262
+ process.exit(1);
2263
+ }
2265
2264
  console.log();
2266
- process.exit(1);
2267
2265
  }
2268
2266
  const version = getProjectVersion(cwd);
2269
2267
  if (version === "1.0") {
@@ -2340,11 +2338,13 @@ var statusCommand = new Command13("status").description("Compare local vs remote
2340
2338
  console.log(chalk13.bold("Struere Status"));
2341
2339
  console.log();
2342
2340
  if (!hasProject(cwd)) {
2343
- console.log(chalk13.yellow("No struere.json found"));
2341
+ console.log(chalk13.yellow("No struere.json found - initializing project..."));
2344
2342
  console.log();
2345
- console.log(chalk13.gray("Run"), chalk13.cyan("struere init"), chalk13.gray("to initialize this project"));
2343
+ const success = await runInit(cwd);
2344
+ if (!success) {
2345
+ process.exit(1);
2346
+ }
2346
2347
  console.log();
2347
- process.exit(1);
2348
2348
  }
2349
2349
  const version = getProjectVersion(cwd);
2350
2350
  if (version === "1.0") {
@@ -2360,14 +2360,17 @@ var statusCommand = new Command13("status").description("Compare local vs remote
2360
2360
  }
2361
2361
  console.log(chalk13.gray("Organization:"), chalk13.cyan(project.organization.name));
2362
2362
  console.log();
2363
- const credentials = loadCredentials();
2363
+ let credentials = loadCredentials();
2364
2364
  const apiKey = getApiKey();
2365
2365
  if (!credentials && !apiKey) {
2366
- console.log(chalk13.red("Not authenticated"));
2366
+ console.log(chalk13.yellow("Not logged in - authenticating..."));
2367
2367
  console.log();
2368
- console.log(chalk13.gray("Run"), chalk13.cyan("struere login"), chalk13.gray("to authenticate"));
2368
+ credentials = await performLogin();
2369
+ if (!credentials) {
2370
+ console.log(chalk13.red("Authentication failed"));
2371
+ process.exit(1);
2372
+ }
2369
2373
  console.log();
2370
- process.exit(1);
2371
2374
  }
2372
2375
  spinner.start("Loading local resources");
2373
2376
  let localResources;
@@ -2467,7 +2470,7 @@ var statusCommand = new Command13("status").description("Compare local vs remote
2467
2470
  // package.json
2468
2471
  var package_default = {
2469
2472
  name: "struere",
2470
- version: "0.4.0",
2473
+ version: "0.4.2",
2471
2474
  description: "Build, test, and deploy AI agents",
2472
2475
  keywords: [
2473
2476
  "ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "struere",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Build, test, and deploy AI agents",
5
5
  "keywords": [
6
6
  "ai",