@vibedrift/cli 0.3.1 → 0.3.2
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/LICENSE +1 -1
- package/README.md +2 -2
- package/dist/index.js +178 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -149,11 +149,11 @@ In short:
|
|
|
149
149
|
- No use to build competing products
|
|
150
150
|
- All rights reserved
|
|
151
151
|
|
|
152
|
-
For commercial licensing, partnerships, or enterprise terms: **sami@
|
|
152
|
+
For commercial licensing, partnerships, or enterprise terms: **sami.ahmadkhan12@gmail.com**
|
|
153
153
|
|
|
154
154
|
---
|
|
155
155
|
|
|
156
156
|
## Links
|
|
157
157
|
|
|
158
158
|
- **Website:** https://vibedrift.ai
|
|
159
|
-
- **Issues / Support:** sami@
|
|
159
|
+
- **Issues / Support:** sami.ahmadkhan12@gmail.com
|
package/dist/index.js
CHANGED
|
@@ -7972,6 +7972,21 @@ async function fetchUsage(token, opts) {
|
|
|
7972
7972
|
headers: { Authorization: `Bearer ${token}` }
|
|
7973
7973
|
});
|
|
7974
7974
|
}
|
|
7975
|
+
async function sendFeedback(args) {
|
|
7976
|
+
const base = await resolveApiUrl(args.apiUrl);
|
|
7977
|
+
const headers = {};
|
|
7978
|
+
if (args.token) headers.Authorization = `Bearer ${args.token}`;
|
|
7979
|
+
return jsonFetch(`${base}/v1/feedback/general`, {
|
|
7980
|
+
method: "POST",
|
|
7981
|
+
headers,
|
|
7982
|
+
body: JSON.stringify({
|
|
7983
|
+
source: args.source,
|
|
7984
|
+
message: args.message,
|
|
7985
|
+
email: args.email,
|
|
7986
|
+
metadata: args.metadata
|
|
7987
|
+
})
|
|
7988
|
+
});
|
|
7989
|
+
}
|
|
7975
7990
|
async function fetchCredits(token, opts) {
|
|
7976
7991
|
const base = await resolveApiUrl(opts?.apiUrl);
|
|
7977
7992
|
return jsonFetch(`${base}/account/credits`, {
|
|
@@ -8960,6 +8975,145 @@ function describeSource2(source) {
|
|
|
8960
8975
|
}
|
|
8961
8976
|
}
|
|
8962
8977
|
|
|
8978
|
+
// src/cli/commands/feedback.ts
|
|
8979
|
+
init_esm_shims();
|
|
8980
|
+
import os from "os";
|
|
8981
|
+
import readline from "readline";
|
|
8982
|
+
import chalk11 from "chalk";
|
|
8983
|
+
init_version();
|
|
8984
|
+
var MAX_MESSAGE_BYTES = 4096;
|
|
8985
|
+
async function runFeedback(opts = {}) {
|
|
8986
|
+
console.log("");
|
|
8987
|
+
console.log(chalk11.bold(" VibeDrift feedback"));
|
|
8988
|
+
console.log(
|
|
8989
|
+
chalk11.dim(" Tell us what's broken, what's confusing, or what you wish existed.")
|
|
8990
|
+
);
|
|
8991
|
+
console.log(
|
|
8992
|
+
chalk11.dim(" Goes straight to the maintainer \u2014 anonymous unless you're logged in.")
|
|
8993
|
+
);
|
|
8994
|
+
console.log("");
|
|
8995
|
+
let message = (opts.message ?? "").trim();
|
|
8996
|
+
if (!message) {
|
|
8997
|
+
message = await promptForMultilineMessage();
|
|
8998
|
+
}
|
|
8999
|
+
if (!message) {
|
|
9000
|
+
console.error(chalk11.red(" \u2717 No feedback provided. Aborting."));
|
|
9001
|
+
process.exit(1);
|
|
9002
|
+
}
|
|
9003
|
+
if (Buffer.byteLength(message, "utf8") > MAX_MESSAGE_BYTES) {
|
|
9004
|
+
console.error(
|
|
9005
|
+
chalk11.red(
|
|
9006
|
+
` \u2717 Message too long (max ${MAX_MESSAGE_BYTES} bytes). Please trim it or open an issue on GitHub for longer reports.`
|
|
9007
|
+
)
|
|
9008
|
+
);
|
|
9009
|
+
process.exit(1);
|
|
9010
|
+
}
|
|
9011
|
+
let token = null;
|
|
9012
|
+
try {
|
|
9013
|
+
const resolved = await resolveToken();
|
|
9014
|
+
if (resolved) token = resolved.token;
|
|
9015
|
+
} catch {
|
|
9016
|
+
}
|
|
9017
|
+
const metadata = {
|
|
9018
|
+
cli_version: getVersion(),
|
|
9019
|
+
node_version: process.version,
|
|
9020
|
+
platform: process.platform,
|
|
9021
|
+
arch: process.arch,
|
|
9022
|
+
os_release: os.release(),
|
|
9023
|
+
locale: process.env.LANG ?? null,
|
|
9024
|
+
tty: process.stdin.isTTY === true
|
|
9025
|
+
};
|
|
9026
|
+
process.stdout.write(chalk11.dim(" Sending... "));
|
|
9027
|
+
try {
|
|
9028
|
+
const result = await sendFeedback({
|
|
9029
|
+
source: "cli",
|
|
9030
|
+
message,
|
|
9031
|
+
token: token ?? void 0,
|
|
9032
|
+
metadata,
|
|
9033
|
+
apiUrl: await resolveApiUrl(opts.apiUrl)
|
|
9034
|
+
});
|
|
9035
|
+
console.log(chalk11.green("ok"));
|
|
9036
|
+
console.log("");
|
|
9037
|
+
console.log(` ${chalk11.dim("Reference:")} ${chalk11.dim(result.id)}`);
|
|
9038
|
+
if (token) {
|
|
9039
|
+
console.log(
|
|
9040
|
+
chalk11.dim(
|
|
9041
|
+
" Submitted under your account \u2014 we'll reply to your email if needed."
|
|
9042
|
+
)
|
|
9043
|
+
);
|
|
9044
|
+
} else {
|
|
9045
|
+
console.log(
|
|
9046
|
+
chalk11.dim(
|
|
9047
|
+
" Submitted anonymously. If you'd like a reply, run `vibedrift login` first."
|
|
9048
|
+
)
|
|
9049
|
+
);
|
|
9050
|
+
}
|
|
9051
|
+
console.log("");
|
|
9052
|
+
console.log(chalk11.green(" \u2713 Thanks for helping us improve VibeDrift."));
|
|
9053
|
+
console.log("");
|
|
9054
|
+
} catch (err) {
|
|
9055
|
+
console.log(chalk11.red("failed"));
|
|
9056
|
+
console.log("");
|
|
9057
|
+
if (err instanceof VibeDriftApiError) {
|
|
9058
|
+
console.error(chalk11.red(` \u2717 ${err.message}`));
|
|
9059
|
+
} else {
|
|
9060
|
+
console.error(
|
|
9061
|
+
chalk11.red(` \u2717 ${err instanceof Error ? err.message : String(err)}`)
|
|
9062
|
+
);
|
|
9063
|
+
}
|
|
9064
|
+
console.error(
|
|
9065
|
+
chalk11.dim(
|
|
9066
|
+
" You can also email sami.ahmadkhan12@gmail.com directly."
|
|
9067
|
+
)
|
|
9068
|
+
);
|
|
9069
|
+
console.log("");
|
|
9070
|
+
process.exit(1);
|
|
9071
|
+
}
|
|
9072
|
+
}
|
|
9073
|
+
function promptForMultilineMessage() {
|
|
9074
|
+
return new Promise((resolve2) => {
|
|
9075
|
+
if (!process.stdin.isTTY) {
|
|
9076
|
+
let buf = "";
|
|
9077
|
+
process.stdin.setEncoding("utf8");
|
|
9078
|
+
process.stdin.on("data", (chunk) => {
|
|
9079
|
+
buf += chunk;
|
|
9080
|
+
});
|
|
9081
|
+
process.stdin.on("end", () => resolve2(buf.trim()));
|
|
9082
|
+
return;
|
|
9083
|
+
}
|
|
9084
|
+
console.log(
|
|
9085
|
+
chalk11.dim(
|
|
9086
|
+
" Type your feedback below. Submit with a single line containing 'EOF',"
|
|
9087
|
+
)
|
|
9088
|
+
);
|
|
9089
|
+
console.log(chalk11.dim(" or press Ctrl-D when done. Press Ctrl-C to abort."));
|
|
9090
|
+
console.log("");
|
|
9091
|
+
const rl = readline.createInterface({
|
|
9092
|
+
input: process.stdin,
|
|
9093
|
+
output: process.stdout,
|
|
9094
|
+
prompt: chalk11.yellow(" > ")
|
|
9095
|
+
});
|
|
9096
|
+
const lines = [];
|
|
9097
|
+
rl.prompt();
|
|
9098
|
+
rl.on("line", (line) => {
|
|
9099
|
+
if (line.trim() === "EOF") {
|
|
9100
|
+
rl.close();
|
|
9101
|
+
return;
|
|
9102
|
+
}
|
|
9103
|
+
lines.push(line);
|
|
9104
|
+
rl.prompt();
|
|
9105
|
+
});
|
|
9106
|
+
rl.on("close", () => {
|
|
9107
|
+
console.log("");
|
|
9108
|
+
resolve2(lines.join("\n").trim());
|
|
9109
|
+
});
|
|
9110
|
+
rl.on("SIGINT", () => {
|
|
9111
|
+
console.log(chalk11.red("\n \u2717 Aborted."));
|
|
9112
|
+
process.exit(1);
|
|
9113
|
+
});
|
|
9114
|
+
});
|
|
9115
|
+
}
|
|
9116
|
+
|
|
8963
9117
|
// src/cli/index.ts
|
|
8964
9118
|
init_version();
|
|
8965
9119
|
var VERSION = getVersion();
|
|
@@ -9007,6 +9161,9 @@ program.command("scan", { isDefault: true }).description("Scan a project for vib
|
|
|
9007
9161
|
).option(
|
|
9008
9162
|
"--update",
|
|
9009
9163
|
"update the VibeDrift CLI to the latest version (alias for `vibedrift update`)"
|
|
9164
|
+
).option(
|
|
9165
|
+
"--feedback [message...]",
|
|
9166
|
+
"send feedback to the maintainer (alias for `vibedrift feedback`)"
|
|
9010
9167
|
).option("--verbose", "show timing breakdown and analyzer details").addOption(
|
|
9011
9168
|
new Option("--api-url <url>", "override the VibeDrift API base URL").hideHelp()
|
|
9012
9169
|
).action(async (path2, options) => {
|
|
@@ -9014,6 +9171,14 @@ program.command("scan", { isDefault: true }).description("Scan a project for vib
|
|
|
9014
9171
|
await runUpdate(VERSION);
|
|
9015
9172
|
return;
|
|
9016
9173
|
}
|
|
9174
|
+
if (options.feedback) {
|
|
9175
|
+
const inline = Array.isArray(options.feedback) ? options.feedback.join(" ").trim() : "";
|
|
9176
|
+
await runFeedback({
|
|
9177
|
+
message: inline || void 0,
|
|
9178
|
+
apiUrl: options.apiUrl
|
|
9179
|
+
});
|
|
9180
|
+
return;
|
|
9181
|
+
}
|
|
9017
9182
|
await runScan(path2, {
|
|
9018
9183
|
json: options.json,
|
|
9019
9184
|
format: options.json ? "json" : options.format,
|
|
@@ -9057,6 +9222,15 @@ program.command("doctor").description("Diagnose CLI installation, auth, and API
|
|
|
9057
9222
|
program.command("update").description("Update the VibeDrift CLI to the latest version").action(async () => {
|
|
9058
9223
|
await runUpdate(VERSION);
|
|
9059
9224
|
});
|
|
9225
|
+
program.command("feedback").description("Send feedback, bug reports, or feature requests directly to the maintainer").argument(
|
|
9226
|
+
"[message...]",
|
|
9227
|
+
"feedback text (omit to be prompted interactively)"
|
|
9228
|
+
).addOption(
|
|
9229
|
+
new Option("--api-url <url>", "override the API base URL").hideHelp()
|
|
9230
|
+
).action(async (messageWords, options) => {
|
|
9231
|
+
const message = (messageWords ?? []).join(" ").trim() || void 0;
|
|
9232
|
+
await runFeedback({ message, apiUrl: options.apiUrl });
|
|
9233
|
+
});
|
|
9060
9234
|
program.addHelpText(
|
|
9061
9235
|
"after",
|
|
9062
9236
|
`
|
|
@@ -9075,6 +9249,10 @@ Examples:
|
|
|
9075
9249
|
$ vibedrift upgrade open the pricing page
|
|
9076
9250
|
$ vibedrift billing manage your Stripe subscription
|
|
9077
9251
|
$ vibedrift update update to the latest CLI version
|
|
9252
|
+
$ vibedrift feedback open an interactive feedback prompt
|
|
9253
|
+
$ vibedrift feedback "the install is broken on Windows"
|
|
9254
|
+
send inline feedback in one shot
|
|
9255
|
+
$ vibedrift --feedback "..." same as above, top-level shortcut
|
|
9078
9256
|
|
|
9079
9257
|
Environment:
|
|
9080
9258
|
VIBEDRIFT_TOKEN bearer token (overrides ~/.vibedrift/config.json)
|