Skip to content

[wip] feat: alternative clone implementation that is 50% faster - #264

Open
ashwin153 wants to merge 2 commits into
mainfrom
alternative-clone
Open

[wip] feat: alternative clone implementation that is 50% faster#264
ashwin153 wants to merge 2 commits into
mainfrom
alternative-clone

Conversation

@ashwin153

@ashwin153 ashwin153 commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a new clone-app skill for the softlight plugin — a Python script (create_clone.py) that scaffolds a Vite + React + TypeScript project from an existing source directory, resolves transitive relative imports, and installs dependencies via pnpm, along with a SKILL.md describing the 5-step workflow.

  • P1 — Version mismatch: .claude-plugin/plugin.json was bumped to 5.120.0 while .codex-plugin and .cursor-plugin were both bumped to 5.104.0; the 16-minor-version gap looks like a typo.
  • P1 — Crash on empty source dir: os.path.commonpath(source_files) at line 173 raises ValueError when source_files is empty (e.g., source dir only contained excluded directories).

Confidence Score: 3/5

Not safe to merge as-is — one clear version-bump typo and one crash-inducing code path need to be resolved first.

Two P1 findings: the .claude-plugin version jumping to 5.120.0 (likely unintentional) and the unguarded commonpath([]) crash on empty source directories. P2 findings (tsconfig/entry mismatch and scaffold overwrite) are worth addressing before GA use but don't block merge on their own.

plugins/softlight/.claude-plugin/plugin.json (version typo) and plugins/softlight/skills/clone-app/create_clone.py (commonpath crash + tsconfig/entry mismatch)

Important Files Changed

Filename Overview
plugins/softlight/skills/clone-app/create_clone.py New script scaffolding a Vite+React clone; crashes on empty source dirs (commonpath), has entry-point/tsconfig mismatch, and can overwrite scaffold with source files
plugins/softlight/.claude-plugin/plugin.json Version bumped to 5.120.0 — inconsistent with .codex-plugin and .cursor-plugin which both went to 5.104.0; likely a typo
plugins/softlight/.codex-plugin/plugin.json Version bumped from 5.103.0 to 5.104.0; no other changes
plugins/softlight/.cursor-plugin/plugin.json Version bumped from 5.103.0 to 5.104.0; no other changes
plugins/softlight/skills/clone-app/SKILL.md New skill definition describing a 5-step clone workflow; clear and self-contained

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["create_clone(source_dir)"] --> B["mkdtemp → target_dir"]
    B --> C["_create_package_json\n(merges source deps + vite/react devDeps)"]
    C --> D["_create_tsconfig_json\n(include: ['src'] only ⚠️)"]
    D --> E["_create_index_html\n(entry: main.tsx at root ⚠️)"]
    E --> F["_create_vite_config_ts"]
    F --> G["_copy_src(target_dir, source_dir)"]
    G --> G1["os.walk source_dir\nskipping node_modules/.git/dist/…"]
    G1 --> G2["BFS: follow relative imports\nin .ts/.tsx files"]
    G2 --> G3["commonpath(source_files) → root_dir\n⚠️ crashes if source_files empty"]
    G3 --> G4["copy each file to target_dir / file.relative_to(root_dir)\n⚠️ may overwrite scaffold files"]
    G4 --> H["_install_dependencies\npnpm install --prefer-offline"]
    H --> I["print(target_dir)"]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: plugins/softlight/.claude-plugin/plugin.json
Line: 8

Comment:
**Version inconsistency with sibling plugin files**

`.claude-plugin` was bumped to `5.120.0` while `.codex-plugin` and `.cursor-plugin` were both bumped to `5.104.0`. A 16-minor-version gap between files that should stay in lockstep looks like a copy-paste error — if the intent was to bump by one minor version (adding the new `clone-app` skill), all three should be `5.104.0`.

```suggestion
  "version": "5.104.0"
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 173

Comment:
**`commonpath` crashes on empty source directory**

If `source_dir` is empty (or every file in it is skipped by the `os.walk` exclusion list), `source_files` will be an empty set and `os.path.commonpath([])` raises `ValueError: commonpath() arg is an empty sequence`, crashing the script with no useful error message. A guard is needed before this line.

```suggestion
    if not source_files:
        raise ValueError(f"No source files found in {source_dir}")
    root_dir = pathlib.Path(os.path.commonpath(source_files))
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 69-71

Comment:
**`tsconfig` `include` conflicts with `index.html` entry point**

`index.html` references `src="main.tsx"` at the project root, but `tsconfig.json` only includes the `"src"` subdirectory. Any `main.tsx` placed at the project root (as SKILL.md step 3 instructs) will be bundled by Vite but silently skipped by `tsc -b`, so type errors in the entry file go undetected. Consider broadening the include to cover root-level `.ts`/`.tsx` files or moving the entry point to `src/main.tsx`.

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 173-178

Comment:
**Copied source files can silently overwrite scaffold config**

`_copy_src` is called after the scaffold files (`package.json`, `tsconfig.json`, `vite.config.ts`, `index.html`) are written. If the source directory contains any of these files at its root level, `shutil.copy2` will overwrite the carefully constructed scaffold without warning. Consider skipping files whose target path collides with an existing scaffold file, or use a dedicated `src/` subdirectory for copied source files.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "chore: run pre-commit" | Re-trigger Greptile

Greptile also left 4 inline comments on this PR.

"mcpServers": "./.mcp.json",
"name": "softlight",
"version": "5.103.0"
"version": "5.120.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Version inconsistency with sibling plugin files

.claude-plugin was bumped to 5.120.0 while .codex-plugin and .cursor-plugin were both bumped to 5.104.0. A 16-minor-version gap between files that should stay in lockstep looks like a copy-paste error — if the intent was to bump by one minor version (adding the new clone-app skill), all three should be 5.104.0.

Suggested change
"version": "5.120.0"
"version": "5.104.0"
Prompt To Fix With AI
This is a comment left during a code review.
Path: plugins/softlight/.claude-plugin/plugin.json
Line: 8

Comment:
**Version inconsistency with sibling plugin files**

`.claude-plugin` was bumped to `5.120.0` while `.codex-plugin` and `.cursor-plugin` were both bumped to `5.104.0`. A 16-minor-version gap between files that should stay in lockstep looks like a copy-paste error — if the intent was to bump by one minor version (adding the new `clone-app` skill), all three should be `5.104.0`.

```suggestion
  "version": "5.104.0"
```

How can I resolve this? If you propose a fix, please make it concise.

)
if imported_file_with_suffix.is_file():
if imported_file_with_suffix not in source_files:
source_files.add(imported_file_with_suffix)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 commonpath crashes on empty source directory

If source_dir is empty (or every file in it is skipped by the os.walk exclusion list), source_files will be an empty set and os.path.commonpath([]) raises ValueError: commonpath() arg is an empty sequence, crashing the script with no useful error message. A guard is needed before this line.

Suggested change
source_files.add(imported_file_with_suffix)
if not source_files:
raise ValueError(f"No source files found in {source_dir}")
root_dir = pathlib.Path(os.path.commonpath(source_files))
Prompt To Fix With AI
This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 173

Comment:
**`commonpath` crashes on empty source directory**

If `source_dir` is empty (or every file in it is skipped by the `os.walk` exclusion list), `source_files` will be an empty set and `os.path.commonpath([])` raises `ValueError: commonpath() arg is an empty sequence`, crashing the script with no useful error message. A guard is needed before this line.

```suggestion
    if not source_files:
        raise ValueError(f"No source files found in {source_dir}")
    root_dir = pathlib.Path(os.path.commonpath(source_files))
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +69 to +71
"include": [
"src",
],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 tsconfig include conflicts with index.html entry point

index.html references src="main.tsx" at the project root, but tsconfig.json only includes the "src" subdirectory. Any main.tsx placed at the project root (as SKILL.md step 3 instructs) will be bundled by Vite but silently skipped by tsc -b, so type errors in the entry file go undetected. Consider broadening the include to cover root-level .ts/.tsx files or moving the entry point to src/main.tsx.

Prompt To Fix With AI
This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 69-71

Comment:
**`tsconfig` `include` conflicts with `index.html` entry point**

`index.html` references `src="main.tsx"` at the project root, but `tsconfig.json` only includes the `"src"` subdirectory. Any `main.tsx` placed at the project root (as SKILL.md step 3 instructs) will be bundled by Vite but silently skipped by `tsc -b`, so type errors in the entry file go undetected. Consider broadening the include to cover root-level `.ts`/`.tsx` files or moving the entry point to `src/main.tsx`.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +173 to +178
source_files.add(imported_file_with_suffix)
queue.append(imported_file_with_suffix)

root_dir = pathlib.Path(os.path.commonpath(source_files))

for source_file in source_files:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Copied source files can silently overwrite scaffold config

_copy_src is called after the scaffold files (package.json, tsconfig.json, vite.config.ts, index.html) are written. If the source directory contains any of these files at its root level, shutil.copy2 will overwrite the carefully constructed scaffold without warning. Consider skipping files whose target path collides with an existing scaffold file, or use a dedicated src/ subdirectory for copied source files.

Prompt To Fix With AI
This is a comment left during a code review.
Path: plugins/softlight/skills/clone-app/create_clone.py
Line: 173-178

Comment:
**Copied source files can silently overwrite scaffold config**

`_copy_src` is called after the scaffold files (`package.json`, `tsconfig.json`, `vite.config.ts`, `index.html`) are written. If the source directory contains any of these files at its root level, `shutil.copy2` will overwrite the carefully constructed scaffold without warning. Consider skipping files whose target path collides with an existing scaffold file, or use a dedicated `src/` subdirectory for copied source files.

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant