@meltstudio/meltctl 4.26.0 → 4.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/audit.d.ts +1 -0
- package/dist/commands/audit.js +42 -17
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/commands/audit.d.ts
CHANGED
package/dist/commands/audit.js
CHANGED
|
@@ -86,6 +86,8 @@ export async function auditListCommand(options) {
|
|
|
86
86
|
params.set('type', options.type);
|
|
87
87
|
if (options.repository)
|
|
88
88
|
params.set('repository', options.repository);
|
|
89
|
+
if (options.latest)
|
|
90
|
+
params.set('latest', 'true');
|
|
89
91
|
if (options.limit)
|
|
90
92
|
params.set('limit', options.limit);
|
|
91
93
|
const query = params.toString();
|
|
@@ -106,27 +108,50 @@ export async function auditListCommand(options) {
|
|
|
106
108
|
console.log(chalk.dim('\n No audits found.\n'));
|
|
107
109
|
return;
|
|
108
110
|
}
|
|
109
|
-
console.log(chalk.bold(`\n Audits (${body.count}):\n`));
|
|
110
|
-
console.log(chalk.dim(` ${'TYPE'.padEnd(12)} ${'REPOSITORY'.padEnd(40)} ${'AUTHOR'.padEnd(30)} DATE`));
|
|
111
|
-
console.log();
|
|
112
111
|
const typeLabels = {
|
|
113
112
|
audit: 'Tech Audit',
|
|
114
113
|
'ux-audit': 'UX Audit',
|
|
115
114
|
};
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
115
|
+
if (options.latest) {
|
|
116
|
+
console.log(chalk.bold(`\n Latest Audits (${body.count}):\n`));
|
|
117
|
+
console.log(chalk.dim(` ${'TYPE'.padEnd(12)} ${'REPOSITORY'.padEnd(40)} ${'AGE'.padEnd(10)} ${'AUTHOR'.padEnd(30)} DATE`));
|
|
118
|
+
console.log();
|
|
119
|
+
for (const r of body.audits) {
|
|
120
|
+
const createdAt = new Date(r.created_at ?? r.createdAt);
|
|
121
|
+
const daysAgo = Math.floor((Date.now() - createdAt.getTime()) / (1000 * 60 * 60 * 24));
|
|
122
|
+
const date = createdAt.toLocaleDateString('en-US', {
|
|
123
|
+
month: 'short',
|
|
124
|
+
day: 'numeric',
|
|
125
|
+
year: 'numeric',
|
|
126
|
+
});
|
|
127
|
+
const repo = r.repository ?? r.project;
|
|
128
|
+
const label = typeLabels[r.type] ?? r.type;
|
|
129
|
+
const typeColor = r.type === 'ux-audit' ? chalk.yellow : chalk.magenta;
|
|
130
|
+
const ageText = daysAgo === 0 ? 'today' : `${daysAgo}d ago`;
|
|
131
|
+
const ageColor = daysAgo <= 7 ? chalk.green : daysAgo <= 30 ? chalk.yellow : chalk.red;
|
|
132
|
+
console.log(` ${typeColor(label.padEnd(12))} ${chalk.white(repo.padEnd(40))} ${ageColor(ageText.padEnd(10))} ${chalk.dim(r.author.padEnd(30))} ${chalk.dim(date)}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
console.log(chalk.bold(`\n Audits (${body.count}):\n`));
|
|
137
|
+
const hdr = ` ${'TYPE'.padEnd(12)} ${'REPOSITORY'.padEnd(40)} ${'AUTHOR'.padEnd(30)} DATE`;
|
|
138
|
+
console.log(chalk.dim(hdr));
|
|
139
|
+
console.log();
|
|
140
|
+
for (const r of body.audits) {
|
|
141
|
+
const date = new Date(r.createdAt).toLocaleDateString('en-US', {
|
|
142
|
+
month: 'short',
|
|
143
|
+
day: 'numeric',
|
|
144
|
+
year: 'numeric',
|
|
145
|
+
hour: '2-digit',
|
|
146
|
+
minute: '2-digit',
|
|
147
|
+
});
|
|
148
|
+
const repo = r.repository ?? r.project;
|
|
149
|
+
const label = typeLabels[r.type] ?? r.type;
|
|
150
|
+
const typeColor = r.type === 'ux-audit' ? chalk.yellow : chalk.magenta;
|
|
151
|
+
console.log(` ${typeColor(label.padEnd(12))} ${chalk.white(repo.padEnd(40))} ${chalk.dim(r.author.padEnd(30))} ${chalk.dim(date)}`);
|
|
152
|
+
if (r.branch && r.branch !== 'main') {
|
|
153
|
+
console.log(` ${' '.padEnd(12)} ${chalk.dim(`branch: ${r.branch} commit: ${r.commit ?? 'N/A'}`)}`);
|
|
154
|
+
}
|
|
130
155
|
}
|
|
131
156
|
}
|
|
132
157
|
console.log();
|
package/dist/index.js
CHANGED
|
@@ -104,6 +104,7 @@ audit
|
|
|
104
104
|
.description('list submitted audits (Team Managers only)')
|
|
105
105
|
.option('--type <type>', 'filter by type (audit, ux-audit)')
|
|
106
106
|
.option('--repository <repo>', 'filter by repository (owner/repo)')
|
|
107
|
+
.option('--latest', 'show only the latest audit per project and type')
|
|
107
108
|
.option('--limit <n>', 'max results (default 50, max 200)')
|
|
108
109
|
.action(async (options) => {
|
|
109
110
|
await auditListCommand(options);
|
package/package.json
CHANGED