@minhpnq1807/contextos 0.5.4 → 0.5.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.5
4
+
5
+ - Discovers all skill roots containing `SKILL.md` under global/project `.gemini`, `.codex`, and `.claude` directories before `ctx sync --skills`.
6
+ - Skips temporary/cache directories such as `.tmp`, `.git`, and `node_modules` while discovering skill roots.
7
+
3
8
  ## 0.5.4
4
9
 
5
10
  - Bridges legacy Antigravity skill directories (`~/.gemini/antigravity/skills` and `~/.gemini/antigravity-cli/skills`) into the skillshare source before `ctx sync --skills`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhpnq1807/contextos",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
4
4
  "description": "Task-aware AGENTS.md context injection and compliance reporting for Codex, Claude Code, and Antigravity.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -122,7 +122,7 @@ export function detectExistingSkills({ cwd = process.cwd(), home = os.homedir()
122
122
  }
123
123
 
124
124
  function skillRoots({ cwd, home }) {
125
- return [
125
+ return uniquePaths([
126
126
  path.join(home, ".claude", "skills"),
127
127
  path.join(home, ".codex", "skills"),
128
128
  path.join(home, ".gemini", "antigravity", "skills"),
@@ -130,17 +130,67 @@ function skillRoots({ cwd, home }) {
130
130
  path.join(cwd, ".claude", "skills"),
131
131
  path.join(cwd, ".codex", "skills"),
132
132
  path.join(cwd, ".gemini", "antigravity", "skills"),
133
- path.join(cwd, ".gemini", "antigravity-cli", "skills")
134
- ];
133
+ path.join(cwd, ".gemini", "antigravity-cli", "skills"),
134
+ ...discoverSkillRoots({ cwd, home })
135
+ ]);
135
136
  }
136
137
 
137
138
  function antigravityLegacyRoots({ cwd, home }) {
138
- return [
139
+ return uniquePaths([
139
140
  path.join(home, ".gemini", "antigravity", "skills"),
140
141
  path.join(home, ".gemini", "antigravity-cli", "skills"),
141
142
  path.join(cwd, ".gemini", "antigravity", "skills"),
142
- path.join(cwd, ".gemini", "antigravity-cli", "skills")
143
- ];
143
+ path.join(cwd, ".gemini", "antigravity-cli", "skills"),
144
+ ...discoverSkillRoots({ cwd, home })
145
+ ]);
146
+ }
147
+
148
+ export function discoverSkillRoots({ cwd = process.cwd(), home = os.homedir() } = {}) {
149
+ const roots = [];
150
+ for (const base of [
151
+ path.join(home, ".gemini"),
152
+ path.join(home, ".codex"),
153
+ path.join(home, ".claude"),
154
+ path.join(cwd, ".gemini"),
155
+ path.join(cwd, ".codex"),
156
+ path.join(cwd, ".claude")
157
+ ]) {
158
+ findSkillRoots(base, 0, roots);
159
+ }
160
+ return uniquePaths(roots);
161
+ }
162
+
163
+ function findSkillRoots(directory, depth, roots) {
164
+ if (depth > 5) return;
165
+ let entries = [];
166
+ try {
167
+ entries = fs.readdirSync(directory, { withFileTypes: true });
168
+ } catch {
169
+ return;
170
+ }
171
+ if (entries.some((entry) => entry.isFile() && entry.name === "SKILL.md")) {
172
+ roots.push(path.dirname(directory));
173
+ return;
174
+ }
175
+ for (const entry of entries) {
176
+ if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
177
+ if (entry.name === ".git" || entry.name === ".tmp" || entry.name === "node_modules") continue;
178
+ const fullPath = path.join(directory, entry.name);
179
+ if (entry.isSymbolicLink() && !safeStat(fullPath)?.isDirectory()) continue;
180
+ findSkillRoots(fullPath, depth + 1, roots);
181
+ }
182
+ }
183
+
184
+ function uniquePaths(paths) {
185
+ const seen = new Set();
186
+ const result = [];
187
+ for (const item of paths) {
188
+ const normalized = path.resolve(item);
189
+ if (seen.has(normalized)) continue;
190
+ seen.add(normalized);
191
+ result.push(item);
192
+ }
193
+ return result;
144
194
  }
145
195
 
146
196
  function countSkillFiles(root) {