specra-cli 0.3.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.
Files changed (172) hide show
  1. package/LICENSE.MD +33 -0
  2. package/README.md +246 -0
  3. package/dist/api-client-VHQARPDT.js +15 -0
  4. package/dist/api-client-VHQARPDT.js.map +1 -0
  5. package/dist/chunk-5765WX4D.js +192 -0
  6. package/dist/chunk-5765WX4D.js.map +1 -0
  7. package/dist/chunk-72RDEJR2.js +94 -0
  8. package/dist/chunk-72RDEJR2.js.map +1 -0
  9. package/dist/chunk-SQ2MMFUZ.js +102 -0
  10. package/dist/chunk-SQ2MMFUZ.js.map +1 -0
  11. package/dist/cli.d.ts +2 -0
  12. package/dist/cli.js +242 -0
  13. package/dist/cli.js.map +1 -0
  14. package/dist/deploy-V4JO2D6B.js +179 -0
  15. package/dist/deploy-V4JO2D6B.js.map +1 -0
  16. package/dist/doctor-ICALAJ4N.js +309 -0
  17. package/dist/doctor-ICALAJ4N.js.map +1 -0
  18. package/dist/login-UG3WU7DY.js +92 -0
  19. package/dist/login-UG3WU7DY.js.map +1 -0
  20. package/dist/logout-WJKHJZT6.js +24 -0
  21. package/dist/logout-WJKHJZT6.js.map +1 -0
  22. package/dist/logs-BLUJPWNO.js +77 -0
  23. package/dist/logs-BLUJPWNO.js.map +1 -0
  24. package/dist/projects-LJ57GK3D.js +49 -0
  25. package/dist/projects-LJ57GK3D.js.map +1 -0
  26. package/package.json +50 -0
  27. package/templates/book-docs/.env.sample +1 -0
  28. package/templates/book-docs/docs/v1.0.0/concepts.mdx +89 -0
  29. package/templates/book-docs/docs/v1.0.0/content/_category_.json +7 -0
  30. package/templates/book-docs/docs/v1.0.0/content/formatting.mdx +128 -0
  31. package/templates/book-docs/docs/v1.0.0/content/reusable-content.mdx +116 -0
  32. package/templates/book-docs/docs/v1.0.0/content/structure.mdx +92 -0
  33. package/templates/book-docs/docs/v1.0.0/customization/_category_.json +7 -0
  34. package/templates/book-docs/docs/v1.0.0/customization/branding.mdx +115 -0
  35. package/templates/book-docs/docs/v1.0.0/customization/themes.mdx +81 -0
  36. package/templates/book-docs/docs/v1.0.0/introduction.mdx +38 -0
  37. package/templates/book-docs/docs/v1.0.0/quickstart.mdx +112 -0
  38. package/templates/book-docs/docs/v2.0.0/concepts.mdx +89 -0
  39. package/templates/book-docs/docs/v2.0.0/content/_category_.json +7 -0
  40. package/templates/book-docs/docs/v2.0.0/content/formatting.mdx +128 -0
  41. package/templates/book-docs/docs/v2.0.0/content/reusable-content.mdx +116 -0
  42. package/templates/book-docs/docs/v2.0.0/content/structure.mdx +92 -0
  43. package/templates/book-docs/docs/v2.0.0/customization/_category_.json +7 -0
  44. package/templates/book-docs/docs/v2.0.0/customization/branding.mdx +115 -0
  45. package/templates/book-docs/docs/v2.0.0/customization/themes.mdx +81 -0
  46. package/templates/book-docs/docs/v2.0.0/introduction.mdx +39 -0
  47. package/templates/book-docs/docs/v2.0.0/quickstart.mdx +112 -0
  48. package/templates/book-docs/gitignore +7 -0
  49. package/templates/book-docs/package.json +28 -0
  50. package/templates/book-docs/postcss.config.mjs +8 -0
  51. package/templates/book-docs/public/api-specs/openapi-example.json +259 -0
  52. package/templates/book-docs/public/api-specs/postman-example.json +205 -0
  53. package/templates/book-docs/public/api-specs/test-api.json +256 -0
  54. package/templates/book-docs/public/api-specs/users-api.json +264 -0
  55. package/templates/book-docs/specra.config.json +77 -0
  56. package/templates/book-docs/src/app.css +86 -0
  57. package/templates/book-docs/src/app.html +17 -0
  58. package/templates/book-docs/src/params/product.ts +7 -0
  59. package/templates/book-docs/src/routes/+layout.server.ts +14 -0
  60. package/templates/book-docs/src/routes/+layout.svelte +21 -0
  61. package/templates/book-docs/src/routes/+page.server.ts +9 -0
  62. package/templates/book-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
  63. package/templates/book-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
  64. package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
  65. package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
  66. package/templates/book-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
  67. package/templates/book-docs/src/routes/docs/[version]/+page.server.ts +27 -0
  68. package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
  69. package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
  70. package/templates/book-docs/static/favicon.svg +4 -0
  71. package/templates/book-docs/svelte.config.js +13 -0
  72. package/templates/book-docs/tsconfig.json +12 -0
  73. package/templates/book-docs/vite.config.ts +6 -0
  74. package/templates/jbrains-docs/.env.sample +1 -0
  75. package/templates/jbrains-docs/docs/v1.0.0/advanced/_category_.json +8 -0
  76. package/templates/jbrains-docs/docs/v1.0.0/advanced/async.mdx +95 -0
  77. package/templates/jbrains-docs/docs/v1.0.0/advanced/generics.mdx +126 -0
  78. package/templates/jbrains-docs/docs/v1.0.0/basics/_category_.json +8 -0
  79. package/templates/jbrains-docs/docs/v1.0.0/basics/control-flow.mdx +106 -0
  80. package/templates/jbrains-docs/docs/v1.0.0/basics/syntax.mdx +129 -0
  81. package/templates/jbrains-docs/docs/v1.0.0/basics/types.mdx +135 -0
  82. package/templates/jbrains-docs/docs/v1.0.0/getting-started.mdx +111 -0
  83. package/templates/jbrains-docs/docs/v1.0.0/home.mdx +37 -0
  84. package/templates/jbrains-docs/docs/v1.0.0/tools/_category_.json +8 -0
  85. package/templates/jbrains-docs/docs/v1.0.0/tools/build-tools.mdx +165 -0
  86. package/templates/jbrains-docs/docs/v1.0.0/tools/testing.mdx +112 -0
  87. package/templates/jbrains-docs/docs/v2.0.0/advanced/_category_.json +8 -0
  88. package/templates/jbrains-docs/docs/v2.0.0/advanced/async.mdx +95 -0
  89. package/templates/jbrains-docs/docs/v2.0.0/advanced/generics.mdx +126 -0
  90. package/templates/jbrains-docs/docs/v2.0.0/basics/_category_.json +8 -0
  91. package/templates/jbrains-docs/docs/v2.0.0/basics/control-flow.mdx +106 -0
  92. package/templates/jbrains-docs/docs/v2.0.0/basics/syntax.mdx +129 -0
  93. package/templates/jbrains-docs/docs/v2.0.0/basics/types.mdx +135 -0
  94. package/templates/jbrains-docs/docs/v2.0.0/getting-started.mdx +111 -0
  95. package/templates/jbrains-docs/docs/v2.0.0/home.mdx +37 -0
  96. package/templates/jbrains-docs/docs/v2.0.0/tools/_category_.json +8 -0
  97. package/templates/jbrains-docs/docs/v2.0.0/tools/build-tools.mdx +165 -0
  98. package/templates/jbrains-docs/docs/v2.0.0/tools/testing.mdx +112 -0
  99. package/templates/jbrains-docs/gitignore +7 -0
  100. package/templates/jbrains-docs/package.json +28 -0
  101. package/templates/jbrains-docs/postcss.config.mjs +8 -0
  102. package/templates/jbrains-docs/public/api-specs/openapi-example.json +259 -0
  103. package/templates/jbrains-docs/public/api-specs/postman-example.json +205 -0
  104. package/templates/jbrains-docs/public/api-specs/test-api.json +256 -0
  105. package/templates/jbrains-docs/public/api-specs/users-api.json +264 -0
  106. package/templates/jbrains-docs/specra.config.json +80 -0
  107. package/templates/jbrains-docs/src/app.css +86 -0
  108. package/templates/jbrains-docs/src/app.html +17 -0
  109. package/templates/jbrains-docs/src/params/product.ts +7 -0
  110. package/templates/jbrains-docs/src/routes/+layout.server.ts +14 -0
  111. package/templates/jbrains-docs/src/routes/+layout.svelte +21 -0
  112. package/templates/jbrains-docs/src/routes/+page.server.ts +9 -0
  113. package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
  114. package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
  115. package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
  116. package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
  117. package/templates/jbrains-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
  118. package/templates/jbrains-docs/src/routes/docs/[version]/+page.server.ts +27 -0
  119. package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
  120. package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
  121. package/templates/jbrains-docs/static/favicon.svg +4 -0
  122. package/templates/jbrains-docs/svelte.config.js +13 -0
  123. package/templates/jbrains-docs/tsconfig.json +12 -0
  124. package/templates/jbrains-docs/vite.config.ts +6 -0
  125. package/templates/minimal/.env.sample +1 -0
  126. package/templates/minimal/docs/v1.0.0/about.mdx +57 -0
  127. package/templates/minimal/docs/v1.0.0/components/_category_.json +8 -0
  128. package/templates/minimal/docs/v1.0.0/components/callout.mdx +83 -0
  129. package/templates/minimal/docs/v1.0.0/components/code-block.mdx +103 -0
  130. package/templates/minimal/docs/v1.0.0/components/index.mdx +8 -0
  131. package/templates/minimal/docs/v1.0.0/components/tabs.mdx +92 -0
  132. package/templates/minimal/docs/v1.0.0/configuration.mdx +322 -0
  133. package/templates/minimal/docs/v1.0.0/features.mdx +197 -0
  134. package/templates/minimal/docs/v1.0.0/getting-started.mdx +183 -0
  135. package/templates/minimal/docs/v2.0.0/about.mdx +57 -0
  136. package/templates/minimal/docs/v2.0.0/components/_category_.json +8 -0
  137. package/templates/minimal/docs/v2.0.0/components/callout.mdx +83 -0
  138. package/templates/minimal/docs/v2.0.0/components/code-block.mdx +103 -0
  139. package/templates/minimal/docs/v2.0.0/components/index.mdx +8 -0
  140. package/templates/minimal/docs/v2.0.0/components/tabs.mdx +92 -0
  141. package/templates/minimal/docs/v2.0.0/configuration.mdx +322 -0
  142. package/templates/minimal/docs/v2.0.0/features.mdx +197 -0
  143. package/templates/minimal/docs/v2.0.0/getting-started.mdx +183 -0
  144. package/templates/minimal/gitignore +7 -0
  145. package/templates/minimal/package.json +29 -0
  146. package/templates/minimal/postcss.config.mjs +8 -0
  147. package/templates/minimal/specra.config.json +91 -0
  148. package/templates/minimal/src/app.css +86 -0
  149. package/templates/minimal/src/app.html +17 -0
  150. package/templates/minimal/src/hooks.server.ts +8 -0
  151. package/templates/minimal/src/params/product.ts +7 -0
  152. package/templates/minimal/src/routes/+error.svelte +10 -0
  153. package/templates/minimal/src/routes/+layout.server.ts +14 -0
  154. package/templates/minimal/src/routes/+layout.svelte +21 -0
  155. package/templates/minimal/src/routes/+page.server.ts +9 -0
  156. package/templates/minimal/src/routes/+page.svelte +149 -0
  157. package/templates/minimal/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
  158. package/templates/minimal/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
  159. package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
  160. package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
  161. package/templates/minimal/src/routes/docs/[version]/+layout.server.ts +42 -0
  162. package/templates/minimal/src/routes/docs/[version]/+page.server.ts +27 -0
  163. package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
  164. package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
  165. package/templates/minimal/static/api-specs/openapi-example.json +259 -0
  166. package/templates/minimal/static/api-specs/postman-example.json +205 -0
  167. package/templates/minimal/static/api-specs/test-api.json +256 -0
  168. package/templates/minimal/static/api-specs/users-api.json +264 -0
  169. package/templates/minimal/static/favicon.svg +4 -0
  170. package/templates/minimal/svelte.config.js +13 -0
  171. package/templates/minimal/tsconfig.json +12 -0
  172. package/templates/minimal/vite.config.ts +6 -0
@@ -0,0 +1,111 @@
1
+ ---
2
+ title: Getting Started
3
+ description: Set up your environment and create your first project
4
+ sidebar_position: 2
5
+ icon: rocket
6
+ ---
7
+
8
+ This guide walks you through setting up your development environment and writing your first program.
9
+
10
+ ## Prerequisites
11
+
12
+ - **Node.js 18+** installed on your machine
13
+ - A code editor (VS Code recommended)
14
+ - A terminal or command line
15
+
16
+ ## Create a Project
17
+
18
+ <Steps>
19
+ <Step title="Scaffold the Project">
20
+ Use the CLI to create a new project:
21
+
22
+ ```bash
23
+ npx create-specra my-project
24
+ ```
25
+ </Step>
26
+
27
+ <Step title="Install Dependencies">
28
+ <Tabs defaultValue="npm">
29
+ <Tab label="npm">
30
+ ```bash
31
+ cd my-project && npm install
32
+ ```
33
+ </Tab>
34
+ <Tab label="yarn">
35
+ ```bash
36
+ cd my-project && yarn install
37
+ ```
38
+ </Tab>
39
+ <Tab label="pnpm">
40
+ ```bash
41
+ cd my-project && pnpm install
42
+ ```
43
+ </Tab>
44
+ </Tabs>
45
+ </Step>
46
+
47
+ <Step title="Run the Project">
48
+ <Tabs defaultValue="npm">
49
+ <Tab label="npm">
50
+ ```bash
51
+ npm run dev
52
+ ```
53
+ </Tab>
54
+ <Tab label="yarn">
55
+ ```bash
56
+ yarn dev
57
+ ```
58
+ </Tab>
59
+ <Tab label="pnpm">
60
+ ```bash
61
+ pnpm dev
62
+ ```
63
+ </Tab>
64
+ </Tabs>
65
+
66
+ Open `http://localhost:5173` in your browser.
67
+ </Step>
68
+ </Steps>
69
+
70
+ ## Project Structure
71
+
72
+ A newly scaffolded project has this structure:
73
+
74
+ ```txt
75
+ my-project/
76
+ ├── docs/
77
+ │ ├── v1.0.0/ # Documentation content
78
+ │ └── v2.0.0/ # Another version
79
+ ├── src/ # Application source
80
+ ├── specra.config.json # Configuration
81
+ └── package.json
82
+ ```
83
+
84
+ ## Hello World
85
+
86
+ Create a new file `docs/v1.0.0/hello.mdx`:
87
+
88
+ ```mdx
89
+ ---
90
+ title: Hello World
91
+ sidebar_position: 99
92
+ ---
93
+
94
+ # Hello World
95
+
96
+ This is your first documentation page!
97
+
98
+ ```
99
+
100
+ <Callout type="tip">
101
+ Files are automatically picked up by the sidebar. Use `sidebar_position` to control ordering.
102
+ </Callout>
103
+
104
+ ## What's Next
105
+
106
+ Now that you have a running project, explore the language fundamentals:
107
+
108
+ <CardGrid cols={2}>
109
+ <Card icon="code" title="Basic Syntax" description="Learn the fundamental building blocks" href="/docs/v1.0.0/basics/syntax" />
110
+ <Card icon="layers" title="Types & Variables" description="Understand the type system" href="/docs/v1.0.0/basics/types" />
111
+ </CardGrid>
@@ -0,0 +1,37 @@
1
+ ---
2
+ title: Home
3
+ description: Welcome to the language documentation
4
+ sidebar_position: 1
5
+ icon: home
6
+ ---
7
+
8
+ Welcome to the documentation. Learn the language from basics to advanced topics, and explore multiplatform tooling.
9
+
10
+ ## Get Started
11
+
12
+ <CardGrid cols={2}>
13
+ <Card icon="book-open" title="Get Started" description="Set up your environment and write your first program" href="/docs/v1.0.0/getting-started" />
14
+ <Card icon="code" title="Basic Syntax" description="Learn the fundamental syntax and structure" href="/docs/v1.0.0/basics/syntax" />
15
+ <Card icon="layers" title="Types & Variables" description="Understand the type system and variable declarations" href="/docs/v1.0.0/basics/types" />
16
+ <Card icon="wrench" title="Build Tools" description="Configure and use build tools for your projects" href="/docs/v1.0.0/tools/build-tools" />
17
+ </CardGrid>
18
+
19
+ ## Language
20
+
21
+ The **Language** section covers everything from basic syntax to advanced features like generics and async programming.
22
+
23
+ <Callout type="info">
24
+ If you're new, start with the [Getting Started](/docs/v1.0.0/getting-started) guide, then work through the Basics section.
25
+ </Callout>
26
+
27
+ ## Multiplatform
28
+
29
+ The **Multiplatform** section covers tooling, build systems, and testing across different platforms and environments.
30
+
31
+ ## What's in This Documentation
32
+
33
+ | Section | Description |
34
+ |---------|-------------|
35
+ | **Basics** | Syntax, types, variables, and control flow |
36
+ | **Advanced** | Generics, async programming, and advanced patterns |
37
+ | **Tools** | Build tools, testing frameworks, and project setup |
@@ -0,0 +1,8 @@
1
+ {
2
+ "label": "Tools",
3
+ "position": 5,
4
+ "collapsible": true,
5
+ "collapsed": false,
6
+ "icon": "wrench",
7
+ "tab_group": "multiplatform"
8
+ }
@@ -0,0 +1,165 @@
1
+ ---
2
+ title: Build Tools
3
+ description: Configure and use build tools for your documentation project
4
+ sidebar_position: 1
5
+ ---
6
+
7
+ This page covers the build tools used to develop, build, and deploy your documentation site.
8
+
9
+ ## Development Server
10
+
11
+ Start the development server with hot reload:
12
+
13
+ <Tabs defaultValue="npm">
14
+ <Tab label="npm">
15
+ ```bash
16
+ npm run dev
17
+ ```
18
+ </Tab>
19
+ <Tab label="yarn">
20
+ ```bash
21
+ yarn dev
22
+ ```
23
+ </Tab>
24
+ <Tab label="pnpm">
25
+ ```bash
26
+ pnpm dev
27
+ ```
28
+ </Tab>
29
+ </Tabs>
30
+
31
+ The dev server runs on `http://localhost:5173` by default with:
32
+ - **Hot Module Replacement (HMR)** — instant updates when you edit MDX files
33
+ - **Error overlay** — displays build errors in the browser
34
+ - **Fast startup** — powered by Vite
35
+
36
+ ## Production Build
37
+
38
+ Build the site for production:
39
+
40
+ <Tabs defaultValue="npm">
41
+ <Tab label="npm">
42
+ ```bash
43
+ npm run build
44
+ ```
45
+ </Tab>
46
+ <Tab label="yarn">
47
+ ```bash
48
+ yarn build
49
+ ```
50
+ </Tab>
51
+ <Tab label="pnpm">
52
+ ```bash
53
+ pnpm build
54
+ ```
55
+ </Tab>
56
+ </Tabs>
57
+
58
+ This outputs a static site to the `build/` directory.
59
+
60
+ <Callout type="info">
61
+ The production build pre-renders all pages for optimal performance and SEO.
62
+ </Callout>
63
+
64
+ ## Preview
65
+
66
+ Preview the production build locally:
67
+
68
+ <Tabs defaultValue="npm">
69
+ <Tab label="npm">
70
+ ```bash
71
+ npm run preview
72
+ ```
73
+ </Tab>
74
+ <Tab label="yarn">
75
+ ```bash
76
+ yarn preview
77
+ ```
78
+ </Tab>
79
+ <Tab label="pnpm">
80
+ ```bash
81
+ pnpm preview
82
+ ```
83
+ </Tab>
84
+ </Tabs>
85
+
86
+ ## Vite Configuration
87
+
88
+ The documentation platform uses Vite as its build tool. The default configuration is in `vite.config.ts`:
89
+
90
+ ```typescript
91
+ import { sveltekit } from '@sveltejs/kit/vite';
92
+ import { defineConfig } from 'vite';
93
+
94
+ export default defineConfig({
95
+ plugins: [sveltekit()]
96
+ });
97
+ ```
98
+
99
+ ## SvelteKit Configuration
100
+
101
+ SvelteKit is configured in `svelte.config.js`:
102
+
103
+ ```javascript
104
+ import { specraConfig } from 'specra/svelte-config';
105
+ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
106
+
107
+ const config = specraConfig({
108
+ vitePreprocess: { vitePreprocess }
109
+ });
110
+
111
+ export default config;
112
+ ```
113
+
114
+ ## PostCSS & Tailwind
115
+
116
+ Styling is handled by Tailwind CSS via PostCSS. Configuration is in `postcss.config.mjs`:
117
+
118
+ ```javascript
119
+ const config = {
120
+ plugins: {
121
+ '@tailwindcss/postcss': {},
122
+ },
123
+ };
124
+
125
+ export default config;
126
+ ```
127
+
128
+ ## TypeScript
129
+
130
+ TypeScript is configured in `tsconfig.json` with strict mode enabled:
131
+
132
+ ```json
133
+ {
134
+ "extends": "./.svelte-kit/tsconfig.json",
135
+ "compilerOptions": {
136
+ "strict": true,
137
+ "allowJs": true,
138
+ "checkJs": true
139
+ }
140
+ }
141
+ ```
142
+
143
+ ## Type Checking
144
+
145
+ Run the type checker:
146
+
147
+ <Tabs defaultValue="npm">
148
+ <Tab label="npm">
149
+ ```bash
150
+ npm run check
151
+ ```
152
+ </Tab>
153
+ <Tab label="yarn">
154
+ ```bash
155
+ yarn check
156
+ ```
157
+ </Tab>
158
+ <Tab label="pnpm">
159
+ ```bash
160
+ pnpm check
161
+ ```
162
+ </Tab>
163
+ </Tabs>
164
+
165
+ This runs `svelte-kit sync` followed by `svelte-check` to verify your TypeScript types.
@@ -0,0 +1,112 @@
1
+ ---
2
+ title: Testing
3
+ description: Verify your documentation builds and renders correctly
4
+ sidebar_position: 2
5
+ ---
6
+
7
+ This page covers strategies for testing your documentation site to ensure content renders correctly and the build succeeds.
8
+
9
+ ## Build Verification
10
+
11
+ The simplest test is to run a production build and check for errors:
12
+
13
+ <Tabs defaultValue="npm">
14
+ <Tab label="npm">
15
+ ```bash
16
+ npm run build
17
+ ```
18
+ </Tab>
19
+ <Tab label="yarn">
20
+ ```bash
21
+ yarn build
22
+ ```
23
+ </Tab>
24
+ <Tab label="pnpm">
25
+ ```bash
26
+ pnpm build
27
+ ```
28
+ </Tab>
29
+ </Tabs>
30
+
31
+ The build will fail if:
32
+ - MDX files have syntax errors
33
+ - Frontmatter is malformed
34
+ - Required fields are missing
35
+
36
+ <Callout type="tip">
37
+ Run `npm run build` in your CI pipeline to catch documentation errors before they reach production.
38
+ </Callout>
39
+
40
+ ## Type Checking
41
+
42
+ Verify TypeScript types are correct:
43
+
44
+ ```bash
45
+ npm run check
46
+ ```
47
+
48
+ This catches type errors in your SvelteKit configuration and any custom components.
49
+
50
+ ## Content Checklist
51
+
52
+ When reviewing documentation changes, verify:
53
+
54
+ | Check | Description |
55
+ |-------|-------------|
56
+ | **Frontmatter** | All pages have `title`, and key pages have `description` |
57
+ | **Links** | Internal links point to existing pages |
58
+ | **Versions** | Content exists in all active version directories |
59
+ | **Sidebar Order** | `sidebar_position` values create a logical reading flow |
60
+ | **Categories** | Each folder has a `_category_.json` with `label` and `position` |
61
+
62
+ ## Visual Testing
63
+
64
+ Preview the site locally and check:
65
+
66
+ <Steps>
67
+ <Step title="Start Dev Server">
68
+ Run `npm run dev` and open the site in your browser.
69
+ </Step>
70
+
71
+ <Step title="Check Navigation">
72
+ Verify sidebar links work, breadcrumbs are correct, and previous/next navigation follows the expected order.
73
+ </Step>
74
+
75
+ <Step title="Check Themes">
76
+ Toggle between light and dark themes. Ensure all content is readable in both modes.
77
+ </Step>
78
+
79
+ <Step title="Check Responsive">
80
+ Test on different viewport sizes. The mobile sidebar should collapse into a menu.
81
+ </Step>
82
+ </Steps>
83
+
84
+ ## Common Issues
85
+
86
+ ### Frontmatter Parsing Errors
87
+
88
+ ```
89
+ Error: Invalid frontmatter in docs/v1.0.0/page.mdx
90
+ ```
91
+
92
+ Ensure your frontmatter uses valid YAML syntax and is enclosed by `---` delimiters.
93
+
94
+ ### Missing Pages
95
+
96
+ If a page doesn't appear in the sidebar:
97
+
98
+ 1. Check the file has the `.mdx` extension (not `.md`)
99
+ 2. Verify the file is in the correct version directory
100
+ 3. Check if `draft: true` is set in frontmatter
101
+
102
+ ### Broken Links
103
+
104
+ If internal links return 404:
105
+
106
+ 1. Check the path matches the file structure
107
+ 2. Include the version prefix: `/docs/v1.0.0/page-name`
108
+ 3. Use the file's slug (filename without `.mdx`), not the title
109
+
110
+ <Callout type="info">
111
+ The dev server shows detailed error messages in the browser overlay. Check the terminal output for build-time errors.
112
+ </Callout>
@@ -0,0 +1,8 @@
1
+ {
2
+ "label": "Advanced",
3
+ "position": 4,
4
+ "collapsible": true,
5
+ "collapsed": false,
6
+ "icon": "graduation-cap",
7
+ "tab_group": "language"
8
+ }
@@ -0,0 +1,95 @@
1
+ ---
2
+ title: Async Programming
3
+ description: Asynchronous data loading and dynamic content
4
+ sidebar_position: 2
5
+ ---
6
+
7
+ This page covers how the documentation platform handles asynchronous operations like data loading, content processing, and dynamic rendering.
8
+
9
+ ## How Content Loading Works
10
+
11
+ Documentation pages are loaded asynchronously at build time and on navigation. The platform uses SvelteKit's server-side loading to fetch and process MDX content:
12
+
13
+ ```typescript
14
+ export const load: PageServerLoad = async ({ params }) => {
15
+ const { version, slug } = params;
16
+ const doc = await getCachedDocBySlug(slug, version);
17
+ const allDocs = await getCachedAllDocs(version);
18
+ return { doc, allDocs, version, slug };
19
+ };
20
+ ```
21
+
22
+ <Callout type="info">
23
+ Content is cached after the first load, so subsequent navigations are nearly instant.
24
+ </Callout>
25
+
26
+ ## Server-Side Data Flow
27
+
28
+ The data loading follows this pipeline:
29
+
30
+ <Steps>
31
+ <Step title="Route Matching">
32
+ SvelteKit matches the URL to a route pattern like `/docs/[version]/[...slug]`.
33
+ </Step>
34
+
35
+ <Step title="Data Loading">
36
+ The `+page.server.ts` load function runs, fetching the document and sidebar data.
37
+ </Step>
38
+
39
+ <Step title="MDX Processing">
40
+ The MDX content is parsed, components are resolved, and the content tree is built.
41
+ </Step>
42
+
43
+ <Step title="Rendering">
44
+ The Svelte component renders the processed content with all interactive components.
45
+ </Step>
46
+ </Steps>
47
+
48
+ ## Configuration Loading
49
+
50
+ Configuration is loaded once at application startup and cached:
51
+
52
+ ```typescript
53
+ import { initConfig, getConfig } from 'specra';
54
+ import specraConfig from '../../specra.config.json';
55
+
56
+ initConfig(specraConfig);
57
+
58
+ const config = getConfig(); // Cached after first call
59
+ ```
60
+
61
+ ## Version Resolution
62
+
63
+ When a user navigates to the root URL, the system resolves the active version and redirects:
64
+
65
+ ```typescript
66
+ export const load: PageServerLoad = async () => {
67
+ const config = getConfig();
68
+ const activeVersion = config.site?.activeVersion || 'v1.0.0';
69
+ redirect(302, `/docs/${activeVersion}/home`);
70
+ };
71
+ ```
72
+
73
+ ## Adjacent Document Resolution
74
+
75
+ Previous and next links are computed asynchronously from the full document list:
76
+
77
+ ```typescript
78
+ const { previous, next } = getAdjacentDocs(slug, allDocs);
79
+ ```
80
+
81
+ This enables linear navigation through the documentation in sidebar order.
82
+
83
+ ## Table of Contents Extraction
84
+
85
+ The table of contents is extracted from heading elements in the content:
86
+
87
+ ```typescript
88
+ const toc = extractTableOfContents(doc.content);
89
+ ```
90
+
91
+ This returns a structured list of headings with their depths and anchor IDs.
92
+
93
+ <Callout type="tip">
94
+ All these async operations are handled by the platform automatically. You only need to write MDX content — the data loading pipeline is built in.
95
+ </Callout>
@@ -0,0 +1,126 @@
1
+ ---
2
+ title: Generics
3
+ description: Create reusable, type-safe documentation patterns
4
+ sidebar_position: 1
5
+ ---
6
+
7
+ Generics in the context of this documentation platform refer to creating reusable, parameterized content patterns that work across different contexts.
8
+
9
+ ## Reusable Component Patterns
10
+
11
+ The built-in component library provides generic patterns that adapt to your content:
12
+
13
+ ### Cards
14
+
15
+ Cards accept different props to serve different purposes:
16
+
17
+ <CardGrid cols={3}>
18
+ <Card icon="zap" title="Feature Card" description="Showcase a feature" />
19
+ <Card icon="book" title="Guide Card" description="Link to a guide" href="/docs/v2.0.0/getting-started" />
20
+ <Card icon="code" title="Code Card" description="Reference a code concept" />
21
+ </CardGrid>
22
+
23
+ ### Tabs
24
+
25
+ Tabs provide generic containers for alternative content:
26
+
27
+ <Tabs defaultValue="Pattern A">
28
+ <Tab label="Pattern A">
29
+ Use tabs for installation instructions across different package managers.
30
+
31
+ ```bash
32
+ npm install my-package
33
+ ```
34
+ </Tab>
35
+ <Tab label="Pattern B">
36
+ Use tabs for code examples across different languages.
37
+
38
+ ```python
39
+ pip install my-package
40
+ ```
41
+ </Tab>
42
+ <Tab label="Pattern C">
43
+ Use tabs for platform-specific instructions.
44
+
45
+ ```bash
46
+ brew install my-package
47
+ ```
48
+ </Tab>
49
+ </Tabs>
50
+
51
+ ## Generic Page Templates
52
+
53
+ ### Landing Pages
54
+
55
+ Landing pages use CardGrid to create navigation hubs:
56
+
57
+ ```mdx
58
+ ---
59
+ title: Section Landing
60
+ ---
61
+
62
+ <CardGrid cols={2}>
63
+ <Card title="Topic A" description="Description" href="/path" />
64
+ <Card title="Topic B" description="Description" href="/path" />
65
+ </CardGrid>
66
+ ```
67
+
68
+ ### Reference Pages
69
+
70
+ Reference pages use tables and code blocks:
71
+
72
+ ```mdx
73
+ ---
74
+ title: API Reference
75
+ ---
76
+
77
+ | Parameter | Type | Description |
78
+ |-----------|------|-------------|
79
+ | `name` | `string` | The item name |
80
+ | `value` | `number` | The item value |
81
+ ```
82
+
83
+ ### Tutorial Pages
84
+
85
+ Tutorial pages use Steps for structured guidance:
86
+
87
+ ```mdx
88
+ ---
89
+ title: Tutorial
90
+ ---
91
+
92
+ <Steps>
93
+ <Step title="Step 1">Instructions here</Step>
94
+ <Step title="Step 2">More instructions</Step>
95
+ </Steps>
96
+ ```
97
+
98
+ ## Callout Types as Generic Patterns
99
+
100
+ Each callout type serves a specific semantic purpose:
101
+
102
+ <Callout type="info">
103
+ **Info** — Supplementary context that enriches understanding.
104
+ </Callout>
105
+
106
+ <Callout type="tip">
107
+ **Tip** — Practical advice that improves the reader's workflow.
108
+ </Callout>
109
+
110
+ <Callout type="warning">
111
+ **Warning** — Important caveats or potential issues to be aware of.
112
+ </Callout>
113
+
114
+ <Callout type="error">
115
+ **Error** — Critical mistakes to avoid or known issues.
116
+ </Callout>
117
+
118
+ ## Best Practices
119
+
120
+ | Pattern | When to Use |
121
+ |---------|-------------|
122
+ | CardGrid | Hub pages, feature showcases, navigation |
123
+ | Tabs | Alternative content (languages, platforms, package managers) |
124
+ | Steps | Sequential instructions, tutorials |
125
+ | Callouts | Inline annotations (tips, warnings, notes) |
126
+ | Tables | Reference data, comparisons, specifications |
@@ -0,0 +1,8 @@
1
+ {
2
+ "label": "Basics",
3
+ "position": 3,
4
+ "collapsible": true,
5
+ "collapsed": false,
6
+ "icon": "book",
7
+ "tab_group": "language"
8
+ }