Commit Graph

1 Commits

Author SHA1 Message Date
Cursor Agent
0ab7ecf403 feat(plugins): code-import atom repo walker (Phase 7 entry slice)
Plan N2 / spec §10 / §21.3.2 / §16 Phase 7.

apps/daemon/src/plugins/atoms/code-import.ts ships the daemon-side
implementation of the SKILL.md fragment landed in §3.M4. Given a
repo path + a project cwd, the runner walks the tree once, writes
`<cwd>/code/index.json`, and never re-walks until the next
explicit re-import.

The walker:
  - Honours OD_CODE_IMPORT_BUDGET_MS (default 60s) and stops cleanly
    when the budget is exhausted, recording every unwalked
    directory under skipped[] with reason='budget-exceeded'.
  - Skips the canonical no-go folders: node_modules, .git, .next,
    .svelte-kit, dist, build, out, coverage, .vercel, .vscode,
    .turbo, .cache, .pnpm-store, .parcel-cache, .nuxt, .astro.
    Each entry lands in skipped[] with reason='directory-skiplist'.
  - Marks symlinks as skipped (reason='symlink') without following.
  - Records files larger than largeFileBytes (default 1 MiB) in
    skipped[] AND in files[] (so the agent sees they exist), but
    omits their imports[] to keep memory bounded.
  - Detects framework: next (app vs pages router), sveltekit, astro,
    remix, vite, cra, custom, unknown.
  - Detects package manager from lockfile presence (pnpm-lock.yaml
    > yarn.lock > bun.lockb > package-lock.json > unknown).
  - Detects style system: tailwind / styled-components / emotion /
    css.
  - Lightweight import edge extraction (regex) for ts/tsx/js/jsx;
    documented as heuristic in the SKILL.md fragment.

Daemon tests: 1528 → 1534 (+6 cases on plugins-code-import:
next-app router + tailwind + pnpm detection, skiplist enforcement,
symlink skip, large-file imports omission, persisted JSON layout,
non-directory repoPath rejection).

Co-authored-by: Tom Huang <1043269994@qq.com>
2026-05-09 14:33:53 +00:00