dogsbay 0.2.0-beta.3 → 0.2.0-beta.5

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.
@@ -108,54 +108,204 @@ export async function siteInit(targetDir, options) {
108
108
  astroOpts.local = true;
109
109
  emitSiteScaffold(outputDir, config.site.name, astroOpts, true);
110
110
  // Seed starter content so the first `dogsbay site build` succeeds
111
- // without manual intervention. Only writes when this is a fresh
112
- // init (writeConfig=true; scaffold-only consumers already have
113
- // content) and the content dir doesn't exist yet — never
114
- // overwrites user files. See plans/beta-launch-followups.md.
115
- let starterContentPath = null;
111
+ // without manual intervention. Writes index.md, getting-started.md,
112
+ // and nav.yml when (a) this is a fresh init (writeConfig=true;
113
+ // scaffold-only consumers already have content) and (b) the
114
+ // content dir doesn't exist yet. Never overwrites user files. See
115
+ // plans/beta-launch-followups.md.
116
+ let starterContentPaths = [];
116
117
  if (writeConfig) {
117
- starterContentPath = seedStarterContent(absTarget, config);
118
+ starterContentPaths = seedStarterContent(absTarget, config);
118
119
  }
119
- printNextSteps(absTarget, outputDir, config, starterContentPath);
120
+ printNextSteps(absTarget, outputDir, config, starterContentPaths);
120
121
  }
121
122
  /**
122
- * Create a starter `<content>/index.md` if the content dir doesn't
123
- * already exist. Returns the path written, or null when nothing
124
- * was created (dir already populated). Never overwrites.
123
+ * Create a starter content set if the content dir doesn't already
124
+ * exist. Writes `index.md`, `getting-started.md`, and `nav.yml`
125
+ * so the user has a working multi-page site with a navigation
126
+ * structure to learn from. Returns the list of paths written, or
127
+ * an empty array when nothing was created. Never overwrites.
125
128
  */
126
129
  function seedStarterContent(absTarget, config) {
127
130
  const sources = config.content.sources ?? [];
128
131
  const first = sources[0];
129
132
  if (!first?.path)
130
- return null;
133
+ return [];
131
134
  const contentDir = isAbsolute(first.path)
132
135
  ? first.path
133
136
  : join(absTarget, first.path);
134
137
  if (existsSync(contentDir))
135
- return null; // user already has content
138
+ return []; // user already has content
136
139
  mkdirSync(contentDir, { recursive: true });
140
+ const written = [];
141
+ const siteName = config.site.name?.trim() || "your documentation site";
142
+ const basePath = config.site.basePath ?? "/docs";
137
143
  const indexPath = join(contentDir, "index.md");
138
144
  writeFileSync(indexPath, `---
139
- title: ${config.site.name || "Welcome"}
145
+ title: Welcome
140
146
  description: Edit content/index.md to get started.
141
147
  ---
142
148
 
143
- # ${config.site.name || "Welcome"}
149
+ # Welcome
144
150
 
145
- This is your starter page. Replace this content with your own
146
- markdown every \`.md\` file under \`content/\` becomes a page.
151
+ This is the starting point of ${siteName}, built with
152
+ [Dogsbay](https://github.com/dogsbay/dogsbay). Replace this
153
+ content with your own — every \`.md\` file under \`content/\` becomes
154
+ a page.
147
155
 
148
- ## What's next
156
+ > [!TIP]
157
+ > Edit this file (\`content/index.md\`) and save. The dev server
158
+ > reloads automatically.
149
159
 
150
- - Edit this file (\`content/index.md\`) to change the home page.
151
- - Add more \`.md\` files alongside it for additional pages.
152
- - Run \`dogsbay site dev\` to preview live as you edit.
153
- - See \`dogsbay.config.yml\` for site-wide settings (theme, agent
154
- readiness, deploy target, etc.).
160
+ ## Get started in 60 seconds
155
161
 
156
- For the full reference, see https://github.com/dogsbay/dogsbay.
162
+ :::steps
163
+ 1. **Edit a page**
164
+ Open \`content/index.md\` and change something. Save — the
165
+ preview updates live.
166
+
167
+ 2. **Add a page**
168
+ Create \`content/about.md\` with frontmatter and a heading.
169
+
170
+ 3. **Wire it in**
171
+ Add the new page to \`content/nav.yml\` so it shows up in the
172
+ sidebar.
173
+ :::
174
+
175
+ ## Where to go next
176
+
177
+ :::cards
178
+ - **[Getting started](${basePath}/getting-started)**
179
+ Three-minute orientation to editing, adding, and grouping pages.
180
+
181
+ - **[Configuration](${basePath}/getting-started)**
182
+ Site name, theme, base path, and per-source settings live in
183
+ \`dogsbay.config.yml\`.
184
+
185
+ - **[Source on GitHub](https://github.com/dogsbay/dogsbay)**
186
+ Star, browse, file an issue, or follow the roadmap.
187
+
188
+ - **[Plugins](https://github.com/dogsbay/dogsbay/tree/main/docs)**
189
+ Image zoom, TypeDoc, and your own — the plugin API is small,
190
+ typed, and explicit.
191
+ :::
192
+
193
+ ## Markdown that does more
194
+
195
+ Cards, steps, tabs, callouts, fenced code — Dogsbay markdown is
196
+ a small superset of CommonMark with directives for the components
197
+ docs sites need most. Here's the same config in two formats:
198
+
199
+ :::tabs
200
+ YAML
201
+ : \`\`\`yaml
202
+ site:
203
+ name: ${siteName.includes("documentation") ? "Acme Docs" : siteName}
204
+ url: https://example.com
205
+ content:
206
+ sources:
207
+ - path: ./content
208
+ from: dogsbay-md
209
+ \`\`\`
210
+
211
+ JSON
212
+ : \`\`\`json
213
+ {
214
+ "site": { "name": "${siteName.includes("documentation") ? "Acme Docs" : siteName}" },
215
+ "content": {
216
+ "sources": [{ "path": "./content", "from": "dogsbay-md" }]
217
+ }
218
+ }
219
+ \`\`\`
220
+ :::
221
+
222
+ For the full markdown reference, see
223
+ [github.com/dogsbay/dogsbay](https://github.com/dogsbay/dogsbay).
224
+ `);
225
+ written.push(indexPath);
226
+ const gettingStartedPath = join(contentDir, "getting-started.md");
227
+ writeFileSync(gettingStartedPath, `---
228
+ title: Getting started
229
+ description: Quick orientation for new contributors.
230
+ ---
231
+
232
+ # Getting started
233
+
234
+ Three minutes to your first edit. Powered by
235
+ [Dogsbay](https://github.com/dogsbay/dogsbay).
236
+
237
+ ## 1. Edit a page
238
+
239
+ Open \`content/index.md\` in your editor and change something.
240
+ Save — the dev server reloads automatically.
241
+
242
+ ## 2. Add a page
243
+
244
+ Create a new file like \`content/about.md\`:
245
+
246
+ \`\`\`md
247
+ ---
248
+ title: About
249
+ ---
250
+
251
+ # About
252
+
253
+ Whatever you want to say here.
254
+ \`\`\`
255
+
256
+ Then add it to \`content/nav.yml\` so it appears in the sidebar.
257
+ Each entry is a single-key map — key = label, value = file path:
258
+
259
+ \`\`\`yaml
260
+ - About: about.md
261
+ \`\`\`
262
+
263
+ External URLs work the same way:
264
+
265
+ \`\`\`yaml
266
+ - GitHub: https://github.com/your-org/your-repo
267
+ \`\`\`
268
+
269
+ ## 3. Group pages
270
+
271
+ To create a section in the sidebar, give the entry a list of
272
+ children instead of a single file:
273
+
274
+ \`\`\`yaml
275
+ - Guides:
276
+ - Configuration: guides/configuration.md
277
+ - Deployment: guides/deployment.md
278
+ \`\`\`
279
+
280
+ The folder structure under \`content/\` doesn't have to match the
281
+ nav — but it usually does, because it makes URLs predictable.
282
+ `);
283
+ written.push(gettingStartedPath);
284
+ const navPath = join(contentDir, "nav.yml");
285
+ writeFileSync(navPath, `# Sidebar navigation. Loaded by Dogsbay automatically — name this
286
+ # file nav.yml, nav.yaml, or nav.json (in that order of precedence).
287
+ #
288
+ # Each entry is a single-key map. The key is the sidebar label.
289
+ # The value is one of:
290
+ # - a file path (relative to content/, e.g. "guide.md")
291
+ # - an absolute URL (e.g. "https://...")
292
+ # - a list of child entries (creates a group)
293
+ #
294
+ # Examples:
295
+ # - Home: index.md # leaf — file path
296
+ # - GitHub: https://github.com/… # leaf — external URL
297
+ # - Guides: # group — children below
298
+ # - Configuration: guides/config.md
299
+ # - Deployment: guides/deploy.md
300
+ #
301
+ # Edit freely as you add or rearrange pages. See
302
+ # https://github.com/dogsbay/dogsbay for the full nav-file reference.
303
+
304
+ - Home: index.md
305
+ - Getting started: getting-started.md
157
306
  `);
158
- return indexPath;
307
+ written.push(navPath);
308
+ return written;
159
309
  }
160
310
  // ─── Resolution: flags + prompts → DogsbayConfig ─────────────────────────
161
311
  async function resolveConfig(opts, interactive) {
@@ -401,14 +551,14 @@ function findExistingConfig(dir) {
401
551
  }
402
552
  return null;
403
553
  }
404
- function printNextSteps(absTarget, outputDir, config, starterContentPath) {
554
+ function printNextSteps(absTarget, outputDir, config, starterContentPaths) {
405
555
  void config;
406
556
  const sameDir = absTarget === outputDir;
407
557
  console.log("");
408
558
  console.log(pc.green("Wrote:"));
409
559
  console.log(` ${absTarget}/dogsbay.config.yml`);
410
- if (starterContentPath) {
411
- console.log(` ${starterContentPath}`);
560
+ for (const p of starterContentPaths) {
561
+ console.log(` ${p}`);
412
562
  }
413
563
  console.log(` ${outputDir}/package.json`);
414
564
  console.log(` ${outputDir}/astro.config.mjs`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dogsbay",
3
- "version": "0.2.0-beta.3",
3
+ "version": "0.2.0-beta.5",
4
4
  "description": "CLI for Dogsbay — scaffold, build, and serve documentation sites with markdown / MkDocs / Obsidian / OpenAPI sources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,14 +30,14 @@
30
30
  "picocolors": "^1.1.0",
31
31
  "prompts": "^2.4.2",
32
32
  "yaml": "^2.8.3",
33
- "@dogsbay/format-mkdocs": "0.2.0-beta.3",
34
- "@dogsbay/format-obsidian": "0.2.0-beta.3",
35
- "@dogsbay/format-mdx": "0.2.0-beta.3",
36
- "@dogsbay/format-starlight": "0.2.0-beta.3",
37
- "@dogsbay/format-astro": "0.2.0-beta.3",
38
- "@dogsbay/format-dogsbay-md": "0.2.0-beta.3",
39
- "@dogsbay/format-openapi": "0.2.0-beta.3",
40
- "@dogsbay/types": "0.2.0-beta.3"
33
+ "@dogsbay/format-mkdocs": "0.2.0-beta.5",
34
+ "@dogsbay/format-astro": "0.2.0-beta.5",
35
+ "@dogsbay/format-obsidian": "0.2.0-beta.5",
36
+ "@dogsbay/format-mdx": "0.2.0-beta.5",
37
+ "@dogsbay/format-dogsbay-md": "0.2.0-beta.5",
38
+ "@dogsbay/format-starlight": "0.2.0-beta.5",
39
+ "@dogsbay/format-openapi": "0.2.0-beta.5",
40
+ "@dogsbay/types": "0.2.0-beta.5"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^22.0.0",