@happyvertical/smrt-projects 0.30.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 (92) hide show
  1. package/AGENTS.md +31 -0
  2. package/CLAUDE.md +1 -0
  3. package/LICENSE +7 -0
  4. package/README.md +97 -0
  5. package/dist/__smrt-register__.d.ts +2 -0
  6. package/dist/__smrt-register__.d.ts.map +1 -0
  7. package/dist/collections/Issues.d.ts +107 -0
  8. package/dist/collections/Issues.d.ts.map +1 -0
  9. package/dist/collections/Projects.d.ts +90 -0
  10. package/dist/collections/Projects.d.ts.map +1 -0
  11. package/dist/collections/PullRequests.d.ts +107 -0
  12. package/dist/collections/PullRequests.d.ts.map +1 -0
  13. package/dist/collections/Repositories.d.ts +77 -0
  14. package/dist/collections/Repositories.d.ts.map +1 -0
  15. package/dist/constants.d.ts +9 -0
  16. package/dist/constants.d.ts.map +1 -0
  17. package/dist/index.d.ts +14 -0
  18. package/dist/index.d.ts.map +1 -0
  19. package/dist/index.js +2477 -0
  20. package/dist/index.js.map +1 -0
  21. package/dist/manifest.json +4193 -0
  22. package/dist/models/Comment.d.ts +77 -0
  23. package/dist/models/Comment.d.ts.map +1 -0
  24. package/dist/models/Issue.d.ts +200 -0
  25. package/dist/models/Issue.d.ts.map +1 -0
  26. package/dist/models/Label.d.ts +63 -0
  27. package/dist/models/Label.d.ts.map +1 -0
  28. package/dist/models/Project.d.ts +183 -0
  29. package/dist/models/Project.d.ts.map +1 -0
  30. package/dist/models/PullRequest.d.ts +114 -0
  31. package/dist/models/PullRequest.d.ts.map +1 -0
  32. package/dist/models/Repository.d.ts +141 -0
  33. package/dist/models/Repository.d.ts.map +1 -0
  34. package/dist/playground.d.ts +2 -0
  35. package/dist/playground.d.ts.map +1 -0
  36. package/dist/playground.js +129 -0
  37. package/dist/playground.js.map +1 -0
  38. package/dist/prompts.d.ts +2 -0
  39. package/dist/prompts.d.ts.map +1 -0
  40. package/dist/smrt-knowledge.json +1956 -0
  41. package/dist/svelte/components/ApprovalActions.svelte +213 -0
  42. package/dist/svelte/components/ApprovalActions.svelte.d.ts +17 -0
  43. package/dist/svelte/components/ApprovalActions.svelte.d.ts.map +1 -0
  44. package/dist/svelte/components/BulkActions.svelte +224 -0
  45. package/dist/svelte/components/BulkActions.svelte.d.ts +14 -0
  46. package/dist/svelte/components/BulkActions.svelte.d.ts.map +1 -0
  47. package/dist/svelte/components/DurationDisplay.svelte +68 -0
  48. package/dist/svelte/components/DurationDisplay.svelte.d.ts +11 -0
  49. package/dist/svelte/components/DurationDisplay.svelte.d.ts.map +1 -0
  50. package/dist/svelte/components/RejectDialog.svelte +250 -0
  51. package/dist/svelte/components/RejectDialog.svelte.d.ts +17 -0
  52. package/dist/svelte/components/RejectDialog.svelte.d.ts.map +1 -0
  53. package/dist/svelte/components/TimeEntryCard.svelte +294 -0
  54. package/dist/svelte/components/TimeEntryCard.svelte.d.ts +17 -0
  55. package/dist/svelte/components/TimeEntryCard.svelte.d.ts.map +1 -0
  56. package/dist/svelte/components/TimeEntryList.svelte +351 -0
  57. package/dist/svelte/components/TimeEntryList.svelte.d.ts +17 -0
  58. package/dist/svelte/components/TimeEntryList.svelte.d.ts.map +1 -0
  59. package/dist/svelte/components/TimeSummary.svelte +165 -0
  60. package/dist/svelte/components/TimeSummary.svelte.d.ts +19 -0
  61. package/dist/svelte/components/TimeSummary.svelte.d.ts.map +1 -0
  62. package/dist/svelte/components/__tests__/ApprovalActions.test.js +41 -0
  63. package/dist/svelte/components/__tests__/BulkActions.test.js +46 -0
  64. package/dist/svelte/components/__tests__/DurationDisplay.test.js +23 -0
  65. package/dist/svelte/components/__tests__/RejectDialog.test.js +45 -0
  66. package/dist/svelte/components/__tests__/TimeEntryCard.test.js +45 -0
  67. package/dist/svelte/components/__tests__/TimeEntryList.test.js +50 -0
  68. package/dist/svelte/components/__tests__/TimeSummary.test.js +39 -0
  69. package/dist/svelte/components/utils.d.ts +42 -0
  70. package/dist/svelte/components/utils.d.ts.map +1 -0
  71. package/dist/svelte/components/utils.js +43 -0
  72. package/dist/svelte/i18n.d.ts +18 -0
  73. package/dist/svelte/i18n.d.ts.map +1 -0
  74. package/dist/svelte/i18n.js +18 -0
  75. package/dist/svelte/index.d.ts +26 -0
  76. package/dist/svelte/index.d.ts.map +1 -0
  77. package/dist/svelte/index.js +31 -0
  78. package/dist/svelte/playground.d.ts +122 -0
  79. package/dist/svelte/playground.d.ts.map +1 -0
  80. package/dist/svelte/playground.js +114 -0
  81. package/dist/svelte/utils.d.ts +42 -0
  82. package/dist/svelte/utils.d.ts.map +1 -0
  83. package/dist/svelte/utils.js +43 -0
  84. package/dist/types.d.ts +54 -0
  85. package/dist/types.d.ts.map +1 -0
  86. package/dist/types.js +2 -0
  87. package/dist/types.js.map +1 -0
  88. package/dist/ui.d.ts +10 -0
  89. package/dist/ui.d.ts.map +1 -0
  90. package/dist/ui.js +85 -0
  91. package/dist/ui.js.map +1 -0
  92. package/package.json +100 -0
package/AGENTS.md ADDED
@@ -0,0 +1,31 @@
1
+ # @happyvertical/smrt-projects
2
+
3
+ Provider-agnostic project management — GitHub-style issues, PRs, projects, and repositories.
4
+
5
+ ## Models
6
+
7
+ | Model | Key Fields | Notes |
8
+ |-------|-----------|-------|
9
+ | **Repository** | `owner`, `name`, `providerType`, `tokenConfigKey` | `sync()`, `getIssues()`, `getPullRequests()` |
10
+ | **Issue** | `repositoryId` (FK), `number`, `title`, `body`, `state`, `labels[]` | `incorporateFeedback()`, `rollback()`, `suggestLabels()` |
11
+ | **PullRequest** | extends Issue + `headRef`, `baseRef`, `merged`, `draft` | STI on Issue table. `summarize()`, `merge()` |
12
+ | **Project** | `projectId`, `title`, `statuses[]`, `statusFieldId` | GitHub Projects V2. `addItem()`, `moveItem()`, `analyzeHealth()` |
13
+ | **Comment** | `issueId` (FK), `body`, `authorLogin` | AI analysis support |
14
+ | **Label** | `repositoryId` (FK), `name`, `color` | |
15
+
16
+ ## Key Patterns
17
+
18
+ - **Token config reference**: stores env var name (`tokenConfigKey: 'GITHUB_TOKEN'`), not the token itself. Resolved at runtime from `process.env` or `getModuleConfig()`
19
+ - **Living spec** (`incorporateFeedback()`): AI synthesizes issue comments into updated body. Supports preview mode and `rollback()`
20
+ - **Provider-agnostic**: GitHub primary, GitLab/Bitbucket/Azure planned. Uses `@happyvertical/repos` and `@happyvertical/projects` SDK packages
21
+ - **PullRequest is STI on Issue**: shares table, discriminated by `_meta_type`
22
+
23
+ ## Collection Methods
24
+
25
+ All collections provide: `discover({ repository, filters })`, `findByRepository(repoId)`, `findOpen(repoId?)`, `batchSync(repository)`.
26
+
27
+ ## Gotchas
28
+
29
+ - **SDK dependency**: requires `@happyvertical/repos` and `@happyvertical/projects` from SDK
30
+ - **tokenConfigKey not tokenValue**: never store actual tokens in the database
31
+ - **synthesisCount tracks incorporateFeedback calls**: incremented on each apply
package/CLAUDE.md ADDED
@@ -0,0 +1 @@
1
+ @AGENTS.md
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright <2025> <Happy Vertical Corporation>
2
+
3
+ Permission 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:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE 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.
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # @happyvertical/smrt-projects
2
+
3
+ Provider-agnostic project management models for the SMRT framework. Manages repositories, issues, pull requests, and project boards with sync support for external providers (GitHub, GitLab, etc.).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @happyvertical/smrt-projects
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import {
15
+ Repository, RepositoryCollection,
16
+ Issue, IssueCollection,
17
+ PullRequest, PullRequestCollection,
18
+ Project, ProjectCollection
19
+ } from '@happyvertical/smrt-projects';
20
+
21
+ // Track a repository (token resolved from env var at runtime)
22
+ const repos = new RepositoryCollection(db);
23
+ const repo = await repos.create({
24
+ owner: 'org',
25
+ name: 'my-app',
26
+ providerType: 'github',
27
+ tokenConfigKey: 'GITHUB_TOKEN',
28
+ });
29
+ await repo.save();
30
+
31
+ // Sync repository metadata from GitHub
32
+ await repo.sync();
33
+
34
+ // Discover and sync issues
35
+ const issues = await repo.getIssues({ state: 'open' });
36
+
37
+ // Living Spec: AI-synthesize comments into updated issue body
38
+ const result = await issue.incorporateFeedback({ apply: true });
39
+
40
+ // Rollback to original body
41
+ await issue.rollback();
42
+ ```
43
+
44
+ ## API
45
+
46
+ ### Models
47
+
48
+ | Export | Description |
49
+ |--------|------------|
50
+ | `Repository` | Git repository with provider integration. Methods: `sync()`, `getIssues()`, `getPullRequests()`, `createIssue()`, `createPullRequest()`, `summarizeActivity()` |
51
+ | `Issue` | Issue/ticket (STI base). Methods: `sync()`, `incorporateFeedback()`, `rollback()`, `suggestLabels()`, `close()`, `addLabels()`, `addComment()` |
52
+ | `PullRequest` | Pull request (STI subclass of Issue). Methods: `sync()`, `summarize()`, `merge()`, `markReady()`, `convertToDraft()`, `requestReviewers()`, `findLinkedIssue()` |
53
+ | `Project` | Project board (GitHub Projects V2). Methods: `sync()`, `addItem()`, `moveItem()`, `listItems()`, `updateItemStatus()`, `analyzeHealth()` |
54
+ | `Comment` | Comment on an issue or PR. AI methods: `isQuestion()`, `isApproval()`, `requestsChanges()`, `extractActionItems()`, `summarize()` |
55
+ | `Label` | Label/tag for issues. Methods: `isTypeLabel()`, `isPriorityLabel()`, `getCategory()`, `createInRepository()` |
56
+
57
+ ### Collections
58
+
59
+ | Export | Key Methods |
60
+ |--------|------------|
61
+ | `RepositoryCollection` | Standard CRUD |
62
+ | `IssueCollection` | `discover()`, `findByRepository()`, `findOpen()`, `findByLabel()`, `findByAssignee()`, `findNeedingReview()`, `findWithUnincorporatedFeedback()`, `batchSync()` |
63
+ | `PullRequestCollection` | `discover()`, `findByRepository()`, `findOpen()`, `batchSync()` |
64
+ | `ProjectCollection` | Standard CRUD, `findByTitle()` |
65
+
66
+ ### STI Hierarchy
67
+
68
+ `PullRequest` extends `Issue` via single-table inheritance. Both share the same table, discriminated by `_meta_type`. PullRequest adds `headRef`, `baseRef`, `merged`, `draft`, `additions`, `deletions`, `changedFiles`.
69
+
70
+ ### Constants
71
+
72
+ `PROJECTS_MODULE_META`, `PROJECTS_UI_SLOTS`
73
+
74
+ ### Key Types
75
+
76
+ `RepositoryProviderType` (`github | gitlab | bitbucket | azure`), `ProjectProviderType` (`github | jira | linear | zenhub`), `ProjectStatus`, `SyncStatus`, `SyncOptions`, `SearchFilters`, `CreateIssueInput`, `CreatePRInput`, `MergeMethod`, `IncorporateFeedbackOptions`, `IncorporateFeedbackResult`, `ProjectItem`, `ItemFilters`
77
+
78
+ ### Options Types
79
+
80
+ `RepositoryOptions`, `IssueOptions`, `PullRequestOptions`, `ProjectOptions`, `CommentOptions`, `LabelOptions`
81
+
82
+ ## Key Patterns
83
+
84
+ - **Token config reference**: stores env var name (`tokenConfigKey: 'GITHUB_TOKEN'`), not the token itself. Resolved at runtime from `process.env` or `getModuleConfig()`
85
+ - **Living Spec** (`incorporateFeedback()`): AI synthesizes issue comments into updated body. Supports preview mode and `rollback()`
86
+ - **Sync throttle**: sync operations skip if called within 5 minutes (override with `{ force: true }`)
87
+ - **Provider-agnostic**: GitHub primary, GitLab/Bitbucket/Azure types defined. Uses `@happyvertical/repos` and `@happyvertical/projects` SDK packages
88
+
89
+ ## Dependencies
90
+
91
+ - `@happyvertical/smrt-core` -- ORM and code generation
92
+ - `@happyvertical/smrt-config` -- configuration loading
93
+ - `@happyvertical/smrt-tenancy` -- multi-tenant scoping
94
+ - `@happyvertical/smrt-types` -- shared type definitions
95
+ - `@happyvertical/repos` -- repository provider SDK
96
+ - `@happyvertical/projects` -- project board provider SDK
97
+ - Peer: `@happyvertical/smrt-svelte`
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=__smrt-register__.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__smrt-register__.d.ts","sourceRoot":"","sources":["../src/__smrt-register__.ts"],"names":[],"mappings":""}
@@ -0,0 +1,107 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { Issue } from '../models/Issue';
3
+ import { Repository } from '../models/Repository';
4
+ import { SearchFilters } from '../types';
5
+ export declare class IssueCollection extends SmrtCollection<Issue> {
6
+ static readonly _itemClass: typeof Issue;
7
+ /**
8
+ * Discover issues from a repository and sync to database
9
+ *
10
+ * This method:
11
+ * 1. Fetches issues from the provider via SDK
12
+ * 2. Creates/updates SMRT Issue records in the database
13
+ * 3. Returns the synced Issue objects
14
+ *
15
+ * @param options - Discovery options
16
+ * @returns Array of Issue objects
17
+ */
18
+ discover(options: {
19
+ repository: Repository;
20
+ filters?: SearchFilters;
21
+ }): Promise<Issue[]>;
22
+ /**
23
+ * Find issues by repository
24
+ *
25
+ * @param repositoryId - Repository ID
26
+ * @returns Array of issues
27
+ */
28
+ findByRepository(repositoryId: string): Promise<Issue[]>;
29
+ /**
30
+ * Find open issues
31
+ *
32
+ * @param repositoryId - Optional repository filter
33
+ * @returns Array of open issues
34
+ */
35
+ findOpen(repositoryId?: string): Promise<Issue[]>;
36
+ /**
37
+ * Find issues by label
38
+ *
39
+ * @param label - Label name
40
+ * @param repositoryId - Optional repository filter
41
+ * @returns Array of issues with the label
42
+ */
43
+ findByLabel(label: string, repositoryId?: string): Promise<Issue[]>;
44
+ /**
45
+ * Find issues by assignee
46
+ *
47
+ * @param assignee - Assignee login
48
+ * @param repositoryId - Optional repository filter
49
+ * @returns Array of issues assigned to the user
50
+ */
51
+ findByAssignee(assignee: string, repositoryId?: string): Promise<Issue[]>;
52
+ /**
53
+ * Find issues needing review (AI-powered)
54
+ *
55
+ * @param repositoryId - Optional repository filter
56
+ * @returns Array of issues that need review
57
+ */
58
+ findNeedingReview(repositoryId?: string): Promise<Issue[]>;
59
+ /**
60
+ * Find issue by number in a repository
61
+ *
62
+ * @param repositoryId - Repository ID
63
+ * @param number - Issue number
64
+ * @returns Issue or null
65
+ */
66
+ findByNumber(repositoryId: string, number: number): Promise<Issue | null>;
67
+ /**
68
+ * Get issues with unincorporated feedback
69
+ *
70
+ * Issues that have comments but haven't had feedback incorporated
71
+ *
72
+ * @param repositoryId - Optional repository filter
73
+ * @returns Array of issues
74
+ */
75
+ findWithUnincorporatedFeedback(repositoryId?: string): Promise<Issue[]>;
76
+ /**
77
+ * Batch sync issues from repository
78
+ *
79
+ * @param repository - Repository to sync from
80
+ * @param options - Sync options
81
+ * @returns Array of synced issues
82
+ */
83
+ batchSync(repository: Repository, options?: {
84
+ force?: boolean;
85
+ }): Promise<Issue[]>;
86
+ /**
87
+ * Find issues by tenant ID
88
+ *
89
+ * @param tenantId - Tenant ID to filter by
90
+ * @returns Array of issues for the tenant
91
+ */
92
+ findByTenant(tenantId: string): Promise<Issue[]>;
93
+ /**
94
+ * Find global issues (no tenant)
95
+ *
96
+ * @returns Array of global issues
97
+ */
98
+ findGlobal(): Promise<Issue[]>;
99
+ /**
100
+ * Find issues for a tenant including global issues
101
+ *
102
+ * @param tenantId - Tenant ID to filter by
103
+ * @returns Array of tenant and global issues
104
+ */
105
+ findWithGlobals(tenantId: string): Promise<Issue[]>;
106
+ }
107
+ //# sourceM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AI,CAAC;IAQxB;;;;;;;OAOG;IACG,8BAA8B,CAClC,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,KAAK,EAAE,CAAC;IAQnB;;;;;;OAMG;IACG,SAAS,CACb,UAAU,EAAE,UAAU,EACtB,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAChC,OAAO,CAAC,KAAK,EAAE,CAAC;IAYnB;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAItD;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;IAIpC;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;CAM1D"}
@@ -0,0 +1,90 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { Project } from '../models/Project';
3
+ import { ProjectProviderType } from '../types';
4
+ export declare class ProjectCollection extends SmrtCollection<Project> {
5
+ static readonly _itemClass: typeof Project;
6
+ /**
7
+ * Find project by title
8
+ *
9
+ * @param title - Project title
10
+ * @returns Project or null
11
+ */
12
+ findByTitle(title: string): Promise<Project | null>;
13
+ /**
14
+ * Find projects by owner
15
+ *
16
+ * @param owner - Project owner (organization or user)
17
+ * @returns Array of projects
18
+ */
19
+ findByOwner(owner: string): Promise<Project[]>;
20
+ /**
21
+ * Find projects by provider type
22
+ *
23
+ * @param providerType - Provider type
24
+ * @returns Array of projects
25
+ */
26
+ findByProvider(providerType: ProjectProviderType): Promise<Project[]>;
27
+ /**
28
+ * Get or create a project by ID
29
+ *
30
+ * @param projectId - Provider-specific project ID
31
+ * @param options - Additional options for creation
32
+ * @returns Project (existing or newly created)
33
+ */
34
+ getOrCreate(projectId: string, options?: {
35
+ title?: string;
36
+ owner?: string;
37
+ providerType?: ProjectProviderType;
38
+ tokenConfigKey?: string;
39
+ statusFieldId?: string;
40
+ statusOptions?: Record<string, string>;
41
+ }): Promise<Project>;
42
+ /**
43
+ * Sync all projects
44
+ *
45
+ * @param options - Sync options
46
+ * @returns Array of synced projects
47
+ */
48
+ syncAll(options?: {
49
+ force?: boolean;
50
+ }): Promise<Project[]>;
51
+ /**
52
+ * Find projects with items in a specific status
53
+ *
54
+ * @param status - Status name
55
+ * @returns Array of projects
56
+ */
57
+ findWithItemsInStatus(status: string): Promise<Project[]>;
58
+ /**
59
+ * Get project statistics
60
+ *
61
+ * @param projectId - Project ID
62
+ * @returns Statistics object
63
+ */
64
+ getStatistics(projectId: string): Promise<{
65
+ totalItems: number;
66
+ itemsByStatus: Record<string, number>;
67
+ itemsByType: Record<string, number>;
68
+ }>;
69
+ /**
70
+ * Find projects by tenant ID
71
+ *
72
+ * @param tenantId - Tenant ID to filter by
73
+ * @returns Array of projects for the tenant
74
+ */
75
+ findByTenant(tenantId: string): Promise<Project[]>;
76
+ /**
77
+ * Find global projects (no tenant)
78
+ *
79
+ * @returns Array of global projects
80
+ */
81
+ findGlobal(): Promise<Project[]>;
82
+ /**
83
+ * Find projects for a tenant including global projects
84
+ *
85
+ * @param tenantId - Tenant ID to filter by
86
+ * @returns Array of tenant and global projects
87
+ */
88
+ findWithGlobals(tenantId: string): Promise<Project[]>;
89
+ }
90
+ //# sourceMappingURL=Projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Projects.d.ts","sourceRoot":"","sources":["../../src/collections/Projects.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,CAAC;IAC5D,MAAM,CAAC,QAAQ,CAAC,UAAU,iBAAW;IAErC;;;;;OAKG;IACG,WAAW,CAAC,KAA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AQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAM5D"}
@@ -0,0 +1,107 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { PullRequest } from '../models/PullRequest';
3
+ import { Repository } from '../models/Repository';
4
+ import { SearchFilters } from '../types';
5
+ export declare class PullRequestCollection extends SmrtCollection<PullRequest> {
6
+ static readonly _itemClass: typeof PullRequest;
7
+ /**
8
+ * Discover pull requests from a repository and sync to database
9
+ *
10
+ * @param options - Discovery options
11
+ * @returns Array of PullRequest objects
12
+ */
13
+ discover(options: {
14
+ repository: Repository;
15
+ filters?: SearchFilters;
16
+ }): Promise<PullRequest[]>;
17
+ /**
18
+ * Find PRs by repository
19
+ *
20
+ * @param repositoryId - Repository ID
21
+ * @returns Array of PRs
22
+ */
23
+ findByRepository(repositoryId: string): Promise<PullRequest[]>;
24
+ /**
25
+ * Find open PRs
26
+ *
27
+ * @param repositoryId - Optional repository filter
28
+ * @returns Array of open PRs
29
+ */
30
+ findOpen(repositoryId?: string): Promise<PullRequest[]>;
31
+ /**
32
+ * Find draft PRs
33
+ *
34
+ * @param repositoryId - Optional repository filter
35
+ * @returns Array of draft PRs
36
+ */
37
+ findDrafts(repositoryId?: string): Promise<PullRequest[]>;
38
+ /**
39
+ * Find PRs ready to merge
40
+ *
41
+ * @param repositoryId - Optional repository filter
42
+ * @returns Array of mergeable PRs
43
+ */
44
+ findReadyToMerge(repositoryId?: string): Promise<PullRequest[]>;
45
+ /**
46
+ * Find PRs by branch
47
+ *
48
+ * @param branch - Branch name (head or base)
49
+ * @param repositoryId - Optional repository filter
50
+ * @returns Array of PRs
51
+ */
52
+ findByBranch(branch: string, repositoryId?: string): Promise<PullRequest[]>;
53
+ /**
54
+ * Find PR by number in a repository
55
+ *
56
+ * @param repositoryId - Repository ID
57
+ * @param number - PR number
58
+ * @returns PullRequest or null
59
+ */
60
+ findByNumber(repositoryId: string, number: number): Promise<PullRequest | null>;
61
+ /**
62
+ * Find PRs ready to merge (AI-powered)
63
+ *
64
+ * @param repositoryId - Optional repository filter
65
+ * @returns Array of PRs that are ready
66
+ */
67
+ findAIReadyToMerge(repositoryId?: string): Promise<PullRequest[]>;
68
+ /**
69
+ * Get PRs by change size
70
+ *
71
+ * @param size - Size classification
72
+ * @param repositoryId - Optional repository filter
73
+ * @returns Array of PRs
74
+ */
75
+ findBySize(size: 'xs' | 's' | 'm' | 'l' | 'xl', repositoryId?: string): Promise<PullRequest[]>;
76
+ /**
77
+ * Batch sync PRs from repository
78
+ *
79
+ * @param repository - Repository to sync from
80
+ * @param options - Sync options
81
+ * @returns Array of synced PRs
82
+ */
83
+ batchSync(repository: Repository, options?: {
84
+ force?: boolean;
85
+ }): Promise<PullRequest[]>;
86
+ /**
87
+ * Find pull requests by tenant ID
88
+ *
89
+ * @param tenantId - Tenant ID to filter by
90
+ * @returns Array of pull requests for the tenant
91
+ */
92
+ findByTenant(tenantId: string): Promise<PullRequest[]>;
93
+ /**
94
+ * Find global pull requests (no tenant)
95
+ *
96
+ * @returns Array of global pull requests
97
+ */
98
+ findGlobal(): Promise<PullRequest[]>;
99
+ /**
100
+ * Find pull requests for a tenant including global pull requests
101
+ *
102
+ * @param tenantId - Tenant ID to filter by
103
+ * @returns Array of tenant and global pull requests
104
+ */
105
+ findWithGlobals(tenantId: string): Promise<PullRequest[]>;
106
+ }
107
+ //# sourceMappingURL=PullRequests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PullRequests.d.ts","sourceRoot":"","sources":["../../src/collections/PullRequests.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,UAAU,CAAC;AAI9D,qBAAa,qBAAsB,S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ChC,OAAO,CAAC,WAAW,EAAE,CAAC;IAYzB;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAI5D;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAI1C;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;CAMhE"}
@@ -0,0 +1,77 @@
1
+ import { SmrtCollection } from '@happyvertical/smrt-core';
2
+ import { Repository } from '../models/Repository';
3
+ import { RepositoryProviderType } from '../types';
4
+ export declare class RepositoryCollection extends SmrtCollection<Repository> {
5
+ static readonly _itemClass: typeof Repository;
6
+ /**
7
+ * Find a repository by owner and name
8
+ *
9
+ * @param owner - Repository owner
10
+ * @param name - Repository name
11
+ * @returns Repository or null
12
+ */
13
+ findByFullName(owner: string, name: string): Promise<Repository | null>;
14
+ /**
15
+ * Find repositories by owner
16
+ *
17
+ * @param owner - Repository owner
18
+ * @returns Array of repositories
19
+ */
20
+ findByOwner(owner: string): Promise<Repository[]>;
21
+ /**
22
+ * Find repositories by provider type
23
+ *
24
+ * @param providerType - Provider type
25
+ * @returns Array of repositories
26
+ */
27
+ findByProvider(providerType: RepositoryProviderType): Promise<Repository[]>;
28
+ /**
29
+ * Get or create a repository by owner/name
30
+ *
31
+ * @param owner - Repository owner
32
+ * @param name - Repository name
33
+ * @param options - Additional options for creation
34
+ * @returns Repository (existing or newly created)
35
+ */
36
+ getOrCreate(owner: string, name: string, options?: {
37
+ providerType?: RepositoryProviderType;
38
+ tokenConfigKey?: string;
39
+ baseUrl?: string;
40
+ }): Promise<Repository>;
41
+ /**
42
+ * Sync all repositories
43
+ *
44
+ * @param options - Sync options
45
+ * @returns Array of synced repositories
46
+ */
47
+ syncAll(options?: {
48
+ force?: boolean;
49
+ }): Promise<Repository[]>;
50
+ /**
51
+ * Find repositories with open issues
52
+ *
53
+ * @returns Array of repositories with at least one open issue
54
+ */
55
+ findWithOpenIssues(): Promise<Repository[]>;
56
+ /**
57
+ * Find repositories by tenant ID
58
+ *
59
+ * @param tenantId - Tenant ID to filter by
60
+ * @returns Array of repositories for the tenant
61
+ */
62
+ findByTenant(tenantId: string): Promise<Repository[]>;
63
+ /**
64
+ * Find global repositories (no tenant)
65
+ *
66
+ * @returns Array of global repositories
67
+ */
68
+ findGlobal(): Promise<Repository[]>;
69
+ /**
70
+ * Find repositories for a tenant including global repositories
71
+ *
72
+ * @param tenantId - Tenant ID to filter by
73
+ * @returns Array of tenant and global repositories
74
+ */
75
+ findWithGlobals(tenantId: string): Promise<Repository[]>;
76
+ }
77
+ //# sourceMappingURL=Repositories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Repositories.d.ts","sourceRoot":"","sources":["../../src/collections/Repositories.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAIvD,qBAAa,oBAAqB,SAAQ,cAAc,CAAC,UAAU,CAAC;IAClE,MAAM,CAAC,QAAQ,CAAC,UAAU,oBAAc;IAExC;;;;;;OAMG;IACG,cAAc,CAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAQ7B;;;;;OAKG;IACG,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAMvD;;;;;OAKG;IACG,cAAc,CAClB,YAAY,EAAE,sBAAsB,GACnC,OAAO,CAAC,UAAU,EAAE,CAAC;IAMxB;;;;;;;OAOG;IACG,WAAW,CACf,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE;QACP,YAAY,CAAC,EAAE,sBAAsB,CAAC;QACtC,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,OAAO,CAAC,EAAE,MAAM,CAAC;KACb,GACL,OAAO,CAAC,UAAU,CAAC;IAkBtB;;;;;OAKG;IACG,OAAO,CAAC,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAYvE;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAsBjD;;;;;OAKG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAI3D;;;;OAIG;IACG,UAAU,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAIzC;;;;;OAKG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAM/D"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Constants for smrt-projects package
3
+ */
4
+ /**
5
+ * Default sync throttle duration in milliseconds (5 minutes)
6
+ * Prevents excessive API calls by skipping sync if synced recently
7
+ */
8
+ export declare const SYNC_THROTTLE_MS: number;
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAgB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { IssueCollection } from './collections/Issues';
2
+ export { ProjectCollection } from './collections/Projects';
3
+ export { PullRequestCollection } from './collections/PullRequests';
4
+ export { RepositoryCollection } from './collections/Repositories';
5
+ export { Comment, type CommentOptions } from './models/Comment';
6
+ export { Issue, type IssueOptions } from './models/Issue';
7
+ export { Label, type LabelOptions } from './models/Label';
8
+ export { Project, type ProjectOptions } from './models/Project';
9
+ export { PullRequest, type PullRequestOptions } from './models/PullRequest';
10
+ export { Repository, type RepositoryOptions } from './models/Repository';
11
+ export { issueIncorporateFeedbackPrompt } from './prompts';
12
+ export type { Branch, CreateIssueInput, CreatePRInput, IncorporateFeedbackOptions, IncorporateFeedbackResult, IProject, IRepository, ItemFilters, MergeMethod, ProjectConfig, ProjectField, ProjectFieldOption, ProjectItem, ProjectProviderType, ProjectStatus, RepositoryConfig, RepositoryProviderType, SDKComment, SDKIssue, SDKLabel, SDKProject, SDKPullRequest, SDKRepository, SearchFilters, SyncOptions, SyncStatus, UpdateIssueInput, User, } from './types';
13
+ export { PROJECTS_MODULE_META, PROJECTS_UI_SLOTS } from './ui';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH,OAAO,wBAAwB,CAAC;AAGhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGlE,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OA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