openplanr 1.2.8 → 1.3.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 (145) hide show
  1. package/README.md +7 -3
  2. package/dist/agents/task-parser.d.ts.map +1 -1
  3. package/dist/agents/task-parser.js +8 -34
  4. package/dist/agents/task-parser.js.map +1 -1
  5. package/dist/ai/prompts/system-prompts.d.ts +2 -2
  6. package/dist/ai/prompts/system-prompts.d.ts.map +1 -1
  7. package/dist/ai/prompts/system-prompts.js +7 -7
  8. package/dist/ai/schemas/ai-response-schemas.js +1 -1
  9. package/dist/ai/schemas/ai-response-schemas.js.map +1 -1
  10. package/dist/ai/types.d.ts.map +1 -1
  11. package/dist/ai/types.js +2 -0
  12. package/dist/ai/types.js.map +1 -1
  13. package/dist/cli/commands/backlog.d.ts +12 -0
  14. package/dist/cli/commands/backlog.d.ts.map +1 -1
  15. package/dist/cli/commands/backlog.js +88 -2
  16. package/dist/cli/commands/backlog.js.map +1 -1
  17. package/dist/cli/commands/config.d.ts.map +1 -1
  18. package/dist/cli/commands/config.js +8 -2
  19. package/dist/cli/commands/config.js.map +1 -1
  20. package/dist/cli/commands/linear.d.ts +8 -0
  21. package/dist/cli/commands/linear.d.ts.map +1 -0
  22. package/dist/cli/commands/linear.js +550 -0
  23. package/dist/cli/commands/linear.js.map +1 -0
  24. package/dist/cli/commands/quick.d.ts +17 -0
  25. package/dist/cli/commands/quick.d.ts.map +1 -1
  26. package/dist/cli/commands/quick.js +31 -15
  27. package/dist/cli/commands/quick.js.map +1 -1
  28. package/dist/cli/commands/revise.d.ts +9 -8
  29. package/dist/cli/commands/revise.d.ts.map +1 -1
  30. package/dist/cli/commands/revise.js +93 -25
  31. package/dist/cli/commands/revise.js.map +1 -1
  32. package/dist/cli/index.js +2 -0
  33. package/dist/cli/index.js.map +1 -1
  34. package/dist/models/schema.d.ts +43 -0
  35. package/dist/models/schema.d.ts.map +1 -1
  36. package/dist/models/schema.js +49 -0
  37. package/dist/models/schema.js.map +1 -1
  38. package/dist/models/types.d.ts +179 -3
  39. package/dist/models/types.d.ts.map +1 -1
  40. package/dist/services/artifact-gathering.d.ts +4 -0
  41. package/dist/services/artifact-gathering.d.ts.map +1 -1
  42. package/dist/services/artifact-gathering.js +1 -1
  43. package/dist/services/artifact-gathering.js.map +1 -1
  44. package/dist/services/artifact-service.d.ts +12 -1
  45. package/dist/services/artifact-service.d.ts.map +1 -1
  46. package/dist/services/artifact-service.js +49 -6
  47. package/dist/services/artifact-service.js.map +1 -1
  48. package/dist/services/atomic-write-service.d.ts +2 -2
  49. package/dist/services/atomic-write-service.js +2 -2
  50. package/dist/services/audit-log-service.d.ts +3 -6
  51. package/dist/services/audit-log-service.d.ts.map +1 -1
  52. package/dist/services/audit-log-service.js +4 -7
  53. package/dist/services/audit-log-service.js.map +1 -1
  54. package/dist/services/cascade-service.d.ts +2 -2
  55. package/dist/services/cascade-service.js +3 -3
  56. package/dist/services/cascade-service.js.map +1 -1
  57. package/dist/services/credentials-service.js +2 -2
  58. package/dist/services/credentials-service.js.map +1 -1
  59. package/dist/services/diff-service.d.ts +1 -1
  60. package/dist/services/diff-service.js +1 -1
  61. package/dist/services/evidence-verifier.d.ts +1 -1
  62. package/dist/services/evidence-verifier.d.ts.map +1 -1
  63. package/dist/services/evidence-verifier.js +5 -2
  64. package/dist/services/evidence-verifier.js.map +1 -1
  65. package/dist/services/git-service.d.ts +4 -4
  66. package/dist/services/git-service.js +4 -4
  67. package/dist/services/graph-integrity.d.ts +2 -3
  68. package/dist/services/graph-integrity.d.ts.map +1 -1
  69. package/dist/services/graph-integrity.js +2 -3
  70. package/dist/services/graph-integrity.js.map +1 -1
  71. package/dist/services/linear/body-formatters.d.ts +69 -0
  72. package/dist/services/linear/body-formatters.d.ts.map +1 -0
  73. package/dist/services/linear/body-formatters.js +183 -0
  74. package/dist/services/linear/body-formatters.js.map +1 -0
  75. package/dist/services/linear/constants.d.ts +61 -0
  76. package/dist/services/linear/constants.d.ts.map +1 -0
  77. package/dist/services/linear/constants.js +84 -0
  78. package/dist/services/linear/constants.js.map +1 -0
  79. package/dist/services/linear/errors.d.ts +14 -0
  80. package/dist/services/linear/errors.d.ts.map +1 -0
  81. package/dist/services/linear/errors.js +106 -0
  82. package/dist/services/linear/errors.js.map +1 -0
  83. package/dist/services/linear/estimate-resolver.d.ts +50 -0
  84. package/dist/services/linear/estimate-resolver.d.ts.map +1 -0
  85. package/dist/services/linear/estimate-resolver.js +82 -0
  86. package/dist/services/linear/estimate-resolver.js.map +1 -0
  87. package/dist/services/linear/plan-builders.d.ts +64 -0
  88. package/dist/services/linear/plan-builders.d.ts.map +1 -0
  89. package/dist/services/linear/plan-builders.js +237 -0
  90. package/dist/services/linear/plan-builders.js.map +1 -0
  91. package/dist/services/linear/scope-loaders.d.ts +79 -0
  92. package/dist/services/linear/scope-loaders.d.ts.map +1 -0
  93. package/dist/services/linear/scope-loaders.js +227 -0
  94. package/dist/services/linear/scope-loaders.js.map +1 -0
  95. package/dist/services/linear/strategy-context.d.ts +66 -0
  96. package/dist/services/linear/strategy-context.d.ts.map +1 -0
  97. package/dist/services/linear/strategy-context.js +121 -0
  98. package/dist/services/linear/strategy-context.js.map +1 -0
  99. package/dist/services/linear-mapping-service.d.ts +11 -0
  100. package/dist/services/linear-mapping-service.d.ts.map +1 -0
  101. package/dist/services/linear-mapping-service.js +220 -0
  102. package/dist/services/linear-mapping-service.js.map +1 -0
  103. package/dist/services/linear-pull-service.d.ts +137 -0
  104. package/dist/services/linear-pull-service.d.ts.map +1 -0
  105. package/dist/services/linear-pull-service.js +720 -0
  106. package/dist/services/linear-pull-service.js.map +1 -0
  107. package/dist/services/linear-push-service.d.ts +86 -0
  108. package/dist/services/linear-push-service.d.ts.map +1 -0
  109. package/dist/services/linear-push-service.js +956 -0
  110. package/dist/services/linear-push-service.js.map +1 -0
  111. package/dist/services/linear-service.d.ts +122 -0
  112. package/dist/services/linear-service.d.ts.map +1 -0
  113. package/dist/services/linear-service.js +361 -0
  114. package/dist/services/linear-service.js.map +1 -0
  115. package/dist/services/prompt-service.d.ts +19 -0
  116. package/dist/services/prompt-service.d.ts.map +1 -1
  117. package/dist/services/prompt-service.js +64 -0
  118. package/dist/services/prompt-service.js.map +1 -1
  119. package/dist/services/revise-apply-service.d.ts +55 -0
  120. package/dist/services/revise-apply-service.d.ts.map +1 -0
  121. package/dist/services/revise-apply-service.js +255 -0
  122. package/dist/services/revise-apply-service.js.map +1 -0
  123. package/dist/services/revise-cache-service.d.ts +1 -1
  124. package/dist/services/revise-cache-service.js +1 -1
  125. package/dist/services/revise-plan-service.d.ts +38 -0
  126. package/dist/services/revise-plan-service.d.ts.map +1 -0
  127. package/dist/services/revise-plan-service.js +151 -0
  128. package/dist/services/revise-plan-service.js.map +1 -0
  129. package/dist/services/revise-service.d.ts +18 -11
  130. package/dist/services/revise-service.d.ts.map +1 -1
  131. package/dist/services/revise-service.js +57 -12
  132. package/dist/services/revise-service.js.map +1 -1
  133. package/dist/services/template-sections.d.ts +1 -1
  134. package/dist/services/template-sections.js +1 -1
  135. package/dist/templates/backlog/backlog-item.md.hbs +3 -0
  136. package/dist/templates/quick/quick-task.md.hbs +6 -0
  137. package/dist/utils/diff.d.ts +22 -1
  138. package/dist/utils/diff.d.ts.map +1 -1
  139. package/dist/utils/diff.js +136 -1
  140. package/dist/utils/diff.js.map +1 -1
  141. package/dist/utils/markdown.d.ts +23 -0
  142. package/dist/utils/markdown.d.ts.map +1 -1
  143. package/dist/utils/markdown.js +79 -0
  144. package/dist/utils/markdown.js.map +1 -1
  145. package/package.json +3 -2
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Pure plan-building for `planr linear push --dry-run`. Takes loaded scopes
3
+ * and returns `LinearPushPlan` objects with per-kind row counts. No Linear
4
+ * API calls; no mutations. Epic-scope plans cascade rows for linked QT/BL.
5
+ */
6
+ import type { Epic, Feature, OpenPlanrConfig, UserStory } from '../../models/types.js';
7
+ import { type ScopedFeature, type ScopedTaskFile } from './scope-loaders.js';
8
+ export type LinearPushItemKind = 'project' | 'feature' | 'story' | 'taskList' | 'quickTask' | 'backlogItem';
9
+ export type LinearPushAction = 'create' | 'update' | 'skip';
10
+ /** Scope of a granular push — what subtree `runLinearPush(artifactId)` touches. */
11
+ export type LinearPushScope = 'epic' | 'feature' | 'story' | 'taskFile' | 'quick' | 'backlog';
12
+ export interface LinearPushPlanRow {
13
+ kind: LinearPushItemKind;
14
+ /** Epic id, feature id, story id, or task-file id for this row. */
15
+ artifactId: string;
16
+ title: string;
17
+ action: LinearPushAction;
18
+ detail?: string;
19
+ }
20
+ export interface LinearPushPlan {
21
+ /** The artifact the user pointed `planr linear push` at (any supported prefix). */
22
+ rootArtifactId: string;
23
+ /** The epic that owns this push's subtree; `undefined` for standalone QT/BL pushes. */
24
+ epicId?: string;
25
+ scope: LinearPushScope;
26
+ rows: LinearPushPlanRow[];
27
+ /** Counts by kind for non-`skip` rows. Missing kinds are 0. */
28
+ counts: {
29
+ project: number;
30
+ features: number;
31
+ stories: number;
32
+ taskLists: number;
33
+ quickTasks: number;
34
+ backlogItems: number;
35
+ total: number;
36
+ };
37
+ }
38
+ /**
39
+ * Extract the linked epic id from QT / BL frontmatter. Canonical field is
40
+ * `epicId`; `parentEpic` is accepted as a compat alias for hand-authored
41
+ * files. Empty strings are normalised to `undefined`.
42
+ */
43
+ export declare function getLinkedEpicId(fm: Record<string, unknown>): string | undefined;
44
+ export declare function projectRow(epic: Epic): LinearPushPlanRow;
45
+ export declare function featureRow(f: Feature): LinearPushPlanRow;
46
+ export declare function storyRow(s: UserStory): LinearPushPlanRow;
47
+ export declare function taskListPlanRow(featureId: string, taskFiles: ScopedTaskFile[], hasBody: boolean, hadIssue: boolean): LinearPushPlanRow;
48
+ export declare function applyUpdateOnly(rows: LinearPushPlanRow[], updateOnly: boolean): LinearPushPlanRow[];
49
+ export declare function summarizePlan(rootArtifactId: string, epicId: string | undefined, scope: LinearPushScope, rows: LinearPushPlanRow[]): LinearPushPlan;
50
+ export declare function buildFeaturePlanRows(projectDir: string, config: OpenPlanrConfig, sf: ScopedFeature): Promise<LinearPushPlanRow[]>;
51
+ export declare function buildEpicPlanRows(projectDir: string, config: OpenPlanrConfig, epicScope: {
52
+ epic: Epic;
53
+ features: ScopedFeature[];
54
+ }): Promise<LinearPushPlanRow[]>;
55
+ /**
56
+ * Build a push preview (and counts) for `planr linear push --dry-run` at any
57
+ * granularity. Accepts any supported artifact id prefix (EPIC/FEAT/US/TASK/
58
+ * QT/BL); returns `null` when the artifact can't be resolved or is not
59
+ * pushable (ADR/SPRINT/checklist).
60
+ */
61
+ export declare function buildLinearPushPlan(projectDir: string, config: OpenPlanrConfig, artifactId: string, options?: {
62
+ updateOnly?: boolean;
63
+ }): Promise<LinearPushPlan | null>;
64
+ //# sourceMappingURL=plan-builders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-builders.d.ts","sourceRoot":"","sources":["../../../src/services/linear/plan-builders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGvF,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,MAAM,kBAAkB,GAC1B,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,WAAW,GACX,aAAa,CAAC;AAElB,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE5D,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,CAAC;IACzB,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;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B,cAAc,CAwBhB;AAMD,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,EAAE,EAAE,aAAa,GAChB,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiB9B;AAED,wBAAsB,iBAAiB,CACrC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,SAAS,EAAE;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,aAAa,EAAE,CAAA;CAAE,GACnD,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAiC9B;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,eAAe,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GACjC,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA2FhC"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Pure plan-building for `planr linear push --dry-run`. Takes loaded scopes
3
+ * and returns `LinearPushPlan` objects with per-kind row counts. No Linear
4
+ * API calls; no mutations. Epic-scope plans cascade rows for linked QT/BL.
5
+ */
6
+ import { findArtifactTypeById, listArtifacts, readArtifact } from '../artifact-service.js';
7
+ import { buildMergedTaskListBody, toOptionalString } from './body-formatters.js';
8
+ import { loadForBacklogItem, loadForFeature, loadForQuickTask, loadForStory, loadForTaskFile, loadLinearPushScope, } from './scope-loaders.js';
9
+ /**
10
+ * Extract the linked epic id from QT / BL frontmatter. Canonical field is
11
+ * `epicId`; `parentEpic` is accepted as a compat alias for hand-authored
12
+ * files. Empty strings are normalised to `undefined`.
13
+ */
14
+ export function getLinkedEpicId(fm) {
15
+ return toOptionalString(fm.epicId) ?? toOptionalString(fm.parentEpic);
16
+ }
17
+ function sortByArtifactId(a, b) {
18
+ return a.id.localeCompare(b.id, undefined, { numeric: true });
19
+ }
20
+ // ---------------------------------------------------------------------------
21
+ // Per-kind row builders
22
+ // ---------------------------------------------------------------------------
23
+ export function projectRow(epic) {
24
+ const id = epic.linearProjectId;
25
+ return {
26
+ kind: 'project',
27
+ artifactId: epic.id,
28
+ title: epic.title.trim() || epic.id,
29
+ action: id ? 'update' : 'create',
30
+ };
31
+ }
32
+ export function featureRow(f) {
33
+ return {
34
+ kind: 'feature',
35
+ artifactId: f.id,
36
+ title: f.title.trim() || f.id,
37
+ action: f.linearIssueId ? 'update' : 'create',
38
+ };
39
+ }
40
+ export function storyRow(s) {
41
+ return {
42
+ kind: 'story',
43
+ artifactId: s.id,
44
+ title: s.title.trim() || s.id,
45
+ action: s.linearIssueId ? 'update' : 'create',
46
+ };
47
+ }
48
+ export function taskListPlanRow(featureId, taskFiles, hasBody, hadIssue) {
49
+ if (!hasBody && !hadIssue) {
50
+ return {
51
+ kind: 'taskList',
52
+ artifactId: featureId,
53
+ title: `Tasks (${featureId})`,
54
+ action: 'skip',
55
+ detail: 'No task checkbox lines in task file(s) for this feature.',
56
+ };
57
+ }
58
+ const label = taskFiles[0]?.id ?? featureId;
59
+ return {
60
+ kind: 'taskList',
61
+ artifactId: label,
62
+ title: `Tasks: ${featureId}`,
63
+ action: hadIssue ? 'update' : 'create',
64
+ };
65
+ }
66
+ export function applyUpdateOnly(rows, updateOnly) {
67
+ if (!updateOnly)
68
+ return rows;
69
+ return rows.map((r) => r.action === 'create'
70
+ ? {
71
+ ...r,
72
+ action: 'skip',
73
+ detail: r.detail
74
+ ? `${r.detail} (not created: --update-only)`
75
+ : 'not created: --update-only',
76
+ }
77
+ : r);
78
+ }
79
+ export function summarizePlan(rootArtifactId, epicId, scope, rows) {
80
+ const countKind = (k) => rows.filter((r) => r.kind === k && r.action !== 'skip').length;
81
+ const project = countKind('project');
82
+ const features = countKind('feature');
83
+ const stories = countKind('story');
84
+ const taskLists = countKind('taskList');
85
+ const quickTasks = countKind('quickTask');
86
+ const backlogItems = countKind('backlogItem');
87
+ return {
88
+ rootArtifactId,
89
+ epicId,
90
+ scope,
91
+ rows,
92
+ counts: {
93
+ project,
94
+ features,
95
+ stories,
96
+ taskLists,
97
+ quickTasks,
98
+ backlogItems,
99
+ total: project + features + stories + taskLists + quickTasks + backlogItems,
100
+ },
101
+ };
102
+ }
103
+ // ---------------------------------------------------------------------------
104
+ // Scope-level row assembly
105
+ // ---------------------------------------------------------------------------
106
+ export async function buildFeaturePlanRows(projectDir, config, sf) {
107
+ const rows = [];
108
+ rows.push(featureRow(sf.data));
109
+ for (const st of sf.stories) {
110
+ rows.push(storyRow(st.data));
111
+ }
112
+ const withLinear = await Promise.all(sf.taskFiles.map(async (tf) => {
113
+ const a = await readArtifact(projectDir, config, 'task', tf.id);
114
+ return { tf, issueId: toOptionalString(a?.data.linearIssueId) };
115
+ }));
116
+ const hadIssue = Boolean(withLinear.find((x) => x.issueId)?.issueId);
117
+ const body = await buildMergedTaskListBody(projectDir, config, sf.data.id, sf.taskFiles);
118
+ const hasBody = body.trim().length > 0;
119
+ rows.push(taskListPlanRow(sf.data.id, sf.taskFiles, hasBody, hadIssue));
120
+ return rows;
121
+ }
122
+ export async function buildEpicPlanRows(projectDir, config, epicScope) {
123
+ const rows = [];
124
+ rows.push(projectRow(epicScope.epic));
125
+ for (const sf of epicScope.features) {
126
+ rows.push(...(await buildFeaturePlanRows(projectDir, config, sf)));
127
+ }
128
+ // Linked QT / BL artifacts get their own rows so `--dry-run` matches what
129
+ // `runLinearPush` would actually touch.
130
+ const quicks = await listArtifacts(projectDir, config, 'quick');
131
+ for (const q of quicks.sort(sortByArtifactId)) {
132
+ const art = await readArtifact(projectDir, config, 'quick', q.id);
133
+ if (!art || getLinkedEpicId(art.data) !== epicScope.epic.id)
134
+ continue;
135
+ const hasId = Boolean(toOptionalString(art.data.linearIssueId));
136
+ rows.push({
137
+ kind: 'quickTask',
138
+ artifactId: q.id,
139
+ title: art.data.title?.trim() || q.title || q.id,
140
+ action: hasId ? 'update' : 'create',
141
+ });
142
+ }
143
+ const backlogs = await listArtifacts(projectDir, config, 'backlog');
144
+ for (const b of backlogs.sort(sortByArtifactId)) {
145
+ const art = await readArtifact(projectDir, config, 'backlog', b.id);
146
+ if (!art || getLinkedEpicId(art.data) !== epicScope.epic.id)
147
+ continue;
148
+ const hasId = Boolean(toOptionalString(art.data.linearIssueId));
149
+ rows.push({
150
+ kind: 'backlogItem',
151
+ artifactId: b.id,
152
+ title: art.data.title?.trim() || b.title || b.id,
153
+ action: hasId ? 'update' : 'create',
154
+ });
155
+ }
156
+ return rows;
157
+ }
158
+ /**
159
+ * Build a push preview (and counts) for `planr linear push --dry-run` at any
160
+ * granularity. Accepts any supported artifact id prefix (EPIC/FEAT/US/TASK/
161
+ * QT/BL); returns `null` when the artifact can't be resolved or is not
162
+ * pushable (ADR/SPRINT/checklist).
163
+ */
164
+ export async function buildLinearPushPlan(projectDir, config, artifactId, options) {
165
+ const updateOnly = options?.updateOnly === true;
166
+ const type = findArtifactTypeById(artifactId);
167
+ if (!type)
168
+ return null;
169
+ if (type === 'epic') {
170
+ const scope = await loadLinearPushScope(projectDir, config, artifactId);
171
+ if (!scope)
172
+ return null;
173
+ const rows = applyUpdateOnly(await buildEpicPlanRows(projectDir, config, scope), updateOnly);
174
+ return summarizePlan(artifactId, scope.epic.id, 'epic', rows);
175
+ }
176
+ if (type === 'feature') {
177
+ const ctx = await loadForFeature(projectDir, config, artifactId);
178
+ if (!ctx)
179
+ return null;
180
+ const rows = applyUpdateOnly(await buildFeaturePlanRows(projectDir, config, ctx.sf), updateOnly);
181
+ return summarizePlan(artifactId, ctx.epic.id, 'feature', rows);
182
+ }
183
+ if (type === 'story') {
184
+ const ctx = await loadForStory(projectDir, config, artifactId);
185
+ if (!ctx)
186
+ return null;
187
+ const rows = applyUpdateOnly([storyRow(ctx.story.data)], updateOnly);
188
+ return summarizePlan(artifactId, ctx.epic.id, 'story', rows);
189
+ }
190
+ if (type === 'task') {
191
+ const ctx = await loadForTaskFile(projectDir, config, artifactId);
192
+ if (!ctx)
193
+ return null;
194
+ const withLinear = await Promise.all(ctx.sf.taskFiles.map(async (tf) => {
195
+ const a = await readArtifact(projectDir, config, 'task', tf.id);
196
+ return { tf, issueId: toOptionalString(a?.data.linearIssueId) };
197
+ }));
198
+ const hadIssue = Boolean(withLinear.find((x) => x.issueId)?.issueId);
199
+ const body = await buildMergedTaskListBody(projectDir, config, ctx.sf.data.id, ctx.sf.taskFiles);
200
+ const hasBody = body.trim().length > 0;
201
+ const rows = applyUpdateOnly([taskListPlanRow(ctx.sf.data.id, ctx.sf.taskFiles, hasBody, hadIssue)], updateOnly);
202
+ return summarizePlan(artifactId, ctx.epic.id, 'taskFile', rows);
203
+ }
204
+ if (type === 'quick') {
205
+ const qt = await loadForQuickTask(projectDir, config, artifactId);
206
+ if (!qt)
207
+ return null;
208
+ const hasId = Boolean(toOptionalString(qt.frontmatter.linearIssueId));
209
+ const rows = applyUpdateOnly([
210
+ {
211
+ kind: 'quickTask',
212
+ artifactId,
213
+ title: qt.title.trim() || qt.id,
214
+ action: hasId ? 'update' : 'create',
215
+ },
216
+ ], updateOnly);
217
+ return summarizePlan(artifactId, undefined, 'quick', rows);
218
+ }
219
+ if (type === 'backlog') {
220
+ const bl = await loadForBacklogItem(projectDir, config, artifactId);
221
+ if (!bl)
222
+ return null;
223
+ const hasId = Boolean(toOptionalString(bl.frontmatter.linearIssueId));
224
+ const rows = applyUpdateOnly([
225
+ {
226
+ kind: 'backlogItem',
227
+ artifactId,
228
+ title: bl.title.trim() || bl.id,
229
+ action: hasId ? 'update' : 'create',
230
+ },
231
+ ], updateOnly);
232
+ return summarizePlan(artifactId, undefined, 'backlog', rows);
233
+ }
234
+ // sprint / adr / checklist — not supported.
235
+ return null;
236
+ }
237
+ //# sourceMappingURL=plan-builders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-builders.js","sourceRoot":"","sources":["../../../src/services/linear/plan-builders.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,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E,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE;gBAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;aACpC;SACF,EACD,UAAU,CACX,CAAC;QACF,OAAO,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,MAAM,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;QACpE,IAAI,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;QACrB,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;QACtE,MAAM,IAAI,GAAG,eAAe,CAC1B;YACE;gBACE,IAAI,EAAE,aAAa;gBACnB,UAAU;gBACV,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE;gBAC/B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ;aACpC;SACF,EACD,UAAU,CACX,CAAC;QACF,OAAO,aAAa,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC/D,CAAC;IAED,4CAA4C;IAC5C,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Pure data loaders that hydrate OpenPlanr artifacts into the shapes the
3
+ * Linear push expects. No Linear API calls, no mutations — just filesystem
4
+ * reads + frontmatter parsing. Every scope-level push function routes
5
+ * through one of these loaders first.
6
+ */
7
+ import type { Epic, Feature, OpenPlanrConfig, UserStory } from '../../models/types.js';
8
+ export interface ScopedTaskFile {
9
+ id: string;
10
+ title: string;
11
+ }
12
+ export interface ScopedStory {
13
+ id: string;
14
+ title: string;
15
+ data: UserStory;
16
+ /** Raw YAML frontmatter — carries fields not mapped onto the typed `data`
17
+ * (e.g. `estimatedPoints`, `storyPoints` for Linear estimate sync). */
18
+ frontmatter: Record<string, unknown>;
19
+ }
20
+ export interface ScopedFeature {
21
+ id: string;
22
+ title: string;
23
+ data: Feature;
24
+ /** Raw YAML frontmatter — same purpose as ScopedStory.frontmatter. */
25
+ frontmatter: Record<string, unknown>;
26
+ stories: ScopedStory[];
27
+ taskFiles: ScopedTaskFile[];
28
+ }
29
+ /**
30
+ * Shape needed to push a standalone artifact (QT or BL) — the raw markdown
31
+ * (so QT can parse + re-render its checkbox list) plus the frontmatter
32
+ * record (linear* fields, epicId link, etc.).
33
+ */
34
+ export interface ScopedStandaloneArtifact {
35
+ id: string;
36
+ title: string;
37
+ raw: string;
38
+ frontmatter: Record<string, unknown>;
39
+ }
40
+ /**
41
+ * Load the full epic subtree (epic frontmatter + features + stories per
42
+ * feature + task-file ids per feature). Filters by `epicId` on each child
43
+ * artifact.
44
+ */
45
+ export declare function loadLinearPushScope(projectDir: string, config: OpenPlanrConfig, epicId: string): Promise<{
46
+ epic: Epic;
47
+ features: ScopedFeature[];
48
+ } | null>;
49
+ /**
50
+ * Parent-chain context needed to push a feature: the feature itself (with
51
+ * its stories and task files) plus its parent epic. Returns `null` if the
52
+ * feature can't be resolved or has no valid `epicId` pointer.
53
+ */
54
+ export declare function loadForFeature(projectDir: string, config: OpenPlanrConfig, featureId: string): Promise<{
55
+ epic: Epic;
56
+ sf: ScopedFeature;
57
+ } | null>;
58
+ /**
59
+ * Parent-chain context needed to push a story: the story itself, its
60
+ * feature (with sibling stories + tasklists) and the containing epic.
61
+ * Returns `null` if any link in the chain is missing.
62
+ */
63
+ export declare function loadForStory(projectDir: string, config: OpenPlanrConfig, storyId: string): Promise<{
64
+ epic: Epic;
65
+ sf: ScopedFeature;
66
+ story: ScopedStory;
67
+ } | null>;
68
+ /**
69
+ * Parent-chain context needed to push a task file: the containing feature
70
+ * (with all its task files merged into one Linear sub-issue body) and the
71
+ * epic.
72
+ */
73
+ export declare function loadForTaskFile(projectDir: string, config: OpenPlanrConfig, taskId: string): Promise<{
74
+ epic: Epic;
75
+ sf: ScopedFeature;
76
+ } | null>;
77
+ export declare function loadForQuickTask(projectDir: string, config: OpenPlanrConfig, qtId: string): Promise<ScopedStandaloneArtifact | null>;
78
+ export declare function loadForBacklogItem(projectDir: string, config: OpenPlanrConfig, blId: string): Promise<ScopedStandaloneArtifact | null>;
79
+ //# sourceMappingURL=scope-loaders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-loaders.d.ts","sourceRoot":"","sources":["../../../src/services/linear/scope-loaders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,eAAe,EAAc,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAkBnG,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,SAAS,CAAC;IAChB;2EACuE;IACvE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,sEAAsE;IACtE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,C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GAAG,IAAI,CAAC,CAW1C"}
@@ -0,0 +1,227 @@
1
+ /**
2
+ * Pure data loaders that hydrate OpenPlanr artifacts into the shapes the
3
+ * Linear push expects. No Linear API calls, no mutations — just filesystem
4
+ * reads + frontmatter parsing. Every scope-level push function routes
5
+ * through one of these loaders first.
6
+ */
7
+ import { listArtifacts, readArtifact, readArtifactRaw } from '../artifact-service.js';
8
+ import { toOptionalString, toOptionalStringArray } from './body-formatters.js';
9
+ import { toOptionalStrategy } from './strategy-context.js';
10
+ function sortByArtifactId(a, b) {
11
+ return a.id.localeCompare(b.id, undefined, { numeric: true });
12
+ }
13
+ function asTaskStatus(s) {
14
+ if (s === 'pending' || s === 'in-progress' || s === 'done')
15
+ return s;
16
+ return 'pending';
17
+ }
18
+ function nowIso() {
19
+ return new Date().toISOString().split('T')[0];
20
+ }
21
+ /**
22
+ * Load the full epic subtree (epic frontmatter + features + stories per
23
+ * feature + task-file ids per feature). Filters by `epicId` on each child
24
+ * artifact.
25
+ */
26
+ export async function loadLinearPushScope(projectDir, config, epicId) {
27
+ const epicArt = await readArtifact(projectDir, config, 'epic', epicId);
28
+ if (!epicArt)
29
+ return null;
30
+ const d = epicArt.data;
31
+ const epic = {
32
+ id: d.id || epicId,
33
+ title: d.title || '',
34
+ createdAt: d.createdAt || d.created || nowIso(),
35
+ updatedAt: d.updatedAt || d.updated || nowIso(),
36
+ filePath: epicArt.filePath,
37
+ owner: d.owner || '',
38
+ businessValue: d.businessValue || '',
39
+ targetUsers: d.targetUsers || '',
40
+ problemStatement: d.problemStatement || '',
41
+ solutionOverview: d.solutionOverview || '',
42
+ successCriteria: d.successCriteria || '',
43
+ keyFeatures: d.keyFeatures || [],
44
+ dependencies: d.dependencies || '',
45
+ risks: d.risks || '',
46
+ featureIds: d.featureIds || [],
47
+ linearProjectId: toOptionalString(d.linearProjectId),
48
+ linearProjectIdentifier: toOptionalString(d.linearProjectIdentifier),
49
+ linearProjectUrl: toOptionalString(d.linearProjectUrl),
50
+ linearMappingStrategy: toOptionalStrategy(d.linearMappingStrategy),
51
+ linearMilestoneId: toOptionalString(d.linearMilestoneId),
52
+ linearLabelId: toOptionalString(d.linearLabelId),
53
+ };
54
+ const allFeatures = (await listArtifacts(projectDir, config, 'feature')).sort(sortByArtifactId);
55
+ const allStories = (await listArtifacts(projectDir, config, 'story')).sort(sortByArtifactId);
56
+ const allTasks = (await listArtifacts(projectDir, config, 'task')).sort(sortByArtifactId);
57
+ const featuresUnderEpic = [];
58
+ for (const f of allFeatures) {
59
+ const a = await readArtifact(projectDir, config, 'feature', f.id);
60
+ if (!a || a.data.epicId !== epicId)
61
+ continue;
62
+ const fd = a.data;
63
+ const feature = {
64
+ id: fd.id || f.id,
65
+ title: fd.title || f.title,
66
+ createdAt: fd.createdAt || fd.created || nowIso(),
67
+ updatedAt: fd.updatedAt || fd.updated || nowIso(),
68
+ filePath: a.filePath,
69
+ epicId: fd.epicId,
70
+ owner: fd.owner || '',
71
+ status: asTaskStatus(fd.status),
72
+ overview: fd.overview || '',
73
+ functionalRequirements: fd.functionalRequirements || [],
74
+ storyIds: fd.storyIds || [],
75
+ linearIssueId: toOptionalString(fd.linearIssueId),
76
+ linearIssueIdentifier: toOptionalString(fd.linearIssueIdentifier),
77
+ linearIssueUrl: toOptionalString(fd.linearIssueUrl),
78
+ linearProjectMilestoneId: toOptionalString(fd.linearProjectMilestoneId),
79
+ linearLabelIds: toOptionalStringArray(fd.linearLabelIds),
80
+ };
81
+ const stories = [];
82
+ for (const s of allStories) {
83
+ const st = await readArtifact(projectDir, config, 'story', s.id);
84
+ if (!st || st.data.featureId !== feature.id)
85
+ continue;
86
+ const sd = st.data;
87
+ const story = {
88
+ id: sd.id || s.id,
89
+ title: sd.title || s.title,
90
+ createdAt: sd.createdAt || sd.created || nowIso(),
91
+ updatedAt: sd.updatedAt || sd.updated || nowIso(),
92
+ filePath: st.filePath,
93
+ featureId: sd.featureId,
94
+ status: asTaskStatus(sd.status),
95
+ role: sd.role || '',
96
+ goal: sd.goal || '',
97
+ benefit: sd.benefit || '',
98
+ acceptanceCriteria: sd.acceptanceCriteria || '',
99
+ additionalNotes: toOptionalString(sd.additionalNotes),
100
+ linearIssueId: toOptionalString(sd.linearIssueId),
101
+ linearIssueIdentifier: toOptionalString(sd.linearIssueIdentifier),
102
+ linearIssueUrl: toOptionalString(sd.linearIssueUrl),
103
+ linearParentIssueId: toOptionalString(sd.linearParentIssueId),
104
+ linearProjectMilestoneId: toOptionalString(sd.linearProjectMilestoneId),
105
+ linearLabelIds: toOptionalStringArray(sd.linearLabelIds),
106
+ };
107
+ stories.push({
108
+ id: story.id,
109
+ title: story.title,
110
+ data: story,
111
+ frontmatter: sd,
112
+ });
113
+ }
114
+ const taskFiles = [];
115
+ for (const t of allTasks) {
116
+ const ta = await readArtifact(projectDir, config, 'task', t.id);
117
+ const pfeat = toOptionalString(ta?.data.featureId);
118
+ if (pfeat === feature.id) {
119
+ taskFiles.push({ id: t.id, title: t.title });
120
+ }
121
+ }
122
+ featuresUnderEpic.push({
123
+ id: feature.id,
124
+ title: feature.title,
125
+ data: feature,
126
+ frontmatter: fd,
127
+ stories,
128
+ taskFiles,
129
+ });
130
+ }
131
+ return { epic, features: featuresUnderEpic };
132
+ }
133
+ /**
134
+ * Parent-chain context needed to push a feature: the feature itself (with
135
+ * its stories and task files) plus its parent epic. Returns `null` if the
136
+ * feature can't be resolved or has no valid `epicId` pointer.
137
+ */
138
+ export async function loadForFeature(projectDir, config, featureId) {
139
+ const featureArt = await readArtifact(projectDir, config, 'feature', featureId);
140
+ if (!featureArt)
141
+ return null;
142
+ const parentEpicId = toOptionalString(featureArt.data.epicId);
143
+ if (!parentEpicId)
144
+ return null;
145
+ const epicScope = await loadLinearPushScope(projectDir, config, parentEpicId);
146
+ if (!epicScope)
147
+ return null;
148
+ const sf = epicScope.features.find((f) => f.id === featureId);
149
+ if (!sf)
150
+ return null;
151
+ return { epic: epicScope.epic, sf };
152
+ }
153
+ /**
154
+ * Parent-chain context needed to push a story: the story itself, its
155
+ * feature (with sibling stories + tasklists) and the containing epic.
156
+ * Returns `null` if any link in the chain is missing.
157
+ */
158
+ export async function loadForStory(projectDir, config, storyId) {
159
+ const storyArt = await readArtifact(projectDir, config, 'story', storyId);
160
+ if (!storyArt)
161
+ return null;
162
+ const parentFeatureId = toOptionalString(storyArt.data.featureId);
163
+ if (!parentFeatureId)
164
+ return null;
165
+ const ctx = await loadForFeature(projectDir, config, parentFeatureId);
166
+ if (!ctx)
167
+ return null;
168
+ const story = ctx.sf.stories.find((s) => s.id === storyId);
169
+ if (!story)
170
+ return null;
171
+ return { epic: ctx.epic, sf: ctx.sf, story };
172
+ }
173
+ /**
174
+ * Parent-chain context needed to push a task file: the containing feature
175
+ * (with all its task files merged into one Linear sub-issue body) and the
176
+ * epic.
177
+ */
178
+ export async function loadForTaskFile(projectDir, config, taskId) {
179
+ const taskArt = await readArtifact(projectDir, config, 'task', taskId);
180
+ if (!taskArt)
181
+ return null;
182
+ const parentFeatureId = toOptionalString(taskArt.data.featureId);
183
+ if (!parentFeatureId)
184
+ return null;
185
+ return loadForFeature(projectDir, config, parentFeatureId);
186
+ }
187
+ /**
188
+ * Frontmatter sanity check for standalone artifacts. Every pushable file
189
+ * MUST have at least a real `title` — otherwise we end up creating a
190
+ * Linear issue whose title is just the artifact id (e.g. "QT-015"), and
191
+ * then the subsequent `updateArtifactFields` write-back fails because the
192
+ * file's frontmatter block is malformed. Bail here, before any API call,
193
+ * so the Linear side stays clean.
194
+ */
195
+ function requireFrontmatter(kind, id, filePath, data) {
196
+ const title = toOptionalString(data.title);
197
+ if (!title) {
198
+ throw new Error(`${kind} ${id} has no \`title\` field in its frontmatter.\n ${filePath}\n Fix the file's frontmatter (must be a \`---\`-delimited YAML block with at least \`id\` and \`title\`) and re-run. No changes were pushed to Linear.`);
199
+ }
200
+ }
201
+ export async function loadForQuickTask(projectDir, config, qtId) {
202
+ const art = await readArtifact(projectDir, config, 'quick', qtId);
203
+ if (!art)
204
+ return null;
205
+ requireFrontmatter('Quick task', qtId, art.filePath, art.data);
206
+ const raw = (await readArtifactRaw(projectDir, config, 'quick', qtId)) ?? '';
207
+ return {
208
+ id: art.data.id || qtId,
209
+ title: art.data.title,
210
+ raw,
211
+ frontmatter: art.data,
212
+ };
213
+ }
214
+ export async function loadForBacklogItem(projectDir, config, blId) {
215
+ const art = await readArtifact(projectDir, config, 'backlog', blId);
216
+ if (!art)
217
+ return null;
218
+ requireFrontmatter('Backlog item', blId, art.filePath, art.data);
219
+ const raw = (await readArtifactRaw(projectDir, config, 'backlog', blId)) ?? '';
220
+ return {
221
+ id: art.data.id || blId,
222
+ title: art.data.title,
223
+ raw,
224
+ frontmatter: art.data,
225
+ };
226
+ }
227
+ //# sourceMappingURL=scope-loaders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-loaders.js","sourceRoot":"","sources":["../../../src/services/linear/scope-loaders.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,SAAS,gBAAgB,CAAC,CAAiB,EAAE,CAAiB;IAC5D,OAAO,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,YAAY,CAAC,CAAU;IAC9B,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC;IACrE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,MAAM;IACb,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAA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