@plebeiantech/lat.md 0.12.3-fork.10 → 0.12.3-fork.12
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.
|
@@ -63,7 +63,7 @@ export function fetchUpstream(repo, url, ref) {
|
|
|
63
63
|
throw new Error(`fetching ${url} failed: ${result.stderr.trim()}`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
// @lat: [[
|
|
66
|
+
// @lat: [[upstream-guard#The upstream guard#Watching the drift]]
|
|
67
67
|
export function analyzeDrift(opts) {
|
|
68
68
|
const root = repoRoot(opts.repo);
|
|
69
69
|
const head = git(root, ['rev-parse', 'HEAD']).stdout.trim();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const SYNC_POINT_FILE = "fork-upstream-sync-point";
|
|
2
2
|
/**
|
|
3
3
|
* The commit this fork was originally cut from. It is not the guard's
|
|
4
|
-
* baseline — see [[
|
|
4
|
+
* baseline — see [[upstream-guard#The upstream guard#The sync point]] for why a frozen
|
|
5
5
|
* one cannot tell the fork's changes from upstream's.
|
|
6
6
|
*/
|
|
7
7
|
export declare const ORIGINAL_FORK_POINT = "65d2f5b220853b2b10dca3de18d511f575bc12c7";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process';
|
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
3
3
|
import { isAbsolute, resolve } from 'node:path';
|
|
4
|
-
// @lat: [[
|
|
4
|
+
// @lat: [[upstream-guard#The upstream guard]]
|
|
5
5
|
export const SYNC_POINT_FILE = 'fork-upstream-sync-point';
|
|
6
6
|
/**
|
|
7
7
|
* The commit this fork was originally cut from. It is not the guard's
|
|
8
|
-
* baseline — see [[
|
|
8
|
+
* baseline — see [[upstream-guard#The upstream guard#The sync point]] for why a frozen
|
|
9
9
|
* one cannot tell the fork's changes from upstream's.
|
|
10
10
|
*/
|
|
11
11
|
export const ORIGINAL_FORK_POINT = '65d2f5b220853b2b10dca3de18d511f575bc12c7';
|
|
12
|
-
// @lat: [[
|
|
12
|
+
// @lat: [[upstream-guard#The upstream guard#The allowlist]]
|
|
13
13
|
export const ALLOWLIST_FILE = 'fork-upstream-allowlist.tsv';
|
|
14
14
|
export const REASON_PLACEHOLDER = 'TODO';
|
|
15
15
|
const ALLOWLIST_HEADER = [
|
|
@@ -188,7 +188,7 @@ export function upstreamPaths(repo, rev, paths) {
|
|
|
188
188
|
}
|
|
189
189
|
return out;
|
|
190
190
|
}
|
|
191
|
-
// @lat: [[
|
|
191
|
+
// @lat: [[upstream-guard#The upstream guard#The sync point]]
|
|
192
192
|
export function parseSyncPoint(text) {
|
|
193
193
|
for (const raw of text.split('\n')) {
|
|
194
194
|
const line = raw.replace(/\r$/, '').trim();
|
|
@@ -216,7 +216,7 @@ export function isShallow(repo) {
|
|
|
216
216
|
const result = git(repo, ['rev-parse', '--is-shallow-repository']);
|
|
217
217
|
return result.stdout.trim() === 'true';
|
|
218
218
|
}
|
|
219
|
-
// @lat: [[
|
|
219
|
+
// @lat: [[upstream-guard#The upstream guard#Running it in CI]]
|
|
220
220
|
export function fetchSyncPoint(repo, rev) {
|
|
221
221
|
const result = git(repo, ['fetch', '--no-tags', '--depth=1', 'origin', rev]);
|
|
222
222
|
return result.status === 0 && hasCommit(repo, rev);
|
|
@@ -317,7 +317,7 @@ export function runGuard(options) {
|
|
|
317
317
|
warnings: result.warnings,
|
|
318
318
|
};
|
|
319
319
|
}
|
|
320
|
-
// @lat: [[
|
|
320
|
+
// @lat: [[upstream-guard#The upstream guard#The sync point]]
|
|
321
321
|
function recordSyncPoint(repo, file, rev) {
|
|
322
322
|
const resolved = git(repo, ['rev-parse', `${rev}^{commit}`]);
|
|
323
323
|
if (resolved.status !== 0) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# lat.md conventions this project enforces
|
|
2
2
|
|
|
3
|
-
`lat check` fails on
|
|
4
|
-
|
|
3
|
+
`lat check` fails on the first three rules below. The last two it cannot see,
|
|
4
|
+
and they matter as much. None of the five are style preferences. This block is
|
|
5
5
|
generated and a later `lat init` replaces it — record project guidance in
|
|
6
6
|
`lat.md/`, never here.
|
|
7
7
|
|
|
@@ -95,6 +95,38 @@ covers it, and every section needs at least one sentence saying what it
|
|
|
95
95
|
verifies and why. `lat check` reports any spec section no test claims, and any
|
|
96
96
|
ref pointing at no section.
|
|
97
97
|
|
|
98
|
+
## One specialty per document
|
|
99
|
+
|
|
100
|
+
A document is **small**, **discrete**, and does **not conflict** with any
|
|
101
|
+
other. Those are three demands on the same thing: a reader must be able to
|
|
102
|
+
find the one place a fact is written down, and trust it.
|
|
103
|
+
|
|
104
|
+
**Small — a document covers one specialty.** Not one topic area; one
|
|
105
|
+
specialty. When a document covers two, it is two documents. Past roughly forty
|
|
106
|
+
sections it has almost certainly become several, and an agent then loads all of
|
|
107
|
+
it to reach one part.
|
|
108
|
+
|
|
109
|
+
**Discrete — each document covers its own specialty.** Before writing a new
|
|
110
|
+
document, search for the specialty first:
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
lat search "the thing you are about to document"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
An overlap has two honest repairs, and picking neither is what produces the
|
|
117
|
+
third copy. Either the two are one document and belong merged, or the part they
|
|
118
|
+
share is its own document that both link. Deciding they are "mostly different"
|
|
119
|
+
and writing anyway is how the set rots.
|
|
120
|
+
|
|
121
|
+
**Does not conflict — two documents never say different things about the same
|
|
122
|
+
specialty.** Never restate a fact another document owns. Link to it with
|
|
123
|
+
`[[section]]`. A restatement is a second copy, a second copy drifts, and drift
|
|
124
|
+
is how document B ends up contradicting document A while both look maintained.
|
|
125
|
+
|
|
126
|
+
The mode rule above is the sharpest available test of "one specialty": a
|
|
127
|
+
document that fails its mode is usually two documents. Split it. Do not soften
|
|
128
|
+
the prose until the check passes.
|
|
129
|
+
|
|
98
130
|
## Read sections, not files
|
|
99
131
|
|
|
100
132
|
`lat search` prints a section id and the exact lines that section occupies.
|
|
@@ -113,7 +145,3 @@ asked about.
|
|
|
113
145
|
|
|
114
146
|
Use `lat expand` on a prompt carrying `[[refs]]` for the same reason: it
|
|
115
147
|
resolves each ref to a location and a preview rather than to a file.
|
|
116
|
-
|
|
117
|
-
The authoring half of the same rule: when a document passes roughly forty
|
|
118
|
-
sections, it has usually become several documents. Split it before an agent
|
|
119
|
-
has to load all of it to reach one part.
|