paqad-ai 0.2.0 → 0.2.2

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/dist/cli/index.js CHANGED
@@ -4014,7 +4014,6 @@ async function readIgnoreRules(projectRoot, config) {
4014
4014
  continue;
4015
4015
  }
4016
4016
  if (line.startsWith("!")) {
4017
- console.warn(`Ignoring negation rule "${line}" in ${sourceName}`);
4018
4017
  continue;
4019
4018
  }
4020
4019
  rules.push(
@@ -4313,7 +4312,11 @@ var init_file_filter = __esm({
4313
4312
  adapterFileExclusionSet;
4314
4313
  diagnosticsSnapshot;
4315
4314
  _layer3RulesCache = null;
4316
- async discoverFiles() {
4315
+ async discoverFiles(onProgress) {
4316
+ onProgress?.({
4317
+ phase: "build",
4318
+ message: "Discovering repository files for RAG eligibility"
4319
+ });
4317
4320
  const discovered = await fg("**/*", {
4318
4321
  cwd: this.options.projectRoot,
4319
4322
  absolute: true,
@@ -4332,19 +4335,43 @@ var init_file_filter = __esm({
4332
4335
  excluded_layer4: 0,
4333
4336
  passed: 0
4334
4337
  };
4335
- for (const absolutePath of sorted) {
4338
+ onProgress?.({
4339
+ phase: "build",
4340
+ message: `Filtering ${sorted.length} discovered files with RAG rules`,
4341
+ loaded: 0,
4342
+ total: sorted.length,
4343
+ percent: 0
4344
+ });
4345
+ const progressInterval = Math.max(Math.min(Math.floor(sorted.length / 20), 2500), 500);
4346
+ for (const [index, absolutePath] of sorted.entries()) {
4336
4347
  const probe = await this.evaluateFile(absolutePath, layer3IgnoreRules);
4337
4348
  if (probe.excluded) {
4338
4349
  if (probe.layer === 1) stats.excluded_layer1 += 1;
4339
4350
  if (probe.layer === 2) stats.excluded_layer2 += 1;
4340
4351
  if (probe.layer === 3) stats.excluded_layer3 += 1;
4341
4352
  if (probe.layer === 4) stats.excluded_layer4 += 1;
4342
- continue;
4353
+ } else {
4354
+ stats.passed += 1;
4355
+ files.push(absolutePath);
4356
+ }
4357
+ const processed = index + 1;
4358
+ if (processed % progressInterval === 0 || processed === sorted.length) {
4359
+ onProgress?.({
4360
+ phase: "build",
4361
+ message: `Filtered ${processed}/${sorted.length} files; ${stats.passed} remain eligible`,
4362
+ loaded: processed,
4363
+ total: sorted.length,
4364
+ percent: Math.round(processed / sorted.length * 100)
4365
+ });
4343
4366
  }
4344
- stats.passed += 1;
4345
- files.push(absolutePath);
4346
4367
  }
4347
- console.debug("[rag:file-filter]", stats);
4368
+ onProgress?.({
4369
+ phase: "build",
4370
+ message: `RAG file filtering kept ${stats.passed} eligible files`,
4371
+ loaded: sorted.length,
4372
+ total: sorted.length,
4373
+ percent: 100
4374
+ });
4348
4375
  return files;
4349
4376
  }
4350
4377
  filterDiagnostics() {
@@ -4627,7 +4654,7 @@ var init_service = __esm({
4627
4654
  provider: provider.name,
4628
4655
  model: provider.model
4629
4656
  });
4630
- const sourceFiles = await this.discoverSourceFiles();
4657
+ const sourceFiles = await this.discoverSourceFiles(options?.onProgress);
4631
4658
  options?.onProgress?.({
4632
4659
  phase: "build",
4633
4660
  message: `Chunking ${sourceFiles.length} source files`,
@@ -4912,7 +4939,7 @@ var init_service = __esm({
4912
4939
  }
4913
4940
  return results;
4914
4941
  }
4915
- async discoverSourceFiles() {
4942
+ async discoverSourceFiles(onProgress) {
4916
4943
  const profile = readProjectProfile(this.projectRoot);
4917
4944
  const frameworks = profile?.stack_profile?.frameworks ?? [];
4918
4945
  const packs = getPacksForFrameworks(frameworks, this.projectRoot);
@@ -4922,7 +4949,7 @@ var init_service = __esm({
4922
4949
  packs,
4923
4950
  intelligence
4924
4951
  });
4925
- return filter.discoverFiles();
4952
+ return filter.discoverFiles(onProgress);
4926
4953
  }
4927
4954
  async validateResumeState() {
4928
4955
  if (this.resumeValidationPromise) {
@@ -11450,8 +11477,81 @@ function inferSelectionDomain(detection, overrides, snapshot) {
11450
11477
  // src/onboarding/rag-onboarding.ts
11451
11478
  init_esm_shims();
11452
11479
  init_project_intelligence();
11453
- init_service();
11454
11480
  import { input, select as select2 } from "@inquirer/prompts";
11481
+
11482
+ // src/cli/ui/rag-progress.ts
11483
+ init_esm_shims();
11484
+ import chalk from "chalk";
11485
+ var PANEL_WIDTH = 74;
11486
+ function border(left, fill, right) {
11487
+ return `${left}${fill.repeat(PANEL_WIDTH)}${right}`;
11488
+ }
11489
+ function pad(text = "") {
11490
+ return ` ${text}`.padEnd(PANEL_WIDTH, " ");
11491
+ }
11492
+ function surface(text) {
11493
+ return chalk.hex("#FFF7ED")(text);
11494
+ }
11495
+ function accent(text) {
11496
+ return chalk.hex("#C2410C").bold(text);
11497
+ }
11498
+ function muted(text) {
11499
+ return chalk.hex("#9A6B55")(text);
11500
+ }
11501
+ function highlight(text) {
11502
+ return chalk.hex("#7C2D12").bold(text);
11503
+ }
11504
+ function progressText(update) {
11505
+ if (update.percent === void 0) {
11506
+ return update.message;
11507
+ }
11508
+ return `${update.percent.toString().padStart(3, " ")}% ${update.message}`;
11509
+ }
11510
+ function detectStep(update) {
11511
+ const message = update.message.toLowerCase();
11512
+ if (update.phase === "download" || update.phase === "load") {
11513
+ return { id: "prepare", number: 1, title: "Preparing embedding runtime" };
11514
+ }
11515
+ if (message.includes("discovering repository files") || message.includes("filtering ") || message.includes("filtered ") || message.includes("eligib") || message.includes("chunking") || message.includes("chunked")) {
11516
+ return { id: "scan", number: 2, title: "Discovering, filtering, and chunking the codebase" };
11517
+ }
11518
+ if (message.includes("embedded")) {
11519
+ return { id: "embed", number: 3, title: "Generating embeddings and vector data" };
11520
+ }
11521
+ return { id: "finalize", number: 4, title: "Finalizing RAG indexes and metadata" };
11522
+ }
11523
+ function renderRagIntroPanel() {
11524
+ const lines = [
11525
+ accent(border("\u2554", "\u2550", "\u2557")),
11526
+ accent("\u2551") + surface(pad(" OPTIONAL PROJECT INTELLIGENCE")) + accent("\u2551"),
11527
+ accent(border("\u2560", "\u2550", "\u2563")),
11528
+ accent("\u2551") + surface(pad(" Build a semantic RAG layer over this codebase.")) + accent("\u2551"),
11529
+ accent("\u2551") + muted(pad(" paqad-ai keeps AI suggestions relevant as files, docs, and patterns grow.")) + accent("\u2551"),
11530
+ accent("\u2551") + surface(pad()) + accent("\u2551"),
11531
+ accent("\u2551") + highlight(pad(" Retrieval-Augmented Generation (RAG) for your repo")) + accent("\u2551"),
11532
+ accent("\u2551") + surface(pad()) + accent("\u2551"),
11533
+ accent("\u2551") + muted(pad(" \u2022 Pulls the most relevant code and docs into each task")) + accent("\u2551"),
11534
+ accent("\u2551") + muted(pad(" \u2022 Cuts irrelevant context so prompts stay tighter and cheaper")) + accent("\u2551"),
11535
+ accent("\u2551") + muted(pad(" \u2022 Keeps completions grounded in your actual project structure")) + accent("\u2551"),
11536
+ accent(border("\u255A", "\u2550", "\u255D")),
11537
+ ""
11538
+ ];
11539
+ return lines.join("\n");
11540
+ }
11541
+ function createRagProgressReporter(write) {
11542
+ let lastStepId;
11543
+ return (update) => {
11544
+ const step = detectStep(update);
11545
+ if (step.id !== lastStepId) {
11546
+ write(chalk.hex("#C2410C").bold(`[${step.number}/4] ${step.title}`));
11547
+ lastStepId = step.id;
11548
+ }
11549
+ write(`${chalk.hex("#EA580C")(" >")} ${progressText(update)}`);
11550
+ };
11551
+ }
11552
+
11553
+ // src/onboarding/rag-onboarding.ts
11554
+ init_service();
11455
11555
  function isInteractive2() {
11456
11556
  return Boolean(process.stdout.isTTY && process.stdin.isTTY);
11457
11557
  }
@@ -11470,19 +11570,7 @@ async function resolveRagSelection(domain, preset) {
11470
11570
  if (domain !== "coding" || !isInteractive2()) {
11471
11571
  return void 0;
11472
11572
  }
11473
- process.stdout.write(
11474
- [
11475
- "paqad-ai can build a RAG (Retrieval-Augmented Generation) index of your",
11476
- "codebase so AI suggestions stay relevant and context-aware as your",
11477
- "project grows.",
11478
- "",
11479
- "Why it matters:",
11480
- " \xB7 Sends fewer tokens to the AI by avoiding irrelevant context",
11481
- " \xB7 Retrieves the most relevant code and docs for each task",
11482
- " \xB7 Keeps suggestions project-aware as the repository grows",
11483
- ""
11484
- ].join("\n")
11485
- );
11573
+ process.stdout.write(renderRagIntroPanel());
11486
11574
  const enabled = await select2({
11487
11575
  message: "Want to enable this?",
11488
11576
  choices: [
@@ -11561,16 +11649,14 @@ async function enableRagDuringOnboarding(projectRoot, ragSelection) {
11561
11649
  });
11562
11650
  service.storeApiKey(ragSelection.provider, key.trim());
11563
11651
  }
11652
+ const reportProgress = createRagProgressReporter(printRagProgress);
11564
11653
  await service.configureAndBuild(
11565
11654
  {
11566
11655
  rag_enabled: true,
11567
11656
  embedding_provider: ragSelection.provider,
11568
11657
  embedding_model: ragSelection.model ?? getDefaultEmbeddingModel(ragSelection.provider)
11569
11658
  },
11570
- (update) => {
11571
- const prefix = update.percent !== void 0 ? `[${update.percent.toString().padStart(3, " ")}%] ` : "";
11572
- printRagProgress(`${prefix}${update.message}`);
11573
- }
11659
+ reportProgress
11574
11660
  );
11575
11661
  }
11576
11662
 
@@ -11703,12 +11789,6 @@ var OnboardingOrchestrator = class {
11703
11789
  projectRoot: options.projectRoot
11704
11790
  })
11705
11791
  );
11706
- if (adapter.capabilities.skills) {
11707
- generatedFiles.push(...await adapter.generateSkills(resolved.skills));
11708
- }
11709
- if (adapter.capabilities.agents) {
11710
- generatedFiles.push(...await adapter.generateAgents(resolved.agents));
11711
- }
11712
11792
  if (adapter.capabilities.hooks) {
11713
11793
  generatedFiles.push(...await adapter.installHooks(resolved.hooks));
11714
11794
  }
@@ -15365,7 +15445,7 @@ init_esm_shims();
15365
15445
  init_esm_shims();
15366
15446
 
15367
15447
  // src/index.ts
15368
- var VERSION = "0.1.9";
15448
+ var VERSION = "0.2.2";
15369
15449
 
15370
15450
  // src/cli/commands/capabilities.ts
15371
15451
  init_esm_shims();
@@ -15431,7 +15511,7 @@ import { Command as Command4 } from "commander";
15431
15511
 
15432
15512
  // src/cli/ui/banner.ts
15433
15513
  init_esm_shims();
15434
- import chalk from "chalk";
15514
+ import chalk2 from "chalk";
15435
15515
  var ASCII = `
15436
15516
  \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557
15437
15517
  \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557 \u2588\u2588\u2551
@@ -15441,21 +15521,21 @@ var ASCII = `
15441
15521
  \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2580\u2580\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D
15442
15522
  `.trimEnd();
15443
15523
  var SLOGAN = "AI Framework \xB7 Structured. Auditable. Scalable.\nDocumentation-first AI workflows for every stack.";
15444
- var PANEL_WIDTH = 68;
15524
+ var PANEL_WIDTH2 = 68;
15445
15525
  function borderLine(left, fill, right) {
15446
- return `${left}${fill.repeat(PANEL_WIDTH)}${right}`;
15526
+ return `${left}${fill.repeat(PANEL_WIDTH2)}${right}`;
15447
15527
  }
15448
- function pad(text = "") {
15449
- return ` ${text}`.padEnd(PANEL_WIDTH, " ");
15528
+ function pad2(text = "") {
15529
+ return ` ${text}`.padEnd(PANEL_WIDTH2, " ");
15450
15530
  }
15451
15531
  function claudeAccent(text) {
15452
- return chalk.hex("#D97757").bold(text);
15532
+ return chalk2.hex("#D97757").bold(text);
15453
15533
  }
15454
15534
  function claudeSurface(text) {
15455
- return chalk.hex("#F5E6DA")(text);
15535
+ return chalk2.hex("#F5E6DA")(text);
15456
15536
  }
15457
15537
  function claudeMuted(text) {
15458
- return chalk.hex("#9A6B55")(text);
15538
+ return chalk2.hex("#9A6B55")(text);
15459
15539
  }
15460
15540
  function printBanner() {
15461
15541
  console.log(claudeAccent(ASCII));
@@ -15465,22 +15545,22 @@ function printBanner() {
15465
15545
  function printNextSteps() {
15466
15546
  console.log();
15467
15547
  console.log(claudeAccent(borderLine("\u2554", "\u2550", "\u2557")));
15468
- console.log(claudeAccent("\u2551") + claudeSurface(pad(" ONBOARDING COMPLETE")) + claudeAccent("\u2551"));
15548
+ console.log(claudeAccent("\u2551") + claudeSurface(pad2(" ONBOARDING COMPLETE")) + claudeAccent("\u2551"));
15469
15549
  console.log(claudeAccent(borderLine("\u2560", "\u2550", "\u2563")));
15470
- console.log(claudeAccent("\u2551") + claudeSurface(pad()) + claudeAccent("\u2551"));
15550
+ console.log(claudeAccent("\u2551") + claudeSurface(pad2()) + claudeAccent("\u2551"));
15471
15551
  console.log(
15472
- claudeAccent("\u2551") + claudeSurface(pad(" NEXT STEP: run `create documentation` before feature work.")) + claudeAccent("\u2551")
15552
+ claudeAccent("\u2551") + claudeSurface(pad2(" NEXT STEP: run `create documentation` before feature work.")) + claudeAccent("\u2551")
15473
15553
  );
15474
- console.log(claudeAccent("\u2551") + claudeSurface(pad()) + claudeAccent("\u2551"));
15554
+ console.log(claudeAccent("\u2551") + claudeSurface(pad2()) + claudeAccent("\u2551"));
15475
15555
  console.log(
15476
- claudeAccent("\u2551") + chalk.hex("#B45309").bold(pad(" create documentation")) + claudeAccent("\u2551")
15556
+ claudeAccent("\u2551") + chalk2.hex("#B45309").bold(pad2(" create documentation")) + claudeAccent("\u2551")
15477
15557
  );
15478
- console.log(claudeAccent("\u2551") + claudeSurface(pad()) + claudeAccent("\u2551"));
15558
+ console.log(claudeAccent("\u2551") + claudeSurface(pad2()) + claudeAccent("\u2551"));
15479
15559
  console.log(
15480
- claudeAccent("\u2551") + claudeMuted(pad(" Generates module docs, stack docs, and architecture context.")) + claudeAccent("\u2551")
15560
+ claudeAccent("\u2551") + claudeMuted(pad2(" Generates module docs, stack docs, and architecture context.")) + claudeAccent("\u2551")
15481
15561
  );
15482
15562
  console.log(
15483
- claudeAccent("\u2551") + claudeMuted(pad(" A matching `.paqad/next-steps.md` file is written for agent pickup.")) + claudeAccent("\u2551")
15563
+ claudeAccent("\u2551") + claudeMuted(pad2(" A matching `.paqad/next-steps.md` file is written for agent pickup.")) + claudeAccent("\u2551")
15484
15564
  );
15485
15565
  console.log(claudeAccent(borderLine("\u255A", "\u2550", "\u255D")));
15486
15566
  console.log();
@@ -15872,10 +15952,7 @@ function printProgress(message) {
15872
15952
  process.stderr.write(`${message}
15873
15953
  `);
15874
15954
  }
15875
- function progressPrinter(update) {
15876
- const prefix = update.percent !== void 0 ? `[${update.percent.toString().padStart(3, " ")}%] ` : "";
15877
- printProgress(`${prefix}${update.message}`);
15878
- }
15955
+ var progressPrinter = createRagProgressReporter(printProgress);
15879
15956
  async function resolveProvider(explicit, current) {
15880
15957
  if (explicit && EMBEDDING_PROVIDERS.includes(explicit)) {
15881
15958
  return explicit;