rrce-workflow 0.2.79 → 0.2.80
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/index.js +18 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1260,7 +1260,7 @@ function copyPromptsToDir(prompts, targetDir, extension) {
|
|
|
1260
1260
|
fs7.writeFileSync(targetPath, content);
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
function convertToOpenCodeAgent(prompt) {
|
|
1263
|
+
function convertToOpenCodeAgent(prompt, useFileReference = false, promptFilePath) {
|
|
1264
1264
|
const { frontmatter, content } = prompt;
|
|
1265
1265
|
const tools = {};
|
|
1266
1266
|
const hostTools = ["read", "write", "edit", "bash", "grep", "glob", "webfetch", "terminalLastCommand"];
|
|
@@ -1277,7 +1277,7 @@ function convertToOpenCodeAgent(prompt) {
|
|
|
1277
1277
|
return {
|
|
1278
1278
|
description: frontmatter.description,
|
|
1279
1279
|
mode: "primary",
|
|
1280
|
-
prompt: content,
|
|
1280
|
+
prompt: useFileReference && promptFilePath ? `{file:${promptFilePath}}` : content,
|
|
1281
1281
|
tools
|
|
1282
1282
|
};
|
|
1283
1283
|
}
|
|
@@ -1694,6 +1694,8 @@ async function installAgentPrompts(config, workspacePath, dataPaths) {
|
|
|
1694
1694
|
if (primaryDataPath) {
|
|
1695
1695
|
if (config.storageMode === "global") {
|
|
1696
1696
|
try {
|
|
1697
|
+
const promptsDir = path12.join(path12.dirname(OPENCODE_CONFIG), "prompts");
|
|
1698
|
+
ensureDir(promptsDir);
|
|
1697
1699
|
let opencodeConfig = { $schema: "https://opencode.ai/config.json" };
|
|
1698
1700
|
if (fs10.existsSync(OPENCODE_CONFIG)) {
|
|
1699
1701
|
opencodeConfig = JSON.parse(fs10.readFileSync(OPENCODE_CONFIG, "utf-8"));
|
|
@@ -1701,7 +1703,10 @@ async function installAgentPrompts(config, workspacePath, dataPaths) {
|
|
|
1701
1703
|
if (!opencodeConfig.agent) opencodeConfig.agent = {};
|
|
1702
1704
|
for (const prompt of prompts) {
|
|
1703
1705
|
const baseName = path12.basename(prompt.filePath, ".md");
|
|
1704
|
-
const
|
|
1706
|
+
const promptFileName = `rrce-${baseName}.md`;
|
|
1707
|
+
const promptFilePath = path12.join(promptsDir, promptFileName);
|
|
1708
|
+
fs10.writeFileSync(promptFilePath, prompt.content);
|
|
1709
|
+
const agentConfig = convertToOpenCodeAgent(prompt, true, `./prompts/${promptFileName}`);
|
|
1705
1710
|
opencodeConfig.agent[baseName] = agentConfig;
|
|
1706
1711
|
}
|
|
1707
1712
|
fs10.writeFileSync(OPENCODE_CONFIG, JSON.stringify(opencodeConfig, null, 2) + "\n");
|
|
@@ -5013,6 +5018,8 @@ ${dataPaths.map((p) => ` \u2022 ${p}`).join("\n")}`,
|
|
|
5013
5018
|
function updateOpenCodeAgents(prompts, mode, primaryDataPath) {
|
|
5014
5019
|
if (mode === "global") {
|
|
5015
5020
|
try {
|
|
5021
|
+
const promptsDir = path19.join(path19.dirname(OPENCODE_CONFIG), "prompts");
|
|
5022
|
+
ensureDir(promptsDir);
|
|
5016
5023
|
let opencodeConfig = { $schema: "https://opencode.ai/config.json" };
|
|
5017
5024
|
if (fs18.existsSync(OPENCODE_CONFIG)) {
|
|
5018
5025
|
opencodeConfig = JSON.parse(fs18.readFileSync(OPENCODE_CONFIG, "utf-8"));
|
|
@@ -5026,11 +5033,18 @@ function updateOpenCodeAgents(prompts, mode, primaryDataPath) {
|
|
|
5026
5033
|
const stillExists = currentAgentNames.includes(existingName);
|
|
5027
5034
|
if (isRrceAgent && !stillExists) {
|
|
5028
5035
|
delete opencodeConfig.agent[existingName];
|
|
5036
|
+
const oldPromptFile = path19.join(promptsDir, `rrce-${existingName}.md`);
|
|
5037
|
+
if (fs18.existsSync(oldPromptFile)) {
|
|
5038
|
+
fs18.unlinkSync(oldPromptFile);
|
|
5039
|
+
}
|
|
5029
5040
|
}
|
|
5030
5041
|
}
|
|
5031
5042
|
for (const prompt of prompts) {
|
|
5032
5043
|
const baseName = path19.basename(prompt.filePath, ".md");
|
|
5033
|
-
const
|
|
5044
|
+
const promptFileName = `rrce-${baseName}.md`;
|
|
5045
|
+
const promptFilePath = path19.join(promptsDir, promptFileName);
|
|
5046
|
+
fs18.writeFileSync(promptFilePath, prompt.content);
|
|
5047
|
+
const agentConfig = convertToOpenCodeAgent(prompt, true, `./prompts/${promptFileName}`);
|
|
5034
5048
|
opencodeConfig.agent[baseName] = agentConfig;
|
|
5035
5049
|
}
|
|
5036
5050
|
fs18.writeFileSync(OPENCODE_CONFIG, JSON.stringify(opencodeConfig, null, 2) + "\n");
|