@google/jules-merge 0.0.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.
- package/README.md +201 -0
- package/dist/cli/check-conflicts.command.mjs +387 -0
- package/dist/cli/index.mjs +28 -0
- package/dist/cli/init.command.mjs +159 -0
- package/dist/core/src/activities/client.d.ts +131 -0
- package/dist/core/src/activities/summary.d.ts +22 -0
- package/dist/core/src/activities/types.d.ts +79 -0
- package/dist/core/src/api.d.ts +49 -0
- package/dist/core/src/artifacts.d.ts +105 -0
- package/dist/core/src/caching.d.ts +31 -0
- package/dist/core/src/client.d.ts +180 -0
- package/dist/core/src/errors.d.ts +97 -0
- package/dist/core/src/index.d.ts +49 -0
- package/dist/core/src/mappers.d.ts +53 -0
- package/dist/core/src/network/adapter.d.ts +47 -0
- package/dist/core/src/platform/node.d.ts +45 -0
- package/dist/core/src/platform/types.d.ts +88 -0
- package/dist/core/src/polling.d.ts +43 -0
- package/dist/core/src/query/computed.d.ts +86 -0
- package/dist/core/src/query/projection.d.ts +80 -0
- package/dist/core/src/query/schema.d.ts +124 -0
- package/dist/core/src/query/select.d.ts +21 -0
- package/dist/core/src/query/validate.d.ts +68 -0
- package/dist/core/src/session.d.ts +195 -0
- package/dist/core/src/sessions.d.ts +87 -0
- package/dist/core/src/snapshot.d.ts +46 -0
- package/dist/core/src/sources.d.ts +23 -0
- package/dist/core/src/storage/cache-info.d.ts +43 -0
- package/dist/core/src/storage/memory.d.ts +69 -0
- package/dist/core/src/storage/node-fs.d.ts +95 -0
- package/dist/core/src/storage/root.d.ts +17 -0
- package/dist/core/src/storage/types.d.ts +115 -0
- package/dist/core/src/streaming.d.ts +47 -0
- package/dist/core/src/types.d.ts +1418 -0
- package/dist/core/src/utils/page-token.d.ts +55 -0
- package/dist/core/src/utils.d.ts +27 -0
- package/dist/index.mjs +395 -0
- package/dist/merge/src/__tests__/conflicts/git-handler.test.d.ts +1 -0
- package/dist/merge/src/__tests__/conflicts/git-spec.test.d.ts +1 -0
- package/dist/merge/src/__tests__/conflicts/session-handler.test.d.ts +1 -0
- package/dist/merge/src/__tests__/conflicts/session-spec.test.d.ts +1 -0
- package/dist/merge/src/__tests__/init/init-handler.test.d.ts +1 -0
- package/dist/merge/src/__tests__/init/init-spec.test.d.ts +1 -0
- package/dist/merge/src/__tests__/init/templates.test.d.ts +1 -0
- package/dist/merge/src/__tests__/shared/git.test.d.ts +1 -0
- package/dist/merge/src/__tests__/shared/github.test.d.ts +1 -0
- package/dist/merge/src/__tests__/shared/session.test.d.ts +1 -0
- package/dist/merge/src/cli/check-conflicts.command.d.ts +24 -0
- package/dist/merge/src/cli/index.d.ts +2 -0
- package/dist/merge/src/cli/init.command.d.ts +23 -0
- package/dist/merge/src/conflicts/git-handler.d.ts +4 -0
- package/dist/merge/src/conflicts/git-spec.d.ts +43 -0
- package/dist/merge/src/conflicts/index.d.ts +4 -0
- package/dist/merge/src/conflicts/session-handler.d.ts +9 -0
- package/dist/merge/src/conflicts/session-spec.d.ts +43 -0
- package/dist/merge/src/index.d.ts +5 -0
- package/dist/merge/src/init/index.d.ts +4 -0
- package/dist/merge/src/init/init-handler.d.ts +4 -0
- package/dist/merge/src/init/init-spec.d.ts +41 -0
- package/dist/merge/src/init/templates.d.ts +10 -0
- package/dist/merge/src/mcp/index.d.ts +1 -0
- package/dist/merge/src/mcp/server.d.ts +2 -0
- package/dist/merge/src/shared/git.d.ts +17 -0
- package/dist/merge/src/shared/github.d.ts +18 -0
- package/dist/merge/src/shared/result.d.ts +19 -0
- package/dist/merge/src/shared/session.d.ts +16 -0
- package/package.json +60 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const InitInputSchema: z.ZodObject<{
|
|
3
|
+
outputDir: z.ZodDefault<z.ZodString>;
|
|
4
|
+
workflowName: z.ZodDefault<z.ZodString>;
|
|
5
|
+
baseBranch: z.ZodDefault<z.ZodString>;
|
|
6
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
force: boolean;
|
|
9
|
+
outputDir: string;
|
|
10
|
+
workflowName: string;
|
|
11
|
+
baseBranch: string;
|
|
12
|
+
}, {
|
|
13
|
+
force?: boolean | undefined;
|
|
14
|
+
outputDir?: string | undefined;
|
|
15
|
+
workflowName?: string | undefined;
|
|
16
|
+
baseBranch?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type InitInput = z.infer<typeof InitInputSchema>;
|
|
19
|
+
export declare const InitErrorCode: z.ZodEnum<["DIRECTORY_NOT_FOUND", "FILE_ALREADY_EXISTS", "WRITE_FAILED", "UNKNOWN_ERROR"]>;
|
|
20
|
+
export type InitErrorCode = z.infer<typeof InitErrorCode>;
|
|
21
|
+
export interface InitData {
|
|
22
|
+
filePath: string;
|
|
23
|
+
content: string;
|
|
24
|
+
}
|
|
25
|
+
export interface InitSuccess {
|
|
26
|
+
success: true;
|
|
27
|
+
data: InitData;
|
|
28
|
+
}
|
|
29
|
+
export interface InitFailure {
|
|
30
|
+
success: false;
|
|
31
|
+
error: {
|
|
32
|
+
code: InitErrorCode;
|
|
33
|
+
message: string;
|
|
34
|
+
recoverable: boolean;
|
|
35
|
+
suggestion?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export type InitResult = InitSuccess | InitFailure;
|
|
39
|
+
export interface InitSpec {
|
|
40
|
+
execute(input: InitInput): Promise<InitResult>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface WorkflowTemplateOptions {
|
|
2
|
+
workflowName: string;
|
|
3
|
+
baseBranch: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Build the GitHub Actions workflow YAML for merge conflict detection.
|
|
7
|
+
* Isolated from handler logic so template changes never conflict with
|
|
8
|
+
* file-writing logic changes.
|
|
9
|
+
*/
|
|
10
|
+
export declare function buildWorkflowYaml(options: WorkflowTemplateOptions): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createMergeServer } from './server.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type GitResult<T> = {
|
|
2
|
+
ok: true;
|
|
3
|
+
data: T;
|
|
4
|
+
} | {
|
|
5
|
+
ok: false;
|
|
6
|
+
error: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* List files with unmerged status (UU) from git status.
|
|
10
|
+
* Used only by the CI failure handler.
|
|
11
|
+
*/
|
|
12
|
+
export declare function gitStatusUnmerged(cwd?: string): Promise<GitResult<string[]>>;
|
|
13
|
+
/**
|
|
14
|
+
* Find the merge base between two commits.
|
|
15
|
+
* Used only by the CI failure handler.
|
|
16
|
+
*/
|
|
17
|
+
export declare function gitMergeBase(head: string, base: string, cwd?: string): Promise<GitResult<string>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Octokit } from '@octokit/rest';
|
|
2
|
+
/**
|
|
3
|
+
* Create an authenticated Octokit instance.
|
|
4
|
+
*
|
|
5
|
+
* Auth priority (matches @google/jules-fleet):
|
|
6
|
+
* 1. GitHub App (GITHUB_APP_ID + GITHUB_APP_PRIVATE_KEY[_BASE64] + GITHUB_APP_INSTALLATION_ID)
|
|
7
|
+
* 2. PAT fallback (GITHUB_TOKEN or GH_TOKEN)
|
|
8
|
+
*/
|
|
9
|
+
export declare function createOctokit(): Octokit;
|
|
10
|
+
/**
|
|
11
|
+
* Compare two commits and return the list of changed file paths.
|
|
12
|
+
*/
|
|
13
|
+
export declare function compareCommits(octokit: Octokit, owner: string, repo: string, base: string, head: string): Promise<string[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the content of a file from a specific ref.
|
|
16
|
+
* Returns empty string if file is not found (404).
|
|
17
|
+
*/
|
|
18
|
+
export declare function getFileContent(octokit: Octokit, owner: string, repo: string, path: string, ref: string): Promise<string>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result helper for success responses.
|
|
3
|
+
*/
|
|
4
|
+
export declare function ok<T>(data: T): {
|
|
5
|
+
success: true;
|
|
6
|
+
data: T;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Result helper for failure responses.
|
|
10
|
+
*/
|
|
11
|
+
export declare function fail<TCode extends string>(code: TCode, message: string, recoverable?: boolean, suggestion?: string): {
|
|
12
|
+
success: false;
|
|
13
|
+
error: {
|
|
14
|
+
code: TCode;
|
|
15
|
+
message: string;
|
|
16
|
+
recoverable: boolean;
|
|
17
|
+
suggestion?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JulesClient } from '@google/jules-sdk';
|
|
2
|
+
export { jules as createJulesClient } from '@google/jules-sdk';
|
|
3
|
+
export interface SessionFileInfo {
|
|
4
|
+
path: string;
|
|
5
|
+
changeType: 'created' | 'modified' | 'deleted';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Get the list of files changed in a Jules session.
|
|
9
|
+
*
|
|
10
|
+
* Dual-mode:
|
|
11
|
+
* - If session is busy (in-progress): aggregates changeSet artifacts from activities
|
|
12
|
+
* - If session is stable (completed): uses the session outcome's changeSet
|
|
13
|
+
*
|
|
14
|
+
* Modeled after packages/mcp/src/functions/code-review.ts#aggregateFromActivities
|
|
15
|
+
*/
|
|
16
|
+
export declare function getSessionChangedFiles(client: JulesClient, sessionId: string): Promise<SessionFileInfo[]>;
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@google/jules-merge",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Predictive conflict detection for parallel AI agents",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"jules-merge": "./dist/cli/index.mjs"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build:js": "bun run build.ts",
|
|
23
|
+
"build:types": "tsc --emitDeclarationOnly --outDir dist",
|
|
24
|
+
"build": "bun run build:js && bun run build:types",
|
|
25
|
+
"test": "vitest",
|
|
26
|
+
"typecheck": "tsc --noEmit"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/google-labs-code/jules-sdk.git"
|
|
31
|
+
},
|
|
32
|
+
"author": "Google LLC",
|
|
33
|
+
"license": "Apache-2.0",
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"registry": "https://wombat-dressing-room.appspot.com",
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@google/jules-sdk": "^0.1.0",
|
|
40
|
+
"@octokit/auth-app": "^8.2.0",
|
|
41
|
+
"@octokit/rest": "^21.0.0",
|
|
42
|
+
"citty": "^0.1.6",
|
|
43
|
+
"zod": "^3.25.0"
|
|
44
|
+
},
|
|
45
|
+
"peerDependencies": {
|
|
46
|
+
"@modelcontextprotocol/sdk": "^1.25.1"
|
|
47
|
+
},
|
|
48
|
+
"peerDependenciesMeta": {
|
|
49
|
+
"@modelcontextprotocol/sdk": {
|
|
50
|
+
"optional": true
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
55
|
+
"@types/bun": "^1.3.9",
|
|
56
|
+
"@types/node": "^22.15.0",
|
|
57
|
+
"typescript": "^5.8.3",
|
|
58
|
+
"vitest": "^3.2.4"
|
|
59
|
+
}
|
|
60
|
+
}
|