mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-19 02:17:09 +00:00
feat: add --kind agent to enable/disable and agent path to TargetsPage
enable.go: support --kind agent flag to route enable/disable operations to .agentignore instead of .skillignore. Works in both global and project modes. Oplog entries now include kind field. TargetsPage.tsx: show agent path below skill path when target has agentPath. Display agent linked count alongside skill counts.
This commit is contained in:
@@ -33,6 +33,12 @@ func cmdToggleSkill(args []string, enable bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Extract --kind flag before parsing other args
|
||||
kind, rest, err := parseKindFlag(rest)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var dryRun bool
|
||||
var patterns []string
|
||||
for _, arg := range rest {
|
||||
@@ -68,20 +74,35 @@ func cmdToggleSkill(args []string, enable bool) error {
|
||||
}
|
||||
applyModeLabel(mode)
|
||||
|
||||
isAgent := kind == kindAgents
|
||||
|
||||
var ignorePath string
|
||||
var cfgPath string
|
||||
if mode == modeProject {
|
||||
ignorePath = filepath.Join(cwd, ".skillshare", "skills", ".skillignore")
|
||||
if isAgent {
|
||||
ignorePath = filepath.Join(cwd, ".skillshare", "agents", ".agentignore")
|
||||
} else {
|
||||
ignorePath = filepath.Join(cwd, ".skillshare", "skills", ".skillignore")
|
||||
}
|
||||
cfgPath = config.ProjectConfigPath(cwd)
|
||||
} else {
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to load config: %w", err)
|
||||
}
|
||||
ignorePath = filepath.Join(cfg.Source, ".skillignore")
|
||||
if isAgent {
|
||||
ignorePath = filepath.Join(cfg.EffectiveAgentsSource(), ".agentignore")
|
||||
} else {
|
||||
ignorePath = filepath.Join(cfg.Source, ".skillignore")
|
||||
}
|
||||
cfgPath = config.ConfigPath()
|
||||
}
|
||||
|
||||
ignoreLabel := ".skillignore"
|
||||
if isAgent {
|
||||
ignoreLabel = ".agentignore"
|
||||
}
|
||||
|
||||
changed := false
|
||||
for _, pattern := range patterns {
|
||||
if dryRun {
|
||||
@@ -96,25 +117,25 @@ func cmdToggleSkill(args []string, enable bool) error {
|
||||
if enable {
|
||||
removed, err := skillignore.RemovePattern(ignorePath, pattern)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update .skillignore: %w", err)
|
||||
return fmt.Errorf("failed to update %s: %w", ignoreLabel, err)
|
||||
}
|
||||
if !removed {
|
||||
ui.Warning("%s is not disabled", pattern)
|
||||
continue
|
||||
}
|
||||
changed = true
|
||||
ui.Success("Enabled: %s (removed from .skillignore)", pattern)
|
||||
ui.Success("Enabled: %s (removed from %s)", pattern, ignoreLabel)
|
||||
} else {
|
||||
added, err := skillignore.AddPattern(ignorePath, pattern)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to update .skillignore: %w", err)
|
||||
return fmt.Errorf("failed to update %s: %w", ignoreLabel, err)
|
||||
}
|
||||
if !added {
|
||||
ui.Warning("%s is already disabled", pattern)
|
||||
continue
|
||||
}
|
||||
changed = true
|
||||
ui.Success("Disabled: %s (added to .skillignore)", pattern)
|
||||
ui.Success("Disabled: %s (added to %s)", pattern, ignoreLabel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,6 +145,7 @@ func cmdToggleSkill(args []string, enable bool) error {
|
||||
e := oplog.NewEntry(action, "ok", time.Since(start))
|
||||
e.Args = map[string]any{
|
||||
"patterns": patterns,
|
||||
"kind": kind.String(),
|
||||
}
|
||||
oplog.Write(cfgPath, oplog.OpsFile, e)
|
||||
}
|
||||
|
||||
@@ -382,6 +382,11 @@ export default function TargetsPage() {
|
||||
<p className="font-mono text-sm text-pencil-light truncate">
|
||||
{shortenHome(target.path)}
|
||||
</p>
|
||||
{target.agentPath && (
|
||||
<p className="font-mono text-sm text-pencil-light truncate">
|
||||
agent: {shortenHome(target.agentPath)}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-1 shrink-0">
|
||||
{(target.mode === 'merge' || target.mode === 'copy') && target.localCount > 0 && (
|
||||
@@ -431,6 +436,9 @@ export default function TargetsPage() {
|
||||
) : (
|
||||
<>{target.linkedCount} {target.mode === 'copy' ? 'managed' : 'shared'}, {target.localCount} local</>
|
||||
)}
|
||||
{target.agentLinkedCount != null && target.agentLinkedCount > 0 && (
|
||||
<>, {target.agentLinkedCount} agent{target.agentLinkedCount !== 1 ? 's' : ''}</>
|
||||
)}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user