@open-dy/vibecoding-cli 0.0.1-beta.1
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 +47 -0
- package/assets/schemas/custom-card-schema.json +102 -0
- package/bin/vibecoding +89 -0
- package/bin/vibecoding-dev +308 -0
- package/bin/vibecoding-interest-card.mjs +35 -0
- package/bin/vibecoding.mjs +9 -0
- package/package.json +58 -0
- package/src/adapters/interest-card/opencard/commands.mjs +62 -0
- package/src/adapters/interest-card/opencard/dev-watch.mjs +203 -0
- package/src/adapters/interest-card/opencard/dev_run.sh +126 -0
- package/src/adapters/interest-card/opencard/eslint-plugin-opencard-taro.mjs +278 -0
- package/src/adapters/interest-card/opencard/lint-lynx-css.mjs +676 -0
- package/src/adapters/interest-card/opencard/lint.sh +131 -0
- package/src/adapters/interest-card/opencard/lynx-css-rules.mjs +508 -0
- package/src/adapters/interest-card/opencard/pack.sh +27 -0
- package/src/adapters/interest-card/opencard/validate-opencard-structure.mjs +65 -0
- package/src/adapters/interest-card/opencard/validate-widget-shell.mjs +902 -0
- package/src/adapters/interest-card/opencard/validate.mjs +11 -0
- package/src/adapters/interest-card/opencard/write-web-config.mjs +17 -0
- package/src/build/opencard-environment.mjs +49 -0
- package/src/build/turbo-config.mjs +140 -0
- package/src/cli.mjs +104 -0
- package/src/commands/build.mjs +138 -0
- package/src/commands/db.mjs +14 -0
- package/src/commands/dev.mjs +319 -0
- package/src/commands/lint.mjs +176 -0
- package/src/commands/pack.mjs +169 -0
- package/src/commands/turbo.mjs +36 -0
- package/src/commands/validate.mjs +26 -0
- package/src/commands/verify.mjs +602 -0
- package/src/core/args.mjs +101 -0
- package/src/core/context.mjs +101 -0
- package/src/core/environment.mjs +55 -0
- package/src/core/errors.mjs +14 -0
- package/src/core/ports.mjs +76 -0
- package/src/core/process-output.mjs +25 -0
- package/src/core/runner.mjs +90 -0
- package/src/core/service-log-context.mjs +27 -0
- package/src/core/web-config.mjs +13 -0
- package/src/lint/lint-lynx-css.mjs +244 -0
- package/src/lint/lynx-css-rules.mjs +138 -0
- package/src/preview/dev-watch.mjs +38 -0
- package/src/preview/start-preview.mjs +213 -0
- package/src/preview/watch-card-routing.mjs +89 -0
- package/src/scripts/pack.mjs +15 -0
- package/src/validators/dependencies.mjs +34 -0
- package/src/validators/empty-project.mjs +29 -0
- package/src/validators/feed-card.cjs +156 -0
- package/src/validators/feed-card.mjs +32 -0
- package/src/validators/opencard-structure.mjs +58 -0
- package/src/validators/routes.cjs +470 -0
- package/src/validators/routes.mjs +17 -0
- package/src/validators/sql.mjs +57 -0
- package/src/validators/widget-shell.mjs +107 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* opencard 结构校验:禁止 Taro App 入口,并要求唯一的 Actual FMP 标记。
|
|
4
|
+
*/
|
|
5
|
+
import fs from 'fs';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
|
|
9
|
+
const __dirname = path.join(process.env.VIBECODING_OPENCARD_ROOT || process.cwd(), 'scripts');
|
|
10
|
+
const SRC = path.resolve(__dirname, '..', 'src');
|
|
11
|
+
|
|
12
|
+
const FORBIDDEN_APP_ENTRIES = ['app.ts', 'app.tsx', 'app.js', 'app.jsx'];
|
|
13
|
+
const TIMING_FLAG_PATTERN =
|
|
14
|
+
/__lynx_timing_flag\s*=\s*(["'])__lynx_timing_actual_fmp\1/g;
|
|
15
|
+
|
|
16
|
+
function findTimingFlags(dir) {
|
|
17
|
+
if (!fs.existsSync(dir)) return [];
|
|
18
|
+
|
|
19
|
+
const locations = [];
|
|
20
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
21
|
+
const target = path.join(dir, entry.name);
|
|
22
|
+
if (entry.isDirectory()) {
|
|
23
|
+
locations.push(...findTimingFlags(target));
|
|
24
|
+
} else if (/\.[jt]sx$/.test(entry.name)) {
|
|
25
|
+
const source = fs.readFileSync(target, 'utf8');
|
|
26
|
+
for (const match of source.matchAll(TIMING_FLAG_PATTERN)) {
|
|
27
|
+
const line = source.slice(0, match.index).split('\n').length;
|
|
28
|
+
locations.push(`${path.relative(SRC, target)}:${line}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return locations;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function main() {
|
|
36
|
+
const found = FORBIDDEN_APP_ENTRIES.filter((name) =>
|
|
37
|
+
fs.existsSync(path.join(SRC, name)),
|
|
38
|
+
).map((name) => `opencard/src/${name}`);
|
|
39
|
+
|
|
40
|
+
if (found.length === 0) {
|
|
41
|
+
const timingFlagLocations = findTimingFlags(SRC);
|
|
42
|
+
if (timingFlagLocations.length === 1) return;
|
|
43
|
+
console.error(
|
|
44
|
+
`ERROR: opencard/src 中必须恰好存在一个 __lynx_timing_flag="__lynx_timing_actual_fmp",当前找到 ${timingFlagLocations.length} 个。`,
|
|
45
|
+
);
|
|
46
|
+
if (timingFlagLocations.length > 0) {
|
|
47
|
+
console.error('找到的位置:');
|
|
48
|
+
for (const location of timingFlagLocations) {
|
|
49
|
+
console.error(` - opencard/src/${location}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.error('ERROR: opencard 不支持 Taro App 入口文件(app.ts / app.tsx 等)。');
|
|
56
|
+
console.error('请删除以下文件;应用级配置仅用 app.config.ts,全局样式用 app.css:');
|
|
57
|
+
for (const file of found) {
|
|
58
|
+
console.error(` - ${file}`);
|
|
59
|
+
}
|
|
60
|
+
console.error(
|
|
61
|
+
'页面入口、useLoad 等逻辑请写在 opencard/src/pages/index/index.tsx。',
|
|
62
|
+
);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|