jorgex-stack 1.0.4 → 1.0.5

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/cli.js CHANGED
@@ -1246,12 +1246,20 @@ function planCommands(adapter, ctx) {
1246
1246
  const { commandsDir } = adapter.paths(ctx.configDir);
1247
1247
  const source = path15.join(ctx.stackDir, "commands");
1248
1248
  if (!fs9.existsSync(source)) return [];
1249
- return fs9.readdirSync(source).filter((f) => f.endsWith(".md")).map((f) => {
1250
- const raw = fs9.readFileSync(path15.join(source, f), "utf8").replace(/\r\n/g, "\n");
1251
- const rendered = adapter.renderCommand(f, raw);
1249
+ const commandFiles = [
1250
+ ...listMarkdownFiles(source),
1251
+ ...listMarkdownFiles(path15.join(source, adapter.id))
1252
+ ];
1253
+ return commandFiles.map(({ file, fullPath }) => {
1254
+ const raw = fs9.readFileSync(fullPath, "utf8").replace(/\r\n/g, "\n");
1255
+ const rendered = adapter.renderCommand(file, raw);
1252
1256
  return { kind: "write", target: path15.join(commandsDir, rendered.file), content: rendered.content };
1253
1257
  });
1254
1258
  }
1259
+ function listMarkdownFiles(dir) {
1260
+ if (!fs9.existsSync(dir)) return [];
1261
+ return fs9.readdirSync(dir, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => ({ file: entry.name, fullPath: path15.join(dir, entry.name) }));
1262
+ }
1255
1263
 
1256
1264
  // src/components/hooks.ts
1257
1265
  function planHooks(adapter, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jorgex-stack",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Harness multi-agente portable: instala la config JorgeX (agentes, skills, hooks, Engram, MCPs) en Claude Code, Codex CLI y OpenCode",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Goal Mode — manage persistent long-running objectives
3
+ ---
4
+
5
+ The Goal Mode plugin should handle `/goal $ARGUMENTS` before this prompt runs.
6
+
7
+ If you are seeing this message as a normal assistant prompt, report that Goal Mode did not intercept the slash command. Do not start work, edit files, run tools, create branches, open PRs, or change repository state.
@@ -50,7 +50,7 @@ export function createOpenCodeGoalHooks(deps: OpenCodeGoalHooksDeps): OpenCodeGo
50
50
  if (command !== "goal") return;
51
51
 
52
52
  const response = commands.handleGoalCommand(extractCommandArguments(input));
53
- appendHookText(input, output, response.message);
53
+ replaceGoalCommandPrompt(input, output, response.message);
54
54
  },
55
55
 
56
56
  "experimental.chat.system.transform": async (_input, output) => {
@@ -169,33 +169,51 @@ function extractCommandArguments(input: unknown): string {
169
169
  return typeof nested === "string" ? nested : "";
170
170
  }
171
171
 
172
- function appendHookText(input: unknown, output: HookOutput, text: string): void {
172
+ function replaceGoalCommandPrompt(input: unknown, output: HookOutput, text: string): void {
173
+ const prompt = renderGoalCommandPrompt(input, text);
174
+
173
175
  if (Array.isArray(output.parts)) {
174
- output.parts.push({
176
+ output.parts.splice(0, output.parts.length, {
175
177
  id: `part_${randomUUID()}`,
176
178
  sessionID: extractHookSessionID(input, output),
177
179
  messageID: extractHookMessageID(input, output),
178
180
  type: "text",
179
- text,
181
+ text: prompt,
180
182
  synthetic: true,
181
183
  });
182
184
  return;
183
185
  }
184
186
  if (typeof output.message === "string") {
185
- output.message = output.message ? `${output.message}\n\n${text}` : text;
187
+ output.message = output.message ? `${output.message}\n\n${prompt}` : prompt;
186
188
  return;
187
189
  }
188
190
  if (typeof output.output === "string") {
189
- output.output = output.output ? `${output.output}\n\n${text}` : text;
191
+ output.output = output.output ? `${output.output}\n\n${prompt}` : prompt;
190
192
  return;
191
193
  }
192
194
  if (Array.isArray(output.content)) {
193
- output.content.push({ type: "text", text });
195
+ output.content.push({ type: "text", text: prompt });
194
196
  return;
195
197
  }
196
198
  throw new Error("Unsupported OpenCode command output contract for Goal Mode.");
197
199
  }
198
200
 
201
+ function renderGoalCommandPrompt(input: unknown, commandResult: string): string {
202
+ const args = extractCommandArguments(input).trim();
203
+ const firstToken = args.split(/\s+/, 1)[0]?.toLowerCase() ?? "";
204
+ const isControlCommand = new Set(["status", "plan", "history", "pause", "resume", "cancel", "merged"]).has(firstToken);
205
+
206
+ return [
207
+ "Goal Mode command result (authoritative):",
208
+ commandResult,
209
+ "",
210
+ "Instructions:",
211
+ isControlCommand
212
+ ? "Reply with the Goal Mode command result only. Do not inspect files, run tools, continue implementation, create branches, open PRs, or change repository state."
213
+ : "A persistent Goal Mode objective has been created. Acknowledge the created goal, then continue only according to the injected Goal Mode context and the project work-lifecycle rules.",
214
+ ].join("\n");
215
+ }
216
+
199
217
  function extractHookSessionID(input: unknown, output: HookOutput): string {
200
218
  const inputRecord = isRecord(input) ? input : undefined;
201
219
  const outputRecord = output;