Skip to content

Commit b2e18d8

Browse files
authored
Make validation steps optional to fix appkit caching breaking npm ins… (#4290)
## Changes Make nodejs validation steps optional enabling agents to work with the template. ## Why Currently type generation in appkit breaks npm cache making any subsequent npm install commands fail. ## Tests
1 parent cc6f143 commit b2e18d8

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

experimental/aitools/lib/validation/nodejs.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ type validationStep struct {
1616
command string
1717
errorPrefix string
1818
displayName string
19+
optional bool
1920
}
2021

2122
func (v *ValidationNodeJs) Validate(ctx context.Context, workDir string) (*ValidateResult, error) {
@@ -31,12 +32,14 @@ func (v *ValidationNodeJs) Validate(ctx context.Context, workDir string) (*Valid
3132
command: "npm install",
3233
errorPrefix: "Failed to install dependencies",
3334
displayName: "Install",
35+
optional: true,
3436
},
3537
{
3638
name: "generate",
3739
command: "npm run typegen --if-present",
3840
errorPrefix: "Failed to run npm typegen",
3941
displayName: "Type generation",
42+
optional: true,
4043
},
4144
{
4245
name: "build",
@@ -55,6 +58,7 @@ func (v *ValidationNodeJs) Validate(ctx context.Context, workDir string) (*Valid
5558
command: "npm run lint:ast-grep --if-present",
5659
errorPrefix: "AST-grep lint found violations",
5760
displayName: "AST-grep lint",
61+
optional: true,
5862
},
5963
{
6064
name: "tests",
@@ -73,6 +77,11 @@ func (v *ValidationNodeJs) Validate(ctx context.Context, workDir string) (*Valid
7377
err := runCommand(ctx, workDir, step.command)
7478
if err != nil {
7579
stepDuration := time.Since(stepStart)
80+
if step.optional {
81+
log.Debugf(ctx, "%s failed (optional, duration: %.1fs)", step.name, stepDuration.Seconds())
82+
progressLog = append(progressLog, fmt.Sprintf("⏭️ %s skipped (%.1fs)", step.displayName, stepDuration.Seconds()))
83+
continue
84+
}
7685
log.Errorf(ctx, "%s failed (duration: %.1fs)", step.name, stepDuration.Seconds())
7786
progressLog = append(progressLog, fmt.Sprintf("❌ %s failed (%.1fs)", step.displayName, stepDuration.Seconds()))
7887
return &ValidateResult{

0 commit comments

Comments
 (0)