pixelcrew 0.2.2 → 0.2.6
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.
- package/README.md +389 -315
- package/bin/pixel-agents.js +306 -149
- package/package.json +3 -1
- package/skill/SKILL.md +185 -0
- package/skill/references/anti-ai-rubric.md +30 -0
- package/skill/references/anti-ai-slop-encyclopedia.md +181 -0
- package/skill/references/commands-reference.md +135 -0
- package/skill/references/testing-and-qa-strategy.md +25 -0
- package/skill/references/token-efficiency.md +20 -0
- package/src/adapters/adapter.interface.js +77 -0
- package/src/adapters/antigravity.js +138 -0
- package/src/adapters/claude-code.js +149 -0
- package/src/adapters/codex.js +131 -0
- package/src/adapters/cursor.js +133 -0
- package/src/adapters/generic.js +63 -0
- package/src/adapters/index.js +15 -0
- package/src/adapters/kiro.js +134 -0
- package/src/adapters/registry.js +150 -0
- package/src/backend/analyzer/complexity-analyzer.js +104 -0
- package/src/backend/analyzer/requirement-analyzer.js +213 -0
- package/src/backend/analyzer/threat-analyzer.js +122 -0
- package/src/backend/api/api-designer.js +90 -0
- package/src/backend/api/error-contract.js +132 -0
- package/src/backend/api/route-generator.js +92 -0
- package/src/backend/api/schema-generator.js +64 -0
- package/src/backend/architecture/adr-generator.js +62 -0
- package/src/backend/architecture/architecture-reasoner.js +119 -0
- package/src/backend/architecture/architecture-selector.js +57 -0
- package/src/backend/architecture/tradeoff-analyzer.js +92 -0
- package/src/backend/data/data-modeler.js +114 -0
- package/src/backend/data/index-analyzer.js +93 -0
- package/src/backend/data/query-analyzer.js +41 -0
- package/src/backend/data/schema-generator.js +92 -0
- package/src/backend/data/transaction-analyzer.js +49 -0
- package/src/backend/index.js +67 -0
- package/src/backend/observability/logging-engine.js +80 -0
- package/src/backend/observability/metrics-engine.js +31 -0
- package/src/backend/observability/tracing-engine.js +16 -0
- package/src/backend/patterns/pattern-registry.js +74 -0
- package/src/backend/patterns/pattern-selector.js +39 -0
- package/src/backend/patterns/tradeoff-engine.js +17 -0
- package/src/backend/performance/cache-analyzer.js +31 -0
- package/src/backend/performance/concurrency-analyzer.js +34 -0
- package/src/backend/performance/performance-engine.js +98 -0
- package/src/backend/performance/query-optimizer.js +16 -0
- package/src/backend/reliability/failure-analyzer.js +22 -0
- package/src/backend/reliability/idempotency-engine.js +56 -0
- package/src/backend/reliability/resilience-engine.js +141 -0
- package/src/backend/reliability/retry-analyzer.js +15 -0
- package/src/backend/security/auth-selector.js +33 -0
- package/src/backend/security/authorization-engine.js +90 -0
- package/src/backend/security/policy-engine.js +49 -0
- package/src/backend/security/secret-analyzer.js +39 -0
- package/src/backend/security/security-engine.js +122 -0
- package/src/backend/security/threat-model.js +59 -0
- package/src/backend/synthesis/backend-synthesizer.js +98 -0
- package/src/backend/synthesis/infrastructure-synthesizer.js +108 -0
- package/src/backend/synthesis/module-synthesizer.js +262 -0
- package/src/backend/validation/architecture-validator.js +70 -0
- package/src/backend/validation/backend-quality-validator.js +71 -0
- package/src/backend/validation/dependency-validator.js +20 -0
- package/src/backend/validation/performance-validator.js +38 -0
- package/src/backend/validation/security-validator.js +73 -0
- package/src/commands/adapt.js +105 -0
- package/src/commands/add.js +78 -0
- package/src/commands/animate.js +48 -0
- package/src/commands/assemble.js +57 -0
- package/src/commands/audit.js +93 -0
- package/src/commands/backend.js +125 -0
- package/src/commands/bento.js +25 -0
- package/src/commands/blueprint.js +65 -0
- package/src/commands/bolder.js +48 -0
- package/src/commands/boss-fight.js +60 -0
- package/src/commands/build.js +39 -0
- package/src/commands/calibrate.js +25 -0
- package/src/commands/chromatic.js +25 -0
- package/src/commands/clarify.js +52 -0
- package/src/commands/colorize.js +57 -0
- package/src/commands/command.interface.js +28 -0
- package/src/commands/commands.js +84 -0
- package/src/commands/craft.js +57 -0
- package/src/commands/crew.js +66 -0
- package/src/commands/critique.js +25 -0
- package/src/commands/de-slop.js +25 -0
- package/src/commands/delight.js +46 -0
- package/src/commands/deploy.js +42 -0
- package/src/commands/distill.js +48 -0
- package/src/commands/doctor.js +89 -0
- package/src/commands/document.js +83 -0
- package/src/commands/eight-bit.js +25 -0
- package/src/commands/extract.js +75 -0
- package/src/commands/fix.js +46 -0
- package/src/commands/harden.js +85 -0
- package/src/commands/index.js +67 -0
- package/src/commands/install.js +75 -0
- package/src/commands/layout.js +48 -0
- package/src/commands/live.js +44 -0
- package/src/commands/manifest.js +25 -0
- package/src/commands/office.js +25 -0
- package/src/commands/onboard.js +46 -0
- package/src/commands/oneshot.js +60 -0
- package/src/commands/optimize.js +46 -0
- package/src/commands/overdrive.js +46 -0
- package/src/commands/parser.js +143 -0
- package/src/commands/pixelcrew.js +96 -0
- package/src/commands/plan.js +66 -0
- package/src/commands/polish.js +45 -0
- package/src/commands/quieter.js +48 -0
- package/src/commands/recap.js +358 -0
- package/src/commands/registry.js +353 -0
- package/src/commands/render.js +26 -0
- package/src/commands/retrofit.js +25 -0
- package/src/commands/review.js +118 -0
- package/src/commands/roster.js +25 -0
- package/src/commands/sentinel.js +25 -0
- package/src/commands/shape.js +66 -0
- package/src/commands/skills.js +57 -0
- package/src/commands/status.js +48 -0
- package/src/commands/stop.js +50 -0
- package/src/commands/sync.js +58 -0
- package/src/commands/typeset.js +58 -0
- package/src/commands/warp.js +25 -0
- package/src/core/agent-runtime.js +94 -0
- package/src/core/event-bus.js +98 -0
- package/src/core/index.js +9 -0
- package/src/core/orchestrator.js +234 -0
- package/src/core/scheduler.js +124 -0
- package/src/core/task-graph.js +185 -0
- package/src/dashboard/app.js +1172 -30
- package/src/dashboard/index.html +223 -23
- package/src/dashboard/styles.css +870 -0
- package/src/index.js +16 -0
- package/src/orchestrator/artifact-graph.js +104 -0
- package/src/orchestrator/ast-normalizer.js +147 -0
- package/src/orchestrator/code-generator.js +846 -0
- package/src/orchestrator/design-engine.js +203 -0
- package/src/orchestrator/engine.js +318 -39
- package/src/orchestrator/oneshot.js +351 -1561
- package/src/orchestrator/ontology.js +394 -0
- package/src/orchestrator/planner.js +302 -0
- package/src/orchestrator/repair-planner.js +67 -0
- package/src/orchestrator/requirement-contract.js +177 -0
- package/src/orchestrator/requirement-validator.js +39 -0
- package/src/orchestrator/semantic-engine.js +582 -0
- package/src/orchestrator/semantic-reviewer.js +179 -0
- package/src/orchestrator/skills-registry.js +194 -0
- package/src/orchestrator/task-planner.js +111 -0
- package/src/orchestrator/task-queue.js +128 -0
- package/src/orchestrator/telemetry.js +209 -0
- package/src/orchestrator/ui-synthesizer.js +245 -0
- package/src/orchestrator/visual-critic.js +106 -0
- package/src/policies/architecture/layering.policy.js +14 -0
- package/src/policies/performance/indexing.policy.js +13 -0
- package/src/policies/reliability/resilience.policy.js +13 -0
- package/src/policies/security/auth.policy.js +31 -0
- package/src/protocol/agent.js +124 -0
- package/src/protocol/event.js +78 -0
- package/src/protocol/index.js +8 -0
- package/src/protocol/skill.js +54 -0
- package/src/protocol/task.js +100 -0
- package/src/scaffold/claude-generator.js +60 -0
- package/src/scaffold/commands-catalog.js +321 -0
- package/src/scaffold/cursor-generator.js +74 -0
- package/src/scaffold/ide-rules.js +133 -0
- package/src/scaffold/init.js +415 -91
- package/src/scaffold/installer.js +571 -0
- package/src/scaffold/kiro-generator.js +86 -0
- package/src/scaffold/skills-bundle.js +520 -0
- package/src/scaffold/templates.js +57 -4
- package/src/scaffold/workstations.js +364 -0
- package/src/server/server.js +292 -42
- package/src/utils/fs-safe.js +168 -0
- package/src/utils/markdown-report.js +175 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIXEL CREW — Universal Agent Protocol & Roles
|
|
3
|
+
*
|
|
4
|
+
* Standardized agent roles, states, expressions, and capability contracts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const AGENT_STATES = {
|
|
8
|
+
IDLE: 'IDLE',
|
|
9
|
+
SPAWNING: 'SPAWNING',
|
|
10
|
+
ANALYZING: 'ANALYZING',
|
|
11
|
+
WORKING: 'WORKING',
|
|
12
|
+
BLOCKED: 'BLOCKED',
|
|
13
|
+
VERIFYING: 'VERIFYING',
|
|
14
|
+
COMPLETED: 'COMPLETED',
|
|
15
|
+
ERROR: 'ERROR'
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const AGENT_EXPRESSIONS = {
|
|
19
|
+
IDLE: '●_●',
|
|
20
|
+
SPAWNING: '░_░',
|
|
21
|
+
ANALYZING: '◉_⊙',
|
|
22
|
+
WORKING: '◉▂◉',
|
|
23
|
+
BLOCKED: '?_?',
|
|
24
|
+
VERIFYING: '🔍_🔍',
|
|
25
|
+
COMPLETED: '^_^',
|
|
26
|
+
ERROR: 'x_x'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const ORCHESTRATOR_EXPRESSIONS = {
|
|
30
|
+
IDLE: '◉_◉',
|
|
31
|
+
COORDINATING: '◉_◉ ⚡',
|
|
32
|
+
ANALYZING: '◉_⊙',
|
|
33
|
+
COMPLETED: '★_★',
|
|
34
|
+
ERROR: 'x_x'
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const AGENT_ROLES = {
|
|
38
|
+
orchestrator: {
|
|
39
|
+
id: 'orchestrator',
|
|
40
|
+
name: 'Tech Lead / Master CPU',
|
|
41
|
+
title: 'Staff Swarm Architect & Project Lead',
|
|
42
|
+
color: '#ffd700',
|
|
43
|
+
icon: '👔',
|
|
44
|
+
defaultSkills: ['anti-ai/slop-guardian']
|
|
45
|
+
},
|
|
46
|
+
creativeDirector: {
|
|
47
|
+
id: 'creativeDirector',
|
|
48
|
+
name: 'Creative Director',
|
|
49
|
+
title: 'Lead Aesthetic Strategist & Brand Architect',
|
|
50
|
+
color: '#ff9900',
|
|
51
|
+
icon: '✨',
|
|
52
|
+
defaultSkills: ['design/ui-design', 'design/typography', 'anti-ai/slop-guardian']
|
|
53
|
+
},
|
|
54
|
+
frontend: {
|
|
55
|
+
id: 'frontend',
|
|
56
|
+
name: 'Frontend Builder',
|
|
57
|
+
title: 'Senior UI/UX & Component Engineer',
|
|
58
|
+
color: '#00f0ff',
|
|
59
|
+
icon: '🎨',
|
|
60
|
+
defaultSkills: ['frontend/nextjs', 'frontend/react', 'frontend/tailwind', 'frontend/accessibility']
|
|
61
|
+
},
|
|
62
|
+
backend: {
|
|
63
|
+
id: 'backend',
|
|
64
|
+
name: 'Backend Engineer',
|
|
65
|
+
title: 'Principal API & Distributed Systems Engineer',
|
|
66
|
+
color: '#ff007f',
|
|
67
|
+
icon: '⚡',
|
|
68
|
+
defaultSkills: ['backend/route-handlers', 'backend/data-models']
|
|
69
|
+
},
|
|
70
|
+
database: {
|
|
71
|
+
id: 'database',
|
|
72
|
+
name: 'Database Architect',
|
|
73
|
+
title: 'Principal DBA & Query Performance Engineer',
|
|
74
|
+
color: '#ffd700',
|
|
75
|
+
icon: '🗄️',
|
|
76
|
+
defaultSkills: ['backend/data-models']
|
|
77
|
+
},
|
|
78
|
+
security: {
|
|
79
|
+
id: 'security',
|
|
80
|
+
name: 'Security Sentinel',
|
|
81
|
+
title: 'InfoSec Lead & OWASP Auditor',
|
|
82
|
+
color: '#ff3344',
|
|
83
|
+
icon: '🛡️',
|
|
84
|
+
defaultSkills: ['frontend/accessibility']
|
|
85
|
+
},
|
|
86
|
+
performance: {
|
|
87
|
+
id: 'performance',
|
|
88
|
+
name: 'Performance Profiler',
|
|
89
|
+
title: 'Core Web Vitals & Runtime Optimizer',
|
|
90
|
+
color: '#00ff88',
|
|
91
|
+
icon: '🚀',
|
|
92
|
+
defaultSkills: ['quality/responsive-design']
|
|
93
|
+
},
|
|
94
|
+
qa: {
|
|
95
|
+
id: 'qa',
|
|
96
|
+
name: 'QA & Visual Critic',
|
|
97
|
+
title: 'Lead Verification & Anti-AI Rubric Guardian',
|
|
98
|
+
color: '#bd00ff',
|
|
99
|
+
icon: '🧪',
|
|
100
|
+
defaultSkills: ['quality/visual-review', 'quality/browser-testing', 'anti-ai/slop-guardian']
|
|
101
|
+
},
|
|
102
|
+
animationSpecialist: {
|
|
103
|
+
id: 'animationSpecialist',
|
|
104
|
+
name: 'Motion Specialist',
|
|
105
|
+
title: 'Senior Kinetic Choreographer & Micro-Interactions',
|
|
106
|
+
color: '#38bdf8',
|
|
107
|
+
icon: '🎬',
|
|
108
|
+
defaultSkills: ['motion/framer-motion', 'motion/micro-interactions']
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Creates and normalizes an Agent Capabilities record
|
|
114
|
+
*/
|
|
115
|
+
export function normalizeCapabilities(capabilities = {}) {
|
|
116
|
+
return {
|
|
117
|
+
fileAccess: Boolean(capabilities.fileAccess ?? true),
|
|
118
|
+
terminalAccess: Boolean(capabilities.terminalAccess ?? true),
|
|
119
|
+
subagents: Boolean(capabilities.subagents ?? false),
|
|
120
|
+
backgroundTasks: Boolean(capabilities.backgroundTasks ?? true),
|
|
121
|
+
streaming: Boolean(capabilities.streaming ?? true),
|
|
122
|
+
toolCalls: Boolean(capabilities.toolCalls ?? true)
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIXEL CREW — Universal Event Protocol
|
|
3
|
+
*
|
|
4
|
+
* Standardized telemetry, lifecycle, and progress events across all agent providers.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const EVENT_TYPES = {
|
|
8
|
+
AGENT_STARTED: 'agent.started',
|
|
9
|
+
AGENT_THINKING: 'agent.thinking',
|
|
10
|
+
SKILL_ACTIVATED: 'skill.activated',
|
|
11
|
+
TOOL_INVOKED: 'tool.invoked',
|
|
12
|
+
PROGRESS: 'progress',
|
|
13
|
+
TASK_COMPLETED: 'task.completed',
|
|
14
|
+
TASK_FAILED: 'task.failed',
|
|
15
|
+
ORCHESTRATION_STARTED: 'orchestration.started',
|
|
16
|
+
ORCHESTRATION_COMPLETED: 'orchestration.completed',
|
|
17
|
+
ORCHESTRATION_FAILED: 'orchestration.failed',
|
|
18
|
+
STATE_CHANGE: 'state.change'
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Creates and validates a standardized AgentEvent object
|
|
23
|
+
*/
|
|
24
|
+
export function createEvent(options = {}) {
|
|
25
|
+
const event = {
|
|
26
|
+
id: options.id || `evt-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
|
|
27
|
+
timestamp: options.timestamp || Date.now(),
|
|
28
|
+
agent: options.agent || 'orchestrator',
|
|
29
|
+
type: options.type || EVENT_TYPES.PROGRESS,
|
|
30
|
+
taskId: options.taskId || null,
|
|
31
|
+
taskName: options.taskName || null,
|
|
32
|
+
skill: options.skill || null,
|
|
33
|
+
message: String(options.message || ''),
|
|
34
|
+
provider: options.provider || 'generic',
|
|
35
|
+
data: typeof options.data === 'object' && options.data !== null ? { ...options.data } : {}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
validateEvent(event);
|
|
39
|
+
return event;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Validates that an AgentEvent object satisfies contract
|
|
44
|
+
*/
|
|
45
|
+
export function validateEvent(event) {
|
|
46
|
+
if (!event || typeof event !== 'object') {
|
|
47
|
+
throw new Error('Event must be a non-null object');
|
|
48
|
+
}
|
|
49
|
+
if (!event.id || typeof event.id !== 'string') {
|
|
50
|
+
throw new Error('Event must have a valid string id');
|
|
51
|
+
}
|
|
52
|
+
if (typeof event.timestamp !== 'number') {
|
|
53
|
+
throw new Error('Event must have a numeric timestamp');
|
|
54
|
+
}
|
|
55
|
+
if (!event.agent || typeof event.agent !== 'string') {
|
|
56
|
+
throw new Error('Event must have a valid agent name');
|
|
57
|
+
}
|
|
58
|
+
if (!event.type || typeof event.type !== 'string') {
|
|
59
|
+
throw new Error('Event must have a valid event type');
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Serializes event for JSONL log line
|
|
66
|
+
*/
|
|
67
|
+
export function serializeEvent(event) {
|
|
68
|
+
validateEvent(event);
|
|
69
|
+
return JSON.stringify(event);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Deserializes an event from JSON string or object
|
|
74
|
+
*/
|
|
75
|
+
export function deserializeEvent(raw) {
|
|
76
|
+
const data = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
77
|
+
return createEvent(data);
|
|
78
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIXEL CREW — Universal Skill Protocol
|
|
3
|
+
*
|
|
4
|
+
* Standard skill interfaces, capability tags, and resolution schemas.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const SKILL_CATEGORIES = {
|
|
8
|
+
FRONTEND: 'frontend',
|
|
9
|
+
DESIGN: 'design',
|
|
10
|
+
MOTION: 'motion',
|
|
11
|
+
QUALITY: 'quality',
|
|
12
|
+
BACKEND: 'backend',
|
|
13
|
+
CONTENT: 'content',
|
|
14
|
+
ANTI_AI: 'anti-ai'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a standardized Skill object
|
|
19
|
+
*/
|
|
20
|
+
export function createSkill(options = {}) {
|
|
21
|
+
const skill = {
|
|
22
|
+
id: String(options.id || ''),
|
|
23
|
+
name: String(options.name || options.id || 'Untitled Skill'),
|
|
24
|
+
category: String(options.category || SKILL_CATEGORIES.FRONTEND),
|
|
25
|
+
description: String(options.description || ''),
|
|
26
|
+
targetAgents: Array.isArray(options.targetAgents) ? [...options.targetAgents] : ['frontend'],
|
|
27
|
+
metadata: typeof options.metadata === 'object' && options.metadata !== null ? { ...options.metadata } : {}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
validateSkill(skill);
|
|
31
|
+
return skill;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Validates a Skill object
|
|
36
|
+
*/
|
|
37
|
+
export function validateSkill(skill) {
|
|
38
|
+
if (!skill || typeof skill !== 'object') {
|
|
39
|
+
throw new Error('Skill must be a non-null object');
|
|
40
|
+
}
|
|
41
|
+
if (!skill.id || typeof skill.id !== 'string') {
|
|
42
|
+
throw new Error('Skill must have a valid string id');
|
|
43
|
+
}
|
|
44
|
+
if (!skill.name || typeof skill.name !== 'string') {
|
|
45
|
+
throw new Error('Skill must have a valid string name');
|
|
46
|
+
}
|
|
47
|
+
if (!skill.category || typeof skill.category !== 'string') {
|
|
48
|
+
throw new Error('Skill must have a valid category');
|
|
49
|
+
}
|
|
50
|
+
if (!Array.isArray(skill.targetAgents) || skill.targetAgents.length === 0) {
|
|
51
|
+
throw new Error('Skill must target at least one agent');
|
|
52
|
+
}
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIXEL CREW — Universal Task Protocol
|
|
3
|
+
*
|
|
4
|
+
* Standardized task definition, validation, and serialization.
|
|
5
|
+
* Translates between Pixel Crew Core and Provider Adapters.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export const TASK_STATUS = {
|
|
9
|
+
PENDING: 'pending',
|
|
10
|
+
QUEUED: 'queued',
|
|
11
|
+
RUNNING: 'running',
|
|
12
|
+
COMPLETED: 'completed',
|
|
13
|
+
FAILED: 'failed',
|
|
14
|
+
CANCELLED: 'cancelled'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a standardized AgentTask object
|
|
19
|
+
*/
|
|
20
|
+
export function createTask(options = {}) {
|
|
21
|
+
const {
|
|
22
|
+
id = `task-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
|
|
23
|
+
title = 'Untitled Task',
|
|
24
|
+
description = '',
|
|
25
|
+
agent = 'frontend',
|
|
26
|
+
skills = [],
|
|
27
|
+
files = { read: [], write: [] },
|
|
28
|
+
dependencies = [],
|
|
29
|
+
status = TASK_STATUS.QUEUED,
|
|
30
|
+
assignedProvider = null,
|
|
31
|
+
metadata = {}
|
|
32
|
+
} = options;
|
|
33
|
+
|
|
34
|
+
const task = {
|
|
35
|
+
id: String(id),
|
|
36
|
+
title: String(title),
|
|
37
|
+
description: String(description),
|
|
38
|
+
agent: String(agent),
|
|
39
|
+
skills: Array.isArray(skills) ? [...skills] : [],
|
|
40
|
+
files: {
|
|
41
|
+
read: Array.isArray(files?.read) ? [...files.read] : [],
|
|
42
|
+
write: Array.isArray(files?.write) ? [...files.write] : []
|
|
43
|
+
},
|
|
44
|
+
dependencies: Array.isArray(dependencies) ? [...dependencies] : [],
|
|
45
|
+
status: Object.values(TASK_STATUS).includes(status) ? status : TASK_STATUS.QUEUED,
|
|
46
|
+
assignedProvider: assignedProvider ? String(assignedProvider) : null,
|
|
47
|
+
metadata: typeof metadata === 'object' && metadata !== null ? { ...metadata } : {},
|
|
48
|
+
createdAt: options.createdAt || Date.now(),
|
|
49
|
+
updatedAt: options.updatedAt || Date.now(),
|
|
50
|
+
result: options.result || null,
|
|
51
|
+
error: options.error || null
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
validateTask(task);
|
|
55
|
+
return task;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Validates that an AgentTask satisfies the required contract
|
|
60
|
+
*/
|
|
61
|
+
export function validateTask(task) {
|
|
62
|
+
if (!task || typeof task !== 'object') {
|
|
63
|
+
throw new Error('Task must be a non-null object');
|
|
64
|
+
}
|
|
65
|
+
if (!task.id || typeof task.id !== 'string') {
|
|
66
|
+
throw new Error('Task must have a valid string id');
|
|
67
|
+
}
|
|
68
|
+
if (!task.title || typeof task.title !== 'string') {
|
|
69
|
+
throw new Error('Task must have a valid string title');
|
|
70
|
+
}
|
|
71
|
+
if (!task.agent || typeof task.agent !== 'string') {
|
|
72
|
+
throw new Error('Task must have a target agent specified');
|
|
73
|
+
}
|
|
74
|
+
if (!Array.isArray(task.skills)) {
|
|
75
|
+
throw new Error('Task skills must be an array');
|
|
76
|
+
}
|
|
77
|
+
if (!task.files || typeof task.files !== 'object') {
|
|
78
|
+
throw new Error('Task files must be an object with read and write arrays');
|
|
79
|
+
}
|
|
80
|
+
if (!Array.isArray(task.dependencies)) {
|
|
81
|
+
throw new Error('Task dependencies must be an array of task IDs');
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Serializes task to JSON format with formatting
|
|
88
|
+
*/
|
|
89
|
+
export function serializeTask(task) {
|
|
90
|
+
validateTask(task);
|
|
91
|
+
return JSON.stringify(task, null, 2);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Parses task from JSON string or object
|
|
96
|
+
*/
|
|
97
|
+
export function deserializeTask(raw) {
|
|
98
|
+
const data = typeof raw === 'string' ? JSON.parse(raw) : raw;
|
|
99
|
+
return createTask(data);
|
|
100
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PIXEL CREW — Claude Code Slash Commands & Instructions Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates .claude/commands/*.md files so that all 24 Floor 42 commands
|
|
5
|
+
* (/assemble, /blueprint, /recap, /render, /sentinel, /warp, /polish, etc.)
|
|
6
|
+
* natively appear in the Anthropic Claude Code CLI slash command picker.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { FLOOR42_COMMANDS } from './commands-catalog.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Generates all Claude Code command and instruction files
|
|
14
|
+
*/
|
|
15
|
+
export function generateClaudeFiles(targetDir, isGlobal = false) {
|
|
16
|
+
const baseDir = isGlobal ? targetDir : path.join(targetDir, '.claude');
|
|
17
|
+
const files = [];
|
|
18
|
+
|
|
19
|
+
// 1. Generate individual command markdown files in .claude/commands/
|
|
20
|
+
for (const cmd of FLOOR42_COMMANDS) {
|
|
21
|
+
const cmdPath = path.join(baseDir, 'commands', `${cmd.name}.md`);
|
|
22
|
+
const cmdContent = `---
|
|
23
|
+
description: ${cmd.description}
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# /${cmd.name}
|
|
27
|
+
|
|
28
|
+
${cmd.prompt}
|
|
29
|
+
`;
|
|
30
|
+
files.push({ path: cmdPath, content: cmdContent });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 2. Workspace instructions and plugin manifest (for workspace scope)
|
|
34
|
+
if (!isGlobal) {
|
|
35
|
+
const claudeMdContent = `# 🏢 PixelCrew Multi-Agent Swarm Instructions for Claude Code
|
|
36
|
+
|
|
37
|
+
You are integrated with PixelCrew (Floor 42, Pixel Corps HQ).
|
|
38
|
+
Support \`/pixelcrew <command>\` and direct slash commands (\`/assemble\`, \`/blueprint\`, \`/boss-fight\`, \`/render\`, \`/recap\`, \`/sentinel\`, \`/audit\`, \`/warp\`, \`/polish\`, etc.).
|
|
39
|
+
|
|
40
|
+
## ⚡ Available Slash Commands
|
|
41
|
+
${FLOOR42_COMMANDS.map(c => `- **\`/${c.name}\`**: ${c.description}`).join('\n')}
|
|
42
|
+
|
|
43
|
+
## 🛡️ Anti-AI Guidelines:
|
|
44
|
+
- Reject purple/cyan neon blobs, floating fake sparkles, and uniform 3-card grids.
|
|
45
|
+
- Apply intentional asymmetry (Bento grids), mathematical fluid clamp() typography, and high-contrast surface tiers.
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
const claudePluginContent = JSON.stringify({
|
|
49
|
+
name: 'pixelcrew',
|
|
50
|
+
version: '0.2.5',
|
|
51
|
+
description: 'Autonomous Multi-Agent Engineering Swarm & Retro Pixel-Art Startup Office',
|
|
52
|
+
skills: ['skills/pixelcrew']
|
|
53
|
+
}, null, 2) + '\n';
|
|
54
|
+
|
|
55
|
+
files.push({ path: path.join(targetDir, 'CLAUDE.md'), content: claudeMdContent });
|
|
56
|
+
files.push({ path: path.join(targetDir, '.claude-plugin', 'plugin.json'), content: claudePluginContent });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return files;
|
|
60
|
+
}
|