@bleedingdev/modern-js-create 3.2.0-ultramodern.117 → 3.2.0-ultramodern.119
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 +35 -125
- package/dist/cjs/create-package-root.cjs +1 -1
- package/dist/cjs/index.cjs +11 -602
- package/dist/cjs/locale/en.cjs +12 -19
- package/dist/cjs/locale/zh.cjs +12 -19
- package/dist/cjs/ultramodern-workspace.cjs +18 -21
- package/dist/esm/create-package-root.js +1 -1
- package/dist/esm/index.js +13 -603
- package/dist/esm/locale/en.js +12 -19
- package/dist/esm/locale/zh.js +12 -19
- package/dist/esm/ultramodern-workspace.js +19 -19
- package/dist/esm-node/create-package-root.js +1 -1
- package/dist/esm-node/index.js +13 -603
- package/dist/esm-node/locale/en.js +12 -19
- package/dist/esm-node/locale/zh.js +12 -19
- package/dist/esm-node/ultramodern-workspace.js +19 -19
- package/dist/types/locale/en.d.ts +0 -7
- package/dist/types/locale/index.d.ts +0 -14
- package/dist/types/locale/zh.d.ts +0 -7
- package/dist/types/ultramodern-workspace.d.ts +0 -1
- package/package.json +4 -5
- package/template-workspace/.github/workflows/ultramodern-workspace-gates.yml.handlebars +22 -6
- package/template-workspace/AGENTS.md +8 -4
- package/template-workspace/README.md.handlebars +11 -1
- package/template-workspace/lefthook.yml +18 -4
- package/template-workspace/scripts/bootstrap-agent-skills.mjs +38 -24
- package/template/.agents/skills-lock.json +0 -34
- package/template/.browserslistrc +0 -4
- package/template/.codex/hooks.json +0 -16
- package/template/.github/renovate.json +0 -53
- package/template/.github/workflows/ultramodern-gates.yml.handlebars +0 -54
- package/template/.gitignore.handlebars +0 -30
- package/template/.mise.toml.handlebars +0 -2
- package/template/.nvmrc +0 -2
- package/template/AGENTS.md +0 -23
- package/template/README.md +0 -111
- package/template/api/effect/index.ts.handlebars +0 -34
- package/template/api/lambda/hello.ts.handlebars +0 -6
- package/template/config/favicon.svg +0 -5
- package/template/config/public/assets/ultramodern-logo.svg +0 -6
- package/template/config/public/locales/cs/translation.json +0 -44
- package/template/config/public/locales/en/translation.json +0 -44
- package/template/lefthook.yml +0 -10
- package/template/modern.config.ts.handlebars +0 -78
- package/template/oxfmt.config.ts +0 -15
- package/template/oxlint.config.ts +0 -19
- package/template/package.json.handlebars +0 -69
- package/template/pnpm-workspace.yaml +0 -34
- package/template/postcss.config.mjs.handlebars +0 -6
- package/template/rstest.config.mts +0 -5
- package/template/scripts/bootstrap-agent-skills.mjs +0 -228
- package/template/scripts/check-i18n-strings.mjs +0 -3
- package/template/scripts/validate-ultramodern.mjs.handlebars +0 -658
- package/template/shared/effect/api.ts.handlebars +0 -17
- package/template/src/modern-app-env.d.ts +0 -3
- package/template/src/modern.runtime.ts.handlebars +0 -23
- package/template/src/routes/[lang]/page.tsx.handlebars +0 -209
- package/template/src/routes/index.css.handlebars +0 -266
- package/template/src/routes/layout.tsx.handlebars +0 -10
- package/template/tailwind.config.ts.handlebars +0 -10
- package/template/tests/tsconfig.json +0 -7
- package/template/tests/ultramodern.contract.test.ts.handlebars +0 -163
- package/template/tsconfig.json +0 -121
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
// @effect-diagnostics nodeBuiltinImport:off processEnv:off
|
|
2
|
-
import { appTools, defineConfig, presetUltramodern } from '@modern-js/app-tools';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
{{#if enableBff}}import { bffPlugin } from '@modern-js/plugin-bff';
|
|
5
|
-
{{/if}}import { i18nPlugin } from '@modern-js/plugin-i18n';
|
|
6
|
-
{{#if isTanstackRouter}}import { tanstackRouterPlugin } from '@modern-js/plugin-tanstack';
|
|
7
|
-
{{/if}}
|
|
8
|
-
const appId = process.env['MODERN_BASELINE_APP_ID'] || path.basename(process.cwd());
|
|
9
|
-
const enableModuleFederationSSR = process.env['MODERN_BASELINE_ENABLE_MF_SSR'] !== 'false';
|
|
10
|
-
const enableBffRequestId = process.env['MODERN_BASELINE_ENABLE_BFF_REQUEST_ID'] !== 'false';
|
|
11
|
-
const enableTelemetryExporters =
|
|
12
|
-
process.env['MODERN_BASELINE_ENABLE_TELEMETRY_EXPORTERS'] !== 'false';
|
|
13
|
-
const telemetryFailLoudStartup = process.env['MODERN_TELEMETRY_FAIL_LOUD_STARTUP'] !== 'false';
|
|
14
|
-
const otlpEndpoint = process.env['MODERN_TELEMETRY_OTLP_ENDPOINT'];
|
|
15
|
-
const configuredSiteUrl = process.env['MODERN_PUBLIC_SITE_URL'];
|
|
16
|
-
const hasConfiguredSiteUrl = typeof configuredSiteUrl === 'string' && configuredSiteUrl.length > 0;
|
|
17
|
-
const isProductionBuild =
|
|
18
|
-
process.env['NODE_ENV'] === 'production' || process.argv.includes('build');
|
|
19
|
-
|
|
20
|
-
if (isProductionBuild && !hasConfiguredSiteUrl) {
|
|
21
|
-
throw new Error(
|
|
22
|
-
'MODERN_PUBLIC_SITE_URL must be set for production builds so canonical and hreflang URLs use the deployed origin.',
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const siteUrl = hasConfiguredSiteUrl ? configuredSiteUrl : 'http://localhost:8080';
|
|
27
|
-
const victoriaMetricsEndpoint = process.env['MODERN_TELEMETRY_VICTORIA_ENDPOINT'];
|
|
28
|
-
|
|
29
|
-
// https://bleedingdev.github.io/ultramodern.js/configure/app/usage.html
|
|
30
|
-
export default defineConfig(
|
|
31
|
-
presetUltramodern(
|
|
32
|
-
{
|
|
33
|
-
{{#if enableBff}} bff: {
|
|
34
|
-
{{#if useEffectBff}} effect: {
|
|
35
|
-
entry: './api/effect/index',
|
|
36
|
-
openapi: true,
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
{{/if}} runtimeFramework: '{{bffRuntime}}',
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
{{/if}} html: {
|
|
43
|
-
meta: {
|
|
44
|
-
viewport: 'width=device-width, initial-scale=1.0, viewport-fit=cover',
|
|
45
|
-
},
|
|
46
|
-
title: 'UltraModern.js Starter',
|
|
47
|
-
},
|
|
48
|
-
plugins: [
|
|
49
|
-
appTools(),
|
|
50
|
-
i18nPlugin({
|
|
51
|
-
localeDetection: {
|
|
52
|
-
fallbackLanguage: 'en',
|
|
53
|
-
languages: ['en', 'cs'],
|
|
54
|
-
localePathRedirect: true,
|
|
55
|
-
},
|
|
56
|
-
}),
|
|
57
|
-
{{#if isTanstackRouter}}
|
|
58
|
-
tanstackRouterPlugin(),
|
|
59
|
-
{{/if}}{{#if enableBff}}
|
|
60
|
-
bffPlugin(),
|
|
61
|
-
{{/if}} ],
|
|
62
|
-
source: {
|
|
63
|
-
globalVars: {
|
|
64
|
-
ULTRAMODERN_SITE_URL: siteUrl,
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
appId,
|
|
70
|
-
enableBffRequestId,
|
|
71
|
-
enableModuleFederationSSR,
|
|
72
|
-
enableTelemetryExporters,
|
|
73
|
-
...(typeof otlpEndpoint === 'string' ? { otlpEndpoint } : {}),
|
|
74
|
-
telemetryFailLoudStartup,
|
|
75
|
-
...(typeof victoriaMetricsEndpoint === 'string' ? { victoriaMetricsEndpoint } : {}),
|
|
76
|
-
},
|
|
77
|
-
),
|
|
78
|
-
);
|
package/template/oxfmt.config.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'oxfmt';
|
|
2
|
-
import ultracite from 'ultracite/oxfmt';
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
extends: [ultracite],
|
|
6
|
-
ignorePatterns: [
|
|
7
|
-
'.agents',
|
|
8
|
-
'dist',
|
|
9
|
-
'node_modules',
|
|
10
|
-
'.modern',
|
|
11
|
-
'.modernjs',
|
|
12
|
-
'**/routeTree.gen.ts',
|
|
13
|
-
],
|
|
14
|
-
singleQuote: true,
|
|
15
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from 'oxlint';
|
|
2
|
-
import core from 'ultracite/oxlint/core';
|
|
3
|
-
import react from 'ultracite/oxlint/react';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
env: {
|
|
7
|
-
browser: true,
|
|
8
|
-
node: true,
|
|
9
|
-
},
|
|
10
|
-
extends: [core, react],
|
|
11
|
-
ignorePatterns: [
|
|
12
|
-
'.agents',
|
|
13
|
-
'dist',
|
|
14
|
-
'node_modules',
|
|
15
|
-
'.modern',
|
|
16
|
-
'.modernjs',
|
|
17
|
-
'**/routeTree.gen.ts',
|
|
18
|
-
],
|
|
19
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "{{packageName}}",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"packageManager": "pnpm@{{pnpmVersion}}",
|
|
7
|
-
"scripts": {
|
|
8
|
-
"reset": "npx rimraf node_modules ./**/node_modules",
|
|
9
|
-
"dev": "modern dev",
|
|
10
|
-
"build": "modern build",
|
|
11
|
-
"serve": "modern serve",
|
|
12
|
-
"test": "rstest run",
|
|
13
|
-
"typecheck": "node -e \"const fs = require('node:fs'); const { execFileSync, spawnSync } = require('node:child_process'); const bin = execFileSync('effect-tsgo', ['get-exe-path'], { encoding: 'utf8' }).trim(); if (process.platform !== 'win32') fs.chmodSync(bin, 0o755); const result = spawnSync(bin, ['--noEmit', '-p', 'tsconfig.json'], { stdio: 'inherit' }); process.exit(result.status ?? 1);\"",
|
|
14
|
-
"i18n:check": "node ./scripts/check-i18n-strings.mjs",
|
|
15
|
-
{{#unless isSubproject}}
|
|
16
|
-
"skills:install": "node ./scripts/bootstrap-agent-skills.mjs",
|
|
17
|
-
"skills:check": "node ./scripts/bootstrap-agent-skills.mjs --check",
|
|
18
|
-
"postinstall": "oxfmt . && node ./scripts/bootstrap-agent-skills.mjs",
|
|
19
|
-
{{/unless}}
|
|
20
|
-
"ultramodern:check": "pnpm format:check && pnpm lint && pnpm typecheck && pnpm i18n:check && pnpm test{{#unless isSubproject}} && pnpm skills:check{{/unless}} && node ./scripts/validate-ultramodern.mjs",
|
|
21
|
-
"format": "oxfmt .",
|
|
22
|
-
"format:check": "oxfmt --check .",
|
|
23
|
-
"lint": "oxlint .",
|
|
24
|
-
"lint:fix": "oxlint . --fix"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@modern-js/plugin-i18n": "{{pluginI18nVersion}}",
|
|
28
|
-
{{#if isTanstackRouter}} "@modern-js/plugin-tanstack": "{{pluginTanstackVersion}}",
|
|
29
|
-
{{/if}}
|
|
30
|
-
"@modern-js/runtime": "{{runtimeVersion}}",
|
|
31
|
-
{{#if isTanstackRouter}} "@tanstack/react-router": "{{tanstackRouterVersion}}",
|
|
32
|
-
{{/if}}
|
|
33
|
-
"i18next": "{{i18nextVersion}}",
|
|
34
|
-
"react": "{{reactVersion}}",
|
|
35
|
-
"react-dom": "{{reactDomVersion}}",
|
|
36
|
-
"react-i18next": "{{reactI18nextVersion}}"
|
|
37
|
-
},
|
|
38
|
-
"devDependencies": {
|
|
39
|
-
"@effect/tsgo": "{{effectTsgoVersion}}",
|
|
40
|
-
"@modern-js/adapter-rstest": "{{adapterRstestVersion}}",
|
|
41
|
-
"@modern-js/app-tools": "{{appToolsVersion}}",
|
|
42
|
-
"@modern-js/code-tools": "{{codeToolsVersion}}",
|
|
43
|
-
"@modern-js/create": "{{createVersion}}",
|
|
44
|
-
{{#if enableBff}} "@modern-js/plugin-bff": "{{pluginBffVersion}}",
|
|
45
|
-
{{/if}} "@modern-js/tsconfig": "{{tsconfigVersion}}",
|
|
46
|
-
"@rstest/core": "{{rstestCoreVersion}}",
|
|
47
|
-
{{#if enableTailwind}}
|
|
48
|
-
"@tailwindcss/postcss": "^{{tailwindPostcssVersion}}",
|
|
49
|
-
{{/if}}
|
|
50
|
-
"@types/node": "^20",
|
|
51
|
-
"@types/react": "{{typesReactVersion}}",
|
|
52
|
-
"@types/react-dom": "{{typesReactDomVersion}}",
|
|
53
|
-
"@typescript/native-preview": "{{typescriptNativePreviewVersion}}",
|
|
54
|
-
"happy-dom": "{{happyDomVersion}}",
|
|
55
|
-
{{#unless isSubproject}}
|
|
56
|
-
"lefthook": "^2.1.9",
|
|
57
|
-
{{/unless}}
|
|
58
|
-
"oxfmt": "{{oxfmtVersion}}",
|
|
59
|
-
"oxlint": "{{oxlintVersion}}",
|
|
60
|
-
{{#if enableTailwind}} "postcss": "{{postcssVersion}}",
|
|
61
|
-
{{/if}} "rimraf": "^6.1.3"{{#if enableTailwind}},
|
|
62
|
-
"tailwindcss": "^{{tailwindVersion}}"{{/if}},
|
|
63
|
-
"ultracite": "{{ultraciteVersion}}"
|
|
64
|
-
},
|
|
65
|
-
"engines": {
|
|
66
|
-
"node": ">=20",
|
|
67
|
-
"pnpm": ">={{pnpmVersion}} <11.6.0"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
minimumReleaseAge: 1440
|
|
2
|
-
minimumReleaseAgeStrict: true
|
|
3
|
-
minimumReleaseAgeIgnoreMissingTime: false
|
|
4
|
-
minimumReleaseAgeExclude:
|
|
5
|
-
- '@bleedingdev/modern-js-*'
|
|
6
|
-
- '@tanstack/react-router'
|
|
7
|
-
- '@tanstack/router-core'
|
|
8
|
-
- '@typescript/native-preview'
|
|
9
|
-
- '@typescript/native-preview-*'
|
|
10
|
-
- '@types/react'
|
|
11
|
-
trustPolicy: no-downgrade
|
|
12
|
-
trustPolicyIgnoreAfter: 1440
|
|
13
|
-
blockExoticSubdeps: true
|
|
14
|
-
engineStrict: true
|
|
15
|
-
pmOnFail: error
|
|
16
|
-
verifyDepsBeforeRun: error
|
|
17
|
-
strictDepBuilds: true
|
|
18
|
-
|
|
19
|
-
allowBuilds:
|
|
20
|
-
'@swc/core': true
|
|
21
|
-
core-js: true
|
|
22
|
-
esbuild: true
|
|
23
|
-
lefthook: true
|
|
24
|
-
msgpackr-extract: true
|
|
25
|
-
sharp: true
|
|
26
|
-
workerd: true
|
|
27
|
-
onlyBuiltDependencies:
|
|
28
|
-
- '@swc/core'
|
|
29
|
-
- core-js
|
|
30
|
-
- esbuild
|
|
31
|
-
- lefthook
|
|
32
|
-
- msgpackr-extract
|
|
33
|
-
- sharp
|
|
34
|
-
- workerd
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from 'node:child_process';
|
|
2
|
-
import fs from 'node:fs';
|
|
3
|
-
import os from 'node:os';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
|
|
6
|
-
const root = process.cwd();
|
|
7
|
-
const lockPath = path.join(root, '.agents/skills-lock.json');
|
|
8
|
-
const checkOnly = process.argv.includes('--check');
|
|
9
|
-
const force = process.argv.includes('--force');
|
|
10
|
-
|
|
11
|
-
const readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
12
|
-
|
|
13
|
-
const run = (command, args, options = {}) =>
|
|
14
|
-
execFileSync(command, args, {
|
|
15
|
-
cwd: options.cwd ?? root,
|
|
16
|
-
encoding: 'utf-8',
|
|
17
|
-
stdio: options.stdio ?? ['ignore', 'pipe', 'pipe'],
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const commandExists = (command) => {
|
|
21
|
-
try {
|
|
22
|
-
run(command, ['--version'], { stdio: 'ignore' });
|
|
23
|
-
return true;
|
|
24
|
-
} catch {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const runShell = (script) =>
|
|
30
|
-
run('sh', ['-lc', script], {
|
|
31
|
-
stdio: 'inherit',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const installGit = () => {
|
|
35
|
-
if (commandExists('git')) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (commandExists('brew')) {
|
|
40
|
-
run('brew', ['install', 'git'], { stdio: 'inherit' });
|
|
41
|
-
} else if (process.platform === 'linux' && commandExists('apt-get')) {
|
|
42
|
-
const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';
|
|
43
|
-
runShell(`${sudo}apt-get update && ${sudo}apt-get install -y git`);
|
|
44
|
-
} else if (process.platform === 'linux' && commandExists('dnf')) {
|
|
45
|
-
const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';
|
|
46
|
-
runShell(`${sudo}dnf install -y git`);
|
|
47
|
-
} else if (process.platform === 'linux' && commandExists('yum')) {
|
|
48
|
-
const sudo = typeof process.getuid === 'function' && process.getuid() === 0 ? '' : 'sudo ';
|
|
49
|
-
runShell(`${sudo}yum install -y git`);
|
|
50
|
-
} else if (process.platform === 'linux' && commandExists('apk')) {
|
|
51
|
-
runShell('apk add --no-cache git');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (!commandExists('git')) {
|
|
55
|
-
throw new Error(
|
|
56
|
-
'Git is required for UltraModern setup. Install git and run pnpm skills:install again.',
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const isInsideGitWorkTree = () => {
|
|
62
|
-
try {
|
|
63
|
-
return run('git', ['rev-parse', '--is-inside-work-tree']).trim() === 'true';
|
|
64
|
-
} catch {
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const initializeGitRepository = () => {
|
|
70
|
-
if (isInsideGitWorkTree()) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
try {
|
|
75
|
-
run('git', ['init', '-b', 'main'], { stdio: 'inherit' });
|
|
76
|
-
} catch {
|
|
77
|
-
run('git', ['init'], { stdio: 'inherit' });
|
|
78
|
-
run('git', ['branch', '-M', 'main'], { stdio: 'inherit' });
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const installLefthook = () => {
|
|
83
|
-
try {
|
|
84
|
-
run('lefthook', ['install'], { stdio: 'inherit' });
|
|
85
|
-
} catch (error) {
|
|
86
|
-
console.warn(`Unable to install lefthook hooks: ${error.message}`);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const removeTree = (dir) =>
|
|
91
|
-
fs.rmSync(dir, {
|
|
92
|
-
force: true,
|
|
93
|
-
maxRetries: 5,
|
|
94
|
-
recursive: true,
|
|
95
|
-
retryDelay: 100,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const cloneSource = (source, targetDir) => {
|
|
99
|
-
if (source.commit) {
|
|
100
|
-
run('git', ['init', targetDir]);
|
|
101
|
-
run('git', ['remote', 'add', 'origin', source.repository], {
|
|
102
|
-
cwd: targetDir,
|
|
103
|
-
});
|
|
104
|
-
run('git', ['fetch', '--depth', '1', '--quiet', 'origin', source.commit], {
|
|
105
|
-
cwd: targetDir,
|
|
106
|
-
});
|
|
107
|
-
run(
|
|
108
|
-
'git',
|
|
109
|
-
[
|
|
110
|
-
'-c',
|
|
111
|
-
'advice.detachedHead=false',
|
|
112
|
-
'checkout',
|
|
113
|
-
'--detach',
|
|
114
|
-
'--quiet',
|
|
115
|
-
'FETCH_HEAD',
|
|
116
|
-
],
|
|
117
|
-
{ cwd: targetDir },
|
|
118
|
-
);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const repo = source.repository.replace(/^https:\/\/github.com\//u, '');
|
|
123
|
-
try {
|
|
124
|
-
run('gh', ['repo', 'clone', repo, targetDir, '--', '--depth', '1', '--quiet']);
|
|
125
|
-
} catch {
|
|
126
|
-
run('git', ['clone', '--depth', '1', '--quiet', source.repository, targetDir]);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const resolveSkillDir = (sourceRoot, skillName) => {
|
|
131
|
-
const candidates = [
|
|
132
|
-
path.join(sourceRoot, skillName),
|
|
133
|
-
path.join(sourceRoot, 'skills', skillName),
|
|
134
|
-
path.join(sourceRoot, 'skills', 'engineering', skillName),
|
|
135
|
-
path.join(sourceRoot, 'skills', 'productivity', skillName),
|
|
136
|
-
];
|
|
137
|
-
return candidates.find((candidate) => fs.existsSync(path.join(candidate, 'SKILL.md')));
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
if (!fs.existsSync(lockPath)) {
|
|
141
|
-
console.error('Missing .agents/skills-lock.json');
|
|
142
|
-
process.exit(1);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const lock = readJson(lockPath);
|
|
146
|
-
const installDir = path.join(root, lock.installDir ?? '.agents/skills');
|
|
147
|
-
const sources = lock.sources ?? [];
|
|
148
|
-
const requiredCloneSources = sources.filter((source) => source.install === 'clone');
|
|
149
|
-
const optionalCloneSources = sources.filter(
|
|
150
|
-
(source) => source.install === 'clone-if-authorized',
|
|
151
|
-
);
|
|
152
|
-
const requiredSkills = [
|
|
153
|
-
...(lock.baseline ?? []),
|
|
154
|
-
...requiredCloneSources.flatMap((source) => source.baseline ?? []),
|
|
155
|
-
].filter(
|
|
156
|
-
(skill, index, skills) =>
|
|
157
|
-
skills.findIndex((candidate) => candidate.name === skill.name) === index,
|
|
158
|
-
);
|
|
159
|
-
|
|
160
|
-
if (checkOnly) {
|
|
161
|
-
const missingRequired = requiredSkills
|
|
162
|
-
.map((skill) => skill.name)
|
|
163
|
-
.filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md')));
|
|
164
|
-
const missingOptional = optionalCloneSources.flatMap((source) =>
|
|
165
|
-
(source.baseline ?? [])
|
|
166
|
-
.map((skill) => skill.name)
|
|
167
|
-
.filter((skillName) => !fs.existsSync(path.join(installDir, skillName, 'SKILL.md'))),
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
if (missingRequired.length > 0) {
|
|
171
|
-
console.error(
|
|
172
|
-
`Required agent skills not installed: ${missingRequired.join(', ')}. Run pnpm skills:install.`,
|
|
173
|
-
);
|
|
174
|
-
process.exit(1);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (missingOptional.length > 0) {
|
|
178
|
-
console.warn(
|
|
179
|
-
`Private skills not installed: ${missingOptional.join(', ')}. Run pnpm skills:install if you have access.`,
|
|
180
|
-
);
|
|
181
|
-
} else {
|
|
182
|
-
console.log('Required and private agent skills are installed.');
|
|
183
|
-
process.exit(0);
|
|
184
|
-
}
|
|
185
|
-
console.log('Required agent skills are installed.');
|
|
186
|
-
process.exit(0);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
fs.mkdirSync(installDir, { recursive: true });
|
|
190
|
-
installGit();
|
|
191
|
-
|
|
192
|
-
for (const source of [...requiredCloneSources, ...optionalCloneSources]) {
|
|
193
|
-
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'ultramodern-skills-'));
|
|
194
|
-
try {
|
|
195
|
-
try {
|
|
196
|
-
cloneSource(source, tempDir);
|
|
197
|
-
} catch (error) {
|
|
198
|
-
if (source.install === 'clone-if-authorized') {
|
|
199
|
-
console.warn(
|
|
200
|
-
`Skipping ${source.repository}; current developer may not have access.`,
|
|
201
|
-
);
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
for (const skill of source.baseline ?? []) {
|
|
207
|
-
const sourceSkillDir = resolveSkillDir(tempDir, skill.name);
|
|
208
|
-
if (!sourceSkillDir) {
|
|
209
|
-
throw new Error(`Skill ${skill.name} not found in ${source.repository}`);
|
|
210
|
-
}
|
|
211
|
-
const targetSkillDir = path.join(installDir, skill.name);
|
|
212
|
-
if (fs.existsSync(targetSkillDir)) {
|
|
213
|
-
if (!force) {
|
|
214
|
-
console.log(`Skipping existing ${skill.name}`);
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
removeTree(targetSkillDir);
|
|
218
|
-
}
|
|
219
|
-
fs.cpSync(sourceSkillDir, targetSkillDir, { recursive: true });
|
|
220
|
-
console.log(`Installed ${skill.name}`);
|
|
221
|
-
}
|
|
222
|
-
} finally {
|
|
223
|
-
removeTree(tempDir);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
initializeGitRepository();
|
|
228
|
-
installLefthook();
|