@flocon-ai/init 0.0.0-stage → 0.0.2

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 CHANGED
@@ -1,3 +1,65 @@
1
- # Temporary Holding Version
1
+ # @flocon-ai/init
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ One command to add Flocon AI pages to your website. Change `/blog` (where the pages go, `/` for the whole website) and the domain, then run it:
4
+
5
+ ```
6
+ npx @flocon-ai/init --path /blog --domain https://acme.com
7
+ ```
8
+
9
+ With options, it asks nothing (same for AI agents). Without options (`npx @flocon-ai/init`), it asks step by step.
10
+
11
+ Supports Next.js (App Router), React Router v7 (framework mode) and Astro.
12
+
13
+ In a terminal, it asks one question at a time (like `create-next-app`), then shows the plan before changing anything:
14
+
15
+ 1. Where should Flocon pages go? Type a path or pick one (autocomplete): `/`, `/blog`, `/guides` first, then the website's folders. Folders that look private (`admin`, `dashboard`, `(app)`…) come last. Next.js: add a route group to use its layout, e.g. `/(site)/blog`.
16
+ 2. Your website's domain? Pre-filled when the project has it (`metadataBase`, `NEXT_PUBLIC_SITE_URL`, `NEXT_PUBLIC_APP_URL`, Astro `site`…). `http://` becomes `https://`. Preview URLs (Vercel `-git-` branches, Netlify deploy previews, Cloudflare Pages previews) and dev tunnels are skipped. Empty = `https://example.com`, replace it later.
17
+ 3. Add `sitemap.xml` and `llms.txt`?
18
+ 4. Plan + "Continue?". Ctrl+C, Esc or "No" at any step: nothing is installed or changed.
19
+
20
+ Project shapes:
21
+
22
+ - `src/app` (Next.js) and `src/pages` (Astro): detected.
23
+ - `[locale]` under the Next.js app folder: the route goes under it and the locale is passed to `<FloconPage />`.
24
+ - `src/pages/[locale]` in Astro: the route goes under it and the locale is passed to `getFloconPage`.
25
+ - Browser-only React (Vite, Lovable, Bolt, CRA): not supported (AI bots do not run JavaScript). The CLI stops and installs nothing.
26
+ - Next.js Pages Router: not supported yet. The CLI stops and installs nothing.
27
+ - Next.js 14 or older, or `output: "export"`: the CLI stops and installs nothing.
28
+ - Astro without SSR (`output: "server"` + an adapter): the CLI stops and installs nothing.
29
+ - React Router with `ssr: false` (SPA mode): the CLI stops and installs nothing.
30
+ - React Router with `flatRoutes()`: the route is a splat file named by the path (`$.tsx`, `blog.$.tsx`). Nothing to add in `app/routes.ts`. With `rootDirectory`, the files go in that folder.
31
+ - A `[slug]`, `[lang]`… route already in the target folder (it would catch the URLs before Flocon): the CLI stops and installs nothing. Pick another path.
32
+ - The route file already exists: the CLI stops and installs nothing. If it is Flocon's own file (second run): "already set up here".
33
+ - React Router with a splat for the same URLs (`route("*")`, `$.tsx`, `($locale).$.tsx`): the CLI stops and installs nothing.
34
+ - Next.js with the root layout in `app/[lang]` (no `app/layout`): the route goes under `[lang]`. No root layout above the route at all: the CLI stops.
35
+ - Next.js route groups: never picked on their own. Type the group in the path to use its layout (`/(site)/blog` → URLs `/blog/...`). In a shell, quote it: `--path "/(site)/blog"`.
36
+ - Next.js App Router + Pages Router in one project: a catch-all in `pages/` for the same URLs stops the command (`next build` passes, but `next start` crashes). `pages/index.tsx` counts as a page for `/` (→ `[...slug]`).
37
+ - Git Bash on Windows turns `/blog` into `C:/Program Files/Git/blog`: the CLI says so. Use `--path blog` (no first slash).
38
+ - Paths with capitals: a note (URLs are case-sensitive). Accents (`/actualités`): the error suggests the plain letters.
39
+ - Next.js route = `[[...slug]]` (it also serves the folder's own URL), or `[...slug]` when the website already has a page there (`app/page.tsx`, `app/blog/page.tsx`…): Next.js refuses both for the same URL.
40
+ - Next.js `cacheComponents: true`: the route uses `export const instant = false` instead of `dynamic`.
41
+ - Config files are read without comments.
42
+
43
+ Options (no prompts, for AI agents and CI). Any of `--path`, `--domain` or `--yes` = no prompts at all (AI agents in Cursor or Windsurf run commands in a real terminal: they hung on the questions). No prompts either when there is no terminal.
44
+
45
+ Questions need Node.js 20.12+. On older Node, the options still work; without options, the CLI stops and shows the one-line command.
46
+
47
+ ```
48
+ npx @flocon-ai/init --path /blog --domain https://acme.com --yes
49
+ ```
50
+
51
+ - `--path <path>`: where pages live (`/` for the whole website, `/blog`…).
52
+ - `--domain <url>`: your website's domain (`https://acme.com` or `acme.com`). Wins over the one found in the project, and skips the domain question.
53
+ - `--yes`: no prompts (path defaults to `/`).
54
+ - `--skip-install`: do not install the package.
55
+ - `--no-sitemap`: do not add the sitemap and `llms.txt` files.
56
+
57
+ The sitemap and `llms.txt` files are never overwritten. If the website already has one, the CLI prints what to add and you merge it yourself.
58
+
59
+ The CLI lists every file that still has `https://example.com`: replace it with your domain. Or run the command again with `--domain`: it replaces `https://example.com` in Flocon's own files.
60
+
61
+ Project with Prettier or Biome: the CLI prints the command to format the new files (it doesn't run it).
62
+
63
+ The CLI never asks for or writes `FLOCON_TOKEN`. Copy it from https://flocon-ai.com/app/tokens, add it to your env file and to your host **before you push or deploy**: without it, Flocon's URLs return an error (500). With `--path /`, that is every unknown URL of the website. On Cloudflare: `.dev.vars` locally, and a Secret on the host (`wrangler secret put FLOCON_TOKEN`).
64
+
65
+ Tests: `npm test` (reads the files the CLI writes). `npm run test:build`: real builds + type checks on what the CLI writes (Next.js latest and 15 with `next start`, Astro, React Router latest and 7.7), with the frameworks and the Flocon libs from npm (~2 min, needs the network). CI runs both, only when this folder changes.
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@flocon-ai/init",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "description": "One command to add Flocon AI pages to your website: npx @flocon-ai/init",
5
+ "homepage": "https://flocon-ai.com/docs",
6
+ "keywords": [
7
+ "flocon-ai",
8
+ "seo",
9
+ "geo",
10
+ "mcp",
11
+ "cli",
12
+ "nextjs",
13
+ "astro",
14
+ "react-router"
15
+ ],
16
+ "license": "UNLICENSED",
17
+ "type": "module",
18
+ "bin": {
19
+ "init": "./src/cli.mjs"
20
+ },
21
+ "files": [
22
+ "src"
23
+ ],
24
+ "engines": {
25
+ "node": ">=20"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "test": "node --test test/init.test.mjs",
32
+ "test:build": "node --test --test-concurrency=1 test/build.test.mjs"
33
+ },
34
+ "dependencies": {
35
+ "@clack/prompts": "^1.9.0"
36
+ }
37
+ }