1- // Decides which CI jobs a change needs. Prints `key=value` lines for
2- // $GITHUB_OUTPUT; a job runs unless its key is "false".
3- //
4- // node ci-changes.cjs --paths <file> gate by the listed paths
5- // node ci-changes.cjs --paths <file> --full run every Linux job, gate only the macOS lint
6- // node ci-changes.cjs changed paths unknown: run everything
7- //
8- // scripts/check-changed.ts requires the same decisions so local runs match CI.
9- //
10- // Every changed path maps to workspace packages, which then pull in their
11- // dependents from package.json. A path this file does not recognize runs
12- // everything, so a new root file or directory can only cost minutes.
1+ // Unknown paths run every job; recognized packages pull in their dependents.
2+ // scripts/check-changed.ts shares these decisions so local checks match CI.
133const fs = require ( "node:fs" ) ;
144const path = require ( "node:path" ) ;
155
166const root = path . resolve ( __dirname , "../.." ) ;
177
18- // Never read by a build, typecheck, or test. Lint still formats them.
198const INERT = [
209 / ^ d o c s \/ / ,
2110 / ^ \. ( a g e n t s | c u r s o r | v s c o d e | d e v c o n t a i n e r | m a c r o s c o p e | r e p o s ) \/ / ,
2211 / ^ [ ^ / ] + \. m d $ / ,
2312 / ^ L I C E N S E $ / ,
2413] ;
2514
26- // Run everything: the root vite.config.ts loads the first as setup for every
27- // package's tests, and the vendored mobile tarballs are installed dependencies.
15+ // Shared test setup and vendored mobile dependencies affect every package.
2816const RUNS_EVERYTHING = [
2917 / ^ p a c k a g e s \/ s h a r e d \/ s r c \/ ( H o s t P r o c e s s | t e s t i n g \/ l o n g T e m p D i r ) \. t s $ / ,
3018 / ^ a p p s \/ m o b i l e \/ d e p s \/ / ,
3119] ;
3220
33- // Paths outside a package, or files inside one that other packages read
34- // through relative imports rather than a package.json dependency.
21+ // Includes cross-package reads absent from package.json dependencies.
3522const EXTRA_OWNERS = [
3623 // Vite configs and tsconfigs of these apps import scripts/lib directly.
3724 [ / ^ s c r i p t s \/ l i b \/ / , [ "@t3tools/desktop" , "@t3tools/mobile" , "@t3tools/web" , "t3" ] ] ,
@@ -43,9 +30,7 @@ const EXTRA_OWNERS = [
4330] ;
4431const RUST = / ^ n a t i v e \/ ( r e s o u r c e - m o n i t o r | k d e - s n a p - s h o t | h y p r l a n d - s n a p - s h o t ) \/ / ;
4532
46- // Tests that read another package's files without declaring it. The scripts
47- // tests read app manifests, assets, and sources (cursor-sdk-packaging,
48- // third-party-licenses, brand-assets, build-desktop-artifact).
33+ // These tests read other packages without declaring dependencies.
4934const TEST_ONLY_DEPS = {
5035 "@t3tools/provider-pi" : [ "@t3tools/client-runtime" ] ,
5136 "@t3tools/scripts" : [
@@ -56,17 +41,12 @@ const TEST_ONLY_DEPS = {
5641 "@t3tools/provider-cursor" ,
5742 ] ,
5843} ;
59- // Declared dependencies that only feed a build step: the server bundles the
60- // built web app (apps/server/vite.config.ts) but never imports it.
44+ // The server bundles the web build without importing it.
6145const BUILD_ONLY_DEPS = { t3 : [ "@t3tools/web" ] } ;
6246
63- // Sources scripts/mobile-native-static-check.ts lints, plus the tool and rule
64- // configuration that decides how it lints them, plus the root package.json
65- // that defines the lint:mobile command.
6647const MOBILE_NATIVE =
6748 / ^ a p p s \/ m o b i l e \/ .* \. ( s w i f t | k t | k t s ) $ | ^ a p p s \/ m o b i l e \/ ( \. s w i f t l i n t \. y m l | d e t e k t \. y m l | \. e d i t o r c o n f i g | B r e w f i l e ) $ | ^ s c r i p t s \/ m o b i l e - n a t i v e - s t a t i c - c h e c k \. t s $ | ^ p a c k a g e \. j s o n $ | ^ \. g i t h u b \/ w o r k f l o w s \/ c i \. y m l $ | ^ \. g i t h u b \/ s c r i p t s \/ c i - c h a n g e s \. c j s $ | ^ \. g i t h u b \/ a c t i o n s \/ c i - c h a n g e s \/ / ;
6849
69- // Jobs that test every package except these, which have jobs of their own.
7050const OWN_TEST_JOB = new Set ( [ "t3" , "@t3tools/web" , "@t3tools/monorepo" ] ) ;
7151
7252function readWorkspace ( ) {
@@ -108,8 +88,7 @@ function readWorkspace() {
10888 return packages ;
10989}
11090
111- // Returns the packages a path touches, [] for an inert path, or null when the
112- // path is not understood and everything must run.
91+ // [] means inert; null means unknown and requires every job.
11392function ownersOf ( file , packages ) {
11493 if ( INERT . some ( ( pattern ) => pattern . test ( file ) ) ) return [ ] ;
11594 // A manifest can change dependencies or versions other packages read.
@@ -148,7 +127,6 @@ function decide(files, packages, full) {
148127 if ( everything ) {
149128 affected = all ;
150129 } else {
151- // Add dependents until nothing changes.
152130 let grew = true ;
153131 while ( grew ) {
154132 grew = false ;
0 commit comments