@lovelybunch/api 1.0.13 → 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/static/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
9
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap" rel="stylesheet">
10
10
  <title>GAIT - Agent-Native Source Control</title>
11
- <script type="module" crossorigin src="/assets/index-DG4YYc23.js"></script>
11
+ <script type="module" crossorigin src="/assets/index-C4DYLEUE.js"></script>
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-xk_paAS8.css">
13
13
  </head>
14
14
  <body class="font-inter">
@@ -1,2 +0,0 @@
1
- import { type ClassValue } from "clsx";
2
- export declare function cn(...inputs: ClassValue[]): any;
package/dist/lib/utils.js DELETED
@@ -1,5 +0,0 @@
1
- import { clsx } from "clsx";
2
- import { twMerge } from "tailwind-merge";
3
- export function cn(...inputs) {
4
- return twMerge(clsx(inputs));
5
- }
@@ -1 +0,0 @@
1
- export declare function GET(): Promise<any>;
@@ -1,37 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
- import { promises as fs } from 'fs';
3
- import { getSymlinkPath } from '@/lib/project-paths';
4
- export async function GET() {
5
- try {
6
- const symlinkPath = await getSymlinkPath();
7
- try {
8
- const stats = await fs.lstat(symlinkPath);
9
- const exists = stats.isSymbolicLink();
10
- return NextResponse.json({
11
- success: true,
12
- exists,
13
- path: symlinkPath
14
- });
15
- }
16
- catch (error) {
17
- if (error.code === 'ENOENT') {
18
- return NextResponse.json({
19
- success: true,
20
- exists: false,
21
- path: symlinkPath
22
- });
23
- }
24
- throw error;
25
- }
26
- }
27
- catch (error) {
28
- console.error('Error checking symlink status:', error);
29
- return NextResponse.json({
30
- success: false,
31
- error: {
32
- code: 'SYMLINK_STATUS_ERROR',
33
- message: error.message
34
- }
35
- }, { status: 500 });
36
- }
37
- }
@@ -1,19 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- interface RouteParams {
3
- params: {
4
- id: string;
5
- };
6
- }
7
- /**
8
- * GET /api/symlinks/[id] - Get a specific symlink configuration
9
- */
10
- export declare function GET(request: NextRequest, { params }: RouteParams): Promise<any>;
11
- /**
12
- * PATCH /api/symlinks/[id] - Update a symlink configuration
13
- */
14
- export declare function PATCH(request: NextRequest, { params }: RouteParams): Promise<any>;
15
- /**
16
- * DELETE /api/symlinks/[id] - Delete a symlink configuration
17
- */
18
- export declare function DELETE(request: NextRequest, { params }: RouteParams): Promise<any>;
19
- export {};
@@ -1,95 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
- import { getSymlinkManager } from '@/lib/symlinks/symlink-manager';
3
- /**
4
- * GET /api/symlinks/[id] - Get a specific symlink configuration
5
- */
6
- export async function GET(request, { params }) {
7
- try {
8
- const manager = await getSymlinkManager();
9
- const symlink = await manager.getSymlink(params.id);
10
- if (!symlink) {
11
- return NextResponse.json({
12
- success: false,
13
- error: {
14
- code: 'NOT_FOUND',
15
- message: `Symlink with ID ${params.id} not found`
16
- }
17
- }, { status: 404 });
18
- }
19
- return NextResponse.json({
20
- success: true,
21
- symlink
22
- });
23
- }
24
- catch (error) {
25
- console.error('Error fetching symlink:', error);
26
- return NextResponse.json({
27
- success: false,
28
- error: {
29
- code: 'FETCH_SYMLINK_ERROR',
30
- message: error.message
31
- }
32
- }, { status: 500 });
33
- }
34
- }
35
- /**
36
- * PATCH /api/symlinks/[id] - Update a symlink configuration
37
- */
38
- export async function PATCH(request, { params }) {
39
- try {
40
- const body = await request.json();
41
- const manager = await getSymlinkManager();
42
- const result = await manager.updateSymlink(params.id, body);
43
- if (!result.success) {
44
- return NextResponse.json({
45
- success: false,
46
- error: {
47
- code: 'UPDATE_SYMLINK_ERROR',
48
- message: result.message,
49
- details: result.error
50
- }
51
- }, { status: 400 });
52
- }
53
- return NextResponse.json(result);
54
- }
55
- catch (error) {
56
- console.error('Error updating symlink:', error);
57
- return NextResponse.json({
58
- success: false,
59
- error: {
60
- code: 'UPDATE_SYMLINK_ERROR',
61
- message: error.message
62
- }
63
- }, { status: 500 });
64
- }
65
- }
66
- /**
67
- * DELETE /api/symlinks/[id] - Delete a symlink configuration
68
- */
69
- export async function DELETE(request, { params }) {
70
- try {
71
- const manager = await getSymlinkManager();
72
- const result = await manager.deleteSymlink(params.id);
73
- if (!result.success) {
74
- return NextResponse.json({
75
- success: false,
76
- error: {
77
- code: 'DELETE_SYMLINK_ERROR',
78
- message: result.message,
79
- details: result.error
80
- }
81
- }, { status: 400 });
82
- }
83
- return NextResponse.json(result);
84
- }
85
- catch (error) {
86
- console.error('Error deleting symlink:', error);
87
- return NextResponse.json({
88
- success: false,
89
- error: {
90
- code: 'DELETE_SYMLINK_ERROR',
91
- message: error.message
92
- }
93
- }, { status: 500 });
94
- }
95
- }
@@ -1,11 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- interface RouteParams {
3
- params: {
4
- id: string;
5
- };
6
- }
7
- /**
8
- * POST /api/symlinks/[id]/toggle - Toggle a symlink on/off
9
- */
10
- export declare function POST(request: NextRequest, { params }: RouteParams): Promise<any>;
11
- export {};
@@ -1,32 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
- import { getSymlinkManager } from '@/lib/symlinks/symlink-manager';
3
- /**
4
- * POST /api/symlinks/[id]/toggle - Toggle a symlink on/off
5
- */
6
- export async function POST(request, { params }) {
7
- try {
8
- const manager = await getSymlinkManager();
9
- const result = await manager.toggleSymlink(params.id);
10
- if (!result.success) {
11
- return NextResponse.json({
12
- success: false,
13
- error: {
14
- code: 'TOGGLE_SYMLINK_ERROR',
15
- message: result.message,
16
- details: result.error
17
- }
18
- }, { status: 400 });
19
- }
20
- return NextResponse.json(result);
21
- }
22
- catch (error) {
23
- console.error('Error toggling symlink:', error);
24
- return NextResponse.json({
25
- success: false,
26
- error: {
27
- code: 'TOGGLE_SYMLINK_ERROR',
28
- message: error.message
29
- }
30
- }, { status: 500 });
31
- }
32
- }
@@ -1 +0,0 @@
1
- export declare function GET(): Promise<any>;
@@ -1,35 +0,0 @@
1
- import { NextResponse } from 'next/server';
2
- import path from 'path';
3
- import { promises as fs } from 'fs';
4
- export async function GET() {
5
- const cwd = process.cwd();
6
- const calculatedRoot = path.resolve(cwd, '../..');
7
- const envRoot = process.env.GAIT_PROJECT_ROOT;
8
- // Check what files exist
9
- const checks = {
10
- cwd,
11
- calculatedRoot,
12
- envRoot: envRoot || 'not set',
13
- gaitDirExists: false,
14
- symlinksJsonExists: false,
15
- symlinksJsonPath: path.join(calculatedRoot, '.gait', 'symlinks.json'),
16
- actualFiles: []
17
- };
18
- try {
19
- await fs.access(path.join(calculatedRoot, '.gait'));
20
- checks.gaitDirExists = true;
21
- const files = await fs.readdir(path.join(calculatedRoot, '.gait'));
22
- checks.actualFiles = files;
23
- try {
24
- await fs.access(checks.symlinksJsonPath);
25
- checks.symlinksJsonExists = true;
26
- }
27
- catch {
28
- // File doesn't exist
29
- }
30
- }
31
- catch {
32
- // Directory doesn't exist
33
- }
34
- return NextResponse.json(checks);
35
- }
@@ -1,9 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- /**
3
- * GET /api/symlinks - Get all symlink configurations
4
- */
5
- export declare function GET(): Promise<any>;
6
- /**
7
- * POST /api/symlinks - Add a new symlink configuration
8
- */
9
- export declare function POST(request: NextRequest): Promise<any>;
@@ -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,2 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- export declare function POST(request: NextRequest): Promise<any>;
@@ -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,3 +0,0 @@
1
- import { NextRequest } from 'next/server';
2
- export declare const dynamic = "force-dynamic";
3
- export declare function GET(request: NextRequest): Promise<any>;
@@ -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>;