@djangocfg/nextjs 2.1.8 → 2.1.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/nextjs",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "Next.js server utilities: sitemap, health, OG images, contact forms, navigation, config",
5
5
  "keywords": [
6
6
  "nextjs",
@@ -105,13 +105,13 @@
105
105
  "ai-docs": "tsx src/ai/cli.ts"
106
106
  },
107
107
  "peerDependencies": {
108
- "@djangocfg/api": "^2.1.8",
108
+ "@djangocfg/api": "^2.1.9",
109
109
  "next": "^15.5.7"
110
110
  },
111
111
  "devDependencies": {
112
- "@djangocfg/imgai": "^2.1.8",
113
- "@djangocfg/layouts": "^2.1.8",
114
- "@djangocfg/typescript-config": "^2.1.8",
112
+ "@djangocfg/imgai": "^2.1.9",
113
+ "@djangocfg/layouts": "^2.1.9",
114
+ "@djangocfg/typescript-config": "^2.1.9",
115
115
  "@types/node": "^24.7.2",
116
116
  "@types/react": "19.2.2",
117
117
  "@types/react-dom": "19.2.1",
package/src/ai/CLAUDE.md CHANGED
@@ -14,6 +14,18 @@ DjangoCFG documentation is available via MCP server.
14
14
  }
15
15
  ```
16
16
 
17
+ ## CLI
18
+
19
+ ```bash
20
+ # Install globally
21
+ npm install -g @djangocfg/nextjs
22
+
23
+ # Use CLI
24
+ djangocfg-docs search "database configuration"
25
+ djangocfg-docs mcp
26
+ djangocfg-docs info
27
+ ```
28
+
17
29
  ## API
18
30
 
19
31
  ```bash
package/src/ai/cli.ts CHANGED
@@ -14,6 +14,36 @@ const args = process.argv.slice(2);
14
14
  const command = args[0];
15
15
  const query = args.slice(1).join(' ');
16
16
 
17
+ /** Wrap text to terminal width with indent */
18
+ function wrapText(text: string, indent = 3, maxWidth?: number): string {
19
+ const width = maxWidth || process.stdout.columns || 80;
20
+ const effectiveWidth = width - indent;
21
+ const prefix = ' '.repeat(indent);
22
+
23
+ // Clean up text - remove extra whitespace and newlines
24
+ const cleaned = text.replace(/\s+/g, ' ').trim();
25
+
26
+ if (cleaned.length <= effectiveWidth) {
27
+ return prefix + cleaned;
28
+ }
29
+
30
+ const words = cleaned.split(' ');
31
+ const lines: string[] = [];
32
+ let currentLine = '';
33
+
34
+ for (const word of words) {
35
+ if (currentLine.length + word.length + 1 <= effectiveWidth) {
36
+ currentLine += (currentLine ? ' ' : '') + word;
37
+ } else {
38
+ if (currentLine) lines.push(prefix + currentLine);
39
+ currentLine = word;
40
+ }
41
+ }
42
+ if (currentLine) lines.push(prefix + currentLine);
43
+
44
+ return lines.join('\n');
45
+ }
46
+
17
47
  async function main() {
18
48
  switch (command) {
19
49
  case 'search':
@@ -30,7 +60,9 @@ async function main() {
30
60
  } else {
31
61
  results.forEach((r, i) => {
32
62
  consola.success(`${i + 1}. ${r.title}`);
33
- consola.log(` ${r.content.slice(0, 150)}...`);
63
+ // Wrap content to terminal width
64
+ const contentPreview = r.content.slice(0, 200);
65
+ console.log(wrapText(contentPreview + '...'));
34
66
  if (r.url) consola.log(` ${r.url}`);
35
67
  consola.log('');
36
68
  });