lantern-harness 0.1.43 → 0.1.45
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/CHANGELOG.md +36 -0
- package/README.md +1 -1
- package/builtin/session/lh-nav-groups.mjs +18 -4
- package/dist/500.html +61 -5
- package/dist/_astro/Base.Bkt1lrgu.css +1 -0
- package/dist/_astro/{Base.astro_astro_type_script_index_0_lang.Chv7r8_9.js → Base.astro_astro_type_script_index_0_lang.UKTVQqk7.js} +1 -1
- package/dist/_astro/{CaseExecBoard.DUMjSunb.js → CaseExecBoard.DICluCbK.js} +1 -1
- package/dist/_astro/{CaseGenerateApp.DtuOyQuv.js → CaseGenerateApp.Be3h5XPG.js} +1 -1
- package/dist/_astro/{CasesLibrary.B9o_jvXb.js → CasesLibrary.Buys7Cy-.js} +3 -3
- package/dist/_astro/ChatApp.D3BheKci.js +227 -0
- package/dist/_astro/ConfirmDialog.DrrPf1MB.js +1 -0
- package/dist/_astro/{DashboardBoard.DEvgMoqo.js → DashboardBoard.Qvf8o4v1.js} +1 -1
- package/dist/_astro/{DocsFileBrowser.D66pN9rp.js → DocsFileBrowser.DwKBffbM.js} +1 -1
- package/dist/_astro/{DocsPager.ceBEecmd.js → DocsPager.Duf4I68E.js} +1 -1
- package/dist/_astro/{DrawerField.CWpOf3L_.js → DrawerField.BH3p4Q4D.js} +1 -1
- package/dist/_astro/{KnowledgeLibrary.DYqE2mRi.js → KnowledgeLibrary.MDpMqeOd.js} +1 -1
- package/dist/_astro/{LifeKrTasksBoard.B7UiEutA.js → LifeKrTasksBoard.DsvW_S66.js} +1 -1
- package/dist/_astro/{LifeKrTodosBoard.VL7HdhNY.js → LifeKrTodosBoard.D2KTqvg1.js} +1 -1
- package/dist/_astro/{LifeObjectivesBoard.lLBPOHEZ.js → LifeObjectivesBoard.B0cDK934.js} +1 -1
- package/dist/_astro/{LifePlanTypeSelect.CdKQmlEK.js → LifePlanTypeSelect.BELDvMWU.js} +1 -1
- package/dist/_astro/{LifeReviewsBoard.AjO4SbsR.js → LifeReviewsBoard.BPXeVpg1.js} +1 -1
- package/dist/_astro/{LifeShared.CtdsQI43.js → LifeShared.tnT7aQON.js} +1 -1
- package/dist/_astro/{LifeStagesBoard.Dl-kTZ6K.js → LifeStagesBoard.CZftLR9K.js} +1 -1
- package/dist/_astro/{LifeYearCycleSelect.BILJOKXK.js → LifeYearCycleSelect.Bw2eRbSm.js} +1 -1
- package/dist/_astro/{LifeYearPlansBoard.BzJmi7Hw.js → LifeYearPlansBoard.DB-RJFEl.js} +1 -1
- package/dist/_astro/{MultiSelectDropdown.y8JMbCxO.js → MultiSelectDropdown.CBC7aNOv.js} +1 -1
- package/dist/_astro/NavLibraries.DdQYsZbe.js +1 -0
- package/dist/_astro/OverflowHint.CHZeFfUj.js +1 -0
- package/dist/_astro/{PluginsPage.D2OrUGY3.js → PluginsPage.C1JnInH4.js} +1 -1
- package/dist/_astro/PluginsPage.C3eEwy3K.js +1 -0
- package/dist/_astro/{PmBugsBoard.BynUocbE.js → PmBugsBoard.CGpXUTPu.js} +1 -1
- package/dist/_astro/{PmIterationsBoard.CvFblvfX.js → PmIterationsBoard.BaKiFIam.js} +1 -1
- package/dist/_astro/{PmProjectDetail.Dlm6flwk.js → PmProjectDetail.DneFVBpy.js} +1 -1
- package/dist/_astro/{PmProjectsBoard.B5vaWuax.js → PmProjectsBoard.BxoMF9gK.js} +1 -1
- package/dist/_astro/PmRequirementsBoard.-SI8VZXI.js +1 -0
- package/dist/_astro/{PmRequirementsBoard.piRWjiYA.js → PmRequirementsBoard.DsK6RF7Q.js} +1 -1
- package/dist/_astro/PmShared.BK8kWRSV.js +1 -0
- package/dist/_astro/{PromptMountDialog.DYojFMok.js → PromptMountDialog.mrTx3U5T.js} +1 -1
- package/dist/_astro/PromptsLibrary.B_SUf47p.js +1 -0
- package/dist/_astro/{ReportsPage.B-xhGVEU.js → ReportsPage.B9lGg1_s.js} +1 -1
- package/dist/_astro/{ReqAnalysisBoard.B3sAOuAq.js → ReqAnalysisBoard.CIZKnCQH.js} +1 -1
- package/dist/_astro/{RequirementsLibrary.BGys7DeN.js → RequirementsLibrary.cJc-bnGQ.js} +1 -1
- package/dist/_astro/{SearchableSelect.DFZBUFIs.js → SearchableSelect.SyLRS-Jj.js} +1 -1
- package/dist/_astro/SelectDropdown.T3CKHaLt.js +1 -0
- package/dist/_astro/{SettingsDialog.CEyjZuxq.js → SettingsDialog.DYdtCvLc.js} +1 -1
- package/dist/_astro/{SpaceSwitcher.DJqvw5Lw.js → SpaceSwitcher.C47_S1g9.js} +1 -1
- package/dist/_astro/{TableFieldConfig.D0v9S2g3.js → TableFieldConfig.C7O-mL-p.js} +1 -1
- package/dist/_astro/{TasksBoard.DZ9LLl_c.js → TasksBoard.BUEg2BYk.js} +1 -1
- package/dist/_astro/{TemplatesLibrary.iyj_kFMO.js → TemplatesLibrary.BLVIphXO.js} +1 -1
- package/dist/_astro/{TestReportsLibrary.B6pf0d7W.js → TestReportsLibrary.DVq30Jae.js} +1 -1
- package/dist/_astro/{TestStatsBoard.DS_2bqWI.js → TestStatsBoard.-5BWQ6bI.js} +1 -1
- package/dist/_astro/{TodosBoard.CYAVDD1W.js → TodosBoard.DI_lTp2e.js} +1 -1
- package/dist/_astro/UiAutoBoard.ChFdgv7s.js +2 -0
- package/dist/_astro/UiAutoEnvPanel.B50q4kYb.js +19 -0
- package/dist/_astro/UiAutoGenerationDialog.CLkFAHrm.js +1 -0
- package/dist/_astro/UiAutoProjectsPage.DCsDeN5d.js +3 -0
- package/dist/_astro/app-config.DkyjuL-S.js +1 -0
- package/dist/_astro/app-version.Cy-5oZO2.js +1 -0
- package/dist/_astro/{bash-tools.CfNj2sh0.js → bash-tools.D9HCzC_7.js} +1 -1
- package/dist/_astro/{case-gen-run.nrr97yK3.js → case-gen-run.BklG1H8k.js} +1 -1
- package/dist/_astro/{case-types.B51yDRdf.js → case-types.DlFkbZJN.js} +1 -1
- package/dist/_astro/composer-draft.llpvz3MW.js +1 -0
- package/dist/_astro/composer-task.DRi5tAJs.js +5 -0
- package/dist/_astro/{hydrate-cache.CoD1FB3T.js → hydrate-cache.B15Nrpq0.js} +1 -1
- package/dist/_astro/i18n.D_aOCHSN.js +7 -0
- package/dist/_astro/{open-docs-in-session.DJtuI1C4.js → open-docs-in-session.CRiZT022.js} +1 -1
- package/dist/_astro/plugins.BRvXWHLe.js +1 -0
- package/dist/_astro/prompts-meta.BUGutlsk.js +2 -0
- package/dist/_astro/{req-analysis.qmyv5cBw.js → req-analysis.B12_MGMQ.js} +1 -1
- package/dist/_astro/{settings.CYERib3l.js → settings.38J2uD5M.js} +2 -2
- package/dist/_astro/{spaces-client.DvIgFink.js → spaces-client.DV04tRyD.js} +1 -1
- package/dist/_astro/{story-review.2UUlN3p-.js → story-review.D2W5tEOY.js} +1 -1
- package/dist/_astro/{test-reports.DPQ-FMsQ.js → test-reports.CuIjlEyK.js} +1 -1
- package/dist/_astro/ui-auto-prompt.H9_yhau9.js +9 -0
- package/dist/_astro/ui-auto.DMv940x4.js +1 -0
- package/dist/_astro/{view-prefs.GnvelRDj.js → view-prefs.DhdLZjGh.js} +1 -1
- package/dist/case-exec/index.html +62 -6
- package/dist/cases/generate/index.html +62 -6
- package/dist/cases/library/index.html +62 -6
- package/dist/dashboard/index.html +62 -6
- package/dist/docs/changelog/index.html +138 -50
- package/dist/docs/install/index.html +61 -5
- package/dist/docs/manual/index.html +129 -21
- package/dist/knowledge/index.html +62 -6
- package/dist/life/kr-tasks/index.html +62 -6
- package/dist/life/kr-todos/index.html +62 -6
- package/dist/life/objectives/index.html +62 -6
- package/dist/life/reviews/index.html +62 -6
- package/dist/life/stages/index.html +62 -6
- package/dist/life/year-plans/index.html +62 -6
- package/dist/plugins/index.html +62 -6
- package/dist/pm/bugs/index.html +62 -6
- package/dist/pm/iterations/index.html +62 -6
- package/dist/pm/projects/detail/index.html +62 -6
- package/dist/pm/projects/index.html +62 -6
- package/dist/pm/requirements/index.html +62 -6
- package/dist/prompts/index.html +62 -6
- package/dist/reports/index.html +62 -6
- package/dist/requirement-analysis/index.html +62 -6
- package/dist/requirements/index.html +62 -6
- package/dist/tasks/index.html +62 -6
- package/dist/templates/index.html +62 -6
- package/dist/test-automation/index.html +63 -7
- package/dist/test-automation/projects/index.html +980 -0
- package/dist/test-reports/index.html +62 -6
- package/dist/test-stats/index.html +62 -6
- package/dist/todos/index.html +62 -6
- package/dist/workbench/index.html +62 -6
- package/docs//345/205/250/345/261/200/346/217/222/344/273/266.md +1 -1
- package/docs//346/223/215/344/275/234/346/211/213/345/206/214.md +107 -63
- package/lh-plugins/lh-uiauto.mjs +2502 -51
- package/lh-plugins/plugin-prompts.mjs +62 -2
- package/lh-plugins/storage-domain.mjs +17 -4
- package/lh-plugins/uiauto-adapters/playwright.mjs +29 -14
- package/lh-plugins/uiauto-adapters/tasks.mjs +8 -2
- package/lh-plugins/uiauto-env.mjs +669 -0
- package/lh-plugins/uiauto-explorer/apps.mjs +4 -5
- package/lh-plugins/uiauto-explorer/emit-files.mjs +32 -9
- package/lh-plugins/uiauto-explorer/emit-ts.mjs +13 -2
- package/lh-plugins/uiauto-explorer/ir.mjs +20 -0
- package/lh-plugins/uiauto-explorer/sessions.mjs +36 -0
- package/lh-plugins/uiauto-node.mjs +327 -0
- package/lh-plugins/uiauto-pm.mjs +178 -0
- package/lh-plugins/uiauto-prompt.mjs +228 -18
- package/lh-plugins/uiauto-report.mjs +16 -0
- package/lh-plugins/uiauto-scaffold/audit.mjs +356 -0
- package/lh-plugins/uiauto-scaffold/index.mjs +25 -0
- package/lh-plugins/uiauto-scaffold/library.mjs +508 -0
- package/lh-plugins/uiauto-scaffold/manifest.mjs +83 -0
- package/lh-plugins/uiauto-scaffold/render.mjs +133 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.json +225 -0
- package/lh-plugins/uiauto-scaffold/templates/playwright-ts.mjs +46 -0
- package/package.json +1 -1
- package/dist/_astro/Base.BnVp5Mf8.css +0 -1
- package/dist/_astro/ChatApp.CKPGFibd.js +0 -227
- package/dist/_astro/ConfirmDialog.D5qXeML0.js +0 -1
- package/dist/_astro/NavLibraries.BnaL-km5.js +0 -1
- package/dist/_astro/OverflowHint.pvo2Xc8R.js +0 -1
- package/dist/_astro/PluginsPage.CMW4hEFr.js +0 -1
- package/dist/_astro/PmRequirementsBoard.B8KTeso8.js +0 -1
- package/dist/_astro/PmShared.86HEsdd_.js +0 -1
- package/dist/_astro/PromptsLibrary.GpNbBTj1.js +0 -1
- package/dist/_astro/SelectDropdown.Dmk5n225.js +0 -1
- package/dist/_astro/SlideOverDrawer.C1IVOc_8.js +0 -1
- package/dist/_astro/UiAutoBoard.DSsiMfx2.js +0 -9
- package/dist/_astro/app-config.DwpFFa5D.js +0 -1
- package/dist/_astro/app-version.Dabxyva-.js +0 -1
- package/dist/_astro/composer-task.DJmluzPT.js +0 -5
- package/dist/_astro/i18n.vo2aElR9.js +0 -7
- package/dist/_astro/plugins.BmKRnp4a.js +0 -1
- package/dist/_astro/prompts-meta.bF2q5SUy.js +0 -2
- package/dist/_astro/ui-auto-prompt.COBTt5Gd.js +0 -4
- package/dist/_astro/ui-auto.BmC9JJ_X.js +0 -1
|
@@ -0,0 +1,508 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 骨架配置库:空间里的骨架 JSON 怎么读、怎么渲染、什么时候补种子。
|
|
3
|
+
*
|
|
4
|
+
* 为什么把骨架挪到文件里(而不是写死在代码里):
|
|
5
|
+
* - 企业里各团队的目录 / 标签 / 流水线口径不一样,骨架要能改;
|
|
6
|
+
* - 改完点「新建项目」立刻生效,不用等版本;
|
|
7
|
+
* - 内置种子只是兜底,用户改过那份文件之后不再覆盖。
|
|
8
|
+
*
|
|
9
|
+
* 落盘位置:
|
|
10
|
+
* - 骨架:`<空间>/.lantern/config/uiauto/skeleton/<id>.json`(跟着空间走,可入库)
|
|
11
|
+
* - 指纹账本:`<空间>/.lantern/local/uiauto-skeletons.json`(本机,判断「有没有人改过」)
|
|
12
|
+
*/
|
|
13
|
+
import crypto from 'node:crypto';
|
|
14
|
+
import fs from 'node:fs';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
|
|
17
|
+
import { spaceConfigFile, spaceLocalFile } from '../../builtin/session/space-layout.mjs';
|
|
18
|
+
import {
|
|
19
|
+
builtinSkeletonText,
|
|
20
|
+
hasBuiltinSkeleton,
|
|
21
|
+
PLAYWRIGHT_TS_SKELETON_ID,
|
|
22
|
+
} from './templates/playwright-ts.mjs';
|
|
23
|
+
|
|
24
|
+
/** 骨架格式版本:将来结构再变时用它做迁移判断 */
|
|
25
|
+
export const SKELETON_SCHEMA = 1;
|
|
26
|
+
|
|
27
|
+
const SKELETON_DIR = 'skeleton';
|
|
28
|
+
const LEDGER_FILE = 'uiauto-skeletons.json';
|
|
29
|
+
|
|
30
|
+
/** 单个文件 / 整份骨架的体积上限:骨架是代码模板,超过这个量级一定是配错了 */
|
|
31
|
+
const MAX_FILE_CHARS = 512 * 1024;
|
|
32
|
+
const MAX_TOTAL_CHARS = 8 * 1024 * 1024;
|
|
33
|
+
const MAX_FILES = 400;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 结果落点:骨架没写 layout 时按这套默认值
|
|
37
|
+
* (与 Harness 出码器的默认布局一致)
|
|
38
|
+
*/
|
|
39
|
+
export const DEFAULT_LAYOUT = Object.freeze({
|
|
40
|
+
testDir: 'tests',
|
|
41
|
+
pagesDir: 'pages',
|
|
42
|
+
fixturesDir: 'fixtures',
|
|
43
|
+
utilsDir: 'utils',
|
|
44
|
+
dataDir: 'data',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/** 骨架 id 用小写短横线;选项 id 沿用 camelCase(authState / webServer) */
|
|
48
|
+
const SKELETON_ID_TOKEN = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
49
|
+
const OPTION_ID_TOKEN = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
|
|
50
|
+
|
|
51
|
+
const digest = (text) =>
|
|
52
|
+
crypto
|
|
53
|
+
.createHash('sha256')
|
|
54
|
+
.update(String(text ?? ''), 'utf8')
|
|
55
|
+
.digest('hex')
|
|
56
|
+
.slice(0, 32);
|
|
57
|
+
|
|
58
|
+
/* ---------------------------- 位置 ---------------------------- */
|
|
59
|
+
|
|
60
|
+
export function skeletonsDir(spaceDir) {
|
|
61
|
+
return spaceConfigFile(spaceDir, 'uiauto', SKELETON_DIR);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function skeletonFile(spaceDir, id = PLAYWRIGHT_TS_SKELETON_ID) {
|
|
65
|
+
return path.join(skeletonsDir(spaceDir), `${id}.json`);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ledgerFile(spaceDir) {
|
|
69
|
+
return spaceLocalFile(spaceDir, LEDGER_FILE);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function readLedger(spaceDir) {
|
|
73
|
+
try {
|
|
74
|
+
const parsed = JSON.parse(fs.readFileSync(ledgerFile(spaceDir), 'utf8'));
|
|
75
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
76
|
+
} catch {
|
|
77
|
+
return {};
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function writeLedger(spaceDir, ledger) {
|
|
82
|
+
try {
|
|
83
|
+
const file = ledgerFile(spaceDir);
|
|
84
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
85
|
+
fs.writeFileSync(file, `${JSON.stringify(ledger, null, 2)}\n`, 'utf8');
|
|
86
|
+
} catch {
|
|
87
|
+
// 账本写不进去只影响「自动升级」,不影响生成
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** 技术栈 → 默认骨架 id(不同语言将来可以各有一份) */
|
|
92
|
+
export function defaultSkeletonId(stackId) {
|
|
93
|
+
const value = String(stackId ?? '').trim();
|
|
94
|
+
if (value === 'playwright') return PLAYWRIGHT_TS_SKELETON_ID;
|
|
95
|
+
if (hasBuiltinSkeleton(value)) return value;
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* --------------------------- 解析 --------------------------- */
|
|
100
|
+
|
|
101
|
+
function asText(value, field, max = 300) {
|
|
102
|
+
const text = String(value ?? '')
|
|
103
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '')
|
|
104
|
+
.trim();
|
|
105
|
+
if (!text) throw new Error(`骨架缺少 ${field}`);
|
|
106
|
+
return text.slice(0, max);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function optionalText(value, max = 300) {
|
|
110
|
+
return String(value ?? '')
|
|
111
|
+
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f]/g, '')
|
|
112
|
+
.trim()
|
|
113
|
+
.slice(0, max);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** 统一成 `/` 分隔的相对路径;越界 / 绝对路径一律拒绝 */
|
|
117
|
+
export function assertSafeSkeletonPath(file) {
|
|
118
|
+
const rel = String(file ?? '')
|
|
119
|
+
.trim()
|
|
120
|
+
.replace(/\\/g, '/');
|
|
121
|
+
if (!rel) throw new Error('骨架里有空文件路径');
|
|
122
|
+
if (rel.startsWith('/') || /^[a-zA-Z]:/.test(rel)) {
|
|
123
|
+
throw new Error(`骨架文件路径必须是相对路径:${rel}`);
|
|
124
|
+
}
|
|
125
|
+
if (rel.split('/').some((part) => !part || part === '.' || part === '..')) {
|
|
126
|
+
throw new Error(`骨架文件路径不合法:${rel}`);
|
|
127
|
+
}
|
|
128
|
+
return rel;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function normalizeLayout(raw) {
|
|
132
|
+
const source = raw && typeof raw === 'object' ? raw : {};
|
|
133
|
+
const layout = {};
|
|
134
|
+
for (const [key, fallback] of Object.entries(DEFAULT_LAYOUT)) {
|
|
135
|
+
const value = optionalText(source[key], 200)
|
|
136
|
+
.replace(/^\.?\//, '')
|
|
137
|
+
.replace(/\/+$/, '');
|
|
138
|
+
layout[key] = value || fallback;
|
|
139
|
+
}
|
|
140
|
+
return layout;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function normalizeOption(raw, index) {
|
|
144
|
+
if (!raw || typeof raw !== 'object') {
|
|
145
|
+
throw new Error(`骨架的 options[${index}] 不是对象`);
|
|
146
|
+
}
|
|
147
|
+
const id = optionalText(raw.id, 64);
|
|
148
|
+
if (!OPTION_ID_TOKEN.test(id)) {
|
|
149
|
+
throw new Error(`骨架选项 id 不合法:${id || '(空)'}(只能用小写字母、数字、连字符)`);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
id,
|
|
153
|
+
label: optionalText(raw.label, 60) || id,
|
|
154
|
+
hint: optionalText(raw.hint, 120),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** 文件级开关:允许 `lint` / `!lint`,必须引用已声明的选项 */
|
|
159
|
+
function normalizeWhen(raw, ids) {
|
|
160
|
+
const value = optionalText(raw, 80);
|
|
161
|
+
if (!value) return '';
|
|
162
|
+
const negated = value.startsWith('!');
|
|
163
|
+
const id = (negated ? value.slice(1) : value).trim();
|
|
164
|
+
if (!ids.has(id)) throw new Error(`骨架文件的 when 引用了未声明的选项:${value}`);
|
|
165
|
+
return negated ? `!${id}` : id;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** 条件块里引用的选项也必须是声明过的:写错一个字母不该等到生成时才炸 */
|
|
169
|
+
function checkConditionTokens(content, ids, filePath) {
|
|
170
|
+
const tokens = String(content).match(/\{\{\s*[#/](?:if|unless)\s*([\w-]*)\s*\}\}/g) ?? [];
|
|
171
|
+
for (const token of tokens) {
|
|
172
|
+
const name = /\{\{\s*[#/](?:if|unless)\s*([\w-]*)\s*\}\}/.exec(token)?.[1] ?? '';
|
|
173
|
+
if (!name) continue;
|
|
174
|
+
if (!ids.has(name)) {
|
|
175
|
+
throw new Error(`骨架文件 ${filePath} 的条件块引用了未声明的选项:${name}`);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
const opens = (String(content).match(/\{\{\s*[#](?:if|unless)\b/g) ?? []).length;
|
|
179
|
+
const closes = (String(content).match(/\{\{\s*\/(?:if|unless)\s*\}\}/g) ?? []).length;
|
|
180
|
+
if (opens !== closes) {
|
|
181
|
+
throw new Error(`骨架文件 ${filePath} 的条件块没有配对(${opens} 开 / ${closes} 合)`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* 严格解析骨架:结构不对直接抛错,不产出半套文件。
|
|
187
|
+
* @param {unknown} raw JSON 对象或 JSON 文本
|
|
188
|
+
* @param {{ fallbackId?: string }} [options]
|
|
189
|
+
*/
|
|
190
|
+
export function parseSkeleton(raw, options = {}) {
|
|
191
|
+
let source = raw;
|
|
192
|
+
if (typeof raw === 'string') {
|
|
193
|
+
try {
|
|
194
|
+
source = JSON.parse(raw);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
throw new Error(`骨架不是合法 JSON:${error instanceof Error ? error.message : error}`);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (!source || typeof source !== 'object' || Array.isArray(source)) {
|
|
200
|
+
throw new Error('骨架必须是一个 JSON 对象');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const id = optionalText(source.id, 64) || optionalText(options.fallbackId, 64);
|
|
204
|
+
if (!SKELETON_ID_TOKEN.test(id)) throw new Error(`骨架 id 不合法:${id || '(空)'}`);
|
|
205
|
+
|
|
206
|
+
const status = source.status === 'planned' ? 'planned' : 'ready';
|
|
207
|
+
const declared = Array.isArray(source.options) ? source.options : [];
|
|
208
|
+
const seenIds = new Set();
|
|
209
|
+
const optionList = declared.map((item, index) => {
|
|
210
|
+
const option = normalizeOption(item, index);
|
|
211
|
+
if (seenIds.has(option.id)) throw new Error(`骨架选项重复:${option.id}`);
|
|
212
|
+
seenIds.add(option.id);
|
|
213
|
+
return option;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const defaultRaw = Array.isArray(source.defaultOptions) ? source.defaultOptions : [];
|
|
217
|
+
const defaultOptions = optionList
|
|
218
|
+
.map((option) => option.id)
|
|
219
|
+
.filter((optionId) => defaultRaw.includes(optionId));
|
|
220
|
+
|
|
221
|
+
const filesRaw = Array.isArray(source.files) ? source.files : [];
|
|
222
|
+
if (!filesRaw.length) throw new Error('骨架没有任何文件');
|
|
223
|
+
if (filesRaw.length > MAX_FILES) throw new Error(`骨架文件数超过 ${MAX_FILES}`);
|
|
224
|
+
|
|
225
|
+
let total = 0;
|
|
226
|
+
const files = filesRaw.map((file, index) => {
|
|
227
|
+
if (!file || typeof file !== 'object') throw new Error(`骨架的 files[${index}] 不是对象`);
|
|
228
|
+
const filePath = assertSafeSkeletonPath(file.path);
|
|
229
|
+
if (file.content == null) throw new Error(`骨架文件缺少 content:${filePath}`);
|
|
230
|
+
const content = String(file.content);
|
|
231
|
+
if (content.length > MAX_FILE_CHARS) {
|
|
232
|
+
throw new Error(`骨架文件过大(${content.length} 字符):${filePath}`);
|
|
233
|
+
}
|
|
234
|
+
total += content.length;
|
|
235
|
+
if (total > MAX_TOTAL_CHARS) throw new Error('骨架总体积过大,检查是不是把产物打进去了');
|
|
236
|
+
checkConditionTokens(content, seenIds, filePath);
|
|
237
|
+
return { path: filePath, content, when: normalizeWhen(file.when, seenIds) };
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return {
|
|
241
|
+
schema: Number.isFinite(Number(source.schema)) ? Number(source.schema) : SKELETON_SCHEMA,
|
|
242
|
+
id,
|
|
243
|
+
stack: asText(source.stack, 'stack', 40),
|
|
244
|
+
label: optionalText(source.label, 80) || id,
|
|
245
|
+
kind: optionalText(source.kind, 20) || 'ui',
|
|
246
|
+
language: optionalText(source.language, 20) || 'ts',
|
|
247
|
+
status,
|
|
248
|
+
hint: optionalText(source.hint, 200),
|
|
249
|
+
promptFile: optionalText(source.promptFile, 200),
|
|
250
|
+
layout: normalizeLayout(source.layout),
|
|
251
|
+
options: optionList,
|
|
252
|
+
defaultOptions,
|
|
253
|
+
files,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
/* --------------------------- 渲染 --------------------------- */
|
|
258
|
+
|
|
259
|
+
const PLACEHOLDER = /\{\{\s*(projectName|packageName|baseURL|stack)\s*\}\}/g;
|
|
260
|
+
const CONDITION = /^(#if|#unless|\/if|\/unless)\s*([\w-]*)$/;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* 条件块渲染:支持嵌套,未选中的整块删掉。
|
|
264
|
+
* 先把 GitHub Actions 的 `${{ ... }}` 摘出去,避免被当成模板。
|
|
265
|
+
*/
|
|
266
|
+
function resolveConditions(text, picked, declaredIds, filePath) {
|
|
267
|
+
const stash = [];
|
|
268
|
+
const stashed = String(text).replace(/\$\{\{[\s\S]*?\}\}/g, (match) => {
|
|
269
|
+
stash.push(match);
|
|
270
|
+
return `\u0000${stash.length - 1}\u0000`;
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
let cursor = 0;
|
|
274
|
+
const walk = (nested) => {
|
|
275
|
+
let out = '';
|
|
276
|
+
while (cursor < stashed.length) {
|
|
277
|
+
const open = stashed.indexOf('{{', cursor);
|
|
278
|
+
if (open < 0) {
|
|
279
|
+
out += stashed.slice(cursor);
|
|
280
|
+
cursor = stashed.length;
|
|
281
|
+
break;
|
|
282
|
+
}
|
|
283
|
+
out += stashed.slice(cursor, open);
|
|
284
|
+
const close = stashed.indexOf('}}', open);
|
|
285
|
+
if (close < 0) {
|
|
286
|
+
out += stashed.slice(open);
|
|
287
|
+
cursor = stashed.length;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
const token = stashed.slice(open + 2, close).trim();
|
|
291
|
+
cursor = close + 2;
|
|
292
|
+
|
|
293
|
+
const matched = CONDITION.exec(token);
|
|
294
|
+
if (!matched) {
|
|
295
|
+
out += `{{${token}}}`;
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
const [, kind, name] = matched;
|
|
299
|
+
if (kind === '/if' || kind === '/unless') {
|
|
300
|
+
if (!nested) throw new Error(`骨架文件 ${filePath} 有多余的闭合标记 {{${token}}}`);
|
|
301
|
+
return { text: out, closed: true };
|
|
302
|
+
}
|
|
303
|
+
if (!declaredIds.has(name)) {
|
|
304
|
+
throw new Error(`骨架文件 ${filePath} 的条件块引用了未声明的选项:${name}`);
|
|
305
|
+
}
|
|
306
|
+
const body = walk(true);
|
|
307
|
+
if (!body.closed) throw new Error(`骨架文件 ${filePath} 的条件块 {{${token}}} 没有闭合`);
|
|
308
|
+
const hit = kind === '#if' ? picked.has(name) : !picked.has(name);
|
|
309
|
+
if (hit) out += body.text;
|
|
310
|
+
}
|
|
311
|
+
if (nested) return { text: out, closed: false };
|
|
312
|
+
return { text: out, closed: true };
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
const result = walk(false);
|
|
316
|
+
if (!result.closed) throw new Error(`骨架文件 ${filePath} 的条件块没有闭合`);
|
|
317
|
+
return result.text.replace(/\u0000(\d+)\u0000/g, (_, index) => stash[Number(index)]);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function fillPlaceholders(text, ctx) {
|
|
321
|
+
return text.replace(PLACEHOLDER, (_, key) => String(ctx[key] ?? ''));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* 项目名 → npm 包名:`web e2e` → `web-e2e`。
|
|
326
|
+
* npm 只收小写字母 / 数字 / 点 / 下划线 / 连字符,中文之类的直接去掉。
|
|
327
|
+
*/
|
|
328
|
+
export function toPackageName(projectName) {
|
|
329
|
+
const slug = String(projectName ?? '')
|
|
330
|
+
.toLowerCase()
|
|
331
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
332
|
+
.replace(/^-+|-+$/g, '')
|
|
333
|
+
.replace(/-{2,}/g, '-')
|
|
334
|
+
.slice(0, 60);
|
|
335
|
+
return slug && /^[a-z0-9]/.test(slug) ? slug : 'e2e-project';
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** 文件级开关:`lint` 选中才要,`!lint` 没选才要 */
|
|
339
|
+
export function whenMatches(when, picked) {
|
|
340
|
+
const value = String(when ?? '').trim();
|
|
341
|
+
if (!value) return true;
|
|
342
|
+
const negated = value.startsWith('!');
|
|
343
|
+
const id = negated ? value.slice(1).trim() : value;
|
|
344
|
+
return negated ? !picked.has(id) : picked.has(id);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/** 只保留骨架声明过的选项,顺序跟着骨架(向导里怎么排就怎么出) */
|
|
348
|
+
export function pickOptions(skeleton, raw) {
|
|
349
|
+
const desired = new Set(Array.isArray(raw) ? raw.map((item) => String(item)) : []);
|
|
350
|
+
return skeleton.options.map((option) => option.id).filter((id) => desired.has(id));
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* 按骨架渲染出待写入的文件清单(纯计算,不碰磁盘)。
|
|
355
|
+
* @param {ReturnType<typeof parseSkeleton>} skeleton 已解析的骨架
|
|
356
|
+
* @param {{ projectName: string, baseURL?: string, options?: string[] }} ctx
|
|
357
|
+
*/
|
|
358
|
+
export function renderFromSkeleton(skeleton, ctx = {}) {
|
|
359
|
+
const projectName = String(ctx.projectName ?? '').trim();
|
|
360
|
+
if (!projectName) throw new Error('请填写项目名');
|
|
361
|
+
const pickedList = pickOptions(skeleton, ctx.options);
|
|
362
|
+
const picked = new Set(pickedList);
|
|
363
|
+
const declaredIds = new Set(skeleton.options.map((option) => option.id));
|
|
364
|
+
const values = {
|
|
365
|
+
projectName,
|
|
366
|
+
packageName: toPackageName(projectName),
|
|
367
|
+
baseURL: String(ctx.baseURL ?? ''),
|
|
368
|
+
stack: skeleton.stack,
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const seen = new Set();
|
|
372
|
+
const files = [];
|
|
373
|
+
let total = 0;
|
|
374
|
+
for (const file of skeleton.files) {
|
|
375
|
+
if (!whenMatches(file.when, picked)) continue;
|
|
376
|
+
if (seen.has(file.path)) throw new Error(`骨架里有重复文件:${file.path}`);
|
|
377
|
+
seen.add(file.path);
|
|
378
|
+
const content = fillPlaceholders(
|
|
379
|
+
resolveConditions(file.content, picked, declaredIds, file.path),
|
|
380
|
+
values,
|
|
381
|
+
);
|
|
382
|
+
total += content.length;
|
|
383
|
+
if (total > MAX_TOTAL_CHARS) throw new Error('渲染结果过大,检查骨架内容');
|
|
384
|
+
files.push({ path: file.path, content });
|
|
385
|
+
}
|
|
386
|
+
if (!files.length) throw new Error('按当前选项没有生成任何文件');
|
|
387
|
+
return { stack: skeleton.stack, options: pickedList, files };
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** 把骨架的选项 / 提示词挂到技术栈视图上(向导里显示的就是骨架里那份) */
|
|
391
|
+
export function applySkeletonToStack(stack, skeleton, source = 'builtin') {
|
|
392
|
+
if (!skeleton) return { ...stack, skeleton: '', skeletonSource: '' };
|
|
393
|
+
return {
|
|
394
|
+
...stack,
|
|
395
|
+
hint: skeleton.hint || stack.hint,
|
|
396
|
+
options: skeleton.options.map((option) => ({ ...option })),
|
|
397
|
+
defaultOptions: [...skeleton.defaultOptions],
|
|
398
|
+
promptFile: skeleton.promptFile || stack.promptFile || '',
|
|
399
|
+
skeleton: skeleton.id,
|
|
400
|
+
skeletonSource: source,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* ------------------------- 种子 / 读取 ------------------------- */
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* 缺文件就补种子;已存在时:
|
|
408
|
+
* - 内容仍与上次种子一致(没人改过)→ 跟内置版本对齐,自动升级;
|
|
409
|
+
* - 内容被人改过 → 一个字都不动,用户改的优先;
|
|
410
|
+
* - 老版本留下的文件(没有账本)→ 只登记指纹,不覆盖。
|
|
411
|
+
*
|
|
412
|
+
* @returns {{ file: string, created: boolean, updated: boolean, exists: boolean }}
|
|
413
|
+
*/
|
|
414
|
+
export function ensureSkeletonSeed(spaceDir, id = PLAYWRIGHT_TS_SKELETON_ID) {
|
|
415
|
+
if (!hasBuiltinSkeleton(id)) throw new Error(`没有内置骨架:${id}`);
|
|
416
|
+
const rendered = builtinSkeletonText(id);
|
|
417
|
+
const renderedHash = digest(rendered);
|
|
418
|
+
const dest = skeletonFile(spaceDir, id);
|
|
419
|
+
const ledger = readLedger(spaceDir);
|
|
420
|
+
|
|
421
|
+
if (!fs.existsSync(dest)) {
|
|
422
|
+
try {
|
|
423
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
424
|
+
fs.writeFileSync(dest, rendered, 'utf8');
|
|
425
|
+
writeLedger(spaceDir, { ...ledger, [id]: renderedHash });
|
|
426
|
+
return { file: dest, created: true, updated: false, exists: true };
|
|
427
|
+
} catch {
|
|
428
|
+
return { file: dest, created: false, updated: false, exists: false };
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
let current = '';
|
|
433
|
+
try {
|
|
434
|
+
current = fs.readFileSync(dest, 'utf8');
|
|
435
|
+
} catch {
|
|
436
|
+
return { file: dest, created: false, updated: false, exists: true };
|
|
437
|
+
}
|
|
438
|
+
const currentHash = digest(current);
|
|
439
|
+
|
|
440
|
+
// 没有账本:老种子或用户自己写的,先只登记,不冒险覆盖
|
|
441
|
+
if (!ledger[id]) {
|
|
442
|
+
writeLedger(spaceDir, { ...ledger, [id]: currentHash });
|
|
443
|
+
return { file: dest, created: false, updated: false, exists: true };
|
|
444
|
+
}
|
|
445
|
+
// 有人改过 → 保持原样
|
|
446
|
+
if (ledger[id] !== currentHash) {
|
|
447
|
+
return { file: dest, created: false, updated: false, exists: true };
|
|
448
|
+
}
|
|
449
|
+
// 没人改过但内置骨架变了 → 自动升级
|
|
450
|
+
if (currentHash !== renderedHash) {
|
|
451
|
+
try {
|
|
452
|
+
fs.writeFileSync(dest, rendered, 'utf8');
|
|
453
|
+
writeLedger(spaceDir, { ...ledger, [id]: renderedHash });
|
|
454
|
+
return { file: dest, created: false, updated: true, exists: true };
|
|
455
|
+
} catch {
|
|
456
|
+
return { file: dest, created: false, updated: false, exists: true };
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
return { file: dest, created: false, updated: false, exists: true };
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* 读空间里的骨架;没有就补种子再用。
|
|
464
|
+
* 空间里那份写坏了也不能挡住「新建项目」:回退内置骨架并把错误带出去。
|
|
465
|
+
*/
|
|
466
|
+
export function loadSkeleton(spaceDir, id = PLAYWRIGHT_TS_SKELETON_ID) {
|
|
467
|
+
const wanted = optionalText(id, 64) || PLAYWRIGHT_TS_SKELETON_ID;
|
|
468
|
+
try {
|
|
469
|
+
ensureSkeletonSeed(spaceDir, wanted);
|
|
470
|
+
} catch {
|
|
471
|
+
// 种子写不进去(只读空间等)时用内置的
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
const file = skeletonFile(spaceDir, wanted);
|
|
475
|
+
let text = '';
|
|
476
|
+
try {
|
|
477
|
+
text = fs.readFileSync(file, 'utf8');
|
|
478
|
+
} catch {
|
|
479
|
+
text = '';
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
if (text.trim()) {
|
|
483
|
+
try {
|
|
484
|
+
return { skeleton: parseSkeleton(text, { fallbackId: wanted }), source: 'space', error: '' };
|
|
485
|
+
} catch (error) {
|
|
486
|
+
const builtin = hasBuiltinSkeleton(wanted)
|
|
487
|
+
? parseSkeleton(builtinSkeletonText(wanted), { fallbackId: wanted })
|
|
488
|
+
: null;
|
|
489
|
+
if (builtin) {
|
|
490
|
+
return {
|
|
491
|
+
skeleton: builtin,
|
|
492
|
+
source: 'builtin',
|
|
493
|
+
error: `空间里的骨架写错了,已回退内置版本:${
|
|
494
|
+
error instanceof Error ? error.message : String(error)
|
|
495
|
+
}`,
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
throw error;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
if (!hasBuiltinSkeleton(wanted)) throw new Error(`没有内置骨架:${wanted}`);
|
|
503
|
+
return {
|
|
504
|
+
skeleton: parseSkeleton(builtinSkeletonText(wanted), { fallbackId: wanted }),
|
|
505
|
+
source: 'builtin',
|
|
506
|
+
error: '',
|
|
507
|
+
};
|
|
508
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 自动化项目脚手架:可选技术栈注册表。
|
|
3
|
+
*
|
|
4
|
+
* 首期只落地 Playwright + TypeScript(UI)。pytest / Selenium 标记为 planned,
|
|
5
|
+
* 前端灰显「规划中」;后续补齐时只需要新增骨架并把 status 改成 ready,
|
|
6
|
+
* 页面、接口与项目记录都不需要改。
|
|
7
|
+
*
|
|
8
|
+
* `skeleton` 指向空间里的骨架 JSON(`<空间>/.lantern/config/uiauto/skeleton/<id>.json`):
|
|
9
|
+
* 向导里显示的选项与生成出来的文件都以那份骨架为准,这里只是缺省值与兜底。
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const SCAFFOLD_STACKS = [
|
|
13
|
+
{
|
|
14
|
+
id: 'playwright',
|
|
15
|
+
label: 'Playwright + TypeScript',
|
|
16
|
+
hint: 'UI 自动化,企业级分层(配置 / 页面对象 / fixture / 环境变量 / 多环境 / CI)',
|
|
17
|
+
kind: 'ui',
|
|
18
|
+
language: 'ts',
|
|
19
|
+
status: 'ready',
|
|
20
|
+
/** 空间里的骨架 id 与建完项目后自动关联的提示词 */
|
|
21
|
+
skeleton: 'playwright-ts',
|
|
22
|
+
promptFile: '自动化执行提示词.md',
|
|
23
|
+
/** 可选附加内容:向导里勾选(与骨架 JSON 的 options 保持一致) */
|
|
24
|
+
options: [
|
|
25
|
+
{ id: 'authState', label: '登录态示例', hint: 'auth.setup.ts + storageState' },
|
|
26
|
+
{ id: 'ci', label: 'GitHub Actions 流水线', hint: '门禁 / 冒烟分片 / 定时回归' },
|
|
27
|
+
{ id: 'lint', label: 'ESLint + Prettier', hint: '代码规范与格式化' },
|
|
28
|
+
{ id: 'husky', label: '提交规范', hint: 'husky + commitlint + lint-staged' },
|
|
29
|
+
{ id: 'allure', label: 'Allure 报告', hint: 'allure-playwright + reports/allure-results' },
|
|
30
|
+
{ id: 'docker', label: 'Docker + Jenkinsfile', hint: '容器化与 Jenkins 部署' },
|
|
31
|
+
{ id: 'webServer', label: '本地自启动被测系统', hint: 'playwright.config.ts 的 webServer' },
|
|
32
|
+
],
|
|
33
|
+
defaultOptions: ['authState', 'ci', 'lint'],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: 'pytest',
|
|
37
|
+
label: 'pytest(接口 / UI)',
|
|
38
|
+
hint: 'Python 栈,后续版本提供',
|
|
39
|
+
kind: 'api',
|
|
40
|
+
language: 'python',
|
|
41
|
+
status: 'planned',
|
|
42
|
+
skeleton: '',
|
|
43
|
+
promptFile: '',
|
|
44
|
+
options: [],
|
|
45
|
+
defaultOptions: [],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'selenium',
|
|
49
|
+
label: 'Selenium + Java',
|
|
50
|
+
hint: 'Maven 栈,后续版本提供',
|
|
51
|
+
kind: 'ui',
|
|
52
|
+
language: 'java',
|
|
53
|
+
status: 'planned',
|
|
54
|
+
skeleton: '',
|
|
55
|
+
promptFile: '',
|
|
56
|
+
options: [],
|
|
57
|
+
defaultOptions: [],
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
export function findStack(id) {
|
|
62
|
+
const value = String(id ?? '').trim();
|
|
63
|
+
return SCAFFOLD_STACKS.find((stack) => stack.id === value) ?? null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* 只把前端需要的字段透出去(不暴露模板实现细节)。
|
|
68
|
+
* 骨架里的选项 / 提示词由 `library.mjs` 的 `applySkeletonToStack` 盖上。
|
|
69
|
+
*/
|
|
70
|
+
export function listStacks() {
|
|
71
|
+
return SCAFFOLD_STACKS.map((stack) => ({
|
|
72
|
+
id: stack.id,
|
|
73
|
+
label: stack.label,
|
|
74
|
+
hint: stack.hint,
|
|
75
|
+
kind: stack.kind,
|
|
76
|
+
language: stack.language,
|
|
77
|
+
status: stack.status,
|
|
78
|
+
skeleton: stack.skeleton,
|
|
79
|
+
promptFile: stack.promptFile,
|
|
80
|
+
options: stack.options.map((option) => ({ ...option })),
|
|
81
|
+
defaultOptions: [...stack.defaultOptions],
|
|
82
|
+
}));
|
|
83
|
+
}
|