@pepshlr/pepdoc 0.2.3 → 0.2.4
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* PepsDoc - Post-install onboarding
|
|
4
|
-
*
|
|
4
|
+
* Writes directly to the terminal device (bypasses npm output buffering)
|
|
5
|
+
* Also creates PEPSDOC.md in the project root as a fallback
|
|
5
6
|
*/
|
|
6
7
|
export {};
|
|
7
8
|
//# sourceMappingURL=postinstall.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../../src/bin/postinstall.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"postinstall.d.ts","sourceRoot":"","sources":["../../src/bin/postinstall.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
|
package/dist/bin/postinstall.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
4
|
* PepsDoc - Post-install onboarding
|
|
5
|
-
*
|
|
5
|
+
* Writes directly to the terminal device (bypasses npm output buffering)
|
|
6
|
+
* Also creates PEPSDOC.md in the project root as a fallback
|
|
6
7
|
*/
|
|
7
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
9
|
if (k2 === undefined) k2 = k;
|
|
@@ -40,14 +41,61 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
40
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
42
|
const fs = __importStar(require("fs"));
|
|
42
43
|
const path = __importStar(require("path"));
|
|
43
|
-
|
|
44
|
+
const PURPLE = '\x1b[35m';
|
|
45
|
+
const GREEN = '\x1b[32m';
|
|
46
|
+
const YELLOW = '\x1b[33m';
|
|
47
|
+
const DIM = '\x1b[2m';
|
|
48
|
+
const RESET = '\x1b[0m';
|
|
49
|
+
const BOLD = '\x1b[1m';
|
|
50
|
+
const line = '─'.repeat(58);
|
|
51
|
+
const message = [
|
|
52
|
+
'',
|
|
53
|
+
` ${PURPLE}${BOLD}✦ PepsDoc${RESET} installed!`,
|
|
54
|
+
'',
|
|
55
|
+
` ${GREEN}${BOLD}Let AI document your entire API automatically.${RESET}`,
|
|
56
|
+
` ${DIM}Copy the prompt below and paste it into your AI assistant:${RESET}`,
|
|
57
|
+
'',
|
|
58
|
+
` ┌${line}┐`,
|
|
59
|
+
` │ ${YELLOW}pepsdoc: integrate and document my entire API ${RESET} │`,
|
|
60
|
+
` │ │`,
|
|
61
|
+
` │ @pepshlr/pepdoc is already installed. Do the following: │`,
|
|
62
|
+
` │ │`,
|
|
63
|
+
` │ 1. Find my main server file and add the adapter: │`,
|
|
64
|
+
` │ Express → pepsdoc(app, { title: '...' }) │`,
|
|
65
|
+
` │ Fastify → fastifyAdapter(app, { title: '...' }) │`,
|
|
66
|
+
` │ Hono → honoAdapter(app, { title: '...' }) │`,
|
|
67
|
+
` │ │`,
|
|
68
|
+
` │ 2. Read all route files and generate JSON docs │`,
|
|
69
|
+
` │ in pepsdoc/data/v1/ (one file per group). │`,
|
|
70
|
+
` │ Schema: node_modules/@pepshlr/pepdoc/templates/ │`,
|
|
71
|
+
` │ ai-skill.md │`,
|
|
72
|
+
` │ │`,
|
|
73
|
+
` │ 3. Start the server and tell me the docs URL. │`,
|
|
74
|
+
` └${line}┘`,
|
|
75
|
+
` ${DIM}(full prompt also saved to PEPSDOC.md in your project)${RESET}`,
|
|
76
|
+
'',
|
|
77
|
+
].join('\n');
|
|
78
|
+
// Write directly to the terminal device — bypasses npm's output buffering
|
|
79
|
+
function writeToTerminal(text) {
|
|
80
|
+
const ttyDevice = process.platform === 'win32' ? '\\\\.\\CON' : '/dev/tty';
|
|
81
|
+
try {
|
|
82
|
+
const fd = fs.openSync(ttyDevice, 'w');
|
|
83
|
+
fs.writeSync(fd, text);
|
|
84
|
+
fs.closeSync(fd);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
// If TTY device isn't available, fall back to stderr
|
|
88
|
+
try {
|
|
89
|
+
process.stderr.write(text);
|
|
90
|
+
}
|
|
91
|
+
catch { /* ignore */ }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
writeToTerminal(message);
|
|
95
|
+
// Also create PEPSDOC.md in the project root for easy copy-paste in VS Code
|
|
44
96
|
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
45
97
|
const outputFile = path.join(projectRoot, 'PEPSDOC.md');
|
|
46
|
-
|
|
47
|
-
if (projectRoot.includes('pepsdoc') && !process.env.INIT_CWD) {
|
|
48
|
-
process.exit(0);
|
|
49
|
-
}
|
|
50
|
-
const content = `# PepsDoc is ready!
|
|
98
|
+
const fileContent = `# PepsDoc is ready!
|
|
51
99
|
|
|
52
100
|
Paste the prompt below into your AI assistant and it will set everything up automatically:
|
|
53
101
|
|
|
@@ -73,7 +121,7 @@ Paste the prompt below into your AI assistant and it will set everything up auto
|
|
|
73
121
|
You can delete this file after setting up.
|
|
74
122
|
`;
|
|
75
123
|
try {
|
|
76
|
-
fs.writeFileSync(outputFile,
|
|
124
|
+
fs.writeFileSync(outputFile, fileContent);
|
|
77
125
|
}
|
|
78
126
|
catch {
|
|
79
127
|
// Silently ignore — don't break the install
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../../src/bin/postinstall.ts"],"names":[],"mappings":";;AAEA
|
|
1
|
+
{"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../../src/bin/postinstall.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,uCAAyB;AACzB,2CAA6B;AAE7B,MAAM,MAAM,GAAG,UAAU,CAAC;AAC1B,MAAM,KAAK,GAAI,UAAU,CAAC;AAC1B,MAAM,MAAM,GAAG,UAAU,CAAC;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