@trayai/tray-sync-cli 0.0.7 → 0.0.9

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.
Files changed (96) hide show
  1. package/dist/commands/env.js +15 -8
  2. package/dist/commands/promote.js +1 -1
  3. package/dist/commands/status.js +1 -1
  4. package/dist/views/env/env.v2.js +115 -0
  5. package/dist/views/icons.js +6 -0
  6. package/dist/views/promote/promote.v2.js +46 -0
  7. package/dist/views/status/status.v2.js +58 -0
  8. package/node_modules/@colors/colors/LICENSE +26 -0
  9. package/node_modules/@colors/colors/README.md +219 -0
  10. package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
  11. package/node_modules/@colors/colors/examples/safe-string.js +80 -0
  12. package/node_modules/@colors/colors/index.d.ts +136 -0
  13. package/node_modules/@colors/colors/lib/colors.js +211 -0
  14. package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
  15. package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
  16. package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
  17. package/node_modules/@colors/colors/lib/index.js +13 -0
  18. package/node_modules/@colors/colors/lib/maps/america.js +10 -0
  19. package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
  20. package/node_modules/@colors/colors/lib/maps/random.js +11 -0
  21. package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
  22. package/node_modules/@colors/colors/lib/styles.js +95 -0
  23. package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
  24. package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
  25. package/node_modules/@colors/colors/package.json +45 -0
  26. package/node_modules/@colors/colors/safe.d.ts +48 -0
  27. package/node_modules/@colors/colors/safe.js +10 -0
  28. package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
  29. package/node_modules/ansi-regex/index.d.ts +33 -0
  30. package/node_modules/ansi-regex/index.js +14 -0
  31. package/node_modules/ansi-regex/license +9 -0
  32. package/node_modules/ansi-regex/package.json +61 -0
  33. package/node_modules/ansi-regex/readme.md +66 -0
  34. package/node_modules/ansis/LICENSE +15 -0
  35. package/node_modules/ansis/README.md +5 -0
  36. package/node_modules/ansis/index.cjs +1 -0
  37. package/node_modules/ansis/index.d.ts +1 -0
  38. package/node_modules/ansis/index.mjs +1 -0
  39. package/node_modules/ansis/package.json +19 -0
  40. package/node_modules/cli-table3/LICENSE +21 -0
  41. package/node_modules/cli-table3/README.md +236 -0
  42. package/node_modules/cli-table3/index.d.ts +96 -0
  43. package/node_modules/cli-table3/index.js +1 -0
  44. package/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +37 -0
  45. package/node_modules/cli-table3/node_modules/ansi-regex/index.js +10 -0
  46. package/node_modules/cli-table3/node_modules/ansi-regex/license +9 -0
  47. package/node_modules/cli-table3/node_modules/ansi-regex/package.json +55 -0
  48. package/node_modules/cli-table3/node_modules/ansi-regex/readme.md +78 -0
  49. package/node_modules/cli-table3/node_modules/string-width/index.d.ts +29 -0
  50. package/node_modules/cli-table3/node_modules/string-width/index.js +47 -0
  51. package/node_modules/cli-table3/node_modules/string-width/license +9 -0
  52. package/node_modules/cli-table3/node_modules/string-width/package.json +56 -0
  53. package/node_modules/cli-table3/node_modules/string-width/readme.md +50 -0
  54. package/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +17 -0
  55. package/node_modules/cli-table3/node_modules/strip-ansi/index.js +4 -0
  56. package/node_modules/cli-table3/node_modules/strip-ansi/license +9 -0
  57. package/node_modules/cli-table3/node_modules/strip-ansi/package.json +54 -0
  58. package/node_modules/cli-table3/node_modules/strip-ansi/readme.md +46 -0
  59. package/node_modules/cli-table3/package.json +100 -0
  60. package/node_modules/cli-table3/src/cell.js +409 -0
  61. package/node_modules/cli-table3/src/debug.js +28 -0
  62. package/node_modules/cli-table3/src/layout-manager.js +254 -0
  63. package/node_modules/cli-table3/src/table.js +106 -0
  64. package/node_modules/cli-table3/src/utils.js +344 -0
  65. package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  66. package/node_modules/emoji-regex/README.md +73 -0
  67. package/node_modules/emoji-regex/es2015/index.js +6 -0
  68. package/node_modules/emoji-regex/es2015/text.js +6 -0
  69. package/node_modules/emoji-regex/index.d.ts +23 -0
  70. package/node_modules/emoji-regex/index.js +6 -0
  71. package/node_modules/emoji-regex/package.json +50 -0
  72. package/node_modules/emoji-regex/text.js +6 -0
  73. package/node_modules/get-east-asian-width/index.d.ts +60 -0
  74. package/node_modules/get-east-asian-width/index.js +30 -0
  75. package/node_modules/get-east-asian-width/license +9 -0
  76. package/node_modules/get-east-asian-width/lookup-data.js +21 -0
  77. package/node_modules/get-east-asian-width/lookup.js +138 -0
  78. package/node_modules/get-east-asian-width/package.json +71 -0
  79. package/node_modules/get-east-asian-width/readme.md +65 -0
  80. package/node_modules/get-east-asian-width/utilities.js +24 -0
  81. package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  82. package/node_modules/is-fullwidth-code-point/index.js +50 -0
  83. package/node_modules/is-fullwidth-code-point/license +9 -0
  84. package/node_modules/is-fullwidth-code-point/package.json +42 -0
  85. package/node_modules/is-fullwidth-code-point/readme.md +39 -0
  86. package/node_modules/string-width/index.d.ts +39 -0
  87. package/node_modules/string-width/index.js +207 -0
  88. package/node_modules/string-width/license +9 -0
  89. package/node_modules/string-width/package.json +65 -0
  90. package/node_modules/string-width/readme.md +66 -0
  91. package/node_modules/strip-ansi/index.d.ts +15 -0
  92. package/node_modules/strip-ansi/index.js +19 -0
  93. package/node_modules/strip-ansi/license +9 -0
  94. package/node_modules/strip-ansi/package.json +59 -0
  95. package/node_modules/strip-ansi/readme.md +37 -0
  96. package/package.json +10 -2
@@ -18,9 +18,10 @@ import { OutputFormats, parseFormat } from "../lib/outputFormat.js";
18
18
  import { listWorkspaceAuthentications, matchAuthCandidates, prioritizeAuths, } from "../lib/authDiscovery.js";
19
19
  import { isFullyResolved, resolveProjectRequirements, } from "../lib/promoteTarget.js";
20
20
  import { checkProjectDrift, DriftStatuses } from "./status.js";
21
- import { printAddedEnvironment, printConnectivityCheck, printEnvAlreadyExists, printEnvNotConfigured, printEnvResolveProject, printEnvResolveProjectFullyResolved, printInvalidEnvName, printNoTargetEnvironments, printNoTokenSkippingConnectivity, printRemovedCredentials, printRemovedEnvironment, printEnvResolveProjectError, printRemovedMapping, printSourceEnvHeader, printSourceEnvLine, printTargetEnvHeader, printTargetEnvLine, printTokenNotSaved, printTrayYamlNotFound, } from "../views/env/env.js";
21
+ import { printAddedEnvironment, printConnectivityCheck, printEnvAlreadyExists, printEnvNotConfigured, printEnvResolveProject, printEnvResolveProjectFullyResolved, printInvalidEnvName, printNoTargetEnvironments, printNoTokenSkippingConnectivity, printRemovedCredentials, printRemovedEnvironment, printEnvResolveProjectError, printRemovedMapping, printSourceEnvTable, printTargetEnvHeader, printTargetEnvTable, printTokenNotSaved, printTrayYamlNotFound, } from "../views/env/env.v2.js";
22
22
  import { printEnvListJson, printEnvResolveResultJson, } from "../views/env/shared.js";
23
- import { printError, printInvalidAuthMappings, printLocalDrift, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printTargetEnvNotFound, } from "../views/promote/promote.js";
23
+ import { printError, printInvalidAuthMappings, printLocalDrift, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printTargetEnvNotFound, } from "../views/promote/promote.v2.js";
24
+ import { FAILURE_ICON, SUCCESS_ICON } from "../views/icons.js";
24
25
  const ENV_NAME_RE = /^[a-zA-Z0-9_-]+$/;
25
26
  function emptyMapping() {
26
27
  return { authentications: {}, config: {}, connectors: [], services: [] };
@@ -46,11 +47,11 @@ async function checkConnectivity(deps, region, workspaceId, tokenFlag) {
46
47
  function describeConnectivity(result) {
47
48
  switch (result.status) {
48
49
  case "ok":
49
- return "✅ connected";
50
+ return `${SUCCESS_ICON} connected`;
50
51
  case "no-token":
51
- return "no token available";
52
+ return `${FAILURE_ICON} no token available`;
52
53
  case "failed":
53
- return `❌ (${result.message})`;
54
+ return `${FAILURE_ICON} ${result.message}`;
54
55
  }
55
56
  }
56
57
  export async function runEnvAdd(deps, options) {
@@ -128,19 +129,25 @@ export async function runEnvList(deps, options) {
128
129
  });
129
130
  return 0;
130
131
  }
131
- printSourceEnvHeader(stdout);
132
132
  const sourceResult = await checkConnectivity(deps, trayYaml.region, trayYaml.workspace_id);
133
- printSourceEnvLine(stdout, describeRegion(trayYaml.region), trayYaml.workspace_id, describeConnectivity(sourceResult));
133
+ printSourceEnvTable(stdout, describeRegion(trayYaml.region), trayYaml.workspace_id, describeConnectivity(sourceResult));
134
134
  printTargetEnvHeader(stdout);
135
135
  if (names.length === 0) {
136
136
  printNoTargetEnvironments(stdout);
137
137
  return 0;
138
138
  }
139
+ const targetRows = [];
139
140
  for (const name of names) {
140
141
  const entry = environments.environments[name];
141
142
  const result = await checkConnectivity(deps, entry.region, entry.workspace_id);
142
- printTargetEnvLine(stdout, name, describeRegion(entry.region), entry.workspace_id, describeConnectivity(result));
143
+ targetRows.push({
144
+ name,
145
+ regionDescription: describeRegion(entry.region),
146
+ workspaceId: entry.workspace_id,
147
+ connectivityDescription: describeConnectivity(result),
148
+ });
143
149
  }
150
+ printTargetEnvTable(stdout, targetRows);
144
151
  return 0;
145
152
  }
146
153
  export async function runEnvRemove(deps, options) {
@@ -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 { checkProjectDrift, DriftStatuses } from "./status.js";
21
- import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, } from "../views/promote/promote.js";
21
+ import { printError, printInvalidAuthMappings, printLocalDrift, printMutuallyExclusiveResumeAndProject, printNoTargetProjectMapped, printProjectError, printProjectNoStateFile, printProjectNotPulledLocally, printPromoted, printTargetEnvNotFound, printTrayYamlNotFound, printUnresolvedRequirements, } from "../views/promote/promote.v2.js";
22
22
  import { printPromoteResultJson } from "../views/promote/shared.js";
23
23
  function findProjectDir(existingDirs, projectId) {
24
24
  return existingDirs.find((name) => name.split("--")[0] === projectId);
@@ -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,115 @@
1
+ import ansis from "ansis";
2
+ import Table from "cli-table3";
3
+ import { FAILURE_ICON, INFO_ICON, WARNING_ICON } from "../icons.js";
4
+ export function printInvalidEnvName(stderr, nameRe, name) {
5
+ stderr(`${FAILURE_ICON} Environment name must match ${nameRe}: "${name}"`);
6
+ }
7
+ export function printEnvAlreadyExists(stderr, name) {
8
+ stderr(`${FAILURE_ICON} Environment "${ansis.bold(name)}" already exists. Run \`${ansis.bold("tray env remove")}\` first to replace it.`);
9
+ }
10
+ export function printAddedEnvironment(stdout, name, regionDescription, workspaceId) {
11
+ const table = new Table({
12
+ head: ["Environment", "Region", "Workspace ID"].map((h) => ansis.bold(h)),
13
+ style: { head: [] },
14
+ });
15
+ table.push([ansis.bold(name), regionDescription, workspaceId]);
16
+ stdout(table.toString());
17
+ }
18
+ export function printTokenNotSaved(stderr, workspaceId) {
19
+ stderr(`${WARNING_ICON} ${ansis.bold("--token")} was NOT saved: credentials.json already has a token for workspace ${workspaceId}, and the existing one was kept.\n` +
20
+ ` Re-run this same \`${ansis.bold("tray env add")}\` command with ${ansis.bold("--force-token")} to replace it with the ${ansis.bold("--token")} you just provided.`);
21
+ }
22
+ export function printNoTokenSkippingConnectivity(stdout) {
23
+ stdout(`${WARNING_ICON} No token available — skipping connectivity check.`);
24
+ }
25
+ const LEADING_STATUS_MARKER_RE = /^((?:\x1b\[[0-9;]*m)*[✓✗](?:\x1b\[[0-9;]*m)*)\s*/;
26
+ export function printConnectivityCheck(stdout, description) {
27
+ const match = description.match(LEADING_STATUS_MARKER_RE);
28
+ if (match) {
29
+ stdout(`${match[1]} Connectivity check: ${description.slice(match[0].length)}`);
30
+ return;
31
+ }
32
+ stdout(`Connectivity check: ${description}`);
33
+ }
34
+ export function printTrayYamlNotFound(stderr) {
35
+ stderr(`${FAILURE_ICON} tray.yaml not found. Run \`${ansis.bold("tray init")}\` first.`);
36
+ }
37
+ function envTable() {
38
+ return new Table({
39
+ head: ["Environment", "Region", "Workspace ID", "Status"].map((h) => ansis.bold(h)),
40
+ style: { head: [] },
41
+ });
42
+ }
43
+ export function printSourceEnvTable(stdout, regionDescription, workspaceId, connectivityDescription) {
44
+ stdout(ansis.bold("SOURCE ENV"));
45
+ const table = envTable();
46
+ table.push([ansis.bold("source"), regionDescription, workspaceId, connectivityDescription]);
47
+ stdout(table.toString());
48
+ }
49
+ export function printTargetEnvHeader(stdout) {
50
+ stdout("");
51
+ stdout(ansis.bold("TARGET ENV"));
52
+ }
53
+ export function printNoTargetEnvironments(stdout) {
54
+ stdout(`${INFO_ICON} No target environments configured.`);
55
+ }
56
+ export function printTargetEnvTable(stdout, rows) {
57
+ const table = envTable();
58
+ for (const row of rows) {
59
+ table.push([ansis.bold(row.name), row.regionDescription, row.workspaceId, row.connectivityDescription]);
60
+ }
61
+ stdout(table.toString());
62
+ }
63
+ export function printEnvNotConfigured(stdout, name) {
64
+ stdout(`${INFO_ICON} Environment "${ansis.bold(name)}" is not configured. Nothing to remove.`);
65
+ }
66
+ export function printRemovedEnvironment(stdout, name) {
67
+ stdout(`${ansis.bold("Removed")} environment "${ansis.bold(name)}" from environments.json.`);
68
+ }
69
+ export function printRemovedMapping(stdout, name, dirName) {
70
+ stdout(`${ansis.bold("Removed")} "${ansis.bold(name)}" mapping from ${dirName}/mappings.json.`);
71
+ }
72
+ export function printRemovedCredentials(stdout, workspaceId) {
73
+ stdout(`${ansis.bold("Removed")} credentials for workspace ${workspaceId}.`);
74
+ }
75
+ export function printEnvResolveProjectFullyResolved(stdout, projectId, sourceProjectName) {
76
+ stdout(`${ansis.bold(`${sourceProjectName} (${projectId})`)}: fully resolved, nothing to do`);
77
+ }
78
+ export function printEnvResolveProjectError(stdout, projectId, sourceProjectName, error) {
79
+ stdout(`${ansis.bold(`${sourceProjectName} (${projectId})`)}:`);
80
+ if (error.reason === "no_target_project_mapped") {
81
+ stdout(` no target project mapped yet — see ${error.mappingsPath}`);
82
+ return;
83
+ }
84
+ if (error.reason === "project_error") {
85
+ const target = error.targetProjectId ? ` (target project ${error.targetProjectId})` : "";
86
+ stdout(` ${error.message}${target}`);
87
+ return;
88
+ }
89
+ stdout(` invalid authentication mappings:`);
90
+ for (const invalid of error.invalidAuthMappings) {
91
+ stdout(` ${invalid.authExportId}: "${invalid.value}" is not a valid target authentication id`);
92
+ }
93
+ }
94
+ export function printEnvResolveProject(stdout, project) {
95
+ stdout(`${ansis.bold(`${project.sourceProjectName} (${project.projectId})`)}:`);
96
+ for (const auth of project.autoResolvedAuthentications) {
97
+ stdout(` auto-resolved: ${auth.title} -> "${auth.chosen.name}" (id: ${auth.chosen.id}, ${auth.chosen.matchKind} match), written to mappings.json`);
98
+ }
99
+ for (const auth of project.unresolvedAuthentications) {
100
+ stdout(` unresolved: ${auth.title} (${auth.service.name} v${auth.service.version})`);
101
+ if (auth.candidates.length === 0) {
102
+ stdout(` no candidates found in the target workspace`);
103
+ }
104
+ for (const candidate of auth.candidates) {
105
+ stdout(` candidate (${candidate.matchKind}): "${candidate.name}" (id: ${candidate.id}, created ${candidate.created})`);
106
+ }
107
+ stdout(` to resolve: set mappings.json's environments.<env>.authentications["${auth.authExportId}"] to a target auth id${auth.candidates.length > 0
108
+ ? `, or re-run with ${ansis.bold("--auto-resolve")} to pick the top candidate automatically`
109
+ : ""}`);
110
+ }
111
+ if (project.hasNewConfigKeys) {
112
+ stdout(` new config keys require mapping — see mappings.json's config entry`);
113
+ }
114
+ }
115
+ //# sourceMappingURL=env.v2.js.map
@@ -0,0 +1,6 @@
1
+ import ansis from "ansis";
2
+ export const SUCCESS_ICON = ansis.bold.green("✓");
3
+ export const FAILURE_ICON = ansis.bold.red("✗");
4
+ export const WARNING_ICON = ansis.bold.hex("#D98C2B")("(!)");
5
+ export const INFO_ICON = ansis.bold.hex("#5C7A99")("(i)");
6
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1,46 @@
1
+ import ansis from "ansis";
2
+ import { FAILURE_ICON } from "../icons.js";
3
+ import { printIssueBlock } from "../shared.js";
4
+ export function printMutuallyExclusiveResumeAndProject(stderr) {
5
+ stderr("--resume and --project are mutually exclusive.");
6
+ }
7
+ export function printTrayYamlNotFound(stderr) {
8
+ stderr("tray.yaml not found. Run `tray init` first.");
9
+ }
10
+ export function printTargetEnvNotFound(stderr, envName) {
11
+ stderr(`${FAILURE_ICON} Target environment "${ansis.bold(envName)}" not found. Run \`${ansis.bold(`tray env add ${envName} ...`)}\` first.`);
12
+ }
13
+ export function printError(stderr, message) {
14
+ stderr(message);
15
+ }
16
+ export function printProjectNotPulledLocally(stderr, projectId) {
17
+ stderr(`Project ${projectId} has not been pulled locally. Run \`tray pull\` first.`);
18
+ }
19
+ export function printProjectNoStateFile(stderr, projectId) {
20
+ stderr(`Project ${projectId} has no state.json. Run \`tray pull\` first.`);
21
+ }
22
+ export function printLocalDrift(stderr, projectId, dirName, dirty) {
23
+ printIssueBlock(stderr, `Project ${projectId} (${dirName}) has local drift; refusing to promote:`, dirty.map((d) => `${d.status}\t${d.path}`), "Run `tray pull` to refresh, or resolve the drift, then retry.");
24
+ }
25
+ export function printNoTargetProjectMapped(stderr, sourceProjectName, projectId, envName, mappingsPath) {
26
+ stderr(`"${sourceProjectName}" (${projectId}) has no target project mapped for "${envName}".`);
27
+ stderr(`Fill in target_project_id in ${mappingsPath}, or re-run with --auto-create-projects.`);
28
+ }
29
+ export function printInvalidAuthMappings(stderr, projectId, sourceProjectName, invalidAuthMappings) {
30
+ printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved authentication mappings:`, invalidAuthMappings.map((invalid) => `${invalid.authExportId}: "${invalid.value}" is not a valid target authentication id`), "Fill in a real target authentication id for each entry above, then retry.");
31
+ }
32
+ export function printUnresolvedRequirements(stderr, projectId, sourceProjectName, envName, unresolved) {
33
+ const bulletLines = unresolved.unresolvedAuthentications.map((auth) => `unresolved authentication: ${auth.title} (${auth.authExportId})`);
34
+ if (unresolved.hasNewConfigKeys) {
35
+ bulletLines.push("new config keys require mapping");
36
+ }
37
+ printIssueBlock(stderr, `Project ${projectId} (${sourceProjectName}) has unresolved import requirements:`, bulletLines, `Run \`tray env resolve ${envName}\` to resolve, then retry.`);
38
+ }
39
+ export function printPromoted(stdout, projectId, sourceProjectName, envName) {
40
+ stdout(`Promoted project ${projectId} (${sourceProjectName}) to "${envName}"`);
41
+ }
42
+ export function printProjectError(stderr, projectId, sourceProjectName, message, targetProjectId) {
43
+ const target = targetProjectId ? ` -> target project ${targetProjectId}` : "";
44
+ stderr(`Project ${projectId} (${sourceProjectName})${target}: ${message}`);
45
+ }
46
+ //# sourceMappingURL=promote.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
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Original Library
4
+ - Copyright (c) Marak Squires
5
+
6
+ Additional Functionality
7
+ - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
8
+ - Copyright (c) DABH (https://github.com/DABH)
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.
@@ -0,0 +1,219 @@
1
+ # @colors/colors ("colors.js")
2
+ [![Build Status](https://github.com/DABH/colors.js/actions/workflows/ci.yml/badge.svg)](https://github.com/DABH/colors.js/actions/workflows/ci.yml)
3
+ [![version](https://img.shields.io/npm/v/@colors/colors.svg)](https://www.npmjs.org/package/@colors/colors)
4
+
5
+ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback.
6
+
7
+ ## get color and style in your node.js console
8
+
9
+ ![Demo](https://raw.githubusercontent.com/DABH/colors.js/master/screenshots/colors.png)
10
+
11
+ ## Installation
12
+
13
+ npm install @colors/colors
14
+
15
+ ## colors and styles!
16
+
17
+ ### text colors
18
+
19
+ - black
20
+ - red
21
+ - green
22
+ - yellow
23
+ - blue
24
+ - magenta
25
+ - cyan
26
+ - white
27
+ - gray
28
+ - grey
29
+
30
+ ### bright text colors
31
+
32
+ - brightRed
33
+ - brightGreen
34
+ - brightYellow
35
+ - brightBlue
36
+ - brightMagenta
37
+ - brightCyan
38
+ - brightWhite
39
+
40
+ ### background colors
41
+
42
+ - bgBlack
43
+ - bgRed
44
+ - bgGreen
45
+ - bgYellow
46
+ - bgBlue
47
+ - bgMagenta
48
+ - bgCyan
49
+ - bgWhite
50
+ - bgGray
51
+ - bgGrey
52
+
53
+ ### bright background colors
54
+
55
+ - bgBrightRed
56
+ - bgBrightGreen
57
+ - bgBrightYellow
58
+ - bgBrightBlue
59
+ - bgBrightMagenta
60
+ - bgBrightCyan
61
+ - bgBrightWhite
62
+
63
+ ### styles
64
+
65
+ - reset
66
+ - bold
67
+ - dim
68
+ - italic
69
+ - underline
70
+ - inverse
71
+ - hidden
72
+ - strikethrough
73
+
74
+ ### extras
75
+
76
+ - rainbow
77
+ - zebra
78
+ - america
79
+ - trap
80
+ - random
81
+
82
+
83
+ ## Usage
84
+
85
+ By popular demand, `@colors/colors` now ships with two types of usages!
86
+
87
+ The super nifty way
88
+
89
+ ```js
90
+ var colors = require('@colors/colors');
91
+
92
+ console.log('hello'.green); // outputs green text
93
+ console.log('i like cake and pies'.underline.red); // outputs red underlined text
94
+ console.log('inverse the color'.inverse); // inverses the color
95
+ console.log('OMG Rainbows!'.rainbow); // rainbow
96
+ console.log('Run the trap'.trap); // Drops the bass
97
+
98
+ ```
99
+
100
+ or a slightly less nifty way which doesn't extend `String.prototype`
101
+
102
+ ```js
103
+ var colors = require('@colors/colors/safe');
104
+
105
+ console.log(colors.green('hello')); // outputs green text
106
+ console.log(colors.red.underline('i like cake and pies')); // outputs red underlined text
107
+ console.log(colors.inverse('inverse the color')); // inverses the color
108
+ console.log(colors.rainbow('OMG Rainbows!')); // rainbow
109
+ console.log(colors.trap('Run the trap')); // Drops the bass
110
+
111
+ ```
112
+
113
+ I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
114
+
115
+ If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
116
+
117
+ ## Enabling/Disabling Colors
118
+
119
+ The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
120
+
121
+ ```bash
122
+ node myapp.js --no-color
123
+ node myapp.js --color=false
124
+
125
+ node myapp.js --color
126
+ node myapp.js --color=true
127
+ node myapp.js --color=always
128
+
129
+ FORCE_COLOR=1 node myapp.js
130
+ ```
131
+
132
+ Or in code:
133
+
134
+ ```javascript
135
+ var colors = require('@colors/colors');
136
+ colors.enable();
137
+ colors.disable();
138
+ ```
139
+
140
+ ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
141
+
142
+ ```js
143
+ var name = 'Beowulf';
144
+ console.log(colors.green('Hello %s'), name);
145
+ // outputs -> 'Hello Beowulf'
146
+ ```
147
+
148
+ ## Custom themes
149
+
150
+ ### Using standard API
151
+
152
+ ```js
153
+
154
+ var colors = require('@colors/colors');
155
+
156
+ colors.setTheme({
157
+ silly: 'rainbow',
158
+ input: 'grey',
159
+ verbose: 'cyan',
160
+ prompt: 'grey',
161
+ info: 'green',
162
+ data: 'grey',
163
+ help: 'cyan',
164
+ warn: 'yellow',
165
+ debug: 'blue',
166
+ error: 'red'
167
+ });
168
+
169
+ // outputs red text
170
+ console.log("this is an error".error);
171
+
172
+ // outputs yellow text
173
+ console.log("this is a warning".warn);
174
+ ```
175
+
176
+ ### Using string safe API
177
+
178
+ ```js
179
+ var colors = require('@colors/colors/safe');
180
+
181
+ // set single property
182
+ var error = colors.red;
183
+ error('this is red');
184
+
185
+ // set theme
186
+ colors.setTheme({
187
+ silly: 'rainbow',
188
+ input: 'grey',
189
+ verbose: 'cyan',
190
+ prompt: 'grey',
191
+ info: 'green',
192
+ data: 'grey',
193
+ help: 'cyan',
194
+ warn: 'yellow',
195
+ debug: 'blue',
196
+ error: 'red'
197
+ });
198
+
199
+ // outputs red text
200
+ console.log(colors.error("this is an error"));
201
+
202
+ // outputs yellow text
203
+ console.log(colors.warn("this is a warning"));
204
+
205
+ ```
206
+
207
+ ### Combining Colors
208
+
209
+ ```javascript
210
+ var colors = require('@colors/colors');
211
+
212
+ colors.setTheme({
213
+ custom: ['red', 'underline']
214
+ });
215
+
216
+ console.log('test'.custom);
217
+ ```
218
+
219
+ *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*
@@ -0,0 +1,83 @@
1
+ var colors = require('../lib/index');
2
+
3
+ console.log('First some yellow text'.yellow);
4
+
5
+ console.log('Underline that text'.yellow.underline);
6
+
7
+ console.log('Make it bold and red'.red.bold);
8
+
9
+ console.log(('Double Raindows All Day Long').rainbow);
10
+
11
+ console.log('Drop the bass'.trap);
12
+
13
+ console.log('DROP THE RAINBOW BASS'.trap.rainbow);
14
+
15
+ // styles not widely supported
16
+ console.log('Chains are also cool.'.bold.italic.underline.red);
17
+
18
+ // styles not widely supported
19
+ console.log('So '.green + 'are'.underline + ' ' + 'inverse'.inverse
20
+ + ' styles! '.yellow.bold);
21
+ console.log('Zebras are so fun!'.zebra);
22
+
23
+ //
24
+ // Remark: .strikethrough may not work with Mac OS Terminal App
25
+ //
26
+ console.log('This is ' + 'not'.strikethrough + ' fun.');
27
+
28
+ console.log('Background color attack!'.black.bgWhite);
29
+ console.log('Use random styles on everything!'.random);
30
+ console.log('America, Heck Yeah!'.america);
31
+
32
+ // eslint-disable-next-line max-len
33
+ console.log('Blindingly '.brightCyan + 'bright? '.brightRed + 'Why '.brightYellow + 'not?!'.brightGreen);
34
+
35
+ console.log('Setting themes is useful');
36
+
37
+ //
38
+ // Custom themes
39
+ //
40
+ console.log('Generic logging theme as JSON'.green.bold.underline);
41
+ // Load theme with JSON literal
42
+ colors.setTheme({
43
+ silly: 'rainbow',
44
+ input: 'grey',
45
+ verbose: 'cyan',
46
+ prompt: 'grey',
47
+ info: 'green',
48
+ data: 'grey',
49
+ help: 'cyan',
50
+ warn: 'yellow',
51
+ debug: 'blue',
52
+ error: 'red',
53
+ });
54
+
55
+ // outputs red text
56
+ console.log('this is an error'.error);
57
+
58
+ // outputs yellow text
59
+ console.log('this is a warning'.warn);
60
+
61
+ // outputs grey text
62
+ console.log('this is an input'.input);
63
+
64
+ console.log('Generic logging theme as file'.green.bold.underline);
65
+
66
+ // Load a theme from file
67
+ try {
68
+ colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));
69
+ } catch (err) {
70
+ console.log(err);
71
+ }
72
+
73
+ // outputs red text
74
+ console.log('this is an error'.error);
75
+
76
+ // outputs yellow text
77
+ console.log('this is a warning'.warn);
78
+
79
+ // outputs grey text
80
+ console.log('this is an input'.input);
81
+
82
+ // console.log("Don't summon".zalgo)
83
+