@navbook/cli 0.1.1 → 0.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.
- package/dist/commands/complete.js +124 -0
- package/dist/commands/complete.js.map +1 -0
- package/dist/{cli/commands → commands}/compose.js +5 -3
- package/dist/commands/compose.js.map +1 -0
- package/dist/commands/doctor.js +56 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/entity.js +235 -0
- package/dist/commands/entity.js.map +1 -0
- package/dist/commands/feature.js +202 -0
- package/dist/commands/feature.js.map +1 -0
- package/dist/commands/init.js +23 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/{cli/commands → commands}/install.js +1 -2
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/issue.js +89 -0
- package/dist/commands/issue.js.map +1 -0
- package/dist/commands/policy.js +49 -0
- package/dist/commands/policy.js.map +1 -0
- package/dist/commands/pr.js +262 -0
- package/dist/commands/pr.js.map +1 -0
- package/dist/context.js +21 -0
- package/dist/context.js.map +1 -0
- package/dist/{cli/editor.js → editor.js} +1 -1
- package/dist/editor.js.map +1 -0
- package/dist/errors.js.map +1 -0
- package/dist/install/completions.js.map +1 -0
- package/dist/{cli/install → install}/hook.js +1 -1
- package/dist/install/hook.js.map +1 -0
- package/dist/{cli/main.js → main.js} +10 -0
- package/dist/main.js.map +1 -0
- package/dist/program.js +356 -0
- package/dist/program.js.map +1 -0
- package/dist/{cli/prompt.js → prompt.js} +11 -0
- package/dist/prompt.js.map +1 -0
- package/dist/render/colors.js.map +1 -0
- package/dist/render/detail.js +197 -0
- package/dist/render/detail.js.map +1 -0
- package/dist/render/table.js.map +1 -0
- package/dist/sort.js +77 -0
- package/dist/sort.js.map +1 -0
- package/package.json +15 -21
- package/README.md +0 -165
- package/dist/cli/commands/complete.d.ts +0 -9
- package/dist/cli/commands/complete.js +0 -72
- package/dist/cli/commands/complete.js.map +0 -1
- package/dist/cli/commands/compose.d.ts +0 -27
- package/dist/cli/commands/compose.js.map +0 -1
- package/dist/cli/commands/doctor.d.ts +0 -14
- package/dist/cli/commands/doctor.js +0 -127
- package/dist/cli/commands/doctor.js.map +0 -1
- package/dist/cli/commands/entity.d.ts +0 -55
- package/dist/cli/commands/entity.js +0 -209
- package/dist/cli/commands/entity.js.map +0 -1
- package/dist/cli/commands/init.d.ts +0 -11
- package/dist/cli/commands/init.js +0 -39
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/install.d.ts +0 -17
- package/dist/cli/commands/install.js.map +0 -1
- package/dist/cli/commands/issue.d.ts +0 -12
- package/dist/cli/commands/issue.js +0 -42
- package/dist/cli/commands/issue.js.map +0 -1
- package/dist/cli/commands/pr.d.ts +0 -64
- package/dist/cli/commands/pr.js +0 -466
- package/dist/cli/commands/pr.js.map +0 -1
- package/dist/cli/commit-flow.d.ts +0 -27
- package/dist/cli/commit-flow.js +0 -47
- package/dist/cli/commit-flow.js.map +0 -1
- package/dist/cli/context.d.ts +0 -39
- package/dist/cli/context.js +0 -93
- package/dist/cli/context.js.map +0 -1
- package/dist/cli/editor.d.ts +0 -23
- package/dist/cli/editor.js.map +0 -1
- package/dist/cli/errors.d.ts +0 -17
- package/dist/cli/errors.js.map +0 -1
- package/dist/cli/history-checks.d.ts +0 -21
- package/dist/cli/history-checks.js +0 -134
- package/dist/cli/history-checks.js.map +0 -1
- package/dist/cli/install/completions.d.ts +0 -19
- package/dist/cli/install/completions.js.map +0 -1
- package/dist/cli/install/hook.d.ts +0 -20
- package/dist/cli/install/hook.js.map +0 -1
- package/dist/cli/main.d.ts +0 -14
- package/dist/cli/main.js.map +0 -1
- package/dist/cli/program.d.ts +0 -23
- package/dist/cli/program.js +0 -204
- package/dist/cli/program.js.map +0 -1
- package/dist/cli/prompt.d.ts +0 -22
- package/dist/cli/prompt.js.map +0 -1
- package/dist/cli/render/colors.d.ts +0 -13
- package/dist/cli/render/colors.js.map +0 -1
- package/dist/cli/render/detail.d.ts +0 -10
- package/dist/cli/render/detail.js +0 -105
- package/dist/cli/render/detail.js.map +0 -1
- package/dist/cli/render/table.d.ts +0 -19
- package/dist/cli/render/table.js.map +0 -1
- package/dist/cli/resolve.d.ts +0 -17
- package/dist/cli/resolve.js +0 -68
- package/dist/cli/resolve.js.map +0 -1
- package/dist/cli/workspace.d.ts +0 -52
- package/dist/cli/workspace.js +0 -178
- package/dist/cli/workspace.js.map +0 -1
- package/dist/core/comments.d.ts +0 -31
- package/dist/core/comments.js +0 -80
- package/dist/core/comments.js.map +0 -1
- package/dist/core/files.d.ts +0 -88
- package/dist/core/files.js +0 -441
- package/dist/core/files.js.map +0 -1
- package/dist/core/frontmatter.d.ts +0 -63
- package/dist/core/frontmatter.js +0 -149
- package/dist/core/frontmatter.js.map +0 -1
- package/dist/core/id.d.ts +0 -46
- package/dist/core/id.js +0 -66
- package/dist/core/id.js.map +0 -1
- package/dist/core/index.d.ts +0 -19
- package/dist/core/index.js +0 -20
- package/dist/core/index.js.map +0 -1
- package/dist/core/json.d.ts +0 -18
- package/dist/core/json.js +0 -51
- package/dist/core/json.js.map +0 -1
- package/dist/core/ops.d.ts +0 -92
- package/dist/core/ops.js +0 -173
- package/dist/core/ops.js.map +0 -1
- package/dist/core/person.d.ts +0 -20
- package/dist/core/person.js +0 -50
- package/dist/core/person.js.map +0 -1
- package/dist/core/query.d.ts +0 -30
- package/dist/core/query.js +0 -106
- package/dist/core/query.js.map +0 -1
- package/dist/core/refs.d.ts +0 -12
- package/dist/core/refs.js +0 -36
- package/dist/core/refs.js.map +0 -1
- package/dist/core/slug.d.ts +0 -22
- package/dist/core/slug.js +0 -40
- package/dist/core/slug.js.map +0 -1
- package/dist/core/time.d.ts +0 -14
- package/dist/core/time.js +0 -37
- package/dist/core/time.js.map +0 -1
- package/dist/core/tree.d.ts +0 -94
- package/dist/core/tree.js +0 -237
- package/dist/core/tree.js.map +0 -1
- package/dist/core/validate.d.ts +0 -55
- package/dist/core/validate.js +0 -312
- package/dist/core/validate.js.map +0 -1
- package/dist/git/config.d.ts +0 -12
- package/dist/git/config.js +0 -27
- package/dist/git/config.js.map +0 -1
- package/dist/git/exec.d.ts +0 -35
- package/dist/git/exec.js +0 -58
- package/dist/git/exec.js.map +0 -1
- package/dist/git/history.d.ts +0 -35
- package/dist/git/history.js +0 -82
- package/dist/git/history.js.map +0 -1
- package/dist/git/index-ops.d.ts +0 -20
- package/dist/git/index-ops.js +0 -45
- package/dist/git/index-ops.js.map +0 -1
- package/dist/git/merge.d.ts +0 -27
- package/dist/git/merge.js +0 -57
- package/dist/git/merge.js.map +0 -1
- package/dist/git/refscan.d.ts +0 -32
- package/dist/git/refscan.js +0 -82
- package/dist/git/refscan.js.map +0 -1
- package/dist/git/repo.d.ts +0 -45
- package/dist/git/repo.js +0 -95
- package/dist/git/repo.js.map +0 -1
- /package/dist/{cli/errors.js → errors.js} +0 -0
- /package/dist/{cli/install → install}/completions.js +0 -0
- /package/dist/{cli/render → render}/colors.js +0 -0
- /package/dist/{cli/render → render}/table.js +0 -0
package/dist/git/index-ops.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Index and commit operations.
|
|
3
|
-
*/
|
|
4
|
-
import { git, gitRun, splitNul } from "./exec.js";
|
|
5
|
-
/** Repository-relative paths currently staged in the index. */
|
|
6
|
-
export function stagedPaths(cwd) {
|
|
7
|
-
const head = gitRun(["rev-parse", "--verify", "--quiet", "HEAD"], { cwd });
|
|
8
|
-
const args = head.code === 0 ? ["diff", "--cached", "--name-only", "-z"] : ["ls-files", "--cached", "-z"];
|
|
9
|
-
return splitNul(git(args, { cwd }));
|
|
10
|
-
}
|
|
11
|
-
/** Contents of a staged file, or null when it is not in the index. */
|
|
12
|
-
export function stagedContent(cwd, path) {
|
|
13
|
-
const result = gitRun(["show", `:${path}`], { cwd });
|
|
14
|
-
return result.code === 0 ? result.stdout : null;
|
|
15
|
-
}
|
|
16
|
-
/** Repository-relative paths of every file in the index. */
|
|
17
|
-
export function indexPaths(cwd) {
|
|
18
|
-
return splitNul(git(["ls-files", "--cached", "-z"], { cwd }));
|
|
19
|
-
}
|
|
20
|
-
/** Stage the given paths, including deletions. */
|
|
21
|
-
export function add(cwd, paths) {
|
|
22
|
-
if (paths.length === 0)
|
|
23
|
-
return;
|
|
24
|
-
git(["add", "--all", "--", ...paths], { cwd });
|
|
25
|
-
}
|
|
26
|
-
/** Move a tracked path, staging the rename. */
|
|
27
|
-
export function move(cwd, from, to) {
|
|
28
|
-
git(["mv", "--", from, to], { cwd });
|
|
29
|
-
}
|
|
30
|
-
/** Compose a commit message from a subject and its trailers. */
|
|
31
|
-
export function composeMessage(subject, trailers) {
|
|
32
|
-
if (trailers.length === 0)
|
|
33
|
-
return `${subject}\n`;
|
|
34
|
-
const lines = trailers.map((t) => `${t.key}: ${t.id}`);
|
|
35
|
-
return `${subject}\n\n${lines.join("\n")}\n`;
|
|
36
|
-
}
|
|
37
|
-
/** Create a commit from what is currently staged. */
|
|
38
|
-
export function commit(cwd, message, opts = {}) {
|
|
39
|
-
const args = ["commit", "--quiet", "-m", message];
|
|
40
|
-
if (opts.allowEmpty)
|
|
41
|
-
args.push("--allow-empty");
|
|
42
|
-
git(args, { cwd });
|
|
43
|
-
return git(["rev-parse", "HEAD"], { cwd }).trim();
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=index-ops.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-ops.js","sourceRoot":"","sources":["../../src/git/index-ops.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAElD,+DAA+D;AAC/D,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC3E,MAAM,IAAI,GACR,IAA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EAAE,QAA4B;IAC1E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,GAAG,OAAO,IAAI,CAAC;IACjD,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,OAAO,GAAG,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,OAAe,EAAE,OAAiC,EAAE;IACtF,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,IAAI,IAAI,CAAC,UAAU;QAAE,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAChD,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IACnB,OAAO,GAAG,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;AACpD,CAAC"}
|
package/dist/git/merge.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merging, for `nav pr merge`.
|
|
3
|
-
*
|
|
4
|
-
* The PR directory has to move into `prs/merged/` as part of the merge that
|
|
5
|
-
* lands the branch, so the merge is performed with `--no-commit` and committed
|
|
6
|
-
* only after the move is staged (spec 02 §2.8).
|
|
7
|
-
*/
|
|
8
|
-
export type MergeOutcome = "up-to-date" | "fast-forward" | "staged" | "conflict";
|
|
9
|
-
/** True when merging `source` into HEAD would just move the branch pointer. */
|
|
10
|
-
export declare function canFastForward(cwd: string, source: string): boolean;
|
|
11
|
-
/** True when `source` is already contained in HEAD. */
|
|
12
|
-
export declare function isAlreadyMerged(cwd: string, source: string): boolean;
|
|
13
|
-
/** Fast-forward HEAD to `source`. */
|
|
14
|
-
export declare function fastForward(cwd: string, source: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Start a real merge commit without completing it, leaving the result staged so
|
|
17
|
-
* the caller can add the PR directory move before committing.
|
|
18
|
-
*/
|
|
19
|
-
export declare function mergeNoCommit(cwd: string, source: string): MergeOutcome;
|
|
20
|
-
/** Complete an in-progress merge with an explicit message. */
|
|
21
|
-
export declare function commitMerge(cwd: string, message: string): string;
|
|
22
|
-
/** Abandon an in-progress merge. */
|
|
23
|
-
export declare function abortMerge(cwd: string): void;
|
|
24
|
-
/** Paths git could not merge automatically. */
|
|
25
|
-
export declare function conflictedPaths(cwd: string): string[];
|
|
26
|
-
/** The commit being merged in, read from MERGE_HEAD. */
|
|
27
|
-
export declare function mergeHead(cwd: string): string | null;
|
package/dist/git/merge.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Merging, for `nav pr merge`.
|
|
3
|
-
*
|
|
4
|
-
* The PR directory has to move into `prs/merged/` as part of the merge that
|
|
5
|
-
* lands the branch, so the merge is performed with `--no-commit` and committed
|
|
6
|
-
* only after the move is staged (spec 02 §2.8).
|
|
7
|
-
*/
|
|
8
|
-
import { git, gitRun } from "./exec.js";
|
|
9
|
-
import { isAncestor } from "./history.js";
|
|
10
|
-
/** True when merging `source` into HEAD would just move the branch pointer. */
|
|
11
|
-
export function canFastForward(cwd, source) {
|
|
12
|
-
const head = git(["rev-parse", "HEAD"], { cwd }).trim();
|
|
13
|
-
const tip = git(["rev-parse", `${source}^{commit}`], { cwd }).trim();
|
|
14
|
-
return isAncestor(cwd, head, tip);
|
|
15
|
-
}
|
|
16
|
-
/** True when `source` is already contained in HEAD. */
|
|
17
|
-
export function isAlreadyMerged(cwd, source) {
|
|
18
|
-
const head = git(["rev-parse", "HEAD"], { cwd }).trim();
|
|
19
|
-
const tip = git(["rev-parse", `${source}^{commit}`], { cwd }).trim();
|
|
20
|
-
return isAncestor(cwd, tip, head);
|
|
21
|
-
}
|
|
22
|
-
/** Fast-forward HEAD to `source`. */
|
|
23
|
-
export function fastForward(cwd, source) {
|
|
24
|
-
git(["merge", "--ff-only", "--quiet", source], { cwd });
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Start a real merge commit without completing it, leaving the result staged so
|
|
28
|
-
* the caller can add the PR directory move before committing.
|
|
29
|
-
*/
|
|
30
|
-
export function mergeNoCommit(cwd, source) {
|
|
31
|
-
const result = gitRun(["merge", "--no-ff", "--no-commit", "--quiet", source], { cwd });
|
|
32
|
-
if (result.code === 0)
|
|
33
|
-
return "staged";
|
|
34
|
-
return "conflict";
|
|
35
|
-
}
|
|
36
|
-
/** Complete an in-progress merge with an explicit message. */
|
|
37
|
-
export function commitMerge(cwd, message) {
|
|
38
|
-
git(["commit", "--quiet", "--no-edit", "-m", message], { cwd });
|
|
39
|
-
return git(["rev-parse", "HEAD"], { cwd }).trim();
|
|
40
|
-
}
|
|
41
|
-
/** Abandon an in-progress merge. */
|
|
42
|
-
export function abortMerge(cwd) {
|
|
43
|
-
gitRun(["merge", "--abort"], { cwd });
|
|
44
|
-
}
|
|
45
|
-
/** Paths git could not merge automatically. */
|
|
46
|
-
export function conflictedPaths(cwd) {
|
|
47
|
-
const result = gitRun(["diff", "--name-only", "--diff-filter=U"], { cwd });
|
|
48
|
-
if (result.code !== 0)
|
|
49
|
-
return [];
|
|
50
|
-
return result.stdout.split("\n").filter((line) => line !== "");
|
|
51
|
-
}
|
|
52
|
-
/** The commit being merged in, read from MERGE_HEAD. */
|
|
53
|
-
export function mergeHead(cwd) {
|
|
54
|
-
const result = gitRun(["rev-parse", "--verify", "--quiet", "MERGE_HEAD"], { cwd });
|
|
55
|
-
return result.code === 0 ? result.stdout.trim() : null;
|
|
56
|
-
}
|
|
57
|
-
//# sourceMappingURL=merge.js.map
|
package/dist/git/merge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file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ACnF,OAAO,MAAM,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC"}
|
package/dist/git/refscan.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading `.navbook/` out of branches that are not checked out.
|
|
3
|
-
*
|
|
4
|
-
* A pull request's files live on the branch it proposes to merge (spec 03
|
|
5
|
-
* §3.5), so listing open PRs means enumerating refs, not walking the working
|
|
6
|
-
* tree. Blobs are read through a single `git cat-file --batch` process so the
|
|
7
|
-
* cost is one subprocess rather than one per file.
|
|
8
|
-
*/
|
|
9
|
-
export interface Ref {
|
|
10
|
-
/** Full ref name, e.g. `refs/heads/feat/auth`. */
|
|
11
|
-
full: string;
|
|
12
|
-
/** Short name, e.g. `feat/auth` or `origin/feat/auth`. */
|
|
13
|
-
short: string;
|
|
14
|
-
remote: boolean;
|
|
15
|
-
}
|
|
16
|
-
/** Local branches and fetched remote branches, excluding symbolic refs. */
|
|
17
|
-
export declare function listBranchRefs(cwd: string): Ref[];
|
|
18
|
-
/** Entries directly inside `dir` at `ref`; empty when the path does not exist. */
|
|
19
|
-
export declare function lsTreeNames(cwd: string, ref: string, dir: string): string[];
|
|
20
|
-
/** Every file path under `dir` at `ref`, recursively. */
|
|
21
|
-
export declare function lsTreeRecursive(cwd: string, ref: string, dir: string): string[];
|
|
22
|
-
export interface BlobRequest {
|
|
23
|
-
ref: string;
|
|
24
|
-
path: string;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Read many blobs in one `git cat-file --batch` process.
|
|
28
|
-
*
|
|
29
|
-
* Results are keyed `<ref>:<path>`; missing objects are simply absent, which is
|
|
30
|
-
* the normal case for a branch that has no `.navbook/` at all.
|
|
31
|
-
*/
|
|
32
|
-
export declare function catBlobs(cwd: string, requests: readonly BlobRequest[]): Map<string, string>;
|
package/dist/git/refscan.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading `.navbook/` out of branches that are not checked out.
|
|
3
|
-
*
|
|
4
|
-
* A pull request's files live on the branch it proposes to merge (spec 03
|
|
5
|
-
* §3.5), so listing open PRs means enumerating refs, not walking the working
|
|
6
|
-
* tree. Blobs are read through a single `git cat-file --batch` process so the
|
|
7
|
-
* cost is one subprocess rather than one per file.
|
|
8
|
-
*/
|
|
9
|
-
import { spawnSync } from "node:child_process";
|
|
10
|
-
import { gitMaybe, splitLines, splitNul } from "./exec.js";
|
|
11
|
-
/** Local branches and fetched remote branches, excluding symbolic refs. */
|
|
12
|
-
export function listBranchRefs(cwd) {
|
|
13
|
-
const output = gitMaybe([
|
|
14
|
-
"for-each-ref",
|
|
15
|
-
"--format=%(refname)%00%(refname:short)%00%(symref)",
|
|
16
|
-
"refs/heads",
|
|
17
|
-
"refs/remotes",
|
|
18
|
-
], { cwd });
|
|
19
|
-
if (output === null)
|
|
20
|
-
return [];
|
|
21
|
-
const refs = [];
|
|
22
|
-
for (const line of splitLines(output)) {
|
|
23
|
-
const [full, short, symref] = line.split("\0");
|
|
24
|
-
if (!full || !short)
|
|
25
|
-
continue;
|
|
26
|
-
// Skip origin/HEAD and friends: they duplicate a branch already listed.
|
|
27
|
-
if (symref !== undefined && symref !== "")
|
|
28
|
-
continue;
|
|
29
|
-
refs.push({ full, short, remote: full.startsWith("refs/remotes/") });
|
|
30
|
-
}
|
|
31
|
-
return refs;
|
|
32
|
-
}
|
|
33
|
-
/** Entries directly inside `dir` at `ref`; empty when the path does not exist. */
|
|
34
|
-
export function lsTreeNames(cwd, ref, dir) {
|
|
35
|
-
const output = gitMaybe(["ls-tree", "--name-only", "-z", `${ref}:${dir}`], { cwd });
|
|
36
|
-
return output === null ? [] : splitNul(output).map((name) => name.replace(/\/$/, ""));
|
|
37
|
-
}
|
|
38
|
-
/** Every file path under `dir` at `ref`, recursively. */
|
|
39
|
-
export function lsTreeRecursive(cwd, ref, dir) {
|
|
40
|
-
const output = gitMaybe(["ls-tree", "-r", "--name-only", "-z", `${ref}:${dir}`], { cwd });
|
|
41
|
-
return output === null ? [] : splitNul(output);
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Read many blobs in one `git cat-file --batch` process.
|
|
45
|
-
*
|
|
46
|
-
* Results are keyed `<ref>:<path>`; missing objects are simply absent, which is
|
|
47
|
-
* the normal case for a branch that has no `.navbook/` at all.
|
|
48
|
-
*/
|
|
49
|
-
export function catBlobs(cwd, requests) {
|
|
50
|
-
const out = new Map();
|
|
51
|
-
if (requests.length === 0)
|
|
52
|
-
return out;
|
|
53
|
-
const specs = requests.map((request) => `${request.ref}:${request.path}`);
|
|
54
|
-
// No `encoding` option: stdout must stay a Buffer, because the batch protocol
|
|
55
|
-
// frames each blob by byte length rather than by any text delimiter.
|
|
56
|
-
const result = spawnSync("git", ["cat-file", "--batch"], {
|
|
57
|
-
cwd,
|
|
58
|
-
input: `${specs.join("\n")}\n`,
|
|
59
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
60
|
-
env: { ...process.env, LC_ALL: "C" },
|
|
61
|
-
});
|
|
62
|
-
if (result.error || result.status !== 0)
|
|
63
|
-
return out;
|
|
64
|
-
const stdout = result.stdout;
|
|
65
|
-
let offset = 0;
|
|
66
|
-
for (const spec of specs) {
|
|
67
|
-
const newline = stdout.indexOf(0x0a, offset);
|
|
68
|
-
if (newline === -1)
|
|
69
|
-
break;
|
|
70
|
-
const header = stdout.subarray(offset, newline).toString("utf8");
|
|
71
|
-
offset = newline + 1;
|
|
72
|
-
// A missing object reports "<spec> missing" and consumes no body.
|
|
73
|
-
const parts = header.split(" ");
|
|
74
|
-
const size = Number(parts[2]);
|
|
75
|
-
if (parts.length < 3 || Number.isNaN(size))
|
|
76
|
-
continue;
|
|
77
|
-
out.set(spec, stdout.subarray(offset, offset + size).toString("utf8"));
|
|
78
|
-
offset += size + 1; // the body is followed by a newline
|
|
79
|
-
}
|
|
80
|
-
return out;
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=refscan.js.map
|
package/dist/git/refscan.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"refscan.js","sourceRoot":"","sources":["../../src/git/refscan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAU3D,2EAA2E;AAC3E,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,MAAM,MAAM,GAAG,QAAQ,CACrB;QACE,cAAc;QACd,oDAAoD;QACpD,YAAY;QACZ,cAAc;KACf,EACD,EAAE,GAAG,EAAE,CACR,CAAC;IACF,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,EAAE,CAAC;IAE/B,MAAM,IAAI,GAAU,EAAE,CAAC;IACvB,KAAK,MAAM,IAAI,IAAI,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK;YAAE,SAAS;QAC9B,wEAAwE;QACxE,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,EAAE;YAAE,SAAS;QACpD,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,WAAW,CAAC,GAAW,EAAE,GAAW,EAAE,GAAW;IAC/D,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,E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spec 02 §2.1), so "walk up
|
|
5
|
-
* like git does" and "ask git for the top level" are the same answer.
|
|
6
|
-
*/
|
|
7
|
-
export declare const NAVBOOK_DIR = ".navbook";
|
|
8
|
-
export interface RepoPaths {
|
|
9
|
-
repoRoot: string;
|
|
10
|
-
navRoot: string;
|
|
11
|
-
hasNavbook: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class NotARepositoryError extends Error {
|
|
14
|
-
}
|
|
15
|
-
/** Locate the repository root containing `cwd`, and its `.navbook/` directory. */
|
|
16
|
-
export declare function findRepo(cwd: string): RepoPaths;
|
|
17
|
-
/** Current branch name, or null when HEAD is detached. */
|
|
18
|
-
export declare function currentBranch(cwd: string): string | null;
|
|
19
|
-
/** Resolve a revision to a full 40-hex SHA, or null when it does not exist. */
|
|
20
|
-
export declare function resolveSha(cwd: string, rev: string): string | null;
|
|
21
|
-
/** True when the repository has at least one commit. */
|
|
22
|
-
export declare function hasCommits(cwd: string): boolean;
|
|
23
|
-
/**
|
|
24
|
-
* The repository's default branch — the tracker of record (spec 03 §3.1).
|
|
25
|
-
*
|
|
26
|
-
* Prefers what `origin/HEAD` designates, then a configured `init.defaultBranch`
|
|
27
|
-
* that actually exists, then conventional names, then the current branch.
|
|
28
|
-
*/
|
|
29
|
-
export declare function defaultBranch(cwd: string): string | null;
|
|
30
|
-
export interface Identity {
|
|
31
|
-
name?: string;
|
|
32
|
-
email: string;
|
|
33
|
-
}
|
|
34
|
-
export declare class MissingIdentityError extends Error {
|
|
35
|
-
}
|
|
36
|
-
/** Author identity from `git config user.name` / `user.email` (spec 04 §4.2). */
|
|
37
|
-
export declare function userIdentity(cwd: string): Identity;
|
|
38
|
-
/** True when the working tree and index have no changes at all. */
|
|
39
|
-
export declare function isTreeClean(cwd: string): boolean;
|
|
40
|
-
/** True when a merge is currently in progress. */
|
|
41
|
-
export declare function isMergeInProgress(cwd: string): boolean;
|
|
42
|
-
/** Absolute path of the repository's git directory. */
|
|
43
|
-
export declare function gitDir(cwd: string): string;
|
|
44
|
-
/** Absolute path of the hooks directory git will actually use. */
|
|
45
|
-
export declare function hooksDir(cwd: string): string;
|
package/dist/git/repo.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Repository discovery and identity.
|
|
3
|
-
*
|
|
4
|
-
* `.navbook/` always sits at the repository root (spec 02 §2.1), so "walk up
|
|
5
|
-
* like git does" and "ask git for the top level" are the same answer.
|
|
6
|
-
*/
|
|
7
|
-
import { existsSync } from "node:fs";
|
|
8
|
-
import { join } from "node:path";
|
|
9
|
-
import { git, gitMaybe, gitRun, splitLines } from "./exec.js";
|
|
10
|
-
export const NAVBOOK_DIR = ".navbook";
|
|
11
|
-
export class NotARepositoryError extends Error {
|
|
12
|
-
}
|
|
13
|
-
/** Locate the repository root containing `cwd`, and its `.navbook/` directory. */
|
|
14
|
-
export function findRepo(cwd) {
|
|
15
|
-
const top = gitMaybe(["rev-parse", "--show-toplevel"], { cwd });
|
|
16
|
-
if (top === null) {
|
|
17
|
-
throw new NotARepositoryError(`not inside a git repository: ${cwd}`);
|
|
18
|
-
}
|
|
19
|
-
const repoRoot = top;
|
|
20
|
-
const navRoot = join(repoRoot, NAVBOOK_DIR);
|
|
21
|
-
return { repoRoot, navRoot, hasNavbook: existsSync(navRoot) };
|
|
22
|
-
}
|
|
23
|
-
/** Current branch name, or null when HEAD is detached. */
|
|
24
|
-
export function currentBranch(cwd) {
|
|
25
|
-
const name = gitMaybe(["symbolic-ref", "--quiet", "--short", "HEAD"], { cwd });
|
|
26
|
-
return name === null || name === "" ? null : name;
|
|
27
|
-
}
|
|
28
|
-
/** Resolve a revision to a full 40-hex SHA, or null when it does not exist. */
|
|
29
|
-
export function resolveSha(cwd, rev) {
|
|
30
|
-
const sha = gitMaybe(["rev-parse", "--verify", "--quiet", `${rev}^{commit}`], { cwd });
|
|
31
|
-
return sha && /^[0-9a-f]{40}$/.test(sha) ? sha : null;
|
|
32
|
-
}
|
|
33
|
-
/** True when the repository has at least one commit. */
|
|
34
|
-
export function hasCommits(cwd) {
|
|
35
|
-
return resolveSha(cwd, "HEAD") !== null;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* The repository's default branch — the tracker of record (spec 03 §3.1).
|
|
39
|
-
*
|
|
40
|
-
* Prefers what `origin/HEAD` designates, then a configured `init.defaultBranch`
|
|
41
|
-
* that actually exists, then conventional names, then the current branch.
|
|
42
|
-
*/
|
|
43
|
-
export function defaultBranch(cwd) {
|
|
44
|
-
const originHead = gitMaybe(["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"], {
|
|
45
|
-
cwd,
|
|
46
|
-
});
|
|
47
|
-
if (originHead?.startsWith("origin/")) {
|
|
48
|
-
const name = originHead.slice("origin/".length);
|
|
49
|
-
if (name !== "")
|
|
50
|
-
return name;
|
|
51
|
-
}
|
|
52
|
-
const branches = new Set(splitLines(gitMaybe(["for-each-ref", "--format=%(refname:short)", "refs/heads"], { cwd }) ?? ""));
|
|
53
|
-
const configured = gitMaybe(["config", "--get", "init.defaultBranch"], { cwd });
|
|
54
|
-
if (configured && branches.has(configured))
|
|
55
|
-
return configured;
|
|
56
|
-
for (const candidate of ["main", "master", "trunk"]) {
|
|
57
|
-
if (branches.has(candidate))
|
|
58
|
-
return candidate;
|
|
59
|
-
}
|
|
60
|
-
return currentBranch(cwd);
|
|
61
|
-
}
|
|
62
|
-
export class MissingIdentityError extends Error {
|
|
63
|
-
}
|
|
64
|
-
/** Author identity from `git config user.name` / `user.email` (spec 04 §4.2). */
|
|
65
|
-
export function userIdentity(cwd) {
|
|
66
|
-
const email = gitMaybe(["config", "--get", "user.email"], { cwd });
|
|
67
|
-
if (!email) {
|
|
68
|
-
throw new MissingIdentityError("git user.email is not configured; run `git config --global user.email you@example.com`");
|
|
69
|
-
}
|
|
70
|
-
const name = gitMaybe(["config", "--get", "user.name"], { cwd });
|
|
71
|
-
return name ? { name, email } : { email };
|
|
72
|
-
}
|
|
73
|
-
/** True when the working tree and index have no changes at all. */
|
|
74
|
-
export function isTreeClean(cwd) {
|
|
75
|
-
const status = gitRun(["status", "--porcelain"], { cwd });
|
|
76
|
-
return status.code === 0 && status.stdout.trim() === "";
|
|
77
|
-
}
|
|
78
|
-
/** True when a merge is currently in progress. */
|
|
79
|
-
export function isMergeInProgress(cwd) {
|
|
80
|
-
const gitDir = gitMaybe(["rev-parse", "--git-dir"], { cwd });
|
|
81
|
-
if (!gitDir)
|
|
82
|
-
return false;
|
|
83
|
-
const absolute = gitDir.startsWith("/") ? gitDir : join(cwd, gitDir);
|
|
84
|
-
return existsSync(join(absolute, "MERGE_HEAD"));
|
|
85
|
-
}
|
|
86
|
-
/** Absolute path of the repository's git directory. */
|
|
87
|
-
export function gitDir(cwd) {
|
|
88
|
-
return git(["rev-parse", "--absolute-git-dir"], { cwd }).trim();
|
|
89
|
-
}
|
|
90
|
-
/** Absolute path of the hooks directory git will actually use. */
|
|
91
|
-
export function hooksDir(cwd) {
|
|
92
|
-
const path = git(["rev-parse", "--git-path", "hooks"], { cwd }).trim();
|
|
93
|
-
return path.startsWith("/") ? path : join(cwd, path);
|
|
94
|
-
}
|
|
95
|
-
//# sourceMappingURL=repo.js.map
|
package/dist/git/repo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repo.js","sourceRoot":"","sources":["../../src/git/repo.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE9D,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC;AAQtC,MAAM,OAAO,mBAAoB,SAAQ,KAAK;CAAG;AAEjD,kFAAkF;AAClF,MAAM,UAAU,QAAQ,CAAC,GAAW;IAClC,MAAM,GAAG,GA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