{"id":28437075,"url":"https://github.com/flinedev/laserfocuskit-swift","last_synced_at":"2025-09-01T12:33:35.517Z","repository":{"id":85882539,"uuid":"410240688","full_name":"FlineDev/LaserFocusKit-Swift","owner":"FlineDev","description":"Utility library for calculations for applying the \"Laser Focus\" priority strategy.","archived":false,"fork":false,"pushed_at":"2025-08-03T11:53:44.000Z","size":50,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T10:08:29.587Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FlineDev.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}},"created_at":"2021-09-25T10:19:32.000Z","updated_at":"2025-08-03T11:53:48.000Z","dependencies_parsed_at":"2023-03-13T07:17:49.299Z","dependency_job_id":null,"html_url":"https://github.com/FlineDev/LaserFocusKit-Swift","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/FlineDev/LaserFocusKit-Swift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlineDev%2FLaserFocusKit-Swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlineDev%2FLaserFocusKit-Swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlineDev%2FLaserFocusKit-Swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlineDev%2FLaserFocusKit-Swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FlineDev","download_url":"https://codeload.github.com/FlineDev/LaserFocusKit-Swift/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FlineDev%2FLaserFocusKit-Swift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273122379,"owners_count":25049572,"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-09-01T02:00:09.058Z","response_time":120,"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":"2025-06-05T23:08:37.583Z","updated_at":"2025-09-01T12:33:35.503Z","avatar_url":"https://github.com/FlineDev.png","language":"Swift","readme":"\u003cimg width=\"1164\" alt=\"Laser Focus Header\" src=\"https://user-images.githubusercontent.com/6942160/135471993-bc65430a-dd45-4810-9139-f59cdab56c4b.png\"\u003e\n\n# LaserFocusKit-Swift\nUtility library for calculations when applying the [Laser Focus](https://dev.to/jeehut/laser-focus-priority-strategy-31ok) priority strategy.\n\n## Usage\n\n\u003cimg width=\"1000\" alt=\"VECTOR\" src=\"https://user-images.githubusercontent.com/6942160/135472228-a5a98734-6e17-4e2d-bb09-43414d76c5ee.png\"\u003e\n\nThis library calculates the overall priority for a given graph of categorized actionable items, such as features or tasks. It supports any number of actionable item levels, e.g. you can provide an entire range of levels like \"Epic\", \"Story\", \"Feature\", \"Task\", \"Sub-Task\", \"Step\" as input. The main method takes just the top level (\"Epic\" in this case) and walks through the other children levels automatically.\n\nFor example, imagine you have the features \"A\", \"B\", and \"C\". Some of them have 3 tasks \"1\", \"2\", and \"3\". And some of the tasks have subtasks, \"x\", \"y\", and \"z\". So the input is this top level array with its children:\n\n```swift\nlet inputs: [ActionableInput] = [\n  .init(name: \"A\", localCategory: .vital, children: [\n    .init(name: \"A1\", localCategory: .vital, children: [\n      .init(name: \"A1x\", localCategory: .vital),\n      .init(name: \"A1y\", localCategory: .essential),\n      .init(name: \"A1z\", localCategory: .completing)]\n    ),\n    .init(name: \"A2\", localCategory: .essential),\n    .init(name: \"A3\", localCategory: .completing, children: [\n      .init(name: \"A3x\", localCategory: .vital),\n      .init(name: \"A3y\", localCategory: .essential),\n      .init(name: \"A3z\", localCategory: .completing)]\n    )]\n  ),\n  .init(name: \"B\", localCategory: .optional, children: [\n    .init(name: \"B1\", localCategory: .vital),\n    .init(name: \"B2\", localCategory: .essential, children: [\n      .init(name: \"B2x\", localCategory: .vital),\n      .init(name: \"B2y\", localCategory: .retracting),\n      .init(name: \"B2z\", localCategory: .completing)]\n    )]\n  ),\n  .init(name: \"C\", localCategory: .completing)\n]\n```\n\nWhat we want to know in the Laser Focus strategy, is the global category for each \"leaf\" element in the graph, or the elements without children, the \"atomic\" elements, so to say. These elements are not further split(table) and can directly be worked on. Just calling the `LaserFocus.prioritizedAtoms(inputs:)` gives us exactly these elements:\n\n```swift\nlet outputs: [ActionableOutput] = LaserFocus.prioritizedAtoms(inputs: inputs)\n\n```\n\nEach element in `ActionableOutput` has a `globalCategory` which includes the overall category of the atomic actionable, which serves as the primary prioritization point. Additionally, each `ActionableOutput` also has an `averageCategoryRawValue` numeric property which can be used to prioritize tasks with the same `globalCategory` for improved precision.\n\nThe simplest way to get the list of tasks in the correct priority order is to just call `sorted()` on the outputs as `ActionableOutput` is `Comparable`:\n\n```swift\nlet sortedOutputs: [ActionableOutput] = outputs.sorted()\n\nprint(sortedOutputs.map(\\.name)) // =\u003e [\"A1x\", \"A1y\", \"A2\", \"A1z\", \"A3x\", \"A3y\", \"A3z\", \"C\", \"B2x\", \"B1\", \"B2z\", \"B2y\"]\n```\n\nNote that both the input `ActionableInput` and output type `ActionableOutput` are `Codable` and can therefore be easily read from \u0026 written to JSON.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflinedev%2Flaserfocuskit-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflinedev%2Flaserfocuskit-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflinedev%2Flaserfocuskit-swift/lists"}