-
Notifications
You must be signed in to change notification settings - Fork 5
feat: /hance skill (install, run, try, batch, ui) #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
42f07f2
docs(spec): /hance skill design
9c7f34e
docs(spec): npx-default runner, setup is install-only
6bd004a
feat(skill): add agent installer + preset index for /hance skill
52feec5
feat(skill): /hance skill files, /compare route, index rebuild hooks
4d480d2
fix(gitignore): anchor /hance so it does not match skills/hance/
e8ecd76
refactor(skill): stateless /compare hand-off, drop binary installer, …
be2ca3d
fix(ui): break infinite re-fetch loop causing editor flicker on initi…
8bf9b1a
feat(presets): add new presets and tune existing ones
d041e85
feat(presets): add 37 film stock presets from FilmBox catalog
60361bc
docs(readme): lead with browser preview + CLI combo, add agent-friend…
c36fcf5
docs(readme): add "Who is this for" positioning section
c432b6c
feat(ui): add agent instruction banners to compare and edit views
1cbca14
fix(ui): address review findings — catch fallback, path normalization…
4c29ac3
chore(presets): remove 13 duplicate film stock presets
012be63
chore: remove hance skill design spec from PR
c389b5e
refactor(ui): replace .then chain with async/await in schema fetch
b74d3be
chore(skills): trim hance skill description to under 150 chars
349230a
fix(skills): address PR review comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { existsSync, readdirSync, readFileSync, writeFileSync, statSync, mkdirSync } from "node:fs"; | ||
| import { join, dirname } from "node:path"; | ||
| import { builtinPresetsDir, userPresetsDir } from "./presets"; | ||
|
|
||
| export interface PresetIndexEntry { | ||
| name: string; | ||
| description: string; | ||
| keywords: string[]; | ||
| characteristics: string[]; | ||
| path: string; | ||
| } | ||
|
|
||
| function scanDir(dir: string, label: "builtin" | "user"): PresetIndexEntry[] { | ||
| if (!existsSync(dir)) return []; | ||
| const out: PresetIndexEntry[] = []; | ||
| for (const file of readdirSync(dir).sort()) { | ||
| if (!file.endsWith(".hlook")) continue; | ||
| const full = join(dir, file); | ||
| if (!statSync(full).isFile()) continue; | ||
| let data: Record<string, unknown>; | ||
| try { | ||
| data = JSON.parse(readFileSync(full, "utf-8")); | ||
| } catch { | ||
| continue; | ||
| } | ||
| out.push({ | ||
| name: typeof data.name === "string" ? data.name : file.replace(/\.hlook$/, ""), | ||
| description: typeof data.description === "string" ? data.description : "", | ||
| keywords: Array.isArray(data.keywords) ? (data.keywords as string[]) : [], | ||
| characteristics: Array.isArray(data.characteristics) ? (data.characteristics as string[]) : [], | ||
| path: label === "builtin" ? `presets/${file}` : full, | ||
| }); | ||
| } | ||
| return out; | ||
| } | ||
|
|
||
| export interface BuildOptions { | ||
| includeUser?: boolean; | ||
| includeBuiltin?: boolean; | ||
| } | ||
|
|
||
| export function buildPresetIndex(opts: BuildOptions = {}): PresetIndexEntry[] { | ||
| const { includeUser = true, includeBuiltin = true } = opts; | ||
| const builtin = includeBuiltin ? scanDir(builtinPresetsDir(), "builtin") : []; | ||
| const user = includeUser ? scanDir(userPresetsDir(), "user") : []; | ||
| const seen = new Set<string>(); | ||
| const merged: PresetIndexEntry[] = []; | ||
| for (const e of [...user, ...builtin]) { | ||
| if (seen.has(e.name)) continue; | ||
| seen.add(e.name); | ||
| merged.push(e); | ||
| } | ||
| return merged.sort((a, b) => a.name.localeCompare(b.name)); | ||
| } | ||
|
|
||
| export function rebuildPresetIndex(outPath?: string, opts: BuildOptions = {}): string { | ||
| const index = buildPresetIndex(opts); | ||
| const target = outPath ?? join(userPresetsDir(), "index.json"); | ||
| mkdirSync(dirname(target), { recursive: true }); | ||
| writeFileSync(target, JSON.stringify(index, null, 2) + "\n"); | ||
| return target; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import { useMemo } from "react"; | ||
|
|
||
| interface Variant { | ||
| label: string; | ||
| src: string | null; | ||
| lookPath: string | null; | ||
| } | ||
|
|
||
| function fileUrl(path: string | null): string | null { | ||
| if (!path) return null; | ||
| return `/api/local-file?path=${encodeURIComponent(path)}`; | ||
| } | ||
|
|
||
| export function ComparePage() { | ||
| const params = useMemo(() => new URLSearchParams(window.location.search), []); | ||
| const kind = params.get("kind") === "video" ? "video" : "image"; | ||
| const original = params.get("original"); | ||
| const variants: Variant[] = [ | ||
| { label: "A", src: params.get("v1"), lookPath: params.get("v1Look") }, | ||
| { label: "B", src: params.get("v2"), lookPath: params.get("v2Look") }, | ||
| { label: "C", src: params.get("v3"), lookPath: params.get("v3Look") }, | ||
| ]; | ||
|
|
||
| function editVariant(i: number) { | ||
| const v = variants[i]; | ||
| if (!v.lookPath || !original) return; | ||
| window.location.href = `/?look=${encodeURIComponent(v.lookPath)}`; | ||
| } | ||
|
|
||
| function Cell({ title, src, action }: { title: string; src: string | null; action?: React.ReactNode }) { | ||
| return ( | ||
| <div className="flex flex-col bg-zinc-900 rounded-md overflow-hidden border border-zinc-800"> | ||
| <div className="flex items-center justify-between px-3 py-2 border-b border-zinc-800"> | ||
| <span className="text-xs text-zinc-300">{title}</span> | ||
| {action} | ||
| </div> | ||
| <div className="flex-1 flex items-center justify-center bg-black min-h-0"> | ||
| {src ? ( | ||
| kind === "video" ? ( | ||
| <video src={src} controls className="max-w-full max-h-full" /> | ||
| ) : ( | ||
| <img src={src} alt={title} className="max-w-full max-h-full object-contain" /> | ||
| ) | ||
| ) : ( | ||
| <span className="text-xs text-zinc-600">missing</span> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <div className="h-screen bg-zinc-950 text-zinc-100 flex flex-col p-4 gap-3"> | ||
| <div className="rounded-lg bg-indigo-600 px-4 py-3 text-center text-sm font-medium text-white"> | ||
| Tell your agent which option you'd like to use — A, B, or C. | ||
| </div> | ||
| <div className="flex-1 grid grid-cols-2 grid-rows-2 gap-3 min-h-0"> | ||
| <Cell title="Original" src={fileUrl(original)} /> | ||
| {variants.map((v, i) => ( | ||
| <Cell | ||
| key={i} | ||
| title={v.label} | ||
| src={fileUrl(v.src)} | ||
| action={ | ||
| <button | ||
| onClick={() => editVariant(i)} | ||
| disabled={!v.lookPath || !original} | ||
| className="text-xs text-white bg-accent hover:bg-accent-hover disabled:opacity-50 rounded-sm px-2 py-0.5" | ||
| > | ||
| Edit | ||
| </button> | ||
| } | ||
| /> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed? the useEffect and the .then?