@nodii/dev 0.4.0 → 0.5.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/README.md +36 -30
- package/dist/api.js +10 -9
- package/dist/cli.js +585 -0
- package/dist/core.js +58 -206
- package/dist/devops-openapi.json +1 -0
- package/dist/hooks.js +4 -4
- package/dist/lanes.js +7 -7
- package/dist/nodii-dev.js +2 -624
- package/dist/oauth.js +1 -1
- package/dist/setup.js +7 -7
- package/package.json +4 -4
package/dist/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CliError,
|
|
1
|
+
import { CliError, devRequest } from "./core.js";
|
|
2
2
|
import { execFile } from "node:child_process";
|
|
3
3
|
import { promisify } from "node:util";
|
|
4
4
|
|
|
@@ -73,7 +73,7 @@ export function extractNodeIds(value, out = new Set()) {
|
|
|
73
73
|
return [...out];
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export async function preHook(payload, request =
|
|
76
|
+
export async function preHook(payload, request = devRequest) {
|
|
77
77
|
const name = payload.tool_name ?? "";
|
|
78
78
|
if (!isFigmaTool(name) || isReadTool(name))
|
|
79
79
|
return { allowed: true, ignored: true };
|
|
@@ -109,7 +109,7 @@ export async function preHook(payload, request = hubRequest) {
|
|
|
109
109
|
return { allowed: true, fileKey, changeSetId: response.data.changeSetId };
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
export async function postHook(payload, request =
|
|
112
|
+
export async function postHook(payload, request = devRequest) {
|
|
113
113
|
const name = payload.tool_name ?? "";
|
|
114
114
|
if (!isFigmaTool(name) || isReadTool(name))
|
|
115
115
|
return { logged: false, ignored: true };
|
|
@@ -156,7 +156,7 @@ export const settingsSnippet = () => ({
|
|
|
156
156
|
},
|
|
157
157
|
});
|
|
158
158
|
|
|
159
|
-
export async function heartbeatCurrentLane(request =
|
|
159
|
+
export async function heartbeatCurrentLane(request = devRequest) {
|
|
160
160
|
let branch;
|
|
161
161
|
try { branch = (await execFileAsync("git", ["branch", "--show-current"], { encoding: "utf8" })).stdout.trim(); }
|
|
162
162
|
catch { return { heartbeated: false, reason: "not a git worktree" }; }
|
package/dist/lanes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
2
|
import { promisify } from "node:util";
|
|
3
|
-
import { CliError, encode,
|
|
3
|
+
import { CliError, encode, devRequest, query, readConfig, requireFlag } from "./core.js";
|
|
4
4
|
|
|
5
5
|
const execFileAsync = promisify(execFile);
|
|
6
6
|
const via = { via: "nodii-dev" };
|
|
@@ -42,7 +42,7 @@ function evidence(flags) {
|
|
|
42
42
|
return { kind: flag === "figma" ? "figma_frame" : flag.replace("-", "_"), ...(URL.canParse(value) ? { url: value } : { ref: value }), ...via };
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export async function laneCommand(action, args, flags, { request =
|
|
45
|
+
export async function laneCommand(action, args, flags, { request = devRequest, config = readConfig, gitContext = inferGitContext } = {}) {
|
|
46
46
|
if (action === "list") {
|
|
47
47
|
const c = flags.mine ? await config() : null;
|
|
48
48
|
const payload = await request("GET", `/api/v1/lanes${query({ kind: flags.kind, status: flags.status, machine: flags.machine, agent: flags.mine ? c.agentId : flags.agent, "waiting-on": flags["waiting-on"], stuck: flags.stuck, cursor: flags.cursor, limit: flags.limit })}`);
|
|
@@ -105,7 +105,7 @@ export async function laneCommand(action, args, flags, { request = hubRequest, c
|
|
|
105
105
|
throw new CliError("USAGE", `Unknown lane action: ${action}`, 2);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export async function nextCommand(ref, flags, { request =
|
|
108
|
+
export async function nextCommand(ref, flags, { request = devRequest } = {}) {
|
|
109
109
|
const lane = (await request("GET", `/api/v1/lanes/${encode(ref)}`)).data;
|
|
110
110
|
const pending = lane.steps.filter((x) => ["waiting", "current", "blocked"].includes(x.state)).sort((a, b) => a.position - b.position);
|
|
111
111
|
const steps = ["backend", "frontend"].map((side) => pending.find((x) => x.side === side)).filter(Boolean);
|
|
@@ -113,7 +113,7 @@ export async function nextCommand(ref, flags, { request = hubRequest } = {}) {
|
|
|
113
113
|
return { payload: { data }, human: data.length ? data.map((x) => `${x.side}: ${x.label}\n ${x.command}`).join("\n") : `All workflow steps are complete. Run: nodii-dev lane land ${lane.key}` };
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
export async function builtCommand(action, args, flags, { request =
|
|
116
|
+
export async function builtCommand(action, args, flags, { request = devRequest } = {}) {
|
|
117
117
|
if (action === "list") {
|
|
118
118
|
const payload = await request("GET", `/api/v1/built${query({ cursor: flags.cursor, limit: flags.limit, includeAcknowledged: flags["include-acknowledged"] })}`);
|
|
119
119
|
return { payload, human: (p) => p.data.map(laneLine).join("\n") || "No built lanes awaiting acknowledgement." };
|
|
@@ -126,7 +126,7 @@ export async function builtCommand(action, args, flags, { request = hubRequest }
|
|
|
126
126
|
throw new CliError("USAGE", `Unknown built action: ${action}`, 2);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export async function machineCommand(action, args, flags, { request =
|
|
129
|
+
export async function machineCommand(action, args, flags, { request = devRequest } = {}) {
|
|
130
130
|
if (action === "list") return { payload: await request("GET", "/api/v1/machines"), human: (p) => p.data.map((x) => `${x.id}\t${x.name}\tcoordinator=${x.coordinatorAgentId}`).join("\n") || "No machines." };
|
|
131
131
|
const id = need(args[0], `machine ${action} needs <machine>`);
|
|
132
132
|
if (action === "show") return { payload: await request("GET", `/api/v1/machines/${encode(id)}`) };
|
|
@@ -136,7 +136,7 @@ export async function machineCommand(action, args, flags, { request = hubRequest
|
|
|
136
136
|
throw new CliError("USAGE", `Unknown machine action: ${action}`, 2);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
export async function peopleCommand(action, args, flags, { request =
|
|
139
|
+
export async function peopleCommand(action, args, flags, { request = devRequest } = {}) {
|
|
140
140
|
if (action === "reveal") {
|
|
141
141
|
const id = need(args[0], "people reveal needs <person>");
|
|
142
142
|
return { payload: await request("POST", `/api/v1/people/${encode(id)}/reveal-name`, { reason: requireFlag(flags, "reason") }), human: (p) => p.data.value ?? p.data.hint ?? "Name unavailable." };
|
|
@@ -145,7 +145,7 @@ export async function peopleCommand(action, args, flags, { request = hubRequest
|
|
|
145
145
|
throw new CliError("USAGE", `Unknown people action: ${action}`, 2);
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
-
export async function agentWorkflowCommand(action, args, flags, { request =
|
|
148
|
+
export async function agentWorkflowCommand(action, args, flags, { request = devRequest } = {}) {
|
|
149
149
|
const agent = need(args[0], `agent ${action} needs <agent>`);
|
|
150
150
|
if (action === "lane-limit") return { payload: await request("PUT", `/api/v1/agents/${encode(agent)}/lane-limit`, { laneLimit: Number(need(args[1], "agent lane-limit needs <agent> <n>")) }), human: "Lane limit updated." };
|
|
151
151
|
if (action === "grant") return { payload: await request("POST", `/api/v1/agents/${encode(agent)}/repo-grants`, { repo: need(args[1], `agent ${action} needs <agent> <repo>`) }), human: "Repository grant added." };
|