mossbear 0.1.0-alpha.104 → 0.1.0-alpha.106
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/README.md +3 -3
- package/dist/artifacts/alias-history.d.ts +68 -0
- package/dist/artifacts/alias-history.d.ts.map +1 -0
- package/dist/artifacts/alias-history.js +125 -0
- package/dist/artifacts/alias-history.js.map +1 -0
- package/dist/artifacts/alias-mirror.d.ts +18 -7
- package/dist/artifacts/alias-mirror.d.ts.map +1 -1
- package/dist/artifacts/alias-mirror.js +52 -9
- package/dist/artifacts/alias-mirror.js.map +1 -1
- package/dist/artifacts/artifact-comments.d.ts +8 -2
- package/dist/artifacts/artifact-comments.d.ts.map +1 -1
- package/dist/artifacts/artifact-comments.js +55 -36
- package/dist/artifacts/artifact-comments.js.map +1 -1
- package/dist/artifacts/global-delivery.d.ts +9 -3
- package/dist/artifacts/global-delivery.d.ts.map +1 -1
- package/dist/artifacts/global-delivery.js +5 -1
- package/dist/artifacts/global-delivery.js.map +1 -1
- package/dist/artifacts/global-namespace.d.ts +50 -4
- package/dist/artifacts/global-namespace.d.ts.map +1 -1
- package/dist/artifacts/global-namespace.js +73 -6
- package/dist/artifacts/global-namespace.js.map +1 -1
- package/dist/artifacts/published-artifacts.d.ts +17 -1
- package/dist/artifacts/published-artifacts.d.ts.map +1 -1
- package/dist/artifacts/published-artifacts.js +38 -24
- package/dist/artifacts/published-artifacts.js.map +1 -1
- package/dist/artifacts/status.d.ts.map +1 -1
- package/dist/artifacts/status.js +9 -9
- package/dist/artifacts/status.js.map +1 -1
- package/dist/artifacts/sync-artifacts.d.ts +5 -1
- package/dist/artifacts/sync-artifacts.d.ts.map +1 -1
- package/dist/artifacts/sync-artifacts.js +115 -485
- package/dist/artifacts/sync-artifacts.js.map +1 -1
- package/dist/artifacts/sync-execution.d.ts +57 -0
- package/dist/artifacts/sync-execution.d.ts.map +1 -0
- package/dist/artifacts/sync-execution.js +385 -0
- package/dist/artifacts/sync-execution.js.map +1 -0
- package/dist/artifacts/sync-plan.d.ts +29 -17
- package/dist/artifacts/sync-plan.d.ts.map +1 -1
- package/dist/artifacts/sync-plan.js +134 -26
- package/dist/artifacts/sync-plan.js.map +1 -1
- package/dist/commands/artifacts/remote.d.ts +7 -1
- package/dist/commands/artifacts/remote.d.ts.map +1 -1
- package/dist/commands/artifacts/remote.js +1 -1
- package/dist/commands/artifacts/remote.js.map +1 -1
- package/dist/commands/artifacts/stamp.d.ts +1 -1
- package/dist/commands/comment.d.ts +1 -1
- package/dist/commands/comments.d.ts +1 -1
- package/dist/commands/comments.d.ts.map +1 -1
- package/dist/commands/comments.js +1 -1
- package/dist/commands/comments.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.js +1 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/lifecycle.d.ts +3 -3
- package/dist/commands/link.d.ts +1 -1
- package/dist/commands/mcp.d.ts +1 -1
- package/dist/commands/promote.d.ts +1 -1
- package/dist/commands/publish.d.ts +1 -1
- package/dist/commands/publish.d.ts.map +1 -1
- package/dist/commands/publish.js +32 -1
- package/dist/commands/publish.js.map +1 -1
- package/dist/commands/pull.d.ts +1 -1
- package/dist/commands/search.d.ts +1 -1
- package/dist/commands/shared-args.d.ts +6 -1
- package/dist/commands/shared-args.d.ts.map +1 -1
- package/dist/commands/shared-args.js +7 -1
- package/dist/commands/shared-args.js.map +1 -1
- package/dist/commands/unlink.d.ts +1 -1
- package/dist/config.d.ts +9 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +59 -129
- package/dist/config.js.map +1 -1
- package/dist/context/materialize.d.ts +13 -5
- package/dist/context/materialize.d.ts.map +1 -1
- package/dist/context/materialize.js +7 -5
- package/dist/context/materialize.js.map +1 -1
- package/dist/context/pull.d.ts +2 -1
- package/dist/context/pull.d.ts.map +1 -1
- package/dist/context/pull.js +2 -1
- package/dist/context/pull.js.map +1 -1
- package/dist/hosted-session-history.d.ts +4 -0
- package/dist/hosted-session-history.d.ts.map +1 -1
- package/dist/hosted-session-history.js +32 -0
- package/dist/hosted-session-history.js.map +1 -1
- package/dist/lifecycle/landed-revisions.d.ts +58 -0
- package/dist/lifecycle/landed-revisions.d.ts.map +1 -0
- package/dist/lifecycle/landed-revisions.js +199 -0
- package/dist/lifecycle/landed-revisions.js.map +1 -0
- package/dist/lifecycle/publish-from-branch.d.ts.map +1 -1
- package/dist/lifecycle/publish-from-branch.js +27 -0
- package/dist/lifecycle/publish-from-branch.js.map +1 -1
- package/dist/lifecycle/retire-skipped-drafts.d.ts +48 -0
- package/dist/lifecycle/retire-skipped-drafts.d.ts.map +1 -0
- package/dist/lifecycle/retire-skipped-drafts.js +98 -0
- package/dist/lifecycle/retire-skipped-drafts.js.map +1 -0
- package/dist/mcp/client.d.ts +8 -1
- package/dist/mcp/client.d.ts.map +1 -1
- package/dist/mcp/client.js +7 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/server.js +12 -7
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/write-items.d.ts +24 -8
- package/dist/mcp/write-items.d.ts.map +1 -1
- package/dist/mcp/write-items.js +36 -12
- package/dist/mcp/write-items.js.map +1 -1
- package/dist/rules/adoption-nudge.d.ts +9 -8
- package/dist/rules/adoption-nudge.d.ts.map +1 -1
- package/dist/rules/adoption-nudge.js +9 -8
- package/dist/rules/adoption-nudge.js.map +1 -1
- package/dist/rules/import-candidates.d.ts +37 -6
- package/dist/rules/import-candidates.d.ts.map +1 -1
- package/dist/rules/import-candidates.js +67 -8
- package/dist/rules/import-candidates.js.map +1 -1
- package/dist/rules/init-import.d.ts.map +1 -1
- package/dist/rules/init-import.js +7 -2
- package/dist/rules/init-import.js.map +1 -1
- package/dist/session-collection-policy.d.ts +2 -0
- package/dist/session-collection-policy.d.ts.map +1 -1
- package/dist/session-collection-policy.js +17 -0
- package/dist/session-collection-policy.js.map +1 -1
- package/dist/usage/snapshot-state.d.ts +17 -0
- package/dist/usage/snapshot-state.d.ts.map +1 -1
- package/dist/usage/snapshot-state.js +64 -0
- package/dist/usage/snapshot-state.js.map +1 -1
- package/dist/usage/snapshots.d.ts.map +1 -1
- package/dist/usage/snapshots.js +4 -4
- package/dist/usage/snapshots.js.map +1 -1
- package/dist/usage/source-provenance.d.ts +17 -7
- package/dist/usage/source-provenance.d.ts.map +1 -1
- package/dist/usage/source-provenance.js +22 -2
- package/dist/usage/source-provenance.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -61,13 +61,13 @@ mossbear doctor # verify hooks + config
|
|
|
61
61
|
|
|
62
62
|
The PostToolUse hook is written as the bare command `mossbear-hook`, a second binary this package installs alongside `mossbear`. It is a separate bin rather than an `mossbear hook` subcommand for two reasons: it runs once per tool call, where booting the full command tree would cost roughly 50ms every time; and a bare command resolved through `PATH` carries nothing machine-specific, so `.claude/settings.json` is identical on every machine and can be committed without churning.
|
|
63
63
|
|
|
64
|
-
To send your sessions to the dashboard, connect
|
|
64
|
+
To send your sessions to the dashboard, connect this machine once:
|
|
65
65
|
|
|
66
66
|
```bash
|
|
67
|
-
mossbear
|
|
67
|
+
mossbear login # prints a code you approve in the browser, then saves the token
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
(`
|
|
70
|
+
Where nobody can approve a code — CI, a container — put a CLI token (dashboard → Settings → Machines) in `MOSSBEAR_TOKEN` instead; a token from the environment is never written to disk. The `--token` flag still works but is deprecated: a token in arguments shows up in shell history and process listings. Then just work normally — your dashboard feed fills in as your agent acts.
|
|
71
71
|
|
|
72
72
|
## Commands
|
|
73
73
|
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which file of a divergent alias set was edited, answered from git history.
|
|
3
|
+
*
|
|
4
|
+
* `deriveAliasMirrors` picks its source from a file with an uncommitted edit.
|
|
5
|
+
* An agent commits inside its own turn and the sync runs at the next session
|
|
6
|
+
* start, so by then the edit is committed on one side and the set sits
|
|
7
|
+
* divergent for good. History still holds the answer: the newest commit at
|
|
8
|
+
* which every file of the set held the same bytes is the last point the pair was
|
|
9
|
+
* in step, and the one file that has changed since is the edit to carry over.
|
|
10
|
+
*
|
|
11
|
+
* Three answers are not an answer, and each is reported as such rather than
|
|
12
|
+
* guessed:
|
|
13
|
+
*
|
|
14
|
+
* - **Several files changed since the common point** — someone edited both
|
|
15
|
+
* sides, and only they can say which is right.
|
|
16
|
+
* - **No commit where the files matched**, within a bounded window of history
|
|
17
|
+
* (`HISTORY_WINDOW` commits that touched the set).
|
|
18
|
+
* - **Git cannot answer** — no work tree, git missing, a timeout, framing this
|
|
19
|
+
* parser does not know. This follows `committed.ts`: a failure resolves to
|
|
20
|
+
* "nothing to say", never to a thrown error that fails the sync.
|
|
21
|
+
*
|
|
22
|
+
* A shallow clone is named separately from the other two, because the fix for
|
|
23
|
+
* it is to fetch more history, and "no common point" would send the reader to
|
|
24
|
+
* look for a divergence that may not exist.
|
|
25
|
+
*
|
|
26
|
+
* Reads only; it never writes, and it compares the blobs git recorded, not the
|
|
27
|
+
* working bytes — the caller has already established that every file in the set
|
|
28
|
+
* holds its committed content.
|
|
29
|
+
*/
|
|
30
|
+
import type { SpawnGitBytesFn } from './committed.js';
|
|
31
|
+
/** Commits that touched the set, newest first, that are inspected before giving up. */
|
|
32
|
+
export declare const HISTORY_WINDOW = 200;
|
|
33
|
+
export type AliasHistoryAnswer =
|
|
34
|
+
/** Exactly one file changed since the files last matched. */
|
|
35
|
+
{
|
|
36
|
+
kind: 'source';
|
|
37
|
+
path: string;
|
|
38
|
+
}
|
|
39
|
+
/** More than one file changed since the files last matched. */
|
|
40
|
+
| {
|
|
41
|
+
kind: 'several';
|
|
42
|
+
paths: string[];
|
|
43
|
+
}
|
|
44
|
+
/** The files never matched within the window, or the window is all there is. */
|
|
45
|
+
| {
|
|
46
|
+
kind: 'no-common-point';
|
|
47
|
+
}
|
|
48
|
+
/** The history ends at a shallow boundary before the files were found to match. */
|
|
49
|
+
| {
|
|
50
|
+
kind: 'shallow';
|
|
51
|
+
}
|
|
52
|
+
/** Git could not answer. */
|
|
53
|
+
| {
|
|
54
|
+
kind: 'no-answer';
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Find the edited file of a set whose files all match `HEAD` but differ.
|
|
58
|
+
*
|
|
59
|
+
* `headBlobs` is what the caller already read for each path at `HEAD`, so this
|
|
60
|
+
* does not ask again. It must hold every path in `paths`.
|
|
61
|
+
*/
|
|
62
|
+
export declare function findEditedFileFromHistory(input: {
|
|
63
|
+
root: string;
|
|
64
|
+
paths: readonly string[];
|
|
65
|
+
headBlobs: ReadonlyMap<string, string>;
|
|
66
|
+
spawnGit?: SpawnGitBytesFn;
|
|
67
|
+
}): AliasHistoryAnswer;
|
|
68
|
+
//# sourceMappingURL=alias-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias-history.d.ts","sourceRoot":"","sources":["../../src/artifacts/alias-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD,uFAAuF;AACvF,eAAO,MAAM,cAAc,MAAM,CAAA;AAKjC,MAAM,MAAM,kBAAkB;AAC5B,6DAA6D;AAC3D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE;AAClC,+DAA+D;GAC7D;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE;AACtC,gFAAgF;GAC9E;IAAE,IAAI,EAAE,iBAAiB,CAAA;CAAE;AAC7B,mFAAmF;GACjF;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE;AACrB,4BAA4B;GAC1B;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAA;AAYzB;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAC/C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACtC,QAAQ,CAAC,EAAE,eAAe,CAAA;CAC3B,GAAG,kBAAkB,CAoFrB"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which file of a divergent alias set was edited, answered from git history.
|
|
3
|
+
*
|
|
4
|
+
* `deriveAliasMirrors` picks its source from a file with an uncommitted edit.
|
|
5
|
+
* An agent commits inside its own turn and the sync runs at the next session
|
|
6
|
+
* start, so by then the edit is committed on one side and the set sits
|
|
7
|
+
* divergent for good. History still holds the answer: the newest commit at
|
|
8
|
+
* which every file of the set held the same bytes is the last point the pair was
|
|
9
|
+
* in step, and the one file that has changed since is the edit to carry over.
|
|
10
|
+
*
|
|
11
|
+
* Three answers are not an answer, and each is reported as such rather than
|
|
12
|
+
* guessed:
|
|
13
|
+
*
|
|
14
|
+
* - **Several files changed since the common point** — someone edited both
|
|
15
|
+
* sides, and only they can say which is right.
|
|
16
|
+
* - **No commit where the files matched**, within a bounded window of history
|
|
17
|
+
* (`HISTORY_WINDOW` commits that touched the set).
|
|
18
|
+
* - **Git cannot answer** — no work tree, git missing, a timeout, framing this
|
|
19
|
+
* parser does not know. This follows `committed.ts`: a failure resolves to
|
|
20
|
+
* "nothing to say", never to a thrown error that fails the sync.
|
|
21
|
+
*
|
|
22
|
+
* A shallow clone is named separately from the other two, because the fix for
|
|
23
|
+
* it is to fetch more history, and "no common point" would send the reader to
|
|
24
|
+
* look for a divergence that may not exist.
|
|
25
|
+
*
|
|
26
|
+
* Reads only; it never writes, and it compares the blobs git recorded, not the
|
|
27
|
+
* working bytes — the caller has already established that every file in the set
|
|
28
|
+
* holds its committed content.
|
|
29
|
+
*/
|
|
30
|
+
import { spawnSync } from 'node:child_process';
|
|
31
|
+
import { parseCatFileBatch } from './committed.js';
|
|
32
|
+
/** Commits that touched the set, newest first, that are inspected before giving up. */
|
|
33
|
+
export const HISTORY_WINDOW = 200;
|
|
34
|
+
/** Commits whose blobs one `cat-file` process reads. */
|
|
35
|
+
const COMMITS_PER_BATCH = 20;
|
|
36
|
+
function defaultSpawnGit(args, cwd, input) {
|
|
37
|
+
const result = spawnSync('git', [...args], {
|
|
38
|
+
cwd,
|
|
39
|
+
input: Buffer.from(input, 'utf8'),
|
|
40
|
+
timeout: 10_000,
|
|
41
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
42
|
+
});
|
|
43
|
+
return { status: result.status, stdout: result.stdout ?? Buffer.alloc(0) };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Find the edited file of a set whose files all match `HEAD` but differ.
|
|
47
|
+
*
|
|
48
|
+
* `headBlobs` is what the caller already read for each path at `HEAD`, so this
|
|
49
|
+
* does not ask again. It must hold every path in `paths`.
|
|
50
|
+
*/
|
|
51
|
+
export function findEditedFileFromHistory(input) {
|
|
52
|
+
const { root, paths, headBlobs, spawnGit = defaultSpawnGit } = input;
|
|
53
|
+
if (paths.length < 2)
|
|
54
|
+
return { kind: 'no-answer' };
|
|
55
|
+
// A path with a newline would forge a second request line in the batch below.
|
|
56
|
+
if (paths.some((path) => path.includes('\n') || path.includes('\0'))) {
|
|
57
|
+
return { kind: 'no-answer' };
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const log = spawnGit([
|
|
61
|
+
'--no-optional-locks',
|
|
62
|
+
'--literal-pathspecs',
|
|
63
|
+
'log',
|
|
64
|
+
// Without it git drops a merge commit whose state matches a parent's,
|
|
65
|
+
// and the walk can pass over the very commit that reconciled the pair.
|
|
66
|
+
'--full-history',
|
|
67
|
+
'--format=%H',
|
|
68
|
+
'-n',
|
|
69
|
+
String(HISTORY_WINDOW),
|
|
70
|
+
'--',
|
|
71
|
+
...paths,
|
|
72
|
+
], root, '');
|
|
73
|
+
if (log.status !== 0)
|
|
74
|
+
return { kind: 'no-answer' };
|
|
75
|
+
const commits = log.stdout
|
|
76
|
+
.toString('utf8')
|
|
77
|
+
.split('\n')
|
|
78
|
+
.filter((line) => line !== '');
|
|
79
|
+
if (commits.length === 0)
|
|
80
|
+
return { kind: 'no-common-point' };
|
|
81
|
+
// A few commits per `cat-file` process, newest first: the usual common point
|
|
82
|
+
// is within the first handful, and a long history of large guide files
|
|
83
|
+
// should not be read whole to find it.
|
|
84
|
+
for (let start = 0; start < commits.length; start += COMMITS_PER_BATCH) {
|
|
85
|
+
const batchCommits = commits.slice(start, start + COMMITS_PER_BATCH);
|
|
86
|
+
const requests = batchCommits.flatMap((commit) => paths.map((path) => `${commit}:${path}`));
|
|
87
|
+
const batch = spawnGit(['--no-optional-locks', 'cat-file', '--batch'], root, `${requests.join('\n')}\n`);
|
|
88
|
+
if (batch.status !== 0)
|
|
89
|
+
return { kind: 'no-answer' };
|
|
90
|
+
const records = parseCatFileBatch(batch.stdout, requests.length);
|
|
91
|
+
if (records === null)
|
|
92
|
+
return { kind: 'no-answer' };
|
|
93
|
+
for (const [commitIndex] of batchCommits.entries()) {
|
|
94
|
+
const blobs = paths.map((_, pathIndex) => {
|
|
95
|
+
const record = records[commitIndex * paths.length + pathIndex];
|
|
96
|
+
return record === null || record === undefined
|
|
97
|
+
? undefined
|
|
98
|
+
: record.blob.toString('utf8');
|
|
99
|
+
});
|
|
100
|
+
const common = blobs[0];
|
|
101
|
+
if (common === undefined || blobs.some((blob) => blob !== common))
|
|
102
|
+
continue;
|
|
103
|
+
// The newest commit at which the whole set matched. What differs from it
|
|
104
|
+
// now is the edit.
|
|
105
|
+
const changed = paths.filter((path) => headBlobs.get(path) !== common);
|
|
106
|
+
if (changed.length === 1 && changed[0] !== undefined) {
|
|
107
|
+
return { kind: 'source', path: changed[0] };
|
|
108
|
+
}
|
|
109
|
+
if (changed.length > 1)
|
|
110
|
+
return { kind: 'several', paths: changed };
|
|
111
|
+
// Nothing changed since: the set matches at HEAD, which the caller ruled out.
|
|
112
|
+
return { kind: 'no-answer' };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const shallow = spawnGit(['--no-optional-locks', 'rev-parse', '--is-shallow-repository'], root, '');
|
|
116
|
+
if (shallow.status === 0 && shallow.stdout.toString('utf8').trim() === 'true') {
|
|
117
|
+
return { kind: 'shallow' };
|
|
118
|
+
}
|
|
119
|
+
return { kind: 'no-common-point' };
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return { kind: 'no-answer' };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=alias-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alias-history.js","sourceRoot":"","sources":["../../src/artifacts/alias-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAIlD,uFAAuF;AACvF,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AAEjC,wDAAwD;AACxD,MAAM,iBAAiB,GAAG,EAAE,CAAA;AAc5B,SAAS,eAAe,CAAC,IAAuB,EAAE,GAAW,EAAE,KAAa;IAC1E,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE;QACzC,GAAG;QACH,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC;QACjC,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI;KAC5B,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;AAC5E,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CAAC,K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AAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC;oBAAE,SAAQ;gBAE3E,yEAAyE;gBACzE,mBAAmB;gBACnB,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,CAAA;gBACtE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;oBACrD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;gBAC7C,CAAC;gBACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;oBAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;gBAClE,8EAA8E;gBAC9E,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;YAC9B,CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,QAAQ,CACtB,CAAC,qBAAqB,EAAE,WAAW,EAAE,yBAAyB,CAAC,EAC/D,IAAI,EACJ,EAAE,CACH,CAAA;QACD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;YAC9E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;QAC5B,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAA;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -27,11 +27,15 @@
|
|
|
27
27
|
* exists to prevent, reported as the feature working. Found by the automated
|
|
28
28
|
* reviewer on #1240, which reproduced it against this module.
|
|
29
29
|
*
|
|
30
|
-
* When **no** file has an uncommitted change
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* When **no** file has an uncommitted change and the files differ, the edit may
|
|
31
|
+
* already be committed — an agent commits inside its own turn, and this runs at
|
|
32
|
+
* the next session start. Git history then names the source: the newest commit at
|
|
33
|
+
* which every file in the set held the same bytes, and the one file that has
|
|
34
|
+
* changed since (`./alias-history.ts`). Exactly one changed → it is the source.
|
|
35
|
+
* More than one → `several-edited`. No such commit within the window, a shallow
|
|
36
|
+
* clone that ends before it, or no answer from git → `no-local-source`, which
|
|
37
|
+
* writes nothing. When **several** files have an uncommitted change, the user is
|
|
38
|
+
* editing both and there is no source to pick. Each is named, and none writes.
|
|
35
39
|
*
|
|
36
40
|
* **`CLAUDE.md` is never part of a set here**, whatever the server sends.
|
|
37
41
|
* Mossbear owns `AGENTS.md`; a `CLAUDE.md` imports it (`@AGENTS.md`) rather
|
|
@@ -77,6 +81,7 @@
|
|
|
77
81
|
* `attendedProjectWrite` to get through the gate would widen the gate for
|
|
78
82
|
* everything else too, which is why this runs beside it rather than through it.
|
|
79
83
|
*/
|
|
84
|
+
import { findEditedFileFromHistory } from './alias-history.js';
|
|
80
85
|
import type { CommittedProbe } from './committed.js';
|
|
81
86
|
import type { GuideProjectionDeps } from './guide-projection.js';
|
|
82
87
|
import type { ConflictResolution } from './sync-plan.js';
|
|
@@ -95,9 +100,13 @@ export type AliasMirrorOutcome =
|
|
|
95
100
|
| 'in-sync'
|
|
96
101
|
/** The target carries uncommitted changes; writing would lose what git cannot give back. */
|
|
97
102
|
| 'held-uncommitted'
|
|
98
|
-
/**
|
|
103
|
+
/**
|
|
104
|
+
* The files differ, none has an uncommitted change, and git history does not
|
|
105
|
+
* name the edited one: no commit where they matched within the window, a
|
|
106
|
+
* shallow clone, a file git has no record of, or no answer from git.
|
|
107
|
+
*/
|
|
99
108
|
| 'no-local-source'
|
|
100
|
-
/** Several files
|
|
109
|
+
/** Several files changed — uncommitted, or committed since the files last matched — so which one is the edit is not knowable. */
|
|
101
110
|
| 'several-edited'
|
|
102
111
|
/** The path resolves outside the repo or through a symlink. */
|
|
103
112
|
| 'unsafe-path'
|
|
@@ -112,6 +121,8 @@ export type AliasMirrorResult = {
|
|
|
112
121
|
error?: string;
|
|
113
122
|
};
|
|
114
123
|
export type AliasMirrorDeps = GuideProjectionDeps & {
|
|
124
|
+
/** Replaces the git history lookup, for tests that fake git. */
|
|
125
|
+
findEditedFileFn?: typeof findEditedFileFromHistory;
|
|
115
126
|
readFileFn?: (path: string, encoding: 'utf8') => Promise<string>;
|
|
116
127
|
writeFileFn?: (path: string, data: string) => Promise<void>;
|
|
117
128
|
mkdirFn?: (path: string, options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias-mirror.d.ts","sourceRoot":"","sources":["../../src/artifacts/alias-mirror.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"alias-mirror.d.ts","sourceRoot":"","sources":["../../src/artifacts/alias-mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAMH,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAK9D,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,gBAAgB,CAAA;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAExD;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,mFAAmF;IACnF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,kBAAkB;AAC5B,sCAAsC;AACpC,SAAS;AACX,uCAAuC;GACrC,SAAS;AACX,4FAA4F;GAC1F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|
28
28
|
* reviewer on #1240, which reproduced it against this module.
|
|
29
29
|
*
|
|
30
|
-
* When **no** file has an uncommitted change
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* When **no** file has an uncommitted change and the files differ, the edit may
|
|
31
|
+
* already be committed — an agent commits inside its own turn, and this runs at
|
|
32
|
+
* the next session start. Git history then names the source: the newest commit at
|
|
33
|
+
* which every file in the set held the same bytes, and the one file that has
|
|
34
|
+
* changed since (`./alias-history.ts`). Exactly one changed → it is the source.
|
|
35
|
+
* More than one → `several-edited`. No such commit within the window, a shallow
|
|
36
|
+
* clone that ends before it, or no answer from git → `no-local-source`, which
|
|
37
|
+
* writes nothing. When **several** files have an uncommitted change, the user is
|
|
38
|
+
* editing both and there is no source to pick. Each is named, and none writes.
|
|
35
39
|
*
|
|
36
40
|
* **`CLAUDE.md` is never part of a set here**, whatever the server sends.
|
|
37
41
|
* Mossbear owns `AGENTS.md`; a `CLAUDE.md` imports it (`@AGENTS.md`) rather
|
|
@@ -80,6 +84,7 @@
|
|
|
80
84
|
import { mkdir, readFile } from 'node:fs/promises';
|
|
81
85
|
import { dirname, resolve } from 'node:path';
|
|
82
86
|
import { writeContextFile } from '../context/materialize.js';
|
|
87
|
+
import { findEditedFileFromHistory } from './alias-history.js';
|
|
83
88
|
import { isRootClaudeMd } from './claude-md-import.js';
|
|
84
89
|
import { refuseUnsafeMappedTarget } from './guide-projection.js';
|
|
85
90
|
const errText = (err) => err instanceof Error ? err.message : String(err);
|
|
@@ -98,6 +103,26 @@ async function readWorking(absolutePath, readFileFn) {
|
|
|
98
103
|
return undefined;
|
|
99
104
|
}
|
|
100
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Ask history which file of a divergent, fully committed set was edited.
|
|
108
|
+
*
|
|
109
|
+
* Only a set whose every file holds its committed bytes can be answered this
|
|
110
|
+
* way: an untracked file, or one git has no answer for, has no history to read.
|
|
111
|
+
*/
|
|
112
|
+
function readHistory(root, present, states, deps) {
|
|
113
|
+
const headBlobs = new Map();
|
|
114
|
+
for (const file of present) {
|
|
115
|
+
const state = states.get(file.path);
|
|
116
|
+
if (state?.kind !== 'committed')
|
|
117
|
+
return { kind: 'no-answer' };
|
|
118
|
+
headBlobs.set(file.path, state.blob);
|
|
119
|
+
}
|
|
120
|
+
return (deps.findEditedFileFn ?? findEditedFileFromHistory)({
|
|
121
|
+
root,
|
|
122
|
+
paths: present.map((file) => file.path),
|
|
123
|
+
headBlobs,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
101
126
|
/**
|
|
102
127
|
* Rewrite every file in each guide's alias set from the one that already holds
|
|
103
128
|
* what the server holds.
|
|
@@ -157,19 +182,37 @@ export async function deriveAliasMirrors(input) {
|
|
|
157
182
|
});
|
|
158
183
|
continue;
|
|
159
184
|
}
|
|
160
|
-
|
|
185
|
+
let source = edited[0];
|
|
161
186
|
if (source === undefined) {
|
|
162
|
-
// Nothing
|
|
187
|
+
// Nothing is uncommitted. Reported only when the files actually differ:
|
|
163
188
|
// an in-sync set with no edit is the ordinary steady state and has
|
|
164
189
|
// nothing to say.
|
|
165
190
|
const differ = present.some((file) => file.content !== present[0]?.content);
|
|
166
|
-
if (differ)
|
|
191
|
+
if (!differ)
|
|
192
|
+
continue;
|
|
193
|
+
// The edit may already be committed — an agent commits inside its own
|
|
194
|
+
// turn, and this runs at the next session start. History says which
|
|
195
|
+
// file moved since the set last matched (`./alias-history.ts`).
|
|
196
|
+
const history = readHistory(root, present, states, deps);
|
|
197
|
+
if (history.kind === 'several') {
|
|
198
|
+
results.push({ path: history.paths.join(', '), outcome: 'several-edited' });
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (history.kind !== 'source') {
|
|
167
202
|
results.push({
|
|
168
203
|
path: present.map((file) => file.path).join(', '),
|
|
169
204
|
outcome: 'no-local-source',
|
|
205
|
+
...(history.kind === 'shallow'
|
|
206
|
+
? {
|
|
207
|
+
error: 'this clone is shallow and its history ends before the files last matched',
|
|
208
|
+
}
|
|
209
|
+
: {}),
|
|
170
210
|
});
|
|
211
|
+
continue;
|
|
171
212
|
}
|
|
172
|
-
|
|
213
|
+
source = present.find((file) => file.path === history.path);
|
|
214
|
+
if (source === undefined)
|
|
215
|
+
continue;
|
|
173
216
|
}
|
|
174
217
|
for (const target of present) {
|
|
175
218
|
if (target.path === source.path)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias-mirror.js","sourceRoot":"","sources":["../../src/artifacts/alias-mirror.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"alias-mirror.js","sourceRoot":"","sources":["../../src/artifacts/alias-mirror.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAqDhE,MAAM,OAAO,GAAG,CAAC,GAAY,EAAU,EAAE,CACvC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;AAElD;;;;;;GAMG;AACH,KAAK,UAAU,WAAW,CACxB,YAAoB,EACpB,UAAsD;IAEtD,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO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BAC3E,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,MAAM,EAAE,MAAM,CAAC,IAAI;oBACnB,OAAO,EAAE,kBAAkB;iBAC5B,CAAC,CAAA;gBACF,SAAQ;YACV,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;gBAChE,MAAM,WAAW,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;gBACtD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;YAC9E,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,MAAM,EAAE,MAAM,CAAC,IAAI;oBACnB,OAAO,EAAE,QAAQ;oBACjB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;iBACpB,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -39,8 +39,14 @@ export declare const CHANGED_SINCE_READ_LINE = "the guide changed since you last
|
|
|
39
39
|
* reply is a request, an agent's is context) is the server's `untrusted.note`.
|
|
40
40
|
*/
|
|
41
41
|
export declare const THREADS_HEADING = "Threads, by who wrote each reply (said here, where no comment text can reach; resolve a thread by its own id, not a reply\u2019s):";
|
|
42
|
-
/**
|
|
43
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Compact on-demand rendering: one marked block, grouped by artifact.
|
|
44
|
+
*
|
|
45
|
+
* Every id is printed whole. A prefix sized to make one read's ids unique is
|
|
46
|
+
* one no other surface can reproduce, and the Inbox's prompt names findings by
|
|
47
|
+
* their full ids, so a shortened id here was a second form to mis-copy.
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatCompactComments(received: readonly ItemCommentWithSubject[], cursor: string, untrusted: GuideHistoryUntrusted | null | undefined): string;
|
|
44
50
|
/**
|
|
45
51
|
* One comment, as the docs phase saw it: about an item this repo actually
|
|
46
52
|
* received, with the body exactly as the server delimited it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-comments.d.ts","sourceRoot":"","sources":["../../src/artifacts/artifact-comments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEvF;;;GAGG;AACH,eAAO,MAAM,UAAU,gFACwD,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qIACgG,CAAA;AAEpI;;;GAGG;AACH,eAAO,MAAM,eAAe,uIACqG,CAAA;
|
|
1
|
+
{"version":3,"file":"artifact-comments.d.ts","sourceRoot":"","sources":["../../src/artifacts/artifact-comments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAKH,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AAEvF;;;GAGG;AACH,eAAO,MAAM,UAAU,gFACwD,CAAA;AAE/E;;;GAGG;AACH,eAAO,MAAM,uBAAuB,qIACgG,CAAA;AAEpI;;;GAGG;AACH,eAAO,MAAM,eAAe,uIACqG,CAAA;AAkHjI;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,sBAAsB,EAAE,EAC3C,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAClD,MAAM,CAwHR;AAED;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC,iFAAiF;IACjF,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