@navbook/cli 0.1.2 → 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/{cli/program.js → program.js} +161 -23
- 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.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
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Column-aligned listings for `nav issue list` / `nav pr list`.
|
|
3
|
-
*/
|
|
4
|
-
import type { Colors } from "./colors.ts";
|
|
5
|
-
export interface Column {
|
|
6
|
-
header: string;
|
|
7
|
-
/** Cells are truncated to this width when the terminal is narrow. */
|
|
8
|
-
flexible?: boolean;
|
|
9
|
-
minWidth?: number;
|
|
10
|
-
}
|
|
11
|
-
export interface TableOptions {
|
|
12
|
-
colors: Colors;
|
|
13
|
-
/** Total width available; unlimited when undefined. */
|
|
14
|
-
width?: number;
|
|
15
|
-
}
|
|
16
|
-
/** Render a table, shrinking flexible columns to fit the terminal width. */
|
|
17
|
-
export declare function renderTable(columns: readonly Column[], rows: readonly string[][], opts: TableOptions): string;
|
|
18
|
-
/** Truncate to `width`, marking the cut with a single ellipsis character. */
|
|
19
|
-
export declare function truncate(text: string, width: number): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table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AAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,GAAG,CAAC,IAAY,EAAE,KAAa;IACtC,MAAM,OAAO,GAAG,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACzD,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,KAAa;IAClD,IAAI,KAAK,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IAC1B,IAAI,YAAY,CAAC,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,IAAI,CAAC;IAC7C,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,GAAG,CAAC;IAC5B,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC;AACxC,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,MAAM,CAAC;AAC1B,CAAC"}
|
package/dist/cli/resolve.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turning what the user typed into the entity they meant — spec 02 §2.2
|
|
3
|
-
* (prefixes of at least four characters) and spec 04 §4.3 (a verb given an ID
|
|
4
|
-
* of the other kind points at the right noun).
|
|
5
|
-
*/
|
|
6
|
-
import { type EntityKind, type EntityRecord, type Repo } from "../core/tree.ts";
|
|
7
|
-
/**
|
|
8
|
-
* Accept a whole entity directory name wherever an ID is expected.
|
|
9
|
-
*
|
|
10
|
-
* Shell completion offers `<id>-<slug>` names, and they are what a user copies
|
|
11
|
-
* out of a path or a forge URL; the ID is simply its first eight characters.
|
|
12
|
-
*/
|
|
13
|
-
export declare function asId(argument: string): string;
|
|
14
|
-
/** Resolve an ID or unambiguous prefix to an entity of the expected kind. */
|
|
15
|
-
export declare function resolveEntity(repo: Repo, prefix: string, kind: EntityKind): EntityRecord;
|
|
16
|
-
/** Resolve a comment ID or prefix within one entity (used by `--reply-to`). */
|
|
17
|
-
export declare function resolveComment(entity: EntityRecord, prefix: string): string;
|
package/dist/cli/resolve.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Turning what the user typed into the entity they meant — spec 02 §2.2
|
|
3
|
-
* (prefixes of at least four characters) and spec 04 §4.3 (a verb given an ID
|
|
4
|
-
* of the other kind points at the right noun).
|
|
5
|
-
*/
|
|
6
|
-
import { MIN_PREFIX_LENGTH, resolvePrefix } from "../core/id.js";
|
|
7
|
-
import { allEntities } from "../core/tree.js";
|
|
8
|
-
import { fail } from "./errors.js";
|
|
9
|
-
const NOUN = { issue: "issue", pr: "pull request" };
|
|
10
|
-
const COMMAND = { issue: "nav issue", pr: "nav pr" };
|
|
11
|
-
/**
|
|
12
|
-
* Accept a whole entity directory name wherever an ID is expected.
|
|
13
|
-
*
|
|
14
|
-
* Shell completion offers `<id>-<slug>` names, and they are what a user copies
|
|
15
|
-
* out of a path or a forge URL; the ID is simply its first eight characters.
|
|
16
|
-
*/
|
|
17
|
-
export function asId(argument) {
|
|
18
|
-
const match = /^([a-z][a-z0-9]{7})-[a-z0-9-]+$/.exec(argument.toLowerCase());
|
|
19
|
-
return match ? match[1] : argument;
|
|
20
|
-
}
|
|
21
|
-
/** Resolve an ID or unambiguous prefix to an entity of the expected kind. */
|
|
22
|
-
export function resolveEntity(repo, prefix, kind) {
|
|
23
|
-
const entities = allEntities(repo);
|
|
24
|
-
const resolution = resolvePrefix(asId(prefix), entities.map((e) => e.id));
|
|
25
|
-
if (!resolution.ok) {
|
|
26
|
-
switch (resolution.reason) {
|
|
27
|
-
case "too-short":
|
|
28
|
-
fail(`'${prefix}' is too short; ID prefixes must be at least ${MIN_PREFIX_LENGTH} characters`);
|
|
29
|
-
break;
|
|
30
|
-
case "not-found":
|
|
31
|
-
fail(`no ${NOUN[kind]} matches '${prefix}'`);
|
|
32
|
-
break;
|
|
33
|
-
default:
|
|
34
|
-
fail(`'${prefix}' is ambiguous; ${resolution.matches.length} entities match`, resolution.matches.map((id) => describe(entities.find((e) => e.id === id))));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
const matches = entities.filter((e) => e.id === resolution.id);
|
|
38
|
-
const wanted = matches.find((e) => e.kind === kind);
|
|
39
|
-
if (wanted)
|
|
40
|
-
return wanted;
|
|
41
|
-
const other = matches[0];
|
|
42
|
-
fail(`#${other.id} is ${other.kind === "pr" ? "a pull request" : "an issue"} — use '${COMMAND[other.kind]} ${verbHint()}'`);
|
|
43
|
-
}
|
|
44
|
-
function verbHint() {
|
|
45
|
-
return "show";
|
|
46
|
-
}
|
|
47
|
-
function describe(entity) {
|
|
48
|
-
if (!entity)
|
|
49
|
-
return "";
|
|
50
|
-
return `#${entity.id} ${entity.kind === "pr" ? "pr " : "issue"} ${entity.title}`;
|
|
51
|
-
}
|
|
52
|
-
/** Resolve a comment ID or prefix within one entity (used by `--reply-to`). */
|
|
53
|
-
export function resolveComment(entity, prefix) {
|
|
54
|
-
const resolution = resolvePrefix(prefix, entity.comments.map((c) => c.id));
|
|
55
|
-
if (resolution.ok)
|
|
56
|
-
return resolution.id;
|
|
57
|
-
switch (resolution.reason) {
|
|
58
|
-
case "too-short":
|
|
59
|
-
fail(`'${prefix}' is too short; ID prefixes must be at least ${MIN_PREFIX_LENGTH} characters`);
|
|
60
|
-
break;
|
|
61
|
-
case "not-found":
|
|
62
|
-
fail(`no comment of #${entity.id} matches '${prefix}'`);
|
|
63
|
-
break;
|
|
64
|
-
default:
|
|
65
|
-
fail(`'${prefix}' is ambiguous within #${entity.id}`, resolution.matches.map((id) => `#${id}`));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=resolve.js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KAAK,EAAE,CAAC;AACvF,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAAC,MAAoB,EAAE,MAAc;IACjE,MAAM,UAAU,GAAG,aAAa,CAC9B,MAAM,EACN,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACjC,CAAC;IACF,IAAI,UAAU,CAAC,EAAE;QAAE,OAAO,UAAU,CAAC,EAAE,CAAC;IACxC,QAAQ,UAAU,CAAC,MAAM,EAAE,CAAC;QAC1B,KAAK,WAAW;YACd,IAAI,CACF,IAAI,MAAM,gDAAgD,iBAAiB,aAAa,CACzF,CAAC;YACF,MAAM;QACR,KAAK,WAAW;YACd,IAAI,CAAC,kBAAkB,MAAM,CAAC,EAAE,aAAa,MAAM,GAAG,CAAC,CAAC;YACxD,MAAM;QACR;YACE,IAAI,CACF,IAAI,MAAM,0BAA0B,MAAM,CAAC,EAAE,EAAE,EAC/C,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CACzC,CAAC;IACN,CAAC;AACH,CAAC"}
|
package/dist/cli/workspace.d.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading and mutating the `.navbook/` working tree.
|
|
3
|
-
*
|
|
4
|
-
* Core plans; this module executes. Every write goes through {@link applyOps}
|
|
5
|
-
* so the set of touched paths is known exactly — which is what makes the
|
|
6
|
-
* `--commit` guard of spec 04 §4.2 precise rather than approximate.
|
|
7
|
-
*/
|
|
8
|
-
import type { FileOp } from "../core/ops.ts";
|
|
9
|
-
import { type Query } from "../core/query.ts";
|
|
10
|
-
import { type NavTree, type Repo } from "../core/tree.ts";
|
|
11
|
-
import type { Ctx } from "./context.ts";
|
|
12
|
-
export interface ReadTreeOptions {
|
|
13
|
-
/** Skip `comments/` directories when the command cannot need them. */
|
|
14
|
-
includeComments?: boolean;
|
|
15
|
-
}
|
|
16
|
-
/** Read `.navbook/` into a flat path→content map. */
|
|
17
|
-
export declare function readNavTree(navRoot: string, opts?: ReadTreeOptions): NavTree;
|
|
18
|
-
/** Load the repository model from the working tree. */
|
|
19
|
-
export declare function loadRepo(ctx: Ctx, opts?: ReadTreeOptions): Repo;
|
|
20
|
-
/** Load the repository, reading comment bodies only when the query needs them. */
|
|
21
|
-
export declare function loadRepoForQuery(ctx: Ctx, query: Query): Repo;
|
|
22
|
-
/** Fail with a helpful message when the repository has no `.navbook/` yet. */
|
|
23
|
-
export declare function requireNavbook(ctx: Ctx): void;
|
|
24
|
-
/** Convert a path relative to `.navbook/` into a repository-relative path. */
|
|
25
|
-
export declare function repoPath(navRelative: string): string;
|
|
26
|
-
/** Absolute filesystem path for a path relative to `.navbook/`. */
|
|
27
|
-
export declare function absPath(ctx: Ctx, navRelative: string): string;
|
|
28
|
-
export interface ApplyResult {
|
|
29
|
-
/** Repository-relative paths the operation created, rewrote or moved. */
|
|
30
|
-
touched: string[];
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Execute file operations in order, then stage exactly the paths involved.
|
|
34
|
-
*
|
|
35
|
-
* Renames are performed as a filesystem move followed by `git add`, which
|
|
36
|
-
* produces the same index state as `git mv` while also working on entities that
|
|
37
|
-
* have not been committed yet.
|
|
38
|
-
*/
|
|
39
|
-
export declare function applyOps(ctx: Ctx, ops: readonly FileOp[]): ApplyResult;
|
|
40
|
-
/** Stage paths, tolerating those that no longer exist and were never tracked. */
|
|
41
|
-
export declare function stage(ctx: Ctx, paths: readonly string[]): void;
|
|
42
|
-
/**
|
|
43
|
-
* Every ID in the repository, read from names alone.
|
|
44
|
-
*
|
|
45
|
-
* Entity IDs are in directory names and comment IDs are in filenames (§2.2,
|
|
46
|
-
* §2.6), so uniqueness can be checked without opening a single file — which
|
|
47
|
-
* keeps `open` fast while still honouring "unique across all entity and
|
|
48
|
-
* comment IDs".
|
|
49
|
-
*/
|
|
50
|
-
export declare function scanAllIds(navRoot: string): Set<string>;
|
|
51
|
-
/** Repository-relative path of an absolute path, in POSIX form. */
|
|
52
|
-
export declare function toRepoRelative(ctx: Ctx, absolute: string): string;
|
package/dist/cli/workspace.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reading and mutating the `.navbook/` working tree.
|
|
3
|
-
*
|
|
4
|
-
* Core plans; this module executes. Every write goes through {@link applyOps}
|
|
5
|
-
* so the set of touched paths is known exactly — which is what makes the
|
|
6
|
-
* `--commit` guard of spec 04 §4.2 precise rather than approximate.
|
|
7
|
-
*/
|
|
8
|
-
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmdirSync, writeFileSync, } from "node:fs";
|
|
9
|
-
import { dirname, join, posix, relative, sep } from "node:path";
|
|
10
|
-
import { parseCommentFileName } from "../core/comments.js";
|
|
11
|
-
import { NAVBOOK_ROOT } from "../core/json.js";
|
|
12
|
-
import { needsComments } from "../core/query.js";
|
|
13
|
-
import { parseDirName } from "../core/slug.js";
|
|
14
|
-
import { parseTree } from "../core/tree.js";
|
|
15
|
-
import { gitMaybe } from "../git/exec.js";
|
|
16
|
-
import { add } from "../git/index-ops.js";
|
|
17
|
-
import { fail } from "./errors.js";
|
|
18
|
-
/** Read `.navbook/` into a flat path→content map. */
|
|
19
|
-
export function readNavTree(navRoot, opts = {}) {
|
|
20
|
-
const includeComments = opts.includeComments !== false;
|
|
21
|
-
const files = new Map();
|
|
22
|
-
if (!existsSync(navRoot))
|
|
23
|
-
return files;
|
|
24
|
-
walk(navRoot, "", files, includeComments);
|
|
25
|
-
return files;
|
|
26
|
-
}
|
|
27
|
-
function walk(absolute, rel, files, includeComments) {
|
|
28
|
-
let entries;
|
|
29
|
-
try {
|
|
30
|
-
entries = readdirSync(absolute, { withFileTypes: true, encoding: "utf8" });
|
|
31
|
-
}
|
|
32
|
-
catch {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
for (const entry of entries) {
|
|
36
|
-
const childRel = rel === "" ? entry.name : `${rel}/${entry.name}`;
|
|
37
|
-
const childAbs = join(absolute, entry.name);
|
|
38
|
-
if (entry.isDirectory()) {
|
|
39
|
-
if (!includeComments && entry.name === "comments")
|
|
40
|
-
continue;
|
|
41
|
-
walk(childAbs, childRel, files, includeComments);
|
|
42
|
-
}
|
|
43
|
-
else if (entry.isFile()) {
|
|
44
|
-
files.set(childRel, readFileSync(childAbs, "utf8"));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/** Load the repository model from the working tree. */
|
|
49
|
-
export function loadRepo(ctx, opts = {}) {
|
|
50
|
-
requireNavbook(ctx);
|
|
51
|
-
const includeComments = opts.includeComments !== false;
|
|
52
|
-
const files = readNavTree(ctx.navRoot, { includeComments });
|
|
53
|
-
return parseTree(files, { commentsLoaded: includeComments });
|
|
54
|
-
}
|
|
55
|
-
/** Load the repository, reading comment bodies only when the query needs them. */
|
|
56
|
-
export function loadRepoForQuery(ctx, query) {
|
|
57
|
-
return loadRepo(ctx, { includeComments: needsComments(query) });
|
|
58
|
-
}
|
|
59
|
-
/** Fail with a helpful message when the repository has no `.navbook/` yet. */
|
|
60
|
-
export function requireNavbook(ctx) {
|
|
61
|
-
if (!ctx.hasNavbook) {
|
|
62
|
-
fail(`not a Navbook repository: no ${NAVBOOK_ROOT}/ at the repository root`, [
|
|
63
|
-
"run 'nav init' to create it",
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
/** Convert a path relative to `.navbook/` into a repository-relative path. */
|
|
68
|
-
export function repoPath(navRelative) {
|
|
69
|
-
return posix.join(NAVBOOK_ROOT, navRelative);
|
|
70
|
-
}
|
|
71
|
-
/** Absolute filesystem path for a path relative to `.navbook/`. */
|
|
72
|
-
export function absPath(ctx, navRelative) {
|
|
73
|
-
return join(ctx.navRoot, ...navRelative.split("/"));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Execute file operations in order, then stage exactly the paths involved.
|
|
77
|
-
*
|
|
78
|
-
* Renames are performed as a filesystem move followed by `git add`, which
|
|
79
|
-
* produces the same index state as `git mv` while also working on entities that
|
|
80
|
-
* have not been committed yet.
|
|
81
|
-
*/
|
|
82
|
-
export function applyOps(ctx, ops) {
|
|
83
|
-
const touched = new Set();
|
|
84
|
-
for (const op of ops) {
|
|
85
|
-
if (op.op === "write") {
|
|
86
|
-
const target = absPath(ctx, op.path);
|
|
87
|
-
mkdirSync(dirname(target), { recursive: true });
|
|
88
|
-
writeFileSync(target, op.content, "utf8");
|
|
89
|
-
touched.add(repoPath(op.path));
|
|
90
|
-
continue;
|
|
91
|
-
}
|
|
92
|
-
const from = absPath(ctx, op.from);
|
|
93
|
-
const to = absPath(ctx, op.to);
|
|
94
|
-
if (!existsSync(from))
|
|
95
|
-
fail(`cannot move ${repoPath(op.from)}: it does not exist`);
|
|
96
|
-
if (existsSync(to))
|
|
97
|
-
fail(`cannot move ${repoPath(op.from)}: ${repoPath(op.to)} already exists`);
|
|
98
|
-
mkdirSync(dirname(to), { recursive: true });
|
|
99
|
-
renameSync(from, to);
|
|
100
|
-
pruneEmptyParents(ctx, dirname(from));
|
|
101
|
-
touched.add(repoPath(op.from));
|
|
102
|
-
touched.add(repoPath(op.to));
|
|
103
|
-
}
|
|
104
|
-
stage(ctx, [...touched]);
|
|
105
|
-
return { touched: [...touched].sort() };
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Remove directories left empty by a move, up to (but never including) the
|
|
109
|
-
* `.navbook/` root. Git does not track empty directories, so leaving them
|
|
110
|
-
* behind would make the working tree disagree with a fresh clone.
|
|
111
|
-
*/
|
|
112
|
-
function pruneEmptyParents(ctx, startDir) {
|
|
113
|
-
let current = startDir;
|
|
114
|
-
while (current.startsWith(ctx.navRoot) && current !== ctx.navRoot) {
|
|
115
|
-
try {
|
|
116
|
-
if (readdirSync(current).length > 0)
|
|
117
|
-
return;
|
|
118
|
-
rmdirSync(current);
|
|
119
|
-
}
|
|
120
|
-
catch {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
current = dirname(current);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/** Stage paths, tolerating those that no longer exist and were never tracked. */
|
|
127
|
-
export function stage(ctx, paths) {
|
|
128
|
-
const stageable = paths.filter((path) => {
|
|
129
|
-
if (existsSync(join(ctx.repoRoot, ...path.split("/"))))
|
|
130
|
-
return true;
|
|
131
|
-
const tracked = gitMaybe(["ls-files", "--", path], { cwd: ctx.repoRoot });
|
|
132
|
-
return tracked !== null && tracked !== "";
|
|
133
|
-
});
|
|
134
|
-
add(ctx.repoRoot, stageable);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Every ID in the repository, read from names alone.
|
|
138
|
-
*
|
|
139
|
-
* Entity IDs are in directory names and comment IDs are in filenames (§2.2,
|
|
140
|
-
* §2.6), so uniqueness can be checked without opening a single file — which
|
|
141
|
-
* keeps `open` fast while still honouring "unique across all entity and
|
|
142
|
-
* comment IDs".
|
|
143
|
-
*/
|
|
144
|
-
export function scanAllIds(navRoot) {
|
|
145
|
-
const ids = new Set();
|
|
146
|
-
if (!existsSync(navRoot))
|
|
147
|
-
return ids;
|
|
148
|
-
const walk = (dir, depth) => {
|
|
149
|
-
let entries;
|
|
150
|
-
try {
|
|
151
|
-
entries = readdirSync(dir, { withFileTypes: true, encoding: "utf8" });
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
for (const entry of entries) {
|
|
157
|
-
if (entry.isDirectory()) {
|
|
158
|
-
const parsed = parseDirName(entry.name);
|
|
159
|
-
if (parsed)
|
|
160
|
-
ids.add(parsed.id);
|
|
161
|
-
if (depth < 6)
|
|
162
|
-
walk(join(dir, entry.name), depth + 1);
|
|
163
|
-
}
|
|
164
|
-
else if (entry.isFile()) {
|
|
165
|
-
const comment = parseCommentFileName(entry.name);
|
|
166
|
-
if (comment)
|
|
167
|
-
ids.add(comment.id);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
};
|
|
171
|
-
walk(navRoot, 0);
|
|
172
|
-
return ids;
|
|
173
|
-
}
|
|
174
|
-
/** Repository-relative path of an absolute path, in POSIX form. */
|
|
175
|
-
export function toRepoRelative(ctx, absolute) {
|
|
176
|
-
return relative(ctx.repoRoot, absolute).split(sep).join("/");
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=workspace.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/cli/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,aAAa,EAAc,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAgB,SAAS,EAAa,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAOnC,qDAAqD;AACrD,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,OAAwB,EAAE;IACrE,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,KAAK,KAAK,CAAC;IACvD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,C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
|
|
2
|
-
* Comment files — spec 02 §2.6. One file per comment, named with a colon-free
|
|
3
|
-
* UTC timestamp plus the comment's own ID, so listings sort chronologically and
|
|
4
|
-
* concurrent comments can never collide.
|
|
5
|
-
*/
|
|
6
|
-
export declare const COMMENT_NAME_PATTERN: RegExp;
|
|
7
|
-
export interface CommentName {
|
|
8
|
-
stamp: string;
|
|
9
|
-
date: Date;
|
|
10
|
-
id: string;
|
|
11
|
-
}
|
|
12
|
-
/** Build the filename for a comment created at `date` with identifier `id`. */
|
|
13
|
-
export declare function commentFileName(date: Date, id: string): string;
|
|
14
|
-
/** Parse a comment filename, or return null when it violates the grammar. */
|
|
15
|
-
export declare function parseCommentFileName(name: string): CommentName | null;
|
|
16
|
-
export interface ThreadItem<T> {
|
|
17
|
-
comment: T;
|
|
18
|
-
depth: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Order comments for display: chronologically by filename, with replies placed
|
|
22
|
-
* directly under the comment they answer and indented by one level.
|
|
23
|
-
*
|
|
24
|
-
* Replies to unknown comments, and reply cycles, degrade to top level rather
|
|
25
|
-
* than disappearing.
|
|
26
|
-
*/
|
|
27
|
-
export declare function threadOrder<T extends {
|
|
28
|
-
id: string;
|
|
29
|
-
replyTo?: string;
|
|
30
|
-
fileName: string;
|
|
31
|
-
}>(comments: readonly T[]): ThreadItem<T>[];
|
package/dist/core/comments.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comment files — spec 02 §2.6. One file per comment, named with a colon-free
|
|
3
|
-
* UTC timestamp plus the comment's own ID, so listings sort chronologically and
|
|
4
|
-
* concurrent comments can never collide.
|
|
5
|
-
*/
|
|
6
|
-
import { isId } from "./id.js";
|
|
7
|
-
import { fromCompactStamp, toCompactStamp } from "./time.js";
|
|
8
|
-
export const COMMENT_NAME_PATTERN = /^(\d{4}-\d{2}-\d{2}T\d{6}Z)-([a-z][a-z0-9]{7})\.md$/;
|
|
9
|
-
/** Build the filename for a comment created at `date` with identifier `id`. */
|
|
10
|
-
export function commentFileName(date, id) {
|
|
11
|
-
return `${toCompactStamp(date)}-${id}.md`;
|
|
12
|
-
}
|
|
13
|
-
/** Parse a comment filename, or return null when it violates the grammar. */
|
|
14
|
-
export function parseCommentFileName(name) {
|
|
15
|
-
const match = COMMENT_NAME_PATTERN.exec(name);
|
|
16
|
-
if (!match)
|
|
17
|
-
return null;
|
|
18
|
-
const stamp = match[1];
|
|
19
|
-
const id = match[2];
|
|
20
|
-
if (!isId(id))
|
|
21
|
-
return null;
|
|
22
|
-
const date = fromCompactStamp(stamp);
|
|
23
|
-
if (!date)
|
|
24
|
-
return null;
|
|
25
|
-
return { stamp, date, id };
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Order comments for display: chronologically by filename, with replies placed
|
|
29
|
-
* directly under the comment they answer and indented by one level.
|
|
30
|
-
*
|
|
31
|
-
* Replies to unknown comments, and reply cycles, degrade to top level rather
|
|
32
|
-
* than disappearing.
|
|
33
|
-
*/
|
|
34
|
-
export function threadOrder(comments) {
|
|
35
|
-
const sorted = [...comments].sort((a, b) => a.fileName < b.fileName ? -1 : a.fileName > b.fileName ? 1 : 0);
|
|
36
|
-
const byId = new Map(sorted.map((c) => [c.id, c]));
|
|
37
|
-
const children = new Map();
|
|
38
|
-
const roots = [];
|
|
39
|
-
for (const comment of sorted) {
|
|
40
|
-
const parent = comment.replyTo ? byId.get(comment.replyTo) : undefined;
|
|
41
|
-
if (!parent || parent.id === comment.id || createsCycle(comment, byId)) {
|
|
42
|
-
roots.push(comment);
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
const bucket = children.get(parent.id);
|
|
46
|
-
if (bucket)
|
|
47
|
-
bucket.push(comment);
|
|
48
|
-
else
|
|
49
|
-
children.set(parent.id, [comment]);
|
|
50
|
-
}
|
|
51
|
-
const out = [];
|
|
52
|
-
// Guard on identity, not id: duplicate ids are a doctor error (D3), and
|
|
53
|
-
// until they are fixed the thread must still show each file exactly once.
|
|
54
|
-
const emitted = new Set();
|
|
55
|
-
const walk = (comment, depth) => {
|
|
56
|
-
if (emitted.has(comment))
|
|
57
|
-
return;
|
|
58
|
-
emitted.add(comment);
|
|
59
|
-
out.push({ comment, depth });
|
|
60
|
-
for (const child of children.get(comment.id) ?? [])
|
|
61
|
-
walk(child, depth + 1);
|
|
62
|
-
};
|
|
63
|
-
for (const root of roots)
|
|
64
|
-
walk(root, 0);
|
|
65
|
-
for (const comment of sorted)
|
|
66
|
-
walk(comment, 0);
|
|
67
|
-
return out;
|
|
68
|
-
}
|
|
69
|
-
function createsCycle(start, byId) {
|
|
70
|
-
const seen = new Set([start.id]);
|
|
71
|
-
let current = start.replyTo ? byId.get(start.replyTo) : undefined;
|
|
72
|
-
while (current) {
|
|
73
|
-
if (seen.has(current.id))
|
|
74
|
-
return true;
|
|
75
|
-
seen.add(current.id);
|
|
76
|
-
current = current.replyTo ? byId.get(current.replyTo) : undefined;
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=comments.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../src/core/comments.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,qDAAqD,CAAC;AAQ1F,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,IAAU,EAAE,EAAU;IACpD,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;AAC5C,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,oBAAoB,CAAC,IAAY;IAC/C,MAAM,KAAK,GAAG,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9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AK,CAAC,EAAE,CAAC,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClE,OAAO,OAAO,EAAE,CAAC;QACf,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;YAAE,OAAO,IAAI,CAAC;QACtC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrB,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/core/files.d.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The three Navbook file kinds — spec 02 §2.5 (`issue.md`), §2.6 (comments and
|
|
3
|
-
* reviews) and §2.7 (`pr.md`): parsing, validation, and construction.
|
|
4
|
-
*
|
|
5
|
-
* Parsing never throws on schema problems; it collects them so `nav doctor` can
|
|
6
|
-
* report every fault in a file at once.
|
|
7
|
-
*
|
|
8
|
-
* Frontmatter is normalized once, at parse time: keys whose spec type is a
|
|
9
|
-
* string (or a list/map of strings) are read from the scalar's source text, so
|
|
10
|
-
* a hand-written all-digit commit SHA — which YAML would resolve to a lossy
|
|
11
|
-
* number — still round-trips as the forty characters the author typed.
|
|
12
|
-
*/
|
|
13
|
-
import { type NavDoc } from "./frontmatter.ts";
|
|
14
|
-
export declare const SHA_PATTERN: RegExp;
|
|
15
|
-
export declare const VERDICTS: readonly ["approve", "request-changes"];
|
|
16
|
-
export type Verdict = (typeof VERDICTS)[number];
|
|
17
|
-
export interface Problem {
|
|
18
|
-
key?: string;
|
|
19
|
-
message: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ParsedFile {
|
|
22
|
-
nav: NavDoc;
|
|
23
|
-
/** Frontmatter with spec-typed keys normalized; unknown keys passed through. */
|
|
24
|
-
fm: Record<string, unknown>;
|
|
25
|
-
/** Frontmatter exactly as the YAML parser resolved it. */
|
|
26
|
-
raw: Record<string, unknown>;
|
|
27
|
-
body: string;
|
|
28
|
-
problems: Problem[];
|
|
29
|
-
}
|
|
30
|
-
export interface Revision {
|
|
31
|
-
head: string;
|
|
32
|
-
base: string;
|
|
33
|
-
date: string;
|
|
34
|
-
}
|
|
35
|
-
/** Parse any Navbook file; frontmatter faults surface as problems, not throws. */
|
|
36
|
-
export declare function parseFile(text: string): ParsedFile;
|
|
37
|
-
/** Coerce spec-typed frontmatter keys; leave unknown keys exactly as parsed. */
|
|
38
|
-
export declare function normalizeFrontmatter(nav: NavDoc, parsed?: Record<string, unknown>): Record<string, unknown>;
|
|
39
|
-
/** Read `labels` defensively, ignoring malformed entries. */
|
|
40
|
-
export declare function readLabels(fm: Record<string, unknown>): string[];
|
|
41
|
-
/** Read `assignee` (scalar or list) defensively. */
|
|
42
|
-
export declare function readAssignees(fm: Record<string, unknown>): string[];
|
|
43
|
-
/** Read `revisions` defensively, keeping only well-formed entries. */
|
|
44
|
-
export declare function readRevisions(fm: Record<string, unknown>): Revision[];
|
|
45
|
-
/** Read the `merged:` block defensively. */
|
|
46
|
-
export declare function readMerged(fm: Record<string, unknown>): Record<string, unknown> | null;
|
|
47
|
-
/** Validate an `issue.md` (§2.5). */
|
|
48
|
-
export declare function validateIssue(parsed: ParsedFile): Problem[];
|
|
49
|
-
/** Validate a `pr.md` (§2.7). */
|
|
50
|
-
export declare function validatePr(parsed: ParsedFile): Problem[];
|
|
51
|
-
/** Validate a comment file (§2.6), including the optional review fields. */
|
|
52
|
-
export declare function validateComment(parsed: ParsedFile, opts: {
|
|
53
|
-
onPr: boolean;
|
|
54
|
-
}): Problem[];
|
|
55
|
-
export interface NewIssueInput {
|
|
56
|
-
title: string;
|
|
57
|
-
author: string;
|
|
58
|
-
created: string;
|
|
59
|
-
body: string;
|
|
60
|
-
labels?: string[];
|
|
61
|
-
assignee?: string[];
|
|
62
|
-
milestone?: string;
|
|
63
|
-
}
|
|
64
|
-
/** Render a new `issue.md`. */
|
|
65
|
-
export declare function newIssueFile(input: NewIssueInput): string;
|
|
66
|
-
export interface NewPrInput extends NewIssueInput {
|
|
67
|
-
target: string;
|
|
68
|
-
source: string;
|
|
69
|
-
revisions: Revision[];
|
|
70
|
-
draft?: boolean;
|
|
71
|
-
}
|
|
72
|
-
/** Render a new `pr.md`. */
|
|
73
|
-
export declare function newPrFile(input: NewPrInput): string;
|
|
74
|
-
export interface NewCommentInput {
|
|
75
|
-
author: string;
|
|
76
|
-
body: string;
|
|
77
|
-
replyTo?: string;
|
|
78
|
-
verdict?: Verdict;
|
|
79
|
-
revision?: string;
|
|
80
|
-
file?: string;
|
|
81
|
-
line?: string;
|
|
82
|
-
}
|
|
83
|
-
/** Render a new comment or review file. */
|
|
84
|
-
export declare function newCommentFile(input: NewCommentInput): string;
|
|
85
|
-
/** Trim trailing whitespace and guarantee exactly one closing newline. */
|
|
86
|
-
export declare function normalizeBody(body: string): string;
|
|
87
|
-
/** Format a person for frontmatter, falling back to the bare address. */
|
|
88
|
-
export declare function formatAuthor(name: string | undefined, email: string): string;
|