rrce-workflow 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +414 -184
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -574,9 +574,97 @@ var init_detection_service = __esm({
574
574
  }
575
575
  });
576
576
 
577
- // src/lib/autocomplete-prompt.ts
577
+ // src/types/prompt.ts
578
+ import { z } from "zod";
579
+ var PromptArgSchema, AutoIdentitySchema, PromptFrontmatterSchema;
580
+ var init_prompt = __esm({
581
+ "src/types/prompt.ts"() {
582
+ "use strict";
583
+ PromptArgSchema = z.object({
584
+ name: z.string(),
585
+ default: z.string().optional(),
586
+ prompt: z.string().optional()
587
+ });
588
+ AutoIdentitySchema = z.object({
589
+ user: z.string(),
590
+ model: z.string()
591
+ });
592
+ PromptFrontmatterSchema = z.object({
593
+ name: z.string(),
594
+ description: z.string(),
595
+ "argument-hint": z.union([z.string(), z.array(z.string())]).optional(),
596
+ tools: z.array(z.string()).optional(),
597
+ mode: z.enum(["primary", "subagent"]).optional(),
598
+ "required-args": z.array(PromptArgSchema).optional(),
599
+ "optional-args": z.array(PromptArgSchema).optional(),
600
+ "auto-identity": AutoIdentitySchema.optional()
601
+ });
602
+ }
603
+ });
604
+
605
+ // src/lib/prompts.ts
578
606
  import * as fs4 from "fs";
579
607
  import * as path4 from "path";
608
+ import { fileURLToPath } from "url";
609
+ import matter from "gray-matter";
610
+ function parsePromptFile(filePath) {
611
+ try {
612
+ const fileContent = fs4.readFileSync(filePath, "utf-8");
613
+ const { data, content } = matter(fileContent);
614
+ const parsed = PromptFrontmatterSchema.safeParse(data);
615
+ if (!parsed.success) {
616
+ console.error(`Failed to parse frontmatter in ${filePath}:`, parsed.error);
617
+ return null;
618
+ }
619
+ return {
620
+ frontmatter: parsed.data,
621
+ content: content.trim(),
622
+ filePath
623
+ };
624
+ } catch (error) {
625
+ console.error(`Error reading prompt file ${filePath}:`, error);
626
+ return null;
627
+ }
628
+ }
629
+ function loadPromptsFromDir(dirPath) {
630
+ if (!fs4.existsSync(dirPath)) {
631
+ return [];
632
+ }
633
+ const files = fs4.readdirSync(dirPath).filter((f) => f.endsWith(".md"));
634
+ const prompts = [];
635
+ for (const file of files) {
636
+ const prompt = parsePromptFile(path4.join(dirPath, file));
637
+ if (prompt) {
638
+ prompts.push(prompt);
639
+ }
640
+ }
641
+ return prompts;
642
+ }
643
+ function getAgentCoreDir() {
644
+ if (__dirname.includes("/src/") || __dirname.includes("\\src\\")) {
645
+ if (fs4.existsSync(path4.join(process.cwd(), "agent-core"))) {
646
+ return path4.join(process.cwd(), "agent-core");
647
+ }
648
+ return path4.resolve(__dirname, "../..", "agent-core");
649
+ }
650
+ return path4.join(__dirname, "..", "agent-core");
651
+ }
652
+ function getAgentCorePromptsDir() {
653
+ return path4.join(getAgentCoreDir(), "prompts");
654
+ }
655
+ var __filename, __dirname;
656
+ var init_prompts = __esm({
657
+ "src/lib/prompts.ts"() {
658
+ "use strict";
659
+ init_prompt();
660
+ __filename = fileURLToPath(import.meta.url);
661
+ __dirname = path4.dirname(__filename);
662
+ }
663
+ });
664
+
665
+ // src/lib/autocomplete-prompt.ts
666
+ import * as fs5 from "fs";
667
+ import * as path5 from "path";
580
668
  import * as readline from "readline";
581
669
  import pc from "picocolors";
582
670
  function directoryPrompt(opts) {
@@ -635,19 +723,19 @@ function completeDirectory(line) {
635
723
  prefix = "";
636
724
  basePath = expanded;
637
725
  } else {
638
- dirToScan = path4.dirname(expanded);
639
- prefix = path4.basename(expanded).toLowerCase();
726
+ dirToScan = path5.dirname(expanded);
727
+ prefix = path5.basename(expanded).toLowerCase();
640
728
  basePath = dirToScan === "/" ? "/" : dirToScan + "/";
641
729
  }
642
- if (!fs4.existsSync(dirToScan)) {
730
+ if (!fs5.existsSync(dirToScan)) {
643
731
  return [[], line];
644
732
  }
645
- const entries = fs4.readdirSync(dirToScan, { withFileTypes: true }).filter((entry) => {
733
+ const entries = fs5.readdirSync(dirToScan, { withFileTypes: true }).filter((entry) => {
646
734
  if (!entry.isDirectory()) return false;
647
735
  if (entry.name.startsWith(".") && !prefix.startsWith(".")) return false;
648
736
  return prefix === "" || entry.name.toLowerCase().startsWith(prefix);
649
737
  }).map((entry) => {
650
- const fullPath = path4.join(dirToScan, entry.name);
738
+ const fullPath = path5.join(dirToScan, entry.name);
651
739
  const displayPath = fullPath.startsWith(process.env.HOME || "") ? fullPath.replace(process.env.HOME || "", "~") : fullPath;
652
740
  return displayPath + "/";
653
741
  }).sort();
@@ -693,7 +781,7 @@ __export(tui_utils_exports, {
693
781
  });
694
782
  import { select, note, isCancel } from "@clack/prompts";
695
783
  import pc2 from "picocolors";
696
- import * as path5 from "path";
784
+ import * as path6 from "path";
697
785
  async function resolveGlobalPath() {
698
786
  const prefs = loadUserPreferences();
699
787
  const defaultPath = prefs.defaultGlobalPath || getDefaultRRCEHome2();
@@ -732,7 +820,7 @@ Please choose a custom path instead.`,
732
820
  }
733
821
  return defaultPath;
734
822
  }
735
- const suggestedPath = path5.join(process.env.HOME || "~", ".rrce-workflow");
823
+ const suggestedPath = path6.join(process.env.HOME || "~", ".rrce-workflow");
736
824
  const customPath = await directoryPrompt({
737
825
  message: "Enter custom global path (Tab to autocomplete):",
738
826
  defaultValue: suggestedPath,
@@ -751,7 +839,7 @@ Please choose a custom path instead.`,
751
839
  }
752
840
  let expandedPath = customPath;
753
841
  if (!expandedPath.endsWith(".rrce-workflow")) {
754
- expandedPath = path5.join(expandedPath, ".rrce-workflow");
842
+ expandedPath = path6.join(expandedPath, ".rrce-workflow");
755
843
  }
756
844
  saveUserPreferences({ defaultGlobalPath: expandedPath, useCustomGlobalPath: true });
757
845
  return expandedPath;
@@ -766,8 +854,8 @@ var init_tui_utils = __esm({
766
854
  });
767
855
 
768
856
  // src/mcp/install.ts
769
- import * as fs5 from "fs";
770
- import * as path6 from "path";
857
+ import * as fs6 from "fs";
858
+ import * as path7 from "path";
771
859
  import * as os from "os";
772
860
  function checkInstallStatus(workspacePath) {
773
861
  return {
@@ -779,46 +867,46 @@ function checkInstallStatus(workspacePath) {
779
867
  };
780
868
  }
781
869
  function checkAntigravityConfig() {
782
- if (!fs5.existsSync(ANTIGRAVITY_CONFIG)) return false;
870
+ if (!fs6.existsSync(ANTIGRAVITY_CONFIG)) return false;
783
871
  try {
784
- const content = JSON.parse(fs5.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
872
+ const content = JSON.parse(fs6.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
785
873
  return !!content.mcpServers?.["rrce"];
786
874
  } catch {
787
875
  return false;
788
876
  }
789
877
  }
790
878
  function checkClaudeConfig() {
791
- if (!fs5.existsSync(CLAUDE_CONFIG)) return false;
879
+ if (!fs6.existsSync(CLAUDE_CONFIG)) return false;
792
880
  try {
793
- const content = JSON.parse(fs5.readFileSync(CLAUDE_CONFIG, "utf-8"));
881
+ const content = JSON.parse(fs6.readFileSync(CLAUDE_CONFIG, "utf-8"));
794
882
  return !!content.mcpServers?.["rrce"];
795
883
  } catch {
796
884
  return false;
797
885
  }
798
886
  }
799
887
  function checkVSCodeGlobalConfig() {
800
- if (!fs5.existsSync(VSCODE_GLOBAL_CONFIG)) return false;
888
+ if (!fs6.existsSync(VSCODE_GLOBAL_CONFIG)) return false;
801
889
  try {
802
- const content = JSON.parse(fs5.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
890
+ const content = JSON.parse(fs6.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
803
891
  return !!content["mcp.servers"]?.["rrce"];
804
892
  } catch {
805
893
  return false;
806
894
  }
807
895
  }
808
896
  function checkVSCodeWorkspaceConfig(workspacePath) {
809
- const configPath = path6.join(workspacePath, ".vscode", "mcp.json");
810
- if (!fs5.existsSync(configPath)) return false;
897
+ const configPath = path7.join(workspacePath, ".vscode", "mcp.json");
898
+ if (!fs6.existsSync(configPath)) return false;
811
899
  try {
812
- const content = JSON.parse(fs5.readFileSync(configPath, "utf-8"));
900
+ const content = JSON.parse(fs6.readFileSync(configPath, "utf-8"));
813
901
  return !!content.servers?.["rrce"];
814
902
  } catch {
815
903
  return false;
816
904
  }
817
905
  }
818
906
  function checkOpenCodeConfig() {
819
- if (!fs5.existsSync(OPENCODE_CONFIG)) return false;
907
+ if (!fs6.existsSync(OPENCODE_CONFIG)) return false;
820
908
  try {
821
- const content = JSON.parse(fs5.readFileSync(OPENCODE_CONFIG, "utf-8"));
909
+ const content = JSON.parse(fs6.readFileSync(OPENCODE_CONFIG, "utf-8"));
822
910
  return !!content.mcp?.["rrce"];
823
911
  } catch {
824
912
  return false;
@@ -845,14 +933,14 @@ function installToConfig(target, workspacePath) {
845
933
  }
846
934
  }
847
935
  function installToAntigravity() {
848
- const dir = path6.dirname(ANTIGRAVITY_CONFIG);
849
- if (!fs5.existsSync(dir)) {
850
- fs5.mkdirSync(dir, { recursive: true });
936
+ const dir = path7.dirname(ANTIGRAVITY_CONFIG);
937
+ if (!fs6.existsSync(dir)) {
938
+ fs6.mkdirSync(dir, { recursive: true });
851
939
  }
852
940
  let config = { mcpServers: {} };
853
- if (fs5.existsSync(ANTIGRAVITY_CONFIG)) {
941
+ if (fs6.existsSync(ANTIGRAVITY_CONFIG)) {
854
942
  try {
855
- config = JSON.parse(fs5.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
943
+ config = JSON.parse(fs6.readFileSync(ANTIGRAVITY_CONFIG, "utf-8"));
856
944
  } catch {
857
945
  }
858
946
  }
@@ -862,21 +950,21 @@ function installToAntigravity() {
862
950
  args: ["-y", "rrce-workflow", "mcp", "start"]
863
951
  };
864
952
  try {
865
- fs5.writeFileSync(ANTIGRAVITY_CONFIG, JSON.stringify(config, null, 2));
953
+ fs6.writeFileSync(ANTIGRAVITY_CONFIG, JSON.stringify(config, null, 2));
866
954
  return true;
867
955
  } catch {
868
956
  return false;
869
957
  }
870
958
  }
871
959
  function installToClaude() {
872
- const dir = path6.dirname(CLAUDE_CONFIG);
873
- if (!fs5.existsSync(dir)) {
874
- fs5.mkdirSync(dir, { recursive: true });
960
+ const dir = path7.dirname(CLAUDE_CONFIG);
961
+ if (!fs6.existsSync(dir)) {
962
+ fs6.mkdirSync(dir, { recursive: true });
875
963
  }
876
964
  let config = { mcpServers: {} };
877
- if (fs5.existsSync(CLAUDE_CONFIG)) {
965
+ if (fs6.existsSync(CLAUDE_CONFIG)) {
878
966
  try {
879
- config = JSON.parse(fs5.readFileSync(CLAUDE_CONFIG, "utf-8"));
967
+ config = JSON.parse(fs6.readFileSync(CLAUDE_CONFIG, "utf-8"));
880
968
  } catch {
881
969
  }
882
970
  }
@@ -886,21 +974,21 @@ function installToClaude() {
886
974
  args: ["-y", "rrce-workflow", "mcp", "start"]
887
975
  };
888
976
  try {
889
- fs5.writeFileSync(CLAUDE_CONFIG, JSON.stringify(config, null, 2));
977
+ fs6.writeFileSync(CLAUDE_CONFIG, JSON.stringify(config, null, 2));
890
978
  return true;
891
979
  } catch {
892
980
  return false;
893
981
  }
894
982
  }
895
983
  function installToVSCodeGlobal() {
896
- const dir = path6.dirname(VSCODE_GLOBAL_CONFIG);
897
- if (!fs5.existsSync(dir)) {
898
- fs5.mkdirSync(dir, { recursive: true });
984
+ const dir = path7.dirname(VSCODE_GLOBAL_CONFIG);
985
+ if (!fs6.existsSync(dir)) {
986
+ fs6.mkdirSync(dir, { recursive: true });
899
987
  }
900
988
  let settings = {};
901
- if (fs5.existsSync(VSCODE_GLOBAL_CONFIG)) {
989
+ if (fs6.existsSync(VSCODE_GLOBAL_CONFIG)) {
902
990
  try {
903
- settings = JSON.parse(fs5.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
991
+ settings = JSON.parse(fs6.readFileSync(VSCODE_GLOBAL_CONFIG, "utf-8"));
904
992
  } catch {
905
993
  }
906
994
  }
@@ -910,22 +998,22 @@ function installToVSCodeGlobal() {
910
998
  args: ["-y", "rrce-workflow", "mcp", "start"]
911
999
  };
912
1000
  try {
913
- fs5.writeFileSync(VSCODE_GLOBAL_CONFIG, JSON.stringify(settings, null, 2));
1001
+ fs6.writeFileSync(VSCODE_GLOBAL_CONFIG, JSON.stringify(settings, null, 2));
914
1002
  return true;
915
1003
  } catch {
916
1004
  return false;
917
1005
  }
918
1006
  }
919
1007
  function installToVSCodeWorkspace(workspacePath) {
920
- const vscodeDir = path6.join(workspacePath, ".vscode");
921
- const configPath = path6.join(vscodeDir, "mcp.json");
922
- if (!fs5.existsSync(vscodeDir)) {
923
- fs5.mkdirSync(vscodeDir, { recursive: true });
1008
+ const vscodeDir = path7.join(workspacePath, ".vscode");
1009
+ const configPath = path7.join(vscodeDir, "mcp.json");
1010
+ if (!fs6.existsSync(vscodeDir)) {
1011
+ fs6.mkdirSync(vscodeDir, { recursive: true });
924
1012
  }
925
1013
  let config = { servers: {} };
926
- if (fs5.existsSync(configPath)) {
1014
+ if (fs6.existsSync(configPath)) {
927
1015
  try {
928
- config = JSON.parse(fs5.readFileSync(configPath, "utf-8"));
1016
+ config = JSON.parse(fs6.readFileSync(configPath, "utf-8"));
929
1017
  } catch {
930
1018
  }
931
1019
  }
@@ -935,23 +1023,23 @@ function installToVSCodeWorkspace(workspacePath) {
935
1023
  args: ["-y", "rrce-workflow", "mcp", "start"]
936
1024
  };
937
1025
  try {
938
- fs5.writeFileSync(configPath, JSON.stringify(config, null, 2));
1026
+ fs6.writeFileSync(configPath, JSON.stringify(config, null, 2));
939
1027
  return true;
940
1028
  } catch {
941
1029
  return false;
942
1030
  }
943
1031
  }
944
1032
  function installToOpenCode() {
945
- const dir = path6.dirname(OPENCODE_CONFIG);
946
- if (!fs5.existsSync(dir)) {
947
- fs5.mkdirSync(dir, { recursive: true });
1033
+ const dir = path7.dirname(OPENCODE_CONFIG);
1034
+ if (!fs6.existsSync(dir)) {
1035
+ fs6.mkdirSync(dir, { recursive: true });
948
1036
  }
949
1037
  let config = {
950
1038
  $schema: "https://opencode.ai/config.json"
951
1039
  };
952
- if (fs5.existsSync(OPENCODE_CONFIG)) {
1040
+ if (fs6.existsSync(OPENCODE_CONFIG)) {
953
1041
  try {
954
- config = JSON.parse(fs5.readFileSync(OPENCODE_CONFIG, "utf-8"));
1042
+ config = JSON.parse(fs6.readFileSync(OPENCODE_CONFIG, "utf-8"));
955
1043
  } catch (error) {
956
1044
  console.error("Warning: Could not parse existing OpenCode config, creating fresh config");
957
1045
  }
@@ -963,7 +1051,7 @@ function installToOpenCode() {
963
1051
  enabled: true
964
1052
  };
965
1053
  try {
966
- fs5.writeFileSync(OPENCODE_CONFIG, JSON.stringify(config, null, 2) + "\n");
1054
+ fs6.writeFileSync(OPENCODE_CONFIG, JSON.stringify(config, null, 2) + "\n");
967
1055
  return true;
968
1056
  } catch (error) {
969
1057
  console.error("Failed to write OpenCode config:", error instanceof Error ? error.message : String(error));
@@ -987,115 +1075,27 @@ function getTargetLabel(target) {
987
1075
  }
988
1076
  }
989
1077
  function isOpenCodeInstalled() {
990
- const configDir = path6.join(os.homedir(), ".config/opencode");
991
- const configFile = path6.join(configDir, "opencode.json");
992
- return fs5.existsSync(configDir) || fs5.existsSync(configFile);
1078
+ const configDir = path7.join(os.homedir(), ".config/opencode");
1079
+ const configFile = path7.join(configDir, "opencode.json");
1080
+ return fs6.existsSync(configDir) || fs6.existsSync(configFile);
993
1081
  }
994
1082
  function isAntigravityInstalled() {
995
- const configDir = path6.join(os.homedir(), ".gemini/antigravity");
996
- return fs5.existsSync(configDir);
1083
+ const configDir = path7.join(os.homedir(), ".gemini/antigravity");
1084
+ return fs6.existsSync(configDir);
997
1085
  }
998
1086
  function isVSCodeInstalled() {
999
- const configDir = path6.join(os.homedir(), ".config/Code/User");
1000
- return fs5.existsSync(configDir);
1087
+ const configDir = path7.join(os.homedir(), ".config/Code/User");
1088
+ return fs6.existsSync(configDir);
1001
1089
  }
1002
1090
  var ANTIGRAVITY_CONFIG, CLAUDE_CONFIG, VSCODE_GLOBAL_CONFIG, OPENCODE_CONFIG_DIR, OPENCODE_CONFIG;
1003
1091
  var init_install = __esm({
1004
1092
  "src/mcp/install.ts"() {
1005
1093
  "use strict";
1006
- ANTIGRAVITY_CONFIG = path6.join(os.homedir(), ".gemini/antigravity/mcp_config.json");
1007
- CLAUDE_CONFIG = path6.join(os.homedir(), ".config/claude/claude_desktop_config.json");
1008
- VSCODE_GLOBAL_CONFIG = path6.join(os.homedir(), ".config/Code/User/settings.json");
1009
- OPENCODE_CONFIG_DIR = path6.join(os.homedir(), ".config/opencode");
1010
- OPENCODE_CONFIG = path6.join(OPENCODE_CONFIG_DIR, "opencode.json");
1011
- }
1012
- });
1013
-
1014
- // src/types/prompt.ts
1015
- import { z } from "zod";
1016
- var PromptArgSchema, AutoIdentitySchema, PromptFrontmatterSchema;
1017
- var init_prompt = __esm({
1018
- "src/types/prompt.ts"() {
1019
- "use strict";
1020
- PromptArgSchema = z.object({
1021
- name: z.string(),
1022
- default: z.string().optional(),
1023
- prompt: z.string().optional()
1024
- });
1025
- AutoIdentitySchema = z.object({
1026
- user: z.string(),
1027
- model: z.string()
1028
- });
1029
- PromptFrontmatterSchema = z.object({
1030
- name: z.string(),
1031
- description: z.string(),
1032
- "argument-hint": z.union([z.string(), z.array(z.string())]).optional(),
1033
- tools: z.array(z.string()).optional(),
1034
- mode: z.enum(["primary", "subagent"]).optional(),
1035
- "required-args": z.array(PromptArgSchema).optional(),
1036
- "optional-args": z.array(PromptArgSchema).optional(),
1037
- "auto-identity": AutoIdentitySchema.optional()
1038
- });
1039
- }
1040
- });
1041
-
1042
- // src/lib/prompts.ts
1043
- import * as fs6 from "fs";
1044
- import * as path7 from "path";
1045
- import { fileURLToPath } from "url";
1046
- import matter from "gray-matter";
1047
- function parsePromptFile(filePath) {
1048
- try {
1049
- const fileContent = fs6.readFileSync(filePath, "utf-8");
1050
- const { data, content } = matter(fileContent);
1051
- const parsed = PromptFrontmatterSchema.safeParse(data);
1052
- if (!parsed.success) {
1053
- console.error(`Failed to parse frontmatter in ${filePath}:`, parsed.error);
1054
- return null;
1055
- }
1056
- return {
1057
- frontmatter: parsed.data,
1058
- content: content.trim(),
1059
- filePath
1060
- };
1061
- } catch (error) {
1062
- console.error(`Error reading prompt file ${filePath}:`, error);
1063
- return null;
1064
- }
1065
- }
1066
- function loadPromptsFromDir(dirPath) {
1067
- if (!fs6.existsSync(dirPath)) {
1068
- return [];
1069
- }
1070
- const files = fs6.readdirSync(dirPath).filter((f) => f.endsWith(".md"));
1071
- const prompts = [];
1072
- for (const file of files) {
1073
- const prompt = parsePromptFile(path7.join(dirPath, file));
1074
- if (prompt) {
1075
- prompts.push(prompt);
1076
- }
1077
- }
1078
- return prompts;
1079
- }
1080
- function getAgentCoreDir() {
1081
- if (__dirname.includes("/src/") || __dirname.includes("\\src\\")) {
1082
- if (fs6.existsSync(path7.join(process.cwd(), "agent-core"))) {
1083
- return path7.join(process.cwd(), "agent-core");
1084
- }
1085
- return path7.resolve(__dirname, "../..", "agent-core");
1086
- }
1087
- return path7.join(__dirname, "..", "agent-core");
1088
- }
1089
- function getAgentCorePromptsDir() {
1090
- return path7.join(getAgentCoreDir(), "prompts");
1091
- }
1092
- var __filename, __dirname;
1093
- var init_prompts = __esm({
1094
- "src/lib/prompts.ts"() {
1095
- "use strict";
1096
- init_prompt();
1097
- __filename = fileURLToPath(import.meta.url);
1098
- __dirname = path7.dirname(__filename);
1094
+ ANTIGRAVITY_CONFIG = path7.join(os.homedir(), ".gemini/antigravity/mcp_config.json");
1095
+ CLAUDE_CONFIG = path7.join(os.homedir(), ".config/claude/claude_desktop_config.json");
1096
+ VSCODE_GLOBAL_CONFIG = path7.join(os.homedir(), ".config/Code/User/settings.json");
1097
+ OPENCODE_CONFIG_DIR = path7.join(os.homedir(), ".config/opencode");
1098
+ OPENCODE_CONFIG = path7.join(OPENCODE_CONFIG_DIR, "opencode.json");
1099
1099
  }
1100
1100
  });
1101
1101
 
@@ -4015,7 +4015,7 @@ Hidden projects: ${projects.length - exposedCount}`,
4015
4015
  async function handleConfigureGlobalPath() {
4016
4016
  const { resolveGlobalPath: resolveGlobalPath2 } = await Promise.resolve().then(() => (init_tui_utils(), tui_utils_exports));
4017
4017
  const fs26 = await import("fs");
4018
- const path24 = await import("path");
4018
+ const path25 = await import("path");
4019
4019
  note3(
4020
4020
  `MCP Hub requires a ${pc5.bold("global storage path")} to store its configuration
4021
4021
  and coordinate across projects.
@@ -4038,7 +4038,7 @@ locally in each project. MCP needs a central location.`,
4038
4038
  `${pc5.green("\u2713")} Global path configured: ${pc5.cyan(resolvedPath)}
4039
4039
 
4040
4040
  MCP config will be stored at:
4041
- ${path24.join(resolvedPath, "mcp.yaml")}`,
4041
+ ${path25.join(resolvedPath, "mcp.yaml")}`,
4042
4042
  "Configuration Saved"
4043
4043
  );
4044
4044
  return true;
@@ -5510,6 +5510,7 @@ var init_mcp = __esm({
5510
5510
  // src/commands/wizard/update-flow.ts
5511
5511
  var update_flow_exports = {};
5512
5512
  __export(update_flow_exports, {
5513
+ runSilentUpdate: () => runSilentUpdate,
5513
5514
  runUpdateFlow: () => runUpdateFlow
5514
5515
  });
5515
5516
  import { confirm as confirm5, spinner as spinner2, note as note6, outro as outro2, cancel as cancel2, isCancel as isCancel7 } from "@clack/prompts";
@@ -5540,6 +5541,126 @@ function getPackageVersion2() {
5540
5541
  }
5541
5542
  return "0.0.0";
5542
5543
  }
5544
+ async function performUpdate(workspacePath, workspaceName, currentStorageMode, options = {}) {
5545
+ const agentCoreDir = getAgentCoreDir();
5546
+ const prompts = loadPromptsFromDir(getAgentCorePromptsDir());
5547
+ const runningVersion = getPackageVersion2();
5548
+ const mode = currentStorageMode || "global";
5549
+ const customGlobalPath = getEffectiveRRCEHome(workspacePath);
5550
+ const dataPaths = resolveAllDataPathsWithCustomGlobal(mode, workspaceName, workspacePath, customGlobalPath);
5551
+ const configFilePath = getConfigPath(workspacePath);
5552
+ let currentSyncedVersion;
5553
+ if (fs21.existsSync(configFilePath)) {
5554
+ try {
5555
+ const content = fs21.readFileSync(configFilePath, "utf-8");
5556
+ const config = parse(content);
5557
+ currentSyncedVersion = config.last_synced_version;
5558
+ } catch (e) {
5559
+ }
5560
+ }
5561
+ const driftReport = DriftService.checkDrift(dataPaths[0], currentSyncedVersion, runningVersion);
5562
+ const ideTargets = [];
5563
+ if (fs21.existsSync(configFilePath)) {
5564
+ const configContent = fs21.readFileSync(configFilePath, "utf-8");
5565
+ if (configContent.includes("opencode: true")) ideTargets.push("OpenCode agents");
5566
+ if (configContent.includes("copilot: true")) ideTargets.push("GitHub Copilot");
5567
+ if (configContent.includes("antigravity: true")) ideTargets.push("Antigravity");
5568
+ }
5569
+ for (const dataPath of dataPaths) {
5570
+ const dirs = ["templates", "prompts", "docs"];
5571
+ const updatedFiles = [];
5572
+ for (const dir of dirs) {
5573
+ const srcDir = path22.join(agentCoreDir, dir);
5574
+ if (!fs21.existsSync(srcDir)) continue;
5575
+ const syncFiles = (src, rel) => {
5576
+ const entries = fs21.readdirSync(src, { withFileTypes: true });
5577
+ for (const entry of entries) {
5578
+ const entrySrc = path22.join(src, entry.name);
5579
+ const entryRel = path22.join(rel, entry.name);
5580
+ const entryDest = path22.join(dataPath, entryRel);
5581
+ if (entry.isDirectory()) {
5582
+ ensureDir(entryDest);
5583
+ syncFiles(entrySrc, entryRel);
5584
+ } else {
5585
+ if (driftReport.modifiedFiles.includes(entryRel)) {
5586
+ backupFile(entryDest);
5587
+ }
5588
+ fs21.copyFileSync(entrySrc, entryDest);
5589
+ updatedFiles.push(entryRel);
5590
+ }
5591
+ }
5592
+ };
5593
+ syncFiles(srcDir, dir);
5594
+ }
5595
+ const manifest = DriftService.generateManifest(dataPath, updatedFiles);
5596
+ DriftService.saveManifest(dataPath, manifest);
5597
+ }
5598
+ const rrceHome = customGlobalPath || getDefaultRRCEHome2();
5599
+ ensureDir(path22.join(rrceHome, "templates"));
5600
+ ensureDir(path22.join(rrceHome, "docs"));
5601
+ copyDirRecursive(path22.join(agentCoreDir, "templates"), path22.join(rrceHome, "templates"));
5602
+ copyDirRecursive(path22.join(agentCoreDir, "docs"), path22.join(rrceHome, "docs"));
5603
+ if (fs21.existsSync(configFilePath)) {
5604
+ const configContent = fs21.readFileSync(configFilePath, "utf-8");
5605
+ if (configContent.includes("copilot: true")) {
5606
+ const copilotPath = getAgentPromptPath(workspacePath, "copilot");
5607
+ ensureDir(copilotPath);
5608
+ clearDirectory(copilotPath);
5609
+ copyPromptsToDir(prompts, copilotPath, ".agent.md");
5610
+ }
5611
+ if (configContent.includes("antigravity: true")) {
5612
+ const antigravityPath = getAgentPromptPath(workspacePath, "antigravity");
5613
+ ensureDir(antigravityPath);
5614
+ clearDirectory(antigravityPath);
5615
+ copyPromptsToDir(prompts, antigravityPath, ".md");
5616
+ }
5617
+ if (configContent.includes("opencode: true")) {
5618
+ const primaryDataPath = dataPaths[0];
5619
+ if (primaryDataPath) {
5620
+ surgicalUpdateOpenCodeAgents(prompts, mode, primaryDataPath);
5621
+ }
5622
+ }
5623
+ try {
5624
+ const yaml = parse(configContent);
5625
+ yaml.last_synced_version = runningVersion;
5626
+ fs21.writeFileSync(configFilePath, stringify2(yaml));
5627
+ } catch (e) {
5628
+ console.error("Failed to update config.yaml version:", e);
5629
+ }
5630
+ }
5631
+ const mcpPath = path22.join(rrceHome, "mcp.yaml");
5632
+ if (fs21.existsSync(mcpPath)) {
5633
+ try {
5634
+ const content = fs21.readFileSync(mcpPath, "utf-8");
5635
+ const yaml = parse(content);
5636
+ if (yaml.projects) {
5637
+ const project = yaml.projects.find((p) => p.name === workspaceName);
5638
+ if (project) {
5639
+ project.last_synced_version = runningVersion;
5640
+ fs21.writeFileSync(mcpPath, stringify2(yaml));
5641
+ }
5642
+ }
5643
+ } catch (e) {
5644
+ console.error("Failed to update mcp.yaml version:", e);
5645
+ }
5646
+ }
5647
+ return {
5648
+ success: true,
5649
+ ideTargets,
5650
+ modifiedFiles: driftReport.modifiedFiles
5651
+ };
5652
+ }
5653
+ async function runSilentUpdate(workspacePath, workspaceName, currentStorageMode) {
5654
+ const s = spinner2();
5655
+ s.start("Applying updates...");
5656
+ try {
5657
+ await performUpdate(workspacePath, workspaceName, currentStorageMode, { silent: true });
5658
+ s.stop("Updates applied");
5659
+ } catch (error) {
5660
+ s.stop("Update failed");
5661
+ throw error;
5662
+ }
5663
+ }
5543
5664
  async function runUpdateFlow(workspacePath, workspaceName, currentStorageMode) {
5544
5665
  const s = spinner2();
5545
5666
  s.start("Checking for updates");
@@ -5732,9 +5853,11 @@ var init_update_flow = __esm({
5732
5853
  });
5733
5854
 
5734
5855
  // src/commands/wizard/index.ts
5735
- import { intro as intro2, select as select5, spinner as spinner7, note as note11, outro as outro7, isCancel as isCancel12 } from "@clack/prompts";
5856
+ import { intro as intro2, select as select5, spinner as spinner7, note as note11, outro as outro7, isCancel as isCancel12, confirm as confirm10 } from "@clack/prompts";
5736
5857
  import pc13 from "picocolors";
5737
5858
  import * as fs25 from "fs";
5859
+ import * as path24 from "path";
5860
+ import { parse as parse2 } from "yaml";
5738
5861
 
5739
5862
  // src/lib/git.ts
5740
5863
  import { execSync } from "child_process";
@@ -5750,6 +5873,7 @@ function getGitUser() {
5750
5873
  // src/commands/wizard/index.ts
5751
5874
  init_paths();
5752
5875
  init_detection_service();
5876
+ init_prompts();
5753
5877
 
5754
5878
  // src/commands/wizard/setup-flow.ts
5755
5879
  import { spinner as spinner3, note as note7, outro as outro3, cancel as cancel3, isCancel as isCancel8, confirm as confirm6, select as select3 } from "@clack/prompts";
@@ -6637,6 +6761,76 @@ Are you sure?`,
6637
6761
  // src/commands/wizard/index.ts
6638
6762
  init_mcp();
6639
6763
  init_config();
6764
+ function getPackageVersion3() {
6765
+ try {
6766
+ const agentCoreDir = getAgentCoreDir();
6767
+ const packageJsonPath = path24.join(path24.dirname(agentCoreDir), "package.json");
6768
+ if (fs25.existsSync(packageJsonPath)) {
6769
+ return JSON.parse(fs25.readFileSync(packageJsonPath, "utf8")).version;
6770
+ }
6771
+ } catch (e) {
6772
+ }
6773
+ return "0.0.0";
6774
+ }
6775
+ function getLastSyncedVersion(workspacePath, workspaceName) {
6776
+ const configFilePath = getConfigPath(workspacePath);
6777
+ if (fs25.existsSync(configFilePath)) {
6778
+ try {
6779
+ const content = fs25.readFileSync(configFilePath, "utf-8");
6780
+ const config = parse2(content);
6781
+ if (config.last_synced_version) {
6782
+ return config.last_synced_version;
6783
+ }
6784
+ } catch (e) {
6785
+ }
6786
+ }
6787
+ const rrceHome = getEffectiveRRCEHome(workspacePath) || getDefaultRRCEHome2();
6788
+ const mcpPath = path24.join(rrceHome, "mcp.yaml");
6789
+ if (fs25.existsSync(mcpPath)) {
6790
+ try {
6791
+ const content = fs25.readFileSync(mcpPath, "utf-8");
6792
+ const config = parse2(content);
6793
+ const project = config.projects?.find((p) => p.name === workspaceName);
6794
+ if (project?.last_synced_version) {
6795
+ return project.last_synced_version;
6796
+ }
6797
+ } catch (e) {
6798
+ }
6799
+ }
6800
+ return void 0;
6801
+ }
6802
+ async function checkAndPromptUpdate(workspacePath, workspaceName, currentStorageMode) {
6803
+ const runningVersion = getPackageVersion3();
6804
+ const lastSyncedVersion = getLastSyncedVersion(workspacePath, workspaceName);
6805
+ if (lastSyncedVersion === runningVersion) {
6806
+ return true;
6807
+ }
6808
+ const versionInfo = lastSyncedVersion ? `${pc13.dim(lastSyncedVersion)} \u2192 ${pc13.green(runningVersion)}` : `${pc13.dim("unknown")} \u2192 ${pc13.green(runningVersion)}`;
6809
+ note11(
6810
+ `${pc13.bold(pc13.cyan("Update available!"))} ${versionInfo}
6811
+
6812
+ New prompts, templates, and agent improvements are ready to install.
6813
+ Your custom knowledge and configuration will be preserved.`,
6814
+ "\u{1F4E6} Version Update"
6815
+ );
6816
+ const shouldUpdate = await confirm10({
6817
+ message: "Apply update now?",
6818
+ initialValue: true
6819
+ });
6820
+ if (isCancel12(shouldUpdate)) {
6821
+ return false;
6822
+ }
6823
+ if (shouldUpdate) {
6824
+ await runSilentUpdate(workspacePath, workspaceName, currentStorageMode);
6825
+ note11(
6826
+ `${pc13.green("\u2713")} Updated to version ${pc13.bold(runningVersion)}
6827
+
6828
+ All agent prompts, templates, and IDE integrations have been synced.`,
6829
+ "Update Complete"
6830
+ );
6831
+ }
6832
+ return true;
6833
+ }
6640
6834
  async function runWizard() {
6641
6835
  intro2(pc13.cyan(pc13.inverse(" RRCE-Workflow Setup ")));
6642
6836
  const s = spinner7();
@@ -6687,24 +6881,22 @@ Workspace: ${pc13.bold(workspaceName)}`,
6687
6881
  const localDataPath = getLocalWorkspacePath(workspacePath);
6688
6882
  const hasLocalData = fs25.existsSync(localDataPath);
6689
6883
  if (isAlreadyConfigured) {
6884
+ const continueToMenu = await checkAndPromptUpdate(workspacePath, workspaceName, currentStorageMode);
6885
+ if (!continueToMenu) {
6886
+ outro7("Exited.");
6887
+ process.exit(0);
6888
+ }
6690
6889
  const menuOptions = [];
6691
6890
  menuOptions.push({
6692
6891
  value: "mcp",
6693
- label: "\u{1F50C} Configure MCP Server",
6694
- hint: "Expose projects to AI assistants (VSCode, Antigravity, Claude)"
6892
+ label: "\u{1F50C} MCP Dashboard",
6893
+ hint: "Manage projects & AI integrations"
6695
6894
  });
6696
- if (detectedProjects.some((p) => p.source === "global")) {
6697
- menuOptions.push({
6698
- value: "delete-global",
6699
- label: "\u{1F5D1}\uFE0F Delete global project(s)",
6700
- hint: "Remove knowledge and configuration"
6701
- });
6702
- }
6703
- if (detectedProjects.length > 0) {
6895
+ if (detectedProjects.some((p) => p.source === "global") || detectedProjects.length > 0) {
6704
6896
  menuOptions.push({
6705
- value: "link",
6706
- label: "\u{1F517} Link other project knowledge",
6707
- hint: `${detectedProjects.length} projects detected (global + sibling)`
6897
+ value: "manage",
6898
+ label: "\u{1F4C1} Manage Projects",
6899
+ hint: "Link, delete, or sync projects"
6708
6900
  });
6709
6901
  }
6710
6902
  if (currentStorageMode === "workspace" && hasLocalData) {
@@ -6714,11 +6906,10 @@ Workspace: ${pc13.bold(workspaceName)}`,
6714
6906
  hint: "Share knowledge with other projects"
6715
6907
  });
6716
6908
  }
6717
- menuOptions.push({ value: "update", label: "\u{1F4E6} Update from package", hint: "Get latest prompts & templates" });
6718
- menuOptions.push({ value: "reconfigure", label: "\u{1F527} Reconfigure project", hint: "Change storage mode, tools, etc." });
6909
+ menuOptions.push({ value: "advanced", label: "\u2699\uFE0F Advanced", hint: "Update, reconfigure, or troubleshoot" });
6719
6910
  menuOptions.push({ value: "exit", label: "\u21A9 Exit" });
6720
6911
  const action = await select5({
6721
- message: "This workspace is already configured. What would you like to do?",
6912
+ message: "What would you like to do?",
6722
6913
  options: menuOptions
6723
6914
  });
6724
6915
  if (isCancel12(action) || action === "exit") {
@@ -6729,23 +6920,62 @@ Workspace: ${pc13.bold(workspaceName)}`,
6729
6920
  await runMCP();
6730
6921
  return;
6731
6922
  }
6732
- if (action === "delete-global") {
6733
- await runDeleteGlobalProjectFlow(detectedProjects);
6734
- return;
6735
- }
6736
- if (action === "link") {
6737
- await runLinkProjectsFlow(workspacePath, workspaceName);
6738
- return;
6923
+ if (action === "manage") {
6924
+ const manageOptions = [];
6925
+ if (detectedProjects.some((p) => p.source === "global")) {
6926
+ manageOptions.push({
6927
+ value: "delete-global",
6928
+ label: "\u{1F5D1}\uFE0F Delete global project(s)",
6929
+ hint: "Remove knowledge and configuration"
6930
+ });
6931
+ }
6932
+ if (detectedProjects.length > 0) {
6933
+ manageOptions.push({
6934
+ value: "link",
6935
+ label: "\u{1F517} Link other project knowledge",
6936
+ hint: `${detectedProjects.length} projects detected`
6937
+ });
6938
+ }
6939
+ manageOptions.push({ value: "back", label: "\u21A9 Back to main menu" });
6940
+ const manageAction = await select5({
6941
+ message: "Project Management",
6942
+ options: manageOptions
6943
+ });
6944
+ if (isCancel12(manageAction) || manageAction === "back") {
6945
+ return runWizard();
6946
+ }
6947
+ if (manageAction === "delete-global") {
6948
+ await runDeleteGlobalProjectFlow(detectedProjects);
6949
+ return;
6950
+ }
6951
+ if (manageAction === "link") {
6952
+ await runLinkProjectsFlow(workspacePath, workspaceName);
6953
+ return;
6954
+ }
6739
6955
  }
6740
6956
  if (action === "sync-global") {
6741
6957
  await runSyncToGlobalFlow(workspacePath, workspaceName);
6742
6958
  return;
6743
6959
  }
6744
- if (action === "update") {
6745
- await runUpdateFlow(workspacePath, workspaceName, currentStorageMode);
6746
- return;
6747
- }
6748
- if (action === "reconfigure") {
6960
+ if (action === "advanced") {
6961
+ const advancedOptions = [
6962
+ { value: "update", label: "\u{1F4E6} Manual Update", hint: "Force update from package" },
6963
+ { value: "reconfigure", label: "\u{1F527} Reconfigure Project", hint: "Change storage mode, tools, etc." },
6964
+ { value: "back", label: "\u21A9 Back to main menu" }
6965
+ ];
6966
+ const advancedAction = await select5({
6967
+ message: "Advanced Options",
6968
+ options: advancedOptions
6969
+ });
6970
+ if (isCancel12(advancedAction) || advancedAction === "back") {
6971
+ return runWizard();
6972
+ }
6973
+ if (advancedAction === "update") {
6974
+ await runUpdateFlow(workspacePath, workspaceName, currentStorageMode);
6975
+ return;
6976
+ }
6977
+ if (advancedAction === "reconfigure") {
6978
+ }
6749
6979
  }
6750
6980
  }
6751
6981
  await runSetupFlow(workspacePath, workspaceName, detectedProjects);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rrce-workflow",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "RRCE-Workflow TUI - Agentic code workflow generator for AI-assisted development",
5
5
  "author": "RRCE Team",
6
6
  "license": "MIT",