@vatio-ai/cli 0.44.0 → 0.45.0
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/lib/commands/support-commands.mjs +34 -1
- package/lib/help.mjs +1 -0
- package/package.json +1 -1
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
5
|
import { dirname, resolve } from "node:path";
|
|
6
6
|
|
|
7
|
+
import { buildBundle } from "../bundle.mjs";
|
|
7
8
|
import { HttpClient } from "../http.mjs";
|
|
8
9
|
import { VERSION } from "../version.mjs";
|
|
9
10
|
import { fail, takeFlag, takeValue } from "../support.mjs";
|
|
11
|
+
import { findWorkspaceRoot } from "../workspace.mjs";
|
|
10
12
|
import { DOCS_URL } from "./misc.mjs";
|
|
11
13
|
|
|
12
14
|
// The whole developer contract as markdown, live from the platform. Fetched
|
|
@@ -50,6 +52,9 @@ function issuesClient(config) {
|
|
|
50
52
|
// `vatio issue` is a change worth making, written against a template the
|
|
51
53
|
// platform also validates against. It is not an issue tracker: there are no
|
|
52
54
|
// states, labels, assignees or backlog, and that is on purpose.
|
|
55
|
+
//
|
|
56
|
+
// Sent from a workspace, it carries the workspace -- see workspaceSource
|
|
57
|
+
// below, and `--no-source` to send the sentence alone.
|
|
53
58
|
export async function issue(config, args) {
|
|
54
59
|
const sub = args[0];
|
|
55
60
|
if (sub === "list") return await issueList(config);
|
|
@@ -58,6 +63,7 @@ export async function issue(config, args) {
|
|
|
58
63
|
|
|
59
64
|
if (takeFlag(args, "--template")) return await issueTemplate(config);
|
|
60
65
|
|
|
66
|
+
const withoutSource = takeFlag(args, "--no-source");
|
|
61
67
|
const file = takeValue(args, "--file");
|
|
62
68
|
const workspace = takeValue(args, "--workspace") ?? safeWorkspace(config);
|
|
63
69
|
|
|
@@ -67,6 +73,14 @@ export async function issue(config, args) {
|
|
|
67
73
|
|
|
68
74
|
const body = { cli_version: VERSION };
|
|
69
75
|
if (workspace) body.workspace = workspace;
|
|
76
|
+
|
|
77
|
+
const source = withoutSource ? null : workspaceSource();
|
|
78
|
+
if (source?.files) {
|
|
79
|
+
body.files = source.files;
|
|
80
|
+
console.log(`Attaching ${source.root} — ${source.files.length} files, the same ones \`vatio push\` sends.`);
|
|
81
|
+
} else if (source?.error) {
|
|
82
|
+
console.log(`Not attaching your workspace: ${source.error}`);
|
|
83
|
+
}
|
|
70
84
|
if (file) {
|
|
71
85
|
body.markdown = readFileSync(file, "utf8");
|
|
72
86
|
} else {
|
|
@@ -75,7 +89,8 @@ export async function issue(config, args) {
|
|
|
75
89
|
fail(
|
|
76
90
|
"Usage: vatio issue \"what should change\"\n" +
|
|
77
91
|
" vatio issue --file ISSUE.md\n" +
|
|
78
|
-
" vatio issue --template
|
|
92
|
+
" vatio issue --template # the shape it is read against\n" +
|
|
93
|
+
" vatio issue --no-source # without your workspace attached"
|
|
79
94
|
);
|
|
80
95
|
}
|
|
81
96
|
body.message = message;
|
|
@@ -160,6 +175,24 @@ async function issueComment(config, id, rest) {
|
|
|
160
175
|
console.log(`Replied on issue ${id}.`);
|
|
161
176
|
}
|
|
162
177
|
|
|
178
|
+
// The directory the issue was typed in, sent whole -- the same bundle `check`
|
|
179
|
+
// and `push` send, because which files matter is the platform's contract and
|
|
180
|
+
// this client does not get a second answer to it.
|
|
181
|
+
//
|
|
182
|
+
// Nothing here can stop an issue from being sent: a directory that is not a
|
|
183
|
+
// workspace, or one too large to bundle, travels without its source. The call
|
|
184
|
+
// site says so out loud, since a developer is entitled to know what left their
|
|
185
|
+
// machine, and `--no-source` declines in advance.
|
|
186
|
+
function workspaceSource() {
|
|
187
|
+
try {
|
|
188
|
+
const root = findWorkspaceRoot(process.cwd());
|
|
189
|
+
if (!root) return null;
|
|
190
|
+
return { root, files: buildBundle(root) };
|
|
191
|
+
} catch (error) {
|
|
192
|
+
return { error: error.message };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
163
196
|
// A workspace is useful context on an issue but never required: `vatio issue`
|
|
164
197
|
// has to work from anywhere, including a directory that is not a workspace.
|
|
165
198
|
function safeWorkspace(config) {
|
package/lib/help.mjs
CHANGED
|
@@ -61,6 +61,7 @@ flag, the directory decides.
|
|
|
61
61
|
|
|
62
62
|
Everything else:
|
|
63
63
|
issue "what should change"|list|show ID|comment ID "reply"|--template
|
|
64
|
+
Sends your workspace along; --no-source to not
|
|
64
65
|
mcp Speak MCP over stdio, for a coding agent
|
|
65
66
|
config show|get KEY|set KEY VALUE|unset KEY
|
|
66
67
|
Keys: base_url, token
|