Page MenuHomeSealhub

No OneTemporary

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3c3629e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+node_modules
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..9f47ff4
--- /dev/null
+++ b/index.js
@@ -0,0 +1,42 @@
+const Promise = require("bluebird");
+const child_process = require("child_process");
+
+function callAPI(method, params) {
+ return new Promise((resolve, reject) => {
+ child_process.exec(
+ `echo '${JSON.stringify(params)}' | arc call-conduit ${method}`,
+ {},
+ (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", process.argv[2], "...");
+ const tasks = await callAPI("maniphest.search", {
+ constraints: { projects: ["Sealroom"], statuses: ["new"] },
+ })
+ .map(async (task, index, tasks) => {
+ const subtask_ids = await callAPI("maniphest.search", {
+ constraints: { parentIDs: [task.id], statuses: ["new", "open"] },
+ }).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}`)
+ )
+);
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..4524a21
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,18 @@
+{
+ "name": "phabricator-graph-decide",
+ "version": "1.0.0",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "bluebird": {
+ "version": "3.5.1",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz",
+ "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA=="
+ },
+ "lodash": {
+ "version": "4.17.4",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz",
+ "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4="
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..e56d3e9
--- /dev/null
+++ b/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "phabricator-graph-decide",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "bluebird": "^3.5.1",
+ "lodash": "^4.17.4"
+ }
+}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 8, 10:02 (23 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034441
Default Alt Text
(2 KB)

Event Timeline