Page MenuHomeSealhub

index.js
No OneTemporary

index.js

const Promise = require("bluebird");
const child_process = require("child_process");
const PROJECT_NAME = process.argv[2];
function callAPI(method, params) {
return new Promise((resolve, reject) => {
child_process.exec(
`echo '${JSON.stringify(
params
)}' | arc call-conduit ${method} --conduit-uri=https://hub.sealcode.org/`,
{},
(e, stdout, stderr) => {
try {
e ? reject(stderr) : resolve(JSON.parse(stdout).response.data);
} catch (e) {
console.log(e, stdout, stderr);
}
}
);
});
}
async function suggest() {
console.log("Finding non-blocked tasks in", PROJECT_NAME, "...");
const tasks = await callAPI("maniphest.search", {
constraints: { projects: [PROJECT_NAME], statuses: ["new"] },
})
.map(async (task, index, tasks) => {
const subtask_ids = await callAPI("maniphest.search", {
constraints: {
parentIDs: [task.id],
statuses: ["new", "open", "review"],
},
}).map(task => task.id);
Object.assign(task, { subtask_ids });
return task;
})
.filter(task => task.subtask_ids.length === 0);
// .map(task => ({ [task.id]: task }))
// .reduce((a, b) => Object.assign(a, b), {});
return tasks;
}
suggest().then(tasks =>
tasks.forEach(task =>
console.log(`https://hub.sealcode.org/T${task.id} - ${task.fields.name}`)
)
);

File Metadata

Mime Type
text/plain
Expires
Wed, Feb 26, 01:39 (1 d, 15 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
610625
Default Alt Text
index.js (1 KB)

Event Timeline