@polymorphism-tech/morph-spec 4.19.0 β†’ 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +2 -2
  2. package/bin/morph-spec.js +11 -0
  3. package/bin/task-manager.js +35 -10
  4. package/claude-plugin.json +1 -1
  5. package/docs/CHEATSHEET.md +1 -1
  6. package/docs/QUICKSTART.md +1 -1
  7. package/framework/agents/architecture/architecture-expert.md +12 -0
  8. package/framework/agents/architecture/packages-validator.md +12 -0
  9. package/framework/agents/architecture/security-expert.md +12 -0
  10. package/framework/agents/frontend/design-system-validator.md +12 -0
  11. package/framework/agents/frontend/nextjs-component-validator.md +12 -0
  12. package/framework/hooks/claude-code/post-tool-use/dispatch.js +20 -3
  13. package/framework/hooks/claude-code/post-tool-use/validator-feedback.js +60 -11
  14. package/framework/rubrics/backend.json +36 -0
  15. package/framework/rubrics/default.json +36 -0
  16. package/framework/rubrics/frontend.json +36 -0
  17. package/framework/skills/level-0-meta/mcp-registry.json +21 -8
  18. package/framework/skills/level-0-meta/morph-frontend-review/SKILL.md +1 -1
  19. package/framework/skills/level-1-workflows/morph-phase-codebase-analysis/SKILL.md +1 -1
  20. package/framework/skills/level-1-workflows/morph-phase-design/SKILL.md +1 -1
  21. package/framework/skills/level-1-workflows/morph-phase-implement/SKILL.md +1 -1
  22. package/framework/skills/level-1-workflows/morph-phase-plan/SKILL.md +1 -1
  23. package/framework/skills/level-1-workflows/morph-phase-tasks/SKILL.md +1 -1
  24. package/framework/skills/level-1-workflows/morph-phase-uiux/SKILL.md +1 -1
  25. package/framework/skills/level-1-workflows/morph-scope-escalation/SKILL.md +1 -1
  26. package/package.json +1 -1
  27. package/src/commands/dashboard/dashboard.js +53 -0
  28. package/src/commands/mcp/mcp-setup.js +99 -2
  29. package/src/dashboard/app/App.jsx +31 -0
  30. package/src/dashboard/app/components/DetailPanel.jsx +11 -0
  31. package/src/dashboard/app/components/FlowGraph.jsx +17 -0
  32. package/src/dashboard/app/components/SearchFilter.jsx +22 -0
  33. package/src/dashboard/app/components/Sidebar.jsx +45 -0
  34. package/src/dashboard/app/hooks/useDetailPanel.js +15 -0
  35. package/src/dashboard/app/main.jsx +13 -0
  36. package/src/dashboard/app/pages/AgentMap.jsx +371 -0
  37. package/src/dashboard/app/pages/HookInspector.jsx +418 -0
  38. package/src/dashboard/app/pages/LiveState.jsx +239 -0
  39. package/src/dashboard/app/pages/PhasePipeline.jsx +410 -0
  40. package/src/dashboard/app/pages/RulesMap.jsx +273 -0
  41. package/src/dashboard/app/pages/SkillsLibrary.jsx +367 -0
  42. package/src/dashboard/app/pages/Standards.jsx +332 -0
  43. package/src/dashboard/app/pages/Workflows.jsx +346 -0
  44. package/src/dashboard/app/styles/index.css +47 -0
  45. package/src/dashboard/index.html +12 -0
  46. package/src/dashboard/package.json +24 -0
  47. package/src/dashboard/scanner/agents-scanner.js +35 -0
  48. package/src/dashboard/scanner/hooks-scanner.js +41 -0
  49. package/src/dashboard/scanner/index.js +21 -0
  50. package/src/dashboard/scanner/phases-scanner.js +15 -0
  51. package/src/dashboard/scanner/rubrics-scanner.js +12 -0
  52. package/src/dashboard/scanner/rules-scanner.js +37 -0
  53. package/src/dashboard/scanner/skills-scanner.js +43 -0
  54. package/src/dashboard/scanner/squads-scanner.js +13 -0
  55. package/src/dashboard/scanner/standards-scanner.js +26 -0
  56. package/src/dashboard/scanner/state-scanner.js +8 -0
  57. package/src/dashboard/scanner/workflows-scanner.js +18 -0
  58. package/src/dashboard/vite-plugin-morph-data.js +17 -0
  59. package/src/dashboard/vite.config.js +24 -0
  60. package/src/lib/checkpoints/checkpoint-hooks.js +2 -1
  61. package/src/lib/detectors/index.js +1 -1
  62. package/src/lib/generators/recap-generator.js +15 -0
  63. package/src/lib/installers/mcp-installer.js +140 -1
  64. package/src/lib/validators/score-aggregator.js +244 -0
  65. package/src/lib/validators/validation-runner.js +44 -0
  66. package/src/scripts/setup-infra.js +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polymorphism-tech/morph-spec",
3
- "version": "4.19.0",
3
+ "version": "4.21.0",
4
4
  "description": "MORPH-SPEC: AI-First development framework with validation pipeline and multi-stack support",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -0,0 +1,53 @@
1
+ import { spawn } from 'child_process';
2
+ import { existsSync } from 'fs';
3
+ import { resolve, dirname } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ import chalk from 'chalk';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+
9
+ export async function dashboardCommand(options = {}) {
10
+ const port = options.port || '3200';
11
+ const dashboardDir = resolve(__dirname, '..', '..', 'dashboard');
12
+ const nodeModules = resolve(dashboardDir, 'node_modules');
13
+
14
+ // Check if dashboard dependencies are installed
15
+ if (!existsSync(nodeModules)) {
16
+ console.log(chalk.yellow('Installing dashboard dependencies...'));
17
+ const install = spawn('npm', ['install'], {
18
+ cwd: dashboardDir,
19
+ stdio: 'inherit',
20
+ shell: true,
21
+ });
22
+ await new Promise((res, rej) => {
23
+ install.on('close', (code) => (code === 0 ? res() : rej(new Error(`npm install failed with code ${code}`))));
24
+ });
25
+ }
26
+
27
+ console.log(chalk.cyan(`\n Starting morph-spec dashboard at http://localhost:${port}\n`));
28
+
29
+ const env = {
30
+ ...process.env,
31
+ MORPH_PROJECT_DIR: process.cwd(),
32
+ };
33
+
34
+ const viteArgs = ['vite', '--port', port];
35
+ if (options.open !== false) viteArgs.push('--open');
36
+
37
+ const vite = spawn('npx', viteArgs, {
38
+ cwd: dashboardDir,
39
+ stdio: 'inherit',
40
+ shell: true,
41
+ env,
42
+ });
43
+
44
+ vite.on('error', (err) => {
45
+ console.error(chalk.red(`Failed to start dashboard: ${err.message}`));
46
+ process.exit(1);
47
+ });
48
+
49
+ process.on('SIGINT', () => {
50
+ vite.kill();
51
+ process.exit(0);
52
+ });
53
+ }
@@ -13,6 +13,8 @@
13
13
  import chalk from 'chalk';
14
14
  import inquirer from 'inquirer';
15
15
  import ora from 'ora';
16
+ import { readFileSync, existsSync } from 'fs';
17
+ import { join } from 'path';
16
18
  import {
17
19
  orchestrateMcpSetup,
18
20
  installAutoMcps,
@@ -21,15 +23,34 @@ import {
21
23
  generateSetupInstructions,
22
24
  formatMcpStatusTable,
23
25
  loadMcpRegistry,
24
- isRemoteMcp
26
+ isRemoteMcp,
27
+ generateStitchProxy,
28
+ patchConfigForPlatform
25
29
  } from '../../lib/installers/mcp-installer.js';
26
30
  import { detectClaudeConfig } from '../../lib/detectors/claude-config-detector.js';
27
31
  import { detectProject } from '../../lib/detectors/index.js';
32
+ import { installMcpServers } from '../../utils/claude-settings-manager.js';
28
33
 
29
34
  /**
30
- * Detect the current project's stack
35
+ * Detect the current project's stack.
36
+ * Prefers .morph/config/config.json (set during morph-spec init) over filesystem re-detection.
31
37
  */
32
38
  async function detectStack(targetPath) {
39
+ // 1. Prefer the authoritative config (handles compound stacks like nextjs+dotnet)
40
+ try {
41
+ const configPath = join(targetPath, '.morph', 'config', 'config.json');
42
+ if (existsSync(configPath)) {
43
+ const config = JSON.parse(readFileSync(configPath, 'utf-8'));
44
+ const configStack = config.project?.stack;
45
+ if (configStack && configStack !== 'unknown') {
46
+ return configStack;
47
+ }
48
+ }
49
+ } catch {
50
+ // Fall through to filesystem detection
51
+ }
52
+
53
+ // 2. Fallback: detect from filesystem
33
54
  try {
34
55
  const results = await detectProject(targetPath, { conversation: false, generateStandards: false });
35
56
  return results.structure?.stack || 'unknown';
@@ -186,6 +207,60 @@ async function setupSpecificMcp(targetPath, name, stack, existingMcps) {
186
207
 
187
208
  const credentials = mcpEntry.install.credentials || [];
188
209
 
210
+ // Stitch MCP β€” custom OAuth proxy setup
211
+ if (name === 'stitch' && !mcpEntry.install.autoInstall) {
212
+ console.log(chalk.cyan(`\n Setting up Stitch MCP (OAuth proxy)\n`));
213
+ console.log(chalk.gray(` Usage: ${mcpEntry.usage}`));
214
+ console.log('');
215
+
216
+ const gcpCred = credentials.find(c => c.envVar === 'STITCH_GCP_PROJECT');
217
+ const { gcpProject } = await inquirer.prompt([{
218
+ type: 'input',
219
+ name: 'gcpProject',
220
+ message: gcpCred ? `${gcpCred.name}:` : 'GCP Project ID:',
221
+ }]);
222
+
223
+ if (!gcpProject || !gcpProject.trim()) {
224
+ console.log(chalk.red(' GCP Project ID is required.'));
225
+ console.log('');
226
+ return;
227
+ }
228
+
229
+ const spinner = ora('Generating Stitch proxy...').start();
230
+ const { proxyPath } = generateStitchProxy(targetPath, gcpProject.trim());
231
+ spinner.succeed(`Proxy script generated: ${proxyPath}`);
232
+
233
+ const config = { ...mcpEntry.install.config };
234
+ const result = await installMcpServers(targetPath, { stitch: patchConfigForPlatform(config) });
235
+ if (result.added.length > 0) {
236
+ console.log(chalk.green(` βœ“ Stitch MCP configured (using OAuth proxy)`));
237
+ } else {
238
+ console.log(chalk.yellow(` ⚠ Stitch MCP already configured`));
239
+ }
240
+
241
+ if (mcpEntry.companionSkills?.installCommand) {
242
+ const { installSkills } = await inquirer.prompt([{
243
+ type: 'confirm',
244
+ name: 'installSkills',
245
+ message: 'Install Stitch companion skills (design, loop, etc.)?',
246
+ default: true
247
+ }]);
248
+ if (installSkills) {
249
+ const skillResults = installCompanionSkills({ stitch: mcpEntry });
250
+ for (const r of skillResults) {
251
+ if (r.success) {
252
+ console.log(chalk.green(` βœ“ Companion skills installed: ${r.repo}`));
253
+ } else {
254
+ console.log(chalk.yellow(` ⚠ Failed to install companion skills: ${r.repo}`));
255
+ }
256
+ }
257
+ }
258
+ }
259
+
260
+ console.log('');
261
+ return;
262
+ }
263
+
189
264
  // Auto-installable β€” just install
190
265
  if (mcpEntry.install.autoInstall) {
191
266
  const spinner = ora(`Installing ${name}...`).start();
@@ -349,6 +424,28 @@ async function interactiveWizard(targetPath, stack, existingMcps) {
349
424
  }]);
350
425
 
351
426
  if (setupNow) {
427
+ // Stitch β€” custom OAuth proxy flow
428
+ if (name === 'stitch' && !entry.install.autoInstall) {
429
+ const gcpCred = entry.install.credentials?.find(c => c.envVar === 'STITCH_GCP_PROJECT');
430
+ const { gcpProject } = await inquirer.prompt([{
431
+ type: 'input',
432
+ name: 'gcpProject',
433
+ message: gcpCred ? `${gcpCred.name}:` : 'GCP Project ID:',
434
+ }]);
435
+ if (gcpProject?.trim()) {
436
+ const { proxyPath } = generateStitchProxy(targetPath, gcpProject.trim());
437
+ console.log(chalk.green(` βœ“ Proxy generated: ${proxyPath}`));
438
+ const config = { ...entry.install.config };
439
+ await installMcpServers(targetPath, { stitch: patchConfigForPlatform(config) });
440
+ console.log(chalk.green(` βœ“ Stitch configured (OAuth proxy)`));
441
+ const skillResults = installCompanionSkills({ stitch: entry });
442
+ for (const r of skillResults) {
443
+ if (r.success) console.log(chalk.green(` βœ“ Companion skills: ${r.repo}`));
444
+ }
445
+ }
446
+ continue;
447
+ }
448
+
352
449
  // Remote MCPs β€” launch OAuth via claude mcp add
353
450
  if (isRemoteMcp(entry.install.config)) {
354
451
  console.log(chalk.cyan(` Launching ${capitalizedName} OAuth...`));
@@ -0,0 +1,31 @@
1
+ import { Routes, Route, Navigate } from 'react-router-dom';
2
+ import Sidebar from './components/Sidebar.jsx';
3
+ import AgentMap from './pages/AgentMap.jsx';
4
+ import PhasePipeline from './pages/PhasePipeline.jsx';
5
+ import HookInspector from './pages/HookInspector.jsx';
6
+ import SkillsLibrary from './pages/SkillsLibrary.jsx';
7
+ import RulesMap from './pages/RulesMap.jsx';
8
+ import Standards from './pages/Standards.jsx';
9
+ import Workflows from './pages/Workflows.jsx';
10
+ import LiveState from './pages/LiveState.jsx';
11
+
12
+ export default function App() {
13
+ return (
14
+ <div className="flex h-screen bg-gray-950 text-gray-100 overflow-hidden">
15
+ <Sidebar />
16
+ <main className="flex-1 overflow-auto">
17
+ <Routes>
18
+ <Route path="/" element={<Navigate to="/agents" replace />} />
19
+ <Route path="/agents" element={<AgentMap />} />
20
+ <Route path="/phases" element={<PhasePipeline />} />
21
+ <Route path="/hooks" element={<HookInspector />} />
22
+ <Route path="/skills" element={<SkillsLibrary />} />
23
+ <Route path="/rules" element={<RulesMap />} />
24
+ <Route path="/standards" element={<Standards />} />
25
+ <Route path="/workflows" element={<Workflows />} />
26
+ <Route path="/state" element={<LiveState />} />
27
+ </Routes>
28
+ </main>
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,11 @@
1
+ export default function DetailPanel({ open, title, onClose, children }) {
2
+ return (
3
+ <div className={`fixed top-0 right-0 h-full w-96 bg-gray-900 border-l border-gray-700 shadow-2xl transform transition-transform duration-200 ease-in-out z-50 ${open ? 'translate-x-0' : 'translate-x-full'}`}>
4
+ <div className="flex items-center justify-between p-4 border-b border-gray-700">
5
+ <h2 className="text-white font-semibold text-lg truncate">{title}</h2>
6
+ <button onClick={onClose} className="text-gray-400 hover:text-white text-xl leading-none">Γ—</button>
7
+ </div>
8
+ <div className="p-4 overflow-y-auto h-[calc(100%-57px)]">{children}</div>
9
+ </div>
10
+ );
11
+ }
@@ -0,0 +1,17 @@
1
+ import { ReactFlow, Controls, MiniMap, Background } from '@xyflow/react';
2
+
3
+ export default function FlowGraph({ nodes, edges, nodeTypes, onNodeClick, fitView = true, className = '' }) {
4
+ return (
5
+ <div className={`w-full h-full ${className}`} style={{ minHeight: '500px' }}>
6
+ <ReactFlow
7
+ nodes={nodes} edges={edges} nodeTypes={nodeTypes} onNodeClick={onNodeClick}
8
+ fitView={fitView} proOptions={{ hideAttribution: true }}
9
+ defaultEdgeOptions={{ type: 'smoothstep', animated: false, style: { stroke: '#475569', strokeWidth: 1.5 } }}
10
+ >
11
+ <Background color="#1e293b" gap={20} />
12
+ <Controls position="bottom-right" />
13
+ <MiniMap nodeColor={(node) => node.data?.color || '#475569'} maskColor="rgba(0, 0, 0, 0.7)" position="bottom-left" />
14
+ </ReactFlow>
15
+ </div>
16
+ );
17
+ }
@@ -0,0 +1,22 @@
1
+ import { useState } from 'react';
2
+
3
+ export default function SearchFilter({ placeholder = 'Search...', filters = [], onSearchChange, onFilterChange }) {
4
+ const [search, setSearch] = useState('');
5
+ function handleSearchChange(e) {
6
+ setSearch(e.target.value);
7
+ onSearchChange?.(e.target.value);
8
+ }
9
+ return (
10
+ <div className="flex items-center gap-3 p-3 bg-gray-900 border-b border-gray-800">
11
+ <input type="text" value={search} onChange={handleSearchChange} placeholder={placeholder}
12
+ className="flex-1 bg-gray-800 border border-gray-700 rounded-md px-3 py-1.5 text-sm text-gray-100 placeholder-gray-500 focus:outline-none focus:border-blue-500" />
13
+ {filters.map(({ name, label, options, value }) => (
14
+ <select key={name} value={value} onChange={(e) => onFilterChange?.(name, e.target.value)}
15
+ className="bg-gray-800 border border-gray-700 rounded-md px-2 py-1.5 text-sm text-gray-300 focus:outline-none focus:border-blue-500">
16
+ <option value="">{label}: All</option>
17
+ {options.map((opt) => (<option key={opt} value={opt}>{opt}</option>))}
18
+ </select>
19
+ ))}
20
+ </div>
21
+ );
22
+ }
@@ -0,0 +1,45 @@
1
+ import { NavLink } from 'react-router-dom';
2
+
3
+ const NAV_ITEMS = [
4
+ { to: '/agents', label: 'Agent Map', icon: 'πŸ—ΊοΈ' },
5
+ { to: '/phases', label: 'Phases', icon: '⚑' },
6
+ { to: '/hooks', label: 'Hooks', icon: 'πŸ”—' },
7
+ { to: '/skills', label: 'Skills', icon: '🧩' },
8
+ { to: '/rules', label: 'Rules', icon: 'πŸ“' },
9
+ { to: '/standards', label: 'Standards', icon: 'πŸ“‹' },
10
+ { to: '/workflows', label: 'Workflows', icon: 'πŸ”„' },
11
+ { to: '/state', label: 'Live State', icon: 'πŸ“Š' },
12
+ ];
13
+
14
+ export default function Sidebar() {
15
+ return (
16
+ <nav className="w-52 flex-shrink-0 bg-gray-900 border-r border-gray-800 flex flex-col">
17
+ <div className="px-4 py-4 border-b border-gray-800">
18
+ <h1 className="text-sm font-semibold text-gray-300 tracking-wide uppercase">
19
+ morph-spec
20
+ </h1>
21
+ <p className="text-xs text-gray-500 mt-0.5">Dashboard</p>
22
+ </div>
23
+ <ul className="flex-1 py-2">
24
+ {NAV_ITEMS.map(({ to, label, icon }) => (
25
+ <li key={to}>
26
+ <NavLink
27
+ to={to}
28
+ className={({ isActive }) =>
29
+ [
30
+ 'flex items-center gap-2.5 px-4 py-2 text-sm transition-colors',
31
+ isActive
32
+ ? 'bg-blue-900/40 border-r-2 border-blue-500 text-blue-300'
33
+ : 'text-gray-400 hover:bg-gray-800 hover:text-gray-200',
34
+ ].join(' ')
35
+ }
36
+ >
37
+ <span className="text-base leading-none">{icon}</span>
38
+ <span>{label}</span>
39
+ </NavLink>
40
+ </li>
41
+ ))}
42
+ </ul>
43
+ </nav>
44
+ );
45
+ }
@@ -0,0 +1,15 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ export function useDetailPanel() {
4
+ const [panel, setPanel] = useState({ open: false, title: '', content: null });
5
+
6
+ const openPanel = useCallback((title, content) => {
7
+ setPanel({ open: true, title, content });
8
+ }, []);
9
+
10
+ const closePanel = useCallback(() => {
11
+ setPanel((prev) => ({ ...prev, open: false }));
12
+ }, []);
13
+
14
+ return { panel, openPanel, closePanel };
15
+ }
@@ -0,0 +1,13 @@
1
+ import { StrictMode } from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import { BrowserRouter } from 'react-router-dom';
4
+ import App from './App.jsx';
5
+ import './styles/index.css';
6
+
7
+ createRoot(document.getElementById('root')).render(
8
+ <StrictMode>
9
+ <BrowserRouter>
10
+ <App />
11
+ </BrowserRouter>
12
+ </StrictMode>
13
+ );