@autobe/filesystem 0.14.0-dev.20250727
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +212 -0
- package/lib/FileSystemIterator.d.ts +1 -0
- package/lib/FileSystemIterator.js +60 -0
- package/lib/FileSystemIterator.js.map +1 -0
- package/lib/RepositoryFileSystem.d.ts +1 -0
- package/lib/RepositoryFileSystem.js +78 -0
- package/lib/RepositoryFileSystem.js.map +1 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/package.json +34 -0
- package/src/FileSystemIterator.ts +53 -0
- package/src/RepositoryFileSystem.ts +92 -0
- package/src/index.ts +2 -0
package/README.md
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# AutoBE - No-Code Agent for Backend Applications
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
```mermaid
|
|
6
|
+
flowchart
|
|
7
|
+
subgraph "Backend Coding Agent"
|
|
8
|
+
coder("Facade Controller")
|
|
9
|
+
end
|
|
10
|
+
subgraph "Functional Agents"
|
|
11
|
+
coder --"Requirements Analysis"--> analyze("Analyze")
|
|
12
|
+
coder --"ERD"--> prisma("Prisma")
|
|
13
|
+
coder --"API Design"--> interface("Interface")
|
|
14
|
+
coder --"Test Codes" --> test("Test")
|
|
15
|
+
coder --"Main Program" --> realize("Realize")
|
|
16
|
+
end
|
|
17
|
+
subgraph "Compiler Feedback"
|
|
18
|
+
prisma --"validates" --> prismaCompiler("Prisma Compiler")
|
|
19
|
+
interface --"validates" --> openapiValidator("OpenAPI Validator")
|
|
20
|
+
interface --"generates" --> tsCompiler("TypeScript Compiler")
|
|
21
|
+
test --"validates" --> tsCompiler("TypeScript Compiler")
|
|
22
|
+
realize --"validates" --> tsCompiler("TypeScript Compiler")
|
|
23
|
+
end
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
[](https://github.com/wrtnlabs/autobe/blob/master/LICENSE)
|
|
27
|
+
[](https://www.npmjs.com/package/@autobe/agent)
|
|
28
|
+
[](https://www.npmjs.com/package/@autobe/agent)
|
|
29
|
+
[](https://github.com/wrtnlabs/autobe/actions?query=workflow%3Abuild)
|
|
30
|
+
[](https://wrtnlabs.io/autobe/docs/)
|
|
31
|
+
[](https://discord.gg/aMhRmzkqCx)
|
|
32
|
+
|
|
33
|
+
[](https://www.bloomberg.com/news/videos/2025-03-31/wtrn-on-series-b-funding-growth-strategy-video)
|
|
34
|
+
[](https://github.com/wrtnlabs)
|
|
35
|
+
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
An AI-powered no-code agent that builds backend applications, enhanced by compiler feedback.
|
|
39
|
+
|
|
40
|
+
`@autobe` is a no-code AI agent that analyzes user requirements and automatically generates backend applications using the stack below, following a waterfall development model. Since `@autobe`-generated code is validated by review agents and OpenAPI/TypeScript/Prisma compilers, it delivers 100% working code.
|
|
41
|
+
|
|
42
|
+
- TypeScript
|
|
43
|
+
- NestJS
|
|
44
|
+
- Prisma (Postgres / SQLite)
|
|
45
|
+
|
|
46
|
+
## Playground
|
|
47
|
+
|
|
48
|
+
https://github.com/user-attachments/assets/b995dd2a-23bd-43c9-96cb-96d5c805f19f
|
|
49
|
+
|
|
50
|
+
[https://stackblitz.com/github/wrtnlabs/autobe-playground-stackblitz](https://stackblitz.com/github/wrtnlabs/autobe-playground-stackblitz?file=md!README.md)
|
|
51
|
+
|
|
52
|
+
Experience the `@autobe` agent through our interactive playground above.
|
|
53
|
+
|
|
54
|
+
To see examples of backend applications generated by `@autobe`, explore these interactive demos. These showcase `@autobe`'s ability to generate production-ready backend code with proper structure, API documentation, and TypeScript interfaces. If you're unsure what to try, start with the BBS example script below.
|
|
55
|
+
|
|
56
|
+
- [BBS (Bulletin Board System)](https://github.com/wrtnlabs/autobe-example-bbs)
|
|
57
|
+
1. I want to create a political/economic discussion board. Since I'm not familiar with programming, please write a requirements analysis report as you see fit.
|
|
58
|
+
2. Design the database schema.
|
|
59
|
+
3. Create the API interface specification.
|
|
60
|
+
4. Make the e2e test functions.
|
|
61
|
+
- [E-Commerce](https://github.com/wrtnlabs/autobe-example-shopping)
|
|
62
|
+
|
|
63
|
+
## Documentation Resources
|
|
64
|
+
|
|
65
|
+
Find comprehensive resources at our [official website](https://wrtnlabs.io/autobe).
|
|
66
|
+
|
|
67
|
+
### π Home
|
|
68
|
+
|
|
69
|
+
- ππ»ββοΈ [Introduction](https://wrtnlabs.io/autobe/docs)
|
|
70
|
+
- π¦ [Setup](https://wrtnlabs.io/autobe/docs/setup)
|
|
71
|
+
- π Concepts
|
|
72
|
+
- [Waterfall Model](https://wrtnlabs.io/autobe/docs/concepts/waterfall)
|
|
73
|
+
- [Compiler Strategy](https://wrtnlabs.io/autobe/docs/concepts/compiler)
|
|
74
|
+
- [AI Function Calling](https://wrtnlabs.io/autobe/docs/concepts/function-calling)
|
|
75
|
+
|
|
76
|
+
### π Features
|
|
77
|
+
|
|
78
|
+
- π€ Agent Library
|
|
79
|
+
- [Facade Controller](https://wrtnlabs.io/autobe/docs/agent/facade)
|
|
80
|
+
- [Configuration](https://wrtnlabs.io/autobe/docs/agent/config)
|
|
81
|
+
- [Event Handling](https://wrtnlabs.io/autobe/docs/agent/event)
|
|
82
|
+
- [Prompt Histories](https://wrtnlabs.io/autobe/docs/agent/history)
|
|
83
|
+
- π‘ WebSocket Protocol
|
|
84
|
+
- [Remote Procedure Call](https://wrtnlabs.io/autobe/docs/websocket/rpc)
|
|
85
|
+
- [NestJS Server](https://wrtnlabs.io/autobe/docs/websocket/nestjs)
|
|
86
|
+
- [NodeJS Server](https://wrtnlabs.io/autobe/docs/websocket/nodejs)
|
|
87
|
+
- [Client Application](https://wrtnlabs.io/autobe/docs/websocket/client)
|
|
88
|
+
- π οΈ Backend Stack
|
|
89
|
+
- [TypeScript](https://wrtnlabs.io/autobe/docs/stack/typescript)
|
|
90
|
+
- [Prisma ORM](https://wrtnlabs.io/autobe/docs/stack/prisma)
|
|
91
|
+
- [NestJS Framework](https://wrtnlabs.io/autobe/docs/stack/nestjs)
|
|
92
|
+
|
|
93
|
+
### π Appendix
|
|
94
|
+
|
|
95
|
+
- π [No-Code Ecosystem](https://wrtnlabs.io/autobe/docs/ecosystem)
|
|
96
|
+
- π
Roadmap
|
|
97
|
+
- [Alpha Release (completed)](https://wrtnlabs.io/autobe/docs/roadmap/alpha)
|
|
98
|
+
- [Beta Release (in progress)](https://wrtnlabs.io/autobe/docs/roadmap/beta)
|
|
99
|
+
- [v1.0 Official Release (planned)](https://wrtnlabs.io/autobe/docs/roadmap/v1.0)
|
|
100
|
+
- π§ [API Documentation](https://wrtnlabs.io/autobe/api)
|
|
101
|
+
|
|
102
|
+
## No-Code Ecosystem
|
|
103
|
+
|
|
104
|
+

|
|
105
|
+
|
|
106
|
+
> A 70-year-old grandmother who grows tomatoes in the countryside created an online debate website in just 10 minutes. Despite being unfamiliar with coding or computers, she built this current affairs and [economics discussion community](https://github.dev/wrtnlabs/autobe-example-bbs) simply by talking with Wrtn's AI. What's remarkable is that users can write posts and comments entirely through voice commands and even engage in current affairs debates with AI.
|
|
107
|
+
>
|
|
108
|
+
> The next day, the grandmother spent another 20 minutes launching an [agricultural products shopping mall](https://github.dev/wrtnlabs/autobe-example-shopping). Customers can simply say "I'd like to order 2kg of tomatoes" to complete their purchase, while the grandmother manages everything from orders and shipping to inventory through simple chat conversations.
|
|
109
|
+
|
|
110
|
+
This is the vision that we, the [WrtnLabs](https://github.com/wrtnlabs) team, are pursuing. We aim to create a world where anyone can build backend servers, AI chatbots, and frontend applications without any coding knowledgeβsimply by conversing with AI.
|
|
111
|
+
|
|
112
|
+
To realize this vision, the [WrtnLabs](https://github.com/wrtnlabs) team is developing two additional projects: [`@agentica`](https://github.com/wrtnlabs/agentica) and [`@autoview`](https://github.com/wrtnlabs/autoview).
|
|
113
|
+
|
|
114
|
+
- **`@agentica`**: Automatically creates AI chatbots when you provide a `swagger.json` file
|
|
115
|
+
- **`@autoview`**: Automatically generates frontend applications when you provide a `swagger.json` file
|
|
116
|
+
|
|
117
|
+
You're not limited to just creating backends with `@autobe`. Once you've built a no-code backend application through `@autobe`, you can immediately create an AI chatbot and frontend applications alongside it.
|
|
118
|
+
|
|
119
|
+
Can you converse? Then you're a full-stack developer.
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { Agentica, assertHttpController } from "@agentica/core";
|
|
123
|
+
import OpenAI from "openai";
|
|
124
|
+
import typia from "typia";
|
|
125
|
+
|
|
126
|
+
import { MobileFileSystem } from "./services/MobileFileSystem";
|
|
127
|
+
|
|
128
|
+
const agent = new Agentica({
|
|
129
|
+
vendor: {
|
|
130
|
+
api: new OpenAI({ apiKey: "********" }),
|
|
131
|
+
model: "gpt-4o-mini",
|
|
132
|
+
},
|
|
133
|
+
controllers: [
|
|
134
|
+
// functions from TypeScript class
|
|
135
|
+
typia.llm.controller<MobileFileSystem, "chatgpt">(
|
|
136
|
+
"filesystem",
|
|
137
|
+
MobileFileSystem(),
|
|
138
|
+
),
|
|
139
|
+
// functions from Swagger/OpenAPI
|
|
140
|
+
assertHttpController({
|
|
141
|
+
name: "shopping",
|
|
142
|
+
model: "chatgpt",
|
|
143
|
+
document: await fetch(
|
|
144
|
+
"https://shopping-be.wrtn.ai/editor/swagger.json",
|
|
145
|
+
).then(r => r.json()),
|
|
146
|
+
connection: {
|
|
147
|
+
host: "https://shopping-be.wrtn.ai",
|
|
148
|
+
headers: { Authorization: "Bearer ********" },
|
|
149
|
+
},
|
|
150
|
+
}),
|
|
151
|
+
],
|
|
152
|
+
});
|
|
153
|
+
await agent.conversate("I wanna buy MacBook Pro");
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Roadmap Schedule
|
|
157
|
+
|
|
158
|
+
```mermaid
|
|
159
|
+
gantt
|
|
160
|
+
dateFormat YYYY-MM-DD
|
|
161
|
+
title AutoBE Roadmap for Beta Release
|
|
162
|
+
|
|
163
|
+
section Analyze Agent
|
|
164
|
+
Debate Enhancement: done, 2025-06-01, 7d
|
|
165
|
+
Prefix Rule: done, 2025-06-12, 7d
|
|
166
|
+
Multimodal: planned, 2025-07-02, 31d
|
|
167
|
+
|
|
168
|
+
section Prisma Agent
|
|
169
|
+
Compiler Development: done, 2025-06-01, 14d
|
|
170
|
+
Prohibition Rule: done, 2025-06-08, 7d
|
|
171
|
+
SQLite Support: done, 2025-06-16, 7d
|
|
172
|
+
|
|
173
|
+
section Interface Agent
|
|
174
|
+
Keyworded SDK: done, 2025-06-01, 10d
|
|
175
|
+
Authorization: done, 2025-06-19, 18d
|
|
176
|
+
Snapshot Logic: planned, 2025-06-23, 14d
|
|
177
|
+
|
|
178
|
+
section Test Agent
|
|
179
|
+
Scenario Agent: done, 2025-06-01, 10d
|
|
180
|
+
Coding Agent: done, 2025-06-12, 14d
|
|
181
|
+
Compiler Feedback: done, 2025-06-12, 14d
|
|
182
|
+
Function Calling: done, 2025-06-18, 14d
|
|
183
|
+
Compiler Development: done, 2025-07-02, 60d
|
|
184
|
+
|
|
185
|
+
section Realize Agent
|
|
186
|
+
Planner Agent: done, 2025-07-02, 30d
|
|
187
|
+
Coding Agent: done, 2025-07-02, 30d
|
|
188
|
+
Compiler Feedback: done, 2025-07-17, 15d
|
|
189
|
+
Function Calling: done, 2025-07-17, 31d
|
|
190
|
+
Runtime Validation: active, 2025-08-01, 30d
|
|
191
|
+
|
|
192
|
+
section Complementation
|
|
193
|
+
Benchmark: done, 2025-06-12, 50d
|
|
194
|
+
Demonstration: done, 2025-06-16, 14d
|
|
195
|
+
Documentation: done, 2025-06-16, 45d
|
|
196
|
+
Articles: active, 2025-07-02, 61d
|
|
197
|
+
Review Agent: active, 2025-07-02, 45d
|
|
198
|
+
Maintenance: active, 2025-08-01, 30d
|
|
199
|
+
|
|
200
|
+
section Ecosystem
|
|
201
|
+
Agentica Prerequisite: active, 2025-06-18, 13d
|
|
202
|
+
WebSocket Streaming: planned, 2025-07-02, 14d
|
|
203
|
+
History Manipulation: planned, 2025-07-16, 30d
|
|
204
|
+
AI Chatbot Development: planned, 2025-07-16, 30d
|
|
205
|
+
Data Seeder Agent: planned, 2025-08-01, 30d
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
`@autobe`'s comprehensive three-month beta development roadmap spans from 2025-06-01 through 2025-08-31, marking a critical phase in our journey toward production readiness.
|
|
209
|
+
|
|
210
|
+
Following the successful completion of our alpha release on 2025-05-31, we have established a robust foundation with fully developed Analysis, Prisma, and Interface Agents. These core components have successfully automated the most complex challenges in backend development: comprehensive requirements analysis, intelligent database architecture, and seamless API design. This achievement represents a significant milestone in our mission to completely automate backend application design.
|
|
211
|
+
|
|
212
|
+
The upcoming beta phase strategically focuses on delivering and refining the Test Agent and Realization Agent while ensuring system-wide stability and performance optimization across the entire `@autobe` ecosystem. Our ambitious target for 2025-08-31 is to achieve a breakthrough: a 100% reliable No-Code Agent platform that can autonomously handle any backend application development challenge without human intervention.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FileSystemIterator = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
18
|
+
const tstl_1 = require("tstl");
|
|
19
|
+
/** @internal */
|
|
20
|
+
var FileSystemIterator;
|
|
21
|
+
(function (FileSystemIterator) {
|
|
22
|
+
FileSystemIterator.read = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const output = {};
|
|
24
|
+
const iterate = (location) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const directory = yield fs_1.default.promises.readdir(location);
|
|
27
|
+
for (const file of directory) {
|
|
28
|
+
const next = `${location}/${file}`;
|
|
29
|
+
const stat = yield fs_1.default.promises.stat(next);
|
|
30
|
+
if (stat.isDirectory())
|
|
31
|
+
yield iterate(next);
|
|
32
|
+
else if (!((_a = props.extension) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
33
|
+
file.endsWith(`.${props.extension}`))
|
|
34
|
+
output[`${(_b = props.prefix) !== null && _b !== void 0 ? _b : ""}${next.substring(props.root.length + 1)}`] = yield fs_1.default.promises.readFile(next, "utf-8");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
yield iterate(props.root);
|
|
38
|
+
return output;
|
|
39
|
+
});
|
|
40
|
+
FileSystemIterator.save = (props) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
if (fs_1.default.existsSync(props.root))
|
|
42
|
+
yield fs_1.default.promises.rm(props.root, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
});
|
|
45
|
+
const directory = new tstl_1.VariadicSingleton((location) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
try {
|
|
47
|
+
yield fs_1.default.promises.mkdir(location, {
|
|
48
|
+
recursive: true,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (_a) { }
|
|
52
|
+
}));
|
|
53
|
+
for (const [key, value] of Object.entries(props.files)) {
|
|
54
|
+
const file = path_1.default.resolve(`${props.root}/${key}`);
|
|
55
|
+
yield directory.get(path_1.default.dirname(file));
|
|
56
|
+
yield fs_1.default.promises.writeFile(file, value !== null && value !== void 0 ? value : "", "utf8");
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
})(FileSystemIterator || (exports.FileSystemIterator = FileSystemIterator = {}));
|
|
60
|
+
//# sourceMappingURL=FileSystemIterator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileSystemIterator.js","sourceRoot":"","sources":["../src/FileSystemIterator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,+BAAyC;AAEzC,gBAAgB;AAChB,IAAiB,kBAAkB,CA+ClC;AA/CD,WAAiB,kBAAkB;IACpB,uBAAI,GAAG,CAAO,KAI1B,EAAmC,EAAE;QACpC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,MAAM,OAAO,GAAG,CAAO,QAAgB,EAAE,EAAE;;YACzC,MAAM,SAAS,GAAa,MAAM,YAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChE,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;gBAC7B,MAAM,IAAI,GAAW,GAAG,QAAQ,IAAI,IAAI,EAAE,CAAC;gBAC3C,MAAM,IAAI,GAAa,MAAM,YAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpD,IAAI,IAAI,CAAC,WAAW,EAAE;oBAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;qBACvC,IACH,CAAC,CAAA,MAAA,KAAK,CAAC,SAAS,0CAAE,MAAM,CAAA;oBACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;oBAEpC,MAAM,CACJ,GAAG,MAAA,KAAK,CAAC,MAAM,mCAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAA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gB,kBAAkB,kCAAlB,kBAAkB,QA+ClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.RepositoryFileSystem = void 0;
|
|
16
|
+
const openapi_1 = require("@samchon/openapi");
|
|
17
|
+
const child_process_1 = __importDefault(require("child_process"));
|
|
18
|
+
const fs_1 = __importDefault(require("fs"));
|
|
19
|
+
const tstl_1 = require("tstl");
|
|
20
|
+
const FileSystemIterator_1 = require("./FileSystemIterator");
|
|
21
|
+
/** @internal */
|
|
22
|
+
var RepositoryFileSystem;
|
|
23
|
+
(function (RepositoryFileSystem) {
|
|
24
|
+
RepositoryFileSystem.analyze = (account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
yield vs.get(account, project);
|
|
26
|
+
return FileSystemIterator_1.FileSystemIterator.read({
|
|
27
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/docs/requirements`,
|
|
28
|
+
extension: "md",
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
RepositoryFileSystem.prisma = (account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield vs.get(account, project);
|
|
33
|
+
const result = yield FileSystemIterator_1.FileSystemIterator.read({
|
|
34
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/prisma/schema`,
|
|
35
|
+
extension: "prisma",
|
|
36
|
+
});
|
|
37
|
+
for (const [key, value] of Object.entries(result))
|
|
38
|
+
result[key] = value.split("@author Samchon").join("@author AutoBE");
|
|
39
|
+
return result;
|
|
40
|
+
});
|
|
41
|
+
RepositoryFileSystem.src = (account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
yield vs.get(account, project);
|
|
43
|
+
return FileSystemIterator_1.FileSystemIterator.read({
|
|
44
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/src`,
|
|
45
|
+
prefix: "src/",
|
|
46
|
+
extension: "ts",
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
RepositoryFileSystem.swagger = (account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
yield vs.get(account, project);
|
|
51
|
+
return openapi_1.OpenApi.convert(JSON.parse(yield fs_1.default.promises.readFile(`${ROOT}/internals/repositories/${account}/${project}/packages/api/swagger.json`, "utf8")));
|
|
52
|
+
});
|
|
53
|
+
RepositoryFileSystem.clone = (account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
yield vs.get(account, project);
|
|
55
|
+
});
|
|
56
|
+
const vs = new tstl_1.VariadicSingleton((account, project) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const location = `${ROOT}/internals/repositories/${account}/${project}`;
|
|
58
|
+
if (fs_1.default.existsSync(location))
|
|
59
|
+
child_process_1.default.execSync("git pull", {
|
|
60
|
+
cwd: location,
|
|
61
|
+
stdio: "ignore",
|
|
62
|
+
});
|
|
63
|
+
else {
|
|
64
|
+
try {
|
|
65
|
+
yield fs_1.default.promises.mkdir(`${ROOT}/internals/repositories/${account}`, {
|
|
66
|
+
recursive: true,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
catch (_a) { }
|
|
70
|
+
child_process_1.default.execSync(`git clone https://github.com/${account}/${project}`, {
|
|
71
|
+
cwd: `${ROOT}/internals/repositories/${account}`,
|
|
72
|
+
stdio: "ignore",
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
const ROOT = `${__dirname}/../../..`;
|
|
77
|
+
})(RepositoryFileSystem || (exports.RepositoryFileSystem = RepositoryFileSystem = {}));
|
|
78
|
+
//# sourceMappingURL=RepositoryFileSystem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepositoryFileSystem.js","sourceRoot":"","sources":["../src/RepositoryFileSystem.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,8CAA2C;AAC3C,kEAA+B;AAC/B,4CAAoB;AACpB,+BAAyC;AAEzC,6DAA0D;AAE1D,gBAAgB;AAChB,IAAiB,oBAAoB,CAmFpC;AAnFD,WAAiB,oBAAoB;IACtB,4BAAO,GAAG,CACrB,OAAe,EACf,OAAe,EACkB,EAAE;QACnC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,uCAAkB,CAAC,IAAI,CAAC;YAC7B,IAAI,EAAE,GAAG,IAAI,2BAA2B,OAAO,IAAI,OAAO,oBAAoB;YAC9E,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC,CAAA,CAAC;IAEW,2BAAM,GAAG,CACpB,OAAe,EACf,OAAe,EACkB,EAAE;QACnC,MAAM,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/B,MAAM,MAAM,GAA2B,MAAM,uCAAkB,CAAC,IAAI,CAAC;YACnE,IAAI,EAAE,GAAG,IAAI,2BAA2B,OAAO,IAAI,OAAO,gBAAgB;YAC1E,SAAS,EAAE,QAAQ;SACpB,CAAC,CAAC;QACH,KAAK,MAAM,CAAC,GAAG,E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,QAAQ,CAAC,UAAU,EAAE;gBACtB,GAAG,EAAE,QAAQ;gBACb,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;aACA,CAAC;YACJ,IAAI,CAAC;gBACH,MAAM,YAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,2BAA2B,OAAO,EAAE,EAAE;oBACnE,SAAS,EAAE,IAAI;iBAChB,CAAC,CAAC;YACL,CAAC;YAAC,WAAM,CAAC,CAAA,CAAC;YACV,uBAAE,CAAC,QAAQ,CAAC,gCAAgC,OAAO,IAAI,OAAO,EAAE,EAAE;gBAChE,GAAG,EAAE,GAAG,IAAI,2BAA2B,OAAO,EAAE;gBAChD,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAA,CACF,CAAC;IAEF,MAAM,IAAI,GAAG,GAAG,SAAS,WAAW,CAAC;AACvC,CAAC,EAnFgB,oBAAoB,oCAApB,oBAAoB,QAmFpC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./FileSystemIterator"), exports);
|
|
18
|
+
__exportStar(require("./RepositoryFileSystem"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,yDAAuC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@autobe/filesystem",
|
|
3
|
+
"version": "0.14.0-dev.20250727",
|
|
4
|
+
"description": "Internal FileSystem for AutoBE Project, not distributed to public",
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "rimraf lib && tsc",
|
|
8
|
+
"prepack": "pnpm run build"
|
|
9
|
+
},
|
|
10
|
+
"author": "Wrtn Technologies",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"packageManager": "pnpm@10.6.4",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@samchon/openapi": "catalog:samchon",
|
|
15
|
+
"tstl": "catalog:samchon"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "^22.15.19",
|
|
19
|
+
"rimraf": "^6.0.1",
|
|
20
|
+
"typescript": "catalog:typescript"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"lib",
|
|
24
|
+
"src",
|
|
25
|
+
"package.json",
|
|
26
|
+
"LICENSE",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public",
|
|
31
|
+
"main": "lib/index.js",
|
|
32
|
+
"typings": "lib/index.d.ts"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { VariadicSingleton } from "tstl";
|
|
4
|
+
|
|
5
|
+
/** @internal */
|
|
6
|
+
export namespace FileSystemIterator {
|
|
7
|
+
export const read = async (props: {
|
|
8
|
+
root: string;
|
|
9
|
+
extension?: string;
|
|
10
|
+
prefix?: string;
|
|
11
|
+
}): Promise<Record<string, string>> => {
|
|
12
|
+
const output: Record<string, string> = {};
|
|
13
|
+
const iterate = async (location: string) => {
|
|
14
|
+
const directory: string[] = await fs.promises.readdir(location);
|
|
15
|
+
for (const file of directory) {
|
|
16
|
+
const next: string = `${location}/${file}`;
|
|
17
|
+
const stat: fs.Stats = await fs.promises.stat(next);
|
|
18
|
+
if (stat.isDirectory()) await iterate(next);
|
|
19
|
+
else if (
|
|
20
|
+
!props.extension?.length ||
|
|
21
|
+
file.endsWith(`.${props.extension}`)
|
|
22
|
+
)
|
|
23
|
+
output[
|
|
24
|
+
`${props.prefix ?? ""}${next.substring(props.root.length + 1)}`
|
|
25
|
+
] = await fs.promises.readFile(next, "utf-8");
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
await iterate(props.root);
|
|
29
|
+
return output;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const save = async (props: {
|
|
33
|
+
root: string;
|
|
34
|
+
files: Record<string, string>;
|
|
35
|
+
}): Promise<void> => {
|
|
36
|
+
if (fs.existsSync(props.root))
|
|
37
|
+
await fs.promises.rm(props.root, {
|
|
38
|
+
recursive: true,
|
|
39
|
+
});
|
|
40
|
+
const directory = new VariadicSingleton(async (location: string) => {
|
|
41
|
+
try {
|
|
42
|
+
await fs.promises.mkdir(location, {
|
|
43
|
+
recursive: true,
|
|
44
|
+
});
|
|
45
|
+
} catch {}
|
|
46
|
+
});
|
|
47
|
+
for (const [key, value] of Object.entries(props.files)) {
|
|
48
|
+
const file: string = path.resolve(`${props.root}/${key}`);
|
|
49
|
+
await directory.get(path.dirname(file));
|
|
50
|
+
await fs.promises.writeFile(file, value ?? "", "utf8");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { OpenApi } from "@samchon/openapi";
|
|
2
|
+
import cp from "child_process";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { VariadicSingleton } from "tstl";
|
|
5
|
+
|
|
6
|
+
import { FileSystemIterator } from "./FileSystemIterator";
|
|
7
|
+
|
|
8
|
+
/** @internal */
|
|
9
|
+
export namespace RepositoryFileSystem {
|
|
10
|
+
export const analyze = async (
|
|
11
|
+
account: string,
|
|
12
|
+
project: string,
|
|
13
|
+
): Promise<Record<string, string>> => {
|
|
14
|
+
await vs.get(account, project);
|
|
15
|
+
return FileSystemIterator.read({
|
|
16
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/docs/requirements`,
|
|
17
|
+
extension: "md",
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const prisma = async (
|
|
22
|
+
account: string,
|
|
23
|
+
project: string,
|
|
24
|
+
): Promise<Record<string, string>> => {
|
|
25
|
+
await vs.get(account, project);
|
|
26
|
+
const result: Record<string, string> = await FileSystemIterator.read({
|
|
27
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/prisma/schema`,
|
|
28
|
+
extension: "prisma",
|
|
29
|
+
});
|
|
30
|
+
for (const [key, value] of Object.entries(result))
|
|
31
|
+
result[key] = value.split("@author Samchon").join("@author AutoBE");
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const src = async (
|
|
36
|
+
account: string,
|
|
37
|
+
project: string,
|
|
38
|
+
): Promise<Record<string, string>> => {
|
|
39
|
+
await vs.get(account, project);
|
|
40
|
+
return FileSystemIterator.read({
|
|
41
|
+
root: `${ROOT}/internals/repositories/${account}/${project}/src`,
|
|
42
|
+
prefix: "src/",
|
|
43
|
+
extension: "ts",
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const swagger = async (
|
|
48
|
+
account: string,
|
|
49
|
+
project: string,
|
|
50
|
+
): Promise<OpenApi.IDocument> => {
|
|
51
|
+
await vs.get(account, project);
|
|
52
|
+
return OpenApi.convert(
|
|
53
|
+
JSON.parse(
|
|
54
|
+
await fs.promises.readFile(
|
|
55
|
+
`${ROOT}/internals/repositories/${account}/${project}/packages/api/swagger.json`,
|
|
56
|
+
"utf8",
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const clone = async (
|
|
63
|
+
account: string,
|
|
64
|
+
project: string,
|
|
65
|
+
): Promise<void> => {
|
|
66
|
+
await vs.get(account, project);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const vs = new VariadicSingleton(
|
|
70
|
+
async (account: string, project: string): Promise<void> => {
|
|
71
|
+
const location: string = `${ROOT}/internals/repositories/${account}/${project}`;
|
|
72
|
+
if (fs.existsSync(location))
|
|
73
|
+
cp.execSync("git pull", {
|
|
74
|
+
cwd: location,
|
|
75
|
+
stdio: "ignore",
|
|
76
|
+
});
|
|
77
|
+
else {
|
|
78
|
+
try {
|
|
79
|
+
await fs.promises.mkdir(`${ROOT}/internals/repositories/${account}`, {
|
|
80
|
+
recursive: true,
|
|
81
|
+
});
|
|
82
|
+
} catch {}
|
|
83
|
+
cp.execSync(`git clone https://github.com/${account}/${project}`, {
|
|
84
|
+
cwd: `${ROOT}/internals/repositories/${account}`,
|
|
85
|
+
stdio: "ignore",
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
const ROOT = `${__dirname}/../../..`;
|
|
92
|
+
}
|
package/src/index.ts
ADDED