agent-config-sync 0.3.2 → 0.4.0

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.
@@ -3,11 +3,7 @@ import type { ProjectDiscovery, TargetName } from './types.js';
3
3
  declare const TARGET_SKILLS_PATHS: Record<TargetName, string>;
4
4
  /**
5
5
  * Discover the active project from the current working directory.
6
- *
7
- * Priority:
8
- * 1. Nearest ancestor that is a Git repository root (excluding home directory)
9
- * 2. Nearest ancestor containing any supported native config file
10
- * 3. Fail with clear error
6
+ * Uses the current directory as the project root.
11
7
  */
12
8
  export declare function discoverProject(cwd?: string): Promise<ProjectDiscovery>;
13
9
  /**
@@ -16,116 +16,23 @@ const TARGET_SKILLS_PATHS = {
16
16
  codex: path.join('.codex', 'skills'),
17
17
  gemini: path.join('.gemini', 'antigravity', 'skills'),
18
18
  };
19
- /** Project marker files that indicate a real project directory */
20
- const PROJECT_MARKERS = [
21
- 'package.json',
22
- 'tsconfig.json',
23
- 'Cargo.toml',
24
- 'go.mod',
25
- 'pyproject.toml',
26
- 'Gemfile',
27
- 'composer.json',
28
- '.gitignore',
29
- 'README.md',
30
- ];
31
19
  // ============================================================================
32
20
  // Project Discovery
33
21
  // ============================================================================
34
22
  /**
35
23
  * Discover the active project from the current working directory.
36
- *
37
- * Priority:
38
- * 1. Nearest ancestor that is a Git repository root (excluding home directory)
39
- * 2. Nearest ancestor containing any supported native config file
40
- * 3. Fail with clear error
24
+ * Uses the current directory as the project root.
41
25
  */
42
26
  export async function discoverProject(cwd = process.cwd()) {
43
- const gitRoot = await findGitRoot(cwd);
44
- const projectRoot = gitRoot ?? (await findNativeConfigRoot(cwd));
45
- if (!projectRoot) {
46
- throw new Error('Not inside a managed project. ' +
47
- 'Navigate to a Git repository or a directory with native agent config files.');
48
- }
49
- const targets = await resolveNativeConfigPaths(projectRoot);
50
- return { root: projectRoot, targets };
51
- }
52
- /**
53
- * Find the nearest Git repository root by traversing upwards.
54
- * Excludes home directory to prevent false positives.
55
- */
56
- async function findGitRoot(cwd) {
57
- let current = path.resolve(cwd);
58
- const homeDir = os.homedir();
59
- while (true) {
60
- // Skip home directory
61
- if (current === homeDir || current === path.dirname(homeDir)) {
62
- return null;
63
- }
64
- const gitDir = path.join(current, '.git');
65
- try {
66
- const stat = await fs.stat(gitDir);
67
- if (stat.isDirectory()) {
68
- // Verify this looks like a real project (has project markers)
69
- if (await hasProjectMarkers(current)) {
70
- return current;
71
- }
72
- }
73
- }
74
- catch {
75
- // .git doesn't exist, continue
76
- }
77
- const parent = path.dirname(current);
78
- if (parent === current) {
79
- // Reached root
80
- return null;
81
- }
82
- current = parent;
83
- }
84
- }
85
- /**
86
- * Check if directory contains project marker files.
87
- */
88
- async function hasProjectMarkers(dir) {
89
- for (const marker of PROJECT_MARKERS) {
90
- try {
91
- await fs.access(path.join(dir, marker));
92
- return true;
93
- }
94
- catch {
95
- // Marker doesn't exist
96
- }
97
- }
98
- return false;
99
- }
100
- /**
101
- * Find the nearest ancestor containing any supported native config file.
102
- * Excludes home directory.
103
- */
104
- async function findNativeConfigRoot(cwd) {
105
- let current = path.resolve(cwd);
27
+ const currentDir = path.resolve(cwd);
106
28
  const homeDir = os.homedir();
107
- while (true) {
108
- // Skip home directory
109
- if (current === homeDir || current === path.dirname(homeDir)) {
110
- return null;
111
- }
112
- for (const targetPath of Object.values(TARGET_CONFIG_PATHS)) {
113
- const fullPath = path.join(current, targetPath);
114
- try {
115
- await fs.access(fullPath);
116
- return current;
117
- }
118
- catch {
119
- // File doesn't exist, try next
120
- }
121
- }
122
- const parent = path.dirname(current);
123
- if (parent === current) {
124
- // Reached root
125
- return null;
126
- }
127
- current = parent;
29
+ // Prevent using home directory as project root
30
+ if (currentDir === homeDir || currentDir === path.dirname(homeDir)) {
31
+ throw new Error('Cannot use home directory as project root. ' +
32
+ 'Navigate to a project directory first.');
128
33
  }
34
+ const targets = await resolveNativeConfigPaths(currentDir);
35
+ return { root: currentDir, targets };
129
36
  }
130
37
  /**
131
38
  * Resolve native config paths for all targets relative to the project root.
@@ -1 +1 @@
1
- {"version":3,"file":"project-discovery.js","sourceRoot":"","sources":["../src/project-discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AAGzB,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,wEAAwE;AACxE,MAAM,mBAAmB,GAA+B;IACtD,MAAM,EAAE,WAAW;IACnB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC;IACzC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC;CAC9C,CAAC;AAEF,sEAAsE;AACtE,MAAM,mBAAmB,GAA+B;IACtD,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;IACtC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC;IACpC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,aAAa,EAAE,QAAQ,CAAC;CACtD,CAAC;AAEF,kEAAkE;AAClE,MAAM,eAAe,GAAG;IACtB,cAAc;IACd,eAAe;IACf,YAAY;IACZ,QAAQ;IACR,gBAAgB;IAChB,SAAS;IACT,eAAe;IACf,YAAY;IACZ,WAAW;CACZ,CAAC;AAEF,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC/D,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,WAAW,GAAG,OAAO,IAAI,CAAC,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IAEjE,IAAI,CAAC,WAAW,EAAE,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C,WAAW,EAAE,YAAY,CAAC,CAAC;QACtD,IAAI,MAAM,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC;YACH,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;QAAC,MAAM,CAAC;YACP,qBAAqB;QACvB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;YAClB,MAAM;YACN,IAAI,EAAE,QAAQ;YACd,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,MAAkB;IAC3E,OAAO,mBAAmB,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB,EAAE,MAAkB;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED;;GAEG;AACH,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-config-sync",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Cross-agent configuration manager for MCP servers and skills. Directly edits native config files—no manifest, no sync step.",
5
5
  "type": "module",
6
6
  "bin": {