agent-space-manager 1.0.2 โ†’ 1.0.4

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.
package/manager.mjs CHANGED
@@ -36,6 +36,7 @@ import {
36
36
  syncMarkdownRulesBlock,
37
37
  syncOwnedFiles,
38
38
  syncJsonHooks,
39
+ syncApps,
39
40
  writeHubCommunicationFiles,
40
41
  ensureGitInfoExclude,
41
42
  parseMarkdownFrontmatter,
@@ -693,6 +694,144 @@ export function listFilesRecursiveRel(dir, baseDir = dir, maxDepth = 4, depth =
693
694
  return results;
694
695
  }
695
696
 
697
+ /**
698
+ * Normalizes an upstream repository URL for reliable duplicate matching.
699
+ */
700
+ function normalizeUpstreamUrl(url = "") {
701
+ return String(url || "")
702
+ .trim()
703
+ .replace(/\.git$/i, "")
704
+ .replace(/\/+$/, "")
705
+ .toLowerCase();
706
+ }
707
+
708
+ /**
709
+ * Extracts and normalizes the `upstream` frontmatter URL from a markdown file.
710
+ */
711
+ function extractMarkdownUpstream(filePath) {
712
+ try {
713
+ if (!filePath || !fs.existsSync(filePath)) return "";
714
+ const raw = fs.readFileSync(filePath, "utf8");
715
+ const { frontmatter } = parseMarkdownFrontmatter(raw);
716
+ return normalizeUpstreamUrl(frontmatter?.upstream || "");
717
+ } catch {
718
+ return "";
719
+ }
720
+ }
721
+
722
+ /**
723
+ * Checks whether a standalone component name/upstream duplicates a plugin-bundled component.
724
+ */
725
+ function matchesPluginComponent(standaloneName, standaloneUpstream, pluginEntries = []) {
726
+ const cleanBase = String(standaloneName || "").replace(/\.(md|mdc)$/i, "").toLowerCase();
727
+ const normUp = normalizeUpstreamUrl(standaloneUpstream);
728
+ for (const entry of pluginEntries) {
729
+ if (normUp && entry.upstream && normUp === entry.upstream) {
730
+ return entry;
731
+ }
732
+ const compBase = String(entry.name || "").replace(/\.(md|mdc)$/i, "").toLowerCase();
733
+ if (!compBase || !cleanBase) continue;
734
+ if (compBase === cleanBase) return entry;
735
+ if (cleanBase.length >= 6 && compBase.endsWith(`-${cleanBase}`)) return entry;
736
+ }
737
+ return null;
738
+ }
739
+
740
+ /**
741
+ * Builds normalized plugin component metadata for duplicate-standalone detection.
742
+ */
743
+ function collectPluginComponentIndex(plugins = [], enabledMap = null) {
744
+ const skillEntries = [];
745
+ const ruleEntries = [];
746
+ const agentEntries = [];
747
+ for (const p of plugins) {
748
+ if (!p || p.isRootSkills || !p.path) continue;
749
+ if (enabledMap && enabledMap[p.id] !== true) continue;
750
+ const pluginUp = normalizeUpstreamUrl(p.upstream || "");
751
+ for (const s of p.skills || []) {
752
+ const skillUp = extractMarkdownUpstream(path.join(p.path, "skills", s, "SKILL.md")) || pluginUp;
753
+ skillEntries.push({ name: s, upstream: skillUp, pluginId: p.id });
754
+ }
755
+ for (const r of p.rules || []) {
756
+ const ruleUp = extractMarkdownUpstream(path.join(p.path, "rules", r)) || pluginUp;
757
+ ruleEntries.push({ name: r, upstream: ruleUp, pluginId: p.id });
758
+ }
759
+ for (const a of p.agents || []) {
760
+ const agentUp = extractMarkdownUpstream(path.join(p.path, "agents", a)) || pluginUp;
761
+ agentEntries.push({ name: a, upstream: agentUp, pluginId: p.id });
762
+ }
763
+ }
764
+ return { skillEntries, ruleEntries, agentEntries };
765
+ }
766
+
767
+ /**
768
+ * Detects pre-existing non-ASM-owned standalone skills, rules, or agents in target IDE
769
+ * directories that duplicate components already provided by enabled plugins.
770
+ */
771
+ export function detectDuplicateStandalones(
772
+ allPlugins = [],
773
+ enabledMap = {},
774
+ targetDirs = {},
775
+ ownedFiles = [],
776
+ ownedLinks = []
777
+ ) {
778
+ const conflicts = [];
779
+ const { skillEntries, ruleEntries, agentEntries } = collectPluginComponentIndex(allPlugins, enabledMap);
780
+ const ownedFileSet = new Set((ownedFiles || []).map((f) => path.resolve(f)));
781
+ const ownedLinkSet = new Set((ownedLinks || []).map((l) => path.resolve(l)));
782
+
783
+ const scanDirForDuplicates = (dir, category, pluginEntries) => {
784
+ if (!dir || !fs.existsSync(dir) || pluginEntries.length === 0) return;
785
+ try {
786
+ for (const ent of fs.readdirSync(dir, { withFileTypes: true })) {
787
+ const fullPath = path.join(dir, ent.name);
788
+ const resolved = path.resolve(fullPath);
789
+ if (category === "skill") {
790
+ if (ownedLinkSet.has(resolved) || isAsmOwnedDirectory(fullPath)) continue;
791
+ const isDir = ent.isDirectory() || (ent.isSymbolicLink() && (() => {
792
+ try { return fs.statSync(fullPath).isDirectory(); } catch { return false; }
793
+ })());
794
+ if (!isDir) continue;
795
+ const up = extractMarkdownUpstream(path.join(fullPath, "SKILL.md"));
796
+ const match = matchesPluginComponent(ent.name, up, pluginEntries);
797
+ if (match) {
798
+ conflicts.push({
799
+ type: "duplicate-standalone",
800
+ category,
801
+ name: ent.name,
802
+ existingPath: fullPath,
803
+ pluginId: match.pluginId,
804
+ pluginComponent: match.name,
805
+ reason: `standalone skill duplicates plugin "${match.pluginId}" (${match.name})`,
806
+ });
807
+ }
808
+ } else {
809
+ if (!ent.name.endsWith(".md") && !ent.name.endsWith(".mdc")) continue;
810
+ if (ownedFileSet.has(resolved)) continue;
811
+ const up = extractMarkdownUpstream(fullPath);
812
+ const match = matchesPluginComponent(ent.name, up, pluginEntries);
813
+ if (match) {
814
+ conflicts.push({
815
+ type: "duplicate-standalone",
816
+ category,
817
+ name: ent.name,
818
+ existingPath: fullPath,
819
+ pluginId: match.pluginId,
820
+ pluginComponent: match.name,
821
+ reason: `standalone ${category} duplicates plugin "${match.pluginId}" (${match.name})`,
822
+ });
823
+ }
824
+ }
825
+ }
826
+ } catch {}
827
+ };
828
+
829
+ scanDirForDuplicates(targetDirs.skillsDir, "skill", skillEntries);
830
+ scanDirForDuplicates(targetDirs.rulesDir, "rule", ruleEntries);
831
+ scanDirForDuplicates(targetDirs.agentsDir, "agent", agentEntries);
832
+ return conflicts;
833
+ }
834
+
696
835
  /**
697
836
  * Builds a comprehensive categorized registry of Plugins, MCPs, Hooks, Skills, Agents, and Rules.
698
837
  */
@@ -704,6 +843,7 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
704
843
  skills: [],
705
844
  agents: [],
706
845
  rules: [],
846
+ apps: [],
707
847
  };
708
848
 
709
849
  const seenSkills = new Set();
@@ -711,6 +851,7 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
711
851
  const seenHooks = new Set();
712
852
  const seenAgents = new Set();
713
853
  const seenRules = new Set();
854
+ const seenApps = new Set();
714
855
 
715
856
  for (const p of plugins) {
716
857
  categories.plugins.push({
@@ -719,12 +860,50 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
719
860
  version: p.version,
720
861
  path: p.path,
721
862
  description: p.description,
863
+ componentType: p.isApp ? "app" : "plugin",
864
+ isApp: Boolean(p.isApp),
865
+ hasApp: Boolean(p.hasApp || p.isApp),
866
+ appsCount: p.isApp ? 1 : (p.apps || []).length,
722
867
  skillsCount: (p.skills || []).length,
723
868
  filesCount: (p.files || []).length,
724
869
  hasMcp: p.hasMcp,
725
870
  hasHooks: p.hasHooks,
726
871
  });
727
872
 
873
+ if (p.isApp) {
874
+ const appKey = p.id || p.name;
875
+ if (!seenApps.has(appKey)) {
876
+ seenApps.add(appKey);
877
+ categories.apps.push({
878
+ id: p.id,
879
+ name: p.name,
880
+ version: p.version,
881
+ pluginId: p.id,
882
+ pluginName: p.name,
883
+ description: p.description,
884
+ sourcePath: p.path,
885
+ upstream: p.upstream || null,
886
+ });
887
+ }
888
+ } else {
889
+ for (const a of p.apps || []) {
890
+ const appKey = `${p.id}/${a}`;
891
+ if (!seenApps.has(appKey)) {
892
+ seenApps.add(appKey);
893
+ const appDir = fs.existsSync(path.join(p.path, "apps", a))
894
+ ? path.join(p.path, "apps", a)
895
+ : path.join(p.path, "app", a);
896
+ categories.apps.push({
897
+ id: appKey,
898
+ name: a,
899
+ pluginId: p.id,
900
+ pluginName: p.name,
901
+ sourcePath: appDir,
902
+ });
903
+ }
904
+ }
905
+ }
906
+
728
907
  for (const s of p.skills || []) {
729
908
  if (!seenSkills.has(s)) {
730
909
  seenSkills.add(s);
@@ -788,19 +967,21 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
788
967
  }
789
968
 
790
969
  if (hubRoot && fs.existsSync(hubRoot)) {
970
+ const { ruleEntries, agentEntries } = collectPluginComponentIndex(plugins);
791
971
  const rootAgentsDir = path.join(hubRoot, "agents");
792
972
  if (fs.existsSync(rootAgentsDir)) {
793
973
  try {
794
974
  for (const a of fs.readdirSync(rootAgentsDir)) {
795
- if (a.endsWith(".md") && !seenAgents.has(a)) {
796
- seenAgents.add(a);
797
- categories.agents.push({
798
- name: a,
799
- pluginId: "root",
800
- pluginName: "Root Agents",
801
- sourcePath: path.join(rootAgentsDir, a),
802
- });
803
- }
975
+ if (!a.endsWith(".md") || seenAgents.has(a)) continue;
976
+ const aPath = path.join(rootAgentsDir, a);
977
+ if (matchesPluginComponent(a, extractMarkdownUpstream(aPath), agentEntries)) continue;
978
+ seenAgents.add(a);
979
+ categories.agents.push({
980
+ name: a,
981
+ pluginId: "root",
982
+ pluginName: "Root Agents",
983
+ sourcePath: aPath,
984
+ });
804
985
  }
805
986
  } catch {}
806
987
  }
@@ -809,15 +990,16 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
809
990
  if (fs.existsSync(rootRulesDir)) {
810
991
  try {
811
992
  for (const r of fs.readdirSync(rootRulesDir)) {
812
- if (r.endsWith(".md") && !seenRules.has(r)) {
813
- seenRules.add(r);
814
- categories.rules.push({
815
- name: r,
816
- pluginId: "root",
817
- pluginName: "Root Rules",
818
- sourcePath: path.join(rootRulesDir, r),
819
- });
820
- }
993
+ if (!r.endsWith(".md") || seenRules.has(r)) continue;
994
+ const rPath = path.join(rootRulesDir, r);
995
+ if (matchesPluginComponent(r, extractMarkdownUpstream(rPath), ruleEntries)) continue;
996
+ seenRules.add(r);
997
+ categories.rules.push({
998
+ name: r,
999
+ pluginId: "root",
1000
+ pluginName: "Root Rules",
1001
+ sourcePath: rPath,
1002
+ });
821
1003
  }
822
1004
  } catch {}
823
1005
  }
@@ -826,6 +1008,31 @@ export function buildCategoriesRegistry(plugins = [], hubRoot = "") {
826
1008
  return categories;
827
1009
  }
828
1010
 
1011
+ /**
1012
+ * Shallow file/folder listing for standalone App directories (avoids recursing hundreds of browser/binary files).
1013
+ */
1014
+ function listShallowAppFiles(appDir) {
1015
+ if (!appDir || !fs.existsSync(appDir)) return [];
1016
+ const results = [];
1017
+ try {
1018
+ for (const e of fs.readdirSync(appDir, { withFileTypes: true })) {
1019
+ if (e.name === ".git" || e.name === "node_modules" || e.name === ".asm-owned.json") continue;
1020
+ const full = path.join(appDir, e.name);
1021
+ try {
1022
+ const st = fs.statSync(full);
1023
+ if (st.isDirectory()) {
1024
+ results.push({ name: `${e.name}/`, relPath: `${e.name}/`, size: 0, mtime: Math.round(st.mtimeMs), isDir: true });
1025
+ } else {
1026
+ results.push({ name: e.name, relPath: e.name, size: st.size, mtime: Math.round(st.mtimeMs) });
1027
+ }
1028
+ } catch {
1029
+ results.push({ name: e.name, relPath: e.name, size: 0, mtime: 0 });
1030
+ }
1031
+ }
1032
+ } catch {}
1033
+ return results;
1034
+ }
1035
+
829
1036
  /**
830
1037
  * Scans plugins directory for all standard plugin packages and root standalone components.
831
1038
  */
@@ -835,11 +1042,50 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
835
1042
  if (!cleanHub || !fs.existsSync(cleanHub)) return [];
836
1043
 
837
1044
  const rootManifestPath = path.join(cleanHub, "plugin.json");
1045
+ const rootAppManifestPath = path.join(cleanHub, "app.json");
838
1046
  const rootSkillMdPath = path.join(cleanHub, "SKILL.md");
839
1047
  const hasDirectPluginsFolder = fs.existsSync(path.join(cleanHub, "plugins"));
1048
+ const hasDirectAppFolder = fs.existsSync(path.join(cleanHub, "app"));
1049
+
1050
+ // 0. Single standalone App package directly at hubRoot
1051
+ if (!hasDirectPluginsFolder && !hasDirectAppFolder && fs.existsSync(rootAppManifestPath)) {
1052
+ const entryName = path.basename(cleanHub);
1053
+ let manifest = { name: entryName, version: "1.0.0", description: "" };
1054
+ try {
1055
+ manifest = JSON.parse(stripBom(fs.readFileSync(rootAppManifestPath, "utf8")));
1056
+ } catch {
1057
+ manifest.description = "Invalid app.json";
1058
+ }
1059
+ const files = listShallowAppFiles(cleanHub);
1060
+ return [
1061
+ {
1062
+ id: manifest.id || entryName,
1063
+ name: manifest.name || entryName,
1064
+ version: manifest.version || "1.0.0",
1065
+ description: manifest.description || `Standalone app component (${entryName})`,
1066
+ path: cleanHub,
1067
+ upstream: manifest.upstream || (typeof manifest.repository === "string" ? manifest.repository : manifest.repository?.url) || manifest.homepage || manifest.url || manifest.source || null,
1068
+ componentType: "app",
1069
+ isApp: true,
1070
+ hasApp: true,
1071
+ apps: [entryName],
1072
+ appName: entryName,
1073
+ appEnv: manifest.env || null,
1074
+ appExecutable: manifest.executable || manifest.bin || null,
1075
+ hasMcp: false,
1076
+ hasHooks: false,
1077
+ mcps: [],
1078
+ hooks: [],
1079
+ skills: [],
1080
+ rules: [],
1081
+ agents: [],
1082
+ files,
1083
+ },
1084
+ ];
1085
+ }
840
1086
 
841
1087
  // 1. Single plugin or standalone skill package directly at hubRoot
842
- if (!hasDirectPluginsFolder && (fs.existsSync(rootManifestPath) || fs.existsSync(rootSkillMdPath))) {
1088
+ if (!hasDirectPluginsFolder && !hasDirectAppFolder && (fs.existsSync(rootManifestPath) || fs.existsSync(rootSkillMdPath))) {
843
1089
  const entryName = path.basename(cleanHub);
844
1090
  let manifest = { name: entryName, version: "1.0.0", description: "" };
845
1091
  if (fs.existsSync(rootManifestPath)) {
@@ -992,7 +1238,7 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
992
1238
  if (hasManifest) {
993
1239
  pluginsDir = cleanHub;
994
1240
  isDirectHub = true;
995
- } else if (!fs.existsSync(path.join(cleanHub, "skills"))) {
1241
+ } else if (!fs.existsSync(path.join(cleanHub, "skills")) && !fs.existsSync(path.join(cleanHub, "app"))) {
996
1242
  return [];
997
1243
  }
998
1244
  } catch {
@@ -1095,6 +1341,20 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
1095
1341
  } catch {}
1096
1342
  }
1097
1343
 
1344
+ const pluginApps = [];
1345
+ for (const subAppFolder of ["apps", "app"]) {
1346
+ const pAppsDir = path.join(pluginDir, subAppFolder);
1347
+ if (fs.existsSync(pAppsDir)) {
1348
+ try {
1349
+ for (const aEnt of fs.readdirSync(pAppsDir, { withFileTypes: true })) {
1350
+ if (aEnt.isDirectory() || aEnt.isSymbolicLink()) {
1351
+ pluginApps.push(aEnt.name);
1352
+ }
1353
+ }
1354
+ } catch {}
1355
+ }
1356
+ }
1357
+
1098
1358
  const files = listFilesRecursiveRel(pluginDir, pluginDir);
1099
1359
 
1100
1360
  plugins.push({
@@ -1106,11 +1366,13 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
1106
1366
  upstream: manifest.upstream || (typeof manifest.repository === "string" ? manifest.repository : manifest.repository?.url) || manifest.homepage || manifest.url || manifest.source || null,
1107
1367
  hasMcp,
1108
1368
  hasHooks,
1369
+ hasApp: pluginApps.length > 0,
1109
1370
  mcps,
1110
1371
  hooks,
1111
1372
  skills,
1112
1373
  rules,
1113
1374
  agents,
1375
+ apps: pluginApps,
1114
1376
  files,
1115
1377
  });
1116
1378
  }
@@ -1122,14 +1384,19 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
1122
1384
  if (fs.existsSync(rootSkillsDir)) {
1123
1385
  try {
1124
1386
  const pluginSkillSet = new Set(plugins.flatMap((p) => p.skills || []));
1387
+ const { skillEntries } = collectPluginComponentIndex(plugins);
1125
1388
  const rootSkills = [];
1126
1389
  for (const se of fs.readdirSync(rootSkillsDir, { withFileTypes: true })) {
1127
1390
  if (pluginSkillSet.has(se.name)) continue;
1391
+ const skillDirPath = path.join(rootSkillsDir, se.name);
1128
1392
  let isDir = false;
1129
1393
  try {
1130
- isDir = se.isDirectory() || (se.isSymbolicLink() && fs.statSync(path.join(rootSkillsDir, se.name)).isDirectory());
1394
+ isDir = se.isDirectory() || (se.isSymbolicLink() && fs.statSync(skillDirPath).isDirectory());
1131
1395
  } catch {}
1132
- if (isDir) rootSkills.push(se.name);
1396
+ if (!isDir) continue;
1397
+ const up = extractMarkdownUpstream(path.join(skillDirPath, "SKILL.md"));
1398
+ if (matchesPluginComponent(se.name, up, skillEntries)) continue;
1399
+ rootSkills.push(se.name);
1133
1400
  }
1134
1401
  if (rootSkills.length > 0) {
1135
1402
  const rootSkillFiles = listFilesRecursiveRel(rootSkillsDir, rootSkillsDir);
@@ -1152,6 +1419,78 @@ export function scanPlugins(hubRoot = resolveHubRoot()) {
1152
1419
  }
1153
1420
  } catch {}
1154
1421
  }
1422
+
1423
+ // Discover standalone App components in <hubRoot>/app/<app-name>/
1424
+ const rootAppDir = path.join(cleanHub, "app");
1425
+ if (fs.existsSync(rootAppDir)) {
1426
+ try {
1427
+ const existingIds = new Set(plugins.map((p) => p.id));
1428
+ for (const ae of fs.readdirSync(rootAppDir, { withFileTypes: true })) {
1429
+ if (ae.name.startsWith(".") || ae.name === "node_modules") continue;
1430
+ const appPath = path.join(rootAppDir, ae.name);
1431
+ let isDir = false;
1432
+ try {
1433
+ isDir = ae.isDirectory() || (ae.isSymbolicLink() && fs.statSync(appPath).isDirectory());
1434
+ } catch {}
1435
+ if (!isDir) continue;
1436
+
1437
+ const appManifestPath = path.join(appPath, "app.json");
1438
+ const fallbackPluginJson = path.join(appPath, "plugin.json");
1439
+ let manifest = { name: ae.name, version: "1.0.0", description: `Standalone app component (${ae.name})` };
1440
+ if (fs.existsSync(appManifestPath)) {
1441
+ try {
1442
+ manifest = JSON.parse(stripBom(fs.readFileSync(appManifestPath, "utf8")));
1443
+ } catch {
1444
+ manifest.description = "Invalid app.json";
1445
+ }
1446
+ } else if (fs.existsSync(fallbackPluginJson)) {
1447
+ try {
1448
+ manifest = JSON.parse(stripBom(fs.readFileSync(fallbackPluginJson, "utf8")));
1449
+ } catch {}
1450
+ }
1451
+
1452
+ let appId = manifest.id || ae.name;
1453
+ if (existingIds.has(appId)) {
1454
+ appId = `app-${appId}`;
1455
+ }
1456
+ existingIds.add(appId);
1457
+
1458
+ const appUpstream =
1459
+ manifest.upstream ||
1460
+ (typeof manifest.repository === "string" ? manifest.repository : manifest.repository?.url) ||
1461
+ manifest.homepage ||
1462
+ manifest.url ||
1463
+ manifest.source ||
1464
+ extractComponentUpstream(appPath, "app", manifest) ||
1465
+ null;
1466
+
1467
+ const appFiles = listShallowAppFiles(appPath);
1468
+ plugins.push({
1469
+ id: appId,
1470
+ name: manifest.name || ae.name,
1471
+ version: manifest.version || "1.0.0",
1472
+ description: manifest.description || `Standalone app component (${ae.name})`,
1473
+ path: appPath,
1474
+ upstream: appUpstream,
1475
+ componentType: "app",
1476
+ isApp: true,
1477
+ hasApp: true,
1478
+ apps: [ae.name],
1479
+ appName: ae.name,
1480
+ appEnv: manifest.env || null,
1481
+ appExecutable: manifest.executable || manifest.bin || null,
1482
+ hasMcp: false,
1483
+ hasHooks: false,
1484
+ mcps: [],
1485
+ hooks: [],
1486
+ skills: [],
1487
+ rules: [],
1488
+ agents: [],
1489
+ files: appFiles,
1490
+ });
1491
+ }
1492
+ } catch {}
1493
+ }
1155
1494
  }
1156
1495
 
1157
1496
  return plugins;
@@ -1309,8 +1648,8 @@ export function sanitizeAgentConfigDirectory(configDir, agentType = "general") {
1309
1648
  }
1310
1649
  }
1311
1650
 
1312
- // 2. Sanitize empty ghost directories left behind in plugins / skills
1313
- for (const sub of ["plugins", "skills"]) {
1651
+ // 2. Sanitize empty ghost directories left behind in plugins / skills / apps
1652
+ for (const sub of ["plugins", "skills", "apps"]) {
1314
1653
  const subDir = path.join(configDir, sub);
1315
1654
  if (fs.existsSync(subDir)) {
1316
1655
  for (const ent of fs.readdirSync(subDir)) {
@@ -1359,7 +1698,7 @@ export function syncIdePlugins(ide, allPlugins = []) {
1359
1698
  const activePluginMap = new Map();
1360
1699
  for (const plugin of allPlugins) {
1361
1700
  const isEnabled = Boolean(normalized.plugins && normalized.plugins[plugin.id] === true);
1362
- if (isEnabled && plugin.path && fs.existsSync(plugin.path) && !plugin.isRootSkills) {
1701
+ if (isEnabled && plugin.path && fs.existsSync(plugin.path) && !plugin.isRootSkills && !plugin.isApp) {
1363
1702
  activePluginMap.set(plugin.id, plugin.path);
1364
1703
  }
1365
1704
  }
@@ -1389,10 +1728,12 @@ export function syncIdePlugins(ide, allPlugins = []) {
1389
1728
  // - Harmonize skills.json without wiping user's non-hub entries
1390
1729
  const isGeminiIde = agentType === "antigravity" || primaryDir.toLowerCase().includes(".gemini");
1391
1730
  let skillLinks = [];
1731
+ let appLinks = [];
1392
1732
  let nextFiles = [];
1393
1733
  const nextJsonKeys = {};
1394
1734
  const nextBlocks = [];
1395
1735
  const components = collectEnabledComponents(allPlugins, normalized.plugins);
1736
+ const appsTargetDir = paths.apps || path.join(path.dirname(bundleDir), "apps");
1396
1737
 
1397
1738
  if (isGeminiIde) {
1398
1739
  const geminiConfigDir = path.dirname(bundleDir);
@@ -1405,7 +1746,7 @@ export function syncIdePlugins(ide, allPlugins = []) {
1405
1746
  try {
1406
1747
  if (fs.existsSync(geminiConfigDir)) {
1407
1748
  for (const entryName of fs.readdirSync(geminiConfigDir)) {
1408
- if (entryName === "plugins" || entryName === "skills" || entryName === "rules" || entryName === "agents") {
1749
+ if (entryName === "plugins" || entryName === "skills" || entryName === "rules" || entryName === "agents" || entryName === "apps") {
1409
1750
  continue;
1410
1751
  }
1411
1752
  const entryPath = path.join(geminiConfigDir, entryName);
@@ -1426,9 +1767,16 @@ export function syncIdePlugins(ide, allPlugins = []) {
1426
1767
  const prevSkillLinks = (prevState.links || []).filter(
1427
1768
  (l) => path.dirname(path.resolve(l)) === path.resolve(geminiSkillsDir)
1428
1769
  );
1770
+ const prevAppLinks = (prevState.links || []).filter(
1771
+ (l) => path.dirname(path.resolve(l)) === path.resolve(appsTargetDir)
1772
+ );
1429
1773
  for (const oldLink of prevState.links || []) {
1430
1774
  const oldParent = path.dirname(path.resolve(oldLink));
1431
- if (oldParent !== path.resolve(bundleDir) && oldParent !== path.resolve(geminiSkillsDir)) {
1775
+ if (
1776
+ oldParent !== path.resolve(bundleDir) &&
1777
+ oldParent !== path.resolve(geminiSkillsDir) &&
1778
+ oldParent !== path.resolve(appsTargetDir)
1779
+ ) {
1432
1780
  removeJunction(oldLink);
1433
1781
  }
1434
1782
  }
@@ -1498,7 +1846,39 @@ export function syncIdePlugins(ide, allPlugins = []) {
1498
1846
  if (hookRes.ownedKeys.length > 0) nextJsonKeys[paths.hooks.file] = hookRes.ownedKeys;
1499
1847
  }
1500
1848
 
1501
- const allOwnedLinks = [...bundleLinks, ...skillLinks];
1849
+ // Sync App components (e.g. ms-playwright) via directory junctions
1850
+ if (appsTargetDir) {
1851
+ const prevAppLinks = (prevState.links || []).filter(
1852
+ (l) => path.dirname(path.resolve(l)) === path.resolve(appsTargetDir)
1853
+ );
1854
+ const appSync = syncApps(
1855
+ components.apps,
1856
+ appsTargetDir,
1857
+ prevAppLinks,
1858
+ createJunction,
1859
+ removeJunction,
1860
+ allPlugins,
1861
+ ownerKey
1862
+ );
1863
+ appLinks = appSync.nextLinks;
1864
+ }
1865
+
1866
+ const allOwnedLinks = [...bundleLinks, ...skillLinks, ...appLinks];
1867
+ if (isGeminiIde) {
1868
+ const geminiConfigDir = path.dirname(bundleDir);
1869
+ const dupes = detectDuplicateStandalones(
1870
+ allPlugins,
1871
+ normalized.plugins,
1872
+ {
1873
+ skillsDir: paths.skills || path.join(geminiConfigDir, "skills"),
1874
+ rulesDir: (paths.rules?.dir || paths.rulesDir?.dir || path.join(geminiConfigDir, "rules")),
1875
+ agentsDir: (paths.agents?.dir || paths.agentsDir?.dir || path.join(geminiConfigDir, "agents")),
1876
+ },
1877
+ nextFiles,
1878
+ allOwnedLinks
1879
+ );
1880
+ components.conflicts.push(...dupes);
1881
+ }
1502
1882
  saveOwnershipState(ownerKey, { links: allOwnedLinks, files: nextFiles, jsonKeys: nextJsonKeys, blocks: nextBlocks });
1503
1883
  return {
1504
1884
  success: true,
@@ -1509,7 +1889,10 @@ export function syncIdePlugins(ide, allPlugins = []) {
1509
1889
  skills: skillLinks.length,
1510
1890
  rules: components.rules.length,
1511
1891
  agents: components.agents.length,
1892
+ apps: appLinks.length,
1893
+ conflicts: components.conflicts.length,
1512
1894
  },
1895
+ conflicts: components.conflicts,
1513
1896
  results,
1514
1897
  };
1515
1898
  }
@@ -1517,12 +1900,37 @@ export function syncIdePlugins(ide, allPlugins = []) {
1517
1900
  // Mode 2: Native-Format Converted Agent (Claude Code, Codex, OpenCode, Copilot, Cursor, Windsurf, Gemini CLI, Cline, Roo, Kiro, Universal, Custom)
1518
1901
  const components = collectEnabledComponents(allPlugins, normalized.plugins);
1519
1902
  const skillsTargetDir = paths.skills || primaryDir;
1903
+ const appsTargetDir = paths.apps || path.join(path.dirname(skillsTargetDir), "apps");
1904
+
1905
+ const prevSkillLinks = (prevState.links || []).filter(
1906
+ (l) => path.dirname(path.resolve(l)) === path.resolve(skillsTargetDir)
1907
+ );
1908
+ const prevAppLinks = (prevState.links || []).filter(
1909
+ (l) => path.dirname(path.resolve(l)) === path.resolve(appsTargetDir)
1910
+ );
1911
+ for (const oldLink of prevState.links || []) {
1912
+ const oldParent = path.dirname(path.resolve(oldLink));
1913
+ if (oldParent !== path.resolve(skillsTargetDir) && oldParent !== path.resolve(appsTargetDir)) {
1914
+ removeJunction(oldLink);
1915
+ }
1916
+ }
1520
1917
 
1521
1918
  // 1. Link flattened skills (<skillsTargetDir>/<skill-name>/SKILL.md)
1522
1919
  const skillSync = syncFlattenedSkills(
1523
1920
  components.skills,
1524
1921
  skillsTargetDir,
1525
- prevState.links || [],
1922
+ prevSkillLinks,
1923
+ createJunction,
1924
+ removeJunction,
1925
+ allPlugins,
1926
+ ownerKey
1927
+ );
1928
+
1929
+ // 1b. Link enabled App components (<appsTargetDir>/<app-name>)
1930
+ const appSync = syncApps(
1931
+ components.apps,
1932
+ appsTargetDir,
1933
+ prevAppLinks,
1526
1934
  createJunction,
1527
1935
  removeJunction,
1528
1936
  allPlugins,
@@ -1599,8 +2007,22 @@ export function syncIdePlugins(ide, allPlugins = []) {
1599
2007
  }
1600
2008
  }
1601
2009
 
2010
+ const allMode2Links = [...skillSync.nextLinks, ...appSync.nextLinks];
2011
+ const dupes = detectDuplicateStandalones(
2012
+ allPlugins,
2013
+ normalized.plugins,
2014
+ {
2015
+ skillsDir: skillsTargetDir,
2016
+ rulesDir: typeof paths.rules === "object" ? paths.rules?.dir : undefined,
2017
+ agentsDir: typeof paths.agents === "object" ? paths.agents?.dir : undefined,
2018
+ },
2019
+ nextFiles,
2020
+ allMode2Links
2021
+ );
2022
+ components.conflicts.push(...dupes);
2023
+
1602
2024
  saveOwnershipState(ownerKey, {
1603
- links: skillSync.nextLinks,
2025
+ links: allMode2Links,
1604
2026
  files: nextFiles,
1605
2027
  jsonKeys: nextJsonKeys,
1606
2028
  blocks: nextBlocks,
@@ -1612,6 +2034,7 @@ export function syncIdePlugins(ide, allPlugins = []) {
1612
2034
  mode: "convert",
1613
2035
  summary: {
1614
2036
  skills: skillSync.nextLinks.length,
2037
+ apps: appSync.nextLinks.length,
1615
2038
  commands: commandsSyncedCount,
1616
2039
  mcp: mcpSyncedCount,
1617
2040
  rules: rulesSyncedCount,
@@ -2281,9 +2704,9 @@ export function getComponentsStorageSnapshot(hubRoot = resolveHubRoot()) {
2281
2704
  exists: false,
2282
2705
  timestamp: Date.now(),
2283
2706
  plugins: {},
2284
- rootComponents: { skills: {}, rules: {}, agents: {}, mcp: null, hooks: null },
2707
+ rootComponents: { skills: {}, rules: {}, agents: {}, apps: {}, mcp: null, hooks: null },
2285
2708
  hash: "empty",
2286
- summary: { pluginCount: 0, skillCount: 0, ruleCount: 0, agentCount: 0, mcpCount: 0, hookCount: 0 },
2709
+ summary: { pluginCount: 0, skillCount: 0, ruleCount: 0, agentCount: 0, mcpCount: 0, hookCount: 0, appCount: 0 },
2287
2710
  };
2288
2711
  }
2289
2712
 
@@ -2316,6 +2739,7 @@ export function getComponentsStorageSnapshot(hubRoot = resolveHubRoot()) {
2316
2739
  let totalAgents = 0;
2317
2740
  let totalMcps = 0;
2318
2741
  let totalHooks = 0;
2742
+ let totalApps = 0;
2319
2743
 
2320
2744
  if (fs.existsSync(pluginsDir)) {
2321
2745
  try {
@@ -2537,10 +2961,37 @@ export function getComponentsStorageSnapshot(hubRoot = resolveHubRoot()) {
2537
2961
  } catch {}
2538
2962
  }
2539
2963
 
2964
+ const rootApps = {};
2965
+ const rootAppsDir = path.join(cleanHub, "app");
2966
+ if (fs.existsSync(rootAppsDir)) {
2967
+ try {
2968
+ for (const a of fs.readdirSync(rootAppsDir)) {
2969
+ if (a.startsWith(".") || a === "node_modules") continue;
2970
+ const aPath = path.join(rootAppsDir, a);
2971
+ try {
2972
+ const aStat = fs.statSync(aPath);
2973
+ if (aStat.isDirectory()) {
2974
+ const appManifest = path.join(aPath, "app.json");
2975
+ let amStat = null;
2976
+ if (fs.existsSync(appManifest)) {
2977
+ try { amStat = fs.statSync(appManifest); } catch {}
2978
+ }
2979
+ rootApps[a] = {
2980
+ mtime: Math.round(amStat ? amStat.mtimeMs : aStat.mtimeMs),
2981
+ size: amStat ? amStat.size : 0,
2982
+ };
2983
+ totalApps++;
2984
+ }
2985
+ } catch {}
2986
+ }
2987
+ } catch {}
2988
+ }
2989
+
2540
2990
  const rootComponents = {
2541
2991
  skills: rootSkills,
2542
2992
  rules: rootRules,
2543
2993
  agents: rootAgents,
2994
+ apps: rootApps,
2544
2995
  mcp: rootMcp,
2545
2996
  hooks: rootHooks,
2546
2997
  };
@@ -2578,6 +3029,7 @@ export function getComponentsStorageSnapshot(hubRoot = resolveHubRoot()) {
2578
3029
  agentCount: totalAgents,
2579
3030
  mcpCount: totalMcps,
2580
3031
  hookCount: totalHooks,
3032
+ appCount: totalApps,
2581
3033
  },
2582
3034
  };
2583
3035
  }
@@ -2986,24 +3438,26 @@ export function collectAllComponentsUpstream(hubRoot = resolveHubRoot()) {
2986
3438
 
2987
3439
  for (const p of plugins) {
2988
3440
  let manifest = null;
2989
- const manifestPath = path.join(p.path, "plugin.json");
3441
+ const manifestPath = path.join(p.path, p.isApp ? "app.json" : "plugin.json");
2990
3442
  if (fs.existsSync(manifestPath)) {
2991
3443
  try { manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8")); } catch {}
2992
3444
  }
2993
- const pluginUpstream = extractComponentUpstream(p.path, "plugin", manifest);
3445
+ const pluginUpstream = extractComponentUpstream(p.path, p.isApp ? "app" : "plugin", manifest);
2994
3446
 
2995
3447
  components.push({
2996
3448
  id: p.id,
2997
3449
  name: p.name || p.id,
2998
- type: "plugin",
3450
+ type: p.isApp ? "app" : "plugin",
2999
3451
  version: p.version || "1.0.0",
3000
3452
  path: p.path,
3001
3453
  upstream: pluginUpstream,
3002
3454
  skillsCount: p.skills?.length || 0,
3003
3455
  rulesCount: p.rules?.length || 0,
3004
3456
  agentsCount: p.agents?.length || 0,
3457
+ appsCount: p.isApp ? 1 : (p.apps?.length || 0),
3005
3458
  hasMcp: Boolean(p.hasMcp),
3006
3459
  hasHooks: Boolean(p.hasHooks),
3460
+ hasApp: Boolean(p.hasApp || p.isApp),
3007
3461
  });
3008
3462
 
3009
3463
  // Check individual skills in plugin
@@ -3291,8 +3745,35 @@ export function verifyPluginWorkabilityOnDisk(plugin, ide, options = {}) {
3291
3745
 
3292
3746
  const profile = AGENT_PROFILES[normalized.agentType] || AGENT_PROFILES.custom;
3293
3747
 
3294
- // 1. Bundle Mode (e.g. Antigravity)
3295
- if (profile.mode === "bundle") {
3748
+ // 0. App Component Check (standalone app in <hubRoot>/app/<app-name>)
3749
+ if (plugin.isApp) {
3750
+ const appsDir = paths.apps || path.join(path.dirname(primaryDir), "apps");
3751
+ const appName = plugin.appName || plugin.id;
3752
+ const appLinkPath = path.join(appsDir, appName);
3753
+ if (!plugin.path || !fs.existsSync(plugin.path)) {
3754
+ return {
3755
+ ...base,
3756
+ workable: false,
3757
+ color: "red",
3758
+ status: "missing_on_disk",
3759
+ summary: `App source missing for "${appName}"`,
3760
+ tooltip: `๐Ÿ”ด Connection failed / Missing source: App directory "${plugin.path || appName}" does not exist on disk.`,
3761
+ reason: `App source directory "${plugin.path || appName}" not found`,
3762
+ };
3763
+ }
3764
+ if (!fs.existsSync(appLinkPath)) {
3765
+ return {
3766
+ ...base,
3767
+ workable: false,
3768
+ color: "red",
3769
+ status: "missing_on_disk",
3770
+ summary: `App "${appName}" missing on disk in ${ide.name || ide.id}`,
3771
+ tooltip: `๐Ÿ”ด Connection failed / Missing on disk: App "${appName}" is not linked in "${appsDir}".`,
3772
+ reason: `App "${appName}" is not deployed in "${appsDir}"`,
3773
+ };
3774
+ }
3775
+ } else if (profile.mode === "bundle") {
3776
+ // 1. Bundle Mode (e.g. Antigravity)
3296
3777
  const bundleDir = paths.bundle || primaryDir;
3297
3778
  const pluginBundleDir = path.join(bundleDir, plugin.id);
3298
3779
  if (!fs.existsSync(pluginBundleDir)) {
@@ -3523,15 +4004,18 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3523
4004
  const rawHooks = Array.isArray(plugin.hooks) ? plugin.hooks : [];
3524
4005
  const hasHooksInside = Boolean(plugin.hasHooks || rawHooks.length > 0);
3525
4006
 
3526
- const hasAnyFeature = hasSkillsInside || hasAgentsInside || hasMcpInside || hasRulesInside || hasHooksInside || (plugin.filesCount && plugin.filesCount > 0);
4007
+ const rawApps = Array.isArray(plugin.apps) ? plugin.apps : [];
4008
+ const hasAppInside = Boolean(plugin.isApp || plugin.hasApp || rawApps.length > 0);
4009
+
4010
+ const hasAnyFeature = hasSkillsInside || hasAgentsInside || hasMcpInside || hasRulesInside || hasHooksInside || hasAppInside || (plugin.filesCount && plugin.filesCount > 0);
3527
4011
  if (!hasAnyFeature && !plugin.path) {
3528
4012
  return {
3529
4013
  workable: false,
3530
4014
  color: "red",
3531
4015
  status: "failed",
3532
4016
  features: {},
3533
- quickActions: { slashCommands: [], mentions: [], hasSlash: false, hasMention: false, hasMcp: false, hasRules: false, hasHooks: false },
3534
- summary: "Empty component (no skills, MCP, rules, or agents found)",
4017
+ quickActions: { slashCommands: [], mentions: [], hasSlash: false, hasMention: false, hasMcp: false, hasRules: false, hasHooks: false, hasApp: false },
4018
+ summary: "Empty component (no skills, MCP, rules, agents, or apps found)",
3535
4019
  tooltip: `๐Ÿ”ด Connection failed: No workable components discovered in "${plugin.name || plugin.id}"`,
3536
4020
  reason: "No workable components discovered in plugin",
3537
4021
  };
@@ -3549,6 +4033,7 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3549
4033
  rules: isBundle || customPaths.rules ? true : (profile?.capabilities?.rules ?? true),
3550
4034
  agents: isBundle || customPaths.agents ? true : (profile?.capabilities?.agents ?? true),
3551
4035
  hooks: isBundle || customPaths.hooks ? true : (profile?.capabilities?.hooks ?? true),
4036
+ apps: isBundle || customPaths.apps ? true : (profile?.capabilities?.apps ?? true),
3552
4037
  };
3553
4038
 
3554
4039
  const features = {};
@@ -3667,6 +4152,27 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3667
4152
  };
3668
4153
  }
3669
4154
 
4155
+ // 6. Apps Check (only if present inside component)
4156
+ if (hasAppInside) {
4157
+ presentTypeCount++;
4158
+ const appNames = rawApps.length > 0 ? rawApps : [plugin.appName || plugin.name || plugin.id];
4159
+ const isSupported = capabilities.apps === true;
4160
+ if (isSupported) {
4161
+ workableCount++;
4162
+ actionParts.push(`App: ${appNames.join(", ")}`);
4163
+ detailedTooltipLines.push(`โœ“ App (${appNames.length}): ${appNames.join(", ")} active`);
4164
+ } else {
4165
+ detailedTooltipLines.push(`โœ— App (${appNames.length}): Skipped (unsupported by ${ide.name || ide.id})`);
4166
+ }
4167
+ features.apps = {
4168
+ present: true,
4169
+ count: appNames.length,
4170
+ workable: isSupported,
4171
+ items: appNames,
4172
+ reason: isSupported ? "Active" : `Unsupported by ${ide.name || ide.id}`,
4173
+ };
4174
+ }
4175
+
3670
4176
  // If component has types present but NONE of them are supported by this agent
3671
4177
  if (presentTypeCount > 0 && workableCount === 0) {
3672
4178
  return {
@@ -3682,6 +4188,7 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3682
4188
  hasMcp: false,
3683
4189
  hasRules: false,
3684
4190
  hasHooks: false,
4191
+ hasApp: false,
3685
4192
  },
3686
4193
  summary: `Incompatible with ${ide.name || ide.id}`,
3687
4194
  tooltip: `๐Ÿ”ด Incompatible with ${ide.name || ide.id}: All component types in "${plugin.name || plugin.id}" are unsupported.`,
@@ -3694,6 +4201,7 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3694
4201
  const hasMcp = hasMcpInside && capabilities.mcp === true;
3695
4202
  const hasRules = hasRulesInside && capabilities.rules === true;
3696
4203
  const hasHooks = hasHooksInside && capabilities.hooks === true;
4204
+ const hasApp = hasAppInside && capabilities.apps === true;
3697
4205
 
3698
4206
  const summary = `Workable in ${ide.name || ide.id}${actionParts.length > 0 ? " ยท " + actionParts.join(" ยท ") : ""}`;
3699
4207
  const baseTooltip = `๐ŸŸข Workable in ${ide.name || ide.id}: Connected & ready.${actionParts.length > 0 ? " Can be used with " + actionParts.join(" | ") : ""}`;
@@ -3712,6 +4220,7 @@ export function evaluateComponentAgentWorkability(plugin, ide, options = {}) {
3712
4220
  hasMcp,
3713
4221
  hasRules,
3714
4222
  hasHooks,
4223
+ hasApp,
3715
4224
  },
3716
4225
  summary,
3717
4226
  tooltip,
@@ -4293,13 +4802,14 @@ export function scanAgentForeignComponents(agentDef, hubConfig = null, plugins =
4293
4802
  if (normIde.configPath && fs.existsSync(normIde.configPath)) checkDirs.add(normIde.configPath);
4294
4803
  if (paths.primary && fs.existsSync(paths.primary)) checkDirs.add(paths.primary);
4295
4804
  if (paths.skills && fs.existsSync(paths.skills)) checkDirs.add(paths.skills);
4805
+ if (paths.apps && fs.existsSync(paths.apps)) checkDirs.add(paths.apps);
4296
4806
  if (paths.rules && fs.existsSync(paths.rules)) checkDirs.add(paths.rules);
4297
4807
  if (paths.agents && fs.existsSync(paths.agents)) checkDirs.add(paths.agents);
4298
4808
 
4299
- // Parent directories for plugins, skills, rules, agents subfolders
4809
+ // Parent directories for plugins, skills, rules, agents, apps subfolders
4300
4810
  for (const d of Array.from(checkDirs)) {
4301
4811
  const parent = path.dirname(d);
4302
- for (const sub of ["plugins", "skills", "rules", "agents"]) {
4812
+ for (const sub of ["plugins", "skills", "rules", "agents", "apps"]) {
4303
4813
  const subPath = path.join(parent, sub);
4304
4814
  if (fs.existsSync(subPath)) checkDirs.add(subPath);
4305
4815
  }