Compare commits
18 Commits
df7921a376
...
1b747dd466
Author | SHA1 | Date |
---|---|---|
Brian Hicks | 1b747dd466 | |
Brian Hicks | 234293b573 | |
Brian Hicks | f0dd249808 | |
Brian Hicks | eccdbad453 | |
Brian Hicks | 6462a71807 | |
Brian Hicks | a69f6c10e2 | |
Brian Hicks | e92663061d | |
Brian Hicks | f864fe320b | |
Brian Hicks | 11aee414b7 | |
Brian Hicks | b6272f9768 | |
Brian Hicks | 110655a023 | |
Brian Hicks | 64e76245fb | |
Brian Hicks | fe647c96cc | |
Brian Hicks | 9a08be9356 | |
Brian Hicks | e9da268cf4 | |
Brian Hicks | 2c4f1e632e | |
Brian Hicks | 1b8e6428a9 | |
Brian Hicks | a6d441500a |
|
@ -0,0 +1 @@
|
|||
/result
|
|
@ -0,0 +1,5 @@
|
|||
"label" = "Finish a task and immedidately sweep for next steps";
|
||||
"shortLabel" = "Finish";
|
||||
"mediumLabel" = "Finish and Follow Up";
|
||||
"longLabel" = "Finish and Follow Up";
|
||||
"paletteLabel" = "Finish";
|
|
@ -0,0 +1 @@
|
|||
"zone.bytes.linear" = "Finish and Follow Up";
|
|
@ -0,0 +1,88 @@
|
|||
"use strict";
|
||||
(() => {
|
||||
var action = new PlugIn.Action(async (selection, sender) => {
|
||||
try {
|
||||
let originalTask = selection.tasks[0];
|
||||
originalTask.flagged = false;
|
||||
let isDoneAlert = new Alert("Is this task completely done?", originalTask.name);
|
||||
isDoneAlert.addOption("Yep!");
|
||||
isDoneAlert.addOption("Not quite");
|
||||
isDoneAlert.addOption("Whoops, never mind!");
|
||||
let isDoneAnswer = await isDoneAlert.show();
|
||||
if (isDoneAnswer == 0) {
|
||||
///////////////////////////////
|
||||
// Yes, it's completely done //
|
||||
///////////////////////////////
|
||||
originalTask.markComplete();
|
||||
let currentSibling = originalTask;
|
||||
while (true) {
|
||||
let nextThingAlert = new Alert("Is there anything that has to happen next?", currentSibling.name);
|
||||
nextThingAlert.addOption("Yep!");
|
||||
nextThingAlert.addOption("No, we're all done");
|
||||
let nextThingAnswer = await nextThingAlert.show();
|
||||
if (nextThingAnswer == 1) {
|
||||
break;
|
||||
}
|
||||
let nextSiblingForm = new Form();
|
||||
nextSiblingForm.addField(new Form.Field.String("name", "What's Next?"));
|
||||
nextSiblingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save");
|
||||
var values = nextSiblingForm.values;
|
||||
currentSibling = new Task(values.name, currentSibling.after);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
}
|
||||
}
|
||||
else if (isDoneAnswer == 1) {
|
||||
/////////////////////////////
|
||||
// No, it's not quite done //
|
||||
/////////////////////////////
|
||||
let nextThingForm = new Form();
|
||||
nextThingForm.addField(new Form.Field.String("name", "What's Next?"));
|
||||
nextThingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextThingForm.show(`What's the next thing that needs to happen to finish "${originalTask.name}"?`, "Save");
|
||||
var values = nextThingForm.values;
|
||||
let currentSibling = new Task(values.name, originalTask.beginning);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
while (true) {
|
||||
let nextThingAlert = new Alert("Is there anything that'd have to happen after this is done?", currentSibling.name);
|
||||
nextThingAlert.addOption("Yep!");
|
||||
nextThingAlert.addOption("No, not for now");
|
||||
let nextThingAnswer = await nextThingAlert.show();
|
||||
if (nextThingAnswer == 1) {
|
||||
break;
|
||||
}
|
||||
let nextSiblingForm = new Form();
|
||||
nextSiblingForm.addField(new Form.Field.String("name", "What's Next?"));
|
||||
nextSiblingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save");
|
||||
values = nextSiblingForm.values;
|
||||
currentSibling = new Task(values.name, currentSibling.after);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
}
|
||||
}
|
||||
else if (isDoneAnswer == 2) {
|
||||
///////////////////////////////////////
|
||||
// Whoops, didn't mean to click that //
|
||||
///////////////////////////////////////
|
||||
return;
|
||||
}
|
||||
else {
|
||||
/////////////////////////////////////////
|
||||
// We forgot how many answers we added //
|
||||
/////////////////////////////////////////
|
||||
new Alert("Whoops!", `I got a value of '${isDoneAnswer}' from that alert, but I'm not sure what that means. This is a plugin bug!`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
action.validate = function (selection, sender) {
|
||||
return (selection.tasks.length === 1 && !selection.tasks[0].hasChildren);
|
||||
};
|
||||
return action;
|
||||
})();
|
|
@ -1,17 +1,5 @@
|
|||
/*{
|
||||
"type": "action",
|
||||
"targets": ["omnifocus"],
|
||||
"author": "Brian Hicks",
|
||||
"identifier": "zone.bytes.finish-and-follow-up",
|
||||
"version": "1.0",
|
||||
"description": "Finish a task and immediately sweep for next steps",
|
||||
"label": "Finish and Follow Up",
|
||||
"shortLabel": "Finish",
|
||||
"paletteLabel": "Finish",
|
||||
"image": "checkmark"
|
||||
}*/
|
||||
(() => {
|
||||
var action = new PlugIn.Action(async (selection, sender) => {
|
||||
var action = new PlugIn.Action(async (selection: Selection, sender: any) => {
|
||||
try {
|
||||
let originalTask = selection.tasks[0]
|
||||
originalTask.flagged = false;
|
||||
|
@ -46,8 +34,10 @@
|
|||
nextSiblingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save");
|
||||
|
||||
currentSibling = new Task(nextSiblingForm.values.name, currentSibling.after);
|
||||
currentSibling.note = nextSiblingForm.values.note;
|
||||
var values = nextSiblingForm.values as { name: string, note: string }
|
||||
|
||||
currentSibling = new Task(values.name, currentSibling.after);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
}
|
||||
|
||||
|
@ -60,8 +50,10 @@
|
|||
nextThingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextThingForm.show(`What's the next thing that needs to happen to finish "${originalTask.name}"?`, "Save");
|
||||
|
||||
let currentSibling = new Task(nextThingForm.values.name, originalTask.beginning);
|
||||
currentSibling.note = nextThingForm.values.note;
|
||||
var values = nextThingForm.values as { name: string, note: string }
|
||||
|
||||
let currentSibling = new Task(values.name, originalTask.beginning);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
|
||||
while (true) {
|
||||
|
@ -79,8 +71,10 @@
|
|||
nextSiblingForm.addField(new Form.Field.String("note", "Notes"));
|
||||
await nextSiblingForm.show(`What's the next thing that needs to happen after "${currentSibling.name}"?`, "Save");
|
||||
|
||||
currentSibling = new Task(nextSiblingForm.values.name, currentSibling.after);
|
||||
currentSibling.note = nextSiblingForm.values.note;
|
||||
values = nextSiblingForm.values as { name: string, note: string }
|
||||
|
||||
currentSibling = new Task(values.name, currentSibling.after);
|
||||
currentSibling.note = values.note;
|
||||
currentSibling.addTags(originalTask.tags);
|
||||
}
|
||||
|
||||
|
@ -102,7 +96,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
action.validate = function(selection, sender){
|
||||
action.validate = function(selection: Selection, sender: any){
|
||||
return (selection.tasks.length === 1 && !selection.tasks[0].hasChildren)
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"author": "Brian Hicks",
|
||||
"identifier": "zone.bytes.finish-and-follow-up",
|
||||
"defaultLocale": "en",
|
||||
"version": "1.0",
|
||||
"description": "Finish a task and immediately sweep for next steps",
|
||||
"actions": [
|
||||
{
|
||||
"image": "checkmark",
|
||||
"identifier": "finish"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,91 +1,93 @@
|
|||
"use strict";
|
||||
(() => {
|
||||
let creds = new Credentials();
|
||||
|
||||
var action = new PlugIn.Action(async () => {
|
||||
try {
|
||||
let req = URL.FetchRequest.fromString("https://api.linear.app/graphql");
|
||||
|
||||
if (req === null || req.url === null || req.url.host === null) {
|
||||
throw "could not parse the URL for Linear's API";
|
||||
}
|
||||
/////////////////////////////////////
|
||||
// Step 1: make sure we have creds //
|
||||
/////////////////////////////////////
|
||||
// creds.remove(req.url.host);
|
||||
let stored = creds.read(req.url.host);
|
||||
|
||||
let key = null;
|
||||
if (stored === null || app.optionKeyDown) {
|
||||
let credsForm = new Form();
|
||||
credsForm.addField(new Form.Field.Password("key", "API Key"));
|
||||
|
||||
await credsForm.show("Please create a personal API key in the Linear settings and paste it here\n(hold option while activating this workflow in the future to reset this)", "Save Key");
|
||||
key = credsForm.values.key;
|
||||
|
||||
creds.write(req.url.host, "-", key);
|
||||
} else {
|
||||
key = stored.password;
|
||||
let credsForm = new Form();
|
||||
credsForm.addField(new Form.Field.Password("key", "API Key"));
|
||||
await credsForm.show("Please create a personal API key in the Linear settings and paste it here\n(hold option while activating this workflow in the future to reset this)", "Save Key");
|
||||
key = credsForm.values.key;
|
||||
creds.write(req.url.host, "-", key);
|
||||
}
|
||||
else {
|
||||
key = stored.password;
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Step 2: get the tasks //
|
||||
///////////////////////////
|
||||
req.method = "POST";
|
||||
req.bodyString = '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name } } } } }"}';
|
||||
req.bodyString = '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}';
|
||||
req.headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": key,
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": key,
|
||||
};
|
||||
|
||||
let resp = await (req.fetch().catch((err) => {
|
||||
console.error("Problem fetching tasks:", err);
|
||||
let alert = new Alert("Problem fetching from Linear", err);
|
||||
alert.show();
|
||||
throw err;
|
||||
console.error("Problem fetching tasks:", err);
|
||||
let alert = new Alert("Problem fetching from Linear", err);
|
||||
alert.show();
|
||||
throw err;
|
||||
}));
|
||||
|
||||
if (resp.bodyString === null) {
|
||||
throw "body string was null. Did the request succeed?";
|
||||
}
|
||||
let body = JSON.parse(resp.bodyString);
|
||||
|
||||
//////////////////////////////////
|
||||
// Step 3: make the tasks in OF //
|
||||
//////////////////////////////////
|
||||
let toFocus = [];
|
||||
for (let linearTask of body.data.viewer.assignedIssues.nodes) {
|
||||
let teamsTag = flattenedTags.byName("teams") || new Tag("teams");
|
||||
let teamTag = teamsTag.tagNamed(linearTask.team.name) || new Tag(linearTask.team.name, teamsTag);
|
||||
|
||||
let linearTag = flattenedTags.byName("from Linear") || new Tag("from Linear");
|
||||
|
||||
let projectName = `${linearTask.team.name} Non-Project Tasks`;
|
||||
if (linearTask.project !== null) {
|
||||
projectName = linearTask.project.name;
|
||||
}
|
||||
|
||||
let project = flattenedProjects.byName(projectName) || new Project(projectName);
|
||||
project.addTag(teamTag);
|
||||
project.addTag(linearTag);
|
||||
project.containsSingletonActions = true;
|
||||
toFocus.push(project);
|
||||
|
||||
let taskName = `${linearTask.identifier}: ${linearTask.title}`;
|
||||
let task = project.taskNamed(taskName) || new Task(taskName, project);
|
||||
task.addTag(teamTag);
|
||||
task.addTag(linearTag);
|
||||
if (task.note.indexOf(linearTask.url) === -1) {
|
||||
if (task.note !== "") {
|
||||
task.appendStringToNote(`\n\n${linearTask.url}`);
|
||||
} else {
|
||||
task.appendStringToNote(linearTask.url)
|
||||
let teamsTag = flattenedTags.byName("teams") || new Tag("teams");
|
||||
let teamTag = teamsTag.tagNamed(linearTask.team.name) || new Tag(linearTask.team.name, teamsTag);
|
||||
let linearTag = flattenedTags.byName("from Linear") || new Tag("from Linear");
|
||||
let projectName = `${linearTask.team.name} Non-Project Tasks`;
|
||||
if (linearTask.project !== null) {
|
||||
projectName = linearTask.project.name;
|
||||
}
|
||||
let project = flattenedProjects.byName(projectName) || new Project(projectName);
|
||||
project.addTag(teamTag);
|
||||
project.addTag(linearTag);
|
||||
project.containsSingletonActions = true;
|
||||
toFocus.push(project);
|
||||
if (linearTask.project && project.note.indexOf(linearTask.project.url) === -1) {
|
||||
if (project.note !== "") {
|
||||
project.appendStringToNote(`\n\n${linearTask.project.url}`);
|
||||
}
|
||||
else {
|
||||
project.appendStringToNote(linearTask.project.url);
|
||||
}
|
||||
}
|
||||
let taskName = `${linearTask.identifier}: ${linearTask.title}`;
|
||||
let task = project.taskNamed(taskName) || new Task(taskName, project);
|
||||
task.addTag(teamTag);
|
||||
task.addTag(linearTag);
|
||||
if (task.note.indexOf(linearTask.url) === -1) {
|
||||
if (task.note !== "") {
|
||||
task.appendStringToNote(`\n\n${linearTask.url}`);
|
||||
}
|
||||
else {
|
||||
task.appendStringToNote(linearTask.url);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (app.platformName === "macOS") {
|
||||
document.windows[0].perspective = Perspective.BuiltIn.Projects;
|
||||
document.windows[0].focus = toFocus;
|
||||
document.windows[0].perspective = Perspective.BuiltIn.Projects;
|
||||
document.windows[0].focus = toFocus;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
return action;
|
||||
})();
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
(() => {
|
||||
let creds = new Credentials();
|
||||
|
||||
var action = new PlugIn.Action(async () => {
|
||||
try {
|
||||
let req = URL.FetchRequest.fromString("https://api.linear.app/graphql");
|
||||
if (req === null || req.url === null || req.url.host === null) {
|
||||
throw "could not parse the URL for Linear's API"
|
||||
}
|
||||
|
||||
/////////////////////////////////////
|
||||
// Step 1: make sure we have creds //
|
||||
/////////////////////////////////////
|
||||
let stored = creds.read(req.url.host);
|
||||
|
||||
let key = null;
|
||||
if (stored === null || app.optionKeyDown) {
|
||||
let credsForm = new Form();
|
||||
credsForm.addField(new Form.Field.Password("key", "API Key"));
|
||||
|
||||
await credsForm.show("Please create a personal API key in the Linear settings and paste it here\n(hold option while activating this workflow in the future to reset this)", "Save Key");
|
||||
key = (credsForm.values as { key: string }).key;
|
||||
|
||||
creds.write(req.url.host, "-", key);
|
||||
} else {
|
||||
key = stored.password;
|
||||
}
|
||||
|
||||
///////////////////////////
|
||||
// Step 2: get the tasks //
|
||||
///////////////////////////
|
||||
req.method = "POST";
|
||||
req.bodyString = '{"query":"{ viewer { assignedIssues(filter: {state: {type: {nin: [\\"completed\\",\\"canceled\\"]}}}) { nodes { identifier title url team { name } project { name url } } } } }"}';
|
||||
req.headers = {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": key,
|
||||
};
|
||||
|
||||
let resp = await (req.fetch().catch((err) => {
|
||||
console.error("Problem fetching tasks:", err);
|
||||
let alert = new Alert("Problem fetching from Linear", err);
|
||||
alert.show();
|
||||
throw err;
|
||||
}));
|
||||
|
||||
if (resp.bodyString === null) {
|
||||
throw "body string was null. Did the request succeed?"
|
||||
}
|
||||
|
||||
let body = JSON.parse(resp.bodyString);
|
||||
|
||||
//////////////////////////////////
|
||||
// Step 3: make the tasks in OF //
|
||||
//////////////////////////////////
|
||||
let toFocus: Array<Project> = [];
|
||||
for (let linearTask of body.data.viewer.assignedIssues.nodes) {
|
||||
let teamsTag = flattenedTags.byName("teams") || new Tag("teams");
|
||||
let teamTag = teamsTag.tagNamed(linearTask.team.name) || new Tag(linearTask.team.name, teamsTag);
|
||||
|
||||
let linearTag = flattenedTags.byName("from Linear") || new Tag("from Linear");
|
||||
|
||||
let projectName = `${linearTask.team.name} Non-Project Tasks`;
|
||||
if (linearTask.project !== null) {
|
||||
projectName = linearTask.project.name;
|
||||
}
|
||||
|
||||
let project = flattenedProjects.byName(projectName) || new Project(projectName);
|
||||
project.addTag(teamTag);
|
||||
project.addTag(linearTag);
|
||||
project.containsSingletonActions = true;
|
||||
toFocus.push(project);
|
||||
if (linearTask.project && project.note.indexOf(linearTask.project.url) === -1) {
|
||||
if (project.note !== "") {
|
||||
project.appendStringToNote(`\n\n${linearTask.project.url}`);
|
||||
} else {
|
||||
project.appendStringToNote(linearTask.project.url)
|
||||
}
|
||||
}
|
||||
|
||||
let taskName = `${linearTask.identifier}: ${linearTask.title}`;
|
||||
let task = project.taskNamed(taskName) || new Task(taskName, project);
|
||||
task.addTag(teamTag);
|
||||
task.addTag(linearTag);
|
||||
if (task.note.indexOf(linearTask.url) === -1) {
|
||||
if (task.note !== "") {
|
||||
task.appendStringToNote(`\n\n${linearTask.url}`);
|
||||
} else {
|
||||
task.appendStringToNote(linearTask.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (app.platformName === "macOS") {
|
||||
document.windows[0].perspective = Perspective.BuiltIn.Projects;
|
||||
document.windows[0].focus = toFocus as SectionArray;
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
return action;
|
||||
})();
|
|
@ -0,0 +1 @@
|
|||
"zone.bytes.session" = "OmniFocus + Session";
|
|
@ -0,0 +1,5 @@
|
|||
"label" = "Start a session";
|
||||
"shortLabel" = "Start";
|
||||
"mediumLabel" = "Start";
|
||||
"longLabel" = "Start a session";
|
||||
"paletteLabel" = "Start";
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
/*
|
||||
WARNING: if you're looking at the file ending in .js and want to make changes,
|
||||
don't! Modify the .ts file and run `tsc` instead!
|
||||
*/
|
||||
(() => {
|
||||
var action = new PlugIn.Action(async (selection, sender) => {
|
||||
try {
|
||||
let task = selection.tasks[0];
|
||||
let possibleCategories = [
|
||||
"Personal",
|
||||
"Team",
|
||||
"Wandering Toolmaker",
|
||||
];
|
||||
let defaultCategory = possibleCategories[0];
|
||||
for (let tag of task.tags) {
|
||||
if (tag.name == "Wandering Toolmaker") {
|
||||
defaultCategory = tag.name;
|
||||
break;
|
||||
}
|
||||
else if (tag.name == "teams" || (tag.parent && tag.parent.name == "teams") || tag.name == "work" || (tag.parent && tag.parent.name == "work")) {
|
||||
defaultCategory = "Team";
|
||||
break;
|
||||
}
|
||||
else if (tag.name == "personal" || (tag.parent && tag.parent.name == "personal")) {
|
||||
defaultCategory = "Personal";
|
||||
break;
|
||||
}
|
||||
}
|
||||
let focusForm = new Form();
|
||||
focusForm.addField(new Form.Field.String("project", "Project", task.containingProject ? task.containingProject.name : null));
|
||||
focusForm.addField(new Form.Field.Option("category", "Category", possibleCategories, possibleCategories, defaultCategory));
|
||||
focusForm.addField(new Form.Field.String("minutes", "Minutes", "25"));
|
||||
await focusForm.show("Focus on…", "Start");
|
||||
let values = focusForm.values;
|
||||
let rawSessionUrl = `session:///start?intent=${encodeURIComponent(values.project)}&categoryName=${encodeURIComponent(values.category)}&duration=${encodeURIComponent(values.minutes)}`;
|
||||
let sessionUrl = URL.fromString(rawSessionUrl);
|
||||
if (sessionUrl === null) {
|
||||
throw `failed to parse session string ("${rawSessionUrl}") into a URL`;
|
||||
}
|
||||
sessionUrl.open();
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
action.validate = function (selection, sender) {
|
||||
return (selection.tasks.length === 1);
|
||||
};
|
||||
return action;
|
||||
})();
|
|
@ -1,17 +1,9 @@
|
|||
/*{
|
||||
"type": "action",
|
||||
"targets": ["omnifocus"],
|
||||
"author": "Brian Hicks",
|
||||
"identifier": "zone.bytes.focus",
|
||||
"version": "1.0",
|
||||
"description": "Start and log a pomodoro for the selected task",
|
||||
"label": "Focus",
|
||||
"shortLabel": "Focus",
|
||||
"paletteLabel": "Focus",
|
||||
"image": "clock"
|
||||
}*/
|
||||
/*
|
||||
WARNING: if you're looking at the file ending in .js and want to make changes,
|
||||
don't! Modify the .ts file and run `tsc` instead!
|
||||
*/
|
||||
(() => {
|
||||
var action = new PlugIn.Action(async (selection, sender) => {
|
||||
var action = new PlugIn.Action(async (selection: Selection, sender: any) => {
|
||||
try {
|
||||
let task = selection.tasks[0]
|
||||
|
||||
|
@ -39,16 +31,26 @@
|
|||
focusForm.addField(new Form.Field.String("project", "Project", task.containingProject ? task.containingProject.name : null));
|
||||
focusForm.addField(new Form.Field.Option("category", "Category", possibleCategories, possibleCategories, defaultCategory));
|
||||
focusForm.addField(new Form.Field.String("minutes", "Minutes", "25"));
|
||||
await focusForm.show("Focus on…", "Start");
|
||||
|
||||
let sessionUrl = URL.fromString(`session:///start?intent=${encodeURIComponent(focusForm.values.project)}&categoryName=${encodeURIComponent(focusForm.values.category)}&duration=${encodeURIComponent(focusForm.values.minutes)}`)
|
||||
await focusForm.show("Focus on…", "Start");
|
||||
let values = focusForm.values as {
|
||||
project: string,
|
||||
category: string,
|
||||
minutes: string,
|
||||
};
|
||||
|
||||
let rawSessionUrl = `session:///start?intent=${encodeURIComponent(values.project)}&categoryName=${encodeURIComponent(values.category)}&duration=${encodeURIComponent(values.minutes)}`
|
||||
let sessionUrl = URL.fromString(rawSessionUrl)
|
||||
if (sessionUrl === null) {
|
||||
throw `failed to parse session string ("${rawSessionUrl}") into a URL`
|
||||
}
|
||||
sessionUrl.open();
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
|
||||
action.validate = function(selection, sender){
|
||||
action.validate = function(selection: Selection, sender: any){
|
||||
return (selection.tasks.length === 1)
|
||||
};
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"author": "Brian Hicks",
|
||||
"identifier": "zone.bytes.session",
|
||||
"defaultLocale": "en",
|
||||
"version": "1.0",
|
||||
"description": "Start tasks in Session (https://www.stayinsession.com/)",
|
||||
"actions": [
|
||||
{
|
||||
"image": "clock",
|
||||
"identifier": "start"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1659877975,
|
||||
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1662096612,
|
||||
"narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "21de2b973f9fee595a7a1ac4693efff791245c34",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system:
|
||||
let pkgs = import inputs.nixpkgs { inherit system; };
|
||||
in {
|
||||
devShell =
|
||||
pkgs.mkShell { packages = [ pkgs.nodePackages.typescript ]; };
|
||||
});
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
/* Visit https://aka.ms/tsconfig to read more about this file */
|
||||
|
||||
/* Projects */
|
||||
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
||||
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
||||
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
||||
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||
|
||||
/* Language and Environment */
|
||||
"target": "es2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||
"lib": ["es7"], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
||||
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
||||
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
||||
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
||||
|
||||
/* Modules */
|
||||
"module": "commonjs", /* Specify what module code is generated. */
|
||||
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
||||
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
||||
// "resolveJsonModule": true, /* Enable importing .json files. */
|
||||
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
||||
|
||||
/* JavaScript Support */
|
||||
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
||||
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
||||
|
||||
/* Emit */
|
||||
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
||||
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
||||
// "removeComments": true, /* Disable emitting comments. */
|
||||
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
||||
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
||||
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
||||
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
||||
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||
|
||||
/* Interop Constraints */
|
||||
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||
|
||||
/* Type Checking */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
||||
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
||||
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
||||
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
||||
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
||||
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
||||
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
||||
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
||||
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||
|
||||
/* Completeness */
|
||||
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
declare const app: Application
|
||||
|
||||
declare const console: Console
|
||||
|
||||
declare const document: DatabaseDocument
|
||||
|
||||
declare const flattenedProjects : ProjectArray
|
||||
|
||||
declare const flattenedTags : TagArray
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue