mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Compare commits
3
Commits
8459836d3b
...
v3.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e2dae64c6 | ||
|
|
b61e3c4052 | ||
|
|
a90fb8647c |
No files matched your search
@@ -1,10 +1,27 @@
|
||||
# General
|
||||
|
||||
### A new dialog wider than 440px needs max-width: none next to its width, sized like the Notebook dialog (min(1200px, 90vw)); the base .modal caps every dialog at 440px, so a width alone has no effect.
|
||||
- Kind: correction
|
||||
- About: src/web-console/public/styles/learning.css, src/web-console/public/styles/pieces.css
|
||||
- Why: The Lessons dialog declared width: min(720px, ...) without max-width: none and rendered about 440px wide.
|
||||
- Noted: 2026-11-15, quick-task
|
||||
|
||||
### A new file under src/web-console/ needs a row in the AGENTS-architecture console files tables; run scripts/test-web-console-shape.mjs after adding one, since it fails until the row exists.
|
||||
- Kind: convention
|
||||
- About: scripts/test-web-console-shape.mjs, .agents-docs/AGENTS-architecture-console-page.md
|
||||
- Noted: 2026-11-14, implement-review
|
||||
|
||||
### In a node:test file, start fixtures such as a test server in a root before hook, never with a top-level await after the first test(), which lets the runner run after hooks early
|
||||
- Kind: correction
|
||||
- About: scripts/test-script-deps.mjs
|
||||
- Why: test-script-deps.mjs awaited its server mid-file and 7 tests failed on Ubuntu and macOS CI only.
|
||||
- Noted: 2026-11-15, Failure log
|
||||
|
||||
### The launcher's prompts each open a new readline on stdin, so a test piping several answers at once loses all but the first; drive a multi-prompt flow by writing each answer after a short delay.
|
||||
- Kind: how-it-works
|
||||
- About: src/launcher/plan2code.js
|
||||
- Noted: 2026-11-15, implement-review
|
||||
|
||||
### When a card in src/plan2code-deps.md changes (what it lists or asks), change the same card in src/web-console/notes/deps.md in the same edit: the console builds the card from the notes.
|
||||
- Kind: correction
|
||||
- About: src/plan2code-deps.md, src/web-console/notes/deps.md
|
||||
|
||||
@@ -14,6 +14,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
- **web console**: a swaying question mark beside Ask for suggestions, and a chevron before Send.
|
||||
- **Snake**: lives, bonus lives at score marks, and three bosses (Grumpy Golem, Comet Queen, Thunder Toad).
|
||||
- **Bounce Road**: four new music tracks and extras.
|
||||
- **web console**: Ask for suggestions is on the Lessons to keep card, in the Notes panel and in the Lessons modal, where the reply shows in a Suggestions box.
|
||||
|
||||
### 🔧 Changed
|
||||
|
||||
@@ -28,6 +29,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
### 🐛 Fixed
|
||||
|
||||
- **Quick Task**: a finish that offers the review again after a review already ran in that launch is refused.
|
||||
- **web console**: the Lessons modal is as wide as the Notebook (it was stuck at the 440px default).
|
||||
|
||||
## v3.0.6
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// folder used as the whole PATH, replaying recorded tool output, so the suite
|
||||
// passes on a machine with none of the tools installed.
|
||||
|
||||
import { test, after } from "node:test";
|
||||
import { test, before, after } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { spawn } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
@@ -2215,12 +2215,14 @@ const HTTP_ROUTES = {
|
||||
"/hang": { hang: true },
|
||||
};
|
||||
|
||||
let httpChild = null;
|
||||
|
||||
async function httpServer(routes) {
|
||||
const dir = tmp("deps-http");
|
||||
fs.writeFileSync(path.join(dir, "server.mjs"), HTTP_SERVER);
|
||||
fs.writeFileSync(path.join(dir, "routes.json"), JSON.stringify(routes));
|
||||
const child = spawn(process.execPath, [path.join(dir, "server.mjs"), path.join(dir, "routes.json")], { stdio: ["ignore", "pipe", "inherit"] });
|
||||
after(() => child.kill());
|
||||
httpChild = child;
|
||||
const port = await new Promise((resolve, reject) => {
|
||||
child.stdout.once("data", (d) => resolve(Number(String(d).trim())));
|
||||
child.once("exit", (code) => reject(new Error(`the test HTTP server exited (${code})`)));
|
||||
@@ -2228,7 +2230,15 @@ async function httpServer(routes) {
|
||||
return `http://127.0.0.1:${port}`;
|
||||
}
|
||||
|
||||
const HTTP = await httpServer(HTTP_ROUTES);
|
||||
// Started in a root before hook, never with a top-level await here: tests are
|
||||
// already registered above, so node:test starts running them during such an
|
||||
// await, sees the root suite finish, and runs its after hooks (this server's
|
||||
// kill and fixtureCleanup) before the notes tests below ever run.
|
||||
let HTTP = null;
|
||||
before(async () => {
|
||||
HTTP = await httpServer(HTTP_ROUTES);
|
||||
});
|
||||
after(() => httpChild?.kill());
|
||||
|
||||
const noteRow = (lockfile, pkg, current, target, extra = {}) => ({ id: `${lockfile}#${pkg}`, package: pkg, current, target, jump: deps.jumpOf("npm", current, target), inRange: true, range: null, pinned: false, security: null, repo: null, pair: null, ...extra });
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ const chipOf = (s) => s.page.locator("#aside").getByRole("button", { name: "Ask
|
||||
|
||||
// What a person sees break: the chip on a card where there is nothing to pick,
|
||||
// on a settled record, or missing where they are unsure what to pick.
|
||||
test("the Ask for suggestions chip shows on open choice, multi and confirm cards only", async (t) => {
|
||||
test("the Ask for suggestions chip shows on open choice, multi, confirm and lessons cards only", async (t) => {
|
||||
const s = await openSession(await suite.browser(), {
|
||||
t,
|
||||
workflow: "plan",
|
||||
@@ -401,13 +401,14 @@ test("the Ask for suggestions chip shows on open choice, multi and confirm cards
|
||||
{ id: "c1", kind: "choice", title: "Export format", body: "Which format?", options: [opt("A", "CSV"), opt("B", "JSON")] },
|
||||
{ id: "m1", kind: "multi", title: "Columns", body: "Which?", options: [opt("1", "Date"), opt("2", "User")] },
|
||||
{ id: "y1", kind: "confirm", title: "Keep going", body: "Carry on?" },
|
||||
{ id: "l1", kind: "lessons", title: "Lessons to keep", body: "Choose for each one.", required: false, rows: [{ id: "r1", type: "lesson", text: "A lesson.", why: "", origin: "You said this.", note: "", flags: [], refused: null, area: "General", kind: "convention", about: ["a.js"], areas: ["General"], choices: ["Keep", "Reword", "Drop"] }] },
|
||||
{ id: "t1", kind: "text", title: "What to call it", body: "A name.", required: false },
|
||||
{ id: "d1", kind: "choice", title: "Old pick", body: "Which?", options: [opt("A", "CSV"), opt("B", "JSON")], status: "answered", answer: { k: "B" } },
|
||||
],
|
||||
agent: { status: "waiting" },
|
||||
},
|
||||
});
|
||||
for (const [id, title, shown] of [["c1", "Export format", 1], ["m1", "Columns", 1], ["y1", "Keep going", 1], ["t1", "What to call it", 0], ["d1", "Old pick", 0]]) {
|
||||
for (const [id, title, shown] of [["c1", "Export format", 1], ["m1", "Columns", 1], ["y1", "Keep going", 1], ["l1", "Lessons to keep", 1], ["t1", "What to call it", 0], ["d1", "Old pick", 0]]) {
|
||||
await goTo(s, id, title);
|
||||
assert.equal(await chipOf(s).count(), shown, `chip on ${id}`);
|
||||
if (shown) assert.equal(await textOf(chipOf(s)), "Ask for suggestions");
|
||||
|
||||
@@ -517,6 +517,28 @@ test("lessons card: Not now and the corner close leave every lesson waiting and
|
||||
}
|
||||
});
|
||||
|
||||
test("lessons card: the dialog has Ask for suggestions, which sends one request and shows the reply in a Suggestions box", async (t) => {
|
||||
const { s, dlg } = await reviewOpen(t);
|
||||
s.wait(10);
|
||||
postCard(s);
|
||||
await dlg.locator(".lessons-row").waitFor();
|
||||
const ask = dlg.getByRole("button", { name: "Ask for suggestions" });
|
||||
assert.equal(await ask.isDisabled(), false);
|
||||
assert.equal(await dlg.locator(".lessons-suggestions").count(), 0, "nothing asked yet");
|
||||
await ask.click();
|
||||
const got = s.wait(10);
|
||||
assert.equal(got.code, 0);
|
||||
const sentAction = got.actions.find((a) => a.suggest === true);
|
||||
assert.ok(sentAction, JSON.stringify(got.actions));
|
||||
assert.equal(sentAction.i, "lessons");
|
||||
assert.match(got.reply, /^Suggestions wanted on Lessons to keep:/m);
|
||||
await dlg.locator(".lessons-suggestions", { hasText: "Asking Plan2Code" }).waitFor();
|
||||
assert.equal(await dlg.getByRole("button", { name: "Ask for suggestions" }).isDisabled(), true, "one request waits at a time");
|
||||
assert.equal(await dlg.getByRole("button", { name: "Keep" }).count(), 1, "the lessons stay open to choose");
|
||||
s.post({ items: [{ id: "lessons", thread: [{ who: "agent", text: "1. Keep it: a real trap." }] }], agent: { status: "waiting" } });
|
||||
await dlg.locator(".lessons-suggestions", { hasText: "Keep it: a real trap." }).waitFor();
|
||||
});
|
||||
|
||||
test("lessons card: closing with choices made asks first, and Keep editing goes back", async (t) => {
|
||||
const { s, dlg } = await reviewOpen(t);
|
||||
s.wait(10);
|
||||
|
||||
@@ -834,7 +834,7 @@ export function renderAside() {
|
||||
|
||||
// The cards with options to pick from, where asking what Plan2Code would pick
|
||||
// makes sense.
|
||||
const SUGGEST_KINDS = ["choice", "multi", "confirm"];
|
||||
const SUGGEST_KINDS = ["choice", "multi", "confirm", "lessons"];
|
||||
|
||||
// Ask for suggestions: its own send, beside the main one (core.js). Focus
|
||||
// stays in the panel: on the chip when it is live again, else the note box.
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
// and is disabled whenever a card would be.
|
||||
|
||||
import { page, redraw, hooks, stage } from "../state.js";
|
||||
import { el, mdInto, lightDismiss } from "../render.js";
|
||||
import { el, md, mdInto, lightDismiss } from "../render.js";
|
||||
import { postJson } from "../net.js";
|
||||
import { sendState } from "../send-state.js";
|
||||
import { sendState, suggestState } from "../send-state.js";
|
||||
import { threadWho, threadText } from "../answers.js";
|
||||
import { loopDriving, isOpen, stagedCount, learningBusyNow } from "../selectors.js";
|
||||
|
||||
const TOP_STATES = new Set(["not-set-up", "off", "paused"]);
|
||||
@@ -345,6 +346,17 @@ export function renderLessonsDialog(on) {
|
||||
ask.appendChild(row);
|
||||
actions.appendChild(ask);
|
||||
} else {
|
||||
const suggest = suggestionsBox(item);
|
||||
if (suggest) actions.appendChild(suggest);
|
||||
// The Notes panel is not on this dialog, so its Ask for suggestions chip
|
||||
// is here: the same request, answered in the Suggestions box above.
|
||||
const st = suggestState(item);
|
||||
const ask = el("button", "btn ghost", "Ask for suggestions");
|
||||
ask.type = "button";
|
||||
ask.id = "lessons-suggest";
|
||||
ask.disabled = saving || st.disabled;
|
||||
ask.title = st.why || "";
|
||||
ask.addEventListener("click", () => hooks.askSuggestions(item.id));
|
||||
const later = el("button", "btn ghost", "Not now");
|
||||
later.type = "button";
|
||||
later.id = "lessons-later";
|
||||
@@ -356,7 +368,7 @@ export function renderLessonsDialog(on) {
|
||||
if (saving) go.appendChild(spinnerLabel("Saving…"));
|
||||
else go.textContent = "Save lessons";
|
||||
go.addEventListener("click", () => saveLessons(item));
|
||||
actions.append(later, go);
|
||||
actions.append(ask, later, go);
|
||||
if (stagedCount() > 1) actions.appendChild(el("p", "help", "Anything else ready to send goes with it."));
|
||||
}
|
||||
dlg.replaceChildren(card, actions, x);
|
||||
@@ -365,6 +377,29 @@ export function renderLessonsDialog(on) {
|
||||
dlg.scrollTop = scroll;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Suggestions box above the dialog's buttons: "Asking Plan2Code…" while a
|
||||
* request waits, then the agent's latest reply in the card's thread after the
|
||||
* last request. Null when nothing was asked.
|
||||
*/
|
||||
function suggestionsBox(item) {
|
||||
const thread = Array.isArray(item.thread) ? item.thread : [];
|
||||
let asked = -1;
|
||||
thread.forEach((m, i) => {
|
||||
if (m && m.suggest === true && threadWho(m) === "user") asked = i;
|
||||
});
|
||||
const waiting = item.sentNote && item.sentNote.suggest === true && !thread.slice(asked + 1).some((m) => threadWho(m) === "agent");
|
||||
const reply = asked >= 0 ? thread.slice(asked + 1).filter((m) => threadWho(m) === "agent").pop() : null;
|
||||
if (!waiting && !reply) return null;
|
||||
const box = el("div", "lessons-suggestions");
|
||||
box.id = "lessons-suggestions";
|
||||
box.setAttribute("role", "status");
|
||||
box.appendChild(el("h3", null, "Suggestions"));
|
||||
if (reply && !waiting) box.appendChild(md(threadText(reply), "md"));
|
||||
else box.appendChild(el("p", "help", "Asking Plan2Code. Its answer shows here."));
|
||||
return box;
|
||||
}
|
||||
|
||||
/**
|
||||
* The dialog's Save lessons, set again whenever what is staged changes,
|
||||
* including the quiet staging of typing (a Reword field emptied, a note): on
|
||||
|
||||
@@ -193,14 +193,19 @@
|
||||
.lessons-first-about { margin: 12px 0 0; }
|
||||
.lessons-later { margin-top: 8px; }
|
||||
|
||||
/* Review from the dashboard: the same card in a dialog over the menu. */
|
||||
.modal.lessons-dialog { width: min(720px, calc(100vw - 32px)); }
|
||||
.lessons-dialog .card { margin: 0; box-shadow: none; border: 0; padding: 0; }
|
||||
/* Review from the dashboard: the same card in a dialog over the menu. Sized
|
||||
like the Notebook dialog; max-width: none lifts the base .modal 440px cap. */
|
||||
.modal.lessons-dialog { width: min(1200px, 90vw); max-width: none; }
|
||||
.lessons-dialog .card { margin: 0; box-shadow: none; border: 0; padding: 0; max-width: none; }
|
||||
|
||||
/* The lessons dialog: closable (the corner ×, Not now, Escape), and locked
|
||||
while Save lessons goes. */
|
||||
.lessons-dialog .modal-actions { align-items: center; justify-content: flex-end; }
|
||||
.lessons-dialog .modal-actions .btn { margin: 0; }
|
||||
.lessons-suggestions { flex: 1 1 100%; padding: 10px 14px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: calc(var(--radius) * 0.5); }
|
||||
.lessons-suggestions h3 { margin: 0 0 6px; font-size: 13.5px; }
|
||||
.lessons-suggestions .md { max-height: 40vh; overflow: auto; font-size: 13.5px; }
|
||||
.lessons-dialog .modal-actions { flex-wrap: wrap; }
|
||||
.lessons-dialog .modal-actions .btn .spinner { margin-right: 8px; }
|
||||
.modal-x {
|
||||
position: absolute;
|
||||
|
||||
+1
-1
@@ -17,6 +17,6 @@
|
||||
"url": "https://github.com/jparkerweb/plan2code"
|
||||
},
|
||||
"homepage": "https://github.com/jparkerweb/plan2code",
|
||||
"releaseDate": "2026-11-14",
|
||||
"releaseDate": "2026-11-15",
|
||||
"mode": "utility"
|
||||
}
|
||||
Reference in new issue
Block a user