@driftless-sh/cli 0.1.33 → 0.1.34
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/index.js +230 -152
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,9 +6,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
11
|
+
};
|
|
9
12
|
var __commonJS = (cb, mod) => function __require() {
|
|
10
13
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
14
|
};
|
|
15
|
+
var __export = (target, all) => {
|
|
16
|
+
for (var name in all)
|
|
17
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
18
|
+
};
|
|
12
19
|
var __copyProps = (to, from, except, desc) => {
|
|
13
20
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
21
|
for (let key of __getOwnPropNames(from))
|
|
@@ -26,6 +33,136 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
33
|
mod
|
|
27
34
|
));
|
|
28
35
|
|
|
36
|
+
// src/api-client.ts
|
|
37
|
+
var api_client_exports = {};
|
|
38
|
+
__export(api_client_exports, {
|
|
39
|
+
api: () => api,
|
|
40
|
+
formatError: () => formatError,
|
|
41
|
+
getApiKey: () => getApiKey,
|
|
42
|
+
getApiUrl: () => getApiUrl
|
|
43
|
+
});
|
|
44
|
+
function loadApiKey() {
|
|
45
|
+
const envKey = process.env["DRIFTLESS_API_KEY"];
|
|
46
|
+
if (envKey) return envKey;
|
|
47
|
+
try {
|
|
48
|
+
if ((0, import_node_fs.existsSync)(CONFIG_PATH)) {
|
|
49
|
+
const config = JSON.parse((0, import_node_fs.readFileSync)(CONFIG_PATH, "utf8"));
|
|
50
|
+
return config.api_key || null;
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
function getBaseUrl() {
|
|
57
|
+
const envUrl = process.env["DRIFTLESS_API_URL"];
|
|
58
|
+
if (envUrl) {
|
|
59
|
+
return envUrl.endsWith("/api/v1") ? envUrl : `${envUrl}/api/v1`;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
if ((0, import_node_fs.existsSync)(CONFIG_PATH)) {
|
|
63
|
+
const config = JSON.parse((0, import_node_fs.readFileSync)(CONFIG_PATH, "utf8"));
|
|
64
|
+
return config.api_url || DEFAULT_URL;
|
|
65
|
+
}
|
|
66
|
+
} catch {
|
|
67
|
+
}
|
|
68
|
+
return DEFAULT_URL;
|
|
69
|
+
}
|
|
70
|
+
function parseError(e) {
|
|
71
|
+
const msg = e.message;
|
|
72
|
+
const jsonMatch = msg.match(/\{[\s\S]*\}/);
|
|
73
|
+
if (jsonMatch) {
|
|
74
|
+
try {
|
|
75
|
+
const parsed = JSON.parse(jsonMatch[0]);
|
|
76
|
+
const parts = [];
|
|
77
|
+
if (parsed.message) parts.push(parsed.message);
|
|
78
|
+
if (parsed.request_id) parts.push(`request_id: ${parsed.request_id}`);
|
|
79
|
+
if (parsed.retryable !== void 0) parts.push(`retryable: ${parsed.retryable ? "yes" : "no"}`);
|
|
80
|
+
if (parsed.endpoint) parts.push(`endpoint: ${parsed.endpoint}`);
|
|
81
|
+
if (parts.length > 0) return parts.join(" | ");
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const statusMatch = msg.match(/HTTP (\d+):/);
|
|
86
|
+
if (statusMatch) {
|
|
87
|
+
const code = parseInt(statusMatch[1], 10);
|
|
88
|
+
if (code === 500) return "Internal server error \u2014 the API encountered an unexpected issue";
|
|
89
|
+
if (code === 401) return "Authentication failed \u2014 check your API key";
|
|
90
|
+
if (code === 403) return "Access denied \u2014 your API key lacks permission";
|
|
91
|
+
if (code === 404) return "Not found \u2014 the resource does not exist";
|
|
92
|
+
if (code === 429) return "Rate limited \u2014 too many requests, try again later";
|
|
93
|
+
return `Server error (HTTP ${code})`;
|
|
94
|
+
}
|
|
95
|
+
return msg;
|
|
96
|
+
}
|
|
97
|
+
function request(method, path, body) {
|
|
98
|
+
return new Promise((resolve8, reject) => {
|
|
99
|
+
const baseUrl = getBaseUrl();
|
|
100
|
+
const fullUrl = `${baseUrl}${path}`;
|
|
101
|
+
const url = new URL(fullUrl);
|
|
102
|
+
const isHttps = url.protocol === "https:";
|
|
103
|
+
const fn = isHttps ? import_node_https.request : import_node_http.request;
|
|
104
|
+
const headers = {
|
|
105
|
+
"Content-Type": "application/json",
|
|
106
|
+
Accept: "application/json"
|
|
107
|
+
};
|
|
108
|
+
const apiKey = loadApiKey();
|
|
109
|
+
if (apiKey) {
|
|
110
|
+
headers["X-API-Key"] = apiKey;
|
|
111
|
+
}
|
|
112
|
+
const req = fn(
|
|
113
|
+
fullUrl,
|
|
114
|
+
{ method, headers },
|
|
115
|
+
(res) => {
|
|
116
|
+
let data = "";
|
|
117
|
+
res.on("data", (chunk) => data += chunk.toString());
|
|
118
|
+
res.on("end", () => {
|
|
119
|
+
if (res.statusCode && res.statusCode >= 400) {
|
|
120
|
+
reject(new Error(`HTTP ${res.statusCode}: ${data}`));
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
resolve8(JSON.parse(data));
|
|
125
|
+
} catch {
|
|
126
|
+
resolve8(data);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
req.on("error", (e) => reject(new Error(`Connection failed: ${e.message}`)));
|
|
132
|
+
if (body) req.write(JSON.stringify(body));
|
|
133
|
+
req.end();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function getApiUrl() {
|
|
137
|
+
return getBaseUrl();
|
|
138
|
+
}
|
|
139
|
+
function getApiKey() {
|
|
140
|
+
return loadApiKey();
|
|
141
|
+
}
|
|
142
|
+
function formatError(e) {
|
|
143
|
+
return parseError(e);
|
|
144
|
+
}
|
|
145
|
+
var import_node_http, import_node_https, import_node_fs, import_node_path, import_node_os, CONFIG_PATH, DEFAULT_URL, api;
|
|
146
|
+
var init_api_client = __esm({
|
|
147
|
+
"src/api-client.ts"() {
|
|
148
|
+
"use strict";
|
|
149
|
+
import_node_http = require("node:http");
|
|
150
|
+
import_node_https = require("node:https");
|
|
151
|
+
import_node_fs = require("node:fs");
|
|
152
|
+
import_node_path = require("node:path");
|
|
153
|
+
import_node_os = require("node:os");
|
|
154
|
+
CONFIG_PATH = (0, import_node_path.resolve)((0, import_node_os.homedir)(), ".driftless", "config.json");
|
|
155
|
+
DEFAULT_URL = "http://localhost:3000/api/v1";
|
|
156
|
+
api = {
|
|
157
|
+
get: (path) => request("GET", path),
|
|
158
|
+
post: (path, body) => request("POST", path, body),
|
|
159
|
+
put: (path, body) => request("PUT", path, body),
|
|
160
|
+
patch: (path, body) => request("PATCH", path, body),
|
|
161
|
+
delete: (path) => request("DELETE", path)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
29
166
|
// ../../libs/scanner/dist/identity/identity.js
|
|
30
167
|
var require_identity = __commonJS({
|
|
31
168
|
"../../libs/scanner/dist/identity/identity.js"(exports2) {
|
|
@@ -2436,7 +2573,7 @@ var require_typescript = __commonJS({
|
|
|
2436
2573
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
2437
2574
|
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
2438
2575
|
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
2439
|
-
var
|
|
2576
|
+
var __export2 = (target, all) => {
|
|
2440
2577
|
for (var name in all)
|
|
2441
2578
|
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
2442
2579
|
};
|
|
@@ -2450,7 +2587,7 @@ var require_typescript = __commonJS({
|
|
|
2450
2587
|
};
|
|
2451
2588
|
var __toCommonJS = (mod) => (__copyProps2, mod);
|
|
2452
2589
|
var typescript_exports = {};
|
|
2453
|
-
|
|
2590
|
+
__export2(typescript_exports, {
|
|
2454
2591
|
ANONYMOUS: () => ANONYMOUS,
|
|
2455
2592
|
AccessFlags: () => AccessFlags,
|
|
2456
2593
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -7537,7 +7674,7 @@ ${lanes.join("\n")}
|
|
|
7537
7674
|
}
|
|
7538
7675
|
var timestamp = nativePerformanceTime ? () => nativePerformanceTime.now() : Date.now;
|
|
7539
7676
|
var ts_performance_exports = {};
|
|
7540
|
-
|
|
7677
|
+
__export2(ts_performance_exports, {
|
|
7541
7678
|
clearMarks: () => clearMarks,
|
|
7542
7679
|
clearMeasures: () => clearMeasures,
|
|
7543
7680
|
createTimer: () => createTimer,
|
|
@@ -55840,7 +55977,7 @@ ${lanes.join("\n")}
|
|
|
55840
55977
|
}
|
|
55841
55978
|
}
|
|
55842
55979
|
var ts_moduleSpecifiers_exports = {};
|
|
55843
|
-
|
|
55980
|
+
__export2(ts_moduleSpecifiers_exports, {
|
|
55844
55981
|
RelativePreference: () => RelativePreference,
|
|
55845
55982
|
countPathComponents: () => countPathComponents,
|
|
55846
55983
|
forEachFileNameOfModule: () => forEachFileNameOfModule,
|
|
@@ -150640,7 +150777,7 @@ ${lanes.join("\n")}
|
|
|
150640
150777
|
}
|
|
150641
150778
|
}
|
|
150642
150779
|
var ts_JsTyping_exports = {};
|
|
150643
|
-
|
|
150780
|
+
__export2(ts_JsTyping_exports, {
|
|
150644
150781
|
NameValidationResult: () => NameValidationResult,
|
|
150645
150782
|
discoverTypings: () => discoverTypings,
|
|
150646
150783
|
isTypingUpToDate: () => isTypingUpToDate,
|
|
@@ -157686,7 +157823,7 @@ interface Symbol {
|
|
|
157686
157823
|
return options;
|
|
157687
157824
|
}
|
|
157688
157825
|
var ts_NavigateTo_exports = {};
|
|
157689
|
-
|
|
157826
|
+
__export2(ts_NavigateTo_exports, {
|
|
157690
157827
|
getNavigateToItems: () => getNavigateToItems
|
|
157691
157828
|
});
|
|
157692
157829
|
function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) {
|
|
@@ -157791,7 +157928,7 @@ interface Symbol {
|
|
|
157791
157928
|
};
|
|
157792
157929
|
}
|
|
157793
157930
|
var ts_NavigationBar_exports = {};
|
|
157794
|
-
|
|
157931
|
+
__export2(ts_NavigationBar_exports, {
|
|
157795
157932
|
getNavigationBarItems: () => getNavigationBarItems,
|
|
157796
157933
|
getNavigationTree: () => getNavigationTree
|
|
157797
157934
|
});
|
|
@@ -158579,7 +158716,7 @@ interface Symbol {
|
|
|
158579
158716
|
return text.replace(/\\?(?:\r?\n|[\r\u2028\u2029])/g, "");
|
|
158580
158717
|
}
|
|
158581
158718
|
var ts_refactor_exports = {};
|
|
158582
|
-
|
|
158719
|
+
__export2(ts_refactor_exports, {
|
|
158583
158720
|
addExportsInOldFile: () => addExportsInOldFile,
|
|
158584
158721
|
addImportsForMovedSymbols: () => addImportsForMovedSymbols,
|
|
158585
158722
|
addNewFileToTsconfig: () => addNewFileToTsconfig,
|
|
@@ -162122,7 +162259,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162122
162259
|
}
|
|
162123
162260
|
}
|
|
162124
162261
|
var ts_refactor_extractSymbol_exports = {};
|
|
162125
|
-
|
|
162262
|
+
__export2(ts_refactor_extractSymbol_exports, {
|
|
162126
162263
|
Messages: () => Messages,
|
|
162127
162264
|
RangeFacts: () => RangeFacts,
|
|
162128
162265
|
getRangeToExtract: () => getRangeToExtract2,
|
|
@@ -166701,7 +166838,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166701
166838
|
return result;
|
|
166702
166839
|
}
|
|
166703
166840
|
var ts_BreakpointResolver_exports = {};
|
|
166704
|
-
|
|
166841
|
+
__export2(ts_BreakpointResolver_exports, {
|
|
166705
166842
|
spanInSourceFileAtLocation: () => spanInSourceFileAtLocation
|
|
166706
166843
|
});
|
|
166707
166844
|
function spanInSourceFileAtLocation(sourceFile, position) {
|
|
@@ -167207,7 +167344,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167207
167344
|
}
|
|
167208
167345
|
}
|
|
167209
167346
|
var ts_CallHierarchy_exports = {};
|
|
167210
|
-
|
|
167347
|
+
__export2(ts_CallHierarchy_exports, {
|
|
167211
167348
|
createCallHierarchyItem: () => createCallHierarchyItem,
|
|
167212
167349
|
getIncomingCalls: () => getIncomingCalls,
|
|
167213
167350
|
getOutgoingCalls: () => getOutgoingCalls,
|
|
@@ -167656,11 +167793,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167656
167793
|
return group(collectCallSites(program, declaration), getCallSiteGroupKey, (entries) => convertCallSiteGroupToOutgoingCall(program, entries));
|
|
167657
167794
|
}
|
|
167658
167795
|
var ts_classifier_exports = {};
|
|
167659
|
-
|
|
167796
|
+
__export2(ts_classifier_exports, {
|
|
167660
167797
|
v2020: () => ts_classifier_v2020_exports
|
|
167661
167798
|
});
|
|
167662
167799
|
var ts_classifier_v2020_exports = {};
|
|
167663
|
-
|
|
167800
|
+
__export2(ts_classifier_v2020_exports, {
|
|
167664
167801
|
TokenEncodingConsts: () => TokenEncodingConsts,
|
|
167665
167802
|
TokenModifier: () => TokenModifier,
|
|
167666
167803
|
TokenType: () => TokenType,
|
|
@@ -167668,7 +167805,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167668
167805
|
getSemanticClassifications: () => getSemanticClassifications2
|
|
167669
167806
|
});
|
|
167670
167807
|
var ts_codefix_exports = {};
|
|
167671
|
-
|
|
167808
|
+
__export2(ts_codefix_exports, {
|
|
167672
167809
|
PreserveOptionalFlags: () => PreserveOptionalFlags,
|
|
167673
167810
|
addNewNodeForMemberSymbol: () => addNewNodeForMemberSymbol,
|
|
167674
167811
|
codeFixAll: () => codeFixAll,
|
|
@@ -179589,7 +179726,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
179589
179726
|
}
|
|
179590
179727
|
}
|
|
179591
179728
|
var ts_Completions_exports = {};
|
|
179592
|
-
|
|
179729
|
+
__export2(ts_Completions_exports, {
|
|
179593
179730
|
CompletionKind: () => CompletionKind,
|
|
179594
179731
|
CompletionSource: () => CompletionSource,
|
|
179595
179732
|
SortText: () => SortText,
|
|
@@ -183845,7 +183982,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
183845
183982
|
return keyword === "abstract" || keyword === "async" || keyword === "await" || keyword === "declare" || keyword === "module" || keyword === "namespace" || keyword === "type" || keyword === "satisfies" || keyword === "as";
|
|
183846
183983
|
}
|
|
183847
183984
|
var ts_Completions_StringCompletions_exports = {};
|
|
183848
|
-
|
|
183985
|
+
__export2(ts_Completions_StringCompletions_exports, {
|
|
183849
183986
|
getStringLiteralCompletionDetails: () => getStringLiteralCompletionDetails,
|
|
183850
183987
|
getStringLiteralCompletions: () => getStringLiteralCompletions
|
|
183851
183988
|
});
|
|
@@ -184913,7 +185050,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
184913
185050
|
return isCallExpression(node.parent) && firstOrUndefined(node.parent.arguments) === node && isIdentifier(node.parent.expression) && node.parent.expression.escapedText === "require";
|
|
184914
185051
|
}
|
|
184915
185052
|
var ts_FindAllReferences_exports = {};
|
|
184916
|
-
|
|
185053
|
+
__export2(ts_FindAllReferences_exports, {
|
|
184917
185054
|
Core: () => Core,
|
|
184918
185055
|
DefinitionKind: () => DefinitionKind,
|
|
184919
185056
|
EntryKind: () => EntryKind,
|
|
@@ -187497,7 +187634,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
187497
187634
|
}
|
|
187498
187635
|
})(Core || (Core = {}));
|
|
187499
187636
|
var ts_GoToDefinition_exports = {};
|
|
187500
|
-
|
|
187637
|
+
__export2(ts_GoToDefinition_exports, {
|
|
187501
187638
|
createDefinitionInfo: () => createDefinitionInfo,
|
|
187502
187639
|
getDefinitionAndBoundSpan: () => getDefinitionAndBoundSpan,
|
|
187503
187640
|
getDefinitionAtPosition: () => getDefinitionAtPosition,
|
|
@@ -188069,7 +188206,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
188069
188206
|
}
|
|
188070
188207
|
}
|
|
188071
188208
|
var ts_InlayHints_exports = {};
|
|
188072
|
-
|
|
188209
|
+
__export2(ts_InlayHints_exports, {
|
|
188073
188210
|
provideInlayHints: () => provideInlayHints
|
|
188074
188211
|
});
|
|
188075
188212
|
var leadingParameterNameCommentRegexFactory = (name) => {
|
|
@@ -188870,7 +189007,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
188870
189007
|
}
|
|
188871
189008
|
}
|
|
188872
189009
|
var ts_JsDoc_exports = {};
|
|
188873
|
-
|
|
189010
|
+
__export2(ts_JsDoc_exports, {
|
|
188874
189011
|
getDocCommentTemplateAtPosition: () => getDocCommentTemplateAtPosition,
|
|
188875
189012
|
getJSDocParameterNameCompletionDetails: () => getJSDocParameterNameCompletionDetails,
|
|
188876
189013
|
getJSDocParameterNameCompletions: () => getJSDocParameterNameCompletions,
|
|
@@ -189307,7 +189444,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
189307
189444
|
}
|
|
189308
189445
|
}
|
|
189309
189446
|
var ts_MapCode_exports = {};
|
|
189310
|
-
|
|
189447
|
+
__export2(ts_MapCode_exports, {
|
|
189311
189448
|
mapCode: () => mapCode
|
|
189312
189449
|
});
|
|
189313
189450
|
function mapCode(sourceFile, contents, focusLocations, host, formatContext, preferences) {
|
|
@@ -189511,7 +189648,7 @@ ${content}
|
|
|
189511
189648
|
node.forEachChild(resetNodePositions);
|
|
189512
189649
|
}
|
|
189513
189650
|
var ts_OrganizeImports_exports = {};
|
|
189514
|
-
|
|
189651
|
+
__export2(ts_OrganizeImports_exports, {
|
|
189515
189652
|
compareImportsOrRequireStatements: () => compareImportsOrRequireStatements,
|
|
189516
189653
|
compareModuleSpecifiers: () => compareModuleSpecifiers2,
|
|
189517
189654
|
getImportDeclarationInsertionIndex: () => getImportDeclarationInsertionIndex,
|
|
@@ -190171,7 +190308,7 @@ ${content}
|
|
|
190171
190308
|
return compareModuleSpecifiersWorker(m1, m2, comparer);
|
|
190172
190309
|
}
|
|
190173
190310
|
var ts_OutliningElementsCollector_exports = {};
|
|
190174
|
-
|
|
190311
|
+
__export2(ts_OutliningElementsCollector_exports, {
|
|
190175
190312
|
collectElements: () => collectElements
|
|
190176
190313
|
});
|
|
190177
190314
|
function collectElements(sourceFile, cancellationToken) {
|
|
@@ -190590,7 +190727,7 @@ ${content}
|
|
|
190590
190727
|
return findChildOfKind(body, 19, sourceFile);
|
|
190591
190728
|
}
|
|
190592
190729
|
var ts_Rename_exports = {};
|
|
190593
|
-
|
|
190730
|
+
__export2(ts_Rename_exports, {
|
|
190594
190731
|
getRenameInfo: () => getRenameInfo,
|
|
190595
190732
|
nodeIsEligibleForRename: () => nodeIsEligibleForRename
|
|
190596
190733
|
});
|
|
@@ -190746,7 +190883,7 @@ ${content}
|
|
|
190746
190883
|
}
|
|
190747
190884
|
}
|
|
190748
190885
|
var ts_SignatureHelp_exports = {};
|
|
190749
|
-
|
|
190886
|
+
__export2(ts_SignatureHelp_exports, {
|
|
190750
190887
|
getArgumentInfoForCompletions: () => getArgumentInfoForCompletions,
|
|
190751
190888
|
getSignatureHelpItems: () => getSignatureHelpItems
|
|
190752
190889
|
});
|
|
@@ -191292,7 +191429,7 @@ ${content}
|
|
|
191292
191429
|
return { name: typeParameter.symbol.name, documentation: typeParameter.symbol.getDocumentationComment(checker), displayParts, isOptional: false, isRest: false };
|
|
191293
191430
|
}
|
|
191294
191431
|
var ts_SmartSelectionRange_exports = {};
|
|
191295
|
-
|
|
191432
|
+
__export2(ts_SmartSelectionRange_exports, {
|
|
191296
191433
|
getSmartSelectionRange: () => getSmartSelectionRange
|
|
191297
191434
|
});
|
|
191298
191435
|
function getSmartSelectionRange(pos, sourceFile) {
|
|
@@ -191523,7 +191660,7 @@ ${content}
|
|
|
191523
191660
|
}
|
|
191524
191661
|
}
|
|
191525
191662
|
var ts_SymbolDisplay_exports = {};
|
|
191526
|
-
|
|
191663
|
+
__export2(ts_SymbolDisplay_exports, {
|
|
191527
191664
|
getSymbolDisplayPartsDocumentationAndSymbolKind: () => getSymbolDisplayPartsDocumentationAndSymbolKind,
|
|
191528
191665
|
getSymbolKind: () => getSymbolKind,
|
|
191529
191666
|
getSymbolModifiers: () => getSymbolModifiers
|
|
@@ -192491,7 +192628,7 @@ ${content}
|
|
|
192491
192628
|
});
|
|
192492
192629
|
}
|
|
192493
192630
|
var ts_textChanges_exports = {};
|
|
192494
|
-
|
|
192631
|
+
__export2(ts_textChanges_exports, {
|
|
192495
192632
|
ChangeTracker: () => ChangeTracker,
|
|
192496
192633
|
LeadingTriviaOption: () => LeadingTriviaOption,
|
|
192497
192634
|
TrailingTriviaOption: () => TrailingTriviaOption,
|
|
@@ -193908,7 +194045,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
193908
194045
|
});
|
|
193909
194046
|
}
|
|
193910
194047
|
var ts_formatting_exports = {};
|
|
193911
|
-
|
|
194048
|
+
__export2(ts_formatting_exports, {
|
|
193912
194049
|
FormattingContext: () => FormattingContext,
|
|
193913
194050
|
FormattingRequestKind: () => FormattingRequestKind,
|
|
193914
194051
|
RuleAction: () => RuleAction,
|
|
@@ -197808,7 +197945,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
197808
197945
|
}
|
|
197809
197946
|
})(SmartIndenter || (SmartIndenter = {}));
|
|
197810
197947
|
var ts_preparePasteEdits_exports = {};
|
|
197811
|
-
|
|
197948
|
+
__export2(ts_preparePasteEdits_exports, {
|
|
197812
197949
|
preparePasteEdits: () => preparePasteEdits
|
|
197813
197950
|
});
|
|
197814
197951
|
function preparePasteEdits(sourceFile, copiedFromRange, checker) {
|
|
@@ -197846,7 +197983,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
197846
197983
|
return shouldProvidePasteEdits;
|
|
197847
197984
|
}
|
|
197848
197985
|
var ts_PasteEdits_exports = {};
|
|
197849
|
-
|
|
197986
|
+
__export2(ts_PasteEdits_exports, {
|
|
197850
197987
|
pasteEditsProvider: () => pasteEditsProvider
|
|
197851
197988
|
});
|
|
197852
197989
|
var fixId55 = "providePostPasteEdits";
|
|
@@ -197953,7 +198090,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
197953
198090
|
};
|
|
197954
198091
|
}
|
|
197955
198092
|
var ts_exports2 = {};
|
|
197956
|
-
|
|
198093
|
+
__export2(ts_exports2, {
|
|
197957
198094
|
ANONYMOUS: () => ANONYMOUS,
|
|
197958
198095
|
AccessFlags: () => AccessFlags,
|
|
197959
198096
|
AssertionLevel: () => AssertionLevel,
|
|
@@ -200304,7 +200441,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
200304
200441
|
};
|
|
200305
200442
|
}
|
|
200306
200443
|
var ts_server_exports3 = {};
|
|
200307
|
-
|
|
200444
|
+
__export2(ts_server_exports3, {
|
|
200308
200445
|
ActionInvalidate: () => ActionInvalidate,
|
|
200309
200446
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
200310
200447
|
ActionSet: () => ActionSet,
|
|
@@ -200402,7 +200539,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
200402
200539
|
updateProjectIfDirty: () => updateProjectIfDirty
|
|
200403
200540
|
});
|
|
200404
200541
|
var ts_server_typingsInstaller_exports = {};
|
|
200405
|
-
|
|
200542
|
+
__export2(ts_server_typingsInstaller_exports, {
|
|
200406
200543
|
TypingsInstaller: () => TypingsInstaller,
|
|
200407
200544
|
getNpmCommandForInstallation: () => getNpmCommandForInstallation,
|
|
200408
200545
|
installNpmPackages: () => installNpmPackages,
|
|
@@ -200969,7 +201106,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
200969
201106
|
return base === "tsconfig.json" || base === "jsconfig.json" ? base : void 0;
|
|
200970
201107
|
}
|
|
200971
201108
|
var ts_server_protocol_exports = {};
|
|
200972
|
-
|
|
201109
|
+
__export2(ts_server_protocol_exports, {
|
|
200973
201110
|
ClassificationType: () => ClassificationType,
|
|
200974
201111
|
CommandTypes: () => CommandTypes,
|
|
200975
201112
|
CompletionTriggerKind: () => CompletionTriggerKind,
|
|
@@ -213043,7 +213180,7 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
213043
213180
|
_TypingsInstallerAdapter.requestDelayMillis = 100;
|
|
213044
213181
|
var TypingsInstallerAdapter = _TypingsInstallerAdapter;
|
|
213045
213182
|
var ts_server_exports4 = {};
|
|
213046
|
-
|
|
213183
|
+
__export2(ts_server_exports4, {
|
|
213047
213184
|
ActionInvalidate: () => ActionInvalidate,
|
|
213048
213185
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
213049
213186
|
ActionSet: () => ActionSet,
|
|
@@ -214209,122 +214346,35 @@ var require_dist = __commonJS({
|
|
|
214209
214346
|
}
|
|
214210
214347
|
});
|
|
214211
214348
|
|
|
214212
|
-
// src/
|
|
214213
|
-
var
|
|
214214
|
-
|
|
214215
|
-
|
|
214216
|
-
|
|
214217
|
-
|
|
214218
|
-
|
|
214219
|
-
|
|
214220
|
-
|
|
214221
|
-
|
|
214222
|
-
|
|
214223
|
-
|
|
214224
|
-
|
|
214225
|
-
|
|
214226
|
-
|
|
214227
|
-
|
|
214228
|
-
}
|
|
214229
|
-
return null;
|
|
214230
|
-
}
|
|
214231
|
-
var DEFAULT_URL = "http://localhost:3000/api/v1";
|
|
214232
|
-
function getBaseUrl() {
|
|
214233
|
-
const envUrl = process.env["DRIFTLESS_API_URL"];
|
|
214234
|
-
if (envUrl) {
|
|
214235
|
-
return envUrl.endsWith("/api/v1") ? envUrl : `${envUrl}/api/v1`;
|
|
214236
|
-
}
|
|
214237
|
-
try {
|
|
214238
|
-
if ((0, import_node_fs.existsSync)(CONFIG_PATH)) {
|
|
214239
|
-
const config = JSON.parse((0, import_node_fs.readFileSync)(CONFIG_PATH, "utf8"));
|
|
214240
|
-
return config.api_url || DEFAULT_URL;
|
|
214241
|
-
}
|
|
214242
|
-
} catch {
|
|
214243
|
-
}
|
|
214244
|
-
return DEFAULT_URL;
|
|
214349
|
+
// src/analytics.ts
|
|
214350
|
+
var analytics_exports = {};
|
|
214351
|
+
__export(analytics_exports, {
|
|
214352
|
+
analyticsEvent: () => analyticsEvent
|
|
214353
|
+
});
|
|
214354
|
+
function analyticsEvent(event, distinctId, props = {}) {
|
|
214355
|
+
if (!KEY) return;
|
|
214356
|
+
fetch(`${HOST}/capture/`, {
|
|
214357
|
+
method: "POST",
|
|
214358
|
+
headers: { "Content-Type": "application/json" },
|
|
214359
|
+
body: JSON.stringify({
|
|
214360
|
+
api_key: KEY,
|
|
214361
|
+
event,
|
|
214362
|
+
distinct_id: `workspace:${distinctId}`,
|
|
214363
|
+
properties: { ...props, source: "cli", $lib: "driftless-cli" }
|
|
214364
|
+
})
|
|
214365
|
+
}).catch(() => void 0);
|
|
214245
214366
|
}
|
|
214246
|
-
|
|
214247
|
-
|
|
214248
|
-
|
|
214249
|
-
|
|
214250
|
-
|
|
214251
|
-
|
|
214252
|
-
const parts = [];
|
|
214253
|
-
if (parsed.message) parts.push(parsed.message);
|
|
214254
|
-
if (parsed.request_id) parts.push(`request_id: ${parsed.request_id}`);
|
|
214255
|
-
if (parsed.retryable !== void 0) parts.push(`retryable: ${parsed.retryable ? "yes" : "no"}`);
|
|
214256
|
-
if (parsed.endpoint) parts.push(`endpoint: ${parsed.endpoint}`);
|
|
214257
|
-
if (parts.length > 0) return parts.join(" | ");
|
|
214258
|
-
} catch {
|
|
214259
|
-
}
|
|
214260
|
-
}
|
|
214261
|
-
const statusMatch = msg.match(/HTTP (\d+):/);
|
|
214262
|
-
if (statusMatch) {
|
|
214263
|
-
const code = parseInt(statusMatch[1], 10);
|
|
214264
|
-
if (code === 500) return "Internal server error \u2014 the API encountered an unexpected issue";
|
|
214265
|
-
if (code === 401) return "Authentication failed \u2014 check your API key";
|
|
214266
|
-
if (code === 403) return "Access denied \u2014 your API key lacks permission";
|
|
214267
|
-
if (code === 404) return "Not found \u2014 the resource does not exist";
|
|
214268
|
-
if (code === 429) return "Rate limited \u2014 too many requests, try again later";
|
|
214269
|
-
return `Server error (HTTP ${code})`;
|
|
214367
|
+
var KEY, HOST;
|
|
214368
|
+
var init_analytics = __esm({
|
|
214369
|
+
"src/analytics.ts"() {
|
|
214370
|
+
"use strict";
|
|
214371
|
+
KEY = "";
|
|
214372
|
+
HOST = "https://us.i.posthog.com";
|
|
214270
214373
|
}
|
|
214271
|
-
|
|
214272
|
-
|
|
214273
|
-
|
|
214274
|
-
|
|
214275
|
-
const baseUrl = getBaseUrl();
|
|
214276
|
-
const fullUrl = `${baseUrl}${path}`;
|
|
214277
|
-
const url = new URL(fullUrl);
|
|
214278
|
-
const isHttps = url.protocol === "https:";
|
|
214279
|
-
const fn = isHttps ? import_node_https.request : import_node_http.request;
|
|
214280
|
-
const headers = {
|
|
214281
|
-
"Content-Type": "application/json",
|
|
214282
|
-
Accept: "application/json"
|
|
214283
|
-
};
|
|
214284
|
-
const apiKey = loadApiKey();
|
|
214285
|
-
if (apiKey) {
|
|
214286
|
-
headers["X-API-Key"] = apiKey;
|
|
214287
|
-
}
|
|
214288
|
-
const req = fn(
|
|
214289
|
-
fullUrl,
|
|
214290
|
-
{ method, headers },
|
|
214291
|
-
(res) => {
|
|
214292
|
-
let data = "";
|
|
214293
|
-
res.on("data", (chunk) => data += chunk.toString());
|
|
214294
|
-
res.on("end", () => {
|
|
214295
|
-
if (res.statusCode && res.statusCode >= 400) {
|
|
214296
|
-
reject(new Error(`HTTP ${res.statusCode}: ${data}`));
|
|
214297
|
-
return;
|
|
214298
|
-
}
|
|
214299
|
-
try {
|
|
214300
|
-
resolve8(JSON.parse(data));
|
|
214301
|
-
} catch {
|
|
214302
|
-
resolve8(data);
|
|
214303
|
-
}
|
|
214304
|
-
});
|
|
214305
|
-
}
|
|
214306
|
-
);
|
|
214307
|
-
req.on("error", (e) => reject(new Error(`Connection failed: ${e.message}`)));
|
|
214308
|
-
if (body) req.write(JSON.stringify(body));
|
|
214309
|
-
req.end();
|
|
214310
|
-
});
|
|
214311
|
-
}
|
|
214312
|
-
var api = {
|
|
214313
|
-
get: (path) => request("GET", path),
|
|
214314
|
-
post: (path, body) => request("POST", path, body),
|
|
214315
|
-
put: (path, body) => request("PUT", path, body),
|
|
214316
|
-
patch: (path, body) => request("PATCH", path, body),
|
|
214317
|
-
delete: (path) => request("DELETE", path)
|
|
214318
|
-
};
|
|
214319
|
-
function getApiUrl() {
|
|
214320
|
-
return getBaseUrl();
|
|
214321
|
-
}
|
|
214322
|
-
function getApiKey() {
|
|
214323
|
-
return loadApiKey();
|
|
214324
|
-
}
|
|
214325
|
-
function formatError(e) {
|
|
214326
|
-
return parseError(e);
|
|
214327
|
-
}
|
|
214374
|
+
});
|
|
214375
|
+
|
|
214376
|
+
// src/commands/init.ts
|
|
214377
|
+
init_api_client();
|
|
214328
214378
|
|
|
214329
214379
|
// src/git.ts
|
|
214330
214380
|
var import_node_child_process = require("node:child_process");
|
|
@@ -214401,6 +214451,7 @@ function getAuthorName() {
|
|
|
214401
214451
|
var import_scanner = __toESM(require_dist());
|
|
214402
214452
|
var import_node_fs4 = require("node:fs");
|
|
214403
214453
|
var import_node_path4 = require("node:path");
|
|
214454
|
+
init_analytics();
|
|
214404
214455
|
|
|
214405
214456
|
// src/commands/install-skill.ts
|
|
214406
214457
|
var import_node_fs3 = require("node:fs");
|
|
@@ -214501,13 +214552,22 @@ async function installSkillCommand() {
|
|
|
214501
214552
|
const icon = (s) => s === "created" ? "created \u2713" : s === "updated" ? "updated \u2713" : "already configured \u2713";
|
|
214502
214553
|
console.log(` CLAUDE.md ${icon(result.claudeMd)}`);
|
|
214503
214554
|
console.log(` AGENTS.md ${icon(result.agentsMd)}`);
|
|
214555
|
+
try {
|
|
214556
|
+
const { api: api2 } = await Promise.resolve().then(() => (init_api_client(), api_client_exports));
|
|
214557
|
+
const me = await api2.get("/me");
|
|
214558
|
+
if (me?.slug) {
|
|
214559
|
+
const { analyticsEvent: analyticsEvent2 } = await Promise.resolve().then(() => (init_analytics(), analytics_exports));
|
|
214560
|
+
analyticsEvent2("cli_install_skill", me.slug, { claude_md: result.claudeMd, agents_md: result.agentsMd });
|
|
214561
|
+
}
|
|
214562
|
+
} catch {
|
|
214563
|
+
}
|
|
214504
214564
|
return result;
|
|
214505
214565
|
}
|
|
214506
214566
|
|
|
214507
214567
|
// src/commands/init.ts
|
|
214508
214568
|
function getVersion() {
|
|
214509
214569
|
try {
|
|
214510
|
-
return "0.1.
|
|
214570
|
+
return "0.1.34";
|
|
214511
214571
|
} catch {
|
|
214512
214572
|
return "0.0.0";
|
|
214513
214573
|
}
|
|
@@ -214979,10 +215039,18 @@ async function initCommand(args) {
|
|
|
214979
215039
|
console.log(" next \u2192 driftless context list");
|
|
214980
215040
|
console.log("");
|
|
214981
215041
|
console.log(DIVIDER);
|
|
215042
|
+
analyticsEvent("cli_init_run", workspaceSlug, {
|
|
215043
|
+
framework: summary.framework,
|
|
215044
|
+
endpoints: summary.endpoints ?? components.filter((c) => c.type === "controller").length,
|
|
215045
|
+
components: components.length,
|
|
215046
|
+
watchers_created: watchersCreated
|
|
215047
|
+
});
|
|
214982
215048
|
process.exit(0);
|
|
214983
215049
|
}
|
|
214984
215050
|
|
|
214985
215051
|
// src/commands/scan.ts
|
|
215052
|
+
init_api_client();
|
|
215053
|
+
init_analytics();
|
|
214986
215054
|
function emitJSON(data) {
|
|
214987
215055
|
console.log(JSON.stringify(data, null, 2));
|
|
214988
215056
|
}
|
|
@@ -215058,6 +215126,7 @@ async function scanCommand(args) {
|
|
|
215058
215126
|
});
|
|
215059
215127
|
const rulesEvaluated = result.rules_evaluated || 0;
|
|
215060
215128
|
if (result.status === "clean") {
|
|
215129
|
+
analyticsEvent("cli_scan_run", workspace.slug, { violations_found: false, count: 0 });
|
|
215061
215130
|
if (isJSON) {
|
|
215062
215131
|
emitJSON({ status: "clean", files: changedFiles, rules_evaluated: rulesEvaluated, violations: [] });
|
|
215063
215132
|
} else {
|
|
@@ -215066,6 +215135,7 @@ async function scanCommand(args) {
|
|
|
215066
215135
|
process.exit(0);
|
|
215067
215136
|
}
|
|
215068
215137
|
if (!result.violations || result.violations.length === 0) {
|
|
215138
|
+
analyticsEvent("cli_scan_run", workspace.slug, { violations_found: false, count: 0 });
|
|
215069
215139
|
if (isJSON) {
|
|
215070
215140
|
emitJSON({ status: "clean", files: changedFiles, rules_evaluated: rulesEvaluated, violations: [] });
|
|
215071
215141
|
} else {
|
|
@@ -215073,6 +215143,7 @@ async function scanCommand(args) {
|
|
|
215073
215143
|
}
|
|
215074
215144
|
process.exit(0);
|
|
215075
215145
|
}
|
|
215146
|
+
analyticsEvent("cli_scan_run", workspace.slug, { violations_found: true, count: result.violations.length });
|
|
215076
215147
|
if (isJSON) {
|
|
215077
215148
|
emitJSON({ status: "violated", files: changedFiles, rules_evaluated: rulesEvaluated, violations: result.violations });
|
|
215078
215149
|
} else {
|
|
@@ -215093,8 +215164,10 @@ ${result.violations.length} violation(s) found (${rulesEvaluated} rule(s) evalua
|
|
|
215093
215164
|
}
|
|
215094
215165
|
|
|
215095
215166
|
// src/commands/context.ts
|
|
215167
|
+
init_api_client();
|
|
215096
215168
|
var import_node_fs5 = require("node:fs");
|
|
215097
215169
|
var import_node_path5 = require("node:path");
|
|
215170
|
+
init_analytics();
|
|
215098
215171
|
function parseArgs(args) {
|
|
215099
215172
|
const flags = {};
|
|
215100
215173
|
const positional = [];
|
|
@@ -215365,6 +215438,7 @@ async function contextCommand(args) {
|
|
|
215365
215438
|
}
|
|
215366
215439
|
try {
|
|
215367
215440
|
const ctx = await api.get(`/workspaces/${workspaceSlug}/watchers/${slug}`);
|
|
215441
|
+
analyticsEvent("cli_context_get", workspaceSlug, { topic: slug });
|
|
215368
215442
|
if (isJSON) {
|
|
215369
215443
|
const sanitized = JSON.parse(JSON.stringify(ctx, (_key, value) => {
|
|
215370
215444
|
if (typeof value === "string" && value.length > 500) return value.slice(0, 500) + "\u2026";
|
|
@@ -215438,6 +215512,7 @@ async function contextCommand(args) {
|
|
|
215438
215512
|
ownership: flags["ownership"],
|
|
215439
215513
|
file_content: fileContent
|
|
215440
215514
|
});
|
|
215515
|
+
analyticsEvent("context_created", workspaceSlug, { topic: name, has_pattern: !!pattern, has_what: !!flags["what"] });
|
|
215441
215516
|
if (isJSON) {
|
|
215442
215517
|
emitJSON2(result);
|
|
215443
215518
|
} else {
|
|
@@ -215520,6 +215595,7 @@ async function contextCommand(args) {
|
|
|
215520
215595
|
`/workspaces/${workspaceSlug}/watchers/${slug}`,
|
|
215521
215596
|
updates
|
|
215522
215597
|
);
|
|
215598
|
+
analyticsEvent("cli_context_update", workspaceSlug, { topic: slug });
|
|
215523
215599
|
if (isJSON) {
|
|
215524
215600
|
emitJSON2(result);
|
|
215525
215601
|
} else {
|
|
@@ -215875,6 +215951,7 @@ Run 'driftless help context' for full reference.`);
|
|
|
215875
215951
|
}
|
|
215876
215952
|
|
|
215877
215953
|
// src/commands/sync.ts
|
|
215954
|
+
init_api_client();
|
|
215878
215955
|
function parseArgs2(args) {
|
|
215879
215956
|
const flags = {};
|
|
215880
215957
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -216079,6 +216156,7 @@ function saveConfig(apiKey, apiUrl) {
|
|
|
216079
216156
|
}
|
|
216080
216157
|
|
|
216081
216158
|
// src/commands/doctor.ts
|
|
216159
|
+
init_api_client();
|
|
216082
216160
|
var import_node_fs7 = require("node:fs");
|
|
216083
216161
|
var import_node_path7 = require("node:path");
|
|
216084
216162
|
async function doctorCommand() {
|
|
@@ -216224,7 +216302,7 @@ function pad2(s, n) {
|
|
|
216224
216302
|
}
|
|
216225
216303
|
|
|
216226
216304
|
// src/index.ts
|
|
216227
|
-
var VERSION = "0.1.
|
|
216305
|
+
var VERSION = "0.1.34";
|
|
216228
216306
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Living repo context for humans and coding agents
|
|
216229
216307
|
|
|
216230
216308
|
Install: npm install -g @driftless-sh/cli
|