@lovelybunch/api 1.0.12 → 1.0.15
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 +11 -5
- package/static/assets/index-C4DYLEUE.js +571 -0
- package/static/assets/index-DG4YYc23.js +571 -0
- package/static/assets/index-xk_paAS8.css +33 -0
- package/static/index.html +2 -2
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +0 -5
- package/dist/routes/api/symlink-status/route.d.ts +0 -1
- package/dist/routes/api/symlink-status/route.js +0 -37
- package/dist/routes/api/symlinks/[id]/route.d.ts +0 -19
- package/dist/routes/api/symlinks/[id]/route.js +0 -95
- package/dist/routes/api/symlinks/[id]/toggle/route.d.ts +0 -11
- package/dist/routes/api/symlinks/[id]/toggle/route.js +0 -32
- package/dist/routes/api/symlinks/debug/route.d.ts +0 -1
- package/dist/routes/api/symlinks/debug/route.js +0 -35
- package/dist/routes/api/symlinks/route.d.ts +0 -9
- package/dist/routes/api/symlinks/route.js +0 -72
- package/dist/routes/api/toggle-symlink/route.d.ts +0 -2
- package/dist/routes/api/toggle-symlink/route.js +0 -94
- package/dist/routes/api/v1/context/[...path]/route.d.ts +0 -16
- package/dist/routes/api/v1/context/[...path]/route.js +0 -107
- package/dist/routes/api/v1/search/route.d.ts +0 -3
- package/dist/routes/api/v1/search/route.js +0 -39
- package/dist/routes/api/v1/user/preferences/route.d.ts +0 -11
- package/dist/routes/api/v1/user/preferences/route.js +0 -31
- package/dist/routes/api/v1/user/profile/route.d.ts +0 -11
- package/dist/routes/api/v1/user/profile/route.js +0 -31
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { getSymlinkManager } from '@/lib/symlinks/symlink-manager';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/symlinks - Get all symlink configurations
|
|
5
|
-
*/
|
|
6
|
-
export async function GET() {
|
|
7
|
-
try {
|
|
8
|
-
const manager = await getSymlinkManager();
|
|
9
|
-
const symlinks = await manager.getSymlinks();
|
|
10
|
-
return NextResponse.json({
|
|
11
|
-
success: true,
|
|
12
|
-
symlinks
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
catch (error) {
|
|
16
|
-
console.error('Error fetching symlinks:', error);
|
|
17
|
-
return NextResponse.json({
|
|
18
|
-
success: false,
|
|
19
|
-
error: {
|
|
20
|
-
code: 'FETCH_SYMLINKS_ERROR',
|
|
21
|
-
message: error.message
|
|
22
|
-
}
|
|
23
|
-
}, { status: 500 });
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* POST /api/symlinks - Add a new symlink configuration
|
|
28
|
-
*/
|
|
29
|
-
export async function POST(request) {
|
|
30
|
-
try {
|
|
31
|
-
const body = await request.json();
|
|
32
|
-
const { name, description, linkPath, targetPath, isActive } = body;
|
|
33
|
-
if (!name || !linkPath || !targetPath) {
|
|
34
|
-
return NextResponse.json({
|
|
35
|
-
success: false,
|
|
36
|
-
error: {
|
|
37
|
-
code: 'INVALID_REQUEST',
|
|
38
|
-
message: 'Missing required fields: name, linkPath, targetPath'
|
|
39
|
-
}
|
|
40
|
-
}, { status: 400 });
|
|
41
|
-
}
|
|
42
|
-
const manager = await getSymlinkManager();
|
|
43
|
-
const result = await manager.addSymlink({
|
|
44
|
-
name,
|
|
45
|
-
description,
|
|
46
|
-
linkPath,
|
|
47
|
-
targetPath,
|
|
48
|
-
isActive: isActive || false
|
|
49
|
-
});
|
|
50
|
-
if (!result.success) {
|
|
51
|
-
return NextResponse.json({
|
|
52
|
-
success: false,
|
|
53
|
-
error: {
|
|
54
|
-
code: 'ADD_SYMLINK_ERROR',
|
|
55
|
-
message: result.message,
|
|
56
|
-
details: result.error
|
|
57
|
-
}
|
|
58
|
-
}, { status: 400 });
|
|
59
|
-
}
|
|
60
|
-
return NextResponse.json(result);
|
|
61
|
-
}
|
|
62
|
-
catch (error) {
|
|
63
|
-
console.error('Error adding symlink:', error);
|
|
64
|
-
return NextResponse.json({
|
|
65
|
-
success: false,
|
|
66
|
-
error: {
|
|
67
|
-
code: 'ADD_SYMLINK_ERROR',
|
|
68
|
-
message: error.message
|
|
69
|
-
}
|
|
70
|
-
}, { status: 500 });
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { getSymlinkPath, getTargetPath } from '@/lib/project-paths';
|
|
5
|
-
export async function POST(request) {
|
|
6
|
-
try {
|
|
7
|
-
const body = await request.json();
|
|
8
|
-
const { active } = body;
|
|
9
|
-
const symlinkPath = await getSymlinkPath();
|
|
10
|
-
const targetPath = await getTargetPath();
|
|
11
|
-
if (active) {
|
|
12
|
-
// Create symlink
|
|
13
|
-
try {
|
|
14
|
-
// Ensure the target directory and file exist
|
|
15
|
-
await fs.mkdir(path.dirname(targetPath), { recursive: true });
|
|
16
|
-
// Check if target file exists, create if not
|
|
17
|
-
try {
|
|
18
|
-
await fs.access(targetPath);
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
await fs.writeFile(targetPath, `# Claude Rules
|
|
22
|
-
|
|
23
|
-
This file contains project-specific rules and guidelines for Claude AI assistant.
|
|
24
|
-
|
|
25
|
-
## Project Context
|
|
26
|
-
Add project-specific context and guidelines here.
|
|
27
|
-
|
|
28
|
-
## Coding Standards
|
|
29
|
-
Add coding standards and conventions here.
|
|
30
|
-
|
|
31
|
-
## Best Practices
|
|
32
|
-
Add best practices and patterns specific to this project.
|
|
33
|
-
`);
|
|
34
|
-
}
|
|
35
|
-
// Remove existing file/symlink if it exists
|
|
36
|
-
try {
|
|
37
|
-
await fs.unlink(symlinkPath);
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
if (error.code !== 'ENOENT')
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
// Create the symlink
|
|
44
|
-
await fs.symlink(targetPath, symlinkPath);
|
|
45
|
-
return NextResponse.json({
|
|
46
|
-
success: true,
|
|
47
|
-
message: 'Symlink created successfully',
|
|
48
|
-
active: true,
|
|
49
|
-
symlinkPath,
|
|
50
|
-
targetPath
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
catch (error) {
|
|
54
|
-
throw new Error(`Failed to create symlink: ${error.message}`);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
// Remove symlink
|
|
59
|
-
try {
|
|
60
|
-
const stats = await fs.lstat(symlinkPath);
|
|
61
|
-
if (stats.isSymbolicLink()) {
|
|
62
|
-
await fs.unlink(symlinkPath);
|
|
63
|
-
}
|
|
64
|
-
return NextResponse.json({
|
|
65
|
-
success: true,
|
|
66
|
-
message: 'Symlink removed successfully',
|
|
67
|
-
active: false,
|
|
68
|
-
symlinkPath
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
if (error.code === 'ENOENT') {
|
|
73
|
-
return NextResponse.json({
|
|
74
|
-
success: true,
|
|
75
|
-
message: 'No symlink to remove',
|
|
76
|
-
active: false,
|
|
77
|
-
symlinkPath
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
throw new Error(`Failed to remove symlink: ${error.message}`);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch (error) {
|
|
85
|
-
console.error('Error toggling symlink:', error);
|
|
86
|
-
return NextResponse.json({
|
|
87
|
-
success: false,
|
|
88
|
-
error: {
|
|
89
|
-
code: 'TOGGLE_SYMLINK_ERROR',
|
|
90
|
-
message: error.message
|
|
91
|
-
}
|
|
92
|
-
}, { status: 500 });
|
|
93
|
-
}
|
|
94
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
|
-
export declare function GET(request: NextRequest, { params }: {
|
|
3
|
-
params: {
|
|
4
|
-
path: string[];
|
|
5
|
-
};
|
|
6
|
-
}): Promise<any>;
|
|
7
|
-
export declare function PUT(request: NextRequest, { params }: {
|
|
8
|
-
params: {
|
|
9
|
-
path: string[];
|
|
10
|
-
};
|
|
11
|
-
}): Promise<any>;
|
|
12
|
-
export declare function DELETE(request: NextRequest, { params }: {
|
|
13
|
-
params: {
|
|
14
|
-
path: string[];
|
|
15
|
-
};
|
|
16
|
-
}): Promise<any>;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { promises as fs } from 'fs';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
async function getContextPath(relativePath) {
|
|
5
|
-
// Use the same approach as FileStorageAdapter for consistency
|
|
6
|
-
const basePath = process.env.GAIT_DATA_PATH ?
|
|
7
|
-
path.resolve(process.env.GAIT_DATA_PATH, '.gait') :
|
|
8
|
-
path.resolve(process.cwd(), '.gait');
|
|
9
|
-
const contextDir = path.join(basePath, 'context');
|
|
10
|
-
const contextPath = path.join(contextDir, ...relativePath);
|
|
11
|
-
return { contextPath, contextDir };
|
|
12
|
-
}
|
|
13
|
-
export async function GET(request, { params }) {
|
|
14
|
-
try {
|
|
15
|
-
const pathInfo = await getContextPath(params.path);
|
|
16
|
-
if (!pathInfo) {
|
|
17
|
-
return NextResponse.json({ error: 'GAIT directory not found' }, { status: 404 });
|
|
18
|
-
}
|
|
19
|
-
const { contextPath: filePath, contextDir } = pathInfo;
|
|
20
|
-
// Security check - ensure path is within context directory
|
|
21
|
-
if (!filePath.startsWith(contextDir)) {
|
|
22
|
-
return NextResponse.json({ error: 'Access denied' }, { status: 403 });
|
|
23
|
-
}
|
|
24
|
-
// Check if it's a directory or file
|
|
25
|
-
const stat = await fs.stat(filePath);
|
|
26
|
-
if (stat.isDirectory()) {
|
|
27
|
-
// Return directory listing
|
|
28
|
-
const files = await fs.readdir(filePath);
|
|
29
|
-
const fileList = await Promise.all(files.map(async (file) => {
|
|
30
|
-
const fileStats = await fs.stat(path.join(filePath, file));
|
|
31
|
-
return {
|
|
32
|
-
name: file,
|
|
33
|
-
isDirectory: fileStats.isDirectory(),
|
|
34
|
-
size: fileStats.size,
|
|
35
|
-
modified: fileStats.mtime
|
|
36
|
-
};
|
|
37
|
-
}));
|
|
38
|
-
return NextResponse.json({ files: fileList });
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
// Return file content
|
|
42
|
-
const content = await fs.readFile(filePath, 'utf-8');
|
|
43
|
-
return new NextResponse(content, {
|
|
44
|
-
headers: {
|
|
45
|
-
'Content-Type': 'text/plain; charset=utf-8',
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
if (error.code === 'ENOENT') {
|
|
52
|
-
return NextResponse.json({ error: 'File not found' }, { status: 404 });
|
|
53
|
-
}
|
|
54
|
-
console.error('Error reading context file:', error);
|
|
55
|
-
return NextResponse.json({ error: 'Failed to read context file' }, { status: 500 });
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
export async function PUT(request, { params }) {
|
|
59
|
-
try {
|
|
60
|
-
const pathInfo = await getContextPath(params.path);
|
|
61
|
-
if (!pathInfo) {
|
|
62
|
-
return NextResponse.json({ error: 'GAIT directory not found' }, { status: 404 });
|
|
63
|
-
}
|
|
64
|
-
const { contextPath: filePath, contextDir } = pathInfo;
|
|
65
|
-
// Security check - ensure path is within context directory
|
|
66
|
-
if (!filePath.startsWith(contextDir)) {
|
|
67
|
-
return NextResponse.json({ error: 'Access denied' }, { status: 403 });
|
|
68
|
-
}
|
|
69
|
-
const content = await request.text();
|
|
70
|
-
// Basic validation for markdown files
|
|
71
|
-
if (filePath.endsWith('.md') && !content.startsWith('---')) {
|
|
72
|
-
return NextResponse.json({ error: 'Markdown files must start with YAML frontmatter (---)' }, { status: 400 });
|
|
73
|
-
}
|
|
74
|
-
// Ensure the directory exists
|
|
75
|
-
const dir = path.dirname(filePath);
|
|
76
|
-
await fs.mkdir(dir, { recursive: true });
|
|
77
|
-
// Write the file
|
|
78
|
-
await fs.writeFile(filePath, content, 'utf-8');
|
|
79
|
-
return NextResponse.json({ success: true });
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
console.error('Error updating context file:', error);
|
|
83
|
-
return NextResponse.json({ error: 'Failed to update context file' }, { status: 500 });
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export async function DELETE(request, { params }) {
|
|
87
|
-
try {
|
|
88
|
-
const pathInfo = await getContextPath(params.path);
|
|
89
|
-
if (!pathInfo) {
|
|
90
|
-
return NextResponse.json({ error: 'GAIT directory not found' }, { status: 404 });
|
|
91
|
-
}
|
|
92
|
-
const { contextPath: filePath, contextDir } = pathInfo;
|
|
93
|
-
// Security check - ensure path is within context directory
|
|
94
|
-
if (!filePath.startsWith(contextDir)) {
|
|
95
|
-
return NextResponse.json({ error: 'Access denied' }, { status: 403 });
|
|
96
|
-
}
|
|
97
|
-
await fs.unlink(filePath);
|
|
98
|
-
return NextResponse.json({ success: true });
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
if (error.code === 'ENOENT') {
|
|
102
|
-
return NextResponse.json({ error: 'File not found' }, { status: 404 });
|
|
103
|
-
}
|
|
104
|
-
console.error('Error deleting context file:', error);
|
|
105
|
-
return NextResponse.json({ error: 'Failed to delete context file' }, { status: 500 });
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { FileStorageAdapter } from '@/lib/storage/file-storage';
|
|
3
|
-
// Force dynamic rendering for this route since it uses searchParams
|
|
4
|
-
export const dynamic = 'force-dynamic';
|
|
5
|
-
const storage = new FileStorageAdapter();
|
|
6
|
-
export async function GET(request) {
|
|
7
|
-
try {
|
|
8
|
-
const searchParams = request.nextUrl.searchParams;
|
|
9
|
-
const query = searchParams.get('q');
|
|
10
|
-
if (!query) {
|
|
11
|
-
return NextResponse.json({
|
|
12
|
-
success: false,
|
|
13
|
-
error: {
|
|
14
|
-
code: 'MISSING_QUERY',
|
|
15
|
-
message: 'Query parameter "q" is required'
|
|
16
|
-
}
|
|
17
|
-
}, { status: 400 });
|
|
18
|
-
}
|
|
19
|
-
const results = await storage.searchCPs(query);
|
|
20
|
-
return NextResponse.json({
|
|
21
|
-
success: true,
|
|
22
|
-
data: results,
|
|
23
|
-
metadata: {
|
|
24
|
-
query,
|
|
25
|
-
resultCount: results.length
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error('Error searching proposals:', error);
|
|
31
|
-
return NextResponse.json({
|
|
32
|
-
success: false,
|
|
33
|
-
error: {
|
|
34
|
-
code: 'SEARCH_ERROR',
|
|
35
|
-
message: error.message
|
|
36
|
-
}
|
|
37
|
-
}, { status: 500 });
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
|
-
/**
|
|
3
|
-
* GET /api/v1/user/preferences
|
|
4
|
-
* Get user preferences
|
|
5
|
-
*/
|
|
6
|
-
export declare function GET(): Promise<any>;
|
|
7
|
-
/**
|
|
8
|
-
* PUT /api/v1/user/preferences
|
|
9
|
-
* Update user preferences
|
|
10
|
-
*/
|
|
11
|
-
export declare function PUT(request: NextRequest): Promise<any>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { updateUserPreferences, loadUserSettings } from '@/lib/user-preferences';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/v1/user/preferences
|
|
5
|
-
* Get user preferences
|
|
6
|
-
*/
|
|
7
|
-
export async function GET() {
|
|
8
|
-
try {
|
|
9
|
-
const settings = await loadUserSettings();
|
|
10
|
-
return NextResponse.json({ success: true, data: settings.preferences });
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
console.error('Failed to load user preferences:', error);
|
|
14
|
-
return NextResponse.json({ success: false, error: 'Failed to load user preferences' }, { status: 500 });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* PUT /api/v1/user/preferences
|
|
19
|
-
* Update user preferences
|
|
20
|
-
*/
|
|
21
|
-
export async function PUT(request) {
|
|
22
|
-
try {
|
|
23
|
-
const preferences = await request.json();
|
|
24
|
-
const settings = await updateUserPreferences(preferences);
|
|
25
|
-
return NextResponse.json({ success: true, data: settings.preferences });
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error('Failed to update user preferences:', error);
|
|
29
|
-
return NextResponse.json({ success: false, error: 'Failed to update user preferences' }, { status: 500 });
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { NextRequest } from 'next/server';
|
|
2
|
-
/**
|
|
3
|
-
* GET /api/v1/user/profile
|
|
4
|
-
* Get user profile information
|
|
5
|
-
*/
|
|
6
|
-
export declare function GET(): Promise<any>;
|
|
7
|
-
/**
|
|
8
|
-
* PUT /api/v1/user/profile
|
|
9
|
-
* Update user profile information
|
|
10
|
-
*/
|
|
11
|
-
export declare function PUT(request: NextRequest): Promise<any>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { NextResponse } from 'next/server';
|
|
2
|
-
import { updateUserProfile, loadUserSettings } from '@/lib/user-preferences';
|
|
3
|
-
/**
|
|
4
|
-
* GET /api/v1/user/profile
|
|
5
|
-
* Get user profile information
|
|
6
|
-
*/
|
|
7
|
-
export async function GET() {
|
|
8
|
-
try {
|
|
9
|
-
const settings = await loadUserSettings();
|
|
10
|
-
return NextResponse.json({ success: true, data: settings.profile });
|
|
11
|
-
}
|
|
12
|
-
catch (error) {
|
|
13
|
-
console.error('Failed to load user profile:', error);
|
|
14
|
-
return NextResponse.json({ success: false, error: 'Failed to load user profile' }, { status: 500 });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* PUT /api/v1/user/profile
|
|
19
|
-
* Update user profile information
|
|
20
|
-
*/
|
|
21
|
-
export async function PUT(request) {
|
|
22
|
-
try {
|
|
23
|
-
const profile = await request.json();
|
|
24
|
-
const settings = await updateUserProfile(profile);
|
|
25
|
-
return NextResponse.json({ success: true, data: settings.profile });
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error('Failed to update user profile:', error);
|
|
29
|
-
return NextResponse.json({ success: false, error: 'Failed to update user profile' }, { status: 500 });
|
|
30
|
-
}
|
|
31
|
-
}
|