mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
feat(extras): create and manage single-file extras from the CLI and dashboard
Single-file extras (file + per-target as) already worked in the sync engine, but the only way to create one was editing config.yaml or the dashboard's AGENTS.md tab, so they looked like an AGENTS.md-only feature. Syncing a file such as Pi's APPEND_SYSTEM.md required hand-written config. - extras init gains --file and --as; the init TUI asks Folder or Single file. Validation runs before anything is written, and init neither creates the source file nor syncs. - extras list and add-target show the full source and target file paths. - POST /api/extras accepts file and per-target as, with the same connection checks as add-target. - The dashboard's first Extras tab becomes "Folders & files" and lists every extra except AGENTS.md files; Add extra can create a single file with a per-target file name. - Assigning shared AGENTS.md files now only attaches or detaches AGENTS.md extras. Before, saving on the AGENTS.md tab restored and removed any other single-file extra linked to the same instruction file. Refs #300
This commit is contained in:
@@ -52,7 +52,7 @@ func printExtrasHelp() {
|
||||
Manage non-skill resources (rules, commands, prompts, etc.).
|
||||
|
||||
Commands:
|
||||
init <name> Create a new extra resource type
|
||||
init <name> Create a new extra (a folder, or one file with --file [--as])
|
||||
list List all configured extras and sync status (interactive TUI)
|
||||
remove <name> Remove an extra resource type
|
||||
collect <name> Collect local files from a target into extras source
|
||||
@@ -80,7 +80,7 @@ func printExtraHelp(name string) {
|
||||
fmt.Printf(`Usage: skillshare extras %s [options]
|
||||
|
||||
Options:
|
||||
--mode <mode> Change sync mode: merge, copy, symlink, or import
|
||||
--mode <mode> Change sync mode: merge, copy, symlink, or import (single-file extras)
|
||||
--target <path> Select a target for --mode
|
||||
--add-target <path> Add a target directory
|
||||
--as <filename> Target filename for a single-file --add-target
|
||||
|
||||
@@ -137,7 +137,11 @@ func cmdExtrasAddTarget(args []string) error {
|
||||
return fmt.Errorf("failed to save config: %w", err)
|
||||
}
|
||||
|
||||
ui.Success("Added target %s to %s", shortenPath(addPath), name)
|
||||
shown := addPath
|
||||
if extras[idx].File != "" {
|
||||
shown = singleFileTargetPath(extras[idx], et)
|
||||
}
|
||||
ui.Success("Added target %s to %s", shortenPath(shown), name)
|
||||
ui.Info("Run 'skillshare sync extras%s' to sync the new target", projectSuffix(mode))
|
||||
|
||||
e := oplog.NewEntry("extras-target", "ok", time.Since(start))
|
||||
@@ -155,7 +159,7 @@ Add a new target directory to an existing extra. Config-only — run
|
||||
|
||||
Options:
|
||||
--add-target <path> Target directory to add (required)
|
||||
--mode <mode> Sync mode: merge (default), copy, symlink, import
|
||||
--mode <mode> Sync mode: merge (default), copy, symlink; import for single-file extras
|
||||
--as <filename> Target filename (single-file extras only)
|
||||
--flatten Flatten subdirectory files into the target root
|
||||
--project, -p Use project mode (.skillshare/)
|
||||
|
||||
+168
-55
@@ -3,10 +3,12 @@ package main
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"skillshare/internal/config"
|
||||
"skillshare/internal/oplog"
|
||||
"skillshare/internal/sync"
|
||||
"skillshare/internal/ui"
|
||||
)
|
||||
|
||||
@@ -38,6 +40,7 @@ func cmdExtrasInit(args []string) error {
|
||||
var targets []string
|
||||
var syncMode string
|
||||
var sourceOverride string
|
||||
var file, as string
|
||||
var force bool
|
||||
var noTUI bool
|
||||
var flatten bool
|
||||
@@ -51,7 +54,7 @@ func cmdExtrasInit(args []string) error {
|
||||
targets = append(targets, rest[i])
|
||||
case "--mode":
|
||||
if i+1 >= len(rest) {
|
||||
return fmt.Errorf("--mode requires an argument (merge/copy/symlink)")
|
||||
return fmt.Errorf("--mode requires an argument (merge/copy/symlink/import)")
|
||||
}
|
||||
i++
|
||||
syncMode = rest[i]
|
||||
@@ -61,6 +64,18 @@ func cmdExtrasInit(args []string) error {
|
||||
}
|
||||
i++
|
||||
sourceOverride = rest[i]
|
||||
case "--file":
|
||||
if i+1 >= len(rest) {
|
||||
return fmt.Errorf("--file requires a filename")
|
||||
}
|
||||
i++
|
||||
file = rest[i]
|
||||
case "--as":
|
||||
if i+1 >= len(rest) {
|
||||
return fmt.Errorf("--as requires a filename")
|
||||
}
|
||||
i++
|
||||
as = rest[i]
|
||||
case "--flatten":
|
||||
flatten = true
|
||||
case "--force":
|
||||
@@ -80,7 +95,7 @@ func cmdExtrasInit(args []string) error {
|
||||
}
|
||||
|
||||
// No arguments at all → launch interactive TUI wizard
|
||||
if name == "" && len(targets) == 0 && syncMode == "" && shouldLaunchTUI(noTUI, nil) {
|
||||
if name == "" && len(targets) == 0 && syncMode == "" && file == "" && as == "" && shouldLaunchTUI(noTUI, nil) {
|
||||
return cmdExtrasInitTUI(mode, cwd)
|
||||
}
|
||||
if name == "" {
|
||||
@@ -90,123 +105,217 @@ func cmdExtrasInit(args []string) error {
|
||||
return fmt.Errorf("at least one --target is required")
|
||||
}
|
||||
|
||||
// Validate name
|
||||
if err := config.ValidateExtraName(name); err != nil {
|
||||
return err
|
||||
initTargets := make([]extrasInitTarget, 0, len(targets))
|
||||
for _, t := range targets {
|
||||
initTargets = append(initTargets, extrasInitTarget{path: t, mode: syncMode, flatten: flatten, as: as})
|
||||
}
|
||||
|
||||
// Validate sync mode
|
||||
if err := config.ValidateExtraMode(syncMode); err != nil {
|
||||
opts := extrasInitOptions{name: name, source: sourceOverride, file: file, targets: initTargets, force: force}
|
||||
if err := validateExtrasInit(opts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Validate flatten + mode combination
|
||||
if err := config.ValidateExtraFlatten(flatten, syncMode); err != nil {
|
||||
return err
|
||||
}
|
||||
if syncMode == "import" {
|
||||
return fmt.Errorf("import mode requires a single-file extra (set file: on the extra in config)")
|
||||
}
|
||||
|
||||
if mode == modeProject {
|
||||
if sourceOverride != "" {
|
||||
return fmt.Errorf("--source is not supported in project mode (source is always .skillshare/extras/<name>/)")
|
||||
}
|
||||
return extrasInitProject(cwd, name, targets, syncMode, flatten, force, start)
|
||||
return extrasInitProject(cwd, opts, start)
|
||||
}
|
||||
return extrasInitGlobal(name, targets, syncMode, sourceOverride, flatten, force, start)
|
||||
return extrasInitGlobal(opts, start)
|
||||
}
|
||||
|
||||
func extrasInitGlobal(name string, targets []string, syncMode string, sourceOverride string, flatten bool, force bool, start time.Time) error {
|
||||
// extrasInitOptions describes the extra that init creates. A non-empty file
|
||||
// makes it a single-file extra.
|
||||
type extrasInitOptions struct {
|
||||
name string
|
||||
source string // global mode only
|
||||
file string
|
||||
targets []extrasInitTarget
|
||||
force bool
|
||||
}
|
||||
|
||||
func (o extrasInitOptions) extra() config.ExtraConfig {
|
||||
extra := config.ExtraConfig{Name: o.name, Source: o.source, File: o.file}
|
||||
for _, t := range o.targets {
|
||||
et := config.ExtraTargetConfig{Path: t.path, Flatten: t.flatten, As: t.as}
|
||||
if t.mode != "" {
|
||||
et.Mode = t.mode
|
||||
}
|
||||
extra.Targets = append(extra.Targets, et)
|
||||
}
|
||||
return extra
|
||||
}
|
||||
|
||||
// validateExtrasInit checks the flags before anything is written.
|
||||
func validateExtrasInit(o extrasInitOptions) error {
|
||||
if err := config.ValidateExtraName(o.name); err != nil {
|
||||
return err
|
||||
}
|
||||
for _, t := range o.targets {
|
||||
if err := config.ValidateExtraMode(t.mode); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := config.ValidateExtraFlatten(t.flatten, t.mode); err != nil {
|
||||
return err
|
||||
}
|
||||
if o.file == "" && t.as != "" {
|
||||
return fmt.Errorf("--as requires --file")
|
||||
}
|
||||
if o.file == "" && t.mode == "import" {
|
||||
return fmt.Errorf("import mode requires a single-file extra: add --file <filename>")
|
||||
}
|
||||
}
|
||||
return config.ValidateExtraConfig(o.extra())
|
||||
}
|
||||
|
||||
// checkExtraSourceFile rejects a single-file extra whose source path is a
|
||||
// directory. A missing file is fine: the user creates it before syncing.
|
||||
func checkExtraSourceFile(sourceDir, file string) error {
|
||||
if file == "" {
|
||||
return nil
|
||||
}
|
||||
path := filepath.Join(sourceDir, file)
|
||||
if info, err := os.Stat(path); err == nil && info.IsDir() {
|
||||
return fmt.Errorf("source %s is a directory, not a file", path)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func extrasInitGlobal(o extrasInitOptions, start time.Time) error {
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if force {
|
||||
cfg.Extras = removeExtraByName(cfg.Extras, name)
|
||||
} else if err := config.ValidateExtraNameUnique(name, cfg.Extras); err != nil {
|
||||
if o.force {
|
||||
cfg.Extras = removeExtraByName(cfg.Extras, o.name)
|
||||
} else if err := config.ValidateExtraNameUnique(o.name, cfg.Extras); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Build extra config
|
||||
extra := config.ExtraConfig{Name: name, Source: sourceOverride}
|
||||
for _, t := range targets {
|
||||
et := config.ExtraTargetConfig{Path: t, Flatten: flatten}
|
||||
if syncMode != "" {
|
||||
et.Mode = syncMode
|
||||
extra := o.extra()
|
||||
sourceDir := config.ResolveExtrasSourceDir(extra, cfg.EffectiveExtrasSource(), cfg.EffectiveSkillsSource())
|
||||
if err := checkExtraSourceFile(sourceDir, o.file); err != nil {
|
||||
return err
|
||||
}
|
||||
cfg.Extras = append(cfg.Extras, extra)
|
||||
if o.file != "" {
|
||||
if err := cfg.ValidateExtras(o.name); err != nil {
|
||||
return err
|
||||
}
|
||||
extra.Targets = append(extra.Targets, et)
|
||||
}
|
||||
|
||||
// Create source directory
|
||||
sourceDir := config.ResolveExtrasSourceDir(extra, cfg.EffectiveExtrasSource(), cfg.EffectiveSkillsSource())
|
||||
if err := os.MkdirAll(sourceDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create extras source directory: %w", err)
|
||||
}
|
||||
|
||||
// Add to config and save
|
||||
cfg.Extras = append(cfg.Extras, extra)
|
||||
if err := cfg.Save(); err != nil {
|
||||
return fmt.Errorf("failed to save config: %w", err)
|
||||
}
|
||||
|
||||
ui.Success("Created extras/%s/ with %d target(s)", name, len(targets))
|
||||
ui.Info("Add files to extras/%s/ then run 'skillshare sync extras'", name)
|
||||
if o.file != "" {
|
||||
printSingleFileExtraCreated(extra, sourceDir, "")
|
||||
} else {
|
||||
ui.Success("Created extras/%s/ with %d target(s)", o.name, len(o.targets))
|
||||
ui.Info("Add files to extras/%s/ then run 'skillshare sync extras'", o.name)
|
||||
}
|
||||
|
||||
// Oplog
|
||||
e := oplog.NewEntry("extras-init", "ok", time.Since(start))
|
||||
e.Args = map[string]any{"name": name, "targets": len(targets), "scope": "global"}
|
||||
e.Args = map[string]any{"name": o.name, "targets": len(o.targets), "scope": "global"}
|
||||
if o.file != "" {
|
||||
e.Args["file"] = o.file
|
||||
}
|
||||
oplog.WriteWithLimit(config.ConfigPath(), oplog.OpsFile, e, logMaxEntries()) //nolint:errcheck
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func extrasInitProject(cwd, name string, targets []string, syncMode string, flatten bool, force bool, start time.Time) error {
|
||||
func extrasInitProject(cwd string, o extrasInitOptions, start time.Time) error {
|
||||
projCfg, err := config.LoadProject(cwd)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if force {
|
||||
projCfg.Extras = removeExtraByName(projCfg.Extras, name)
|
||||
} else if err := config.ValidateExtraNameUnique(name, projCfg.Extras); err != nil {
|
||||
if o.force {
|
||||
projCfg.Extras = removeExtraByName(projCfg.Extras, o.name)
|
||||
} else if err := config.ValidateExtraNameUnique(o.name, projCfg.Extras); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
extra := config.ExtraConfig{Name: name}
|
||||
for _, t := range targets {
|
||||
et := config.ExtraTargetConfig{Path: t, Flatten: flatten}
|
||||
if syncMode != "" {
|
||||
et.Mode = syncMode
|
||||
extra := o.extra()
|
||||
sourceDir := config.ExtrasSourceDirProject(projCfg.EffectiveExtrasSource(cwd), o.name)
|
||||
if err := checkExtraSourceFile(sourceDir, o.file); err != nil {
|
||||
return err
|
||||
}
|
||||
projCfg.Extras = append(projCfg.Extras, extra)
|
||||
if o.file != "" {
|
||||
if err := projCfg.ValidateExtras(cwd, o.name); err != nil {
|
||||
return err
|
||||
}
|
||||
extra.Targets = append(extra.Targets, et)
|
||||
}
|
||||
|
||||
// Create source directory
|
||||
sourceDir := config.ExtrasSourceDirProject(projCfg.EffectiveExtrasSource(cwd), name)
|
||||
if err := os.MkdirAll(sourceDir, 0755); err != nil {
|
||||
return fmt.Errorf("failed to create extras source directory: %w", err)
|
||||
}
|
||||
|
||||
// Add to config and save
|
||||
projCfg.Extras = append(projCfg.Extras, extra)
|
||||
if err := projCfg.Save(cwd); err != nil {
|
||||
return fmt.Errorf("failed to save project config: %w", err)
|
||||
}
|
||||
|
||||
ui.Success("Created .skillshare/extras/%s/ with %d target(s)", name, len(targets))
|
||||
ui.Info("Add files to .skillshare/extras/%s/ then run 'skillshare sync extras -p'", name)
|
||||
if o.file != "" {
|
||||
printSingleFileExtraCreated(extra, sourceDir, " -p")
|
||||
} else {
|
||||
ui.Success("Created .skillshare/extras/%s/ with %d target(s)", o.name, len(o.targets))
|
||||
ui.Info("Add files to .skillshare/extras/%s/ then run 'skillshare sync extras -p'", o.name)
|
||||
}
|
||||
|
||||
// Oplog
|
||||
cfgPath := config.ProjectConfigPath(cwd)
|
||||
e := oplog.NewEntry("extras-init", "ok", time.Since(start))
|
||||
e.Args = map[string]any{"name": name, "targets": len(targets), "scope": "project"}
|
||||
e.Args = map[string]any{"name": o.name, "targets": len(o.targets), "scope": "project"}
|
||||
if o.file != "" {
|
||||
e.Args["file"] = o.file
|
||||
}
|
||||
oplog.WriteWithLimit(cfgPath, oplog.OpsFile, e, logMaxEntries()) //nolint:errcheck
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// printSingleFileExtraCreated reports a new single-file extra: its source file
|
||||
// and the file each target will get, as configured. suffix is appended to the
|
||||
// sync hint.
|
||||
func printSingleFileExtraCreated(extra config.ExtraConfig, sourceDir, suffix string) {
|
||||
src := filepath.Join(sourceDir, extra.File)
|
||||
ui.Success("Created extra %s (single file)", extra.Name)
|
||||
_, err := os.Stat(src)
|
||||
missing := ""
|
||||
if err != nil {
|
||||
missing = " (not found)"
|
||||
}
|
||||
fmt.Printf("Source: %s%s\n", shortenPath(src), missing)
|
||||
for _, t := range extra.Targets {
|
||||
fmt.Printf("Target: %s [%s]\n", shortenPath(singleFileTargetPath(extra, t)), sync.EffectiveMode(t.Mode))
|
||||
}
|
||||
if missing != "" {
|
||||
fmt.Printf("Create the source file, then run 'skillshare sync extras%s'.\n", suffix)
|
||||
return
|
||||
}
|
||||
fmt.Printf("Run 'skillshare sync extras%s' to sync.\n", suffix)
|
||||
}
|
||||
|
||||
// singleFileTargetPath returns the file a single-file extra's target writes,
|
||||
// <path>/<as or file>, with the path as configured (relative project paths
|
||||
// stay relative).
|
||||
func singleFileTargetPath(extra config.ExtraConfig, t config.ExtraTargetConfig) string {
|
||||
name := t.As
|
||||
if name == "" {
|
||||
name = extra.File
|
||||
}
|
||||
return filepath.Join(config.ExpandPath(t.Path), name)
|
||||
}
|
||||
|
||||
// removeExtraByName returns a new slice with the named extra removed.
|
||||
// If no extra matches, the original slice is returned unchanged.
|
||||
func removeExtraByName(extras []config.ExtraConfig, name string) []config.ExtraConfig {
|
||||
@@ -222,7 +331,7 @@ func removeExtraByName(extras []config.ExtraConfig, name string) []config.ExtraC
|
||||
func printExtrasInitHelp() {
|
||||
fmt.Println(`Usage: skillshare extras init <name> [options]
|
||||
|
||||
Create a new extra resource type.
|
||||
Create a new extra resource type: a folder of files, or one file (--file).
|
||||
|
||||
Arguments:
|
||||
name Name for the extra (e.g., rules, commands, prompts)
|
||||
@@ -230,8 +339,10 @@ Arguments:
|
||||
Options:
|
||||
--target <path> Target directory (repeatable)
|
||||
--source <path> Custom source directory (overrides extras_source and default; global mode only)
|
||||
--mode <mode> Sync mode: merge (default), copy, symlink
|
||||
--flatten Flatten files from subdirectories into target root
|
||||
--file <filename> Sync only this file from the source directory (single-file extra)
|
||||
--as <filename> Target filename for every --target (requires --file; default: the --file name)
|
||||
--mode <mode> Sync mode: merge (default), copy, symlink; import for single-file extras
|
||||
--flatten Flatten files from subdirectories into target root (folder extras only)
|
||||
--force Overwrite if extra already exists
|
||||
--project, -p Create in project mode (.skillshare/)
|
||||
--global, -g Create in global mode (~/.config/skillshare/)
|
||||
@@ -244,5 +355,7 @@ Examples:
|
||||
skillshare extras init rules --source ~/company-shared/rules --target ~/.claude/rules
|
||||
skillshare extras init rules --target ~/.claude/rules --force
|
||||
skillshare extras init agents --target ~/.claude/agents --flatten
|
||||
skillshare extras init prompts --target .claude/prompts -p`)
|
||||
skillshare extras init prompts --target .claude/prompts -p
|
||||
skillshare extras init pi-prompt --source ~/dotfiles/prompts --file system.md \
|
||||
--target ~/.pi/agent --as APPEND_SYSTEM.md`)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
)
|
||||
|
||||
func TestValidateExtrasInit(t *testing.T) {
|
||||
target := func(mode string, flatten bool, as string) []extrasInitTarget {
|
||||
return []extrasInitTarget{{path: "/tmp/t", mode: mode, flatten: flatten, as: as}}
|
||||
}
|
||||
cases := []struct {
|
||||
name string
|
||||
opts extrasInitOptions
|
||||
want string // "" = valid
|
||||
}{
|
||||
{"single file with as", extrasInitOptions{name: "p", file: "system.md", targets: target("", false, "APPEND.md")}, ""},
|
||||
{"single file import", extrasInitOptions{name: "p", file: "system.md", targets: target("import", false, "")}, ""},
|
||||
{"as without file", extrasInitOptions{name: "p", targets: target("", false, "APPEND.md")}, "--as requires --file"},
|
||||
{"import without file", extrasInitOptions{name: "p", targets: target("import", false, "")}, "import mode requires a single-file extra"},
|
||||
{"flatten with file", extrasInitOptions{name: "p", file: "system.md", targets: target("", true, "")}, "flatten cannot be used with a single-file extra"},
|
||||
{"file is a path", extrasInitOptions{name: "p", file: "a/system.md", targets: target("", false, "")}, "must be a plain filename"},
|
||||
{"as is a path", extrasInitOptions{name: "p", file: "system.md", targets: target("", false, "../x.md")}, "must be a plain filename"},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
err := validateExtrasInit(tc.opts)
|
||||
if tc.want == "" {
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if err == nil || !strings.Contains(err.Error(), tc.want) {
|
||||
t.Fatalf("error = %v, want %q", err, tc.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtrasInitTUI_SingleFileFlow(t *testing.T) {
|
||||
var m tea.Model = newExtrasInitTUIModel()
|
||||
typeText := func(s string) {
|
||||
for _, r := range s {
|
||||
m, _ = m.Update(tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{r}})
|
||||
}
|
||||
}
|
||||
key := func(k string) {
|
||||
switch k {
|
||||
case "enter":
|
||||
m, _ = m.Update(tea.KeyMsg{Type: tea.KeyEnter})
|
||||
case "down":
|
||||
m, _ = m.Update(tea.KeyMsg{Type: tea.KeyDown})
|
||||
}
|
||||
}
|
||||
|
||||
typeText("pi-prompt")
|
||||
key("enter")
|
||||
key("down") // Single file
|
||||
key("enter")
|
||||
typeText("system.md")
|
||||
key("enter")
|
||||
key("enter") // default source
|
||||
typeText("/tmp/pi")
|
||||
key("enter")
|
||||
key("enter") // keep the source file name
|
||||
key("enter") // merge
|
||||
|
||||
got := m.(extrasInitTUIModel)
|
||||
if got.phase != extrasPhaseAddMore {
|
||||
t.Fatalf("phase = %v, want add-more (no flatten step for a single file)", got.phase)
|
||||
}
|
||||
if !got.singleFile || got.file != "system.md" || len(got.targets) != 1 || got.targets[0].as != "" || got.targets[0].mode != "merge" {
|
||||
t.Errorf("model = singleFile %v file %q targets %+v", got.singleFile, got.file, got.targets)
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,11 @@ type extrasInitPhase int
|
||||
|
||||
const (
|
||||
extrasPhaseNameInput extrasInitPhase = iota
|
||||
extrasPhaseKindSelect // folder or single file?
|
||||
extrasPhaseFileInput // single file: source file name
|
||||
extrasPhaseSourceInput // ask for custom source directory
|
||||
extrasPhaseTargetInput // ask for target path
|
||||
extrasPhaseAsInput // single file: target file name
|
||||
extrasPhaseModeSelect // choose sync mode
|
||||
extrasPhaseFlattenToggle // flatten files into target root?
|
||||
extrasPhaseAddMore // add another target?
|
||||
@@ -28,14 +31,18 @@ type extrasInitTarget struct {
|
||||
path string
|
||||
mode string
|
||||
flatten bool
|
||||
as string // single file: target filename ("" = the source file name)
|
||||
}
|
||||
|
||||
type extrasInitTUIModel struct {
|
||||
phase extrasInitPhase
|
||||
name string
|
||||
sourceValue string
|
||||
singleFile bool
|
||||
kindCursor int // 0 folder, 1 single file
|
||||
file string // single file: source file name
|
||||
targets []extrasInitTarget
|
||||
currMode int // cursor index into syncModes
|
||||
currMode int // cursor index into m.modes()
|
||||
|
||||
textInput textinput.Model
|
||||
sourceInput textinput.Model
|
||||
@@ -44,7 +51,32 @@ type extrasInitTUIModel struct {
|
||||
err error
|
||||
}
|
||||
|
||||
var syncModes = config.ValidSyncModes // import needs a single-file extra, which init does not create
|
||||
var syncModes = config.ValidSyncModes // folder extras; import needs a single file
|
||||
|
||||
// singleFileSyncModes are offered for a single-file extra. symlink is left out:
|
||||
// for one file it does the same as merge.
|
||||
var singleFileSyncModes = []string{"merge", "copy", "import"}
|
||||
|
||||
// modes returns the sync modes offered for the extra being created.
|
||||
func (m extrasInitTUIModel) modes() []string {
|
||||
if m.singleFile {
|
||||
return singleFileSyncModes
|
||||
}
|
||||
return syncModes
|
||||
}
|
||||
|
||||
// targetLabel returns a target as listed in the wizard: its path (for a
|
||||
// single file, the file it writes) and settings.
|
||||
func (m extrasInitTUIModel) targetLabel(t extrasInitTarget) string {
|
||||
path, modeLabel := t.path, t.mode
|
||||
if m.singleFile {
|
||||
path = singleFileTargetPath(config.ExtraConfig{File: m.file}, config.ExtraTargetConfig{Path: t.path, As: t.as})
|
||||
}
|
||||
if t.flatten {
|
||||
modeLabel += ", flatten"
|
||||
}
|
||||
return fmt.Sprintf("%s (%s)", path, modeLabel)
|
||||
}
|
||||
|
||||
func newExtrasInitTUIModel() extrasInitTUIModel {
|
||||
ti := textinput.New()
|
||||
@@ -83,11 +115,24 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case extrasPhaseNameInput:
|
||||
m.cancelled = true
|
||||
return m, tea.Quit
|
||||
case extrasPhaseSourceInput:
|
||||
case extrasPhaseKindSelect:
|
||||
m.phase = extrasPhaseNameInput
|
||||
m.textInput.SetValue(m.name)
|
||||
m.textInput.Placeholder = "rules"
|
||||
return m, nil
|
||||
case extrasPhaseFileInput:
|
||||
m.err = nil
|
||||
m.phase = extrasPhaseKindSelect
|
||||
return m, nil
|
||||
case extrasPhaseSourceInput:
|
||||
if m.singleFile {
|
||||
m.phase = extrasPhaseFileInput
|
||||
m.textInput.SetValue(m.file)
|
||||
m.textInput.Placeholder = "system.md"
|
||||
return m, nil
|
||||
}
|
||||
m.phase = extrasPhaseKindSelect
|
||||
return m, nil
|
||||
case extrasPhaseTargetInput:
|
||||
if len(m.targets) == 0 {
|
||||
m.phase = extrasPhaseSourceInput
|
||||
@@ -97,7 +142,20 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
m.phase = extrasPhaseAddMore
|
||||
return m, nil
|
||||
case extrasPhaseAsInput:
|
||||
m.err = nil
|
||||
m.targets = m.targets[:len(m.targets)-1] // remove the pending target
|
||||
m.phase = extrasPhaseTargetInput
|
||||
m.textInput.SetValue("")
|
||||
m.textInput.Placeholder = targetPlaceholder(len(m.targets))
|
||||
return m, nil
|
||||
case extrasPhaseModeSelect:
|
||||
if m.singleFile {
|
||||
m.phase = extrasPhaseAsInput
|
||||
m.textInput.SetValue(m.targets[len(m.targets)-1].as)
|
||||
m.textInput.Placeholder = m.file
|
||||
return m, nil
|
||||
}
|
||||
m.targets = m.targets[:len(m.targets)-1] // remove the pending target
|
||||
m.phase = extrasPhaseTargetInput
|
||||
m.textInput.SetValue("")
|
||||
@@ -107,7 +165,7 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
m.phase = extrasPhaseModeSelect
|
||||
return m, nil
|
||||
case extrasPhaseAddMore:
|
||||
if m.targets[len(m.targets)-1].mode == "symlink" {
|
||||
if m.singleFile || m.targets[len(m.targets)-1].mode == "symlink" {
|
||||
m.phase = extrasPhaseModeSelect
|
||||
} else {
|
||||
m.phase = extrasPhaseFlattenToggle
|
||||
@@ -133,6 +191,42 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
m.name = name
|
||||
m.err = nil
|
||||
m.phase = extrasPhaseKindSelect
|
||||
return m, nil
|
||||
}
|
||||
|
||||
case extrasPhaseKindSelect:
|
||||
switch msg.String() {
|
||||
case "up", "k":
|
||||
m.kindCursor = 0
|
||||
case "down", "j":
|
||||
m.kindCursor = 1
|
||||
case "enter", " ":
|
||||
m.singleFile = m.kindCursor == 1
|
||||
if m.singleFile {
|
||||
m.phase = extrasPhaseFileInput
|
||||
m.textInput.SetValue(m.file)
|
||||
m.textInput.Placeholder = "system.md"
|
||||
return m, nil
|
||||
}
|
||||
m.phase = extrasPhaseSourceInput
|
||||
m.sourceInput.Focus()
|
||||
}
|
||||
return m, nil
|
||||
|
||||
case extrasPhaseFileInput:
|
||||
switch msg.String() {
|
||||
case "enter":
|
||||
file := strings.TrimSpace(m.textInput.Value())
|
||||
if file == "" {
|
||||
return m, nil
|
||||
}
|
||||
if err := config.ValidateExtraConfig(config.ExtraConfig{Name: m.name, File: file}); err != nil {
|
||||
m.err = err
|
||||
return m, nil
|
||||
}
|
||||
m.file = file
|
||||
m.err = nil
|
||||
m.phase = extrasPhaseSourceInput
|
||||
m.sourceInput.Focus()
|
||||
return m, nil
|
||||
@@ -157,6 +251,31 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
m.targets = append(m.targets, extrasInitTarget{path: path})
|
||||
m.currMode = 0
|
||||
if m.singleFile {
|
||||
m.phase = extrasPhaseAsInput
|
||||
m.textInput.SetValue("")
|
||||
m.textInput.Placeholder = m.file
|
||||
return m, nil
|
||||
}
|
||||
m.phase = extrasPhaseModeSelect
|
||||
return m, nil
|
||||
}
|
||||
|
||||
case extrasPhaseAsInput:
|
||||
switch msg.String() {
|
||||
case "enter":
|
||||
as := strings.TrimSpace(m.textInput.Value())
|
||||
if as == m.file {
|
||||
as = ""
|
||||
}
|
||||
tc := config.ExtraTargetConfig{Path: m.targets[len(m.targets)-1].path, As: as}
|
||||
if err := config.ValidateExtraConfig(config.ExtraConfig{Name: m.name, File: m.file, Targets: []config.ExtraTargetConfig{tc}}); err != nil {
|
||||
m.err = err
|
||||
return m, nil
|
||||
}
|
||||
m.err = nil
|
||||
m.targets[len(m.targets)-1].as = as
|
||||
m.currMode = 0
|
||||
m.phase = extrasPhaseModeSelect
|
||||
return m, nil
|
||||
}
|
||||
@@ -169,14 +288,15 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
}
|
||||
return m, nil
|
||||
case "down", "j":
|
||||
if m.currMode < len(syncModes)-1 {
|
||||
if m.currMode < len(m.modes())-1 {
|
||||
m.currMode++
|
||||
}
|
||||
return m, nil
|
||||
case "enter", " ":
|
||||
m.targets[len(m.targets)-1].mode = syncModes[m.currMode]
|
||||
if syncModes[m.currMode] == "symlink" {
|
||||
m.phase = extrasPhaseAddMore // skip flatten for symlink
|
||||
mode := m.modes()[m.currMode]
|
||||
m.targets[len(m.targets)-1].mode = mode
|
||||
if m.singleFile || mode == "symlink" {
|
||||
m.phase = extrasPhaseAddMore // no flatten for one file or a directory symlink
|
||||
} else {
|
||||
m.phase = extrasPhaseFlattenToggle
|
||||
}
|
||||
@@ -224,7 +344,7 @@ func (m extrasInitTUIModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
// Delegate to textinput for typing phases
|
||||
switch m.phase {
|
||||
case extrasPhaseNameInput, extrasPhaseTargetInput:
|
||||
case extrasPhaseNameInput, extrasPhaseFileInput, extrasPhaseTargetInput, extrasPhaseAsInput:
|
||||
var cmd tea.Cmd
|
||||
m.textInput, cmd = m.textInput.Update(msg)
|
||||
return m, cmd
|
||||
@@ -253,8 +373,40 @@ func (m extrasInitTUIModel) View() string {
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Dim().MarginLeft(2).Render("enter confirm esc cancel"))
|
||||
|
||||
case extrasPhaseKindSelect:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Accent().Render("What do you want to sync?"))
|
||||
b.WriteString("\n")
|
||||
kinds := [][2]string{{"Folder", " (every file in a folder)"}, {"Single file", " (one file, renamed per target if needed)"}}
|
||||
for i, k := range kinds {
|
||||
if i == m.kindCursor {
|
||||
b.WriteString(theme.Accent().Render("▸ "+k[0]) + theme.Dim().Render(k[1]))
|
||||
} else {
|
||||
b.WriteString(theme.Dim().Render(" " + k[0] + k[1]))
|
||||
}
|
||||
b.WriteString("\n")
|
||||
}
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().MarginLeft(2).Render("↑↓/jk navigate enter/space select esc back"))
|
||||
|
||||
case extrasPhaseFileInput:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Accent().Render("Source file name: "))
|
||||
b.WriteString(m.textInput.View())
|
||||
if m.err != nil {
|
||||
b.WriteString("\n" + theme.Danger().Render(m.err.Error()))
|
||||
}
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Dim().MarginLeft(2).Render("enter confirm esc back"))
|
||||
|
||||
case extrasPhaseSourceInput:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
if m.singleFile {
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("File: %s", m.file)))
|
||||
}
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Accent().Render("Source directory (optional): "))
|
||||
b.WriteString(m.sourceInput.View())
|
||||
@@ -263,6 +415,10 @@ func (m extrasInitTUIModel) View() string {
|
||||
|
||||
case extrasPhaseTargetInput:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
if m.singleFile {
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("File: %s", m.file)))
|
||||
}
|
||||
if m.sourceValue != "" {
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Source: %s", m.sourceValue)))
|
||||
@@ -270,11 +426,7 @@ func (m extrasInitTUIModel) View() string {
|
||||
if len(m.targets) > 0 {
|
||||
b.WriteString("\n")
|
||||
for _, t := range m.targets {
|
||||
modeLabel := t.mode
|
||||
if t.flatten {
|
||||
modeLabel += ", flatten"
|
||||
}
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf(" → %s (%s)", t.path, modeLabel)))
|
||||
b.WriteString(theme.Dim().Render(" → " + m.targetLabel(t)))
|
||||
b.WriteString("\n")
|
||||
}
|
||||
}
|
||||
@@ -284,25 +436,44 @@ func (m extrasInitTUIModel) View() string {
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Dim().MarginLeft(2).Render("enter confirm esc back"))
|
||||
|
||||
case extrasPhaseModeSelect:
|
||||
case extrasPhaseAsInput:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Target: %s", m.targets[len(m.targets)-1].path)))
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Accent().Render("Target file name: "))
|
||||
b.WriteString(m.textInput.View())
|
||||
if m.err != nil {
|
||||
b.WriteString("\n" + theme.Danger().Render(m.err.Error()))
|
||||
}
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Dim().MarginLeft(2).Render(fmt.Sprintf("enter to keep %s esc back", m.file)))
|
||||
|
||||
case extrasPhaseModeSelect:
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Target: %s", m.targetLabel(m.targets[len(m.targets)-1]))))
|
||||
b.WriteString("\n\n")
|
||||
b.WriteString(theme.Accent().Render("Sync mode:"))
|
||||
b.WriteString("\n")
|
||||
for i, mode := range syncModes {
|
||||
for i, mode := range m.modes() {
|
||||
cursor := " "
|
||||
if i == m.currMode {
|
||||
cursor = "▸ "
|
||||
}
|
||||
var desc string
|
||||
switch mode {
|
||||
case "merge":
|
||||
switch {
|
||||
case m.singleFile && mode == "merge":
|
||||
desc = " (file symlink, default)"
|
||||
case m.singleFile && mode == "copy":
|
||||
desc = " (file copy)"
|
||||
case mode == "import":
|
||||
desc = " (@path line in the target file)"
|
||||
case mode == "merge":
|
||||
desc = " (per-file symlinks, default)"
|
||||
case "copy":
|
||||
case mode == "copy":
|
||||
desc = " (file copies)"
|
||||
case "symlink":
|
||||
case mode == "symlink":
|
||||
desc = " (directory symlink)"
|
||||
}
|
||||
if i == m.currMode {
|
||||
@@ -329,11 +500,7 @@ func (m extrasInitTUIModel) View() string {
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf("Name: %s", m.name)))
|
||||
b.WriteString("\n")
|
||||
for _, t := range m.targets {
|
||||
modeLabel := t.mode
|
||||
if t.flatten {
|
||||
modeLabel += ", flatten"
|
||||
}
|
||||
b.WriteString(theme.Dim().Render(fmt.Sprintf(" → %s (%s)", t.path, modeLabel)))
|
||||
b.WriteString(theme.Dim().Render(" → " + m.targetLabel(t)))
|
||||
b.WriteString("\n")
|
||||
}
|
||||
b.WriteString("\n")
|
||||
@@ -345,15 +512,14 @@ func (m extrasInitTUIModel) View() string {
|
||||
b.WriteString(theme.Accent().Render("Summary:"))
|
||||
b.WriteString("\n")
|
||||
b.WriteString(fmt.Sprintf(" Name: %s\n", m.name))
|
||||
if m.singleFile {
|
||||
b.WriteString(fmt.Sprintf(" File: %s\n", m.file))
|
||||
}
|
||||
if m.sourceValue != "" {
|
||||
b.WriteString(fmt.Sprintf(" Source: %s\n", m.sourceValue))
|
||||
}
|
||||
for _, t := range m.targets {
|
||||
modeLabel := t.mode
|
||||
if t.flatten {
|
||||
modeLabel += ", flatten"
|
||||
}
|
||||
b.WriteString(fmt.Sprintf(" → %s (%s)\n", t.path, modeLabel))
|
||||
b.WriteString(fmt.Sprintf(" → %s\n", m.targetLabel(t)))
|
||||
}
|
||||
b.WriteString("\n")
|
||||
b.WriteString(theme.Accent().Render("Create this extra? (Y/n) "))
|
||||
@@ -391,23 +557,39 @@ func cmdExtrasInitTUI(mode runMode, cwd string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Collect targets and the first non-empty mode (mode applies globally)
|
||||
var targetPaths []string
|
||||
syncMode := ""
|
||||
flatten := false
|
||||
for _, t := range result.targets {
|
||||
targetPaths = append(targetPaths, t.path)
|
||||
if syncMode == "" && t.mode != "" && t.mode != "merge" {
|
||||
syncMode = t.mode
|
||||
start := time.Now()
|
||||
opts := extrasInitOptions{name: result.name, source: result.sourceValue, file: result.file}
|
||||
if result.singleFile {
|
||||
// Each target keeps its own file name and mode; merge is the default.
|
||||
for _, t := range result.targets {
|
||||
if t.mode == "merge" {
|
||||
t.mode = ""
|
||||
}
|
||||
opts.targets = append(opts.targets, t)
|
||||
}
|
||||
if t.flatten {
|
||||
flatten = true
|
||||
} else {
|
||||
// Collect targets and the first non-empty mode (mode applies globally)
|
||||
syncMode := ""
|
||||
flatten := false
|
||||
for _, t := range result.targets {
|
||||
if syncMode == "" && t.mode != "" && t.mode != "merge" {
|
||||
syncMode = t.mode
|
||||
}
|
||||
if t.flatten {
|
||||
flatten = true
|
||||
}
|
||||
}
|
||||
for _, t := range result.targets {
|
||||
opts.targets = append(opts.targets, extrasInitTarget{path: t.path, mode: syncMode, flatten: flatten})
|
||||
}
|
||||
}
|
||||
if err := validateExtrasInit(opts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
start := time.Now()
|
||||
if mode == modeProject {
|
||||
return extrasInitProject(cwd, result.name, targetPaths, syncMode, flatten, false, start)
|
||||
opts.source = ""
|
||||
return extrasInitProject(cwd, opts, start)
|
||||
}
|
||||
return extrasInitGlobal(result.name, targetPaths, syncMode, result.sourceValue, flatten, false, start)
|
||||
return extrasInitGlobal(opts, start)
|
||||
}
|
||||
|
||||
@@ -234,7 +234,14 @@ func cmdExtrasList(args []string) error {
|
||||
if i > 0 {
|
||||
fmt.Println()
|
||||
}
|
||||
if !entry.SourceExists {
|
||||
if entry.File != "" {
|
||||
// Single-file extra: the source is one file, shown in full.
|
||||
src := shortenPath(filepath.Join(entry.SourceDir, entry.File))
|
||||
if !entry.SourceExists {
|
||||
src += " · source not found"
|
||||
}
|
||||
fmt.Printf("%s→%s %s %s%s%s\n", ui.Cyan, ui.Reset, entry.Name, ui.Dim, src, ui.Reset)
|
||||
} else if !entry.SourceExists {
|
||||
fmt.Printf("%s→%s %s %s\n", ui.Cyan, ui.Reset, entry.Name, ui.Dim+"source not found"+ui.Reset)
|
||||
} else {
|
||||
fileLabel := fmt.Sprintf("%d files", entry.FileCount)
|
||||
@@ -269,7 +276,7 @@ func cmdExtrasList(args []string) error {
|
||||
if t.Status != "synced" {
|
||||
statusSuffix = fmt.Sprintf(" %s%s%s", color, t.Status, ui.Reset)
|
||||
}
|
||||
fmt.Printf(" %s%s%s %s %s%s%s%s\n", color, icon, ui.Reset, shortenPath(t.Path), ui.Dim, modeLabel, ui.Reset, statusSuffix)
|
||||
fmt.Printf(" %s%s%s %s %s%s%s%s\n", color, icon, ui.Reset, shortenPath(extrasTargetDisplayPath(entry.File, t)), ui.Dim, modeLabel, ui.Reset, statusSuffix)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ type extrasListTUIModel struct {
|
||||
// Target sub-menu
|
||||
showTargetMenu bool
|
||||
targetMenuItems []extrasTargetInfo
|
||||
targetMenuFile string // single-file extra: its file, for target display paths
|
||||
targetCursor int
|
||||
targetAction string
|
||||
|
||||
@@ -423,6 +424,15 @@ func (m extrasListTUIModel) viewExtrasVertical() string {
|
||||
|
||||
// ─── Detail Panel ────────────────────────────────────────────────────
|
||||
|
||||
// extrasTargetDisplayPath returns the path shown for a target: the directory,
|
||||
// or for a single-file extra (file set) the file it writes.
|
||||
func extrasTargetDisplayPath(file string, t extrasTargetInfo) string {
|
||||
if file == "" {
|
||||
return t.Path
|
||||
}
|
||||
return singleFileTargetPath(config.ExtraConfig{File: file}, config.ExtraTargetConfig{Path: t.Path, As: t.As})
|
||||
}
|
||||
|
||||
func (m extrasListTUIModel) renderExtrasDetail(e extrasListEntry) string {
|
||||
var b strings.Builder
|
||||
|
||||
@@ -430,7 +440,13 @@ func (m extrasListTUIModel) renderExtrasDetail(e extrasListEntry) string {
|
||||
b.WriteString("\n\n")
|
||||
|
||||
label := theme.Dim().Width(14).Render("Source")
|
||||
if e.SourceExists {
|
||||
if e.File != "" {
|
||||
b.WriteString(label + shortenPath(filepath.Join(e.SourceDir, e.File)))
|
||||
if !e.SourceExists {
|
||||
b.WriteString(theme.Dim().Render(" · not found"))
|
||||
}
|
||||
b.WriteString("\n")
|
||||
} else if e.SourceExists {
|
||||
b.WriteString(label + shortenPath(e.SourceDir) + "\n")
|
||||
} else {
|
||||
b.WriteString(label + theme.Dim().Render("not found") + "\n")
|
||||
@@ -481,7 +497,7 @@ func (m extrasListTUIModel) renderExtrasDetail(e extrasListEntry) string {
|
||||
modeLabel += ", flatten"
|
||||
}
|
||||
fmt.Fprintf(&b, " %s %s (%s)%s\n",
|
||||
style.Render(icon), shortenPath(t.Path), modeLabel, theme.Dim().Render(statusText))
|
||||
style.Render(icon), shortenPath(extrasTargetDisplayPath(e.File, t)), modeLabel, theme.Dim().Render(statusText))
|
||||
}
|
||||
if hasDrift {
|
||||
b.WriteString("\n" + theme.Warning().Render("hint:") + " press S to sync, or use --force to overwrite conflicts\n")
|
||||
@@ -704,6 +720,7 @@ func (m extrasListTUIModel) enterTargetMenu(action string) (tea.Model, tea.Cmd)
|
||||
m.showTargetMenu = true
|
||||
m.targetAction = action
|
||||
m.targetMenuItems = item.entry.Targets
|
||||
m.targetMenuFile = item.entry.File
|
||||
m.targetCursor = 0
|
||||
m.lastActionMsg = ""
|
||||
return m, nil
|
||||
@@ -784,7 +801,7 @@ func (m extrasListTUIModel) renderTargetMenu() string {
|
||||
if i == m.targetCursor {
|
||||
prefix = theme.Accent().Render(">") + " "
|
||||
}
|
||||
fmt.Fprintf(&b, "%s%s (%s)\n", prefix, shortenPath(t.Path), t.Mode)
|
||||
fmt.Fprintf(&b, "%s%s (%s)\n", prefix, shortenPath(extrasTargetDisplayPath(m.targetMenuFile, t)), t.Mode)
|
||||
}
|
||||
} else {
|
||||
for i := 0; i <= len(m.targetMenuItems); i++ {
|
||||
@@ -796,7 +813,7 @@ func (m extrasListTUIModel) renderTargetMenu() string {
|
||||
fmt.Fprintf(&b, "%s%s\n", prefix, "All targets")
|
||||
} else {
|
||||
t := m.targetMenuItems[i-1]
|
||||
fmt.Fprintf(&b, "%s%s (%s)\n", prefix, shortenPath(t.Path), t.Mode)
|
||||
fmt.Fprintf(&b, "%s%s (%s)\n", prefix, shortenPath(extrasTargetDisplayPath(m.targetMenuFile, t)), t.Mode)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,16 @@ type Resolver struct {
|
||||
TargetDir func(string) string
|
||||
}
|
||||
|
||||
// IsShared reports whether extra is a shared instruction file: a single-file
|
||||
// extra whose file is AGENTS.md. Other single-file extras may target the same
|
||||
// instruction files, but Assign and PlanAssign never attach or detach them.
|
||||
func IsShared(extra config.ExtraConfig) bool { return extra.File == AgentsFile }
|
||||
|
||||
// Shared returns the shared instruction files among extras.
|
||||
func Shared(extras []config.ExtraConfig) []config.ExtraConfig {
|
||||
return slices.DeleteFunc(slices.Clone(extras), func(e config.ExtraConfig) bool { return !IsShared(e) })
|
||||
}
|
||||
|
||||
// Assign makes want exactly the shared files attached to t, in that order of
|
||||
// addition. Files no longer wanted are restored first (their link or import
|
||||
// line removed, the replaced file put back); newly wanted ones are added to
|
||||
@@ -36,7 +46,7 @@ func Assign(extras []config.ExtraConfig, t Target, want []string, r Resolver, wa
|
||||
|
||||
var errs []string
|
||||
for i := range extras {
|
||||
if extras[i].File == "" || slices.Contains(want, extras[i].Name) {
|
||||
if !IsShared(extras[i]) || slices.Contains(want, extras[i].Name) {
|
||||
continue
|
||||
}
|
||||
j := targetIndex(extras[i], t.File, r)
|
||||
@@ -93,14 +103,14 @@ func PlanAssign(extras []config.ExtraConfig, t Target, want []string, r Resolver
|
||||
return nil, &config.ExtraTargetConflict{Name: want[0], Target: t.Name}
|
||||
}
|
||||
for _, name := range want {
|
||||
if i := indexOf(extras, name); i == -1 || extras[i].File == "" {
|
||||
if i := indexOf(extras, name); i == -1 || !IsShared(extras[i]) {
|
||||
return nil, fmt.Errorf("shared instruction file %q not found", name)
|
||||
}
|
||||
}
|
||||
next := slices.Clone(extras)
|
||||
for i := range next {
|
||||
next[i].Targets = slices.Clone(next[i].Targets)
|
||||
if next[i].File == "" {
|
||||
if !IsShared(next[i]) {
|
||||
continue
|
||||
}
|
||||
j := targetIndex(next[i], t.File, r)
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"skillshare/internal/config"
|
||||
syncpkg "skillshare/internal/sync"
|
||||
)
|
||||
|
||||
func write(t *testing.T, path, content string) {
|
||||
@@ -212,6 +213,36 @@ func TestAssign_RestoreModifiedTargetPutsBackPreAttachFile(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAssign_LeavesOtherSingleFileExtrasAlone(t *testing.T) {
|
||||
t.Setenv("XDG_STATE_HOME", t.TempDir())
|
||||
src, home := t.TempDir(), t.TempDir()
|
||||
write(t, filepath.Join(src, "personal", "AGENTS.md"), "p\n")
|
||||
write(t, filepath.Join(src, "prompt", "system.md"), "s\n")
|
||||
claude := filepath.Join(home, "CLAUDE.md")
|
||||
write(t, claude, "mine\n")
|
||||
prompt := config.ExtraConfig{Name: "prompt", File: "system.md", Targets: []config.ExtraTargetConfig{{Path: home, As: "CLAUDE.md", Mode: "import"}}}
|
||||
extras := []config.ExtraConfig{{Name: "personal", File: "AGENTS.md"}, prompt}
|
||||
target := Target{Name: "claude", File: claude, Import: true}
|
||||
r := newResolver(src)
|
||||
if _, err := syncpkg.SyncExtraFile(ExtraFile(prompt, 0, r), false, ""); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if _, err := PlanAssign(extras, target, []string{"prompt"}, r); err == nil {
|
||||
t.Error("PlanAssign accepted a single-file extra that is not an AGENTS.md")
|
||||
}
|
||||
extras, err := Assign(extras, target, []string{"personal"}, r)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if extras, err = Assign(extras, target, nil, r); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(extras[1].Targets) != 1 || !strings.Contains(read(t, claude), "system.md") {
|
||||
t.Errorf("prompt extra detached: targets %+v, CLAUDE.md %q", extras[1].Targets, read(t, claude))
|
||||
}
|
||||
}
|
||||
|
||||
func TestProjectReach(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
write(t, filepath.Join(root, "AGENTS.md"), "a\n")
|
||||
|
||||
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
@@ -423,11 +424,13 @@ func (s *Server) handleExtrasCreate(w http.ResponseWriter, r *http.Request) {
|
||||
var body struct {
|
||||
Name string `json:"name"`
|
||||
Source string `json:"source,omitempty"`
|
||||
File string `json:"file,omitempty"` // single-file extra: the file in the source dir
|
||||
Targets []struct {
|
||||
Path string `json:"path"`
|
||||
Mode string `json:"mode"`
|
||||
Flatten bool `json:"flatten"`
|
||||
Extension string `json:"extension,omitempty"`
|
||||
As string `json:"as,omitempty"` // single-file extra: target filename
|
||||
} `json:"targets"`
|
||||
}
|
||||
if err := json.NewDecoder(r.Body).Decode(&body); err != nil {
|
||||
@@ -469,9 +472,9 @@ func (s *Server) handleExtrasCreate(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
// Build ExtraConfig
|
||||
extra := config.ExtraConfig{Name: body.Name, Source: body.Source}
|
||||
extra := config.ExtraConfig{Name: body.Name, Source: body.Source, File: body.File}
|
||||
for _, t := range body.Targets {
|
||||
et := config.ExtraTargetConfig{Path: t.Path, Flatten: t.Flatten}
|
||||
et := config.ExtraTargetConfig{Path: t.Path, Flatten: t.Flatten, As: t.As}
|
||||
if t.Mode != "" {
|
||||
et.Mode = t.Mode
|
||||
}
|
||||
@@ -489,10 +492,29 @@ func (s *Server) handleExtrasCreate(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// Append to config (extras source resolution is handled by
|
||||
// s.cfg.EffectiveExtrasSource() inside s.extrasSourceDir; no backfill needed).
|
||||
// The same ownership and import checks add-target runs.
|
||||
var validateErr error
|
||||
if s.IsProjectMode() {
|
||||
s.projectCfg.Extras = append(s.projectCfg.Extras, extra)
|
||||
prev := s.projectCfg.Extras
|
||||
s.projectCfg.Extras = append(slices.Clone(prev), extra)
|
||||
if validateErr = s.projectCfg.ValidateExtras(s.projectRoot, extra.Name); validateErr != nil {
|
||||
s.projectCfg.Extras = prev
|
||||
}
|
||||
} else {
|
||||
s.cfg.Extras = append(s.cfg.Extras, extra)
|
||||
prev := s.cfg.Extras
|
||||
s.cfg.Extras = append(slices.Clone(prev), extra)
|
||||
if validateErr = s.cfg.ValidateExtras(extra.Name); validateErr != nil {
|
||||
s.cfg.Extras = prev
|
||||
}
|
||||
}
|
||||
if validateErr != nil {
|
||||
var conflict *config.ExtraTargetConflict
|
||||
if errors.As(validateErr, &conflict) {
|
||||
writeExtraTargetConflict(w, validateErr, conflict.Target)
|
||||
} else {
|
||||
writeError(w, http.StatusBadRequest, validateErr.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if err := s.saveConfig(); err != nil {
|
||||
|
||||
@@ -900,3 +900,59 @@ func TestHandleExtrasRemoveTarget_Last(t *testing.T) {
|
||||
t.Fatalf("expected 400, got %d: %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleExtrasCreate_SingleFile(t *testing.T) {
|
||||
s, _ := newTestServerWithExtras(t, nil, "")
|
||||
targetDir := t.TempDir()
|
||||
body := `{"name":"pi-prompt","file":"system.md","targets":[{"path":"` + targetDir + `","as":"APPEND_SYSTEM.md","mode":"copy"}]}`
|
||||
rr := httptest.NewRecorder()
|
||||
s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodPost, "/api/extras", strings.NewReader(body)))
|
||||
if rr.Code != http.StatusOK {
|
||||
t.Fatalf("expected 200, got %d: %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
|
||||
rr = httptest.NewRecorder()
|
||||
s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodGet, "/api/extras", nil))
|
||||
var resp struct {
|
||||
Extras []extrasListEntry `json:"extras"`
|
||||
}
|
||||
if err := json.Unmarshal(rr.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(resp.Extras) != 1 || resp.Extras[0].File != "system.md" || resp.Extras[0].Targets[0].As != "APPEND_SYSTEM.md" {
|
||||
t.Errorf("extras = %+v, want file system.md with as APPEND_SYSTEM.md", resp.Extras)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleExtrasCreate_SingleFileRejectsInvalidSettings(t *testing.T) {
|
||||
targetDir := t.TempDir()
|
||||
cases := map[string]string{
|
||||
"flatten": `{"name":"x","file":"a.md","targets":[{"path":"` + targetDir + `","flatten":true}]}`,
|
||||
"as_no_file": `{"name":"x","targets":[{"path":"` + targetDir + `","as":"b.md"}]}`,
|
||||
"file_is_path": `{"name":"x","file":"sub/a.md","targets":[{"path":"` + targetDir + `"}]}`,
|
||||
}
|
||||
for name, body := range cases {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
s, _ := newTestServerWithExtras(t, nil, "")
|
||||
rr := httptest.NewRecorder()
|
||||
s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodPost, "/api/extras", strings.NewReader(body)))
|
||||
if rr.Code != http.StatusBadRequest {
|
||||
t.Errorf("expected 400, got %d: %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleExtrasCreate_SingleFileTargetHeld(t *testing.T) {
|
||||
targetDir := t.TempDir()
|
||||
s, _ := newTestServerWithExtras(t, []config.ExtraConfig{{Name: "a", File: "a.md", Targets: []config.ExtraTargetConfig{{Path: targetDir, As: "OUT.md"}}}}, "")
|
||||
body := `{"name":"b","file":"b.md","targets":[{"path":"` + targetDir + `","as":"OUT.md"}]}`
|
||||
rr := httptest.NewRecorder()
|
||||
s.handler.ServeHTTP(rr, httptest.NewRequest(http.MethodPost, "/api/extras", strings.NewReader(body)))
|
||||
if rr.Code != http.StatusConflict {
|
||||
t.Fatalf("expected 409, got %d: %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
if len(s.cfg.Extras) != 1 {
|
||||
t.Errorf("extras after rejected create = %+v, want unchanged", s.cfg.Extras)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ func (s *Server) handleGetTargetInstructions(w http.ResponseWriter, r *http.Requ
|
||||
resp.LinkTo = dest
|
||||
resp.LinkShared = s.sharedLinkName(it.Path)
|
||||
}
|
||||
resp.Shared = instructions.Assignments(s.extrasConfig(), it.Path, s.instructionsResolver())
|
||||
resp.Shared = instructions.Assignments(instructions.Shared(s.extrasConfig()), it.Path, s.instructionsResolver())
|
||||
resp.Convert, resp.Blocked = convertMethods(it, resp.Exists && instructions.HasMovableContent(resp.Content), s.IsProjectMode(), s.usesShared(it.Path))
|
||||
writeJSON(w, resp)
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@ import (
|
||||
syncpkg "skillshare/internal/sync"
|
||||
)
|
||||
|
||||
// Shared instruction files are single-file extras attached to the global
|
||||
// instruction files of targets. In project mode they are the project's
|
||||
// single-file extras, with every target listed as a location; the project's
|
||||
// Shared instruction files are single-file extras whose file is AGENTS.md (see
|
||||
// instructions.IsShared), attached to the global instruction files of targets.
|
||||
// Other single-file extras belong to the Extras page. In project mode they are
|
||||
// the project's AGENTS.md extras, with every target listed as a location; the project's
|
||||
// own ./AGENTS.md is handled in handler_instructions_project.go.
|
||||
|
||||
func (s *Server) requireGlobalInstructions(next http.HandlerFunc) http.HandlerFunc {
|
||||
@@ -99,7 +100,7 @@ func (s *Server) instructionTargets() []sharedInstructionsTarget {
|
||||
}
|
||||
_, err := os.Stat(it.Path)
|
||||
t.Exists = err == nil
|
||||
t.Assigned = instructions.Assignments(s.cfg.Extras, it.Path, res)
|
||||
t.Assigned = instructions.Assignments(instructions.Shared(s.cfg.Extras), it.Path, res)
|
||||
t.LinkedShared = s.sharedLinkName(it.Path)
|
||||
out = append(out, t)
|
||||
}
|
||||
@@ -107,7 +108,7 @@ func (s *Server) instructionTargets() []sharedInstructionsTarget {
|
||||
t := sharedInstructionsTarget{Name: r.Name, Path: r.Path, Import: r.Import, MaxChars: r.MaxChars, RiderOf: r.Via}
|
||||
_, err := os.Stat(r.Path)
|
||||
t.Exists = err == nil
|
||||
t.Assigned = instructions.Assignments(s.cfg.Extras, r.Path, res)
|
||||
t.Assigned = instructions.Assignments(instructions.Shared(s.cfg.Extras), r.Path, res)
|
||||
t.LinkedShared = s.sharedLinkName(r.Path)
|
||||
out = append(out, t)
|
||||
}
|
||||
@@ -123,7 +124,7 @@ func (s *Server) handleListSharedInstructions(w http.ResponseWriter, r *http.Req
|
||||
tools := s.instructionTargets()
|
||||
files := []sharedInstructionsFile{}
|
||||
for _, extra := range s.extrasConfig() {
|
||||
if extra.File == "" {
|
||||
if !instructions.IsShared(extra) {
|
||||
continue
|
||||
}
|
||||
f := sharedInstructionsFile{Name: extra.Name, File: extra.File, Path: filepath.Join(s.extrasSourceDir(extra), extra.File), Targets: len(extra.Targets), Locations: s.sharedLocations(extra, tools)}
|
||||
@@ -405,7 +406,7 @@ func (s *Server) handleAssignSharedInstructions(w http.ResponseWriter, r *http.R
|
||||
return
|
||||
}
|
||||
for _, shared := range body.Extras {
|
||||
if _, found := s.sharedExtra(shared); !found {
|
||||
if extra, found := s.sharedExtra(shared); !found || !instructions.IsShared(extra) {
|
||||
writeCodedError(w, http.StatusNotFound, "instructions_shared_not_found", fmt.Sprintf("shared instruction file %q not found", shared), map[string]string{"name": shared})
|
||||
return
|
||||
}
|
||||
@@ -484,7 +485,7 @@ func (s *Server) handleRestoreSharedInstructions(w http.ResponseWriter, r *http.
|
||||
return
|
||||
}
|
||||
var keep []string
|
||||
for _, a := range instructions.Assignments(s.cfg.Extras, it.Path, s.instructionsResolver()) {
|
||||
for _, a := range instructions.Assignments(instructions.Shared(s.cfg.Extras), it.Path, s.instructionsResolver()) {
|
||||
if a.Name != name {
|
||||
keep = append(keep, a.Name)
|
||||
}
|
||||
|
||||
@@ -473,3 +473,22 @@ func TestSharedInstructions_ReportsCopyWithoutFileLinks(t *testing.T) {
|
||||
t.Errorf("codex assigned = %+v, want a synced copy", a)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSharedInstructions_OnlyAgentsFileExtras(t *testing.T) {
|
||||
s, _ := newInstructionsServer(t, "claude")
|
||||
if rr := instructionsRequest(t, s, http.MethodPost, "/api/instructions", `{"name":"personal","content":"p\n"}`); rr.Code != http.StatusOK {
|
||||
t.Fatalf("create: %d %s", rr.Code, rr.Body.String())
|
||||
}
|
||||
s.cfg.Extras = append(s.cfg.Extras, config.ExtraConfig{Name: "prompt", File: "system.md", Targets: []config.ExtraTargetConfig{}})
|
||||
|
||||
got := decodeBody[struct {
|
||||
Files []sharedInstructionsFile `json:"files"`
|
||||
}](t, instructionsRequest(t, s, http.MethodGet, "/api/instructions", ""))
|
||||
if len(got.Files) != 1 || got.Files[0].Name != "personal" {
|
||||
t.Errorf("files = %+v, want only personal", got.Files)
|
||||
}
|
||||
rr := instructionsRequest(t, s, http.MethodPost, "/api/instructions/assign", `{"targets":["claude"],"extras":["prompt"]}`)
|
||||
if rr.Code != http.StatusNotFound {
|
||||
t.Errorf("assign prompt: %d %s, want 404", rr.Code, rr.Body.String())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,3 +269,80 @@ func TestExtrasFile_InitRejectsImport(t *testing.T) {
|
||||
result.AssertFailure(t)
|
||||
result.AssertAnyOutputContains(t, "import mode requires a single-file extra")
|
||||
}
|
||||
|
||||
func TestExtrasFile_InitFileAsThenSync(t *testing.T) {
|
||||
sb := testutil.NewSandbox(t)
|
||||
defer sb.Cleanup()
|
||||
sb.CreateSkill("placeholder", map[string]string{"SKILL.md": "# P"})
|
||||
sb.WriteConfig("source: " + sb.SourcePath + "\ntargets:\n claude:\n path: " + sb.CreateTarget("claude") + "\n")
|
||||
prompts := filepath.Join(sb.Home, "dotfiles", "prompts")
|
||||
piDir := filepath.Join(sb.Home, ".pi", "agent")
|
||||
|
||||
result := sb.RunCLI("extras", "init", "pi-prompt", "--source", prompts, "--file", "system.md", "--target", piDir, "--as", "APPEND_SYSTEM.md")
|
||||
result.AssertSuccess(t)
|
||||
result.AssertOutputContains(t, "Created extra pi-prompt (single file)")
|
||||
result.AssertOutputContains(t, "Source: ~/dotfiles/prompts/system.md (not found)")
|
||||
result.AssertOutputContains(t, "Target: ~/.pi/agent/APPEND_SYSTEM.md [merge]")
|
||||
result.AssertOutputContains(t, "Create the source file, then run 'skillshare sync extras'.")
|
||||
if sb.FileExists(filepath.Join(prompts, "system.md")) {
|
||||
t.Error("init created the source file")
|
||||
}
|
||||
|
||||
sb.WriteFile(filepath.Join(prompts, "system.md"), "# system")
|
||||
sb.RunCLI("sync", "extras").AssertSuccess(t)
|
||||
if got := sb.SymlinkTarget(filepath.Join(piDir, "APPEND_SYSTEM.md")); got != filepath.Join(prompts, "system.md") {
|
||||
t.Errorf("APPEND_SYSTEM.md link = %q, want the source file", got)
|
||||
}
|
||||
|
||||
list := sb.RunCLI("extras", "list", "--no-tui")
|
||||
list.AssertSuccess(t)
|
||||
list.AssertOutputContains(t, "~/dotfiles/prompts/system.md")
|
||||
list.AssertOutputContains(t, "~/.pi/agent/APPEND_SYSTEM.md")
|
||||
}
|
||||
|
||||
func TestExtrasFile_InitSharedSourceDirSyncsOwnFileOnly(t *testing.T) {
|
||||
sb := testutil.NewSandbox(t)
|
||||
defer sb.Cleanup()
|
||||
sb.CreateSkill("placeholder", map[string]string{"SKILL.md": "# P"})
|
||||
sb.WriteConfig("source: " + sb.SourcePath + "\ntargets:\n claude:\n path: " + sb.CreateTarget("claude") + "\n")
|
||||
prompts := filepath.Join(sb.Home, "dotfiles", "prompts")
|
||||
sb.WriteFile(filepath.Join(prompts, "a.md"), "a")
|
||||
sb.WriteFile(filepath.Join(prompts, "b.md"), "b")
|
||||
aDir, bDir := filepath.Join(sb.Home, "out-a"), filepath.Join(sb.Home, "out-b")
|
||||
|
||||
sb.RunCLI("extras", "init", "a", "--source", prompts, "--file", "a.md", "--target", aDir).AssertSuccess(t)
|
||||
result := sb.RunCLI("extras", "init", "b", "--source", prompts, "--file", "b.md", "--target", bDir, "--mode", "copy")
|
||||
result.AssertSuccess(t)
|
||||
result.AssertOutputContains(t, "Run 'skillshare sync extras' to sync.")
|
||||
sb.RunCLI("sync", "extras").AssertSuccess(t)
|
||||
|
||||
if got := sb.ListDir(aDir); len(got) != 1 || got[0] != "a.md" {
|
||||
t.Errorf("out-a = %v, want [a.md]", got)
|
||||
}
|
||||
if got := sb.ListDir(bDir); len(got) != 1 || got[0] != "b.md" || sb.IsSymlink(filepath.Join(bDir, "b.md")) {
|
||||
t.Errorf("out-b = %v, want a copied b.md only", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtrasFile_InitRejectsFlattenAndDirectorySource(t *testing.T) {
|
||||
sb := testutil.NewSandbox(t)
|
||||
defer sb.Cleanup()
|
||||
sb.CreateSkill("placeholder", map[string]string{"SKILL.md": "# P"})
|
||||
cfg := "source: " + sb.SourcePath + "\ntargets:\n claude:\n path: " + sb.CreateTarget("claude") + "\n"
|
||||
sb.WriteConfig(cfg)
|
||||
prompts := filepath.Join(sb.Home, "prompts")
|
||||
if err := os.MkdirAll(filepath.Join(prompts, "system.md"), 0755); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
target := filepath.Join(sb.Home, "out")
|
||||
|
||||
result := sb.RunCLI("extras", "init", "p", "--file", "system.md", "--target", target, "--flatten")
|
||||
result.AssertFailure(t)
|
||||
result.AssertAnyOutputContains(t, "flatten cannot be used with a single-file extra")
|
||||
result = sb.RunCLI("extras", "init", "p", "--source", prompts, "--file", "system.md", "--target", target)
|
||||
result.AssertFailure(t)
|
||||
result.AssertAnyOutputContains(t, "is a directory")
|
||||
if got := sb.ReadFile(sb.ConfigPath); strings.Contains(got, "name: p") {
|
||||
t.Errorf("config changed after rejected init:\n%s", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ export interface ExtraTarget {
|
||||
|
||||
export interface Extra {
|
||||
name: string;
|
||||
file?: string; // single-file extra (a shared instruction file): the file in source_dir
|
||||
file?: string; // single-file extra: the file in source_dir (AGENTS.md ones are shared instruction files)
|
||||
source_dir: string;
|
||||
source_type: "per-extra" | "extras_source" | "default";
|
||||
file_count: number;
|
||||
@@ -707,7 +707,8 @@ export const api = {
|
||||
createExtra: (data: {
|
||||
name: string;
|
||||
source?: string;
|
||||
targets: Array<{ path: string; mode: string; flatten?: boolean; extension?: string }>;
|
||||
file?: string; // single-file extra: the file in the source folder
|
||||
targets: Array<{ path: string; mode: string; flatten?: boolean; extension?: string; as?: string }>;
|
||||
}) =>
|
||||
apiFetch<{ success: boolean }>('/extras', {
|
||||
method: 'POST',
|
||||
@@ -745,7 +746,7 @@ export const api = {
|
||||
...(extension !== undefined && { extension }),
|
||||
}),
|
||||
}),
|
||||
addExtraTarget: (name: string, target: { path: string; mode?: string; flatten?: boolean }) =>
|
||||
addExtraTarget: (name: string, target: { path: string; mode?: string; flatten?: boolean; as?: string }) =>
|
||||
apiFetch<{ success: boolean }>(`/extras/${encodeURIComponent(name)}/targets`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(target),
|
||||
|
||||
@@ -76,7 +76,7 @@ describe('Convert dialog', () => {
|
||||
expect(screen.queryByText('Enter a name for the shared AGENTS.md to see the preview.')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('says when a name belongs to a folder extra', async () => {
|
||||
it('says when a name belongs to an extra on the first tab', async () => {
|
||||
withExtras([{ name: 'personal', file: 'AGENTS.md' }, { name: 'claude-rules' }]);
|
||||
renderDialog();
|
||||
const user = userEvent.setup();
|
||||
@@ -85,6 +85,6 @@ describe('Convert dialog', () => {
|
||||
await user.clear(input);
|
||||
await user.type(input, 'claude-rules');
|
||||
|
||||
expect(screen.getAllByText('claude-rules is already used by a folder extra. Pick another name.')).toHaveLength(2);
|
||||
expect(screen.getAllByText('claude-rules is already used by an extra on the Folders & files tab. Pick another name.')).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useToast } from '../Toast';
|
||||
import { useT } from '../../i18n';
|
||||
import { fileName, shortenHome } from '../../lib/paths';
|
||||
import { queryKeys } from '../../lib/queryKeys';
|
||||
import { instructionsErrorMessage, defaultShareName, importLines, isFolderExtra, lineDiff, refreshInstructions, sharedNameProblem, takenName } from './instructionsView';
|
||||
import { instructionsErrorMessage, defaultShareName, importLines, isOtherExtra, lineDiff, refreshInstructions, sharedNameProblem, takenName } from './instructionsView';
|
||||
|
||||
const METHODS: ConvertMethod[] = ['import', 'rename', 'copy'];
|
||||
// The share picker's choice for a new shared file; real names are extras names.
|
||||
@@ -46,7 +46,7 @@ export default function ConvertDialog({ data, onClose }: { data: TargetInstructi
|
||||
const nameProblem = choice === NEW ? sharedNameProblem(shareName, names) : null;
|
||||
const taken = takenName(shareName, names) ?? shareName.trim();
|
||||
const nameError = nameProblem === 'invalid' ? t('instructions.shared.nameInvalid')
|
||||
: nameProblem === 'taken' ? t(isFolderExtra(taken, extras.data?.extras ?? []) ? 'instructions.shared.nameTakenFolder' : 'instructions.convert.nameTaken', { name: taken })
|
||||
: nameProblem === 'taken' ? t(isOtherExtra(taken, extras.data?.extras ?? []) ? 'instructions.shared.nameTakenFolder' : 'instructions.convert.nameTaken', { name: taken })
|
||||
: '';
|
||||
const shareAs = shareReady && choice === NEW && !nameProblem ? shareName.trim() : undefined;
|
||||
const body = { method, keep_tool_lines: keep, ...(shareAs && { share_as: shareAs }), ...(shareInto && { share_into: shareInto }) };
|
||||
|
||||
@@ -13,7 +13,7 @@ import { useT } from '../../i18n';
|
||||
import { shortenHome } from '../../lib/paths';
|
||||
import { queryKeys } from '../../lib/queryKeys';
|
||||
import { BoxHeader, InstructionsPreview } from './ViewTabs';
|
||||
import { instructionsErrorMessage, isFolderExtra, isImportLine, sharedNameProblem, takenName } from './instructionsView';
|
||||
import { instructionsErrorMessage, isOtherExtra, isImportLine, sharedNameProblem, takenName } from './instructionsView';
|
||||
|
||||
/** Creates a shared instruction file, from content or by moving a target's current file into it. */
|
||||
export default function NewSharedDialog({ targets, project = false, onClose, onCreated }: {
|
||||
@@ -68,7 +68,7 @@ export default function NewSharedDialog({ targets, project = false, onClose, onC
|
||||
<span className={`ss-inp ${problem ? 'err' : ''}`}>
|
||||
<input id="shared-name" autoFocus value={name} onChange={(e) => setName(e.target.value)} placeholder="personal" disabled={saving} />
|
||||
</span>
|
||||
<span className={`hp ${problem ? 'text-bad' : ''}`}>{problem === 'invalid' ? t('instructions.shared.nameInvalid') : problem === 'taken' ? t(isFolderExtra(taken, extras.data?.extras ?? []) ? 'instructions.shared.nameTakenFolder' : 'instructions.convert.nameTaken', { name: taken }) : t('instructions.shared.nameHint')}</span>
|
||||
<span className={`hp ${problem ? 'text-bad' : ''}`}>{problem === 'invalid' ? t('instructions.shared.nameInvalid') : problem === 'taken' ? t(isOtherExtra(taken, extras.data?.extras ?? []) ? 'instructions.shared.nameTakenFolder' : 'instructions.convert.nameTaken', { name: taken }) : t('instructions.shared.nameHint')}</span>
|
||||
</div>
|
||||
{!project && <div className="ss-fld">
|
||||
<span className="text-[13px] font-semibold">{t('instructions.shared.startFrom')}</span>
|
||||
|
||||
@@ -22,9 +22,12 @@ export function takenName(name: string, taken: string[]): string | undefined {
|
||||
return taken.find((x) => x.toLowerCase() === n);
|
||||
}
|
||||
|
||||
/** Whether name is a folder extra (not a shared instruction file), so a name clash should say so. */
|
||||
export const isFolderExtra = (name: string, extras: { name: string; file?: string }[]) =>
|
||||
extras.some((e) => e.name === name && !e.file);
|
||||
/** Whether an extra is a shared AGENTS.md, shown on the AGENTS.md tab. Every other extra (folders and other single files) is on the first tab. */
|
||||
export const isAgentsExtra = (extra: { file?: string }) => extra.file === 'AGENTS.md';
|
||||
|
||||
/** Whether name is an extra on the first tab (not a shared AGENTS.md), so a name clash should say so. */
|
||||
export const isOtherExtra = (name: string, extras: { name: string; file?: string }[]) =>
|
||||
extras.some((e) => e.name === name && !isAgentsExtra(e));
|
||||
|
||||
/** A free name for a new shared file made from a target: the target's name, else <name>-2, <name>-3, … */
|
||||
export function defaultShareName(target: string, taken: string[]): string {
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "Ziel hinzufügen",
|
||||
"extras.cancel": "Abbrechen",
|
||||
"extras.create": "Erstellen",
|
||||
"extras.empty.description": "Extras ermöglichen es dir, beliebige Verzeichnisse zusammen mit deinen Skills mit deinen KI-Tool-Zielen zu synchronisieren.",
|
||||
"extras.empty.foldersTitle": "Noch keine Ordner-Extras",
|
||||
"extras.empty.sharedElsewhere": "Deine {count} gemeinsamen AGENTS.md findest du im Tab AGENTS.md. Ordner-Extras synchronisieren ein ganzes Verzeichnis, etwa rules oder commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Deine {count} gemeinsamen Dateien findest du im Tab AGENTS.md. Ordner-Extras synchronisieren ein ganzes Verzeichnis, etwa rules oder commands.",
|
||||
"extras.empty.description": "Extras ermöglichen es dir, beliebige Ordner oder Dateien zusammen mit deinen Skills mit deinen KI-Tool-Zielen zu synchronisieren.",
|
||||
"extras.empty.foldersTitle": "Noch keine Ordner- oder Datei-Extras",
|
||||
"extras.empty.sharedElsewhere": "Deine {count} gemeinsamen AGENTS.md findest du im Tab AGENTS.md. Andere Extras synchronisieren einen Ordner oder eine einzelne Datei, etwa rules oder commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Deine {count} gemeinsamen Dateien findest du im Tab AGENTS.md. Andere Extras synchronisieren einen Ordner oder eine einzelne Datei, etwa rules oder commands.",
|
||||
"extras.empty.title": "Keine Extras konfiguriert",
|
||||
"extras.flatten": "Glätten",
|
||||
"extras.flattenOn": "An",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Modus",
|
||||
"extras.modal.targets": "Ziele",
|
||||
"extras.modal.subtitle": "Ein Ordner, der wie Skills mit deinen Tools synchronisiert wird.",
|
||||
"extras.modal.subtitle": "Ein Ordner oder eine einzelne Datei, die wie Skills mit deinen Tools synchronisiert wird.",
|
||||
"extras.modal.nameHint": "Wird in der Liste angezeigt und als Ordnername verwendet.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Eigener Quellordner",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "Ziel entfernen",
|
||||
"extras.removeTargetConfirm.title": "Ziel entfernen",
|
||||
"extras.removeTargetConfirm.message": "Ziel \"{path}\" entfernen? Bereits zum Ziel synchronisierte Dateien werden nicht gelöscht.",
|
||||
"extras.subtitle.global": "Weitere Ordner neben Skills, die synchron bleiben sollen: rules, commands, prompts. Jeder hat eigene Source und Targets.",
|
||||
"extras.subtitle.project": "Weitere Projektordner neben Skills, die synchron bleiben sollen: rules, commands, prompts. Jeder hat eigene Source und Targets.",
|
||||
"extras.subtitle.global": "Weitere Ordner und Dateien neben Skills, die synchron bleiben sollen: rules, commands, prompts. Jeder Eintrag hat eigene Source und Targets.",
|
||||
"extras.subtitle.project": "Weitere Projektordner und -dateien neben Skills, die synchron bleiben sollen: rules, commands, prompts. Jeder Eintrag hat eigene Source und Targets.",
|
||||
"extras.sync": "Synchronisieren",
|
||||
"extras.status.synced": "Synchronisiert",
|
||||
"extras.status.drift": "Abweichung",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten legt Dateien aus Unterordnern direkt in den Target-Ordner.",
|
||||
"extras.files.one": "{count} Datei",
|
||||
"extras.files.other": "{count} Dateien",
|
||||
"extras.modal.sync": "Synchronisieren",
|
||||
"extras.modal.syncFolder": "Ordner",
|
||||
"extras.modal.syncFile": "Einzelne Datei",
|
||||
"extras.modal.fileName": "Dateiname",
|
||||
"extras.modal.fileNameInvalid": "Gib einen Dateinamen ein, keinen Pfad.",
|
||||
"extras.modal.fileSyncs": "Synchronisiert {path}. Andere Dateien in diesem Ordner bleiben unberührt.",
|
||||
"extras.modal.agentsNote": "Ein Extra mit der Datei AGENTS.md erscheint im Tab AGENTS.md.",
|
||||
"extras.hint.fileAs": "Lass den Dateinamen leer, um {file} zu behalten.",
|
||||
"extras.hint.fileModes": "merge verlinkt die Datei · copy schreibt eine Kopie · import fügt eine @-Zeile hinzu, nur für Tools, die @-Importe lesen.",
|
||||
"extras.hint.fileBackup": "Eine Datei, die schon am Ziel liegt, wird gesichert, bevor sie ersetzt wird.",
|
||||
"extras.singleFile": "einzelne Datei",
|
||||
"extras.sourceFileMissing": "Quelldatei fehlt",
|
||||
"extras.fileModeDescription.merge": "Datei verlinken",
|
||||
"extras.fileModeDescription.copy": "Kopie der Datei schreiben",
|
||||
"extras.fileModeDescription.import": "@-Zeile hinzufügen, für Tools, die @-Importe lesen",
|
||||
"extras.moreActions": "Weitere Aktionen für {name}",
|
||||
"extras.targetActions": "Weitere Aktionen für {path}",
|
||||
"extras.footnote": "Extras werden beim Sync zusammen mit allem anderen geschrieben. Eine Extension wandelt Dateien für Tools um, die kein Markdown lesen, z. B. schreibt gemini-commands TOML.",
|
||||
"extras.footnoteLink": "Extensions verwaltest du in den Settings.",
|
||||
"extras.tabs": "Extras-Bereiche",
|
||||
"extras.tab.folders": "Ordner",
|
||||
"extras.tab.folders": "Ordner & Dateien",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Geändert",
|
||||
"instructions.saved": "{path} gespeichert.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "Kein anderes Tool liest eine AGENTS.md in diesem Ordner, ohne Teilen verwendet sie also nur {name}.",
|
||||
"instructions.convert.nameFirst": "Gib einen Namen für die gemeinsame AGENTS.md ein, um die Vorschau zu sehen.",
|
||||
"instructions.convert.nameTaken": "Eine gemeinsame AGENTS.md namens {name} gibt es schon. Wähle einen anderen Namen.",
|
||||
"instructions.shared.nameTakenFolder": "{name} wird schon von einem Ordner-Extra verwendet. Wähle einen anderen Namen.",
|
||||
"instructions.shared.nameTakenFolder": "{name} wird schon von einem Extra im Tab „Ordner & Dateien“ verwendet. Wähle einen anderen Namen.",
|
||||
"instructions.convert.backup": "{file} wird vor der Änderung gesichert.",
|
||||
"instructions.convert.run": "Konvertieren",
|
||||
"instructions.convert.done": "{file} konvertiert.",
|
||||
|
||||
@@ -401,10 +401,10 @@
|
||||
"extras.addTarget": "Add target",
|
||||
"extras.cancel": "Cancel",
|
||||
"extras.create": "Create",
|
||||
"extras.empty.description": "Extras let you sync any directory to your AI tool targets alongside your skills.",
|
||||
"extras.empty.foldersTitle": "No folder extras yet",
|
||||
"extras.empty.sharedElsewhere": "Your {count} shared AGENTS.md file(s) are on the AGENTS.md tab. Folder extras sync a whole directory, such as rules or commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Your {count} shared file(s) are on the AGENTS.md tab. Folder extras sync a whole directory, such as rules or commands.",
|
||||
"extras.empty.description": "Extras let you sync any folder or file to your AI tool targets alongside your skills.",
|
||||
"extras.empty.foldersTitle": "No folder or file extras yet",
|
||||
"extras.empty.sharedElsewhere": "Your {count} shared AGENTS.md file(s) are on the AGENTS.md tab. Other extras sync a folder or a single file, such as rules or commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Your {count} shared file(s) are on the AGENTS.md tab. Other extras sync a folder or a single file, such as rules or commands.",
|
||||
"extras.empty.title": "No extras configured",
|
||||
"extras.flatten": "Flatten",
|
||||
"extras.flattenOn": "On",
|
||||
@@ -416,7 +416,7 @@
|
||||
"extras.modal.colPath": "Folder",
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Mode",
|
||||
"extras.modal.subtitle": "A folder that is synced to your tools the same way skills are.",
|
||||
"extras.modal.subtitle": "A folder or a single file that is synced to your tools the same way skills are.",
|
||||
"extras.modal.nameHint": "Shown in the list and used as the folder name.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Custom folder",
|
||||
@@ -433,8 +433,8 @@
|
||||
"extras.removeTarget": "Remove target",
|
||||
"extras.removeTargetConfirm.title": "Remove target",
|
||||
"extras.removeTargetConfirm.message": "Remove target “{path}”? Files already synced to the target will not be deleted.",
|
||||
"extras.subtitle.global": "Other folders you want in sync besides skills: rules, commands, prompts. Each one has its own source and targets.",
|
||||
"extras.subtitle.project": "Other project folders you want in sync besides skills: rules, commands, prompts. Each one has its own source and targets.",
|
||||
"extras.subtitle.global": "Other folders and files you want in sync besides skills: rules, commands, prompts. Each one has its own source and targets.",
|
||||
"extras.subtitle.project": "Other project folders and files you want in sync besides skills: rules, commands, prompts. Each one has its own source and targets.",
|
||||
"extras.forceSync": "Force sync",
|
||||
"extras.sync": "Sync",
|
||||
"extras.status.synced": "In sync",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten puts files from subfolders straight into the target folder.",
|
||||
"extras.files.one": "{count} file",
|
||||
"extras.files.other": "{count} files",
|
||||
"extras.modal.sync": "Sync",
|
||||
"extras.modal.syncFolder": "Folder",
|
||||
"extras.modal.syncFile": "Single file",
|
||||
"extras.modal.fileName": "File name",
|
||||
"extras.modal.fileNameInvalid": "Enter a file name, not a path.",
|
||||
"extras.modal.fileSyncs": "Syncs {path}. Other files in that folder are left alone.",
|
||||
"extras.modal.agentsNote": "An extra whose file is AGENTS.md appears on the AGENTS.md tab.",
|
||||
"extras.hint.fileAs": "Leave File name empty to keep {file}.",
|
||||
"extras.hint.fileModes": "merge links the file · copy writes a copy · import adds an @ line, only for tools that read @ imports.",
|
||||
"extras.hint.fileBackup": "A file already at the target is backed up before it is replaced.",
|
||||
"extras.singleFile": "single file",
|
||||
"extras.sourceFileMissing": "Source file missing",
|
||||
"extras.fileModeDescription.merge": "Link the file",
|
||||
"extras.fileModeDescription.copy": "Write a copy of the file",
|
||||
"extras.fileModeDescription.import": "Add an @ line, for tools that read @ imports",
|
||||
"extras.moreActions": "More actions for {name}",
|
||||
"extras.targetActions": "More actions for {path}",
|
||||
"extras.footnote": "Extras are written together with everything else when you run Sync. An extension converts each file for a tool that does not read Markdown, for example gemini-commands writes TOML.",
|
||||
"extras.footnoteLink": "Manage extensions in Settings.",
|
||||
"extras.tabs": "Extras sections",
|
||||
"extras.tab.folders": "Folders",
|
||||
"extras.tab.folders": "Folders & files",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Modified",
|
||||
"instructions.saved": "Saved {path}.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "No other tool reads an AGENTS.md in this folder, so without sharing only {name} uses it.",
|
||||
"instructions.convert.nameFirst": "Enter a name for the shared AGENTS.md to see the preview.",
|
||||
"instructions.convert.nameTaken": "A shared AGENTS.md named {name} already exists. Pick another name.",
|
||||
"instructions.shared.nameTakenFolder": "{name} is already used by a folder extra. Pick another name.",
|
||||
"instructions.shared.nameTakenFolder": "{name} is already used by an extra on the Folders & files tab. Pick another name.",
|
||||
"instructions.convert.backup": "{file} is backed up before it's changed.",
|
||||
"instructions.convert.run": "Convert",
|
||||
"instructions.convert.done": "Converted {file}.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "Añadir destino",
|
||||
"extras.cancel": "Cancelar",
|
||||
"extras.create": "Crear",
|
||||
"extras.empty.description": "Los extras te permiten sincronizar cualquier directorio con tus destinos de herramientas de IA junto con tus skills.",
|
||||
"extras.empty.foldersTitle": "Aún no hay extras de carpeta",
|
||||
"extras.empty.sharedElsewhere": "Tus {count} AGENTS.md compartidos están en la pestaña AGENTS.md. Los extras de carpeta sincronizan un directorio entero, como rules o commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Tus {count} archivos compartidos están en la pestaña AGENTS.md. Los extras de carpeta sincronizan un directorio completo, como rules o commands.",
|
||||
"extras.empty.description": "Los extras te permiten sincronizar cualquier carpeta o archivo con los destinos de tus herramientas de IA junto con tus skills.",
|
||||
"extras.empty.foldersTitle": "Aún no hay extras de carpetas o archivos",
|
||||
"extras.empty.sharedElsewhere": "Tus {count} AGENTS.md compartidos están en la pestaña AGENTS.md. Los demás extras sincronizan una carpeta o un solo archivo, como rules o commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Tus {count} archivos compartidos están en la pestaña AGENTS.md. Los demás extras sincronizan una carpeta o un solo archivo, como rules o commands.",
|
||||
"extras.empty.title": "No hay extras configurados",
|
||||
"extras.flatten": "Aplanar",
|
||||
"extras.flattenOn": "Activado",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Modo",
|
||||
"extras.modal.targets": "Destinos",
|
||||
"extras.modal.subtitle": "Una carpeta que se sincroniza con tus herramientas igual que los skills.",
|
||||
"extras.modal.subtitle": "Una carpeta o un solo archivo que se sincroniza con tus herramientas igual que los skills.",
|
||||
"extras.modal.nameHint": "Se muestra en la lista y se usa como nombre de la carpeta.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Carpeta de origen personalizada",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "Eliminar destino",
|
||||
"extras.removeTargetConfirm.title": "Eliminar destino",
|
||||
"extras.removeTargetConfirm.message": "¿Eliminar el destino \"{path}\"? Los archivos ya sincronizados con el destino no se eliminarán.",
|
||||
"extras.subtitle.global": "Otras carpetas que quieres sincronizar además de los skills: rules, commands, prompts. Cada una tiene su propio source y targets.",
|
||||
"extras.subtitle.project": "Otras carpetas del proyecto que quieres sincronizar además de los skills: rules, commands, prompts. Cada una tiene su propio source y targets.",
|
||||
"extras.subtitle.global": "Otras carpetas y archivos que quieres sincronizar además de los skills: rules, commands, prompts. Cada uno tiene su propio source y targets.",
|
||||
"extras.subtitle.project": "Otras carpetas y archivos del proyecto que quieres sincronizar además de los skills: rules, commands, prompts. Cada uno tiene su propio source y targets.",
|
||||
"extras.sync": "Sincronizar",
|
||||
"extras.status.synced": "Sincronizado",
|
||||
"extras.status.drift": "Con diferencias",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten coloca los archivos de las subcarpetas directamente en la carpeta target.",
|
||||
"extras.files.one": "{count} archivo",
|
||||
"extras.files.other": "{count} archivos",
|
||||
"extras.modal.sync": "Sincronizar",
|
||||
"extras.modal.syncFolder": "Carpeta",
|
||||
"extras.modal.syncFile": "Un solo archivo",
|
||||
"extras.modal.fileName": "Nombre de archivo",
|
||||
"extras.modal.fileNameInvalid": "Escribe un nombre de archivo, no una ruta.",
|
||||
"extras.modal.fileSyncs": "Sincroniza {path}. Los demás archivos de esa carpeta no se tocan.",
|
||||
"extras.modal.agentsNote": "Un extra cuyo archivo es AGENTS.md aparece en la pestaña AGENTS.md.",
|
||||
"extras.hint.fileAs": "Deja vacío el nombre de archivo para conservar {file}.",
|
||||
"extras.hint.fileModes": "merge enlaza el archivo · copy escribe una copia · import añade una línea @, solo para herramientas que leen importaciones @.",
|
||||
"extras.hint.fileBackup": "Si ya hay un archivo en el destino, se guarda una copia de seguridad antes de reemplazarlo.",
|
||||
"extras.singleFile": "un solo archivo",
|
||||
"extras.sourceFileMissing": "Falta el archivo de origen",
|
||||
"extras.fileModeDescription.merge": "Enlazar el archivo",
|
||||
"extras.fileModeDescription.copy": "Escribir una copia del archivo",
|
||||
"extras.fileModeDescription.import": "Añadir una línea @, para herramientas que leen importaciones @",
|
||||
"extras.moreActions": "Más acciones para {name}",
|
||||
"extras.targetActions": "Más acciones para {path}",
|
||||
"extras.footnote": "Los extras se escriben junto con todo lo demás al ejecutar Sync. Una extension convierte cada archivo para herramientas que no leen Markdown; por ejemplo, gemini-commands escribe TOML.",
|
||||
"extras.footnoteLink": "Gestiona las extensions en Settings.",
|
||||
"extras.tabs": "Secciones de extras",
|
||||
"extras.tab.folders": "Carpetas",
|
||||
"extras.tab.folders": "Carpetas y archivos",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Modificado",
|
||||
"instructions.saved": "Se guardó {path}.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "Ninguna otra herramienta lee un AGENTS.md en esta carpeta, así que sin compartirlo solo lo usa {name}.",
|
||||
"instructions.convert.nameFirst": "Escribe un nombre para el AGENTS.md compartido para ver la vista previa.",
|
||||
"instructions.convert.nameTaken": "Ya existe un AGENTS.md compartido llamado {name}. Elige otro nombre.",
|
||||
"instructions.shared.nameTakenFolder": "{name} ya lo usa un extra de carpeta. Elige otro nombre.",
|
||||
"instructions.shared.nameTakenFolder": "{name} ya lo usa un extra de la pestaña Carpetas y archivos. Elige otro nombre.",
|
||||
"instructions.convert.backup": "Se hace una copia de seguridad de {file} antes de cambiarlo.",
|
||||
"instructions.convert.run": "Convertir",
|
||||
"instructions.convert.done": "Se convirtió {file}.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "افزودن هدف",
|
||||
"extras.cancel": "لغو",
|
||||
"extras.create": "ایجاد",
|
||||
"extras.empty.description": "موارد اضافی به شما اجازه میدهند هر پوشهای را در کنار اسکیلهای خود با هدفهای AI همگام کنید.",
|
||||
"extras.empty.foldersTitle": "هنوز extra پوشهای وجود ندارد",
|
||||
"extras.empty.sharedElsewhere": "{count} فایل AGENTS.md مشترک شما در زبانه AGENTS.md است. extraهای پوشه یک پوشه کامل مثل rules یا commands را همگام میکنند.",
|
||||
"extras.empty.sharedElsewhereProject": "{count} فایل مشترک شما در زبانه AGENTS.md است. extraهای پوشهای یک پوشه کامل مثل rules یا commands را همگام میکنند.",
|
||||
"extras.empty.description": "با extraها میتوانید هر پوشه یا فایلی را همراه skillها با targetهای ابزارهای هوش مصنوعی همگام کنید.",
|
||||
"extras.empty.foldersTitle": "هنوز extra پوشه یا فایل ندارید",
|
||||
"extras.empty.sharedElsewhere": "{count} فایل AGENTS.md مشترک شما در زبانه AGENTS.md است. extraهای دیگر یک پوشه یا یک فایل مثل rules یا commands را همگام میکنند.",
|
||||
"extras.empty.sharedElsewhereProject": "{count} فایل مشترک شما در زبانه AGENTS.md است. extraهای دیگر یک پوشه یا یک فایل مثل rules یا commands را همگام میکنند.",
|
||||
"extras.empty.title": "هیچ مورد اضافی پیکربندی نشده",
|
||||
"extras.flatten": "یکسانسازی",
|
||||
"extras.flattenOn": "روشن",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "حالت",
|
||||
"extras.modal.targets": "هدفها",
|
||||
"extras.modal.subtitle": "پوشهای که مثل skillها با ابزارهای شما همگام میشود.",
|
||||
"extras.modal.subtitle": "یک پوشه یا یک فایل که مثل skillها با ابزارهای شما همگام میشود.",
|
||||
"extras.modal.nameHint": "در فهرست نمایش داده میشود و نام پوشه هم میشود.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "پوشهٔ منبع سفارشی",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "حذف هدف",
|
||||
"extras.removeTargetConfirm.title": "حذف هدف",
|
||||
"extras.removeTargetConfirm.message": "هدف \"{path}\" حذف شود؟ فایلهایی که قبلاً با هدف همگامسازی شدهاند حذف نخواهند شد.",
|
||||
"extras.subtitle.global": "پوشههای دیگری که علاوه بر skillها میخواهید همگام بمانند: rules، commands، prompts. هر کدام source و targets خودش را دارد.",
|
||||
"extras.subtitle.project": "پوشههای دیگر پروژه که علاوه بر skillها میخواهید همگام بمانند: rules، commands، prompts. هر کدام source و targets خودش را دارد.",
|
||||
"extras.subtitle.global": "پوشهها و فایلهای دیگری که علاوه بر skillها میخواهید همگام بمانند: rules، commands، prompts. هر کدام source و targets خودش را دارد.",
|
||||
"extras.subtitle.project": "پوشهها و فایلهای دیگر پروژه که علاوه بر skillها میخواهید همگام بمانند: rules، commands، prompts. هر کدام source و targets خودش را دارد.",
|
||||
"extras.sync": "همگامسازی",
|
||||
"extras.status.synced": "همگام است",
|
||||
"extras.status.drift": "دارای تفاوت",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten فایلهای زیرپوشهها را مستقیم در پوشه target میگذارد.",
|
||||
"extras.files.one": "{count} فایل",
|
||||
"extras.files.other": "{count} فایل",
|
||||
"extras.modal.sync": "همگامسازی",
|
||||
"extras.modal.syncFolder": "پوشه",
|
||||
"extras.modal.syncFile": "یک فایل",
|
||||
"extras.modal.fileName": "نام فایل",
|
||||
"extras.modal.fileNameInvalid": "نام فایل را وارد کنید، نه مسیر.",
|
||||
"extras.modal.fileSyncs": "{path} را همگام میکند. فایلهای دیگر آن پوشه دست نمیخورند.",
|
||||
"extras.modal.agentsNote": "extraای که فایلش AGENTS.md است در زبانه AGENTS.md نمایش داده میشود.",
|
||||
"extras.hint.fileAs": "برای نگه داشتن {file}، نام فایل را خالی بگذارید.",
|
||||
"extras.hint.fileModes": "merge فایل را پیوند میدهد · copy یک نسخه مینویسد · import یک خط @ اضافه میکند، فقط برای ابزارهایی که importهای @ را میخوانند.",
|
||||
"extras.hint.fileBackup": "فایلی که از قبل در مقصد هست، پیش از جایگزینی پشتیبانگیری میشود.",
|
||||
"extras.singleFile": "یک فایل",
|
||||
"extras.sourceFileMissing": "فایل منبع وجود ندارد",
|
||||
"extras.fileModeDescription.merge": "پیوند دادن فایل",
|
||||
"extras.fileModeDescription.copy": "نوشتن یک نسخه از فایل",
|
||||
"extras.fileModeDescription.import": "افزودن خط @، برای ابزارهایی که importهای @ را میخوانند",
|
||||
"extras.moreActions": "کارهای بیشتر برای {name}",
|
||||
"extras.targetActions": "کارهای بیشتر برای {path}",
|
||||
"extras.footnote": "با اجرای Sync، extras همراه بقیه نوشته میشوند. extension هر فایل را برای ابزاری که Markdown نمیخواند تبدیل میکند؛ مثلاً gemini-commands فایل TOML مینویسد.",
|
||||
"extras.footnoteLink": "extensionها را در Settings مدیریت کنید.",
|
||||
"extras.tabs": "بخشهای extras",
|
||||
"extras.tab.folders": "پوشهها",
|
||||
"extras.tab.folders": "پوشهها و فایلها",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "تغییریافته",
|
||||
"instructions.saved": "{path} ذخیره شد.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "هیچ ابزار دیگری AGENTS.md این پوشه را نمیخواند، پس بدون اشتراک فقط {name} از آن استفاده میکند.",
|
||||
"instructions.convert.nameFirst": "برای دیدن پیشنمایش، نامی برای AGENTS.md مشترک وارد کنید.",
|
||||
"instructions.convert.nameTaken": "یک AGENTS.md مشترک به نام {name} از قبل وجود دارد. نام دیگری انتخاب کنید.",
|
||||
"instructions.shared.nameTakenFolder": "{name} از قبل برای یک extra پوشهای استفاده شده است. نام دیگری انتخاب کنید.",
|
||||
"instructions.shared.nameTakenFolder": "{name} قبلاً توسط یک extra در زبانه «پوشهها و فایلها» استفاده شده است. نام دیگری انتخاب کنید.",
|
||||
"instructions.convert.backup": "پیش از تغییر، از {file} پشتیبان گرفته میشود.",
|
||||
"instructions.convert.run": "تبدیل",
|
||||
"instructions.convert.done": "{file} تبدیل شد.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "Ajouter une cible",
|
||||
"extras.cancel": "Annuler",
|
||||
"extras.create": "Créer",
|
||||
"extras.empty.description": "Les extras vous permettent de synchroniser n'importe quel répertoire vers vos cibles d'outils IA en plus de vos skills.",
|
||||
"extras.empty.foldersTitle": "Aucun extra de dossier pour l'instant",
|
||||
"extras.empty.sharedElsewhere": "Vos {count} AGENTS.md partagés sont dans l'onglet AGENTS.md. Les extras de dossier synchronisent un répertoire entier, comme rules ou commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Vos {count} fichiers partagés sont dans l'onglet AGENTS.md. Les extras de dossier synchronisent un répertoire entier, comme rules ou commands.",
|
||||
"extras.empty.description": "Les extras vous permettent de synchroniser n’importe quel dossier ou fichier vers les cibles de vos outils IA, en plus de vos skills.",
|
||||
"extras.empty.foldersTitle": "Aucun extra de dossier ou de fichier",
|
||||
"extras.empty.sharedElsewhere": "Vos {count} AGENTS.md partagés sont dans l'onglet AGENTS.md. Les autres extras synchronisent un dossier ou un seul fichier, comme rules ou commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Vos {count} fichiers partagés sont dans l'onglet AGENTS.md. Les autres extras synchronisent un dossier ou un seul fichier, comme rules ou commands.",
|
||||
"extras.empty.title": "Aucun extra configuré",
|
||||
"extras.flatten": "Aplatir",
|
||||
"extras.flattenOn": "Activé",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Mode",
|
||||
"extras.modal.targets": "Cibles",
|
||||
"extras.modal.subtitle": "Un dossier synchronisé avec vos outils comme les skills.",
|
||||
"extras.modal.subtitle": "Un dossier ou un seul fichier synchronisé avec vos outils de la même façon que les skills.",
|
||||
"extras.modal.nameHint": "Affiché dans la liste et utilisé comme nom de dossier.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Dossier source personnalisé",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "Supprimer la cible",
|
||||
"extras.removeTargetConfirm.title": "Supprimer la cible",
|
||||
"extras.removeTargetConfirm.message": "Supprimer la cible « {path} » ? Les fichiers déjà synchronisés vers la cible ne seront pas supprimés.",
|
||||
"extras.subtitle.global": "D’autres dossiers à synchroniser en plus des skills : rules, commands, prompts. Chacun a sa propre source et ses targets.",
|
||||
"extras.subtitle.project": "D’autres dossiers du projet à synchroniser en plus des skills : rules, commands, prompts. Chacun a sa propre source et ses targets.",
|
||||
"extras.subtitle.global": "D’autres dossiers et fichiers à synchroniser en plus des skills : rules, commands, prompts. Chacun a sa propre source et ses targets.",
|
||||
"extras.subtitle.project": "D’autres dossiers et fichiers du projet à synchroniser en plus des skills : rules, commands, prompts. Chacun a sa propre source et ses targets.",
|
||||
"extras.sync": "Synchroniser",
|
||||
"extras.status.synced": "Synchronisé",
|
||||
"extras.status.drift": "Différences détectées",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten place les fichiers des sous-dossiers directement dans le dossier target.",
|
||||
"extras.files.one": "{count} fichier",
|
||||
"extras.files.other": "{count} fichiers",
|
||||
"extras.modal.sync": "Synchroniser",
|
||||
"extras.modal.syncFolder": "Dossier",
|
||||
"extras.modal.syncFile": "Un seul fichier",
|
||||
"extras.modal.fileName": "Nom du fichier",
|
||||
"extras.modal.fileNameInvalid": "Saisissez un nom de fichier, pas un chemin.",
|
||||
"extras.modal.fileSyncs": "Synchronise {path}. Les autres fichiers de ce dossier ne sont pas modifiés.",
|
||||
"extras.modal.agentsNote": "Un extra dont le fichier est AGENTS.md apparaît dans l'onglet AGENTS.md.",
|
||||
"extras.hint.fileAs": "Laissez le nom du fichier vide pour garder {file}.",
|
||||
"extras.hint.fileModes": "merge crée un lien vers le fichier · copy écrit une copie · import ajoute une ligne @, uniquement pour les outils qui lisent les imports @.",
|
||||
"extras.hint.fileBackup": "Un fichier déjà présent dans la cible est sauvegardé avant d'être remplacé.",
|
||||
"extras.singleFile": "un seul fichier",
|
||||
"extras.sourceFileMissing": "Fichier source manquant",
|
||||
"extras.fileModeDescription.merge": "Lier le fichier",
|
||||
"extras.fileModeDescription.copy": "Écrire une copie du fichier",
|
||||
"extras.fileModeDescription.import": "Ajouter une ligne @, pour les outils qui lisent les imports @",
|
||||
"extras.moreActions": "Autres actions pour {name}",
|
||||
"extras.targetActions": "Autres actions pour {path}",
|
||||
"extras.footnote": "Les extras sont écrits avec tout le reste quand vous lancez Sync. Une extension convertit chaque fichier pour un outil qui ne lit pas le Markdown ; par exemple gemini-commands écrit du TOML.",
|
||||
"extras.footnoteLink": "Gérez les extensions dans Settings.",
|
||||
"extras.tabs": "Sections des extras",
|
||||
"extras.tab.folders": "Dossiers",
|
||||
"extras.tab.folders": "Dossiers et fichiers",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Modifié",
|
||||
"instructions.saved": "{path} enregistré.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "Aucun autre outil ne lit un AGENTS.md dans ce dossier : sans partage, seul {name} l'utilise.",
|
||||
"instructions.convert.nameFirst": "Saisissez un nom pour l'AGENTS.md partagé pour voir l'aperçu.",
|
||||
"instructions.convert.nameTaken": "Un AGENTS.md partagé nommé {name} existe déjà. Choisissez un autre nom.",
|
||||
"instructions.shared.nameTakenFolder": "{name} est déjà utilisé par un extra de dossier. Choisissez un autre nom.",
|
||||
"instructions.shared.nameTakenFolder": "{name} est déjà utilisé par un extra de l'onglet Dossiers et fichiers. Choisissez un autre nom.",
|
||||
"instructions.convert.backup": "{file} est sauvegardé avant d'être modifié.",
|
||||
"instructions.convert.run": "Convertir",
|
||||
"instructions.convert.done": "{file} converti.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "Tambah Target",
|
||||
"extras.cancel": "Batal",
|
||||
"extras.create": "Buat",
|
||||
"extras.empty.description": "Extras memungkinkan Anda menyinkronkan direktori apa pun ke target alat AI bersama skill Anda.",
|
||||
"extras.empty.foldersTitle": "Belum ada extra folder",
|
||||
"extras.empty.sharedElsewhere": "{count} AGENTS.md bersama Anda ada di tab AGENTS.md. Extra folder menyinkronkan seluruh direktori, seperti rules atau commands.",
|
||||
"extras.empty.sharedElsewhereProject": "{count} file bersama Anda ada di tab AGENTS.md. Extra folder menyinkronkan seluruh direktori, seperti rules atau commands.",
|
||||
"extras.empty.description": "Extras memungkinkan Anda menyinkronkan folder atau file apa pun ke target alat AI Anda bersama skills.",
|
||||
"extras.empty.foldersTitle": "Belum ada extra folder atau file",
|
||||
"extras.empty.sharedElsewhere": "{count} AGENTS.md bersama Anda ada di tab AGENTS.md. Extra lain menyinkronkan satu folder atau satu file, seperti rules atau commands.",
|
||||
"extras.empty.sharedElsewhereProject": "{count} file bersama Anda ada di tab AGENTS.md. Extra lain menyinkronkan satu folder atau satu file, seperti rules atau commands.",
|
||||
"extras.empty.title": "Tidak ada extras yang dikonfigurasi",
|
||||
"extras.flatten": "Ratakan",
|
||||
"extras.flattenOn": "Aktif",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Mode",
|
||||
"extras.modal.targets": "Target",
|
||||
"extras.modal.subtitle": "Folder yang disinkronkan ke tools Anda seperti skills.",
|
||||
"extras.modal.subtitle": "Folder atau satu file yang disinkronkan ke alat Anda dengan cara yang sama seperti skills.",
|
||||
"extras.modal.nameHint": "Ditampilkan di daftar dan dipakai sebagai nama folder.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Folder sumber khusus",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "Hapus target",
|
||||
"extras.removeTargetConfirm.title": "Hapus target",
|
||||
"extras.removeTargetConfirm.message": "Hapus target \"{path}\"? File yang sudah disinkronkan ke target tidak akan dihapus.",
|
||||
"extras.subtitle.global": "Folder lain yang ingin disinkronkan selain skills: rules, commands, prompts. Masing-masing punya source dan targets sendiri.",
|
||||
"extras.subtitle.project": "Folder proyek lain yang ingin disinkronkan selain skills: rules, commands, prompts. Masing-masing punya source dan targets sendiri.",
|
||||
"extras.subtitle.global": "Folder dan file lain yang ingin disinkronkan selain skills: rules, commands, prompts. Masing-masing punya source dan targets sendiri.",
|
||||
"extras.subtitle.project": "Folder dan file proyek lain yang ingin disinkronkan selain skills: rules, commands, prompts. Masing-masing punya source dan targets sendiri.",
|
||||
"extras.sync": "Sinkronkan",
|
||||
"extras.status.synced": "Tersinkron",
|
||||
"extras.status.drift": "Ada perbedaan",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten menaruh file dari subfolder langsung ke folder target.",
|
||||
"extras.files.one": "{count} file",
|
||||
"extras.files.other": "{count} file",
|
||||
"extras.modal.sync": "Sinkronkan",
|
||||
"extras.modal.syncFolder": "Folder",
|
||||
"extras.modal.syncFile": "Satu file",
|
||||
"extras.modal.fileName": "Nama file",
|
||||
"extras.modal.fileNameInvalid": "Masukkan nama file, bukan path.",
|
||||
"extras.modal.fileSyncs": "Menyinkronkan {path}. File lain di folder itu tidak diubah.",
|
||||
"extras.modal.agentsNote": "Extra dengan file AGENTS.md muncul di tab AGENTS.md.",
|
||||
"extras.hint.fileAs": "Kosongkan Nama file untuk tetap memakai {file}.",
|
||||
"extras.hint.fileModes": "merge menautkan file · copy menulis salinan · import menambahkan baris @, hanya untuk alat yang membaca impor @.",
|
||||
"extras.hint.fileBackup": "File yang sudah ada di target dicadangkan sebelum diganti.",
|
||||
"extras.singleFile": "satu file",
|
||||
"extras.sourceFileMissing": "File sumber tidak ada",
|
||||
"extras.fileModeDescription.merge": "Tautkan file",
|
||||
"extras.fileModeDescription.copy": "Tulis salinan file",
|
||||
"extras.fileModeDescription.import": "Tambahkan baris @, untuk alat yang membaca impor @",
|
||||
"extras.moreActions": "Tindakan lain untuk {name}",
|
||||
"extras.targetActions": "Tindakan lain untuk {path}",
|
||||
"extras.footnote": "Extras ditulis bersama semua yang lain saat Anda menjalankan Sync. Extension mengonversi setiap file untuk tool yang tidak membaca Markdown, misalnya gemini-commands menulis TOML.",
|
||||
"extras.footnoteLink": "Kelola extensions di Settings.",
|
||||
"extras.tabs": "Bagian extras",
|
||||
"extras.tab.folders": "Folder",
|
||||
"extras.tab.folders": "Folder & file",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Diubah",
|
||||
"instructions.saved": "{path} disimpan.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "Tidak ada alat lain yang membaca AGENTS.md di folder ini, jadi tanpa dibagikan hanya {name} yang memakainya.",
|
||||
"instructions.convert.nameFirst": "Masukkan nama AGENTS.md bersama untuk melihat pratinjau.",
|
||||
"instructions.convert.nameTaken": "AGENTS.md bersama bernama {name} sudah ada. Pilih nama lain.",
|
||||
"instructions.shared.nameTakenFolder": "{name} sudah dipakai oleh extra folder. Pilih nama lain.",
|
||||
"instructions.shared.nameTakenFolder": "{name} sudah dipakai oleh extra di tab Folder & file. Pilih nama lain.",
|
||||
"instructions.convert.backup": "{file} dicadangkan sebelum diubah.",
|
||||
"instructions.convert.run": "Konversi",
|
||||
"instructions.convert.done": "{file} dikonversi.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "ターゲットを追加",
|
||||
"extras.cancel": "キャンセル",
|
||||
"extras.create": "作成",
|
||||
"extras.empty.description": "Extras を使うと、スキルと一緒に任意のディレクトリを AI ツールのターゲットに同期できます。",
|
||||
"extras.empty.foldersTitle": "フォルダの extra はまだありません",
|
||||
"extras.empty.sharedElsewhere": "共有 AGENTS.md {count} 件は「AGENTS.md」タブにあります。フォルダの extra は rules や commands などのフォルダ全体を同期します。",
|
||||
"extras.empty.sharedElsewhereProject": "共有ファイル {count} 件は「AGENTS.md」タブにあります。フォルダの extra は rules や commands などのフォルダ全体を同期します。",
|
||||
"extras.empty.description": "Extras を使うと、スキルと一緒に任意のフォルダーやファイルを AI ツールのターゲットに同期できます。",
|
||||
"extras.empty.foldersTitle": "フォルダーやファイルの extra はまだありません",
|
||||
"extras.empty.sharedElsewhere": "共有 AGENTS.md {count} 件は「AGENTS.md」タブにあります。ほかの extra は rules や commands などのフォルダーまたは単一ファイルを同期します。",
|
||||
"extras.empty.sharedElsewhereProject": "共有ファイル {count} 件は「AGENTS.md」タブにあります。ほかの extra は rules や commands などのフォルダーまたは単一ファイルを同期します。",
|
||||
"extras.empty.title": "Extra が設定されていません",
|
||||
"extras.flatten": "フラット化",
|
||||
"extras.flattenOn": "オン",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "モード",
|
||||
"extras.modal.targets": "ターゲット",
|
||||
"extras.modal.subtitle": "skills と同じ方法でツールに同期されるフォルダーです。",
|
||||
"extras.modal.subtitle": "skills と同じ方法でツールに同期されるフォルダーまたは単一ファイルです。",
|
||||
"extras.modal.nameHint": "一覧に表示され、フォルダー名にも使われます。",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "カスタムソースフォルダー",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "ターゲットを削除",
|
||||
"extras.removeTargetConfirm.title": "ターゲットを削除",
|
||||
"extras.removeTargetConfirm.message": "ターゲット「{path}」を削除しますか?すでにターゲットに同期されたファイルは削除されません。",
|
||||
"extras.subtitle.global": "skills 以外に同期したいフォルダー(rules、commands、prompts など)。それぞれに source と targets があります。",
|
||||
"extras.subtitle.project": "プロジェクト内で skills 以外に同期したいフォルダー(rules、commands、prompts など)。それぞれに source と targets があります。",
|
||||
"extras.subtitle.global": "skills 以外に同期したいフォルダーやファイル(rules、commands、prompts など)。それぞれに source と targets があります。",
|
||||
"extras.subtitle.project": "プロジェクト内で skills 以外に同期したいフォルダーやファイル(rules、commands、prompts など)。それぞれに source と targets があります。",
|
||||
"extras.sync": "同期",
|
||||
"extras.status.synced": "同期済み",
|
||||
"extras.status.drift": "差分あり",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten はサブフォルダーのファイルを target フォルダーに直接置きます。",
|
||||
"extras.files.one": "{count} ファイル",
|
||||
"extras.files.other": "{count} ファイル",
|
||||
"extras.modal.sync": "同期",
|
||||
"extras.modal.syncFolder": "フォルダー",
|
||||
"extras.modal.syncFile": "単一ファイル",
|
||||
"extras.modal.fileName": "ファイル名",
|
||||
"extras.modal.fileNameInvalid": "パスではなくファイル名を入力してください。",
|
||||
"extras.modal.fileSyncs": "{path} を同期します。そのフォルダー内のほかのファイルはそのままです。",
|
||||
"extras.modal.agentsNote": "ファイルが AGENTS.md の extra は「AGENTS.md」タブに表示されます。",
|
||||
"extras.hint.fileAs": "ファイル名を空にすると {file} のままになります。",
|
||||
"extras.hint.fileModes": "merge はファイルをリンク · copy はコピーを書き込み · import は @ 行を追加(@ インポートを読むツールのみ)。",
|
||||
"extras.hint.fileBackup": "ターゲットに既にあるファイルは、置き換える前にバックアップされます。",
|
||||
"extras.singleFile": "単一ファイル",
|
||||
"extras.sourceFileMissing": "ソースファイルがありません",
|
||||
"extras.fileModeDescription.merge": "ファイルをリンク",
|
||||
"extras.fileModeDescription.copy": "ファイルのコピーを書き込む",
|
||||
"extras.fileModeDescription.import": "@ 行を追加(@ インポートを読むツール向け)",
|
||||
"extras.moreActions": "{name} のその他の操作",
|
||||
"extras.targetActions": "{path} のその他の操作",
|
||||
"extras.footnote": "Sync を実行すると extras も一緒に書き込まれます。extension は Markdown を読まないツール向けに各ファイルを変換します。たとえば gemini-commands は TOML を書き出します。",
|
||||
"extras.footnoteLink": "extensions は Settings で管理します。",
|
||||
"extras.tabs": "Extras のセクション",
|
||||
"extras.tab.folders": "フォルダー",
|
||||
"extras.tab.folders": "フォルダーとファイル",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "変更あり",
|
||||
"instructions.saved": "{path} を保存しました。",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "このフォルダーの AGENTS.md は他のツールに読まれないため、共有しない場合は {name} だけが使います。",
|
||||
"instructions.convert.nameFirst": "共有 AGENTS.md の名前を入力するとプレビューが表示されます。",
|
||||
"instructions.convert.nameTaken": "{name} という共有 AGENTS.md はすでにあります。別の名前にしてください。",
|
||||
"instructions.shared.nameTakenFolder": "{name} はフォルダの extra ですでに使われています。別の名前にしてください。",
|
||||
"instructions.shared.nameTakenFolder": "{name} は「フォルダーとファイル」タブの extra ですでに使われています。別の名前にしてください。",
|
||||
"instructions.convert.backup": "{file} は変更前にバックアップされます。",
|
||||
"instructions.convert.run": "変換",
|
||||
"instructions.convert.done": "{file} を変換しました。",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "대상 추가",
|
||||
"extras.cancel": "취소",
|
||||
"extras.create": "생성",
|
||||
"extras.empty.description": "Extras를 사용하면 skills와 함께 AI 도구 대상에 임의의 디렉토리를 동기화할 수 있습니다.",
|
||||
"extras.empty.foldersTitle": "아직 폴더 extra가 없습니다",
|
||||
"extras.empty.sharedElsewhere": "공유 AGENTS.md {count}개는 AGENTS.md 탭에 있습니다. 폴더 extra는 rules나 commands 같은 폴더 전체를 동기화합니다.",
|
||||
"extras.empty.sharedElsewhereProject": "공유 파일 {count}개는 AGENTS.md 탭에 있습니다. 폴더 extra는 rules나 commands 같은 폴더 전체를 동기화합니다.",
|
||||
"extras.empty.description": "Extras를 사용하면 skills와 함께 원하는 폴더나 파일을 AI 도구 대상에 동기화할 수 있습니다.",
|
||||
"extras.empty.foldersTitle": "아직 폴더나 파일 extra가 없습니다",
|
||||
"extras.empty.sharedElsewhere": "공유 AGENTS.md {count}개는 AGENTS.md 탭에 있습니다. 다른 extra는 rules나 commands 같은 폴더 또는 단일 파일을 동기화합니다.",
|
||||
"extras.empty.sharedElsewhereProject": "공유 파일 {count}개는 AGENTS.md 탭에 있습니다. 다른 extra는 rules나 commands 같은 폴더 또는 단일 파일을 동기화합니다.",
|
||||
"extras.empty.title": "설정된 extras 없음",
|
||||
"extras.flatten": "평탄화",
|
||||
"extras.flattenOn": "켜짐",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "모드",
|
||||
"extras.modal.targets": "대상",
|
||||
"extras.modal.subtitle": "skills와 같은 방식으로 도구에 동기화되는 폴더입니다.",
|
||||
"extras.modal.subtitle": "skills와 같은 방식으로 도구에 동기화되는 폴더 또는 단일 파일입니다.",
|
||||
"extras.modal.nameHint": "목록에 표시되며 폴더 이름으로도 쓰입니다.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "사용자 지정 소스 폴더",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "대상 제거",
|
||||
"extras.removeTargetConfirm.title": "대상 제거",
|
||||
"extras.removeTargetConfirm.message": "대상 \"{path}\"을(를) 제거하시겠습니까? 이미 대상에 동기화된 파일은 삭제되지 않습니다.",
|
||||
"extras.subtitle.global": "skills 외에 동기화할 폴더(rules, commands, prompts 등). 각각 자체 source와 targets가 있습니다.",
|
||||
"extras.subtitle.project": "프로젝트에서 skills 외에 동기화할 폴더(rules, commands, prompts 등). 각각 자체 source와 targets가 있습니다.",
|
||||
"extras.subtitle.global": "skills 외에 동기화할 폴더와 파일(rules, commands, prompts 등). 각각 자체 source와 targets가 있습니다.",
|
||||
"extras.subtitle.project": "프로젝트에서 skills 외에 동기화할 폴더와 파일(rules, commands, prompts 등). 각각 자체 source와 targets가 있습니다.",
|
||||
"extras.sync": "동기화",
|
||||
"extras.status.synced": "동기화됨",
|
||||
"extras.status.drift": "차이 있음",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten은 하위 폴더의 파일을 target 폴더에 바로 넣습니다.",
|
||||
"extras.files.one": "파일 {count}개",
|
||||
"extras.files.other": "파일 {count}개",
|
||||
"extras.modal.sync": "동기화",
|
||||
"extras.modal.syncFolder": "폴더",
|
||||
"extras.modal.syncFile": "단일 파일",
|
||||
"extras.modal.fileName": "파일 이름",
|
||||
"extras.modal.fileNameInvalid": "경로가 아닌 파일 이름을 입력하세요.",
|
||||
"extras.modal.fileSyncs": "{path}을(를) 동기화합니다. 해당 폴더의 다른 파일은 그대로 둡니다.",
|
||||
"extras.modal.agentsNote": "파일이 AGENTS.md인 extra는 AGENTS.md 탭에 표시됩니다.",
|
||||
"extras.hint.fileAs": "파일 이름을 비워 두면 {file}을(를) 그대로 사용합니다.",
|
||||
"extras.hint.fileModes": "merge는 파일을 링크 · copy는 사본을 작성 · import는 @ 줄을 추가하며, @ import를 읽는 도구에서만 동작합니다.",
|
||||
"extras.hint.fileBackup": "대상에 이미 있는 파일은 교체하기 전에 백업됩니다.",
|
||||
"extras.singleFile": "단일 파일",
|
||||
"extras.sourceFileMissing": "소스 파일 없음",
|
||||
"extras.fileModeDescription.merge": "파일 링크",
|
||||
"extras.fileModeDescription.copy": "파일 사본 작성",
|
||||
"extras.fileModeDescription.import": "@ 줄 추가, @ import를 읽는 도구용",
|
||||
"extras.moreActions": "{name} 추가 작업",
|
||||
"extras.targetActions": "{path} 추가 작업",
|
||||
"extras.footnote": "Sync를 실행하면 extras도 함께 기록됩니다. extension은 Markdown을 읽지 않는 도구를 위해 파일을 변환합니다. 예를 들어 gemini-commands는 TOML로 기록합니다.",
|
||||
"extras.footnoteLink": "extensions는 Settings에서 관리합니다.",
|
||||
"extras.tabs": "Extras 섹션",
|
||||
"extras.tab.folders": "폴더",
|
||||
"extras.tab.folders": "폴더 및 파일",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "수정됨",
|
||||
"instructions.saved": "{path}을(를) 저장했습니다.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "이 폴더의 AGENTS.md는 다른 도구가 읽지 않으므로, 공유하지 않으면 {name}만 사용합니다.",
|
||||
"instructions.convert.nameFirst": "공유 AGENTS.md 이름을 입력하면 미리보기가 표시됩니다.",
|
||||
"instructions.convert.nameTaken": "{name}(이)라는 공유 AGENTS.md가 이미 있습니다. 다른 이름을 입력하세요.",
|
||||
"instructions.shared.nameTakenFolder": "{name}은(는) 이미 폴더 extra가 쓰고 있습니다. 다른 이름을 입력하세요.",
|
||||
"instructions.shared.nameTakenFolder": "{name}은(는) 이미 '폴더 및 파일' 탭의 extra에서 사용 중입니다. 다른 이름을 선택하세요.",
|
||||
"instructions.convert.backup": "{file}은(는) 변경 전에 백업됩니다.",
|
||||
"instructions.convert.run": "변환",
|
||||
"instructions.convert.done": "{file}을(를) 변환했습니다.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "Adicionar Destino",
|
||||
"extras.cancel": "Cancelar",
|
||||
"extras.create": "Criar",
|
||||
"extras.empty.description": "Extras permitem sincronizar qualquer diretório para os destinos das suas ferramentas de IA junto com suas skills.",
|
||||
"extras.empty.foldersTitle": "Ainda não há extras de pasta",
|
||||
"extras.empty.sharedElsewhere": "Seus {count} AGENTS.md compartilhados estão na aba AGENTS.md. Extras de pasta sincronizam um diretório inteiro, como rules ou commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Seus {count} arquivos compartilhados estão na aba AGENTS.md. Extras de pasta sincronizam um diretório inteiro, como rules ou commands.",
|
||||
"extras.empty.description": "Extras permitem sincronizar qualquer pasta ou arquivo com os destinos das suas ferramentas de IA junto com seus skills.",
|
||||
"extras.empty.foldersTitle": "Nenhum extra de pasta ou arquivo ainda",
|
||||
"extras.empty.sharedElsewhere": "Seus {count} AGENTS.md compartilhados estão na aba AGENTS.md. Os outros extras sincronizam uma pasta ou um único arquivo, como rules ou commands.",
|
||||
"extras.empty.sharedElsewhereProject": "Seus {count} arquivos compartilhados estão na aba AGENTS.md. Os outros extras sincronizam uma pasta ou um único arquivo, como rules ou commands.",
|
||||
"extras.empty.title": "Nenhum extra configurado",
|
||||
"extras.flatten": "Nivelar",
|
||||
"extras.flattenOn": "Ativado",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "Extension",
|
||||
"extras.modal.colMode": "Modo",
|
||||
"extras.modal.targets": "Destinos",
|
||||
"extras.modal.subtitle": "Uma pasta sincronizada com suas ferramentas do mesmo jeito que os skills.",
|
||||
"extras.modal.subtitle": "Uma pasta ou um único arquivo sincronizado com suas ferramentas do mesmo jeito que os skills.",
|
||||
"extras.modal.nameHint": "Aparece na lista e é usado como nome da pasta.",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "Pasta de origem personalizada",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "Remover destino",
|
||||
"extras.removeTargetConfirm.title": "Remover destino",
|
||||
"extras.removeTargetConfirm.message": "Remover o destino \"{path}\"? Os arquivos já sincronizados com o destino não serão excluídos.",
|
||||
"extras.subtitle.global": "Outras pastas que você quer sincronizar além dos skills: rules, commands, prompts. Cada uma tem sua própria source e targets.",
|
||||
"extras.subtitle.project": "Outras pastas do projeto que você quer sincronizar além dos skills: rules, commands, prompts. Cada uma tem sua própria source e targets.",
|
||||
"extras.subtitle.global": "Outras pastas e arquivos que você quer sincronizar além dos skills: rules, commands, prompts. Cada um tem sua própria source e targets.",
|
||||
"extras.subtitle.project": "Outras pastas e arquivos do projeto que você quer sincronizar além dos skills: rules, commands, prompts. Cada um tem sua própria source e targets.",
|
||||
"extras.sync": "Sincronizar",
|
||||
"extras.status.synced": "Sincronizado",
|
||||
"extras.status.drift": "Com diferenças",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten coloca os arquivos das subpastas direto na pasta target.",
|
||||
"extras.files.one": "{count} arquivo",
|
||||
"extras.files.other": "{count} arquivos",
|
||||
"extras.modal.sync": "Sincronizar",
|
||||
"extras.modal.syncFolder": "Pasta",
|
||||
"extras.modal.syncFile": "Arquivo único",
|
||||
"extras.modal.fileName": "Nome do arquivo",
|
||||
"extras.modal.fileNameInvalid": "Digite um nome de arquivo, não um caminho.",
|
||||
"extras.modal.fileSyncs": "Sincroniza {path}. Os outros arquivos dessa pasta não são alterados.",
|
||||
"extras.modal.agentsNote": "Um extra cujo arquivo é AGENTS.md aparece na aba AGENTS.md.",
|
||||
"extras.hint.fileAs": "Deixe o nome do arquivo vazio para manter {file}.",
|
||||
"extras.hint.fileModes": "merge cria um link para o arquivo · copy grava uma cópia · import adiciona uma linha @, só para ferramentas que leem imports @.",
|
||||
"extras.hint.fileBackup": "Um arquivo que já existe no destino recebe backup antes de ser substituído.",
|
||||
"extras.singleFile": "arquivo único",
|
||||
"extras.sourceFileMissing": "Arquivo de origem ausente",
|
||||
"extras.fileModeDescription.merge": "Criar link para o arquivo",
|
||||
"extras.fileModeDescription.copy": "Gravar uma cópia do arquivo",
|
||||
"extras.fileModeDescription.import": "Adicionar uma linha @, para ferramentas que leem imports @",
|
||||
"extras.moreActions": "Mais ações para {name}",
|
||||
"extras.targetActions": "Mais ações para {path}",
|
||||
"extras.footnote": "Os extras são gravados junto com todo o resto quando você executa o Sync. Uma extension converte cada arquivo para ferramentas que não leem Markdown; por exemplo, gemini-commands grava TOML.",
|
||||
"extras.footnoteLink": "Gerencie as extensions em Settings.",
|
||||
"extras.tabs": "Seções de extras",
|
||||
"extras.tab.folders": "Pastas",
|
||||
"extras.tab.folders": "Pastas e arquivos",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "Modificado",
|
||||
"instructions.saved": "{path} salvo.",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "Nenhuma outra ferramenta lê um AGENTS.md nesta pasta, então sem compartilhar só {name} o usa.",
|
||||
"instructions.convert.nameFirst": "Digite um nome para o AGENTS.md compartilhado para ver a prévia.",
|
||||
"instructions.convert.nameTaken": "Já existe um AGENTS.md compartilhado chamado {name}. Escolha outro nome.",
|
||||
"instructions.shared.nameTakenFolder": "{name} já é usado por um extra de pasta. Escolha outro nome.",
|
||||
"instructions.shared.nameTakenFolder": "{name} já é usado por um extra da aba Pastas e arquivos. Escolha outro nome.",
|
||||
"instructions.convert.backup": "É feito backup de {file} antes da alteração.",
|
||||
"instructions.convert.run": "Converter",
|
||||
"instructions.convert.done": "{file} convertido.",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "添加目标",
|
||||
"extras.cancel": "取消",
|
||||
"extras.create": "创建",
|
||||
"extras.empty.description": "Extras 让你可以将任意目录与 skill 一起同步到 AI 工具目标。",
|
||||
"extras.empty.foldersTitle": "还没有目录类的 extra",
|
||||
"extras.empty.sharedElsewhere": "你的 {count} 份共享 AGENTS.md 在“AGENTS.md”标签页。目录类的 extra 会同步整个文件夹,例如 rules 或 commands。",
|
||||
"extras.empty.sharedElsewhereProject": "你的 {count} 个共享文件在“AGENTS.md”标签页。文件夹类 extra 会同步整个目录,例如 rules 或 commands。",
|
||||
"extras.empty.description": "Extras 让你可以将任意文件夹或文件与 skills 一起同步到 AI 工具目标。",
|
||||
"extras.empty.foldersTitle": "还没有文件夹或文件类的 extra",
|
||||
"extras.empty.sharedElsewhere": "你的 {count} 份共享 AGENTS.md 在“AGENTS.md”标签页。其他 extra 会同步一个文件夹或单个文件,例如 rules 或 commands。",
|
||||
"extras.empty.sharedElsewhereProject": "你的 {count} 份共享文件在“AGENTS.md”标签页。其他 extra 会同步一个文件夹或单个文件,例如 rules 或 commands。",
|
||||
"extras.empty.title": "未配置任何 extra",
|
||||
"extras.flatten": "扁平化",
|
||||
"extras.flattenOn": "启用",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "扩展",
|
||||
"extras.modal.colMode": "模式",
|
||||
"extras.modal.targets": "目标",
|
||||
"extras.modal.subtitle": "像 skills 一样同步到各个工具的文件夹。",
|
||||
"extras.modal.subtitle": "像 skills 一样同步到各个工具的文件夹或单个文件。",
|
||||
"extras.modal.nameHint": "显示在列表中,也是文件夹名称。",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "自定义来源文件夹",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "删除目标",
|
||||
"extras.removeTargetConfirm.title": "删除目标",
|
||||
"extras.removeTargetConfirm.message": "删除目标「{path}」?已同步到目标的文件不会被删除。",
|
||||
"extras.subtitle.global": "skills 以外也想同步的文件夹,例如 rules、commands、prompts。每个都有自己的 source 和 targets。",
|
||||
"extras.subtitle.project": "项目里 skills 以外也想同步的文件夹,例如 rules、commands、prompts。每个都有自己的 source 和 targets。",
|
||||
"extras.subtitle.global": "skills 以外也想同步的文件夹和文件,例如 rules、commands、prompts。每个都有自己的 source 和 targets。",
|
||||
"extras.subtitle.project": "项目中 skills 以外也想同步的文件夹和文件,例如 rules、commands、prompts。每个都有自己的 source 和 targets。",
|
||||
"extras.sync": "同步",
|
||||
"extras.status.synced": "已同步",
|
||||
"extras.status.drift": "存在差异",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten 会把子文件夹里的文件直接放进 target 文件夹。",
|
||||
"extras.files.one": "{count} 个文件",
|
||||
"extras.files.other": "{count} 个文件",
|
||||
"extras.modal.sync": "同步",
|
||||
"extras.modal.syncFolder": "文件夹",
|
||||
"extras.modal.syncFile": "单个文件",
|
||||
"extras.modal.fileName": "文件名",
|
||||
"extras.modal.fileNameInvalid": "请输入文件名,而不是路径。",
|
||||
"extras.modal.fileSyncs": "同步 {path}。该文件夹中的其他文件不受影响。",
|
||||
"extras.modal.agentsNote": "文件为 AGENTS.md 的 extra 会显示在“AGENTS.md”标签页。",
|
||||
"extras.hint.fileAs": "文件名留空则保留 {file}。",
|
||||
"extras.hint.fileModes": "merge 链接文件 · copy 写入副本 · import 添加一行 @,仅适用于读取 @ import 的工具。",
|
||||
"extras.hint.fileBackup": "目标位置已有的文件会先备份再替换。",
|
||||
"extras.singleFile": "单个文件",
|
||||
"extras.sourceFileMissing": "源文件不存在",
|
||||
"extras.fileModeDescription.merge": "链接文件",
|
||||
"extras.fileModeDescription.copy": "写入文件副本",
|
||||
"extras.fileModeDescription.import": "添加一行 @,适用于读取 @ import 的工具",
|
||||
"extras.moreActions": "{name} 的更多操作",
|
||||
"extras.targetActions": "{path} 的更多操作",
|
||||
"extras.footnote": "执行 Sync 时,extras 会和其他内容一起写入。extension 会为不读 Markdown 的工具转换每个文件,例如 gemini-commands 会写成 TOML。",
|
||||
"extras.footnoteLink": "在 Settings 管理 extensions。",
|
||||
"extras.tabs": "Extras 分类",
|
||||
"extras.tab.folders": "文件夹",
|
||||
"extras.tab.folders": "文件夹和文件",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "已修改",
|
||||
"instructions.saved": "已保存 {path}。",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "没有其他工具会读取这个文件夹里的 AGENTS.md,不共享的话只有 {name} 会用到。",
|
||||
"instructions.convert.nameFirst": "先输入共享 AGENTS.md 的名称,才会显示预览。",
|
||||
"instructions.convert.nameTaken": "已经有名为 {name} 的共享 AGENTS.md,请换一个名称。",
|
||||
"instructions.shared.nameTakenFolder": "{name} 已经被一个文件夹 extra 使用,请换一个名称。",
|
||||
"instructions.shared.nameTakenFolder": "{name} 已被“文件夹和文件”标签页中的 extra 使用,请换一个名称。",
|
||||
"instructions.convert.backup": "修改前会先备份 {file}。",
|
||||
"instructions.convert.run": "转换",
|
||||
"instructions.convert.done": "已转换 {file}。",
|
||||
|
||||
@@ -321,10 +321,10 @@
|
||||
"extras.addTarget": "新增目標",
|
||||
"extras.cancel": "取消",
|
||||
"extras.create": "建立",
|
||||
"extras.empty.description": "Extras 讓你可以將任意目錄連同 skills 一起同步到 AI 工具目標。",
|
||||
"extras.empty.foldersTitle": "還沒有目錄類的 extra",
|
||||
"extras.empty.sharedElsewhere": "你的 {count} 份共用 AGENTS.md 在「AGENTS.md」分頁。目錄類的 extra 會同步整個資料夾,例如 rules 或 commands。",
|
||||
"extras.empty.sharedElsewhereProject": "你的 {count} 份共用檔在「AGENTS.md」分頁。目錄類的 extra 會同步整個資料夾,例如 rules 或 commands。",
|
||||
"extras.empty.description": "Extras 讓你可以將任意資料夾或檔案連同 skills 一起同步到 AI 工具目標。",
|
||||
"extras.empty.foldersTitle": "還沒有資料夾或檔案類的 extra",
|
||||
"extras.empty.sharedElsewhere": "你的 {count} 份共用 AGENTS.md 在「AGENTS.md」分頁。其他 extra 會同步一個資料夾或單一檔案,例如 rules 或 commands。",
|
||||
"extras.empty.sharedElsewhereProject": "你的 {count} 份共用檔在「AGENTS.md」分頁。其他 extra 會同步一個資料夾或單一檔案,例如 rules 或 commands。",
|
||||
"extras.empty.title": "尚未設定任何 extra",
|
||||
"extras.flatten": "攤平",
|
||||
"extras.flattenOn": "啟用",
|
||||
@@ -337,7 +337,7 @@
|
||||
"extras.modal.colExtension": "擴充功能",
|
||||
"extras.modal.colMode": "模式",
|
||||
"extras.modal.targets": "目標",
|
||||
"extras.modal.subtitle": "像 skills 一樣同步到各個工具的資料夾。",
|
||||
"extras.modal.subtitle": "像 skills 一樣同步到各個工具的資料夾或單一檔案。",
|
||||
"extras.modal.nameHint": "顯示在列表中,也是資料夾名稱。",
|
||||
"extras.modal.source": "Source",
|
||||
"extras.sourceType.custom": "自訂來源資料夾",
|
||||
@@ -354,8 +354,8 @@
|
||||
"extras.removeTarget": "移除目標",
|
||||
"extras.removeTargetConfirm.title": "移除目標",
|
||||
"extras.removeTargetConfirm.message": "移除目標「{path}」?已同步到目標的檔案不會被刪除。",
|
||||
"extras.subtitle.global": "skills 以外也想同步的資料夾,例如 rules、commands、prompts。每個都有自己的 source 和 targets。",
|
||||
"extras.subtitle.project": "專案裡 skills 以外也想同步的資料夾,例如 rules、commands、prompts。每個都有自己的 source 和 targets。",
|
||||
"extras.subtitle.global": "skills 以外也想同步的資料夾和檔案,例如 rules、commands、prompts。每個都有自己的 source 和 targets。",
|
||||
"extras.subtitle.project": "專案裡 skills 以外也想同步的資料夾和檔案,例如 rules、commands、prompts。每個都有自己的 source 和 targets。",
|
||||
"extras.sync": "同步",
|
||||
"extras.status.synced": "已同步",
|
||||
"extras.status.drift": "有差異",
|
||||
@@ -1065,12 +1065,27 @@
|
||||
"extras.hint.flatten": "flatten 會把子資料夾裡的檔案直接放進 target 資料夾。",
|
||||
"extras.files.one": "{count} 個檔案",
|
||||
"extras.files.other": "{count} 個檔案",
|
||||
"extras.modal.sync": "同步",
|
||||
"extras.modal.syncFolder": "資料夾",
|
||||
"extras.modal.syncFile": "單一檔案",
|
||||
"extras.modal.fileName": "檔名",
|
||||
"extras.modal.fileNameInvalid": "請輸入檔名,不是路徑。",
|
||||
"extras.modal.fileSyncs": "同步 {path}。那個資料夾裡的其他檔案不會被動到。",
|
||||
"extras.modal.agentsNote": "檔案是 AGENTS.md 的 extra 會顯示在「AGENTS.md」分頁。",
|
||||
"extras.hint.fileAs": "檔名留空就沿用 {file}。",
|
||||
"extras.hint.fileModes": "merge 連結檔案 · copy 寫入副本 · import 加一行 @,只適用於會讀 @ import 的工具。",
|
||||
"extras.hint.fileBackup": "目標上已有的檔案會先備份再取代。",
|
||||
"extras.singleFile": "單一檔案",
|
||||
"extras.sourceFileMissing": "來源檔案不存在",
|
||||
"extras.fileModeDescription.merge": "連結檔案",
|
||||
"extras.fileModeDescription.copy": "寫入檔案副本",
|
||||
"extras.fileModeDescription.import": "加一行 @,適用於會讀 @ import 的工具",
|
||||
"extras.moreActions": "{name} 的更多動作",
|
||||
"extras.targetActions": "{path} 的更多動作",
|
||||
"extras.footnote": "執行 Sync 時,extras 會和其他內容一起寫入。extension 會為不讀 Markdown 的工具轉換每個檔案,例如 gemini-commands 會寫成 TOML。",
|
||||
"extras.footnoteLink": "在 Settings 管理 extensions。",
|
||||
"extras.tabs": "Extras 分類",
|
||||
"extras.tab.folders": "目錄",
|
||||
"extras.tab.folders": "資料夾與檔案",
|
||||
"extras.tab.instructions": "AGENTS.md",
|
||||
"extras.status.modified": "已修改",
|
||||
"instructions.saved": "已儲存 {path}。",
|
||||
@@ -1141,7 +1156,7 @@
|
||||
"instructions.convert.shareOff": "沒有其他工具會讀這個資料夾裡的 AGENTS.md,不共用的話只有 {name} 會用到。",
|
||||
"instructions.convert.nameFirst": "先輸入共用 AGENTS.md 的名稱,才會顯示預覽。",
|
||||
"instructions.convert.nameTaken": "已經有名為 {name} 的共用 AGENTS.md,請換一個名稱。",
|
||||
"instructions.shared.nameTakenFolder": "{name} 已經被一個資料夾 extra 使用,請換一個名稱。",
|
||||
"instructions.shared.nameTakenFolder": "{name} 已經被「資料夾與檔案」分頁的 extra 使用,請換一個名稱。",
|
||||
"instructions.convert.backup": "轉換前會先備份原本的 {file}。",
|
||||
"instructions.convert.run": "轉換",
|
||||
"instructions.convert.done": "已轉換 {file}。",
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, within } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { I18nProvider } from '../i18n';
|
||||
import { ToastProvider } from '../components/Toast';
|
||||
import { api } from '../api/client';
|
||||
import ExtrasPage from './ExtrasPage';
|
||||
|
||||
vi.mock('../context/AppContext', () => ({ useAppContext: () => ({ isProjectMode: true }) }));
|
||||
@@ -19,8 +21,11 @@ vi.mock('../api/client', async (load) => {
|
||||
targets: [{ path: '.', mode: 'symlink', flatten: false, status: 'synced' }] },
|
||||
{ name: 'rules', source_dir: '/p/.skillshare/extras/rules', source_type: 'per-extra', file_count: 2, source_exists: true,
|
||||
targets: [{ path: '.claude/rules', mode: 'merge', flatten: false, status: 'synced' }] },
|
||||
{ name: 'conventions', file: 'CONVENTIONS.md', source_dir: '/p/.skillshare/extras/conventions', source_type: 'per-extra', file_count: 1, source_exists: true,
|
||||
targets: [{ path: '.cursor', mode: 'copy', flatten: false, as: 'rules.md', status: 'synced' }] },
|
||||
],
|
||||
}),
|
||||
createExtra: vi.fn().mockResolvedValue({ success: true }),
|
||||
listExtraExtensions: vi.fn().mockResolvedValue({ extensions: [] }),
|
||||
availableTargets: vi.fn().mockResolvedValue({ targets: [] }),
|
||||
getOverview: vi.fn().mockResolvedValue({}),
|
||||
@@ -28,16 +33,48 @@ vi.mock('../api/client', async (load) => {
|
||||
};
|
||||
});
|
||||
|
||||
describe('Extras page in a project', () => {
|
||||
// Shared files are on the AGENTS.md tab.
|
||||
it('lists only folder extras on the folders tab', async () => {
|
||||
render(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<I18nProvider><ToastProvider><MemoryRouter><ExtrasPage /></MemoryRouter></ToastProvider></I18nProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
const renderPage = () => render(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<I18nProvider><ToastProvider><MemoryRouter><ExtrasPage /></MemoryRouter></ToastProvider></I18nProvider>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
|
||||
describe('Extras page in a project', () => {
|
||||
it('lists folder extras on the first tab', async () => {
|
||||
renderPage();
|
||||
expect(await screen.findByText('rules')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// Shared AGENTS.md files are on the AGENTS.md tab.
|
||||
it('leaves AGENTS.md extras off the first tab', async () => {
|
||||
renderPage();
|
||||
await screen.findByText('rules');
|
||||
expect(screen.queryByText('team-rules')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows other single-file extras with the full target file path', async () => {
|
||||
renderPage();
|
||||
expect(await screen.findByText('conventions')).toBeInTheDocument();
|
||||
expect(screen.getByText('.cursor/rules.md')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('creates a single-file extra with its file and target file name', async () => {
|
||||
const user = userEvent.setup();
|
||||
renderPage();
|
||||
await user.click(await screen.findByRole('button', { name: 'Add extra' }));
|
||||
const dialog = screen.getByRole('dialog');
|
||||
await user.type(within(dialog).getByLabelText('Name'), 'notes');
|
||||
await user.click(within(dialog).getByRole('radio', { name: 'Single file' }));
|
||||
const [fileInput, asInput] = within(dialog).getAllByRole('textbox', { name: 'File name' });
|
||||
await user.type(fileInput, 'NOTES.md');
|
||||
await user.type(within(dialog).getByRole('textbox', { name: 'Folder' }), '.claude');
|
||||
await user.type(asInput, 'CLAUDE-notes.md');
|
||||
await user.click(within(dialog).getByRole('button', { name: 'Create' }));
|
||||
|
||||
expect(api.createExtra).toHaveBeenCalledWith({
|
||||
name: 'notes',
|
||||
file: 'NOTES.md',
|
||||
targets: [{ path: '.claude', mode: 'merge', as: 'CLAUDE-notes.md' }],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+175
-27
@@ -1,7 +1,7 @@
|
||||
import { useMemo, useState } from 'react';
|
||||
import { Link, useSearchParams } from 'react-router-dom';
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
||||
import { Ellipsis, FoldVertical, Folder, FolderPlus, Link2, Plus, Puzzle, RefreshCw, Trash2, X, Zap } from 'lucide-react';
|
||||
import { Ellipsis, FileText, FoldVertical, Folder, FolderPlus, Link2, Plus, Puzzle, RefreshCw, Trash2, X, Zap } from 'lucide-react';
|
||||
import { api } from '../api/client';
|
||||
import type { AvailableTarget, Extra, ExtraTarget } from '../api/client';
|
||||
import { queryKeys, staleTimes } from '../lib/queryKeys';
|
||||
@@ -21,8 +21,17 @@ import { buildSyncToast, sumEntry, syncToastType } from '../lib/extrasSyncToast'
|
||||
import { shortenHome } from '../lib/paths';
|
||||
import ProjectInstructions from '../components/instructions/ProjectInstructions';
|
||||
import SharedInstructions from '../components/instructions/SharedInstructions';
|
||||
import { isAgentsExtra } from '../components/instructions/instructionsView';
|
||||
|
||||
const MODES = ['merge', 'copy', 'symlink'] as const;
|
||||
// A single file can't be a directory symlink; import writes an @ line instead.
|
||||
const FILE_MODES = ['merge', 'copy', 'import'] as const;
|
||||
|
||||
/** A file name typed where a path would be wrong. */
|
||||
const isPathLike = (name: string) => /[\\/]/.test(name);
|
||||
|
||||
/** <folder>/<file>, for a single-file extra's source or target file. */
|
||||
const joinFile = (dir: string, file: string) => `${dir.replace(/[\\/]+$/, '')}/${file}`;
|
||||
|
||||
const STATUS: Record<string, { tone: string; labelKey: string }> = {
|
||||
synced: { tone: 'ok', labelKey: 'extras.status.synced' },
|
||||
@@ -54,9 +63,53 @@ interface Draft {
|
||||
mode: string;
|
||||
flatten: boolean;
|
||||
extension: string;
|
||||
as: string; // single-file extra: target file name, empty keeps the source name
|
||||
}
|
||||
|
||||
const newDraft = (): Draft => ({ id: crypto.randomUUID(), path: '', mode: 'merge', flatten: false, extension: '' });
|
||||
const newDraft = (): Draft => ({ id: crypto.randomUUID(), path: '', mode: 'merge', flatten: false, extension: '', as: '' });
|
||||
|
||||
/** Folder · File name · Mode for a single-file extra, shared by the Add extra dialog and the inline Add target row. */
|
||||
function FileDraftFields({ draft, onChange, fileName, known, disabled }: {
|
||||
draft: Draft;
|
||||
onChange: (next: Draft) => void;
|
||||
fileName: string;
|
||||
known: AvailableTarget[];
|
||||
disabled: boolean;
|
||||
}) {
|
||||
const t = useT();
|
||||
return (
|
||||
<>
|
||||
<TargetMark path={draft.path} known={known} />
|
||||
<span className="ss-inp min-w-0 flex-1">
|
||||
<input
|
||||
value={draft.path}
|
||||
onChange={(e) => onChange({ ...draft, path: e.target.value })}
|
||||
placeholder="~/.claude"
|
||||
aria-label={t('extras.modal.colPath')}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</span>
|
||||
<span className={`ss-inp w-[170px] shrink-0 ${isPathLike(draft.as) ? 'err' : ''}`}>
|
||||
<input
|
||||
value={draft.as}
|
||||
onChange={(e) => onChange({ ...draft, as: e.target.value })}
|
||||
placeholder={fileName || 'CONVENTIONS.md'}
|
||||
aria-label={t('extras.modal.fileName')}
|
||||
aria-invalid={isPathLike(draft.as)}
|
||||
title={isPathLike(draft.as) ? t('extras.modal.fileNameInvalid') : undefined}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</span>
|
||||
<Select
|
||||
className="w-[104px] shrink-0"
|
||||
value={draft.mode}
|
||||
onChange={(v) => onChange({ ...draft, mode: v })}
|
||||
options={FILE_MODES.map((m) => ({ value: m, label: m, description: t(`extras.fileModeDescription.${m}`) }))}
|
||||
disabled={disabled}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
/** Folder · Extension · Mode · flatten, shared by the Add extra dialog and the inline Add target row. */
|
||||
function DraftFields({ draft, onChange, extensions, known, disabled }: {
|
||||
@@ -126,9 +179,20 @@ function DraftHints({ extensions }: { extensions: string[] }) {
|
||||
);
|
||||
}
|
||||
|
||||
function FileDraftHints({ fileName }: { fileName: string }) {
|
||||
const t = useT();
|
||||
return (
|
||||
<div className="flex flex-col gap-0.5 text-[12.5px] text-ink-3">
|
||||
<span>{t('extras.hint.fileAs', { file: fileName || '…' })}</span>
|
||||
<span>{t('extras.hint.fileModes')}</span>
|
||||
<span>{t('extras.hint.fileBackup')}</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
onClose: () => void;
|
||||
onCreated: () => void;
|
||||
onCreated: (agents: boolean) => void;
|
||||
extensions: string[];
|
||||
known: AvailableTarget[];
|
||||
sharedDir: string;
|
||||
@@ -136,13 +200,26 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
const { toast } = useToast();
|
||||
const t = useT();
|
||||
const [name, setName] = useState('');
|
||||
const [single, setSingle] = useState(false);
|
||||
const [file, setFile] = useState('');
|
||||
const [custom, setCustom] = useState(false);
|
||||
const [source, setSource] = useState('');
|
||||
const [drafts, setDrafts] = useState<Draft[]>(() => [newDraft()]);
|
||||
const [saving, setSaving] = useState(false);
|
||||
const title = t('extras.addExtraTitle');
|
||||
const valid = drafts.filter((d) => d.path.trim());
|
||||
const canCreate = name.trim() !== '' && valid.length > 0 && (!custom || source.trim() !== '') && !saving;
|
||||
const fileName = file.trim();
|
||||
const fileOk = !single || (fileName !== '' && !isPathLike(fileName) && valid.every((d) => !isPathLike(d.as.trim())));
|
||||
const canCreate = name.trim() !== '' && valid.length > 0 && (!custom || source.trim() !== '') && fileOk && !saving;
|
||||
const agents = single && isAgentsExtra({ file: fileName });
|
||||
const sourceFile = joinFile(custom ? source.trim() || '…' : `${shortenHome(sharedDir)}/${name.trim() || '…'}`, fileName || '…');
|
||||
|
||||
// Keep each target's mode valid for the chosen kind.
|
||||
const switchKind = (toSingle: boolean) => {
|
||||
const modes: readonly string[] = toSingle ? FILE_MODES : MODES;
|
||||
setSingle(toSingle);
|
||||
setDrafts(drafts.map((d) => (modes.includes(d.mode) ? d : { ...d, mode: 'merge' })));
|
||||
};
|
||||
|
||||
const create = async () => {
|
||||
if (!canCreate) return;
|
||||
@@ -151,10 +228,13 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
await api.createExtra({
|
||||
name: name.trim(),
|
||||
...(custom && { source: source.trim() }),
|
||||
targets: valid.map((d) => ({ path: d.path.trim(), mode: d.extension ? 'copy' : d.mode, flatten: d.flatten, ...(d.extension && { extension: d.extension }) })),
|
||||
...(single && { file: fileName }),
|
||||
targets: valid.map((d) => (single
|
||||
? { path: d.path.trim(), mode: d.mode, ...(d.as.trim() && { as: d.as.trim() }) }
|
||||
: { path: d.path.trim(), mode: d.extension ? 'copy' : d.mode, flatten: d.flatten, ...(d.extension && { extension: d.extension }) })),
|
||||
});
|
||||
toast(t('extras.toast.created', { name: name.trim() }), 'success');
|
||||
onCreated();
|
||||
onCreated(agents);
|
||||
} catch (err) {
|
||||
toast((err as Error).message, 'error');
|
||||
setSaving(false);
|
||||
@@ -179,6 +259,17 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
</span>
|
||||
<span className="hp">{t('extras.modal.nameHint')}</span>
|
||||
</div>
|
||||
<div className="ss-fld">
|
||||
<span id="extra-kind" className="text-[13px] font-semibold">{t('extras.modal.sync')}</span>
|
||||
<div className="ss-seg self-start" role="radiogroup" aria-labelledby="extra-kind">
|
||||
{[false, true].map((on) => (
|
||||
<button key={String(on)} type="button" role="radio" aria-checked={single === on} className={single === on ? 'on' : ''} onClick={() => switchKind(on)} disabled={saving}>
|
||||
{on ? <FileText size={14} /> : <Folder size={14} />}
|
||||
{t(on ? 'extras.modal.syncFile' : 'extras.modal.syncFolder')}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="ss-fld">
|
||||
<span className="text-[13px] font-semibold">{t('extras.modal.source')}</span>
|
||||
<Select
|
||||
@@ -194,10 +285,23 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
<span className="ss-inp">
|
||||
<input value={source} onChange={(e) => setSource(e.target.value)} placeholder={t('extras.modal.sourcePathPlaceholder')} aria-label={t('extras.sourceType.custom')} disabled={saving} />
|
||||
</span>
|
||||
) : (
|
||||
) : !single && (
|
||||
<span className="hp truncate font-mono">{`${shortenHome(sharedDir)}/${name.trim() || '…'}`}</span>
|
||||
)}
|
||||
</div>
|
||||
{single && (
|
||||
<div className="ss-fld">
|
||||
<label htmlFor="extra-file">{t('extras.modal.fileName')}</label>
|
||||
<span className={`ss-inp ${isPathLike(fileName) ? 'err' : ''}`}>
|
||||
<input id="extra-file" value={file} onChange={(e) => setFile(e.target.value)} placeholder="CONVENTIONS.md" aria-invalid={isPathLike(fileName)} disabled={saving} />
|
||||
</span>
|
||||
{isPathLike(fileName) && <span className="hp text-bad">{t('extras.modal.fileNameInvalid')}</span>}
|
||||
</div>
|
||||
)}
|
||||
{single && (
|
||||
<p className="col-span-2 min-w-0 break-all text-[12.5px] text-ink-3">{t('extras.modal.fileSyncs', { path: sourceFile })}</p>
|
||||
)}
|
||||
{agents && <div className="ss-note inf col-span-2"><span className="flex-1">{t('extras.modal.agentsNote')}</span></div>}
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-1.5">
|
||||
@@ -206,14 +310,16 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
<div className="ss-lh !px-3">
|
||||
<span className="w-[30px]" />
|
||||
<span className="flex-1">{t('extras.modal.colPath')}</span>
|
||||
<span className="w-[170px]">{t('extras.modal.colExtension')}</span>
|
||||
<span className="w-[170px]">{t(single ? 'extras.modal.fileName' : 'extras.modal.colExtension')}</span>
|
||||
<span className="w-[104px]">{t('extras.modal.colMode')}</span>
|
||||
<span className="w-[96px]" />
|
||||
{!single && <span className="w-[96px]" />}
|
||||
<span className="w-[30px]" />
|
||||
</div>
|
||||
{drafts.map((d, i) => (
|
||||
<div key={d.id} className="ss-r !min-h-[52px] !px-3 !py-1.5">
|
||||
<DraftFields draft={d} onChange={(next) => setDrafts(drafts.map((x, j) => (j === i ? next : x)))} extensions={extensions} known={known} disabled={saving} />
|
||||
{single
|
||||
? <FileDraftFields draft={d} onChange={(next) => setDrafts(drafts.map((x, j) => (j === i ? next : x)))} fileName={fileName} known={known} disabled={saving} />
|
||||
: <DraftFields draft={d} onChange={(next) => setDrafts(drafts.map((x, j) => (j === i ? next : x)))} extensions={extensions} known={known} disabled={saving} />}
|
||||
<button
|
||||
type="button"
|
||||
className="ss-ib shrink-0 disabled:invisible"
|
||||
@@ -232,7 +338,7 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<DraftHints extensions={extensions} />
|
||||
{single ? <FileDraftHints fileName={fileName} /> : <DraftHints extensions={extensions} />}
|
||||
</div>
|
||||
</div>
|
||||
<div className="df">
|
||||
@@ -244,24 +350,28 @@ function AddExtraDialog({ onClose, onCreated, extensions, known, sharedDir }: {
|
||||
);
|
||||
}
|
||||
|
||||
function AddTargetRow({ onAdd, onCancel, extensions, known }: {
|
||||
function AddTargetRow({ onAdd, onCancel, extensions, known, file }: {
|
||||
onAdd: (draft: Draft) => Promise<boolean>;
|
||||
onCancel: () => void;
|
||||
extensions: string[];
|
||||
known: AvailableTarget[];
|
||||
file?: string; // single-file extra: the source file name
|
||||
}) {
|
||||
const t = useT();
|
||||
const [draft, setDraft] = useState(newDraft);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const ready = draft.path.trim() !== '' && !isPathLike(draft.as.trim());
|
||||
const add = async () => {
|
||||
if (!draft.path.trim() || busy) return;
|
||||
if (!ready || busy) return;
|
||||
setBusy(true);
|
||||
if (!(await onAdd(draft))) setBusy(false);
|
||||
};
|
||||
return (
|
||||
<form className="ss-r !min-h-[52px] !py-1.5" onSubmit={(e) => { e.preventDefault(); void add(); }}>
|
||||
<DraftFields draft={draft} onChange={setDraft} extensions={extensions} known={known} disabled={busy} />
|
||||
<Button type="submit" variant="primary" size="sm" loading={busy} disabled={!draft.path.trim()}>{t('extras.addTarget')}</Button>
|
||||
{file
|
||||
? <FileDraftFields draft={draft} onChange={setDraft} fileName={file} known={known} disabled={busy} />
|
||||
: <DraftFields draft={draft} onChange={setDraft} extensions={extensions} known={known} disabled={busy} />}
|
||||
<Button type="submit" variant="primary" size="sm" loading={busy} disabled={!ready}>{t('extras.addTarget')}</Button>
|
||||
<button type="button" className="ss-ib shrink-0" aria-label={t('extras.cancel')} onClick={onCancel} disabled={busy}><X size={16} /></button>
|
||||
</form>
|
||||
);
|
||||
@@ -282,7 +392,7 @@ export default function ExtrasPage() {
|
||||
const { toast } = useToast();
|
||||
const t = useT();
|
||||
const queryClient = useQueryClient();
|
||||
const [params] = useSearchParams();
|
||||
const [params, setParams] = useSearchParams();
|
||||
const tab = params.get('tab') === 'instructions' ? 'instructions' : 'folders';
|
||||
|
||||
const { data, isPending, error } = useQuery({ queryKey: queryKeys.extras, queryFn: () => api.listExtras(), staleTime: staleTimes.extras });
|
||||
@@ -340,10 +450,13 @@ export default function ExtrasPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const addTarget = async (name: string, d: Draft) => {
|
||||
const addTarget = async (extra: Extra, d: Draft) => {
|
||||
const { name } = extra;
|
||||
const path = d.path.trim();
|
||||
try {
|
||||
await api.addExtraTarget(name, { path, mode: d.extension ? 'copy' : d.mode, flatten: d.flatten });
|
||||
await api.addExtraTarget(name, extra.file
|
||||
? { path, mode: d.mode, ...(d.as.trim() && { as: d.as.trim() }) }
|
||||
: { path, mode: d.extension ? 'copy' : d.mode, flatten: d.flatten });
|
||||
// The add endpoint takes no extension, so set it on the new target afterwards
|
||||
if (d.extension) await api.setExtraMode(name, path, 'copy', undefined, d.extension);
|
||||
toast(t('extras.toast.targetAdded', { path }), 'success');
|
||||
@@ -363,7 +476,25 @@ export default function ExtrasPage() {
|
||||
{ key: 'remove', label: t('extras.removeConfirm.title'), icon: <Trash2 size={14} />, danger: true, onSelect: () => setRemoveExtra(extra.name) },
|
||||
];
|
||||
|
||||
const targetMenu = (extra: Extra, tg: ExtraTarget): ContextMenuItem[] => [
|
||||
// Single files: merge, copy or import; symlink only when a target already uses it.
|
||||
const fileTargetMenu = (extra: Extra, tg: ExtraTarget): ContextMenuItem[] => [
|
||||
{
|
||||
key: 'mode',
|
||||
label: t('extras.modal.colMode'),
|
||||
icon: <Link2 size={14} />,
|
||||
items: [...FILE_MODES, ...(tg.mode === 'symlink' ? ['symlink'] : [])].map((m) => ({
|
||||
key: m,
|
||||
label: m,
|
||||
selected: tg.mode === m,
|
||||
onSelect: () => void changeTarget(extra.name, tg, { mode: m }, t('extras.toast.modeChanged', { mode: m })),
|
||||
})),
|
||||
},
|
||||
...(extra.targets.length > 1
|
||||
? [{ key: 'remove', label: t('extras.removeTarget'), icon: <Trash2 size={14} />, danger: true, onSelect: () => setRemoveTarget({ name: extra.name, path: tg.path }) }]
|
||||
: []),
|
||||
];
|
||||
|
||||
const targetMenu = (extra: Extra, tg: ExtraTarget): ContextMenuItem[] => extra.file ? fileTargetMenu(extra, tg) : [
|
||||
...(extensions.length > 0 || tg.extension
|
||||
? [{
|
||||
key: 'extension',
|
||||
@@ -412,8 +543,8 @@ export default function ExtrasPage() {
|
||||
: []),
|
||||
];
|
||||
|
||||
// Shared instruction files (single-file extras) have their own tab.
|
||||
const extras = (data?.extras ?? []).filter((e) => !e.file);
|
||||
// Shared AGENTS.md files have their own tab.
|
||||
const extras = (data?.extras ?? []).filter((e) => !isAgentsExtra(e));
|
||||
const sharedCount = (data?.extras ?? []).length - extras.length;
|
||||
|
||||
return (
|
||||
@@ -449,10 +580,22 @@ export default function ExtrasPage() {
|
||||
{extras.map((extra) => (
|
||||
<div key={extra.name} className="contents">
|
||||
<div className="ss-gh !min-h-12">
|
||||
<span className="ss-cat sm extra"><FolderPlus size={14} /></span>
|
||||
<span className="ss-cat sm extra">{extra.file ? <FileText size={14} /> : <FolderPlus size={14} />}</span>
|
||||
<span className="font-mono font-semibold">{extra.name}</span>
|
||||
<span className="min-w-0 truncate font-mono text-ink-3" title={extra.source_dir}>{shortenHome(extra.source_dir)}</span>
|
||||
<span className="shrink-0 text-ink-3">· {t(extra.file_count === 1 ? 'extras.files.one' : 'extras.files.other', { count: extra.file_count })}</span>
|
||||
{extra.file ? (
|
||||
<>
|
||||
<span className="min-w-0 truncate font-mono text-ink-3" title={joinFile(extra.source_dir, extra.file)}>
|
||||
{joinFile(shortenHome(extra.source_dir), '')}<span className="font-semibold text-ink">{extra.file}</span>
|
||||
</span>
|
||||
<span className="shrink-0 text-ink-3">· {t('extras.singleFile')}</span>
|
||||
{!extra.source_exists && <span className="ss-tag bad shrink-0">{t('extras.sourceFileMissing')}</span>}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<span className="min-w-0 truncate font-mono text-ink-3" title={extra.source_dir}>{shortenHome(extra.source_dir)}</span>
|
||||
<span className="shrink-0 text-ink-3">· {t(extra.file_count === 1 ? 'extras.files.one' : 'extras.files.other', { count: extra.file_count })}</span>
|
||||
</>
|
||||
)}
|
||||
<span className="flex-1" />
|
||||
<button type="button" className="ss-ib" aria-label={t('extras.moreActions', { name: extra.name })} onClick={(e) => openMenu(e, extraMenu(extra))}>
|
||||
<Ellipsis size={16} />
|
||||
@@ -460,10 +603,11 @@ export default function ExtrasPage() {
|
||||
</div>
|
||||
{extra.targets.map((tg) => {
|
||||
const status = STATUS[tg.status];
|
||||
const dest = extra.file ? joinFile(tg.path, tg.as || extra.file) : tg.path;
|
||||
return (
|
||||
<div key={tg.path} className="ss-r !min-h-[46px]">
|
||||
<TargetMark path={tg.path} known={known} />
|
||||
<span className="min-w-0 flex-1 truncate font-mono text-[13px]" title={tg.path}>{shortenHome(tg.path)}</span>
|
||||
<span className="min-w-0 flex-1 truncate font-mono text-[13px]" title={dest}>{shortenHome(dest)}</span>
|
||||
<TargetTags target={tg} />
|
||||
<span className="w-[120px] shrink-0">
|
||||
<span className={`ss-st ${status?.tone ?? ''}`}>{status ? t(status.labelKey) : tg.status}</span>
|
||||
@@ -475,7 +619,7 @@ export default function ExtrasPage() {
|
||||
);
|
||||
})}
|
||||
{addingTo === extra.name ? (
|
||||
<AddTargetRow onAdd={(d) => addTarget(extra.name, d)} onCancel={() => setAddingTo(null)} extensions={extensions} known={known} />
|
||||
<AddTargetRow onAdd={(d) => addTarget(extra, d)} onCancel={() => setAddingTo(null)} extensions={extensions} known={known} file={extra.file} />
|
||||
) : (
|
||||
<div className="ss-r !min-h-10">
|
||||
<button type="button" className="flex items-center gap-[7px] text-[13px] text-ink-2 hover:text-ink" onClick={() => setAddingTo(extra.name)}>
|
||||
@@ -497,7 +641,11 @@ export default function ExtrasPage() {
|
||||
{showAdd && (
|
||||
<AddExtraDialog
|
||||
onClose={() => setShowAdd(false)}
|
||||
onCreated={() => { setShowAdd(false); invalidate(); }}
|
||||
onCreated={(agents) => {
|
||||
setShowAdd(false);
|
||||
invalidate();
|
||||
if (agents) setParams({ tab: 'instructions' }, { replace: true });
|
||||
}}
|
||||
extensions={extensions}
|
||||
known={known}
|
||||
sharedDir={sharedDir}
|
||||
|
||||
Reference in New Issue
Block a user