@nordsym/apiclaw 2.2.0 → 2.2.1
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/README.md +15 -2
- package/dist/bin-http.js +0 -0
- package/dist/bin.bundled.js +79288 -0
- package/dist/gateway-client.d.ts.map +1 -1
- package/dist/gateway-client.js +24 -2
- package/dist/gateway-client.js.map +1 -1
- package/dist/index.bundled.js +61263 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -2
- package/.claude/settings.local.json +0 -13
- package/.env.prod +0 -1
- package/apiclaw-README.md +0 -494
- package/convex/_generated/api.d.ts +0 -145
- package/convex/_generated/api.js +0 -23
- package/convex/_generated/dataModel.d.ts +0 -60
- package/convex/_generated/server.d.ts +0 -143
- package/convex/_generated/server.js +0 -93
- package/convex/_listWorkspaces.ts +0 -13
- package/convex/adminActivate.ts +0 -53
- package/convex/adminStats.ts +0 -306
- package/convex/agents.ts +0 -939
- package/convex/analytics.ts +0 -187
- package/convex/apiKeys.ts +0 -220
- package/convex/backfillAnalytics.ts +0 -272
- package/convex/backfillSearchLogs.ts +0 -35
- package/convex/billing.ts +0 -834
- package/convex/capabilities.ts +0 -157
- package/convex/chains.ts +0 -1318
- package/convex/credits.ts +0 -211
- package/convex/crons.ts +0 -65
- package/convex/debugFilestackLogs.ts +0 -16
- package/convex/debugGetToken.ts +0 -18
- package/convex/directCall.ts +0 -713
- package/convex/earnProgress.ts +0 -753
- package/convex/email.ts +0 -329
- package/convex/feedback.ts +0 -265
- package/convex/funnel.ts +0 -431
- package/convex/guards.ts +0 -174
- package/convex/http.ts +0 -3756
- package/convex/inbound.ts +0 -32
- package/convex/logs.ts +0 -701
- package/convex/migrateFilestack.ts +0 -81
- package/convex/migratePartnersProd.ts +0 -174
- package/convex/migratePratham.ts +0 -126
- package/convex/migrateProviderWorkspaces.ts +0 -175
- package/convex/mou.ts +0 -91
- package/convex/nurture.ts +0 -355
- package/convex/providerKeys.ts +0 -289
- package/convex/providers.ts +0 -1135
- package/convex/purchases.ts +0 -183
- package/convex/ratelimit.ts +0 -104
- package/convex/schema.ts +0 -926
- package/convex/searchLogs.ts +0 -265
- package/convex/seedAPILayerAPIs.ts +0 -191
- package/convex/seedDirectCallConfigs.ts +0 -336
- package/convex/seedPratham.ts +0 -149
- package/convex/spendAlerts.ts +0 -442
- package/convex/stripeActions.ts +0 -607
- package/convex/teams.ts +0 -243
- package/convex/telemetry.ts +0 -81
- package/convex/tsconfig.json +0 -25
- package/convex/updateAPIStatus.ts +0 -44
- package/convex/usage.ts +0 -260
- package/convex/usageReports.ts +0 -357
- package/convex/waitlist.ts +0 -55
- package/convex/webhooks.ts +0 -494
- package/convex/workspaceSettings.ts +0 -143
- package/convex/workspaces.ts +0 -1331
- package/convex.json +0 -3
- package/direct-test.mjs +0 -51
- package/email-templates/filestack-provider-outreach.html +0 -162
- package/email-templates/partnership-template.html +0 -116
- package/email-templates/pratham-draft-preview.txt +0 -57
- package/email-templates/pratham-partnership-draft.html +0 -141
- package/reports/APIClaw-Session-Report-2026-04-05.pdf +0 -0
- package/reports/pipeline/PIPELINE-REPORT.json +0 -153
- package/reports/pipeline/acquire_apisguru.json +0 -17
- package/reports/pipeline/capabilities.json +0 -38
- package/reports/pipeline/discover_azure_recursive.json +0 -1551
- package/reports/pipeline/discover_github.json +0 -25
- package/reports/pipeline/discover_github_repos.json +0 -49
- package/reports/pipeline/discover_swaggerhub.json +0 -24
- package/reports/pipeline/discover_well_known.json +0 -23
- package/reports/pipeline/fetch_specs.json +0 -19
- package/reports/pipeline/generate_providers.json +0 -14
- package/reports/pipeline/match_registry.json +0 -11
- package/reports/pipeline/parse_specs.json +0 -17
- package/reports/pipeline/promote_candidates.json +0 -34
- package/reports/pipeline/validate.json +0 -30
- package/reports/pipeline/validate_smoke_details.json +0 -3835
- package/reports/session-report-2026-04-05.html +0 -433
- package/seed-apis-direct.mjs +0 -106
- package/src/access-control.ts +0 -174
- package/src/adapters/base.ts +0 -364
- package/src/adapters/claude-desktop.ts +0 -41
- package/src/adapters/cline.ts +0 -88
- package/src/adapters/continue.ts +0 -91
- package/src/adapters/cursor.ts +0 -43
- package/src/adapters/custom.ts +0 -188
- package/src/adapters/detect.ts +0 -202
- package/src/adapters/index.ts +0 -47
- package/src/adapters/windsurf.ts +0 -44
- package/src/bin-http.ts +0 -45
- package/src/bin.ts +0 -34
- package/src/capability-router.ts +0 -331
- package/src/chainExecutor.ts +0 -730
- package/src/chainResolver.test.ts +0 -246
- package/src/chainResolver.ts +0 -658
- package/src/cli/commands/demo.ts +0 -109
- package/src/cli/commands/doctor.ts +0 -435
- package/src/cli/commands/index.ts +0 -9
- package/src/cli/commands/login.ts +0 -203
- package/src/cli/commands/mcp-install.ts +0 -373
- package/src/cli/commands/restore.ts +0 -333
- package/src/cli/commands/setup.ts +0 -297
- package/src/cli/commands/uninstall.ts +0 -240
- package/src/cli/index.ts +0 -148
- package/src/cli.ts +0 -370
- package/src/confirmation.ts +0 -296
- package/src/credentials.ts +0 -455
- package/src/credits.ts +0 -329
- package/src/crypto.ts +0 -75
- package/src/discovery.ts +0 -568
- package/src/enterprise/env.ts +0 -156
- package/src/enterprise/index.ts +0 -7
- package/src/enterprise/script-generator.ts +0 -481
- package/src/execute-dynamic.ts +0 -617
- package/src/execute.ts +0 -2386
- package/src/funnel-client.ts +0 -168
- package/src/funnel.test.ts +0 -187
- package/src/gateway-client.ts +0 -192
- package/src/hivr-whitelist.ts +0 -110
- package/src/http-api.ts +0 -286
- package/src/http-server-minimal.ts +0 -154
- package/src/index.ts +0 -2702
- package/src/intelligent-gateway.ts +0 -339
- package/src/mcp-analytics.ts +0 -156
- package/src/metered.ts +0 -149
- package/src/open-apis-generated.ts +0 -157
- package/src/open-apis.ts +0 -558
- package/src/postinstall.ts +0 -40
- package/src/product-whitelist.ts +0 -246
- package/src/proxy.ts +0 -36
- package/src/registration-guard.ts +0 -117
- package/src/session.ts +0 -129
- package/src/stripe.ts +0 -497
- package/src/telemetry.ts +0 -71
- package/src/test.ts +0 -135
- package/src/types/convex-api.d.ts +0 -20
- package/src/types/convex-api.ts +0 -21
- package/src/types.ts +0 -109
- package/src/ui/colors.ts +0 -219
- package/src/ui/errors.ts +0 -394
- package/src/ui/index.ts +0 -17
- package/src/ui/prompts.ts +0 -390
- package/src/ui/spinner.ts +0 -325
- package/src/utils/backup.ts +0 -224
- package/src/utils/config.ts +0 -318
- package/src/utils/os.ts +0 -124
- package/src/utils/paths.ts +0 -203
- package/src/webhook.ts +0 -107
- package/test-10-working.cjs +0 -97
- package/test-14-final.cjs +0 -96
- package/test-actual-handlers.ts +0 -92
- package/test-apilayer-all-14.ts +0 -249
- package/test-apilayer-fixed.ts +0 -248
- package/test-direct-endpoints.ts +0 -174
- package/test-exact-endpoints.ts +0 -144
- package/test-final.ts +0 -83
- package/test-full-routing.ts +0 -100
- package/test-handlers-correct.ts +0 -217
- package/test-numverify-key.ts +0 -41
- package/test-via-handlers.ts +0 -92
- package/test-worldnews.mjs +0 -26
- package/tsconfig.json +0 -20
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type shim for Convex generated API.
|
|
3
|
-
*
|
|
4
|
-
* Replaces the direct import from `../convex/_generated/api.js` which
|
|
5
|
-
* caused TypeScript to transitively process all convex/*.ts source files
|
|
6
|
-
* under the main tsconfig (NodeNext strict), producing hundreds of
|
|
7
|
-
* irrelevant errors. The convex/ directory has its own tsconfig
|
|
8
|
-
* (Bundler moduleResolution) and is compiled separately via `npx convex deploy`.
|
|
9
|
-
*
|
|
10
|
-
* If you add new api.X.Y usages in the codebase, add the shape here.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
declare const api: {
|
|
14
|
-
analytics: {
|
|
15
|
-
log: any;
|
|
16
|
-
};
|
|
17
|
-
[key: string]: any; // forward-compatible: won't break on new api.* usage
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { api };
|
package/src/types/convex-api.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime shim for Convex API references.
|
|
3
|
-
* Provides the `api` object with the correct path structure
|
|
4
|
-
* for use with ConvexHttpClient without importing generated code.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export const api: any = new Proxy(
|
|
8
|
-
{},
|
|
9
|
-
{
|
|
10
|
-
get(_, module: string) {
|
|
11
|
-
return new Proxy(
|
|
12
|
-
{},
|
|
13
|
-
{
|
|
14
|
-
get(_, fn: string) {
|
|
15
|
-
return `${module}:${fn}`;
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
);
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
);
|
package/src/types.ts
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
// Core types for APIvault
|
|
2
|
-
|
|
3
|
-
export interface APIProvider {
|
|
4
|
-
id: string;
|
|
5
|
-
name: string;
|
|
6
|
-
description: string;
|
|
7
|
-
category: string;
|
|
8
|
-
capabilities: string[];
|
|
9
|
-
keywords: string[];
|
|
10
|
-
pricing: APIPricing;
|
|
11
|
-
auth_type: string; // api_key, basic, oauth, bearer
|
|
12
|
-
docs_url: string;
|
|
13
|
-
base_url: string;
|
|
14
|
-
endpoints: APIEndpoint[];
|
|
15
|
-
features: string[];
|
|
16
|
-
compliance: string[];
|
|
17
|
-
regions: string[];
|
|
18
|
-
agent_success_rate: number;
|
|
19
|
-
avg_latency_ms: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface APIPricing {
|
|
23
|
-
model: string; // per_unit, per_query, per_token, per_character, subscription
|
|
24
|
-
free_tier: boolean;
|
|
25
|
-
minimum_purchase: number | null;
|
|
26
|
-
[key: string]: string | number | boolean | null | undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface APIEndpoint {
|
|
30
|
-
name: string;
|
|
31
|
-
method: string;
|
|
32
|
-
path: string;
|
|
33
|
-
params: string[];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface SearchResult {
|
|
37
|
-
provider: APIProvider;
|
|
38
|
-
relevance_score: number;
|
|
39
|
-
match_reasons: string[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface AgentCredits {
|
|
43
|
-
agent_id: string;
|
|
44
|
-
balance_usd: number;
|
|
45
|
-
currency: string;
|
|
46
|
-
created_at: string;
|
|
47
|
-
updated_at: string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface Purchase {
|
|
51
|
-
id: string;
|
|
52
|
-
agent_id: string;
|
|
53
|
-
provider_id: string;
|
|
54
|
-
amount_usd: number;
|
|
55
|
-
credits_purchased: number;
|
|
56
|
-
status: 'pending' | 'active' | 'exhausted' | 'refunded';
|
|
57
|
-
credentials?: APICredentials;
|
|
58
|
-
created_at: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface APICredentials {
|
|
62
|
-
type: string; // api_key, basic, bearer
|
|
63
|
-
api_key?: string;
|
|
64
|
-
username?: string;
|
|
65
|
-
password?: string;
|
|
66
|
-
token?: string;
|
|
67
|
-
expires_at?: string;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface UsageRecord {
|
|
71
|
-
purchase_id: string;
|
|
72
|
-
provider_id: string;
|
|
73
|
-
units_used: number;
|
|
74
|
-
units_remaining: number;
|
|
75
|
-
cost_incurred_usd: number;
|
|
76
|
-
last_used_at: string;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Enhanced API details response
|
|
81
|
-
* Supports both full and compact (minified) modes
|
|
82
|
-
*/
|
|
83
|
-
export interface APIDetailsResponse {
|
|
84
|
-
id: string;
|
|
85
|
-
type: 'direct_call' | 'open' | 'registry';
|
|
86
|
-
|
|
87
|
-
// Full mode fields
|
|
88
|
-
name?: string;
|
|
89
|
-
description?: string;
|
|
90
|
-
category?: string;
|
|
91
|
-
auth_type?: string;
|
|
92
|
-
base_url?: string;
|
|
93
|
-
docs_url?: string;
|
|
94
|
-
pricing?: APIPricing | string;
|
|
95
|
-
direct_call?: boolean;
|
|
96
|
-
free?: boolean;
|
|
97
|
-
note?: string;
|
|
98
|
-
|
|
99
|
-
// Compact mode fields
|
|
100
|
-
desc?: string;
|
|
101
|
-
auth?: string;
|
|
102
|
-
url?: string;
|
|
103
|
-
|
|
104
|
-
// Actions (for direct_call and open types)
|
|
105
|
-
actions?: Record<string, {
|
|
106
|
-
description?: string;
|
|
107
|
-
params: { name: string; required: boolean; desc: string }[] | string[];
|
|
108
|
-
}>;
|
|
109
|
-
}
|
package/src/ui/colors.ts
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* APIClaw MCP Auto-Setup - Color Utilities
|
|
3
|
-
*
|
|
4
|
-
* Chalk-based color helpers for consistent terminal output.
|
|
5
|
-
* Supports color detection and graceful fallback.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import chalk from 'chalk';
|
|
9
|
-
|
|
10
|
-
// Re-export chalk for direct access
|
|
11
|
-
export { chalk };
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Semantic colors for APIClaw CLI output
|
|
15
|
-
*/
|
|
16
|
-
export const colors = {
|
|
17
|
-
// Status colors
|
|
18
|
-
success: chalk.green,
|
|
19
|
-
error: chalk.red,
|
|
20
|
-
warning: chalk.yellow,
|
|
21
|
-
info: chalk.blue,
|
|
22
|
-
|
|
23
|
-
// Emphasis
|
|
24
|
-
primary: chalk.cyan,
|
|
25
|
-
secondary: chalk.gray,
|
|
26
|
-
muted: chalk.dim,
|
|
27
|
-
highlight: chalk.bold,
|
|
28
|
-
|
|
29
|
-
// Branded
|
|
30
|
-
brand: chalk.hex('#6366F1'), // APIClaw purple
|
|
31
|
-
|
|
32
|
-
// Semantic actions
|
|
33
|
-
action: chalk.cyan.bold,
|
|
34
|
-
code: chalk.gray.italic,
|
|
35
|
-
path: chalk.underline,
|
|
36
|
-
link: chalk.blue.underline,
|
|
37
|
-
|
|
38
|
-
// Labels
|
|
39
|
-
label: chalk.white.bold,
|
|
40
|
-
value: chalk.white,
|
|
41
|
-
} as const;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Icons for visual feedback
|
|
45
|
-
*/
|
|
46
|
-
export const icons = {
|
|
47
|
-
// Status icons
|
|
48
|
-
success: chalk.green('✓'),
|
|
49
|
-
error: chalk.red('✗'),
|
|
50
|
-
warning: chalk.yellow('⚠'),
|
|
51
|
-
info: chalk.blue('ℹ'),
|
|
52
|
-
|
|
53
|
-
// Progress icons
|
|
54
|
-
pending: chalk.gray('○'),
|
|
55
|
-
active: chalk.cyan('●'),
|
|
56
|
-
|
|
57
|
-
// Actions
|
|
58
|
-
arrow: chalk.cyan('→'),
|
|
59
|
-
bullet: chalk.gray('•'),
|
|
60
|
-
plus: chalk.green('+'),
|
|
61
|
-
minus: chalk.red('-'),
|
|
62
|
-
|
|
63
|
-
// Objects
|
|
64
|
-
folder: '📁',
|
|
65
|
-
file: '📄',
|
|
66
|
-
config: '⚙️',
|
|
67
|
-
search: '🔍',
|
|
68
|
-
rocket: '🚀',
|
|
69
|
-
shield: '🛡️',
|
|
70
|
-
key: '🔑',
|
|
71
|
-
check: '✅',
|
|
72
|
-
cross: '❌',
|
|
73
|
-
wrench: '🔧',
|
|
74
|
-
package: '📦',
|
|
75
|
-
} as const;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Format a header with brand styling
|
|
79
|
-
*/
|
|
80
|
-
export function header(text: string): string {
|
|
81
|
-
return chalk.bold.cyan(`\n${text}\n${'═'.repeat(text.length)}\n`);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Format a section title
|
|
86
|
-
*/
|
|
87
|
-
export function section(text: string): string {
|
|
88
|
-
return chalk.bold.white(`\n${text}\n${'-'.repeat(text.length)}`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Format a key-value pair for display
|
|
93
|
-
*/
|
|
94
|
-
export function keyValue(key: string, value: string, indent = 0): string {
|
|
95
|
-
const padding = ' '.repeat(indent);
|
|
96
|
-
return `${padding}${colors.label(key)}: ${colors.value(value)}`;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Format a status line with icon
|
|
101
|
-
*/
|
|
102
|
-
export function status(
|
|
103
|
-
state: 'success' | 'error' | 'warning' | 'info' | 'pending',
|
|
104
|
-
message: string
|
|
105
|
-
): string {
|
|
106
|
-
const iconMap = {
|
|
107
|
-
success: icons.success,
|
|
108
|
-
error: icons.error,
|
|
109
|
-
warning: icons.warning,
|
|
110
|
-
info: icons.info,
|
|
111
|
-
pending: icons.pending,
|
|
112
|
-
};
|
|
113
|
-
return `${iconMap[state]} ${message}`;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Format a diff-style addition
|
|
118
|
-
*/
|
|
119
|
-
export function added(text: string): string {
|
|
120
|
-
return chalk.green(`+ ${text}`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Format a diff-style removal
|
|
125
|
-
*/
|
|
126
|
-
export function removed(text: string): string {
|
|
127
|
-
return chalk.red(`- ${text}`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Format a code block
|
|
132
|
-
*/
|
|
133
|
-
export function codeBlock(code: string, indent = 2): string {
|
|
134
|
-
const padding = ' '.repeat(indent);
|
|
135
|
-
return code
|
|
136
|
-
.split('\n')
|
|
137
|
-
.map(line => `${padding}${chalk.gray(line)}`)
|
|
138
|
-
.join('\n');
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Format a command suggestion
|
|
143
|
-
*/
|
|
144
|
-
export function command(cmd: string): string {
|
|
145
|
-
return chalk.cyan.bold(` ${cmd}`);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Format a help link
|
|
150
|
-
*/
|
|
151
|
-
export function helpLink(url: string): string {
|
|
152
|
-
return chalk.blue.underline(url);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Create a boxed message
|
|
157
|
-
*/
|
|
158
|
-
export function box(
|
|
159
|
-
content: string,
|
|
160
|
-
options: { title?: string; padding?: number; borderColor?: typeof chalk } = {}
|
|
161
|
-
): string {
|
|
162
|
-
const { title, padding = 1, borderColor = chalk.gray } = options;
|
|
163
|
-
const lines = content.split('\n');
|
|
164
|
-
const maxWidth = Math.max(...lines.map(l => stripAnsi(l).length), title?.length || 0);
|
|
165
|
-
const width = maxWidth + padding * 2;
|
|
166
|
-
|
|
167
|
-
const pad = ' '.repeat(padding);
|
|
168
|
-
const top = title
|
|
169
|
-
? borderColor(`┌─ ${title} ${'─'.repeat(Math.max(0, width - title.length - 4))}┐`)
|
|
170
|
-
: borderColor(`┌${'─'.repeat(width)}┐`);
|
|
171
|
-
const bottom = borderColor(`└${'─'.repeat(width)}┘`);
|
|
172
|
-
|
|
173
|
-
const body = lines.map(line => {
|
|
174
|
-
const stripped = stripAnsi(line);
|
|
175
|
-
const rightPad = ' '.repeat(Math.max(0, maxWidth - stripped.length));
|
|
176
|
-
return `${borderColor('│')}${pad}${line}${rightPad}${pad}${borderColor('│')}`;
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
return [top, ...body, bottom].join('\n');
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Strip ANSI escape codes from string (for width calculations)
|
|
184
|
-
*/
|
|
185
|
-
function stripAnsi(str: string): string {
|
|
186
|
-
// eslint-disable-next-line no-control-regex
|
|
187
|
-
return str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Format a table-like list
|
|
192
|
-
*/
|
|
193
|
-
export function table(rows: [string, string][], indent = 0): string {
|
|
194
|
-
const padding = ' '.repeat(indent);
|
|
195
|
-
const maxKeyLen = Math.max(...rows.map(([k]) => stripAnsi(k).length));
|
|
196
|
-
|
|
197
|
-
return rows
|
|
198
|
-
.map(([key, value]) => {
|
|
199
|
-
const keyPad = ' '.repeat(maxKeyLen - stripAnsi(key).length);
|
|
200
|
-
return `${padding}${key}${keyPad} ${value}`;
|
|
201
|
-
})
|
|
202
|
-
.join('\n');
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Format a list with bullets
|
|
207
|
-
*/
|
|
208
|
-
export function bulletList(items: string[], indent = 0): string {
|
|
209
|
-
const padding = ' '.repeat(indent);
|
|
210
|
-
return items.map(item => `${padding}${icons.bullet} ${item}`).join('\n');
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Format numbered list
|
|
215
|
-
*/
|
|
216
|
-
export function numberedList(items: string[], indent = 0): string {
|
|
217
|
-
const padding = ' '.repeat(indent);
|
|
218
|
-
return items.map((item, i) => `${padding}${chalk.gray(`${i + 1}.`)} ${item}`).join('\n');
|
|
219
|
-
}
|