create-alistt69-kit 0.3.5 → 0.3.6
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/LICENSE +20 -20
- package/README.md +189 -189
- package/bin/index.js +24 -24
- package/package.json +44 -44
- package/src/core/apply-features.js +14 -14
- package/src/core/collect-project-info.js +170 -170
- package/src/core/copy-base-template.js +11 -11
- package/src/core/create-project.js +99 -99
- package/src/core/install-dependencies.js +27 -27
- package/src/core/parse-cli-args.js +122 -122
- package/src/core/prepare-target-directory.js +69 -69
- package/src/core/render-project-readme.js +278 -278
- package/src/core/replace-tokens.js +45 -45
- package/src/core/restore-special-files.js +18 -18
- package/src/features/agents-md/files/AGENTS.md +36 -36
- package/src/features/agents-md/index.js +13 -13
- package/src/features/autoprefixer/files/postcss.config.cjs +4 -4
- package/src/features/autoprefixer/index.js +31 -31
- package/src/features/define-feature.js +32 -32
- package/src/features/eslint/files/eslint.config.mjs +135 -135
- package/src/features/eslint/index.js +43 -43
- package/src/features/index.js +28 -28
- package/src/features/prerender/files/prerender.routes.mjs +5 -5
- package/src/features/prerender/files/scripts/prerender.mjs +114 -114
- package/src/features/prerender/index.js +40 -40
- package/src/features/react-router/files/scripts/generate/page.mjs +366 -366
- package/src/features/react-router/files/src/app/App.tsx +18 -18
- package/src/features/react-router/files/src/app/providers/error-boundary/lib/provider/index.tsx +44 -44
- package/src/features/react-router/files/src/app/providers/error-boundary/ui/error-screen/index.tsx +151 -151
- package/src/features/react-router/files/src/app/providers/index.ts +17 -17
- package/src/features/react-router/files/src/app/providers/router/lib/provider/index.tsx +21 -21
- package/src/features/react-router/files/src/app/providers/router/model/router/index.tsx +24 -24
- package/src/features/react-router/files/src/app/providers/router/types/index.ts +10 -10
- package/src/features/react-router/files/src/app/providers/router/ui/app/index.tsx +36 -36
- package/src/features/react-router/files/src/index.tsx +23 -23
- package/src/features/react-router/files/src/pages/error/index.ts +1 -1
- package/src/features/react-router/files/src/pages/error/lazy.ts +3 -3
- package/src/features/react-router/files/src/pages/error/page.tsx +7 -7
- package/src/features/react-router/files/src/pages/main/index.ts +1 -1
- package/src/features/react-router/files/src/pages/main/lazy.ts +3 -3
- package/src/features/react-router/files/src/pages/main/page.tsx +7 -7
- package/src/features/react-router/index.js +36 -36
- package/src/features/stylelint/files/stylelint.config.mjs +13 -13
- package/src/features/stylelint/index.js +37 -37
- package/src/templates/base/.editorconfig +11 -11
- package/src/templates/base/README.md +2 -2
- package/src/templates/base/babel.config.json +12 -12
- package/src/templates/base/gitignore +27 -27
- package/src/templates/base/package.json +48 -48
- package/src/templates/base/public/index.html +12 -12
- package/src/templates/base/src/app/App.tsx +12 -12
- package/src/templates/base/src/app/providers/error-boundary/lib/provider/index.tsx +44 -44
- package/src/templates/base/src/app/providers/error-boundary/ui/error-screen/index.tsx +150 -150
- package/src/templates/base/src/app/providers/index.ts +5 -5
- package/src/templates/base/src/index.tsx +19 -19
- package/src/templates/base/src/styles/index.scss +13 -13
- package/src/templates/base/src/styles/normalize.scss +36 -36
- package/src/templates/base/src/widgets/created-by/index.tsx +1 -1
- package/src/templates/base/tsconfig.json +25 -25
- package/src/utils/agents-md.js +52 -52
- package/src/utils/console-format.js +11 -11
- package/src/utils/package-json.js +96 -96
- package/src/utils/package-manager.js +22 -22
|
@@ -1,151 +1,151 @@
|
|
|
1
|
-
type ErrorScreenProps = {
|
|
2
|
-
title?: string;
|
|
3
|
-
description?: string;
|
|
4
|
-
errorMessage?: string;
|
|
5
|
-
onRetry?: () => void;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
function ErrorScreen({
|
|
9
|
-
title = 'Something went wrong',
|
|
10
|
-
description = 'An unexpected error occurred. Try again or reload the page.',
|
|
11
|
-
errorMessage,
|
|
12
|
-
onRetry,
|
|
13
|
-
}: ErrorScreenProps) {
|
|
14
|
-
return (
|
|
15
|
-
<main
|
|
16
|
-
style={{
|
|
17
|
-
minHeight: '100vh',
|
|
18
|
-
display: 'grid',
|
|
19
|
-
placeItems: 'center',
|
|
20
|
-
padding: '24px',
|
|
21
|
-
background:
|
|
22
|
-
'radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 40%), #0b0d12',
|
|
23
|
-
color: '#f5f7fa',
|
|
24
|
-
}}
|
|
25
|
-
>
|
|
26
|
-
<section
|
|
27
|
-
style={{
|
|
28
|
-
width: '100%',
|
|
29
|
-
maxWidth: '560px',
|
|
30
|
-
padding: '32px',
|
|
31
|
-
borderRadius: '24px',
|
|
32
|
-
border: '1px solid rgba(255,255,255,0.08)',
|
|
33
|
-
background: 'rgba(255,255,255,0.04)',
|
|
34
|
-
backdropFilter: 'blur(12px)',
|
|
35
|
-
boxShadow: '0 20px 80px rgba(0,0,0,0.35)',
|
|
36
|
-
}}
|
|
37
|
-
>
|
|
38
|
-
<div
|
|
39
|
-
style={{
|
|
40
|
-
width: '56px',
|
|
41
|
-
height: '56px',
|
|
42
|
-
borderRadius: '16px',
|
|
43
|
-
display: 'grid',
|
|
44
|
-
placeItems: 'center',
|
|
45
|
-
fontSize: '28px',
|
|
46
|
-
background: 'rgba(255,255,255,0.08)',
|
|
47
|
-
marginBottom: '20px',
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
⚠️
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<h1
|
|
54
|
-
style={{
|
|
55
|
-
margin: 0,
|
|
56
|
-
fontSize: '32px',
|
|
57
|
-
lineHeight: 1.1,
|
|
58
|
-
fontWeight: 700,
|
|
59
|
-
}}
|
|
60
|
-
>
|
|
61
|
-
{title}
|
|
62
|
-
</h1>
|
|
63
|
-
|
|
64
|
-
<p
|
|
65
|
-
style={{
|
|
66
|
-
marginTop: '12px',
|
|
67
|
-
marginBottom: 0,
|
|
68
|
-
fontSize: '16px',
|
|
69
|
-
lineHeight: 1.6,
|
|
70
|
-
color: 'rgba(245,247,250,0.78)',
|
|
71
|
-
}}
|
|
72
|
-
>
|
|
73
|
-
{description}
|
|
74
|
-
</p>
|
|
75
|
-
|
|
76
|
-
{errorMessage ? (
|
|
77
|
-
<pre
|
|
78
|
-
style={{
|
|
79
|
-
marginTop: '20px',
|
|
80
|
-
padding: '16px',
|
|
81
|
-
overflowX: 'auto',
|
|
82
|
-
borderRadius: '16px',
|
|
83
|
-
background: 'rgba(0,0,0,0.28)',
|
|
84
|
-
border: '1px solid rgba(255,255,255,0.08)',
|
|
85
|
-
color: '#ffb4b4',
|
|
86
|
-
fontSize: '13px',
|
|
87
|
-
lineHeight: 1.5,
|
|
88
|
-
whiteSpace: 'pre-wrap',
|
|
89
|
-
wordBreak: 'break-word',
|
|
90
|
-
}}
|
|
91
|
-
>
|
|
92
|
-
{errorMessage}
|
|
93
|
-
</pre>
|
|
94
|
-
) : null}
|
|
95
|
-
|
|
96
|
-
<div
|
|
97
|
-
style={{
|
|
98
|
-
display: 'flex',
|
|
99
|
-
gap: '12px',
|
|
100
|
-
flexWrap: 'wrap',
|
|
101
|
-
marginTop: '24px',
|
|
102
|
-
}}
|
|
103
|
-
>
|
|
104
|
-
{onRetry ? (
|
|
105
|
-
<button
|
|
106
|
-
type="button"
|
|
107
|
-
onClick={onRetry}
|
|
108
|
-
style={buttonPrimaryStyle}
|
|
109
|
-
>
|
|
110
|
-
Try again
|
|
111
|
-
</button>
|
|
112
|
-
) : null}
|
|
113
|
-
|
|
114
|
-
<button
|
|
115
|
-
type="button"
|
|
116
|
-
onClick={() => window.location.reload()}
|
|
117
|
-
style={buttonSecondaryStyle}
|
|
118
|
-
>
|
|
119
|
-
Reload page
|
|
120
|
-
</button>
|
|
121
|
-
</div>
|
|
122
|
-
</section>
|
|
123
|
-
</main>
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const buttonBaseStyle: React.CSSProperties = {
|
|
128
|
-
appearance: 'none',
|
|
129
|
-
border: 'none',
|
|
130
|
-
cursor: 'pointer',
|
|
131
|
-
borderRadius: '14px',
|
|
132
|
-
padding: '12px 16px',
|
|
133
|
-
fontSize: '14px',
|
|
134
|
-
fontWeight: 600,
|
|
135
|
-
transition: 'transform 0.15s ease, opacity 0.15s ease',
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const buttonPrimaryStyle: React.CSSProperties = {
|
|
139
|
-
...buttonBaseStyle,
|
|
140
|
-
background: '#ffffff',
|
|
141
|
-
color: '#0b0d12',
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const buttonSecondaryStyle: React.CSSProperties = {
|
|
145
|
-
...buttonBaseStyle,
|
|
146
|
-
background: 'rgba(255,255,255,0.08)',
|
|
147
|
-
color: '#f5f7fa',
|
|
148
|
-
border: '1px solid rgba(255,255,255,0.1)',
|
|
149
|
-
};
|
|
150
|
-
|
|
1
|
+
type ErrorScreenProps = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
errorMessage?: string;
|
|
5
|
+
onRetry?: () => void;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
function ErrorScreen({
|
|
9
|
+
title = 'Something went wrong',
|
|
10
|
+
description = 'An unexpected error occurred. Try again or reload the page.',
|
|
11
|
+
errorMessage,
|
|
12
|
+
onRetry,
|
|
13
|
+
}: ErrorScreenProps) {
|
|
14
|
+
return (
|
|
15
|
+
<main
|
|
16
|
+
style={{
|
|
17
|
+
minHeight: '100vh',
|
|
18
|
+
display: 'grid',
|
|
19
|
+
placeItems: 'center',
|
|
20
|
+
padding: '24px',
|
|
21
|
+
background:
|
|
22
|
+
'radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 40%), #0b0d12',
|
|
23
|
+
color: '#f5f7fa',
|
|
24
|
+
}}
|
|
25
|
+
>
|
|
26
|
+
<section
|
|
27
|
+
style={{
|
|
28
|
+
width: '100%',
|
|
29
|
+
maxWidth: '560px',
|
|
30
|
+
padding: '32px',
|
|
31
|
+
borderRadius: '24px',
|
|
32
|
+
border: '1px solid rgba(255,255,255,0.08)',
|
|
33
|
+
background: 'rgba(255,255,255,0.04)',
|
|
34
|
+
backdropFilter: 'blur(12px)',
|
|
35
|
+
boxShadow: '0 20px 80px rgba(0,0,0,0.35)',
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
style={{
|
|
40
|
+
width: '56px',
|
|
41
|
+
height: '56px',
|
|
42
|
+
borderRadius: '16px',
|
|
43
|
+
display: 'grid',
|
|
44
|
+
placeItems: 'center',
|
|
45
|
+
fontSize: '28px',
|
|
46
|
+
background: 'rgba(255,255,255,0.08)',
|
|
47
|
+
marginBottom: '20px',
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
⚠️
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<h1
|
|
54
|
+
style={{
|
|
55
|
+
margin: 0,
|
|
56
|
+
fontSize: '32px',
|
|
57
|
+
lineHeight: 1.1,
|
|
58
|
+
fontWeight: 700,
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
{title}
|
|
62
|
+
</h1>
|
|
63
|
+
|
|
64
|
+
<p
|
|
65
|
+
style={{
|
|
66
|
+
marginTop: '12px',
|
|
67
|
+
marginBottom: 0,
|
|
68
|
+
fontSize: '16px',
|
|
69
|
+
lineHeight: 1.6,
|
|
70
|
+
color: 'rgba(245,247,250,0.78)',
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
{description}
|
|
74
|
+
</p>
|
|
75
|
+
|
|
76
|
+
{errorMessage ? (
|
|
77
|
+
<pre
|
|
78
|
+
style={{
|
|
79
|
+
marginTop: '20px',
|
|
80
|
+
padding: '16px',
|
|
81
|
+
overflowX: 'auto',
|
|
82
|
+
borderRadius: '16px',
|
|
83
|
+
background: 'rgba(0,0,0,0.28)',
|
|
84
|
+
border: '1px solid rgba(255,255,255,0.08)',
|
|
85
|
+
color: '#ffb4b4',
|
|
86
|
+
fontSize: '13px',
|
|
87
|
+
lineHeight: 1.5,
|
|
88
|
+
whiteSpace: 'pre-wrap',
|
|
89
|
+
wordBreak: 'break-word',
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
{errorMessage}
|
|
93
|
+
</pre>
|
|
94
|
+
) : null}
|
|
95
|
+
|
|
96
|
+
<div
|
|
97
|
+
style={{
|
|
98
|
+
display: 'flex',
|
|
99
|
+
gap: '12px',
|
|
100
|
+
flexWrap: 'wrap',
|
|
101
|
+
marginTop: '24px',
|
|
102
|
+
}}
|
|
103
|
+
>
|
|
104
|
+
{onRetry ? (
|
|
105
|
+
<button
|
|
106
|
+
type="button"
|
|
107
|
+
onClick={onRetry}
|
|
108
|
+
style={buttonPrimaryStyle}
|
|
109
|
+
>
|
|
110
|
+
Try again
|
|
111
|
+
</button>
|
|
112
|
+
) : null}
|
|
113
|
+
|
|
114
|
+
<button
|
|
115
|
+
type="button"
|
|
116
|
+
onClick={() => window.location.reload()}
|
|
117
|
+
style={buttonSecondaryStyle}
|
|
118
|
+
>
|
|
119
|
+
Reload page
|
|
120
|
+
</button>
|
|
121
|
+
</div>
|
|
122
|
+
</section>
|
|
123
|
+
</main>
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const buttonBaseStyle: React.CSSProperties = {
|
|
128
|
+
appearance: 'none',
|
|
129
|
+
border: 'none',
|
|
130
|
+
cursor: 'pointer',
|
|
131
|
+
borderRadius: '14px',
|
|
132
|
+
padding: '12px 16px',
|
|
133
|
+
fontSize: '14px',
|
|
134
|
+
fontWeight: 600,
|
|
135
|
+
transition: 'transform 0.15s ease, opacity 0.15s ease',
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const buttonPrimaryStyle: React.CSSProperties = {
|
|
139
|
+
...buttonBaseStyle,
|
|
140
|
+
background: '#ffffff',
|
|
141
|
+
color: '#0b0d12',
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const buttonSecondaryStyle: React.CSSProperties = {
|
|
145
|
+
...buttonBaseStyle,
|
|
146
|
+
background: 'rgba(255,255,255,0.08)',
|
|
147
|
+
color: '#f5f7fa',
|
|
148
|
+
border: '1px solid rgba(255,255,255,0.1)',
|
|
149
|
+
};
|
|
150
|
+
|
|
151
151
|
export default ErrorScreen;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import ErrorBoundary from './error-boundary/lib/provider'
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
ErrorBoundary as AppErrorBoundary,
|
|
5
|
-
};
|
|
1
|
+
import ErrorBoundary from './error-boundary/lib/provider'
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
ErrorBoundary as AppErrorBoundary,
|
|
5
|
+
};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { StrictMode } from 'react';
|
|
2
|
-
import { createRoot } from 'react-dom/client';
|
|
3
|
-
import App from '@/app/App';
|
|
4
|
-
import { AppErrorBoundary } from '@/app/providers';
|
|
5
|
-
import './styles/index.scss';
|
|
6
|
-
|
|
7
|
-
const container = document.getElementById('root');
|
|
8
|
-
|
|
9
|
-
if (!container) {
|
|
10
|
-
throw new Error('Root container not found');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
createRoot(container).render(
|
|
14
|
-
<StrictMode>
|
|
15
|
-
<AppErrorBoundary>
|
|
16
|
-
<App />
|
|
17
|
-
</AppErrorBoundary>
|
|
18
|
-
</StrictMode>,
|
|
19
|
-
);
|
|
1
|
+
import { StrictMode } from 'react';
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
|
+
import App from '@/app/App';
|
|
4
|
+
import { AppErrorBoundary } from '@/app/providers';
|
|
5
|
+
import './styles/index.scss';
|
|
6
|
+
|
|
7
|
+
const container = document.getElementById('root');
|
|
8
|
+
|
|
9
|
+
if (!container) {
|
|
10
|
+
throw new Error('Root container not found');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
createRoot(container).render(
|
|
14
|
+
<StrictMode>
|
|
15
|
+
<AppErrorBoundary>
|
|
16
|
+
<App />
|
|
17
|
+
</AppErrorBoundary>
|
|
18
|
+
</StrictMode>,
|
|
19
|
+
);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
html,
|
|
2
|
-
body,
|
|
3
|
-
#root {
|
|
4
|
-
margin: 0;
|
|
5
|
-
padding: 0;
|
|
6
|
-
min-height: 100%;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
body {
|
|
10
|
-
font-family: Bahnschrift, serif;
|
|
11
|
-
background: #141617;
|
|
12
|
-
color: #A6A8AAFF;
|
|
13
|
-
}
|
|
1
|
+
html,
|
|
2
|
+
body,
|
|
3
|
+
#root {
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
min-height: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
body {
|
|
10
|
+
font-family: Bahnschrift, serif;
|
|
11
|
+
background: #141617;
|
|
12
|
+
color: #A6A8AAFF;
|
|
13
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
*,
|
|
2
|
-
*::before,
|
|
3
|
-
*::after {
|
|
4
|
-
margin: 0;
|
|
5
|
-
padding: 0;
|
|
6
|
-
border: none;
|
|
7
|
-
list-style: none;
|
|
8
|
-
text-decoration: none;
|
|
9
|
-
box-sizing: border-box;
|
|
10
|
-
color: inherit;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
body {
|
|
14
|
-
-webkit-font-smoothing: antialiased;
|
|
15
|
-
text-rendering: optimizelegibility;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
input,
|
|
19
|
-
button,
|
|
20
|
-
textarea {
|
|
21
|
-
font-size: inherit;
|
|
22
|
-
font-family: inherit;
|
|
23
|
-
|
|
24
|
-
&::placeholder {
|
|
25
|
-
user-select: none;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
button {
|
|
30
|
-
user-select: none;
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
img {
|
|
35
|
-
user-select: none;
|
|
36
|
-
}
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
margin: 0;
|
|
5
|
+
padding: 0;
|
|
6
|
+
border: none;
|
|
7
|
+
list-style: none;
|
|
8
|
+
text-decoration: none;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
color: inherit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
body {
|
|
14
|
+
-webkit-font-smoothing: antialiased;
|
|
15
|
+
text-rendering: optimizelegibility;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
input,
|
|
19
|
+
button,
|
|
20
|
+
textarea {
|
|
21
|
+
font-size: inherit;
|
|
22
|
+
font-family: inherit;
|
|
23
|
+
|
|
24
|
+
&::placeholder {
|
|
25
|
+
user-select: none;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
button {
|
|
30
|
+
user-select: none;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
img {
|
|
35
|
+
user-select: none;
|
|
36
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"outDir": "./build",
|
|
4
|
-
"noImplicitAny": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"target": "es6",
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"allowJs": true,
|
|
9
|
-
"moduleResolution": "node",
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"strict": true,
|
|
12
|
-
"skipLibCheck": true,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"baseUrl": "./",
|
|
16
|
-
"paths": {
|
|
17
|
-
"@/*": ["./src/*"]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"ts-node": {
|
|
21
|
-
"compilerOptions": {
|
|
22
|
-
"module": "CommonJS"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./build",
|
|
4
|
+
"noImplicitAny": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"target": "es6",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"allowJs": true,
|
|
9
|
+
"moduleResolution": "node",
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"strict": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"baseUrl": "./",
|
|
16
|
+
"paths": {
|
|
17
|
+
"@/*": ["./src/*"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"ts-node": {
|
|
21
|
+
"compilerOptions": {
|
|
22
|
+
"module": "CommonJS"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/utils/agents-md.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { access, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const AGENTS_MD_PATH = 'AGENTS.md';
|
|
5
|
-
const SECTIONS_MARKER = '<!-- @agents-sections -->';
|
|
6
|
-
|
|
7
|
-
export function getAgentsMdPath(projectPath) {
|
|
8
|
-
return resolve(projectPath, AGENTS_MD_PATH);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export async function hasAgentsMd(projectPath) {
|
|
12
|
-
try {
|
|
13
|
-
await access(getAgentsMdPath(projectPath));
|
|
14
|
-
return true;
|
|
15
|
-
} catch (_) {
|
|
16
|
-
return false;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function appendAgentsSection(projectPath, sectionKey, content) {
|
|
21
|
-
if (!(await hasAgentsMd(projectPath))) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const filepath = getAgentsMdPath(projectPath);
|
|
26
|
-
const fileContent = await readFile(filepath, 'utf8');
|
|
27
|
-
|
|
28
|
-
if (fileContent.includes(`<!-- @agents:${sectionKey} -->`)) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const block = [
|
|
33
|
-
`<!-- @agents:${sectionKey} -->`,
|
|
34
|
-
content.trim(),
|
|
35
|
-
`<!-- /@agents:${sectionKey} -->`,
|
|
36
|
-
].join('\n');
|
|
37
|
-
|
|
38
|
-
let nextContent;
|
|
39
|
-
|
|
40
|
-
if (fileContent.includes(SECTIONS_MARKER)) {
|
|
41
|
-
nextContent = fileContent.replace(
|
|
42
|
-
SECTIONS_MARKER,
|
|
43
|
-
`${block}\n\n${SECTIONS_MARKER}`,
|
|
44
|
-
);
|
|
45
|
-
} else {
|
|
46
|
-
const trimmed = fileContent.trimEnd();
|
|
47
|
-
nextContent = `${trimmed}\n\n${block}\n`;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
await writeFile(filepath, nextContent, 'utf8');
|
|
51
|
-
|
|
52
|
-
return true;
|
|
1
|
+
import { access, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
|
|
4
|
+
const AGENTS_MD_PATH = 'AGENTS.md';
|
|
5
|
+
const SECTIONS_MARKER = '<!-- @agents-sections -->';
|
|
6
|
+
|
|
7
|
+
export function getAgentsMdPath(projectPath) {
|
|
8
|
+
return resolve(projectPath, AGENTS_MD_PATH);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export async function hasAgentsMd(projectPath) {
|
|
12
|
+
try {
|
|
13
|
+
await access(getAgentsMdPath(projectPath));
|
|
14
|
+
return true;
|
|
15
|
+
} catch (_) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export async function appendAgentsSection(projectPath, sectionKey, content) {
|
|
21
|
+
if (!(await hasAgentsMd(projectPath))) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const filepath = getAgentsMdPath(projectPath);
|
|
26
|
+
const fileContent = await readFile(filepath, 'utf8');
|
|
27
|
+
|
|
28
|
+
if (fileContent.includes(`<!-- @agents:${sectionKey} -->`)) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const block = [
|
|
33
|
+
`<!-- @agents:${sectionKey} -->`,
|
|
34
|
+
content.trim(),
|
|
35
|
+
`<!-- /@agents:${sectionKey} -->`,
|
|
36
|
+
].join('\n');
|
|
37
|
+
|
|
38
|
+
let nextContent;
|
|
39
|
+
|
|
40
|
+
if (fileContent.includes(SECTIONS_MARKER)) {
|
|
41
|
+
nextContent = fileContent.replace(
|
|
42
|
+
SECTIONS_MARKER,
|
|
43
|
+
`${block}\n\n${SECTIONS_MARKER}`,
|
|
44
|
+
);
|
|
45
|
+
} else {
|
|
46
|
+
const trimmed = fileContent.trimEnd();
|
|
47
|
+
nextContent = `${trimmed}\n\n${block}\n`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
await writeFile(filepath, nextContent, 'utf8');
|
|
51
|
+
|
|
52
|
+
return true;
|
|
53
53
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const color = (code, text) => `\u001B[${code}m${text}\u001B[0m`;
|
|
2
|
-
|
|
3
|
-
export const format = {
|
|
4
|
-
cyan: (text) => color('36', text),
|
|
5
|
-
green: (text) => color('32', text),
|
|
6
|
-
yellow: (text) => color('33', text),
|
|
7
|
-
dim: (text) => color('2', text),
|
|
8
|
-
bold: (text) => color('1', text),
|
|
9
|
-
|
|
10
|
-
sectionTitle: (text) => color('36', text),
|
|
11
|
-
label: (text) => color('2', text),
|
|
1
|
+
const color = (code, text) => `\u001B[${code}m${text}\u001B[0m`;
|
|
2
|
+
|
|
3
|
+
export const format = {
|
|
4
|
+
cyan: (text) => color('36', text),
|
|
5
|
+
green: (text) => color('32', text),
|
|
6
|
+
yellow: (text) => color('33', text),
|
|
7
|
+
dim: (text) => color('2', text),
|
|
8
|
+
bold: (text) => color('1', text),
|
|
9
|
+
|
|
10
|
+
sectionTitle: (text) => color('36', text),
|
|
11
|
+
label: (text) => color('2', text),
|
|
12
12
|
};
|