@docyrus/docyrus 0.0.25 → 0.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docyrus/docyrus",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "private": false,
5
5
  "description": "Docyrus API CLI",
6
6
  "main": "./main.js",
@@ -17,6 +17,7 @@
17
17
  "@mozilla/readability": "^0.6.0",
18
18
  "@opentui/core": "^0.1.85",
19
19
  "@opentui/react": "^0.1.85",
20
+ "@sinclair/typebox": "^0.34.48",
20
21
  "@xterm/headless": "^5.5.0",
21
22
  "cheerio": "^1.1.2",
22
23
  "diff": "^8.0.2",
@@ -1,8 +1,9 @@
1
1
  import type { ExtensionAPI, ExtensionCommandContext } from "@mariozechner/pi-coding-agent";
2
2
  import fs from "node:fs/promises";
3
3
  import path from "node:path";
4
+ import { startPlanningWorkflow } from "./plan";
4
5
 
5
- const ARCHITECT_OUTPUT_ROOT_SEGMENTS = ["docs", "architect"] as const;
6
+ const ARCHITECT_OUTPUT_ROOT_SEGMENTS = ["docyrus", "architecture"] as const;
6
7
  const ARCHITECT_DISCOVERY_FILE_NAME = "discovery.snapshot.json";
7
8
  const ARCHITECT_DATA_SOURCES_FILE_NAME = "DATA_SOURCES.md";
8
9
  const ARCHITECT_PLAN_FILE_NAME = "PLAN.md";
@@ -543,7 +544,7 @@ export async function discoverArchitectTenantState(params: {
543
544
  }
544
545
 
545
546
  function buildArchitectPrompt(params: {
546
- brief: string;
547
+ brief?: string;
547
548
  outputDir: string;
548
549
  snapshot: IArchitectDiscoverySnapshot;
549
550
  }): string {
@@ -565,7 +566,7 @@ function buildArchitectPrompt(params: {
565
566
  "Work only from the discovery snapshot plus any non-mutating local inspection you need.",
566
567
  "",
567
568
  "## User Brief",
568
- params.brief,
569
+ params.brief ?? "No brief was provided yet. Before planning, collect the minimum missing product details from the user using the ask_user protocol.",
569
570
  "",
570
571
  "## Discovery Summary",
571
572
  `- Tenant: ${tenantDisplay}`,
@@ -610,24 +611,6 @@ function buildArchitectPrompt(params: {
610
611
  ].join("\n");
611
612
  }
612
613
 
613
- async function promptForArchitectBrief(ctx: ExtensionCommandContext, args: string): Promise<string | null> {
614
- const inlineBrief = parseArchitectBrief(args);
615
- if (inlineBrief) {
616
- return inlineBrief;
617
- }
618
-
619
- if (!ctx.hasUI) {
620
- return null;
621
- }
622
-
623
- const brief = await ctx.ui.editor(
624
- "Describe the app idea to architect:",
625
- "",
626
- );
627
-
628
- return parseArchitectBrief(brief || "");
629
- }
630
-
631
614
  function createArchitectCliRunner(params: {
632
615
  pi: ExtensionAPI;
633
616
  ctx: ExtensionCommandContext;
@@ -683,13 +666,7 @@ function createArchitectCliRunner(params: {
683
666
  }
684
667
 
685
668
  async function architectHandler(pi: ExtensionAPI, ctx: ExtensionCommandContext, args: string): Promise<void> {
686
- const brief = await promptForArchitectBrief(ctx, args);
687
- if (!brief) {
688
- if (ctx.hasUI) {
689
- ctx.ui.notify("Usage: /architect <app-idea brief>", "error");
690
- }
691
- return;
692
- }
669
+ const brief = parseArchitectBrief(args) ?? undefined;
693
670
 
694
671
  let environment: IArchitectCliEnvironment;
695
672
  try {
@@ -724,7 +701,7 @@ async function architectHandler(pi: ExtensionAPI, ctx: ExtensionCommandContext,
724
701
 
725
702
  const outputDir = createArchitectRunDirectoryPath({
726
703
  cwd: ctx.cwd,
727
- brief,
704
+ brief: brief ?? "app-idea",
728
705
  date: new Date(discovery.snapshot.generatedAt),
729
706
  });
730
707
  const discoveryPath = path.join(outputDir, ARCHITECT_DISCOVERY_FILE_NAME);
@@ -754,11 +731,18 @@ async function architectHandler(pi: ExtensionAPI, ctx: ExtensionCommandContext,
754
731
  ctx.ui.notify(`Architect: saved discovery snapshot to ${discoveryPath}`, "info");
755
732
  }
756
733
 
757
- pi.sendUserMessage(buildArchitectPrompt({
758
- brief,
759
- outputDir,
760
- snapshot: discovery.snapshot,
761
- }));
734
+ await startPlanningWorkflow({
735
+ pi,
736
+ ctx,
737
+ mode: "architect",
738
+ task: brief,
739
+ artifactPath: outputDir,
740
+ initialPrompt: buildArchitectPrompt({
741
+ brief,
742
+ outputDir,
743
+ snapshot: discovery.snapshot,
744
+ }),
745
+ });
762
746
  }
763
747
 
764
748
  export default function architectExtension(pi: ExtensionAPI) {