Make Project Management a native feature

- Move the storage and model of the plugin into src/lib/features/pm/ as pure TypeScript, so the skill can still bundle them.
- Move the DOM interface onto the host menus, the shared tooltip, and the host icons.
- A ribbon button opens Project Management. Board tabs keep the owner runestone.pm and the board-<hex> view IDs through view patterns.
- Read only .runestone/pm/. Offer the plugin migration, with backups, for legacy notes.
- A save, move, or delete reads only that card again. Watcher paths reach the feature.
- Add Settings → Project Management and the projectManagement section. View states move to localStorage.
- Background reads the boards from workspace.json. Remove api.backgrounds and the boards service.
- Add yaml 2.9.1. Use the host markdown-it.
- Move 18 plugin test files to tests/unit/features/pm/ and add native tests.
This commit is contained in:
Knotty Wyvern
2026-10-29 20:54:29 -07:00
parent e6deecc092
commit e66f089176
100 changed files with 14412 additions and 290 deletions
+25 -19
View File
@@ -1,32 +1,35 @@
// Find in plug-in views: privacy attributes, Project Management views, plug-in documents, custom find handlers, focus, both themes, and narrow layouts.
// @requires repo:RuneStone_Project_Management/dist/plugin
// Project Management is a native feature. Its board is in the hidden storage of the workspace (.runestone/pm/).
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
import path from 'node:path';
import { mockTauri, outputDir, pluginRepo, runSmoke, smokeUrl } from '../_harness/index.mjs';
import { mockTauri, outputDir, runSmoke, smokeUrl } from '../_harness/index.mjs';
const board = {
schema: 1, kind: 'board', id: 'host-find-board',
lists: [
{ id: 'todo', name: 'To do', status: 'todo', collapsed: false },
{ id: 'doing', name: 'In progress', status: 'doing', collapsed: false },
{ id: 'done', name: 'Done', status: 'done', collapsed: false },
],
defaults: { todo: 'todo', doing: 'doing', done: 'done' },
};
await runSmoke('find/pluginViews', async ({ page }) => {
const output = await outputDir('find/pluginViews');
const pmDist = pluginRepo('RuneStone_Project_Management/dist/plugin');
const pm = {
manifest: JSON.parse(await readFile(path.join(pmDist, 'plugin.json'), 'utf8')),
code: await readFile(path.join(pmDist, 'main.js'), 'utf8'),
};
// Unknown commands return null, as the original mock did.
await mockTauri(page, {
strict: false,
state: { pm },
state: { catalog: JSON.stringify({ schema: 1, boards: [{ name: 'Find board', value: board }] }, null, 2) + '\n' },
commands: test => {
const workspace = test.workspace({
root: 'C:/find-test',
files: {
'untitled.md': '# Existing note\n',
'sample.finddoc': 'Alpha alpha alphabet',
'Board.md': '---\nrunestone_pm:\n schema: 1\n kind: board\n id: host-find-board\n lists:\n - {id: todo, name: To do, status: todo, collapsed: false}\n - {id: doing, name: In progress, status: doing, collapsed: false}\n - {id: done, name: Done, status: done, collapsed: false}\n defaults: {todo: todo, doing: doing, done: done}\n---\n',
'.runestone/pm/.gitignore': '*\n',
'.runestone/pm/workspace.json': test.state.catalog,
},
});
test.files = workspace.files;
const { pm } = test.state;
const manifest = { schemaVersion: 1, id: 'test.find', name: 'Find test', author: 'Test', description: 'Search checks', version: '1.0.0', apiVersion: 1, entry: 'main.js', access: 'full-app' };
const code = `export function activate(api) {
api.registerDocumentType({ id: 'document', title: 'Test document', extensions: ['finddoc'], identify: path => ({ id: path }), mount(root) {
@@ -43,8 +46,8 @@ await runSmoke('find/pluginViews', async ({ page }) => {
if (!workspace.files.has(args.rel) && args.missingOk) return null;
return workspace.workspace_read(args);
},
plugins_snapshot: () => ({ root: 'C:/test/plugins', plugins: [manifest, pm.manifest].map(item => ({ manifest: item, hash: item.id, enabled: true, path: 'C:/test/plugins/' + item.id, error: null, removal: false })) }),
plugins_load: args => args.id === pm.manifest.id ? pm.code : code,
plugins_snapshot: () => ({ root: 'C:/test/plugins', plugins: [manifest].map(item => ({ manifest: item, hash: item.id, enabled: true, path: 'C:/test/plugins/' + item.id, error: null, removal: false })) }),
plugins_load: () => code,
plugins_data: () => 'null',
browser_connect: () => 'test',
};
@@ -99,11 +102,14 @@ await runSmoke('find/pluginViews', async ({ page }) => {
await page.screenshot({ path: `${output}/${name}-${theme}-narrow.png` });
await page.setViewportSize({ width: 1440, height: 1000 });
}
for (const surface of ['all-tasks', 'board-document']) {
if (surface === 'all-tasks') {
await page.getByRole('button', { name: 'Plug-in views', exact: true }).click();
await page.getByRole('menuitem', { name: /^Project Management/ }).click();
} else await page.getByRole('tree', { name: 'Workspace files' }).getByText('Board', { exact: true }).dblclick();
for (const surface of ['all-tasks', 'board']) {
// The ribbon button opens All tasks. The board scope opens the board in the same tab.
if (surface === 'all-tasks') await page.locator('.plugin-ribbon').getByRole('button', { name: 'Project Management', exact: true }).click();
else {
await page.locator('.plugin-editor-pane:visible').getByRole('button', { name: /^Board scope:/ }).click();
await page.getByRole('menuitemradio', { name: 'Find board', exact: true }).click();
await page.getByRole('tab', { name: 'Find board', exact: true }).waitFor();
}
const pane = page.locator('.plugin-editor-pane:visible');
await pane.locator('.pm-board').waitFor();
await pane.focus();