{"id":20456242,"url":"https://github.com/semperos/sc-client-goal","last_synced_at":"2026-03-19T15:58:07.352Z","repository":{"id":261176558,"uuid":"848066191","full_name":"semperos/sc-client-goal","owner":"semperos","description":"Shortcut API client in Goal","archived":false,"fork":false,"pushed_at":"2025-10-22T02:55:20.000Z","size":83,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-22T04:33:26.227Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semperos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-27T04:17:08.000Z","updated_at":"2025-10-22T02:55:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"d70e05bd-c4be-48d9-8238-cc53040974e9","html_url":"https://github.com/semperos/sc-client-goal","commit_stats":null,"previous_names":["semperos/sc-client-goal"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/semperos/sc-client-goal","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semperos%2Fsc-client-goal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semperos%2Fsc-client-goal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semperos%2Fsc-client-goal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semperos%2Fsc-client-goal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semperos","download_url":"https://codeload.github.com/semperos/sc-client-goal/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semperos%2Fsc-client-goal/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280852861,"owners_count":26402485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T11:21:56.042Z","updated_at":"2025-10-24T19:20:03.892Z","avatar_url":"https://github.com/semperos.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shortcut API Client using Goal\n\nThis repository contains [Goal](https://codeberg.org/anaseto/goal) source code for a [Shortcut REST API v3](https://developer.shortcut.com/api/rest/v3) client, using extensions to Goal provided by [Ari](https://github.com/semperos/ari).\n\n## Setup\n\nFirst, install the `ari` command:\n\n```shell\ngo install github.com/semperos/ari/cmd/ari@latest\n```\n\nMake a directory to keep your Goal source code and set it as your `GOALLIB`, for example:\n\n```\nmkdir -p $HOME/Development/goal\nexport GOALLIB=$HOME/Development/goal\n```\n\nNow check out this repository in your `GOALLIB` folder:\n\n```\ncd $GOALLIB\ngit clone https://github.com/semperos/sc-client-goal sc-client\n```\n\nFinally, ensure your Shortcut API token is set to the `SHORTCUT_API_TOKEN` environment variable. I personally use [direnv](https://github.com/direnv/direnv) + [sops](https://github.com/direnv/direnv) to accomplish this with a local `.envrc` file that looks like:\n\n```\nexport SHORCUT_API_TOKEN=$(sops -d --extract '[\"shortcut\"][\"token\"]' $HOME/.config/credentials.yaml)\n```\n\nTo start interacting with the Shortcut API via Goal, run the following command which will fetch entities from your Shortcut workspace (e.g., workflows, teams \u0026 members) and provide a `sc\u003e` prompt when ready:\n\n```shell\nari -l sc.goal\n```\n\nAlternatively, you can `\"\"import\"sc-client/sc\"` from your Goal program (run via `ari`).\n\n## Gotchas\n\n- Goal deserializes JSON `null` as `0n` which is its NaN value.\n- Goal deserializes JSON `true` as `0w` which is its positive infinity value.\n- Goal deserializes JSON `false` as `-0w` which is its negative infinity value.\n\n## Examples\n\n**Iteration workstreams**, defined as number of epics + number of stories not in an epic for the last 10 iterations:\n\n```\nimport\"sc-client/sc\"              / Located based on GOALLIB env var\nepid:..x[\"epic_id\"]               / Helper to grab epic id\nrepnan:{y[\u0026nan y]:x}              / Helper to replace a NaN value with x\nnanepic:repnan[-1]                / Helper to replace a NaN epic ID with -1\nittbl:mktbl its:iteration.list\"\"  / Table of all iterations in workspace\ngroupits:{[group]                 / Table filtered to iterations for given group (Team)\n (1;..1~'*'x[\"group_ids\"]=p.group\"id\";..status=\"done\")#ittbl}\nitnumws:{[its]                    / Num epics + stories wout epic in last 10 iterations\n its:its[(..\u003ex[\"end_date\"])its]\n itsdone:its[!10]\"id\"\n itss:iteration.stories'itsdone\n epicfreqs:k.freq'nanepic'epid''itss\n numepics:-1+#'epicfreqs\n numnonepic:@[;-1]'epicfreqs\n numepics + numnonepic\n}\nac\"gr.*\"                          / See which teams are defined\nitnumws@groupits gr.yourteamhere  / Report\n```\n\n**Produce a CSV of labels** that are no longer in use for in-progress work:\n\n```\nimport\"sc-client/sc\"\nsay\"PLEASE WAIT. Fetching all labels with their stories and/or epics.\"\nlbs:label\"\"; lbsstories:label.stories'lbs; lbsepics:label.epics'lbs\nnosts:0=#'lbsstories; noeps:0=#'lbsepics\nALLNONE:lbs@\u0026nosts\u0026noeps\n\nSNONE:lbs[\u0026nosts] / labels with no stories\nENONE:lbs[\u0026noeps] / labels with no epics\n\n/ TODO can use \"completed\" field instead\nSDONE:lbs@\u00261~'{\u0026/x}'story.isdone''lbsstories / labels with stories, all stories done\nEDONE:lbs@\u00261~'{\u0026/x}'epic.isdone''lbsepics    / labels with epics,   all epics done\n\nids:@[;\"id\"]'; seti:{x[\u0026~(#y)=(ids y)?(ids x)]} / set intersection\nALLDONE:seti[SDONE;EDONE]\nALLSDONE:seti[SDONE;ENONE]\nALLEDONE:seti[EDONE;SNONE]\n\nARCHIVE:,/(ALLNONE;ALLDONE;ALLSDONE;ALLEDONE)\ncols:{A:x[(\"id\";\"name\";\"app_url\")];@[A;0;\"i\"$]}'ARCHIVE\nhd:!\"id name app_url\"\nt:hd!+cols; t:@[t;\"id\";\"i\"$]; t:@[t;\"name\";rx/\\t/ sub \" \"] / int id; name w/out csv sep\nf:\"labels.csv\"; f print\"\\t\"csv t; say \"Wrote archive-able labels to $f\"\n```\n\nCancel stories owned by former members of your Shortcut workspace that are in progress (never closed out). This assumes that there's either a workflow state with the word \"cancel\" in it, or that the very last workflow state in your workflows is the best fit to convey that something was cancelled. It also relies on the `cache.` bindings that are made in `scdata.goal`, so make sure you load `sc.goal` (which loads `scdata.goal`) when running this:\n\n```\ncancelWorkflowStates:cache.workflowstates[\u0026{rx/(?i)cancel/@x}'{x[\"name\"]}'cache.workflowstates]\nworkflowToCancelState:(@[;\"_workflow_id\"]'cancelWorkflowStates)!(cancelWorkflowStates)\nlastWorkflowState:{[workflowId] *|cache.workflows[workflowId;\"states\"]}\ncancelWorkflowState:{[workflowId]\n state:workflowToCancelState[workflowId]\n ?[0\u003c#state;state;lastWorkflowState[workflowId]]}\nformerMembers:cache.members@\u00260w={x[\"disabled\"]}'cache.members\nss:story.search@..[\"owner_ids\":@[;\"id\"]'formerMembers;\"archived\":-0w;\"workflow_state_types\":!\"started\"]\ncount:#ss; say\"Cancelling $count stories...\"\ncancelStory:{[s]\n workflowId:s\"workflow_id\";newWorkflowState:cancelWorkflowState[workflowId]\n story.update[s\"id\";..[\"workflow_state_id\":newWorkflowState\"id\"]]}\ncancelStory'ss\n```\n\n## License\n\nCopyright 2024 Daniel Gregoire\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemperos%2Fsc-client-goal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemperos%2Fsc-client-goal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemperos%2Fsc-client-goal/lists"}