@nexus-cortex/core 4.52.0 → 4.54.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/adapters/node/GitHistoryStore.d.ts +80 -0
- package/dist/adapters/node/GitHistoryStore.d.ts.map +1 -0
- package/dist/adapters/node/GitHistoryStore.js +179 -0
- package/dist/adapters/node/GitHistoryStore.js.map +1 -0
- package/dist/adapters/node/index.d.ts +2 -0
- package/dist/adapters/node/index.d.ts.map +1 -1
- package/dist/adapters/node/index.js +1 -0
- package/dist/adapters/node/index.js.map +1 -1
- package/dist/canon/canonArtifacts.d.ts +14 -0
- package/dist/canon/canonArtifacts.d.ts.map +1 -0
- package/dist/canon/canonArtifacts.js +269 -0
- package/dist/canon/canonArtifacts.js.map +1 -0
- package/dist/canon/canonGraph.d.ts +30 -0
- package/dist/canon/canonGraph.d.ts.map +1 -0
- package/dist/canon/canonGraph.js +216 -0
- package/dist/canon/canonGraph.js.map +1 -0
- package/dist/canon/canonPull.d.ts +38 -0
- package/dist/canon/canonPull.d.ts.map +1 -0
- package/dist/canon/canonPull.js +133 -0
- package/dist/canon/canonPull.js.map +1 -0
- package/dist/canon/canonSync.d.ts +20 -0
- package/dist/canon/canonSync.d.ts.map +1 -0
- package/dist/canon/canonSync.js +243 -0
- package/dist/canon/canonSync.js.map +1 -0
- package/dist/canon/canonTranslate.d.ts +19 -0
- package/dist/canon/canonTranslate.d.ts.map +1 -0
- package/dist/canon/canonTranslate.js +719 -0
- package/dist/canon/canonTranslate.js.map +1 -0
- package/dist/canon/index.d.ts +19 -0
- package/dist/canon/index.d.ts.map +1 -0
- package/dist/canon/index.js +14 -0
- package/dist/canon/index.js.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +17 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git-backed HistoryStore — "your agent memory is a git repo you own."
|
|
3
|
+
*
|
|
4
|
+
* A published `HistoryStore` backend whose durable store is a git working
|
|
5
|
+
* clone: sessions are canonical JSONL under `{repoDir}/{sessionsSubdir}`,
|
|
6
|
+
* writes are committed (and optionally pushed), reads optionally pull first.
|
|
7
|
+
* It DECORATES the existing Node session store (JSONLHistoryStore via
|
|
8
|
+
* NodeHistoryStoreAdapter) — the canonical record format is reused verbatim,
|
|
9
|
+
* never re-implemented; this class only adds the git state-machine layer
|
|
10
|
+
* (push = append, pull = rehydrate).
|
|
11
|
+
*
|
|
12
|
+
* Dependency-free (Node built-ins only). git identity is passed per-commit
|
|
13
|
+
* with `-c user.name/-c user.email` so global git config is never mutated.
|
|
14
|
+
* All git invocations set GIT_TERMINAL_PROMPT=0 so a missing credential fails
|
|
15
|
+
* fast instead of hanging on a prompt.
|
|
16
|
+
*
|
|
17
|
+
* Scope: the SESSION dimension (canonical Message records). The capability/
|
|
18
|
+
* artifact dimension (skills/agents/mcp/plugins manifests) is a separate arc
|
|
19
|
+
* (CANON_CROSS_HARNESS_PLAN.md §27p) and is intentionally not modeled here.
|
|
20
|
+
*
|
|
21
|
+
* @module adapters/node/GitHistoryStore
|
|
22
|
+
*/
|
|
23
|
+
import type { HistoryStore, SessionInfo } from '../../interfaces/HistoryStore.js';
|
|
24
|
+
import type { CanonicalMessage, SessionMetadata } from '@nexus-cortex/types';
|
|
25
|
+
export interface GitHistoryStoreConfig {
|
|
26
|
+
/** Local git working clone that holds the sessions. */
|
|
27
|
+
repoDir: string;
|
|
28
|
+
/**
|
|
29
|
+
* Subdirectory within the repo where canonical session JSONL lives.
|
|
30
|
+
* Default `.cortex/sessions` (the harness-native canon layout).
|
|
31
|
+
*/
|
|
32
|
+
sessionsSubdir?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Remote URL. If set and `repoDir` has no `.git`, it is cloned on first use;
|
|
35
|
+
* otherwise a fresh repo is `git init`'d locally.
|
|
36
|
+
*/
|
|
37
|
+
remote?: string;
|
|
38
|
+
/** Branch to commit/push. Default `main`. */
|
|
39
|
+
branch?: string;
|
|
40
|
+
/** Pull before every read op. Default false (reads stay offline/fast). */
|
|
41
|
+
autoPull?: boolean;
|
|
42
|
+
/** Commit after every write op. Default true. */
|
|
43
|
+
autoCommit?: boolean;
|
|
44
|
+
/** Push after every committed write. Default false (opt-in network). */
|
|
45
|
+
autoPush?: boolean;
|
|
46
|
+
/** Commit-message prefix. Default `canon`. */
|
|
47
|
+
commitPrefix?: string;
|
|
48
|
+
/** git author identity for commits (never written to global config). */
|
|
49
|
+
authorName?: string;
|
|
50
|
+
authorEmail?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Git-backed session history store. Decorates JSONLHistoryStore with a git
|
|
54
|
+
* state machine; implements the runtime-agnostic HistoryStore interface.
|
|
55
|
+
*/
|
|
56
|
+
export declare class GitHistoryStore implements HistoryStore {
|
|
57
|
+
private readonly cfg;
|
|
58
|
+
private readonly inner;
|
|
59
|
+
private readyPromise;
|
|
60
|
+
constructor(config: GitHistoryStoreConfig);
|
|
61
|
+
private git;
|
|
62
|
+
/** Idempotent: clone/init the repo and ensure the sessions subdir exists. */
|
|
63
|
+
private ensureRepo;
|
|
64
|
+
private doEnsureRepo;
|
|
65
|
+
private pathExists;
|
|
66
|
+
private pullIfEnabled;
|
|
67
|
+
/** Commit anything staged under the sessions subdir; push if configured. */
|
|
68
|
+
private commitAndPush;
|
|
69
|
+
loadSession(sessionId: string): Promise<CanonicalMessage[]>;
|
|
70
|
+
listSessions(): Promise<SessionInfo[]>;
|
|
71
|
+
sessionExists(sessionId: string): Promise<boolean>;
|
|
72
|
+
loadMetadata(sessionId: string): Promise<SessionMetadata | null>;
|
|
73
|
+
getSessionInfo(sessionId: string): Promise<SessionInfo | null>;
|
|
74
|
+
appendMessage(sessionId: string, message: CanonicalMessage): Promise<void>;
|
|
75
|
+
appendMessages(sessionId: string, messages: CanonicalMessage[]): Promise<void>;
|
|
76
|
+
saveSession(sessionId: string, messages: CanonicalMessage[]): Promise<void>;
|
|
77
|
+
saveMetadata(sessionId: string, metadata: SessionMetadata): Promise<void>;
|
|
78
|
+
deleteSession(sessionId: string): Promise<boolean>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=GitHistoryStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHistoryStore.d.ts","sourceRoot":"","sources":["../../../src/adapters/node/GitHistoryStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAM7E,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAID;;;GAGG;AACH,qBAAa,eAAgB,YAAW,YAAY;IAClD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAyE;IAC7F,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA0B;IAChD,OAAO,CAAC,YAAY,CAA8B;gBAEtC,MAAM,EAAE,qBAAqB;YAoB3B,GAAG;IAUjB,6EAA6E;IAC7E,OAAO,CAAC,UAAU;YAKJ,YAAY;YAuBZ,UAAU;YAIV,aAAa;IAM3B,4EAA4E;YAC9D,aAAa;IAiBrB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAM3D,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAMtC,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAMhE,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAO9D,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAM1E,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAM9E,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAM3E,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzE,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAMzD"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git-backed HistoryStore — "your agent memory is a git repo you own."
|
|
3
|
+
*
|
|
4
|
+
* A published `HistoryStore` backend whose durable store is a git working
|
|
5
|
+
* clone: sessions are canonical JSONL under `{repoDir}/{sessionsSubdir}`,
|
|
6
|
+
* writes are committed (and optionally pushed), reads optionally pull first.
|
|
7
|
+
* It DECORATES the existing Node session store (JSONLHistoryStore via
|
|
8
|
+
* NodeHistoryStoreAdapter) — the canonical record format is reused verbatim,
|
|
9
|
+
* never re-implemented; this class only adds the git state-machine layer
|
|
10
|
+
* (push = append, pull = rehydrate).
|
|
11
|
+
*
|
|
12
|
+
* Dependency-free (Node built-ins only). git identity is passed per-commit
|
|
13
|
+
* with `-c user.name/-c user.email` so global git config is never mutated.
|
|
14
|
+
* All git invocations set GIT_TERMINAL_PROMPT=0 so a missing credential fails
|
|
15
|
+
* fast instead of hanging on a prompt.
|
|
16
|
+
*
|
|
17
|
+
* Scope: the SESSION dimension (canonical Message records). The capability/
|
|
18
|
+
* artifact dimension (skills/agents/mcp/plugins manifests) is a separate arc
|
|
19
|
+
* (CANON_CROSS_HARNESS_PLAN.md §27p) and is intentionally not modeled here.
|
|
20
|
+
*
|
|
21
|
+
* @module adapters/node/GitHistoryStore
|
|
22
|
+
*/
|
|
23
|
+
import { execFile } from 'child_process';
|
|
24
|
+
import { promisify } from 'util';
|
|
25
|
+
import * as fs from 'fs/promises';
|
|
26
|
+
import * as path from 'path';
|
|
27
|
+
import { JSONLHistoryStore } from '../../session/JSONLHistoryStore.js';
|
|
28
|
+
import { NodeHistoryStoreAdapter } from './NodeHistoryStoreAdapter.js';
|
|
29
|
+
const execFileAsync = promisify(execFile);
|
|
30
|
+
/**
|
|
31
|
+
* Git-backed session history store. Decorates JSONLHistoryStore with a git
|
|
32
|
+
* state machine; implements the runtime-agnostic HistoryStore interface.
|
|
33
|
+
*/
|
|
34
|
+
export class GitHistoryStore {
|
|
35
|
+
cfg;
|
|
36
|
+
inner;
|
|
37
|
+
readyPromise = null;
|
|
38
|
+
constructor(config) {
|
|
39
|
+
this.cfg = {
|
|
40
|
+
repoDir: config.repoDir,
|
|
41
|
+
sessionsSubdir: config.sessionsSubdir ?? '.cortex/sessions',
|
|
42
|
+
branch: config.branch ?? 'main',
|
|
43
|
+
autoPull: config.autoPull ?? false,
|
|
44
|
+
autoCommit: config.autoCommit ?? true,
|
|
45
|
+
autoPush: config.autoPush ?? false,
|
|
46
|
+
commitPrefix: config.commitPrefix ?? 'canon',
|
|
47
|
+
authorName: config.authorName ?? 'nexus-cortex canon',
|
|
48
|
+
authorEmail: config.authorEmail ?? 'canon@nexus-cortex.local',
|
|
49
|
+
remote: config.remote,
|
|
50
|
+
};
|
|
51
|
+
const baseDir = path.join(this.cfg.repoDir, this.cfg.sessionsSubdir);
|
|
52
|
+
// git IS the history — no sidecar .backup files inside a versioned repo.
|
|
53
|
+
this.inner = new NodeHistoryStoreAdapter(new JSONLHistoryStore({ baseDir, enableBackups: false }));
|
|
54
|
+
}
|
|
55
|
+
// ---- git plumbing (dependency-free) -------------------------------------
|
|
56
|
+
async git(args, cwd = this.cfg.repoDir) {
|
|
57
|
+
const { stdout } = await execFileAsync('git', args, {
|
|
58
|
+
cwd,
|
|
59
|
+
encoding: 'utf8',
|
|
60
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
61
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
62
|
+
});
|
|
63
|
+
return stdout;
|
|
64
|
+
}
|
|
65
|
+
/** Idempotent: clone/init the repo and ensure the sessions subdir exists. */
|
|
66
|
+
ensureRepo() {
|
|
67
|
+
if (!this.readyPromise)
|
|
68
|
+
this.readyPromise = this.doEnsureRepo();
|
|
69
|
+
return this.readyPromise;
|
|
70
|
+
}
|
|
71
|
+
async doEnsureRepo() {
|
|
72
|
+
const hasGit = await this.pathExists(path.join(this.cfg.repoDir, '.git'));
|
|
73
|
+
if (!hasGit) {
|
|
74
|
+
if (this.cfg.remote) {
|
|
75
|
+
await fs.mkdir(path.dirname(this.cfg.repoDir), { recursive: true });
|
|
76
|
+
await execFileAsync('git', ['clone', '-q', '--branch', this.cfg.branch, this.cfg.remote, this.cfg.repoDir], {
|
|
77
|
+
encoding: 'utf8',
|
|
78
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
79
|
+
}).catch(async () => {
|
|
80
|
+
// remote may not yet have the branch — clone default then checkout.
|
|
81
|
+
await execFileAsync('git', ['clone', '-q', this.cfg.remote, this.cfg.repoDir], {
|
|
82
|
+
encoding: 'utf8',
|
|
83
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: '0' },
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
await fs.mkdir(this.cfg.repoDir, { recursive: true });
|
|
89
|
+
await this.git(['init', '-q', '-b', this.cfg.branch]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
await fs.mkdir(path.join(this.cfg.repoDir, this.cfg.sessionsSubdir), { recursive: true });
|
|
93
|
+
}
|
|
94
|
+
async pathExists(p) {
|
|
95
|
+
try {
|
|
96
|
+
await fs.access(p);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
async pullIfEnabled() {
|
|
104
|
+
if (!this.cfg.autoPull || !this.cfg.remote)
|
|
105
|
+
return;
|
|
106
|
+
// Non-fatal: an offline pull must not break a local read.
|
|
107
|
+
await this.git(['pull', '-q', '--ff-only', 'origin', this.cfg.branch]).catch(() => undefined);
|
|
108
|
+
}
|
|
109
|
+
/** Commit anything staged under the sessions subdir; push if configured. */
|
|
110
|
+
async commitAndPush(message) {
|
|
111
|
+
if (!this.cfg.autoCommit)
|
|
112
|
+
return;
|
|
113
|
+
await this.git(['add', '--', this.cfg.sessionsSubdir]);
|
|
114
|
+
const status = (await this.git(['status', '--porcelain', '--', this.cfg.sessionsSubdir])).trim();
|
|
115
|
+
if (!status)
|
|
116
|
+
return; // nothing changed — no empty commits
|
|
117
|
+
await this.git([
|
|
118
|
+
'-c', `user.name=${this.cfg.authorName}`,
|
|
119
|
+
'-c', `user.email=${this.cfg.authorEmail}`,
|
|
120
|
+
'commit', '-q', '-m', message,
|
|
121
|
+
]);
|
|
122
|
+
if (this.cfg.autoPush && this.cfg.remote) {
|
|
123
|
+
await this.git(['push', '-q', 'origin', this.cfg.branch]);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// ---- HistoryStore: reads ------------------------------------------------
|
|
127
|
+
async loadSession(sessionId) {
|
|
128
|
+
await this.ensureRepo();
|
|
129
|
+
await this.pullIfEnabled();
|
|
130
|
+
return this.inner.loadSession(sessionId);
|
|
131
|
+
}
|
|
132
|
+
async listSessions() {
|
|
133
|
+
await this.ensureRepo();
|
|
134
|
+
await this.pullIfEnabled();
|
|
135
|
+
return this.inner.listSessions();
|
|
136
|
+
}
|
|
137
|
+
async sessionExists(sessionId) {
|
|
138
|
+
await this.ensureRepo();
|
|
139
|
+
return this.inner.sessionExists(sessionId);
|
|
140
|
+
}
|
|
141
|
+
async loadMetadata(sessionId) {
|
|
142
|
+
await this.ensureRepo();
|
|
143
|
+
await this.pullIfEnabled();
|
|
144
|
+
return this.inner.loadMetadata(sessionId);
|
|
145
|
+
}
|
|
146
|
+
async getSessionInfo(sessionId) {
|
|
147
|
+
await this.ensureRepo();
|
|
148
|
+
return this.inner.getSessionInfo(sessionId);
|
|
149
|
+
}
|
|
150
|
+
// ---- HistoryStore: writes (each = one git commit) -----------------------
|
|
151
|
+
async appendMessage(sessionId, message) {
|
|
152
|
+
await this.ensureRepo();
|
|
153
|
+
await this.inner.appendMessage(sessionId, message);
|
|
154
|
+
await this.commitAndPush(`${this.cfg.commitPrefix}: append ${sessionId}`);
|
|
155
|
+
}
|
|
156
|
+
async appendMessages(sessionId, messages) {
|
|
157
|
+
await this.ensureRepo();
|
|
158
|
+
await this.inner.appendMessages(sessionId, messages);
|
|
159
|
+
await this.commitAndPush(`${this.cfg.commitPrefix}: append ${messages.length} → ${sessionId}`);
|
|
160
|
+
}
|
|
161
|
+
async saveSession(sessionId, messages) {
|
|
162
|
+
await this.ensureRepo();
|
|
163
|
+
await this.inner.saveSession(sessionId, messages);
|
|
164
|
+
await this.commitAndPush(`${this.cfg.commitPrefix}: save ${sessionId} (${messages.length} msgs)`);
|
|
165
|
+
}
|
|
166
|
+
async saveMetadata(sessionId, metadata) {
|
|
167
|
+
await this.ensureRepo();
|
|
168
|
+
await this.inner.saveMetadata(sessionId, metadata);
|
|
169
|
+
await this.commitAndPush(`${this.cfg.commitPrefix}: metadata ${sessionId}`);
|
|
170
|
+
}
|
|
171
|
+
async deleteSession(sessionId) {
|
|
172
|
+
await this.ensureRepo();
|
|
173
|
+
const deleted = await this.inner.deleteSession(sessionId);
|
|
174
|
+
if (deleted)
|
|
175
|
+
await this.commitAndPush(`${this.cfg.commitPrefix}: delete ${sessionId}`);
|
|
176
|
+
return deleted;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=GitHistoryStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHistoryStore.js","sourceRoot":"","sources":["../../../src/adapters/node/GitHistoryStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAG7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAgC1C;;;GAGG;AACH,MAAM,OAAO,eAAe;IACT,GAAG,CAAyE;IAC5E,KAAK,CAA0B;IACxC,YAAY,GAAyB,IAAI,CAAC;IAElD,YAAY,MAA6B;QACvC,IAAI,CAAC,GAAG,GAAG;YACT,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,cAAc,EAAE,MAAM,CAAC,cAAc,IAAI,kBAAkB;YAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM;YAC/B,QAAQ,E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AC,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,cAAc,SAAS,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,SAAiB;QACnC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC1D,IAAI,OAAO;YAAE,MAAM,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,YAAY,SAAS,EAAE,CAAC,CAAC;QACvF,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { NodeConfigProvider } from './NodeConfigProvider.js';
|
|
15
15
|
export { NodeHistoryStoreAdapter } from './NodeHistoryStoreAdapter.js';
|
|
16
|
+
export { GitHistoryStore } from './GitHistoryStore.js';
|
|
17
|
+
export type { GitHistoryStoreConfig } from './GitHistoryStore.js';
|
|
16
18
|
export { NodeToolExecutorAdapter } from './NodeToolExecutorAdapter.js';
|
|
17
19
|
export { NodePermissionAdapter } from './NodePermissionAdapter.js';
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { NodeConfigProvider } from './NodeConfigProvider.js';
|
|
15
15
|
export { NodeHistoryStoreAdapter } from './NodeHistoryStoreAdapter.js';
|
|
16
|
+
export { GitHistoryStore } from './GitHistoryStore.js';
|
|
16
17
|
export { NodeToolExecutorAdapter } from './NodeToolExecutorAdapter.js';
|
|
17
18
|
export { NodePermissionAdapter } from './NodePermissionAdapter.js';
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/node/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface CanonArtifactsOptions {
|
|
2
|
+
store?: string;
|
|
3
|
+
home?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
repoUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CanonArtifactsResult {
|
|
8
|
+
captured: number;
|
|
9
|
+
unchanged: number;
|
|
10
|
+
kinds: Record<string, number>;
|
|
11
|
+
pushed: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function canonArtifacts(o?: CanonArtifactsOptions): Promise<CanonArtifactsResult>;
|
|
14
|
+
//# sourceMappingURL=canonArtifacts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonArtifacts.d.ts","sourceRoot":"","sources":["../../src/canon/canonArtifacts.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,MAAM,EAAE,OAAO,CAAC;CACjB;AAuCD,wBAAsB,cAAc,CAAC,CAAC,GAAE,qBAA0B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAqLjG"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* canonArtifacts — the capability/artifact dimension capture leg
|
|
3
|
+
* (CANON_CROSS_HARNESS_PLAN.md §27p; Phase C part 2, leg 3).
|
|
4
|
+
*
|
|
5
|
+
* Discovers native capability artifacts and the intent layer, normalizes each
|
|
6
|
+
* into the store's taxonomy dirs (the CAPTURE side of the per-kind layout
|
|
7
|
+
* adapters: skill-dir → /skills/<id>/, agent-file → /agents/<id>.md,
|
|
8
|
+
* mcp/plugin registries → normalized JSON, project manifests → JSON with a
|
|
9
|
+
* thin `state` field), and writes one ArtifactManifest record per artifact
|
|
10
|
+
* under /canon/artifacts/<kind>/<id>.json. Content is blob-addressed with git
|
|
11
|
+
* blob SHAs computed locally (sha1 of "blob <len>\0"+bytes — identical to
|
|
12
|
+
* git's object id, so provenance survives any clone). Secret scrub at the
|
|
13
|
+
* push boundary, same pattern set as canonSync. Absences are VISIBLE in
|
|
14
|
+
* /canon/artifacts/ARTIFACTS.md (D8: never silent). Incremental via
|
|
15
|
+
* ~/.canon/artifacts-manifest.json keyed by primary-file blob refs.
|
|
16
|
+
* Projection-BACK (store → receiving harness layout) arrives with the
|
|
17
|
+
* artifact pull leg; stated in ARTIFACTS.md rather than implied.
|
|
18
|
+
*
|
|
19
|
+
* @module canon/canonArtifacts
|
|
20
|
+
*/
|
|
21
|
+
import * as crypto from 'node:crypto';
|
|
22
|
+
import * as fs from 'node:fs';
|
|
23
|
+
import * as path from 'node:path';
|
|
24
|
+
import { execFileSync } from 'node:child_process';
|
|
25
|
+
const SECRET_PATTERNS = [
|
|
26
|
+
[/sk-[A-Za-z0-9_-]{16,}/g, '[redacted:sk]'],
|
|
27
|
+
[/ghp_[A-Za-z0-9]{20,}/g, '[redacted:ghp]'],
|
|
28
|
+
[/github_pat_[A-Za-z0-9_]{20,}/g, '[redacted:ghpat]'],
|
|
29
|
+
[/hf_[A-Za-z0-9]{20,}/g, '[redacted:hf]'],
|
|
30
|
+
[/AIza[A-Za-z0-9_-]{20,}/g, '[redacted:aiza]'],
|
|
31
|
+
[/xai-[A-Za-z0-9]{20,}/g, '[redacted:xai]'],
|
|
32
|
+
[/nar_[A-Za-z0-9]{16,}/g, '[redacted:nar]'],
|
|
33
|
+
[/gsk_[A-Za-z0-9]{20,}/g, '[redacted:gsk]'],
|
|
34
|
+
[/xox[bpars]-[A-Za-z0-9-]{10,}/g, '[redacted:slack]'],
|
|
35
|
+
[/AKIA[A-Z0-9]{16}/g, '[redacted:akia]'],
|
|
36
|
+
[/eyJ[A-Za-z0-9_-]{20,}\.eyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{10,}/g, '[redacted:jwt]'],
|
|
37
|
+
];
|
|
38
|
+
const scrub = (s) => SECRET_PATTERNS.reduce((v, [re, sub]) => v.replace(re, sub), s);
|
|
39
|
+
/** git blob id (12 hex) computed locally — identical to `git hash-object`. */
|
|
40
|
+
const blobRef = (content) => {
|
|
41
|
+
const buf = Buffer.isBuffer(content) ? content : Buffer.from(content);
|
|
42
|
+
return crypto.createHash('sha1')
|
|
43
|
+
.update(`blob ${buf.length}\0`).update(buf).digest('hex').slice(0, 12);
|
|
44
|
+
};
|
|
45
|
+
const walkFiles = (dir) => {
|
|
46
|
+
const out = [];
|
|
47
|
+
const rec = (d) => {
|
|
48
|
+
let es = [];
|
|
49
|
+
try {
|
|
50
|
+
es = fs.readdirSync(d, { withFileTypes: true });
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
for (const e of es) {
|
|
56
|
+
const p = path.join(d, e.name);
|
|
57
|
+
if (e.isDirectory())
|
|
58
|
+
rec(p);
|
|
59
|
+
else if (e.isFile())
|
|
60
|
+
out.push(p);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
rec(dir);
|
|
64
|
+
return out.sort();
|
|
65
|
+
};
|
|
66
|
+
export async function canonArtifacts(o = {}) {
|
|
67
|
+
const HOME = o.home ?? process.env.HOME ?? '/home/runner/workspace';
|
|
68
|
+
const DRY = o.dryRun ?? false;
|
|
69
|
+
const STORE = o.store ?? '/tmp/canon-store';
|
|
70
|
+
const MANIFEST_PATH = path.join(HOME, '.canon', 'artifacts-manifest.json');
|
|
71
|
+
const CANON_REPO = o.repoUrl ?? process.env.CANON_REPO ?? 'https://github.com/Spitfire-Products/nexus-canon-store';
|
|
72
|
+
const env = { ...process.env, GIT_TERMINAL_PROMPT: '0' };
|
|
73
|
+
if (!fs.existsSync(path.join(STORE, '.git'))) {
|
|
74
|
+
console.log(`[canon-artifacts] no store at ${STORE} — cloning ${CANON_REPO}`);
|
|
75
|
+
execFileSync('git', ['clone', '-q', CANON_REPO, STORE], { encoding: 'utf8', env });
|
|
76
|
+
}
|
|
77
|
+
const incr = fs.existsSync(MANIFEST_PATH)
|
|
78
|
+
? JSON.parse(fs.readFileSync(MANIFEST_PATH, 'utf8')) : {};
|
|
79
|
+
let captured = 0, unchanged = 0;
|
|
80
|
+
const kinds = {};
|
|
81
|
+
const absences = [];
|
|
82
|
+
/** Normalize one artifact into the store + write its manifest record. */
|
|
83
|
+
const capture = (m, files) => {
|
|
84
|
+
const primaryFile = files.find((f) => f.rel === m.primary);
|
|
85
|
+
if (!primaryFile)
|
|
86
|
+
return;
|
|
87
|
+
const version = blobRef(primaryFile.bytes);
|
|
88
|
+
const key = `${m.kind}/${m.id}`;
|
|
89
|
+
kinds[m.kind] = (kinds[m.kind] ?? 0) + 1;
|
|
90
|
+
if (incr[key] === version) {
|
|
91
|
+
unchanged++;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (!DRY) {
|
|
95
|
+
const destRoot = m.kind === 'skill' || m.kind === 'plugin'
|
|
96
|
+
? path.join(STORE, m.kind + 's', m.id)
|
|
97
|
+
: path.join(STORE, m.kind === 'mcp' ? 'mcp' : m.kind + 's');
|
|
98
|
+
const content = [];
|
|
99
|
+
for (const f of files) {
|
|
100
|
+
const scrubbed = Buffer.from(scrub(f.bytes.toString('utf8')));
|
|
101
|
+
const dest = m.kind === 'skill' || m.kind === 'plugin'
|
|
102
|
+
? path.join(destRoot, f.rel)
|
|
103
|
+
: path.join(destRoot, f.rel);
|
|
104
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
105
|
+
fs.writeFileSync(dest, scrubbed);
|
|
106
|
+
content.push({ path: f.rel, ref: blobRef(scrubbed), bytes: scrubbed.length });
|
|
107
|
+
}
|
|
108
|
+
const record = {
|
|
109
|
+
recordKind: 'artifact-manifest',
|
|
110
|
+
...m,
|
|
111
|
+
version,
|
|
112
|
+
timestamp: new Date().toISOString(),
|
|
113
|
+
content,
|
|
114
|
+
};
|
|
115
|
+
const recPath = path.join(STORE, 'canon', 'artifacts', m.kind, `${m.id}.json`);
|
|
116
|
+
fs.mkdirSync(path.dirname(recPath), { recursive: true });
|
|
117
|
+
fs.writeFileSync(recPath, JSON.stringify(record, null, 2) + '\n');
|
|
118
|
+
}
|
|
119
|
+
incr[key] = version;
|
|
120
|
+
captured++;
|
|
121
|
+
};
|
|
122
|
+
// ── skills: dir + SKILL.md (layout adapter: skill-dir → /skills/<id>/) ─────
|
|
123
|
+
for (const [harness, root] of [['claude-code', path.join(HOME, '.claude', 'skills')], ['agents-dir', path.join(HOME, '.agents', 'skills')]]) {
|
|
124
|
+
let entries = [];
|
|
125
|
+
try {
|
|
126
|
+
entries = fs.readdirSync(root);
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
absences.push(`${harness} skills root absent (${root})`);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
for (const name of entries.sort()) {
|
|
133
|
+
const dir = path.join(root, name);
|
|
134
|
+
if (!fs.existsSync(path.join(dir, 'SKILL.md')))
|
|
135
|
+
continue;
|
|
136
|
+
const files = walkFiles(dir).map((p) => ({ rel: path.relative(dir, p), bytes: fs.readFileSync(p) }));
|
|
137
|
+
const desc = /^description:\s*(.+)$/m.exec(fs.readFileSync(path.join(dir, 'SKILL.md'), 'utf8'))?.[1];
|
|
138
|
+
capture({
|
|
139
|
+
kind: 'skill', id: name, name, description: desc?.slice(0, 200), primary: 'SKILL.md',
|
|
140
|
+
provenance: { harness, native: dir, ref: blobRef(fs.readFileSync(path.join(dir, 'SKILL.md'))) },
|
|
141
|
+
harnessCompat: { 'claude-code': 'supported', 'nexus-cortex': 'supported' },
|
|
142
|
+
projectionRules: { 'claude-code': '.claude/skills/<id>/', 'agents-dir': '.agents/skills/<id>/' },
|
|
143
|
+
}, files);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// ── agents: single .md w/ frontmatter (layout adapter: file → /agents/) ────
|
|
147
|
+
const agentsRoot = path.join(HOME, '.claude', 'agents');
|
|
148
|
+
let agentFiles = [];
|
|
149
|
+
try {
|
|
150
|
+
agentFiles = fs.readdirSync(agentsRoot).filter((f) => f.endsWith('.md')).sort();
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
absences.push(`claude-code agents root absent (${agentsRoot})`);
|
|
154
|
+
}
|
|
155
|
+
for (const f of agentFiles) {
|
|
156
|
+
const abs = path.join(agentsRoot, f);
|
|
157
|
+
const bytes = fs.readFileSync(abs);
|
|
158
|
+
const id = path.basename(f, '.md');
|
|
159
|
+
const desc = /^description:\s*(.+)$/m.exec(bytes.toString('utf8'))?.[1];
|
|
160
|
+
capture({
|
|
161
|
+
kind: 'agent', id, name: id, description: desc?.slice(0, 200), primary: f,
|
|
162
|
+
provenance: { harness: 'claude-code', native: abs, ref: blobRef(bytes) },
|
|
163
|
+
harnessCompat: { 'claude-code': 'supported' },
|
|
164
|
+
projectionRules: { 'claude-code': '.claude/agents/<id>.md' },
|
|
165
|
+
}, [{ rel: f, bytes }]);
|
|
166
|
+
}
|
|
167
|
+
// ── mcp: config registries (normalized json) ───────────────────────────────
|
|
168
|
+
const mcpSources = [
|
|
169
|
+
['workspace', path.join(HOME, '.mcp.json')],
|
|
170
|
+
['nexus-terminal', path.join(HOME, 'nexus-terminal', '.mcp.json')],
|
|
171
|
+
['omniclaude-v4', path.join(HOME, 'omniclaude-v4', '.mcp.json')],
|
|
172
|
+
];
|
|
173
|
+
for (const [label, p] of mcpSources) {
|
|
174
|
+
if (!fs.existsSync(p)) {
|
|
175
|
+
absences.push(`mcp config absent (${p})`);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
const bytes = fs.readFileSync(p);
|
|
179
|
+
capture({
|
|
180
|
+
kind: 'mcp', id: label, name: `${label} MCP servers`, primary: `${label}.json`,
|
|
181
|
+
provenance: { harness: 'claude-code', native: p, ref: blobRef(bytes) },
|
|
182
|
+
projectionRules: { 'claude-code': '.mcp.json' },
|
|
183
|
+
}, [{ rel: `${label}.json`, bytes }]);
|
|
184
|
+
}
|
|
185
|
+
// ── plugins: registry snapshot (bundle capture = follow-up, stated) ────────
|
|
186
|
+
const pluginsReg = path.join(HOME, '.claude', 'plugins', 'installed_plugins.json');
|
|
187
|
+
if (fs.existsSync(pluginsReg)) {
|
|
188
|
+
const bytes = fs.readFileSync(pluginsReg);
|
|
189
|
+
capture({
|
|
190
|
+
kind: 'plugin', id: 'installed-registry', name: 'Installed plugins registry', primary: 'installed_plugins.json',
|
|
191
|
+
provenance: { harness: 'claude-code', native: pluginsReg, ref: blobRef(bytes) },
|
|
192
|
+
projectionRules: { 'claude-code': '.claude/plugins/installed_plugins.json' },
|
|
193
|
+
}, [{ rel: 'installed_plugins.json', bytes }]);
|
|
194
|
+
}
|
|
195
|
+
else
|
|
196
|
+
absences.push(`plugins registry absent (${pluginsReg})`);
|
|
197
|
+
// ── plans: doc-snapshot + thin state (fork 1 — never an event log) ─────────
|
|
198
|
+
const plansRoot = path.join(HOME, '.claude', 'plans');
|
|
199
|
+
let planFiles = [];
|
|
200
|
+
try {
|
|
201
|
+
planFiles = fs.readdirSync(plansRoot).filter((f) => f.endsWith('.md')).sort();
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
absences.push(`plans root absent (${plansRoot})`);
|
|
205
|
+
}
|
|
206
|
+
for (const f of planFiles) {
|
|
207
|
+
const abs = path.join(plansRoot, f);
|
|
208
|
+
const bytes = fs.readFileSync(abs);
|
|
209
|
+
const id = path.basename(f, '.md');
|
|
210
|
+
capture({
|
|
211
|
+
kind: 'plan', id, primary: f,
|
|
212
|
+
provenance: { harness: 'claude-code', native: abs, ref: blobRef(bytes) },
|
|
213
|
+
state: { status: 'snapshot', capturedFrom: 'claude-code-plans' },
|
|
214
|
+
}, [{ rel: f, bytes }]);
|
|
215
|
+
}
|
|
216
|
+
// ── projects: manifests for known roots (roots + per-harness session dirs) ─
|
|
217
|
+
const projects = [
|
|
218
|
+
['workspace', HOME],
|
|
219
|
+
['omniclaude-v4', path.join(HOME, 'omniclaude-v4')],
|
|
220
|
+
['nexus-terminal', path.join(HOME, 'nexus-terminal')],
|
|
221
|
+
];
|
|
222
|
+
for (const [id, root] of projects) {
|
|
223
|
+
if (!fs.existsSync(root))
|
|
224
|
+
continue;
|
|
225
|
+
const doc = JSON.stringify({
|
|
226
|
+
id, root,
|
|
227
|
+
sessionDirs: { 'nexus-cortex': path.join(root, '.cortex', 'sessions'), 'claude-code': `~/.claude/projects/${root.replace(/\//g, '-')}` },
|
|
228
|
+
}, null, 2) + '\n';
|
|
229
|
+
capture({
|
|
230
|
+
kind: 'project', id, primary: `${id}.json`,
|
|
231
|
+
provenance: { harness: 'workspace', native: root, ref: blobRef(doc) },
|
|
232
|
+
state: { status: 'active' },
|
|
233
|
+
}, [{ rel: `${id}.json`, bytes: Buffer.from(doc) }]);
|
|
234
|
+
}
|
|
235
|
+
// ── visibility doc + commit ────────────────────────────────────────────────
|
|
236
|
+
const summary = `${captured} captured, ${unchanged} unchanged (${Object.entries(kinds).map(([k, n]) => `${k}:${n}`).join(', ') || 'none'})`;
|
|
237
|
+
let pushed = false;
|
|
238
|
+
if (!DRY) {
|
|
239
|
+
const md = `# /canon/artifacts — ArtifactManifest records (§27p second record kind)\n\n` +
|
|
240
|
+
`One JSON manifest per artifact: identity, content-derived version (primary-file git\n` +
|
|
241
|
+
`blob ref), blob-addressed content listing, provenance, harnessCompat, projectionRules.\n` +
|
|
242
|
+
`Bytes live in the store taxonomy dirs (/skills /agents /mcp /plugins /plans /projects).\n\n` +
|
|
243
|
+
`## Not captured this run (visible, never silent — D8)\n` +
|
|
244
|
+
(absences.length ? absences.map((a) => `- ${a}\n`).join('') : '- none\n') +
|
|
245
|
+
`\n## Projection-back\nRendering artifacts INTO a receiving harness's layout (the pull side of the\n` +
|
|
246
|
+
`per-kind layout adapters) arrives with the artifact pull leg; until then its\nabsence is stated here rather than implied.\n`;
|
|
247
|
+
const mdPath = path.join(STORE, 'canon', 'artifacts', 'ARTIFACTS.md');
|
|
248
|
+
fs.mkdirSync(path.dirname(mdPath), { recursive: true });
|
|
249
|
+
fs.writeFileSync(mdPath, md);
|
|
250
|
+
fs.mkdirSync(path.dirname(MANIFEST_PATH), { recursive: true });
|
|
251
|
+
fs.writeFileSync(MANIFEST_PATH, JSON.stringify(incr));
|
|
252
|
+
const git = (a) => execFileSync('git', a, { cwd: STORE, encoding: 'utf8', env });
|
|
253
|
+
git(['add', '-A']);
|
|
254
|
+
if (git(['status', '--porcelain']).trim()) {
|
|
255
|
+
git(['commit', '-q', '-m', `canon-artifacts: ${summary}`]);
|
|
256
|
+
git(['push', '-q', 'origin', 'main']);
|
|
257
|
+
console.log(`[canon-artifacts] pushed: ${summary}`);
|
|
258
|
+
pushed = true;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
console.log(`[canon-artifacts] no changes (${summary})`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
console.log(`[canon-artifacts DRY] would capture ${captured}, unchanged ${unchanged}`);
|
|
266
|
+
}
|
|
267
|
+
return { captured, unchanged, kinds, pushed };
|
|
268
|
+
}
|
|
269
|
+
//# sourceMappingURL=canonArtifacts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canonArtifacts.js","sourceRoot":"","sources":["../../src/canon/canonArtifacts.ts"],"names":[],"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