apostil 0.1.0 → 0.1.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 +26 -16
- package/dist/cli/index.js +59 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +170 -112
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
# Apostil
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Figma-like commenting tool for React & Next.js. Leave comments directly on the Web App UI, and never miss a feedback.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## What can it do?
|
|
6
6
|
|
|
7
|
-
- **Click to pin** — drop comment pins anywhere on the page
|
|
8
7
|
- **Smart target detection** — auto-anchors to nearest meaningful element
|
|
9
|
-
- **
|
|
10
|
-
- **Keyboard shortcuts** — `C` to toggle comment mode, `Esc` to cancel
|
|
11
|
-
- **Popover-aware** — comments inside modals/popovers re-appear when reopened
|
|
12
|
-
- **All Pages view** — see every comment across your project in one sidebar
|
|
13
|
-
- **Auto z-index** — overlay detects highest z-index and sits above everything
|
|
8
|
+
- **Project level view** — see every comment across your project in one sidebar, like Figma.
|
|
14
9
|
- **SSR-safe** — works with Next.js App Router
|
|
15
10
|
|
|
16
|
-
## Quick Start
|
|
11
|
+
## Quick Start Guide
|
|
17
12
|
|
|
18
|
-
|
|
13
|
+
**1. Install** with npm, pnpm, or yarn
|
|
19
14
|
|
|
20
15
|
```bash
|
|
21
|
-
npm install apostil
|
|
16
|
+
npm install apostil
|
|
17
|
+
```
|
|
18
|
+
Or install globally
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g apostil
|
|
22
21
|
```
|
|
23
22
|
|
|
24
|
-
|
|
23
|
+
**2. Initialize**
|
|
25
24
|
|
|
26
25
|
```bash
|
|
27
|
-
npx apostil init
|
|
26
|
+
npx apostil init # personal (default) — local dev only
|
|
27
|
+
npx apostil init --dev # dev + staging environments
|
|
28
|
+
npx apostil init --public # all environments including production
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
This will:
|
|
31
32
|
- Create `app/api/apostil/route.ts` — API route for comment storage
|
|
32
|
-
- Create `components/apostil-wrapper.tsx` — pre-configured wrapper
|
|
33
|
+
- Create `components/apostil-wrapper.tsx` — pre-configured wrapper with env guard
|
|
33
34
|
- Create `.apostil/` directory and add it to `.gitignore`
|
|
34
35
|
- **Automatically wrap `{children}` in your root layout** with `<ApostilWrapper>`
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
**3. Start your project and start commenting**
|
|
37
38
|
|
|
38
39
|
```bash
|
|
39
40
|
npm run dev
|
|
@@ -54,6 +55,16 @@ Comments are stored as JSON files in `.apostil/`:
|
|
|
54
55
|
|
|
55
56
|
The wrapper auto-detects the current page from `usePathname()` and loads the corresponding comments. Every page in your app gets commenting automatically.
|
|
56
57
|
|
|
58
|
+
## Modes
|
|
59
|
+
|
|
60
|
+
| Mode | Active in | Comments in git | Env override |
|
|
61
|
+
|------|-----------|----------------|--------------|
|
|
62
|
+
| `(default)` | Local dev only | No | — |
|
|
63
|
+
| `--dev` | Dev + staging | No | `NEXT_PUBLIC_APOSTIL=true` to force on |
|
|
64
|
+
| `--public` | All environments | Yes | `NEXT_PUBLIC_APOSTIL=false` to disable |
|
|
65
|
+
|
|
66
|
+
Re-run `npx apostil init --dev` (or `--public`) to switch modes — it will regenerate the wrapper component.
|
|
67
|
+
|
|
57
68
|
## Uninstall
|
|
58
69
|
|
|
59
70
|
```bash
|
|
@@ -162,7 +173,6 @@ __apostil_debug.disable()
|
|
|
162
173
|
- React 18+
|
|
163
174
|
- Next.js (App Router)
|
|
164
175
|
- Tailwind CSS
|
|
165
|
-
- lucide-react
|
|
166
176
|
|
|
167
177
|
## License
|
|
168
178
|
|
package/dist/cli/index.js
CHANGED
|
@@ -6,7 +6,8 @@ import path from "path";
|
|
|
6
6
|
var args = process.argv.slice(2);
|
|
7
7
|
var command = args[0];
|
|
8
8
|
if (command === "init") {
|
|
9
|
-
|
|
9
|
+
const mode = parseMode(args.slice(1));
|
|
10
|
+
init(mode);
|
|
10
11
|
} else if (command === "remove") {
|
|
11
12
|
remove();
|
|
12
13
|
} else if (command === "help" || command === "--help" || command === "-h" || !command) {
|
|
@@ -16,17 +17,27 @@ if (command === "init") {
|
|
|
16
17
|
`);
|
|
17
18
|
printHelp();
|
|
18
19
|
}
|
|
20
|
+
function parseMode(flags) {
|
|
21
|
+
if (flags.includes("--dev")) return "dev";
|
|
22
|
+
if (flags.includes("--public")) return "public";
|
|
23
|
+
return "personal";
|
|
24
|
+
}
|
|
19
25
|
function printHelp() {
|
|
20
26
|
console.log(`
|
|
21
27
|
apostil \u2014 Pin-and-comment feedback for React & Next.js
|
|
22
28
|
|
|
23
29
|
Usage:
|
|
24
|
-
npx apostil init
|
|
25
|
-
npx apostil remove
|
|
26
|
-
npx apostil help
|
|
30
|
+
npx apostil init [mode] Set up apostil in your Next.js project
|
|
31
|
+
npx apostil remove Remove apostil from your project
|
|
32
|
+
npx apostil help Show this help
|
|
33
|
+
|
|
34
|
+
Modes:
|
|
35
|
+
(default) Personal \u2014 local dev only, comments gitignored
|
|
36
|
+
--dev Dev + staging \u2014 comments gitignored, env-controlled
|
|
37
|
+
--public All environments \u2014 comments committed to git
|
|
27
38
|
`);
|
|
28
39
|
}
|
|
29
|
-
async function init() {
|
|
40
|
+
async function init(mode) {
|
|
30
41
|
const cwd = process.cwd();
|
|
31
42
|
const appDir = await findAppDir(cwd);
|
|
32
43
|
if (!appDir) {
|
|
@@ -35,7 +46,10 @@ async function init() {
|
|
|
35
46
|
process.exit(1);
|
|
36
47
|
}
|
|
37
48
|
const useSrc = appDir.includes("src/app");
|
|
38
|
-
|
|
49
|
+
const modeLabel = mode === "personal" ? "personal" : mode === "dev" ? "dev" : "public";
|
|
50
|
+
console.log(`
|
|
51
|
+
Setting up apostil (${modeLabel} mode)...
|
|
52
|
+
`);
|
|
39
53
|
const apiDir = path.join(appDir, "api", "apostil");
|
|
40
54
|
const apiFile = path.join(apiDir, "route.ts");
|
|
41
55
|
if (await fileExists(apiFile)) {
|
|
@@ -48,17 +62,13 @@ async function init() {
|
|
|
48
62
|
`,
|
|
49
63
|
"utf-8"
|
|
50
64
|
);
|
|
51
|
-
console.log(
|
|
65
|
+
console.log(` \u2713 Created ${rel(cwd, apiFile)}`);
|
|
52
66
|
}
|
|
53
67
|
const componentsDir = path.join(cwd, useSrc ? "src/components" : "components");
|
|
54
68
|
const wrapperFile = path.join(componentsDir, "apostil-wrapper.tsx");
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
await fs.mkdir(componentsDir, { recursive: true });
|
|
59
|
-
await fs.writeFile(wrapperFile, getWrapperComponent(), "utf-8");
|
|
60
|
-
console.log(` \u2713 Created ${rel(cwd, wrapperFile)}`);
|
|
61
|
-
}
|
|
69
|
+
await fs.mkdir(componentsDir, { recursive: true });
|
|
70
|
+
await fs.writeFile(wrapperFile, getWrapperComponent(mode), "utf-8");
|
|
71
|
+
console.log(` \u2713 Created ${rel(cwd, wrapperFile)} (${modeLabel} mode)`);
|
|
62
72
|
const commentsDir = path.join(cwd, ".apostil");
|
|
63
73
|
await fs.mkdir(commentsDir, { recursive: true });
|
|
64
74
|
console.log(" \u2713 Created .apostil/ directory");
|
|
@@ -68,16 +78,24 @@ async function init() {
|
|
|
68
78
|
gitignore = await fs.readFile(gitignorePath, "utf-8");
|
|
69
79
|
} catch {
|
|
70
80
|
}
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
81
|
+
if (mode === "public") {
|
|
82
|
+
if (gitignore.includes(".apostil")) {
|
|
83
|
+
console.log(" \u2713 .gitignore unchanged (public mode \u2014 comments will be committed)");
|
|
84
|
+
} else {
|
|
85
|
+
console.log(" \u2713 Comments will be committed to git (public mode)");
|
|
86
|
+
}
|
|
75
87
|
} else {
|
|
76
|
-
|
|
88
|
+
if (!gitignore.includes(".apostil")) {
|
|
89
|
+
const entry = "\n# Apostil comments\n.apostil/\n";
|
|
90
|
+
await fs.appendFile(gitignorePath, entry, "utf-8");
|
|
91
|
+
console.log(" \u2713 Added .apostil/ to .gitignore");
|
|
92
|
+
} else {
|
|
93
|
+
console.log(" \u2713 .gitignore already configured");
|
|
94
|
+
}
|
|
77
95
|
}
|
|
78
96
|
const layoutInjected = await injectIntoLayout(appDir, useSrc);
|
|
79
97
|
if (layoutInjected) {
|
|
80
|
-
console.log(
|
|
98
|
+
console.log(" \u2713 Added <ApostilWrapper> to root layout");
|
|
81
99
|
}
|
|
82
100
|
console.log("\n Done! Run your dev server and press C to start commenting.\n");
|
|
83
101
|
}
|
|
@@ -122,7 +140,26 @@ async function remove() {
|
|
|
122
140
|
Done! Now run: npm uninstall apostil
|
|
123
141
|
`);
|
|
124
142
|
}
|
|
125
|
-
function getWrapperComponent() {
|
|
143
|
+
function getWrapperComponent(mode) {
|
|
144
|
+
const envGuard = mode === "personal" ? `
|
|
145
|
+
// Personal mode \u2014 only active in local development
|
|
146
|
+
if (process.env.NODE_ENV !== "development") {
|
|
147
|
+
return <>{children}</>;
|
|
148
|
+
}
|
|
149
|
+
` : mode === "dev" ? `
|
|
150
|
+
// Dev mode \u2014 active in dev + staging, disabled in production
|
|
151
|
+
// Set NEXT_PUBLIC_APOSTIL=true to force on in any environment
|
|
152
|
+
const forceOn = process.env.NEXT_PUBLIC_APOSTIL === "true";
|
|
153
|
+
if (process.env.NODE_ENV === "production" && !forceOn) {
|
|
154
|
+
return <>{children}</>;
|
|
155
|
+
}
|
|
156
|
+
` : `
|
|
157
|
+
// Public mode \u2014 active in all environments
|
|
158
|
+
// Set NEXT_PUBLIC_APOSTIL=false to disable
|
|
159
|
+
if (process.env.NEXT_PUBLIC_APOSTIL === "false") {
|
|
160
|
+
return <>{children}</>;
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
126
163
|
return `"use client";
|
|
127
164
|
|
|
128
165
|
import { usePathname } from "next/navigation";
|
|
@@ -133,7 +170,7 @@ import {
|
|
|
133
170
|
CommentSidebar,
|
|
134
171
|
} from "apostil";
|
|
135
172
|
|
|
136
|
-
export function ApostilWrapper({ children }: { children: React.ReactNode }) {
|
|
173
|
+
export function ApostilWrapper({ children }: { children: React.ReactNode }) {${envGuard}
|
|
137
174
|
const pathname = usePathname();
|
|
138
175
|
const pageId = pathname.replace(/\\//g, "--").replace(/^--/, "") || "home";
|
|
139
176
|
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport fs from \"fs/promises\";\nimport path from \"path\";\n\nconst args = process.argv.slice(2);\nconst command = args[0];\n\nif (command === \"init\") {\n init();\n} else if (command === \"remove\") {\n remove();\n} else if (command === \"help\" || command === \"--help\" || command === \"-h\" || !command) {\n printHelp();\n} else {\n console.log(` Unknown command: ${command}\\n`);\n printHelp();\n}\n\nfunction printHelp() {\n console.log(`\n apostil — Pin-and-comment feedback for React & Next.js\n\n Usage:\n npx apostil init Set up apostil in your Next.js project\n npx apostil remove Remove apostil from your project\n npx apostil help Show this help\n`);\n}\n\nasync function init() {\n const cwd = process.cwd();\n\n // Detect Next.js app directory\n const appDir = await findAppDir(cwd);\n if (!appDir) {\n console.log(\" Could not find a Next.js app/ directory.\");\n console.log(\" Make sure you're running this from your project root.\\n\");\n process.exit(1);\n }\n\n // Detect src/ prefix\n const useSrc = appDir.includes(\"src/app\");\n\n console.log(\"\\n Setting up apostil...\\n\");\n\n // 1. Create API route\n const apiDir = path.join(appDir, \"api\", \"apostil\");\n const apiFile = path.join(apiDir, \"route.ts\");\n if (await fileExists(apiFile)) {\n console.log(\" ✓ API route already exists\");\n } else {\n await fs.mkdir(apiDir, { recursive: true });\n await fs.writeFile(\n apiFile,\n `export { GET, POST } from \"apostil/adapters/nextjs\";\\n`,\n \"utf-8\"\n );\n console.log(\" ✓ Created ${rel(cwd, apiFile)}\");\n }\n\n // 2. Create wrapper component\n const componentsDir = path.join(cwd, useSrc ? \"src/components\" : \"components\");\n const wrapperFile = path.join(componentsDir, \"apostil-wrapper.tsx\");\n if (await fileExists(wrapperFile)) {\n console.log(\" ✓ Wrapper component already exists\");\n } else {\n await fs.mkdir(componentsDir, { recursive: true });\n await fs.writeFile(wrapperFile, getWrapperComponent(), \"utf-8\");\n console.log(` ✓ Created ${rel(cwd, wrapperFile)}`);\n }\n\n // 3. Create .apostil/ directory for comment storage\n const commentsDir = path.join(cwd, \".apostil\");\n await fs.mkdir(commentsDir, { recursive: true });\n console.log(\" ✓ Created .apostil/ directory\");\n\n // 4. Add .apostil/ to .gitignore\n const gitignorePath = path.join(cwd, \".gitignore\");\n let gitignore = \"\";\n try {\n gitignore = await fs.readFile(gitignorePath, \"utf-8\");\n } catch {}\n\n if (!gitignore.includes(\".apostil\")) {\n const entry = \"\\n# Apostil comments\\n.apostil/\\n\";\n await fs.appendFile(gitignorePath, entry, \"utf-8\");\n console.log(\" ✓ Added .apostil/ to .gitignore\");\n } else {\n console.log(\" ✓ .gitignore already configured\");\n }\n\n // 5. Inject wrapper into root layout\n const layoutInjected = await injectIntoLayout(appDir, useSrc);\n if (layoutInjected) {\n console.log(` ✓ Added <ApostilWrapper> to root layout`);\n }\n\n console.log(\"\\n Done! Run your dev server and press C to start commenting.\\n\");\n}\n\nasync function remove() {\n const cwd = process.cwd();\n const appDir = await findAppDir(cwd);\n const useSrc = appDir?.includes(\"src/app\") ?? false;\n\n console.log(\"\\n Removing apostil...\\n\");\n\n // 1. Remove API route\n if (appDir) {\n const apiDir = path.join(appDir, \"api\", \"apostil\");\n if (await fileExists(path.join(apiDir, \"route.ts\"))) {\n await fs.rm(apiDir, { recursive: true });\n console.log(\" ✓ Removed API route\");\n }\n }\n\n // 2. Remove wrapper component\n const componentsDir = path.join(cwd, useSrc ? \"src/components\" : \"components\");\n const wrapperFile = path.join(componentsDir, \"apostil-wrapper.tsx\");\n if (await fileExists(wrapperFile)) {\n await fs.rm(wrapperFile);\n console.log(\" ✓ Removed wrapper component\");\n }\n\n // 3. Remove wrapper from layout\n if (appDir) {\n const unwrapped = await removeFromLayout(appDir);\n if (unwrapped) {\n console.log(\" ✓ Removed <ApostilWrapper> from root layout\");\n }\n }\n\n // 4. Remove .apostil/ directory\n const commentsDir = path.join(cwd, \".apostil\");\n if (await fileExists(commentsDir)) {\n await fs.rm(commentsDir, { recursive: true });\n console.log(\" ✓ Removed .apostil/ directory\");\n }\n\n // 5. Remove from .gitignore\n const gitignorePath = path.join(cwd, \".gitignore\");\n try {\n let gitignore = await fs.readFile(gitignorePath, \"utf-8\");\n gitignore = gitignore.replace(/\\n?# Apostil comments\\n\\.apostil\\/\\n?/g, \"\");\n await fs.writeFile(gitignorePath, gitignore, \"utf-8\");\n console.log(\" ✓ Cleaned .gitignore\");\n } catch {}\n\n console.log(`\n Done! Now run: npm uninstall apostil\n`);\n}\n\n// --- Wrapper component template ---\n\nfunction getWrapperComponent(): string {\n return `\"use client\";\n\nimport { usePathname } from \"next/navigation\";\nimport {\n ApostilProvider,\n CommentOverlay,\n CommentToggle,\n CommentSidebar,\n} from \"apostil\";\n\nexport function ApostilWrapper({ children }: { children: React.ReactNode }) {\n const pathname = usePathname();\n const pageId = pathname.replace(/\\\\//g, \"--\").replace(/^--/, \"\") || \"home\";\n\n return (\n <ApostilProvider pageId={pageId}>\n {children}\n <CommentOverlay />\n <CommentSidebar />\n <CommentToggle />\n </ApostilProvider>\n );\n}\n`;\n}\n\n// --- Layout injection ---\n\nasync function injectIntoLayout(appDir: string, useSrc: boolean): Promise<boolean> {\n const layoutPath = await findLayout(appDir);\n if (!layoutPath) return false;\n\n let content = await fs.readFile(layoutPath, \"utf-8\");\n\n // Skip if already injected\n if (content.includes(\"ApostilWrapper\")) {\n console.log(\" ✓ Layout already has <ApostilWrapper>\");\n return false;\n }\n\n // Add import at the top (after existing imports or \"use\" directives)\n const importPath = useSrc ? \"@/components/apostil-wrapper\" : \"../components/apostil-wrapper\";\n const importLine = `import { ApostilWrapper } from \"${importPath}\";\\n`;\n\n // Find the last import statement and insert after it\n const importRegex = /^import\\s.+$/gm;\n let lastImportIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = importRegex.exec(content)) !== null) {\n lastImportIndex = match.index + match[0].length;\n }\n\n if (lastImportIndex > 0) {\n content = content.slice(0, lastImportIndex) + \"\\n\" + importLine + content.slice(lastImportIndex);\n } else {\n // No imports found, add at the top (after \"use client\" or \"use server\" if present)\n const useDirective = content.match(/^[\"']use (client|server)[\"'];?\\n/);\n const insertAt = useDirective ? useDirective[0].length : 0;\n content = content.slice(0, insertAt) + importLine + content.slice(insertAt);\n }\n\n // Wrap {children} with <ApostilWrapper>\n // Handle both {children} and { children } patterns inside <body>\n const bodyChildrenRegex = /(<body[^>]*>)([\\s\\S]*?)(\\{[\\s]*children[\\s]*\\})([\\s\\S]*?)(<\\/body>)/;\n const bodyMatch = content.match(bodyChildrenRegex);\n\n if (bodyMatch) {\n // Wrap {children} inside <body> with <ApostilWrapper>\n content = content.replace(\n bodyChildrenRegex,\n `$1$2<ApostilWrapper>$3</ApostilWrapper>$4$5`\n );\n } else {\n // Fallback: try to find {children} anywhere and wrap it\n const childrenRegex = /(\\{[\\s]*children[\\s]*\\})/;\n if (childrenRegex.test(content)) {\n content = content.replace(childrenRegex, `<ApostilWrapper>$1</ApostilWrapper>`);\n } else {\n console.log(\" ⚠ Could not find {children} in layout — add <ApostilWrapper> manually\");\n return false;\n }\n }\n\n await fs.writeFile(layoutPath, content, \"utf-8\");\n return true;\n}\n\nasync function removeFromLayout(appDir: string): Promise<boolean> {\n const layoutPath = await findLayout(appDir);\n if (!layoutPath) return false;\n\n let content = await fs.readFile(layoutPath, \"utf-8\");\n\n if (!content.includes(\"ApostilWrapper\")) return false;\n\n // Remove import line\n content = content.replace(/import\\s*\\{[^}]*ApostilWrapper[^}]*\\}\\s*from\\s*[\"'][^\"']+[\"'];?\\n?/g, \"\");\n\n // Unwrap <ApostilWrapper>{children}</ApostilWrapper>\n content = content.replace(/<ApostilWrapper>([\\s\\S]*?)<\\/ApostilWrapper>/g, \"$1\");\n\n await fs.writeFile(layoutPath, content, \"utf-8\");\n return true;\n}\n\n// --- Helpers ---\n\nasync function findAppDir(cwd: string): Promise<string | null> {\n for (const candidate of [\"src/app\", \"app\"]) {\n const dir = path.join(cwd, candidate);\n try {\n const stat = await fs.stat(dir);\n if (stat.isDirectory()) return dir;\n } catch {}\n }\n return null;\n}\n\nasync function findLayout(appDir: string): Promise<string | null> {\n for (const ext of [\"tsx\", \"jsx\", \"ts\", \"js\"]) {\n const file = path.join(appDir, `layout.${ext}`);\n if (await fileExists(file)) return file;\n }\n return null;\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n await fs.stat(p);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction rel(cwd: string, filePath: string): string {\n return path.relative(cwd, filePath);\n}\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAM,UAAU,KAAK,CAAC;AAEtB,IAAI,YAAY,QAAQ;AACtB,OAAK;AACP,WAAW,YAAY,UAAU;AAC/B,SAAO;AACT,WAAW,YAAY,UAAU,YAAY,YAAY,YAAY,QAAQ,CAAC,SAAS;AACrF,YAAU;AACZ,OAAO;AACL,UAAQ,IAAI,sBAAsB,OAAO;AAAA,CAAI;AAC7C,YAAU;AACZ;AAEA,SAAS,YAAY;AACnB,UAAQ,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAOb;AACD;AAEA,eAAe,OAAO;AACpB,QAAM,MAAM,QAAQ,IAAI;AAGxB,QAAM,SAAS,MAAM,WAAW,GAAG;AACnC,MAAI,CAAC,QAAQ;AACX,YAAQ,IAAI,4CAA4C;AACxD,YAAQ,IAAI,2DAA2D;AACvE,YAAQ,KAAK,CAAC;AAAA,EAChB;AAGA,QAAM,SAAS,OAAO,SAAS,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":["#!/usr/bin/env node\n\nimport fs from \"fs/promises\";\nimport path from \"path\";\n\ntype Mode = \"personal\" | \"dev\" | \"public\";\n\nconst args = process.argv.slice(2);\nconst command = args[0];\n\nif (command === \"init\") {\n const mode = parseMode(args.slice(1));\n init(mode);\n} else if (command === \"remove\") {\n remove();\n} else if (command === \"help\" || command === \"--help\" || command === \"-h\" || !command) {\n printHelp();\n} else {\n console.log(` Unknown command: ${command}\\n`);\n printHelp();\n}\n\nfunction parseMode(flags: string[]): Mode {\n if (flags.includes(\"--dev\")) return \"dev\";\n if (flags.includes(\"--public\")) return \"public\";\n return \"personal\";\n}\n\nfunction printHelp() {\n console.log(`\n apostil — Pin-and-comment feedback for React & Next.js\n\n Usage:\n npx apostil init [mode] Set up apostil in your Next.js project\n npx apostil remove Remove apostil from your project\n npx apostil help Show this help\n\n Modes:\n (default) Personal — local dev only, comments gitignored\n --dev Dev + staging — comments gitignored, env-controlled\n --public All environments — comments committed to git\n`);\n}\n\nasync function init(mode: Mode) {\n const cwd = process.cwd();\n\n // Detect Next.js app directory\n const appDir = await findAppDir(cwd);\n if (!appDir) {\n console.log(\" Could not find a Next.js app/ directory.\");\n console.log(\" Make sure you're running this from your project root.\\n\");\n process.exit(1);\n }\n\n // Detect src/ prefix\n const useSrc = appDir.includes(\"src/app\");\n\n const modeLabel = mode === \"personal\" ? \"personal\" : mode === \"dev\" ? \"dev\" : \"public\";\n console.log(`\\n Setting up apostil (${modeLabel} mode)...\\n`);\n\n // 1. Create API route\n const apiDir = path.join(appDir, \"api\", \"apostil\");\n const apiFile = path.join(apiDir, \"route.ts\");\n if (await fileExists(apiFile)) {\n console.log(\" ✓ API route already exists\");\n } else {\n await fs.mkdir(apiDir, { recursive: true });\n await fs.writeFile(\n apiFile,\n `export { GET, POST } from \"apostil/adapters/nextjs\";\\n`,\n \"utf-8\"\n );\n console.log(` ✓ Created ${rel(cwd, apiFile)}`);\n }\n\n // 2. Create wrapper component\n const componentsDir = path.join(cwd, useSrc ? \"src/components\" : \"components\");\n const wrapperFile = path.join(componentsDir, \"apostil-wrapper.tsx\");\n await fs.mkdir(componentsDir, { recursive: true });\n await fs.writeFile(wrapperFile, getWrapperComponent(mode), \"utf-8\");\n console.log(` ✓ Created ${rel(cwd, wrapperFile)} (${modeLabel} mode)`);\n\n // 3. Create .apostil/ directory for comment storage\n const commentsDir = path.join(cwd, \".apostil\");\n await fs.mkdir(commentsDir, { recursive: true });\n console.log(\" ✓ Created .apostil/ directory\");\n\n // 4. Handle .gitignore based on mode\n const gitignorePath = path.join(cwd, \".gitignore\");\n let gitignore = \"\";\n try {\n gitignore = await fs.readFile(gitignorePath, \"utf-8\");\n } catch {}\n\n if (mode === \"public\") {\n // Public mode: don't gitignore comments — they get committed\n if (gitignore.includes(\".apostil\")) {\n console.log(\" ✓ .gitignore unchanged (public mode — comments will be committed)\");\n } else {\n console.log(\" ✓ Comments will be committed to git (public mode)\");\n }\n } else {\n // Personal & dev: gitignore comments\n if (!gitignore.includes(\".apostil\")) {\n const entry = \"\\n# Apostil comments\\n.apostil/\\n\";\n await fs.appendFile(gitignorePath, entry, \"utf-8\");\n console.log(\" ✓ Added .apostil/ to .gitignore\");\n } else {\n console.log(\" ✓ .gitignore already configured\");\n }\n }\n\n // 5. Inject wrapper into root layout\n const layoutInjected = await injectIntoLayout(appDir, useSrc);\n if (layoutInjected) {\n console.log(\" ✓ Added <ApostilWrapper> to root layout\");\n }\n\n console.log(\"\\n Done! Run your dev server and press C to start commenting.\\n\");\n}\n\nasync function remove() {\n const cwd = process.cwd();\n const appDir = await findAppDir(cwd);\n const useSrc = appDir?.includes(\"src/app\") ?? false;\n\n console.log(\"\\n Removing apostil...\\n\");\n\n // 1. Remove API route\n if (appDir) {\n const apiDir = path.join(appDir, \"api\", \"apostil\");\n if (await fileExists(path.join(apiDir, \"route.ts\"))) {\n await fs.rm(apiDir, { recursive: true });\n console.log(\" ✓ Removed API route\");\n }\n }\n\n // 2. Remove wrapper component\n const componentsDir = path.join(cwd, useSrc ? \"src/components\" : \"components\");\n const wrapperFile = path.join(componentsDir, \"apostil-wrapper.tsx\");\n if (await fileExists(wrapperFile)) {\n await fs.rm(wrapperFile);\n console.log(\" ✓ Removed wrapper component\");\n }\n\n // 3. Remove wrapper from layout\n if (appDir) {\n const unwrapped = await removeFromLayout(appDir);\n if (unwrapped) {\n console.log(\" ✓ Removed <ApostilWrapper> from root layout\");\n }\n }\n\n // 4. Remove .apostil/ directory\n const commentsDir = path.join(cwd, \".apostil\");\n if (await fileExists(commentsDir)) {\n await fs.rm(commentsDir, { recursive: true });\n console.log(\" ✓ Removed .apostil/ directory\");\n }\n\n // 5. Remove from .gitignore\n const gitignorePath = path.join(cwd, \".gitignore\");\n try {\n let gitignore = await fs.readFile(gitignorePath, \"utf-8\");\n gitignore = gitignore.replace(/\\n?# Apostil comments\\n\\.apostil\\/\\n?/g, \"\");\n await fs.writeFile(gitignorePath, gitignore, \"utf-8\");\n console.log(\" ✓ Cleaned .gitignore\");\n } catch {}\n\n console.log(`\n Done! Now run: npm uninstall apostil\n`);\n}\n\n// --- Wrapper component template ---\n\nfunction getWrapperComponent(mode: Mode): string {\n const envGuard = mode === \"personal\"\n ? `\n // Personal mode — only active in local development\n if (process.env.NODE_ENV !== \"development\") {\n return <>{children}</>;\n }\n`\n : mode === \"dev\"\n ? `\n // Dev mode — active in dev + staging, disabled in production\n // Set NEXT_PUBLIC_APOSTIL=true to force on in any environment\n const forceOn = process.env.NEXT_PUBLIC_APOSTIL === \"true\";\n if (process.env.NODE_ENV === \"production\" && !forceOn) {\n return <>{children}</>;\n }\n`\n : `\n // Public mode — active in all environments\n // Set NEXT_PUBLIC_APOSTIL=false to disable\n if (process.env.NEXT_PUBLIC_APOSTIL === \"false\") {\n return <>{children}</>;\n }\n`;\n\n return `\"use client\";\n\nimport { usePathname } from \"next/navigation\";\nimport {\n ApostilProvider,\n CommentOverlay,\n CommentToggle,\n CommentSidebar,\n} from \"apostil\";\n\nexport function ApostilWrapper({ children }: { children: React.ReactNode }) {${envGuard}\n const pathname = usePathname();\n const pageId = pathname.replace(/\\\\//g, \"--\").replace(/^--/, \"\") || \"home\";\n\n return (\n <ApostilProvider pageId={pageId}>\n {children}\n <CommentOverlay />\n <CommentSidebar />\n <CommentToggle />\n </ApostilProvider>\n );\n}\n`;\n}\n\n// --- Layout injection ---\n\nasync function injectIntoLayout(appDir: string, useSrc: boolean): Promise<boolean> {\n const layoutPath = await findLayout(appDir);\n if (!layoutPath) return false;\n\n let content = await fs.readFile(layoutPath, \"utf-8\");\n\n // Skip if already injected\n if (content.includes(\"ApostilWrapper\")) {\n console.log(\" ✓ Layout already has <ApostilWrapper>\");\n return false;\n }\n\n // Add import at the top (after existing imports or \"use\" directives)\n const importPath = useSrc ? \"@/components/apostil-wrapper\" : \"../components/apostil-wrapper\";\n const importLine = `import { ApostilWrapper } from \"${importPath}\";\\n`;\n\n // Find the last import statement and insert after it\n const importRegex = /^import\\s.+$/gm;\n let lastImportIndex = 0;\n let match: RegExpExecArray | null;\n while ((match = importRegex.exec(content)) !== null) {\n lastImportIndex = match.index + match[0].length;\n }\n\n if (lastImportIndex > 0) {\n content = content.slice(0, lastImportIndex) + \"\\n\" + importLine + content.slice(lastImportIndex);\n } else {\n // No imports found, add at the top (after \"use client\" or \"use server\" if present)\n const useDirective = content.match(/^[\"']use (client|server)[\"'];?\\n/);\n const insertAt = useDirective ? useDirective[0].length : 0;\n content = content.slice(0, insertAt) + importLine + content.slice(insertAt);\n }\n\n // Wrap {children} with <ApostilWrapper>\n // Handle both {children} and { children } patterns inside <body>\n const bodyChildrenRegex = /(<body[^>]*>)([\\s\\S]*?)(\\{[\\s]*children[\\s]*\\})([\\s\\S]*?)(<\\/body>)/;\n const bodyMatch = content.match(bodyChildrenRegex);\n\n if (bodyMatch) {\n content = content.replace(\n bodyChildrenRegex,\n `$1$2<ApostilWrapper>$3</ApostilWrapper>$4$5`\n );\n } else {\n // Fallback: try to find {children} anywhere and wrap it\n const childrenRegex = /(\\{[\\s]*children[\\s]*\\})/;\n if (childrenRegex.test(content)) {\n content = content.replace(childrenRegex, `<ApostilWrapper>$1</ApostilWrapper>`);\n } else {\n console.log(\" ⚠ Could not find {children} in layout — add <ApostilWrapper> manually\");\n return false;\n }\n }\n\n await fs.writeFile(layoutPath, content, \"utf-8\");\n return true;\n}\n\nasync function removeFromLayout(appDir: string): Promise<boolean> {\n const layoutPath = await findLayout(appDir);\n if (!layoutPath) return false;\n\n let content = await fs.readFile(layoutPath, \"utf-8\");\n\n if (!content.includes(\"ApostilWrapper\")) return false;\n\n // Remove import line\n content = content.replace(/import\\s*\\{[^}]*ApostilWrapper[^}]*\\}\\s*from\\s*[\"'][^\"']+[\"'];?\\n?/g, \"\");\n\n // Unwrap <ApostilWrapper>{children}</ApostilWrapper>\n content = content.replace(/<ApostilWrapper>([\\s\\S]*?)<\\/ApostilWrapper>/g, \"$1\");\n\n await fs.writeFile(layoutPath, content, \"utf-8\");\n return true;\n}\n\n// --- Helpers ---\n\nasync function findAppDir(cwd: string): Promise<string | null> {\n for (const candidate of [\"src/app\", \"app\"]) {\n const dir = path.join(cwd, candidate);\n try {\n const stat = await fs.stat(dir);\n if (stat.isDirectory()) return dir;\n } catch {}\n }\n return null;\n}\n\nasync function findLayout(appDir: string): Promise<string | null> {\n for (const ext of [\"tsx\", \"jsx\", \"ts\", \"js\"]) {\n const file = path.join(appDir, `layout.${ext}`);\n if (await fileExists(file)) return file;\n }\n return null;\n}\n\nasync function fileExists(p: string): Promise<boolean> {\n try {\n await fs.stat(p);\n return true;\n } catch {\n return false;\n }\n}\n\nfunction rel(cwd: string, filePath: string): string {\n return path.relative(cwd, filePath);\n}\n"],"mappings":";;;AAEA,OAAO,QAAQ;AACf,OAAO,UAAU;AAIjB,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AACjC,IAAM,UAAU,KAAK,CAAC;AAEtB,IAAI,YAAY,QAAQ;AACtB,QAAM,OAAO,UAAU,KAAK,MAAM,CAAC,CAAC;AACp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