@cogito.ai/cli 0.2.0 → 0.3.1

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.
Files changed (84) hide show
  1. package/dist/registry.json +3 -13
  2. package/dist/templates/web-nextjs/.github/copilot-instructions.md +36 -14
  3. package/dist/templates/web-nextjs/AGENTS.md +14 -11
  4. package/dist/templates/web-nextjs/README.md +37 -30
  5. package/dist/templates/web-nextjs/apps/docs/.source/browser.ts +12 -0
  6. package/dist/templates/web-nextjs/apps/docs/.source/dynamic.ts +8 -0
  7. package/dist/templates/web-nextjs/apps/docs/.source/server.ts +19 -0
  8. package/dist/templates/web-nextjs/apps/docs/.source/source.config.mjs +10 -0
  9. package/dist/templates/web-nextjs/apps/docs/app/(home)/page.tsx +5 -0
  10. package/dist/templates/web-nextjs/apps/docs/app/api/search/route.ts +4 -0
  11. package/dist/templates/web-nextjs/apps/docs/app/docs/[[...slug]]/page.tsx +41 -0
  12. package/dist/templates/web-nextjs/apps/docs/app/docs/layout.tsx +14 -0
  13. package/dist/templates/web-nextjs/apps/docs/app/global.css +3 -0
  14. package/dist/templates/web-nextjs/apps/docs/app/layout.tsx +13 -0
  15. package/dist/templates/web-nextjs/apps/docs/app/llms-full.txt/route.ts +11 -0
  16. package/dist/templates/web-nextjs/apps/docs/app/llms.txt/route.ts +8 -0
  17. package/dist/templates/web-nextjs/apps/docs/content/docs/changelog/.gitkeep +2 -0
  18. package/dist/templates/web-nextjs/apps/docs/content/docs/changelog/index.mdx +9 -0
  19. package/dist/templates/web-nextjs/apps/docs/content/docs/changelog/meta.json +3 -0
  20. package/dist/templates/web-nextjs/apps/docs/content/docs/decisions/.gitkeep +0 -0
  21. package/dist/templates/web-nextjs/apps/docs/content/docs/decisions/meta.json +4 -0
  22. package/dist/templates/web-nextjs/apps/docs/content/docs/features/hello.mdx +29 -0
  23. package/dist/templates/web-nextjs/apps/docs/content/docs/features/meta.json +4 -0
  24. package/dist/templates/web-nextjs/apps/docs/content/docs/index.mdx +6 -0
  25. package/dist/templates/web-nextjs/apps/docs/content/docs/meta.json +4 -0
  26. package/dist/templates/web-nextjs/apps/docs/content/docs/roadmap/.gitkeep +2 -0
  27. package/dist/templates/web-nextjs/apps/docs/content/docs/roadmap/index.mdx +29 -0
  28. package/dist/templates/web-nextjs/apps/docs/content/docs/roadmap/meta.json +3 -0
  29. package/dist/templates/web-nextjs/apps/docs/eslint.config.js +10 -0
  30. package/dist/templates/web-nextjs/apps/docs/lib/source.ts +7 -0
  31. package/dist/templates/web-nextjs/apps/docs/next.config.ts +14 -0
  32. package/dist/templates/web-nextjs/apps/docs/package.json +38 -0
  33. package/dist/templates/web-nextjs/apps/docs/postcss.config.mjs +8 -0
  34. package/dist/templates/web-nextjs/apps/docs/source.config.ts +7 -0
  35. package/dist/templates/web-nextjs/apps/docs/tsconfig.json +26 -0
  36. package/dist/templates/web-nextjs/apps/web/.github/copilot-instructions.md +65 -0
  37. package/dist/templates/web-nextjs/apps/web/next-env.d.ts +6 -0
  38. package/dist/templates/web-nextjs/{next.config.ts → apps/web/next.config.ts} +6 -1
  39. package/dist/templates/web-nextjs/apps/web/package.json +33 -0
  40. package/dist/templates/web-nextjs/openspec/config.yaml +20 -7
  41. package/dist/templates/web-nextjs/openspec/roadmap.yaml +31 -0
  42. package/dist/templates/web-nextjs/package.json +10 -21
  43. package/dist/templates/web-nextjs/packages/eslint-config/CHANGELOG.md +7 -0
  44. package/dist/templates/web-nextjs/packages/eslint-config/base.js +34 -0
  45. package/dist/templates/web-nextjs/packages/eslint-config/features.js +86 -0
  46. package/dist/templates/web-nextjs/packages/eslint-config/next.js +24 -0
  47. package/dist/templates/web-nextjs/packages/eslint-config/package.json +22 -0
  48. package/dist/templates/web-nextjs/packages/openspec-docs-sync/package.json +24 -0
  49. package/dist/templates/web-nextjs/packages/openspec-docs-sync/src/index.ts +290 -0
  50. package/dist/templates/web-nextjs/packages/openspec-docs-sync/tsconfig.json +17 -0
  51. package/dist/templates/web-nextjs/packages/tsconfig/CHANGELOG.md +7 -0
  52. package/dist/templates/web-nextjs/packages/tsconfig/base.json +11 -0
  53. package/dist/templates/web-nextjs/packages/tsconfig/package.json +10 -0
  54. package/dist/templates/web-nextjs/pnpm-lock.yaml +6722 -0
  55. package/dist/templates/web-nextjs/pnpm-workspace.yaml +3 -0
  56. package/dist/templates/web-nextjs/roadmap.yaml +31 -0
  57. package/dist/templates/web-nextjs/turbo.json +18 -0
  58. package/package.json +1 -1
  59. /package/dist/templates/web-nextjs/{next-env.d.ts → apps/docs/next-env.d.ts} +0 -0
  60. /package/dist/templates/web-nextjs/{eslint.config.js → apps/web/eslint.config.js} +0 -0
  61. /package/dist/templates/web-nextjs/{messages → apps/web/messages}/en.json +0 -0
  62. /package/dist/templates/web-nextjs/{messages → apps/web/messages}/zh.json +0 -0
  63. /package/dist/templates/web-nextjs/{middleware.ts → apps/web/middleware.ts} +0 -0
  64. /package/dist/templates/web-nextjs/{src → apps/web/src}/app/[locale]/globals.css +0 -0
  65. /package/dist/templates/web-nextjs/{src → apps/web/src}/app/[locale]/hello/page.tsx +0 -0
  66. /package/dist/templates/web-nextjs/{src → apps/web/src}/app/[locale]/layout.tsx +0 -0
  67. /package/dist/templates/web-nextjs/{src → apps/web/src}/app/[locale]/page.tsx +0 -0
  68. /package/dist/templates/web-nextjs/{src → apps/web/src}/core/repositories/.gitkeep +0 -0
  69. /package/dist/templates/web-nextjs/{src → apps/web/src}/core/repositories/IGreetingRepository.ts +0 -0
  70. /package/dist/templates/web-nextjs/{src → apps/web/src}/core/types/.gitkeep +0 -0
  71. /package/dist/templates/web-nextjs/{src → apps/web/src}/core/types/greeting.ts +0 -0
  72. /package/dist/templates/web-nextjs/{src → apps/web/src}/features/_experiments/.gitkeep +0 -0
  73. /package/dist/templates/web-nextjs/{src → apps/web/src}/features/hello/__contract__.ts +0 -0
  74. /package/dist/templates/web-nextjs/{src → apps/web/src}/features/hello/hello.test.ts +0 -0
  75. /package/dist/templates/web-nextjs/{src → apps/web/src}/features/hello/index.ts +0 -0
  76. /package/dist/templates/web-nextjs/{src → apps/web/src}/features/hello/service.ts +0 -0
  77. /package/dist/templates/web-nextjs/{src → apps/web/src}/i18n/request.ts +0 -0
  78. /package/dist/templates/web-nextjs/{src → apps/web/src}/infra/db/.gitkeep +0 -0
  79. /package/dist/templates/web-nextjs/{src → apps/web/src}/infra/db/SupabaseGreetingRepository.ts +0 -0
  80. /package/dist/templates/web-nextjs/{src → apps/web/src}/infra/db/client.ts +0 -0
  81. /package/dist/templates/web-nextjs/{src → apps/web/src}/infra/db/schema.ts +0 -0
  82. /package/dist/templates/web-nextjs/{tailwind.config.ts → apps/web/tailwind.config.ts} +0 -0
  83. /package/dist/templates/web-nextjs/{tsconfig.json → apps/web/tsconfig.json} +0 -0
  84. /package/dist/templates/web-nextjs/{vitest.config.ts → apps/web/vitest.config.ts} +0 -0
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * openspec-docs-sync
4
+ * Idempotent sync engine: openspec/changes/archive → apps/docs/content/docs/changelog
5
+ * roadmap.yaml → apps/docs/content/docs/roadmap/index.mdx
6
+ */
7
+ import fs from 'node:fs'
8
+ import path from 'node:path'
9
+ import { fileURLToPath } from 'node:url'
10
+ import matter from 'gray-matter'
11
+ import yaml from 'js-yaml'
12
+
13
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
14
+
15
+ // Resolve workspace root (two levels up from packages/openspec-docs-sync/src)
16
+ const WORKSPACE_ROOT = path.resolve(__dirname, '..', '..', '..')
17
+
18
+ const ARCHIVE_DIR = path.join(WORKSPACE_ROOT, 'openspec', 'changes', 'archive')
19
+ const ROADMAP_FILE = path.join(WORKSPACE_ROOT, 'roadmap.yaml')
20
+ const CHANGELOG_OUT_DIR = path.join(WORKSPACE_ROOT, 'apps', 'docs', 'content', 'docs', 'changelog')
21
+ const ROADMAP_OUT_DIR = path.join(WORKSPACE_ROOT, 'apps', 'docs', 'content', 'docs', 'roadmap')
22
+
23
+ const AUTO_GENERATED_HEADER = '<!-- AUTO-GENERATED by openspec-docs-sync. Do not edit manually. -->'
24
+
25
+ // ── Types ────────────────────────────────────────────────────────────────────
26
+
27
+ interface ArchivedChange {
28
+ /** Directory name e.g. "2026-06-01-bootstrap-platform-skeleton" */
29
+ dirName: string
30
+ /** Parsed date from directory prefix */
31
+ date: string
32
+ /** Change id (part after YYYY-MM-DD-) */
33
+ id: string
34
+ /** roadmap-id from frontmatter, if present */
35
+ roadmapId: string | null
36
+ why: string
37
+ capabilities: string
38
+ nonGoals: string
39
+ title: string
40
+ }
41
+
42
+ interface RoadmapEntry {
43
+ id: string
44
+ title: string
45
+ status: string
46
+ owner: string
47
+ }
48
+
49
+ interface RoadmapData {
50
+ now: RoadmapEntry[]
51
+ next: RoadmapEntry[]
52
+ later: RoadmapEntry[]
53
+ wont: RoadmapEntry[]
54
+ }
55
+
56
+ // ── Parsing ──────────────────────────────────────────────────────────────────
57
+
58
+ /**
59
+ * Extract a Markdown section by heading. Returns the content between this
60
+ * heading and the next same-level heading (or end of file).
61
+ */
62
+ function extractSection(content: string, heading: string): string {
63
+ const lines = content.split('\n')
64
+ const level = heading.match(/^(#{1,6})/)?.[1]?.length ?? 2
65
+ const headingPattern = new RegExp(`^#{${level}}\\s+${escapeRegex(heading.replace(/^#+\s*/, ''))}`)
66
+ let inSection = false
67
+ const sectionLines: string[] = []
68
+
69
+ for (const line of lines) {
70
+ if (inSection) {
71
+ const isNewSection = new RegExp(`^#{1,${level}}\\s`).test(line)
72
+ if (isNewSection) break
73
+ sectionLines.push(line)
74
+ } else if (headingPattern.test(line)) {
75
+ inSection = true
76
+ }
77
+ }
78
+
79
+ return sectionLines.join('\n').trim()
80
+ }
81
+
82
+ function escapeRegex(s: string): string {
83
+ return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
84
+ }
85
+
86
+ /**
87
+ * Derive a human-friendly title from the change id.
88
+ * e.g. "bootstrap-platform-skeleton" → "Bootstrap Platform Skeleton"
89
+ */
90
+ function idToTitle(id: string): string {
91
+ return id
92
+ .split('-')
93
+ .map((w) => w.charAt(0).toUpperCase() + w.slice(1))
94
+ .join(' ')
95
+ }
96
+
97
+ function parseArchivedChange(dirName: string): ArchivedChange | null {
98
+ // Expect format: YYYY-MM-DD-<id>
99
+ const match = dirName.match(/^(\d{4}-\d{2}-\d{2})-(.+)$/)
100
+ if (!match) return null
101
+
102
+ const date = match[1] as string
103
+ const id = match[2] as string
104
+
105
+ const proposalPath = path.join(ARCHIVE_DIR, dirName, 'proposal.md')
106
+ if (!fs.existsSync(proposalPath)) return null
107
+
108
+ const raw = fs.readFileSync(proposalPath, 'utf-8')
109
+ const parsed = matter(raw)
110
+ const content = parsed.content
111
+
112
+ const roadmapId = (parsed.data['roadmap-id'] as string | undefined) ?? null
113
+ const why = extractSection(content, '## Why')
114
+ const capabilities = extractSection(content, '## Capabilities')
115
+ const nonGoals = extractSection(content, '## Non-goals')
116
+ const title = idToTitle(id)
117
+
118
+ return { dirName, date, id, roadmapId, why, capabilities, nonGoals, title }
119
+ }
120
+
121
+ // ── Changelog generation ─────────────────────────────────────────────────────
122
+
123
+ function generateChangelogMdx(change: ArchivedChange): string {
124
+ const description = `Archived on ${change.date}${change.roadmapId ? ` · roadmap: ${change.roadmapId}` : ''}`
125
+
126
+ const sections: string[] = []
127
+
128
+ if (change.why) {
129
+ sections.push(`## Why\n\n${change.why}`)
130
+ }
131
+ if (change.capabilities) {
132
+ sections.push(`## Capabilities\n\n${change.capabilities}`)
133
+ }
134
+ if (change.nonGoals) {
135
+ sections.push(`## Non-goals\n\n${change.nonGoals}`)
136
+ }
137
+
138
+ return [
139
+ '---',
140
+ `title: "${change.title}"`,
141
+ `description: "${description}"`,
142
+ '---',
143
+ '',
144
+ `{/* ${AUTO_GENERATED_HEADER} */}`,
145
+ '',
146
+ `> Archived: ${change.date}${change.roadmapId ? ` · roadmap-id: \`${change.roadmapId}\`` : ''}`,
147
+ '',
148
+ ...sections,
149
+ ].join('\n')
150
+ }
151
+
152
+ function syncChangelog(changes: ArchivedChange[]): void {
153
+ fs.mkdirSync(CHANGELOG_OUT_DIR, { recursive: true })
154
+
155
+ // Sort by date descending (newest first)
156
+ const sorted = [...changes].sort((a, b) => b.date.localeCompare(a.date))
157
+
158
+ for (const change of sorted) {
159
+ const outPath = path.join(CHANGELOG_OUT_DIR, `${change.id}.mdx`)
160
+ const mdx = generateChangelogMdx(change)
161
+ fs.writeFileSync(outPath, mdx, 'utf-8')
162
+ console.log(` ✓ changelog/${change.id}.mdx`)
163
+ }
164
+
165
+ // Generate index page listing all changes
166
+ const indexContent = generateChangelogIndex(sorted)
167
+ fs.writeFileSync(path.join(CHANGELOG_OUT_DIR, 'index.mdx'), indexContent, 'utf-8')
168
+ console.log(` ✓ changelog/index.mdx`)
169
+ }
170
+
171
+ function generateChangelogIndex(changes: ArchivedChange[]): string {
172
+ const items = changes.map((c) => `- [${c.title}](./${c.id}) — archived ${c.date}`).join('\n')
173
+
174
+ return [
175
+ '---',
176
+ 'title: "Changelog"',
177
+ 'description: "Archived changes and decision log, newest first."',
178
+ '---',
179
+ '',
180
+ `{/* ${AUTO_GENERATED_HEADER} */}`,
181
+ '',
182
+ 'Archived changes in reverse-chronological order.',
183
+ '',
184
+ items,
185
+ ].join('\n')
186
+ }
187
+
188
+ // ── Roadmap generation ────────────────────────────────────────────────────────
189
+
190
+ function statusBadge(status: string): string {
191
+ const map: Record<string, string> = {
192
+ done: '✅',
193
+ 'in-progress': '🔄',
194
+ planned: '📋',
195
+ }
196
+ return map[status] ?? status
197
+ }
198
+
199
+ function renderBucket(entries: RoadmapEntry[]): string {
200
+ if (!entries || entries.length === 0) return '_No items._'
201
+ return entries
202
+ .map(
203
+ (e) =>
204
+ `- ${statusBadge(e.status)} **${e.title}** \`${e.id}\` \n Status: ${e.status} · Owner: ${e.owner}`,
205
+ )
206
+ .join('\n')
207
+ }
208
+
209
+ function generateRoadmapMdx(data: RoadmapData): string {
210
+ return [
211
+ '---',
212
+ 'title: "Roadmap"',
213
+ 'description: "Current platform roadmap — four-bucket view (Now / Next / Later / Won\'t)."',
214
+ '---',
215
+ '',
216
+ `{/* ${AUTO_GENERATED_HEADER} */}`,
217
+ '',
218
+ '> Auto-generated from `roadmap.yaml`. To update, edit the YAML and re-run `pnpm docs:sync`.',
219
+ '',
220
+ '## Now',
221
+ '',
222
+ renderBucket(data.now),
223
+ '',
224
+ '## Next',
225
+ '',
226
+ renderBucket(data.next),
227
+ '',
228
+ '## Later',
229
+ '',
230
+ renderBucket(data.later),
231
+ '',
232
+ "## Won't",
233
+ '',
234
+ renderBucket(data.wont),
235
+ ].join('\n')
236
+ }
237
+
238
+ function syncRoadmap(): void {
239
+ fs.mkdirSync(ROADMAP_OUT_DIR, { recursive: true })
240
+
241
+ const raw = fs.readFileSync(ROADMAP_FILE, 'utf-8')
242
+ const data = yaml.load(raw) as RoadmapData
243
+
244
+ const mdx = generateRoadmapMdx(data)
245
+ const outPath = path.join(ROADMAP_OUT_DIR, 'index.mdx')
246
+ fs.writeFileSync(outPath, mdx, 'utf-8')
247
+ console.log(` ✓ roadmap/index.mdx`)
248
+ }
249
+
250
+ // ── Entry point ───────────────────────────────────────────────────────────────
251
+
252
+ function main(): void {
253
+ console.log('openspec-docs-sync: starting…')
254
+ console.log(` workspace: ${WORKSPACE_ROOT}`)
255
+
256
+ // 1. Scan archive
257
+ if (!fs.existsSync(ARCHIVE_DIR)) {
258
+ console.error(` ✗ Archive directory not found: ${ARCHIVE_DIR}`)
259
+ process.exit(1)
260
+ }
261
+
262
+ const archiveDirs = fs.readdirSync(ARCHIVE_DIR).filter((d) => {
263
+ const full = path.join(ARCHIVE_DIR, d)
264
+ return fs.statSync(full).isDirectory()
265
+ })
266
+
267
+ console.log(` Found ${archiveDirs.length} archived change(s).`)
268
+
269
+ const changes: ArchivedChange[] = []
270
+ for (const dirName of archiveDirs) {
271
+ const change = parseArchivedChange(dirName)
272
+ if (change) {
273
+ changes.push(change)
274
+ } else {
275
+ console.warn(` ⚠ Skipping unrecognised archive dir: ${dirName}`)
276
+ }
277
+ }
278
+
279
+ // 2. Sync changelog MDX files (idempotent: overwrites by id)
280
+ console.log('\n Syncing changelog…')
281
+ syncChangelog(changes)
282
+
283
+ // 3. Sync roadmap MDX
284
+ console.log('\n Syncing roadmap…')
285
+ syncRoadmap()
286
+
287
+ console.log('\nopenspec-docs-sync: done ✓')
288
+ }
289
+
290
+ main()
@@ -0,0 +1,17 @@
1
+ {
2
+ "extends": "@cogito.ai/tsconfig/base.json",
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "module": "Node16",
6
+ "moduleResolution": "Node16",
7
+ "lib": ["ES2022"],
8
+ "types": ["node"],
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "declaration": true,
12
+ "declarationMap": true,
13
+ "sourceMap": true
14
+ },
15
+ "include": ["src/**/*"],
16
+ "exclude": ["node_modules", "dist"]
17
+ }
@@ -0,0 +1,7 @@
1
+ # @cogito.ai/tsconfig
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Initial release: shared ESLint config and TypeScript config for AgentDock platform packages and templates
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "Strict",
4
+ "compilerOptions": {
5
+ "strict": true,
6
+ "noUncheckedIndexedAccess": true,
7
+ "exactOptionalPropertyTypes": true,
8
+ "noImplicitReturns": true,
9
+ "noFallthroughCasesInSwitch": true
10
+ }
11
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@cogito.ai/tsconfig",
3
+ "version": "0.2.0",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "exports": {
8
+ "./base.json": "./base.json"
9
+ }
10
+ }