feat: establish tokenized kanban design foundation

This commit is contained in:
zenchantlive 2026-02-11 18:38:51 -08:00
parent d82452b89c
commit ce2010fd92
18 changed files with 1544 additions and 162 deletions

View file

@ -0,0 +1,34 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import path from 'node:path';
const ROOT = process.cwd();
const TARGET_DIRS = ['src/components/kanban', 'src/components/shared'];
const INLINE_STYLE_PATTERN = /\bstyle\s*=\s*\{\s*\{/m;
async function collectTsxFiles(relativeDir) {
const absoluteDir = path.join(ROOT, relativeDir);
const entries = await fs.readdir(absoluteDir, { withFileTypes: true });
return entries
.filter((entry) => entry.isFile() && entry.name.endsWith('.tsx'))
.map((entry) => path.join(absoluteDir, entry.name));
}
test('kanban and shared components do not use inline style objects', async () => {
const files = (await Promise.all(TARGET_DIRS.map(collectTsxFiles))).flat();
const offenders = [];
for (const filePath of files) {
const content = await fs.readFile(filePath, 'utf8');
if (INLINE_STYLE_PATTERN.test(content)) {
offenders.push(path.relative(ROOT, filePath));
}
}
assert.deepEqual(
offenders,
[],
`Inline style objects found in: ${offenders.join(', ')}`,
);
});

View file

@ -4,7 +4,7 @@ import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { readIssuesFromDisk, resolveIssuesJsonlPath } from '../../src/lib/read-issues';
import { readIssuesFromDisk, resolveIssuesJsonlPath, resolveIssuesJsonlPathCandidates } from '../../src/lib/read-issues';
import { sameWindowsPath } from '../../src/lib/pathing';
test('resolveIssuesJsonlPath appends .beads/issues.jsonl using windows-safe pathing', () => {
@ -12,6 +12,12 @@ test('resolveIssuesJsonlPath appends .beads/issues.jsonl using windows-safe path
assert.equal(sameWindowsPath(resolved, 'C:/Repo/Project/.beads/issues.jsonl'), true);
});
test('resolveIssuesJsonlPathCandidates includes .jsonl and .jsonl.new fallback paths', () => {
const [primary, fallback] = resolveIssuesJsonlPathCandidates('C:/Repo/Project');
assert.equal(sameWindowsPath(primary, 'C:/Repo/Project/.beads/issues.jsonl'), true);
assert.equal(sameWindowsPath(fallback, 'C:/Repo/Project/.beads/issues.jsonl.new'), true);
});
test('readIssuesFromDisk parses JSONL issues from disk', async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'beadboard-read-'));
const beadsDir = path.join(root, '.beads');
@ -39,3 +45,19 @@ test('readIssuesFromDisk returns empty list when issues file does not exist', as
const issues = await readIssuesFromDisk({ projectRoot: root });
assert.deepEqual(issues, []);
});
test('readIssuesFromDisk falls back to issues.jsonl.new when issues.jsonl is missing', async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'beadboard-read-fallback-'));
const beadsDir = path.join(root, '.beads');
const fallbackPath = path.join(beadsDir, 'issues.jsonl.new');
await fs.mkdir(beadsDir, { recursive: true });
await fs.writeFile(
fallbackPath,
JSON.stringify({ id: 'bb-fallback', title: 'From fallback', status: 'open', priority: 2, issue_type: 'task' }),
'utf8',
);
const issues = await readIssuesFromDisk({ projectRoot: root });
assert.equal(issues.length, 1);
assert.equal(issues[0].id, 'bb-fallback');
});