Detect outdated skills, modify version command triggers - #92
Conversation
Invoked whenever banner is shown or --version is used
Don't show auth status warning when using --quiet
If an installed skill is from a known agent + prior release, tfctl will now migrate it to the latest embedded skill.
| } else { | ||
| // This is not a match for any known skill and should not be migrated, but | ||
| // may be outdated. | ||
| migrationResult <- &MigrationResult{ |
There was a problem hiding this comment.
A user-customized skill is not a migration failure but the caller in main.go logs this as logger.Error("Failed to migrate skill", ...). Either we shouldn't emit a result here or add a field to distinguish skipping cuz its unknown" from actually failed to write, rn every user who edited their SKILL.md gets an error in --debug output
| defer targetFile.Close() | ||
| defer file.Close() | ||
|
|
||
| tempFile, err := os.CreateTemp("", fmt.Sprintf("SKILL-%s-*", version.Name)) |
There was a problem hiding this comment.
Empty string dir means os.TempDir() which is usually /tmp so if the target path is on a different filesystem, os.Rename fails on Linux. Could use os.CreateTemp(filepath.Dir(path), ...) instead
Also os.Rename is called while tempFile is still open. Can u rename an open file? I think on windows u cant, u may need tempFile.Close() before calling rename
|
|
||
| found, ok := resource.ByName(grant) | ||
| if !ok { | ||
| warnings = append(warnings, fmt.Sprintf("unknown resource type %q in --allow-delete; it may still be honored", grant)) |
There was a problem hiding this comment.
Does AllowsDelete not automatically deny this at runtime for unknown types? I know we went over this in our call but it seems like the first loop only matches if the strings are equal which they wouldn't be right?
| // The result must be sorted and free of duplicates for deterministic | ||
| // completion output. | ||
| assert.True(t, sort.StringsAreSorted(got), "completions must be sorted") | ||
| assert.True(t, slices.IsSorted(got), "completions must be sorted") |
There was a problem hiding this comment.
shd we remove this assertion on sorting since the registry resources arent sorted anymore?
| @if [ -z "$(VERSION)" ]; then echo "VERSION is not set"; exit 1; fi | ||
| @echo $(VERSION) > $(VERSION_FILE) | ||
| @echo "Updated $(VERSION_FILE) to $(VERSION)" | ||
| @echo "v$(VERSION) $$(sha256sum $(SKILL_EMBEDDED) | cut -d' ' -f1)" >> $(SKILL_HASHES) |
There was a problem hiding this comment.
sha256sum doesn't exist on macOS does that matter?
There was a problem hiding this comment.
Good call out. I thought it was built in. I'll use shasum -a 256
|
a few higher level comments:
|
| } | ||
|
|
||
| // WaitForMigration waits for the migration process to complete and returns all MigrationResults. | ||
| func WaitForMigration() []MigrationResult { |
There was a problem hiding this comment.
If installSkillToPath hangs the CLI hangs at exit with no timeout. The context passed to MigrateInstalled is the shutdown context, but nothing in the migration code checks ctx.Done(). Can we add a select with a deadline, or a hard timeout to aboid hanging indefinitely?
- allow context cancelation while migrating skills - don't migrate when --dry-run is used - allow --argument=true form of arguments when checking global args - use `shasum -a 256` instead of `sha256sums` in Makefile because it's more portable - remove some unneeded code
This fixes a corner case where the symlink could change after it's resolved but before the target was overwritten
|
@shwetamurali I think I addressed all feedback. Thanks! |

Description
A few different 0.4.0 cleanups:
tfctl,tfctl --version,tfctl -v,tfctl versionall run the hidden version subcommand, which now does the checkpoint rendering.make prepare-releaseharness execno longer accepts values "all" and "reversible", making all resources explicit. I think this will be easier to understand.harness installno longer requires auth setup firstExample Output
PR Checklist
npx changie newor install changie to prepare a new changelog entry for the next set of release notes.--json— Force machine readable output to stdout. Does not apply to stderr.--markdown— Force markdown output to stdout. Does not apply to stderr.--dry-run— Don't make any actual writes or other mutations. Describe what would have changed to stderr.--quiet— Only render essential content.make gen/screenshotif the root command output changes.Autocompletefield to positional arguments and flags to assist shell autocomplete.PCI review checklist
I have documented a clear reason for, and description of, the change I am making.
If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
If applicable, I've documented the impact of any changes to security controls.
Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.