tycono 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/api/src/routes/git.ts +1 -1
- package/src/api/src/routes/setup.ts +14 -1
- package/src/api/src/services/git-save.ts +2 -2
- package/src/web/dist/assets/{index-Dwi3nVT7.js → index-DaWdihfW.js} +24 -24
- package/src/web/dist/assets/{preview-app-BggYkB4E.js → preview-app-x4kICKsu.js} +1 -1
- package/src/web/dist/index.html +1 -1
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ interface LastCommit {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function git(cmd: string): string {
|
|
21
|
-
return execSync(`git ${cmd}`, { cwd: COMPANY_ROOT, encoding: 'utf-8' }).trim();
|
|
21
|
+
return execSync(`git ${cmd}`, { cwd: COMPANY_ROOT, encoding: 'utf-8', timeout: 5000 }).trim();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
// GET /api/git/status
|
|
@@ -89,7 +89,20 @@ setupRouter.post('/scaffold', (req, res) => {
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
const
|
|
92
|
+
const baseRoot = process.env.COMPANY_ROOT || process.cwd();
|
|
93
|
+
|
|
94
|
+
// Safety: if CWD is a dangerous path (home dir, root, or has too many entries),
|
|
95
|
+
// scaffold into a subdirectory named after the company
|
|
96
|
+
const dangerousPaths = new Set(['/', os.homedir(), os.tmpdir()]);
|
|
97
|
+
const isDangerous = dangerousPaths.has(baseRoot) || baseRoot === '/tmp';
|
|
98
|
+
let projectRoot = baseRoot;
|
|
99
|
+
if (isDangerous) {
|
|
100
|
+
const slug = companyName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'my-company';
|
|
101
|
+
projectRoot = path.join(baseRoot, slug);
|
|
102
|
+
if (!fs.existsSync(projectRoot)) {
|
|
103
|
+
fs.mkdirSync(projectRoot, { recursive: true });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
93
106
|
|
|
94
107
|
const config: ScaffoldConfig = {
|
|
95
108
|
companyName,
|
|
@@ -65,14 +65,14 @@ const SAVE_PATHS = [
|
|
|
65
65
|
|
|
66
66
|
function run(cmd: string, cwd: string): string {
|
|
67
67
|
try {
|
|
68
|
-
return execSync(cmd, { cwd, encoding: 'utf-8', timeout:
|
|
68
|
+
return execSync(cmd, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
69
69
|
} catch {
|
|
70
70
|
return '';
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
function runOrThrow(cmd: string, cwd: string): string {
|
|
75
|
-
return execSync(cmd, { cwd, encoding: 'utf-8', timeout:
|
|
75
|
+
return execSync(cmd, { cwd, encoding: 'utf-8', timeout: 5000, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/** Check if directory is a git repository */
|