openmill 0.2.0 → 0.2.1
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/bin/openmill.mjs +25 -11
- package/package.json +1 -1
package/dist/bin/openmill.mjs
CHANGED
|
@@ -321,7 +321,7 @@ function jobsToStart(graph, jobs, slots) {
|
|
|
321
321
|
}
|
|
322
322
|
// package.json
|
|
323
323
|
var name = "openmill";
|
|
324
|
-
var version = "0.2.
|
|
324
|
+
var version = "0.2.1";
|
|
325
325
|
var description = "A local software factory that turns design docs into pull requests.";
|
|
326
326
|
// ../server/src/config-store.ts
|
|
327
327
|
async function readConfig(path) {
|
|
@@ -611,17 +611,19 @@ function loadClaudeAgents() {
|
|
|
611
611
|
return agents;
|
|
612
612
|
}
|
|
613
613
|
// ../server/src/harness/prompt.ts
|
|
614
|
+
const CONCLUDE = "Before you report the result, write your conclusion as a normal message so a human who resumes this session can read why you stopped.";
|
|
614
615
|
function startPrompt(input) {
|
|
615
616
|
const facts = [
|
|
616
617
|
input.projectPath ? `The project overview is at ${input.projectPath}.` : void 0,
|
|
617
618
|
`You are already in your worktree on branch ${input.branch}, so don't create another branch or worktree.`,
|
|
618
619
|
`Open the draft PR against ${input.prBaseBranch}.`,
|
|
619
|
-
"No human is present. Wherever the skill says to ask or tell the user, stop and report needs_input with the question as reason."
|
|
620
|
+
"No human is present. Wherever the skill says to ask or tell the user, stop and report needs_input with the question as reason.",
|
|
621
|
+
CONCLUDE
|
|
620
622
|
].filter(Boolean);
|
|
621
623
|
return `/${PLUGIN_NAME}:${WORKFLOW_SKILL} ${input.docPath}\n\n${facts.map((fact) => `- ${fact}`).join("\n")}\n`;
|
|
622
624
|
}
|
|
623
|
-
const HANDBACK_MESSAGE =
|
|
624
|
-
const RESTART_MESSAGE =
|
|
625
|
+
const HANDBACK_MESSAGE = `openmill handed this job back to you after a human worked on it. Check the worktree and the conversation, continue the workflow until the draft PR is open, then report the result. ${CONCLUDE}`;
|
|
626
|
+
const RESTART_MESSAGE = `The openmill server restarted while you were working. Check the worktree, continue the workflow from where you stopped, then report the result. ${CONCLUDE}`;
|
|
625
627
|
// ../server/src/harness/types.ts
|
|
626
628
|
const RUN_STATUSES = [
|
|
627
629
|
"done",
|
|
@@ -1876,6 +1878,17 @@ async function unwrap(response) {
|
|
|
1876
1878
|
}
|
|
1877
1879
|
return body;
|
|
1878
1880
|
}
|
|
1881
|
+
function fitLastColumn(header, rows) {
|
|
1882
|
+
const columns = process.stdout.isTTY ? process.stdout.columns : void 0;
|
|
1883
|
+
const last = header.length - 1;
|
|
1884
|
+
const used = header.slice(0, last).reduce((sum, title, column) => sum + Math.max(title.length, ...rows.map((row) => stripVTControlCharacters(row[column] ?? "").length)) + 2, 0);
|
|
1885
|
+
const room = columns ? Math.max(columns - used, header[last]?.length ?? 0) : 1e400;
|
|
1886
|
+
return rows.map((row) => {
|
|
1887
|
+
const text = (row[last] ?? "").replace(/\s+/g, " ").trim();
|
|
1888
|
+
const cell = text.length > room ? `${text.slice(0, room - 1)}…` : text;
|
|
1889
|
+
return [...row.slice(0, last), cell];
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1879
1892
|
function table(header, rows) {
|
|
1880
1893
|
const widths = header.map((title, column) => Math.max(title.length, ...rows.map((row) => stripVTControlCharacters(row[column] ?? "").length)));
|
|
1881
1894
|
return [header.map((title) => pc.dim(title)), ...rows].map((row) => row.map((cell, column) => cell + " ".repeat((widths[column] ?? 0) - stripVTControlCharacters(cell).length)).join(" ").trimEnd()).join("\n");
|
|
@@ -1911,19 +1924,20 @@ program.command("add").description("queue design docs as jobs").argument("<paths
|
|
|
1911
1924
|
});
|
|
1912
1925
|
program.command("ls").description("list jobs").action(async () => {
|
|
1913
1926
|
const { jobs } = await unwrap((await connect()).jobs.$get());
|
|
1914
|
-
|
|
1927
|
+
const header = [
|
|
1915
1928
|
"ID",
|
|
1916
1929
|
"STATE",
|
|
1917
|
-
"REASON",
|
|
1918
1930
|
"SESSION",
|
|
1919
|
-
"PR"
|
|
1920
|
-
|
|
1931
|
+
"PR",
|
|
1932
|
+
"REASON"
|
|
1933
|
+
];
|
|
1934
|
+
console.log(table(header, fitLastColumn(header, jobs.map((job) => [
|
|
1921
1935
|
pc.bold(job.id),
|
|
1922
1936
|
state(job.state),
|
|
1923
|
-
job.reason ?? "",
|
|
1924
1937
|
pc.dim(job.sessionId ?? ""),
|
|
1925
|
-
job.prUrl ?? ""
|
|
1926
|
-
|
|
1938
|
+
job.prUrl ?? "",
|
|
1939
|
+
job.reason ?? ""
|
|
1940
|
+
]))));
|
|
1927
1941
|
});
|
|
1928
1942
|
program.command("show").description("show a job and how to resume its session").argument("<id>").action(async (id) => {
|
|
1929
1943
|
const job = await unwrap((await connect()).jobs[":id"].$get({
|