hub-launch 1.30.0 → 1.31.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 (96) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +52 -0
  3. package/dist/commands/errorWatcher.d.ts +2 -0
  4. package/dist/commands/errorWatcher.d.ts.map +1 -1
  5. package/dist/commands/errorWatcher.js +13 -0
  6. package/dist/commands/errorWatcher.js.map +1 -1
  7. package/dist/commands/init.d.ts +12 -0
  8. package/dist/commands/init.d.ts.map +1 -1
  9. package/dist/commands/init.js +52 -1
  10. package/dist/commands/init.js.map +1 -1
  11. package/dist/commands/launch.d.ts +36 -0
  12. package/dist/commands/launch.d.ts.map +1 -1
  13. package/dist/commands/launch.js +267 -6
  14. package/dist/commands/launch.js.map +1 -1
  15. package/dist/commands/login.d.ts +14 -1
  16. package/dist/commands/login.d.ts.map +1 -1
  17. package/dist/commands/login.js +26 -4
  18. package/dist/commands/login.js.map +1 -1
  19. package/dist/commands/schedule.d.ts.map +1 -1
  20. package/dist/commands/schedule.js +12 -0
  21. package/dist/commands/schedule.js.map +1 -1
  22. package/dist/commands/script.d.ts +1 -1
  23. package/dist/commands/script.d.ts.map +1 -1
  24. package/dist/commands/script.js +3 -0
  25. package/dist/commands/script.js.map +1 -1
  26. package/dist/commands/session-hook.d.ts +9 -0
  27. package/dist/commands/session-hook.d.ts.map +1 -1
  28. package/dist/commands/session-hook.js +60 -15
  29. package/dist/commands/session-hook.js.map +1 -1
  30. package/dist/index.js +2 -1
  31. package/dist/index.js.map +1 -1
  32. package/dist/scripts/backlog-add.d.ts +2 -0
  33. package/dist/scripts/backlog-add.d.ts.map +1 -0
  34. package/dist/scripts/backlog-add.js +145 -0
  35. package/dist/scripts/backlog-add.js.map +1 -0
  36. package/dist/scripts/backlog-init.d.ts +2 -0
  37. package/dist/scripts/backlog-init.d.ts.map +1 -0
  38. package/dist/scripts/backlog-init.js +84 -0
  39. package/dist/scripts/backlog-init.js.map +1 -0
  40. package/dist/scripts/backlog-resync.d.ts +2 -0
  41. package/dist/scripts/backlog-resync.d.ts.map +1 -0
  42. package/dist/scripts/backlog-resync.js +156 -0
  43. package/dist/scripts/backlog-resync.js.map +1 -0
  44. package/dist/scripts/launch-run.d.ts +1 -0
  45. package/dist/scripts/launch-run.d.ts.map +1 -1
  46. package/dist/scripts/launch-run.js +47 -3
  47. package/dist/scripts/launch-run.js.map +1 -1
  48. package/dist/scripts/lib/backlog-sync.d.ts +27 -0
  49. package/dist/scripts/lib/backlog-sync.d.ts.map +1 -0
  50. package/dist/scripts/lib/backlog-sync.js +48 -0
  51. package/dist/scripts/lib/backlog-sync.js.map +1 -0
  52. package/dist/scripts/lib/read-config.d.ts +16 -0
  53. package/dist/scripts/lib/read-config.d.ts.map +1 -1
  54. package/dist/scripts/lib/read-config.js +34 -0
  55. package/dist/scripts/lib/read-config.js.map +1 -1
  56. package/dist/services/api/HulaApiClient.d.ts +39 -0
  57. package/dist/services/api/HulaApiClient.d.ts.map +1 -1
  58. package/dist/services/api/HulaApiClient.js +15 -0
  59. package/dist/services/api/HulaApiClient.js.map +1 -1
  60. package/dist/services/github/IssueService.d.ts.map +1 -1
  61. package/dist/services/github/IssueService.js +3 -0
  62. package/dist/services/github/IssueService.js.map +1 -1
  63. package/dist/services/plan/GitHubSourcePlanService.d.ts +67 -0
  64. package/dist/services/plan/GitHubSourcePlanService.d.ts.map +1 -0
  65. package/dist/services/plan/GitHubSourcePlanService.js +148 -0
  66. package/dist/services/plan/GitHubSourcePlanService.js.map +1 -0
  67. package/dist/services/plan/PlanBranchService.d.ts +5 -1
  68. package/dist/services/plan/PlanBranchService.d.ts.map +1 -1
  69. package/dist/services/plan/PlanBranchService.js +21 -3
  70. package/dist/services/plan/PlanBranchService.js.map +1 -1
  71. package/dist/templates/proceed-instructions.md +2 -1
  72. package/dist/templates/skills/hula-approve/SKILL.md +31 -0
  73. package/dist/templates/skills/hula-fix/SKILL.md +10 -0
  74. package/dist/templates/skills/hula-launch/SKILL.md +40 -1
  75. package/dist/templates/skills/hula-plan/SKILL.md +39 -4
  76. package/dist/types/config.schema.d.ts +24 -0
  77. package/dist/types/config.schema.d.ts.map +1 -1
  78. package/dist/types/config.schema.js +11 -0
  79. package/dist/types/config.schema.js.map +1 -1
  80. package/dist/types/issue.schema.d.ts +6 -0
  81. package/dist/types/issue.schema.d.ts.map +1 -1
  82. package/dist/types/issue.schema.js +8 -0
  83. package/dist/types/issue.schema.js.map +1 -1
  84. package/dist/types/pr.schema.d.ts +38 -0
  85. package/dist/types/pr.schema.d.ts.map +1 -1
  86. package/dist/types/pr.schema.js +7 -0
  87. package/dist/types/pr.schema.js.map +1 -1
  88. package/dist/utils/client-session.d.ts +16 -0
  89. package/dist/utils/client-session.d.ts.map +1 -1
  90. package/dist/utils/client-session.js +29 -0
  91. package/dist/utils/client-session.js.map +1 -1
  92. package/dist/utils/sandbox-profile.d.ts +44 -0
  93. package/dist/utils/sandbox-profile.d.ts.map +1 -0
  94. package/dist/utils/sandbox-profile.js +78 -0
  95. package/dist/utils/sandbox-profile.js.map +1 -0
  96. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"IssueService.js","sourceRoot":"","sources":["../../../src/services/github/IssueService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAKL,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,OAAO,YAAY;IACvB;;;OAGG;IACH,MAAM,CAAC,WAAW,CAAC,WAAmB,EAAE,KAAc,EAAE,IAAa;QACnE,OAAO,CAAC,KAAK,IAAI,IAAI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K,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,EAAuB;YACrD,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;SACrD,CAAC,CAAC,CAAC;IACN,CAAC;IAED;;OAEG;IACK,wBAAwB,CAAC,WAAwB;QACvD,OAAO;YACL,MAAM,EAAE,WAAW,CAAC,MAAM;YAC1B,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,IAAI,EAAE,WAAW,CAAC,IAAI,IAAI,SAAS;YACnC,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,GAAG,EAAE,WAAW,CAAC,QAAQ;YACzB,SAAS,EAAE,WAAW,CAAC,UAAU;YACjC,SAAS,EAAE,WAAW,CAAC,UAAU;YACjC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;YACpD,GAAG,CAAC,WAAW,CAAC,YAAY,KAAK,SAAS;gBACxC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE;gBACzB,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,67 @@
1
+ import type { Issue } from '../../types/index.js';
2
+ import type { PullRequest } from '../../types/index.js';
3
+ /**
4
+ * GitHub-source plan generation for `hula launch --issue` / `--pr`.
5
+ *
6
+ * The CLI can start a launch from an existing GitHub issue or pull request
7
+ * instead of a local plan file. This module owns everything GitHub-specific:
8
+ * parsing the `--issue` / `--pr` reference, resolving and validating the issue
9
+ * or PR through the existing services, turning its text into a generated plan
10
+ * markdown, and writing that plan to the local plans directory (from where the
11
+ * normal launch flow publishes it to the feature branch and deletes it after a
12
+ * successful POST).
13
+ */
14
+ /** A parsed `--issue` / `--pr` reference. owner/repo are present only for URLs. */
15
+ export interface GitHubRef {
16
+ number: number;
17
+ owner?: string;
18
+ repo?: string;
19
+ }
20
+ /**
21
+ * Parse an `--issue` / `--pr` value: a number (`42`), a `#`-prefixed number
22
+ * (`#42`), or a full GitHub URL (`https://github.com/<owner>/<repo>/issues/<n>`
23
+ * for `issue`, `/pull/<n>` for `pr`), with an optional trailing `/`, `#...`, or
24
+ * `?...`.
25
+ *
26
+ * Throws a clear, flag-specific error on anything else (including an issue URL
27
+ * passed to `--pr` or vice versa — the path segment must match `kind`).
28
+ */
29
+ export declare function parseGitHubRef(input: string, kind: 'issue' | 'pr'): GitHubRef;
30
+ /**
31
+ * Find the first issue number linked from a PR body via a GitHub closing
32
+ * keyword (`Closes #5`, `fixes: #5`, `Resolved #5`, …). Returns `null` when
33
+ * there is no such reference.
34
+ */
35
+ export declare function findLinkedIssueNumber(body: string | null): number | null;
36
+ /**
37
+ * Resolve an explicit `--issue <n>` into a validated open issue (not a PR).
38
+ */
39
+ export declare function resolveIssueSource(n: number, repo: {
40
+ owner?: string;
41
+ name?: string;
42
+ }): Promise<Issue>;
43
+ /**
44
+ * Resolve `--pr <n>` into a validated open, same-repo pull request.
45
+ */
46
+ export declare function resolvePrSource(n: number): Promise<PullRequest>;
47
+ /**
48
+ * Build the generated plan markdown from a resolved issue and/or PR. Sections
49
+ * are omitted when the source is absent; empty descriptions become a
50
+ * placeholder so the plan never has a blank body.
51
+ */
52
+ export declare function buildPlanMarkdown(input: {
53
+ issue?: Issue;
54
+ pr?: PullRequest;
55
+ repoFullName: string;
56
+ }): string;
57
+ /**
58
+ * Write a generated plan to `<planDir>/<YYYY-MM-DD-HH:MM>-<slug>.md`, creating
59
+ * the directory if needed, and return the path relative to the repo root
60
+ * (`planDir`'s parent chain). A relaunch in the same minute overwrites the file.
61
+ *
62
+ * `planDir` is the repo-relative plans directory (`config.planPath`). The
63
+ * returned path is repo-relative so the normal launch flow (publish + delete)
64
+ * treats it exactly like a hand-written plan.
65
+ */
66
+ export declare function writeGeneratedPlan(planDir: string, slug: string, markdown: string, repoRoot?: string): string;
67
+ //# sourceMappingURL=GitHubSourcePlanService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubSourcePlanService.d.ts","sourceRoot":"","sources":["../../../src/services/plan/GitHubSourcePlanService.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD;;;;;;;;;;GAUG;AAEH,mFAAmF;AACnF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,GAAG,IAAI,GACnB,SAAS,CAgCX;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAMxE;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,CAAC,EAAE,MAAM,EACT,IAAI,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC,OAAO,CAAC,KAAK,CAAC,CAahB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAuBrE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,MAAM,CAsCT;AAcD;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,QAAQ,GAAE,MAAsB,GAC/B,MAAM,CAaR"}
@@ -0,0 +1,148 @@
1
+ import { existsSync, mkdirSync, writeFileSync } from 'fs';
2
+ import { isAbsolute, join, relative } from 'path';
3
+ import { IssueService } from '../github/IssueService.js';
4
+ import { PRService } from '../github/PRService.js';
5
+ /**
6
+ * Parse an `--issue` / `--pr` value: a number (`42`), a `#`-prefixed number
7
+ * (`#42`), or a full GitHub URL (`https://github.com/<owner>/<repo>/issues/<n>`
8
+ * for `issue`, `/pull/<n>` for `pr`), with an optional trailing `/`, `#...`, or
9
+ * `?...`.
10
+ *
11
+ * Throws a clear, flag-specific error on anything else (including an issue URL
12
+ * passed to `--pr` or vice versa — the path segment must match `kind`).
13
+ */
14
+ export function parseGitHubRef(input, kind) {
15
+ const trimmed = input.trim();
16
+ const segment = kind === 'issue' ? 'issues' : 'pull';
17
+ const badValue = () => {
18
+ throw new Error(`Invalid --${kind} value "${input}". Use a number, #number, or https://github.com/<owner>/<repo>/${segment}/<n>`);
19
+ };
20
+ // Plain number or #number.
21
+ const numMatch = /^#?(\d+)$/.exec(trimmed);
22
+ if (numMatch) {
23
+ const number = Number(numMatch[1]);
24
+ if (!Number.isSafeInteger(number) || number <= 0)
25
+ badValue();
26
+ return { number };
27
+ }
28
+ // GitHub URL. The path segment (issues|pull) must match `kind` so an issue
29
+ // URL handed to --pr (or vice versa) is rejected rather than silently
30
+ // treated as the other kind.
31
+ const urlMatch = /^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/(issues|pull)\/(\d+)(?:[/#?].*)?$/i.exec(trimmed);
32
+ if (urlMatch && urlMatch[3]?.toLowerCase() === segment) {
33
+ const number = Number(urlMatch[4]);
34
+ if (!Number.isSafeInteger(number) || number <= 0)
35
+ badValue();
36
+ return { number, owner: urlMatch[1], repo: urlMatch[2] };
37
+ }
38
+ return badValue();
39
+ }
40
+ /**
41
+ * Find the first issue number linked from a PR body via a GitHub closing
42
+ * keyword (`Closes #5`, `fixes: #5`, `Resolved #5`, …). Returns `null` when
43
+ * there is no such reference.
44
+ */
45
+ export function findLinkedIssueNumber(body) {
46
+ if (!body)
47
+ return null;
48
+ const match = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?)\s*:?\s+#(\d+)\b/i.exec(body);
49
+ return match ? Number(match[1]) : null;
50
+ }
51
+ /**
52
+ * Resolve an explicit `--issue <n>` into a validated open issue (not a PR).
53
+ */
54
+ export async function resolveIssueSource(n, repo) {
55
+ const issue = await new IssueService().get(n, repo.owner, repo.name);
56
+ if (issue.isPullRequest) {
57
+ throw new Error(`#${n} is a pull request, not an issue. Use --pr ${n} instead.`);
58
+ }
59
+ if (issue.state !== 'open') {
60
+ throw new Error(`Issue #${n} is closed. Reopen it on GitHub before launching.`);
61
+ }
62
+ return issue;
63
+ }
64
+ /**
65
+ * Resolve `--pr <n>` into a validated open, same-repo pull request.
66
+ */
67
+ export async function resolvePrSource(n) {
68
+ const pr = await new PRService().get(n);
69
+ if (pr.merged_at) {
70
+ throw new Error(`PR #${n} is already merged. Nothing to continue.`);
71
+ }
72
+ if (pr.state !== 'open') {
73
+ throw new Error(`PR #${n} is closed. Reopen it on GitHub before launching.`);
74
+ }
75
+ const headFullName = pr.head.repo?.full_name ?? null;
76
+ const baseFullName = pr.base.repo?.full_name ?? null;
77
+ const isFork = headFullName === null ||
78
+ (baseFullName !== null &&
79
+ headFullName.toLowerCase() !== baseFullName.toLowerCase());
80
+ if (isFork) {
81
+ const source = headFullName ?? 'a deleted fork';
82
+ throw new Error(`PR #${n} comes from a fork (${source}). HubLaunch can only continue pull requests whose branch is in this repository.`);
83
+ }
84
+ return pr;
85
+ }
86
+ /**
87
+ * Build the generated plan markdown from a resolved issue and/or PR. Sections
88
+ * are omitted when the source is absent; empty descriptions become a
89
+ * placeholder so the plan never has a blank body.
90
+ */
91
+ export function buildPlanMarkdown(input) {
92
+ const { issue, pr, repoFullName } = input;
93
+ const placeholder = '_No description provided._';
94
+ const title = pr ? pr.title : (issue?.title ?? 'Untitled');
95
+ const sourceLines = [];
96
+ if (pr) {
97
+ sourceLines.push(`- Pull request: #${pr.number} — ${pr.html_url} (branch \`${pr.head.ref}\` → \`${pr.base.ref}\`)`);
98
+ }
99
+ if (issue) {
100
+ sourceLines.push(`- Issue: #${issue.number} — https://github.com/${repoFullName}/issues/${issue.number}`);
101
+ }
102
+ const task = pr
103
+ ? `Continue the existing pull request #${pr.number}. It already contains work: first read its current changes with \`git diff origin/${pr.base.ref}...HEAD\` and understand them, then finish what the pull request description (and the linked issue, if any) asks for. Do not revert or rewrite existing commits; add new commits on top. Add or update tests for anything you change.`
104
+ : `Implement what GitHub issue #${issue?.number} asks for. The issue text is below. Make the smallest complete change that resolves it, add or update tests, and keep existing behaviour unchanged elsewhere.`;
105
+ const sections = [];
106
+ sections.push(`# ${title}`);
107
+ sections.push(`## Source\n${sourceLines.join('\n')}`);
108
+ sections.push(`## Task\n${task}`);
109
+ if (pr) {
110
+ sections.push(`## Pull Request Description\n${pr.body?.trim() ? pr.body.trim() : placeholder}`);
111
+ }
112
+ if (issue) {
113
+ sections.push(`## Issue Description\n${issue.body?.trim() ? issue.body.trim() : placeholder}`);
114
+ }
115
+ return sections.join('\n\n') + '\n';
116
+ }
117
+ /**
118
+ * Format the local date/time as `YYYY-MM-DD-HH:MM` (24-hour, local time) to
119
+ * match the existing plan-filename convention.
120
+ */
121
+ function timestampSlug(now = new Date()) {
122
+ const pad = (n) => String(n).padStart(2, '0');
123
+ return (`${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}` +
124
+ `-${pad(now.getHours())}:${pad(now.getMinutes())}`);
125
+ }
126
+ /**
127
+ * Write a generated plan to `<planDir>/<YYYY-MM-DD-HH:MM>-<slug>.md`, creating
128
+ * the directory if needed, and return the path relative to the repo root
129
+ * (`planDir`'s parent chain). A relaunch in the same minute overwrites the file.
130
+ *
131
+ * `planDir` is the repo-relative plans directory (`config.planPath`). The
132
+ * returned path is repo-relative so the normal launch flow (publish + delete)
133
+ * treats it exactly like a hand-written plan.
134
+ */
135
+ export function writeGeneratedPlan(planDir, slug, markdown, repoRoot = process.cwd()) {
136
+ const absDir = isAbsolute(planDir) ? planDir : join(repoRoot, planDir);
137
+ if (!existsSync(absDir)) {
138
+ mkdirSync(absDir, { recursive: true });
139
+ }
140
+ const fileName = `${timestampSlug()}-${slug}.md`;
141
+ const absPath = join(absDir, fileName);
142
+ writeFileSync(absPath, markdown, 'utf-8');
143
+ // Return a repo-relative path (matching the positional-planPath convention)
144
+ // so the publish + post-POST cleanup treat it like any other plan file.
145
+ const rel = relative(repoRoot, absPath);
146
+ return rel;
147
+ }
148
+ //# sourceMappingURL=GitHubSourcePlanService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubSourcePlanService.js","sourceRoot":"","sources":["../../../src/services/plan/GitHubSourcePlanService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAuBnD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAa,EACb,IAAoB;IAEpB,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAErD,MAAM,QAAQ,GAAG,GAAU,EAAE;QAC3B,MAAM,IAAI,KAAK,CACb,aAAa,IAAI,WAAW,KAAK,kEAAkE,OAAO,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AAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvE,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,SAAS,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,MAAM,QAAQ,GAAG,GAAG,aAAa,EAAE,IAAI,IAAI,KAAK,CAAC;IACjD,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IACvC,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAE1C,4EAA4E;IAC5E,wEAAwE;IACxE,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACxC,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -34,5 +34,9 @@ export declare class PlanNotFoundError extends Error {
34
34
  *
35
35
  * @throws PlanNotFoundError when the plan content cannot be resolved anywhere.
36
36
  */
37
- export declare function ensurePlanBranch(config: Config, planPath: string, issueName: string, repoRoot?: string): Promise<EnsurePlanBranchResult>;
37
+ export declare function ensurePlanBranch(config: Config, planPath: string, issueName: string, repoRoot?: string, opts?: {
38
+ branch?: string;
39
+ baseBranch?: string;
40
+ requireExistingBranch?: boolean;
41
+ }): Promise<EnsurePlanBranchResult>;
38
42
  //# sourceMappingURL=PlanBranchService.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlanBranchService.d.ts","sourceRoot":"","sources":["../../../src/services/plan/PlanBranchService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMnD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,QAAQ,EAAE,MAAM;CAI7B;AAmCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,sBAAsB,CAAC,CAsDjC"}
1
+ {"version":3,"file":"PlanBranchService.d.ts","sourceRoot":"","sources":["../../../src/services/plan/PlanBranchService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMnD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,OAAO,EAAE,OAAO,CAAC;IACjB,gFAAgF;IAChF,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,QAAQ,EAAE,MAAM;CAI7B;AAmCD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EAQjB,IAAI,CAAC,EAAE;IACL,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,GACA,OAAO,CAAC,sBAAsB,CAAC,CAsEjC"}
@@ -54,16 +54,34 @@ async function resolvePlanContent(gitService, relativePath, planFsPath, branch,
54
54
  *
55
55
  * @throws PlanNotFoundError when the plan content cannot be resolved anywhere.
56
56
  */
57
- export async function ensurePlanBranch(config, planPath, issueName, repoRoot) {
58
- const branch = sanitizePlanName(issueName);
59
- const baseBranch = config.uploadBranch ?? 'main';
57
+ export async function ensurePlanBranch(config, planPath, issueName, repoRoot,
58
+ // Overrides for the launch-from-existing flow (FR 7):
59
+ // branch → publish to this exact branch (unsanitized, may
60
+ // contain `/`), e.g. a PR's head branch.
61
+ // baseBranch → cut the new branch from this ref instead of
62
+ // config.uploadBranch; verified to exist on origin.
63
+ // requireExistingBranch → the branch must already be on origin (a PR's
64
+ // head branch); never create it.
65
+ opts) {
66
+ const branch = opts?.branch ?? sanitizePlanName(issueName);
67
+ const baseBranch = opts?.baseBranch ?? config.uploadBranch ?? 'main';
60
68
  const gitService = new GitService(repoRoot);
61
69
  const planService = new PlanService(config.planPath);
62
70
  const relativePath = planService.getRelativePath(planPath);
63
71
  const planFsPath = isAbsolute(planPath) || !repoRoot ? planPath : join(repoRoot, planPath);
64
72
  // One fetch up front so every origin/<ref> read below is current.
65
73
  await gitService.fetch('origin');
74
+ // An explicit base branch (--base) must exist on origin before we try to
75
+ // cut a new branch from it.
76
+ if (opts?.baseBranch &&
77
+ !(await gitService.remoteBranchExists(opts.baseBranch))) {
78
+ throw new Error(`Base branch '${opts.baseBranch}' not found on origin`);
79
+ }
66
80
  const branchOnOrigin = await gitService.remoteBranchExists(branch);
81
+ // A PR's head branch must already be on origin — never create it here.
82
+ if (opts?.requireExistingBranch && !branchOnOrigin) {
83
+ throw new Error(`Branch '${branch}' of the pull request was not found on origin`);
84
+ }
67
85
  const content = await resolvePlanContent(gitService, relativePath, planFsPath, branch, branchOnOrigin, baseBranch);
68
86
  if (content === null) {
69
87
  throw new PlanNotFoundError(planPath);
@@ -1 +1 @@
1
- {"version":3,"file":"PlanBranchService.js","sourceRoot":"","sources":["../../../src/services/plan/PlanBranchService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAA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AK,OAAO,EAAE,CAAC;gBACzB,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;YACpD,CAAC;QACH,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAC3D,MAAM,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE;YACjD,aAAa,EAAE,6BAA6B;YAC5C,MAAM;SACP,CAAC,CAAC;QACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACnD,CAAC;IAED,MAAM,SAAS,GAAG,IAAI,kBAAkB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC3D,MAAM,SAAS,CAAC,WAAW,CAAC,YAAY,EAAE,OAAO,EAAE;QACjD,aAAa,EAAE,oCAAoC;QACnD,MAAM;QACN,aAAa,EAAE,UAAU,UAAU,EAAE;KACtC,CAAC,CAAC;IACH,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAClD,CAAC"}
@@ -386,6 +386,7 @@ Determine `<issueName>` before asking the question:
386
386
  - If the slug is **longer than 3 words**, shorten it to the 2–3 most distinctive words (e.g. `auto-launch-offer-after-plan` → `auto-launch`). Otherwise keep it as-is.
387
387
  - Always **kebab-case** (lowercase words joined by hyphens), never camelCase — these become git branch names.
388
388
  - Example: `.hublaunch/plans/skills/2026-07-09-14:28-auto-launch-offer-after-plan.md` → slug `auto-launch-offer-after-plan` → `<issueName>` = `auto-launch`.
389
+ - **Exception — existing issue or PR:** if `/hula-plan` emitted a `<!-- hula-source: --issue <n> -->` or `<!-- hula-source: --pr <n> -->` comment for this plan, the default is `issue-<n>` or `pr-<n>` instead of the slug.
389
390
 
390
391
  ### 2. Ask the launch question
391
392
 
@@ -416,7 +417,7 @@ Then **STOP and wait** for the user's reply. Do not launch until they answer.
416
417
 
417
418
  ### 4. Execute the launch
418
419
 
419
- On a clear affirmative, read `.agents/skills/hula-launch/SKILL.md` and execute its workflow with the arguments `<issueName> <planPath>` (plus any `--handoff`/`--test` flags from the reply). Pass the plan path explicitly — it is known in this session — rather than relying on chat-history extraction.
420
+ On a clear affirmative, read `.agents/skills/hula-launch/SKILL.md` and execute its workflow with the arguments `<issueName> <planPath>` (plus any `--handoff`/`--test` flags from the reply, and the `--issue <n>` / `--pr <n>` flag from this plan's `hula-source` comment, if any). Pass the plan path explicitly — it is known in this session — rather than relying on chat-history extraction.
420
421
 
421
422
  Execute that workflow **inline in this session**: read the SKILL.md file and follow its steps directly. Do **not** invoke `hula-launch` (or any other hula skill) through the Skill tool — the hula skills set `disable-model-invocation: true`, so a Skill-tool invocation is rejected with "blocked by disable-model-invocation". Only reading the file and executing its steps works.
422
423
 
@@ -296,6 +296,37 @@ No local worktree was involved — PR was merged directly on GitHub.
296
296
 
297
297
  ---
298
298
 
299
+ ## Step C: Report the Chat's Backlog
300
+
301
+ After presenting the Success Summary (Path A Step A5 or Path B Step B3), check this chat's backlog before finishing.
302
+
303
+ 1. **Find the backlog.** Scan this conversation's history for a `<!-- hula-backlog: <key> -->` comment. If none is found, skip this step entirely — say nothing about a backlog.
304
+ 2. **Resync to the dashboard (best-effort).** Before reading the file, retry the remote push for any item that couldn't sync earlier (e.g. added during `/hula-plan`, before a tracked `Plan` existed server-side). Resolve `<owner>/<repo>` via `gh repo view --json nameWithOwner -q .nameWithOwner`, then run:
305
+ - Path A (fix session): `hula script backlog-resync -- <key> --project <owner>/<repo> --tracking-name <prBranch>` (use the `prBranch` from the `<!-- hula-fix-session -->` comment resolved in Step 1).
306
+ - Path B (remote-only): `hula script backlog-resync -- <key> --project <owner>/<repo> --issue <issueNumber>` (use the issue number resolved in Step 1).
307
+
308
+ Ignore the output beyond confirming the command ran — a resync failure or a repo not configured for remote (`hulaApiKey`/`hulaProjectUrl`) is expected and must never block the report below. If you can't resolve `<owner>/<repo>`, skip the resync and proceed directly to reading the file.
309
+ 3. **Read it.** Read `.hublaunch/.backlogs/<key>.json` directly (no script needed — this is read-only). If the file doesn't exist, or `items` is empty, or every item has `status: "done"`, display:
310
+ ```
311
+ 📋 No open backlog items for this chat — safe to close or archive.
312
+ ```
313
+ 4. **If there are open items** (`status: "open"`), display each one with a suggested next action, using judgment to pick the category:
314
+ - Trivial/mechanical and clearly actionable right now in this working tree → suggest doing it now.
315
+ - Requires a decision, credential, or external action only the user can take → state exactly what the user needs to do.
316
+ - A substantial independent feature/change → suggest a new chat, and offer the exact prompt: `/hula-plan <2-3 sentence restatement of the item as a goal>`.
317
+
318
+ ```
319
+ 📋 This chat has N open backlog item(s):
320
+
321
+ 1. <item text>
322
+ → <suggested next action, phrased per the category above>
323
+
324
+ 2. <item text>
325
+ → <suggested next action>
326
+ ```
327
+
328
+ ---
329
+
299
330
  ## Error Handling
300
331
 
301
332
  ### Merge Conflicts
@@ -63,6 +63,16 @@ Example: /hula-fix YizYah/hub-launch#42 the button validation is broken
63
63
 
64
64
  Stop execution here. Do not proceed.
65
65
 
66
+ ### Step 1.5: Create the Chat Backlog (if not already created)
67
+
68
+ If you have not already created a backlog for this chat, create one now — the same mechanism `/hula-plan` uses.
69
+
70
+ 1. Scan this conversation's history for a prior `<!-- hula-backlog: <key> -->` comment. If found, reuse it.
71
+ 2. If none found: generate `<key>` (`bl-` + 8 lowercase base-36 characters), run `hula script backlog-init -- <key>`, and emit `<!-- hula-backlog: <key> -->` in this response's output. If the script reports an error, log a one-line warning and continue.
72
+ 3. Whenever something surfaces during this fix that should be tracked but is not part of the fix itself, run `hula script backlog-add -- <key> "<one-line item text>" --project <owner>/<repo> --issue <issueNumber>` and continue silently.
73
+ - `<issueNumber>` is the issue detected in Step 1. `<owner>/<repo>` comes from `gh repo view --json nameWithOwner -q .nameWithOwner`. (The branch/tracking name isn't known yet at this point in a fix, so identify the plan by issue number.)
74
+ - The `--project`/`--issue` args let the item sync to the `hula-project` dashboard when the repo is configured for remote (`hulaApiKey` + `hulaProjectUrl`). They're optional: if you can't resolve `<owner>/<repo>`, omit them and just run `hula script backlog-add -- <key> "<one-line item text>"` — the local backlog still works, and any unsynced item is retried automatically at `/hula-approve` time.
75
+
66
76
  ### Step 2: Setup Worktree and Session (Script)
67
77
 
68
78
  Run the setup script — it handles issue lookup, validation, worktree creation, and session file writing in one terminal approval:
@@ -2,7 +2,7 @@
2
2
  name: hula-launch
3
3
  description: "Launch a validated plan: creates the GitHub issue and starts the cloud run that ends in a verified PR (offered automatically after /hula-plan). Use when the user asks to launch a plan."
4
4
  disable-model-invocation: true
5
- argument-hint: <branch-name> [<plan-path>] [--handoff <username>] [--test] [--skip-regression] [--kill] [--kill-and-relaunch] [--folder <path>] [--group-id <id>] [--plan <repo>=<path>]
5
+ argument-hint: <branch-name> [<plan-path>] [--handoff <username>] [--test] [--skip-regression] [--kill] [--kill-and-relaunch] [--folder <path>] [--group-id <id>] [--plan <repo>=<path>] [--issue <ref> | --pr <ref>] [--base <branch>]
6
6
  allowed-tools: Bash Read
7
7
  ---
8
8
 
@@ -23,6 +23,15 @@ From `$ARGUMENTS`:
23
23
  - In folder mode the plan path is resolved **per repository** — do NOT pass a positional plan path. A single positional is the branch name.
24
24
  - **--group-id** (optional): `--group-id <id>`. Use an explicit group id instead of generating one (join/retry an existing group). Valid ids match `^[A-Za-z0-9_-]{1,64}$`.
25
25
  - **--plan** (optional, repeatable): `--plan <repo>=<path>`. Override the auto-resolved plan for one repo in `--folder` mode. `<repo>` is the discovered directory name; `<path>` is relative to that repo's root.
26
+ - **--issue** (optional): `--issue <ref>` (a number, `#number`, or issue URL). Work on an **existing** GitHub issue: no new issue is created, the issue is never edited, and the PR links it with `Closes #N`.
27
+ - **--pr** (optional): `--pr <ref>` (a number, `#number`, or PR URL). Continue an **existing** same-repo pull request: the plan is committed to the PR's head branch and new commits are pushed on top. Fork PRs are rejected.
28
+ - **--base** (optional): `--base <branch>`. Cut the work branch from `<branch>` and open the PR into it. Not allowed with `--pr` (the PR already has a base).
29
+ - **Source from `/hula-plan`**: if `--issue`/`--pr` is not in `$ARGUMENTS`, look in the chat history for a `<!-- hula-source: --issue <n> -->` or `<!-- hula-source: --pr <n> -->` comment emitted by `/hula-plan` **for the same plan path** you resolve below (it is printed next to that plan's `<!-- hula-plan: <path> -->` comment). If found, use that flag as if the user had passed it. A `hula-source` comment for a different plan does not apply.
30
+
31
+ `--issue`/`--pr` cannot be combined with `--kill` or `--folder`. `--issue` and `--pr` together are only valid without a plan file — that combination is a direct CLI launch (`hula launch --issue <n> --pr <m>`), not a `/hula-launch` run; if both are present here, stop with:
32
+ ```
33
+ ❌ /hula-launch takes a plan, so pass --issue or --pr, not both. To work an issue on an existing PR without a plan, run: hula launch --issue <n> --pr <m>
34
+ ```
26
35
 
27
36
  `--kill` and `--kill-and-relaunch` are mutually exclusive; if the user passes both, stop with:
28
37
  ```
@@ -47,6 +56,14 @@ If no plan path is found in `$ARGUMENTS` or chat history (and `--kill` is not se
47
56
  ❌ No plan found in this chat. Run /hula-plan first, or pass the plan path as the second argument.
48
57
  ```
49
58
 
59
+ > 💡 **Launching from an existing GitHub issue or PR without a plan?** The
60
+ > normal path is `/hula-plan --issue <n>` / `/hula-plan --pr <n>`, which plans
61
+ > from the GitHub text and then launches through this skill with the source
62
+ > flag. To skip planning entirely, run the CLI directly: `hula launch --issue
63
+ > <ref>` or `hula launch --pr <ref>` generates the plan from the GitHub text
64
+ > (a single positional is then the tracking name, never a plan path). See the
65
+ > README's "Launch from an existing issue or PR".
66
+
50
67
  ## Step 2: Run the launch script
51
68
 
52
69
  With the values known, run exactly one Bash command.
@@ -78,6 +95,13 @@ hula script launch-run -- <plan-path> <branch-name> --skip-regression
78
95
 
79
96
  Append `--test` whenever the user passed it; it composes with `--handoff`. Append `--skip-regression` whenever the user passed it; it composes with `--handoff` and `--test` too.
80
97
 
98
+ **From an existing issue or PR** — append the source flag (from `$ARGUMENTS` or the plan's `hula-source` comment), and `--base` if given; they compose with the flags above:
99
+ ```bash
100
+ hula script launch-run -- <plan-path> <branch-name> --issue <n>
101
+ hula script launch-run -- <plan-path> <branch-name> --pr <n>
102
+ hula script launch-run -- <plan-path> <branch-name> --issue <n> --base <branch>
103
+ ```
104
+
81
105
  **Stop the in-flight task without relaunching (`--kill`)** — pass only the branch name (no plan path):
82
106
  ```bash
83
107
  hula script launch-run -- <branch-name> --kill
@@ -108,6 +132,21 @@ hula script launch-run -- <branch-name> --folder <parent-path> --kill
108
132
 
109
133
  Parse the JSON output from the script:
110
134
  - If `status` is `"error"`, display `❌ Launch failed: <message>` and stop.
135
+ - If `status` is `"success"` **and `prNumber` is non-empty** (a `--pr` launch), the work continues on the existing pull request. Display:
136
+
137
+ ```
138
+ ✅ Launched on existing PR #<prNumber> (branch `<branchName>` tracks it)
139
+
140
+ 🔀 **Pull request**: <repo>#<prNumber> — new commits are pushed to its head branch
141
+ 📋 **Issue**: <repo>#<issueNumber> (only when `issueNumber` is non-empty)
142
+ 📄 **Plan**: `<planPath>`
143
+
144
+ <!-- hula-issue: <issueNumber> --> (only when `issueNumber` is non-empty)
145
+
146
+ **Next Steps:**
147
+ - Use `/hula-verify` to check implementation against the plan
148
+ - Use `/hula-approve` when ready to merge
149
+ ```
111
150
  - If `status` is `"success"` **and this was a `--kill` (cancel-only) run** — indicated by an empty `issueNumber` — there is no new issue/PR. Display a cancel summary instead of the launch template:
112
151
 
113
152
  ```
@@ -2,7 +2,7 @@
2
2
  name: hula-plan
3
3
  description: "Plan (step 1 of 2): describe what you want built — drafts an implementation plan, validates it until it stands on its own, then offers to launch. Use when the user asks to plan, build, or implement something."
4
4
  disable-model-invocation: true
5
- argument-hint: <what you want built> [--folder <subfolder>] [--autoLaunch [--test] [--handoff <username>]]
5
+ argument-hint: <what you want built> [--issue <n> | --pr <n>] [--folder <subfolder>] [--autoLaunch [--test] [--handoff <username>]]
6
6
  allowed-tools: Bash Read
7
7
  ---
8
8
 
@@ -31,8 +31,24 @@ The user will describe a feature or issue. Your job is to:
31
31
 
32
32
  Issue description: $ARGUMENTS
33
33
  Folder (optional): Parsed from $ARGUMENTS if --folder flag is provided
34
+ Source (optional): Parsed from $ARGUMENTS if `--issue <ref>` or `--pr <ref>` is provided — see "Starting From an Existing Issue or PR" below. The rest of $ARGUMENTS is then the user's extra instructions on top of that issue or PR.
34
35
  Auto-launch (optional): Parsed from $ARGUMENTS if --autoLaunch flag is provided (optionally combined with --test and/or --handoff <username>, both otherwise unused until the Launch Offer)
35
36
 
37
+ ## Starting From an Existing Issue or PR
38
+
39
+ `--issue <ref>` plans work on an issue already on the repo; `--pr <ref>` plans more changes to an open pull request. `<ref>` is a number, `#number`, or a GitHub URL for **this** repository. Without either flag, skip this section.
40
+
41
+ 1. **Exactly one source.** If both `--issue` and `--pr` are present, stop with:
42
+ ```
43
+ ❌ Pass --issue or --pr to /hula-plan, not both. To work an issue on an existing PR without a plan, run: hula launch --issue <n> --pr <m>
44
+ ```
45
+ 2. **Read the source** (read-only — never comment on, edit, or assign it):
46
+ - `--issue`: `gh issue view <ref> --json number,title,body,state,url,comments`. If `state` is not `OPEN`, stop with `❌ Issue #<n> is closed.` If `gh` reports it is a pull request, stop with `❌ #<n> is a pull request — use --pr <n>.`
47
+ - `--pr`: `gh pr view <ref> --json number,title,body,state,url,headRefName,baseRefName,isCrossRepository,files` and `gh pr diff <ref>`. If `state` is not `OPEN`, stop with `❌ PR #<n> is not open.` If `isCrossRepository` is `true`, stop with `❌ PR #<n> comes from a fork; HubLaunch can only continue same-repo PRs.`
48
+ 3. **Treat it as the feature description.** The issue/PR title, body, and comments (plus the PR's current diff) are what the user wants built; the rest of `$ARGUMENTS` is extra instructions that take precedence where they conflict. Run the Deep Analysis and clarifying questions below as usual.
49
+ 4. **Say where the plan came from.** Add a `## Source` section directly under the Plan Summary: `Issue #<n> — <url>` or `Pull request #<n> — <url> (branch <headRefName> → <baseRefName>)`. For a PR, the plan must describe only the **new** work: its existing commits stay as they are and new commits go on top.
50
+ 5. **Default name.** Unless the user names it, the tracking/branch name is `issue-<n>` or `pr-<n>` (the same default `hula launch --issue/--pr` uses).
51
+
36
52
  ## Additional Context
37
53
 
38
54
  Use the `#codebase` tool to search for relevant existing code:
@@ -122,11 +138,27 @@ The plan should be immediately actionable by a developer familiar with the codeb
122
138
 
123
139
  **⚠️ NEVER create plan files in the project root directory.** The plan file MUST always be inside the `.hublaunch/plans/` directory (or a subfolder of it). If you cannot read the config file, use the default path `.hublaunch/plans/`.
124
140
 
141
+ ### Step 1.5: Create the Chat Backlog (if not already created)
142
+
143
+ Every `/hula-plan` chat gets one backlog: a running list of things that come up during the conversation that should NOT be folded into the plan being drafted right now.
144
+
145
+ 1. **Check if this chat already has one.** Scan this conversation's own history for a prior `<!-- hula-backlog: <key> -->` HTML comment (emitted by an earlier `/hula-plan`, `/hula-fix`, or `/hula-approve` in the same chat). If found, reuse that `<key>` — do not create a second backlog.
146
+ 2. **If none found, create one:**
147
+ - Generate `<key>` as `bl-` followed by 8 lowercase base-36 characters (e.g. `bl-m3x9k2p1`).
148
+ - Run: `hula script backlog-init -- <key>`
149
+ - Parse the JSON output: `{"status":"success","key":"<key>","path":"<path>","created":true|false}`. If `status` is `"error"`, log a one-line warning and continue — a backlog failure must never block planning.
150
+ 3. **Emit the tracking comment** in this response's output, alongside the existing `<!-- hula-plan -->` / `<!-- hula-branch -->` comments: `<!-- hula-backlog: <key> -->`
151
+ 4. **During the rest of this planning conversation**, whenever something surfaces that should be tracked but is not part of the plan being drafted right now (a follow-up idea, a deferred concern, something the user mentions in passing that isn't this plan's scope), run `hula script backlog-add -- <key> "<one-line item text>" --project <owner>/<repo> --tracking-name <issueName>` and continue silently — do not interrupt the flow to announce this each time. It surfaces later in the `/hula-approve` summary.
152
+ - `<issueName>` is the branch/tracking name resolved in Step 2 (or, if Step 2 hasn't run yet, the same name you'll resolve there). `<owner>/<repo>` comes from `gh repo view --json nameWithOwner -q .nameWithOwner`.
153
+ - The `--project`/`--tracking-name` args let the item sync to the `hula-project` dashboard when the repo is configured for remote (`hulaApiKey` + `hulaProjectUrl`). They're optional: if you can't resolve either value, omit them and just run `hula script backlog-add -- <key> "<one-line item text>"` — the local backlog still works, and any unsynced item is retried automatically at `/hula-approve` time.
154
+
125
155
  ### Step 2: Create the Plan Branch
126
156
 
127
157
  Right after saving the plan file, create the feature branch on origin with the plan committed to it. This is the **plan-branch flow**: the git branch exists from plan time onward, so branch-scoped infrastructure (Vercel Preview env vars, per-branch databases, beforeLaunch hooks) can rely on it well before the launch.
128
158
 
129
- 1. **Resolve `<issueName>`** using the same rules as the Launch Offer's "Resolve the issue name" step in `hula instructions proceed`: a name the user specified anywhere in this conversation wins (most recent first); otherwise derive the default from the plan file's basename (strip the `YYYY-MM-DD-HH:MM-` prefix and `.md`, shorten a >3-word slug to its 2–3 most distinctive words, always kebab-case).
159
+ **With `--pr`, skip this step.** The work branch is the PR's own head branch, which already exists; `hula launch --pr` commits the plan to it at launch time. Do not run `hula upload`, and print `🌿 Branch: PR head `<headRefName>` (plan committed at launch)` in place of the 🌿 line in Step 3, omitting the `hula-branch` comment.
160
+
161
+ 1. **Resolve `<issueName>`** using the same rules as the Launch Offer's "Resolve the issue name" step in `hula instructions proceed`: a name the user specified anywhere in this conversation wins (most recent first); otherwise, with `--issue`, use `issue-<n>`; otherwise derive the default from the plan file's basename (strip the `YYYY-MM-DD-HH:MM-` prefix and `.md`, shorten a >3-word slug to its 2–3 most distinctive words, always kebab-case).
130
162
  2. **Create the branch** by running:
131
163
 
132
164
  `hula upload <planPath> --branch <issueName>`
@@ -143,11 +175,13 @@ Right after saving the plan file, create the feature branch on origin with the p
143
175
  🌿 Branch created: `feature-name` (plan pushed to origin)
144
176
  <!-- hula-plan: .hublaunch/plans/2025-12-29-14:30-feature-name.md -->
145
177
  <!-- hula-branch: feature-name -->
178
+ <!-- hula-backlog: bl-m3x9k2p1 -->
179
+ <!-- hula-source: --issue 42 -->
146
180
 
147
181
  📋 **Proceeding to validation now…**
148
182
  ```
149
183
 
150
- (Substitute the actual resolved `<issueName>` in the branch line and the `hula-branch` comment. If branch creation failed in Step 2, replace the 🌿 line with `⚠️ Branch creation deferred to launch time` and omit the `hula-branch` comment.)
184
+ (Substitute the actual resolved `<issueName>` in the branch line and the `hula-branch` comment, and the actual `<key>` from Step 1.5 in the `hula-backlog` comment. Emit the `hula-source` comment only when `--issue` or `--pr` was given, as `<!-- hula-source: --issue <n> -->` or `<!-- hula-source: --pr <n> -->` with the resolved number — `/hula-launch` reads it to launch against that issue or PR. If branch creation failed in Step 2, replace the 🌿 line with `⚠️ Branch creation deferred to launch time` and omit the `hula-branch` comment. If Step 1.5 reused an existing backlog key or its `backlog-init` failed, still emit the `hula-backlog` comment with the resolved/reused `<key>`.)
151
185
 
152
186
  Now proceed directly to plan validation **without waiting for the user**. The plan file was just created in this session — the path is already known.
153
187
 
@@ -167,9 +201,10 @@ Read `hula instructions proceed` and execute the full validation workflow agains
167
201
  - **`--autoLaunch` skips the Launch Offer's confirmation sub-step only.** If `--autoLaunch` was present in `$ARGUMENTS`:
168
202
  1. Still perform the Launch Offer's "1. Resolve the issue name" step exactly as documented there (conversation-mention wins, else the plan-filename-slug default) — resolution itself is unchanged.
169
203
  2. Skip "2. Ask the launch question" and "3. Interpret the reply" entirely — do not ask, do not wait.
170
- 3. Print exactly (substituting the resolved name): `🚀 --autoLaunch set — launching as \`<issueName>\`…`
204
+ 3. Print exactly (substituting the resolved name): `🚀 --autoLaunch set — launching as `<issueName>`…`
171
205
  4. Immediately perform the Launch Offer's "4. Execute the launch" step: read `.agents/skills/hula-launch/SKILL.md` and execute its workflow with `<issueName> <planPath>`.
172
206
  5. If `--test` and/or `--handoff <username>` were also present in `$ARGUMENTS`, pass them through to the launch — same as the Launch Offer's reply table does for a manual reply containing those flags.
207
+ 6. If `--issue` or `--pr` was given, pass `--issue <n>` / `--pr <n>` through to the launch as well.
173
208
  - **Without `--autoLaunch`**, behavior is completely unchanged: ask and wait as today.
174
209
 
175
210
  **Note:** The plan is saved locally AND pushed to its feature branch on origin (Step 2). When you run `/hula-launch`, the plan branch is re-synced automatically (covering validation edits and renames) before the GitHub issue is created and the implementation begins — no separate upload step needed. Because validation ends with the Launch Offer, an affirmative reply runs the `/hula-launch` workflow for the user automatically; they can also decline and run `/hula-launch` themselves later. `/hula-confirm` remains available as a standalone command for re-validation at any time. If `--autoLaunch` was passed to `/hula-plan`, the launch runs automatically once validation completes — no reply needed.