@goodfoot/git-mesh 1.0.0 → 1.0.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/man/git-mesh.1 ADDED
@@ -0,0 +1,175 @@
1
+ .ie \n(.g .ds Aq \(aq
2
+ .el .ds Aq '
3
+ .TH git-mesh 1 "git-mesh 1.0.13"
4
+ .ie \n(.g .ds Aq \(aq
5
+ .el .ds Aq '
6
+ .SH NAME
7
+ git\-mesh \- Track implicit semantic dependencies in a git repo.
8
+ .ie \n(.g .ds Aq \(aq
9
+ .el .ds Aq '
10
+ .SH SYNOPSIS
11
+ \fBgit\-mesh\fR [\fB\-h\fR|\fB\-\-help\fR] [\fB\-V\fR|\fB\-\-version\fR] [\fIsubcommands\fR]
12
+ .SH DESCRIPTION
13
+ .B git mesh
14
+ tracks implicit semantic dependencies in a Git repository: couplings between
15
+ line ranges (or whole files), in code or prose, that no schema, type, or test
16
+ enforces.
17
+ Each
18
+ .B mesh
19
+ anchors the participating ranges and carries a durable
20
+ .I why
21
+ \[em] one prose sentence that names the relationship the anchored ranges hold
22
+ and survives a rewrite of either side.
23
+ .PP
24
+ The standing question at commit time: did this change create or rely on a
25
+ coupling that is not visible from the lines themselves?
26
+ .PP
27
+ .B Writing the why.
28
+ Name the relationship the ranges hold in one prose sentence, written so it
29
+ survives a rewrite of either side.
30
+ Describe the relationship in role\-words (\(lqthe doc,\(rq \(lqthe parser,\(rq
31
+ \(lqthe runbook,\(rq \(lqthe migration\(rq) rather than repeating filenames.
32
+ For asymmetric relationships, name which side is normative:
33
+ \(lqthe doc is the source of truth when they disagree.\(rq
34
+ Do not restate the mesh name, embed incidental implementation details, or
35
+ bundle ownership and review triggers in the why.
36
+ .PP
37
+ .B Re\-anchoring on drift.
38
+ When
39
+ .B git mesh stale
40
+ reports drift, review the change at each anchor.
41
+ If the relationship still holds, re-anchor with
42
+ .B git mesh add
43
+ and commit.
44
+ If the relationship has changed, update the why with
45
+ .B git mesh why
46
+ before re-anchoring.
47
+ .PP
48
+ Meshes are stored as Git refs under
49
+ .IR refs/meshes/v1/<name> ,
50
+ so they travel with
51
+ .B git fetch
52
+ and
53
+ .B git push
54
+ like branches and tags.
55
+ .B git mesh fetch
56
+ and
57
+ .B git mesh push
58
+ keep remote mirrors in sync.
59
+ .PP
60
+ Bare invocations:
61
+ .RS 4
62
+ .TP
63
+ .B git mesh
64
+ List every mesh in the repository.
65
+ .TP
66
+ .BI git\ mesh\ <name>
67
+ Show one mesh (ranges, why, config).
68
+ .RE
69
+ .ie \n(.g .ds Aq \(aq
70
+ .el .ds Aq '
71
+ .SH OPTIONS
72
+ .TP
73
+ \fB\-h\fR, \fB\-\-help\fR
74
+ Print help
75
+ .TP
76
+ \fB\-V\fR, \fB\-\-version\fR
77
+ Print version
78
+ .ie \n(.g .ds Aq \(aq
79
+ .el .ds Aq '
80
+ .SH SUBCOMMANDS
81
+ .TP
82
+ git\-mesh\-ls(1)
83
+ List files and ranges currently tracked by a mesh
84
+ .TP
85
+ git\-mesh\-stale(1)
86
+ Report ranges whose content has drifted from their anchored state
87
+ .TP
88
+ git\-mesh\-add(1)
89
+ Stage ranges to add on the next mesh commit
90
+ .TP
91
+ git\-mesh\-rm(1)
92
+ Stage ranges to remove on the next mesh commit
93
+ .TP
94
+ git\-mesh\-why(1)
95
+ Read or stage the mesh\*(Aqs why — the durable one\-sentence definition of the relationship the anchored ranges hold
96
+ .TP
97
+ git\-mesh\-commit(1)
98
+ Resolve staged operations and write a mesh commit
99
+ .TP
100
+ git\-mesh\-restore(1)
101
+ Clear the staging area
102
+ .TP
103
+ git\-mesh\-revert(1)
104
+ Fast\-forward a mesh to a past state
105
+ .TP
106
+ git\-mesh\-delete(1)
107
+ Delete a mesh ref
108
+ .TP
109
+ git\-mesh\-mv(1)
110
+ Rename a mesh ref
111
+ .TP
112
+ git\-mesh\-config(1)
113
+ Read or stage mesh\-level resolver options
114
+ .TP
115
+ git\-mesh\-fetch(1)
116
+ Fetch mesh and range refs from a remote
117
+ .TP
118
+ git\-mesh\-push(1)
119
+ Push mesh and range refs to a remote
120
+ .TP
121
+ git\-mesh\-doctor(1)
122
+ Audit the local mesh setup
123
+ .TP
124
+ git\-mesh\-pre\-commit(1)
125
+ Fail the current commit if any drift is visible in the staged tree
126
+ .TP
127
+ git\-mesh\-advice(1)
128
+ Append events and flush session\-scoped advice
129
+ .TP
130
+ git\-mesh\-help(1)
131
+ Print this message or the help of the given subcommand(s)
132
+ .ie \n(.g .ds Aq \(aq
133
+ .el .ds Aq '
134
+ .SH VERSION
135
+ v1.0.13
136
+ .SH EXAMPLES
137
+ Anchor a new mesh alongside a code change:
138
+ .PP
139
+ .RS 4
140
+ .nf
141
+ git mesh add billing/charge-request-contract \e
142
+ docs/api/charge.md#L40-L88 api/charge.ts#L30-L76
143
+ git mesh why billing/charge-request-contract \e
144
+ -m "The doc states the request body shape the parser honors; \e
145
+ the doc is the source of truth when they disagree."
146
+ git commit -m "Wire checkout to charge API"
147
+ # post-commit hook runs: git mesh commit
148
+ .fi
149
+ .RE
150
+ .PP
151
+ Document an existing relationship anchored at HEAD:
152
+ .PP
153
+ .RS 4
154
+ .nf
155
+ git mesh add auth/token-contract --at HEAD \e
156
+ packages/auth/token.ts#L88-L104 \e
157
+ packages/auth/crypto.ts#L12-L40
158
+ git mesh why auth/token-contract \e
159
+ -m "Token verification depends on signature verification."
160
+ git mesh commit auth/token-contract
161
+ .fi
162
+ .RE
163
+ .PP
164
+ Check for drift and inspect a mesh:
165
+ .PP
166
+ .RS 4
167
+ .nf
168
+ git mesh stale
169
+ git mesh billing/charge-request-contract
170
+ git mesh billing/charge-request-contract --log
171
+ .fi
172
+ .RE
173
+ .SH SEE ALSO
174
+ .BR git (1),
175
+ .BR gitcli (7)
package/package.json CHANGED
@@ -1,29 +1,34 @@
1
1
  {
2
2
  "name": "@goodfoot/git-mesh",
3
- "version": "1.0.0",
3
+ "version": "1.0.16",
4
4
  "bin": "bin/git-mesh",
5
+ "man": [
6
+ "man/git-mesh.1"
7
+ ],
5
8
  "scripts": {
6
9
  "postinstall": "node scripts/postinstall.js",
7
- "build": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release",
8
- "build:local": "mkdir -p \"$HOME/.local/bin\" && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release && install -m 0755 target/build/release/git-mesh \"$HOME/.local/bin/git-mesh\"",
9
- "build:clean": "rm -rf target/build target/lint target/test target/typecheck && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/build cargo build --release",
10
- "test": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/test cargo test --quiet -- --test-threads=1",
11
- "lint": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/lint cargo clippy --quiet -- -D warnings",
12
- "typecheck": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=target/typecheck cargo check --quiet"
10
+ "build:man": "env CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/build\" cargo run --quiet --bin gen-manpage -- man/git-mesh.1",
11
+ "build": "yarn build:man && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/build\" cargo build --release",
12
+ "build:local": "mkdir -p \"$HOME/.local/bin\" \"$HOME/.local/share/man/man1\" && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/build\" cargo build --release && install -m 0755 \"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/build/release/git-mesh\" \"$HOME/.local/bin/git-mesh\" && yarn build:man && install -m 0644 man/git-mesh.1 \"$HOME/.local/share/man/man1/git-mesh.1\"",
13
+ "build:clean": "rm -rf \"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}\" && yarn build:man && env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/build\" cargo build --release",
14
+ "test": "env CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/test\" cargo nextest run --build-jobs 1",
15
+ "lint": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/lint\" cargo clippy --quiet -- -D warnings",
16
+ "typecheck": "env CARGO_BUILD_JOBS=1 CARGO_TARGET_DIR=\"${GIT_MESH_CARGO_TARGET_ROOT:-$HOME/.cache/git-mesh/cargo-target}/typecheck\" cargo check --quiet --locked"
13
17
  },
14
18
  "files": [
15
19
  "bin/",
20
+ "man/",
16
21
  "scripts/postinstall.js"
17
22
  ],
18
23
  "optionalDependencies": {
19
- "@goodfoot/git-mesh-darwin-arm64": "1.0.0",
20
- "@goodfoot/git-mesh-darwin-x64": "1.0.0",
21
- "@goodfoot/git-mesh-linux-arm64": "1.0.0",
22
- "@goodfoot/git-mesh-linux-x64": "1.0.0",
23
- "@goodfoot/git-mesh-win32-x64": "1.0.0"
24
+ "@goodfoot/git-mesh-darwin-arm64": "1.0.16",
25
+ "@goodfoot/git-mesh-darwin-x64": "1.0.16",
26
+ "@goodfoot/git-mesh-linux-arm64": "1.0.16",
27
+ "@goodfoot/git-mesh-linux-x64": "1.0.16",
28
+ "@goodfoot/git-mesh-win32-x64": "1.0.16"
24
29
  },
25
30
  "repository": {
26
31
  "type": "git",
27
32
  "url": "git+https://github.com/goodfoot-io/git-mesh.git"
28
33
  }
29
- }
34
+ }
@@ -2,6 +2,7 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const { spawnSync } = require('child_process');
5
6
 
6
7
  const PLATFORM_MAP = {
7
8
  linux: 'linux',
@@ -22,6 +23,37 @@ function fail(message, error) {
22
23
  process.exit(1);
23
24
  }
24
25
 
26
+ function buildFromSource(destBinary, binaryName) {
27
+ const cargoToml = path.join(__dirname, '..', 'Cargo.toml');
28
+ if (!fs.existsSync(cargoToml)) {
29
+ fail(`@goodfoot/git-mesh: Binary not found at ${destBinary} and no Cargo.toml available to build from source.`);
30
+ }
31
+
32
+ console.log(`@goodfoot/git-mesh: Prebuilt binary missing; building from source via cargo...`);
33
+
34
+ const targetDir = path.join(__dirname, '..', 'target', 'build');
35
+ const result = spawnSync('cargo', ['build', '--release', '--manifest-path', cargoToml], {
36
+ stdio: 'inherit',
37
+ env: { ...process.env, CARGO_BUILD_JOBS: '1', CARGO_TARGET_DIR: targetDir }
38
+ });
39
+
40
+ if (result.error || result.status !== 0) {
41
+ fail(
42
+ `@goodfoot/git-mesh: Failed to build binary from source. Install Rust/cargo or publish the platform package.`,
43
+ result.error
44
+ );
45
+ }
46
+
47
+ const builtBinary = path.join(targetDir, 'release', binaryName);
48
+ if (!fs.existsSync(builtBinary)) {
49
+ fail(`@goodfoot/git-mesh: cargo build succeeded but binary not found at ${builtBinary}.`);
50
+ }
51
+
52
+ fs.mkdirSync(path.dirname(destBinary), { recursive: true });
53
+ fs.copyFileSync(builtBinary, destBinary);
54
+ fs.chmodSync(destBinary, 0o755);
55
+ }
56
+
25
57
  function main() {
26
58
  const platform = PLATFORM_MAP[process.platform];
27
59
  const arch = ARCH_MAP[process.arch];
@@ -42,7 +74,7 @@ function main() {
42
74
 
43
75
  const sourceBinary = path.join(packageDir, 'bin', sourceBinaryName);
44
76
  if (!fs.existsSync(sourceBinary)) {
45
- fail(`@goodfoot/git-mesh: Binary not found in ${packageName}. The package may not have been published correctly.`);
77
+ buildFromSource(sourceBinary, sourceBinaryName);
46
78
  }
47
79
 
48
80
  const binGitMesh = path.join(__dirname, '..', 'bin', 'git-mesh');