sdd-cli 0.1.18 → 0.1.19

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.
package/README.md CHANGED
@@ -162,6 +162,9 @@ Use `--questions` when you want the manual question-by-question flow.
162
162
  ### Router
163
163
  - `sdd-cli route` -- classify user intent and route to the right flow
164
164
 
165
+ ### Imports
166
+ - `sdd-cli import issue <github-issue-url>` -- import issue context and bootstrap autopilot
167
+
165
168
  ### Requirement lifecycle
166
169
  - `sdd-cli req create`
167
170
  - `sdd-cli req refine`
package/dist/cli.js CHANGED
@@ -46,6 +46,7 @@ const route_1 = require("./commands/route");
46
46
  const doctor_1 = require("./commands/doctor");
47
47
  const quickstart_1 = require("./commands/quickstart");
48
48
  const status_1 = require("./commands/status");
49
+ const import_issue_1 = require("./commands/import-issue");
49
50
  const paths_1 = require("./paths");
50
51
  const flags_1 = require("./context/flags");
51
52
  const prompt_1 = require("./ui/prompt");
@@ -334,4 +335,12 @@ ai
334
335
  const { runAiExec } = await Promise.resolve().then(() => __importStar(require("./commands/ai-exec")));
335
336
  await runAiExec(prompt.join(" ").trim());
336
337
  });
338
+ const importCmd = program.command("import").description("Import external work items into SDD flow");
339
+ importCmd
340
+ .command("issue")
341
+ .description("Import a GitHub issue URL and bootstrap autopilot")
342
+ .argument("<url>", "GitHub issue URL")
343
+ .action(async (url) => {
344
+ await (0, import_issue_1.runImportIssue)(url);
345
+ });
337
346
  program.parse(process.argv);
@@ -0,0 +1 @@
1
+ export declare function runImportIssue(issueUrl: string): Promise<void>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runImportIssue = runImportIssue;
4
+ const hello_1 = require("./hello");
5
+ function parseGitHubIssueUrl(input) {
6
+ const trimmed = input.trim();
7
+ const match = trimmed.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+)\/issues\/(\d+)(?:[/?#].*)?$/i);
8
+ if (!match) {
9
+ return null;
10
+ }
11
+ return { owner: match[1], repo: match[2], number: match[3] };
12
+ }
13
+ async function fetchIssue(ref) {
14
+ const baseApi = process.env.SDD_GITHUB_API_BASE || "https://api.github.com";
15
+ const endpoint = `${baseApi.replace(/\/$/, "")}/repos/${ref.owner}/${ref.repo}/issues/${ref.number}`;
16
+ const response = await fetch(endpoint, {
17
+ headers: {
18
+ Accept: "application/vnd.github+json",
19
+ "User-Agent": "sdd-cli"
20
+ }
21
+ });
22
+ if (!response.ok) {
23
+ throw new Error(`Failed to fetch issue (${response.status}).`);
24
+ }
25
+ const payload = (await response.json());
26
+ return {
27
+ title: payload.title || `Issue #${ref.number}`,
28
+ body: payload.body || "",
29
+ url: payload.html_url || `https://github.com/${ref.owner}/${ref.repo}/issues/${ref.number}`
30
+ };
31
+ }
32
+ function buildSeedText(issue) {
33
+ const bodySnippet = issue.body.trim().slice(0, 400).replace(/\s+/g, " ");
34
+ return `Resolve issue: ${issue.title}. Context: ${bodySnippet}. Source: ${issue.url}`;
35
+ }
36
+ async function runImportIssue(issueUrl) {
37
+ const ref = parseGitHubIssueUrl(issueUrl);
38
+ if (!ref) {
39
+ console.log("Invalid GitHub issue URL. Expected format: https://github.com/<owner>/<repo>/issues/<number>");
40
+ return;
41
+ }
42
+ console.log(`Importing issue ${ref.owner}/${ref.repo}#${ref.number} ...`);
43
+ try {
44
+ const issue = await fetchIssue(ref);
45
+ const seedText = buildSeedText(issue);
46
+ console.log(`Imported: ${issue.title}`);
47
+ await (0, hello_1.runHello)(seedText, false);
48
+ }
49
+ catch (error) {
50
+ console.log(error.message);
51
+ }
52
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sdd-cli",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "SDD-first, AI-native CLI for end-to-end delivery.",
5
5
  "homepage": "https://github.com/jdsalasca/sdd-tool#readme",
6
6
  "repository": {