agent-rules-init 0.6.1 → 0.6.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.d.ts CHANGED
@@ -5,6 +5,7 @@ import { type PromptFn } from "./core/prompt-engine.js";
5
5
  import { type AssistantId, type EnrichMetrics, type ExecFn } from "./core/llm-bridge.js";
6
6
  import type { RepoFacts } from "./core/types.js";
7
7
  export interface RunCliOptions {
8
+ /** @deprecated Project metadata is no longer requested interactively. */
8
9
  promptFn?: PromptFn;
9
10
  execFn?: ExecFn;
10
11
  skipLlm?: boolean;
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import { UI, detectLang } from "./core/i18n.js";
10
10
  import { loadConfig } from "./core/config.js";
11
11
  import { applyProjectExcludes, buildPackageUnits } from "./core/project-units.js";
12
12
  import { renderProjectUnitAgents } from "./core/project-unit-output.js";
13
- import { collectLowConfidenceQuestions, askQuestions, applyAnswers, makeDefaultPromptFn, hasInteractiveTty, } from "./core/prompt-engine.js";
13
+ import { hasInteractiveTty, } from "./core/prompt-engine.js";
14
14
  import { detectAvailableAssistants, enrichFilesWithAssistant, estimateEnrichment, defaultExecFn, } from "./core/llm-bridge.js";
15
15
  import { hashGeneratedFiles, makeGenerationState, writeGenerationState, } from "./core/generation-state.js";
16
16
  import { evaluateGenerationCheck } from "./core/check-state.js";
@@ -76,13 +76,14 @@ export async function runCli(rootPath, options = {}) {
76
76
  options.onConfigWarnings?.(loadedConfig.warnings);
77
77
  const execFn = options.execFn ?? defaultExecFn;
78
78
  const lang = options.lang ?? config.lang ?? detectLang();
79
- const promptFn = options.promptFn ?? makeDefaultPromptFn(lang);
80
79
  const ui = UI[lang];
81
80
  const signals = applyProjectExcludes(scanRepo(rootPath), config.exclude ?? []);
82
81
  const rawDetections = ALL_PACKS.map((pack) => pack.detect(signals)).filter((d) => d !== null);
83
- const questions = collectLowConfidenceQuestions(rawDetections, lang);
84
- const answers = options.nonInteractive ? {} : await askQuestions(questions, promptFn);
85
- const detections = applyAnswers(rawDetections, answers);
82
+ // Missing framework/tooling signals are valid facts, not questions the user should
83
+ // have to answer. Keep the low-confidence `none` value and render conservative,
84
+ // framework-neutral guidance; explicit repository config can still override project
85
+ // metadata when a team wants to provide it.
86
+ const detections = rawDetections;
86
87
  const facts = buildRepoFacts(signals, lang);
87
88
  options.onFacts?.(facts);
88
89
  const ctx = { facts, signals };
@@ -1,15 +1,6 @@
1
- import { type Lang } from "./i18n.js";
2
- import type { DetectionResult } from "./types.js";
3
- export type QuestionField = "framework" | "testRunner" | "linter" | "packageManager";
4
- export interface Question {
5
- packId: string;
6
- field: QuestionField;
7
- message: string;
8
- }
9
- export declare function collectLowConfidenceQuestions(detections: DetectionResult[], lang: Lang): Question[];
1
+ /**
2
+ * Kept as a compatibility type for callers that supplied a custom clarification
3
+ * prompt before 0.6.2. Project metadata is no longer requested interactively.
4
+ */
10
5
  export type PromptFn = (message: string) => Promise<string>;
11
6
  export declare function hasInteractiveTty(): boolean;
12
- export declare function makeDefaultPromptFn(lang: Lang): PromptFn;
13
- export declare const defaultPromptFn: PromptFn;
14
- export declare function askQuestions(questions: Question[], promptFn?: PromptFn): Promise<Record<string, string>>;
15
- export declare function applyAnswers(detections: DetectionResult[], answers: Record<string, string>): DetectionResult[];
@@ -1,57 +1,3 @@
1
- import * as clack from "@clack/prompts";
2
- import { UI, detectLang } from "./i18n.js";
3
- const FIELDS = ["framework", "testRunner", "linter", "packageManager"];
4
- export function collectLowConfidenceQuestions(detections, lang) {
5
- const ui = UI[lang];
6
- const questions = [];
7
- for (const detection of detections) {
8
- for (const field of FIELDS) {
9
- const detectionField = detection[field];
10
- if (detectionField && detectionField.confidence === "low") {
11
- questions.push({
12
- packId: detection.packId,
13
- field,
14
- message: ui.question(ui.fieldLabels[field], detection.language),
15
- });
16
- }
17
- }
18
- }
19
- return questions;
20
- }
21
1
  export function hasInteractiveTty() {
22
2
  return Boolean(process.stdin.isTTY && process.stdout.isTTY);
23
3
  }
24
- export function makeDefaultPromptFn(lang) {
25
- return async (message) => {
26
- if (!hasInteractiveTty()) {
27
- console.warn(UI[lang].skippedQuestion(message));
28
- return "";
29
- }
30
- const answer = await clack.text({ message });
31
- if (clack.isCancel(answer)) {
32
- clack.cancel(UI[lang].cancelled);
33
- process.exit(1);
34
- }
35
- return answer;
36
- };
37
- }
38
- export const defaultPromptFn = (message) => makeDefaultPromptFn(detectLang())(message);
39
- export async function askQuestions(questions, promptFn = defaultPromptFn) {
40
- const answers = {};
41
- for (const question of questions) {
42
- answers[`${question.packId}:${question.field}`] = await promptFn(question.message);
43
- }
44
- return answers;
45
- }
46
- export function applyAnswers(detections, answers) {
47
- return detections.map((detection) => {
48
- const updated = { ...detection };
49
- for (const field of FIELDS) {
50
- const answer = answers[`${detection.packId}:${field}`];
51
- if (answer) {
52
- updated[field] = { value: answer, confidence: "high" };
53
- }
54
- }
55
- return updated;
56
- });
57
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-rules-init",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Generates CLAUDE.md, AGENTS.md, copilot-instructions.md and prompt files from what your repo actually is.",
5
5
  "license": "MIT",
6
6
  "type": "module",