@nickmeriano/task 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +63 -8
  2. package/dist/cli.js +220 -17
  3. package/dist/cli.js.map +1 -1
  4. package/dist/file-store.d.ts +113 -0
  5. package/dist/file-store.d.ts.map +1 -0
  6. package/dist/file-store.js +604 -0
  7. package/dist/file-store.js.map +1 -0
  8. package/dist/index.d.ts +6 -4
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +3 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/server.d.ts.map +1 -1
  13. package/dist/server.js +11 -7
  14. package/dist/server.js.map +1 -1
  15. package/dist/store.d.ts +55 -15
  16. package/dist/store.d.ts.map +1 -1
  17. package/dist/store.js +63 -29
  18. package/dist/store.js.map +1 -1
  19. package/dist/store.test.d.ts +12 -0
  20. package/dist/store.test.d.ts.map +1 -0
  21. package/dist/store.test.js +252 -0
  22. package/dist/store.test.js.map +1 -0
  23. package/dist/ticket-doc.d.ts +57 -0
  24. package/dist/ticket-doc.d.ts.map +1 -0
  25. package/dist/ticket-doc.js +197 -0
  26. package/dist/ticket-doc.js.map +1 -0
  27. package/dist/types.d.ts +14 -1
  28. package/dist/types.d.ts.map +1 -1
  29. package/dist/types.js.map +1 -1
  30. package/package.json +4 -4
  31. package/skill/SKILL.md +23 -8
  32. package/src/cli.ts +236 -20
  33. package/src/file-store.ts +693 -0
  34. package/src/index.ts +30 -4
  35. package/src/server.ts +15 -11
  36. package/src/store.test.ts +305 -0
  37. package/src/store.ts +99 -40
  38. package/src/ticket-doc.ts +226 -0
  39. package/src/types.ts +14 -1
  40. package/ui/dist/assets/index-CXW8uT5f.css +1 -0
  41. package/ui/dist/assets/{index-D_qmmh3D.js → index-oJzomUDL.js} +58 -58
  42. package/ui/dist/index.html +2 -2
  43. package/ui/dist/assets/index-Da14ye1f.css +0 -1
@@ -0,0 +1,113 @@
1
+ import { type Store } from "./store.ts";
2
+ import type { Comment, ProjectConfig, Task, TaskFilter, TaskInput, TaskPatch } from "./types.ts";
3
+ export declare const TICKETS_DIR = "tickets";
4
+ /** Finished tickets moved out of the hot path — same per-ticket layout. */
5
+ export declare const ARCHIVE_DIR = "archive";
6
+ /**
7
+ * The canonical persistence layer: one directory per ticket under
8
+ * `.task/tickets/`, holding a frontmatter+markdown `ticket.md` and one file
9
+ * per comment. Everything is plain text committed to git, which is the point —
10
+ * ticket edits diff, review, and merge like code, and two branches touching
11
+ * different tickets (or adding comments to the same one) merge cleanly by
12
+ * construction.
13
+ *
14
+ * There is no database and no cache: boards are dozens of tickets, and
15
+ * re-reading a handful of small files per operation is cheaper than opening
16
+ * SQLite ever was. If boards outgrow that, a derived (gitignored) index can be
17
+ * added without changing the format — the files stay the source of truth.
18
+ */
19
+ export declare class FileStore implements Store {
20
+ readonly root: string;
21
+ readonly taskDir: string;
22
+ readonly config: ProjectConfig;
23
+ private ticketsDir;
24
+ private archiveDir;
25
+ constructor(root: string);
26
+ close(): void;
27
+ displayId(number: number): string;
28
+ /** Accepts "PHONE-12", "phone-12" or "12". */
29
+ parseId(ref: string): number;
30
+ private ticketPath;
31
+ /**
32
+ * A ticket's comments live wherever the ticket does — the whole directory
33
+ * moves on archive, so an archived ticket's discussion stays readable.
34
+ */
35
+ private commentsPath;
36
+ private readDir;
37
+ /** Every live ticket on the board, freshly parsed — the files are the state. */
38
+ private readAll;
39
+ private readOne;
40
+ /** Cheap presence check — the archive's numbers, without parsing anything. */
41
+ private archivedNumbers;
42
+ private isArchived;
43
+ /** The error every write path throws instead of touching the archive. */
44
+ private assertNotArchived;
45
+ private writeTicket;
46
+ /**
47
+ * Only `blocked_by` is stored (on the blocked ticket); the `blocks` side is
48
+ * derived here, so the two views can never disagree.
49
+ */
50
+ private toTask;
51
+ private applyFilter;
52
+ list(filter?: TaskFilter): Task[];
53
+ get(number: number): Task | null;
54
+ create(input: TaskInput): Task;
55
+ update(number: number, patch: TaskPatch): Task;
56
+ /**
57
+ * Make every other ticket's `blocked_by` agree with "this task blocks
58
+ * exactly `targets`". Returns whether anything changed; every touched ticket
59
+ * (and, via the caller, this one) gets its `updated` bumped.
60
+ */
61
+ private reconcileBlocks;
62
+ /** `task link A --blocks B` and friends — additive, unlike the patch form. */
63
+ link(number: number, relation: "blocks" | "blocked_by", target: number): Task;
64
+ unlink(number: number, relation: "blocks" | "blocked_by", target: number): Task;
65
+ delete(number: number): void;
66
+ /**
67
+ * Move a finished ticket's whole directory to `.task/archive/` — one rename,
68
+ * which git records as a move, so history follows the ticket. Archived
69
+ * tickets leave every hot path (`list`, the board, link derivation) but stay
70
+ * readable via `get`/`comments` and keep their number reserved forever.
71
+ * Links other tickets hold on this one are left in place: they're
72
+ * dangling-tolerant everywhere, and unarchiving puts them back in force.
73
+ */
74
+ archive(number: number): Task;
75
+ unarchive(number: number): Task;
76
+ /**
77
+ * One file per comment, append-only: two writers commenting concurrently on
78
+ * the same ticket produce two files and merge without a conflict — which is
79
+ * why they aren't lines inside `ticket.md`.
80
+ */
81
+ comments(number: number): Comment[];
82
+ addComment(number: number, body: string, author?: string): Comment;
83
+ deleteComment(number: number, commentId: string): Comment;
84
+ commentCounts(): Map<number, number>;
85
+ }
86
+ /**
87
+ * The board in `root`, on whichever backend it uses: text files when the
88
+ * `tickets/` tree exists or the config says version ≥ 2, the legacy SQLite
89
+ * store otherwise. Old boards keep working untouched until `task migrate`.
90
+ */
91
+ export declare function openBoard(root: string): Store;
92
+ export interface InitOptions {
93
+ name: string;
94
+ prefix?: string;
95
+ }
96
+ /**
97
+ * Create `.task/` in `root`: config and a .gitignore. New boards are
98
+ * text-canonical from the start — tickets appear under `tickets/` as they're
99
+ * created, and everything in `.task/` except the ignores belongs in git.
100
+ */
101
+ export declare function initProject(root: string, options: InitOptions): Store;
102
+ export interface MigrateResult {
103
+ tasks: number;
104
+ comments: number;
105
+ }
106
+ /**
107
+ * `task migrate` — export every ticket and comment from a legacy `tasks.db`
108
+ * into the text layout, flip the config to version 2, and gitignore the
109
+ * database. The database file itself is left on disk untouched, as a backup;
110
+ * it just stops being the state.
111
+ */
112
+ export declare function migrateBoard(root: string): MigrateResult;
113
+ //# sourceMappingURL=file-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-store.d.ts","sourceRoot":"","sources":["../src/file-store.ts"],"names":[],"mappings":"AAkBA,OAAO,EAOL,KAAK,KAAK,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,OAAO,EACP,aAAa,EAEb,IAAI,EACJ,UAAU,EACV,SAAS,EACT,SAAS,EACV,MAAM,YAAY,CAAA;AAEnB,eAAO,MAAM,WAAW,YAAY,CAAA;AACpC,2EAA2E;AAC3E,eAAO,MAAM,WAAW,YAAY,CAAA;AAuBpC;;;;;;;;;;;;GAYG;AACH,qBAAa,SAAU,YAAW,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;IAC9B,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,UAAU,CAAQ;gBAEd,IAAI,EAAE,MAAM;IAUxB,KAAK,IAAI,IAAI;IAEb,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIjC,8CAA8C;IAC9C,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAQ5B,OAAO,CAAC,UAAU;IAIlB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,OAAO;IAaf,gFAAgF;IAChF,OAAO,CAAC,OAAO;IAIf,OAAO,CAAC,OAAO;IAMf,8EAA8E;IAC9E,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,UAAU;IAIlB,yEAAyE;IACzE,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,WAAW;IAKnB;;;OAGG;IACH,OAAO,CAAC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