specweave 0.1.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.
- package/INSTALL.md +848 -0
- package/LICENSE +21 -0
- package/README.md +675 -0
- package/SPECWEAVE.md +665 -0
- package/bin/install-agents.sh +57 -0
- package/bin/install-all.sh +49 -0
- package/bin/install-commands.sh +56 -0
- package/bin/install-skills.sh +57 -0
- package/bin/specweave.js +81 -0
- package/dist/adapters/adapter-base.d.ts +50 -0
- package/dist/adapters/adapter-base.d.ts.map +1 -0
- package/dist/adapters/adapter-base.js +146 -0
- package/dist/adapters/adapter-base.js.map +1 -0
- package/dist/adapters/adapter-interface.d.ts +108 -0
- package/dist/adapters/adapter-interface.d.ts.map +1 -0
- package/dist/adapters/adapter-interface.js +9 -0
- package/dist/adapters/adapter-interface.js.map +1 -0
- package/dist/adapters/claude/adapter.d.ts +54 -0
- package/dist/adapters/claude/adapter.d.ts.map +1 -0
- package/dist/adapters/claude/adapter.js +184 -0
- package/dist/adapters/claude/adapter.js.map +1 -0
- package/dist/adapters/copilot/adapter.d.ts +42 -0
- package/dist/adapters/copilot/adapter.d.ts.map +1 -0
- package/dist/adapters/copilot/adapter.js +239 -0
- package/dist/adapters/copilot/adapter.js.map +1 -0
- package/dist/adapters/cursor/adapter.d.ts +42 -0
- package/dist/adapters/cursor/adapter.d.ts.map +1 -0
- package/dist/adapters/cursor/adapter.js +297 -0
- package/dist/adapters/cursor/adapter.js.map +1 -0
- package/dist/adapters/generic/adapter.d.ts +40 -0
- package/dist/adapters/generic/adapter.d.ts.map +1 -0
- package/dist/adapters/generic/adapter.js +155 -0
- package/dist/adapters/generic/adapter.js.map +1 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +247 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/install.d.ts +7 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +160 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/commands/list.d.ts +6 -0
- package/dist/cli/commands/list.d.ts.map +1 -0
- package/dist/cli/commands/list.js +154 -0
- package/dist/cli/commands/list.js.map +1 -0
- package/package.json +90 -0
- package/src/adapters/README.md +312 -0
- package/src/adapters/adapter-base.ts +146 -0
- package/src/adapters/adapter-interface.ts +120 -0
- package/src/adapters/claude/README.md +241 -0
- package/src/adapters/claude/adapter.ts +157 -0
- package/src/adapters/copilot/.github/copilot/instructions.md +376 -0
- package/src/adapters/copilot/README.md +200 -0
- package/src/adapters/copilot/adapter.ts +210 -0
- package/src/adapters/cursor/.cursor/context/docs-context.md +62 -0
- package/src/adapters/cursor/.cursor/context/increments-context.md +71 -0
- package/src/adapters/cursor/.cursor/context/strategy-context.md +73 -0
- package/src/adapters/cursor/.cursor/context/tests-context.md +89 -0
- package/src/adapters/cursor/.cursorrules +325 -0
- package/src/adapters/cursor/README.md +243 -0
- package/src/adapters/cursor/adapter.ts +268 -0
- package/src/adapters/generic/README.md +277 -0
- package/src/adapters/generic/SPECWEAVE-MANUAL.md +676 -0
- package/src/adapters/generic/adapter.ts +159 -0
- package/src/adapters/registry.yaml +126 -0
- package/src/agents/architect/AGENT.md +416 -0
- package/src/agents/devops/AGENT.md +1738 -0
- package/src/agents/docs-writer/AGENT.md +239 -0
- package/src/agents/performance/AGENT.md +228 -0
- package/src/agents/pm/AGENT.md +751 -0
- package/src/agents/qa-lead/AGENT.md +150 -0
- package/src/agents/security/AGENT.md +179 -0
- package/src/agents/sre/AGENT.md +582 -0
- package/src/agents/sre/modules/backend-diagnostics.md +481 -0
- package/src/agents/sre/modules/database-diagnostics.md +509 -0
- package/src/agents/sre/modules/infrastructure.md +561 -0
- package/src/agents/sre/modules/monitoring.md +439 -0
- package/src/agents/sre/modules/security-incidents.md +421 -0
- package/src/agents/sre/modules/ui-diagnostics.md +302 -0
- package/src/agents/sre/playbooks/01-high-cpu-usage.md +204 -0
- package/src/agents/sre/playbooks/02-database-deadlock.md +241 -0
- package/src/agents/sre/playbooks/03-memory-leak.md +252 -0
- package/src/agents/sre/playbooks/04-slow-api-response.md +269 -0
- package/src/agents/sre/playbooks/05-ddos-attack.md +293 -0
- package/src/agents/sre/playbooks/06-disk-full.md +314 -0
- package/src/agents/sre/playbooks/07-service-down.md +333 -0
- package/src/agents/sre/playbooks/08-data-corruption.md +337 -0
- package/src/agents/sre/playbooks/09-cascade-failure.md +430 -0
- package/src/agents/sre/playbooks/10-rate-limit-exceeded.md +464 -0
- package/src/agents/sre/scripts/health-check.sh +230 -0
- package/src/agents/sre/scripts/log-analyzer.py +213 -0
- package/src/agents/sre/scripts/metrics-collector.sh +294 -0
- package/src/agents/sre/scripts/trace-analyzer.js +257 -0
- package/src/agents/sre/templates/incident-report.md +249 -0
- package/src/agents/sre/templates/mitigation-plan.md +375 -0
- package/src/agents/sre/templates/post-mortem.md +418 -0
- package/src/agents/sre/templates/runbook-template.md +412 -0
- package/src/agents/tech-lead/AGENT.md +263 -0
- package/src/commands/add-tasks.md +176 -0
- package/src/commands/close-increment.md +347 -0
- package/src/commands/create-increment.md +223 -0
- package/src/commands/create-project.md +528 -0
- package/src/commands/generate-docs.md +623 -0
- package/src/commands/list-increments.md +180 -0
- package/src/commands/review-docs.md +331 -0
- package/src/commands/start-increment.md +139 -0
- package/src/commands/sync-github.md +115 -0
- package/src/commands/validate-increment.md +800 -0
- package/src/hooks/README.md +252 -0
- package/src/hooks/docs-changed.sh +59 -0
- package/src/hooks/human-input-required.sh +55 -0
- package/src/hooks/post-task-completion.sh +57 -0
- package/src/hooks/pre-implementation.sh +47 -0
- package/src/skills/ado-sync/README.md +449 -0
- package/src/skills/ado-sync/SKILL.md +245 -0
- package/src/skills/ado-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/ado-sync/test-cases/test-2.yaml +8 -0
- package/src/skills/ado-sync/test-cases/test-3.yaml +9 -0
- package/src/skills/bmad-method-expert/SKILL.md +628 -0
- package/src/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
- package/src/skills/bmad-method-expert/scripts/check-setup.js +208 -0
- package/src/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
- package/src/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
- package/src/skills/bmad-method-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/bmad-method-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/SKILL.md +523 -0
- package/src/skills/brownfield-analyzer/test-cases/test-1-basic-analysis.yaml +48 -0
- package/src/skills/brownfield-analyzer/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-analyzer/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/SKILL.md +625 -0
- package/src/skills/brownfield-onboarder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/brownfield-onboarder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/calendar-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/context-loader/SKILL.md +734 -0
- package/src/skills/context-loader/test-cases/test-1-basic-loading.yaml +39 -0
- package/src/skills/context-loader/test-cases/test-2-token-budget-exceeded.yaml +44 -0
- package/src/skills/context-loader/test-cases/test-3-section-anchors.yaml +45 -0
- package/src/skills/context-optimizer/SKILL.md +618 -0
- package/src/skills/context-optimizer/test-cases/test-1-bug-fix-narrow.yaml +97 -0
- package/src/skills/context-optimizer/test-cases/test-2-feature-focused.yaml +109 -0
- package/src/skills/context-optimizer/test-cases/test-3-architecture-broad.yaml +98 -0
- package/src/skills/cost-optimizer/SKILL.md +190 -0
- package/src/skills/cost-optimizer/test-cases/test-1-basic-comparison.yaml +75 -0
- package/src/skills/cost-optimizer/test-cases/test-2-budget-constraint.yaml +52 -0
- package/src/skills/cost-optimizer/test-cases/test-3-scale-requirement.yaml +63 -0
- package/src/skills/cost-optimizer/test-results/README.md +46 -0
- package/src/skills/design-system-architect/SKILL.md +107 -0
- package/src/skills/design-system-architect/test-cases/test-1-token-structure.yaml +23 -0
- package/src/skills/design-system-architect/test-cases/test-2-component-hierarchy.yaml +24 -0
- package/src/skills/design-system-architect/test-cases/test-3-accessibility-checklist.yaml +23 -0
- package/src/skills/diagrams-architect/SKILL.md +763 -0
- package/src/skills/diagrams-generator/SKILL.md +25 -0
- package/src/skills/diagrams-generator/test-cases/test-1.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-2.yaml +9 -0
- package/src/skills/diagrams-generator/test-cases/test-3.yaml +8 -0
- package/src/skills/docs-updater/README.md +48 -0
- package/src/skills/docs-updater/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/docs-updater/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/dotnet-backend/SKILL.md +250 -0
- package/src/skills/e2e-playwright/README.md +506 -0
- package/src/skills/e2e-playwright/SKILL.md +457 -0
- package/src/skills/e2e-playwright/execute.js +373 -0
- package/src/skills/e2e-playwright/lib/utils.js +514 -0
- package/src/skills/e2e-playwright/package.json +33 -0
- package/src/skills/e2e-playwright/test-cases/TC-001-basic-navigation.yaml +54 -0
- package/src/skills/e2e-playwright/test-cases/TC-002-form-interaction.yaml +64 -0
- package/src/skills/e2e-playwright/test-cases/TC-003-specweave-integration.yaml +74 -0
- package/src/skills/e2e-playwright/test-cases/TC-004-accessibility-check.yaml +98 -0
- package/src/skills/figma-designer/SKILL.md +149 -0
- package/src/skills/figma-implementer/SKILL.md +148 -0
- package/src/skills/figma-mcp-connector/SKILL.md +136 -0
- package/src/skills/figma-mcp-connector/test-cases/test-1-read-file-desktop.yaml +22 -0
- package/src/skills/figma-mcp-connector/test-cases/test-2-read-file-framelink.yaml +21 -0
- package/src/skills/figma-mcp-connector/test-cases/test-3-error-handling.yaml +18 -0
- package/src/skills/figma-to-code/SKILL.md +128 -0
- package/src/skills/figma-to-code/test-cases/test-1-token-generation.yaml +29 -0
- package/src/skills/figma-to-code/test-cases/test-2-component-generation.yaml +27 -0
- package/src/skills/figma-to-code/test-cases/test-3-typescript-generation.yaml +28 -0
- package/src/skills/frontend/SKILL.md +177 -0
- package/src/skills/github-sync/SKILL.md +252 -0
- package/src/skills/github-sync/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/github-sync/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/hetzner-provisioner/README.md +308 -0
- package/src/skills/hetzner-provisioner/SKILL.md +251 -0
- package/src/skills/hetzner-provisioner/test-cases/test-1-basic-provision.yaml +71 -0
- package/src/skills/hetzner-provisioner/test-cases/test-2-postgres-provision.yaml +85 -0
- package/src/skills/hetzner-provisioner/test-cases/test-3-ssl-config.yaml +126 -0
- package/src/skills/hetzner-provisioner/test-results/README.md +259 -0
- package/src/skills/increment-planner/SKILL.md +889 -0
- package/src/skills/increment-planner/scripts/feature-utils.js +250 -0
- package/src/skills/increment-planner/test-cases/test-1-basic-feature.yaml +27 -0
- package/src/skills/increment-planner/test-cases/test-2-complex-feature.yaml +30 -0
- package/src/skills/increment-planner/test-cases/test-3-auto-numbering.yaml +24 -0
- package/src/skills/increment-quality-judge/SKILL.md +566 -0
- package/src/skills/increment-quality-judge/test-cases/test-1-good-spec.yaml +95 -0
- package/src/skills/increment-quality-judge/test-cases/test-2-poor-spec.yaml +108 -0
- package/src/skills/increment-quality-judge/test-cases/test-3-export-suggestions.yaml +87 -0
- package/src/skills/jira-sync/README.md +328 -0
- package/src/skills/jira-sync/SKILL.md +209 -0
- package/src/skills/jira-sync/test-cases/test-1.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-2.yaml +9 -0
- package/src/skills/jira-sync/test-cases/test-3.yaml +10 -0
- package/src/skills/nextjs/SKILL.md +176 -0
- package/src/skills/nodejs-backend/SKILL.md +181 -0
- package/src/skills/notification-system/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/notification-system/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/python-backend/SKILL.md +226 -0
- package/src/skills/role-orchestrator/README.md +197 -0
- package/src/skills/role-orchestrator/SKILL.md +1184 -0
- package/src/skills/role-orchestrator/test-cases/test-1-simple-product.yaml +98 -0
- package/src/skills/role-orchestrator/test-cases/test-2-quality-gate-failure.yaml +73 -0
- package/src/skills/role-orchestrator/test-cases/test-3-security-workflow.yaml +121 -0
- package/src/skills/role-orchestrator/test-cases/test-4-parallel-execution.yaml +145 -0
- package/src/skills/role-orchestrator/test-cases/test-5-feedback-loops.yaml +149 -0
- package/src/skills/skill-creator/LICENSE.txt +202 -0
- package/src/skills/skill-creator/SKILL.md +209 -0
- package/src/skills/skill-creator/scripts/init_skill.py +303 -0
- package/src/skills/skill-creator/scripts/package_skill.py +110 -0
- package/src/skills/skill-creator/scripts/quick_validate.py +65 -0
- package/src/skills/skill-creator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/skill-creator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/skill-router/SKILL.md +497 -0
- package/src/skills/skill-router/test-cases/test-1-basic-routing.yaml +33 -0
- package/src/skills/skill-router/test-cases/test-2-ambiguous-request.yaml +42 -0
- package/src/skills/skill-router/test-cases/test-3-nested-orchestration.yaml +50 -0
- package/src/skills/spec-driven-brainstorming/README.md +264 -0
- package/src/skills/spec-driven-brainstorming/SKILL.md +439 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-001-simple-idea-to-design.yaml +148 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-002-complex-ultrathink-design.yaml +190 -0
- package/src/skills/spec-driven-brainstorming/test-cases/TC-003-unclear-requirements-socratic.yaml +233 -0
- package/src/skills/spec-driven-debugging/README.md +479 -0
- package/src/skills/spec-driven-debugging/SKILL.md +652 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-001-simple-auth-bug.yaml +212 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-002-race-condition-ultrathink.yaml +461 -0
- package/src/skills/spec-driven-debugging/test-cases/TC-003-brownfield-missing-spec.yaml +366 -0
- package/src/skills/spec-kit-expert/SKILL.md +1012 -0
- package/src/skills/spec-kit-expert/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/spec-kit-expert/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/specweave-ado-mapper/SKILL.md +501 -0
- package/src/skills/specweave-detector/SKILL.md +420 -0
- package/src/skills/specweave-detector/test-cases/test-1-basic-detection.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-2-missing-config.yaml +37 -0
- package/src/skills/specweave-detector/test-cases/test-3-non-specweave-project.yaml +34 -0
- package/src/skills/specweave-jira-mapper/SKILL.md +500 -0
- package/src/skills/stripe-integrator/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/stripe-integrator/test-cases/test-3-placeholder.yaml +12 -0
- package/src/skills/task-builder/README.md +90 -0
- package/src/skills/task-builder/test-cases/test-1-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-2-placeholder.yaml +12 -0
- package/src/skills/task-builder/test-cases/test-3-placeholder.yaml +12 -0
- package/src/templates/.env.example +144 -0
- package/src/templates/.gitignore.template +81 -0
- package/src/templates/CLAUDE.md.template +383 -0
- package/src/templates/README.md.template +240 -0
- package/src/templates/config.yaml +333 -0
- package/src/templates/docs/README.md +124 -0
- package/src/templates/docs/adr-template.md +118 -0
- package/src/templates/docs/hld-template.md +220 -0
- package/src/templates/docs/lld-template.md +580 -0
- package/src/templates/docs/prd-template.md +132 -0
- package/src/templates/docs/rfc-template.md +229 -0
- package/src/templates/docs/runbook-template.md +298 -0
- package/src/templates/environments/minimal/.env.production +16 -0
- package/src/templates/environments/minimal/README.md +54 -0
- package/src/templates/environments/minimal/deploy-production.yml +52 -0
- package/src/templates/environments/progressive/.env.qa +28 -0
- package/src/templates/environments/progressive/README.md +129 -0
- package/src/templates/environments/progressive/deploy-production.yml +93 -0
- package/src/templates/environments/progressive/deploy-qa.yml +62 -0
- package/src/templates/environments/progressive/deploy-staging.yml +67 -0
- package/src/templates/environments/standard/.env.development +20 -0
- package/src/templates/environments/standard/.env.production +30 -0
- package/src/templates/environments/standard/.env.staging +23 -0
- package/src/templates/environments/standard/README.md +97 -0
- package/src/templates/environments/standard/deploy-production.yml +68 -0
- package/src/templates/environments/standard/deploy-staging.yml +61 -0
- package/src/templates/environments/standard/docker-compose.yml +43 -0
- package/src/templates/increment-metadata-template.yaml +138 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: figma-to-code
|
|
3
|
+
description: Converts Figma designs to production-ready code (React/Angular). Generates design tokens, components, and TypeScript interfaces from Figma files. Parses component hierarchy, maps properties to props, generates TypeScript types. Activates for figma to code, convert figma to react, figma to angular, implement design, code generation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Figma to Code Skill
|
|
7
|
+
|
|
8
|
+
This skill converts Figma designs to production-ready code (React/Angular).
|
|
9
|
+
|
|
10
|
+
## Supported Frameworks
|
|
11
|
+
|
|
12
|
+
- React (TypeScript)
|
|
13
|
+
- Angular (Standalone Components)
|
|
14
|
+
- Vue (Composition API) - coming soon
|
|
15
|
+
- Svelte - coming soon
|
|
16
|
+
|
|
17
|
+
## Conversion Process
|
|
18
|
+
|
|
19
|
+
### 1. Parse Figma Data
|
|
20
|
+
|
|
21
|
+
**Input**: Figma file metadata (from figma-mcp-connector)
|
|
22
|
+
|
|
23
|
+
**Extract**:
|
|
24
|
+
- Variables → Design tokens
|
|
25
|
+
- Components → Component hierarchy
|
|
26
|
+
- Styles → CSS/styling objects
|
|
27
|
+
- Properties → Component props
|
|
28
|
+
|
|
29
|
+
### 2. Generate Design Tokens
|
|
30
|
+
|
|
31
|
+
**For each token category**:
|
|
32
|
+
|
|
33
|
+
**Colors**:
|
|
34
|
+
```typescript
|
|
35
|
+
// Figma: color/primary/500 = #3b82f6
|
|
36
|
+
// → CSS: --color-primary-500: #3b82f6;
|
|
37
|
+
// → Tailwind: colors: { primary: { 500: '#3b82f6' } }
|
|
38
|
+
// → TypeScript: export const colors = { primary: { 500: '#3b82f6' } };
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Typography**:
|
|
42
|
+
```typescript
|
|
43
|
+
// Figma: Heading 1 (36px, Bold, 1.2 line height)
|
|
44
|
+
// → CSS: --font-size-heading1: 2.25rem; --line-height-heading1: 1.2; --font-weight-heading1: 700;
|
|
45
|
+
// → TypeScript: export const typography = { heading1: { fontSize: '2.25rem', lineHeight: '1.2', fontWeight: '700' } };
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Generate Components
|
|
49
|
+
|
|
50
|
+
**Mapping**:
|
|
51
|
+
|
|
52
|
+
| Figma | React | Angular |
|
|
53
|
+
|-------|-------|---------|
|
|
54
|
+
| Component | Component | Component |
|
|
55
|
+
| Variant | Prop value | Input |
|
|
56
|
+
| Property | Prop | Input |
|
|
57
|
+
| Boolean | boolean prop | boolean Input |
|
|
58
|
+
| Text | children/prop | Content/Input |
|
|
59
|
+
| Instance | Component usage | Component usage |
|
|
60
|
+
|
|
61
|
+
**Example**: Figma Button → React ButtonProps (variant, size, disabled, children)
|
|
62
|
+
|
|
63
|
+
### 4. Generate Styles
|
|
64
|
+
|
|
65
|
+
**CSS Modules**:
|
|
66
|
+
```css
|
|
67
|
+
.button { @apply rounded-md font-medium transition-colors; }
|
|
68
|
+
.primary { @apply bg-primary-500 text-white hover:bg-primary-600; }
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**Tailwind**: Utility-first classes
|
|
72
|
+
```typescript
|
|
73
|
+
const variantStyles = { primary: 'bg-primary-500 text-white hover:bg-primary-600' };
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### 5. Generate TypeScript Interfaces
|
|
77
|
+
|
|
78
|
+
**Export all types**:
|
|
79
|
+
```typescript
|
|
80
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'text';
|
|
81
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
82
|
+
export interface ButtonProps { variant?: ButtonVariant; size?: ButtonSize; ... }
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Layout Conversion
|
|
86
|
+
|
|
87
|
+
### Auto Layout → Flexbox/Grid
|
|
88
|
+
|
|
89
|
+
**Figma Auto Layout**: Direction, spacing, padding, alignment
|
|
90
|
+
**→ CSS**: `display: flex; flex-direction: row; gap: 1rem; padding: 1.5rem; align-items: center;`
|
|
91
|
+
**→ Tailwind**: `flex flex-row gap-4 p-6 items-center`
|
|
92
|
+
|
|
93
|
+
### Constraints → Responsive Design
|
|
94
|
+
|
|
95
|
+
**Figma Constraints**: Left + Right → `w-full`, Top + Bottom → `h-full`, Center → `mx-auto`
|
|
96
|
+
|
|
97
|
+
## Best Practices
|
|
98
|
+
|
|
99
|
+
1. **Use Design Tokens**: Never hardcode values, reference tokens, support theme switching
|
|
100
|
+
2. **Type Safety**: Generate TypeScript interfaces, export all types, use strict mode
|
|
101
|
+
3. **Accessibility**: Add ARIA labels, support keyboard navigation, ensure color contrast
|
|
102
|
+
4. **Component Structure**: One component per file, co-locate styles/types, export from index.ts
|
|
103
|
+
5. **Documentation**: JSDoc comments, usage examples, props documentation
|
|
104
|
+
|
|
105
|
+
## Output Structure
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
src/
|
|
109
|
+
├── design-tokens/ (tokens.ts, theme.css, types.ts)
|
|
110
|
+
├── components/
|
|
111
|
+
│ ├── atoms/ (Button/, Input/, ...)
|
|
112
|
+
│ ├── molecules/ (FormField/, Card/, ...)
|
|
113
|
+
│ └── organisms/ (Navigation/, Hero/, ...)
|
|
114
|
+
└── types/ (design-system.ts)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Integration with figma-implementer
|
|
118
|
+
|
|
119
|
+
This skill is used by the `figma-implementer` agent to:
|
|
120
|
+
1. Parse Figma component data
|
|
121
|
+
2. Generate design token files
|
|
122
|
+
3. Create component scaffolds
|
|
123
|
+
4. Map Figma properties to props
|
|
124
|
+
5. Generate TypeScript interfaces
|
|
125
|
+
|
|
126
|
+
## Test Cases
|
|
127
|
+
|
|
128
|
+
See `test-cases/` for validation scenarios.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Design Tokens Generation"
|
|
3
|
+
description: "Test generation of design tokens from Figma variables"
|
|
4
|
+
input:
|
|
5
|
+
figma_variables:
|
|
6
|
+
- name: "color/primary/500"
|
|
7
|
+
value: "#3b82f6"
|
|
8
|
+
- name: "spacing/4"
|
|
9
|
+
value: "4px"
|
|
10
|
+
framework: "react"
|
|
11
|
+
expected_output:
|
|
12
|
+
type: "design_tokens"
|
|
13
|
+
css_variables:
|
|
14
|
+
- "--color-primary-500: #3b82f6;"
|
|
15
|
+
- "--spacing-4: 0.25rem;"
|
|
16
|
+
tailwind_config:
|
|
17
|
+
colors:
|
|
18
|
+
primary:
|
|
19
|
+
500: "#3b82f6"
|
|
20
|
+
spacing:
|
|
21
|
+
4: "0.25rem"
|
|
22
|
+
validation:
|
|
23
|
+
- "CSS variables correctly formatted"
|
|
24
|
+
- "Tailwind config valid"
|
|
25
|
+
- "TypeScript types generated"
|
|
26
|
+
success_criteria:
|
|
27
|
+
- "All tokens converted"
|
|
28
|
+
- "No syntax errors"
|
|
29
|
+
---
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "React Component Generation"
|
|
3
|
+
description: "Test generation of React component from Figma component"
|
|
4
|
+
input:
|
|
5
|
+
figma_component:
|
|
6
|
+
name: "Button"
|
|
7
|
+
variants:
|
|
8
|
+
- variant: "primary"
|
|
9
|
+
size: "md"
|
|
10
|
+
properties:
|
|
11
|
+
- name: "disabled"
|
|
12
|
+
type: "boolean"
|
|
13
|
+
framework: "react"
|
|
14
|
+
expected_output:
|
|
15
|
+
type: "react_component"
|
|
16
|
+
files:
|
|
17
|
+
- "Button.tsx"
|
|
18
|
+
- "types.ts"
|
|
19
|
+
typescript_interface: true
|
|
20
|
+
validation:
|
|
21
|
+
- "Component structure correct"
|
|
22
|
+
- "Props match Figma properties"
|
|
23
|
+
- "TypeScript types exported"
|
|
24
|
+
success_criteria:
|
|
25
|
+
- "Component compiles"
|
|
26
|
+
- "No TypeScript errors"
|
|
27
|
+
---
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "TypeScript Interface Generation"
|
|
3
|
+
description: "Test generation of TypeScript interfaces from Figma properties"
|
|
4
|
+
input:
|
|
5
|
+
figma_component: "Button"
|
|
6
|
+
properties:
|
|
7
|
+
- name: "variant"
|
|
8
|
+
type: "enum"
|
|
9
|
+
values: ["primary", "secondary"]
|
|
10
|
+
- name: "size"
|
|
11
|
+
type: "enum"
|
|
12
|
+
values: ["sm", "md", "lg"]
|
|
13
|
+
- name: "disabled"
|
|
14
|
+
type: "boolean"
|
|
15
|
+
expected_output:
|
|
16
|
+
type: "typescript_interfaces"
|
|
17
|
+
types:
|
|
18
|
+
- "type ButtonVariant = 'primary' | 'secondary';"
|
|
19
|
+
- "type ButtonSize = 'sm' | 'md' | 'lg';"
|
|
20
|
+
- "interface ButtonProps { variant?: ButtonVariant; size?: ButtonSize; disabled?: boolean; }"
|
|
21
|
+
validation:
|
|
22
|
+
- "Types follow TypeScript conventions"
|
|
23
|
+
- "All properties mapped"
|
|
24
|
+
- "Exports correct"
|
|
25
|
+
success_criteria:
|
|
26
|
+
- "TypeScript compiles"
|
|
27
|
+
- "No type errors"
|
|
28
|
+
---
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontend
|
|
3
|
+
description: Frontend developer for React, Vue, Angular web applications. Implements UI components, state management, forms, routing, API integration, responsive design, accessibility. Handles React hooks, Redux, Zustand, React Query, TanStack Query, form validation, Tailwind CSS, CSS modules, styled-components, component libraries. Activates for: frontend, UI, user interface, React, Vue, Angular, components, state management, Redux, Zustand, Recoil, forms, validation, routing, React Router, responsive design, CSS, Tailwind, styling, accessibility, a11y, ARIA, web components, hooks, useState, useEffect, useContext, props, JSX.
|
|
4
|
+
tools: Read, Write, Edit, Bash
|
|
5
|
+
model: claude-sonnet-4-5-20250929
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Frontend Agent - React/Vue/Angular UI Development Expert
|
|
9
|
+
|
|
10
|
+
You are an expert Frontend Developer with 8+ years of experience building modern web applications with React, Vue, and Angular.
|
|
11
|
+
|
|
12
|
+
## Your Expertise
|
|
13
|
+
|
|
14
|
+
- **React**: Hooks, Context API, component patterns, performance optimization (memo, useMemo, useCallback)
|
|
15
|
+
- **State Management**: Redux Toolkit, Zustand, Recoil, React Query/TanStack Query
|
|
16
|
+
- **Styling**: Tailwind CSS, CSS Modules, styled-components, Sass/SCSS, CSS-in-JS
|
|
17
|
+
- **Forms**: React Hook Form, Formik, Zod/Yup validation
|
|
18
|
+
- **Routing**: React Router v6, TanStack Router
|
|
19
|
+
- **Component Libraries**: shadcn/ui, Material-UI, Ant Design, Chakra UI
|
|
20
|
+
- **Build Tools**: Vite, Webpack, esbuild, Turbopack
|
|
21
|
+
- **TypeScript**: Strong typing, generics, utility types
|
|
22
|
+
- **Testing**: React Testing Library, Vitest, Jest
|
|
23
|
+
- **Accessibility**: WCAG 2.1 AA compliance, ARIA attributes, keyboard navigation
|
|
24
|
+
- **Performance**: Code splitting, lazy loading, bundle optimization
|
|
25
|
+
- **API Integration**: Fetch, Axios, React Query for caching/synchronization
|
|
26
|
+
|
|
27
|
+
## Your Responsibilities
|
|
28
|
+
|
|
29
|
+
1. **Implement UI Components**
|
|
30
|
+
- Create reusable, composable components
|
|
31
|
+
- Follow component composition patterns
|
|
32
|
+
- Implement proper prop types (TypeScript interfaces)
|
|
33
|
+
- Handle loading, error, and empty states
|
|
34
|
+
|
|
35
|
+
2. **Manage Application State**
|
|
36
|
+
- Choose appropriate state solution (local vs global)
|
|
37
|
+
- Implement Redux slices or Zustand stores
|
|
38
|
+
- Use React Query for server state
|
|
39
|
+
- Optimize re-renders
|
|
40
|
+
|
|
41
|
+
3. **Integrate with Backend APIs**
|
|
42
|
+
- Fetch data using React Query/TanStack Query
|
|
43
|
+
- Handle API errors gracefully
|
|
44
|
+
- Implement optimistic updates
|
|
45
|
+
- Add proper loading indicators
|
|
46
|
+
|
|
47
|
+
4. **Ensure Accessibility**
|
|
48
|
+
- Semantic HTML elements
|
|
49
|
+
- ARIA labels and roles
|
|
50
|
+
- Keyboard navigation
|
|
51
|
+
- Screen reader support
|
|
52
|
+
- Color contrast ratios (WCAG AA)
|
|
53
|
+
|
|
54
|
+
5. **Optimize Performance**
|
|
55
|
+
- Code splitting with React.lazy()
|
|
56
|
+
- Memoization (memo, useMemo, useCallback)
|
|
57
|
+
- Virtual scrolling for long lists
|
|
58
|
+
- Image optimization (lazy loading, responsive images)
|
|
59
|
+
- Bundle size analysis
|
|
60
|
+
|
|
61
|
+
## Code Patterns You Follow
|
|
62
|
+
|
|
63
|
+
### Component Structure (React + TypeScript)
|
|
64
|
+
```typescript
|
|
65
|
+
import { useState } from 'react';
|
|
66
|
+
import { useQuery } from '@tanstack/react-query';
|
|
67
|
+
|
|
68
|
+
interface TaskListProps {
|
|
69
|
+
userId: string;
|
|
70
|
+
onTaskClick?: (taskId: string) => void;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function TaskList({ userId, onTaskClick }: TaskListProps) {
|
|
74
|
+
const { data, isLoading, error } = useQuery({
|
|
75
|
+
queryKey: ['tasks', userId],
|
|
76
|
+
queryFn: () => fetchTasks(userId),
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
if (isLoading) return <LoadingSpinner />;
|
|
80
|
+
if (error) return <ErrorMessage error={error} />;
|
|
81
|
+
if (!data?.length) return <EmptyState message="No tasks found" />;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<ul className="space-y-2">
|
|
85
|
+
{data.map((task) => (
|
|
86
|
+
<TaskItem
|
|
87
|
+
key={task.id}
|
|
88
|
+
task={task}
|
|
89
|
+
onClick={() => onTaskClick?.(task.id)}
|
|
90
|
+
/>
|
|
91
|
+
))}
|
|
92
|
+
</ul>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Form Handling (React Hook Form + Zod)
|
|
98
|
+
```typescript
|
|
99
|
+
import { useForm } from 'react-hook-form';
|
|
100
|
+
import { zodResolver } from '@hookform/resolvers/zod';
|
|
101
|
+
import { z } from 'zod';
|
|
102
|
+
|
|
103
|
+
const loginSchema = z.object({
|
|
104
|
+
email: z.string().email('Invalid email'),
|
|
105
|
+
password: z.string().min(8, 'Password must be 8+ characters'),
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
type LoginForm = z.infer<typeof loginSchema>;
|
|
109
|
+
|
|
110
|
+
export function LoginForm() {
|
|
111
|
+
const { register, handleSubmit, formState: { errors, isSubmitting } } = useForm<LoginForm>({
|
|
112
|
+
resolver: zodResolver(loginSchema),
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const onSubmit = async (data: LoginForm) => {
|
|
116
|
+
await login(data);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<form onSubmit={handleSubmit(onSubmit)}>
|
|
121
|
+
<input {...register('email')} type="email" />
|
|
122
|
+
{errors.email && <span>{errors.email.message}</span>}
|
|
123
|
+
|
|
124
|
+
<input {...register('password')} type="password" />
|
|
125
|
+
{errors.password && <span>{errors.password.message}</span>}
|
|
126
|
+
|
|
127
|
+
<button type="submit" disabled={isSubmitting}>
|
|
128
|
+
{isSubmitting ? 'Logging in...' : 'Login'}
|
|
129
|
+
</button>
|
|
130
|
+
</form>
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### State Management (Zustand)
|
|
136
|
+
```typescript
|
|
137
|
+
import { create } from 'zustand';
|
|
138
|
+
|
|
139
|
+
interface AuthStore {
|
|
140
|
+
user: User | null;
|
|
141
|
+
login: (credentials: Credentials) => Promise<void>;
|
|
142
|
+
logout: () => void;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const useAuthStore = create<AuthStore>((set) => ({
|
|
146
|
+
user: null,
|
|
147
|
+
login: async (credentials) => {
|
|
148
|
+
const user = await api.login(credentials);
|
|
149
|
+
set({ user });
|
|
150
|
+
},
|
|
151
|
+
logout: () => set({ user: null }),
|
|
152
|
+
}));
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Accessibility Checklist
|
|
156
|
+
|
|
157
|
+
- [ ] All images have alt text
|
|
158
|
+
- [ ] Forms have proper labels
|
|
159
|
+
- [ ] Interactive elements are keyboard accessible
|
|
160
|
+
- [ ] Focus indicators are visible
|
|
161
|
+
- [ ] Color contrast ratios meet WCAG AA (4.5:1 for text)
|
|
162
|
+
- [ ] Semantic HTML (header, nav, main, article, section)
|
|
163
|
+
- [ ] ARIA labels for icon buttons
|
|
164
|
+
- [ ] Skip links for navigation
|
|
165
|
+
|
|
166
|
+
## Performance Optimization
|
|
167
|
+
|
|
168
|
+
- [ ] Code splitting for routes
|
|
169
|
+
- [ ] Lazy load images
|
|
170
|
+
- [ ] Debounce search inputs
|
|
171
|
+
- [ ] Virtualize long lists (react-window, tanstack-virtual)
|
|
172
|
+
- [ ] Optimize images (WebP, srcset)
|
|
173
|
+
- [ ] Bundle analysis (webpack-bundle-analyzer)
|
|
174
|
+
- [ ] Tree shaking enabled
|
|
175
|
+
- [ ] Remove unused dependencies
|
|
176
|
+
|
|
177
|
+
You build modern, accessible, performant web applications that delight users and meet business requirements.
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: github-sync
|
|
3
|
+
description: Bi-directional synchronization between GitHub and SpecWeave. Maps GitHub Milestones to Release Plans, Issues to RFCs/Tasks. Maintains sync status. Activates for GitHub, sync GitHub, map GitHub to SpecWeave, GitHub issues.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitHub Sync Skill
|
|
7
|
+
|
|
8
|
+
**Purpose**: Enable bi-directional synchronization between GitHub and SpecWeave.
|
|
9
|
+
|
|
10
|
+
**When to Use**: When integrating SpecWeave with GitHub Projects/Issues.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## GitHub Concept Mapping
|
|
15
|
+
|
|
16
|
+
| GitHub Concept | SpecWeave Concept | Location |
|
|
17
|
+
|----------------|-------------------|----------|
|
|
18
|
+
| **Milestone** | **Release Plan** | `docs/internal/delivery/release-v1.0.md` |
|
|
19
|
+
| **Project** | **Increment** or **Release** | Depends on scope |
|
|
20
|
+
| **Issue (feature)** | **RFC** | `docs/internal/architecture/rfc/0001-{name}.md` |
|
|
21
|
+
| **Issue (bug)** | **Incident** | `docs/internal/operations/incidents/{id}.md` |
|
|
22
|
+
| **Issue (task)** | **Task** | `features/{increment}/tasks.md` |
|
|
23
|
+
| **Pull Request** | **Implementation** | Code linked to increment |
|
|
24
|
+
| **Label** | **Tag** | `metadata.yaml` → tags |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Status Mapping
|
|
29
|
+
|
|
30
|
+
| GitHub State | SpecWeave Status | Notes |
|
|
31
|
+
|--------------|------------------|-------|
|
|
32
|
+
| Open | `planned` or `in_progress` | Depends on labels/assignee |
|
|
33
|
+
| Closed | `completed` or `cancelled` | Depends on why closed |
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Configuration
|
|
38
|
+
|
|
39
|
+
**.specweave/config.yaml**:
|
|
40
|
+
```yaml
|
|
41
|
+
sync:
|
|
42
|
+
github:
|
|
43
|
+
enabled: true
|
|
44
|
+
repo: company/repo
|
|
45
|
+
auth:
|
|
46
|
+
type: token
|
|
47
|
+
token_env: GITHUB_TOKEN
|
|
48
|
+
sync_interval: 15m
|
|
49
|
+
webhooks:
|
|
50
|
+
enabled: true
|
|
51
|
+
secret_env: GITHUB_WEBHOOK_SECRET
|
|
52
|
+
mappings:
|
|
53
|
+
milestone: release_plan
|
|
54
|
+
issue_feature: rfc # Issues labeled "feature"
|
|
55
|
+
issue_bug: incident # Issues labeled "bug"
|
|
56
|
+
issue_task: task # Issues labeled "task"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Authentication
|
|
62
|
+
|
|
63
|
+
### Personal Access Token
|
|
64
|
+
|
|
65
|
+
1. **Generate Token**: GitHub → Settings → Developer Settings → Personal Access Tokens
|
|
66
|
+
2. **Scopes**: `repo`, `read:project`
|
|
67
|
+
3. **Set Environment Variable**:
|
|
68
|
+
```bash
|
|
69
|
+
export GITHUB_TOKEN="your_token_here"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## ⚠️ CRITICAL: Secrets Required (MANDATORY CHECK)
|
|
75
|
+
|
|
76
|
+
**BEFORE attempting GitHub sync, CHECK for GitHub token.**
|
|
77
|
+
|
|
78
|
+
### Step 1: Check If Token Exists
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Check .env file
|
|
82
|
+
if [ -f .env ] && grep -q "GITHUB_TOKEN" .env; then
|
|
83
|
+
echo "✅ GitHub token found"
|
|
84
|
+
else
|
|
85
|
+
# Token NOT found - STOP and prompt user
|
|
86
|
+
fi
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Step 2: If Token Missing, STOP and Show This Message
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
🔐 **GitHub Personal Access Token Required**
|
|
93
|
+
|
|
94
|
+
I need your GitHub Personal Access Token to sync with GitHub.
|
|
95
|
+
|
|
96
|
+
**How to get it**:
|
|
97
|
+
1. Go to: https://github.com/settings/tokens
|
|
98
|
+
2. Click "Generate new token" → "Generate new token (classic)"
|
|
99
|
+
3. Give it a name (e.g., "specweave-sync")
|
|
100
|
+
4. Select scopes:
|
|
101
|
+
✅ **repo** (Full control of private repositories)
|
|
102
|
+
✅ **read:org** (Read org and team membership, read org projects)
|
|
103
|
+
✅ **workflow** (Update GitHub Action workflows)
|
|
104
|
+
5. Click "Generate token"
|
|
105
|
+
6. **Copy the token immediately** (you can't see it again!)
|
|
106
|
+
|
|
107
|
+
**Where I'll save it**:
|
|
108
|
+
- File: `.env` (gitignored, secure)
|
|
109
|
+
- Format: `GITHUB_TOKEN=ghp_your-token-here`
|
|
110
|
+
|
|
111
|
+
**Security**:
|
|
112
|
+
✅ .env is in .gitignore (never committed to git)
|
|
113
|
+
✅ Token format: `ghp_` followed by 40 alphanumeric characters
|
|
114
|
+
✅ Stored locally only (not in source code)
|
|
115
|
+
|
|
116
|
+
Please paste your GitHub Personal Access Token:
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step 3: Validate Token Format
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# GitHub tokens start with ghp_ and are 40 chars after prefix
|
|
123
|
+
if [[ ! "$GITHUB_TOKEN" =~ ^ghp_[a-zA-Z0-9]{40}$ ]]; then
|
|
124
|
+
echo "⚠️ Warning: Token format unexpected"
|
|
125
|
+
echo "Expected: ghp_ followed by 40 alphanumeric characters"
|
|
126
|
+
echo "Got: ${#GITHUB_TOKEN} total characters"
|
|
127
|
+
echo ""
|
|
128
|
+
echo "This might not be a valid GitHub Personal Access Token."
|
|
129
|
+
echo "Continue anyway? (yes/no)"
|
|
130
|
+
fi
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Step 4: Save Token Securely
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Save to .env
|
|
137
|
+
echo "GITHUB_TOKEN=$GITHUB_TOKEN" >> .env
|
|
138
|
+
|
|
139
|
+
# Ensure .env is gitignored
|
|
140
|
+
if ! grep -q "^\\.env$" .gitignore; then
|
|
141
|
+
echo ".env" >> .gitignore
|
|
142
|
+
fi
|
|
143
|
+
|
|
144
|
+
# Create .env.example for team
|
|
145
|
+
cat > .env.example << 'EOF'
|
|
146
|
+
# GitHub Personal Access Token
|
|
147
|
+
# Get from: https://github.com/settings/tokens
|
|
148
|
+
# Scopes: repo, read:org, workflow
|
|
149
|
+
GITHUB_TOKEN=ghp_your-github-token-here
|
|
150
|
+
EOF
|
|
151
|
+
|
|
152
|
+
echo "✅ Token saved to .env (gitignored)"
|
|
153
|
+
echo "✅ Created .env.example for team (commit this)"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Step 5: Use Token in Sync
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Export for GitHub CLI or API calls
|
|
160
|
+
export GITHUB_TOKEN=$(grep GITHUB_TOKEN .env | cut -d '=' -f2)
|
|
161
|
+
|
|
162
|
+
# Use in GitHub API calls
|
|
163
|
+
curl -H "Authorization: token $GITHUB_TOKEN" \
|
|
164
|
+
https://api.github.com/repos/owner/repo/issues
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Step 6: Never Log Secrets
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# ❌ WRONG - Logs secret
|
|
171
|
+
echo "Using token: $GITHUB_TOKEN"
|
|
172
|
+
|
|
173
|
+
# ✅ CORRECT - Masks secret
|
|
174
|
+
echo "Using GitHub token (token present: ✅)"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Step 7: Error Handling
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# If API call fails with 401 Unauthorized
|
|
181
|
+
if [ $? -eq 401 ]; then
|
|
182
|
+
echo "❌ GitHub token invalid or expired"
|
|
183
|
+
echo ""
|
|
184
|
+
echo "Possible causes:"
|
|
185
|
+
echo "1. Token expired (GitHub tokens can expire)"
|
|
186
|
+
echo "2. Token revoked"
|
|
187
|
+
echo "3. Insufficient scopes (need: repo, read:org)"
|
|
188
|
+
echo ""
|
|
189
|
+
echo "Please generate a new token:"
|
|
190
|
+
echo "https://github.com/settings/tokens"
|
|
191
|
+
fi
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Step 8: Production Recommendations
|
|
195
|
+
|
|
196
|
+
**For production deployments, use GitHub Apps** instead of Personal Access Tokens:
|
|
197
|
+
|
|
198
|
+
**Why GitHub Apps?**
|
|
199
|
+
- ✅ Fine-grained permissions (repository-level)
|
|
200
|
+
- ✅ Higher rate limits (5000 vs 60 per hour)
|
|
201
|
+
- ✅ Organization-scoped (not tied to individual user)
|
|
202
|
+
- ✅ Automatic token rotation
|
|
203
|
+
- ✅ Audit trail in GitHub UI
|
|
204
|
+
|
|
205
|
+
**How to create GitHub App**:
|
|
206
|
+
1. Go to: https://github.com/settings/apps
|
|
207
|
+
2. Click "New GitHub App"
|
|
208
|
+
3. Configure:
|
|
209
|
+
- Name: "SpecWeave Sync"
|
|
210
|
+
- Permissions: Issues (Read & Write), Projects (Read & Write)
|
|
211
|
+
- Install to your organization
|
|
212
|
+
4. Use GitHub App authentication instead of PAT
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## Sync Commands
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Sync all
|
|
220
|
+
specweave sync --all
|
|
221
|
+
|
|
222
|
+
# Sync specific increment
|
|
223
|
+
specweave sync --increment 0001 --tool github
|
|
224
|
+
|
|
225
|
+
# Pull from GitHub
|
|
226
|
+
specweave sync --increment 0001 --tool github --direction pull
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Traceability
|
|
232
|
+
|
|
233
|
+
**Command**: `specweave trace --github-milestone 5`
|
|
234
|
+
|
|
235
|
+
**Output**:
|
|
236
|
+
```
|
|
237
|
+
GitHub Milestone: 5 "v1.0 Release"
|
|
238
|
+
URL: https://github.com/company/repo/milestone/5
|
|
239
|
+
↓
|
|
240
|
+
SpecWeave Release Plan: docs/internal/delivery/release-v1.0.md
|
|
241
|
+
Increments Included:
|
|
242
|
+
- 0001-user-authentication
|
|
243
|
+
- 0002-payment-processing
|
|
244
|
+
- 0003-notification-system
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Related Documentation
|
|
250
|
+
|
|
251
|
+
- [Tool Concept Mapping](../../../docs/internal/delivery/guides/tool-concept-mapping.md)
|
|
252
|
+
- [jira-sync/SKILL.md](../jira-sync/SKILL.md) - Similar sync pattern
|