Skip to content

armgit / Ix

Public Imported from GitHub
0

Understand any codebase instantly. System intelligence for codebases, built for humans and AI.

fix: ix ingest recursive by default; ix reset auto-ingests after wipe

kagebinary9565350d7228
diff --git a/ix-cli/src/cli/commands/ingest.ts b/ix-cli/src/cli/commands/ingest.ts
index 86a290bf..4ab59eba 100644
--- a/ix-cli/src/cli/commands/ingest.ts
+++ b/ix-cli/src/cli/commands/ingest.ts
@@ -61,7 +61,7 @@ export function registerIngestCommand(program: Command): void {
.command('ingest [path]')
.description('Ingest source files or GitHub data into the knowledge graph')
.option('--path <dir>', 'Path to ingest (alternative to positional argument)')
- .option('--recursive', 'Recursively ingest directory')
+ .option('--no-recursive', 'Do not recurse into subdirectories (recursive is on by default)')
.option('--github <owner/repo>', 'Ingest issues, PRs, and commits from a GitHub repository')
.option('--token <pat>', 'GitHub personal access token')
.option('--since <date>', 'Only fetch items updated after this date (ISO 8601)')
@@ -69,7 +69,7 @@ export function registerIngestCommand(program: Command): void {
.option('--force', 'Force re-ingest even if files are unchanged (useful after parser upgrades)')
.option('--format <fmt>', 'Output format (text|json)', 'text')
.option('--root <dir>', 'Workspace root directory')
- .addHelpText('after', '\nExamples:\n ix ingest ./src --recursive\n ix ingest --path ./src --recursive --force\n ix ingest --github owner/repo\n ix ingest --github owner/repo --since 2026-01-01 --limit 20 --format json\n ix ingest --github owner/repo --token ghp_xxxx')
+ .addHelpText('after', '\nExamples:\n ix ingest ./src\n ix ingest --path ./src --force\n ix ingest --github owner/repo\n ix ingest --github owner/repo --since 2026-01-01 --limit 20 --format json\n ix ingest --github owner/repo --token ghp_xxxx')
.action(async (positionalPath: string | undefined, opts: {
path?: string; recursive?: boolean; force?: boolean; github?: string; token?: string;
since?: string; limit: string; format: string; root?: string;
@@ -122,7 +122,7 @@ async function ingestFiles(
const stat = fs.statSync(resolvedPath);
const filePaths: string[] = stat.isFile()
? [resolvedPath]
- : Array.from(walkFiles(resolvedPath, opts.recursive ?? false, isGrammarSupported));
+ : Array.from(walkFiles(resolvedPath, opts.recursive ?? true, isGrammarSupported));
filesDiscovered = filePaths.length;
diff --git a/ix-cli/src/cli/commands/reset.ts b/ix-cli/src/cli/commands/reset.ts
index dcf57b02..6ee263df 100644
--- a/ix-cli/src/cli/commands/reset.ts
+++ b/ix-cli/src/cli/commands/reset.ts
@@ -1,14 +1,16 @@
import type { Command } from "commander";
import chalk from "chalk";
+import { spawnSync } from "child_process";
import { IxClient } from "../../client/api.js";
import { getEndpoint } from "../config.js";
export function registerResetCommand(program: Command): void {
program
.command("reset")
- .description("Wipe all graph data (nodes + edges) for a clean re-ingest")
+ .description("Wipe all graph data and re-ingest from current directory")
.option("-y, --yes", "Skip confirmation prompt")
- .action(async (opts: { yes?: boolean }) => {
+ .option("--no-ingest", "Wipe only, skip the automatic re-ingest")
+ .action(async (opts: { yes?: boolean; ingest?: boolean }) => {
if (!opts.yes) {
process.stdout.write(
chalk.yellow("This will delete all nodes and edges. Are you sure? (y/N) ")
@@ -17,6 +19,7 @@ export function registerResetCommand(program: Command): void {
process.stdin.setEncoding("utf8");
process.stdin.once("data", (chunk: string) => resolve(chunk.trim()));
});
+ process.stdin.pause();
if (answer.toLowerCase() !== "y") {
console.log(chalk.dim("Aborted."));
return;
@@ -26,10 +29,20 @@ export function registerResetCommand(program: Command): void {
const client = new IxClient(getEndpoint());
try {
await client.reset();
- console.log(chalk.green("✓") + " Graph wiped. Run " + chalk.bold("ix ingest . --recursive") + " to re-ingest.");
+ console.log(chalk.green("✓") + " Graph wiped.");
} catch (err: any) {
console.error(chalk.red("Error:"), err.message);
process.exitCode = 1;
+ return;
}
+
+ if (opts.ingest === false) return;
+
+ console.log(chalk.dim("Re-ingesting..."));
+ const result = spawnSync(process.argv[0], [process.argv[1], "ingest", "."], {
+ stdio: "inherit",
+ cwd: process.cwd(),
+ });
+ if (result.status !== 0) process.exitCode = result.status ?? 1;
});
}