@context-forge/core 0.19.0 → 0.19.2
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/config/ConfigKeys.js +2 -2
- package/dist/config/ConfigKeys.js.map +1 -1
- package/dist/config/ConfigManager.js.map +1 -1
- package/dist/config/guideExclude.d.ts +7 -1
- package/dist/config/guideExclude.d.ts.map +1 -1
- package/dist/config/guideExclude.js +27 -7
- package/dist/config/guideExclude.js.map +1 -1
- package/dist/guides/GuideDetector.d.ts.map +1 -1
- package/dist/guides/GuideDetector.js +8 -39
- package/dist/guides/GuideDetector.js.map +1 -1
- package/dist/guides/GuideManager.d.ts +15 -6
- package/dist/guides/GuideManager.d.ts.map +1 -1
- package/dist/guides/GuideManager.js +38 -8
- package/dist/guides/GuideManager.js.map +1 -1
- package/dist/guides/configExcludeCommit.d.ts +23 -0
- package/dist/guides/configExcludeCommit.d.ts.map +1 -0
- package/dist/guides/configExcludeCommit.js +65 -0
- package/dist/guides/configExcludeCommit.js.map +1 -0
- package/dist/guides/gitExec.d.ts +1 -1
- package/dist/guides/gitExec.d.ts.map +1 -1
- package/dist/guides/gitExec.js +1 -1
- package/dist/guides/gitExec.js.map +1 -1
- package/dist/guides/guideTreeDiff.d.ts +8 -0
- package/dist/guides/guideTreeDiff.d.ts.map +1 -0
- package/dist/guides/guideTreeDiff.js +86 -0
- package/dist/guides/guideTreeDiff.js.map +1 -0
- package/dist/guides/index.d.ts +1 -1
- package/dist/guides/index.d.ts.map +1 -1
- package/dist/guides/index.js.map +1 -1
- package/dist/guides/strategies/TarballStrategy.d.ts +20 -38
- package/dist/guides/strategies/TarballStrategy.d.ts.map +1 -1
- package/dist/guides/strategies/TarballStrategy.js +123 -172
- package/dist/guides/strategies/TarballStrategy.js.map +1 -1
- package/dist/guides/strategies/tarballSwap.d.ts +12 -0
- package/dist/guides/strategies/tarballSwap.d.ts.map +1 -0
- package/dist/guides/strategies/tarballSwap.js +66 -0
- package/dist/guides/strategies/tarballSwap.js.map +1 -0
- package/dist/guides/tarballSource.d.ts +68 -0
- package/dist/guides/tarballSource.d.ts.map +1 -0
- package/dist/guides/tarballSource.js +171 -0
- package/dist/guides/tarballSource.js.map +1 -0
- package/dist/guides/types.d.ts +41 -4
- package/dist/guides/types.d.ts.map +1 -1
- package/dist/guides/types.js +7 -2
- package/dist/guides/types.js.map +1 -1
- package/dist/guides/versionTags.d.ts +3 -0
- package/dist/guides/versionTags.d.ts.map +1 -0
- package/dist/guides/versionTags.js +17 -0
- package/dist/guides/versionTags.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/introspection/ConsistencyChecker.js.map +1 -1
- package/dist/introspection/ProjectModelBuilder.d.ts.map +1 -1
- package/dist/introspection/ProjectModelBuilder.js.map +1 -1
- package/dist/services/ContextEmbedder.js.map +1 -1
- package/dist/services/ContextIntegrator.d.ts.map +1 -1
- package/dist/services/ContextIntegrator.js +6 -6
- package/dist/services/ContextIntegrator.js.map +1 -1
- package/dist/services/ContextTemplateEngine.d.ts +1 -1
- package/dist/services/ContextTemplateEngine.d.ts.map +1 -1
- package/dist/services/ContextTemplateEngine.js +5 -5
- package/dist/services/ContextTemplateEngine.js.map +1 -1
- package/dist/services/SectionBuilder.d.ts.map +1 -1
- package/dist/services/SectionBuilder.js +3 -3
- package/dist/services/SectionBuilder.js.map +1 -1
- package/dist/services/StatementManager.d.ts.map +1 -1
- package/dist/services/StatementManager.js +7 -4
- package/dist/services/StatementManager.js.map +1 -1
- package/dist/services/SystemPromptParser.d.ts +1 -0
- package/dist/services/SystemPromptParser.d.ts.map +1 -1
- package/dist/services/SystemPromptParser.js +6 -2
- package/dist/services/SystemPromptParser.js.map +1 -1
- package/dist/services/TemplateProcessor.js +1 -1
- package/dist/services/TemplateProcessor.js.map +1 -1
- package/dist/storage/FileStorageService.d.ts.map +1 -1
- package/dist/storage/FileStorageService.js +6 -3
- package/dist/storage/FileStorageService.js.map +1 -1
- package/dist/storage/backupService.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,52 +1,18 @@
|
|
|
1
1
|
// Tarball-based (manual) guide installation strategy
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync, mkdirSync
|
|
3
|
-
import {
|
|
2
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
3
|
+
import { join } from 'path';
|
|
4
4
|
import { createGunzip } from 'zlib';
|
|
5
|
-
import { Readable } from 'stream';
|
|
6
5
|
import { pipeline } from 'stream/promises';
|
|
7
6
|
import { extract } from 'tar';
|
|
8
|
-
import { fetch as undiciFetch, EnvHttpProxyAgent } from 'undici';
|
|
9
7
|
import { VERSION_MARKER_FILE, EXCLUDE_RECORD_FILE, DEFAULT_SOURCE_GIT, GUIDE_RELATIVE_PATH } from '../types.js';
|
|
10
|
-
import {
|
|
8
|
+
import { commitPathIfChanged } from '../gitExec.js';
|
|
9
|
+
import { resolveTarballSource, openArchive } from '../tarballSource.js';
|
|
10
|
+
import { diffGuideTrees } from '../guideTreeDiff.js';
|
|
11
|
+
import { decideConfigCommit } from '../configExcludeCommit.js';
|
|
12
|
+
import { clearLeftovers, removeStaging, stagingPathFor, swapIntoPlace } from './tarballSwap.js';
|
|
11
13
|
import { matchingGuidePatterns, sameExcludeList } from '../../config/guideExclude.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* for the ls-remote half; Node's built-in fetch does not, so the download goes
|
|
15
|
-
* through undici's EnvHttpProxyAgent, which reads the same set (and NO_PROXY).
|
|
16
|
-
*/
|
|
17
|
-
const PROXY_ENV_VARS = ['HTTPS_PROXY', 'https_proxy', 'HTTP_PROXY', 'http_proxy'];
|
|
18
|
-
/** Names of the proxy variables currently set, so a failure can say which applied. */
|
|
19
|
-
export function activeProxyEnvVars(env = process.env) {
|
|
20
|
-
return PROXY_ENV_VARS.filter((name) => Boolean(env[name]));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* GitHub signals an exhausted rate limit with 403 (or 429) plus
|
|
24
|
-
* x-ratelimit-remaining: 0. Returns a specific message for that case, null
|
|
25
|
-
* for any other failure status.
|
|
26
|
-
*/
|
|
27
|
-
export function describeRateLimit(status, headers) {
|
|
28
|
-
if (status !== 403 && status !== 429)
|
|
29
|
-
return null;
|
|
30
|
-
if (headers.get('x-ratelimit-remaining') !== '0')
|
|
31
|
-
return null;
|
|
32
|
-
const reset = headers.get('x-ratelimit-reset');
|
|
33
|
-
const resetAt = reset && /^\d+$/.test(reset)
|
|
34
|
-
? ` Resets at ${new Date(Number(reset) * 1000).toLocaleTimeString()}.`
|
|
35
|
-
: '';
|
|
36
|
-
return ('GitHub API rate limit exceeded: unauthenticated requests are limited to 60 per hour ' +
|
|
37
|
-
`per source IP, shared by everyone behind the same NAT or proxy.${resetAt}`);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Parse owner/repo from a GitHub source URL.
|
|
41
|
-
* Supports: https://github.com/{owner}/{repo}.git and https://github.com/{owner}/{repo}
|
|
42
|
-
*/
|
|
43
|
-
export function parseGitHubOwnerRepo(source) {
|
|
44
|
-
const match = /github\.com\/([^/]+)\/([^/.]+)/.exec(source);
|
|
45
|
-
if (!match) {
|
|
46
|
-
throw new Error(`Cannot parse GitHub owner/repo from source URL: ${source}`);
|
|
47
|
-
}
|
|
48
|
-
return { owner: match[1], repo: match[2] };
|
|
49
|
-
}
|
|
14
|
+
// Moved to tarballSource; re-exported so existing importers keep working.
|
|
15
|
+
export { activeProxyEnvVars, describeRateLimit, parseGitHubOwnerRepo } from '../tarballSource.js';
|
|
50
16
|
/**
|
|
51
17
|
* Top-level entries dropped from the extracted tarball. A tarball install
|
|
52
18
|
* promises plain files with no git wiring, and the guide repo has at times
|
|
@@ -88,15 +54,15 @@ export function readExcludeRecord(guideDir) {
|
|
|
88
54
|
.filter((line) => line !== '')
|
|
89
55
|
.sort();
|
|
90
56
|
}
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
57
|
+
/** The version marker of a guide directory, or null when there is none. */
|
|
58
|
+
function readVersionMarker(guideDir) {
|
|
59
|
+
const markerPath = join(guideDir, VERSION_MARKER_FILE);
|
|
60
|
+
return existsSync(markerPath) ? readFileSync(markerPath, 'utf-8').trim() || null : null;
|
|
61
|
+
}
|
|
62
|
+
/** Whether the installed and staged guides carry the same version marker and exclude record. */
|
|
63
|
+
function bookkeepingMatches(installedDir, stagedDir) {
|
|
64
|
+
return (readVersionMarker(installedDir) === readVersionMarker(stagedDir) &&
|
|
65
|
+
sameExcludeList(readExcludeRecord(installedDir), readExcludeRecord(stagedDir)));
|
|
100
66
|
}
|
|
101
67
|
export class TarballStrategy {
|
|
102
68
|
exclude;
|
|
@@ -104,38 +70,39 @@ export class TarballStrategy {
|
|
|
104
70
|
constructor(exclude = []) {
|
|
105
71
|
this.exclude = exclude;
|
|
106
72
|
}
|
|
107
|
-
|
|
73
|
+
detect(_projectPath, targetDir) {
|
|
108
74
|
const markerPath = join(targetDir, VERSION_MARKER_FILE);
|
|
109
75
|
if (!existsSync(markerPath))
|
|
110
|
-
return null;
|
|
76
|
+
return Promise.resolve(null);
|
|
111
77
|
try {
|
|
112
78
|
const version = readFileSync(markerPath, 'utf-8').trim() || null;
|
|
113
|
-
return { method: 'tarball', version, source: null };
|
|
79
|
+
return Promise.resolve({ method: 'tarball', version, source: null });
|
|
114
80
|
}
|
|
115
81
|
catch {
|
|
116
|
-
return null;
|
|
82
|
+
return Promise.resolve(null);
|
|
117
83
|
}
|
|
118
84
|
}
|
|
119
|
-
async install(projectPath, source, targetDir) {
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
const
|
|
85
|
+
async install(projectPath, source, targetDir, options = {}) {
|
|
86
|
+
const resolved = await resolveTarballSource({
|
|
87
|
+
source: source || DEFAULT_SOURCE_GIT,
|
|
88
|
+
version: options.version,
|
|
89
|
+
projectRoot: options.sourceRoot ?? projectPath,
|
|
90
|
+
});
|
|
91
|
+
const tag = resolved.tag;
|
|
92
|
+
const unmatched = await this.extractAndSwap(resolved, targetDir);
|
|
126
93
|
// Same commit the submodule strategy makes, so a tarball install does not
|
|
127
94
|
// leave the guide untracked for the user to notice later.
|
|
128
|
-
const committed = await commitPathIfChanged(projectPath, GUIDE_RELATIVE_PATH, `docs: install ai-project-guide ${
|
|
95
|
+
const committed = await commitPathIfChanged(projectPath, GUIDE_RELATIVE_PATH, `docs: install ai-project-guide ${tag}`);
|
|
129
96
|
return {
|
|
130
97
|
success: true,
|
|
131
|
-
version:
|
|
98
|
+
version: tag,
|
|
132
99
|
method: 'tarball',
|
|
133
100
|
path: targetDir,
|
|
134
101
|
committed,
|
|
135
102
|
...this.excludeFields(unmatched),
|
|
136
103
|
};
|
|
137
104
|
}
|
|
138
|
-
async update(projectPath, targetDir, source) {
|
|
105
|
+
async update(projectPath, targetDir, source, options = {}) {
|
|
139
106
|
const markerPath = join(targetDir, VERSION_MARKER_FILE);
|
|
140
107
|
let previousVersion = null;
|
|
141
108
|
try {
|
|
@@ -144,26 +111,44 @@ export class TarballStrategy {
|
|
|
144
111
|
catch {
|
|
145
112
|
// No previous version
|
|
146
113
|
}
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
114
|
+
const resolved = await resolveTarballSource({
|
|
115
|
+
source,
|
|
116
|
+
version: options.version,
|
|
117
|
+
projectRoot: options.sourceRoot ?? projectPath,
|
|
118
|
+
});
|
|
119
|
+
const tag = resolved.tag;
|
|
151
120
|
const excludeDiffers = !sameExcludeList(readExcludeRecord(targetDir), this.sortedExclude());
|
|
152
|
-
|
|
153
|
-
|
|
121
|
+
// A local archive always stages: the same 'local' marker can name different archives.
|
|
122
|
+
if (resolved.kind === 'remote' && previousVersion === tag && !excludeDiffers) {
|
|
123
|
+
return { success: true, previousVersion, newVersion: tag, method: 'tarball' };
|
|
154
124
|
}
|
|
155
125
|
// Same version but a different exclude list: re-extract the same tag.
|
|
156
|
-
const excludeChanged = previousVersion ===
|
|
157
|
-
const unmatched = await this.
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
126
|
+
const excludeChanged = previousVersion === tag && excludeDiffers;
|
|
127
|
+
const unmatched = await this.stage(resolved, targetDir);
|
|
128
|
+
const { outcome, preview } = await this.reviewStaged(targetDir, options.confirm, { from: previousVersion, to: tag });
|
|
129
|
+
// Nothing is swapped or committed for either of these; the guide is untouched.
|
|
130
|
+
if (outcome === 'unchanged') {
|
|
131
|
+
return { success: true, previousVersion, newVersion: previousVersion, method: 'tarball', unchanged: true, preview };
|
|
132
|
+
}
|
|
133
|
+
if (outcome === 'cancelled') {
|
|
134
|
+
return { success: false, previousVersion, newVersion: previousVersion, method: 'tarball', cancelled: true, preview };
|
|
135
|
+
}
|
|
136
|
+
swapIntoPlace(targetDir);
|
|
137
|
+
// A changed guide.exclude lives in .context-forge.toml; commit it with the
|
|
138
|
+
// re-extract it caused, when that file holds no other uncommitted edits.
|
|
139
|
+
const configDecision = excludeDiffers ? await decideConfigCommit(projectPath) : { add: false };
|
|
140
|
+
const committed = await commitPathIfChanged(projectPath, configDecision.add ? [GUIDE_RELATIVE_PATH, configDecision.relativePath] : GUIDE_RELATIVE_PATH, excludeChanged
|
|
141
|
+
? `docs: re-extract ai-project-guide ${tag} (guide.exclude changed)`
|
|
142
|
+
: `docs: update ai-project-guide ${tag}`);
|
|
161
143
|
return {
|
|
162
144
|
success: true,
|
|
163
145
|
previousVersion,
|
|
164
|
-
newVersion:
|
|
146
|
+
newVersion: tag,
|
|
165
147
|
method: 'tarball',
|
|
166
148
|
committed,
|
|
149
|
+
preview,
|
|
150
|
+
...(excludeDiffers ? { configCommitted: configDecision.add && committed } : {}),
|
|
151
|
+
...(!configDecision.add && configDecision.notice ? { configNotice: configDecision.notice } : {}),
|
|
167
152
|
...this.excludeFields(unmatched),
|
|
168
153
|
...(excludeChanged ? { excludeChanged: true } : {}),
|
|
169
154
|
};
|
|
@@ -178,135 +163,101 @@ export class TarballStrategy {
|
|
|
178
163
|
...(unmatched.length > 0 ? { unmatchedExclude: unmatched } : {}),
|
|
179
164
|
};
|
|
180
165
|
}
|
|
166
|
+
/** Stage the new guide, then swap it into place (install: nothing to preview). */
|
|
167
|
+
async extractAndSwap(resolved, targetDir) {
|
|
168
|
+
const unmatched = await this.stage(resolved, targetDir);
|
|
169
|
+
swapIntoPlace(targetDir);
|
|
170
|
+
return unmatched;
|
|
171
|
+
}
|
|
181
172
|
/**
|
|
182
|
-
* Build the new guide in a staging directory
|
|
183
|
-
*
|
|
184
|
-
* existing guide untouched
|
|
185
|
-
*
|
|
173
|
+
* Build the new guide in a staging directory. Any failure (network, rate
|
|
174
|
+
* limit, broken archive) removes the staging directory and leaves the
|
|
175
|
+
* existing guide untouched. Returns the guide.exclude patterns that
|
|
176
|
+
* matched no archive entry.
|
|
186
177
|
*/
|
|
187
|
-
async
|
|
188
|
-
const staging =
|
|
189
|
-
|
|
190
|
-
// Leftovers from an earlier crash
|
|
191
|
-
rmSync(staging, { recursive: true, force: true });
|
|
192
|
-
rmSync(previous, { recursive: true, force: true });
|
|
178
|
+
async stage(resolved, targetDir) {
|
|
179
|
+
const staging = stagingPathFor(targetDir);
|
|
180
|
+
clearLeftovers(targetDir);
|
|
193
181
|
const matched = new Set();
|
|
194
182
|
try {
|
|
195
|
-
await this.
|
|
183
|
+
await this.openAndExtract(resolved, staging, (entryPath) => {
|
|
196
184
|
const decision = decideTarballEntry(entryPath, this.exclude);
|
|
197
185
|
for (const pattern of decision.matchedExclude)
|
|
198
186
|
matched.add(pattern);
|
|
199
187
|
return !decision.skip;
|
|
200
188
|
});
|
|
201
|
-
writeFileSync(join(staging, VERSION_MARKER_FILE), tag, 'utf-8');
|
|
189
|
+
writeFileSync(join(staging, VERSION_MARKER_FILE), resolved.tag, 'utf-8');
|
|
202
190
|
if (this.exclude.length > 0) {
|
|
203
191
|
writeFileSync(join(staging, EXCLUDE_RECORD_FILE), this.sortedExclude().join('\n') + '\n', 'utf-8');
|
|
204
192
|
}
|
|
205
193
|
}
|
|
206
194
|
catch (err) {
|
|
207
195
|
// Don't leave a partial staging dir in the user's repo; the guide itself is untouched.
|
|
208
|
-
|
|
196
|
+
removeStaging(targetDir);
|
|
209
197
|
throw err;
|
|
210
198
|
}
|
|
211
|
-
const hadGuide = existsSync(targetDir);
|
|
212
|
-
if (hadGuide)
|
|
213
|
-
renameSync(targetDir, previous);
|
|
214
|
-
try {
|
|
215
|
-
renameSync(staging, targetDir);
|
|
216
|
-
}
|
|
217
|
-
catch (err) {
|
|
218
|
-
if (hadGuide)
|
|
219
|
-
this.restorePrevious(previous, targetDir, err);
|
|
220
|
-
throw err;
|
|
221
|
-
}
|
|
222
|
-
rmSync(previous, { recursive: true, force: true });
|
|
223
199
|
return this.exclude.filter((pattern) => !matched.has(pattern));
|
|
224
200
|
}
|
|
225
201
|
/**
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
202
|
+
* Diff the staged guide against the installed one and decide whether to
|
|
203
|
+
* swap. The staging directory is removed on every path except `proceed`,
|
|
204
|
+
* including when the diff or the confirm callback throws.
|
|
229
205
|
*/
|
|
230
|
-
|
|
206
|
+
async reviewStaged(targetDir, confirm, versions) {
|
|
207
|
+
let proceed = false;
|
|
231
208
|
try {
|
|
232
|
-
|
|
209
|
+
const preview = await diffGuideTrees(targetDir, stagingPathFor(targetDir));
|
|
210
|
+
if (preview.added + preview.removed + preview.changed === 0) {
|
|
211
|
+
// Identical files. Only a true no-op when cf's own bookkeeping matches
|
|
212
|
+
// too; otherwise swap (no prompt: nothing visible changes) so the
|
|
213
|
+
// marker and exclude record do not go stale.
|
|
214
|
+
if (bookkeepingMatches(targetDir, stagingPathFor(targetDir)))
|
|
215
|
+
return { outcome: 'unchanged', preview };
|
|
216
|
+
proceed = true;
|
|
217
|
+
return { outcome: 'proceed', preview };
|
|
218
|
+
}
|
|
219
|
+
if (confirm && !(await confirm(preview, versions)))
|
|
220
|
+
return { outcome: 'cancelled', preview };
|
|
221
|
+
proceed = true;
|
|
222
|
+
return { outcome: 'proceed', preview };
|
|
233
223
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
`The previous guide is at ${previous}; move it back to ${targetDir} by hand.`, { cause: swapError });
|
|
224
|
+
finally {
|
|
225
|
+
if (!proceed)
|
|
226
|
+
removeStaging(targetDir);
|
|
238
227
|
}
|
|
239
228
|
}
|
|
240
229
|
/**
|
|
241
|
-
*
|
|
242
|
-
*
|
|
230
|
+
* Open the resolved archive (remote tag or local file) and extract it into
|
|
231
|
+
* extractDir. A gunzip, tar or read error names the archive. An archive with
|
|
232
|
+
* more than one top-level directory is refused: the extract strips exactly
|
|
233
|
+
* one level, so a second root would land its files loose in the guide.
|
|
243
234
|
*/
|
|
244
|
-
async
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}
|
|
253
|
-
if (tags.length === 0)
|
|
254
|
-
return null;
|
|
255
|
-
// Sort descending
|
|
256
|
-
tags.sort((a, b) => {
|
|
257
|
-
const pa = a.replace(/^v/, '').split('.').map(Number);
|
|
258
|
-
const pb = b.replace(/^v/, '').split('.').map(Number);
|
|
259
|
-
for (let i = 0; i < 3; i++) {
|
|
260
|
-
if (pa[i] !== pb[i])
|
|
261
|
-
return pb[i] - pa[i];
|
|
262
|
-
}
|
|
263
|
-
return 0;
|
|
264
|
-
});
|
|
265
|
-
return tags[0];
|
|
266
|
-
}
|
|
267
|
-
/** Download tarball from GitHub API and extract into extractDir */
|
|
268
|
-
async downloadAndExtract(source, tag, extractDir, filter) {
|
|
269
|
-
const { owner, repo } = parseGitHubOwnerRepo(source);
|
|
270
|
-
const url = `https://api.github.com/repos/${owner}/${repo}/tarball/${tag}`;
|
|
271
|
-
// The ls-remote half already went through git, which honors the proxy
|
|
272
|
-
// variables itself; a failure here is therefore the download specifically.
|
|
273
|
-
const proxyVars = activeProxyEnvVars();
|
|
274
|
-
const via = proxyVars.length > 0 ? ` via proxy (${proxyVars.join(', ')})` : '';
|
|
275
|
-
const failurePrefix = `Downloading guide tarball from ${url}${via} failed`;
|
|
276
|
-
// Closed in finally: an open keep-alive socket would otherwise hold the
|
|
277
|
-
// CLI process alive until the agent's idle timeout.
|
|
278
|
-
const dispatcher = new EnvHttpProxyAgent();
|
|
235
|
+
async openAndExtract(resolved, extractDir, filter) {
|
|
236
|
+
const archive = await openArchive(resolved);
|
|
237
|
+
const roots = new Set();
|
|
238
|
+
const rootGuardedFilter = (entryPath) => {
|
|
239
|
+
const root = entryPath.replace(/^\.\//, '').split('/')[0];
|
|
240
|
+
if (root !== '')
|
|
241
|
+
roots.add(root);
|
|
242
|
+
return roots.size <= 1 && filter(entryPath);
|
|
243
|
+
};
|
|
279
244
|
try {
|
|
280
|
-
|
|
245
|
+
mkdirSync(extractDir, { recursive: true });
|
|
246
|
+
// GitHub tarballs have a top-level directory like {owner}-{repo}-{hash}/
|
|
247
|
+
// We strip 1 level and extract directly into extractDir
|
|
281
248
|
try {
|
|
282
|
-
|
|
283
|
-
headers: { Accept: 'application/vnd.github+json' },
|
|
284
|
-
redirect: 'follow',
|
|
285
|
-
dispatcher,
|
|
286
|
-
});
|
|
249
|
+
await pipeline(archive.stream, createGunzip(), extract({ cwd: extractDir, strip: 1, filter: rootGuardedFilter }));
|
|
287
250
|
}
|
|
288
251
|
catch (err) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
const cause = err instanceof Error && err.cause instanceof Error ? err.cause.message : undefined;
|
|
292
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
293
|
-
throw new Error(withNetworkErrorHint(`${failurePrefix}: ${cause ? `${message}: ${cause}` : message}`));
|
|
252
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
253
|
+
throw new Error(`Reading guide archive ${archive.label} failed: ${reason}`, { cause: err });
|
|
294
254
|
}
|
|
295
|
-
if (
|
|
296
|
-
|
|
297
|
-
throw new Error(rateLimit ?? `${failurePrefix}: HTTP ${response.status} ${response.statusText}`);
|
|
255
|
+
if (roots.size > 1) {
|
|
256
|
+
throw new Error(`Archive must contain a single top-level directory (${archive.label})`);
|
|
298
257
|
}
|
|
299
|
-
if (!response.body) {
|
|
300
|
-
throw new Error(`${failurePrefix}: empty response body`);
|
|
301
|
-
}
|
|
302
|
-
mkdirSync(extractDir, { recursive: true });
|
|
303
|
-
// GitHub tarballs have a top-level directory like {owner}-{repo}-{hash}/
|
|
304
|
-
// We strip 1 level and extract directly into extractDir
|
|
305
|
-
const nodeStream = Readable.fromWeb(response.body);
|
|
306
|
-
await pipeline(nodeStream, createGunzip(), extract({ cwd: extractDir, strip: 1, filter }));
|
|
307
258
|
}
|
|
308
259
|
finally {
|
|
309
|
-
await
|
|
260
|
+
await archive.close();
|
|
310
261
|
}
|
|
311
262
|
}
|
|
312
263
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TarballStrategy.js","sourceRoot":"","sources":["../../../src/guides/strategies/TarballStrategy.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEjE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AAC,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;QAC9C,CAAC,CAAC;QAEF,IAAI,CAAC;YACH,SAAS,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAE3C,yEAAyE;YACzE,wDAAwD;YACxD,IAAI,CAAC;gBACH,MAAM,QAAQ,CACZ,OAAO,CAAC,MAAM,EACd,YAAY,EAAE,EACd,OAAO,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAClE,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChE,MAAM,IAAI,KAAK,CAAC,yBAAyB,OAAO,CAAC,KAAK,YAAY,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;YAC9F,CAAC;YACD,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,sDAAsD,OAAO,CAAC,KAAK,GAAG,CAAC,CAAC;YAC1F,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Where the new guide is built before it replaces `targetDir`. */
|
|
2
|
+
export declare function stagingPathFor(targetDir: string): string;
|
|
3
|
+
/** Remove the staging directory; safe when it does not exist. */
|
|
4
|
+
export declare function removeStaging(targetDir: string): void;
|
|
5
|
+
/** Remove staging and backup directories left behind by an earlier crash. */
|
|
6
|
+
export declare function clearLeftovers(targetDir: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Replace `targetDir` with the staged guide. A failed swap restores the
|
|
9
|
+
* previous guide and rethrows.
|
|
10
|
+
*/
|
|
11
|
+
export declare function swapIntoPlace(targetDir: string): void;
|
|
12
|
+
//# sourceMappingURL=tarballSwap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tarballSwap.d.ts","sourceRoot":"","sources":["../../../src/guides/strategies/tarballSwap.ts"],"names":[],"mappings":"AAgBA,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAErD;AAED,6EAA6E;AAC7E,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAarD"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Staging and swap helpers for the tarball strategy's replace-the-guide step.
|
|
2
|
+
import { existsSync, renameSync, rmSync } from 'fs';
|
|
3
|
+
import { basename, dirname, join } from 'path';
|
|
4
|
+
/**
|
|
5
|
+
* Suffixes for the sibling directories used next to the guide directory
|
|
6
|
+
* (e.g. project-documents/.ai-project-guide.staging). Siblings, so both
|
|
7
|
+
* renames stay on one filesystem.
|
|
8
|
+
*/
|
|
9
|
+
const STAGING_SUFFIX = '.staging';
|
|
10
|
+
const PREVIOUS_SUFFIX = '.previous';
|
|
11
|
+
function siblingPath(targetDir, suffix) {
|
|
12
|
+
return join(dirname(targetDir), `.${basename(targetDir)}${suffix}`);
|
|
13
|
+
}
|
|
14
|
+
/** Where the new guide is built before it replaces `targetDir`. */
|
|
15
|
+
export function stagingPathFor(targetDir) {
|
|
16
|
+
return siblingPath(targetDir, STAGING_SUFFIX);
|
|
17
|
+
}
|
|
18
|
+
/** Remove the staging directory; safe when it does not exist. */
|
|
19
|
+
export function removeStaging(targetDir) {
|
|
20
|
+
rmSync(stagingPathFor(targetDir), { recursive: true, force: true });
|
|
21
|
+
}
|
|
22
|
+
/** Remove staging and backup directories left behind by an earlier crash. */
|
|
23
|
+
export function clearLeftovers(targetDir) {
|
|
24
|
+
removeStaging(targetDir);
|
|
25
|
+
rmSync(siblingPath(targetDir, PREVIOUS_SUFFIX), { recursive: true, force: true });
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Replace `targetDir` with the staged guide. A failed swap restores the
|
|
29
|
+
* previous guide and rethrows.
|
|
30
|
+
*/
|
|
31
|
+
export function swapIntoPlace(targetDir) {
|
|
32
|
+
const staging = stagingPathFor(targetDir);
|
|
33
|
+
const previous = siblingPath(targetDir, PREVIOUS_SUFFIX);
|
|
34
|
+
const hadGuide = existsSync(targetDir);
|
|
35
|
+
if (hadGuide)
|
|
36
|
+
renameSync(targetDir, previous);
|
|
37
|
+
try {
|
|
38
|
+
renameSync(staging, targetDir);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
if (hadGuide)
|
|
42
|
+
restorePrevious(previous, targetDir, err);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
rmSync(previous, { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Move the previous guide back after a failed swap. If that also fails, the
|
|
49
|
+
* guide exists only at `previous`: throw an error that says where, keeping
|
|
50
|
+
* the swap failure as the cause so the root error is not lost.
|
|
51
|
+
*/
|
|
52
|
+
function restorePrevious(previous, targetDir, swapError) {
|
|
53
|
+
let restoreFailure = null;
|
|
54
|
+
try {
|
|
55
|
+
renameSync(previous, targetDir);
|
|
56
|
+
}
|
|
57
|
+
catch (restoreError) {
|
|
58
|
+
restoreFailure = { reason: restoreError instanceof Error ? restoreError.message : String(restoreError) };
|
|
59
|
+
}
|
|
60
|
+
// Thrown outside the catch: the cause is the swap failure, not the restore failure.
|
|
61
|
+
if (restoreFailure) {
|
|
62
|
+
throw new Error(`Installing the new guide failed, and restoring the previous guide also failed (${restoreFailure.reason}). ` +
|
|
63
|
+
`The previous guide is at ${previous}; move it back to ${targetDir} by hand.`, { cause: swapError });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=tarballSwap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tarballSwap.js","sourceRoot":"","sources":["../../../src/guides/strategies/tarballSwap.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE/C;;;;GAIG;AACH,MAAM,cAAc,GAAG,UAAU,CAAC;AAClC,MAAM,eAAe,GAAG,WAAW,CAAC;AAEpC,SAAS,WAAW,CAAC,SAAiB,EAAE,MAAc;IACpD,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,OAAO,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AAChD,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,aAAa,CAAC,SAAiB;IAC7C,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,6EAA6E;AAC7E,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,aAAa,CAAC,SAAS,CAAC,CAAC;IACzB,MAAM,CAAC,WAAW,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACpF,CAAC;AAED;;;GAGG;AAC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 @@
|
|
|
1
|
+
import { Readable } from 'stream';
|
|
2
|
+
import { LOCAL_VERSION_MARKER } from './types.js';
|
|
3
|
+
/** Names of the proxy variables currently set, so a failure can say which applied. */
|
|
4
|
+
export declare function activeProxyEnvVars(env?: NodeJS.ProcessEnv): string[];
|
|
5
|
+
/** Minimal header access shared by undici and WHATWG Response objects. */
|
|
6
|
+
interface HeaderReader {
|
|
7
|
+
get(name: string): string | null;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* GitHub signals an exhausted rate limit with 403 (or 429) plus
|
|
11
|
+
* x-ratelimit-remaining: 0. Returns a specific message for that case, null
|
|
12
|
+
* for any other failure status.
|
|
13
|
+
*/
|
|
14
|
+
export declare function describeRateLimit(status: number, headers: HeaderReader): string | null;
|
|
15
|
+
/**
|
|
16
|
+
* Parse owner/repo from a GitHub source URL.
|
|
17
|
+
* Supports: https://github.com/{owner}/{repo}.git and https://github.com/{owner}/{repo}
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseGitHubOwnerRepo(source: string): {
|
|
20
|
+
owner: string;
|
|
21
|
+
repo: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Semver tags of the remote, newest first, via git ls-remote. Real failures
|
|
25
|
+
* (network, auth, invalid remote) propagate — only a genuinely tag-less remote
|
|
26
|
+
* yields an empty list.
|
|
27
|
+
*/
|
|
28
|
+
export declare function listRemoteTags(source: string): Promise<string[]>;
|
|
29
|
+
/** Where a guide comes from after --source and --version are resolved. */
|
|
30
|
+
export type ResolvedTarballSource = {
|
|
31
|
+
kind: 'remote';
|
|
32
|
+
source: string;
|
|
33
|
+
tag: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'local';
|
|
36
|
+
path: string;
|
|
37
|
+
tag: typeof LOCAL_VERSION_MARKER;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Absolute path when `source` names an existing file (relative paths resolve
|
|
41
|
+
* against `projectRoot`), else null. A directory is not a local archive: a
|
|
42
|
+
* submodule or clone source may legitimately be a local git directory.
|
|
43
|
+
*/
|
|
44
|
+
export declare function localSourceFile(source: string, projectRoot: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Decide whether `source` is a local archive or a remote repository, and
|
|
47
|
+
* which tag applies. A source is local when it names an existing file; a
|
|
48
|
+
* relative path resolves against `projectRoot` (callers pass the CLI's cwd or
|
|
49
|
+
* the project root). Paths outside the project root are allowed.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveTarballSource({ source, version, projectRoot, }: {
|
|
52
|
+
source: string;
|
|
53
|
+
version: string | undefined;
|
|
54
|
+
projectRoot: string;
|
|
55
|
+
}): Promise<ResolvedTarballSource>;
|
|
56
|
+
/** Raw `.tar.gz` bytes of a guide archive. `close` must be called once the stream is consumed. */
|
|
57
|
+
export interface ArchiveStream {
|
|
58
|
+
stream: Readable;
|
|
59
|
+
/** What to name in an error: the download URL, or the local file path. */
|
|
60
|
+
label: string;
|
|
61
|
+
close: () => Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
/** Open a resolved source (remote tag or local file) as a byte stream. */
|
|
64
|
+
export declare function openArchive(resolved: ResolvedTarballSource): Promise<ArchiveStream>;
|
|
65
|
+
/** Open the GitHub tarball for a tag as a byte stream. */
|
|
66
|
+
export declare function openRemoteArchive(source: string, tag: string): Promise<ArchiveStream>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=tarballSource.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tarballSource.d.ts","sourceRoot":"","sources":["../../src/guides/tarballSource.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAUlD,sFAAsF;AACtF,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,EAAE,CAEjF;AAED,0EAA0E;AAC1E,U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