@geastack/cli 0.1.89 → 0.1.91

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/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ GeaStack cli
2
+ Copyright 2026 GeaStack
3
+
4
+ Licensed under the Apache License, Version 2.0; see LICENSE.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/cli",
3
- "version": "0.1.89",
3
+ "version": "0.1.91",
4
4
  "description": "Command-line front door for GeaStack apps, targets, and local toolchains.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -37,15 +37,15 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@clack/prompts": "^1.8.0",
40
- "@geastack/simulator": "^0.1.12",
40
+ "@geastack/simulator": "^0.1.13",
41
41
  "@geastack/targets": "^0.1.86",
42
42
  "picocolors": "^1.1.1",
43
43
  "serialport": "^13.0.0"
44
44
  },
45
45
  "starterDependencies": {
46
- "@geastack/core": "^0.1.31",
46
+ "@geastack/core": "^0.1.33",
47
47
  "@geastack/targets": "^0.1.86",
48
- "@geastack/apple": "^0.2.9"
48
+ "@geastack/apple": "^0.2.13"
49
49
  },
50
50
  "scripts": {
51
51
  "check": "node --check bin/gea.mjs && node --check bin/create-geastack.mjs && find src test packages -name '*.mjs' -print0 | xargs -0 -n1 node --check",
@@ -2,7 +2,7 @@ import { execFileSync } from 'node:child_process'
2
2
  import { existsSync, readdirSync, realpathSync } from 'node:fs'
3
3
  import path from 'node:path'
4
4
 
5
- import { detectSerialDevices } from '../serial-devices.mjs'
5
+ import { detectSerialDevices, serialFromLinuxById } from '../serial-devices.mjs'
6
6
 
7
7
  // A board is identified by its USB SERIAL, never by a /dev path: enumerated
8
8
  // paths change on every plug-in and identical boards routinely share one.
@@ -59,7 +59,10 @@ function linuxSerialByIdCandidates(serial) {
59
59
  if (!existsSync(dir)) return []
60
60
  const needle = normalizedSerial(serial)
61
61
  return readdirSync(dir)
62
- .filter((name) => normalizedSerial(name).includes(needle))
62
+ .filter((name) => {
63
+ const deviceSerial = serialFromLinuxById(name)
64
+ return normalizedSerial(deviceSerial) === needle
65
+ })
63
66
  .map((name) => path.join(dir, name))
64
67
  }
65
68
 
@@ -98,10 +101,6 @@ function macUsbDeviceForSerial(serial, ioreg = runIoreg) {
98
101
  ) || null
99
102
  }
100
103
 
101
- function locationDigits(locationHex) {
102
- return locationHex.toLowerCase().replace(/^0+/, '').replace(/0+$/, '').replace(/[^0-9a-f]/g, '')
103
- }
104
-
105
104
  function macUsbCalloutPortsForSerial(serial, ioreg = runIoreg) {
106
105
  const output = ioreg(['-p', 'IOService', '-l', '-w0'], { maxBuffer: 64 * 1024 * 1024 })
107
106
  const stack = []
@@ -173,21 +172,13 @@ function runIoreg(args, options = {}) {
173
172
  }
174
173
 
175
174
  function resolveMacUsbSerialPort(serial, ioreg = runIoreg) {
176
- const candidates = serialPortCandidates().filter((candidate) => path.basename(candidate).startsWith('cu.'))
177
- const needle = normalizedSerial(serial)
178
- const serialMatches = candidates.filter((candidate) => normalizedSerial(path.basename(candidate)).includes(needle))
179
- if (serialMatches.length === 1) return serialMatches[0]
180
-
181
- const location = macUsbDeviceForSerial(serial, ioreg)?.locationHex || ''
182
- const digits = locationDigits(location)
183
- if (digits) {
184
- const locationMatches = candidates.filter((candidate) => normalizedSerial(path.basename(candidate)).includes(digits))
185
- if (locationMatches.length === 1) return locationMatches[0]
186
- const registryMatches = macUsbCalloutPortsForSerial(serial, ioreg)
187
- if (registryMatches.length === 1) return registryMatches[0]
188
- if (registryMatches.length > 1) {
189
- throw new Error([`USB serial ${serial} maps to multiple /dev/cu.* ports:`, ...registryMatches.map((c) => ` ${c}`)].join('\n'))
190
- }
175
+ // A location fragment is not an identity: "1" also matches usbmodem21301.
176
+ // During re-enumeration that heuristic selected a different connected board.
177
+ // Only accept the callout inherited from this exact serial in IORegistry.
178
+ const registryMatches = macUsbCalloutPortsForSerial(serial, ioreg)
179
+ if (registryMatches.length === 1) return registryMatches[0]
180
+ if (registryMatches.length > 1) {
181
+ throw new Error([`USB serial ${serial} maps to multiple /dev/cu.* ports:`, ...registryMatches.map((c) => ` ${c}`)].join('\n'))
191
182
  }
192
183
  throw new Error(`Could not map USB serial ${serial} to a /dev/cu.* port. Check that the board is attached.`)
193
184
  }
@@ -233,17 +224,25 @@ export async function waitForSerialPort({
233
224
  label = 'USB serial port',
234
225
  pollSeconds = 1,
235
226
  log = (line) => process.stderr.write(`${line}\n`),
236
- resolver = resolveUsbSerialPort
227
+ resolver = resolveUsbSerialPort,
228
+ portPresent = serialPortPresent
237
229
  } = {}) {
238
230
  const startedAt = Date.now()
239
231
  let nextLog = startedAt
240
232
  while (true) {
241
233
  if (port) {
242
- if (serialPortPresent(port)) return port
234
+ if (portPresent(port)) {
235
+ if (!serial) return port
236
+ try {
237
+ if (resolver({ serial }) === port) return port
238
+ } catch {
239
+ // An explicit path does not override the registered board identity.
240
+ }
241
+ }
243
242
  } else if (serial) {
244
243
  try {
245
244
  const resolved = resolver({ serial })
246
- if (resolved && serialPortPresent(resolved)) return resolved
245
+ if (resolved && portPresent(resolved)) return resolved
247
246
  } catch {
248
247
  // not attached yet
249
248
  }
@@ -22,6 +22,9 @@ const cliVersion = cliPackage.version
22
22
  const starterDependencies = cliPackage.starterDependencies || {}
23
23
  const coreDependencyDefault = starterDependencies['@geastack/core'] || 'latest'
24
24
  const targetsDependencyDefault = starterDependencies['@geastack/targets'] || 'latest'
25
+ // The native tooling uses the TypeScript 5 compiler API. Do not let a
26
+ // floating version in an older example select an incompatible major.
27
+ const typescriptDependencyDefault = '^5.9.3'
25
28
  const starterFontPath = fileURLToPath(new URL('../starters/fonts/Inter-Regular.ttf', import.meta.url))
26
29
 
27
30
  export async function runCreateGeastack(argv, io = {}) {
@@ -82,7 +85,7 @@ export async function runCreateGeastack(argv, io = {}) {
82
85
  : starter.kind === 'empty'
83
86
  ? targetManifest(starter.targets || ['web'])
84
87
  : targetManifestFromObject(sourceManifest.targets)
85
- writeJson(path.join(targetDir, 'package.json'), packageJson({
88
+ const projectPackage = packageJson({
86
89
  appId,
87
90
  displayName,
88
91
  targets,
@@ -91,11 +94,20 @@ export async function runCreateGeastack(argv, io = {}) {
91
94
  cliDependency,
92
95
  sourcePackage,
93
96
  sourceManifest
94
- }))
97
+ })
98
+ writeJson(path.join(targetDir, 'package.json'), projectPackage)
95
99
  if (targets.web) ensureFile(path.join(targetDir, 'index.html'), () => indexHtml(displayName, entry))
96
100
  fs.mkdirSync(path.join(targetDir, '.gea'), { recursive: true })
97
101
  writeJson(path.join(targetDir, '.gea', 'boards.json'), {})
98
102
  ensureJson(path.join(targetDir, 'tsconfig.json'), () => tsconfigJson(targets))
103
+ if (/^(?:\^|~)?5\./.test(projectPackage.devDependencies.typescript)) {
104
+ const configPath = path.join(targetDir, 'tsconfig.json')
105
+ const config = readJson(configPath)
106
+ if (config.compilerOptions?.ignoreDeprecations === '6.0') {
107
+ config.compilerOptions.ignoreDeprecations = '5.0'
108
+ writeJson(configPath, config)
109
+ }
110
+ }
99
111
  ensureFile(path.join(targetDir, '.gitignore'), gitignore)
100
112
  if (targets.web) ensureFile(path.join(targetDir, 'vite.web.config.ts'), viteConfigTs)
101
113
  fs.writeFileSync(path.join(targetDir, 'README.md'), readme({ appId, displayName, starter, targets }))
@@ -353,7 +365,9 @@ function packageJson({ appId, displayName, targets, entry, coreDependency, cliDe
353
365
  },
354
366
  devDependencies: {
355
367
  ...(sourcePackage.devDependencies || {}),
356
- typescript: sourcePackage.devDependencies?.typescript || 'latest',
368
+ typescript: !sourcePackage.devDependencies?.typescript || ['latest', '*'].includes(sourcePackage.devDependencies.typescript)
369
+ ? typescriptDependencyDefault
370
+ : sourcePackage.devDependencies.typescript,
357
371
  ...(targets.web ? { vite: sourcePackage.devDependencies?.vite || 'latest' } : {})
358
372
  },
359
373
  gea: geaManifest,
@@ -130,7 +130,7 @@ function normalizeDevice(input) {
130
130
  }
131
131
  }
132
132
 
133
- function serialFromLinuxById(name) {
133
+ export function serialFromLinuxById(name) {
134
134
  const cleaned = name.replace(/-if\d+.*$/i, '')
135
135
  const parts = cleaned.split('_').map((part) => part.trim()).filter(Boolean)
136
136
  return parts.at(-1) || ''
@@ -11,7 +11,7 @@
11
11
  "@geajs/core": "1.4.3"
12
12
  },
13
13
  "devDependencies": {
14
- "typescript": "latest"
14
+ "typescript": "^5.9.3"
15
15
  },
16
16
  "gea": {
17
17
  "id": "counter",