@microwiseai/snapshot 0.3.48 → 0.3.57
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/commands/access.js +1 -1
- package/dist/commands/access.js.map +1 -1
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +37 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +110 -72
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/setup.d.ts +5 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +52 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/access-sync.d.ts.map +1 -1
- package/dist/lib/access-sync.js +2 -0
- package/dist/lib/access-sync.js.map +1 -1
- package/dist/lib/config.d.ts +15 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +96 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/gitlab.js +3 -3
- package/dist/lib/gitlab.js.map +1 -1
- package/dist/lib/prerequisites.d.ts +33 -0
- package/dist/lib/prerequisites.d.ts.map +1 -0
- package/dist/lib/prerequisites.js +109 -0
- package/dist/lib/prerequisites.js.map +1 -0
- package/dist/lib/session.d.ts +6 -8
- package/dist/lib/session.d.ts.map +1 -1
- package/dist/lib/session.js +10 -12
- package/dist/lib/session.js.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/node_modules/@microwiseai/snapshot-dedup/dist/dedup.d.ts +108 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/dedup.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/dedup.js +196 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/dedup.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/index.d.ts +21 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/index.js +27 -0
- package/node_modules/@microwiseai/snapshot-dedup/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-dedup/package.json +41 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/index.d.ts +9 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/index.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/index.js +8 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/index.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/parallel-installer.d.ts +86 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/parallel-installer.d.ts.map +1 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/parallel-installer.js +159 -0
- package/node_modules/@microwiseai/snapshot-parallel/dist/parallel-installer.js.map +1 -0
- package/node_modules/@microwiseai/snapshot-parallel/package.json +41 -0
- package/package.json +7 -3
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot Deduplication Logic
|
|
3
|
+
*
|
|
4
|
+
* Detects already-installed packages and removes duplicates from install lists.
|
|
5
|
+
* Prevents redundant installs when extending snapshots (e.g., full extends minimal).
|
|
6
|
+
*
|
|
7
|
+
* Storage: ~/.config/ist-snapshot/installed-history.json
|
|
8
|
+
* Format: { "packages": { "@ist/sesh@0.3.33": { snapshot, installedAt } } }
|
|
9
|
+
*/
|
|
10
|
+
export interface InstalledPackageEntry {
|
|
11
|
+
/** Which snapshot installed this package */
|
|
12
|
+
snapshot: string;
|
|
13
|
+
/** ISO timestamp */
|
|
14
|
+
installedAt: string;
|
|
15
|
+
/** Package version */
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
export interface InstallHistory {
|
|
19
|
+
/** Map of "name@version" -> metadata */
|
|
20
|
+
packages: Record<string, InstalledPackageEntry>;
|
|
21
|
+
/** Last updated timestamp */
|
|
22
|
+
updatedAt: string;
|
|
23
|
+
}
|
|
24
|
+
export interface DedupResult {
|
|
25
|
+
/** Packages that need to be installed (not yet installed) */
|
|
26
|
+
toInstall: Record<string, string>;
|
|
27
|
+
/** Packages skipped because already installed */
|
|
28
|
+
skipped: SkippedPackage[];
|
|
29
|
+
}
|
|
30
|
+
export interface SkippedPackage {
|
|
31
|
+
name: string;
|
|
32
|
+
version: string;
|
|
33
|
+
/** The snapshot that originally installed this package */
|
|
34
|
+
installedBy: string;
|
|
35
|
+
/** When it was originally installed */
|
|
36
|
+
installedAt: string;
|
|
37
|
+
}
|
|
38
|
+
export interface DedupReport {
|
|
39
|
+
/** Total packages in the original list */
|
|
40
|
+
totalRequested: number;
|
|
41
|
+
/** Number of packages that will be installed */
|
|
42
|
+
toInstallCount: number;
|
|
43
|
+
/** Number of packages skipped (already installed) */
|
|
44
|
+
skippedCount: number;
|
|
45
|
+
/** Details of skipped packages */
|
|
46
|
+
skipped: SkippedPackage[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get the path to the install history file.
|
|
50
|
+
* Exposed for testing/override purposes.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getHistoryFilePath(): string;
|
|
53
|
+
/**
|
|
54
|
+
* Load install history from disk
|
|
55
|
+
*/
|
|
56
|
+
export declare function loadInstallHistory(historyPath?: string): InstallHistory;
|
|
57
|
+
/**
|
|
58
|
+
* Save install history to disk
|
|
59
|
+
*/
|
|
60
|
+
export declare function saveInstallHistory(history: InstallHistory, historyPath?: string): void;
|
|
61
|
+
/**
|
|
62
|
+
* Record successfully installed packages into history
|
|
63
|
+
*/
|
|
64
|
+
export declare function recordInstalledPackages(packages: Record<string, string>, snapshotName: string, historyPath?: string): void;
|
|
65
|
+
/**
|
|
66
|
+
* Record a list of installed package specs (e.g., ["@ist/sesh@0.3.33"])
|
|
67
|
+
*/
|
|
68
|
+
export declare function recordInstalledSpecs(specs: string[], snapshotName: string, historyPath?: string): void;
|
|
69
|
+
/**
|
|
70
|
+
* Check if a specific package@version is already installed
|
|
71
|
+
*/
|
|
72
|
+
export declare function isAlreadyInstalled(name: string, version: string, history?: InstallHistory): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Deduplicate a package list against previously installed packages.
|
|
75
|
+
*
|
|
76
|
+
* @param packages - Record of { name: version } to install
|
|
77
|
+
* @param history - Optional pre-loaded history (avoids re-reading from disk)
|
|
78
|
+
* @returns DedupResult with toInstall and skipped lists
|
|
79
|
+
*/
|
|
80
|
+
export declare function dedup(packages: Record<string, string>, history?: InstallHistory): DedupResult;
|
|
81
|
+
/**
|
|
82
|
+
* Deduplicate and generate a human-readable report
|
|
83
|
+
*/
|
|
84
|
+
export declare function dedupWithReport(packages: Record<string, string>, history?: InstallHistory): {
|
|
85
|
+
result: DedupResult;
|
|
86
|
+
report: DedupReport;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Deduplicate an install block (multiple installer types)
|
|
90
|
+
* Used for snapshot.install which has structure: { "skit": {...}, "npm-proxy": {...} }
|
|
91
|
+
*/
|
|
92
|
+
export declare function dedupInstallBlock(installBlock: Record<string, Record<string, string>>, history?: InstallHistory): {
|
|
93
|
+
dedupedBlock: Record<string, Record<string, string>>;
|
|
94
|
+
totalSkipped: SkippedPackage[];
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Clear all install history (useful for fresh installs or testing)
|
|
98
|
+
*/
|
|
99
|
+
export declare function clearInstallHistory(historyPath?: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* Get packages installed by a specific snapshot
|
|
102
|
+
*/
|
|
103
|
+
export declare function getPackagesBySnapshot(snapshotName: string, historyPath?: string): Record<string, string>;
|
|
104
|
+
/**
|
|
105
|
+
* Get total count of installed packages
|
|
106
|
+
*/
|
|
107
|
+
export declare function getInstalledCount(historyPath?: string): number;
|
|
108
|
+
//# sourceMappingURL=dedup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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C,CAexB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAG9D"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot Deduplication Logic
|
|
3
|
+
*
|
|
4
|
+
* Detects already-installed packages and removes duplicates from install lists.
|
|
5
|
+
* Prevents redundant installs when extending snapshots (e.g., full extends minimal).
|
|
6
|
+
*
|
|
7
|
+
* Storage: ~/.config/ist-snapshot/installed-history.json
|
|
8
|
+
* Format: { "packages": { "@ist/sesh@0.3.33": { snapshot, installedAt } } }
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
11
|
+
import { homedir } from 'os';
|
|
12
|
+
import { join } from 'path';
|
|
13
|
+
// ============================================================
|
|
14
|
+
// History File Management
|
|
15
|
+
// ============================================================
|
|
16
|
+
const HISTORY_DIR = join(homedir(), '.config', 'ist-snapshot');
|
|
17
|
+
const HISTORY_FILE = join(HISTORY_DIR, 'installed-history.json');
|
|
18
|
+
/**
|
|
19
|
+
* Get the path to the install history file.
|
|
20
|
+
* Exposed for testing/override purposes.
|
|
21
|
+
*/
|
|
22
|
+
export function getHistoryFilePath() {
|
|
23
|
+
return HISTORY_FILE;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load install history from disk
|
|
27
|
+
*/
|
|
28
|
+
export function loadInstallHistory(historyPath) {
|
|
29
|
+
const filePath = historyPath || HISTORY_FILE;
|
|
30
|
+
if (!existsSync(filePath)) {
|
|
31
|
+
return { packages: {}, updatedAt: new Date().toISOString() };
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
35
|
+
const data = JSON.parse(content);
|
|
36
|
+
// Validate structure
|
|
37
|
+
if (!data.packages || typeof data.packages !== 'object') {
|
|
38
|
+
return { packages: {}, updatedAt: new Date().toISOString() };
|
|
39
|
+
}
|
|
40
|
+
return data;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
// Corrupted file - start fresh
|
|
44
|
+
return { packages: {}, updatedAt: new Date().toISOString() };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Save install history to disk
|
|
49
|
+
*/
|
|
50
|
+
export function saveInstallHistory(history, historyPath) {
|
|
51
|
+
const filePath = historyPath || HISTORY_FILE;
|
|
52
|
+
const dir = join(filePath, '..');
|
|
53
|
+
if (!existsSync(dir)) {
|
|
54
|
+
mkdirSync(dir, { recursive: true });
|
|
55
|
+
}
|
|
56
|
+
history.updatedAt = new Date().toISOString();
|
|
57
|
+
writeFileSync(filePath, JSON.stringify(history, null, 2));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Record successfully installed packages into history
|
|
61
|
+
*/
|
|
62
|
+
export function recordInstalledPackages(packages, snapshotName, historyPath) {
|
|
63
|
+
const history = loadInstallHistory(historyPath);
|
|
64
|
+
const now = new Date().toISOString();
|
|
65
|
+
for (const [name, version] of Object.entries(packages)) {
|
|
66
|
+
const key = `${name}@${version}`;
|
|
67
|
+
history.packages[key] = {
|
|
68
|
+
snapshot: snapshotName,
|
|
69
|
+
installedAt: now,
|
|
70
|
+
version,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
saveInstallHistory(history, historyPath);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Record a list of installed package specs (e.g., ["@ist/sesh@0.3.33"])
|
|
77
|
+
*/
|
|
78
|
+
export function recordInstalledSpecs(specs, snapshotName, historyPath) {
|
|
79
|
+
const packages = {};
|
|
80
|
+
for (const spec of specs) {
|
|
81
|
+
const atIdx = spec.lastIndexOf('@');
|
|
82
|
+
if (atIdx > 0) {
|
|
83
|
+
const name = spec.substring(0, atIdx);
|
|
84
|
+
const version = spec.substring(atIdx + 1);
|
|
85
|
+
packages[name] = version;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
recordInstalledPackages(packages, snapshotName, historyPath);
|
|
89
|
+
}
|
|
90
|
+
// ============================================================
|
|
91
|
+
// Dedup Logic
|
|
92
|
+
// ============================================================
|
|
93
|
+
/**
|
|
94
|
+
* Check if a specific package@version is already installed
|
|
95
|
+
*/
|
|
96
|
+
export function isAlreadyInstalled(name, version, history) {
|
|
97
|
+
const h = history || loadInstallHistory();
|
|
98
|
+
const key = `${name}@${version}`;
|
|
99
|
+
return key in h.packages;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Deduplicate a package list against previously installed packages.
|
|
103
|
+
*
|
|
104
|
+
* @param packages - Record of { name: version } to install
|
|
105
|
+
* @param history - Optional pre-loaded history (avoids re-reading from disk)
|
|
106
|
+
* @returns DedupResult with toInstall and skipped lists
|
|
107
|
+
*/
|
|
108
|
+
export function dedup(packages, history) {
|
|
109
|
+
const h = history || loadInstallHistory();
|
|
110
|
+
const toInstall = {};
|
|
111
|
+
const skipped = [];
|
|
112
|
+
for (const [name, version] of Object.entries(packages)) {
|
|
113
|
+
const key = `${name}@${version}`;
|
|
114
|
+
const existing = h.packages[key];
|
|
115
|
+
if (existing) {
|
|
116
|
+
skipped.push({
|
|
117
|
+
name,
|
|
118
|
+
version,
|
|
119
|
+
installedBy: existing.snapshot,
|
|
120
|
+
installedAt: existing.installedAt,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
toInstall[name] = version;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
return { toInstall, skipped };
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Deduplicate and generate a human-readable report
|
|
131
|
+
*/
|
|
132
|
+
export function dedupWithReport(packages, history) {
|
|
133
|
+
const result = dedup(packages, history);
|
|
134
|
+
const totalRequested = Object.keys(packages).length;
|
|
135
|
+
const report = {
|
|
136
|
+
totalRequested,
|
|
137
|
+
toInstallCount: Object.keys(result.toInstall).length,
|
|
138
|
+
skippedCount: result.skipped.length,
|
|
139
|
+
skipped: result.skipped,
|
|
140
|
+
};
|
|
141
|
+
return { result, report };
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Deduplicate an install block (multiple installer types)
|
|
145
|
+
* Used for snapshot.install which has structure: { "skit": {...}, "npm-proxy": {...} }
|
|
146
|
+
*/
|
|
147
|
+
export function dedupInstallBlock(installBlock, history) {
|
|
148
|
+
const h = history || loadInstallHistory();
|
|
149
|
+
const dedupedBlock = {};
|
|
150
|
+
const totalSkipped = [];
|
|
151
|
+
for (const [installerName, packages] of Object.entries(installBlock)) {
|
|
152
|
+
const { toInstall, skipped } = dedup(packages, h);
|
|
153
|
+
dedupedBlock[installerName] = toInstall;
|
|
154
|
+
totalSkipped.push(...skipped);
|
|
155
|
+
}
|
|
156
|
+
return { dedupedBlock, totalSkipped };
|
|
157
|
+
}
|
|
158
|
+
// ============================================================
|
|
159
|
+
// History Utilities
|
|
160
|
+
// ============================================================
|
|
161
|
+
/**
|
|
162
|
+
* Clear all install history (useful for fresh installs or testing)
|
|
163
|
+
*/
|
|
164
|
+
export function clearInstallHistory(historyPath) {
|
|
165
|
+
const filePath = historyPath || HISTORY_FILE;
|
|
166
|
+
const emptyHistory = {
|
|
167
|
+
packages: {},
|
|
168
|
+
updatedAt: new Date().toISOString(),
|
|
169
|
+
};
|
|
170
|
+
saveInstallHistory(emptyHistory, filePath);
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get packages installed by a specific snapshot
|
|
174
|
+
*/
|
|
175
|
+
export function getPackagesBySnapshot(snapshotName, historyPath) {
|
|
176
|
+
const history = loadInstallHistory(historyPath);
|
|
177
|
+
const result = {};
|
|
178
|
+
for (const [key, entry] of Object.entries(history.packages)) {
|
|
179
|
+
if (entry.snapshot === snapshotName) {
|
|
180
|
+
const atIdx = key.lastIndexOf('@');
|
|
181
|
+
if (atIdx > 0) {
|
|
182
|
+
const name = key.substring(0, atIdx);
|
|
183
|
+
result[name] = entry.version;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Get total count of installed packages
|
|
191
|
+
*/
|
|
192
|
+
export function getInstalledCount(historyPath) {
|
|
193
|
+
const history = loadInstallHistory(historyPath);
|
|
194
|
+
return Object.keys(history.packages).length;
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=dedup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dedup.js","sourceRoot":"","sources":["../src/dedup.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiD5B,+DAA+D;AAC/D,0BAA0B;AAC1B,+DAA+D;AAE/D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;AAC/D,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,wBAAwB,CAAC,CAAC;AAEjE;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,WAAoB;IACrD,MAAM,QAAQ,GAAG,WAAW,IAAI,YAAY,CAAC;IAE7C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;IAC/D,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAChD,MAAM,IAAI,GAA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AAW,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;gBACd,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAoB;IACpD,MAAM,OAAO,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @microwiseai/snapshot-dedup
|
|
3
|
+
*
|
|
4
|
+
* Deduplication module for Snapshot CLI.
|
|
5
|
+
* Prevents redundant package installations across snapshot extends chains.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { dedup, dedupWithReport, recordInstalledPackages } from '@microwiseai/snapshot-dedup';
|
|
9
|
+
*
|
|
10
|
+
* // Before installing
|
|
11
|
+
* const { result, report } = dedupWithReport(packages);
|
|
12
|
+
* console.log(`Skipping ${report.skippedCount} already-installed packages`);
|
|
13
|
+
*
|
|
14
|
+
* // Install only result.toInstall
|
|
15
|
+
* // ...
|
|
16
|
+
*
|
|
17
|
+
* // After successful install, record them
|
|
18
|
+
* recordInstalledPackages(result.toInstall, '@ist/full');
|
|
19
|
+
*/
|
|
20
|
+
export { dedup, dedupWithReport, dedupInstallBlock, isAlreadyInstalled, loadInstallHistory, saveInstallHistory, recordInstalledPackages, recordInstalledSpecs, clearInstallHistory, getPackagesBySnapshot, getInstalledCount, getHistoryFilePath, type InstalledPackageEntry, type InstallHistory, type DedupResult, type DedupReport, type SkippedPackage, } from './dedup.js';
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAEL,KAAK,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAGlB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EAGnB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAGlB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @microwiseai/snapshot-dedup
|
|
3
|
+
*
|
|
4
|
+
* Deduplication module for Snapshot CLI.
|
|
5
|
+
* Prevents redundant package installations across snapshot extends chains.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { dedup, dedupWithReport, recordInstalledPackages } from '@microwiseai/snapshot-dedup';
|
|
9
|
+
*
|
|
10
|
+
* // Before installing
|
|
11
|
+
* const { result, report } = dedupWithReport(packages);
|
|
12
|
+
* console.log(`Skipping ${report.skippedCount} already-installed packages`);
|
|
13
|
+
*
|
|
14
|
+
* // Install only result.toInstall
|
|
15
|
+
* // ...
|
|
16
|
+
*
|
|
17
|
+
* // After successful install, record them
|
|
18
|
+
* recordInstalledPackages(result.toInstall, '@ist/full');
|
|
19
|
+
*/
|
|
20
|
+
export {
|
|
21
|
+
// Core dedup functions
|
|
22
|
+
dedup, dedupWithReport, dedupInstallBlock, isAlreadyInstalled,
|
|
23
|
+
// History management
|
|
24
|
+
loadInstallHistory, saveInstallHistory, recordInstalledPackages, recordInstalledSpecs, clearInstallHistory,
|
|
25
|
+
// Utility functions
|
|
26
|
+
getPackagesBySnapshot, getInstalledCount, getHistoryFilePath, } from './dedup.js';
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO;AACL,uBAAuB;AACvB,KAAK,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB;AAElB,qBAAqB;AACrB,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB;AAEnB,oBAAoB;AACpB,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,GAQnB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@microwiseai/snapshot-dedup",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Deduplication logic for Snapshot CLI - prevents reinstalling already-installed packages",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"test": "vitest",
|
|
18
|
+
"test:run": "vitest run",
|
|
19
|
+
"prepublishOnly": "npm run build"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"keywords": [
|
|
25
|
+
"snapshot",
|
|
26
|
+
"dedup",
|
|
27
|
+
"deduplication",
|
|
28
|
+
"install"
|
|
29
|
+
],
|
|
30
|
+
"author": "IST Team",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"dependencies": {},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^20.11.0",
|
|
35
|
+
"typescript": "^5.7.3",
|
|
36
|
+
"vitest": "^4.0.18"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @microwiseai/snapshot-parallel
|
|
3
|
+
*
|
|
4
|
+
* Parallel package installer with concurrency control.
|
|
5
|
+
* Drop-in replacement for serial install loops in @microwiseai/snapshot core.
|
|
6
|
+
*/
|
|
7
|
+
export { parallelInstall, recordToEntries, partitionEntries, } from './parallel-installer.js';
|
|
8
|
+
export type { PackageEntry, PackageInstallResult, ParallelInstallResult, ProgressEvent, InstallFn, ParallelInstallOptions, } from './parallel-installer.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,EACb,SAAS,EACT,sBAAsB,GACvB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @microwiseai/snapshot-parallel
|
|
3
|
+
*
|
|
4
|
+
* Parallel package installer with concurrency control.
|
|
5
|
+
* Drop-in replacement for serial install loops in @microwiseai/snapshot core.
|
|
6
|
+
*/
|
|
7
|
+
export { parallelInstall, recordToEntries, partitionEntries, } from './parallel-installer.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,GACjB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel Package Installer
|
|
3
|
+
*
|
|
4
|
+
* Concurrency-limited parallel execution for package installation.
|
|
5
|
+
* Replaces serial for-loops in core/install.ts with Promise-pool pattern.
|
|
6
|
+
*/
|
|
7
|
+
/** A single package to install: name + version */
|
|
8
|
+
export interface PackageEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
}
|
|
12
|
+
/** Result of installing a single package */
|
|
13
|
+
export interface PackageInstallResult {
|
|
14
|
+
name: string;
|
|
15
|
+
version: string;
|
|
16
|
+
/** "name@version" convenience string */
|
|
17
|
+
spec: string;
|
|
18
|
+
success: boolean;
|
|
19
|
+
/** Error message if failed */
|
|
20
|
+
error?: string;
|
|
21
|
+
/** Duration in ms */
|
|
22
|
+
durationMs: number;
|
|
23
|
+
}
|
|
24
|
+
/** Aggregated results from a parallel install batch */
|
|
25
|
+
export interface ParallelInstallResult {
|
|
26
|
+
installed: string[];
|
|
27
|
+
failed: string[];
|
|
28
|
+
results: PackageInstallResult[];
|
|
29
|
+
totalDurationMs: number;
|
|
30
|
+
}
|
|
31
|
+
/** Progress event emitted for each package completion */
|
|
32
|
+
export interface ProgressEvent {
|
|
33
|
+
/** 1-based index of completed package */
|
|
34
|
+
current: number;
|
|
35
|
+
/** Total number of packages */
|
|
36
|
+
total: number;
|
|
37
|
+
/** The result for the just-completed package */
|
|
38
|
+
result: PackageInstallResult;
|
|
39
|
+
}
|
|
40
|
+
/** Function that actually installs a single package. Provided by the caller. */
|
|
41
|
+
export type InstallFn = (entry: PackageEntry) => Promise<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
error?: string;
|
|
44
|
+
}>;
|
|
45
|
+
/** Options for parallel installation */
|
|
46
|
+
export interface ParallelInstallOptions {
|
|
47
|
+
/** Max concurrent installs (default: 4) */
|
|
48
|
+
concurrency?: number;
|
|
49
|
+
/** Called after each package completes */
|
|
50
|
+
onProgress?: (event: ProgressEvent) => void;
|
|
51
|
+
/** AbortSignal to cancel remaining installs */
|
|
52
|
+
signal?: AbortSignal;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Install packages in parallel with concurrency control.
|
|
56
|
+
*
|
|
57
|
+
* @param entries - List of packages to install
|
|
58
|
+
* @param installFn - Function that installs a single package (caller provides the actual logic)
|
|
59
|
+
* @param options - Concurrency, progress callback, abort signal
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* import { parallelInstall } from '@microwiseai/snapshot-parallel';
|
|
64
|
+
*
|
|
65
|
+
* const result = await parallelInstall(
|
|
66
|
+
* [{ name: '@ist/smon', version: '0.2.15' }],
|
|
67
|
+
* async (entry) => {
|
|
68
|
+
* // your install logic here
|
|
69
|
+
* return { success: true };
|
|
70
|
+
* },
|
|
71
|
+
* { concurrency: 4, onProgress: (e) => console.log(`${e.current}/${e.total}`) }
|
|
72
|
+
* );
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function parallelInstall(entries: PackageEntry[], installFn: InstallFn, options?: ParallelInstallOptions): Promise<ParallelInstallResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Convert a { name: version } record to PackageEntry[].
|
|
78
|
+
* Preserves insertion order.
|
|
79
|
+
*/
|
|
80
|
+
export declare function recordToEntries(packages: Record<string, string>): PackageEntry[];
|
|
81
|
+
/**
|
|
82
|
+
* Partition entries by a classifier function.
|
|
83
|
+
* Useful for splitting skit vs npm vs generic before parallel install.
|
|
84
|
+
*/
|
|
85
|
+
export declare function partitionEntries<K extends string>(entries: PackageEntry[], classifier: (entry: PackageEntry) => K): Record<K, PackageEntry[]>;
|
|
86
|
+
//# sourceMappingURL=parallel-installer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallel-installer.d.ts","sourceRoot":"","s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