Files
Willie 403aafb254 feat: unify project target names with global names, add aliases for backward compat
Project targets now use the same short names as global targets (e.g.,
"claude" instead of "claude-code"). Old project_name values are preserved
as aliases so existing configs continue to work.

- Add Aliases field to targetSpec (deprecated, remove once safe)
- Update 11 targets in targets.yaml: project_name = global_name
- LookupProjectTarget falls back to alias lookup
- Fix 3 callers that bypassed LookupProjectTarget
- Extend MatchesTargetName and KnownTargetNames with alias support
- Add TestLookupProjectTarget_Alias
- Update all integration tests, docs, CLI help, and FAQ
2026-02-16 00:08:59 +08:00

54 lines
1.4 KiB
Go

//go:build !online
package integration
import (
"os"
"path/filepath"
"testing"
"skillshare/internal/testutil"
)
func TestUIProject_RequiresInit(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
// Create an empty project directory without .skillshare/config.yaml
projectRoot := filepath.Join(sb.Root, "project")
os.MkdirAll(projectRoot, 0755)
result := sb.RunCLIInDir(projectRoot, "ui", "-p", "--no-open")
result.AssertFailure(t)
result.AssertAnyOutputContains(t, "run 'skillshare init -p' first")
}
func TestUIProject_ExplicitFlag(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
projectRoot := sb.SetupProjectDir("claude")
// With -p flag and no .skillshare in a different dir, should fail
emptyDir := filepath.Join(sb.Root, "empty")
os.MkdirAll(emptyDir, 0755)
result := sb.RunCLIInDir(emptyDir, "ui", "-p", "--no-open")
result.AssertFailure(t)
result.AssertAnyOutputContains(t, "run 'skillshare init -p' first")
// With -p flag in project dir, the server will try to start and bind a port.
// We just verify it doesn't fail with "not initialized" error by checking
// the setup path works. The actual server binding is tested separately.
_ = projectRoot
}
func TestUIProject_MutuallyExclusiveFlags(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
result := sb.RunCLI("ui", "-p", "-g", "--no-open")
result.AssertFailure(t)
result.AssertAnyOutputContains(t, "mutually exclusive")
}