AP1.9d: Methoden-Default-UI und Product Language für Product-Flow.
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Has been cancelled
Test Suite / lint-backend (push) Waiting to run
Test Suite / compose-smoke (push) Waiting to run
Test Suite / k6 /api/health Baseline (push) Blocked by required conditions
Test Suite / playwright-smoke (push) Blocked by required conditions
Deploy Development / deploy (push) Successful in 47s
Test Suite / pytest-backend (push) Has been cancelled
Prozessleiste, archetypgebundene Modus-Defaults und Sprint/Arbeitspaket-Begriffe schließen den GUI-Kern für continuous_product vor Sprint-Planungs-Flows. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
82a5b9adec
commit
09826d146e
20 files changed
+796
-55
No files matched your search
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* AP1.9d — Methoden-Default-UI: Archetyp/Methode steuert Prozessleiste,
|
||||
* Modus-Defaults und sichtbare Nav-Knoten (Anti-Todo-Wand).
|
||||
*
|
||||
* @typedef {{ key: string, to: string, label: string, mode: 'plan'|'work'|'control' }} ProcessStep
|
||||
* @typedef {{
|
||||
* archetypeKey: string | null,
|
||||
* methodKey: string | null,
|
||||
* hasActiveSprint: boolean,
|
||||
* }} MethodUiInput
|
||||
* @typedef {{
|
||||
* processSteps: ProcessStep[],
|
||||
* planDefaultRoute: string,
|
||||
* workDefaultRoute: string,
|
||||
* controlDefaultRoute: string,
|
||||
* planOutlineKeys: string[] | null,
|
||||
* workNavKeys: string[] | null,
|
||||
* }} MethodUiDefaults
|
||||
*/
|
||||
|
||||
import { PLAN_OUTLINE_NODES } from '../plan/planOutlineNodes.js'
|
||||
import { WORK_NAV_ITEMS } from './workNav.js'
|
||||
|
||||
const PRODUCT_PROCESS = [
|
||||
{ key: 'inbox', to: '/plan/inbox', label: 'Eingang', mode: 'plan' },
|
||||
{ key: 'sprint-plan', to: '/plan/sprint', label: 'Sprint planen', mode: 'plan' },
|
||||
{ key: 'sprint-work', to: '/work/sprint', label: 'Ausführen', mode: 'work' },
|
||||
{ key: 'control', to: '/control/status', label: 'Kontrolle', mode: 'control' },
|
||||
]
|
||||
|
||||
const LINEAR_PROCESS = [
|
||||
{ key: 'gates', to: '/plan/gates', label: 'Zielzustände', mode: 'plan' },
|
||||
{ key: 'work', to: '/work/today', label: 'Ausführen', mode: 'work' },
|
||||
{ key: 'control', to: '/control/status', label: 'Kontrolle', mode: 'control' },
|
||||
]
|
||||
|
||||
const MATURITY_PROCESS = [
|
||||
{ key: 'gates', to: '/plan/gates', label: 'Stufen', mode: 'plan' },
|
||||
{ key: 'journey', to: '/control/journey', label: 'Rhythmen', mode: 'control' },
|
||||
{ key: 'work', to: '/work/today', label: 'Ausführen', mode: 'work' },
|
||||
{ key: 'control', to: '/control/status', label: 'Kontrolle', mode: 'control' },
|
||||
]
|
||||
|
||||
const PROGRAM_PROCESS = [
|
||||
{ key: 'gates', to: '/plan/gates', label: 'Phasen', mode: 'plan' },
|
||||
{ key: 'inbox', to: '/plan/inbox', label: 'Eingang', mode: 'plan' },
|
||||
{ key: 'work', to: '/work/today', label: 'Ausführen', mode: 'work' },
|
||||
{ key: 'control', to: '/control/status', label: 'Kontrolle', mode: 'control' },
|
||||
]
|
||||
|
||||
const ARCHETYPE_UI = {
|
||||
'initiative.product': {
|
||||
processSteps: PRODUCT_PROCESS,
|
||||
planDefaultRoute: '/plan/inbox',
|
||||
workDefaultRoute: '/work/sprint',
|
||||
controlDefaultRoute: '/control/status',
|
||||
planOutlineKeys: ['profile', 'inbox', 'sprint', 'gates'],
|
||||
workNavKeys: ['sprint', 'today', 'mine'],
|
||||
},
|
||||
'initiative.linear_project': {
|
||||
processSteps: LINEAR_PROCESS,
|
||||
planDefaultRoute: '/plan/gates',
|
||||
workDefaultRoute: '/work/today',
|
||||
controlDefaultRoute: '/control/status',
|
||||
planOutlineKeys: ['profile', 'structure', 'gates', 'inbox', 'work'],
|
||||
workNavKeys: ['today', 'mine', 'sprint'],
|
||||
},
|
||||
'initiative.maturity_journey': {
|
||||
processSteps: MATURITY_PROCESS,
|
||||
planDefaultRoute: '/plan/gates',
|
||||
workDefaultRoute: '/work/today',
|
||||
controlDefaultRoute: '/control/status',
|
||||
planOutlineKeys: ['profile', 'gates', 'inbox', 'work'],
|
||||
workNavKeys: ['today', 'mine', 'sprint'],
|
||||
},
|
||||
'initiative.program': {
|
||||
processSteps: PROGRAM_PROCESS,
|
||||
planDefaultRoute: '/plan/gates',
|
||||
workDefaultRoute: '/work/today',
|
||||
controlDefaultRoute: '/control/status',
|
||||
planOutlineKeys: ['profile', 'structure', 'gates', 'inbox', 'sprint', 'work'],
|
||||
workNavKeys: ['today', 'mine', 'sprint'],
|
||||
},
|
||||
}
|
||||
|
||||
const FALLBACK_DEFAULTS = {
|
||||
processSteps: [],
|
||||
planDefaultRoute: '/plan/profile',
|
||||
workDefaultRoute: '/work/today',
|
||||
controlDefaultRoute: '/control/status',
|
||||
planOutlineKeys: null,
|
||||
workNavKeys: null,
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MethodUiInput} input
|
||||
* @returns {MethodUiDefaults}
|
||||
*/
|
||||
export function resolveMethodUiDefaults(input = {}) {
|
||||
const archetypeKey = input.archetypeKey || null
|
||||
const base = ARCHETYPE_UI[archetypeKey] || FALLBACK_DEFAULTS
|
||||
|
||||
let workDefaultRoute = base.workDefaultRoute
|
||||
if (archetypeKey === 'initiative.product' && !input.hasActiveSprint) {
|
||||
workDefaultRoute = '/work/today'
|
||||
}
|
||||
|
||||
return {
|
||||
processSteps: base.processSteps,
|
||||
planDefaultRoute: base.planDefaultRoute,
|
||||
workDefaultRoute,
|
||||
controlDefaultRoute: base.controlDefaultRoute,
|
||||
planOutlineKeys: base.planOutlineKeys,
|
||||
workNavKeys: base.workNavKeys,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MethodUiInput} input
|
||||
* @returns {ProcessStep[]}
|
||||
*/
|
||||
export function resolveProcessSteps(input = {}) {
|
||||
return resolveMethodUiDefaults(input).processSteps
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MethodUiInput} input
|
||||
* @returns {typeof PLAN_OUTLINE_NODES}
|
||||
*/
|
||||
export function resolvePlanOutlineNodes(input = {}) {
|
||||
const { planOutlineKeys } = resolveMethodUiDefaults(input)
|
||||
if (!planOutlineKeys) return PLAN_OUTLINE_NODES
|
||||
const allowed = new Set(planOutlineKeys)
|
||||
return PLAN_OUTLINE_NODES.filter((node) => allowed.has(node.key))
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MethodUiInput} input
|
||||
* @returns {typeof WORK_NAV_ITEMS}
|
||||
*/
|
||||
export function resolveWorkNavItems(input = {}) {
|
||||
const { workNavKeys } = resolveMethodUiDefaults(input)
|
||||
if (!workNavKeys) return WORK_NAV_ITEMS
|
||||
const order = new Map(workNavKeys.map((key, index) => [key, index]))
|
||||
return WORK_NAV_ITEMS.filter((item) => order.has(item.key)).sort(
|
||||
(a, b) => (order.get(a.key) ?? 0) - (order.get(b.key) ?? 0),
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Aktiven Prozessschritt aus Modus + Pfad ableiten.
|
||||
* @param {string} pathname
|
||||
* @param {ProcessStep[]} steps
|
||||
*/
|
||||
export function resolveActiveProcessStepKey(pathname, steps) {
|
||||
const path = (pathname || '').replace(/\/$/, '') || pathname
|
||||
if (!steps.length) return null
|
||||
|
||||
if (path.startsWith('/control/')) {
|
||||
const journey = steps.find((s) => s.key === 'journey')
|
||||
if (journey && path.startsWith('/control/journey')) return 'journey'
|
||||
return steps.find((s) => s.mode === 'control')?.key ?? null
|
||||
}
|
||||
if (path.startsWith('/work/')) {
|
||||
if (path.startsWith('/work/sprint')) {
|
||||
return steps.find((s) => s.key === 'sprint-work')?.key ?? null
|
||||
}
|
||||
return steps.find((s) => s.key === 'work')?.key ?? null
|
||||
}
|
||||
if (path.startsWith('/plan/')) {
|
||||
if (path.startsWith('/plan/inbox')) return 'inbox'
|
||||
if (path.startsWith('/plan/sprint')) return 'sprint-plan'
|
||||
if (path.startsWith('/plan/gates')) return 'gates'
|
||||
}
|
||||
if (path.startsWith('/actions/')) {
|
||||
return steps.find((s) => s.mode === 'work')?.key ?? null
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
resolveActiveProcessStepKey,
|
||||
resolveMethodUiDefaults,
|
||||
resolvePlanOutlineNodes,
|
||||
resolveProcessSteps,
|
||||
resolveWorkNavItems,
|
||||
} from './methodUiDefaults.js'
|
||||
|
||||
describe('methodUiDefaults', () => {
|
||||
it('product archetype defaults to Eingang and sprint-centric work nav', () => {
|
||||
const ui = resolveMethodUiDefaults({
|
||||
archetypeKey: 'initiative.product',
|
||||
hasActiveSprint: true,
|
||||
})
|
||||
expect(ui.planDefaultRoute).toBe('/plan/inbox')
|
||||
expect(ui.workDefaultRoute).toBe('/work/sprint')
|
||||
expect(ui.planOutlineKeys).toEqual(['profile', 'inbox', 'sprint', 'gates'])
|
||||
expect(resolveWorkNavItems({ archetypeKey: 'initiative.product' }).map((i) => i.key)).toEqual([
|
||||
'sprint',
|
||||
'today',
|
||||
'mine',
|
||||
])
|
||||
})
|
||||
|
||||
it('product without active sprint falls back work default to today', () => {
|
||||
const ui = resolveMethodUiDefaults({
|
||||
archetypeKey: 'initiative.product',
|
||||
hasActiveSprint: false,
|
||||
})
|
||||
expect(ui.workDefaultRoute).toBe('/work/today')
|
||||
})
|
||||
|
||||
it('exposes product process bar steps', () => {
|
||||
const steps = resolveProcessSteps({ archetypeKey: 'initiative.product' })
|
||||
expect(steps.map((s) => s.label)).toEqual([
|
||||
'Eingang',
|
||||
'Sprint planen',
|
||||
'Ausführen',
|
||||
'Kontrolle',
|
||||
])
|
||||
})
|
||||
|
||||
it('linear archetype defaults to gates and filters plan outline', () => {
|
||||
const ui = resolveMethodUiDefaults({ archetypeKey: 'initiative.linear_project' })
|
||||
expect(ui.planDefaultRoute).toBe('/plan/gates')
|
||||
expect(resolvePlanOutlineNodes({ archetypeKey: 'initiative.linear_project' }).map((n) => n.key)).toEqual([
|
||||
'profile',
|
||||
'structure',
|
||||
'gates',
|
||||
'inbox',
|
||||
'work',
|
||||
])
|
||||
})
|
||||
|
||||
it('generic archetype keeps full plan outline and no process steps', () => {
|
||||
expect(resolveMethodUiDefaults({}).processSteps).toEqual([])
|
||||
expect(resolvePlanOutlineNodes({}).length).toBe(6)
|
||||
})
|
||||
|
||||
it('resolves active process step from pathname', () => {
|
||||
const steps = resolveProcessSteps({ archetypeKey: 'initiative.product' })
|
||||
expect(resolveActiveProcessStepKey('/plan/inbox', steps)).toBe('inbox')
|
||||
expect(resolveActiveProcessStepKey('/plan/sprint', steps)).toBe('sprint-plan')
|
||||
expect(resolveActiveProcessStepKey('/work/sprint', steps)).toBe('sprint-work')
|
||||
expect(resolveActiveProcessStepKey('/control/status', steps)).toBe('control')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user