Skip to content

Report the install directory in skills get output - #573

Open
Yusufihsangorgel wants to merge 1 commit into
dart-lang:mainfrom
Yusufihsangorgel:issue-552-install-location
Open

Report the install directory in skills get output#573
Yusufihsangorgel wants to merge 1 commit into
dart-lang:mainfrom
Yusufihsangorgel:issue-552-install-location

Conversation

@Yusufihsangorgel

Copy link
Copy Markdown
Contributor

Fixes #552.

After installing, the per-agent summary named the agent but not where the
skills actually went. It now names the directory:

Before:

Installed 2 skill(s) for generic.
Installed 2 skill(s) for claude.

After:

Installed 2 skill(s) for generic at .agents/skills.
Installed 2 skill(s) for claude at .claude/skills.

This follows the display you added to skills list in #554 (d1405de), whose
header is claude (installed at .claude/skills): — same project-relative
directory, same at preposition. The value here is agent.skillsRelativePath
rather than p.split(p.relative(adapter.skillsDirectory, from: rootPath)).join('/');
I checked all six adapters on multiple roots and the two produce identical
strings, so this avoids pulling package:path into get_skills.dart while
staying consistent with what list prints.

Not included: a location on each per-skill line. The directory is constant per
agent, so repeating it on every skill is noise, and InstalledSkillInfo
carries no path — threading one through _installSkills
_PackageInstallResultSkillInstallResult would multiply the diff for that
noise. Happy to do it if you disagree.

This touches get_skills.dart and the ## 1.0.0-wip CHANGELOG, the same two
files as your open #568. I merged the two locally and they apply cleanly, so
there's nothing to coordinate.

Test covers two agents with different directories in a single get run.

Fixes dart-lang#552.

The per-agent summary logged after installing now names the directory the
skills were written to, mirroring the `(installed at <dir>)` display added
to `skills list` in dart-lang#554.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request updates the get command's summary message to display the actual installation directory for each agent, and adds a corresponding test to verify this behavior. The reviewer suggested using addTearDown to cancel the logger subscription in the new test to prevent potential resource leaks if the test fails.

Comment on lines +308 to +331
final logMessages = <String>[];
final subscription = Logger('skills get').onRecord.listen((r) {
logMessages.add(r.message);
});

final getCommand = GetCommand(
dialogSupport: null,
gitRunner: GitRunner(isAvailableOverride: () async => false),
);
final runner = SkillsCommandRunner('skills', 'Test')
..addCommand(getCommand);

await runner.run([
'get',
'--directory',
projectPath,
'--agent',
Agent.generic.cliName,
'--agent',
Agent.claude.cliName,
'--all',
]);

await subscription.cancel();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

[CONCERN] If the test fails or throws an exception before reaching await subscription.cancel();, the logger subscription will leak and continue to listen to log events during subsequent tests. This can cause test flakiness or side effects.

Consider using addTearDown to guarantee that the subscription is cancelled when the test finishes.

      final logMessages = <String>[];
      final subscription = Logger('skills get').onRecord.listen((r) {
        logMessages.add(r.message);
      });
      addTearDown(subscription.cancel);

      final getCommand = GetCommand(
        dialogSupport: null,
        gitRunner: GitRunner(isAvailableOverride: () async => false),
      );
      final runner = SkillsCommandRunner('skills', 'Test')
        ..addCommand(getCommand);

      await runner.run([
        'get',
        '--directory',
        projectPath,
        '--agent',
        Agent.generic.cliName,
        '--agent',
        Agent.claude.cliName,
        '--all',
      ]);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Kept this consistent with the await subscription.cancel() in the sibling test above; switching both to addTearDown is a reasonable cleanup but out of scope for this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skills install messages should indicate output location

1 participant