mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-05 00:15:41 -08:00
Sync upstream v3.2.6: Loop checkboxes, Notes drag handle, US English replies, app update fetch (v3.2.6)
- Implement's and Review's confirm panes carry a Loop checkbox in place of the dashboard's loop cards; loop end-screen buttons show a spinner. - The stacked Notes panel gets a drag handle. - Every skill prompt and the console contracts say to reply in US English. - The desktop app offers Update to latest when the skills are newer, and plan2code update refetches an app that install.json does not record. - Devin Balanced maps to Sonnet 5.5 Medium.
This commit is contained in:
1 parent
9629961f36
commit
658c813428
70 files changed
+818
-242
No files matched your search
+31
-12
@@ -2942,7 +2942,8 @@ const INSTALL_PIECES = ['skills', 'launcher', 'app', 'statusline', 'metrics', 'b
|
||||
const LAUNCHER_PICK_FOLDER_FLAG = '--pick-folder';
|
||||
|
||||
/**
|
||||
* `~/.plan2code/install.json` as `{ version, scope, pieces }`, or null when missing or unparsable.
|
||||
* `~/.plan2code/install.json` as `{ version, scope, pieces, appVersion? }`, or null when missing or unparsable.
|
||||
* `appVersion` is the release the desktop app file is, set when the app is placed (see appCurrent()).
|
||||
* `skipped` lists optional pieces (the desktop app) the person said no to, so an unattended
|
||||
* `plan2code update` does not install them; it is left out of the file while empty.
|
||||
*/
|
||||
@@ -2960,12 +2961,15 @@ function readInstallRecord() {
|
||||
let recordVersionHold = null;
|
||||
|
||||
/** Temp file, then rename, so a crash never leaves a half-written record. A failure only skips the record. */
|
||||
function writeInstallRecord(pieces, skipped = (readInstallRecord() || {}).skipped || [], version = recordVersionHold ? recordVersionHold.version : projectVersion.version) {
|
||||
function writeInstallRecord(pieces, skipped = (readInstallRecord() || {}).skipped || [], version = recordVersionHold ? recordVersionHold.version : projectVersion.version, appVersion = (readInstallRecord() || {}).appVersion) {
|
||||
const record = {
|
||||
version,
|
||||
scope: 'global',
|
||||
pieces: [...new Set(pieces)].filter((piece) => INSTALL_PIECES.includes(piece)).sort(),
|
||||
};
|
||||
// Which release the desktop app file is, kept apart from `version`: that one is stamped by the
|
||||
// skills step before the app is placed, so it cannot say whether the app file is current.
|
||||
if (record.pieces.includes('app') && typeof appVersion === 'string' && appVersion) record.appVersion = appVersion;
|
||||
const declined = [...new Set(skipped)].filter((piece) => INSTALL_PIECES.includes(piece) && !record.pieces.includes(piece)).sort();
|
||||
if (declined.length > 0) record.skipped = declined;
|
||||
const tmp = `${INSTALL_RECORD}.${process.pid}.tmp`;
|
||||
@@ -3000,10 +3004,21 @@ function installedLauncherVersion() {
|
||||
}
|
||||
}
|
||||
|
||||
/** Add a piece after a successful global install. */
|
||||
function recordInstalled(piece) {
|
||||
/** Add a piece after a successful global install; `appVersion` names the release the desktop app file is. */
|
||||
function recordInstalled(piece, { appVersion } = {}) {
|
||||
const record = readInstallRecord();
|
||||
writeInstallRecord([...(record ? record.pieces : []), piece]);
|
||||
writeInstallRecord([...(record ? record.pieces : []), piece], undefined, undefined, appVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the desktop app file is the release `version`: true when the record lists no app, else
|
||||
* only when it names that release. A record from before `appVersion` existed, or one an update
|
||||
* stamped while the app stayed old, says no, so the next update fetches the app instead of
|
||||
* stopping at "Already on".
|
||||
*/
|
||||
function appCurrent(version, record = readInstallRecord()) {
|
||||
if (!record || !record.pieces.includes('app')) return true;
|
||||
return record.appVersion === version;
|
||||
}
|
||||
|
||||
/** Remember that an optional piece was declined. Needs a record: one holding no pieces would make update do nothing. */
|
||||
@@ -3609,7 +3624,7 @@ async function installDesktopApp({ quiet = false, unattended = false, outcome =
|
||||
} catch (error) {
|
||||
return fail(`the file was verified but could not be put in ${APP_DIR} (${error.message}); close the app and try again.`);
|
||||
}
|
||||
recordInstalled('app');
|
||||
recordInstalled('app', { appVersion: version });
|
||||
outcome.appSize = bytes.length;
|
||||
console.log(` ${COLORS.GREEN}${MARKS.DONE}${COLORS.RESET} Installed: ${APP_DEST}`);
|
||||
console.log(` The app is not code-signed. ${appAllowLine()}`);
|
||||
@@ -4154,12 +4169,13 @@ function releaseNotesUrl(version) {
|
||||
* Reinstall whatever ~/.plan2code/install.json lists, without the menu or any prompt, and print
|
||||
* one compact summary: `Updating <old> -> <new>` (or `Already on <new>`, which stops early unless
|
||||
* `force`, and only when the installed command's bin/version.json agrees with the record whenever
|
||||
* the record lists `launcher`, and the canonical skills manifest and the shared console are complete
|
||||
* for it whenever the record lists `skills`), one line per piece by its human name, then the release notes link and the restart
|
||||
* the record lists `launcher`, the canonical skills manifest and the shared console are complete
|
||||
* for it whenever the record lists `skills`, and the record names this version as the app's whenever it
|
||||
* lists `app`), one line per piece by its human name, then the release notes link and the restart
|
||||
* hint. Each piece's own output is held back and shown only when that piece warns or fails.
|
||||
* Returns the exit code: 0 when every piece updated, 1 naming the pieces that failed.
|
||||
*/
|
||||
async function update({ steps = UPDATE_STEPS, cleanShims = removeLegacyLoopShims, force = false, skillsCurrent = canonicalSkillsCurrent, consoleCurrent = sharedConsoleCurrent, progress = writeProgressToStdout, devTools = devToolCapabilities() } = {}) {
|
||||
async function update({ steps = UPDATE_STEPS, cleanShims = removeLegacyLoopShims, force = false, skillsCurrent = canonicalSkillsCurrent, consoleCurrent = sharedConsoleCurrent, appInPlaceFor = appCurrent, progress = writeProgressToStdout, devTools = devToolCapabilities() } = {}) {
|
||||
const record = readInstallRecord();
|
||||
const version = projectVersion.version;
|
||||
const before = record && typeof record.version === 'string' ? record.version : null;
|
||||
@@ -4175,7 +4191,10 @@ async function update({ steps = UPDATE_STEPS, cleanShims = removeLegacyLoopShims
|
||||
// And the shared console the skills forward to: its folder complete for this version, named by
|
||||
// console-dir, with no interrupted copy or backup of it left beside it.
|
||||
const consoleInPlace = sameVersion && pieces.includes('skills') ? consoleCurrent(version) : true;
|
||||
if (sameVersion && skillsInPlace && consoleInPlace && !force) {
|
||||
// And the desktop app file: the record's version is stamped before the app step runs, so an app
|
||||
// left on an older release under a new record would otherwise never be fetched.
|
||||
const appInPlace = sameVersion && pieces.includes('app') ? appInPlaceFor(version, record) : true;
|
||||
if (sameVersion && skillsInPlace && consoleInPlace && appInPlace && !force) {
|
||||
console.log(`${COLORS.GREEN}${MARKS.DONE}${COLORS.RESET} Already on ${version}`);
|
||||
console.log(`${COLORS.DIM}Run plan2code update --force to install it again.${COLORS.RESET}`);
|
||||
return 0;
|
||||
@@ -4184,8 +4203,8 @@ async function update({ steps = UPDATE_STEPS, cleanShims = removeLegacyLoopShims
|
||||
if (before === version && launcherVersion !== version && !force) {
|
||||
console.log(`${COLORS.DIM}The plan2code command is still on ${launcherVersion || 'an unknown version'}, so everything is installed again.${COLORS.RESET}`);
|
||||
}
|
||||
if (sameVersion && (!skillsInPlace || !consoleInPlace) && !force) {
|
||||
const unfinished = [!skillsInPlace && 'the installed skills do not match it on disk', !consoleInPlace && 'the shared console is not complete'].filter(Boolean).join(' and ');
|
||||
if (sameVersion && (!skillsInPlace || !consoleInPlace || !appInPlace) && !force) {
|
||||
const unfinished = [!skillsInPlace && 'the installed skills do not match it on disk', !consoleInPlace && 'the shared console is not complete', !appInPlace && `the desktop app is not recorded at ${version}`].filter(Boolean).join(' and ');
|
||||
console.log(`${COLORS.DIM}${version} is installed, but ${unfinished}, so it is installed again.${COLORS.RESET}`);
|
||||
}
|
||||
if (!record) console.log(`${COLORS.DIM}No install record found; updating the skills and the plan2code command.${COLORS.RESET}`);
|
||||
|
||||
Reference in new issue
Block a user