@cognite/cli 0.5.2 → 0.6.0-alpha.8
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 +118 -33
- package/_templates/app/new/config/eslint.config.mjs.ejs.t +99 -0
- package/_templates/app/new/config/tsconfig.json.ejs.t +35 -0
- package/_templates/app/new/config/tsconfig.node.json.ejs.t +27 -0
- package/_templates/app/new/config/vite.config.ts.ejs.t +26 -0
- package/_templates/app/new/config/vitest.config.ts.ejs.t +14 -0
- package/_templates/app/new/config/vitest.setup.ts.ejs.t +4 -0
- package/_templates/app/new/cursor/data-modeling.mdc.ejs.t +1996 -0
- package/_templates/app/new/cursor/mcp.json.ejs.t +10 -0
- package/_templates/app/new/cursor/rules.mdc.ejs.t +10 -0
- package/_templates/app/new/github/ci.yml.ejs.t +36 -0
- package/_templates/app/new/prompt.js +49 -0
- package/_templates/app/new/root/.npmrc.ejs.t +4 -0
- package/_templates/app/new/root/AGENTS.md.ejs.t +215 -0
- package/_templates/app/new/root/SPEC.md.ejs.t +77 -0
- package/_templates/app/new/root/app.json.ejs.t +22 -0
- package/_templates/app/new/root/gitignore.ejs.t +21 -0
- package/_templates/app/new/root/index.html.ejs.t +36 -0
- package/_templates/app/new/root/package.json.ejs.t +67 -0
- package/_templates/app/new/src/App.test.tsx.ejs.t +45 -0
- package/_templates/app/new/src/App.tsx.ejs.t +265 -0
- package/_templates/app/new/src/lib/utils.ts.ejs.t +9 -0
- package/_templates/app/new/src/main.tsx.ejs.t +36 -0
- package/_templates/app/new/src/styles.css.ejs.t +12 -0
- package/_vendor/spec-kit/.version +4 -0
- package/_vendor/spec-kit/README.md +39 -0
- package/_vendor/spec-kit/commands/speckit.analyze.md +249 -0
- package/_vendor/spec-kit/commands/speckit.checklist.md +361 -0
- package/_vendor/spec-kit/commands/speckit.clarify.md +247 -0
- package/_vendor/spec-kit/commands/speckit.implement.md +198 -0
- package/_vendor/spec-kit/commands/speckit.plan.md +149 -0
- package/_vendor/spec-kit/commands/speckit.specify.md +327 -0
- package/_vendor/spec-kit/commands/speckit.tasks.md +200 -0
- package/_vendor/spec-kit/scripts/bash/check-prerequisites.sh +190 -0
- package/_vendor/spec-kit/scripts/bash/common.sh +645 -0
- package/_vendor/spec-kit/scripts/bash/setup-plan.sh +75 -0
- package/_vendor/spec-kit/templates/checklist-template.md +40 -0
- package/_vendor/spec-kit/templates/plan-template.md +104 -0
- package/_vendor/spec-kit/templates/spec-template.md +128 -0
- package/_vendor/spec-kit/templates/tasks-template.md +251 -0
- package/dist/chunk-GFMJ4MJZ.js +8 -0
- package/dist/cli/cli.js +347 -0
- package/dist/skills-4R3OUI44.js +2 -0
- package/package.json +25 -17
- package/index.js +0 -116
- package/operations.js +0 -113
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/App.tsx'
|
|
3
|
+
---
|
|
4
|
+
<% if (infra === 'appsApi') { -%>
|
|
5
|
+
import { connectToHostApp } from '@cognite/app-sdk';
|
|
6
|
+
<% } -%>
|
|
7
|
+
import {
|
|
8
|
+
Alert,
|
|
9
|
+
AlertDescription,
|
|
10
|
+
Badge,
|
|
11
|
+
Card,
|
|
12
|
+
CardContent,
|
|
13
|
+
CardDescription,
|
|
14
|
+
CardHeader,
|
|
15
|
+
CardTitle,
|
|
16
|
+
Collapsible,
|
|
17
|
+
CollapsibleContent,
|
|
18
|
+
CollapsibleTrigger,
|
|
19
|
+
Loader,
|
|
20
|
+
Separator,
|
|
21
|
+
} from '@cognite/aura/components';
|
|
22
|
+
<% if (infra !== 'appsApi') { -%>
|
|
23
|
+
import { useDune } from '@cognite/dune';
|
|
24
|
+
<% } -%>
|
|
25
|
+
import { IconCaretUpDown, IconRocket } from '@tabler/icons-react';
|
|
26
|
+
<% if (infra === 'appsApi') { -%>
|
|
27
|
+
import { useEffect, useState } from 'react';
|
|
28
|
+
<% } -%>
|
|
29
|
+
|
|
30
|
+
import appConfig from '../app.json';
|
|
31
|
+
|
|
32
|
+
const DUNE_DOCUMENTATION_HREF = 'https://laughing-adventure-r6kwpyy.pages.github.io/';
|
|
33
|
+
|
|
34
|
+
const INTRO_COPY =
|
|
35
|
+
"Build and deploy React apps to Cognite Data Fusion in minutes. Aura, Cognite's AI-native design system, comes pre-configured so your app looks and feels at home from day one. Follow the checklist below to get started.";
|
|
36
|
+
|
|
37
|
+
const CHECKLIST_STEPS = [
|
|
38
|
+
{
|
|
39
|
+
label: 'Plan',
|
|
40
|
+
badge: 'Step 1',
|
|
41
|
+
body: (
|
|
42
|
+
<>
|
|
43
|
+
Open <code>SPEC.md</code> at the repo root and describe what you want to build. If <code>.specify/</code> is
|
|
44
|
+
present, run <code>/speckit.specify</code> in Claude Code or Cursor to fill it in interactively. Otherwise, ask
|
|
45
|
+
your agent to collaborate on <code>SPEC.md</code> directly. Keep it simple and clear, then move on to building
|
|
46
|
+
when ready.
|
|
47
|
+
</>
|
|
48
|
+
),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: 'Explore',
|
|
52
|
+
badge: 'Step 2',
|
|
53
|
+
body: (
|
|
54
|
+
<>
|
|
55
|
+
Ask Cursor to review and understand your data model, then answer any follow-up questions it raises. Continue
|
|
56
|
+
refining the app by providing additional input as needed.
|
|
57
|
+
</>
|
|
58
|
+
),
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'Deploy',
|
|
62
|
+
badge: 'Step 3',
|
|
63
|
+
body: (
|
|
64
|
+
<>
|
|
65
|
+
When ready to deploy, run <code>npx @cognite/dune deploy:interactive</code> in the terminal. Your app will
|
|
66
|
+
appear in the Fusion portal under Custom apps. Run the command again to redeploy new changes.
|
|
67
|
+
</>
|
|
68
|
+
),
|
|
69
|
+
},
|
|
70
|
+
] as const;
|
|
71
|
+
|
|
72
|
+
function App() {
|
|
73
|
+
<% if (infra === 'appsApi') { -%>
|
|
74
|
+
// Connect to the Fusion host via @cognite/app-sdk. The handshake is
|
|
75
|
+
// asynchronous — `project` is only populated after Comlink finishes
|
|
76
|
+
// exposing the host API, so we render a loader until then.
|
|
77
|
+
const [project, setProject] = useState<string | null>(null);
|
|
78
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
79
|
+
const [error, setError] = useState<string | undefined>();
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
let cancelled = false;
|
|
83
|
+
connectToHostApp({ applicationName: '<%= name %>' })
|
|
84
|
+
.then(async ({ api }) => {
|
|
85
|
+
if (cancelled) return;
|
|
86
|
+
const proj = await api.getProject();
|
|
87
|
+
if (cancelled) return;
|
|
88
|
+
setProject(proj);
|
|
89
|
+
})
|
|
90
|
+
.catch((err: unknown) => {
|
|
91
|
+
if (cancelled) return;
|
|
92
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
93
|
+
})
|
|
94
|
+
.finally(() => {
|
|
95
|
+
if (!cancelled) setIsLoading(false);
|
|
96
|
+
});
|
|
97
|
+
return () => {
|
|
98
|
+
cancelled = true;
|
|
99
|
+
};
|
|
100
|
+
}, []);
|
|
101
|
+
<% } else { -%>
|
|
102
|
+
const { sdk, isLoading, error } = useDune();
|
|
103
|
+
<% } -%>
|
|
104
|
+
|
|
105
|
+
if (isLoading) {
|
|
106
|
+
return (
|
|
107
|
+
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
108
|
+
<section className="mx-auto flex min-h-screen w-full max-w-lg flex-col justify-center p-4 sm:p-8">
|
|
109
|
+
<div className="mx-auto w-full max-w-sm">
|
|
110
|
+
<Card aria-label="Loading project" aria-live="polite">
|
|
111
|
+
<CardContent>
|
|
112
|
+
<div className="inline-flex items-center gap-3 text-muted-foreground">
|
|
113
|
+
<Loader size={20} />
|
|
114
|
+
<span>Loading project...</span>
|
|
115
|
+
</div>
|
|
116
|
+
</CardContent>
|
|
117
|
+
</Card>
|
|
118
|
+
</div>
|
|
119
|
+
</section>
|
|
120
|
+
</main>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
<% if (infra === 'appsApi') { -%>
|
|
125
|
+
if (error) {
|
|
126
|
+
return (
|
|
127
|
+
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
128
|
+
<section className="mx-auto flex min-h-screen w-full max-w-lg flex-col justify-center p-4 sm:p-8">
|
|
129
|
+
<div className="mx-auto w-full max-w-sm">
|
|
130
|
+
<Alert>
|
|
131
|
+
<AlertDescription>Failed to connect to Fusion host: {error}</AlertDescription>
|
|
132
|
+
</Alert>
|
|
133
|
+
</div>
|
|
134
|
+
</section>
|
|
135
|
+
</main>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
<% } else { -%>
|
|
139
|
+
if (error) {
|
|
140
|
+
return (
|
|
141
|
+
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
142
|
+
<section className="mx-auto flex min-h-screen w-full max-w-lg flex-col justify-center p-4 sm:p-8">
|
|
143
|
+
<div className="mx-auto w-full max-w-sm">
|
|
144
|
+
<Alert>
|
|
145
|
+
<AlertDescription>{error}</AlertDescription>
|
|
146
|
+
</Alert>
|
|
147
|
+
</div>
|
|
148
|
+
</section>
|
|
149
|
+
</main>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
<% } -%>
|
|
153
|
+
|
|
154
|
+
const deployment = appConfig.deployments?.[0];
|
|
155
|
+
const orgLabel = deployment?.org ?? '';
|
|
156
|
+
<% if (infra === 'appsApi') { -%>
|
|
157
|
+
const projectLabel = deployment?.project ?? project ?? '';
|
|
158
|
+
<% } else { -%>
|
|
159
|
+
const projectLabel = deployment?.project ?? sdk.project;
|
|
160
|
+
<% } -%>
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<main className="min-h-screen bg-muted/50 text-foreground">
|
|
164
|
+
<section className="mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center p-4 sm:p-8">
|
|
165
|
+
<Card>
|
|
166
|
+
<div className="p-15 gap-16">
|
|
167
|
+
<CardHeader>
|
|
168
|
+
<CardTitle as="h1">Welcome to Dune</CardTitle>
|
|
169
|
+
<CardDescription>{INTRO_COPY}</CardDescription>
|
|
170
|
+
</CardHeader>
|
|
171
|
+
|
|
172
|
+
<CardContent>
|
|
173
|
+
<Separator />
|
|
174
|
+
|
|
175
|
+
<div className="flex flex-col gap-6 pt-16">
|
|
176
|
+
<div className="flex items-center gap-2 pt-4">
|
|
177
|
+
<IconRocket aria-hidden />
|
|
178
|
+
<span className="text-2xl font-medium">App deployment checklist</span>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div className="flex flex-col gap-4 px-4">
|
|
182
|
+
{CHECKLIST_STEPS.map((step, index) => (
|
|
183
|
+
<Collapsible key={step.label} defaultOpen={index === 0}>
|
|
184
|
+
<CollapsibleTrigger className="w-full">
|
|
185
|
+
<div className="flex w-full min-w-0 items-center justify-between gap-3 text-left">
|
|
186
|
+
<span className="text-lg">{step.label}</span>
|
|
187
|
+
<span className="inline-flex shrink-0 items-center gap-2">
|
|
188
|
+
<Badge variant="mountain" background>
|
|
189
|
+
{step.badge}
|
|
190
|
+
</Badge>
|
|
191
|
+
<IconCaretUpDown aria-hidden className="size-4 text-muted-foreground" />
|
|
192
|
+
</span>
|
|
193
|
+
</div>
|
|
194
|
+
</CollapsibleTrigger>
|
|
195
|
+
<CollapsibleContent>
|
|
196
|
+
<div className="py-2">{step.body}</div>
|
|
197
|
+
</CollapsibleContent>
|
|
198
|
+
</Collapsible>
|
|
199
|
+
))}
|
|
200
|
+
</div>
|
|
201
|
+
|
|
202
|
+
<div className="mb-10">
|
|
203
|
+
<Alert variant="secondary">
|
|
204
|
+
<AlertDescription>
|
|
205
|
+
<div className="flex flex-wrap items-center gap-2 text-lg">
|
|
206
|
+
<span>Your app will deploy to</span>
|
|
207
|
+
{orgLabel ? (
|
|
208
|
+
<>
|
|
209
|
+
<span>org</span>
|
|
210
|
+
<Badge variant="nordic" background>
|
|
211
|
+
{orgLabel}
|
|
212
|
+
</Badge>
|
|
213
|
+
<span>and project</span>
|
|
214
|
+
</>
|
|
215
|
+
) : (
|
|
216
|
+
<span>project</span>
|
|
217
|
+
)}
|
|
218
|
+
<Badge variant="nordic" background>
|
|
219
|
+
{projectLabel}
|
|
220
|
+
</Badge>
|
|
221
|
+
</div>
|
|
222
|
+
</AlertDescription>
|
|
223
|
+
</Alert>
|
|
224
|
+
</div>
|
|
225
|
+
|
|
226
|
+
<Collapsible>
|
|
227
|
+
<CollapsibleTrigger className="w-full">
|
|
228
|
+
<div className="flex w-full min-w-0 items-center justify-between gap-3 text-left">
|
|
229
|
+
<span className="text-lg">Support</span>
|
|
230
|
+
<span className="inline-flex shrink-0 items-center gap-2">
|
|
231
|
+
<Badge variant="mountain">
|
|
232
|
+
Help & feedback
|
|
233
|
+
</Badge>
|
|
234
|
+
<IconCaretUpDown aria-hidden className="size-4 text-muted-foreground" />
|
|
235
|
+
</span>
|
|
236
|
+
</div>
|
|
237
|
+
</CollapsibleTrigger>
|
|
238
|
+
<CollapsibleContent>
|
|
239
|
+
<div className="py-2">
|
|
240
|
+
<p>
|
|
241
|
+
For additional support and feedback, please head to{' '}
|
|
242
|
+
<a
|
|
243
|
+
href={DUNE_DOCUMENTATION_HREF}
|
|
244
|
+
rel="noreferrer"
|
|
245
|
+
style={{ color: '#486AED' }}
|
|
246
|
+
target="_blank"
|
|
247
|
+
>
|
|
248
|
+
Dune documentation
|
|
249
|
+
</a>{' '}
|
|
250
|
+
or the{' '}
|
|
251
|
+
<span style={{ color: '#486AED' }}>#Dune Slack channel</span>.
|
|
252
|
+
</p>
|
|
253
|
+
</div>
|
|
254
|
+
</CollapsibleContent>
|
|
255
|
+
</Collapsible>
|
|
256
|
+
</div>
|
|
257
|
+
</CardContent>
|
|
258
|
+
</div>
|
|
259
|
+
</Card>
|
|
260
|
+
</section>
|
|
261
|
+
</main>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export default App;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/lib/utils.ts'
|
|
3
|
+
---
|
|
4
|
+
import { type ClassValue, clsx } from 'clsx';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
|
+
|
|
7
|
+
export function cn(...inputs: ClassValue[]) {
|
|
8
|
+
return twMerge(clsx(inputs));
|
|
9
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/main.tsx'
|
|
3
|
+
---
|
|
4
|
+
<% if (infra !== 'appsApi') { -%>
|
|
5
|
+
import { DuneAuthProvider } from '@cognite/dune';
|
|
6
|
+
<% } -%>
|
|
7
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import ReactDOM from 'react-dom/client';
|
|
10
|
+
|
|
11
|
+
import App from './App.tsx';
|
|
12
|
+
|
|
13
|
+
import './styles.css';
|
|
14
|
+
|
|
15
|
+
const queryClient = new QueryClient({
|
|
16
|
+
defaultOptions: {
|
|
17
|
+
queries: {
|
|
18
|
+
staleTime: 5 * 60 * 1000, // 5 minutes
|
|
19
|
+
gcTime: 10 * 60 * 1000, // 10 minutes
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
25
|
+
<React.StrictMode>
|
|
26
|
+
<QueryClientProvider client={queryClient}>
|
|
27
|
+
<% if (infra === 'appsApi') { -%>
|
|
28
|
+
<App />
|
|
29
|
+
<% } else { -%>
|
|
30
|
+
<DuneAuthProvider>
|
|
31
|
+
<App />
|
|
32
|
+
</DuneAuthProvider>
|
|
33
|
+
<% } -%>
|
|
34
|
+
</QueryClientProvider>
|
|
35
|
+
</React.StrictMode>
|
|
36
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>src/styles.css'
|
|
3
|
+
---
|
|
4
|
+
@import '@cognite/aura/styles.source.css';
|
|
5
|
+
|
|
6
|
+
@source '../node_modules/@cognite/aura/dist/components';
|
|
7
|
+
|
|
8
|
+
:root {
|
|
9
|
+
--font-inter: "Inter", ui-sans-serif, system-ui, sans-serif;
|
|
10
|
+
--font-source-code-pro: "Source Code Pro", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
11
|
+
"Liberation Mono", "Courier New", monospace;
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Vendored: github/spec-kit
|
|
2
|
+
|
|
3
|
+
Selected, generated files from [github/spec-kit](https://github.com/github/spec-kit). Pinned version is in [`.version`](./.version).
|
|
4
|
+
|
|
5
|
+
## Why this exists
|
|
6
|
+
|
|
7
|
+
Dune app authors should not need Python, `uv`, or network access just because they pass `dune create --spec-kit`.
|
|
8
|
+
|
|
9
|
+
Instead, Dune maintainers refresh spec-kit inside this monorepo, commit the selected generated files here, and let `dune create` copy them into new apps. That keeps end-user scaffolding fast and JS/TS-only while still letting us track upstream spec-kit intentionally.
|
|
10
|
+
|
|
11
|
+
## Maintainer-only refresh
|
|
12
|
+
|
|
13
|
+
The refresh script is for Dune monorepo maintainers only:
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
pnpm --filter @cognite/dune refresh-spec-kit <tag>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
It requires `uv` locally, which provides `uvx`. That is acceptable for maintainers; it must not become a requirement for generated Dune apps.
|
|
20
|
+
|
|
21
|
+
The script runs spec-kit's own `specify init` for the requested tag, stages the selected output in a temporary directory, and swaps it into `_vendor/spec-kit` only after all copies succeed.
|
|
22
|
+
|
|
23
|
+
## What we vendor
|
|
24
|
+
|
|
25
|
+
We vendor the parts Dune uses:
|
|
26
|
+
|
|
27
|
+
- generated `commands/speckit.{specify,clarify,plan,tasks,implement,analyze,checklist}.md`
|
|
28
|
+
- `templates/{spec,plan,tasks,checklist}-template.md`
|
|
29
|
+
- `scripts/bash/{check-prerequisites,common,setup-plan}.sh`
|
|
30
|
+
|
|
31
|
+
Deliberately excluded:
|
|
32
|
+
|
|
33
|
+
- spec-kit's `AGENTS.md`, constitution command, and constitution template, because Dune uses the app's `AGENTS.md` as the constitution
|
|
34
|
+
- integration metadata/workflows generated by `specify init`
|
|
35
|
+
- optional commands such as taskstoissues
|
|
36
|
+
- PowerShell scripts, until Dune chooses to support a PowerShell command set
|
|
37
|
+
- spec-kit's Python CLI, tests, and docs
|
|
38
|
+
|
|
39
|
+
**Cadence:** refresh at least once per Dune CLI minor release, sooner if upstream ships a fix we depend on.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## User Input
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
$ARGUMENTS
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
You **MUST** consider the user input before proceeding (if not empty).
|
|
12
|
+
|
|
13
|
+
## Pre-Execution Checks
|
|
14
|
+
|
|
15
|
+
**Check for extension hooks (before analysis)**:
|
|
16
|
+
- Check if `.specify/extensions.yml` exists in the project root.
|
|
17
|
+
- If it exists, read it and look for entries under the `hooks.before_analyze` key
|
|
18
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
19
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
20
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
21
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
22
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
23
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
24
|
+
- **Optional hook** (`optional: true`):
|
|
25
|
+
```
|
|
26
|
+
## Extension Hooks
|
|
27
|
+
|
|
28
|
+
**Optional Pre-Hook**: {extension}
|
|
29
|
+
Command: `/{command}`
|
|
30
|
+
Description: {description}
|
|
31
|
+
|
|
32
|
+
Prompt: {prompt}
|
|
33
|
+
To execute: `/{command}`
|
|
34
|
+
```
|
|
35
|
+
- **Mandatory hook** (`optional: false`):
|
|
36
|
+
```
|
|
37
|
+
## Extension Hooks
|
|
38
|
+
|
|
39
|
+
**Automatic Pre-Hook**: {extension}
|
|
40
|
+
Executing: `/{command}`
|
|
41
|
+
EXECUTE_COMMAND: {command}
|
|
42
|
+
|
|
43
|
+
Wait for the result of the hook command before proceeding to the Goal.
|
|
44
|
+
```
|
|
45
|
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
|
46
|
+
|
|
47
|
+
## Goal
|
|
48
|
+
|
|
49
|
+
Identify inconsistencies, duplications, ambiguities, and underspecified items across the three core artifacts (`spec.md`, `plan.md`, `tasks.md`) before implementation. This command MUST run only after `/speckit.tasks` has successfully produced a complete `tasks.md`.
|
|
50
|
+
|
|
51
|
+
## Operating Constraints
|
|
52
|
+
|
|
53
|
+
**STRICTLY READ-ONLY**: Do **not** modify any files. Output a structured analysis report. Offer an optional remediation plan (user must explicitly approve before any follow-up editing commands would be invoked manually).
|
|
54
|
+
|
|
55
|
+
**Constitution Authority**: The project constitution (`.specify/memory/constitution.md`) is **non-negotiable** within this analysis scope. Constitution conflicts are automatically CRITICAL and require adjustment of the spec, plan, or tasks—not dilution, reinterpretation, or silent ignoring of the principle. If a principle itself needs to change, that must occur in a separate, explicit constitution update outside `/speckit.analyze`.
|
|
56
|
+
|
|
57
|
+
## Execution Steps
|
|
58
|
+
|
|
59
|
+
### 1. Initialize Analysis Context
|
|
60
|
+
|
|
61
|
+
Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` once from repo root and parse JSON for FEATURE_DIR and AVAILABLE_DOCS. Derive absolute paths:
|
|
62
|
+
|
|
63
|
+
- SPEC = FEATURE_DIR/spec.md
|
|
64
|
+
- PLAN = FEATURE_DIR/plan.md
|
|
65
|
+
- TASKS = FEATURE_DIR/tasks.md
|
|
66
|
+
|
|
67
|
+
Abort with an error message if any required file is missing (instruct the user to run missing prerequisite command).
|
|
68
|
+
For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
|
|
69
|
+
|
|
70
|
+
### 2. Load Artifacts (Progressive Disclosure)
|
|
71
|
+
|
|
72
|
+
Load only the minimal necessary context from each artifact:
|
|
73
|
+
|
|
74
|
+
**From spec.md:**
|
|
75
|
+
|
|
76
|
+
- Overview/Context
|
|
77
|
+
- Functional Requirements
|
|
78
|
+
- Success Criteria (measurable outcomes — e.g., performance, security, availability, user success, business impact)
|
|
79
|
+
- User Stories
|
|
80
|
+
- Edge Cases (if present)
|
|
81
|
+
|
|
82
|
+
**From plan.md:**
|
|
83
|
+
|
|
84
|
+
- Architecture/stack choices
|
|
85
|
+
- Data Model references
|
|
86
|
+
- Phases
|
|
87
|
+
- Technical constraints
|
|
88
|
+
|
|
89
|
+
**From tasks.md:**
|
|
90
|
+
|
|
91
|
+
- Task IDs
|
|
92
|
+
- Descriptions
|
|
93
|
+
- Phase grouping
|
|
94
|
+
- Parallel markers [P]
|
|
95
|
+
- Referenced file paths
|
|
96
|
+
|
|
97
|
+
**From constitution:**
|
|
98
|
+
|
|
99
|
+
- Load `.specify/memory/constitution.md` for principle validation
|
|
100
|
+
|
|
101
|
+
### 3. Build Semantic Models
|
|
102
|
+
|
|
103
|
+
Create internal representations (do not include raw artifacts in output):
|
|
104
|
+
|
|
105
|
+
- **Requirements inventory**: For each Functional Requirement (FR-###) and Success Criterion (SC-###), record a stable key. Use the explicit FR-/SC- identifier as the primary key when present, and optionally also derive an imperative-phrase slug for readability (e.g., "User can upload file" → `user-can-upload-file`). Include only Success Criteria items that require buildable work (e.g., load-testing infrastructure, security audit tooling), and exclude post-launch outcome metrics and business KPIs (e.g., "Reduce support tickets by 50%").
|
|
106
|
+
- **User story/action inventory**: Discrete user actions with acceptance criteria
|
|
107
|
+
- **Task coverage mapping**: Map each task to one or more requirements or stories (inference by keyword / explicit reference patterns like IDs or key phrases)
|
|
108
|
+
- **Constitution rule set**: Extract principle names and MUST/SHOULD normative statements
|
|
109
|
+
|
|
110
|
+
### 4. Detection Passes (Token-Efficient Analysis)
|
|
111
|
+
|
|
112
|
+
Focus on high-signal findings. Limit to 50 findings total; aggregate remainder in overflow summary.
|
|
113
|
+
|
|
114
|
+
#### A. Duplication Detection
|
|
115
|
+
|
|
116
|
+
- Identify near-duplicate requirements
|
|
117
|
+
- Mark lower-quality phrasing for consolidation
|
|
118
|
+
|
|
119
|
+
#### B. Ambiguity Detection
|
|
120
|
+
|
|
121
|
+
- Flag vague adjectives (fast, scalable, secure, intuitive, robust) lacking measurable criteria
|
|
122
|
+
- Flag unresolved placeholders (TODO, TKTK, ???, `<placeholder>`, etc.)
|
|
123
|
+
|
|
124
|
+
#### C. Underspecification
|
|
125
|
+
|
|
126
|
+
- Requirements with verbs but missing object or measurable outcome
|
|
127
|
+
- User stories missing acceptance criteria alignment
|
|
128
|
+
- Tasks referencing files or components not defined in spec/plan
|
|
129
|
+
|
|
130
|
+
#### D. Constitution Alignment
|
|
131
|
+
|
|
132
|
+
- Any requirement or plan element conflicting with a MUST principle
|
|
133
|
+
- Missing mandated sections or quality gates from constitution
|
|
134
|
+
|
|
135
|
+
#### E. Coverage Gaps
|
|
136
|
+
|
|
137
|
+
- Requirements with zero associated tasks
|
|
138
|
+
- Tasks with no mapped requirement/story
|
|
139
|
+
- Success Criteria requiring buildable work (performance, security, availability) not reflected in tasks
|
|
140
|
+
|
|
141
|
+
#### F. Inconsistency
|
|
142
|
+
|
|
143
|
+
- Terminology drift (same concept named differently across files)
|
|
144
|
+
- Data entities referenced in plan but absent in spec (or vice versa)
|
|
145
|
+
- Task ordering contradictions (e.g., integration tasks before foundational setup tasks without dependency note)
|
|
146
|
+
- Conflicting requirements (e.g., one requires Next.js while other specifies Vue)
|
|
147
|
+
|
|
148
|
+
### 5. Severity Assignment
|
|
149
|
+
|
|
150
|
+
Use this heuristic to prioritize findings:
|
|
151
|
+
|
|
152
|
+
- **CRITICAL**: Violates constitution MUST, missing core spec artifact, or requirement with zero coverage that blocks baseline functionality
|
|
153
|
+
- **HIGH**: Duplicate or conflicting requirement, ambiguous security/performance attribute, untestable acceptance criterion
|
|
154
|
+
- **MEDIUM**: Terminology drift, missing non-functional task coverage, underspecified edge case
|
|
155
|
+
- **LOW**: Style/wording improvements, minor redundancy not affecting execution order
|
|
156
|
+
|
|
157
|
+
### 6. Produce Compact Analysis Report
|
|
158
|
+
|
|
159
|
+
Output a Markdown report (no file writes) with the following structure:
|
|
160
|
+
|
|
161
|
+
## Specification Analysis Report
|
|
162
|
+
|
|
163
|
+
| ID | Category | Severity | Location(s) | Summary | Recommendation |
|
|
164
|
+
|----|----------|----------|-------------|---------|----------------|
|
|
165
|
+
| A1 | Duplication | HIGH | spec.md:L120-134 | Two similar requirements ... | Merge phrasing; keep clearer version |
|
|
166
|
+
|
|
167
|
+
(Add one row per finding; generate stable IDs prefixed by category initial.)
|
|
168
|
+
|
|
169
|
+
**Coverage Summary Table:**
|
|
170
|
+
|
|
171
|
+
| Requirement Key | Has Task? | Task IDs | Notes |
|
|
172
|
+
|-----------------|-----------|----------|-------|
|
|
173
|
+
|
|
174
|
+
**Constitution Alignment Issues:** (if any)
|
|
175
|
+
|
|
176
|
+
**Unmapped Tasks:** (if any)
|
|
177
|
+
|
|
178
|
+
**Metrics:**
|
|
179
|
+
|
|
180
|
+
- Total Requirements
|
|
181
|
+
- Total Tasks
|
|
182
|
+
- Coverage % (requirements with >=1 task)
|
|
183
|
+
- Ambiguity Count
|
|
184
|
+
- Duplication Count
|
|
185
|
+
- Critical Issues Count
|
|
186
|
+
|
|
187
|
+
### 7. Provide Next Actions
|
|
188
|
+
|
|
189
|
+
At end of report, output a concise Next Actions block:
|
|
190
|
+
|
|
191
|
+
- If CRITICAL issues exist: Recommend resolving before `/speckit.implement`
|
|
192
|
+
- If only LOW/MEDIUM: User may proceed, but provide improvement suggestions
|
|
193
|
+
- Provide explicit command suggestions: e.g., "Run /speckit.specify with refinement", "Run /speckit.plan to adjust architecture", "Manually edit tasks.md to add coverage for 'performance-metrics'"
|
|
194
|
+
|
|
195
|
+
### 8. Offer Remediation
|
|
196
|
+
|
|
197
|
+
Ask the user: "Would you like me to suggest concrete remediation edits for the top N issues?" (Do NOT apply them automatically.)
|
|
198
|
+
|
|
199
|
+
### 9. Check for extension hooks
|
|
200
|
+
|
|
201
|
+
After reporting, check if `.specify/extensions.yml` exists in the project root.
|
|
202
|
+
- If it exists, read it and look for entries under the `hooks.after_analyze` key
|
|
203
|
+
- If the YAML cannot be parsed or is invalid, skip hook checking silently and continue normally
|
|
204
|
+
- Filter out hooks where `enabled` is explicitly `false`. Treat hooks without an `enabled` field as enabled by default.
|
|
205
|
+
- For each remaining hook, do **not** attempt to interpret or evaluate hook `condition` expressions:
|
|
206
|
+
- If the hook has no `condition` field, or it is null/empty, treat the hook as executable
|
|
207
|
+
- If the hook defines a non-empty `condition`, skip the hook and leave condition evaluation to the HookExecutor implementation
|
|
208
|
+
- For each executable hook, output the following based on its `optional` flag:
|
|
209
|
+
- **Optional hook** (`optional: true`):
|
|
210
|
+
```
|
|
211
|
+
## Extension Hooks
|
|
212
|
+
|
|
213
|
+
**Optional Hook**: {extension}
|
|
214
|
+
Command: `/{command}`
|
|
215
|
+
Description: {description}
|
|
216
|
+
|
|
217
|
+
Prompt: {prompt}
|
|
218
|
+
To execute: `/{command}`
|
|
219
|
+
```
|
|
220
|
+
- **Mandatory hook** (`optional: false`):
|
|
221
|
+
```
|
|
222
|
+
## Extension Hooks
|
|
223
|
+
|
|
224
|
+
**Automatic Hook**: {extension}
|
|
225
|
+
Executing: `/{command}`
|
|
226
|
+
EXECUTE_COMMAND: {command}
|
|
227
|
+
```
|
|
228
|
+
- If no hooks are registered or `.specify/extensions.yml` does not exist, skip silently
|
|
229
|
+
|
|
230
|
+
## Operating Principles
|
|
231
|
+
|
|
232
|
+
### Context Efficiency
|
|
233
|
+
|
|
234
|
+
- **Minimal high-signal tokens**: Focus on actionable findings, not exhaustive documentation
|
|
235
|
+
- **Progressive disclosure**: Load artifacts incrementally; don't dump all content into analysis
|
|
236
|
+
- **Token-efficient output**: Limit findings table to 50 rows; summarize overflow
|
|
237
|
+
- **Deterministic results**: Rerunning without changes should produce consistent IDs and counts
|
|
238
|
+
|
|
239
|
+
### Analysis Guidelines
|
|
240
|
+
|
|
241
|
+
- **NEVER modify files** (this is read-only analysis)
|
|
242
|
+
- **NEVER hallucinate missing sections** (if absent, report them accurately)
|
|
243
|
+
- **Prioritize constitution violations** (these are always CRITICAL)
|
|
244
|
+
- **Use examples over exhaustive rules** (cite specific instances, not generic patterns)
|
|
245
|
+
- **Report zero issues gracefully** (emit success report with coverage statistics)
|
|
246
|
+
|
|
247
|
+
## Context
|
|
248
|
+
|
|
249
|
+
$ARGUMENTS
|