Skip to content

armgit / Ix

Public Imported from GitHub
0

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

fix(ci): search from the mapped fixture; Windows paths; document reset --workspace

KageBinarydade81be7d6a
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b2a634fd..af95550d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -274,7 +274,9 @@ jobs:
FIXTURE="$PWD/test/fixtures/sample_project"
echo "::group::status"; $IX status; echo "::endgroup::"
echo "::group::map fixture"; $IX map "$FIXTURE" --silent; echo "::endgroup::"
- echo "::group::search"; $IX search BillingService --format json | tee search.json; echo "::endgroup::"
+ # From inside the fixture: a graph read from a directory no workspace
+ # covers is refused (workspace_not_mapped), not answered from the default.
+ echo "::group::search"; (cd "$FIXTURE" && $IX search BillingService --format json) | tee search.json; echo "::endgroup::"
node -e "const r=require('./search.json');const n=(r.results||r).length||0;if(!n){console.error('no search results after map');process.exit(1)}console.log('search returned',n,'results')"
# From the directory the fixture was mapped into. doctor answers for
# its own cwd (#518), and `ix-cli` is not a registered workspace — a
diff --git a/ix-cli/src/cli/__tests__/workspace-not-mapped.test.ts b/ix-cli/src/cli/__tests__/workspace-not-mapped.test.ts
index 76d0f85c..61273f90 100644
--- a/ix-cli/src/cli/__tests__/workspace-not-mapped.test.ts
+++ b/ix-cli/src/cli/__tests__/workspace-not-mapped.test.ts
@@ -38,7 +38,9 @@ function register(workspaces: Array<Partial<WorkspaceConfig> & { root_path: stri
}
beforeEach(() => {
- home = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), "ix-unmapped-")));
+ // `.native`: on Windows the temp dir is an 8.3 short path (RUNNER~1) and
+ // git reports the long one, so the comparisons below need the long form.
+ home = fs.realpathSync.native(fs.mkdtempSync(path.join(os.tmpdir(), "ix-unmapped-")));
process.env.IX_HOME = path.join(home, ".ix");
other = path.join(home, "other-repo");
unmapped = path.join(home, "somewhere-else");
@@ -124,7 +126,7 @@ describe("resolveWorkspaceRoot", () => {
// files: an answer from an unrelated repository.
execFileSync("git", ["init", "-q", unmapped]);
register([{ root_path: other, default: true }]);
- expect(fs.realpathSync(resolveWorkspaceRoot(undefined, unmapped))).toBe(unmapped);
+ expect(fs.realpathSync.native(resolveWorkspaceRoot(undefined, unmapped))).toBe(unmapped);
});
it("keeps the default workspace for a directory with no local context", () => {
diff --git a/ix-cli/src/cli/bootstrap.ts b/ix-cli/src/cli/bootstrap.ts
index 4fe0c955..b1226c9e 100644
--- a/ix-cli/src/cli/bootstrap.ts
+++ b/ix-cli/src/cli/bootstrap.ts
@@ -171,7 +171,10 @@ export function resolveWorkspaceId(cwd = process.cwd()): string | undefined {
export function requireReadWorkspaceId(cwd = process.cwd()): string {
const id = resolveWorkspaceId(cwd);
if (id) return id;
- throw new WorkspaceNotMappedError(cwd, workspaceNotMappedHint(cwd, gitRootFor(cwd)));
+ // git prints its top-level with forward slashes on Windows; the hint is
+ // for a person to read and paste, so it gets the platform's own form.
+ const gitRoot = gitRootFor(cwd);
+ throw new WorkspaceNotMappedError(cwd, workspaceNotMappedHint(cwd, gitRoot && resolve(gitRoot)));
}
/**
diff --git a/skills/ix/references/flags.md b/skills/ix/references/flags.md
index 6059b7a4..2a76a22d 100644
--- a/skills/ix/references/flags.md
+++ b/skills/ix/references/flags.md
@@ -604,6 +604,7 @@ Wipe graph data.
| `--yes` / `-y` | — | off | Skip confirmation prompt |
| `--code` | — | off | Reset only code graph (files, functions, classes, regions); preserve goals, plans, tasks, bugs, and decisions |
| `--ingest` | — | off | Re-run ix map after wiping (rebuilds the code graph) |
+| `--workspace` | — | off | Reset only the registered workspace containing cwd (`/v1/reset/workspace`); every other workspace is left alone. The fix for a hollowed graph, with `--ingest` |
### `ix savings`