feat: rename skills/skiff to pouch and move ACK state under .pouch
Use ~/.pouch, the pouch CLI, and .pouch.yaml as the SSOT container. Keep the inner skills/ packages, and store ACK project state in .pouch/ack instead of docs/ack.
This commit is contained in:
@@ -8,8 +8,8 @@ import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
from skiff.project import normalize_skill_entry
|
||||
from skiff.sources import fetch_source
|
||||
from pouch.project import normalize_skill_entry
|
||||
from pouch.sources import fetch_source
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
@@ -41,19 +41,19 @@ class CustomSourceTests(unittest.TestCase):
|
||||
def setUp(self) -> None:
|
||||
self.temp_dir = tempfile.TemporaryDirectory()
|
||||
self.home = Path(self.temp_dir.name)
|
||||
self.skills_home = self.home / ".skills"
|
||||
self.skills_home = self.home / ".pouch"
|
||||
(self.skills_home / "skills").mkdir(parents=True)
|
||||
(self.skills_home / "catalog.yaml").write_text("", encoding="utf-8")
|
||||
|
||||
def tearDown(self) -> None:
|
||||
self.temp_dir.cleanup()
|
||||
|
||||
def run_skiff(self, *args: str) -> subprocess.CompletedProcess[str]:
|
||||
def run_pouch(self, *args: str) -> subprocess.CompletedProcess[str]:
|
||||
env = os.environ.copy()
|
||||
env["HOME"] = str(self.home)
|
||||
env["PYTHONPATH"] = str(REPO_ROOT)
|
||||
return subprocess.run(
|
||||
[sys.executable, "-m", "skiff", *args],
|
||||
[sys.executable, "-m", "pouch", *args],
|
||||
cwd=REPO_ROOT,
|
||||
env=env,
|
||||
text=True,
|
||||
@@ -65,7 +65,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
company = self.home / "company"
|
||||
expected = write_skill(company / "internal" / "skills", "code-review")
|
||||
|
||||
added = self.run_skiff(
|
||||
added = self.run_pouch(
|
||||
"source",
|
||||
"add",
|
||||
"company",
|
||||
@@ -74,8 +74,8 @@ class CustomSourceTests(unittest.TestCase):
|
||||
"--skills-path",
|
||||
"internal/skills",
|
||||
)
|
||||
listed = self.run_skiff("list", "--source", "company")
|
||||
installed = self.run_skiff("add", "company/code-review", "-g", "-a", "codex")
|
||||
listed = self.run_pouch("list", "--source", "company")
|
||||
installed = self.run_pouch("add", "company/code-review", "-g", "-a", "codex")
|
||||
|
||||
self.assertEqual(added.returncode, 0, added.stderr)
|
||||
self.assertEqual(listed.returncode, 0, listed.stderr)
|
||||
@@ -84,7 +84,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
link = self.home / ".codex" / "skills" / "code-review"
|
||||
self.assertTrue(link.is_symlink())
|
||||
self.assertEqual(link.resolve(), expected.resolve())
|
||||
config = self.home / ".config" / "skiff" / "config.yaml"
|
||||
config = self.home / ".config" / "pouch" / "config.yaml"
|
||||
self.assertIn("company:", config.read_text(encoding="utf-8"))
|
||||
|
||||
def test_local_source_can_expose_a_single_skill(self) -> None:
|
||||
@@ -94,7 +94,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
"---\nname: solo\ndescription: Test single source.\n---\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
added = self.run_skiff(
|
||||
added = self.run_pouch(
|
||||
"source",
|
||||
"add",
|
||||
"solo",
|
||||
@@ -103,7 +103,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
"--skills-path",
|
||||
".",
|
||||
)
|
||||
installed = self.run_skiff(
|
||||
installed = self.run_pouch(
|
||||
"add",
|
||||
"solo",
|
||||
"-g",
|
||||
@@ -122,10 +122,10 @@ class CustomSourceTests(unittest.TestCase):
|
||||
expected = write_skill(company / "skills", "code-review")
|
||||
project = self.home / "project"
|
||||
project.mkdir()
|
||||
added = self.run_skiff("source", "add", "company", "--local", str(company))
|
||||
added = self.run_pouch("source", "add", "company", "--local", str(company))
|
||||
self.assertEqual(added.returncode, 0, added.stderr)
|
||||
|
||||
result = self.run_skiff(
|
||||
result = self.run_pouch(
|
||||
"add",
|
||||
"company/code-review",
|
||||
"--project",
|
||||
@@ -135,7 +135,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
manifest = project.joinpath(".skills.yaml").read_text(encoding="utf-8")
|
||||
manifest = project.joinpath(".pouch.yaml").read_text(encoding="utf-8")
|
||||
self.assertIn('name: "code-review"', manifest)
|
||||
self.assertIn("source: company", manifest)
|
||||
self.assertEqual(
|
||||
@@ -149,14 +149,14 @@ class CustomSourceTests(unittest.TestCase):
|
||||
write_skill(company / "skills", "code-review")
|
||||
project = self.home / "project"
|
||||
project.mkdir()
|
||||
project.joinpath(".skills.yaml").write_text(
|
||||
project.joinpath(".pouch.yaml").write_text(
|
||||
"skills:\n - code-review\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
added = self.run_skiff("source", "add", "company", "--local", str(company))
|
||||
added = self.run_pouch("source", "add", "company", "--local", str(company))
|
||||
self.assertEqual(added.returncode, 0, added.stderr)
|
||||
|
||||
result = self.run_skiff(
|
||||
result = self.run_pouch(
|
||||
"add",
|
||||
"company/code-review",
|
||||
"--project",
|
||||
@@ -166,17 +166,17 @@ class CustomSourceTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
manifest = project.joinpath(".skills.yaml").read_text(encoding="utf-8")
|
||||
manifest = project.joinpath(".pouch.yaml").read_text(encoding="utf-8")
|
||||
self.assertIn("source: company", manifest)
|
||||
|
||||
def test_unqualified_duplicate_requires_explicit_source(self) -> None:
|
||||
write_skill(self.skills_home / "skills", "code-review")
|
||||
company = self.home / "company"
|
||||
write_skill(company / "skills", "code-review")
|
||||
added = self.run_skiff("source", "add", "company", "--local", str(company))
|
||||
added = self.run_pouch("source", "add", "company", "--local", str(company))
|
||||
self.assertEqual(added.returncode, 0, added.stderr)
|
||||
|
||||
result = self.run_skiff("add", "code-review", "-g", "-a", "codex")
|
||||
result = self.run_pouch("add", "code-review", "-g", "-a", "codex")
|
||||
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("builtin/code-review", result.stderr)
|
||||
@@ -194,9 +194,9 @@ class CustomSourceTests(unittest.TestCase):
|
||||
" path: skills\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
added = self.run_skiff("source", "add", "company", "--local", str(company))
|
||||
added = self.run_pouch("source", "add", "company", "--local", str(company))
|
||||
|
||||
result = self.run_skiff(
|
||||
result = self.run_pouch(
|
||||
"add",
|
||||
"company/code-review",
|
||||
"-g",
|
||||
@@ -216,15 +216,15 @@ class CustomSourceTests(unittest.TestCase):
|
||||
expected = write_skill(company / "skills", "code-review")
|
||||
project = self.home / "project"
|
||||
project.mkdir()
|
||||
project.joinpath(".skills.yaml").write_text(
|
||||
project.joinpath(".pouch.yaml").write_text(
|
||||
"skills:\n - name: code-review\n source: company\n"
|
||||
"targets:\n - codex\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
added = self.run_skiff("source", "add", "company", "--local", str(company))
|
||||
added = self.run_pouch("source", "add", "company", "--local", str(company))
|
||||
self.assertEqual(added.returncode, 0, added.stderr)
|
||||
|
||||
result = self.run_skiff("sync", "--project", str(project), "-a", "codex")
|
||||
result = self.run_pouch("sync", "--project", str(project), "-a", "codex")
|
||||
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
link = project / ".agents" / "skills" / "code-review"
|
||||
@@ -233,16 +233,16 @@ class CustomSourceTests(unittest.TestCase):
|
||||
def test_sync_reports_missing_machine_source(self) -> None:
|
||||
project = self.home / "project"
|
||||
project.mkdir()
|
||||
project.joinpath(".skills.yaml").write_text(
|
||||
project.joinpath(".pouch.yaml").write_text(
|
||||
"skills:\n - name: code-review\n source: company\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
result = self.run_skiff("sync", "--project", str(project), "-a", "codex")
|
||||
result = self.run_pouch("sync", "--project", str(project), "-a", "codex")
|
||||
|
||||
self.assertNotEqual(result.returncode, 0)
|
||||
self.assertIn("本机尚未配置", result.stderr)
|
||||
self.assertIn("skiff source add company", result.stderr)
|
||||
self.assertIn("pouch source add company", result.stderr)
|
||||
|
||||
def test_git_source_is_cloned_to_default_checkout(self) -> None:
|
||||
upstream = self.home / "upstream"
|
||||
@@ -266,10 +266,10 @@ class CustomSourceTests(unittest.TestCase):
|
||||
capture_output=True,
|
||||
)
|
||||
|
||||
result = self.run_skiff("source", "add", "company", str(upstream))
|
||||
result = self.run_pouch("source", "add", "company", str(upstream))
|
||||
|
||||
self.assertEqual(result.returncode, 0, result.stderr)
|
||||
checkout = self.home / ".local" / "share" / "skiff" / "sources" / "company"
|
||||
checkout = self.home / ".local" / "share" / "pouch" / "sources" / "company"
|
||||
self.assertTrue((checkout / ".git").is_dir())
|
||||
self.assertTrue((checkout / "skills" / "release-check" / "SKILL.md").is_file())
|
||||
|
||||
@@ -281,7 +281,7 @@ class CustomSourceTests(unittest.TestCase):
|
||||
"checkout": str(checkout),
|
||||
}
|
||||
|
||||
with patch("skiff.sources.subprocess.run") as run:
|
||||
with patch("pouch.sources.subprocess.run") as run:
|
||||
fetch_source("company", entry)
|
||||
|
||||
run.assert_called_once_with(
|
||||
|
||||
Reference in New Issue
Block a user