feat(terminal): guide memory creation with prompts
This commit is contained in:
1 parent
8a1dee3c49
commit
8ffeb2897f
12 files changed
+133
-27
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ const meta = new URL("../dist/.openai/", import.meta.url);
|
||||
await rm(dist, { recursive: true, force: true });
|
||||
await Promise.all([mkdir(server, { recursive: true }), mkdir(meta, { recursive: true })]);
|
||||
const [rawIndexHtml, addonsJs, bootGuardJs, i18nJs, tasksJs, calendarJs, i18nRenderersJs, desktopPersonalizationJs, desktopWidgetsJs, browserAppJs, dataActionsJs, terminalAppJs, manifest, serviceWorker, icon, localeEn, localeZh] = await Promise.all([text("index.html"), text("addons.js"), text("boot-guard.js"), text("i18n.js"), text("tasks.js"), text("calendar.js"), text("i18n-renderers.js"), text("desktop-personalization.js"), text("desktop-widgets.js"), text("browser-app.js"), text("data-actions.js"), text("terminal-app.js"), text("manifest.webmanifest"), text("service-worker.js"), text("life-os-icon.svg"), readFile(new URL("../public/locales/en.json", import.meta.url), "utf8"), readFile(new URL("../public/locales/zh-CN.json", import.meta.url), "utf8")]);
|
||||
const release = "1.10.0";
|
||||
const release = "1.11.0";
|
||||
const localeEnJs = `window.LifeOSLocales=window.LifeOSLocales||{};window.LifeOSLocales.en=${localeEn};`;
|
||||
const localeZhJs = `window.LifeOSLocales=window.LifeOSLocales||{};window.LifeOSLocales['zh-CN']=${localeZh};`;
|
||||
let indexHtml = rawIndexHtml.replace('src="addons.js"', `src="addons.js?v=${release}"`).replace('src="tasks.js"', `src="tasks.js?v=${release}"`).replace('src="calendar.js"', `src="calendar.js?v=${release}"`);
|
||||
|
||||
+28
-1
@@ -97,7 +97,34 @@ assert.equal(terminalStorage.get('lifeos_memories')[0].text, 'Finished lab');
|
||||
assert.equal(terminalStorage.get('lifeos_memories')[0].tags[0], 'school');
|
||||
assert.throws(() => command('memory add "Again" --text "Duplicate"'), /memoryExists/);
|
||||
assert.throws(() => command('goal add "Invalid date" --due 2026-02-30'), /invalidDate/);
|
||||
assert.equal(command('memory add "Multiline" --date 2026-09-29').compose.title, 'Multiline');
|
||||
assert.match(command('memory add "Multiline" --date 2026-09-29').message, /terminal\.wizard\.tags/);
|
||||
assert.match(command('back').message, /terminal\.wizard\.date/);
|
||||
assert.match(command('2026-09-29').message, /terminal\.wizard\.tags/);
|
||||
assert.equal(command('cancel').cancel, true);
|
||||
assert.equal(command('memory add').message.includes('terminal.wizard.title'), true);
|
||||
assert.match(command('A second memory').message, /terminal\.wizard\.date/);
|
||||
assert.match(command('2026-09-30').message, /terminal\.wizard\.tags/);
|
||||
assert.match(command('school, lab').message, /terminal\.wizard\.energy/);
|
||||
assert.match(command('5').message, /terminal\.wizard\.mood/);
|
||||
assert.match(command('rain').message, /terminal\.wizard\.location/);
|
||||
assert.match(command('Campus').message, /terminal\.wizard\.taskId/);
|
||||
const wizardDraft = command('1').compose;
|
||||
assert.equal(wizardDraft.title, 'A second memory');
|
||||
assert.equal(wizardDraft.taskId, terminalStorage.get('lifeos_system').tasksBoard.tasks[0].id);
|
||||
terminalContext.LifeOSActions.createMemory({ ...wizardDraft, text: 'Multiline body' });
|
||||
terminalContext.LifeOSTerminalEngine.finishWizard();
|
||||
assert.equal(terminalStorage.get('lifeos_memories').length, 2);
|
||||
const terminalUiNodes = Object.fromEntries(['.terminal-output','.terminal-form','.terminal-compose','.terminal-input','.terminal-note','.terminal-shortcuts'].map(selector => [selector, { value: '', hidden: false, listeners: {}, children: [], focus() {}, addEventListener(type, handler) { this.listeners[type] = handler; }, replaceChildren() { this.children = []; }, append(child) { this.children.push(child); } }]));
|
||||
const terminalUi = { innerHTML: '', dataset: {}, querySelector(selector) { return selector === '.terminal-shell' ? (this.innerHTML ? {} : null) : terminalUiNodes[selector]; } };
|
||||
terminalContext.terminalApp(terminalUi);
|
||||
const submitTerminal = value => { terminalUiNodes['.terminal-input'].value = value; terminalUiNodes['.terminal-form'].listeners.submit({ preventDefault() {} }); };
|
||||
submitTerminal('memory add "Via UI" --date 2026-10-01');
|
||||
for (let index = 0; index < 5; index++) submitTerminal('');
|
||||
assert.equal(terminalUiNodes['.terminal-compose'].hidden, false, 'guided memory input reaches the multiline note');
|
||||
terminalUiNodes['.terminal-note'].value = 'A note from the guided form';
|
||||
terminalUiNodes['.terminal-compose'].listeners.click({ target: { closest: () => ({ dataset: { note: 'save' } }) } });
|
||||
assert.equal(terminalStorage.get('lifeos_memories').find(item => item.date === '2026-10-01').text, 'A note from the guided form');
|
||||
assert.equal(terminalUiNodes['.terminal-compose'].hidden, true);
|
||||
assert.equal(command('open calendar').message, 'terminal.opened');
|
||||
assert.ok(terminalRenders.includes('calendar'));
|
||||
assert.deepEqual(Array.from(terminalContext.LifeOSTerminalEngine.words('task add "quoted title" --priority high')), ['task','add','quoted title','--priority','high']);
|
||||
|
||||
Reference in new issue
Block a user