@pepshlr/pepdoc 0.2.2 → 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,14 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* PepsDoc - Post-install onboarding
|
|
4
|
-
*
|
|
3
|
+
* PepsDoc - Post-install onboarding
|
|
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
|
-
declare const GREEN = "\u001B[32m";
|
|
8
|
-
declare const YELLOW = "\u001B[33m";
|
|
9
|
-
declare const DIM = "\u001B[2m";
|
|
10
|
-
declare const RESET = "\u001B[0m";
|
|
11
|
-
declare const BOLD = "\u001B[1m";
|
|
12
|
-
declare const line: string;
|
|
13
|
-
declare const lines: string[];
|
|
7
|
+
export {};
|
|
14
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
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
/**
|
|
4
|
-
* PepsDoc - Post-install onboarding
|
|
5
|
-
*
|
|
4
|
+
* PepsDoc - Post-install onboarding
|
|
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
|
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
7
44
|
const PURPLE = '\x1b[35m';
|
|
8
45
|
const GREEN = '\x1b[32m';
|
|
9
46
|
const YELLOW = '\x1b[33m';
|
|
@@ -11,7 +48,7 @@ const DIM = '\x1b[2m';
|
|
|
11
48
|
const RESET = '\x1b[0m';
|
|
12
49
|
const BOLD = '\x1b[1m';
|
|
13
50
|
const line = '─'.repeat(58);
|
|
14
|
-
const
|
|
51
|
+
const message = [
|
|
15
52
|
'',
|
|
16
53
|
` ${PURPLE}${BOLD}✦ PepsDoc${RESET} installed!`,
|
|
17
54
|
'',
|
|
@@ -28,14 +65,65 @@ const lines = [
|
|
|
28
65
|
` │ Fastify → fastifyAdapter(app, { title: '...' }) │`,
|
|
29
66
|
` │ Hono → honoAdapter(app, { title: '...' }) │`,
|
|
30
67
|
` │ │`,
|
|
31
|
-
` │ 2. Read all route files
|
|
32
|
-
` │
|
|
68
|
+
` │ 2. Read all route files and generate JSON docs │`,
|
|
69
|
+
` │ in pepsdoc/data/v1/ (one file per group). │`,
|
|
33
70
|
` │ Schema: node_modules/@pepshlr/pepdoc/templates/ │`,
|
|
34
71
|
` │ ai-skill.md │`,
|
|
35
72
|
` │ │`,
|
|
36
73
|
` │ 3. Start the server and tell me the docs URL. │`,
|
|
37
74
|
` └${line}┘`,
|
|
75
|
+
` ${DIM}(full prompt also saved to PEPSDOC.md in your project)${RESET}`,
|
|
38
76
|
'',
|
|
39
|
-
];
|
|
40
|
-
|
|
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
|
|
96
|
+
const projectRoot = process.env.INIT_CWD || process.cwd();
|
|
97
|
+
const outputFile = path.join(projectRoot, 'PEPSDOC.md');
|
|
98
|
+
const fileContent = `# PepsDoc is ready!
|
|
99
|
+
|
|
100
|
+
Paste the prompt below into your AI assistant and it will set everything up automatically:
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
\`\`\`
|
|
105
|
+
@pepshlr/pepdoc is already installed. Do the following:
|
|
106
|
+
|
|
107
|
+
1. Find my main server file and add the adapter:
|
|
108
|
+
- Express → const { pepsdoc } = require('@pepshlr/pepdoc'); pepsdoc(app, { title: 'My API' })
|
|
109
|
+
- Fastify → const { fastifyAdapter } = require('@pepshlr/pepdoc'); fastifyAdapter(app, { title: 'My API' })
|
|
110
|
+
- Hono → const { honoAdapter } = require('@pepshlr/pepdoc'); honoAdapter(app, { title: 'My API' })
|
|
111
|
+
|
|
112
|
+
2. Read all route files in the project and generate JSON documentation
|
|
113
|
+
files in pepsdoc/data/v1/ (one file per group of routes).
|
|
114
|
+
Follow the schema in: node_modules/@pepshlr/pepdoc/templates/ai-skill.md
|
|
115
|
+
|
|
116
|
+
3. Start the server and tell me the URL to access the docs.
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
You can delete this file after setting up.
|
|
122
|
+
`;
|
|
123
|
+
try {
|
|
124
|
+
fs.writeFileSync(outputFile, fileContent);
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
// Silently ignore — don't break the install
|
|
128
|
+
}
|
|
41
129
|
//# sourceMappingURL=postinstall.js.map
|
|
@@ -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;;;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