commit 17a02b906e4c68c5872ad323e6600df2fc8b01c6 Author: Ansho Rei Date: Thu May 14 20:41:40 2026 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1932747 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +.worklane diff --git a/.opencode/agent/testing-agent.md b/.opencode/agent/testing-agent.md new file mode 100644 index 0000000..3c548c2 --- /dev/null +++ b/.opencode/agent/testing-agent.md @@ -0,0 +1,24 @@ +--- +id: testing-agent +name: Testing Agent +description: Tests that the Worklane command works as intended +category: testing +type: standard +version: 1.0.0 +author: ilya +mode: primary +temperature: 0.1 +tools: + bash: true + read: true +permissions: + bash: + "sudo *": "deny" + cargo: + "check": "allow" + "build": "allow" + "run": "allow" + skill: + "testing-skill": "allow" + +--- diff --git a/.opencode/skill/kanban-skill/SKILL.md b/.opencode/skill/kanban-skill/SKILL.md new file mode 100644 index 0000000..9509c07 --- /dev/null +++ b/.opencode/skill/kanban-skill/SKILL.md @@ -0,0 +1,145 @@ +--- +id: worklane_kanban +name: worklane_kanban +version: 1.0.0 +description: > + Creates Kanban-style tickets in Worklane using the `worklane add` CLI command. + Supports title, description, acceptance criteria, implementation plan, tags, + due date, and owner assignment. +rendering: + strategy: cli_args + join_arrays_with: "," + omit_empty: true +--- + +## Outline of the command: + +```yaml +command: worklane add +parameters: + title: + type: string + required: true + cli_flag: "--title" + + description: + type: string + required: false + cli_flag: "--description" + + acceptance: + type: array + required: false + description: "List of acceptance criteria" + cli_flag: "--acceptance" + format: csv + + plan: + type: array + required: false + description: "Step-by-step implementation plan" + cli_flag: "--plan" + format: csv + + tags: + type: array + required: false + cli_flag: "--tags" + format: csv + + due: + type: string + required: false + description: "Due date in YYYY-MM-DD format" + cli_flag: "--due" + + owner: + type: string + required: false + cli_flag: "--owner" +``` + +Example: +```yaml +input: + title: "Implement login API" + description: "Add JWT-based authentication" + acceptance: + - "User can log in with email/password" + - "JWT is returned on success" + plan: + - "Create auth controller" + - "Add JWT middleware" + - "Write tests" + tags: ["backend", "auth"] + due: "2026-06-01" + owner: "alice" +output: > + worklane add --title "Implement login API" + --description "Add JWT-based authentication" + --acceptance "User can log in with email/password,JWT is returned on success" + --plan "Create auth controller,Add JWT middleware,Write tests" + --tags "backend,auth" + --due "2026-06-01" + --owner "alice" +``` + +## Agent Guidance (IMPORTANT — read before generating tickets) + +When creating a Worklane ticket, the agent MUST: + +### 1. Title quality + +* Keep it short, action-oriented, and outcome-focused +* Prefer verbs: “Implement”, “Fix”, “Add”, “Refactor”, “Improve” +* Avoid vague titles like “Update system” or “Fix bug” +* If possible, specify the subsystem (API, UI, backend, auth, etc.) + +### 2. Description quality + +* Explain *what* is being built and *why it matters* +* Include context or user impact (not implementation details) +* Keep it 2–4 sentences max unless complexity requires more +* Avoid duplicating acceptance criteria or implementation steps + +### 3. Acceptance criteria quality + +* Must be **testable and verifiable** +* Each item should describe a *visible or measurable outcome* +* Use “Given / When / Then” style only if helpful—otherwise keep simple +* Avoid implementation details (no file names, no internal architecture) +* Each criterion should represent one atomic expectation + +#### Good example: + +* User can log in with valid credentials +* Invalid credentials return a 401 error +* Session persists across page refresh + +#### Bad example: + +* Implement JWT middleware in auth service ❌ (implementation detail) +* Add login function ❌ (too vague) + +### 4. Implementation plan quality + +* Must be a **step-by-step engineering checklist** +* Ordered logically from setup → implementation → testing → cleanup +* Each step should be actionable (start with a verb) +* Include testing and validation steps explicitly +* Avoid high-level or vague steps like “build feature” + +#### Good example: + +* Create authentication controller +* Add JWT token generation service +* Integrate middleware into protected routes +* Write unit tests for auth flows +* Add integration tests for login endpoint + +### 5. General rules + +* Prefer clarity over completeness +* Do not repeat information across fields +* Ensure consistency between description, acceptance criteria, and plan +* If unsure, choose simpler and more testable phrasing diff --git a/.opencode/skill/testing-skill/SKILL.md b/.opencode/skill/testing-skill/SKILL.md new file mode 100644 index 0000000..b3c6bbe --- /dev/null +++ b/.opencode/skill/testing-skill/SKILL.md @@ -0,0 +1,21 @@ +--- +name: testing-skill +description: Proper guidelines for testing the worklane CLI +--- + +## Purpose +This skill enables the agent to test a CLI application while enforcing strict isolation from the project directory. All commands must be executed in a dedicated temporary workspace (`./tmp`) to prevent accidental modification of source files or repository state. + +## Core Rules (Non-Negotiable) +- Never execute CLI commands in the project root or in any source directory +- All command execution MUST occur inside of `./tmp` +- If `./tmp` does not exist, the agent MUST create it before running any command +- The working directory must always be explicitly set to `./tmp` for every execution step +- The agent must never assume the current working directory is safe + +## Process + +- Check if `./tmp` exists + - If not, create it: `mkdir -p ./tmp` +- Switch execution context to `./tmp` +- Go ahead and test the commands diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..a975af7 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,903 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "anstream" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" + +[[package]] +name = "anstyle-parse" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ce7f38b242319f7cabaa6813055467063ecdc9d355bbb4ce0c68908cd8130e" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "assert_cmd" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aa3a22042e45de04255c7bf3626e239f450200fd0493c1e382263544b20aea6" +dependencies = [ + "anstyle", + "bstr", + "libc", + "predicates", + "predicates-core", + "predicates-tree", + "wait-timeout", +] + +[[package]] +name = "assert_fs" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a652f6cb1f516886fcfee5e7a5c078b9ade62cfcb889524efe5a64d682dd27a9" +dependencies = [ + "anstyle", + "doc-comment", + "globwalk", + "predicates", + "predicates-core", + "predicates-tree", + "tempfile", +] + +[[package]] +name = "bitflags" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3" + +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", + "regex-automata", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "clap" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ddb117e43bbf7dacf0a4190fef4d345b9bad68dfc649cb349e7d17d28428e51" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2ce8604710f6733aa641a2b3731eaa1e8b3d9973d5e3565da11800813f997a9" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8d4a3bb8b1e0c1050499d1815f5ab16d04f0959b233085fb31653fbfc9d98f9" + +[[package]] +name = "colorchoice" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d07550c9036bf2ae0c684c4297d503f838287c83c53686d05370d0e139ae570" + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "difflib" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" + +[[package]] +name = "doc-comment" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "780955b8b195a21ab8e4ac6b60dd1dbdcec1dc6c51c0617964b08c81785e12c9" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f1f227452a390804cdb637b74a86990f2a7d7ba4b7d5693aac9b4dd6defd8d6" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "getrandom" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0de51e6874e94e7bf76d726fc5d13ba782deca734ff60d5bb2fb2607c7406555" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", + "wasip3", +] + +[[package]] +name = "globset" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags", + "ignore", + "walkdir", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "id-arena" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" + +[[package]] +name = "ignore" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "js-sys" +version = "0.3.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67df7112613f8bfd9150013a0314e196f4800d3201ae742489d999db2f979f08" +dependencies = [ + "cfg-if", + "futures-util", + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "leb128fmt" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" + +[[package]] +name = "libc" +version = "0.2.186" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66" + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "predicates" +version = "3.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ada8f2932f28a27ee7b70dd6c1c39ea0675c55a36879ab92f3a715eaa1e63cfe" +dependencies = [ + "anstyle", + "difflib", + "predicates-core", +] + +[[package]] +name = "predicates-core" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cad38746f3166b4031b1a0d39ad9f954dd291e7854fcc0eed52ee41a0b50d144" + +[[package]] +name = "predicates-tree" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de1b847b39c8131db0467e9df1ff60e6d0562ab8e9a16e568ad0fdb372e2f2" +dependencies = [ + "predicates-core", + "termtree", +] + +[[package]] +name = "prettyplease" +version = "0.2.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "rustix" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "syn" +version = "2.0.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom", + "once_cell", + "rustix", + "windows-sys", +] + +[[package]] +name = "termtree" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "uuid" +version = "1.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd74a9687298c6858e9b88ec8935ec45d22e8fd5e6394fa1bd4e99a87789c76" +dependencies = [ + "getrandom", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "wasip2" +version = "1.0.3+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20064672db26d7cdc89c7798c48a0fdfac8213434a1186e5ef29fd560ae223d6" +dependencies = [ + "wit-bindgen 0.57.1", +] + +[[package]] +name = "wasip3" +version = "0.4.0+wasi-0.3.0-rc-2026-01-06" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5428f8bf88ea5ddc08faddef2ac4a67e390b88186c703ce6dbd955e1c145aca5" +dependencies = [ + "wit-bindgen 0.51.0", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49ace1d07c165b0864824eee619580c4689389afa9dc9ed3a4c75040d82e6790" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e68e6f4afd367a562002c05637acb8578ff2dea1943df76afb9e83d177c8578" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d95a9ec35c64b2a7cb35d3fead40c4238d0940c86d107136999567a4703259f2" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.121" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4e0100b01e9f0d03189a92b96772a1fb998639d981193d7dbab487302513441" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-encoder" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "990065f2fe63003fe337b932cfb5e3b80e0b4d0f5ff650e6985b1048f62c8319" +dependencies = [ + "leb128fmt", + "wasmparser", +] + +[[package]] +name = "wasm-metadata" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0e353e6a2fbdc176932bbaab493762eb1255a7900fe0fea1a2f96c296cc909" +dependencies = [ + "anyhow", + "indexmap", + "wasm-encoder", + "wasmparser", +] + +[[package]] +name = "wasmparser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47b807c72e1bac69382b3a6fb3dbe8ea4c0ed87ff5629b8685ae6b9a611028fe" +dependencies = [ + "bitflags", + "hashbrown 0.15.5", + "indexmap", + "semver", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" +dependencies = [ + "wit-bindgen-rust-macro", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "wit-bindgen-core" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea61de684c3ea68cb082b7a88508a8b27fcc8b797d738bfc99a82facf1d752dc" +dependencies = [ + "anyhow", + "heck", + "wit-parser", +] + +[[package]] +name = "wit-bindgen-rust" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c566e0f4b284dd6561c786d9cb0142da491f46a9fbed79ea69cdad5db17f21" +dependencies = [ + "anyhow", + "heck", + "indexmap", + "prettyplease", + "syn", + "wasm-metadata", + "wit-bindgen-core", + "wit-component", +] + +[[package]] +name = "wit-bindgen-rust-macro" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0f9bfd77e6a48eccf51359e3ae77140a7f50b1e2ebfe62422d8afdaffab17a" +dependencies = [ + "anyhow", + "prettyplease", + "proc-macro2", + "quote", + "syn", + "wit-bindgen-core", + "wit-bindgen-rust", +] + +[[package]] +name = "wit-component" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d66ea20e9553b30172b5e831994e35fbde2d165325bec84fc43dbf6f4eb9cb2" +dependencies = [ + "anyhow", + "bitflags", + "indexmap", + "log", + "serde", + "serde_derive", + "serde_json", + "wasm-encoder", + "wasm-metadata", + "wasmparser", + "wit-parser", +] + +[[package]] +name = "wit-parser" +version = "0.244.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc8ac4bc1dc3381b7f59c34f00b67e18f910c2c0f50015669dde7def656a736" +dependencies = [ + "anyhow", + "id-arena", + "indexmap", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + +[[package]] +name = "worklane" +version = "0.1.0" +dependencies = [ + "anyhow", + "assert_cmd", + "assert_fs", + "clap", + "tempfile", + "uuid", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a0c5be0 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "worklane" +version = "0.1.0" +edition = "2024" + +[dependencies] +clap = { version = "4", features = ["derive"] } +anyhow = "1" +uuid = { version = "1", features = ["v4"] } + +[dev-dependencies] +assert_cmd = "2" +assert_fs = "1" +tempfile = "3" diff --git a/README.md b/README.md new file mode 100644 index 0000000..5ea6cb0 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Worklane + +Worklane is a local Kanban flow for agentic software development. diff --git a/src/command.rs b/src/command.rs new file mode 100644 index 0000000..0b468b6 --- /dev/null +++ b/src/command.rs @@ -0,0 +1,47 @@ + +use clap::Parser; + +#[derive(Parser)] +#[command(name = "worklane")] +#[command(about = "A CLI tool for managing project status")] +pub struct Cli { + #[command(subcommand)] + pub command: Command, +} + +#[derive(clap::Subcommand)] +pub enum Command { + /// Initialize worklane in the current project + Init, + + /// Add a new ticket to the backlog + Add { + /// Ticket title + #[arg(short, long)] + title: String, + + /// Ticket description + #[arg(short, long)] + description: Option, + + /// Acceptance criteria (comma-separated) + #[arg(short, long)] + acceptance: Vec, + + /// Implementation plan (comma-separated steps) + #[arg(short, long)] + plan: Vec, + + /// Tags (comma-separated) + #[arg(short = 'g', long)] + tags: Vec, + + /// Due date (YYYY-MM-DD) + #[arg(long)] + due: Option, + + /// Owner + #[arg(short, long)] + owner: Option, + }, +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..caa0d72 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,166 @@ +use anyhow::{anyhow, Result}; +use clap::Parser; +use std::fs; +use std::path::Path; + +mod command; + +use command::*; + +fn find_worklane_dir(start: &Path) -> Result { + let mut current = start.canonicalize()?; + + loop { + let worklane_dir = current.join(".worklane"); + if worklane_dir.exists() { + return Ok(worklane_dir); + } + + if !current.pop() { + break; + } + } + + Err(anyhow!( + "No .worklane directory found. Run `worklane init` first." + )) +} + +fn slug(title: &str) -> String { + title + .to_lowercase() + .chars() + .filter(|c| c.is_alphanumeric() || *c == ' ' || *c == '-' || *c == '_') + .map(|c| if c == ' ' { '-' } else { c }) + .collect() +} + +fn cmd_init(start: &Path) -> Result<()> { + let dir = start.canonicalize().unwrap_or_else(|_| start.to_path_buf()); + let worklane_dir = dir.join(".worklane"); + + if worklane_dir.exists() { + println!("worklane already initialized in: {}", worklane_dir.display()); + return Ok(()); + } + + fs::create_dir_all(&worklane_dir)?; + + let folders = ["backlog", "committed", "reviewing", "done"]; + for folder in &folders { + fs::create_dir_all(worklane_dir.join(folder))?; + } + + println!("Initialized worklane in: {}", worklane_dir.display()); + Ok(()) +} + +fn cmd_add( + title: &str, + description: &Option, + acceptance: &[String], + plan: &[String], + tags: &[String], + due: &Option, + owner: &Option, + start: &Path, +) -> Result<()> { + let worklane_dir = find_worklane_dir(start)?; + let backlog_dir = worklane_dir.join("backlog"); + + if !backlog_dir.exists() { + return Err(anyhow!( + "Backlog directory not found. Run `worklane init` first." + )); + } + + let id = uuid::Uuid::new_v4(); + let slug = slug(title); + let filename = format!("{}_{}.md", id, slug); + let filepath = backlog_dir.join(&filename); + + if filepath.exists() { + return Err(anyhow!("A ticket with this title already exists.")); + } + + let description_text = description + .as_deref() + .unwrap_or("_No description provided._"); + + let mut body = format!( + "# {}\n\ + \n\ + ## Description\n\ + {}\n\ + \n\ + ## Acceptance Criteria\n\ + {}\n\ + \n\ + ## Implementation Plan\n\ + {}\n\ + \n\ + ## Metadata\n\ + \n\ + - **ID**: {}\n\ + - **Tags**: {}\n\ + - **Due**: {}\n\ + - **Owner**: {}\n\ + - **Status**: backlog\n\ + ", + title, + description_text, + if acceptance.is_empty() { + "_No acceptance criteria provided._".to_string() + } else { + acceptance + .iter() + .map(|c| format!("- [ ] {}", c)) + .collect::>() + .join("\n") + }, + if plan.is_empty() { + "_No implementation plan provided._".to_string() + } else { + plan.iter() + .enumerate() + .map(|(i, s)| format!("{}. {}", i + 1, s)) + .collect::>() + .join("\n") + }, + id, + if tags.is_empty() { + "_None_".to_string() + } else { + tags.join(", ") + }, + due.as_deref().unwrap_or("_Not set_"), + owner.as_deref().unwrap_or("_Not set_"), + ); + body.push('\n'); + + fs::write(&filepath, body)?; + + println!("Created ticket: {}", filename); + Ok(()) +} + +fn main() -> Result<()> { + let cli = Cli::parse(); + + let start = std::env::current_dir()?; + + match cli.command { + Command::Init => cmd_init(&start), + Command::Add { + title, + description, + acceptance, + plan, + tags, + due, + owner, + } => cmd_add( + &title, &description, &acceptance, &plan, &tags, &due, &owner, &start, + ), + } +} diff --git a/tests/cmd_init.rs b/tests/cmd_init.rs new file mode 100644 index 0000000..e4c41aa --- /dev/null +++ b/tests/cmd_init.rs @@ -0,0 +1,172 @@ +use assert_cmd::Command; +use assert_fs::fixture::{PathChild, PathCreateDir}; +use assert_fs::TempDir; +use std::fs; +use std::path::PathBuf; + +const BIN_NAME: &str = env!("CARGO_BIN_EXE_worklane"); + +fn setup_worklane(temp: &TempDir) -> PathBuf { + let worklane = temp.child(".worklane"); + worklane.create_dir_all().unwrap(); + + for dir in ["backlog", "committed", "reviewing", "done"] { + worklane.child(dir).create_dir_all().unwrap(); + } + + worklane.path().to_path_buf() +} + +#[test] +fn add_creates_ticket_in_backlog() { + let temp = TempDir::new().unwrap(); + let worklane = setup_worklane(&temp); + + let mut cmd = Command::cargo_bin(BIN_NAME).unwrap(); + cmd.current_dir(&temp.path()) + .arg("add") + .args(["--title", "Test ticket"]) + .assert() + .success(); + + let files: Vec<_> = fs::read_dir(worklane.join("backlog")) + .unwrap() + .filter_map(|e| e.ok()) + .map(|e| e.file_name().into_string().unwrap()) + .collect(); + + assert_eq!(files.len(), 1); + let filename = &files[0]; + assert!(filename.ends_with("_test-ticket.md")); +} + +#[test] +fn add_formats_ticket_correctly() { + let temp = TempDir::new().unwrap(); + setup_worklane(&temp); + + let mut cmd = Command::cargo_bin(BIN_NAME).unwrap(); + cmd.current_dir(&temp.path()) + .args([ + "add", + "--title", + "Fix login bug", + "--description", + "Users cannot log in", + "--acceptance", + "Login succeeds with valid credentials", + "--acceptance", + "Invalid credentials show error", + "--plan", + "Check password hash", + "--tags", + "bug,frontend", + "--due", + "2025-06-01", + "--owner", + "alice", + ]) + .assert() + .success(); + + let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog")) + .unwrap() + .filter_map(|e| e.ok()) + .collect(); + + assert_eq!(files.len(), 1); + let content = fs::read_to_string(files[0].path()).unwrap(); + + assert!(content.contains("# Fix login bug")); + assert!(content.contains("# Description")); + assert!(content.contains("Users cannot log in")); + assert!(content.contains("# Acceptance Criteria")); + assert!(content.contains("- [ ] Login succeeds with valid credentials")); + assert!(content.contains("- [ ] Invalid credentials show error")); + assert!(content.contains("# Implementation Plan")); + assert!(content.contains("Check password hash")); + assert!(content.contains("# Metadata")); + assert!(content.contains("**ID**")); + assert!(content.contains("**Tags**")); + assert!(content.contains("bug,frontend")); + assert!(content.contains("**Due**")); + assert!(content.contains("2025-06-01")); + assert!(content.contains("**Owner**")); + assert!(content.contains("alice")); + assert!(content.contains("**Status**")); + assert!(content.contains("backlog")); +} + +#[test] +fn add_with_optional_fields_uses_defaults() { + let temp = TempDir::new().unwrap(); + setup_worklane(&temp); + + let mut cmd = Command::cargo_bin(BIN_NAME).unwrap(); + cmd.current_dir(&temp.path()) + .args(["add", "--title", "Minimal ticket"]) + .assert() + .success(); + + let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog")) + .unwrap() + .filter_map(|e| e.ok()) + .collect(); + + let content = fs::read_to_string(files[0].path()).unwrap(); + assert!(content.contains("# Minimal ticket")); + assert!(content.contains("_No acceptance criteria provided._")); + assert!(content.contains("_No implementation plan provided._")); + assert!(content.contains("**Status**")); + assert!(content.contains("backlog")); +} + +#[test] +fn add_allows_duplicate_titles() { + let temp = TempDir::new().unwrap(); + setup_worklane(&temp); + + let mut cmd = Command::cargo_bin(BIN_NAME).unwrap(); + cmd.current_dir(&temp.path()) + .args(["add", "--title", "Existing title"]) + .assert() + .success(); + + let mut cmd2 = Command::cargo_bin(BIN_NAME).unwrap(); + cmd2.current_dir(&temp.path()) + .args(["add", "--title", "Existing title"]) + .assert() + .success(); + + let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog")) + .unwrap() + .filter_map(|e| e.ok()) + .collect(); + + // Each add call creates a new file with a different UUID + assert_eq!(files.len(), 2); +} + +#[test] +fn add_file_has_uuid_prefix() { + let temp = TempDir::new().unwrap(); + setup_worklane(&temp); + + let mut cmd = Command::cargo_bin(BIN_NAME).unwrap(); + cmd.current_dir(&temp.path()) + .args(["add", "--title", "UUID test"]) + .assert() + .success(); + + let files: Vec<_> = fs::read_dir(temp.child(".worklane").join("backlog")) + .unwrap() + .filter_map(|e| e.ok()) + .collect(); + + assert_eq!(files.len(), 1); + let filename = files[0].file_name().into_string().unwrap(); + // UUID format: 8-4-4-4-12 hex chars (36 chars with hyphens) + let parts: Vec<&str> = filename.split('_').collect(); + assert_eq!(parts[0].len(), 36); + assert_eq!(parts[0].chars().filter(|c| c.is_ascii_hexdigit()).count(), 32); +}