@vkenliu/adit-cloud 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/LICENSE +21 -0
- package/dist/auth/credentials.d.ts +62 -0
- package/dist/auth/credentials.d.ts.map +1 -0
- package/dist/auth/credentials.js +151 -0
- package/dist/auth/credentials.js.map +1 -0
- package/dist/auth/device-auth.d.ts +40 -0
- package/dist/auth/device-auth.d.ts.map +1 -0
- package/dist/auth/device-auth.js +84 -0
- package/dist/auth/device-auth.js.map +1 -0
- package/dist/config.d.ts +48 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +80 -0
- package/dist/config.js.map +1 -0
- package/dist/http/client.d.ts +28 -0
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/client.js +229 -0
- package/dist/http/client.js.map +1 -0
- package/dist/http/errors.d.ts +19 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +31 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/project-link/auto-link.d.ts +30 -0
- package/dist/project-link/auto-link.d.ts.map +1 -0
- package/dist/project-link/auto-link.js +91 -0
- package/dist/project-link/auto-link.js.map +1 -0
- package/dist/project-link/bulk-task.d.ts +15 -0
- package/dist/project-link/bulk-task.d.ts.map +1 -0
- package/dist/project-link/bulk-task.js +107 -0
- package/dist/project-link/bulk-task.js.map +1 -0
- package/dist/project-link/cache.d.ts +22 -0
- package/dist/project-link/cache.d.ts.map +1 -0
- package/dist/project-link/cache.js +82 -0
- package/dist/project-link/cache.js.map +1 -0
- package/dist/project-link/doc-discovery.d.ts +35 -0
- package/dist/project-link/doc-discovery.d.ts.map +1 -0
- package/dist/project-link/doc-discovery.js +260 -0
- package/dist/project-link/doc-discovery.js.map +1 -0
- package/dist/project-link/git-collector.d.ts +88 -0
- package/dist/project-link/git-collector.d.ts.map +1 -0
- package/dist/project-link/git-collector.js +250 -0
- package/dist/project-link/git-collector.js.map +1 -0
- package/dist/project-link/index.d.ts +15 -0
- package/dist/project-link/index.d.ts.map +1 -0
- package/dist/project-link/index.js +20 -0
- package/dist/project-link/index.js.map +1 -0
- package/dist/project-link/intent-command.d.ts +23 -0
- package/dist/project-link/intent-command.d.ts.map +1 -0
- package/dist/project-link/intent-command.js +104 -0
- package/dist/project-link/intent-command.js.map +1 -0
- package/dist/project-link/link-command.d.ts +26 -0
- package/dist/project-link/link-command.d.ts.map +1 -0
- package/dist/project-link/link-command.js +350 -0
- package/dist/project-link/link-command.js.map +1 -0
- package/dist/project-link/qualify.d.ts +25 -0
- package/dist/project-link/qualify.d.ts.map +1 -0
- package/dist/project-link/qualify.js +45 -0
- package/dist/project-link/qualify.js.map +1 -0
- package/dist/project-link/types.d.ts +254 -0
- package/dist/project-link/types.d.ts.map +1 -0
- package/dist/project-link/types.js +8 -0
- package/dist/project-link/types.js.map +1 -0
- package/dist/sync/auto-sync.d.ts +42 -0
- package/dist/sync/auto-sync.d.ts.map +1 -0
- package/dist/sync/auto-sync.js +136 -0
- package/dist/sync/auto-sync.js.map +1 -0
- package/dist/sync/conflicts.d.ts +27 -0
- package/dist/sync/conflicts.d.ts.map +1 -0
- package/dist/sync/conflicts.js +28 -0
- package/dist/sync/conflicts.js.map +1 -0
- package/dist/sync/engine.d.ts +76 -0
- package/dist/sync/engine.d.ts.map +1 -0
- package/dist/sync/engine.js +152 -0
- package/dist/sync/engine.js.map +1 -0
- package/dist/sync/serializer.d.ts +123 -0
- package/dist/sync/serializer.d.ts.map +1 -0
- package/dist/sync/serializer.js +280 -0
- package/dist/sync/serializer.js.map +1 -0
- package/dist/transcript/auto-upload.d.ts +25 -0
- package/dist/transcript/auto-upload.d.ts.map +1 -0
- package/dist/transcript/auto-upload.js +75 -0
- package/dist/transcript/auto-upload.js.map +1 -0
- package/dist/transcript/index.d.ts +4 -0
- package/dist/transcript/index.d.ts.map +1 -0
- package/dist/transcript/index.js +4 -0
- package/dist/transcript/index.js.map +1 -0
- package/dist/transcript/manager.d.ts +63 -0
- package/dist/transcript/manager.d.ts.map +1 -0
- package/dist/transcript/manager.js +143 -0
- package/dist/transcript/manager.js.map +1 -0
- package/dist/transcript/uploader.d.ts +135 -0
- package/dist/transcript/uploader.d.ts.map +1 -0
- package/dist/transcript/uploader.js +235 -0
- package/dist/transcript/uploader.js.map +1 -0
- package/package.json +29 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git metadata collection for project link.
|
|
3
|
+
*
|
|
4
|
+
* Collects remote URL, branches, commit logs, and default branch
|
|
5
|
+
* using the existing @vkenliu/adit-engine git runner. All functions are
|
|
6
|
+
* fail-safe — they throw on critical errors (no git repo, no remote)
|
|
7
|
+
* but return empty arrays for non-critical failures.
|
|
8
|
+
*/
|
|
9
|
+
import { runGit, getRemoteUrl } from "@vkenliu/adit-engine";
|
|
10
|
+
/** Collect the remote origin URL. Throws if no remote is configured. */
|
|
11
|
+
export async function collectRemoteUrl(cwd) {
|
|
12
|
+
const url = await getRemoteUrl(cwd);
|
|
13
|
+
if (!url) {
|
|
14
|
+
throw new Error("No git remote 'origin' configured. Add one with: git remote add origin <url>");
|
|
15
|
+
}
|
|
16
|
+
return url;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Detect the default branch name.
|
|
20
|
+
*
|
|
21
|
+
* Tries `git symbolic-ref refs/remotes/origin/HEAD` first (reliable
|
|
22
|
+
* if the remote HEAD is set). Falls back to checking for `main` then
|
|
23
|
+
* `master` branch existence.
|
|
24
|
+
*/
|
|
25
|
+
export async function collectDefaultBranch(cwd) {
|
|
26
|
+
const result = await runGit(["symbolic-ref", "refs/remotes/origin/HEAD", "--short"], { cwd });
|
|
27
|
+
if (result.exitCode === 0) {
|
|
28
|
+
// Returns "origin/main" — strip the "origin/" prefix
|
|
29
|
+
const ref = result.stdout.trim();
|
|
30
|
+
return ref.replace(/^origin\//, "");
|
|
31
|
+
}
|
|
32
|
+
// Fallback: check if main or master exists
|
|
33
|
+
for (const branch of ["main", "master"]) {
|
|
34
|
+
const check = await runGit(["rev-parse", "--verify", `refs/heads/${branch}`], { cwd });
|
|
35
|
+
if (check.exitCode === 0)
|
|
36
|
+
return branch;
|
|
37
|
+
}
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the currently checked-out branch name.
|
|
42
|
+
*
|
|
43
|
+
* Uses `git branch --show-current` which returns an empty string
|
|
44
|
+
* in detached HEAD state. Returns null if not on a branch or if
|
|
45
|
+
* the command fails.
|
|
46
|
+
*/
|
|
47
|
+
export async function collectCurrentBranch(cwd) {
|
|
48
|
+
const result = await runGit(["branch", "--show-current"], { cwd });
|
|
49
|
+
if (result.exitCode !== 0)
|
|
50
|
+
return null;
|
|
51
|
+
const branch = result.stdout.trim();
|
|
52
|
+
return branch || null;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Collect all branches (local + remote) with their HEAD SHAs.
|
|
56
|
+
*
|
|
57
|
+
* Remote branches are included and deduplicated — if a local branch
|
|
58
|
+
* name matches a remote tracking branch, the local version is kept.
|
|
59
|
+
*/
|
|
60
|
+
export async function collectBranches(cwd) {
|
|
61
|
+
const result = await runGit(["branch", "-a", "--format=%(refname:short)|%(objectname:short)"], { cwd });
|
|
62
|
+
if (result.exitCode !== 0)
|
|
63
|
+
return [];
|
|
64
|
+
const defaultBranch = await collectDefaultBranch(cwd);
|
|
65
|
+
const seen = new Map();
|
|
66
|
+
for (const line of result.stdout.trim().split("\n")) {
|
|
67
|
+
if (!line)
|
|
68
|
+
continue;
|
|
69
|
+
const [rawName, headSha] = line.split("|");
|
|
70
|
+
if (!rawName || !headSha)
|
|
71
|
+
continue;
|
|
72
|
+
// Normalize remote branch names: "origin/main" → "main"
|
|
73
|
+
let name = rawName.trim();
|
|
74
|
+
if (name.startsWith("origin/")) {
|
|
75
|
+
name = name.slice("origin/".length);
|
|
76
|
+
}
|
|
77
|
+
// Skip HEAD pointer
|
|
78
|
+
if (name === "HEAD" || name.includes("->"))
|
|
79
|
+
continue;
|
|
80
|
+
// Local branches take priority over remote tracking branches
|
|
81
|
+
if (!seen.has(name) || !rawName.startsWith("origin/")) {
|
|
82
|
+
seen.set(name, {
|
|
83
|
+
name,
|
|
84
|
+
headSha: headSha.trim(),
|
|
85
|
+
isDefault: name === defaultBranch,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return Array.from(seen.values());
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Collect commit logs, optionally since a specific commit SHA.
|
|
93
|
+
*
|
|
94
|
+
* When `sinceCommitSha` is provided, only commits after that SHA
|
|
95
|
+
* are returned (incremental sync). Otherwise, all commits are returned.
|
|
96
|
+
* Commits are ordered newest-first (git log default).
|
|
97
|
+
*
|
|
98
|
+
* When `branch` is provided, each returned commit will have its
|
|
99
|
+
* `branch` field set to that value. For accurate per-commit branch
|
|
100
|
+
* assignment, use `resolveCommitBranches()` after collecting commits
|
|
101
|
+
* instead of this option.
|
|
102
|
+
*
|
|
103
|
+
* Format uses NUL (\x00) as record delimiter and SOH (\x01) as field
|
|
104
|
+
* delimiter so that pipe characters and newlines inside commit messages
|
|
105
|
+
* (%B = subject + body, multi-line) are preserved without ambiguity.
|
|
106
|
+
*/
|
|
107
|
+
export async function collectCommitLogs(cwd, sinceCommitShaOrOptions) {
|
|
108
|
+
// Support both the old positional signature and the new options object.
|
|
109
|
+
// Old: collectCommitLogs(cwd, sinceCommitSha)
|
|
110
|
+
// New: collectCommitLogs(cwd, { sinceCommitSha, branch })
|
|
111
|
+
let sinceCommitSha;
|
|
112
|
+
let branch;
|
|
113
|
+
if (sinceCommitShaOrOptions !== null &&
|
|
114
|
+
sinceCommitShaOrOptions !== undefined &&
|
|
115
|
+
typeof sinceCommitShaOrOptions === "object") {
|
|
116
|
+
sinceCommitSha = sinceCommitShaOrOptions.sinceCommitSha;
|
|
117
|
+
branch = sinceCommitShaOrOptions.branch;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
sinceCommitSha = sinceCommitShaOrOptions;
|
|
121
|
+
}
|
|
122
|
+
// %H = full SHA
|
|
123
|
+
// %an = author name
|
|
124
|
+
// %ae = author email
|
|
125
|
+
// %aI = author date (ISO 8601 strict)
|
|
126
|
+
// %B = subject + body (may contain newlines)
|
|
127
|
+
// %x01 = SOH field delimiter, %x00 = NUL record delimiter
|
|
128
|
+
const args = ["log", "--format=%H%x01%an%x01%ae%x01%aI%x01%B%x00"];
|
|
129
|
+
if (sinceCommitSha) {
|
|
130
|
+
// Verify the SHA still exists (could have been force-pushed away)
|
|
131
|
+
const exists = await runGit(["cat-file", "-t", sinceCommitSha], { cwd });
|
|
132
|
+
if (exists.exitCode === 0) {
|
|
133
|
+
args.push(`${sinceCommitSha}..HEAD`);
|
|
134
|
+
}
|
|
135
|
+
// If SHA doesn't exist, fall through to full log
|
|
136
|
+
}
|
|
137
|
+
const result = await runGit(args, { cwd, timeout: 30_000 });
|
|
138
|
+
if (result.exitCode !== 0)
|
|
139
|
+
return [];
|
|
140
|
+
const commits = [];
|
|
141
|
+
// Split on NUL to get individual commit records.
|
|
142
|
+
// %B includes a trailing newline; we trim each record to strip it.
|
|
143
|
+
for (const record of result.stdout.split("\0")) {
|
|
144
|
+
const trimmed = record.trim();
|
|
145
|
+
if (!trimmed)
|
|
146
|
+
continue;
|
|
147
|
+
const fields = trimmed.split("\x01");
|
|
148
|
+
if (fields.length < 5)
|
|
149
|
+
continue;
|
|
150
|
+
commits.push({
|
|
151
|
+
sha: fields[0],
|
|
152
|
+
authorName: fields[1],
|
|
153
|
+
authorEmail: fields[2],
|
|
154
|
+
date: fields[3],
|
|
155
|
+
// %B may contain SOH-free multi-line text; everything after the 4th
|
|
156
|
+
// SOH is the message (rejoin in case of unexpected extra SOH chars).
|
|
157
|
+
message: fields.slice(4).join("\x01").trim(),
|
|
158
|
+
branch: branch ?? undefined,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return commits;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Resolve per-commit branch assignments for a set of commits.
|
|
165
|
+
*
|
|
166
|
+
* For each known branch, runs `git log <branch> --format=%H` to collect
|
|
167
|
+
* the SHAs reachable from that branch. Commits are assigned to the most
|
|
168
|
+
* specific branch (non-default branches take priority over the default
|
|
169
|
+
* branch, so a commit on `feature/x` that was later merged into `main`
|
|
170
|
+
* is attributed to `feature/x`).
|
|
171
|
+
*
|
|
172
|
+
* Only SHAs present in `commitShas` are assigned — this avoids building
|
|
173
|
+
* a map for the entire repository history when doing incremental sync.
|
|
174
|
+
*
|
|
175
|
+
* Mutates the `branch` field of each commit in `commits` in-place and
|
|
176
|
+
* also returns the same array for chaining convenience.
|
|
177
|
+
*/
|
|
178
|
+
export async function resolveCommitBranches(cwd, commits, branches, defaultBranch) {
|
|
179
|
+
if (commits.length === 0 || branches.length === 0)
|
|
180
|
+
return commits;
|
|
181
|
+
// Build a set of SHAs we care about for fast lookup
|
|
182
|
+
const targetShas = new Set(commits.map((c) => c.sha));
|
|
183
|
+
// Map from SHA → branch name. Non-default branches are processed first
|
|
184
|
+
// so their assignments take priority (a commit reachable from both
|
|
185
|
+
// `feature/x` and `main` should be attributed to `feature/x`).
|
|
186
|
+
const shaToBranch = new Map();
|
|
187
|
+
// Sort branches: default branch last so non-default branches win
|
|
188
|
+
const sorted = [...branches].sort((a, b) => {
|
|
189
|
+
const aIsDefault = a.name === defaultBranch ? 1 : 0;
|
|
190
|
+
const bIsDefault = b.name === defaultBranch ? 1 : 0;
|
|
191
|
+
return aIsDefault - bIsDefault;
|
|
192
|
+
});
|
|
193
|
+
for (const branch of sorted) {
|
|
194
|
+
const result = await runGit(["log", branch.name, "--format=%H"], { cwd, timeout: 30_000 });
|
|
195
|
+
if (result.exitCode !== 0)
|
|
196
|
+
continue;
|
|
197
|
+
for (const line of result.stdout.trim().split("\n")) {
|
|
198
|
+
const sha = line.trim();
|
|
199
|
+
if (!sha || !targetShas.has(sha))
|
|
200
|
+
continue;
|
|
201
|
+
// Only assign if not already claimed by a non-default branch
|
|
202
|
+
if (!shaToBranch.has(sha)) {
|
|
203
|
+
shaToBranch.set(sha, branch.name);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
// Apply resolved branches to commits
|
|
208
|
+
for (const commit of commits) {
|
|
209
|
+
const resolved = shaToBranch.get(commit.sha);
|
|
210
|
+
if (resolved) {
|
|
211
|
+
commit.branch = resolved;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return commits;
|
|
215
|
+
}
|
|
216
|
+
/** Count total commits reachable from HEAD. */
|
|
217
|
+
export async function collectCommitCount(cwd) {
|
|
218
|
+
const result = await runGit(["rev-list", "--count", "HEAD"], { cwd });
|
|
219
|
+
if (result.exitCode !== 0)
|
|
220
|
+
return 0;
|
|
221
|
+
return parseInt(result.stdout.trim(), 10) || 0;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Extract a project name from a git remote URL.
|
|
225
|
+
*
|
|
226
|
+
* Examples:
|
|
227
|
+
* "https://github.com/user/my-repo.git" → "my-repo"
|
|
228
|
+
* "git@github.com:user/my-repo.git" → "my-repo"
|
|
229
|
+
* "https://github.com/user/my-repo" → "my-repo"
|
|
230
|
+
*/
|
|
231
|
+
export function projectNameFromRemoteUrl(url) {
|
|
232
|
+
// Strip trailing .git
|
|
233
|
+
const cleaned = url.replace(/\.git$/, "");
|
|
234
|
+
// Handle SSH: git@host:user/repo → take last segment
|
|
235
|
+
if (cleaned.includes(":") && !cleaned.includes("://")) {
|
|
236
|
+
const afterColon = cleaned.split(":").pop() ?? "";
|
|
237
|
+
return afterColon.split("/").pop() ?? cleaned;
|
|
238
|
+
}
|
|
239
|
+
// Handle HTTPS: https://host/user/repo → take last path segment
|
|
240
|
+
try {
|
|
241
|
+
const parsed = new URL(cleaned);
|
|
242
|
+
const segments = parsed.pathname.split("/").filter(Boolean);
|
|
243
|
+
return segments.pop() ?? cleaned;
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
// Fallback: just take the last path segment
|
|
247
|
+
return cleaned.split("/").pop() ?? cleaned;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=git-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-collector.js","sourceRoot":"","sources":["../../src/project-link/git-collector.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5D,wEAAwE;AACxE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,GAAW;IAChD,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,GAAW;IACpD,MAAM,MAAM,GAAG,MAAM,MAAM,CACzB,CAAC,cAAc,EAAE,0BAA0B,EAAE,SAAS,CAAC,EACvD,EAAE,GAAG,EAAE,CACR,CAAC;IAEF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;QAC1B,qDAAqD;QACrD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACtC,CAAC;IAED,2CAA2C;IAC3C,KAAK,MAAM,MAAM,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,CAAC,WAAW,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AE1C,qDAAqD;IACrD,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACtD,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAClD,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC;IAChD,CAAC;IAED,gEAAgE;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;QAChC,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5D,OAAO,QAAQ,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,4CAA4C;QAC5C,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Link — public API for connecting a local codebase to adit-cloud.
|
|
3
|
+
*
|
|
4
|
+
* Exports command handlers, utility functions, and type definitions
|
|
5
|
+
* for the `/adit link` and `/adit intent` plugin commands.
|
|
6
|
+
*/
|
|
7
|
+
export { linkCommand } from "./link-command.js";
|
|
8
|
+
export { intentCommand, formatIntentList, formatIntentDetail } from "./intent-command.js";
|
|
9
|
+
export { triggerProjectLinkSync } from "./auto-link.js";
|
|
10
|
+
export { checkQuality, formatQualityFeedback } from "./qualify.js";
|
|
11
|
+
export { collectRemoteUrl, collectDefaultBranch, collectCurrentBranch, collectBranches, collectCommitLogs, collectCommitCount, resolveCommitBranches, projectNameFromRemoteUrl, } from "./git-collector.js";
|
|
12
|
+
export { discoverDocuments, loadDocSettings } from "./doc-discovery.js";
|
|
13
|
+
export { getProjectLinkCache, upsertProjectLinkCache, clearProjectLinkCache, updateCachedCommitSha, updateCachedDocHashes, updateCachedQualified, } from "./cache.js";
|
|
14
|
+
export type { GitBranch, GitCommit, DiscoveredDocument, ProjectLinkCache, NegotiateResponse, LinkInitResponse, CommitUploadResponse, DocumentUploadResponse, QualifyResponse, LinkStatusResponse, IntentSummary, IntentDetail, TaskSlice, StepTiming, LinkOptions, IntentOptions, LinkResult, IntentResult, } from "./types.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-link/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAGxD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGxE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAC;AAGpB,YAAY,EACV,SAAS,EACT,SAAS,EACT,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project Link — public API for connecting a local codebase to adit-cloud.
|
|
3
|
+
*
|
|
4
|
+
* Exports command handlers, utility functions, and type definitions
|
|
5
|
+
* for the `/adit link` and `/adit intent` plugin commands.
|
|
6
|
+
*/
|
|
7
|
+
// Command handlers
|
|
8
|
+
export { linkCommand } from "./link-command.js";
|
|
9
|
+
export { intentCommand, formatIntentList, formatIntentDetail } from "./intent-command.js";
|
|
10
|
+
// Auto-sync
|
|
11
|
+
export { triggerProjectLinkSync } from "./auto-link.js";
|
|
12
|
+
// Quality check
|
|
13
|
+
export { checkQuality, formatQualityFeedback } from "./qualify.js";
|
|
14
|
+
// Git collection
|
|
15
|
+
export { collectRemoteUrl, collectDefaultBranch, collectCurrentBranch, collectBranches, collectCommitLogs, collectCommitCount, resolveCommitBranches, projectNameFromRemoteUrl, } from "./git-collector.js";
|
|
16
|
+
// Document discovery
|
|
17
|
+
export { discoverDocuments, loadDocSettings } from "./doc-discovery.js";
|
|
18
|
+
// Local cache
|
|
19
|
+
export { getProjectLinkCache, upsertProjectLinkCache, clearProjectLinkCache, updateCachedCommitSha, updateCachedDocHashes, updateCachedQualified, } from "./cache.js";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/project-link/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,mBAAmB;AACnB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAE1F,YAAY;AACZ,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,gBAAgB;AAChB,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAEnE,iBAAiB;AACjB,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,oBAAoB,CAAC;AAE5B,qBAAqB;AACrB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAExE,cAAc;AACd,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent command handler for `/adit intent`.
|
|
3
|
+
*
|
|
4
|
+
* Lists intents for the linked project, or shows detail for a
|
|
5
|
+
* specific intent including tasks, latest plan, and ship notes.
|
|
6
|
+
*/
|
|
7
|
+
import type { CloudClient } from "../http/client.js";
|
|
8
|
+
import type { IntentOptions, IntentResult, IntentSummary, IntentDetail } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Execute the intent command: list intents or show detail.
|
|
11
|
+
*
|
|
12
|
+
* Requires a linked project with a confirmed project ID.
|
|
13
|
+
*/
|
|
14
|
+
export declare function intentCommand(client: CloudClient, projectId: string, options: IntentOptions): Promise<IntentResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Format an intent list for human-readable display.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatIntentList(intents: IntentSummary[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format an intent detail for human-readable display.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatIntentDetail(intent: IntentDetail): string;
|
|
23
|
+
//# sourceMappingURL=intent-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent-command.d.ts","sourceRoot":"","sources":["../../src/project-link/intent-command.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,YAAY,EACb,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,CAiBvB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,MAAM,CAsBjE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,CA4D/D"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Intent command handler for `/adit intent`.
|
|
3
|
+
*
|
|
4
|
+
* Lists intents for the linked project, or shows detail for a
|
|
5
|
+
* specific intent including tasks, latest plan, and ship notes.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Execute the intent command: list intents or show detail.
|
|
9
|
+
*
|
|
10
|
+
* Requires a linked project with a confirmed project ID.
|
|
11
|
+
*/
|
|
12
|
+
export async function intentCommand(client, projectId, options) {
|
|
13
|
+
if (options.id) {
|
|
14
|
+
// Show detail for a specific intent
|
|
15
|
+
const intent = await client.get(`/api/project-link/intents/${encodeURIComponent(options.id)}?projectId=${encodeURIComponent(projectId)}`);
|
|
16
|
+
return { intent: intent.intent };
|
|
17
|
+
}
|
|
18
|
+
// List intents
|
|
19
|
+
let url = `/api/project-link/intents?projectId=${encodeURIComponent(projectId)}`;
|
|
20
|
+
if (options.state) {
|
|
21
|
+
url += `&state=${encodeURIComponent(options.state)}`;
|
|
22
|
+
}
|
|
23
|
+
const response = await client.get(url);
|
|
24
|
+
return { intents: response.intents };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Format an intent list for human-readable display.
|
|
28
|
+
*/
|
|
29
|
+
export function formatIntentList(intents) {
|
|
30
|
+
if (intents.length === 0) {
|
|
31
|
+
return "No intents found for this project.";
|
|
32
|
+
}
|
|
33
|
+
const lines = [];
|
|
34
|
+
lines.push(`${intents.length} intent${intents.length !== 1 ? "s" : ""}:`);
|
|
35
|
+
lines.push("");
|
|
36
|
+
for (const intent of intents) {
|
|
37
|
+
const progress = intent.taskCount > 0
|
|
38
|
+
? `${intent.completedTaskCount}/${intent.taskCount} tasks`
|
|
39
|
+
: "no tasks";
|
|
40
|
+
const branches = intent.linkedBranches.length > 0
|
|
41
|
+
? ` [${intent.linkedBranches.join(", ")}]`
|
|
42
|
+
: "";
|
|
43
|
+
lines.push(` ${intent.id.padEnd(28)} ${intent.state.padEnd(12)} ${intent.title}${branches}`);
|
|
44
|
+
lines.push(`${"".padEnd(43)}${progress} | ${intent.businessGoal}`);
|
|
45
|
+
lines.push("");
|
|
46
|
+
}
|
|
47
|
+
return lines.join("\n");
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format an intent detail for human-readable display.
|
|
51
|
+
*/
|
|
52
|
+
export function formatIntentDetail(intent) {
|
|
53
|
+
const lines = [];
|
|
54
|
+
lines.push(`Intent: ${intent.title}`);
|
|
55
|
+
lines.push(`State: ${intent.state}`);
|
|
56
|
+
lines.push(`Goal: ${intent.businessGoal}`);
|
|
57
|
+
if (intent.acceptanceMd) {
|
|
58
|
+
lines.push("");
|
|
59
|
+
lines.push("Acceptance Criteria:");
|
|
60
|
+
lines.push(intent.acceptanceMd);
|
|
61
|
+
}
|
|
62
|
+
if (intent.antiGoals) {
|
|
63
|
+
lines.push("");
|
|
64
|
+
lines.push("Anti-Goals:");
|
|
65
|
+
lines.push(intent.antiGoals);
|
|
66
|
+
}
|
|
67
|
+
if (intent.clarityScores) {
|
|
68
|
+
const s = intent.clarityScores;
|
|
69
|
+
lines.push("");
|
|
70
|
+
lines.push(`Clarity: goal=${s.goal.toFixed(2)} constraints=${s.constraints.toFixed(2)} criteria=${s.criteria.toFixed(2)} context=${s.context.toFixed(2)}`);
|
|
71
|
+
}
|
|
72
|
+
if (intent.linkedBranches.length > 0) {
|
|
73
|
+
lines.push(`Branches: ${intent.linkedBranches.join(", ")}`);
|
|
74
|
+
}
|
|
75
|
+
if (intent.tasks.length > 0) {
|
|
76
|
+
lines.push("");
|
|
77
|
+
lines.push(`Tasks (${intent.tasks.length}):`);
|
|
78
|
+
for (const task of intent.tasks) {
|
|
79
|
+
const phase = task.phaseTitle ? `[${task.phaseTitle}]` : `[Phase ${task.phase}]`;
|
|
80
|
+
const complexity = task.complexityScore !== null ? ` (complexity: ${task.complexityScore})` : "";
|
|
81
|
+
lines.push(` ${phase} ${task.title} — ${task.approvalStatus}${complexity}`);
|
|
82
|
+
if (task.description) {
|
|
83
|
+
lines.push(` ${task.description}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (intent.latestPlan) {
|
|
88
|
+
lines.push("");
|
|
89
|
+
lines.push(`Latest Plan (v${intent.latestPlan.version}, ${intent.latestPlan.versionType}):`);
|
|
90
|
+
if (intent.latestPlan.gatekeeperVerdict) {
|
|
91
|
+
lines.push(` Verdict: ${intent.latestPlan.gatekeeperVerdict}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (intent.recentShipNotes.length > 0) {
|
|
95
|
+
lines.push("");
|
|
96
|
+
lines.push(`Recent Ship Notes (${intent.recentShipNotes.length}):`);
|
|
97
|
+
for (const note of intent.recentShipNotes) {
|
|
98
|
+
const label = note.architecturalDecision ? " [ARCH]" : "";
|
|
99
|
+
lines.push(` - ${note.noteBody}${label} (${note.createdBy})`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return lines.join("\n");
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=intent-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAC,OAAO,IAAI,CAAC,QAAQ,GAAG,KAAK,KAAK,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project link command handler — orchestrates the 6-step link flow.
|
|
3
|
+
*
|
|
4
|
+
* Steps:
|
|
5
|
+
* 1. Check credentials (handled by caller)
|
|
6
|
+
* 2. Negotiate project ID with server
|
|
7
|
+
* 3. Upload git metadata (branches + commits)
|
|
8
|
+
* 4. Discover project documents
|
|
9
|
+
* 5. Upload documents (with user confirmation in interactive mode)
|
|
10
|
+
* 6. Quality check (and optional AI summary generation)
|
|
11
|
+
*/
|
|
12
|
+
import type Database from "better-sqlite3";
|
|
13
|
+
import type { CloudClient } from "../http/client.js";
|
|
14
|
+
import type { LinkOptions, LinkResult } from "./types.js";
|
|
15
|
+
/**
|
|
16
|
+
* Execute the project link flow.
|
|
17
|
+
*
|
|
18
|
+
* The caller is responsible for:
|
|
19
|
+
* - Loading credentials and verifying authentication
|
|
20
|
+
* - Creating the CloudClient with a valid server URL
|
|
21
|
+
* - Opening the database
|
|
22
|
+
*
|
|
23
|
+
* Returns a LinkResult summarizing what was done.
|
|
24
|
+
*/
|
|
25
|
+
export declare function linkCommand(db: Database.Database, client: CloudClient, projectRoot: string, projectId: string, serverUrl: string, options?: LinkOptions): Promise<LinkResult>;
|
|
26
|
+
//# sourceMappingURL=link-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-command.d.ts","sourceRoot":"","sources":["../../src/project-link/link-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EAOX,MAAM,YAAY,CAAC;AA2BpB;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,UAAU,CAAC,CAmWrB"}
|