@startupjs/cli 0.62.1 → 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 CHANGED
@@ -1,4 +1,6 @@
1
- import { runCli } from '@react-pug/check-types'
1
+ import { runCli } from 'cssxjs/check'
2
+ import { createRequire } from 'node:module'
3
+ import { join } from 'node:path'
2
4
 
3
5
  export const name = 'check [files...]'
4
6
  export const description = 'Type-check the current project with React-Pug support'
@@ -30,6 +32,21 @@ export const options = [
30
32
  ]
31
33
 
32
34
  export async function action (files = [], options) {
35
+ const requireFromProject = createRequire(join(process.cwd(), 'package.json'))
36
+ const { generateTeamplayEnv } = requireFromProject('teamplay/babel/loader')
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 })
49
+
33
50
  const args = [...files]
34
51
  if (options.project) args.push('--project', options.project)
35
52
  if (options.tagFunction) args.push('--tagFunction', options.tagFunction)
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.62.1",
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",
@@ -9,13 +9,16 @@
9
9
  "access": "public"
10
10
  },
11
11
  "dependencies": {
12
- "@react-pug/check-types": "^0.1.18",
13
- "@startupjs/patches": "^0.62.0",
14
- "@startupjs/pm": "^0.62.0",
12
+ "@startupjs/patches": "^0.63.0-alpha.0",
13
+ "@startupjs/pm": "^0.63.0-alpha.0",
14
+ "@startupjs/skills": "^0.63.0-alpha.3",
15
15
  "chalk": "^5.3.0",
16
16
  "commander": "^12.0.0",
17
- "create-startupjs": "^0.62.1",
17
+ "create-startupjs": "^0.63.0-alpha.3",
18
18
  "execa": "^8.0.1"
19
19
  },
20
- "gitHead": "9764b3809e7eb4107baa027f8a5bff453829f23b"
20
+ "peerDependencies": {
21
+ "cssxjs": "*"
22
+ },
23
+ "gitHead": "be9d66164176ed3cad4c8bcbe5b370dd29f6de81"
21
24
  }