cortex-agents 2.1.0 → 2.2.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.
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Information about the current worktree context.
3
+ */
4
+ export interface WorktreeInfo {
5
+ /** True if the current directory is a linked worktree (not the main working tree) */
6
+ isWorktree: boolean;
7
+ /** The current branch name */
8
+ currentBranch: string;
9
+ /** The absolute path to the main working tree (null if detection fails) */
10
+ mainWorktreePath: string | null;
11
+ }
12
+ /**
13
+ * Detect whether the current git directory is a linked worktree.
14
+ *
15
+ * Uses the canonical method: compare resolved absolute paths of
16
+ * `git rev-parse --git-dir` vs `--git-common-dir`.
17
+ * In a linked worktree these differ; in the main tree they're identical.
18
+ */
19
+ export declare function detectWorktreeInfo(cwd: string): Promise<WorktreeInfo>;
20
+ //# sourceMappingURL=worktree-detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktree-detect.d.ts","sourceRoot":"","sources":["../../src/utils/worktree-detect.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qFAAqF;IACrF,UAAU,EAAE,OAAO,CAAC;IACpB,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAqC3E"}
@@ -0,0 +1,42 @@
1
+ import * as path from "path";
2
+ /**
3
+ * Detect whether the current git directory is a linked worktree.
4
+ *
5
+ * Uses the canonical method: compare resolved absolute paths of
6
+ * `git rev-parse --git-dir` vs `--git-common-dir`.
7
+ * In a linked worktree these differ; in the main tree they're identical.
8
+ */
9
+ export async function detectWorktreeInfo(cwd) {
10
+ const result = {
11
+ isWorktree: false,
12
+ currentBranch: "",
13
+ mainWorktreePath: null,
14
+ };
15
+ // Get current branch
16
+ try {
17
+ const branch = await Bun.$ `git -C ${cwd} branch --show-current`.quiet().text();
18
+ result.currentBranch = branch.trim();
19
+ }
20
+ catch {
21
+ result.currentBranch = "(unknown)";
22
+ }
23
+ // Compare git-dir and git-common-dir
24
+ try {
25
+ const gitDirRaw = await Bun.$ `git -C ${cwd} rev-parse --git-dir`.quiet().text();
26
+ const commonDirRaw = await Bun.$ `git -C ${cwd} rev-parse --git-common-dir`.quiet().text();
27
+ // Resolve both to absolute paths for reliable comparison
28
+ const absGitDir = path.resolve(cwd, gitDirRaw.trim());
29
+ const absCommonDir = path.resolve(cwd, commonDirRaw.trim());
30
+ result.isWorktree = absGitDir !== absCommonDir;
31
+ // If it's a worktree, the main working tree is one level above the common .git dir
32
+ if (result.isWorktree) {
33
+ // git-common-dir points to the main repo's .git directory
34
+ // The main worktree is its parent
35
+ result.mainWorktreePath = path.dirname(absCommonDir);
36
+ }
37
+ }
38
+ catch {
39
+ // If detection fails, assume not a worktree
40
+ }
41
+ return result;
42
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cortex-agents",
3
- "version": "2.1.0",
4
- "description": "Model-agnostic agents for OpenCode - agent handover notifications, mermaid documentation, interactive model configuration, worktree workflow, and plan persistence",
3
+ "version": "2.2.0",
4
+ "description": "Supercharge OpenCode with structured workflows, intelligent agents, and automated development practices",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -30,17 +30,20 @@
30
30
  "planning",
31
31
  "mermaid",
32
32
  "documentation",
33
- "notifications"
33
+ "notifications",
34
+ "workflow",
35
+ "pull-request",
36
+ "developer-tools"
34
37
  ],
35
38
  "author": "",
36
39
  "license": "Apache-2.0",
37
40
  "repository": {
38
41
  "type": "git",
39
- "url": "https://github.com/your-org/cortex-agents"
42
+ "url": "https://github.com/ps-carvalho/cortex-agents"
40
43
  },
41
- "homepage": "https://github.com/your-org/cortex-agents#readme",
44
+ "homepage": "https://github.com/ps-carvalho/cortex-agents#readme",
42
45
  "bugs": {
43
- "url": "https://github.com/your-org/cortex-agents/issues"
46
+ "url": "https://github.com/ps-carvalho/cortex-agents/issues"
44
47
  },
45
48
  "engines": {
46
49
  "node": ">=18.0.0"