@proletariat/cli 0.3.36 → 0.3.40

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 (64) hide show
  1. package/README.md +37 -2
  2. package/bin/dev.js +0 -0
  3. package/dist/commands/branch/where.js +6 -17
  4. package/dist/commands/epic/ticket.js +7 -24
  5. package/dist/commands/execution/config.js +4 -14
  6. package/dist/commands/execution/logs.js +6 -0
  7. package/dist/commands/execution/view.js +8 -0
  8. package/dist/commands/mcp-server.js +2 -1
  9. package/dist/commands/pmo/init.js +12 -40
  10. package/dist/commands/qa/index.d.ts +54 -0
  11. package/dist/commands/qa/index.js +762 -0
  12. package/dist/commands/repo/view.js +2 -8
  13. package/dist/commands/session/attach.js +4 -4
  14. package/dist/commands/session/health.js +4 -4
  15. package/dist/commands/session/list.js +1 -19
  16. package/dist/commands/session/peek.js +6 -6
  17. package/dist/commands/session/poke.js +2 -2
  18. package/dist/commands/ticket/epic.js +17 -43
  19. package/dist/commands/work/spawn-all.js +1 -1
  20. package/dist/commands/work/spawn.js +15 -4
  21. package/dist/commands/work/start.js +17 -9
  22. package/dist/commands/work/watch.js +1 -1
  23. package/dist/commands/workspace/prune.js +3 -3
  24. package/dist/hooks/init.js +10 -2
  25. package/dist/lib/agents/commands.d.ts +5 -0
  26. package/dist/lib/agents/commands.js +143 -97
  27. package/dist/lib/database/drizzle-schema.d.ts +465 -0
  28. package/dist/lib/database/drizzle-schema.js +53 -0
  29. package/dist/lib/database/index.d.ts +47 -1
  30. package/dist/lib/database/index.js +138 -20
  31. package/dist/lib/execution/runners.d.ts +34 -0
  32. package/dist/lib/execution/runners.js +134 -7
  33. package/dist/lib/execution/session-utils.d.ts +5 -0
  34. package/dist/lib/execution/session-utils.js +45 -3
  35. package/dist/lib/execution/spawner.js +15 -2
  36. package/dist/lib/execution/storage.d.ts +1 -1
  37. package/dist/lib/execution/storage.js +17 -2
  38. package/dist/lib/execution/types.d.ts +1 -0
  39. package/dist/lib/mcp/tools/index.d.ts +1 -0
  40. package/dist/lib/mcp/tools/index.js +1 -0
  41. package/dist/lib/mcp/tools/tmux.d.ts +16 -0
  42. package/dist/lib/mcp/tools/tmux.js +182 -0
  43. package/dist/lib/mcp/tools/work.js +52 -0
  44. package/dist/lib/pmo/schema.d.ts +1 -1
  45. package/dist/lib/pmo/schema.js +1 -0
  46. package/dist/lib/pmo/storage/base.js +207 -0
  47. package/dist/lib/pmo/storage/dependencies.d.ts +1 -0
  48. package/dist/lib/pmo/storage/dependencies.js +11 -3
  49. package/dist/lib/pmo/storage/epics.js +1 -1
  50. package/dist/lib/pmo/storage/helpers.d.ts +4 -4
  51. package/dist/lib/pmo/storage/helpers.js +36 -26
  52. package/dist/lib/pmo/storage/projects.d.ts +2 -0
  53. package/dist/lib/pmo/storage/projects.js +207 -119
  54. package/dist/lib/pmo/storage/specs.d.ts +2 -0
  55. package/dist/lib/pmo/storage/specs.js +274 -188
  56. package/dist/lib/pmo/storage/tickets.d.ts +2 -0
  57. package/dist/lib/pmo/storage/tickets.js +350 -290
  58. package/dist/lib/pmo/storage/views.d.ts +2 -0
  59. package/dist/lib/pmo/storage/views.js +183 -130
  60. package/dist/lib/prompt-json.d.ts +5 -0
  61. package/dist/lib/prompt-json.js +9 -0
  62. package/oclif.manifest.json +3922 -3819
  63. package/package.json +11 -6
  64. package/LICENSE +0 -190
@@ -4390,6 +4390,471 @@ export declare const pmoTicketTemplates: import("drizzle-orm/sqlite-core").SQLit
4390
4390
  };
4391
4391
  dialect: "sqlite";
4392
4392
  }>;
4393
+ /**
4394
+ * Categories (ticket and status type classifications)
4395
+ */
4396
+ export declare const pmoCategories: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4397
+ name: "pmo_categories";
4398
+ schema: undefined;
4399
+ columns: {
4400
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4401
+ name: "id";
4402
+ tableName: "pmo_categories";
4403
+ dataType: "string";
4404
+ columnType: "SQLiteText";
4405
+ data: string;
4406
+ driverParam: string;
4407
+ notNull: true;
4408
+ hasDefault: false;
4409
+ isPrimaryKey: true;
4410
+ isAutoincrement: false;
4411
+ hasRuntimeDefault: false;
4412
+ enumValues: [string, ...string[]];
4413
+ baseColumn: never;
4414
+ identity: undefined;
4415
+ generated: undefined;
4416
+ }, object>;
4417
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4418
+ name: "name";
4419
+ tableName: "pmo_categories";
4420
+ dataType: "string";
4421
+ columnType: "SQLiteText";
4422
+ data: string;
4423
+ driverParam: string;
4424
+ notNull: true;
4425
+ hasDefault: false;
4426
+ isPrimaryKey: false;
4427
+ isAutoincrement: false;
4428
+ hasRuntimeDefault: false;
4429
+ enumValues: [string, ...string[]];
4430
+ baseColumn: never;
4431
+ identity: undefined;
4432
+ generated: undefined;
4433
+ }, object>;
4434
+ type: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4435
+ name: "type";
4436
+ tableName: "pmo_categories";
4437
+ dataType: "string";
4438
+ columnType: "SQLiteText";
4439
+ data: string;
4440
+ driverParam: string;
4441
+ notNull: true;
4442
+ hasDefault: false;
4443
+ isPrimaryKey: false;
4444
+ isAutoincrement: false;
4445
+ hasRuntimeDefault: false;
4446
+ enumValues: [string, ...string[]];
4447
+ baseColumn: never;
4448
+ identity: undefined;
4449
+ generated: undefined;
4450
+ }, object>;
4451
+ description: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4452
+ name: "description";
4453
+ tableName: "pmo_categories";
4454
+ dataType: "string";
4455
+ columnType: "SQLiteText";
4456
+ data: string;
4457
+ driverParam: string;
4458
+ notNull: false;
4459
+ hasDefault: false;
4460
+ isPrimaryKey: false;
4461
+ isAutoincrement: false;
4462
+ hasRuntimeDefault: false;
4463
+ enumValues: [string, ...string[]];
4464
+ baseColumn: never;
4465
+ identity: undefined;
4466
+ generated: undefined;
4467
+ }, object>;
4468
+ color: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4469
+ name: "color";
4470
+ tableName: "pmo_categories";
4471
+ dataType: "string";
4472
+ columnType: "SQLiteText";
4473
+ data: string;
4474
+ driverParam: string;
4475
+ notNull: false;
4476
+ hasDefault: false;
4477
+ isPrimaryKey: false;
4478
+ isAutoincrement: false;
4479
+ hasRuntimeDefault: false;
4480
+ enumValues: [string, ...string[]];
4481
+ baseColumn: never;
4482
+ identity: undefined;
4483
+ generated: undefined;
4484
+ }, object>;
4485
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4486
+ name: "position";
4487
+ tableName: "pmo_categories";
4488
+ dataType: "number";
4489
+ columnType: "SQLiteInteger";
4490
+ data: number;
4491
+ driverParam: number;
4492
+ notNull: true;
4493
+ hasDefault: true;
4494
+ isPrimaryKey: false;
4495
+ isAutoincrement: false;
4496
+ hasRuntimeDefault: false;
4497
+ enumValues: undefined;
4498
+ baseColumn: never;
4499
+ identity: undefined;
4500
+ generated: undefined;
4501
+ }, object>;
4502
+ isBuiltin: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4503
+ name: "is_builtin";
4504
+ tableName: "pmo_categories";
4505
+ dataType: "boolean";
4506
+ columnType: "SQLiteBoolean";
4507
+ data: boolean;
4508
+ driverParam: number;
4509
+ notNull: true;
4510
+ hasDefault: true;
4511
+ isPrimaryKey: false;
4512
+ isAutoincrement: false;
4513
+ hasRuntimeDefault: false;
4514
+ enumValues: undefined;
4515
+ baseColumn: never;
4516
+ identity: undefined;
4517
+ generated: undefined;
4518
+ }, object>;
4519
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4520
+ name: "created_at";
4521
+ tableName: "pmo_categories";
4522
+ dataType: "string";
4523
+ columnType: "SQLiteText";
4524
+ data: string;
4525
+ driverParam: string;
4526
+ notNull: false;
4527
+ hasDefault: true;
4528
+ isPrimaryKey: false;
4529
+ isAutoincrement: false;
4530
+ hasRuntimeDefault: false;
4531
+ enumValues: [string, ...string[]];
4532
+ baseColumn: never;
4533
+ identity: undefined;
4534
+ generated: undefined;
4535
+ }, object>;
4536
+ };
4537
+ dialect: "sqlite";
4538
+ }>;
4539
+ /**
4540
+ * Label groups
4541
+ */
4542
+ export declare const pmoLabelGroups: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4543
+ name: "pmo_label_groups";
4544
+ schema: undefined;
4545
+ columns: {
4546
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4547
+ name: "id";
4548
+ tableName: "pmo_label_groups";
4549
+ dataType: "string";
4550
+ columnType: "SQLiteText";
4551
+ data: string;
4552
+ driverParam: string;
4553
+ notNull: true;
4554
+ hasDefault: false;
4555
+ isPrimaryKey: true;
4556
+ isAutoincrement: false;
4557
+ hasRuntimeDefault: false;
4558
+ enumValues: [string, ...string[]];
4559
+ baseColumn: never;
4560
+ identity: undefined;
4561
+ generated: undefined;
4562
+ }, object>;
4563
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4564
+ name: "name";
4565
+ tableName: "pmo_label_groups";
4566
+ dataType: "string";
4567
+ columnType: "SQLiteText";
4568
+ data: string;
4569
+ driverParam: string;
4570
+ notNull: true;
4571
+ hasDefault: false;
4572
+ isPrimaryKey: false;
4573
+ isAutoincrement: false;
4574
+ hasRuntimeDefault: false;
4575
+ enumValues: [string, ...string[]];
4576
+ baseColumn: never;
4577
+ identity: undefined;
4578
+ generated: undefined;
4579
+ }, object>;
4580
+ description: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4581
+ name: "description";
4582
+ tableName: "pmo_label_groups";
4583
+ dataType: "string";
4584
+ columnType: "SQLiteText";
4585
+ data: string;
4586
+ driverParam: string;
4587
+ notNull: false;
4588
+ hasDefault: false;
4589
+ isPrimaryKey: false;
4590
+ isAutoincrement: false;
4591
+ hasRuntimeDefault: false;
4592
+ enumValues: [string, ...string[]];
4593
+ baseColumn: never;
4594
+ identity: undefined;
4595
+ generated: undefined;
4596
+ }, object>;
4597
+ isExclusive: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4598
+ name: "is_exclusive";
4599
+ tableName: "pmo_label_groups";
4600
+ dataType: "boolean";
4601
+ columnType: "SQLiteBoolean";
4602
+ data: boolean;
4603
+ driverParam: number;
4604
+ notNull: true;
4605
+ hasDefault: true;
4606
+ isPrimaryKey: false;
4607
+ isAutoincrement: false;
4608
+ hasRuntimeDefault: false;
4609
+ enumValues: undefined;
4610
+ baseColumn: never;
4611
+ identity: undefined;
4612
+ generated: undefined;
4613
+ }, object>;
4614
+ isRequired: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4615
+ name: "is_required";
4616
+ tableName: "pmo_label_groups";
4617
+ dataType: "boolean";
4618
+ columnType: "SQLiteBoolean";
4619
+ data: boolean;
4620
+ driverParam: number;
4621
+ notNull: true;
4622
+ hasDefault: true;
4623
+ isPrimaryKey: false;
4624
+ isAutoincrement: false;
4625
+ hasRuntimeDefault: false;
4626
+ enumValues: undefined;
4627
+ baseColumn: never;
4628
+ identity: undefined;
4629
+ generated: undefined;
4630
+ }, object>;
4631
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4632
+ name: "position";
4633
+ tableName: "pmo_label_groups";
4634
+ dataType: "number";
4635
+ columnType: "SQLiteInteger";
4636
+ data: number;
4637
+ driverParam: number;
4638
+ notNull: true;
4639
+ hasDefault: true;
4640
+ isPrimaryKey: false;
4641
+ isAutoincrement: false;
4642
+ hasRuntimeDefault: false;
4643
+ enumValues: undefined;
4644
+ baseColumn: never;
4645
+ identity: undefined;
4646
+ generated: undefined;
4647
+ }, object>;
4648
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4649
+ name: "created_at";
4650
+ tableName: "pmo_label_groups";
4651
+ dataType: "string";
4652
+ columnType: "SQLiteText";
4653
+ data: string;
4654
+ driverParam: string;
4655
+ notNull: false;
4656
+ hasDefault: true;
4657
+ isPrimaryKey: false;
4658
+ isAutoincrement: false;
4659
+ hasRuntimeDefault: false;
4660
+ enumValues: [string, ...string[]];
4661
+ baseColumn: never;
4662
+ identity: undefined;
4663
+ generated: undefined;
4664
+ }, object>;
4665
+ };
4666
+ dialect: "sqlite";
4667
+ }>;
4668
+ /**
4669
+ * Labels
4670
+ */
4671
+ export declare const pmoLabels: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4672
+ name: "pmo_labels";
4673
+ schema: undefined;
4674
+ columns: {
4675
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4676
+ name: "id";
4677
+ tableName: "pmo_labels";
4678
+ dataType: "string";
4679
+ columnType: "SQLiteText";
4680
+ data: string;
4681
+ driverParam: string;
4682
+ notNull: true;
4683
+ hasDefault: false;
4684
+ isPrimaryKey: true;
4685
+ isAutoincrement: false;
4686
+ hasRuntimeDefault: false;
4687
+ enumValues: [string, ...string[]];
4688
+ baseColumn: never;
4689
+ identity: undefined;
4690
+ generated: undefined;
4691
+ }, object>;
4692
+ name: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4693
+ name: "name";
4694
+ tableName: "pmo_labels";
4695
+ dataType: "string";
4696
+ columnType: "SQLiteText";
4697
+ data: string;
4698
+ driverParam: string;
4699
+ notNull: true;
4700
+ hasDefault: false;
4701
+ isPrimaryKey: false;
4702
+ isAutoincrement: false;
4703
+ hasRuntimeDefault: false;
4704
+ enumValues: [string, ...string[]];
4705
+ baseColumn: never;
4706
+ identity: undefined;
4707
+ generated: undefined;
4708
+ }, object>;
4709
+ color: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4710
+ name: "color";
4711
+ tableName: "pmo_labels";
4712
+ dataType: "string";
4713
+ columnType: "SQLiteText";
4714
+ data: string;
4715
+ driverParam: string;
4716
+ notNull: false;
4717
+ hasDefault: false;
4718
+ isPrimaryKey: false;
4719
+ isAutoincrement: false;
4720
+ hasRuntimeDefault: false;
4721
+ enumValues: [string, ...string[]];
4722
+ baseColumn: never;
4723
+ identity: undefined;
4724
+ generated: undefined;
4725
+ }, object>;
4726
+ description: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4727
+ name: "description";
4728
+ tableName: "pmo_labels";
4729
+ dataType: "string";
4730
+ columnType: "SQLiteText";
4731
+ data: string;
4732
+ driverParam: string;
4733
+ notNull: false;
4734
+ hasDefault: false;
4735
+ isPrimaryKey: false;
4736
+ isAutoincrement: false;
4737
+ hasRuntimeDefault: false;
4738
+ enumValues: [string, ...string[]];
4739
+ baseColumn: never;
4740
+ identity: undefined;
4741
+ generated: undefined;
4742
+ }, object>;
4743
+ groupId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4744
+ name: "group_id";
4745
+ tableName: "pmo_labels";
4746
+ dataType: "string";
4747
+ columnType: "SQLiteText";
4748
+ data: string;
4749
+ driverParam: string;
4750
+ notNull: false;
4751
+ hasDefault: false;
4752
+ isPrimaryKey: false;
4753
+ isAutoincrement: false;
4754
+ hasRuntimeDefault: false;
4755
+ enumValues: [string, ...string[]];
4756
+ baseColumn: never;
4757
+ identity: undefined;
4758
+ generated: undefined;
4759
+ }, object>;
4760
+ position: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4761
+ name: "position";
4762
+ tableName: "pmo_labels";
4763
+ dataType: "number";
4764
+ columnType: "SQLiteInteger";
4765
+ data: number;
4766
+ driverParam: number;
4767
+ notNull: true;
4768
+ hasDefault: true;
4769
+ isPrimaryKey: false;
4770
+ isAutoincrement: false;
4771
+ hasRuntimeDefault: false;
4772
+ enumValues: undefined;
4773
+ baseColumn: never;
4774
+ identity: undefined;
4775
+ generated: undefined;
4776
+ }, object>;
4777
+ isBuiltin: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4778
+ name: "is_builtin";
4779
+ tableName: "pmo_labels";
4780
+ dataType: "boolean";
4781
+ columnType: "SQLiteBoolean";
4782
+ data: boolean;
4783
+ driverParam: number;
4784
+ notNull: true;
4785
+ hasDefault: true;
4786
+ isPrimaryKey: false;
4787
+ isAutoincrement: false;
4788
+ hasRuntimeDefault: false;
4789
+ enumValues: undefined;
4790
+ baseColumn: never;
4791
+ identity: undefined;
4792
+ generated: undefined;
4793
+ }, object>;
4794
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4795
+ name: "created_at";
4796
+ tableName: "pmo_labels";
4797
+ dataType: "string";
4798
+ columnType: "SQLiteText";
4799
+ data: string;
4800
+ driverParam: string;
4801
+ notNull: false;
4802
+ hasDefault: true;
4803
+ isPrimaryKey: false;
4804
+ isAutoincrement: false;
4805
+ hasRuntimeDefault: false;
4806
+ enumValues: [string, ...string[]];
4807
+ baseColumn: never;
4808
+ identity: undefined;
4809
+ generated: undefined;
4810
+ }, object>;
4811
+ };
4812
+ dialect: "sqlite";
4813
+ }>;
4814
+ /**
4815
+ * Ticket-to-label associations
4816
+ */
4817
+ export declare const pmoTicketLabels: import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
4818
+ name: "pmo_ticket_labels";
4819
+ schema: undefined;
4820
+ columns: {
4821
+ ticketId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4822
+ name: "ticket_id";
4823
+ tableName: "pmo_ticket_labels";
4824
+ dataType: "string";
4825
+ columnType: "SQLiteText";
4826
+ data: string;
4827
+ driverParam: string;
4828
+ notNull: true;
4829
+ hasDefault: false;
4830
+ isPrimaryKey: false;
4831
+ isAutoincrement: false;
4832
+ hasRuntimeDefault: false;
4833
+ enumValues: [string, ...string[]];
4834
+ baseColumn: never;
4835
+ identity: undefined;
4836
+ generated: undefined;
4837
+ }, object>;
4838
+ labelId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
4839
+ name: "label_id";
4840
+ tableName: "pmo_ticket_labels";
4841
+ dataType: "string";
4842
+ columnType: "SQLiteText";
4843
+ data: string;
4844
+ driverParam: string;
4845
+ notNull: true;
4846
+ hasDefault: false;
4847
+ isPrimaryKey: false;
4848
+ isAutoincrement: false;
4849
+ hasRuntimeDefault: false;
4850
+ enumValues: [string, ...string[]];
4851
+ baseColumn: never;
4852
+ identity: undefined;
4853
+ generated: undefined;
4854
+ }, object>;
4855
+ };
4856
+ dialect: "sqlite";
4857
+ }>;
4393
4858
  /**
4394
4859
  * Roadmaps (named collections of projects)
4395
4860
  */
@@ -506,6 +506,59 @@ export const pmoTicketTemplates = sqliteTable('pmo_ticket_templates', {
506
506
  }, (table) => ({
507
507
  idxBuiltin: index('idx_pmo_ticket_templates_builtin').on(table.isBuiltin),
508
508
  }));
509
+ /**
510
+ * Categories (ticket and status type classifications)
511
+ */
512
+ export const pmoCategories = sqliteTable('pmo_categories', {
513
+ id: text('id').primaryKey(),
514
+ name: text('name').notNull(),
515
+ type: text('type').notNull(),
516
+ description: text('description'),
517
+ color: text('color'),
518
+ position: integer('position').notNull().default(0),
519
+ isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
520
+ createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
521
+ }, (table) => ({
522
+ uniqNameType: unique().on(table.name, table.type),
523
+ idxType: index('idx_pmo_categories_type').on(table.type),
524
+ }));
525
+ /**
526
+ * Label groups
527
+ */
528
+ export const pmoLabelGroups = sqliteTable('pmo_label_groups', {
529
+ id: text('id').primaryKey(),
530
+ name: text('name').notNull().unique(),
531
+ description: text('description'),
532
+ isExclusive: integer('is_exclusive', { mode: 'boolean' }).notNull().default(false),
533
+ isRequired: integer('is_required', { mode: 'boolean' }).notNull().default(false),
534
+ position: integer('position').notNull().default(0),
535
+ createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
536
+ });
537
+ /**
538
+ * Labels
539
+ */
540
+ export const pmoLabels = sqliteTable('pmo_labels', {
541
+ id: text('id').primaryKey(),
542
+ name: text('name').notNull(),
543
+ color: text('color'),
544
+ description: text('description'),
545
+ groupId: text('group_id'),
546
+ position: integer('position').notNull().default(0),
547
+ isBuiltin: integer('is_builtin', { mode: 'boolean' }).notNull().default(false),
548
+ createdAt: text('created_at').default(sql `CURRENT_TIMESTAMP`),
549
+ }, (table) => ({
550
+ idxGroup: index('idx_pmo_labels_group').on(table.groupId),
551
+ }));
552
+ /**
553
+ * Ticket-to-label associations
554
+ */
555
+ export const pmoTicketLabels = sqliteTable('pmo_ticket_labels', {
556
+ ticketId: text('ticket_id').notNull(),
557
+ labelId: text('label_id').notNull(),
558
+ }, (table) => ({
559
+ pk: primaryKey({ columns: [table.ticketId, table.labelId] }),
560
+ idxLabel: index('idx_pmo_ticket_labels_label').on(table.labelId),
561
+ }));
509
562
  /**
510
563
  * Roadmaps (named collections of projects)
511
564
  */
@@ -96,9 +96,19 @@ export declare function addRepositoriesToDatabase(workspacePath: string, repos:
96
96
  */
97
97
  export declare function addAgentsToDatabase(workspacePath: string, agentNames: string[], themeId?: string, mountMode?: MountMode): void;
98
98
  /**
99
- * Add an ephemeral agent to the database
99
+ * Add an ephemeral agent to the database.
100
+ * Throws on name collision — use tryAddEphemeralAgentToDatabase for
101
+ * concurrency-safe insertion with conflict detection.
100
102
  */
101
103
  export declare function addEphemeralAgentToDatabase(workspacePath: string, agentName: string, baseName: string, themeId?: string, mountMode?: MountMode): Agent;
104
+ /**
105
+ * Try to add an ephemeral agent to the database.
106
+ * Returns the Agent on success, or null if the name already exists
107
+ * (SQLITE_CONSTRAINT_PRIMARYKEY). This is concurrency-safe: parallel
108
+ * processes that generate the same name will not crash — the loser
109
+ * simply gets null and can retry with a different name.
110
+ */
111
+ export declare function tryAddEphemeralAgentToDatabase(workspacePath: string, agentName: string, baseName: string, themeId?: string, mountMode?: MountMode): Agent | null;
102
112
  /**
103
113
  * Get all ephemeral agent names from the database
104
114
  */
@@ -149,10 +159,46 @@ export declare function getWorkspaceRepositories(workspacePath: string): Reposit
149
159
  * Get worktrees for a specific agent
150
160
  */
151
161
  export declare function getAgentWorktrees(workspacePath: string, agentName: string): AgentWorktree[];
162
+ /**
163
+ * Find agent worktrees matching a branch pattern (case-insensitive LIKE).
164
+ */
165
+ export declare function findWorktreesByBranch(workspacePath: string, branchPattern: string): AgentWorktree[];
166
+ /**
167
+ * Get agent worktrees for a specific repository.
168
+ */
169
+ export declare function getWorktreesForRepo(workspacePath: string, repoName: string): Array<{
170
+ agent_name: string;
171
+ is_clean: number;
172
+ commits_ahead: number;
173
+ branch: string;
174
+ }>;
175
+ /**
176
+ * Upsert a workspace setting (key-value pair).
177
+ */
178
+ export declare function upsertWorkspaceSetting(db: Database.Database, key: string, value: string): void;
152
179
  /**
153
180
  * Remove agents from database
154
181
  */
155
182
  export declare function removeAgentsFromDatabase(workspacePath: string, agentNames: string[]): void;
183
+ /**
184
+ * Check if PMO tables exist and get basic stats.
185
+ * Used by pmo init to detect existing PMO before storage layer is available.
186
+ */
187
+ export declare function checkPMOExists(dbPath: string): {
188
+ exists: boolean;
189
+ projectCount: number;
190
+ ticketCount: number;
191
+ };
192
+ /**
193
+ * Get a PMO setting from the pmo_settings table.
194
+ * Used for bootstrapping queries before storage layer is available.
195
+ */
196
+ export declare function getPMOSetting(dbPath: string, key: string): string | null;
197
+ /**
198
+ * Drop PMO tables from the database.
199
+ * Used during PMO reinitialization.
200
+ */
201
+ export declare function dropPMOTables(dbPath: string, tables: string[]): void;
156
202
  /**
157
203
  * Get all themes
158
204
  */