feat: comprehensive design system overhaul

Applied impeccable design critique, audit, harden, layout, distill, and polish across all pages.

DESIGN SYSTEM:
- Created PRODUCT.md (5 design principles, WCAG 2.1 AA target)
- Created DESIGN.md (34 color tokens, 6 radius scale, full component spec)
- Created .impeccable/design.json (sidecar with tonal ramps, shadows, motion)

ACCESSIBILITY:
- 33 aria-labels across 7 pages (was ~13)
- 63 <label> elements (was ~30)
- 6 <main> landmarks + role=navigation on all sidebars
- Esc to close modals on 4 pages
- Keyboard shortcuts (Ctrl+J/K, Ctrl+F) on chat

THEMING:
- 216 hardcoded colors replaced with var() references
- 449 !important removed from dark-mode.css
- Dark mode script unified (was duplicated 9x inline)
- All modals converted to .modal-overlay + .modal design system classes

CHAT:
- Error states for messages (.msg.erro, .msg.enviando)
- Connection status indicator
- Confirmation modal before finalizar
- Input bar reorganized (3 visible actions, + menu)
- Right panel accordions
- Send button disabled when empty
- Touch targets 44px on mobile

CLIENT DETAIL:
- Tabs/badges/sub-tabs use CSS classes instead of inline styles
- 'Iniciar Conversa' button now primary action
- alert() replaced with inline feedback
- Modal converted to design system classes

CLIENT LIST:
- Modal moved inside <body> (was HTML-invalid)
- alert() replaced with inline feedback
- Modal uses .show pattern

SETTINGS:
- 4 modals converted to design system classes
- 14 alert() calls replaced with inline feedback
- fecharModal() uses classList instead of style.display

ROUTES:
- border-radius normalized, hardcoded colors fixed

Score progression:
  Chat:        23 → 32/40
  Client List: 32 → 35/40
  Client Detail: 26 → 30/40
  Settings:     29 → 35/40
  Routes:       37 → 38/40
  Audit (project): 14/20 → 17/20
This commit is contained in:
2026-06-23 16:58:12 +00:00
parent cf720c37a1
commit 12d419de7c
113 changed files with 52423 additions and 951 deletions
+214
View File
@@ -0,0 +1,214 @@
#!/usr/bin/env node
/**
* Pin/unpin sub-commands as standalone skill shortcuts.
*
* Usage:
* node <scripts_path>/pin.mjs pin <command>
* node <scripts_path>/pin.mjs unpin <command>
*
* `pin audit` creates a lightweight /audit skill that redirects to /impeccable audit.
* `unpin audit` removes that shortcut.
*
* The script discovers harness directories (.claude/skills, .cursor/skills, etc.)
* in the project root and creates/removes the pin in all of them.
*/
import { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, readdirSync } from 'node:fs';
import { join, resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
// All known harness directories
const HARNESS_DIRS = [
'.claude', '.cursor', '.gemini', '.codex', '.agents',
'.trae', '.trae-cn', '.pi', '.opencode', '.kiro', '.rovodev',
];
// Valid sub-command names
const VALID_COMMANDS = [
'craft', 'init', 'extract', 'document', 'shape',
'critique', 'audit',
'polish', 'bolder', 'quieter', 'distill', 'harden', 'onboard', 'live',
'animate', 'colorize', 'typeset', 'layout', 'delight', 'overdrive',
'clarify', 'adapt', 'optimize',
];
// Marker to identify pinned skills (so unpin doesn't delete user skills)
const PIN_MARKER = '<!-- impeccable-pinned-skill -->';
/**
* Walk up from startDir to find a project root.
*/
function findProjectRoot(startDir = process.cwd()) {
let dir = resolve(startDir);
while (dir !== '/') {
if (
existsSync(join(dir, 'package.json')) ||
existsSync(join(dir, '.git')) ||
existsSync(join(dir, 'skills-lock.json'))
) {
return dir;
}
const parent = resolve(dir, '..');
if (parent === dir) break;
dir = parent;
}
return resolve(startDir);
}
/**
* Find harness skill directories that have an impeccable skill installed.
*/
function findHarnessDirs(projectRoot) {
const dirs = [];
for (const harness of HARNESS_DIRS) {
const skillsDir = join(projectRoot, harness, 'skills');
// Only pin in harness dirs that already have impeccable installed
const impeccableDir = join(skillsDir, 'impeccable');
if (existsSync(impeccableDir) || existsSync(join(skillsDir, 'i-impeccable'))) {
dirs.push(skillsDir);
}
}
return dirs;
}
/**
* Load command metadata (descriptions for pinned skills).
*/
function loadCommandMetadata() {
const metadataPath = join(__dirname, 'command-metadata.json');
if (existsSync(metadataPath)) {
return JSON.parse(readFileSync(metadataPath, 'utf-8'));
}
return {};
}
/**
* Generate a pinned skill's SKILL.md content.
*/
function generatePinnedSkill(command, metadata) {
const desc = metadata[command]?.description || `Shortcut for /impeccable ${command}.`;
const hint = metadata[command]?.argumentHint || '[target]';
return `---
name: ${command}
description: "${desc}"
argument-hint: "${hint}"
user-invocable: true
---
${PIN_MARKER}
This is a pinned shortcut for \`{{command_prefix}}impeccable ${command}\`.
Invoke {{command_prefix}}impeccable ${command}, passing along any arguments provided here, and follow its instructions.
`;
}
/**
* Pin a command: create shortcut skill in all harness dirs.
*/
function pin(command, projectRoot) {
const metadata = loadCommandMetadata();
const harnessDirs = findHarnessDirs(projectRoot);
if (harnessDirs.length === 0) {
console.log('No harness directories with impeccable installed found.');
return false;
}
const content = generatePinnedSkill(command, metadata);
let created = 0;
for (const skillsDir of harnessDirs) {
// Check if skill already exists (and isn't a pin)
const skillDir = join(skillsDir, command);
if (existsSync(skillDir)) {
const existingMd = join(skillDir, 'SKILL.md');
if (existsSync(existingMd)) {
const existing = readFileSync(existingMd, 'utf-8');
if (!existing.includes(PIN_MARKER)) {
console.log(` SKIP: ${skillDir} (non-pinned skill already exists)`);
continue;
}
}
}
mkdirSync(skillDir, { recursive: true });
writeFileSync(join(skillDir, 'SKILL.md'), content, 'utf-8');
console.log(` + ${skillDir}`);
created++;
}
if (created > 0) {
console.log(`\nPinned '${command}' as a standalone shortcut in ${created} location(s).`);
console.log(`You can now use /${command} directly.`);
}
return created > 0;
}
/**
* Unpin a command: remove shortcut skill from all harness dirs.
*/
function unpin(command, projectRoot) {
const harnessDirs = findHarnessDirs(projectRoot);
let removed = 0;
for (const skillsDir of harnessDirs) {
const skillDir = join(skillsDir, command);
if (!existsSync(skillDir)) continue;
const skillMd = join(skillDir, 'SKILL.md');
if (!existsSync(skillMd)) continue;
// Safety: only remove if it's a pinned skill
const content = readFileSync(skillMd, 'utf-8');
if (!content.includes(PIN_MARKER)) {
console.log(` SKIP: ${skillDir} (not a pinned skill)`);
continue;
}
rmSync(skillDir, { recursive: true, force: true });
console.log(` - ${skillDir}`);
removed++;
}
if (removed > 0) {
console.log(`\nUnpinned '${command}' from ${removed} location(s).`);
console.log(`Use /impeccable ${command} to access it.`);
} else {
console.log(`No pinned '${command}' shortcut found.`);
}
return removed > 0;
}
// --- CLI ---
const [,, action, command] = process.argv;
if (!action || !command) {
console.log('Usage: node pin.mjs <pin|unpin> <command>');
console.log(`\nAvailable commands: ${VALID_COMMANDS.join(', ')}`);
process.exit(1);
}
if (action !== 'pin' && action !== 'unpin') {
console.error(`Unknown action: ${action}. Use 'pin' or 'unpin'.`);
process.exit(1);
}
if (!VALID_COMMANDS.includes(command)) {
console.error(`Unknown command: ${command}`);
console.error(`Available commands: ${VALID_COMMANDS.join(', ')}`);
process.exit(1);
}
const root = findProjectRoot();
if (action === 'pin') {
pin(command, root);
} else {
unpin(command, root);
}