@devframes/service-git 0.9.12 → 0.9.16
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/dist/index.d.mts +28 -28
- package/dist/index.mjs +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DevframeServiceDefinition } from "devframe/types";
|
|
2
2
|
//#region src/types.d.ts
|
|
3
|
-
type FileStatusCode = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'type-changed' | 'unmerged' | 'unknown';
|
|
4
|
-
interface StatusFileEntry {
|
|
3
|
+
export type FileStatusCode = 'modified' | 'added' | 'deleted' | 'renamed' | 'copied' | 'type-changed' | 'unmerged' | 'unknown';
|
|
4
|
+
export interface StatusFileEntry {
|
|
5
5
|
path: string;
|
|
6
6
|
/** Previous path, present for renames and copies. */
|
|
7
7
|
from?: string;
|
|
8
8
|
status: FileStatusCode;
|
|
9
9
|
}
|
|
10
|
-
interface GitStatus {
|
|
10
|
+
export interface GitStatus {
|
|
11
11
|
/** `false` when the working directory is not inside a git repository. */
|
|
12
12
|
isRepo: boolean;
|
|
13
13
|
root: string | null;
|
|
@@ -27,7 +27,7 @@ interface GitStatus {
|
|
|
27
27
|
/** `true` when stage / unstage / commit actions are available. */
|
|
28
28
|
canWrite: boolean;
|
|
29
29
|
}
|
|
30
|
-
interface Commit {
|
|
30
|
+
export interface Commit {
|
|
31
31
|
hash: string;
|
|
32
32
|
shortHash: string;
|
|
33
33
|
author: string;
|
|
@@ -41,7 +41,7 @@ interface Commit {
|
|
|
41
41
|
/** Full parent hashes; drives the commit graph. */
|
|
42
42
|
parents: string[];
|
|
43
43
|
}
|
|
44
|
-
interface GitLog {
|
|
44
|
+
export interface GitLog {
|
|
45
45
|
isRepo: boolean;
|
|
46
46
|
commits: Commit[];
|
|
47
47
|
limit: number;
|
|
@@ -49,7 +49,7 @@ interface GitLog {
|
|
|
49
49
|
/** `true` when the page filled to `limit`, hinting at further history. */
|
|
50
50
|
hasMore: boolean;
|
|
51
51
|
}
|
|
52
|
-
interface LogArgs {
|
|
52
|
+
export interface LogArgs {
|
|
53
53
|
/** Number of commits to return (clamped to 1–200, default 30). */
|
|
54
54
|
limit?: number;
|
|
55
55
|
/** Commits to skip from the tip, for pagination (default 0). */
|
|
@@ -59,7 +59,7 @@ interface LogArgs {
|
|
|
59
59
|
/** Restrict history to commits that touched these repo-relative path(s). */
|
|
60
60
|
paths?: string[];
|
|
61
61
|
}
|
|
62
|
-
interface Branch {
|
|
62
|
+
export interface Branch {
|
|
63
63
|
name: string;
|
|
64
64
|
current: boolean;
|
|
65
65
|
sha: string;
|
|
@@ -70,12 +70,12 @@ interface Branch {
|
|
|
70
70
|
/** `true` when the upstream branch no longer exists. */
|
|
71
71
|
gone: boolean;
|
|
72
72
|
}
|
|
73
|
-
interface GitBranches {
|
|
73
|
+
export interface GitBranches {
|
|
74
74
|
isRepo: boolean;
|
|
75
75
|
current: string | null;
|
|
76
76
|
branches: Branch[];
|
|
77
77
|
}
|
|
78
|
-
interface Tag {
|
|
78
|
+
export interface Tag {
|
|
79
79
|
name: string;
|
|
80
80
|
/** Short SHA of the commit the tag ultimately points to. */
|
|
81
81
|
sha: string;
|
|
@@ -90,18 +90,18 @@ interface Tag {
|
|
|
90
90
|
/** `true` for annotated tags, which carry their own message and date. */
|
|
91
91
|
annotated: boolean;
|
|
92
92
|
}
|
|
93
|
-
interface GitTags {
|
|
93
|
+
export interface GitTags {
|
|
94
94
|
isRepo: boolean;
|
|
95
95
|
/** Tags, newest creation date first. */
|
|
96
96
|
tags: Tag[];
|
|
97
97
|
}
|
|
98
|
-
interface ReadFileArgs {
|
|
98
|
+
export interface ReadFileArgs {
|
|
99
99
|
/** Repo-relative path to the file. */
|
|
100
100
|
path: string;
|
|
101
101
|
/** Commit-ish to read the file from (default: current HEAD). */
|
|
102
102
|
ref?: string;
|
|
103
103
|
}
|
|
104
|
-
interface GitFile {
|
|
104
|
+
export interface GitFile {
|
|
105
105
|
/** `false` when the working directory is not inside a git repository. */
|
|
106
106
|
isRepo: boolean;
|
|
107
107
|
/** `false` when no blob exists at `path` for `ref`. */
|
|
@@ -116,13 +116,13 @@ interface GitFile {
|
|
|
116
116
|
/** `true` when `content` was clipped to the internal char limit. */
|
|
117
117
|
truncated: boolean;
|
|
118
118
|
}
|
|
119
|
-
interface DiffFile {
|
|
119
|
+
export interface DiffFile {
|
|
120
120
|
path: string;
|
|
121
121
|
additions: number;
|
|
122
122
|
deletions: number;
|
|
123
123
|
binary: boolean;
|
|
124
124
|
}
|
|
125
|
-
interface GitDiff {
|
|
125
|
+
export interface GitDiff {
|
|
126
126
|
isRepo: boolean;
|
|
127
127
|
staged: boolean;
|
|
128
128
|
path: string | null;
|
|
@@ -134,13 +134,13 @@ interface GitDiff {
|
|
|
134
134
|
/** `true` when `patch` was clipped to the internal char limit. */
|
|
135
135
|
truncated: boolean;
|
|
136
136
|
}
|
|
137
|
-
interface DiffArgs {
|
|
137
|
+
export interface DiffArgs {
|
|
138
138
|
/** Limit the diff to a single path; omit for the whole tree. */
|
|
139
139
|
path?: string;
|
|
140
140
|
/** Diff the index against HEAD instead of the working tree. */
|
|
141
141
|
staged?: boolean;
|
|
142
142
|
}
|
|
143
|
-
interface CommitFile {
|
|
143
|
+
export interface CommitFile {
|
|
144
144
|
path: string;
|
|
145
145
|
additions: number;
|
|
146
146
|
deletions: number;
|
|
@@ -148,7 +148,7 @@ interface CommitFile {
|
|
|
148
148
|
/** Change kind relative to the parent (add / modify / delete / rename …). */
|
|
149
149
|
status: FileStatusCode;
|
|
150
150
|
}
|
|
151
|
-
interface CommitDetail {
|
|
151
|
+
export interface CommitDetail {
|
|
152
152
|
/** `false` when the working directory is not inside a git repository. */
|
|
153
153
|
isRepo: boolean;
|
|
154
154
|
/** `false` when the hash does not resolve to a commit. */
|
|
@@ -175,25 +175,25 @@ interface CommitDetail {
|
|
|
175
175
|
/** `true` when `patch` was clipped to the internal char limit. */
|
|
176
176
|
truncated: boolean;
|
|
177
177
|
}
|
|
178
|
-
interface ShowArgs {
|
|
178
|
+
export interface ShowArgs {
|
|
179
179
|
/** Commit-ish to inspect (full or short hash). */
|
|
180
180
|
hash: string;
|
|
181
181
|
/** Include the full unified patch (default `true`). */
|
|
182
182
|
patch?: boolean;
|
|
183
183
|
}
|
|
184
|
-
interface StageArgs {
|
|
184
|
+
export interface StageArgs {
|
|
185
185
|
/** Paths to stage (`git add`). */
|
|
186
186
|
paths: string[];
|
|
187
187
|
}
|
|
188
|
-
interface UnstageArgs {
|
|
188
|
+
export interface UnstageArgs {
|
|
189
189
|
/** Paths to unstage (`git restore --staged`). */
|
|
190
190
|
paths: string[];
|
|
191
191
|
}
|
|
192
|
-
interface CommitArgs {
|
|
192
|
+
export interface CommitArgs {
|
|
193
193
|
/** Commit message. */
|
|
194
194
|
message: string;
|
|
195
195
|
}
|
|
196
|
-
interface CommitResult {
|
|
196
|
+
export interface CommitResult {
|
|
197
197
|
/** `true` when the commit succeeded. */
|
|
198
198
|
ok: boolean;
|
|
199
199
|
/** Short hash of the new commit, or `null` on failure. */
|
|
@@ -204,7 +204,7 @@ interface CommitResult {
|
|
|
204
204
|
status: GitStatus;
|
|
205
205
|
}
|
|
206
206
|
/** The node API a consumer gets from `ctx.services.get('@devframes/service-git')`. */
|
|
207
|
-
interface GitServiceApi {
|
|
207
|
+
export interface GitServiceApi {
|
|
208
208
|
status: () => Promise<GitStatus>;
|
|
209
209
|
log: (args?: LogArgs) => Promise<GitLog>;
|
|
210
210
|
show: (args: ShowArgs) => Promise<CommitDetail>;
|
|
@@ -218,9 +218,9 @@ interface GitServiceApi {
|
|
|
218
218
|
}
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/index.d.ts
|
|
221
|
-
declare const GIT_SERVICE_PACKAGE = "@devframes/service-git";
|
|
222
|
-
declare const GIT_SERVICE_SCOPE = "devframes:service:git";
|
|
223
|
-
interface GitServiceOptions {
|
|
221
|
+
export declare const GIT_SERVICE_PACKAGE = "@devframes/service-git";
|
|
222
|
+
export declare const GIT_SERVICE_SCOPE = "devframes:service:git";
|
|
223
|
+
export interface GitServiceOptions {
|
|
224
224
|
/**
|
|
225
225
|
* Repository directory to operate on. Defaults to the context's `cwd`; the
|
|
226
226
|
* repo root is discovered once (`rev-parse --show-toplevel`) and memoized.
|
|
@@ -256,6 +256,6 @@ declare module 'devframe' {
|
|
|
256
256
|
* authorization is the host's connection-trust boundary. The service defines
|
|
257
257
|
* no `dump`/`snapshot`; a devframe bakes what it needs via `snapshotRpc`.
|
|
258
258
|
*/
|
|
259
|
-
declare function createGitService(options?: GitServiceOptions): DevframeServiceDefinition<GitServiceApi, GitServiceOptions>;
|
|
259
|
+
export declare function createGitService(options?: GitServiceOptions): DevframeServiceDefinition<GitServiceApi, GitServiceOptions>;
|
|
260
260
|
//#endregion
|
|
261
|
-
export {
|
|
261
|
+
export { createGitService as default };
|
package/dist/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { execFile } from "node:child_process";
|
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { promisify } from "node:util";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "0.9.
|
|
7
|
+
var version = "0.9.16";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/git.ts
|
|
10
10
|
const execFileAsync = promisify(execFile);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/service-git",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.16",
|
|
5
5
|
"description": "Devframe wire service exposing read/write git operations (status, log, show, diff, branches, stage, unstage, commit) over RPC.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"devframe": "0.9.
|
|
31
|
+
"devframe": "0.9.16"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@types/node": "^26.
|
|
35
|
-
"devframe": "0.9.
|
|
36
|
-
"tsdown": "^0.
|
|
37
|
-
"vitest": "^
|
|
34
|
+
"@types/node": "^26.5.0",
|
|
35
|
+
"devframe": "0.9.16",
|
|
36
|
+
"tsdown": "^0.23.0",
|
|
37
|
+
"vitest": "^5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsdown",
|