Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 2 additions & 4 deletions .github/workflows/skills_tool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defaults:
working-directory: tool

jobs:
analyze:
analyze_and_test:
strategy:
fail-fast: false
matrix:
Expand All @@ -36,9 +36,7 @@ jobs:

- run: dart analyze --fatal-infos

# NOTE: dart test is currently omitted as the test suite needs to be
# refactored to work properly without relying on real API keys in the CI environment
# - run: dart test
- run: dart test

formatting_stable_ubuntu-latest:
runs-on: ubuntu-latest
Expand Down
7 changes: 5 additions & 2 deletions tool/lib/src/commands/generate_skill_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ import 'base_skill_command.dart';
/// Command to generate skills from a configuration file.
class GenerateSkillCommand extends BaseSkillCommand {
/// Creates a new [GenerateSkillCommand].
GenerateSkillCommand({required super.httpClient, super.outputDir})
: super(logger: Logger('GenerateSkillCommand'));
GenerateSkillCommand({
required super.httpClient,
super.outputDir,
super.environment,
}) : super(logger: Logger('GenerateSkillCommand'));

@override
String get name => 'generate-skill';
Expand Down
1 change: 1 addition & 0 deletions tool/lib/src/commands/validate_skill_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ValidateSkillCommand extends BaseSkillCommand {
ValidateSkillCommand({
required super.httpClient,
super.outputDir,
super.environment,
this.validationDir,
}) : super(logger: Logger('ValidateSkillCommand'));

Expand Down
1 change: 1 addition & 0 deletions tool/test/generate_skills_retry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down
7 changes: 7 additions & 0 deletions tool/test/generate_skills_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down Expand Up @@ -158,6 +159,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down Expand Up @@ -225,6 +227,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: skillsDir,
);
Expand Down Expand Up @@ -302,6 +305,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: skillsDir,
);
Expand Down Expand Up @@ -347,6 +351,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down Expand Up @@ -401,6 +406,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down Expand Up @@ -432,6 +438,7 @@ void main() {
});

final command = GenerateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
httpClient: mockClient,
outputDir: tempDir,
);
Expand Down
26 changes: 17 additions & 9 deletions tool/test/skill_assertions_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,23 @@ import 'package:yaml/yaml.dart';

void main() {
group('Skill Assertions', () {
final skillsDir = Directory('../skills');

test('skills directory exists', () {
expect(
skillsDir.existsSync(),
isTrue,
reason: 'skills directory should exist',
);
});
final skillsDir = Directory(
path.normalize(path.join(Directory.current.path, '..', 'skills')),
);

test(
'skills directory exists',
() {
expect(
skillsDir.existsSync(),
isTrue,
reason: 'skills directory should exist',
);
},
skip: !skillsDir.existsSync() ? 'Directory not present' : false,
);

if (!skillsDir.existsSync()) return;

final skillDirs = skillsDir.listSync().whereType<Directory>();

Expand Down
38 changes: 33 additions & 5 deletions tool/test/validate_skills_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down Expand Up @@ -136,6 +137,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down Expand Up @@ -180,6 +182,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand All @@ -199,7 +202,11 @@ void main() {

runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(outputDir: skillsDir, httpClient: mockClient),
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
),
);

await IOOverrides.runZoned(() async {
Expand Down Expand Up @@ -240,7 +247,11 @@ void main() {

runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(outputDir: skillsDir, httpClient: mockClient),
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
),
);

await IOOverrides.runZoned(() async {
Expand Down Expand Up @@ -274,7 +285,11 @@ void main() {

runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(outputDir: skillsDir, httpClient: mockClient),
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
),
);

await runner.run(['validate-skill', configFile.path]);
Expand Down Expand Up @@ -320,6 +335,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down Expand Up @@ -369,6 +385,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down Expand Up @@ -416,6 +433,7 @@ void main() {
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down Expand Up @@ -495,6 +513,7 @@ Content
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
validationDir: validationDir,
Expand Down Expand Up @@ -534,7 +553,11 @@ Content

runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(outputDir: skillsDir, httpClient: mockClient),
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
),
);

await runner.run(['validate-skill', configFile.path]);
Expand Down Expand Up @@ -570,7 +593,11 @@ Content

runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(outputDir: skillsDir, httpClient: mockClient),
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
httpClient: mockClient,
),
);

await runner.run(['validate-skill', configFile.path]);
Expand Down Expand Up @@ -627,6 +654,7 @@ Content
runner = CommandRunner('skills', 'Test runner')
..addCommand(
ValidateSkillCommand(
environment: {'GEMINI_API_KEY': 'test-key'},
outputDir: skillsDir,
validationDir: validationDir,
httpClient: mockClient,
Expand Down
20 changes: 12 additions & 8 deletions tool/test/yaml_assets_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ import 'package:yaml/yaml.dart';

void main() {
final resourcesDir = Directory(
p.join(Directory.current.path, '..', 'tool', 'resources'),
p.normalize(p.join(Directory.current.path, '..', 'tool', 'resources')),
);

test('tool/resources directory exists', () {
expect(
resourcesDir.existsSync(),
isTrue,
reason: 'tool/resources directory should exist',
);
});
test(
'tool/resources directory exists',
() {
expect(
resourcesDir.existsSync(),
isTrue,
reason: 'tool/resources directory should exist',
);
},
skip: !resourcesDir.existsSync() ? 'Directory not present' : false,
);

if (!resourcesDir.existsSync()) return;

Expand Down
Loading