specweave 0.23.16 → 0.24.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/.claude-plugin/marketplace.json +93 -38
- package/CLAUDE.md +159 -11
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +57 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts +89 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts.map +1 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js +213 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts +29 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js +109 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +2 -0
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/smart-filter.d.ts +83 -0
- package/dist/src/cli/helpers/smart-filter.d.ts.map +1 -0
- package/dist/src/cli/helpers/smart-filter.js +265 -0
- package/dist/src/cli/helpers/smart-filter.js.map +1 -0
- package/dist/src/core/progress/progress-tracker.d.ts +4 -1
- package/dist/src/core/progress/progress-tracker.d.ts.map +1 -1
- package/dist/src/core/progress/progress-tracker.js +33 -4
- package/dist/src/core/progress/progress-tracker.js.map +1 -1
- package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
- package/dist/src/core/qa/quality-gate-decider.js +2 -2
- package/dist/src/core/qa/quality-gate-decider.js.map +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts +2 -2
- package/dist/src/core/qa/risk-calculator.js +2 -2
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/validators/ac-presence-validator.d.ts +56 -0
- package/dist/src/core/validators/ac-presence-validator.d.ts.map +1 -0
- package/dist/src/core/validators/ac-presence-validator.js +149 -0
- package/dist/src/core/validators/ac-presence-validator.js.map +1 -0
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.d.ts.map +1 -1
- package/dist/src/integrations/ado/ado-dependency-loader.js +39 -7
- package/dist/src/integrations/ado/ado-dependency-loader.js.map +1 -1
- package/dist/src/integrations/ado/area-path-mapper.d.ts +137 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.js +267 -0
- package/dist/src/integrations/ado/area-path-mapper.js.map +1 -0
- package/dist/src/integrations/jira/filter-processor.d.ts +126 -0
- package/dist/src/integrations/jira/filter-processor.d.ts.map +1 -0
- package/dist/src/integrations/jira/filter-processor.js +207 -0
- package/dist/src/integrations/jira/filter-processor.js.map +1 -0
- package/dist/src/integrations/jira/jira-client.d.ts +13 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +33 -0
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/utils/ac-embedder.d.ts +63 -0
- package/dist/src/utils/ac-embedder.d.ts.map +1 -0
- package/dist/src/utils/ac-embedder.js +217 -0
- package/dist/src/utils/ac-embedder.js.map +1 -0
- package/dist/src/utils/env-manager.d.ts +86 -0
- package/dist/src/utils/env-manager.d.ts.map +1 -0
- package/dist/src/utils/env-manager.js +188 -0
- package/dist/src/utils/env-manager.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave/agents/AGENTS-INDEX.md +1 -1
- package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +9 -9
- package/plugins/specweave/commands/specweave-do.md +37 -0
- package/plugins/specweave/commands/specweave-done.md +159 -0
- package/plugins/specweave/commands/specweave-embed-acs.md +446 -0
- package/plugins/specweave/commands/specweave-next.md +148 -3
- package/plugins/specweave/commands/specweave-qa.md +2 -2
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh +1 -1
- package/plugins/specweave/hooks/lib/migrate-increment-work.sh.bak +245 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/lib/sync-spec-content.sh.bak +149 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +34 -4
- package/plugins/specweave/hooks/lib/validate-spec-status.sh +1 -1
- package/plugins/specweave/hooks/lib/validate-spec-status.sh.bak +163 -0
- package/plugins/specweave/hooks/post-first-increment.sh +1 -1
- package/plugins/specweave/hooks/post-first-increment.sh.bak +61 -0
- package/plugins/specweave/hooks/post-spec-update.sh +1 -1
- package/plugins/specweave/hooks/post-spec-update.sh.bak +158 -0
- package/plugins/specweave/hooks/post-user-story-complete.sh +1 -1
- package/plugins/specweave/hooks/post-user-story-complete.sh.bak +179 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +1 -1
- package/plugins/specweave/hooks/pre-command-deduplication.sh.bak +83 -0
- package/plugins/specweave/hooks/pre-increment-start.sh +168 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/hooks/user-prompt-submit.sh.bak +386 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
- package/plugins/specweave/skills/specweave-framework/SKILL.md +1 -1
- package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-ado/agents/ado-manager/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-multi-project-mapper/AGENT.md +23 -0
- package/plugins/specweave-ado/agents/ado-sync-judge/AGENT.md +23 -0
- package/plugins/specweave-ado/commands/specweave-ado-import-projects.md +331 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-alternatives/commands/alternatives-analyze.md +336 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +651 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +420 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +487 -0
- package/plugins/specweave-backend/agents/database-optimizer/AGENT.md +23 -0
- package/plugins/specweave-backend/commands/api-scaffold.md +80 -0
- package/plugins/specweave-backend/commands/crud-generate.md +109 -0
- package/plugins/specweave-backend/commands/migration-generate.md +139 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +23 -0
- package/plugins/specweave-confluent/commands/connector-deploy.md +154 -0
- package/plugins/specweave-confluent/commands/ksqldb-query.md +179 -0
- package/plugins/specweave-confluent/commands/schema-register.md +123 -0
- package/plugins/specweave-core/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-core/commands/architecture-review.md +288 -0
- package/plugins/specweave-core/commands/code-review.md +213 -0
- package/plugins/specweave-core/commands/refactor-plan.md +249 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +157 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +244 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +83 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-cost-optimizer/commands/cost-analyze.md +360 -0
- package/plugins/specweave-cost-optimizer/commands/cost-optimize.md +480 -0
- package/plugins/specweave-cost-optimizer/skills/aws-cost-expert/SKILL.md +416 -0
- package/plugins/specweave-cost-optimizer/skills/cloud-pricing/SKILL.md +325 -0
- package/plugins/specweave-cost-optimizer/skills/cost-optimization/SKILL.md +337 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +23 -0
- package/plugins/specweave-diagrams/commands/diagrams-generate.md +168 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-docs/commands/docs-generate.md +441 -0
- package/plugins/specweave-docs/commands/docs-init.md +334 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +581 -0
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +689 -0
- package/plugins/specweave-docs/skills/technical-writing/SKILL.md +1039 -0
- package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-figma/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-figma/commands/figma-import.md +690 -0
- package/plugins/specweave-figma/commands/figma-to-react.md +834 -0
- package/plugins/specweave-figma/commands/figma-tokens.md +815 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +387 -0
- package/plugins/specweave-frontend/agents/frontend-architect/README.md +385 -0
- package/plugins/specweave-frontend/agents/frontend-architect/examples.md +590 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/component-template.tsx +152 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/hook-template.ts +311 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/page-template.tsx +228 -0
- package/plugins/specweave-frontend/commands/component-generate.md +510 -0
- package/plugins/specweave-frontend/commands/design-system-init.md +494 -0
- package/plugins/specweave-frontend/commands/frontend-scaffold.md +207 -0
- package/plugins/specweave-frontend/commands/nextjs-setup.md +396 -0
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +278 -0
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +420 -0
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +546 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-github/agents/github-manager/AGENT.md +23 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +25 -0
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +25 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +194 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +49 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +67 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-infrastructure/agents/devops/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/network-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/performance-engineer/AGENT.md +26 -0
- package/plugins/specweave-infrastructure/agents/sre/AGENT.md +26 -0
- package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/agents/jira-manager/AGENT.md +26 -0
- package/plugins/specweave-jira/commands/import-projects.js +183 -0
- package/plugins/specweave-jira/commands/import-projects.md +97 -0
- package/plugins/specweave-jira/commands/import-projects.ts +288 -0
- package/plugins/specweave-jira/commands/specweave-jira-import-projects.md +298 -0
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +26 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +26 -0
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kubernetes/agents/kubernetes-architect/AGENT.md +26 -0
- package/plugins/specweave-kubernetes/commands/cluster-setup.md +262 -0
- package/plugins/specweave-kubernetes/commands/deployment-generate.md +242 -0
- package/plugins/specweave-kubernetes/commands/helm-scaffold.md +333 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +3 -3
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +26 -0
- package/plugins/specweave-ml/agents/mlops-engineer/AGENT.md +26 -0
- package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +26 -0
- package/plugins/specweave-mobile/commands/app-scaffold.md +233 -0
- package/plugins/specweave-mobile/commands/build-config.md +256 -0
- package/plugins/specweave-mobile/commands/screen-generate.md +289 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-payments/agents/payment-integration/AGENT.md +26 -0
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +20 -0
- package/plugins/specweave-plugin-dev/commands/plugin-create.md +333 -0
- package/plugins/specweave-plugin-dev/commands/plugin-publish.md +339 -0
- package/plugins/specweave-plugin-dev/commands/plugin-test.md +293 -0
- package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +162 -0
- package/plugins/specweave-plugin-dev/skills/marketplace-publishing/SKILL.md +263 -0
- package/plugins/specweave-plugin-dev/skills/plugin-development/SKILL.md +316 -0
- package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-release/agents/release-manager/AGENT.md +27 -0
- package/plugins/specweave-release/commands/specweave-release-npm.md +110 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +168 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +797 -0
- package/plugins/specweave-testing/agents/qa-engineer/README.md +443 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/playwright-e2e-test.ts +470 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/test-data-factory.ts +507 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/vitest-unit-test.ts +400 -0
- package/plugins/specweave-testing/agents/qa-engineer/test-strategies.md +726 -0
- package/plugins/specweave-testing/commands/e2e-setup.md +1081 -0
- package/plugins/specweave-testing/commands/test-coverage.md +979 -0
- package/plugins/specweave-testing/commands/test-generate.md +1156 -0
- package/plugins/specweave-testing/commands/test-init.md +409 -0
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +769 -0
- package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +934 -0
- package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +1011 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-create.md +691 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-package.md +751 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-validate.md +858 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-ui/commands/ui-automate.md +199 -0
- package/plugins/specweave-ui/commands/ui-inspect.md +70 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +314 -0
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +716 -0
- package/plugins/specweave-ui/skills/visual-regression/SKILL.md +728 -0
- package/plugins/specweave/commands/check-hooks.md +0 -257
- package/plugins/specweave/commands/specweave-archive-increments.md +0 -82
- package/plugins/specweave/skills/plugin-expert/SKILL.md +0 -340
- /package/plugins/specweave/{agents/code-reviewer.md → skills/code-reviewer/SKILL.md} +0 -0
|
@@ -0,0 +1,546 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nextjs
|
|
3
|
+
description: Expert in Next.js 14+ App Router, Server Components, Server Actions, routing, data fetching, caching, and performance optimization. Activates for Next.js, Next, App Router, Server Components, RSC, Next.js 14, SSR, SSG, ISR, metadata, SEO.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Next.js Expert
|
|
7
|
+
|
|
8
|
+
You are an expert in Next.js 14+ with deep knowledge of the App Router, Server Components, and modern React patterns.
|
|
9
|
+
|
|
10
|
+
## Core Expertise
|
|
11
|
+
|
|
12
|
+
### 1. App Router Architecture
|
|
13
|
+
|
|
14
|
+
**File-System Based Routing**:
|
|
15
|
+
```
|
|
16
|
+
app/
|
|
17
|
+
├── layout.tsx # Root layout
|
|
18
|
+
├── page.tsx # Home page (/)
|
|
19
|
+
├── loading.tsx # Loading UI
|
|
20
|
+
├── error.tsx # Error boundary
|
|
21
|
+
├── not-found.tsx # 404 page
|
|
22
|
+
├── about/
|
|
23
|
+
│ └── page.tsx # /about
|
|
24
|
+
├── blog/
|
|
25
|
+
│ ├── page.tsx # /blog
|
|
26
|
+
│ └── [slug]/
|
|
27
|
+
│ └── page.tsx # /blog/[slug]
|
|
28
|
+
└── (marketing)/ # Route group (doesn't affect URL)
|
|
29
|
+
├── layout.tsx
|
|
30
|
+
└── features/
|
|
31
|
+
└── page.tsx # /features
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Route Groups**:
|
|
35
|
+
- `(marketing)`, `(dashboard)` for organizing routes
|
|
36
|
+
- Shared layouts within groups
|
|
37
|
+
- Different root layouts per group
|
|
38
|
+
|
|
39
|
+
**Dynamic Routes**:
|
|
40
|
+
- `[slug]` for single dynamic segment
|
|
41
|
+
- `[...slug]` for catch-all routes
|
|
42
|
+
- `[[...slug]]` for optional catch-all routes
|
|
43
|
+
|
|
44
|
+
### 2. Server Components (RSC)
|
|
45
|
+
|
|
46
|
+
**Server Component Benefits**:
|
|
47
|
+
- Zero JavaScript sent to client
|
|
48
|
+
- Direct database/API access
|
|
49
|
+
- Automatic code splitting
|
|
50
|
+
- Streaming and Suspense support
|
|
51
|
+
- Better SEO (fully rendered HTML)
|
|
52
|
+
|
|
53
|
+
**Server Component Example**:
|
|
54
|
+
```typescript
|
|
55
|
+
// app/posts/page.tsx (Server Component by default)
|
|
56
|
+
async function getPosts() {
|
|
57
|
+
const res = await fetch('https://api.example.com/posts', {
|
|
58
|
+
next: { revalidate: 3600 }, // ISR: revalidate every hour
|
|
59
|
+
});
|
|
60
|
+
return res.json();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export default async function PostsPage() {
|
|
64
|
+
const posts = await getPosts();
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div>
|
|
68
|
+
<h1>Posts</h1>
|
|
69
|
+
{posts.map((post) => (
|
|
70
|
+
<article key={post.id}>
|
|
71
|
+
<h2>{post.title}</h2>
|
|
72
|
+
<p>{post.excerpt}</p>
|
|
73
|
+
</article>
|
|
74
|
+
))}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Client Components**:
|
|
81
|
+
```typescript
|
|
82
|
+
'use client'; // Mark as Client Component
|
|
83
|
+
|
|
84
|
+
import { useState } from 'react';
|
|
85
|
+
|
|
86
|
+
export function Counter() {
|
|
87
|
+
const [count, setCount] = useState(0);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<button onClick={() => setCount(count + 1)}>
|
|
91
|
+
Count: {count}
|
|
92
|
+
</button>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Composition Pattern**:
|
|
98
|
+
```typescript
|
|
99
|
+
// Server Component
|
|
100
|
+
import { ClientButton } from './ClientButton';
|
|
101
|
+
|
|
102
|
+
export default async function Page() {
|
|
103
|
+
const data = await fetchData(); // Server-side data fetching
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div>
|
|
107
|
+
<h1>{data.title}</h1>
|
|
108
|
+
<ClientButton /> {/* Client Component for interactivity */}
|
|
109
|
+
</div>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### 3. Data Fetching Strategies
|
|
115
|
+
|
|
116
|
+
**Server-Side Rendering (SSR)**:
|
|
117
|
+
```typescript
|
|
118
|
+
// Dynamic data fetching (SSR)
|
|
119
|
+
async function getData() {
|
|
120
|
+
const res = await fetch('https://api.example.com/data', {
|
|
121
|
+
cache: 'no-store', // Never cache, always fresh
|
|
122
|
+
});
|
|
123
|
+
return res.json();
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Static Site Generation (SSG)**:
|
|
128
|
+
```typescript
|
|
129
|
+
// Static data fetching (SSG)
|
|
130
|
+
async function getData() {
|
|
131
|
+
const res = await fetch('https://api.example.com/data', {
|
|
132
|
+
cache: 'force-cache', // Cache by default
|
|
133
|
+
});
|
|
134
|
+
return res.json();
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Incremental Static Regeneration (ISR)**:
|
|
139
|
+
```typescript
|
|
140
|
+
// Revalidate every 60 seconds
|
|
141
|
+
async function getData() {
|
|
142
|
+
const res = await fetch('https://api.example.com/data', {
|
|
143
|
+
next: { revalidate: 60 },
|
|
144
|
+
});
|
|
145
|
+
return res.json();
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**On-Demand Revalidation**:
|
|
150
|
+
```typescript
|
|
151
|
+
// app/api/revalidate/route.ts
|
|
152
|
+
import { revalidatePath, revalidateTag } from 'next/cache';
|
|
153
|
+
|
|
154
|
+
export async function POST() {
|
|
155
|
+
revalidatePath('/posts'); // Revalidate specific path
|
|
156
|
+
revalidateTag('posts'); // Revalidate by cache tag
|
|
157
|
+
return Response.json({ revalidated: true });
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 4. Caching Strategies
|
|
162
|
+
|
|
163
|
+
**Fetch Caching**:
|
|
164
|
+
```typescript
|
|
165
|
+
// Force cache (default)
|
|
166
|
+
fetch('...', { cache: 'force-cache' });
|
|
167
|
+
|
|
168
|
+
// No cache (SSR)
|
|
169
|
+
fetch('...', { cache: 'no-store' });
|
|
170
|
+
|
|
171
|
+
// Revalidate periodically (ISR)
|
|
172
|
+
fetch('...', { next: { revalidate: 3600 } });
|
|
173
|
+
|
|
174
|
+
// Tag-based revalidation
|
|
175
|
+
fetch('...', { next: { tags: ['posts'] } });
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**React Cache**:
|
|
179
|
+
```typescript
|
|
180
|
+
import { cache } from 'react';
|
|
181
|
+
|
|
182
|
+
// Deduplicate requests within a single render
|
|
183
|
+
const getUser = cache(async (id: string) => {
|
|
184
|
+
const res = await fetch(`/api/users/${id}`);
|
|
185
|
+
return res.json();
|
|
186
|
+
});
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Unstable Cache** (Experimental):
|
|
190
|
+
```typescript
|
|
191
|
+
import { unstable_cache } from 'next/cache';
|
|
192
|
+
|
|
193
|
+
const getCachedData = unstable_cache(
|
|
194
|
+
async (id) => {
|
|
195
|
+
return await db.query(id);
|
|
196
|
+
},
|
|
197
|
+
['data-key'],
|
|
198
|
+
{ revalidate: 3600 }
|
|
199
|
+
);
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### 5. Server Actions
|
|
203
|
+
|
|
204
|
+
**Form Handling**:
|
|
205
|
+
```typescript
|
|
206
|
+
// app/posts/create/page.tsx
|
|
207
|
+
import { createPost } from './actions';
|
|
208
|
+
|
|
209
|
+
export default function CreatePostPage() {
|
|
210
|
+
return (
|
|
211
|
+
<form action={createPost}>
|
|
212
|
+
<input name="title" required />
|
|
213
|
+
<textarea name="content" required />
|
|
214
|
+
<button type="submit">Create Post</button>
|
|
215
|
+
</form>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// app/posts/create/actions.ts
|
|
220
|
+
'use server';
|
|
221
|
+
|
|
222
|
+
import { revalidatePath } from 'next/cache';
|
|
223
|
+
import { redirect } from 'next/navigation';
|
|
224
|
+
|
|
225
|
+
export async function createPost(formData: FormData) {
|
|
226
|
+
const title = formData.get('title') as string;
|
|
227
|
+
const content = formData.get('content') as string;
|
|
228
|
+
|
|
229
|
+
// Validate
|
|
230
|
+
if (!title || !content) {
|
|
231
|
+
throw new Error('Title and content are required');
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// Database operation
|
|
235
|
+
await db.post.create({ data: { title, content } });
|
|
236
|
+
|
|
237
|
+
// Revalidate and redirect
|
|
238
|
+
revalidatePath('/posts');
|
|
239
|
+
redirect('/posts');
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**Progressive Enhancement**:
|
|
244
|
+
```typescript
|
|
245
|
+
'use client';
|
|
246
|
+
|
|
247
|
+
import { useFormStatus } from 'react-dom';
|
|
248
|
+
|
|
249
|
+
function SubmitButton() {
|
|
250
|
+
const { pending } = useFormStatus();
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<button disabled={pending}>
|
|
254
|
+
{pending ? 'Creating...' : 'Create Post'}
|
|
255
|
+
</button>
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 6. Routing and Navigation
|
|
261
|
+
|
|
262
|
+
**Link Component**:
|
|
263
|
+
```typescript
|
|
264
|
+
import Link from 'next/link';
|
|
265
|
+
|
|
266
|
+
<Link href="/about">About</Link>
|
|
267
|
+
<Link href="/posts/123">Post 123</Link>
|
|
268
|
+
<Link href={{ pathname: '/posts/[id]', query: { id: '123' } }}>
|
|
269
|
+
Post 123
|
|
270
|
+
</Link>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
**useRouter Hook**:
|
|
274
|
+
```typescript
|
|
275
|
+
'use client';
|
|
276
|
+
|
|
277
|
+
import { useRouter } from 'next/navigation';
|
|
278
|
+
|
|
279
|
+
export function NavigateButton() {
|
|
280
|
+
const router = useRouter();
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<button onClick={() => router.push('/dashboard')}>
|
|
284
|
+
Go to Dashboard
|
|
285
|
+
</button>
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Parallel Routes**:
|
|
291
|
+
```
|
|
292
|
+
app/
|
|
293
|
+
├── @team/
|
|
294
|
+
│ └── page.tsx
|
|
295
|
+
├── @analytics/
|
|
296
|
+
│ └── page.tsx
|
|
297
|
+
└── layout.tsx # Renders both @team and @analytics
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
**Intercepting Routes**:
|
|
301
|
+
```
|
|
302
|
+
app/
|
|
303
|
+
├── photos/
|
|
304
|
+
│ ├── [id]/
|
|
305
|
+
│ │ └── page.tsx
|
|
306
|
+
│ └── (.)[id]/ # Intercept when navigating from /photos
|
|
307
|
+
│ └── page.tsx
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### 7. Metadata and SEO
|
|
311
|
+
|
|
312
|
+
**Static Metadata**:
|
|
313
|
+
```typescript
|
|
314
|
+
import type { Metadata } from 'next';
|
|
315
|
+
|
|
316
|
+
export const metadata: Metadata = {
|
|
317
|
+
title: 'My App',
|
|
318
|
+
description: 'App description',
|
|
319
|
+
openGraph: {
|
|
320
|
+
title: 'My App',
|
|
321
|
+
description: 'App description',
|
|
322
|
+
images: ['/og-image.jpg'],
|
|
323
|
+
},
|
|
324
|
+
twitter: {
|
|
325
|
+
card: 'summary_large_image',
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Dynamic Metadata**:
|
|
331
|
+
```typescript
|
|
332
|
+
export async function generateMetadata({ params }): Promise<Metadata> {
|
|
333
|
+
const post = await getPost(params.id);
|
|
334
|
+
|
|
335
|
+
return {
|
|
336
|
+
title: post.title,
|
|
337
|
+
description: post.excerpt,
|
|
338
|
+
openGraph: {
|
|
339
|
+
title: post.title,
|
|
340
|
+
description: post.excerpt,
|
|
341
|
+
images: [post.image],
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**JSON-LD Structured Data**:
|
|
348
|
+
```typescript
|
|
349
|
+
export default function BlogPost({ post }) {
|
|
350
|
+
const jsonLd = {
|
|
351
|
+
'@context': 'https://schema.org',
|
|
352
|
+
'@type': 'Article',
|
|
353
|
+
headline: post.title,
|
|
354
|
+
author: {
|
|
355
|
+
'@type': 'Person',
|
|
356
|
+
name: post.author,
|
|
357
|
+
},
|
|
358
|
+
datePublished: post.publishedAt,
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<>
|
|
363
|
+
<script
|
|
364
|
+
type="application/ld+json"
|
|
365
|
+
dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}
|
|
366
|
+
/>
|
|
367
|
+
<article>{/* ... */}</article>
|
|
368
|
+
</>
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
### 8. API Routes (Route Handlers)
|
|
374
|
+
|
|
375
|
+
**Basic API Route**:
|
|
376
|
+
```typescript
|
|
377
|
+
// app/api/hello/route.ts
|
|
378
|
+
import { NextRequest, NextResponse } from 'next/server';
|
|
379
|
+
|
|
380
|
+
export async function GET(request: NextRequest) {
|
|
381
|
+
return NextResponse.json({ message: 'Hello World' });
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export async function POST(request: NextRequest) {
|
|
385
|
+
const body = await request.json();
|
|
386
|
+
// Process request
|
|
387
|
+
return NextResponse.json({ success: true, data: body });
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Dynamic API Routes**:
|
|
392
|
+
```typescript
|
|
393
|
+
// app/api/posts/[id]/route.ts
|
|
394
|
+
export async function GET(
|
|
395
|
+
request: NextRequest,
|
|
396
|
+
{ params }: { params: { id: string } }
|
|
397
|
+
) {
|
|
398
|
+
const post = await getPost(params.id);
|
|
399
|
+
return NextResponse.json(post);
|
|
400
|
+
}
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Middleware**:
|
|
404
|
+
```typescript
|
|
405
|
+
// middleware.ts (root level)
|
|
406
|
+
import { NextResponse } from 'next/server';
|
|
407
|
+
import type { NextRequest } from 'next/server';
|
|
408
|
+
|
|
409
|
+
export function middleware(request: NextRequest) {
|
|
410
|
+
// Auth check
|
|
411
|
+
const token = request.cookies.get('token');
|
|
412
|
+
|
|
413
|
+
if (!token && request.nextUrl.pathname.startsWith('/dashboard')) {
|
|
414
|
+
return NextResponse.redirect(new URL('/login', request.url));
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return NextResponse.next();
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export const config = {
|
|
421
|
+
matcher: ['/dashboard/:path*'],
|
|
422
|
+
};
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### 9. Image Optimization
|
|
426
|
+
|
|
427
|
+
**next/image**:
|
|
428
|
+
```typescript
|
|
429
|
+
import Image from 'next/image';
|
|
430
|
+
|
|
431
|
+
// Local image
|
|
432
|
+
<Image
|
|
433
|
+
src="/hero.jpg"
|
|
434
|
+
alt="Hero"
|
|
435
|
+
width={1200}
|
|
436
|
+
height={600}
|
|
437
|
+
priority // Load immediately
|
|
438
|
+
/>
|
|
439
|
+
|
|
440
|
+
// Remote image
|
|
441
|
+
<Image
|
|
442
|
+
src="https://example.com/image.jpg"
|
|
443
|
+
alt="Remote image"
|
|
444
|
+
width={800}
|
|
445
|
+
height={400}
|
|
446
|
+
placeholder="blur"
|
|
447
|
+
blurDataURL="data:image/jpeg;base64,..."
|
|
448
|
+
/>
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Image Configuration**:
|
|
452
|
+
```javascript
|
|
453
|
+
// next.config.js
|
|
454
|
+
module.exports = {
|
|
455
|
+
images: {
|
|
456
|
+
remotePatterns: [
|
|
457
|
+
{
|
|
458
|
+
protocol: 'https',
|
|
459
|
+
hostname: 'images.example.com',
|
|
460
|
+
},
|
|
461
|
+
],
|
|
462
|
+
formats: ['image/avif', 'image/webp'],
|
|
463
|
+
},
|
|
464
|
+
};
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### 10. Performance Optimization
|
|
468
|
+
|
|
469
|
+
**Code Splitting**:
|
|
470
|
+
```typescript
|
|
471
|
+
import dynamic from 'next/dynamic';
|
|
472
|
+
|
|
473
|
+
// Dynamic import with loading state
|
|
474
|
+
const DynamicComponent = dynamic(() => import('@/components/Heavy'), {
|
|
475
|
+
loading: () => <p>Loading...</p>,
|
|
476
|
+
ssr: false, // Disable SSR for this component
|
|
477
|
+
});
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
**Streaming with Suspense**:
|
|
481
|
+
```typescript
|
|
482
|
+
import { Suspense } from 'react';
|
|
483
|
+
|
|
484
|
+
export default function Page() {
|
|
485
|
+
return (
|
|
486
|
+
<div>
|
|
487
|
+
<h1>Dashboard</h1>
|
|
488
|
+
<Suspense fallback={<LoadingSkeleton />}>
|
|
489
|
+
<SlowDataComponent />
|
|
490
|
+
</Suspense>
|
|
491
|
+
</div>
|
|
492
|
+
);
|
|
493
|
+
}
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
**Font Optimization**:
|
|
497
|
+
```typescript
|
|
498
|
+
import { Inter, Roboto_Mono } from 'next/font/google';
|
|
499
|
+
|
|
500
|
+
const inter = Inter({ subsets: ['latin'], variable: '--font-inter' });
|
|
501
|
+
const roboto = Roboto_Mono({ subsets: ['latin'], variable: '--font-mono' });
|
|
502
|
+
|
|
503
|
+
// In layout
|
|
504
|
+
<body className={`${inter.variable} ${roboto.variable}`}>
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
## Configuration
|
|
508
|
+
|
|
509
|
+
**next.config.js**:
|
|
510
|
+
```javascript
|
|
511
|
+
/** @type {import('next').NextConfig} */
|
|
512
|
+
const nextConfig = {
|
|
513
|
+
reactStrictMode: true,
|
|
514
|
+
experimental: {
|
|
515
|
+
typedRoutes: true, // Type-safe navigation
|
|
516
|
+
},
|
|
517
|
+
async headers() {
|
|
518
|
+
return [
|
|
519
|
+
{
|
|
520
|
+
source: '/:path*',
|
|
521
|
+
headers: [
|
|
522
|
+
{ key: 'X-DNS-Prefetch-Control', value: 'on' },
|
|
523
|
+
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
|
|
524
|
+
],
|
|
525
|
+
},
|
|
526
|
+
];
|
|
527
|
+
},
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
module.exports = nextConfig;
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## Best Practices
|
|
534
|
+
|
|
535
|
+
1. **Server Components by Default**: Use Client Components only when needed
|
|
536
|
+
2. **Streaming**: Use Suspense for better perceived performance
|
|
537
|
+
3. **Image Optimization**: Always use next/image
|
|
538
|
+
4. **Font Optimization**: Use next/font for automatic optimization
|
|
539
|
+
5. **Metadata**: Use generateMetadata for dynamic SEO
|
|
540
|
+
6. **Caching**: Leverage ISR and revalidation strategies
|
|
541
|
+
7. **Type Safety**: Enable TypeScript strict mode and typed routes
|
|
542
|
+
8. **Security Headers**: Configure in next.config.js
|
|
543
|
+
9. **Error Handling**: Implement error.tsx for error boundaries
|
|
544
|
+
10. **Loading States**: Add loading.tsx for better UX
|
|
545
|
+
|
|
546
|
+
You are ready to build high-performance Next.js applications!
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "specweave-github",
|
|
3
3
|
"description": "GitHub Issues integration for SpecWeave increments. Bidirectional sync between SpecWeave increments and GitHub Issues. Automatically creates issues from increments, tracks progress, and closes issues on completion. Uses GitHub CLI (gh) for seamless integration.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SpecWeave Team",
|
|
7
7
|
"url": "https://spec-weave.com"
|
|
@@ -42,6 +42,29 @@ GitHub issues MUST use living docs format:
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
+
## 🚀 How to Invoke This Agent
|
|
46
|
+
|
|
47
|
+
**Subagent Type**: `specweave-github:github-manager:SpecWeave Sync`
|
|
48
|
+
|
|
49
|
+
**Usage Example**:
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
Task({
|
|
53
|
+
subagent_type: "specweave-github:github-manager:SpecWeave Sync",
|
|
54
|
+
prompt: "Your task description here",
|
|
55
|
+
model: "haiku" // optional: haiku, sonnet, opus
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**Naming Convention**: `{plugin}:{directory}:{yaml-name}`
|
|
60
|
+
- **Plugin**: specweave-github
|
|
61
|
+
- **Directory**: github-manager
|
|
62
|
+
- **YAML Name**: SpecWeave Sync
|
|
63
|
+
|
|
64
|
+
**When to Use**:
|
|
65
|
+
- [TODO: Describe specific use cases for this agent]
|
|
66
|
+
- [TODO: When should this agent be invoked instead of others?]
|
|
67
|
+
- [TODO: What problems does this agent solve?]
|
|
45
68
|
## Capabilities
|
|
46
69
|
|
|
47
70
|
As the GitHub Manager agent, I specialize in:
|
|
@@ -2,6 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
Expert agent for splitting SpecWeave tasks across multiple GitHub repositories based on architecture patterns.
|
|
4
4
|
|
|
5
|
+
## 🚀 How to Invoke This Agent
|
|
6
|
+
|
|
7
|
+
**Subagent Type**: `specweave-github:github-task-splitter:github-task-splitter`
|
|
8
|
+
|
|
9
|
+
**Usage Example**:
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
Task({
|
|
13
|
+
subagent_type: "specweave-github:github-task-splitter:github-task-splitter",
|
|
14
|
+
prompt: "Split tasks for increment 0015-shopping-cart across frontend, backend, and shared repositories",
|
|
15
|
+
model: "haiku" // optional: haiku, sonnet, opus
|
|
16
|
+
});
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Naming Convention**: `{plugin}:{directory}:{yaml-name-or-directory-name}`
|
|
20
|
+
- **Plugin**: specweave-github
|
|
21
|
+
- **Directory**: github-task-splitter
|
|
22
|
+
- **Agent Name**: github-task-splitter
|
|
23
|
+
|
|
24
|
+
**When to Use**:
|
|
25
|
+
- You need to distribute SpecWeave tasks across multiple GitHub repositories based on technology stack
|
|
26
|
+
- You want to analyze task dependencies across different services
|
|
27
|
+
- You need to create tracking issues in multiple repositories for a single increment
|
|
28
|
+
- You're managing a multi-repo architecture (monorepo, microservices, etc.) and need intelligent task distribution
|
|
29
|
+
|
|
5
30
|
## Role
|
|
6
31
|
I analyze SpecWeave increments and intelligently distribute tasks across multiple repositories based on:
|
|
7
32
|
- Repository architecture (single, multi-repo, monorepo, parent)
|
|
@@ -7,6 +7,31 @@ description: Updates GitHub issues for user stories with proper ACs and tasks. A
|
|
|
7
7
|
|
|
8
8
|
**Role**: Updates GitHub issues for individual user stories to include checkable acceptance criteria and task connections.
|
|
9
9
|
|
|
10
|
+
## 🚀 How to Invoke This Agent
|
|
11
|
+
|
|
12
|
+
**Subagent Type**: `specweave-github:user-story-updater:user-story-updater`
|
|
13
|
+
|
|
14
|
+
**Usage Example**:
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
Task({
|
|
18
|
+
subagent_type: "specweave-github:user-story-updater:user-story-updater",
|
|
19
|
+
prompt: "Update GitHub issue #501 for user story FS-031/US-004 with checkable ACs and task connections",
|
|
20
|
+
model: "haiku" // optional: haiku, sonnet, opus
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Naming Convention**: `{plugin}:{directory}:{yaml-name-or-directory-name}`
|
|
25
|
+
- **Plugin**: specweave-github
|
|
26
|
+
- **Directory**: user-story-updater
|
|
27
|
+
- **Agent Name**: user-story-updater
|
|
28
|
+
|
|
29
|
+
**When to Use**:
|
|
30
|
+
- You need to sync user story details from SpecWeave to GitHub issues
|
|
31
|
+
- You want to add checkable acceptance criteria checkboxes to GitHub issues
|
|
32
|
+
- You need to link tasks in SpecWeave tasks.md to GitHub issues
|
|
33
|
+
- You're updating GitHub issue content with the latest user story information and progress
|
|
34
|
+
|
|
10
35
|
**Activates For**:
|
|
11
36
|
- "Update user story issue"
|
|
12
37
|
- "Fix GitHub issue format for US-004"
|