@driftless-sh/cli 0.1.20 → 0.1.21
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 +64 -54
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -126140,7 +126140,7 @@ ${lanes.join("\n")}
|
|
|
126140
126140
|
}
|
|
126141
126141
|
}
|
|
126142
126142
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
126143
|
-
const
|
|
126143
|
+
const resolve8 = factory2.createUniqueName("resolve");
|
|
126144
126144
|
const reject = factory2.createUniqueName("reject");
|
|
126145
126145
|
const parameters = [
|
|
126146
126146
|
factory2.createParameterDeclaration(
|
|
@@ -126149,7 +126149,7 @@ ${lanes.join("\n")}
|
|
|
126149
126149
|
/*dotDotDotToken*/
|
|
126150
126150
|
void 0,
|
|
126151
126151
|
/*name*/
|
|
126152
|
-
|
|
126152
|
+
resolve8
|
|
126153
126153
|
),
|
|
126154
126154
|
factory2.createParameterDeclaration(
|
|
126155
126155
|
/*modifiers*/
|
|
@@ -126166,7 +126166,7 @@ ${lanes.join("\n")}
|
|
|
126166
126166
|
factory2.createIdentifier("require"),
|
|
126167
126167
|
/*typeArguments*/
|
|
126168
126168
|
void 0,
|
|
126169
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
126169
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve8, reject]
|
|
126170
126170
|
)
|
|
126171
126171
|
)
|
|
126172
126172
|
]);
|
|
@@ -212884,8 +212884,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
212884
212884
|
installPackage(options) {
|
|
212885
212885
|
this.packageInstallId++;
|
|
212886
212886
|
const request2 = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
212887
|
-
const promise = new Promise((
|
|
212888
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
212887
|
+
const promise = new Promise((resolve8, reject) => {
|
|
212888
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve8, reject });
|
|
212889
212889
|
});
|
|
212890
212890
|
this.installer.send(request2);
|
|
212891
212891
|
return promise;
|
|
@@ -214266,7 +214266,7 @@ function parseError(e) {
|
|
|
214266
214266
|
return msg;
|
|
214267
214267
|
}
|
|
214268
214268
|
function request(method, path, body) {
|
|
214269
|
-
return new Promise((
|
|
214269
|
+
return new Promise((resolve8, reject) => {
|
|
214270
214270
|
const baseUrl = getBaseUrl();
|
|
214271
214271
|
const fullUrl = `${baseUrl}${path}`;
|
|
214272
214272
|
const url = new URL(fullUrl);
|
|
@@ -214292,9 +214292,9 @@ function request(method, path, body) {
|
|
|
214292
214292
|
return;
|
|
214293
214293
|
}
|
|
214294
214294
|
try {
|
|
214295
|
-
|
|
214295
|
+
resolve8(JSON.parse(data));
|
|
214296
214296
|
} catch {
|
|
214297
|
-
|
|
214297
|
+
resolve8(data);
|
|
214298
214298
|
}
|
|
214299
214299
|
});
|
|
214300
214300
|
}
|
|
@@ -214933,7 +214933,7 @@ async function scanCommand(args) {
|
|
|
214933
214933
|
process.exit(0);
|
|
214934
214934
|
}
|
|
214935
214935
|
console.log(`
|
|
214936
|
-
${result.violations.length} violation(s) found:
|
|
214936
|
+
${result.violations.length} violation(s) found (${rulesEvaluated} rule(s) evaluated):
|
|
214937
214937
|
`);
|
|
214938
214938
|
for (const v of result.violations) {
|
|
214939
214939
|
const severityColor = v.severity === "critical" || v.severity === "high" ? "\x1B[31m" : "\x1B[33m";
|
|
@@ -214948,6 +214948,8 @@ ${result.violations.length} violation(s) found:
|
|
|
214948
214948
|
}
|
|
214949
214949
|
|
|
214950
214950
|
// src/commands/context.ts
|
|
214951
|
+
var import_node_fs4 = require("node:fs");
|
|
214952
|
+
var import_node_path4 = require("node:path");
|
|
214951
214953
|
function parseArgs(args) {
|
|
214952
214954
|
const flags = {};
|
|
214953
214955
|
const positional = [];
|
|
@@ -215130,12 +215132,11 @@ async function contextCommand(args) {
|
|
|
215130
215132
|
const qs = query.length > 0 ? `?${query.join("&")}` : "";
|
|
215131
215133
|
try {
|
|
215132
215134
|
const summaries = await api.get(`/workspaces/${workspaceSlug}/watchers${qs}`);
|
|
215135
|
+
if (summaries.length === 0) {
|
|
215136
|
+
console.error("No context topics yet. Run `driftless init` to auto-generate watchers from your codebase.");
|
|
215137
|
+
}
|
|
215133
215138
|
if (isHuman) {
|
|
215134
|
-
|
|
215135
|
-
console.log("No context topics yet. Run `driftless init` to auto-generate watchers from your codebase.");
|
|
215136
|
-
} else {
|
|
215137
|
-
renderSummaryHuman(summaries);
|
|
215138
|
-
}
|
|
215139
|
+
renderSummaryHuman(summaries);
|
|
215139
215140
|
} else {
|
|
215140
215141
|
emitJSON(summaries);
|
|
215141
215142
|
}
|
|
@@ -215173,12 +215174,11 @@ async function contextCommand(args) {
|
|
|
215173
215174
|
`/workspaces/${workspaceSlug}/watchers/match-files`,
|
|
215174
215175
|
{ files }
|
|
215175
215176
|
);
|
|
215177
|
+
if (results.length === 0) {
|
|
215178
|
+
console.error(`No context topics match these files. No watcher covers the changed paths.`);
|
|
215179
|
+
}
|
|
215176
215180
|
if (isHuman) {
|
|
215177
|
-
|
|
215178
|
-
console.log(`No context topics match these files. No watcher covers the changed paths.`);
|
|
215179
|
-
} else {
|
|
215180
|
-
renderMatchFilesHuman(results, files);
|
|
215181
|
-
}
|
|
215181
|
+
renderMatchFilesHuman(results, files);
|
|
215182
215182
|
} else {
|
|
215183
215183
|
emitJSON(results);
|
|
215184
215184
|
}
|
|
@@ -215199,7 +215199,11 @@ async function contextCommand(args) {
|
|
|
215199
215199
|
if (isHuman) {
|
|
215200
215200
|
renderContextHuman(ctx);
|
|
215201
215201
|
} else {
|
|
215202
|
-
|
|
215202
|
+
const sanitized = JSON.parse(JSON.stringify(ctx, (_key, value) => {
|
|
215203
|
+
if (typeof value === "string" && value.length > 500) return value.slice(0, 500) + "\u2026";
|
|
215204
|
+
return value;
|
|
215205
|
+
}));
|
|
215206
|
+
emitJSON(sanitized);
|
|
215203
215207
|
}
|
|
215204
215208
|
} catch (e) {
|
|
215205
215209
|
console.error(`Topic '${slug}' not found.`);
|
|
@@ -215217,12 +215221,11 @@ async function contextCommand(args) {
|
|
|
215217
215221
|
const results = await api.get(
|
|
215218
215222
|
`/workspaces/${workspaceSlug}/watchers/search?q=${encodeURIComponent(query)}`
|
|
215219
215223
|
);
|
|
215224
|
+
if (results.length === 0) {
|
|
215225
|
+
console.error(`No context topics matching "${query}".`);
|
|
215226
|
+
}
|
|
215220
215227
|
if (isHuman) {
|
|
215221
|
-
|
|
215222
|
-
console.log(`No context topics matching "${query}".`);
|
|
215223
|
-
} else {
|
|
215224
|
-
renderSummaryHuman(results);
|
|
215225
|
-
}
|
|
215228
|
+
renderSummaryHuman(results);
|
|
215226
215229
|
} else {
|
|
215227
215230
|
emitJSON(results);
|
|
215228
215231
|
}
|
|
@@ -215401,10 +215404,14 @@ async function contextCommand(args) {
|
|
|
215401
215404
|
if (filesFlag) console.log(` files: ${filesFlag}`);
|
|
215402
215405
|
if (patternFlag) console.log(` pattern: ${patternFlag}`);
|
|
215403
215406
|
} else {
|
|
215404
|
-
|
|
215407
|
+
const sanitized = JSON.parse(JSON.stringify(result, (_key, value) => {
|
|
215408
|
+
if (typeof value === "string" && value.length > 500) return value.slice(0, 500) + "\u2026";
|
|
215409
|
+
return value;
|
|
215410
|
+
}));
|
|
215411
|
+
emitJSON(sanitized);
|
|
215405
215412
|
}
|
|
215406
215413
|
} catch (e) {
|
|
215407
|
-
console.error(`Anchor failed: ${e
|
|
215414
|
+
console.error(`Anchor failed: ${formatError(e)}`);
|
|
215408
215415
|
process.exit(1);
|
|
215409
215416
|
}
|
|
215410
215417
|
return;
|
|
@@ -215420,17 +215427,20 @@ async function contextCommand(args) {
|
|
|
215420
215427
|
console.error("No files provided.");
|
|
215421
215428
|
process.exit(1);
|
|
215422
215429
|
}
|
|
215430
|
+
const missingFiles = files.filter((f) => !(0, import_node_fs4.existsSync)((0, import_node_path4.resolve)(process.cwd(), f)));
|
|
215431
|
+
if (missingFiles.length > 0 && isHuman) {
|
|
215432
|
+
console.error(`File(s) not found locally: ${missingFiles.join(", ")}. Matching by pattern only.`);
|
|
215433
|
+
}
|
|
215423
215434
|
try {
|
|
215424
215435
|
const results = await api.post(
|
|
215425
215436
|
`/workspaces/${workspaceSlug}/watchers/match-files`,
|
|
215426
215437
|
{ files }
|
|
215427
215438
|
);
|
|
215439
|
+
if (results.length === 0) {
|
|
215440
|
+
console.error(`No context topics match these files. No watcher covers the changed paths.`);
|
|
215441
|
+
}
|
|
215428
215442
|
if (isHuman) {
|
|
215429
|
-
|
|
215430
|
-
console.log(`No context topics match these files. No watcher covers the changed paths.`);
|
|
215431
|
-
} else {
|
|
215432
|
-
renderMatchFilesHuman(results, files);
|
|
215433
|
-
}
|
|
215443
|
+
renderMatchFilesHuman(results, files);
|
|
215434
215444
|
} else {
|
|
215435
215445
|
emitJSON(results);
|
|
215436
215446
|
}
|
|
@@ -215446,8 +215456,8 @@ Run 'driftless help context' for full reference.`);
|
|
|
215446
215456
|
}
|
|
215447
215457
|
|
|
215448
215458
|
// src/commands/install-skill.ts
|
|
215449
|
-
var
|
|
215450
|
-
var
|
|
215459
|
+
var import_node_fs5 = require("node:fs");
|
|
215460
|
+
var import_node_path5 = require("node:path");
|
|
215451
215461
|
var template = `# Driftless \u2014 Live Repo Context
|
|
215452
215462
|
|
|
215453
215463
|
Driftless Cloud holds the team's living codebase context (topics, anchors, rules, gotchas).
|
|
@@ -215573,29 +215583,29 @@ Context delivery + structural verification only.
|
|
|
215573
215583
|
`;
|
|
215574
215584
|
function installSkillCommand() {
|
|
215575
215585
|
const cwd = process.cwd();
|
|
215576
|
-
const agentsPath = (0,
|
|
215577
|
-
if ((0,
|
|
215578
|
-
const existing = (0,
|
|
215586
|
+
const agentsPath = (0, import_node_path5.resolve)(cwd, "AGENTS.md");
|
|
215587
|
+
if ((0, import_node_fs5.existsSync)(agentsPath)) {
|
|
215588
|
+
const existing = (0, import_node_fs5.readFileSync)(agentsPath, "utf8");
|
|
215579
215589
|
if (existing.includes("# Driftless")) {
|
|
215580
215590
|
console.log("Driftless section already present in AGENTS.md.");
|
|
215581
215591
|
return;
|
|
215582
215592
|
}
|
|
215583
|
-
(0,
|
|
215593
|
+
(0, import_node_fs5.writeFileSync)(agentsPath, existing + "\n---\n\n" + template);
|
|
215584
215594
|
console.log(`Appended Driftless section to ${agentsPath}`);
|
|
215585
215595
|
} else {
|
|
215586
|
-
(0,
|
|
215596
|
+
(0, import_node_fs5.writeFileSync)(agentsPath, template);
|
|
215587
215597
|
console.log(`Driftless skill installed at ${agentsPath}`);
|
|
215588
215598
|
}
|
|
215589
215599
|
}
|
|
215590
215600
|
|
|
215591
215601
|
// src/commands/login.ts
|
|
215592
|
-
var
|
|
215593
|
-
var
|
|
215602
|
+
var import_node_fs6 = require("node:fs");
|
|
215603
|
+
var import_node_path6 = require("node:path");
|
|
215594
215604
|
var import_node_readline = require("node:readline");
|
|
215595
215605
|
var import_node_child_process2 = require("node:child_process");
|
|
215596
215606
|
var import_node_os2 = require("node:os");
|
|
215597
|
-
var CONFIG_DIR = (0,
|
|
215598
|
-
var CONFIG_PATH2 = (0,
|
|
215607
|
+
var CONFIG_DIR = (0, import_node_path6.resolve)((0, import_node_os2.homedir)(), ".driftless");
|
|
215608
|
+
var CONFIG_PATH2 = (0, import_node_path6.resolve)(CONFIG_DIR, "config.json");
|
|
215599
215609
|
function openBrowser(url) {
|
|
215600
215610
|
const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
|
|
215601
215611
|
(0, import_node_child_process2.exec)(`${cmd} ${url}`);
|
|
@@ -215624,10 +215634,10 @@ async function loginCommand(args) {
|
|
|
215624
215634
|
input: process.stdin,
|
|
215625
215635
|
output: process.stdout
|
|
215626
215636
|
});
|
|
215627
|
-
const apiKey = await new Promise((
|
|
215637
|
+
const apiKey = await new Promise((resolve8) => {
|
|
215628
215638
|
rl.question("Paste your API key: ", (answer) => {
|
|
215629
215639
|
rl.close();
|
|
215630
|
-
|
|
215640
|
+
resolve8(answer.trim());
|
|
215631
215641
|
});
|
|
215632
215642
|
});
|
|
215633
215643
|
if (!apiKey.startsWith("drift_")) {
|
|
@@ -215640,10 +215650,10 @@ async function loginCommand(args) {
|
|
|
215640
215650
|
function saveConfig(apiKey, apiUrl) {
|
|
215641
215651
|
const url = apiUrl || "https://api.driftless.icu/api/v1";
|
|
215642
215652
|
try {
|
|
215643
|
-
if (!(0,
|
|
215644
|
-
(0,
|
|
215653
|
+
if (!(0, import_node_fs6.existsSync)(CONFIG_DIR)) {
|
|
215654
|
+
(0, import_node_fs6.mkdirSync)(CONFIG_DIR, { recursive: true });
|
|
215645
215655
|
}
|
|
215646
|
-
(0,
|
|
215656
|
+
(0, import_node_fs6.writeFileSync)(
|
|
215647
215657
|
CONFIG_PATH2,
|
|
215648
215658
|
JSON.stringify({ api_key: apiKey, api_url: url }, null, 2) + "\n"
|
|
215649
215659
|
);
|
|
@@ -215659,8 +215669,8 @@ function saveConfig(apiKey, apiUrl) {
|
|
|
215659
215669
|
}
|
|
215660
215670
|
|
|
215661
215671
|
// src/commands/doctor.ts
|
|
215662
|
-
var
|
|
215663
|
-
var
|
|
215672
|
+
var import_node_fs7 = require("node:fs");
|
|
215673
|
+
var import_node_path7 = require("node:path");
|
|
215664
215674
|
async function doctorCommand() {
|
|
215665
215675
|
const checks = [];
|
|
215666
215676
|
const apiKey = getApiKey();
|
|
@@ -215746,9 +215756,9 @@ async function doctorCommand() {
|
|
|
215746
215756
|
} else {
|
|
215747
215757
|
checks.push({ name: "Baseline", status: "warn", detail: "Skipped (no git remote)" });
|
|
215748
215758
|
}
|
|
215749
|
-
const agentsPath = (0,
|
|
215750
|
-
if ((0,
|
|
215751
|
-
const content = (0,
|
|
215759
|
+
const agentsPath = (0, import_node_path7.resolve)(process.cwd(), "AGENTS.md");
|
|
215760
|
+
if ((0, import_node_fs7.existsSync)(agentsPath)) {
|
|
215761
|
+
const content = (0, import_node_fs7.readFileSync)(agentsPath, "utf-8");
|
|
215752
215762
|
if (content.includes("driftless")) {
|
|
215753
215763
|
checks.push({ name: "AGENTS.md", status: "ok", detail: "Driftless skill installed" });
|
|
215754
215764
|
} else {
|
|
@@ -215803,7 +215813,7 @@ function pad2(s, n) {
|
|
|
215803
215813
|
}
|
|
215804
215814
|
|
|
215805
215815
|
// src/index.ts
|
|
215806
|
-
var VERSION = "0.1.
|
|
215816
|
+
var VERSION = "0.1.21";
|
|
215807
215817
|
var HELP_TEXT = `Driftless CLI v${VERSION} \u2014 Context integrity for AI engineering teams
|
|
215808
215818
|
|
|
215809
215819
|
Install: npm install -g @driftless-sh/cli
|