Skip to content

Commit 01188e2

Browse files
authored
improvement(sim-cli): upgrade commander 15, chalk 6 and babel 8 (#10350)
* improvement(sim-cli): upgrade commander 15, chalk 6 and babel 8 - commander ^11.1.0 -> ^15.1.0 (sim-cli and the root docs generator that walks its command tree) - chalk 5.6.2 -> 6.0.1 (sim-cli) - @babel/parser and @babel/types 7.29.x -> 8.1.2 in workflow-code and workspace-code, and the root parser the audit scripts use, so the CLI bundle carries one parser copy; apps/sim keeps 7 for the executor's own parse of user function code - workflow-code: Babel 8 types a member's object as Expression | Super; add an isMemberAccess guard and type chain roots as MemberExpression['object']; drop the 'Import' callee hint case Babel 8 no longer produces - audits: read TSImportType.source (Babel 8 rename) and drop the Babel 7 Import-callee shapes * improvement(sim-cli): require node ^22.18.0 || >=24.11.0 to match bundled babel 8 and commander 15 - engines.node in sim-cli, workflow-code, workflow-sdk and workspace-code - README and CLI install docs state the new floor - the publish workflow smoke-tests the packed bundle on node 22.18.0, the floor
1 parent 70f513c commit 01188e2

17 files changed

Lines changed: 81 additions & 69 deletions

File tree

‎.github/workflows/publish-sim-cli.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
persist-credentials: false
4242

4343
# Vitest 5 requires Node 22.12+; the published bundle is also
44-
# smoke-tested on Node 22 below, its minimum supported runtime.
44+
# smoke-tested below on Node 22.18.0, its minimum supported runtime.
4545
- name: Setup workspace
4646
uses: ./.github/actions/setup
4747
with:
@@ -131,10 +131,10 @@ jobs:
131131
working-directory: packages/sim-cli
132132
run: bun pm pack --ignore-scripts --filename "$RUNNER_TEMP/package.tgz" --quiet
133133

134-
- name: Setup Node 22 for the bundle smoke test
134+
- name: Setup the minimum supported Node for the bundle smoke test
135135
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v6
136136
with:
137-
node-version: '22'
137+
node-version: '22.18.0'
138138

139139
- name: Smoke-test packed Node bundle
140140
env:

‎apps/docs/content/docs/cli/index.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Use `sim` to run workflows, query tables, move files, search knowledge bases, an
77

88
## Install
99

10-
The installed CLI requires Node.js 22 or newer. Install it globally with Bun, then check the version:
10+
The installed CLI requires Node.js 22.18 or newer on the 22 line, or 24.11 or newer. Install it globally with Bun, then check the version:
1111

1212
```bash
1313
bun add -g sim

‎bun.lock‎

Lines changed: 34 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"@next/swc-linux-x64-gnu": "16.4.5"
186186
},
187187
"devDependencies": {
188-
"@babel/parser": "7.29.9",
188+
"@babel/parser": "8.1.2",
189189
"@biomejs/biome": "2.0.6",
190190
"@mdx-js/mdx": "3.1.1",
191191
"@octokit/rest": "^22.0.1",
@@ -196,7 +196,7 @@
196196
"@typescript/typescript6": "^6.0.2",
197197
"@vercel/og": "0.6.8",
198198
"ajv": "8.20.0",
199-
"commander": "^11.1.0",
199+
"commander": "^15.1.0",
200200
"concurrently": "10.0.6",
201201
"glob": "13.0.6",
202202
"gray-matter": "4.0.3",

‎packages/sim-cli/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ to set up a Sim deployment.
1212

1313
## Install
1414

15-
The CLI requires Node.js 22 or newer. Install it globally with Bun (npm and pnpm work too; keep upgrading with the manager that owns the installation, or run `sim update`):
15+
The CLI requires Node.js 22.18 or newer on the 22 line, or 24.11 or newer. Install it globally with Bun (npm and pnpm work too; keep upgrading with the manager that owns the installation, or run `sim update`):
1616

1717
```bash
1818
bun add --global sim

‎packages/sim-cli/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@
4747
"access": "public"
4848
},
4949
"engines": {
50-
"node": ">=22"
50+
"node": "^22.18.0 || >=24.11.0"
5151
},
5252
"dependencies": {
53-
"chalk": "5.6.2",
54-
"commander": "^11.1.0",
53+
"chalk": "6.0.1",
54+
"commander": "^15.1.0",
5555
"csv-parse": "7.0.3",
5656
"diff": "9.0.0",
5757
"js-yaml": "4.3.2",

‎packages/workflow-code/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"license": "Apache-2.0",
88
"engines": {
99
"bun": ">=1.4.4",
10-
"node": ">=22.0.0"
10+
"node": "^22.18.0 || >=24.11.0"
1111
},
1212
"exports": {
1313
".": {
@@ -77,13 +77,13 @@
7777
"test:watch": "vitest"
7878
},
7979
"dependencies": {
80-
"@babel/parser": "7.29.9",
80+
"@babel/parser": "8.1.2",
8181
"@noble/hashes": "2.2.0",
8282
"@sim/utils": "workspace:*",
8383
"@sim/workflow-types": "workspace:*"
8484
},
8585
"devDependencies": {
86-
"@babel/types": "7.29.8",
86+
"@babel/types": "8.1.2",
8787
"@sim/testing": "workspace:*",
8888
"@sim/tsconfig": "workspace:*",
8989
"@xyflow/react": "12.12.1",

‎packages/workflow-code/src/babel.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* The Babel AST walk and error reading shared by the compiler and the code-file reader.
33
*/
44

5-
import type { MemberExpression, Node } from '@babel/types'
5+
import type { MemberExpression, Node, OptionalMemberExpression } from '@babel/types'
66
import { isIndexSegment, isNameSegment, type RefSegment } from './code-files/ref-path'
77

88
/** The fields a thrown or recovered Babel error may carry. */
@@ -47,9 +47,14 @@ export function childNodes(node: Node): Node[] {
4747
return children
4848
}
4949

50+
/** Whether `node` is a member access, optional or not. */
51+
export function isMemberAccess(node: Node): node is MemberExpression | OptionalMemberExpression {
52+
return node.type === 'MemberExpression' || node.type === 'OptionalMemberExpression'
53+
}
54+
5055
/** The name a member access reads: `.name` or `['name']` (optional or not); `null` otherwise. */
5156
export function memberName(node: Node): string | null {
52-
if (node.type !== 'MemberExpression' && node.type !== 'OptionalMemberExpression') return null
57+
if (!isMemberAccess(node)) return null
5358
if (!node.computed && node.property.type === 'Identifier') return node.property.name
5459
return node.property.type === 'StringLiteral' ? node.property.value : null
5560
}

‎packages/workflow-code/src/code-files/from-file.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { type ParserOptions, parse } from '@babel/parser'
2-
import type { Expression, MemberExpression, Node } from '@babel/types'
2+
import type { MemberExpression, Node } from '@babel/types'
33
import { isLikelyWorkflowReferenceSegment } from '@sim/utils/workflow-references'
44
import { babelErrorShape, childNodes, memberSegment } from '../babel'
55
import { ENV_VAR_NAME, formatStoredPath, type RefSegment } from './ref-path'
@@ -106,7 +106,10 @@ function isParenthesized(node: Node): boolean {
106106
}
107107

108108
/** The members of a chain, innermost first, and its root; stops at a parenthesized object. */
109-
function flattenChain(top: MemberExpression): { root: Expression; members: MemberExpression[] } {
109+
function flattenChain(top: MemberExpression): {
110+
root: MemberExpression['object']
111+
members: MemberExpression[]
112+
} {
110113
const members: MemberExpression[] = [top]
111114
let object = top.object
112115
while (object.type === 'MemberExpression' && !isParenthesized(object)) {
@@ -133,7 +136,7 @@ function envName(member: MemberExpression): string | null {
133136
* rooted at `$ref`/`$env` or maps no member.
134137
*/
135138
function chainReplacement(
136-
root: Expression,
139+
root: MemberExpression['object'],
137140
members: MemberExpression[]
138141
): { replacement: Replacement; consumed: number } | null {
139142
if (root.type !== 'Identifier' || members.length === 0) return null

‎packages/workflow-code/src/compile/function-returns.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import { parse } from '@babel/parser'
1717
import type { Expression, Node, ObjectExpression, PatternLike } from '@babel/types'
18-
import { childNodes, memberName } from '../babel'
18+
import { childNodes, isMemberAccess, memberName } from '../babel'
1919
import { parseStoredPath } from '../code-files/ref-path'
2020
import { toCodeFile } from '../code-files/to-file'
2121
import type { BlockKey, CanonicalBlock } from '../model'
@@ -295,8 +295,9 @@ class Inference {
295295
if (BOOLEAN_FUNCTIONS.has(callee.name)) return 'boolean'
296296
return undefined
297297
}
298+
if (!isMemberAccess(callee)) return undefined
298299
const method = memberName(callee)
299-
if (method === null || !('object' in callee)) return undefined
300+
if (method === null) return undefined
300301
if (callee.object.type === 'Identifier') {
301302
if (callee.object.name === 'Math') return this.isBuiltin('Math') ? 'number' : undefined
302303
const known = STATIC_KINDS[`${callee.object.name}.${method}`]
@@ -356,8 +357,9 @@ class Inference {
356357
private isArray(node: Node, strict = false): boolean {
357358
if (node.type === 'ArrayExpression') return true
358359
if (node.type === 'CallExpression' || node.type === 'OptionalCallExpression') {
360+
if (!isMemberAccess(node.callee)) return false
359361
const method = memberName(node.callee)
360-
if (method === null || !('object' in node.callee)) return false
362+
if (method === null) return false
361363
if (node.callee.object.type === 'Identifier' && node.callee.object.name === 'Object') {
362364
return (
363365
this.isBuiltin('Object') &&

0 commit comments

Comments
 (0)