Update app.py
Browse files
app.py
CHANGED
@@ -28,27 +28,20 @@ PROJECT_TEMPLATES = {
|
|
28 |
"app.py": """from flask import Flask
|
29 |
from flask_sqlalchemy import SQLAlchemy
|
30 |
import os
|
31 |
-
|
32 |
basedir = os.path.abspath(os.path.dirname(__file__))
|
33 |
-
|
34 |
app = Flask(__name__)
|
35 |
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') or \\
|
36 |
'{{database_uri}}' # Placeholder for database URI
|
37 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
38 |
-
|
39 |
db = SQLAlchemy(app)
|
40 |
-
|
41 |
class HelloWorld(db.Model):
|
42 |
id = db.Column(db.Integer, primary_key=True)
|
43 |
message = db.Column(db.String(128))
|
44 |
-
|
45 |
def __repr__(self):
|
46 |
return f'<HelloWorld {self.message}>'
|
47 |
-
|
48 |
@app.route('/')
|
49 |
def hello():
|
50 |
return "Hello, Flask!"
|
51 |
-
|
52 |
@app.route('/db_test')
|
53 |
def db_test():
|
54 |
try:
|
@@ -56,8 +49,6 @@ def db_test():
|
|
56 |
return "Database connection successful!"
|
57 |
except Exception as e:
|
58 |
return f"Database connection failed: {e}"
|
59 |
-
|
60 |
-
|
61 |
if __name__ == '__main__':
|
62 |
with app.app_context(): # Create application context for DB operations
|
63 |
db.create_all()
|
@@ -148,7 +139,6 @@ code {
|
|
148 |
"manage.py": """#!/usr/bin/env python
|
149 |
import os
|
150 |
import sys
|
151 |
-
|
152 |
if __name__ == "__main__":
|
153 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
|
154 |
try:
|
@@ -221,10 +211,8 @@ STATIC_URL = '/static/'
|
|
221 |
"myapp/urls.py": """from django.contrib import admin
|
222 |
from django.urls import path
|
223 |
from django.http import HttpResponse
|
224 |
-
|
225 |
def home(request):
|
226 |
return HttpResponse("Hello, Django!")
|
227 |
-
|
228 |
urlpatterns = [
|
229 |
path('admin/', admin.site.urls),
|
230 |
path('', home, name='home'),
|
@@ -243,11 +231,9 @@ application = get_wsgi_application()""",
|
|
243 |
"server.js": """const express = require('express')
|
244 |
const app = express()
|
245 |
const port = 3000
|
246 |
-
|
247 |
app.get('/', (req, res) => {
|
248 |
res.send('Hello World from Express!')
|
249 |
})
|
250 |
-
|
251 |
app.listen(port, () => {
|
252 |
console.log(`Server listening on port ${port}`)
|
253 |
})""",
|
@@ -290,7 +276,6 @@ app.listen(port, () => {
|
|
290 |
"files": {
|
291 |
"main.py": """def main():
|
292 |
print("Hello from Python script!")
|
293 |
-
|
294 |
if __name__ == "__main__":
|
295 |
main()""",
|
296 |
"requirements.txt": "",
|
@@ -342,8 +327,7 @@ if __name__ == "__main__":
|
|
342 |
}""",
|
343 |
"vite.config.js": """import { defineConfig } from 'vite'
|
344 |
import react from '@vitejs/plugin-react'
|
345 |
-
|
346 |
-
// https://vitejs.dev/config/
|
347 |
export default defineConfig({
|
348 |
plugins: [react()],
|
349 |
})""",
|
@@ -364,7 +348,6 @@ export default defineConfig({
|
|
364 |
import ReactDOM from 'react-dom/client'
|
365 |
import App from './App.jsx'
|
366 |
import './index.css'
|
367 |
-
|
368 |
ReactDOM.createRoot(document.getElementById('root')).render(
|
369 |
<React.StrictMode>
|
370 |
<App />
|
@@ -373,15 +356,12 @@ ReactDOM.createRoot(document.getElementById('root')).render(
|
|
373 |
"src/App.jsx": """import React from 'react'
|
374 |
import { Button } from "./components/ui/button"
|
375 |
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./components/ui/card"
|
376 |
-
|
377 |
-
|
378 |
function App() {
|
379 |
return (
|
380 |
<div className="container mx-auto py-10">
|
381 |
<h1 className="text-3xl font-bold text-center mb-5">
|
382 |
Witaj w aplikacji Shadcn UI!
|
383 |
</h1>
|
384 |
-
|
385 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
386 |
<Card>
|
387 |
<CardHeader>
|
@@ -393,7 +373,6 @@ function App() {
|
|
393 |
<Button className="mt-4">Przycisk Akcji</Button>
|
394 |
</CardContent>
|
395 |
</Card>
|
396 |
-
|
397 |
<Card>
|
398 |
<CardHeader>
|
399 |
<CardTitle>Karta 2</CardTitle>
|
@@ -404,7 +383,6 @@ function App() {
|
|
404 |
<Button variant="secondary" className="mt-4">Przycisk Wtórny</Button>
|
405 |
</CardContent>
|
406 |
</Card>
|
407 |
-
|
408 |
<Card className="lg:col-span-1 md:col-span-2">
|
409 |
<CardHeader>
|
410 |
<CardTitle>Dłuższa Karta</CardTitle>
|
@@ -423,76 +401,55 @@ function App() {
|
|
423 |
</div>
|
424 |
)
|
425 |
}
|
426 |
-
|
427 |
export default App""",
|
428 |
"src/index.css": """@tailwind base;
|
429 |
@tailwind components;
|
430 |
@tailwind utilities;
|
431 |
-
|
432 |
@layer base {
|
433 |
:root {
|
434 |
--background: 0 0% 100%;
|
435 |
--foreground: 222.2 84.9% 4.9%;
|
436 |
-
|
437 |
--card: 0 0% 100%;
|
438 |
--card-foreground: 222.2 84.9% 4.9%;
|
439 |
-
|
440 |
--popover: 0 0% 100%;
|
441 |
--popover-foreground: 222.2 84.9% 4.9%;
|
442 |
-
|
443 |
--primary: 221.2 83.2% 53.3%;
|
444 |
--primary-foreground: 210 40% 98%;
|
445 |
-
|
446 |
--secondary: 210 40% 96.1%;
|
447 |
--secondary-foreground: 222.2 47.4% 11.2%;
|
448 |
-
|
449 |
--muted: 210 40% 96.1%;
|
450 |
--muted-foreground: 215.4 16.3% 46.9%;
|
451 |
-
|
452 |
--accent: 210 40% 96.1%;
|
453 |
--accent-foreground: 222.2 47.4% 11.2%;
|
454 |
-
|
455 |
--destructive: 0 84.2% 60.2%;
|
456 |
--destructive-foreground: 210 40% 98%;
|
457 |
-
|
458 |
--border: 214.3 31.8% 91.4%;
|
459 |
--input: 214.3 31.8% 91.4%;
|
460 |
--ring: 221.2 83.2% 53.3%;
|
461 |
-
|
462 |
--radius: 0.5rem;
|
463 |
}
|
464 |
-
|
465 |
.dark {
|
466 |
--background: 222.2 84.9% 4.9%;
|
467 |
--foreground: 210 40% 98%;
|
468 |
-
|
469 |
--card: 222.2 84.9% 4.9%;
|
470 |
--card-foreground: 210 40% 98%;
|
471 |
-
|
472 |
--popover: 222.2 84.9% 4.9%;
|
473 |
--popover-foreground: 210 40% 98%;
|
474 |
-
|
475 |
--primary: 217.2 91.2% 59.8%;
|
476 |
--primary-foreground: 222.2 47.4% 11.2%;
|
477 |
-
|
478 |
--secondary: 217.2 32.6% 17.5%;
|
479 |
--secondary-foreground: 210 40% 98%;
|
480 |
-
|
481 |
--muted: 217.2 32.6% 17.5%;
|
482 |
--muted-foreground: 215 20.2% 65.1%;
|
483 |
-
|
484 |
--accent: 217.2 32.6% 17.5%;
|
485 |
--accent-foreground: 210 40% 98%;
|
486 |
-
|
487 |
--destructive: 0 62.8% 30.6%;
|
488 |
--destructive-foreground: 210 40% 98%;
|
489 |
-
|
490 |
--border: 217.2 32.6% 17.5%;
|
491 |
--input: 217.2 32.6% 17.5%;
|
492 |
--ring: 224.9 98.6% 67.3%;
|
493 |
}
|
494 |
}
|
495 |
-
|
496 |
@layer components {
|
497 |
.container {
|
498 |
@apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
|
@@ -586,7 +543,6 @@ module.exports = {
|
|
586 |
import { cn } from "@/lib/utils"
|
587 |
import { Slot } from "@radix-ui/react-slot"
|
588 |
import { cva } from "class-variance-authority";
|
589 |
-
|
590 |
const buttonVariants = cva(
|
591 |
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
592 |
{
|
@@ -615,7 +571,6 @@ const buttonVariants = cva(
|
|
615 |
},
|
616 |
}
|
617 |
)
|
618 |
-
|
619 |
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
620 |
const Comp = asChild ? Slot : "button"
|
621 |
return (<Comp
|
@@ -623,64 +578,56 @@ const Button = React.forwardRef(({ className, variant, size, asChild = false, ..
|
|
623 |
ref={ref} {...props} />)
|
624 |
})
|
625 |
Button.displayName = "Button"
|
626 |
-
|
627 |
export { Button, buttonVariants }""",
|
628 |
"src/components/ui/card.jsx": """import * as React from "react"
|
629 |
import { cn } from "@/lib/utils"
|
630 |
-
|
631 |
const Card = React.forwardRef(({ className, ...props }, ref) => (<div
|
632 |
className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
|
633 |
ref={ref}
|
634 |
{...props} />))
|
635 |
Card.displayName = "Card"
|
636 |
-
|
637 |
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (<div
|
638 |
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
639 |
ref={ref}
|
640 |
{...props} />))
|
641 |
CardHeader.displayName = "CardHeader"
|
642 |
-
|
643 |
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (<h3
|
644 |
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
645 |
ref={ref}
|
646 |
{...props} />))
|
647 |
CardTitle.displayName = "CardTitle"
|
648 |
-
|
649 |
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (<p
|
650 |
className={cn("text-sm text-muted-foreground", className)}
|
651 |
ref={ref}
|
652 |
{...props} />))
|
653 |
CardDescription.displayName = "CardDescription"
|
654 |
-
|
655 |
const CardContent = React.forwardRef(({ className, ...props }, ref) => (<div
|
656 |
className={cn("p-6 pt-0", className)}
|
657 |
ref={ref}
|
658 |
{...props} />))
|
659 |
CardContent.displayName = "CardContent"
|
660 |
-
|
661 |
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (<div
|
662 |
className={cn("flex items-center p-6 pt-0", className)}
|
663 |
ref={ref}
|
664 |
{...props} />))
|
665 |
CardFooter.displayName = "CardFooter" "node_modules/colorette": {
|
666 |
"version": "2.0.20",
|
667 |
-
"resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
|
668 |
-
"integrity": "sha512
|
|
|
669 |
"fastapi": {
|
670 |
"files": {
|
671 |
"main.py": """from fastapi import FastAPI
|
672 |
|
673 |
app = FastAPI()
|
674 |
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
}
|
682 |
-
},
|
683 |
-
"post_process": "shadcn_setup"
|
684 |
},
|
685 |
"nextjs": {
|
686 |
"files": {
|
@@ -747,7 +694,7 @@ export default function Home() {
|
|
747 |
</div>
|
748 |
)
|
749 |
}""",
|
750 |
-
"styles/Home.module.css": """.container {
|
751 |
min-height: 100vh;
|
752 |
padding: 0 0.5rem;
|
753 |
display: flex;
|
@@ -868,8 +815,8 @@ export default function handler(req, res) {
|
|
868 |
},
|
869 |
"node_modules/@babel/code-frame": {
|
870 |
"version": "7.23.5",
|
871 |
-
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
|
872 |
-
"integrity": "sha512
|
873 |
"dependencies": {
|
874 |
"@babel/highlight": "^7.22.16"
|
875 |
},
|
@@ -879,8 +826,8 @@ export default function handler(req, res) {
|
|
879 |
},
|
880 |
"node_modules/@babel/highlight": {
|
881 |
"version": "7.23.4",
|
882 |
-
"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
|
883 |
-
"integrity": "sha512
|
884 |
"dependencies": {
|
885 |
"chalk": "^2.0.0",
|
886 |
"esutils": "^2.0.0"
|
@@ -891,13 +838,13 @@ export default function handler(req, res) {
|
|
891 |
},
|
892 |
"node_modules/@cnakazawa/describe-type": {
|
893 |
"version": "2.1.1",
|
894 |
-
"resolved": "https://registry.npmjs.org/@cnakazawa/describe-type/-/describe-type-2.1.1.tgz",
|
895 |
-
"integrity": "sha512
|
896 |
},
|
897 |
"node_modules/@eslint/eslintrc": {
|
898 |
"version": "2.1.1",
|
899 |
-
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz",
|
900 |
-
"integrity": "sha512
|
901 |
"dependencies": {
|
902 |
"ajv": "^6.12.2",
|
903 |
"chalk": "^2.0.0",
|
@@ -915,16 +862,16 @@ export default function handler(req, res) {
|
|
915 |
},
|
916 |
"node_modules/@eslint/js": {
|
917 |
"version": "8.52.0",
|
918 |
-
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz",
|
919 |
-
"integrity": "sha512
|
920 |
"engines": {
|
921 |
"node": "^10.0.0 || >= 12.0.0"
|
922 |
}
|
923 |
},
|
924 |
"node_modules/@humanwhocodes/config-array": {
|
925 |
"version": "0.11.12",
|
926 |
-
|
927 |
-
"integrity": "sha512
|
928 |
"dependencies": {
|
929 |
"@humanwhocodes/object-schema": "^1.2.1",
|
930 |
"debug": "^4.3.4",
|
@@ -936,16 +883,16 @@ export default function handler(req, res) {
|
|
936 |
},
|
937 |
"node_modules/@humanwhocodes/object-schema": {
|
938 |
"version": "1.2.1",
|
939 |
-
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
|
940 |
-
"integrity": "sha512
|
941 |
"engines": {
|
942 |
"node": ">=12"
|
943 |
}
|
944 |
},
|
945 |
"node_modules/@jest/types": {
|
946 |
"version": "29.6.3",
|
947 |
-
"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
|
948 |
-
"integrity": "sha512
|
949 |
"dependencies": {
|
950 |
"@types/jest": "*",
|
951 |
"@types/node": "*",
|
@@ -954,31 +901,31 @@ export default function handler(req, res) {
|
|
954 |
},
|
955 |
"node_modules/@next/env": {
|
956 |
"version": "14.0.0",
|
957 |
-
"resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.0.tgz",
|
958 |
-
"integrity": "sha512
|
959 |
},
|
960 |
"node_modules/@npmcli/ci-detect": {
|
961 |
"version": "2.0.1",
|
962 |
-
"resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-2.0.1.tgz",
|
963 |
-
"integrity": "sha512
|
964 |
},
|
965 |
"node_modules/@radix-ui/react-slot": {
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
},
|
970 |
"node_modules/@radix-ui/slot": {
|
971 |
"version": "1.0.2",
|
972 |
-
"resolved": "https://registry.npmjs.org/@radix-ui/slot/-/slot-1.0.2.tgz",
|
973 |
-
"integrity": "sha512
|
974 |
"peerDependencies": {
|
975 |
"react": "*"
|
976 |
}
|
977 |
},
|
978 |
"node_modules/@rollup/plugin-commonjs": {
|
979 |
"version": "25.0.7",
|
980 |
-
"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz",
|
981 |
-
"integrity": "sha512
|
982 |
"peerDependencies": {
|
983 |
"rollup": "^1.20.0||^2||^3"
|
984 |
},
|
@@ -990,8 +937,8 @@ export default function handler(req, res) {
|
|
990 |
},
|
991 |
"node_modules/@rollup/plugin-inject": {
|
992 |
"version": "5.1.0",
|
993 |
-
"resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.1.0.tgz",
|
994 |
-
"integrity": "sha512
|
995 |
"peerDependencies": {
|
996 |
"rollup": "^1.20.0||^2||^3"
|
997 |
},
|
@@ -1003,8 +950,8 @@ export default function handler(req, res) {
|
|
1003 |
},
|
1004 |
"node_modules/@stylistic/eslint-plugin-js": {
|
1005 |
"version": "1.5.1",
|
1006 |
-
"resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.5.1.tgz",
|
1007 |
-
"integrity": "sha512
|
1008 |
"dependencies": {
|
1009 |
"@stylistic/eslint-plugin-plus": "1.5.1",
|
1010 |
"globals": "^13.20.0"
|
@@ -1015,24 +962,24 @@ export default function handler(req, res) {
|
|
1015 |
},
|
1016 |
"node_modules/@stylistic/eslint-plugin-plus": {
|
1017 |
"version": "1.5.1",
|
1018 |
-
"resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.5.1.tgz",
|
1019 |
-
"integrity": "sha512
|
1020 |
"peerDependencies": {
|
1021 |
"eslint": ">=8.0.0"
|
1022 |
}
|
1023 |
},
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
},
|
1032 |
"node_modules/@svgr/plugin-jsx": {
|
1033 |
"version": "8.1.4",
|
1034 |
-
"resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-8.1.4.tgz",
|
1035 |
-
"integrity": "sha512
|
1036 |
"dependencies": {
|
1037 |
"@babel/plugin-syntax-jsx": "^7.18.6",
|
1038 |
"@svgr/babel-preset": "8.1.4",
|
@@ -1048,32 +995,32 @@ export default function handler(req, res) {
|
|
1048 |
},
|
1049 |
"node_modules/@tsconfig/cypress": {
|
1050 |
"version": "3.0.0",
|
1051 |
-
"resolved": "https://registry.npmjs.org/@tsconfig/cypress/-/cypress-3.0.0.tgz",
|
1052 |
-
"integrity": "sha512
|
1053 |
"peerDependencies": {
|
1054 |
"typescript": ">=4.5"
|
1055 |
}
|
1056 |
},
|
1057 |
"node_modules/@tsconfig/create-react-app": {
|
1058 |
"version": "2.0.1",
|
1059 |
-
"resolved": "https://registry.npmjs.org/@tsconfig/create-react-app/-/create-react-app-2.0.1.tgz",
|
1060 |
-
"integrity": "sha512
|
1061 |
"peerDependencies": {
|
1062 |
"typescript": ">=3.8"
|
1063 |
}
|
1064 |
},
|
1065 |
"node_modules/@tsconfig/node-lts-strictest": {
|
1066 |
"version": "20.1.1",
|
1067 |
-
"resolved": "https://registry.npmjs.org/@tsconfig/node-lts-strictest/-/node-lts-strictest-20.1.1.tgz",
|
1068 |
-
"integrity": "sha512
|
1069 |
"peerDependencies": {
|
1070 |
"typescript": ">=4.8"
|
1071 |
}
|
1072 |
},
|
1073 |
"node_modules/@types/babel__core": {
|
1074 |
"version": "7.20.3",
|
1075 |
-
"resolved": "https://registry.npmjs.org/@types/babel__core/-/core-7.20.3.tgz",
|
1076 |
-
"integrity": "sha512
|
1077 |
"dependencies": {
|
1078 |
"@babel/parser": "*",
|
1079 |
"@types/babel__generator": "*",
|
@@ -1084,36 +1031,36 @@ export default function handler(req, res) {
|
|
1084 |
},
|
1085 |
"node_modules/@types/babel__generator": {
|
1086 |
"version": "7.6.8",
|
1087 |
-
"resolved": "https://registry.npmjs.org/@types/babel__generator/-/generator-7.6.8.tgz",
|
1088 |
-
"integrity": "sha512
|
1089 |
},
|
1090 |
"node_modules/@types/babel__template": {
|
1091 |
"version": "7.4.5",
|
1092 |
-
"resolved": "https://registry.npmjs.org/@types/babel__template/-/template-7.4.5.tgz",
|
1093 |
-
"integrity": "sha512
|
1094 |
},
|
1095 |
"node_modules/@types/babel__traverse": {
|
1096 |
"version": "7.20.5",
|
1097 |
-
"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/traverse-7.20.5.tgz",
|
1098 |
-
"integrity": "sha512
|
1099 |
"dependencies": {
|
1100 |
"@types/babel__parser": "*"
|
1101 |
}
|
1102 |
},
|
1103 |
"node_modules/@types/chalk": {
|
1104 |
"version": "2.2.0",
|
1105 |
-
"resolved": "https://registry.npmjs.org/@types/chalk/-/chalk-2.2.0.tgz",
|
1106 |
-
"integrity": "sha512
|
1107 |
},
|
1108 |
"node_modules/@types/color-name": {
|
1109 |
"version": "1.1.3",
|
1110 |
-
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.3.tgz",
|
1111 |
-
"integrity": "sha512
|
1112 |
},
|
1113 |
"node_modules/@types/eslint": {
|
1114 |
"version": "8.44.7",
|
1115 |
-
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.7.tgz",
|
1116 |
-
"integrity": "sha512
|
1117 |
"dependencies": {
|
1118 |
"@jest/types": "*",
|
1119 |
"@types/estree": "*",
|
@@ -1123,26 +1070,26 @@ export default function handler(req, res) {
|
|
1123 |
},
|
1124 |
"node_modules/@types/estree": {
|
1125 |
"version": "2.0.0",
|
1126 |
-
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-2.0.0.tgz",
|
1127 |
-
"integrity": "sha512
|
1128 |
},
|
1129 |
"node_modules/@types/glob": {
|
1130 |
"version": "8.1.0",
|
1131 |
-
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz",
|
1132 |
-
"integrity": "sha512
|
1133 |
"dependencies": {
|
1134 |
"@types/node": "*"
|
1135 |
}
|
1136 |
},
|
1137 |
"node_modules/@types/hoist-non-react-statics": {
|
1138 |
"version": "3.3.1",
|
1139 |
-
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
|
1140 |
-
"integrity": "sha512
|
1141 |
},
|
1142 |
"node_modules/@types/jest": {
|
1143 |
"version": "29.5.5",
|
1144 |
-
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.5.tgz",
|
1145 |
-
"integrity": "sha512
|
1146 |
"dependencies": {
|
1147 |
"@types/estree": "*",
|
1148 |
"@types/node": "*",
|
@@ -1154,46 +1101,46 @@ export default function handler(req, res) {
|
|
1154 |
},
|
1155 |
"node_modules/@types/json-schema": {
|
1156 |
"version": "7.0.12",
|
1157 |
-
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
|
1158 |
-
"integrity": "sha512
|
1159 |
},
|
1160 |
"node_modules/@types/json5": {
|
1161 |
"version": "0.0.2",
|
1162 |
-
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.2.tgz",
|
1163 |
-
"integrity": "sha512
|
1164 |
},
|
1165 |
"node_modules/@types/minimatch": {
|
1166 |
"version": "5.1.0",
|
1167 |
-
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.0.tgz",
|
1168 |
-
"integrity": "sha512
|
1169 |
},
|
1170 |
"node_modules/@types/node": {
|
1171 |
"version": "20.8.9",
|
1172 |
-
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz",
|
1173 |
-
"integrity": "sha512
|
1174 |
},
|
1175 |
"node_modules/@types/parse-json": {
|
1176 |
"version": "4.0.0",
|
1177 |
-
"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
|
1178 |
-
"integrity": "sha512
|
1179 |
},
|
1180 |
"node_modules/@types/prettier": {
|
1181 |
"version": "2.7.3",
|
1182 |
-
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz",
|
1183 |
-
"integrity": "sha512
|
1184 |
},
|
1185 |
"node_modules/@types/promises-aplus": {
|
1186 |
"version": "2.0.5",
|
1187 |
-
"resolved": "https://registry.npmjs.org/@types/promises-aplus/-/promises-aplus-2.0.5.tgz",
|
1188 |
-
"integrity": "sha512
|
1189 |
"dependencies": {
|
1190 |
"@types/node": "*"
|
1191 |
}
|
1192 |
},
|
1193 |
"node_modules/@types/react": {
|
1194 |
"version": "18.2.33",
|
1195 |
-
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz",
|
1196 |
-
"integrity": "sha512
|
1197 |
"dependencies": {
|
1198 |
"@types/prop-types": "*",
|
1199 |
"@types/scheduler": "*",
|
@@ -1202,49 +1149,49 @@ export default function handler(req, res) {
|
|
1202 |
},
|
1203 |
"node_modules/@types/react-dom": {
|
1204 |
"version": "18.2.14",
|
1205 |
-
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.14.tgz",
|
1206 |
-
"integrity": "sha512
|
1207 |
"dependencies": {
|
1208 |
"@types/react": "*"
|
1209 |
}
|
1210 |
},
|
1211 |
"node_modules/@types/resolve": {
|
1212 |
"version": "1.20.2",
|
1213 |
-
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
|
1214 |
-
"integrity": "sha512
|
1215 |
},
|
1216 |
"node_modules/@types/scheduler": {
|
1217 |
"version": "0.16.4",
|
1218 |
-
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.4.tgz",
|
1219 |
-
"integrity": "sha512
|
1220 |
},
|
1221 |
"node_modules/@types/semver": {
|
1222 |
"version": "7.5.3",
|
1223 |
-
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz",
|
1224 |
-
"integrity": "sha512
|
1225 |
},
|
1226 |
"node_modules/@types/stack-trace-parser": {
|
1227 |
"version": "1.3.2",
|
1228 |
-
"resolved": "https://registry.npmjs.org/@types/stack-trace-parser/-/stack-trace-parser-1.3.2.tgz",
|
1229 |
-
"integrity": "sha512
|
1230 |
},
|
1231 |
"node_modules/@types/testing-library__dom": {
|
1232 |
"version": "7.5.0",
|
1233 |
-
"resolved": "https://registry.npmjs.org/@types/testing-library__dom/-/dom-7.5.0.tgz",
|
1234 |
-
"integrity": "sha512
|
1235 |
"dependencies": {
|
1236 |
"@types/node": "*"
|
1237 |
}
|
1238 |
},
|
1239 |
"node_modules/@types/ungap__structured-clone": {
|
1240 |
"version": "0.3.0",
|
1241 |
-
"resolved": "https://registry.npmjs.org/@types/ungap__structured-clone/-/structured-clone-0.3.0.tgz",
|
1242 |
-
"integrity": "sha512
|
1243 |
},
|
1244 |
"node_modules/@vercel/nft": {
|
1245 |
"version": "0.25.0",
|
1246 |
-
"resolved": "https://registry.npmjs.org/@vercel/nft/-/nft-0.25.0.tgz",
|
1247 |
-
"integrity": "sha512
|
1248 |
"dependencies": {
|
1249 |
"@types/glob": "^8.0.0",
|
1250 |
"cacache": "^16.1.0",
|
@@ -1261,8 +1208,8 @@ export default function handler(req, res) {
|
|
1261 |
},
|
1262 |
"node_modules/ajv": {
|
1263 |
"version": "6.12.6",
|
1264 |
-
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
1265 |
-
"integrity": "sha512
|
1266 |
"dependencies": {
|
1267 |
"fast-deep-equal": "^3.1.1",
|
1268 |
"json-schema-traverse": "^0.4.1",
|
@@ -1274,8 +1221,8 @@ export default function handler(req, res) {
|
|
1274 |
},
|
1275 |
"node_modules/ansi-styles": {
|
1276 |
"version": "3.2.1",
|
1277 |
-
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
1278 |
-
"integrity": "sha512
|
1279 |
"dependencies": {
|
1280 |
"color-convert": "^1.9.0"
|
1281 |
},
|
@@ -1285,16 +1232,16 @@ export default function handler(req, res) {
|
|
1285 |
},
|
1286 |
"node_modules/arg": {
|
1287 |
"version": "5.0.2",
|
1288 |
-
"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
|
1289 |
-
"integrity": "sha512
|
1290 |
"engines": {
|
1291 |
"node": ">=14"
|
1292 |
}
|
1293 |
},
|
1294 |
"node_modules/assert": {
|
1295 |
"version": "1.5.0",
|
1296 |
-
"resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
|
1297 |
-
"integrity": "sha512
|
1298 |
"dependencies": {
|
1299 |
"ieee754": "^1.1.13",
|
1300 |
"util": "0.10.4"
|
@@ -1302,8 +1249,8 @@ export default function handler(req, res) {
|
|
1302 |
},
|
1303 |
"node_modules/autoprefixer": {
|
1304 |
"version": "10.4.16",
|
1305 |
-
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
|
1306 |
-
"integrity": "sha512
|
1307 |
"dependencies": {
|
1308 |
"browserslist": "^4.22.1",
|
1309 |
"caniuse-lite": "1.0.30015751",
|
@@ -1323,13 +1270,13 @@ export default function handler(req, res) {
|
|
1323 |
},
|
1324 |
"node_modules/balanced-match": {
|
1325 |
"version": "1.0.2",
|
1326 |
-
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
1327 |
-
"integrity": "sha512
|
1328 |
},
|
1329 |
"node_modules/browserslist": {
|
1330 |
"version": "4.22.2",
|
1331 |
-
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz",
|
1332 |
-
"integrity": "sha512
|
1333 |
"funding": {
|
1334 |
"type": "opencollective",
|
1335 |
"url": "https://opencollective.com/browserslist"
|
@@ -1340,8 +1287,8 @@ export default function handler(req, res) {
|
|
1340 |
},
|
1341 |
"node_modules/cacache": {
|
1342 |
"version": "16.1.1",
|
1343 |
-
"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.1.tgz",
|
1344 |
-
"integrity": "sha512
|
1345 |
"dependencies": {
|
1346 |
"@npmcli/ci-detect": "^2.0.0",
|
1347 |
"@npmcli/fs": "^3.1.0",
|
@@ -1365,19 +1312,21 @@ export default function handler(req, res) {
|
|
1365 |
},
|
1366 |
"node_modules/camelcase": {
|
1367 |
"version": "6.3.0",
|
1368 |
-
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
|
1369 |
-
"integrity": "sha512
|
1370 |
"engines": {
|
1371 |
"node": ">=10"
|
1372 |
}
|
1373 |
},
|
1374 |
"node_modules/caniuse-lite": {
|
1375 |
"version": "1.0.30015751",
|
1376 |
-
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30015751.tgz",
|
1377 |
-
"integrity": "sha512
|
1378 |
-
|
1379 |
-
|
1380 |
-
"
|
|
|
|
|
1381 |
"dependencies": {
|
1382 |
"ansi-styles": "^3.2.1",
|
1383 |
"escape-string-regexp": "^1.0.5",
|
@@ -1389,8 +1338,8 @@ export default function handler(req, res) {
|
|
1389 |
},
|
1390 |
"node_modules/chokidar": {
|
1391 |
"version": "3.5.3",
|
1392 |
-
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
1393 |
-
"integrity": "sha512
|
1394 |
"dependencies": {
|
1395 |
"anymatch": "~3.1.3",
|
1396 |
"braces": "~3.0.2",
|
@@ -1409,34 +1358,34 @@ export default function handler(req, res) {
|
|
1409 |
},
|
1410 |
"node_modules/chownr": {
|
1411 |
"version": "3.0.0",
|
1412 |
-
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
1413 |
-
"integrity": "sha512
|
1414 |
"engines": {
|
1415 |
"node": ">=12"
|
1416 |
}
|
1417 |
},
|
1418 |
"node_modules/class-variance-authority": {
|
1419 |
"version": "0.7.0",
|
1420 |
-
"resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.0.tgz",
|
1421 |
-
"integrity": "sha512
|
1422 |
},
|
1423 |
"node_modules/cli-boxes": {
|
1424 |
"version": "2.2.1",
|
1425 |
-
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz",
|
1426 |
-
"integrity": "sha512
|
1427 |
"engines": {
|
1428 |
"node": ">=12"
|
1429 |
}
|
1430 |
},
|
1431 |
"node_modules/clsx": {
|
1432 |
"version": "2.1.0",
|
1433 |
-
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz",
|
1434 |
-
"integrity": "sha512
|
1435 |
},
|
1436 |
"node_modules/color-convert": {
|
1437 |
"version": "1.9.3",
|
1438 |
-
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
1439 |
-
"integrity": "sha512
|
1440 |
"dependencies": {
|
1441 |
"color-name": "1.1.3"
|
1442 |
},
|
@@ -1446,28 +1395,25 @@ export default function handler(req, res) {
|
|
1446 |
},
|
1447 |
"node_modules/color-name": {
|
1448 |
"version": "1.1.3",
|
1449 |
-
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
1450 |
-
"integrity": "sha512
|
1451 |
"engines": {
|
1452 |
"node": ">=0.1.90"
|
1453 |
}
|
1454 |
},
|
1455 |
-
"fastapi": {
|
1456 |
-
"files": {
|
1457 |
-
"main.py": """from fastapi import FastAPI
|
1458 |
|
1459 |
-
|
|
|
|
|
|
|
1460 |
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
".gitignore": "__pycache__/\nvenv/\n"
|
1467 |
-
}
|
1468 |
},
|
1469 |
}
|
1470 |
-
|
1471 |
def get_file_content(owner, repo_name, path, branch="main"):
|
1472 |
"""Fetches file content from a GitHub repository."""
|
1473 |
url = f"https://raw.githubusercontent.com/{owner}/{repo_name}/{branch}/{path}"
|
@@ -1477,14 +1423,10 @@ def get_file_content(owner, repo_name, path, branch="main"):
|
|
1477 |
return response.text
|
1478 |
except requests.exceptions.RequestException as e:
|
1479 |
return f"Error fetching file: {e}"
|
1480 |
-
|
1481 |
-
|
1482 |
def extract_repo_info(url):
|
1483 |
"""Extracts owner and repo name from a GitHub URL."""
|
1484 |
match = re.search(r"github\.com/([^/]+)/([^/]+)", url)
|
1485 |
return match.group(1), match.group(2) if match else (None, None)
|
1486 |
-
|
1487 |
-
|
1488 |
def analyze_file_content(content, file_path):
|
1489 |
"""Analyzes file content and returns statistics."""
|
1490 |
lines = content.splitlines()
|
@@ -1496,8 +1438,6 @@ def analyze_file_content(content, file_path):
|
|
1496 |
"word_count": word_count,
|
1497 |
"file_extension": file_extension,
|
1498 |
}
|
1499 |
-
|
1500 |
-
|
1501 |
def github_tool(
|
1502 |
action: str,
|
1503 |
repo_name: str = None,
|
@@ -1529,7 +1469,6 @@ def github_tool(
|
|
1529 |
):
|
1530 |
"""Manages GitHub repositories."""
|
1531 |
user = g.get_user()
|
1532 |
-
|
1533 |
try:
|
1534 |
if action == "import_repository":
|
1535 |
if not all([owner, repo_name, vcs_url]):
|
@@ -1539,7 +1478,6 @@ def github_tool(
|
|
1539 |
return "Repository already exists."
|
1540 |
except GithubException:
|
1541 |
pass
|
1542 |
-
|
1543 |
headers = {
|
1544 |
'Authorization': f'token {GITHUB_TOKEN}',
|
1545 |
'Accept': 'application/vnd.github.v3+json',
|
@@ -1548,13 +1486,11 @@ def github_tool(
|
|
1548 |
response = requests.put(import_url, json={'vcs_url': vcs_url, 'vcs': 'git'}, headers=headers)
|
1549 |
response.raise_for_status()
|
1550 |
return "Repository import started."
|
1551 |
-
|
1552 |
elif action == "create_repository":
|
1553 |
if not repo_name:
|
1554 |
raise ValueError("Missing parameter: repo_name")
|
1555 |
repo = user.create_repo(name=repo_name)
|
1556 |
return f"Repository **{repo_name}** created! [Open repository]({repo.html_url})"
|
1557 |
-
|
1558 |
elif action == "create_project_from_template":
|
1559 |
if not all([repo_name, template_name]):
|
1560 |
raise ValueError("Missing parameters: repo_name, template_name")
|
@@ -1564,26 +1500,20 @@ def github_tool(
|
|
1564 |
)
|
1565 |
repo = user.create_repo(name=repo_name)
|
1566 |
template = PROJECT_TEMPLATES[template_name]
|
1567 |
-
|
1568 |
template_params_final = {}
|
1569 |
if "params" in template:
|
1570 |
for param_name, param_config in template["params"].items():
|
1571 |
template_params_final[param_name] = template_params.get(param_name, param_config.get("default")) if template_params else param_config.get("default")
|
1572 |
-
|
1573 |
repo_name_snake_case = repo_name.replace("-", "_")
|
1574 |
readme_filename = "README.md"
|
1575 |
-
|
1576 |
env = jinja2.Environment()
|
1577 |
-
|
1578 |
for file_path, file_content in template["files"].items():
|
1579 |
final_file_path = file_path
|
1580 |
final_file_content = file_content
|
1581 |
-
|
1582 |
if "rename_files" in template:
|
1583 |
for old_name, new_name_template in template["rename_files"].items():
|
1584 |
if file_path == old_name:
|
1585 |
final_file_path = new_name_template.replace("{{repo_name_snake_case}}", repo_name_snake_case).replace("{{repo_name}}", repo_name).replace("{{readme_filename}}", readme_filename)
|
1586 |
-
|
1587 |
template_render = env.from_string(final_file_content)
|
1588 |
final_file_content = template_render.render(
|
1589 |
repo_name=repo_name,
|
@@ -1591,14 +1521,12 @@ def github_tool(
|
|
1591 |
readme_filename=readme_filename,
|
1592 |
**template_params_final
|
1593 |
)
|
1594 |
-
|
1595 |
repo.create_file(
|
1596 |
final_file_path,
|
1597 |
f"Create {final_file_path} from template {template_name}",
|
1598 |
final_file_content,
|
1599 |
branch="main",
|
1600 |
)
|
1601 |
-
|
1602 |
if "post_process" in template:
|
1603 |
post_process_action = template["post_process"]
|
1604 |
if post_process_action == "install_dependencies":
|
@@ -1619,16 +1547,13 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1619 |
return f"Repository **{repo_name}** created from template **{template_name}**! [Open repository]({repo.html_url})\n\n{instructions}"
|
1620 |
else:
|
1621 |
print(f"Unknown post-process action: {post_process_action}")
|
1622 |
-
|
1623 |
return f"Repository **{repo_name}** created from template **{template_name}**! [Open repository]({repo.html_url})"
|
1624 |
-
|
1625 |
elif action == "create_file":
|
1626 |
if not all([repo_name, path, content, message]):
|
1627 |
raise ValueError("Missing parameters: repo_name, path, content, message")
|
1628 |
repo = user.get_repo(repo_name)
|
1629 |
repo.create_file(path, message, content, branch=branch)
|
1630 |
return f"File **`{path}`** created in repository **`{repo_name}`** on branch **`{branch}`**."
|
1631 |
-
|
1632 |
elif action == "get_file":
|
1633 |
if not all([repo_name, path]):
|
1634 |
raise ValueError("Missing parameters: repo_name, path")
|
@@ -1637,13 +1562,11 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1637 |
return (
|
1638 |
f"File content of **`{path}`** from **`{repo_name}`**:\n\n`\n{file_content.decoded_content.decode()}\n`"
|
1639 |
)
|
1640 |
-
|
1641 |
elif action == "get_file_content_by_url":
|
1642 |
if not file_url:
|
1643 |
raise ValueError("Missing parameter: file_url")
|
1644 |
file_content = get_file_content(None, None, None, None)
|
1645 |
return f"File content from URL **`{file_url}`**:\n\n`\n{file_content}\n`"
|
1646 |
-
|
1647 |
elif action == "delete_file":
|
1648 |
if not all([repo_name, path]):
|
1649 |
raise ValueError("Missing parameters: repo_name, path")
|
@@ -1651,7 +1574,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1651 |
file_contents = repo.get_contents(path, ref=branch)
|
1652 |
repo.delete_file(path, "Delete file", file_contents.sha, branch=branch)
|
1653 |
return f"File **`{path}`** deleted from repository **`{repo_name}`** on branch **`{branch}`**."
|
1654 |
-
|
1655 |
elif action == "update_file":
|
1656 |
if not all([repo_name, path, content, message]):
|
1657 |
raise ValueError("Missing parameters: repo_name, path, content, message")
|
@@ -1659,32 +1581,24 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1659 |
file_contents = repo.get_contents(path, ref=branch)
|
1660 |
repo.update_file(path, message, content, file_contents.sha, branch=branch)
|
1661 |
return f"File **`{path}`** updated in repository **`{repo_name}`** on branch **`{branch}`**."
|
1662 |
-
|
1663 |
elif action == "update_file_diff":
|
1664 |
if not all([repo_name, path, diff, diff_message]):
|
1665 |
raise ValueError("Missing parameters: repo_name, path, diff, diff_message")
|
1666 |
repo = user.get_repo(repo_name)
|
1667 |
file_contents = repo.get_contents(path, ref=branch)
|
1668 |
current_content_text = file_contents.decoded_content.decode()
|
1669 |
-
|
1670 |
dmp = diff_match_patch()
|
1671 |
-
|
1672 |
try:
|
1673 |
patches = dmp.patch_fromText(diff)
|
1674 |
except ValueError:
|
1675 |
raise ValueError("Invalid patch format. Please provide a valid patch in 'diff' format.")
|
1676 |
-
|
1677 |
patched_content_tuple = dmp.patch_apply(patches, current_content_text)
|
1678 |
patched_content_text = patched_content_tuple[0]
|
1679 |
patch_results = patched_content_tuple[1]
|
1680 |
-
|
1681 |
if not any(patch_results):
|
1682 |
raise ValueError("Failed to apply patch. Diff might be outdated or invalid.")
|
1683 |
-
|
1684 |
repo.update_file(path, diff_message, patched_content_text, file_contents.sha, branch=branch)
|
1685 |
return f"File **`{path}`** updated using diff in repository **`{repo_name}`** on branch **`{branch}`**."
|
1686 |
-
|
1687 |
-
|
1688 |
elif action == "list_branches":
|
1689 |
if not repo_name:
|
1690 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1692,7 +1606,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1692 |
branches = repo.get_branches()
|
1693 |
branch_list = "\n".join([f"- `{branch.name}`" for branch in branches])
|
1694 |
return f"Branches in repository **`{repo_name}`**:\n{branch_list}"
|
1695 |
-
|
1696 |
elif action == "create_branch":
|
1697 |
if not all([repo_name, base, head]):
|
1698 |
raise ValueError("Missing parameters: repo_name, base, head")
|
@@ -1700,21 +1613,18 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1700 |
source_branch = repo.get_branch(base)
|
1701 |
repo.create_git_ref(ref=f"refs/heads/{head}", sha=source_branch.commit.sha)
|
1702 |
return f"Branch **`{head}`** created from **`{base}`** in repository **`{repo_name}`**."
|
1703 |
-
|
1704 |
elif action == "delete_branch":
|
1705 |
if not all([repo_name, branch]):
|
1706 |
raise ValueError("Missing parameters: repo_name, branch")
|
1707 |
repo = user.get_repo(repo_name)
|
1708 |
repo.get_git_ref(f"heads/{branch}").delete()
|
1709 |
return f"Branch **`{branch}`** deleted from repository **`{repo_name}`**."
|
1710 |
-
|
1711 |
elif action == "create_pull_request":
|
1712 |
if not all([repo_name, title, body, base, head]):
|
1713 |
raise ValueError("Missing parameters: repo_name, title, body, base, head")
|
1714 |
repo = user.get_repo(repo_name)
|
1715 |
pr = repo.create_pull(title=title, body=body, base=base, head=head)
|
1716 |
return f"Pull request created! [Open Pull Request]({pr.html_url})"
|
1717 |
-
|
1718 |
elif action == "list_open_pull_requests":
|
1719 |
if not repo_name:
|
1720 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1724,14 +1634,12 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1724 |
return f"No open pull requests in repository **`{repo_name}`**."
|
1725 |
prs_list = "\n".join([f"- [{pr.title}]({pr.html_url})" for pr in open_prs])
|
1726 |
return f"Open pull requests in repository **`{repo_name}`**:\n{prs_list}"
|
1727 |
-
|
1728 |
elif action == "create_issue":
|
1729 |
if not all([repo_name, title, body]):
|
1730 |
raise ValueError("Missing parameters: repo_name, title, body")
|
1731 |
repo = user.get_repo(repo_name)
|
1732 |
issue = repo.create_issue(title=title, body=body)
|
1733 |
return f"Issue created! [Open Issue]({issue.html_url})"
|
1734 |
-
|
1735 |
elif action == "list_issues":
|
1736 |
if not repo_name:
|
1737 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1741,7 +1649,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1741 |
return f"No open issues in repository **`{repo_name}`**."
|
1742 |
issues_list = "\n".join([f"- [{issue.title}]({issue.html_url})" for issue in issues])
|
1743 |
return f"Open issues in repository **`{repo_name}`**:\n{issues_list}"
|
1744 |
-
|
1745 |
elif action == "add_label_to_issue":
|
1746 |
if not all([repo_name, issue_number, labels]):
|
1747 |
raise ValueError("Missing parameters: repo_name, issue_number, labels")
|
@@ -1752,7 +1659,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1752 |
return (
|
1753 |
f"Labels **`{labels}`** added to issue **#{issue_number}** in repository **`{repo_name}`**."
|
1754 |
)
|
1755 |
-
|
1756 |
elif action == "close_issue":
|
1757 |
if not all([repo_name, issue_number]):
|
1758 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
@@ -1760,7 +1666,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1760 |
issue = repo.get_issue(number=int(issue_number))
|
1761 |
issue.edit(state='closed')
|
1762 |
return f"Issue **#{issue_number}** closed in repository **`{repo_name}`**."
|
1763 |
-
|
1764 |
elif action == "add_comment_to_issue":
|
1765 |
if not all([repo_name, issue_number, message]):
|
1766 |
raise ValueError("Missing parameters: repo_name, issue_number, message")
|
@@ -1768,7 +1673,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1768 |
issue = repo.get_issue(number=int(issue_number))
|
1769 |
issue.create_comment(body=message)
|
1770 |
return f"Comment added to issue **#{issue_number}** in repository **`{repo_name}`**."
|
1771 |
-
|
1772 |
elif action == "create_release":
|
1773 |
if not all([repo_name, tag, name, message]):
|
1774 |
raise ValueError("Missing parameters: repo_name, tag, name, message")
|
@@ -1777,7 +1681,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1777 |
return (
|
1778 |
f"Release **`{name}`** created in repository **`{repo_name}`**! [Open Release]({release.html_url})"
|
1779 |
)
|
1780 |
-
|
1781 |
elif action == "list_releases":
|
1782 |
if not repo_name:
|
1783 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1787,14 +1690,12 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1787 |
return f"No releases in repository **`{repo_name}`**."
|
1788 |
releases_list = "\n".join([f"- [{release.tag_name}]({release.html_url})" for release in releases])
|
1789 |
return f"Releases in repository **`{repo_name}`**:\n{releases_list}"
|
1790 |
-
|
1791 |
elif action == "fork_repository":
|
1792 |
if not repo_name:
|
1793 |
raise ValueError("Missing parameter: repo_name")
|
1794 |
repo = g.get_repo(repo_name)
|
1795 |
fork = user.create_fork(repo)
|
1796 |
return f"Repository **`{repo_name}`** forked! [Open fork]({fork.html_url})"
|
1797 |
-
|
1798 |
elif action == "list_forks":
|
1799 |
if not repo_name:
|
1800 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1804,7 +1705,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1804 |
return f"No forks of repository **`{repo_name}`**."
|
1805 |
forks_list = "\n".join([f"- [{fork.full_name}]({fork.html_url})" for fork in forks])
|
1806 |
return f"Forks of repository **`{repo_name}`**:\n{forks_list}"
|
1807 |
-
|
1808 |
elif action == "list_files":
|
1809 |
if not all([owner, repo_name]):
|
1810 |
raise ValueError("Missing parameters: owner, repo_name")
|
@@ -1814,7 +1714,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1814 |
return f"No files in path **`{path}`** of repository **`{repo_name}`**."
|
1815 |
files_list = "\n".join([f"- [{content.name}]({content.download_url})" for content in contents])
|
1816 |
return f"Files in path **`{path}`** of repository **`{repo_name}`**:\n{files_list}"
|
1817 |
-
|
1818 |
elif action == "get_repository_info":
|
1819 |
if not all([owner, repo_name]):
|
1820 |
raise ValueError("Missing parameters: owner, repo_name")
|
@@ -1833,7 +1732,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1833 |
}
|
1834 |
info_md = "\n".join([f"- **{key}**: {value}" for key, value in info.items()])
|
1835 |
return f"Repository info for **`{repo_name}`**:\n{info_md}"
|
1836 |
-
|
1837 |
elif action == "get_file_content":
|
1838 |
if not all([owner, repo_name, path]):
|
1839 |
raise ValueError("Missing parameters: owner, repo_name, path")
|
@@ -1841,14 +1739,12 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1841 |
return (
|
1842 |
f"File content of **`{path}`** from repository **`{repo_name}`**:\n\n`\n{content_text}\n`"
|
1843 |
)
|
1844 |
-
|
1845 |
elif action == "analyze_repository_by_url":
|
1846 |
if not repo_url:
|
1847 |
raise ValueError("Missing parameter: repo_url")
|
1848 |
owner, repo_name = extract_repo_info(repo_url)
|
1849 |
if not owner or not repo_name:
|
1850 |
raise ValueError("Invalid repository URL")
|
1851 |
-
|
1852 |
repo = g.get_repo(f"{owner}/{repo_name}")
|
1853 |
contents = repo.get_contents("")
|
1854 |
file_analyses = []
|
@@ -1869,7 +1765,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1869 |
for f in file_analyses
|
1870 |
])
|
1871 |
return analysis_md
|
1872 |
-
|
1873 |
elif action == "analyze_repository_content":
|
1874 |
if not all([owner, repo_name]):
|
1875 |
raise ValueError("Missing parameters: owner, repo_name")
|
@@ -1893,21 +1788,18 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1893 |
for f in file_analyses
|
1894 |
])
|
1895 |
return analysis_md
|
1896 |
-
|
1897 |
elif action == "delete_repository":
|
1898 |
if not repo_name:
|
1899 |
raise ValueError("Missing parameter: repo_name")
|
1900 |
repo = user.get_repo(repo_name)
|
1901 |
repo.delete()
|
1902 |
return f"Repository **`{repo_name}`** deleted!"
|
1903 |
-
|
1904 |
elif action == "update_repository_description":
|
1905 |
if not all([repo_name, new_description]):
|
1906 |
raise ValueError("Missing parameters: repo_name, new_description")
|
1907 |
repo = user.get_repo(repo_name)
|
1908 |
repo.edit(description=new_description)
|
1909 |
return f"Repository **`{repo_name}`** description updated to: \"{new_description}\""
|
1910 |
-
|
1911 |
elif action == "edit_issue":
|
1912 |
if not all([repo_name, issue_number]):
|
1913 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
@@ -1925,7 +1817,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1925 |
issue.edit(**issue_update_params)
|
1926 |
updated_fields = ", ".join(issue_update_params.keys())
|
1927 |
return f"Issue **#{issue_number}** in repository **`{repo_name}`** updated fields: {updated_fields}"
|
1928 |
-
|
1929 |
elif action == "list_closed_issues":
|
1930 |
if not repo_name:
|
1931 |
raise ValueError("Missing parameter: repo_name")
|
@@ -1935,7 +1826,6 @@ Po wykonaniu tych kroków, Twoja aplikacja Shadcn UI będzie w pełni skonfiguro
|
|
1935 |
return f"No closed issues in repository **`{repo_name}`**."
|
1936 |
issues_list = "\n".join([f"- [{issue.title}]({issue.html_url})" for issue in issues])
|
1937 |
return f"Closed issues in repository **`{repo_name}`**:\n{issues_list}"
|
1938 |
-
|
1939 |
elif action == "get_issue_details":
|
1940 |
if not all([repo_name, issue_number]):
|
1941 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
@@ -1963,12 +1853,9 @@ Author: {issue.user.login}
|
|
1963 |
"""
|
1964 |
else:
|
1965 |
details += "No comments."
|
1966 |
-
|
1967 |
return details
|
1968 |
-
|
1969 |
else:
|
1970 |
raise ValueError(f"Unknown action: {action}")
|
1971 |
-
|
1972 |
except GithubException as e:
|
1973 |
return f"**GitHub Error:** {e}"
|
1974 |
except ValueError as e:
|
@@ -1977,11 +1864,8 @@ Author: {issue.user.login}
|
|
1977 |
return f"**Connection Error:** {e}"
|
1978 |
except Exception as e:
|
1979 |
return f"**Unexpected Error:** {e}"
|
1980 |
-
|
1981 |
-
|
1982 |
with gr.Blocks() as demo:
|
1983 |
gr.Markdown("# GitHub Tool Plugingit (Simplified Interface)")
|
1984 |
-
|
1985 |
with gr.Column():
|
1986 |
action = gr.Dropdown(
|
1987 |
choices=[
|
@@ -2025,7 +1909,6 @@ with gr.Blocks() as demo:
|
|
2025 |
value=param_details["default"] if "default" in param_details else ""
|
2026 |
)
|
2027 |
template_params_ui[template_key] = params_section
|
2028 |
-
|
2029 |
branch = gr.Textbox(label="Branch", value="main")
|
2030 |
path = gr.Textbox(label="File Path")
|
2031 |
content = gr.Code(label="File Content", lines=5, language='python', visible=True)
|
@@ -2048,7 +1931,6 @@ with gr.Blocks() as demo:
|
|
2048 |
issue_title = gr.Textbox(label="New Issue Title", visible=False)
|
2049 |
issue_body = gr.Textbox(label="New Issue Body", visible=False, lines=3)
|
2050 |
issue_state = gr.Dropdown(label="New Issue State (open/closed)", choices=["open", "closed", None], value=None, allow_none=True, visible=False)
|
2051 |
-
|
2052 |
def show_template_params(template_name):
|
2053 |
visibility_map = {key: gr.Column.update(visible=False) for key in PROJECT_TEMPLATES if
|
2054 |
"params" in PROJECT_TEMPLATES[key]}
|
@@ -2056,7 +1938,6 @@ with gr.Blocks() as demo:
|
|
2056 |
visibility_map[template_name] = gr.Column.update(visible=True)
|
2057 |
return [visibility_map.get(key, gr.Column.update(visible=False)) for key in PROJECT_TEMPLATES if
|
2058 |
"params" in PROJECT_TEMPLATES[key]]
|
2059 |
-
|
2060 |
template_param_visibility_outputs = [template_params_ui[key] for key in PROJECT_TEMPLATES if
|
2061 |
"params" in PROJECT_TEMPLATES[key]]
|
2062 |
template_name.change(
|
@@ -2064,22 +1945,24 @@ with gr.Blocks() as demo:
|
|
2064 |
inputs=[template_name],
|
2065 |
outputs=template_param_visibility_outputs
|
2066 |
)
|
2067 |
-
|
2068 |
run_button = gr.Button("Execute")
|
2069 |
output = gr.Markdown(label="Result")
|
2070 |
-
|
2071 |
input_components = [
|
2072 |
action, repo_name, branch, path, content, message, owner, vcs_url, title, body, base, head, issue_number,
|
2073 |
labels, tag, release_name, file_url, repo_url, template_name, new_description, issue_title, issue_body,
|
2074 |
issue_state, diff, diff_message
|
2075 |
]
|
2076 |
-
|
2077 |
for template_key in PROJECT_TEMPLATES:
|
2078 |
if "params" in PROJECT_TEMPLATES[template_key]:
|
2079 |
for param_name in template_params_ui:
|
2080 |
-
if param_name in
|
2081 |
-
|
|
|
|
|
|
|
2082 |
|
|
|
|
|
2083 |
def show_hide_input_fields(action_name):
|
2084 |
visibility_map = {
|
2085 |
"repo_name": gr.Textbox.update(visible=False),
|
@@ -2107,7 +1990,6 @@ with gr.Blocks() as demo:
|
|
2107 |
"issue_body": gr.Textbox.update(visible=False),
|
2108 |
"issue_state": gr.Dropdown.update(visible=False),
|
2109 |
}
|
2110 |
-
|
2111 |
if action_name in ["import_repository"]:
|
2112 |
visibility_map.update({"repo_name": gr.Textbox.update(visible=True), "owner": gr.Textbox.update(visible=True), "vcs_url": gr.Textbox.update(visible=True)})
|
2113 |
elif action_name in ["create_repository", "delete_repository", "list_branches", "list_open_pull_requests", "list_issues", "list_closed_issues", "list_releases", "list_forks"]:
|
@@ -2150,28 +2032,21 @@ with gr.Blocks() as demo:
|
|
2150 |
visibility_map.update({"repo_url": gr.Textbox.update(visible=True)})
|
2151 |
elif action_name == "update_repository_description":
|
2152 |
visibility_map.update({"repo_name": gr.Textbox.update(visible=True), "new_description": gr.Textbox.update(visible=True)})
|
2153 |
-
|
2154 |
-
|
2155 |
return [visibility_map.get(key, gr.Textbox.update(visible=False)) for key in visibility_map]
|
2156 |
-
|
2157 |
output_components_visibility = [
|
2158 |
repo_name, branch, path, content, message, owner, vcs_url, title, body, base, head, issue_number, labels,
|
2159 |
tag, release_name, file_url, repo_url, template_name, new_description, issue_title, issue_body,
|
2160 |
issue_state, diff, diff_message
|
2161 |
]
|
2162 |
-
|
2163 |
action.change(
|
2164 |
show_hide_input_fields,
|
2165 |
inputs=[action],
|
2166 |
outputs=output_components_visibility
|
2167 |
)
|
2168 |
-
|
2169 |
-
|
2170 |
run_button.click(
|
2171 |
github_tool,
|
2172 |
inputs=input_components,
|
2173 |
outputs=output,
|
2174 |
api_name="github_tool"
|
2175 |
)
|
2176 |
-
|
2177 |
demo.launch()
|
|
|
28 |
"app.py": """from flask import Flask
|
29 |
from flask_sqlalchemy import SQLAlchemy
|
30 |
import os
|
|
|
31 |
basedir = os.path.abspath(os.path.dirname(__file__))
|
|
|
32 |
app = Flask(__name__)
|
33 |
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL') or \\
|
34 |
'{{database_uri}}' # Placeholder for database URI
|
35 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
|
|
36 |
db = SQLAlchemy(app)
|
|
|
37 |
class HelloWorld(db.Model):
|
38 |
id = db.Column(db.Integer, primary_key=True)
|
39 |
message = db.Column(db.String(128))
|
|
|
40 |
def __repr__(self):
|
41 |
return f'<HelloWorld {self.message}>'
|
|
|
42 |
@app.route('/')
|
43 |
def hello():
|
44 |
return "Hello, Flask!"
|
|
|
45 |
@app.route('/db_test')
|
46 |
def db_test():
|
47 |
try:
|
|
|
49 |
return "Database connection successful!"
|
50 |
except Exception as e:
|
51 |
return f"Database connection failed: {e}"
|
|
|
|
|
52 |
if __name__ == '__main__':
|
53 |
with app.app_context(): # Create application context for DB operations
|
54 |
db.create_all()
|
|
|
139 |
"manage.py": """#!/usr/bin/env python
|
140 |
import os
|
141 |
import sys
|
|
|
142 |
if __name__ == "__main__":
|
143 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
|
144 |
try:
|
|
|
211 |
"myapp/urls.py": """from django.contrib import admin
|
212 |
from django.urls import path
|
213 |
from django.http import HttpResponse
|
|
|
214 |
def home(request):
|
215 |
return HttpResponse("Hello, Django!")
|
|
|
216 |
urlpatterns = [
|
217 |
path('admin/', admin.site.urls),
|
218 |
path('', home, name='home'),
|
|
|
231 |
"server.js": """const express = require('express')
|
232 |
const app = express()
|
233 |
const port = 3000
|
|
|
234 |
app.get('/', (req, res) => {
|
235 |
res.send('Hello World from Express!')
|
236 |
})
|
|
|
237 |
app.listen(port, () => {
|
238 |
console.log(`Server listening on port ${port}`)
|
239 |
})""",
|
|
|
276 |
"files": {
|
277 |
"main.py": """def main():
|
278 |
print("Hello from Python script!")
|
|
|
279 |
if __name__ == "__main__":
|
280 |
main()""",
|
281 |
"requirements.txt": "",
|
|
|
327 |
}""",
|
328 |
"vite.config.js": """import { defineConfig } from 'vite'
|
329 |
import react from '@vitejs/plugin-react'
|
330 |
+
# https://vitejs.dev/config/
|
|
|
331 |
export default defineConfig({
|
332 |
plugins: [react()],
|
333 |
})""",
|
|
|
348 |
import ReactDOM from 'react-dom/client'
|
349 |
import App from './App.jsx'
|
350 |
import './index.css'
|
|
|
351 |
ReactDOM.createRoot(document.getElementById('root')).render(
|
352 |
<React.StrictMode>
|
353 |
<App />
|
|
|
356 |
"src/App.jsx": """import React from 'react'
|
357 |
import { Button } from "./components/ui/button"
|
358 |
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "./components/ui/card"
|
|
|
|
|
359 |
function App() {
|
360 |
return (
|
361 |
<div className="container mx-auto py-10">
|
362 |
<h1 className="text-3xl font-bold text-center mb-5">
|
363 |
Witaj w aplikacji Shadcn UI!
|
364 |
</h1>
|
|
|
365 |
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
366 |
<Card>
|
367 |
<CardHeader>
|
|
|
373 |
<Button className="mt-4">Przycisk Akcji</Button>
|
374 |
</CardContent>
|
375 |
</Card>
|
|
|
376 |
<Card>
|
377 |
<CardHeader>
|
378 |
<CardTitle>Karta 2</CardTitle>
|
|
|
383 |
<Button variant="secondary" className="mt-4">Przycisk Wtórny</Button>
|
384 |
</CardContent>
|
385 |
</Card>
|
|
|
386 |
<Card className="lg:col-span-1 md:col-span-2">
|
387 |
<CardHeader>
|
388 |
<CardTitle>Dłuższa Karta</CardTitle>
|
|
|
401 |
</div>
|
402 |
)
|
403 |
}
|
|
|
404 |
export default App""",
|
405 |
"src/index.css": """@tailwind base;
|
406 |
@tailwind components;
|
407 |
@tailwind utilities;
|
|
|
408 |
@layer base {
|
409 |
:root {
|
410 |
--background: 0 0% 100%;
|
411 |
--foreground: 222.2 84.9% 4.9%;
|
|
|
412 |
--card: 0 0% 100%;
|
413 |
--card-foreground: 222.2 84.9% 4.9%;
|
|
|
414 |
--popover: 0 0% 100%;
|
415 |
--popover-foreground: 222.2 84.9% 4.9%;
|
|
|
416 |
--primary: 221.2 83.2% 53.3%;
|
417 |
--primary-foreground: 210 40% 98%;
|
|
|
418 |
--secondary: 210 40% 96.1%;
|
419 |
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
|
420 |
--muted: 210 40% 96.1%;
|
421 |
--muted-foreground: 215.4 16.3% 46.9%;
|
|
|
422 |
--accent: 210 40% 96.1%;
|
423 |
--accent-foreground: 222.2 47.4% 11.2%;
|
|
|
424 |
--destructive: 0 84.2% 60.2%;
|
425 |
--destructive-foreground: 210 40% 98%;
|
|
|
426 |
--border: 214.3 31.8% 91.4%;
|
427 |
--input: 214.3 31.8% 91.4%;
|
428 |
--ring: 221.2 83.2% 53.3%;
|
|
|
429 |
--radius: 0.5rem;
|
430 |
}
|
|
|
431 |
.dark {
|
432 |
--background: 222.2 84.9% 4.9%;
|
433 |
--foreground: 210 40% 98%;
|
|
|
434 |
--card: 222.2 84.9% 4.9%;
|
435 |
--card-foreground: 210 40% 98%;
|
|
|
436 |
--popover: 222.2 84.9% 4.9%;
|
437 |
--popover-foreground: 210 40% 98%;
|
|
|
438 |
--primary: 217.2 91.2% 59.8%;
|
439 |
--primary-foreground: 222.2 47.4% 11.2%;
|
|
|
440 |
--secondary: 217.2 32.6% 17.5%;
|
441 |
--secondary-foreground: 210 40% 98%;
|
|
|
442 |
--muted: 217.2 32.6% 17.5%;
|
443 |
--muted-foreground: 215 20.2% 65.1%;
|
|
|
444 |
--accent: 217.2 32.6% 17.5%;
|
445 |
--accent-foreground: 210 40% 98%;
|
|
|
446 |
--destructive: 0 62.8% 30.6%;
|
447 |
--destructive-foreground: 210 40% 98%;
|
|
|
448 |
--border: 217.2 32.6% 17.5%;
|
449 |
--input: 217.2 32.6% 17.5%;
|
450 |
--ring: 224.9 98.6% 67.3%;
|
451 |
}
|
452 |
}
|
|
|
453 |
@layer components {
|
454 |
.container {
|
455 |
@apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
|
|
|
543 |
import { cn } from "@/lib/utils"
|
544 |
import { Slot } from "@radix-ui/react-slot"
|
545 |
import { cva } from "class-variance-authority";
|
|
|
546 |
const buttonVariants = cva(
|
547 |
"inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
|
548 |
{
|
|
|
571 |
},
|
572 |
}
|
573 |
)
|
|
|
574 |
const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
|
575 |
const Comp = asChild ? Slot : "button"
|
576 |
return (<Comp
|
|
|
578 |
ref={ref} {...props} />)
|
579 |
})
|
580 |
Button.displayName = "Button"
|
|
|
581 |
export { Button, buttonVariants }""",
|
582 |
"src/components/ui/card.jsx": """import * as React from "react"
|
583 |
import { cn } from "@/lib/utils"
|
|
|
584 |
const Card = React.forwardRef(({ className, ...props }, ref) => (<div
|
585 |
className={cn("rounded-lg border bg-card text-card-foreground shadow-sm", className)}
|
586 |
ref={ref}
|
587 |
{...props} />))
|
588 |
Card.displayName = "Card"
|
|
|
589 |
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (<div
|
590 |
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
591 |
ref={ref}
|
592 |
{...props} />))
|
593 |
CardHeader.displayName = "CardHeader"
|
|
|
594 |
const CardTitle = React.forwardRef(({ className, ...props }, ref) => (<h3
|
595 |
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
596 |
ref={ref}
|
597 |
{...props} />))
|
598 |
CardTitle.displayName = "CardTitle"
|
|
|
599 |
const CardDescription = React.forwardRef(({ className, ...props }, ref) => (<p
|
600 |
className={cn("text-sm text-muted-foreground", className)}
|
601 |
ref={ref}
|
602 |
{...props} />))
|
603 |
CardDescription.displayName = "CardDescription"
|
|
|
604 |
const CardContent = React.forwardRef(({ className, ...props }, ref) => (<div
|
605 |
className={cn("p-6 pt-0", className)}
|
606 |
ref={ref}
|
607 |
{...props} />))
|
608 |
CardContent.displayName = "CardContent"
|
|
|
609 |
const CardFooter = React.forwardRef(({ className, ...props }, ref) => (<div
|
610 |
className={cn("flex items-center p-6 pt-0", className)}
|
611 |
ref={ref}
|
612 |
{...props} />))
|
613 |
CardFooter.displayName = "CardFooter" "node_modules/colorette": {
|
614 |
"version": "2.0.20",
|
615 |
+
# "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
|
616 |
+
# "integrity": "sha512",
|
617 |
+
},
|
618 |
"fastapi": {
|
619 |
"files": {
|
620 |
"main.py": """from fastapi import FastAPI
|
621 |
|
622 |
app = FastAPI()
|
623 |
|
624 |
+
@app.get("/")
|
625 |
+
async def read_root():
|
626 |
+
return {"Hello": "World from FastAPI"}
|
627 |
+
""",
|
628 |
+
"requirements.txt": "fastapi\nuvicorn",
|
629 |
+
".gitignore": "__pycache__/\nvenv/\n"
|
630 |
+
}
|
|
|
|
|
631 |
},
|
632 |
"nextjs": {
|
633 |
"files": {
|
|
|
694 |
</div>
|
695 |
)
|
696 |
}""",
|
697 |
+
"styles/Home.module.css": """.container {
|
698 |
min-height: 100vh;
|
699 |
padding: 0 0.5rem;
|
700 |
display: flex;
|
|
|
815 |
},
|
816 |
"node_modules/@babel/code-frame": {
|
817 |
"version": "7.23.5",
|
818 |
+
#"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz",
|
819 |
+
#"integrity": "sha512-...",
|
820 |
"dependencies": {
|
821 |
"@babel/highlight": "^7.22.16"
|
822 |
},
|
|
|
826 |
},
|
827 |
"node_modules/@babel/highlight": {
|
828 |
"version": "7.23.4",
|
829 |
+
#"resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz",
|
830 |
+
#"integrity": "sha512-...",
|
831 |
"dependencies": {
|
832 |
"chalk": "^2.0.0",
|
833 |
"esutils": "^2.0.0"
|
|
|
838 |
},
|
839 |
"node_modules/@cnakazawa/describe-type": {
|
840 |
"version": "2.1.1",
|
841 |
+
#"resolved": "https://registry.npmjs.org/@cnakazawa/describe-type/-/describe-type-2.1.1.tgz",
|
842 |
+
#"integrity": "sha512-...",
|
843 |
},
|
844 |
"node_modules/@eslint/eslintrc": {
|
845 |
"version": "2.1.1",
|
846 |
+
#"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz",
|
847 |
+
#"integrity": "sha512-...",
|
848 |
"dependencies": {
|
849 |
"ajv": "^6.12.2",
|
850 |
"chalk": "^2.0.0",
|
|
|
862 |
},
|
863 |
"node_modules/@eslint/js": {
|
864 |
"version": "8.52.0",
|
865 |
+
#"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz",
|
866 |
+
#"integrity": "sha512-...",
|
867 |
"engines": {
|
868 |
"node": "^10.0.0 || >= 12.0.0"
|
869 |
}
|
870 |
},
|
871 |
"node_modules/@humanwhocodes/config-array": {
|
872 |
"version": "0.11.12",
|
873 |
+
# "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.12.tgz",
|
874 |
+
#"integrity": "sha512-...",
|
875 |
"dependencies": {
|
876 |
"@humanwhocodes/object-schema": "^1.2.1",
|
877 |
"debug": "^4.3.4",
|
|
|
883 |
},
|
884 |
"node_modules/@humanwhocodes/object-schema": {
|
885 |
"version": "1.2.1",
|
886 |
+
#"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
|
887 |
+
#"integrity": "sha512-...",
|
888 |
"engines": {
|
889 |
"node": ">=12"
|
890 |
}
|
891 |
},
|
892 |
"node_modules/@jest/types": {
|
893 |
"version": "29.6.3",
|
894 |
+
#"resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
|
895 |
+
#"integrity": "sha512-...",
|
896 |
"dependencies": {
|
897 |
"@types/jest": "*",
|
898 |
"@types/node": "*",
|
|
|
901 |
},
|
902 |
"node_modules/@next/env": {
|
903 |
"version": "14.0.0",
|
904 |
+
#"resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.0.tgz",
|
905 |
+
#"integrity": "sha512-...",
|
906 |
},
|
907 |
"node_modules/@npmcli/ci-detect": {
|
908 |
"version": "2.0.1",
|
909 |
+
#"resolved": "https://registry.npmjs.org/@npmcli/ci-detect/-/ci-detect-2.0.1.tgz",
|
910 |
+
#"integrity": "sha512-...",
|
911 |
},
|
912 |
"node_modules/@radix-ui/react-slot": {
|
913 |
+
"version": "1.0.2",
|
914 |
+
#"resolved": "https://registry.npmjs.org/@radix-ui/react-slot/-/react-slot-1.0.2.tgz",
|
915 |
+
#"integrity": "sha512-...",
|
916 |
},
|
917 |
"node_modules/@radix-ui/slot": {
|
918 |
"version": "1.0.2",
|
919 |
+
#"resolved": "https://registry.npmjs.org/@radix-ui/slot/-/slot-1.0.2.tgz",
|
920 |
+
#"integrity": "sha512-...",
|
921 |
"peerDependencies": {
|
922 |
"react": "*"
|
923 |
}
|
924 |
},
|
925 |
"node_modules/@rollup/plugin-commonjs": {
|
926 |
"version": "25.0.7",
|
927 |
+
#"resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.7.tgz",
|
928 |
+
#"integrity": "sha512-...",
|
929 |
"peerDependencies": {
|
930 |
"rollup": "^1.20.0||^2||^3"
|
931 |
},
|
|
|
937 |
},
|
938 |
"node_modules/@rollup/plugin-inject": {
|
939 |
"version": "5.1.0",
|
940 |
+
#"resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.1.0.tgz",
|
941 |
+
#"integrity": "sha512-...",
|
942 |
"peerDependencies": {
|
943 |
"rollup": "^1.20.0||^2||^3"
|
944 |
},
|
|
|
950 |
},
|
951 |
"node_modules/@stylistic/eslint-plugin-js": {
|
952 |
"version": "1.5.1",
|
953 |
+
#"resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.5.1.tgz",
|
954 |
+
#"integrity": "sha512-...",
|
955 |
"dependencies": {
|
956 |
"@stylistic/eslint-plugin-plus": "1.5.1",
|
957 |
"globals": "^13.20.0"
|
|
|
962 |
},
|
963 |
"node_modules/@stylistic/eslint-plugin-plus": {
|
964 |
"version": "1.5.1",
|
965 |
+
#"resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.5.1.tgz",
|
966 |
+
#"integrity": "sha512-...",
|
967 |
"peerDependencies": {
|
968 |
"eslint": ">=8.0.0"
|
969 |
}
|
970 |
},
|
971 |
+
"node_modules/@stylistic/js": {
|
972 |
+
"version": "1.5.1",
|
973 |
+
#"resolved": "https://registry.npmjs.org/@stylistic/js/-/js-1.5.1.tgz",
|
974 |
+
#"integrity": "sha512-...",
|
975 |
+
"engines": {
|
976 |
+
"node": ">=14.0.0"
|
977 |
+
}
|
978 |
},
|
979 |
"node_modules/@svgr/plugin-jsx": {
|
980 |
"version": "8.1.4",
|
981 |
+
#"resolved": "https://registry.npmjs.org/@svgr/plugin-jsx/-/plugin-jsx-8.1.4.tgz",
|
982 |
+
#"integrity": "sha512-...",
|
983 |
"dependencies": {
|
984 |
"@babel/plugin-syntax-jsx": "^7.18.6",
|
985 |
"@svgr/babel-preset": "8.1.4",
|
|
|
995 |
},
|
996 |
"node_modules/@tsconfig/cypress": {
|
997 |
"version": "3.0.0",
|
998 |
+
#"resolved": "https://registry.npmjs.org/@tsconfig/cypress/-/cypress-3.0.0.tgz",
|
999 |
+
#"integrity": "sha512-...",
|
1000 |
"peerDependencies": {
|
1001 |
"typescript": ">=4.5"
|
1002 |
}
|
1003 |
},
|
1004 |
"node_modules/@tsconfig/create-react-app": {
|
1005 |
"version": "2.0.1",
|
1006 |
+
#"resolved": "https://registry.npmjs.org/@tsconfig/create-react-app/-/create-react-app-2.0.1.tgz",
|
1007 |
+
#"integrity": "sha512-...",
|
1008 |
"peerDependencies": {
|
1009 |
"typescript": ">=3.8"
|
1010 |
}
|
1011 |
},
|
1012 |
"node_modules/@tsconfig/node-lts-strictest": {
|
1013 |
"version": "20.1.1",
|
1014 |
+
#"resolved": "https://registry.npmjs.org/@tsconfig/node-lts-strictest/-/node-lts-strictest-20.1.1.tgz",
|
1015 |
+
#"integrity": "sha512-...",
|
1016 |
"peerDependencies": {
|
1017 |
"typescript": ">=4.8"
|
1018 |
}
|
1019 |
},
|
1020 |
"node_modules/@types/babel__core": {
|
1021 |
"version": "7.20.3",
|
1022 |
+
#"resolved": "https://registry.npmjs.org/@types/babel__core/-/core-7.20.3.tgz",
|
1023 |
+
#"integrity": "sha512-...",
|
1024 |
"dependencies": {
|
1025 |
"@babel/parser": "*",
|
1026 |
"@types/babel__generator": "*",
|
|
|
1031 |
},
|
1032 |
"node_modules/@types/babel__generator": {
|
1033 |
"version": "7.6.8",
|
1034 |
+
#"resolved": "https://registry.npmjs.org/@types/babel__generator/-/generator-7.6.8.tgz",
|
1035 |
+
#"integrity": "sha512-...",
|
1036 |
},
|
1037 |
"node_modules/@types/babel__template": {
|
1038 |
"version": "7.4.5",
|
1039 |
+
#"resolved": "https://registry.npmjs.org/@types/babel__template/-/template-7.4.5.tgz",
|
1040 |
+
#"integrity": "sha512-...",
|
1041 |
},
|
1042 |
"node_modules/@types/babel__traverse": {
|
1043 |
"version": "7.20.5",
|
1044 |
+
#"resolved": "https://registry.npmjs.org/@types/babel__traverse/-/traverse-7.20.5.tgz",
|
1045 |
+
#"integrity": "sha512-...",
|
1046 |
"dependencies": {
|
1047 |
"@types/babel__parser": "*"
|
1048 |
}
|
1049 |
},
|
1050 |
"node_modules/@types/chalk": {
|
1051 |
"version": "2.2.0",
|
1052 |
+
#"resolved": "https://registry.npmjs.org/@types/chalk/-/chalk-2.2.0.tgz",
|
1053 |
+
#"integrity": "sha512-...",
|
1054 |
},
|
1055 |
"node_modules/@types/color-name": {
|
1056 |
"version": "1.1.3",
|
1057 |
+
#"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.3.tgz",
|
1058 |
+
#"integrity": "sha512-...",
|
1059 |
},
|
1060 |
"node_modules/@types/eslint": {
|
1061 |
"version": "8.44.7",
|
1062 |
+
#"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.7.tgz",
|
1063 |
+
#"integrity": "sha512-...",
|
1064 |
"dependencies": {
|
1065 |
"@jest/types": "*",
|
1066 |
"@types/estree": "*",
|
|
|
1070 |
},
|
1071 |
"node_modules/@types/estree": {
|
1072 |
"version": "2.0.0",
|
1073 |
+
#"resolved": "https://registry.npmjs.org/@types/estree/-/estree-2.0.0.tgz",
|
1074 |
+
#"integrity": "sha512-...",
|
1075 |
},
|
1076 |
"node_modules/@types/glob": {
|
1077 |
"version": "8.1.0",
|
1078 |
+
#"resolved": "https://registry.npmjs.org/@types/glob/-/glob-8.1.0.tgz",
|
1079 |
+
#"integrity": "sha512-...",
|
1080 |
"dependencies": {
|
1081 |
"@types/node": "*"
|
1082 |
}
|
1083 |
},
|
1084 |
"node_modules/@types/hoist-non-react-statics": {
|
1085 |
"version": "3.3.1",
|
1086 |
+
#"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz",
|
1087 |
+
#"integrity": "sha512-...",
|
1088 |
},
|
1089 |
"node_modules/@types/jest": {
|
1090 |
"version": "29.5.5",
|
1091 |
+
#"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.5.tgz",
|
1092 |
+
#"integrity": "sha512-...",
|
1093 |
"dependencies": {
|
1094 |
"@types/estree": "*",
|
1095 |
"@types/node": "*",
|
|
|
1101 |
},
|
1102 |
"node_modules/@types/json-schema": {
|
1103 |
"version": "7.0.12",
|
1104 |
+
#"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.12.tgz",
|
1105 |
+
#"integrity": "sha512-...",
|
1106 |
},
|
1107 |
"node_modules/@types/json5": {
|
1108 |
"version": "0.0.2",
|
1109 |
+
#"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.2.tgz",
|
1110 |
+
#"integrity": "sha512-...",
|
1111 |
},
|
1112 |
"node_modules/@types/minimatch": {
|
1113 |
"version": "5.1.0",
|
1114 |
+
#"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.0.tgz",
|
1115 |
+
#"integrity": "sha512-...",
|
1116 |
},
|
1117 |
"node_modules/@types/node": {
|
1118 |
"version": "20.8.9",
|
1119 |
+
#"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz",
|
1120 |
+
#"integrity": "sha512-...",
|
1121 |
},
|
1122 |
"node_modules/@types/parse-json": {
|
1123 |
"version": "4.0.0",
|
1124 |
+
#"resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz",
|
1125 |
+
#"integrity": "sha512-...",
|
1126 |
},
|
1127 |
"node_modules/@types/prettier": {
|
1128 |
"version": "2.7.3",
|
1129 |
+
#"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.7.3.tgz",
|
1130 |
+
#"integrity": "sha512-...",
|
1131 |
},
|
1132 |
"node_modules/@types/promises-aplus": {
|
1133 |
"version": "2.0.5",
|
1134 |
+
#"resolved": "https://registry.npmjs.org/@types/promises-aplus/-/promises-aplus-2.0.5.tgz",
|
1135 |
+
#"integrity": "sha512-...",
|
1136 |
"dependencies": {
|
1137 |
"@types/node": "*"
|
1138 |
}
|
1139 |
},
|
1140 |
"node_modules/@types/react": {
|
1141 |
"version": "18.2.33",
|
1142 |
+
#"resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.33.tgz",
|
1143 |
+
#"integrity": "sha512-...",
|
1144 |
"dependencies": {
|
1145 |
"@types/prop-types": "*",
|
1146 |
"@types/scheduler": "*",
|
|
|
1149 |
},
|
1150 |
"node_modules/@types/react-dom": {
|
1151 |
"version": "18.2.14",
|
1152 |
+
#"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.2.14.tgz",
|
1153 |
+
#"integrity": "sha512-...",
|
1154 |
"dependencies": {
|
1155 |
"@types/react": "*"
|
1156 |
}
|
1157 |
},
|
1158 |
"node_modules/@types/resolve": {
|
1159 |
"version": "1.20.2",
|
1160 |
+
#"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.20.2.tgz",
|
1161 |
+
#"integrity": "sha512-...",
|
1162 |
},
|
1163 |
"node_modules/@types/scheduler": {
|
1164 |
"version": "0.16.4",
|
1165 |
+
#"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.4.tgz",
|
1166 |
+
#"integrity": "sha512-...",
|
1167 |
},
|
1168 |
"node_modules/@types/semver": {
|
1169 |
"version": "7.5.3",
|
1170 |
+
#"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.3.tgz",
|
1171 |
+
#"integrity": "sha512-...",
|
1172 |
},
|
1173 |
"node_modules/@types/stack-trace-parser": {
|
1174 |
"version": "1.3.2",
|
1175 |
+
#"resolved": "https://registry.npmjs.org/@types/stack-trace-parser/-/stack-trace-parser-1.3.2.tgz",
|
1176 |
+
#"integrity": "sha512-...",
|
1177 |
},
|
1178 |
"node_modules/@types/testing-library__dom": {
|
1179 |
"version": "7.5.0",
|
1180 |
+
#"resolved": "https://registry.npmjs.org/@types/testing-library__dom/-/dom-7.5.0.tgz",
|
1181 |
+
#"integrity": "sha512-...",
|
1182 |
"dependencies": {
|
1183 |
"@types/node": "*"
|
1184 |
}
|
1185 |
},
|
1186 |
"node_modules/@types/ungap__structured-clone": {
|
1187 |
"version": "0.3.0",
|
1188 |
+
#"resolved": "https://registry.npmjs.org/@types/ungap__structured-clone/-/structured-clone-0.3.0.tgz",
|
1189 |
+
#"integrity": "sha512-...",
|
1190 |
},
|
1191 |
"node_modules/@vercel/nft": {
|
1192 |
"version": "0.25.0",
|
1193 |
+
#"resolved": "https://registry.npmjs.org/@vercel/nft/-/nft-0.25.0.tgz",
|
1194 |
+
#"integrity": "sha512-...",
|
1195 |
"dependencies": {
|
1196 |
"@types/glob": "^8.0.0",
|
1197 |
"cacache": "^16.1.0",
|
|
|
1208 |
},
|
1209 |
"node_modules/ajv": {
|
1210 |
"version": "6.12.6",
|
1211 |
+
#"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
|
1212 |
+
#"integrity": "sha512-...",
|
1213 |
"dependencies": {
|
1214 |
"fast-deep-equal": "^3.1.1",
|
1215 |
"json-schema-traverse": "^0.4.1",
|
|
|
1221 |
},
|
1222 |
"node_modules/ansi-styles": {
|
1223 |
"version": "3.2.1",
|
1224 |
+
#"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
1225 |
+
#"integrity": "sha512-...",
|
1226 |
"dependencies": {
|
1227 |
"color-convert": "^1.9.0"
|
1228 |
},
|
|
|
1232 |
},
|
1233 |
"node_modules/arg": {
|
1234 |
"version": "5.0.2",
|
1235 |
+
#"resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
|
1236 |
+
#"integrity": "sha512-...",
|
1237 |
"engines": {
|
1238 |
"node": ">=14"
|
1239 |
}
|
1240 |
},
|
1241 |
"node_modules/assert": {
|
1242 |
"version": "1.5.0",
|
1243 |
+
#"resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz",
|
1244 |
+
#"integrity": "sha512-...",
|
1245 |
"dependencies": {
|
1246 |
"ieee754": "^1.1.13",
|
1247 |
"util": "0.10.4"
|
|
|
1249 |
},
|
1250 |
"node_modules/autoprefixer": {
|
1251 |
"version": "10.4.16",
|
1252 |
+
#"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz",
|
1253 |
+
#"integrity": "sha512-...",
|
1254 |
"dependencies": {
|
1255 |
"browserslist": "^4.22.1",
|
1256 |
"caniuse-lite": "1.0.30015751",
|
|
|
1270 |
},
|
1271 |
"node_modules/balanced-match": {
|
1272 |
"version": "1.0.2",
|
1273 |
+
#"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
1274 |
+
#"integrity": "sha512-...",
|
1275 |
},
|
1276 |
"node_modules/browserslist": {
|
1277 |
"version": "4.22.2",
|
1278 |
+
#"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz",
|
1279 |
+
#"integrity": "sha512-...",
|
1280 |
"funding": {
|
1281 |
"type": "opencollective",
|
1282 |
"url": "https://opencollective.com/browserslist"
|
|
|
1287 |
},
|
1288 |
"node_modules/cacache": {
|
1289 |
"version": "16.1.1",
|
1290 |
+
#"resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.1.tgz",
|
1291 |
+
#"integrity": "sha512-...",
|
1292 |
"dependencies": {
|
1293 |
"@npmcli/ci-detect": "^2.0.0",
|
1294 |
"@npmcli/fs": "^3.1.0",
|
|
|
1312 |
},
|
1313 |
"node_modules/camelcase": {
|
1314 |
"version": "6.3.0",
|
1315 |
+
#"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz",
|
1316 |
+
#"integrity": "sha512-...",
|
1317 |
"engines": {
|
1318 |
"node": ">=10"
|
1319 |
}
|
1320 |
},
|
1321 |
"node_modules/caniuse-lite": {
|
1322 |
"version": "1.0.30015751",
|
1323 |
+
#"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30015751.tgz",
|
1324 |
+
#"integrity": "sha512-...",
|
1325 |
+
},
|
1326 |
+
"node_modules/chalk": {
|
1327 |
+
"version": "2.4.2",
|
1328 |
+
#"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
|
1329 |
+
#"integrity": "sha512-...",
|
1330 |
"dependencies": {
|
1331 |
"ansi-styles": "^3.2.1",
|
1332 |
"escape-string-regexp": "^1.0.5",
|
|
|
1338 |
},
|
1339 |
"node_modules/chokidar": {
|
1340 |
"version": "3.5.3",
|
1341 |
+
#"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
1342 |
+
#"integrity": "sha512-...",
|
1343 |
"dependencies": {
|
1344 |
"anymatch": "~3.1.3",
|
1345 |
"braces": "~3.0.2",
|
|
|
1358 |
},
|
1359 |
"node_modules/chownr": {
|
1360 |
"version": "3.0.0",
|
1361 |
+
#"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
1362 |
+
#"integrity": "sha512-...",
|
1363 |
"engines": {
|
1364 |
"node": ">=12"
|
1365 |
}
|
1366 |
},
|
1367 |
"node_modules/class-variance-authority": {
|
1368 |
"version": "0.7.0",
|
1369 |
+
#"resolved": "https://registry.npmjs.org/class-variance-authority/-/class-variance-authority-0.7.0.tgz",
|
1370 |
+
#"integrity": "sha512-...",
|
1371 |
},
|
1372 |
"node_modules/cli-boxes": {
|
1373 |
"version": "2.2.1",
|
1374 |
+
#"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz",
|
1375 |
+
#"integrity": "sha512-...",
|
1376 |
"engines": {
|
1377 |
"node": ">=12"
|
1378 |
}
|
1379 |
},
|
1380 |
"node_modules/clsx": {
|
1381 |
"version": "2.1.0",
|
1382 |
+
#"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.0.tgz",
|
1383 |
+
#"integrity": "sha512-...",
|
1384 |
},
|
1385 |
"node_modules/color-convert": {
|
1386 |
"version": "1.9.3",
|
1387 |
+
#"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
1388 |
+
#"integrity": "sha512-...",
|
1389 |
"dependencies": {
|
1390 |
"color-name": "1.1.3"
|
1391 |
},
|
|
|
1395 |
},
|
1396 |
"node_modules/color-name": {
|
1397 |
"version": "1.1.3",
|
1398 |
+
#"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
1399 |
+
#"integrity": "sha512-...",
|
1400 |
"engines": {
|
1401 |
"node": ">=0.1.90"
|
1402 |
}
|
1403 |
},
|
|
|
|
|
|
|
1404 |
|
1405 |
+
|
1406 |
+
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }""",
|
1407 |
+
"src/lib/utils.js": """import { clsx } from "clsx"
|
1408 |
+
import { twMerge } from "tailwind-merge"
|
1409 |
|
1410 |
+
export function cn(...inputs) {
|
1411 |
+
return twMerge(clsx(inputs))
|
1412 |
+
}"""
|
1413 |
+
},
|
1414 |
+
"post_process": "shadcn_setup"
|
|
|
|
|
1415 |
},
|
1416 |
}
|
|
|
1417 |
def get_file_content(owner, repo_name, path, branch="main"):
|
1418 |
"""Fetches file content from a GitHub repository."""
|
1419 |
url = f"https://raw.githubusercontent.com/{owner}/{repo_name}/{branch}/{path}"
|
|
|
1423 |
return response.text
|
1424 |
except requests.exceptions.RequestException as e:
|
1425 |
return f"Error fetching file: {e}"
|
|
|
|
|
1426 |
def extract_repo_info(url):
|
1427 |
"""Extracts owner and repo name from a GitHub URL."""
|
1428 |
match = re.search(r"github\.com/([^/]+)/([^/]+)", url)
|
1429 |
return match.group(1), match.group(2) if match else (None, None)
|
|
|
|
|
1430 |
def analyze_file_content(content, file_path):
|
1431 |
"""Analyzes file content and returns statistics."""
|
1432 |
lines = content.splitlines()
|
|
|
1438 |
"word_count": word_count,
|
1439 |
"file_extension": file_extension,
|
1440 |
}
|
|
|
|
|
1441 |
def github_tool(
|
1442 |
action: str,
|
1443 |
repo_name: str = None,
|
|
|
1469 |
):
|
1470 |
"""Manages GitHub repositories."""
|
1471 |
user = g.get_user()
|
|
|
1472 |
try:
|
1473 |
if action == "import_repository":
|
1474 |
if not all([owner, repo_name, vcs_url]):
|
|
|
1478 |
return "Repository already exists."
|
1479 |
except GithubException:
|
1480 |
pass
|
|
|
1481 |
headers = {
|
1482 |
'Authorization': f'token {GITHUB_TOKEN}',
|
1483 |
'Accept': 'application/vnd.github.v3+json',
|
|
|
1486 |
response = requests.put(import_url, json={'vcs_url': vcs_url, 'vcs': 'git'}, headers=headers)
|
1487 |
response.raise_for_status()
|
1488 |
return "Repository import started."
|
|
|
1489 |
elif action == "create_repository":
|
1490 |
if not repo_name:
|
1491 |
raise ValueError("Missing parameter: repo_name")
|
1492 |
repo = user.create_repo(name=repo_name)
|
1493 |
return f"Repository **{repo_name}** created! [Open repository]({repo.html_url})"
|
|
|
1494 |
elif action == "create_project_from_template":
|
1495 |
if not all([repo_name, template_name]):
|
1496 |
raise ValueError("Missing parameters: repo_name, template_name")
|
|
|
1500 |
)
|
1501 |
repo = user.create_repo(name=repo_name)
|
1502 |
template = PROJECT_TEMPLATES[template_name]
|
|
|
1503 |
template_params_final = {}
|
1504 |
if "params" in template:
|
1505 |
for param_name, param_config in template["params"].items():
|
1506 |
template_params_final[param_name] = template_params.get(param_name, param_config.get("default")) if template_params else param_config.get("default")
|
|
|
1507 |
repo_name_snake_case = repo_name.replace("-", "_")
|
1508 |
readme_filename = "README.md"
|
|
|
1509 |
env = jinja2.Environment()
|
|
|
1510 |
for file_path, file_content in template["files"].items():
|
1511 |
final_file_path = file_path
|
1512 |
final_file_content = file_content
|
|
|
1513 |
if "rename_files" in template:
|
1514 |
for old_name, new_name_template in template["rename_files"].items():
|
1515 |
if file_path == old_name:
|
1516 |
final_file_path = new_name_template.replace("{{repo_name_snake_case}}", repo_name_snake_case).replace("{{repo_name}}", repo_name).replace("{{readme_filename}}", readme_filename)
|
|
|
1517 |
template_render = env.from_string(final_file_content)
|
1518 |
final_file_content = template_render.render(
|
1519 |
repo_name=repo_name,
|
|
|
1521 |
readme_filename=readme_filename,
|
1522 |
**template_params_final
|
1523 |
)
|
|
|
1524 |
repo.create_file(
|
1525 |
final_file_path,
|
1526 |
f"Create {final_file_path} from template {template_name}",
|
1527 |
final_file_content,
|
1528 |
branch="main",
|
1529 |
)
|
|
|
1530 |
if "post_process" in template:
|
1531 |
post_process_action = template["post_process"]
|
1532 |
if post_process_action == "install_dependencies":
|
|
|
1547 |
return f"Repository **{repo_name}** created from template **{template_name}**! [Open repository]({repo.html_url})\n\n{instructions}"
|
1548 |
else:
|
1549 |
print(f"Unknown post-process action: {post_process_action}")
|
|
|
1550 |
return f"Repository **{repo_name}** created from template **{template_name}**! [Open repository]({repo.html_url})"
|
|
|
1551 |
elif action == "create_file":
|
1552 |
if not all([repo_name, path, content, message]):
|
1553 |
raise ValueError("Missing parameters: repo_name, path, content, message")
|
1554 |
repo = user.get_repo(repo_name)
|
1555 |
repo.create_file(path, message, content, branch=branch)
|
1556 |
return f"File **`{path}`** created in repository **`{repo_name}`** on branch **`{branch}`**."
|
|
|
1557 |
elif action == "get_file":
|
1558 |
if not all([repo_name, path]):
|
1559 |
raise ValueError("Missing parameters: repo_name, path")
|
|
|
1562 |
return (
|
1563 |
f"File content of **`{path}`** from **`{repo_name}`**:\n\n`\n{file_content.decoded_content.decode()}\n`"
|
1564 |
)
|
|
|
1565 |
elif action == "get_file_content_by_url":
|
1566 |
if not file_url:
|
1567 |
raise ValueError("Missing parameter: file_url")
|
1568 |
file_content = get_file_content(None, None, None, None)
|
1569 |
return f"File content from URL **`{file_url}`**:\n\n`\n{file_content}\n`"
|
|
|
1570 |
elif action == "delete_file":
|
1571 |
if not all([repo_name, path]):
|
1572 |
raise ValueError("Missing parameters: repo_name, path")
|
|
|
1574 |
file_contents = repo.get_contents(path, ref=branch)
|
1575 |
repo.delete_file(path, "Delete file", file_contents.sha, branch=branch)
|
1576 |
return f"File **`{path}`** deleted from repository **`{repo_name}`** on branch **`{branch}`**."
|
|
|
1577 |
elif action == "update_file":
|
1578 |
if not all([repo_name, path, content, message]):
|
1579 |
raise ValueError("Missing parameters: repo_name, path, content, message")
|
|
|
1581 |
file_contents = repo.get_contents(path, ref=branch)
|
1582 |
repo.update_file(path, message, content, file_contents.sha, branch=branch)
|
1583 |
return f"File **`{path}`** updated in repository **`{repo_name}`** on branch **`{branch}`**."
|
|
|
1584 |
elif action == "update_file_diff":
|
1585 |
if not all([repo_name, path, diff, diff_message]):
|
1586 |
raise ValueError("Missing parameters: repo_name, path, diff, diff_message")
|
1587 |
repo = user.get_repo(repo_name)
|
1588 |
file_contents = repo.get_contents(path, ref=branch)
|
1589 |
current_content_text = file_contents.decoded_content.decode()
|
|
|
1590 |
dmp = diff_match_patch()
|
|
|
1591 |
try:
|
1592 |
patches = dmp.patch_fromText(diff)
|
1593 |
except ValueError:
|
1594 |
raise ValueError("Invalid patch format. Please provide a valid patch in 'diff' format.")
|
|
|
1595 |
patched_content_tuple = dmp.patch_apply(patches, current_content_text)
|
1596 |
patched_content_text = patched_content_tuple[0]
|
1597 |
patch_results = patched_content_tuple[1]
|
|
|
1598 |
if not any(patch_results):
|
1599 |
raise ValueError("Failed to apply patch. Diff might be outdated or invalid.")
|
|
|
1600 |
repo.update_file(path, diff_message, patched_content_text, file_contents.sha, branch=branch)
|
1601 |
return f"File **`{path}`** updated using diff in repository **`{repo_name}`** on branch **`{branch}`**."
|
|
|
|
|
1602 |
elif action == "list_branches":
|
1603 |
if not repo_name:
|
1604 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1606 |
branches = repo.get_branches()
|
1607 |
branch_list = "\n".join([f"- `{branch.name}`" for branch in branches])
|
1608 |
return f"Branches in repository **`{repo_name}`**:\n{branch_list}"
|
|
|
1609 |
elif action == "create_branch":
|
1610 |
if not all([repo_name, base, head]):
|
1611 |
raise ValueError("Missing parameters: repo_name, base, head")
|
|
|
1613 |
source_branch = repo.get_branch(base)
|
1614 |
repo.create_git_ref(ref=f"refs/heads/{head}", sha=source_branch.commit.sha)
|
1615 |
return f"Branch **`{head}`** created from **`{base}`** in repository **`{repo_name}`**."
|
|
|
1616 |
elif action == "delete_branch":
|
1617 |
if not all([repo_name, branch]):
|
1618 |
raise ValueError("Missing parameters: repo_name, branch")
|
1619 |
repo = user.get_repo(repo_name)
|
1620 |
repo.get_git_ref(f"heads/{branch}").delete()
|
1621 |
return f"Branch **`{branch}`** deleted from repository **`{repo_name}`**."
|
|
|
1622 |
elif action == "create_pull_request":
|
1623 |
if not all([repo_name, title, body, base, head]):
|
1624 |
raise ValueError("Missing parameters: repo_name, title, body, base, head")
|
1625 |
repo = user.get_repo(repo_name)
|
1626 |
pr = repo.create_pull(title=title, body=body, base=base, head=head)
|
1627 |
return f"Pull request created! [Open Pull Request]({pr.html_url})"
|
|
|
1628 |
elif action == "list_open_pull_requests":
|
1629 |
if not repo_name:
|
1630 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1634 |
return f"No open pull requests in repository **`{repo_name}`**."
|
1635 |
prs_list = "\n".join([f"- [{pr.title}]({pr.html_url})" for pr in open_prs])
|
1636 |
return f"Open pull requests in repository **`{repo_name}`**:\n{prs_list}"
|
|
|
1637 |
elif action == "create_issue":
|
1638 |
if not all([repo_name, title, body]):
|
1639 |
raise ValueError("Missing parameters: repo_name, title, body")
|
1640 |
repo = user.get_repo(repo_name)
|
1641 |
issue = repo.create_issue(title=title, body=body)
|
1642 |
return f"Issue created! [Open Issue]({issue.html_url})"
|
|
|
1643 |
elif action == "list_issues":
|
1644 |
if not repo_name:
|
1645 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1649 |
return f"No open issues in repository **`{repo_name}`**."
|
1650 |
issues_list = "\n".join([f"- [{issue.title}]({issue.html_url})" for issue in issues])
|
1651 |
return f"Open issues in repository **`{repo_name}`**:\n{issues_list}"
|
|
|
1652 |
elif action == "add_label_to_issue":
|
1653 |
if not all([repo_name, issue_number, labels]):
|
1654 |
raise ValueError("Missing parameters: repo_name, issue_number, labels")
|
|
|
1659 |
return (
|
1660 |
f"Labels **`{labels}`** added to issue **#{issue_number}** in repository **`{repo_name}`**."
|
1661 |
)
|
|
|
1662 |
elif action == "close_issue":
|
1663 |
if not all([repo_name, issue_number]):
|
1664 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
|
|
1666 |
issue = repo.get_issue(number=int(issue_number))
|
1667 |
issue.edit(state='closed')
|
1668 |
return f"Issue **#{issue_number}** closed in repository **`{repo_name}`**."
|
|
|
1669 |
elif action == "add_comment_to_issue":
|
1670 |
if not all([repo_name, issue_number, message]):
|
1671 |
raise ValueError("Missing parameters: repo_name, issue_number, message")
|
|
|
1673 |
issue = repo.get_issue(number=int(issue_number))
|
1674 |
issue.create_comment(body=message)
|
1675 |
return f"Comment added to issue **#{issue_number}** in repository **`{repo_name}`**."
|
|
|
1676 |
elif action == "create_release":
|
1677 |
if not all([repo_name, tag, name, message]):
|
1678 |
raise ValueError("Missing parameters: repo_name, tag, name, message")
|
|
|
1681 |
return (
|
1682 |
f"Release **`{name}`** created in repository **`{repo_name}`**! [Open Release]({release.html_url})"
|
1683 |
)
|
|
|
1684 |
elif action == "list_releases":
|
1685 |
if not repo_name:
|
1686 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1690 |
return f"No releases in repository **`{repo_name}`**."
|
1691 |
releases_list = "\n".join([f"- [{release.tag_name}]({release.html_url})" for release in releases])
|
1692 |
return f"Releases in repository **`{repo_name}`**:\n{releases_list}"
|
|
|
1693 |
elif action == "fork_repository":
|
1694 |
if not repo_name:
|
1695 |
raise ValueError("Missing parameter: repo_name")
|
1696 |
repo = g.get_repo(repo_name)
|
1697 |
fork = user.create_fork(repo)
|
1698 |
return f"Repository **`{repo_name}`** forked! [Open fork]({fork.html_url})"
|
|
|
1699 |
elif action == "list_forks":
|
1700 |
if not repo_name:
|
1701 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1705 |
return f"No forks of repository **`{repo_name}`**."
|
1706 |
forks_list = "\n".join([f"- [{fork.full_name}]({fork.html_url})" for fork in forks])
|
1707 |
return f"Forks of repository **`{repo_name}`**:\n{forks_list}"
|
|
|
1708 |
elif action == "list_files":
|
1709 |
if not all([owner, repo_name]):
|
1710 |
raise ValueError("Missing parameters: owner, repo_name")
|
|
|
1714 |
return f"No files in path **`{path}`** of repository **`{repo_name}`**."
|
1715 |
files_list = "\n".join([f"- [{content.name}]({content.download_url})" for content in contents])
|
1716 |
return f"Files in path **`{path}`** of repository **`{repo_name}`**:\n{files_list}"
|
|
|
1717 |
elif action == "get_repository_info":
|
1718 |
if not all([owner, repo_name]):
|
1719 |
raise ValueError("Missing parameters: owner, repo_name")
|
|
|
1732 |
}
|
1733 |
info_md = "\n".join([f"- **{key}**: {value}" for key, value in info.items()])
|
1734 |
return f"Repository info for **`{repo_name}`**:\n{info_md}"
|
|
|
1735 |
elif action == "get_file_content":
|
1736 |
if not all([owner, repo_name, path]):
|
1737 |
raise ValueError("Missing parameters: owner, repo_name, path")
|
|
|
1739 |
return (
|
1740 |
f"File content of **`{path}`** from repository **`{repo_name}`**:\n\n`\n{content_text}\n`"
|
1741 |
)
|
|
|
1742 |
elif action == "analyze_repository_by_url":
|
1743 |
if not repo_url:
|
1744 |
raise ValueError("Missing parameter: repo_url")
|
1745 |
owner, repo_name = extract_repo_info(repo_url)
|
1746 |
if not owner or not repo_name:
|
1747 |
raise ValueError("Invalid repository URL")
|
|
|
1748 |
repo = g.get_repo(f"{owner}/{repo_name}")
|
1749 |
contents = repo.get_contents("")
|
1750 |
file_analyses = []
|
|
|
1765 |
for f in file_analyses
|
1766 |
])
|
1767 |
return analysis_md
|
|
|
1768 |
elif action == "analyze_repository_content":
|
1769 |
if not all([owner, repo_name]):
|
1770 |
raise ValueError("Missing parameters: owner, repo_name")
|
|
|
1788 |
for f in file_analyses
|
1789 |
])
|
1790 |
return analysis_md
|
|
|
1791 |
elif action == "delete_repository":
|
1792 |
if not repo_name:
|
1793 |
raise ValueError("Missing parameter: repo_name")
|
1794 |
repo = user.get_repo(repo_name)
|
1795 |
repo.delete()
|
1796 |
return f"Repository **`{repo_name}`** deleted!"
|
|
|
1797 |
elif action == "update_repository_description":
|
1798 |
if not all([repo_name, new_description]):
|
1799 |
raise ValueError("Missing parameters: repo_name, new_description")
|
1800 |
repo = user.get_repo(repo_name)
|
1801 |
repo.edit(description=new_description)
|
1802 |
return f"Repository **`{repo_name}`** description updated to: \"{new_description}\""
|
|
|
1803 |
elif action == "edit_issue":
|
1804 |
if not all([repo_name, issue_number]):
|
1805 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
|
|
1817 |
issue.edit(**issue_update_params)
|
1818 |
updated_fields = ", ".join(issue_update_params.keys())
|
1819 |
return f"Issue **#{issue_number}** in repository **`{repo_name}`** updated fields: {updated_fields}"
|
|
|
1820 |
elif action == "list_closed_issues":
|
1821 |
if not repo_name:
|
1822 |
raise ValueError("Missing parameter: repo_name")
|
|
|
1826 |
return f"No closed issues in repository **`{repo_name}`**."
|
1827 |
issues_list = "\n".join([f"- [{issue.title}]({issue.html_url})" for issue in issues])
|
1828 |
return f"Closed issues in repository **`{repo_name}`**:\n{issues_list}"
|
|
|
1829 |
elif action == "get_issue_details":
|
1830 |
if not all([repo_name, issue_number]):
|
1831 |
raise ValueError("Missing parameters: repo_name, issue_number")
|
|
|
1853 |
"""
|
1854 |
else:
|
1855 |
details += "No comments."
|
|
|
1856 |
return details
|
|
|
1857 |
else:
|
1858 |
raise ValueError(f"Unknown action: {action}")
|
|
|
1859 |
except GithubException as e:
|
1860 |
return f"**GitHub Error:** {e}"
|
1861 |
except ValueError as e:
|
|
|
1864 |
return f"**Connection Error:** {e}"
|
1865 |
except Exception as e:
|
1866 |
return f"**Unexpected Error:** {e}"
|
|
|
|
|
1867 |
with gr.Blocks() as demo:
|
1868 |
gr.Markdown("# GitHub Tool Plugingit (Simplified Interface)")
|
|
|
1869 |
with gr.Column():
|
1870 |
action = gr.Dropdown(
|
1871 |
choices=[
|
|
|
1909 |
value=param_details["default"] if "default" in param_details else ""
|
1910 |
)
|
1911 |
template_params_ui[template_key] = params_section
|
|
|
1912 |
branch = gr.Textbox(label="Branch", value="main")
|
1913 |
path = gr.Textbox(label="File Path")
|
1914 |
content = gr.Code(label="File Content", lines=5, language='python', visible=True)
|
|
|
1931 |
issue_title = gr.Textbox(label="New Issue Title", visible=False)
|
1932 |
issue_body = gr.Textbox(label="New Issue Body", visible=False, lines=3)
|
1933 |
issue_state = gr.Dropdown(label="New Issue State (open/closed)", choices=["open", "closed", None], value=None, allow_none=True, visible=False)
|
|
|
1934 |
def show_template_params(template_name):
|
1935 |
visibility_map = {key: gr.Column.update(visible=False) for key in PROJECT_TEMPLATES if
|
1936 |
"params" in PROJECT_TEMPLATES[key]}
|
|
|
1938 |
visibility_map[template_name] = gr.Column.update(visible=True)
|
1939 |
return [visibility_map.get(key, gr.Column.update(visible=False)) for key in PROJECT_TEMPLATES if
|
1940 |
"params" in PROJECT_TEMPLATES[key]]
|
|
|
1941 |
template_param_visibility_outputs = [template_params_ui[key] for key in PROJECT_TEMPLATES if
|
1942 |
"params" in PROJECT_TEMPLATES[key]]
|
1943 |
template_name.change(
|
|
|
1945 |
inputs=[template_name],
|
1946 |
outputs=template_param_visibility_outputs
|
1947 |
)
|
|
|
1948 |
run_button = gr.Button("Execute")
|
1949 |
output = gr.Markdown(label="Result")
|
|
|
1950 |
input_components = [
|
1951 |
action, repo_name, branch, path, content, message, owner, vcs_url, title, body, base, head, issue_number,
|
1952 |
labels, tag, release_name, file_url, repo_url, template_name, new_description, issue_title, issue_body,
|
1953 |
issue_state, diff, diff_message
|
1954 |
]
|
|
|
1955 |
for template_key in PROJECT_TEMPLATES:
|
1956 |
if "params" in PROJECT_TEMPLATES[template_key]:
|
1957 |
for param_name in template_params_ui:
|
1958 |
+
if param_name in
|
1959 |
+
Use code with caution.
|
1960 |
+
Python
|
1961 |
+
57.3s
|
1962 |
+
kontynuuj
|
1963 |
|
1964 |
+
PROJECT_TEMPLATES[template_key]["params"]:
|
1965 |
+
input_components.append(template_params_ui[param_name])
|
1966 |
def show_hide_input_fields(action_name):
|
1967 |
visibility_map = {
|
1968 |
"repo_name": gr.Textbox.update(visible=False),
|
|
|
1990 |
"issue_body": gr.Textbox.update(visible=False),
|
1991 |
"issue_state": gr.Dropdown.update(visible=False),
|
1992 |
}
|
|
|
1993 |
if action_name in ["import_repository"]:
|
1994 |
visibility_map.update({"repo_name": gr.Textbox.update(visible=True), "owner": gr.Textbox.update(visible=True), "vcs_url": gr.Textbox.update(visible=True)})
|
1995 |
elif action_name in ["create_repository", "delete_repository", "list_branches", "list_open_pull_requests", "list_issues", "list_closed_issues", "list_releases", "list_forks"]:
|
|
|
2032 |
visibility_map.update({"repo_url": gr.Textbox.update(visible=True)})
|
2033 |
elif action_name == "update_repository_description":
|
2034 |
visibility_map.update({"repo_name": gr.Textbox.update(visible=True), "new_description": gr.Textbox.update(visible=True)})
|
|
|
|
|
2035 |
return [visibility_map.get(key, gr.Textbox.update(visible=False)) for key in visibility_map]
|
|
|
2036 |
output_components_visibility = [
|
2037 |
repo_name, branch, path, content, message, owner, vcs_url, title, body, base, head, issue_number, labels,
|
2038 |
tag, release_name, file_url, repo_url, template_name, new_description, issue_title, issue_body,
|
2039 |
issue_state, diff, diff_message
|
2040 |
]
|
|
|
2041 |
action.change(
|
2042 |
show_hide_input_fields,
|
2043 |
inputs=[action],
|
2044 |
outputs=output_components_visibility
|
2045 |
)
|
|
|
|
|
2046 |
run_button.click(
|
2047 |
github_tool,
|
2048 |
inputs=input_components,
|
2049 |
outputs=output,
|
2050 |
api_name="github_tool"
|
2051 |
)
|
|
|
2052 |
demo.launch()
|