@startupjs/cli 0.63.0-alpha.0 → 0.63.0-alpha.3
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/commands/check.js +12 -1
- package/commands/index.js +1 -0
- package/commands/skills.js +66 -0
- package/package.json +4 -3
package/commands/check.js
CHANGED
|
@@ -34,7 +34,18 @@ export const options = [
|
|
|
34
34
|
export async function action (files = [], options) {
|
|
35
35
|
const requireFromProject = createRequire(join(process.cwd(), 'package.json'))
|
|
36
36
|
const { generateTeamplayEnv } = requireFromProject('teamplay/babel/loader')
|
|
37
|
-
|
|
37
|
+
let pluginTypes = []
|
|
38
|
+
let featuresType
|
|
39
|
+
try {
|
|
40
|
+
const {
|
|
41
|
+
getPluginTypeEntries,
|
|
42
|
+
getStaticFeaturesType
|
|
43
|
+
} = requireFromProject('@startupjs/babel-plugin-startupjs-plugins/loader')
|
|
44
|
+
pluginTypes = getPluginTypeEntries(process.cwd())
|
|
45
|
+
featuresType = getStaticFeaturesType(process.cwd())
|
|
46
|
+
} catch {}
|
|
47
|
+
|
|
48
|
+
generateTeamplayEnv({ fallbackModelsFolders: ['model'], pluginTypes, featuresType })
|
|
38
49
|
|
|
39
50
|
const args = [...files]
|
|
40
51
|
if (options.project) args.push('--project', options.project)
|
package/commands/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export * as startProduction from './start-production.js'
|
|
|
7
7
|
export * as startWorker from './start-worker.js'
|
|
8
8
|
export * as startWorkerProduction from './start-worker-production.js'
|
|
9
9
|
export * as build from './build.js'
|
|
10
|
+
export * as skills from './skills.js'
|
|
10
11
|
export * as install from 'create-startupjs/install'
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from 'fs'
|
|
2
|
+
import { createRequire } from 'module'
|
|
3
|
+
import { dirname, join } from 'path'
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url)
|
|
6
|
+
|
|
7
|
+
export const name = 'skills'
|
|
8
|
+
export const description = 'List StartupJS agent skills installed from @startupjs/skills'
|
|
9
|
+
|
|
10
|
+
export async function action () {
|
|
11
|
+
const skillsRoot = dirname(require.resolve('@startupjs/skills/package.json'))
|
|
12
|
+
const skills = getSkills(skillsRoot)
|
|
13
|
+
|
|
14
|
+
console.log('skills:')
|
|
15
|
+
for (const skill of skills) {
|
|
16
|
+
console.log(` - name: ${toYamlString(skill.name)}`)
|
|
17
|
+
console.log(` description: ${toYamlString(skill.description)}`)
|
|
18
|
+
console.log(` path: ${toYamlString(skill.path)}`)
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getSkills (skillsRoot) {
|
|
23
|
+
const skills = []
|
|
24
|
+
for (const entry of readdirSync(skillsRoot, { withFileTypes: true })) {
|
|
25
|
+
if (!entry.isDirectory()) continue
|
|
26
|
+
const skillPath = join(skillsRoot, entry.name, 'SKILL.md')
|
|
27
|
+
if (!existsSync(skillPath)) continue
|
|
28
|
+
const metadata = getSkillMetadata(skillPath)
|
|
29
|
+
skills.push({
|
|
30
|
+
name: metadata.name || entry.name,
|
|
31
|
+
description: metadata.description || '',
|
|
32
|
+
path: skillPath
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name))
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getSkillMetadata (skillPath) {
|
|
39
|
+
const content = readFileSync(skillPath, 'utf8')
|
|
40
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/)
|
|
41
|
+
if (!match) return {}
|
|
42
|
+
|
|
43
|
+
const metadata = {}
|
|
44
|
+
for (const line of match[1].split('\n')) {
|
|
45
|
+
const field = line.match(/^([A-Za-z0-9_-]+):\s*(.*)$/)
|
|
46
|
+
if (!field) continue
|
|
47
|
+
metadata[field[1]] = unquoteYamlString(field[2])
|
|
48
|
+
}
|
|
49
|
+
return metadata
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function unquoteYamlString (value) {
|
|
53
|
+
value = value.trim()
|
|
54
|
+
if (!value) return ''
|
|
55
|
+
if (
|
|
56
|
+
(value.startsWith('"') && value.endsWith('"')) ||
|
|
57
|
+
(value.startsWith("'") && value.endsWith("'"))
|
|
58
|
+
) {
|
|
59
|
+
return value.slice(1, -1)
|
|
60
|
+
}
|
|
61
|
+
return value
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function toYamlString (value) {
|
|
65
|
+
return JSON.stringify(value)
|
|
66
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@startupjs/cli",
|
|
3
|
-
"version": "0.63.0-alpha.
|
|
3
|
+
"version": "0.63.0-alpha.3",
|
|
4
4
|
"description": "The command-line tool for StartupJS apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,13 +11,14 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@startupjs/patches": "^0.63.0-alpha.0",
|
|
13
13
|
"@startupjs/pm": "^0.63.0-alpha.0",
|
|
14
|
+
"@startupjs/skills": "^0.63.0-alpha.3",
|
|
14
15
|
"chalk": "^5.3.0",
|
|
15
16
|
"commander": "^12.0.0",
|
|
16
|
-
"create-startupjs": "^0.63.0-alpha.
|
|
17
|
+
"create-startupjs": "^0.63.0-alpha.3",
|
|
17
18
|
"execa": "^8.0.1"
|
|
18
19
|
},
|
|
19
20
|
"peerDependencies": {
|
|
20
21
|
"cssxjs": "*"
|
|
21
22
|
},
|
|
22
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "be9d66164176ed3cad4c8bcbe5b370dd29f6de81"
|
|
23
24
|
}
|