feat(terminal): guide memory creation with prompts

This commit is contained in:
Codex committed 2026-09-28 12:22:05 +09:00
1 parent 8a1dee3c49
commit 8ffeb2897f
12 files changed
+133 -27

No files matched your search

+28 -1
View File
@@ -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']);