Report the install directory in skills get output - #573
Conversation
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.
There was a problem hiding this comment.
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.
| 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(); |
There was a problem hiding this comment.
[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',
]);There was a problem hiding this comment.
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.
Fixes #552.
After installing, the per-agent summary named the agent but not where the
skills actually went. It now names the directory:
Before:
After:
This follows the display you added to
skills listin #554 (d1405de), whoseheader is
claude (installed at .claude/skills):— same project-relativedirectory, same
atpreposition. The value here isagent.skillsRelativePathrather 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:pathintoget_skills.dartwhilestaying consistent with what
listprints.Not included: a location on each per-skill line. The directory is constant per
agent, so repeating it on every skill is noise, and
InstalledSkillInfocarries no path — threading one through
_installSkills→_PackageInstallResult→SkillInstallResultwould multiply the diff for thatnoise. Happy to do it if you disagree.
This touches
get_skills.dartand the## 1.0.0-wipCHANGELOG, the same twofiles 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
getrun.