Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c65a783
Try out NX agents
kasperpeulen Nov 18, 2025
45e6f41
Use --startFrom task in nx
kasperpeulen Nov 24, 2025
b96d8b6
Fix
kasperpeulen Nov 24, 2025
4815dd0
Fix
kasperpeulen Nov 25, 2025
0812f33
Fix
kasperpeulen Nov 25, 2025
5889731
Use latest node 22
kasperpeulen Nov 25, 2025
1644680
Cleanup build script
kasperpeulen Nov 25, 2025
9c09531
Run everything
kasperpeulen Nov 25, 2025
36db0b3
Fix
kasperpeulen Nov 25, 2025
2f45799
Fix check
kasperpeulen Nov 25, 2025
c10cca9
Fix
kasperpeulen Nov 25, 2025
11da1a4
Fix
kasperpeulen Nov 25, 2025
4694e9d
Fix
kasperpeulen Nov 25, 2025
908eefb
Fix
kasperpeulen Nov 25, 2025
c9f56bf
Fix
kasperpeulen Nov 25, 2025
4622396
Fix
kasperpeulen Nov 25, 2025
a8c6d41
Fix
kasperpeulen Nov 26, 2025
1b72107
Add cloud access token
kasperpeulen Nov 26, 2025
3d7f007
Fix
kasperpeulen Nov 26, 2025
5caad09
Fix
kasperpeulen Nov 26, 2025
b68e98e
Fix
kasperpeulen Nov 26, 2025
8b63ec2
Verify
kasperpeulen Nov 26, 2025
ffc7857
Fix
kasperpeulen Nov 26, 2025
0f2c997
Fix
kasperpeulen Nov 26, 2025
c2e3773
Run chromatic in cache location
kasperpeulen Nov 26, 2025
b1ba7b2
Fix
kasperpeulen Nov 26, 2025
32bb4b0
Fix
kasperpeulen Nov 26, 2025
40f2c1d
Fix
kasperpeulen Nov 26, 2025
3cd7a0f
Fix
kasperpeulen Nov 26, 2025
bf2a3d9
Fix
kasperpeulen Nov 26, 2025
2483221
Fix
kasperpeulen Nov 26, 2025
82f6baf
Remove yarn lock file
kasperpeulen Nov 26, 2025
0779ef3
Ignore yarn lock files in test-storybooks
kasperpeulen Nov 26, 2025
4916d39
Fix
kasperpeulen Nov 26, 2025
bf04639
Fix
kasperpeulen Nov 26, 2025
a102952
Fix
kasperpeulen Nov 26, 2025
035dfa3
Fix
kasperpeulen Nov 26, 2025
1d8048b
Fix
kasperpeulen Nov 26, 2025
d370e3b
Fix
kasperpeulen Nov 26, 2025
975b14f
Fix
kasperpeulen Nov 26, 2025
a706f5f
Fix
kasperpeulen Nov 26, 2025
4703f2a
Fix
kasperpeulen Nov 26, 2025
3b25ae5
Merge remote-tracking branch 'origin/next' into kasper/nx-agents
kasperpeulen Nov 26, 2025
497caa6
Fix
kasperpeulen Nov 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix
  • Loading branch information
kasperpeulen committed Nov 25, 2025
commit 11da1a4cf7711d4dffef451cfc411648541e66b5
50 changes: 24 additions & 26 deletions scripts/tasks/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,32 +179,30 @@ export const sandbox: Task = {

await extendPreview(details, options);

if (process.env.NX_RUN) {
logger.info('✅ Moving sandbox to cache directory');
const sandboxDir = join(details.sandboxDir);
const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replace('/', '-'));

if (sandboxDir !== cacheDir) {
logger.info(`✅ Removing cache directory ${cacheDir}`);
await rm(cacheDir, { recursive: true, force: true });

logger.info(`✅ Copy ${sandboxDir} to cache directory`);
await cp(sandboxDir, cacheDir, {
recursive: true,
force: true,
filter: (src) => {
const name = path.basename(src);
return (
name !== 'node_modules' &&
!(name === 'cache' && path.basename(path.dirname(src)) === '.yarn')
);
},
});
} else {
logger.info(`✅ Removing node_modules from cache directory ${cacheDir}`);
await rm(path.join(cacheDir, 'node_modules'), { force: true, recursive: true });
await rm(path.join(cacheDir, '.yarn', 'cache'), { force: true, recursive: true });
}
logger.info('✅ Moving sandbox to cache directory');
const sandboxDir = join(details.sandboxDir);
const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replace('/', '-'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

replace('/', '-') only replaces the first occurrence.

If details.key contains multiple / characters (e.g., react/vite/ts), only the first / will be replaced, resulting in react-vite/ts instead of react-vite-ts. This could cause filesystem issues.

-    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replace('/', '-'));
+    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replaceAll('/', '-'));

Verify the format of details.key to confirm if it can contain multiple / characters:


🏁 Script executed:

#!/bin/bash
# Search for key property assignments and usage patterns
rg -n "\.key\s*=" scripts/tasks/ -A2 -B2
# Search for template key definitions
ast-grep --pattern 'key: $_'

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Read the sandbox.ts file to understand context around line 184
cat scripts/tasks/sandbox.ts | head -200 | tail -50

Length of output: 1568


🏁 Script executed:

#!/bin/bash
# Search for details object definition and key property
rg -n "details.*key" scripts/tasks/sandbox.ts -B5 -A5

Length of output: 436


🏁 Script executed:

#!/bin/bash
# Search for where key is defined or assigned in sandbox.ts
rg -n "key" scripts/tasks/sandbox.ts -C3

Length of output: 315


🏁 Script executed:

#!/bin/bash
# Find if key contains patterns with multiple slashes in the codebase
rg -n "key.*/" scripts/tasks/ -C2

Length of output: 1893


🏁 Script executed:

#!/bin/bash
# Find where details.key is defined or where keys are generated
rg -n "key.*:" scripts/tasks/sandbox.ts -B3 -A3

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Search for interface/type definitions for details
rg -n "interface.*[Dd]etails|type.*[Dd]etails" scripts/tasks/sandbox.ts -A10

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Look for example keys in tests or documentation
rg -n "react|vue|angular" scripts/tasks/sandbox.ts -C2 | head -30

Length of output: 220


🏁 Script executed:

#!/bin/bash
# Check if keys actually contain multiple slashes in codebase references
rg -n "['\"].*\/.*\/.*['\"]" scripts/tasks/ | grep -i key | head -20

Length of output: 90


🏁 Script executed:

#!/bin/bash
# Search for imports/types at top of sandbox.ts to understand details object origin
head -50 scripts/tasks/sandbox.ts

Length of output: 1361


🏁 Script executed:

#!/bin/bash
# Look for actual sandbox template keys in config or test files
find scripts/tasks -name "*.ts" -type f -exec grep -l "template" {} \; | head -5

Length of output: 104


🏁 Script executed:

#!/bin/bash
# Search for specific template/key patterns (e.g., "react/vite")
rg -n "react.*vite|vue.*vite|angular" scripts/tasks/ -C1 | head -40

Length of output: 2448


🏁 Script executed:

#!/bin/bash
# Verify build.ts line 66 has the same issue
sed -n '60,72p' scripts/tasks/build.ts

Length of output: 504


Replace replace() with replaceAll() to handle keys with multiple / characters in both files.

Keys like bench/react-vite-default-ts contain multiple slashes. Using replace('/', '-') only replaces the first occurrence, resulting in incorrect cache directory names like bench-react-vite/default-ts instead of bench-react-vite-default-ts. Use replaceAll('/', '-') instead.

Locations to fix:

  • scripts/tasks/sandbox.ts line 184
  • scripts/tasks/build.ts line 66
-    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replace('/', '-'));
+    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replaceAll('/', '-'));
-    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', key.replace('/', '-'), 'storybook-static');
+    const cacheDir = join(ROOT_DIRECTORY, 'sandbox', key.replaceAll('/', '-'), 'storybook-static');
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replace('/', '-'));
const cacheDir = join(ROOT_DIRECTORY, 'sandbox', details.key.replaceAll('/', '-'));
🤖 Prompt for AI Agents
In scripts/tasks/sandbox.ts around line 184 and scripts/tasks/build.ts around
line 66, the code uses String.prototype.replace('/', '-') which only replaces
the first slash; change these calls to use replaceAll('/', '-') so all '/'
characters in keys are replaced with '-' to produce correct cache/build
directory names (e.g., bench/react-vite-default-ts ->
bench-react-vite-default-ts).


if (sandboxDir !== cacheDir) {
logger.info(`✅ Removing cache directory ${cacheDir}`);
await rm(cacheDir, { recursive: true, force: true });

logger.info(`✅ Copy ${sandboxDir} to cache directory`);
await cp(sandboxDir, cacheDir, {
recursive: true,
force: true,
filter: (src) => {
const name = path.basename(src);
return (
name !== 'node_modules' &&
!(name === 'cache' && path.basename(path.dirname(src)) === '.yarn')
);
},
});
} else {
logger.info(`✅ Removing node_modules from cache directory ${cacheDir}`);
await rm(path.join(cacheDir, 'node_modules'), { force: true, recursive: true });
await rm(path.join(cacheDir, '.yarn', 'cache'), { force: true, recursive: true });
}

logger.info(`✅ Storybook sandbox created at ${details.sandboxDir}`);
Expand Down
Loading