Skip to content

Commit 85a260b

Browse files
committed
fix: resolve bugs, dead code, inconsistencies, and UX issues across commands
Bugs: - secrets/set: make `value` arg optional so stdin path is reachable - logs: fix --follow exclusive referencing nonexistent flag `fromDate` → `since` - view: guard processor progress against division by zero when totalBlocks=0 - deploy: fix typo "the they" in static help string Dead code: - deploy: remove commented-out example() line and stub isUrl "Not implemented" branch; drop stale FIXME comment - restart: remove self-aliased unused import - tags/add, tags/remove: remove unused formatSquidReference import - explorer: remove debug:true, commented-out screen options and disableMouse call, duplicate static hidden declaration - secrets/set: remove stale TODO comment - prod: remove stale TODO comment Inconsistencies: - secrets/list, secrets/set, secrets/remove: replace raw Flags.string org with SqdFlags.org - secrets/list: replace for...in with Object.entries - secrets/remove: use logSuccess instead of plain log - tags/remove: fix arg description "New tag to assign" → "Tag to remove" - list: print "No squids found" instead of silently exiting when result is empty - gateways/list: change .map() to .forEach() since return values were discarded - remove: use formatSquidReference for squid result line instead of manual string Safety / UX: - whoami: mask all but last 4 chars of token - run: pass error.message instead of Error object to this.error() - init: re-throw Dockerfile removal errors that are not ENOENT - auth: correct --key description URL to https://cloud.sqd.dev Made-with: Cursor
1 parent 8919abf commit 85a260b

18 files changed

Lines changed: 33 additions & 52 deletions

File tree

src/commands/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default class Auth extends CliCommand {
1212
static flags = {
1313
key: Flags.string({
1414
char: 'k',
15-
description: 'Cloud auth key. Log in to https://app.subsquid.io to create or update your key.',
15+
description: 'Cloud auth key. Log in to https://cloud.sqd.dev to create or update your key.',
1616
required: true,
1717
}),
1818
host: Flags.string({

src/commands/deploy.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export function resolveManifest(
5454
}
5555

5656
function example(command: string, description: string) {
57-
// return [chalk.dim(`// ${description}`), command].join('\r\n');
5857
return `${command} ${chalk.dim(`// ${description}`)}`;
5958
}
6059

@@ -77,7 +76,7 @@ export default class Deploy extends DeployCommand {
7776
),
7877
];
7978

80-
static help = 'If squid flags are not specified, the they will be retrieved from the manifest or prompted.';
79+
static help = 'If squid flags are not specified, they will be retrieved from the manifest or prompted.';
8180

8281
static args = {
8382
source: Args.directory({
@@ -171,12 +170,6 @@ export default class Deploy extends DeployCommand {
171170
},
172171
} = await this.parse(Deploy);
173172

174-
const isUrl = source.startsWith('http://') || source.startsWith('https://');
175-
if (isUrl) {
176-
this.log(`🦑 Releasing the squid from remote`);
177-
return this.error('Not implemented yet');
178-
}
179-
180173
if (interactive && hardReset) {
181174
const { confirm } = await inquirer.prompt([
182175
{
@@ -199,7 +192,6 @@ export default class Deploy extends DeployCommand {
199192
const overrides = reference || (pick(flags, 'slot', 'name', 'tag', 'org') as Partial<ParsedSquidReference>);
200193

201194
let manifest = res.manifest;
202-
// FIXME: it is not possible to override org atm
203195
if (entries(overrides).some(([k, v]) => k !== 'org' && get(manifest, k) !== v)) {
204196
// we need to do it to keep formatting the same
205197
const manifestRaw = Manifest.replace(res.manifestRaw, {});

src/commands/explorer.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class Explorer extends CliCommand {
99
static hidden = true;
1010

1111
static description = 'Open a visual explorer for the Cloud deployments';
12-
// static hidden = true;
12+
1313
static flags = {
1414
org: Flags.string({
1515
char: 'o',
@@ -27,9 +27,6 @@ export default class Explorer extends CliCommand {
2727
const screen = blessed.screen({
2828
smartCSR: true,
2929
fastCSR: true,
30-
// dockBorders: true,
31-
debug: true,
32-
// autoPadding: true,
3330
fullUnicode: true,
3431
});
3532

@@ -59,8 +56,6 @@ export default class Explorer extends CliCommand {
5956
return process.exit(0);
6057
});
6158

62-
// screen.program.disableMouse();
63-
6459
manager.focus();
6560
screen.render();
6661
}

src/commands/gateways/list.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export default class Ls extends CliCommand {
103103
},
104104
});
105105

106-
gateways.map(({ chainName, chainId, chainSS58Prefix, providers }) => {
106+
gateways.forEach(({ chainName, chainId, chainSS58Prefix, providers }) => {
107107
const row = [chainName, chalk.dim(chainId || chainSS58Prefix || '-'), providers[0].dataSourceUrl];
108108
table.push(row);
109109
});

src/commands/init.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ export default class Init extends CliCommand {
176176
/** Remove deprecated files from repositories **/
177177
try {
178178
await asyncFs.rm(path.resolve(localDir, 'Dockerfile'));
179-
} catch (e) {}
179+
} catch (e: any) {
180+
if (e.code !== 'ENOENT') throw e;
181+
}
180182

181183
const manifestPath = path.resolve(localDir, 'squid.yaml');
182184
try {

src/commands/list.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ export default class List extends CliCommand {
6666
return this.log(JSON.stringify(squids.map(formatSquidJson), null, 2));
6767
}
6868

69+
if (!squids.length) {
70+
return this.log('No squids found');
71+
}
72+
6973
if (squids.length) {
7074
CliUx.ux.table(
7175
squids,

src/commands/logs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default class Logs extends CliCommand {
8181
summary: 'Follow',
8282
required: false,
8383
default: false,
84-
exclusive: ['fromDate', 'pageSize'],
84+
exclusive: ['since', 'pageSize'],
8585
}),
8686
};
8787

src/commands/prod.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export default class Prod extends Command {
99
async run(): Promise<void> {
1010
await this.parse(Prod);
1111

12-
// TODO write description
1312
this.log(
1413
[
1514
chalk.yellow('*******************************************************'),

src/commands/remove.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import inquirer from 'inquirer';
55
import { deleteSquid } from '../api';
66
import { SqdFlags } from '../command';
77
import { DeployCommand } from '../deploy-command';
8-
import { ParsedSquidReference, printSquid } from '../utils';
8+
import { formatSquidReference, ParsedSquidReference, printSquid } from '../utils';
99

1010
import { DELETE_COLOR } from './deploy';
1111

@@ -96,7 +96,7 @@ export default class Remove extends DeployCommand {
9696
if (!deployment || !deployment.squid) return;
9797

9898
this.logDeployResult(DELETE_COLOR, `The squid ${printSquid(squid)} was successfully deleted`);
99-
this.log(`squid: ${squid.name}@${squid.slot}`);
99+
this.log(`squid: ${formatSquidReference({ name: squid.name, slot: squid.slot })}`);
100100
this.log(`deploy_id: ${deployment.id}`);
101101
this.log(`duration: ${Math.round(deployment.totalElapsedTimeMs / 1000)}s`);
102102
}

src/commands/restart.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { isNil, omitBy } from 'lodash';
44
import { restartSquid } from '../api';
55
import { SqdFlags } from '../command';
66
import { DeployCommand } from '../deploy-command';
7-
import { formatSquidReference as formatSquidReference, printSquid } from '../utils';
7+
import { printSquid } from '../utils';
88

99
import { UPDATE_COLOR } from './deploy';
1010

0 commit comments

Comments
 (0)