@telpin-sistemas/orqen 0.1.3 → 0.1.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/README.md +7 -5
- package/dist/commands/client-chat.js +42 -0
- package/dist/commands/environment.js +13 -10
- package/dist/commands/eval.js +1 -1
- package/dist/commands/init.js +32 -13
- package/dist/commands/swarm.js +1 -1
- package/dist/commands/tutorial.js +1 -1
- package/dist/commands/update.js +86 -37
- package/dist/commands/workflow.js +50 -6
- package/dist/connectors/config.js +10 -5
- package/dist/connectors/describe.js +2 -2
- package/dist/connectors/github.js +7 -2
- package/dist/connectors/index.js +3 -0
- package/dist/connectors/jira.js +8 -2
- package/dist/connectors/legacy.js +1 -0
- package/dist/connectors/local.js +104 -0
- package/dist/connectors/markup.js +53 -0
- package/dist/index.js +17 -3
- package/dist/lib/config-keys.js +126 -0
- package/dist/lib/config.js +76 -13
- package/dist/lib/connectors-edit.js +28 -0
- package/dist/lib/connectors-setup.js +12 -1
- package/dist/lib/kit.js +0 -6
- package/dist/lib/provider-credentials.js +16 -5
- package/dist/lib/stack.js +1 -1
- package/dist/lib/system.js +5 -7
- package/dist/lib/tools.js +2 -2
- package/dist/lib/transitions-suggest.js +15 -0
- package/dist/practice/practice.js +221 -0
- package/dist/practice/scenario.js +186 -0
- package/dist/sdd/index.js +1 -1
- package/dist/template/.agents/commands/implement.md +1 -1
- package/dist/template/.agents/commands/review.md +2 -2
- package/dist/template/AGENTS.md +9 -9
- package/dist/template/stages/development.md +1 -1
- package/dist/tutorial/content.js +1 -1
- package/dist/workflow/config.js +18 -15
- package/dist/workflow/factory.js +6 -5
- package/dist/workflow/process.js +109 -32
- package/dist/workflow/workspace.js +34 -4
- package/package.json +1 -1
- package/dist/template/env.example +0 -27
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ orqen init # Run from the repository you want to initialize
|
|
|
14
14
|
3. Uses an installed AI agent to review a short repository summary in the background. It validates the proposal with Zod. Use `--deep` to let the agent explore the repository or `--no-ai` to use automatic detection only.
|
|
15
15
|
4. Lets you confirm or edit components, the command that starts each part, tests, migrations, and seed commands.
|
|
16
16
|
5. Finds a compatible OpenSpec installation (version 2.x), installs it if needed, and runs `openspec init` for the selected tools with English artifact output.
|
|
17
|
-
6. Configures the connectors: the requests system the client sees and an optional issues system for the team (Jira, GitHub or Asana). It asks for the project/filter and the account, checks them against the tool and, if the check fails, lets you fix them, save them anyway or skip (`orqen connectors setup` later). The selection goes to `orqen/config.yaml`; provider accounts go to `~/.orqen/
|
|
17
|
+
6. Configures the connectors: the requests system the client sees and an optional issues system for the team (Jira, GitHub or Asana). It asks for the project/filter and the account, checks them against the tool and, if the check fails, lets you fix them, save them anyway or skip (`orqen connectors setup` later). The selection goes to `orqen/config.yaml`; provider accounts go to `~/.orqen/credentials.env`, shared across repositories (Enter keeps an existing token). Existing connectors and general settings are kept by default. `orqen connectors` checks the configured resources.
|
|
18
18
|
7. Writes the environment configuration (no Docker in between), agent instructions, plugin, stage guides, and manifest. It merges the OpenSpec workflow rules with the repository's existing configuration.
|
|
19
19
|
|
|
20
20
|
`init` configures an existing project without requesting, cloning or reading the external stack catalog. It reuses any database scripts already installed in the project; new service scripts come from `bootstrap`.
|
|
@@ -40,7 +40,9 @@ For non-interactive first use of `bootstrap`, pass `--tools-repo @company/tools`
|
|
|
40
40
|
|
|
41
41
|
## Update an installation
|
|
42
42
|
|
|
43
|
-
`orqen update
|
|
43
|
+
Run `orqen update` from any directory to update the CLI. In an ORQEN project, the same command continues with OpenSpec and the kit using the newly installed CLI. Use `--cli-only` to update just the CLI from inside a project, or `orqen update --desktop` to update the global npm desktop app.
|
|
44
|
+
|
|
45
|
+
The kit updates files that still match the manifest. For edited files, you can keep the existing version, replace it, or write a copy with the `.orqen-new` suffix.
|
|
44
46
|
|
|
45
47
|
Use `--no-cli`, `--no-openspec`, or `--no-kit` to skip a step. Run `orqen init` again when you need to detect the stack or regenerate the environment.
|
|
46
48
|
|
|
@@ -49,12 +51,12 @@ Use `--no-cli`, `--no-openspec`, or `--no-kit` to skip a step. Run `orqen init`
|
|
|
49
51
|
```sh
|
|
50
52
|
orqen env setup
|
|
51
53
|
orqen env up [--all]
|
|
52
|
-
orqen env test [
|
|
54
|
+
orqen env test [unit|integration|e2e|visual]
|
|
53
55
|
orqen env status
|
|
54
56
|
orqen env down
|
|
55
57
|
```
|
|
56
58
|
|
|
57
|
-
`up` starts the processes
|
|
59
|
+
`up` starts the `processes` of `orqen/environment.yaml` in the background (`--all` includes the `when: e2e` ones, such as the frontend), waits until each one responds on its port, URL, or log line, then runs migrations and seed commands. `down` stops what orqen started; `status` shows what is running and where each log is (`orqen/state/logs/`). The test commands receive the `variables` of `orqen/environment.yaml`. `orqen env test unit|integration|e2e|visual` runs one suite (`unitarios` and `integracion` still work).
|
|
58
60
|
|
|
59
61
|
## Split a task across a swarm of agents
|
|
60
62
|
|
|
@@ -83,7 +85,7 @@ In `TESTING`, taking the stage starts the full environment, runs the configured
|
|
|
83
85
|
|
|
84
86
|
In the full lane, QA runs `/orqen:review <KEY>` in `QA_REVIEW` and records the decision with `orqen review <KEY> approve|reject`; the direct and light lanes skip QA. Run `orqen pr <KEY>` to inspect the integration target or add an explanation file to open the PR to `DEVEL_BRANCH`; testing opens no PR, so this is the PR the senior reviews. In `CODE_REVIEW`, the senior runs `/orqen:code-review <KEY>`, and `orqen code-review <KEY> <report.md> --verdict <approve|minor|reject>` records the report under `orqen/work/<KEY>/round-N/` and comments it on the internal ticket (or the external one) without changing the stage.
|
|
85
87
|
|
|
86
|
-
For an existing checkout, the CLI also reads `cli/.env` and its local state under `cli/.state/`.
|
|
88
|
+
For an existing checkout, the CLI also reads `cli/.env` and its local state under `cli/.state/`. The flow settings (approvers, code review gate, integration branch) live under `workflow` in `orqen/config.yaml` (English keys; the Spanish ones of earlier versions are still read); a variable such as `APPROVERS_CODE` or `DEVEL_BRANCH` in `.env` or the environment overrides them.
|
|
87
89
|
|
|
88
90
|
## Develop locally
|
|
89
91
|
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The conversation with the client: the comments of the request's ticket in the requests system.
|
|
3
|
+
* orqen comments <KEY> [--json] the ticket and its comments (client on one side, the team/orqen on the other)
|
|
4
|
+
* orqen comment <KEY> <file|-> answers the client: a comment signed with the person's name
|
|
5
|
+
* The team's comments carry the orqen mark, so the gates never take them as the client's answer.
|
|
6
|
+
*/
|
|
7
|
+
import { isBotComment, BOT_MARK, LEGACY_BOT_MARKS } from "../connectors/types.js";
|
|
8
|
+
import { nombreHerramienta } from "../connectors/describe.js";
|
|
9
|
+
/** "[orqen] **Mateo:** hola" → { author: "Mateo", text: "hola" }; orqen's own messages → author "orqen". */
|
|
10
|
+
export function parseTeamComment(body) {
|
|
11
|
+
let t = body;
|
|
12
|
+
for (const m of [BOT_MARK, ...LEGACY_BOT_MARKS])
|
|
13
|
+
if (t.startsWith(m)) {
|
|
14
|
+
t = t.slice(m.length);
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
t = t.replace(/^\s+/, "");
|
|
18
|
+
const m = t.match(/^\*{1,2}([^*\n]{1,60}?):\*{1,2}\s*/);
|
|
19
|
+
return m ? { author: m[1].trim(), text: t.slice(m[0].length) } : { author: "orqen", text: t };
|
|
20
|
+
}
|
|
21
|
+
export function toMessage(c) {
|
|
22
|
+
if (isBotComment(c.body)) {
|
|
23
|
+
const p = parseTeamComment(c.body);
|
|
24
|
+
return { id: c.id, from: "team", author: p.author, text: p.text, created: c.created };
|
|
25
|
+
}
|
|
26
|
+
return { id: c.id, from: "client", author: c.authorName || c.author, text: c.body, created: c.created };
|
|
27
|
+
}
|
|
28
|
+
export async function readClientChat(t, key) {
|
|
29
|
+
const [ticket, comments] = await Promise.all([t.ticket(key), t.comments(key)]);
|
|
30
|
+
const first = ticket.description.trim()
|
|
31
|
+
? [{ id: "description", from: "client", author: ticket.reportedBy ?? "", text: ticket.description.trim(), created: "" }] : [];
|
|
32
|
+
return {
|
|
33
|
+
key, title: ticket.title, tool: nombreHerramienta(t.kind), url: ticket.url, status: ticket.status,
|
|
34
|
+
messages: [...first, ...comments.map(toMessage)],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function replyToClient(t, key, text, person) {
|
|
38
|
+
const body = text.trim();
|
|
39
|
+
if (!body)
|
|
40
|
+
throw new Error("Empty message: nothing was sent.");
|
|
41
|
+
await t.comment(key, person ? `**${person}:** ${body}` : body);
|
|
42
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* setup install dependencies (entornos.preparar)
|
|
4
4
|
* up [--all] start the processes (npm run dev, npm start…) and wait until they are ready; then migrations and seed.
|
|
5
5
|
* --all: also the processes that are only for e2e / visual tests (e.g. the frontend)
|
|
6
|
-
* test [type...]
|
|
6
|
+
* test [type...] unit / integration / e2e / visual with the variables of orqen/environment.yaml
|
|
7
7
|
* `-- <args>`: appended to the command of the requested type (e.g. only the e2e of a change)
|
|
8
8
|
* status which processes are running
|
|
9
9
|
* down stop the processes orqen started
|
|
@@ -14,6 +14,9 @@ import { ejecutarLinea } from "../lib/proc.js";
|
|
|
14
14
|
import { bajarProcesos, estadoProcesos, levantarProcesos } from "../lib/processes.js";
|
|
15
15
|
import { pc } from "../ui/console.js";
|
|
16
16
|
const TIPOS = ["unitarios", "integracion", "e2e", "visual"];
|
|
17
|
+
/** Test types as people write them (orqen/environment.yaml uses unit / integration); the Spanish names still work. */
|
|
18
|
+
const NOMBRE = { unitarios: "unit", integracion: "integration", e2e: "e2e", visual: "visual" };
|
|
19
|
+
const tipoDe = (s) => (Object.entries(NOMBRE).find(([, en]) => en === s)?.[0] ?? s);
|
|
17
20
|
const titulo = (s) => console.log(`\n${pc.bold(pc.magenta("▸"))} ${pc.bold(s)}`);
|
|
18
21
|
async function correr(repo, cfg, lineas, etiqueta) {
|
|
19
22
|
const env = { ...process.env, ...cfg.entornos.variables };
|
|
@@ -40,7 +43,7 @@ export async function entorno(sub, resto, o) {
|
|
|
40
43
|
break;
|
|
41
44
|
case "up": {
|
|
42
45
|
if (!e.procesos.length)
|
|
43
|
-
console.log(pc.dim("No processes configured in orqen/
|
|
46
|
+
console.log(pc.dim("No processes configured in orqen/environment.yaml (processes)."));
|
|
44
47
|
const r = await levantarProcesos(repo, e.procesos, e.variables, { todos: o.todos, alAvanzar: (m) => titulo(m) });
|
|
45
48
|
if (!r.ok) {
|
|
46
49
|
console.error(pc.red(`✘ ${r.detalle}`));
|
|
@@ -60,12 +63,12 @@ export async function entorno(sub, resto, o) {
|
|
|
60
63
|
break;
|
|
61
64
|
}
|
|
62
65
|
case "test": {
|
|
63
|
-
const pedidos = (resto.length ? resto : TIPOS.filter((t) => e.tests[t]));
|
|
66
|
+
const pedidos = (resto.length ? resto.map(tipoDe) : TIPOS.filter((t) => e.tests[t]));
|
|
64
67
|
const invalidos = pedidos.filter((t) => !TIPOS.includes(t));
|
|
65
68
|
if (invalidos.length)
|
|
66
|
-
throw new Error(`Invalid test type: ${invalidos.join(", ")}. Options: ${
|
|
69
|
+
throw new Error(`Invalid test type: ${invalidos.join(", ")}. Options: ${Object.values(NOMBRE).join(", ")}`);
|
|
67
70
|
if (!pedidos.length)
|
|
68
|
-
throw new Error("No test commands are configured in orqen/
|
|
71
|
+
throw new Error("No test commands are configured in orqen/environment.yaml (tests).");
|
|
69
72
|
const extra = o.extra ?? [];
|
|
70
73
|
if (extra.length && !resto.length)
|
|
71
74
|
throw new Error("Name the test type the arguments after `--` are for, e.g. orqen env test e2e -- tests/login.spec.ts");
|
|
@@ -73,13 +76,13 @@ export async function entorno(sub, resto, o) {
|
|
|
73
76
|
for (const t of pedidos) {
|
|
74
77
|
const cmd = e.tests[t];
|
|
75
78
|
if (!cmd) {
|
|
76
|
-
resultados.push([t, null]);
|
|
79
|
+
resultados.push([NOMBRE[t], null]);
|
|
77
80
|
continue;
|
|
78
81
|
}
|
|
79
82
|
const linea = extra.length ? `${cmd} ${extra.map(citar).join(" ")}` : cmd;
|
|
80
|
-
resultados.push([t, await correr(repo, cfg, [linea], `tests ${t}`)]);
|
|
83
|
+
resultados.push([NOMBRE[t], await correr(repo, cfg, [linea], `tests ${NOMBRE[t]}`)]);
|
|
81
84
|
}
|
|
82
|
-
console.log("\n" + resultados.map(([t, r]) => `${r === null ? pc.yellow("–") : r ? pc.green("✔") : pc.red("✘")} ${t}${r === null ? pc.dim(" (no command configured in orqen/
|
|
85
|
+
console.log("\n" + resultados.map(([t, r]) => `${r === null ? pc.yellow("–") : r ? pc.green("✔") : pc.red("✘")} ${t}${r === null ? pc.dim(" (no command configured in orqen/environment.yaml)") : ""}`).join("\n"));
|
|
83
86
|
ok = resultados.every(([, r]) => r !== false);
|
|
84
87
|
break;
|
|
85
88
|
}
|
|
@@ -90,7 +93,7 @@ export async function entorno(sub, resto, o) {
|
|
|
90
93
|
break;
|
|
91
94
|
}
|
|
92
95
|
if (!st.length)
|
|
93
|
-
console.log(pc.dim("No processes configured in orqen/
|
|
96
|
+
console.log(pc.dim("No processes configured in orqen/environment.yaml (processes)."));
|
|
94
97
|
for (const x of st)
|
|
95
98
|
console.log(`${x.corriendo ? pc.green("●") : pc.dim("○")} ${x.nombre.padEnd(16)} ${pc.dim(x.comando)}${x.puerto ? pc.dim(` :${x.puerto}`) : ""}${x.cuando === "e2e" ? pc.dim(" (e2e only)") : ""}${x.log ? pc.dim(`\n log: ${x.log}`) : ""}`);
|
|
96
99
|
break;
|
|
@@ -105,7 +108,7 @@ export async function entorno(sub, resto, o) {
|
|
|
105
108
|
"Usage: orqen env <command>",
|
|
106
109
|
" setup install dependencies (entornos.preparar)",
|
|
107
110
|
" up [--all] start the processes and wait until they are ready, then migrate and seed (--all: include e2e-only processes)",
|
|
108
|
-
" test [type...]
|
|
111
|
+
" test [type...] unit | integration | e2e | visual (default: all configured tests)",
|
|
109
112
|
" -- <args>: appended to that type's command, e.g. orqen env test e2e -- tests/login.spec.ts",
|
|
110
113
|
" status show which processes are running and where their logs are",
|
|
111
114
|
" down stop the processes orqen started",
|
package/dist/commands/eval.js
CHANGED
|
@@ -12,7 +12,7 @@ import { EVAL_STEPS, loadCases } from "../eval/cases.js";
|
|
|
12
12
|
import { runCase } from "../eval/run.js";
|
|
13
13
|
import { loadConfig } from "../workflow/config.js";
|
|
14
14
|
export const EVAL_HELP = ` eval [case|step...] Run the agent on test tickets and check its work (orqen/evals/*.yaml, or the built-in cases)
|
|
15
|
-
--agent "<cmd>" Headless agent (default:
|
|
15
|
+
--agent "<cmd>" Headless agent (default: agent.command of orqen/config.yaml)
|
|
16
16
|
--judge "<cmd>" Also ask a judge agent whether the output made facts up ("" = the same agent)
|
|
17
17
|
--no-lessons Without the team's lessons (orqen/knowledge): compare how much they help
|
|
18
18
|
--keep Keep the test projects · --json Machine-readable result
|
package/dist/commands/init.js
CHANGED
|
@@ -6,9 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { basename, resolve } from "node:path";
|
|
8
8
|
import { agentesInstalados, comandoRapido, explorarConAgente, explorarRapidoAislado } from "../lib/agent.js";
|
|
9
|
-
import { ARCHIVO_CONFIG, entornosDesdeStack, escribirConfig, existeConfig, leerConfig } from "../lib/config.js";
|
|
9
|
+
import { ARCHIVO_CONFIG, ARCHIVO_ENTORNO, entornosDesdeStack, escribirConfig, existeConfig, leerConfig } from "../lib/config.js";
|
|
10
10
|
import { detectar } from "../lib/detect.js";
|
|
11
|
-
import { escribirEnv, leerEnv, RUTA_ENV } from "../lib/env.js";
|
|
12
11
|
import { checkSummary, missingSecrets, setupConnectorsStep } from "../lib/connectors-setup.js";
|
|
13
12
|
import { checkDraft, parseDraft } from "../lib/connectors-edit.js";
|
|
14
13
|
import { providerEnv, providerFile, saveProviders } from "../lib/provider-credentials.js";
|
|
@@ -20,6 +19,7 @@ import { ProcesoEntorno } from "../lib/processes.js";
|
|
|
20
19
|
import { PROCESO_DB } from "../lib/tools.js";
|
|
21
20
|
import { mostrarLogo } from "../ui/logo.js";
|
|
22
21
|
import { azul, confirmar, diffColoreado, elegir, elegirVarios, gris, interactivo, magenta, p, pc, salirSiCancela, texto, tick, } from "../ui/console.js";
|
|
22
|
+
import { execFileSync } from "node:child_process";
|
|
23
23
|
import { readFileSync, existsSync } from "node:fs";
|
|
24
24
|
import { join } from "node:path";
|
|
25
25
|
const HERRAMIENTAS_OPENSPEC = [
|
|
@@ -121,7 +121,6 @@ export async function init(o) {
|
|
|
121
121
|
openspecCfg = await prepararOpenSpec(repo, agentes.map((a) => a.id), o.herramientas, yes);
|
|
122
122
|
const rama = await texto("Base branch for request branches and pull requests", ramaBase(repo), yes);
|
|
123
123
|
const previous = existeConfig(repo) ? leerConfig(repo) : undefined;
|
|
124
|
-
const datosEnv = leerEnv(repo) ? undefined : {};
|
|
125
124
|
// Connectors: what goes in config.yaml (project, filter…) and the provider accounts, shared by this user's repositories.
|
|
126
125
|
const conectores = await prepararConectores(repo, previous?.conectores, o, yes);
|
|
127
126
|
// 4. Review the proposal.
|
|
@@ -158,6 +157,8 @@ export async function init(o) {
|
|
|
158
157
|
stack,
|
|
159
158
|
...(conectores?.conectores ?? previous?.conectores ? { conectores: conectores?.conectores ?? previous?.conectores } : {}),
|
|
160
159
|
...(previous?.general ? { general: previous.general } : {}),
|
|
160
|
+
// how the flow works (shared): kept as is, or the defaults written out so the team sees what can be set
|
|
161
|
+
flujo: previous?.flujo ?? { soporte: false, aprobadores: { analisis: [], qa: [], codigo: [], cliente: [], ejecucion: [] }, code_review: { gate: "github", revisores: [] }, rama_desarrollo: "desarrollo" },
|
|
161
162
|
entornos: pre ? pre.entornos : entornosDesdeStack(stack),
|
|
162
163
|
};
|
|
163
164
|
const vars = { RESUMEN_STACK: resumenStack(stack), BASE_BRANCH: config.proyecto.rama_base, AGENT_CMD: comandoAgente ? `${comandoAgente}` : "claude -p --permission-mode acceptEdits" };
|
|
@@ -179,31 +180,48 @@ export async function init(o) {
|
|
|
179
180
|
}
|
|
180
181
|
escribirConfig(repo, config);
|
|
181
182
|
const res = await aplicar(repo, plan, (c) => resolverConflicto(c, yes));
|
|
182
|
-
if (datosEnv) {
|
|
183
|
-
escribirEnv(repo, readFileSync(join(repo, "orqen", ".env.example"), "utf8"), datosEnv);
|
|
184
|
-
p.log.success(`${RUTA_ENV} created ${gris("(ignored by Git)")}`);
|
|
185
|
-
}
|
|
186
183
|
const env = providerEnv(repo);
|
|
187
184
|
const faltanEnv = config.conectores ? missingSecrets(config.conectores, env) : [];
|
|
188
185
|
const lado = res.filter((r) => r.accion === "guardado-al-lado");
|
|
189
|
-
p.log.success(`${ARCHIVO_CONFIG} and kit v${VERSION_CLI} installed`);
|
|
186
|
+
p.log.success(`${ARCHIVO_CONFIG}, ${ARCHIVO_ENTORNO} and kit v${VERSION_CLI} installed`);
|
|
190
187
|
for (const r of lado)
|
|
191
188
|
p.log.warn(`${r.ruta}: the proposed version is in ${r.detalle} for you to merge`);
|
|
189
|
+
const commiteado = await commitInstall(repo, o.commit, yes);
|
|
192
190
|
const mk = marketplace(existsSync(join(repo, MARKETPLACE)) ? readFileSync(join(repo, MARKETPLACE), "utf8") : undefined).nombre;
|
|
193
191
|
const pasos = [
|
|
194
192
|
...(!config.conectores ? [`Connect where the tickets live: ${pc.cyan("orqen connectors setup")} (Jira, GitHub or Asana).`] : []),
|
|
195
193
|
...(faltanEnv.length ? [`Complete the provider accounts with ${pc.cyan("orqen connectors setup")}: missing ${faltanEnv.join(", ")}. These accounts are shared across your repositories.`] : []),
|
|
196
|
-
`Review ${pc.cyan(ARCHIVO_CONFIG)}, then try: ${pc.cyan("orqen env up")} · ${pc.cyan("orqen env test")} · ${pc.cyan("orqen env down")}`,
|
|
194
|
+
`Review ${pc.cyan(ARCHIVO_CONFIG)} and ${pc.cyan(ARCHIVO_ENTORNO)}, then try: ${pc.cyan("orqen env up")} · ${pc.cyan("orqen env test")} · ${pc.cyan("orqen env down")}`,
|
|
197
195
|
`Open Claude Code in this folder (restart it if it was open) and accept ${pc.bold("Trust this folder")}: ` +
|
|
198
196
|
`the commands appear as ${pc.cyan("/orqen:tutorial")} (start here if you are new), ${pc.cyan("/orqen:support")}, ${pc.cyan("/orqen:analyze")}, ${pc.cyan("/orqen:list")}, ${pc.cyan("/orqen:implement")}, ${pc.cyan("/orqen:pr")}, ${pc.cyan("/orqen:review")} (QA), ${pc.cyan("/orqen:approve")} ` +
|
|
199
197
|
gris(`(type /orqen: to list them; check with /plugin → orqen@${mk})`),
|
|
200
|
-
`Commit the changes (orqen/, .claude/, .claude-plugin/, AGENTS.md, CLAUDE.md, openspec/) so the team gets the same commands
|
|
198
|
+
...(!commiteado ? [`Commit the changes (orqen/, .claude/, .claude-plugin/, AGENTS.md, CLAUDE.md, openspec/) so the team gets the same commands: ${pc.cyan('git add -A && git commit -m "Install orqen"')}`] : []),
|
|
201
199
|
];
|
|
202
200
|
if (o.sinLogo)
|
|
203
201
|
return; // `orqen bootstrap` shows its own next steps
|
|
204
202
|
p.note(pasos.map((x, i) => `${pc.bold(`${i + 1}.`)} ${x}`).join("\n"), "Next steps");
|
|
205
203
|
p.outro(`${magenta("//")} ${pc.bold("From request to production.")}`);
|
|
206
204
|
}
|
|
205
|
+
const INSTALLED = ["orqen", ".claude", ".claude-plugin", "AGENTS.md", "CLAUDE.md", ".gitignore", "openspec"];
|
|
206
|
+
/**
|
|
207
|
+
* Commits what init wrote (the team gets the same commands, and the first `orqen take` can switch branches). Only those
|
|
208
|
+
* paths: nothing else the person had changed or staged. Asks when interactive; --yes only does it with --commit.
|
|
209
|
+
*/
|
|
210
|
+
async function commitInstall(repo, commit, yes) {
|
|
211
|
+
if (!commit && (yes || !(await confirmar("Commit the files orqen just wrote (orqen/, .claude/, AGENTS.md…)?", true, false))))
|
|
212
|
+
return false;
|
|
213
|
+
const paths = INSTALLED.filter((x) => existsSync(join(repo, x)));
|
|
214
|
+
try {
|
|
215
|
+
execFileSync("git", ["add", "--", ...paths], { cwd: repo, stdio: "pipe" });
|
|
216
|
+
execFileSync("git", ["commit", "-q", "-m", "Install orqen", "--", ...paths], { cwd: repo, stdio: "pipe" });
|
|
217
|
+
p.log.success("Committed: Install orqen");
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
catch (e) {
|
|
221
|
+
p.log.warn(`Could not commit (${(e.stderr?.toString() || e.message).trim().split("\n")[0]}): commit the files by hand.`);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
207
225
|
/** Connectors step: from --connectors (JSON), interactively, or kept as they were (--yes, --no-connectors). */
|
|
208
226
|
async function prepararConectores(repo, prev, o, yes) {
|
|
209
227
|
if (o.sinConectores)
|
|
@@ -256,7 +274,7 @@ async function revisarStack(stack, yes, hayAgente) {
|
|
|
256
274
|
const comps = await elegirVarios("Components to include", stack.componentes.map((c) => ({ value: c.nombre, label: `${c.nombre} ${gris(`(${c.ruta})`)}`, hint: [c.tipo, c.framework ?? c.lenguaje].join(" · ") })), stack.componentes.map((c) => c.nombre), false);
|
|
257
275
|
const tests = { ...stack.tests };
|
|
258
276
|
for (const k of ["unitarios", "integracion", "e2e", "visual"]) {
|
|
259
|
-
tests[k] = (await texto(`Test command for ${k} (leave blank to skip)`, tests[k] ?? "", false)) || undefined;
|
|
277
|
+
tests[k] = (await texto(`Test command for ${{ unitarios: "unit", integracion: "integration" }[k] ?? k} tests (leave blank to skip)`, tests[k] ?? "", false)) || undefined;
|
|
260
278
|
}
|
|
261
279
|
const migraciones = (await texto("Migration command (leave blank to skip)", stack.migraciones ?? "", false)) || undefined;
|
|
262
280
|
const seed = (await texto("Seed command for test data (leave blank to skip)", stack.seed ?? "", false)) || undefined;
|
|
@@ -273,7 +291,7 @@ async function revisarProcesos(e, yes) {
|
|
|
273
291
|
const linea = (x) => `${x.nombre}: ${x.comando}${x.ruta !== "." ? gris(` (in ${x.ruta})`) : ""}${x.puerto ? gris(` → :${x.puerto}`) : ""}${x.cuando === "e2e" ? gris(" [e2e only]") : ""}`;
|
|
274
292
|
p.note(e.procesos.length
|
|
275
293
|
? e.procesos.map(linea).join("\n") + "\n\n" + gris("orqen starts them when needed (orqen take / orqen env up) and stops them afterwards.")
|
|
276
|
-
: gris("Could not find how to start the project (no dev/start script). You can add it under
|
|
294
|
+
: gris("Could not find how to start the project (no dev/start script). You can add it under processes in orqen/environment.yaml."), "How the project starts");
|
|
277
295
|
if (yes || !e.procesos.length)
|
|
278
296
|
return e;
|
|
279
297
|
if (!(await confirmar("Do you want to change any command?", false, false)))
|
|
@@ -344,7 +362,8 @@ async function prepararOpenSpec(repo, agentes, herramientasPedidas, yes) {
|
|
|
344
362
|
function resumenPlan(plan, config) {
|
|
345
363
|
const icono = { crear: pc.green("+"), actualizar: pc.yellow("~"), igual: gris("="), conflicto: pc.red("!") };
|
|
346
364
|
const filas = [
|
|
347
|
-
`${pc.green("+")} ${ARCHIVO_CONFIG}`,
|
|
365
|
+
`${pc.green("+")} ${ARCHIVO_CONFIG} ${gris("(the flow: project, connectors, workflow)")}`,
|
|
366
|
+
`${pc.green("+")} ${ARCHIVO_ENTORNO} ${gris("(stack, how each part starts, tests)")}`,
|
|
348
367
|
...plan.filter((c) => c.accion !== "igual" && !c.ruta.startsWith("orqen/stages/") && !c.ruta.startsWith("orqen/plugin/"))
|
|
349
368
|
.map((c) => `${icono[c.accion]} ${c.ruta}${c.accion === "conflicto" ? pc.red(" (local edits require review)") : ""}`),
|
|
350
369
|
];
|
package/dist/commands/swarm.js
CHANGED
|
@@ -24,7 +24,7 @@ export const SWARM_HELP = ` swarm "<task>" Split a task into small sub
|
|
|
24
24
|
--small "<cmd>" Small model for subtasks (default: ${SWARM_DEFAULTS.small})
|
|
25
25
|
--large "<cmd>" Larger model after the small one fails (default: ${SWARM_DEFAULTS.large})
|
|
26
26
|
--small-attempts <n> --large-attempts <n> Attempts per tier (default 2 and 2)
|
|
27
|
-
--test "<cmd>" Final verification when the plan has none (default:
|
|
27
|
+
--test "<cmd>" Final verification when the plan has none (default: tests.unit of orqen/environment.yaml)
|
|
28
28
|
--setup "<cmd>" Run in each worktree before the agent (default: entornos.preparar); --no-setup
|
|
29
29
|
--apply Integrate a successful result into the starting branch (fast-forward only)
|
|
30
30
|
--plan <file.json> Use an existing plan instead of planning · --plan-only Only write the plan
|
|
@@ -57,7 +57,7 @@ export function datosDelRepo(repo, plataforma = process.platform) {
|
|
|
57
57
|
ramaDevel: env.DEVEL_BRANCH || "desarrollo",
|
|
58
58
|
windows: plataforma === "win32",
|
|
59
59
|
db: existsSync(join(repo, "orqen", "tools", "db.mjs")),
|
|
60
|
-
conectado: c.requests.kind === "jira" ? !!(real(c.requests.url) && real(c.requests.token)) : c.requests.kind === "github" ? !!c.requests.repo : !!(c.requests.project && c.requests.token),
|
|
60
|
+
conectado: c.requests.kind === "jira" ? !!(real(c.requests.url) && real(c.requests.token)) : c.requests.kind === "github" ? !!c.requests.repo : c.requests.kind === "local" ? true : !!(c.requests.project && c.requests.token),
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
export function buscarPaso(pasos, valor) {
|
package/dist/commands/update.js
CHANGED
|
@@ -1,18 +1,59 @@
|
|
|
1
|
-
/** Update the CLI
|
|
2
|
-
import {
|
|
1
|
+
/** Update the CLI or desktop app, and refresh OpenSpec and managed kit files in an ORQEN project. */
|
|
2
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
3
4
|
import semver from "semver";
|
|
4
|
-
import { actualizarVersiones, escribirConfig, leerConfig } from "../lib/config.js";
|
|
5
|
+
import { actualizarVersiones, ARCHIVO_CONFIG, ARCHIVO_ENTORNO, configVieja, escribirConfig, existeConfig, leerConfig } from "../lib/config.js";
|
|
5
6
|
import { leerEnv } from "../lib/env.js";
|
|
6
7
|
import { legacyToYaml, legacyVarsIn } from "../connectors/legacy.js";
|
|
7
8
|
import { aplicar, leerManifest, planificar } from "../lib/kit.js";
|
|
8
9
|
import { actualizarArchivosOpenSpec, estadoOpenSpec, instalarOpenSpec, RANGO_OPENSPEC, ultimaVersionOpenSpec, } from "../lib/openspec.js";
|
|
9
|
-
import { ejecutar } from "../lib/proc.js";
|
|
10
|
-
import {
|
|
10
|
+
import { ejecutar, ejecutarAsync } from "../lib/proc.js";
|
|
11
|
+
import { gestorCli, PAQUETE_CLI, ultimaVersionPaquete, VERSION_CLI } from "../lib/system.js";
|
|
11
12
|
import { resumenStack } from "../lib/stack.js";
|
|
12
13
|
import { mostrarLogo } from "../ui/logo.js";
|
|
13
14
|
import { azul, confirmar, gris, interactivo, magenta, p, pc } from "../ui/console.js";
|
|
14
15
|
import { resolverConflicto } from "./init.js";
|
|
16
|
+
const PAQUETE_DESKTOP = "@telpin-sistemas/orqen-desktop";
|
|
17
|
+
function paqueteGlobal(gestor, paquete) {
|
|
18
|
+
const r = ejecutar(gestor, ["root", "-g"], { timeoutMs: 20_000 });
|
|
19
|
+
if (r.codigo !== 0 || !r.stdout.trim())
|
|
20
|
+
throw new Error(r.stderr.trim() || r.error?.message || `Could not locate global packages for ${gestor}.`);
|
|
21
|
+
return join(r.stdout.trim(), paquete);
|
|
22
|
+
}
|
|
23
|
+
async function actualizarPaquete(gestor, paquete, actual, yes) {
|
|
24
|
+
const ultima = ultimaVersionPaquete(gestor, paquete);
|
|
25
|
+
if (!ultima)
|
|
26
|
+
return { status: "unavailable", version: actual };
|
|
27
|
+
if (!semver.gt(ultima, actual))
|
|
28
|
+
return { status: "current", version: actual };
|
|
29
|
+
if (!await confirmar(`Update ${paquete} from ${actual} to ${ultima}?`, true, yes))
|
|
30
|
+
return { status: "skipped", version: actual };
|
|
31
|
+
const r = await ejecutarAsync(gestor, [gestor === "pnpm" ? "add" : "install", "-g", `${paquete}@${ultima}`], { timeoutMs: 10 * 60_000 });
|
|
32
|
+
if (r.codigo !== 0)
|
|
33
|
+
throw new Error(`Update failed for ${paquete}: ${(r.stderr || r.stdout || r.error?.message || `exit code ${r.codigo}`).trim().slice(-1500)}`);
|
|
34
|
+
return { status: "installed", version: ultima };
|
|
35
|
+
}
|
|
15
36
|
export async function update(o) {
|
|
37
|
+
if (o.desktop) {
|
|
38
|
+
const manifest = join(paqueteGlobal("npm", PAQUETE_DESKTOP), "package.json");
|
|
39
|
+
if (!existsSync(manifest))
|
|
40
|
+
throw new Error("Install ORQEN Desktop globally with npm before updating it.");
|
|
41
|
+
const launcher = process.env.ORQEN_DESKTOP_NPM_MANIFEST;
|
|
42
|
+
if (launcher && realpathSync(launcher) !== realpathSync(manifest)) {
|
|
43
|
+
throw new Error("The running desktop app is outside the active global npm installation.");
|
|
44
|
+
}
|
|
45
|
+
const { version: actual } = JSON.parse(readFileSync(manifest, "utf8"));
|
|
46
|
+
const result = await actualizarPaquete("npm", PAQUETE_DESKTOP, actual, !!o.yes || !interactivo());
|
|
47
|
+
if (result.status === "unavailable")
|
|
48
|
+
throw new Error("Could not check npm for ORQEN Desktop updates.");
|
|
49
|
+
if (o.json)
|
|
50
|
+
console.log(JSON.stringify(result));
|
|
51
|
+
else if (result.status === "installed")
|
|
52
|
+
console.log(`ORQEN Desktop ${result.version} installed. Restart the app to use it.`);
|
|
53
|
+
else if (result.status === "current")
|
|
54
|
+
console.log(`ORQEN Desktop ${result.version} is up to date.`);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
16
57
|
const repo = resolve(o.dir ?? process.cwd());
|
|
17
58
|
let yes = !!o.yes;
|
|
18
59
|
await mostrarLogo(!o.sinAnimacion && !o.yes);
|
|
@@ -21,41 +62,40 @@ export async function update(o) {
|
|
|
21
62
|
p.log.warn("Non-interactive terminal. Using defaults as with --yes.");
|
|
22
63
|
yes = true;
|
|
23
64
|
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
config = leerConfig(repo);
|
|
27
|
-
}
|
|
28
|
-
catch (e) {
|
|
29
|
-
p.cancel(e.message);
|
|
30
|
-
process.exitCode = 1;
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const s = p.spinner();
|
|
34
|
-
// 1. CLI
|
|
65
|
+
const config = !o.cliOnly && (o.dir !== undefined || o.sinCli || existeConfig(repo)) ? leerConfig(repo) : undefined;
|
|
35
66
|
if (!o.sinCli) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
const gestor = gestorCli();
|
|
68
|
+
p.log.step("Checking for orqen updates…");
|
|
69
|
+
const result = await actualizarPaquete(gestor, PAQUETE_CLI, VERSION_CLI, yes);
|
|
70
|
+
if (result.status === "unavailable") {
|
|
71
|
+
if (!config)
|
|
72
|
+
throw new Error("Could not check npm for orqen updates.");
|
|
73
|
+
p.log.warn("Could not reach npm. Using the installed CLI to update this project.");
|
|
74
|
+
}
|
|
75
|
+
if (result.status === "current")
|
|
76
|
+
p.log.success(`orqen ${result.version} is up to date`);
|
|
77
|
+
if (result.status === "installed") {
|
|
78
|
+
p.log.success(`orqen ${result.version} installed`);
|
|
79
|
+
if (config) {
|
|
80
|
+
const cli = join(paqueteGlobal(gestor, PAQUETE_CLI), "dist", "index.js");
|
|
81
|
+
const args = [cli, "update", "--dir", repo, "--no-cli", "--no-animation"];
|
|
82
|
+
if (yes)
|
|
83
|
+
args.push("--yes");
|
|
84
|
+
if (o.sinOpenspec)
|
|
85
|
+
args.push("--no-openspec");
|
|
86
|
+
if (o.sinKit)
|
|
87
|
+
args.push("--no-kit");
|
|
88
|
+
const r = ejecutar(process.execPath, args, { heredar: true });
|
|
89
|
+
if (r.error)
|
|
90
|
+
throw r.error;
|
|
91
|
+
process.exitCode = r.codigo;
|
|
53
92
|
return;
|
|
54
93
|
}
|
|
55
94
|
}
|
|
56
|
-
else
|
|
57
|
-
s.stop(`orqen ${VERSION_CLI} is up to date`);
|
|
58
95
|
}
|
|
96
|
+
if (!config)
|
|
97
|
+
return;
|
|
98
|
+
const s = p.spinner();
|
|
59
99
|
// 2. OpenSpec
|
|
60
100
|
if (!o.sinOpenspec) {
|
|
61
101
|
s.start("Checking OpenSpec…");
|
|
@@ -82,6 +122,7 @@ export async function update(o) {
|
|
|
82
122
|
}
|
|
83
123
|
catch (e) {
|
|
84
124
|
s.error(e.message);
|
|
125
|
+
process.exitCode = 1;
|
|
85
126
|
}
|
|
86
127
|
}
|
|
87
128
|
}
|
|
@@ -116,11 +157,19 @@ export async function update(o) {
|
|
|
116
157
|
if (!config.conectores && viejas.length) {
|
|
117
158
|
const bloque = legacyToYaml(env);
|
|
118
159
|
p.log.info(`orqen/.env uses variables of an earlier version: ${viejas.join(", ")}`);
|
|
119
|
-
if (await confirmar("Move where the tickets live to orqen/config.yaml (
|
|
160
|
+
if (await confirmar("Move where the tickets live to orqen/config.yaml (connectors)? orqen/.env is not modified", true, yes)) {
|
|
120
161
|
const actual = leerConfig(repo);
|
|
121
162
|
actual.conectores = bloque;
|
|
122
163
|
escribirConfig(repo, actual);
|
|
123
|
-
p.log.success(`
|
|
164
|
+
p.log.success(`connectors written in orqen/config.yaml ${gris("(you can delete REC_JQL and SIS_* from orqen/.env)")}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
// 5. Format of earlier versions: Spanish keys and the stack/environment inside config.yaml
|
|
168
|
+
if (configVieja(repo)) {
|
|
169
|
+
p.log.info(`${ARCHIVO_CONFIG} uses the format of an earlier version (Spanish keys, stack and environment in the same file).`);
|
|
170
|
+
if (await confirmar(`Rewrite it with English keys and move the stack and environment to ${ARCHIVO_ENTORNO}? (comments in the file are not kept)`, true, yes)) {
|
|
171
|
+
escribirConfig(repo, leerConfig(repo));
|
|
172
|
+
p.log.success(`${ARCHIVO_CONFIG} rewritten · ${ARCHIVO_ENTORNO} created`);
|
|
124
173
|
}
|
|
125
174
|
}
|
|
126
175
|
actualizarVersiones(repo, { cli: VERSION_CLI });
|
|
@@ -16,7 +16,7 @@ import { OpenSpecCli } from "../workflow/openspec.js";
|
|
|
16
16
|
import { Process } from "../workflow/process.js";
|
|
17
17
|
import { Store } from "../workflow/store.js";
|
|
18
18
|
import { GitWorkspace } from "../workflow/workspace.js";
|
|
19
|
-
export const WORKFLOW_COMMANDS = ["list", "qa", "approve", "merged", "cancel", "pending", "support", "analyze", "lane", "take", "complete", "pr", "review", "code-review", "schema", "block", "release", "search", "status", "cycle", "connectors"];
|
|
19
|
+
export const WORKFLOW_COMMANDS = ["list", "qa", "approve", "merged", "cancel", "pending", "support", "analyze", "lane", "take", "complete", "pr", "review", "code-review", "schema", "block", "release", "search", "status", "cycle", "connectors", "comments", "comment"];
|
|
20
20
|
/** What people run: the 9 steps (as /orqen:* commands in their agent) and the CLI commands meant for a person. */
|
|
21
21
|
export const WORKFLOW_HELP = `The 9 steps (run the /orqen:* commands in your agent: it calls the CLI for you):
|
|
22
22
|
1 /orqen:list requests orqen list requests [--json] [--all] Everyone's work list, by role (takes nothing)
|
|
@@ -34,6 +34,8 @@ Request commands for people:
|
|
|
34
34
|
merged <KEY> [--person N] Confirm the hand merge of an approved PR when orqen cannot read it from GitHub
|
|
35
35
|
cancel <KEY> --reason T Close the request without delivering it: closes the PR unmerged, comments both tickets (CANCELLED)
|
|
36
36
|
release <KEY> Free a request held by an agent that is no longer working on it
|
|
37
|
+
comments <KEY> [--json] Read the request and its conversation with the client
|
|
38
|
+
comment <KEY> <file|-> Reply to the client on the request (--person NAME)
|
|
37
39
|
connectors [setup] Show and check the connectors (requests and issues), or set them up
|
|
38
40
|
cycle [--loop] Unattended mode (cron/CI/server): agent stages only, never support or analysis
|
|
39
41
|
|
|
@@ -95,7 +97,7 @@ export async function runWorkflow(cmd, rest) {
|
|
|
95
97
|
const me = personFlag || quienSoy(cfg.repoPath);
|
|
96
98
|
/** Accepts the request key or the current issue key of a known request, and always returns the request key. */
|
|
97
99
|
function toKey(key) {
|
|
98
|
-
if (!key ||
|
|
100
|
+
if (!key || flow.item(key))
|
|
99
101
|
return key;
|
|
100
102
|
const item = store.all().find((r) => r.key.toUpperCase() === key.toUpperCase() || r.issue?.toUpperCase() === key.toUpperCase());
|
|
101
103
|
// unknown key: it is taken as a new request (the connector says whether it exists)
|
|
@@ -211,7 +213,7 @@ export async function runWorkflow(cmd, rest) {
|
|
|
211
213
|
continue;
|
|
212
214
|
console.log(`${titles[role]}:`);
|
|
213
215
|
for (const b of xs)
|
|
214
|
-
console.log(` ${b.work.padEnd(12)} ${b.state.padEnd(15)} ${(b.next[0]?.command ?? "").padEnd(28)} ${b.takenBy ? `(taken by ${b.takenBy} since ${b.since?.slice(0, 16).replace("T", " ")})` : ""}`);
|
|
216
|
+
console.log(` ${b.work.padEnd(12)} ${b.state.padEnd(15)} ${(b.next[0]?.command ?? "").padEnd(28)} ${b.takenBy ? `(taken by ${b.takenBy} since ${b.since?.slice(0, 16).replace("T", " ")})` : ""}${b.recovered ? " ← state read from the ticket; this machine has no record" : ""}`);
|
|
215
217
|
}
|
|
216
218
|
return;
|
|
217
219
|
}
|
|
@@ -469,7 +471,8 @@ export async function runWorkflow(cmd, rest) {
|
|
|
469
471
|
case "status": {
|
|
470
472
|
if (has("json")) {
|
|
471
473
|
if (rest[0]) {
|
|
472
|
-
const
|
|
474
|
+
const k = toKey(rest[0]);
|
|
475
|
+
const item = flow.item(k) ?? await flow.peek(k);
|
|
473
476
|
const b = item ? flow.boardItem(item) : undefined;
|
|
474
477
|
return console.log(JSON.stringify(item ? { ...item, role: b.role, next: b.next, qa_status: b.qa, returned: b.returned, events: store.events(item.key) } : null, null, 2));
|
|
475
478
|
}
|
|
@@ -481,8 +484,10 @@ export async function runWorkflow(cmd, rest) {
|
|
|
481
484
|
}
|
|
482
485
|
if (rest[0]) {
|
|
483
486
|
const key = toKey(rest[0]);
|
|
484
|
-
const item =
|
|
487
|
+
const item = flow.item(key) ?? await flow.peek(key);
|
|
485
488
|
console.log(item ? JSON.stringify({ ...item, artifacts: Object.keys(item.artifacts) }, null, 2) : "unknown");
|
|
489
|
+
if (item?.recovered)
|
|
490
|
+
console.log(`State read from the ticket's label: this machine has no record of ${key}. Fetch its branch (git fetch origin orqen/${key.toLowerCase()}) to recover the full record.`);
|
|
486
491
|
for (const ev of store.events(key))
|
|
487
492
|
console.log(` ${ev.ts} ${ev.from} → ${ev.to} ${ev.detail}`);
|
|
488
493
|
}
|
|
@@ -531,6 +536,9 @@ export async function runWorkflow(cmd, rest) {
|
|
|
531
536
|
const { existsSync } = await import("node:fs");
|
|
532
537
|
const draft = parseDraft(draftInput());
|
|
533
538
|
const config = leerConfig(cfg.repoPath);
|
|
539
|
+
const { withSuggestedTransitions } = await import("../lib/connectors-edit.js");
|
|
540
|
+
const suggested = await withSuggestedTransitions(draft.conectores, { ...providerEnv(cfg.repoPath), ...draft.env });
|
|
541
|
+
draft.conectores = suggested.conectores;
|
|
534
542
|
config.conectores = draft.conectores;
|
|
535
543
|
if (config.general) {
|
|
536
544
|
const { updateGeneral } = await import("../lib/general-settings.js");
|
|
@@ -547,7 +555,10 @@ export async function runWorkflow(cmd, rest) {
|
|
|
547
555
|
const file = join(cfg.repoPath, RUTA_ENV);
|
|
548
556
|
escribirEnv(cfg.repoPath, readFileSync(file, "utf8"), clear);
|
|
549
557
|
}
|
|
550
|
-
|
|
558
|
+
console.log(`✔ Connectors saved in orqen/config.yaml. Provider accounts saved for this user in ${providerFile()}`);
|
|
559
|
+
if (suggested.added.length)
|
|
560
|
+
console.log(` Ticket moves proposed from the project columns for: ${suggested.added.join(", ")} (edit transitions in orqen/config.yaml).`);
|
|
561
|
+
return;
|
|
551
562
|
}
|
|
552
563
|
if (rest[0] === "setup") {
|
|
553
564
|
const { askConnectors } = await import("../lib/connectors-setup.js");
|
|
@@ -584,6 +595,39 @@ export async function runWorkflow(cmd, rest) {
|
|
|
584
595
|
process.exitCode = 1;
|
|
585
596
|
return;
|
|
586
597
|
}
|
|
598
|
+
case "comments": {
|
|
599
|
+
const json = has("json");
|
|
600
|
+
const key = toKey(rest[0]);
|
|
601
|
+
if (!key) {
|
|
602
|
+
console.error("Usage: orqen comments <KEY> [--json]");
|
|
603
|
+
process.exitCode = 1;
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
const { readClientChat } = await import("./client-chat.js");
|
|
607
|
+
const chat = await readClientChat(connectors.requests, key);
|
|
608
|
+
if (json)
|
|
609
|
+
return console.log(JSON.stringify(chat, null, 2));
|
|
610
|
+
console.log(`${chat.key} · ${chat.title} (${chat.tool})`);
|
|
611
|
+
for (const m of chat.messages)
|
|
612
|
+
console.log(`\n${m.from === "team" ? "→" : "←"} ${m.author || (m.from === "team" ? "orqen" : "client")}${m.created ? ` ${m.created.slice(0, 16).replace("T", " ")}` : ""}\n${m.text}`);
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
case "comment": {
|
|
616
|
+
try {
|
|
617
|
+
const key = toKey(rest[0]);
|
|
618
|
+
if (!key || !rest[1])
|
|
619
|
+
throw new Error("Usage: orqen comment <KEY> <message.md|-> [--person NAME]");
|
|
620
|
+
const text = rest[1] === "-" ? readFileSync(0, "utf8") : readFileSync(rest[1], "utf8");
|
|
621
|
+
const { replyToClient } = await import("./client-chat.js");
|
|
622
|
+
await replyToClient(connectors.requests, key, text, me);
|
|
623
|
+
console.log(`✔ answered on ${key}`);
|
|
624
|
+
}
|
|
625
|
+
catch (e) {
|
|
626
|
+
console.error(`✘ ${e.message}`);
|
|
627
|
+
process.exitCode = 1;
|
|
628
|
+
}
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
587
631
|
case "cycle":
|
|
588
632
|
if (!has("loop"))
|
|
589
633
|
return cycle();
|