facult 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/manage.ts +35 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "facult",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Manage coding-agent skills and MCP configs across tools.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/manage.ts CHANGED
@@ -1525,6 +1525,34 @@ async function createSkillSymlinks({
1525
1525
  }
1526
1526
  }
1527
1527
 
1528
+ function isPreservedToolSkillEntry(name: string): boolean {
1529
+ return name.startsWith(".");
1530
+ }
1531
+
1532
+ async function restorePreservedToolSkillEntries({
1533
+ backupDir,
1534
+ toolSkillsDir,
1535
+ }: {
1536
+ backupDir: string | null | undefined;
1537
+ toolSkillsDir: string;
1538
+ }) {
1539
+ if (!(backupDir && (await fileExists(backupDir)))) {
1540
+ return;
1541
+ }
1542
+ const entries = await readdir(backupDir, { withFileTypes: true }).catch(
1543
+ () => [] as import("node:fs").Dirent[]
1544
+ );
1545
+ for (const entry of entries) {
1546
+ if (!isPreservedToolSkillEntry(entry.name)) {
1547
+ continue;
1548
+ }
1549
+ const source = join(backupDir, entry.name);
1550
+ const target = join(toolSkillsDir, entry.name);
1551
+ await rm(target, { recursive: true, force: true });
1552
+ await cp(source, target, { recursive: true });
1553
+ }
1554
+ }
1555
+
1528
1556
  async function planSkillSymlinkChanges({
1529
1557
  homeDir,
1530
1558
  toolSkillsDir,
@@ -1553,6 +1581,9 @@ async function planSkillSymlinkChanges({
1553
1581
  const add: string[] = [];
1554
1582
 
1555
1583
  for (const entry of existing) {
1584
+ if (isPreservedToolSkillEntry(entry.name)) {
1585
+ continue;
1586
+ }
1556
1587
  if (!desiredSet.has(entry.name)) {
1557
1588
  remove.push(entry.name);
1558
1589
  continue;
@@ -1970,6 +2001,10 @@ export async function manageTool(tool: string, opts: ManageOptions = {}) {
1970
2001
 
1971
2002
  if (toolPaths.skillsDir) {
1972
2003
  await ensureEmptyDir(toolPaths.skillsDir);
2004
+ await restorePreservedToolSkillEntries({
2005
+ backupDir: skillsBackup,
2006
+ toolSkillsDir: toolPaths.skillsDir,
2007
+ });
1973
2008
  await createSkillSymlinks({
1974
2009
  homeDir: home,
1975
2010
  toolSkillsDir: toolPaths.skillsDir,