@trayai/tray-sync-cli 0.0.8 → 0.0.10
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/pull.js
CHANGED
|
@@ -18,7 +18,7 @@ import { resolveToken } from "../lib/tokenResolution.js";
|
|
|
18
18
|
import { isUuid } from "../lib/uuid.js";
|
|
19
19
|
import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
|
|
20
20
|
import { IncompatibleApiError } from "../api/errors.js";
|
|
21
|
-
import { printError, printPulled, printPulledUnchanged, printRemovedStaleProjectDir, printRenamedProjectDir, printSolutionDropped, printTrayYamlNotFound, printWouldPullProject, printWouldRenameProjectDir, printWouldSkipUnchangedProject, } from "../views/pull/pull.js";
|
|
21
|
+
import { printError, printPulled, printPulledUnchanged, printRemovedStaleProjectDir, printRenamedProjectDir, printSolutionDropped, printTrayYamlNotFound, printWouldPullProject, printWouldRenameProjectDir, printWouldSkipUnchangedProject, } from "../views/pull/pull.v2.js";
|
|
22
22
|
import { printPullResultJson } from "../views/pull/shared.js";
|
|
23
23
|
const ASSET_DIRS = [
|
|
24
24
|
{ field: "workflows", dirName: "workflows", fileName: "workflow.json", trayType: TrayTypes.WORKFLOW },
|
package/dist/commands/status.js
CHANGED
|
@@ -7,7 +7,7 @@ import { sha256 } from "../lib/checksum.js";
|
|
|
7
7
|
import { isUuid } from "../lib/uuid.js";
|
|
8
8
|
import { resolveContainedSafe } from "../lib/pathContainment.js";
|
|
9
9
|
import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
|
|
10
|
-
import { printStatusReports } from "../views/status/status.js";
|
|
10
|
+
import { printStatusReports } from "../views/status/status.v2.js";
|
|
11
11
|
import { printStatusReportsJson } from "../views/status/shared.js";
|
|
12
12
|
export const DriftStatuses = {
|
|
13
13
|
CLEAN: "CLEAN",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import ansis from "ansis";
|
|
2
|
+
import { FAILURE_ICON, INFO_ICON, WARNING_ICON } from "../icons.js";
|
|
3
|
+
export function printSolutionDropped(stdout, projectId) {
|
|
4
|
+
stdout(`${WARNING_ICON} project ${ansis.bold(projectId)} has a solution; solutions are not supported in v1 and were dropped from the local mirror.`);
|
|
5
|
+
}
|
|
6
|
+
export function printWouldRenameProjectDir(stdout, oldDirName, newDirName) {
|
|
7
|
+
stdout(`${INFO_ICON} Would rename project directory: ${ansis.bold(oldDirName)} -> ${ansis.bold(newDirName)}`);
|
|
8
|
+
}
|
|
9
|
+
export function printWouldSkipUnchangedProject(stdout, projectId, projectName) {
|
|
10
|
+
stdout(`${INFO_ICON} Would skip project ${ansis.bold(`${projectId} (${projectName})`)}: unchanged since last pull`);
|
|
11
|
+
}
|
|
12
|
+
export function printWouldPullProject(stdout, projectId, projectName) {
|
|
13
|
+
stdout(`${INFO_ICON} Would pull project ${ansis.bold(`${projectId} (${projectName})`)}`);
|
|
14
|
+
}
|
|
15
|
+
export function printRenamedProjectDir(stdout, oldDirName, newDirName) {
|
|
16
|
+
stdout(`${ansis.bold("Renamed")} project directory: ${ansis.bold(oldDirName)} -> ${ansis.bold(newDirName)}`);
|
|
17
|
+
}
|
|
18
|
+
export function printPulledUnchanged(stdout, projectId, projectName) {
|
|
19
|
+
stdout(`${ansis.bold("Pulled")} project ${ansis.bold(`${projectId} (${projectName})`)} — unchanged, skipped per-file work`);
|
|
20
|
+
}
|
|
21
|
+
export function printPulled(stdout, projectId, projectName) {
|
|
22
|
+
stdout(`${ansis.bold("Pulled")} project ${ansis.bold(`${projectId} (${projectName})`)}`);
|
|
23
|
+
}
|
|
24
|
+
export function printRemovedStaleProjectDir(stdout, dirName) {
|
|
25
|
+
stdout(`${ansis.bold("Removed")} stale project directory: ${ansis.bold(dirName)}`);
|
|
26
|
+
}
|
|
27
|
+
export function printTrayYamlNotFound(stderr) {
|
|
28
|
+
stderr(`${FAILURE_ICON} tray.yaml not found. Run \`${ansis.bold("tray init")}\` first.`);
|
|
29
|
+
}
|
|
30
|
+
export function printError(stderr, message) {
|
|
31
|
+
stderr(`${FAILURE_ICON} ${message}`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=pull.v2.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import ansis from "ansis";
|
|
2
|
+
import Table from "cli-table3";
|
|
3
|
+
import { FAILURE_ICON, INFO_ICON, SUCCESS_ICON, WARNING_ICON } from "../icons.js";
|
|
4
|
+
export const StatusLabels = {
|
|
5
|
+
CLEAN: "CLEAN",
|
|
6
|
+
DRIFTED: "DRIFTED",
|
|
7
|
+
NEVER_PULLED: "NEVER PULLED",
|
|
8
|
+
NOT_PULLED_LOCALLY: "NOT PULLED LOCALLY",
|
|
9
|
+
};
|
|
10
|
+
function projectName(dirName, projectId) {
|
|
11
|
+
return dirName.slice(projectId.length + 2);
|
|
12
|
+
}
|
|
13
|
+
export function printStatusReports(stdout, cleanStatus, sortedReports) {
|
|
14
|
+
const table = new Table({
|
|
15
|
+
head: ["ID", "Name", "Status"].map((h) => ansis.bold(h)),
|
|
16
|
+
style: { head: [] },
|
|
17
|
+
});
|
|
18
|
+
const detailBlocks = [];
|
|
19
|
+
for (const { dirName, projectId, result } of sortedReports) {
|
|
20
|
+
if (!dirName) {
|
|
21
|
+
table.push([ansis.bold(projectId), "", `${INFO_ICON} ${StatusLabels.NOT_PULLED_LOCALLY}`]);
|
|
22
|
+
detailBlocks.push({
|
|
23
|
+
label: projectId,
|
|
24
|
+
lines: [`not pulled locally — run \`${ansis.bold("tray pull")}\` to fetch it`],
|
|
25
|
+
});
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
if (result.never_pulled) {
|
|
29
|
+
table.push([
|
|
30
|
+
ansis.bold(projectId),
|
|
31
|
+
projectName(dirName, projectId),
|
|
32
|
+
`${WARNING_ICON} ${StatusLabels.NEVER_PULLED}`,
|
|
33
|
+
]);
|
|
34
|
+
detailBlocks.push({ label: projectName(dirName, projectId), lines: ["no state.json"] });
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (result.drift.every((d) => d.status === cleanStatus)) {
|
|
38
|
+
table.push([ansis.bold(projectId), projectName(dirName, projectId), `${SUCCESS_ICON} ${StatusLabels.CLEAN}`]);
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
table.push([ansis.bold(projectId), projectName(dirName, projectId), `${FAILURE_ICON} ${StatusLabels.DRIFTED}`]);
|
|
42
|
+
detailBlocks.push({
|
|
43
|
+
label: projectName(dirName, projectId),
|
|
44
|
+
lines: result.drift
|
|
45
|
+
.filter((d) => d.status !== cleanStatus)
|
|
46
|
+
.map((d) => `${d.status}\t${d.path}`),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
stdout(table.toString());
|
|
50
|
+
for (const block of detailBlocks) {
|
|
51
|
+
stdout("");
|
|
52
|
+
stdout(`${ansis.bold(block.label)}:`);
|
|
53
|
+
for (const line of block.lines) {
|
|
54
|
+
stdout(` ${line}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=status.v2.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trayai/tray-sync-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "CLI tool to clone Tray projects and related assets to a local directory, and promote them between Tray environments",
|
|
5
5
|
"bin": {
|
|
6
6
|
"tray": "dist/cli.js"
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"test": "node --test dist-test/test/**/*.test.js",
|
|
26
26
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
27
|
"build-and-reinstall": "npm uninstall -g @trayai/tray-sync-cli --silent || true; npm run build && npm pack --silent | xargs -I{} sh -c 'npm install -g ./{} && rm ./{}'",
|
|
28
|
-
"gallery:env": "tsc -p tsconfig.test.json && node dist-test/test/manual/envOutputGallery.js"
|
|
28
|
+
"gallery:env": "tsc -p tsconfig.test.json && node dist-test/test/manual/envOutputGallery.js",
|
|
29
|
+
"gallery:status": "tsc -p tsconfig.test.json && node dist-test/test/manual/statusOutputGallery.js",
|
|
30
|
+
"gallery:pull": "tsc -p tsconfig.test.json && node dist-test/test/manual/pullOutputGallery.js"
|
|
29
31
|
},
|
|
30
32
|
"license": "Apache-2.0",
|
|
31
33
|
"dependencies": {
|