@ryuenn3123/agentic-senior-core 6.16.5 → 6.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/agentic-senior-core/.codex-plugin/plugin.json +1 -1
- package/.agents/plugins/agentic-senior-core/commands/asc-develop.md +1 -1
- package/.agents/plugins/agentic-senior-core/commands/asc-develop.toml +2 -3
- package/.agents/plugins/agentic-senior-core/commands/asc-test.md +1 -2
- package/.agents/plugins/agentic-senior-core/commands/asc-test.toml +2 -3
- package/.agents/plugins/agentic-senior-core/commands/asc-ui.md +1 -1
- package/.agents/plugins/agentic-senior-core/commands/asc-ui.toml +2 -3
- package/.agents/plugins/agentic-senior-core/hooks/lib/known-ui-slop-patterns.json +10 -0
- package/.agents/plugins/agentic-senior-core/hooks/post-edit-enforce.js +70 -9
- package/.agents/plugins/agentic-senior-core/hooks/stop-verify-gate.js +148 -0
- package/.agents/plugins/agentic-senior-core/hooks.json +7 -0
- package/.agents/plugins/agentic-senior-core/plugin.json +1 -1
- package/.agents/plugins/agentic-senior-core/rules/agentic-senior-core.md +2 -1
- package/.agents/plugins/agentic-senior-core/skills/asc/SKILL.md +7 -6
- package/.agents/plugins/agentic-senior-core/skills/asc/references/writing-skills.md +16 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-develop/SKILL.md +44 -59
- package/.agents/plugins/agentic-senior-core/skills/asc-develop/references/execution-plans.md +43 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-develop/references/subagent-orchestration.md +55 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-pentest/references/fuzzing-dsl.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-test/SKILL.md +5 -3
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/regression-proof.md +2 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/systematic-debugging.md +32 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/tdd-cycle.md +2 -2
- package/.agents/plugins/agentic-senior-core/skills/asc-test/references/uat.md +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/SKILL.md +42 -88
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/data-to-structure.md +96 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/responsive-and-copy.md +32 -0
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/states-and-a11y.md +38 -0
- package/gemini-extension.json +1 -1
- package/lib/cli/commands/preview.mjs +22 -17
- package/package.json +1 -1
- package/plugin.yaml +1 -1
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/accessibility.md +0 -102
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/copy-i18n.md +0 -151
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/browser-surfaces.md +0 -69
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/color-surfaces.md +0 -74
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/motion.md +0 -55
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/themes-catalog.md +0 -198
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/craft/typography.md +0 -54
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/divergence.md +0 -159
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/mobile-responsive.md +0 -115
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/experience.md +0 -27
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/genre-calibration.md +0 -89
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/operate.md +0 -79
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/persuade.md +0 -100
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/modes/read.md +0 -43
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/redesign-audit.md +0 -89
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/reflexes.md +0 -59
- package/.agents/plugins/agentic-senior-core/skills/asc-ui/references/states-feedback.md +0 -148
package/.agents/plugins/agentic-senior-core/skills/asc-develop/references/subagent-orchestration.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Subagent Orchestration & Worktree Isolation
|
|
2
|
+
|
|
3
|
+
Delegate independent implementation tasks to fresh subagents to keep parent coordination context small while enforcing two-stage verification gates.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Dispatch Criteria
|
|
8
|
+
|
|
9
|
+
Use subagents **only** when all three conditions hold:
|
|
10
|
+
1. An implementation plan contains $\ge$ 2 tasks with clearly separated module responsibilities.
|
|
11
|
+
2. Target file write sets do not overlap (preventing concurrent file write collisions).
|
|
12
|
+
3. Subagent tooling (`invoke_subagent` or host equivalent) is available in the runtime.
|
|
13
|
+
|
|
14
|
+
Keep tightly coupled sequential edits inline in the current session—subagent handoff overhead outweighs benefits when tasks mutate the same files.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2. Self-Contained Subagent Prompts
|
|
19
|
+
|
|
20
|
+
Subagents must never guess missing context. Every subagent prompt must explicitly state:
|
|
21
|
+
1. **Scoped Objective:** The single task deliverable and explicit non-goals (which files NOT to touch).
|
|
22
|
+
2. **Exact File Paths & Signatures:** Target implementation file(s), test file(s), and required input/output contracts.
|
|
23
|
+
3. **Analogous Pattern Reference:** One existing file path in the workspace whose naming, error handling, and layer split must be matched.
|
|
24
|
+
4. **Verification Command:** The exact test command (`ascx npm test -- ...`, `ascx pytest ...`) the subagent must run and pass before reporting back.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## 3. Two-Pass Review Gate Per Task
|
|
29
|
+
|
|
30
|
+
Never trust a subagent's verbal summary alone. After each subagent finishes, inspect `ascx git status` and `ascx git diff`, then verify two gates in order:
|
|
31
|
+
|
|
32
|
+
1. **Pass 1 — Spec Compliance:**
|
|
33
|
+
- Did the subagent implement every requirement and edge case in the task contract?
|
|
34
|
+
- Did it introduce unrequested features, extra files, or unauthorized dependencies?
|
|
35
|
+
2. **Pass 2 — Code Quality & Security:**
|
|
36
|
+
- Are inputs validated at trust boundaries, queries parameterized, and resource-level authorization checks enforced?
|
|
37
|
+
- Does the happy path use flat early returns without duplicated codebase utilities?
|
|
38
|
+
- Run the task test command fresh and confirm `exit 0`.
|
|
39
|
+
|
|
40
|
+
When all tasks finish, run the full repository test suite once across the combined diff before handoff.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 4. Git Worktree Isolation (`git worktree`)
|
|
45
|
+
|
|
46
|
+
When running parallel feature streams or risky refactors without disturbing the active working directory:
|
|
47
|
+
|
|
48
|
+
1. **Verify Ignore Rule:** Confirm `.worktrees/` is listed in `.gitignore` before creating local worktrees (or place worktrees in a sibling temp directory outside the repo).
|
|
49
|
+
2. **Create Isolated Worktree:**
|
|
50
|
+
```bash
|
|
51
|
+
ascx git worktree add -b feat/<short-name> .worktrees/<short-name>
|
|
52
|
+
```
|
|
53
|
+
3. **Baseline Check:** Run the existing test suite inside the new worktree before writing changes to confirm a clean starting baseline.
|
|
54
|
+
4. **Clean Teardown:** After changes are verified and merged (with user confirmation), remove the worktree via `ascx git worktree remove .worktrees/<short-name>`.
|
|
55
|
+
|
|
@@ -53,7 +53,7 @@ All dynamic injection tests must use non-destructive canary strings. Never injec
|
|
|
53
53
|
|
|
54
54
|
---
|
|
55
55
|
|
|
56
|
-
## 3.
|
|
56
|
+
## 3. Crash Detection & Error Triage
|
|
57
57
|
|
|
58
58
|
When fuzzing an endpoint, every server response is categorized against three automated oracles:
|
|
59
59
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: asc-test
|
|
3
3
|
description: >
|
|
4
|
-
Trigger this skill when the user is:
|
|
4
|
+
Trigger this skill when the user is: debugging errors or crashes, investigating bugs, writing unit/integration/E2E tests, UAT checklists, or fixing flaky tests. Also trigger when the user says: "write a test", "TDD", "fix this bug", "why is this failing", "error 500", "flaky test", "E2E test", "playwright", "UAT", "regression test", "bikin tes", "benerin bug", "kok error", "kenapa gagal", "tes gagal terus". Also trigger on files matching: `*.test.*`, `*.spec.*`, `tests/*`, `__tests__/*`, or `e2e/*`.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Testing, TDD, Verification & UAT Router
|
|
@@ -10,9 +10,9 @@ Staff-grade testing playbook and verification gates. Enforces test-first discipl
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## 1.
|
|
13
|
+
## 1. Test-Driven Development Protocol
|
|
14
14
|
|
|
15
|
-
> **
|
|
15
|
+
> **CORE PROTOCOL:** No production code shall be written without a failing test first.
|
|
16
16
|
|
|
17
17
|
Every feature, bugfix, or refactor must follow the Red-Green-Refactor sequence:
|
|
18
18
|
1. **RED:** Write a minimal failing test. Execute it and confirm it fails for the expected reason.
|
|
@@ -31,6 +31,7 @@ Every feature, bugfix, or refactor must follow the Red-Green-Refactor sequence:
|
|
|
31
31
|
|
|
32
32
|
Before writing tests, running suites, or claiming verification:
|
|
33
33
|
1. **Mandatory Ingestion (BLOCKING GATE):** Call `read_file` on the tier reference matching your testing requirement BEFORE taking action:
|
|
34
|
+
- Debugging runtime errors, 500 crashes, or unknown failures ➔ `references/systematic-debugging.md`
|
|
34
35
|
- Writing unit tests / TDD cycle ➔ `references/tdd-cycle.md`
|
|
35
36
|
- Behavior testing, boundary isolation, mocks/fakes ➔ `references/test-design.md`
|
|
36
37
|
- Generative property invariants & fuzzing ➔ `references/property-testing.md`
|
|
@@ -105,6 +106,7 @@ Select the lowest testing tier that validates the requirement:
|
|
|
105
106
|
|
|
106
107
|
| Testing Domain / Trigger | Mandatory Reference Path |
|
|
107
108
|
|---|---|
|
|
109
|
+
| 4-phase root-cause investigation & circuit breaker | `references/systematic-debugging.md` |
|
|
108
110
|
| Red-Green-Refactor mechanics & whole-suite checks | `references/tdd-cycle.md` |
|
|
109
111
|
| Behavior testing, boundary isolation & mocking | `references/test-design.md` |
|
|
110
112
|
| Generative property invariants & boundary fuzzing | `references/property-testing.md` |
|
|
@@ -36,7 +36,7 @@ Never fix a bug by immediately editing production code. Follow this deterministi
|
|
|
36
36
|
- Edit production code to eliminate the bug.
|
|
37
37
|
- Run the reproduction test fresh: it must pass with exit code 0.
|
|
38
38
|
|
|
39
|
-
### Step 3:
|
|
39
|
+
### Step 3: Regression Verification (Revert & Confirm)
|
|
40
40
|
To prove that the test actually guards against the bug:
|
|
41
41
|
1. Temporarily comment out or revert the fix in production code.
|
|
42
42
|
2. Run the test fresh: **The test must fail.**
|
|
@@ -45,7 +45,7 @@ To prove that the test actually guards against the bug:
|
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
48
|
-
## 2. Claim Verification
|
|
48
|
+
## 2. Claim Verification Standards
|
|
49
49
|
|
|
50
50
|
Every claim regarding test results or bug fixes requires concrete execution evidence:
|
|
51
51
|
|
package/.agents/plugins/agentic-senior-core/skills/asc-test/references/systematic-debugging.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Systematic Root-Cause Debugging
|
|
2
|
+
|
|
3
|
+
> **Core Invariant:** Zero production code edits before root-cause investigation is complete. Patching symptoms without proving the failure mechanism creates cascading regressions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. The Four Mandatory Debugging Phases
|
|
8
|
+
|
|
9
|
+
Complete each phase in strict order for every bug report, runtime crash, 500 error, build break, or failing test:
|
|
10
|
+
|
|
11
|
+
### Phase 1: Root-Cause Investigation (Read-Only)
|
|
12
|
+
Before modifying any file in `src/` or `app/`:
|
|
13
|
+
1. **Read Raw Failure Evidence:** Capture the exact error message, HTTP status, stack trace line numbers, and exit code without skimming.
|
|
14
|
+
2. **Trace Data Flow Backward:** Follow the failing variable or state from the crash site back to its trust boundary (request payload, DB query result, environment variable, async race window). Identify *where* invalid state originated, not merely where it threw.
|
|
15
|
+
3. **Check Recent Deltas:** Inspect recent modifications (`ascx git status`, `ascx git diff`, `ascx git log -n 5`) touching the module, config, or dependencies.
|
|
16
|
+
4. **Compare Working Analog:** Locate a working endpoint or handler in the same codebase and compare middleware order, types, and null/error guards.
|
|
17
|
+
|
|
18
|
+
### Phase 2: Falsifiable Hypothesis & Deterministic Reproduction
|
|
19
|
+
1. **State One Explicit Hypothesis:** *"Function `X` fails with `Y` when input `Z` occurs because condition `W` is unchecked at line `N`."*
|
|
20
|
+
2. **Write the Reproduction Test First:** Follow `references/regression-proof.md` to create an automated unit, integration, or CLI reproduction test targeting that exact input.
|
|
21
|
+
3. **Confirm Expected Failure (`RED`):** Execute the test fresh (`ascx npm test -- ...`, `ascx pytest ...`). It **must fail** with the exact symptom under investigation. If it passes, your hypothesis is incomplete—return to Phase 1.
|
|
22
|
+
|
|
23
|
+
### Phase 3: Minimal Root-Cause Fix
|
|
24
|
+
1. **Single-Cause Change:** Fix the root cause at its origin boundary (for example, normalize/validate at input entry rather than sprinkling defensive `?.` checks downstream).
|
|
25
|
+
2. **Zero Bundled Refactoring:** Do not mix style cleanups, renames, or unrelated feature changes into a bugfix diff.
|
|
26
|
+
3. **Two-Failure Circuit Breaker:** If two consecutive code edits fail to turn the reproduction test green, **STOP editing**. Revert the speculative edits, re-examine architectural assumptions from Phase 1, and report the exact blocker if an external constraint is involved.
|
|
27
|
+
|
|
28
|
+
### Phase 4: Regression & Whole-Suite Proof
|
|
29
|
+
1. Execute the reproduction test fresh and confirm `exit 0` (`GREEN`).
|
|
30
|
+
2. Perform the revert check in `references/regression-proof.md` when fixing subtle logic guards.
|
|
31
|
+
3. Run the complete test suite fresh (`ascx npm test` or project runner) to prove zero collateral regressions before claiming the bug is resolved.
|
|
32
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Test-Driven Development (TDD) Cycle
|
|
2
2
|
|
|
3
|
-
TDD is an architectural discipline for writing deterministic, verifiable software. The
|
|
3
|
+
TDD is an architectural discipline for writing deterministic, verifiable software. The core principle governs all development:
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **Core Principle:** No production code shall be written without a failing test first.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -42,7 +42,7 @@ Verification records, testing matrices, and UAT notes belong in the agent conver
|
|
|
42
42
|
|
|
43
43
|
---
|
|
44
44
|
|
|
45
|
-
## 4.
|
|
45
|
+
## 4. Boundary & Edge Case Categories
|
|
46
46
|
|
|
47
47
|
Never sign off on acceptance testing by verifying only the primary happy path. Every scenario must be verified against four operational vectors:
|
|
48
48
|
|
|
@@ -4,114 +4,68 @@ description: >
|
|
|
4
4
|
Trigger this skill when working on: UI components, UX design, layouts, microcopy, typography, design systems, modals, forms, tables, dashboards, empty states, or error UI. Also trigger when the user says: "design this page", "clean up UI", "write UI copy", "fix UI slop", "make it look professional", "too verbose", "improve the design", "broken on mobile", "bikin UI", "rapikan tampilan", "tulisan UI berlebihan", "tampilan di hp rusak", "terlalu kaku", "jangan kayak AI". Also trigger when creating or editing files matching: `*.tsx`, `*.jsx`, `*.vue`, `*.svelte`, `*.html`, `*.blade.php`, `*.css`, or UI component files.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Deterministic Frontend & UI Engineering Router (`asc-ui`)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Enforces structural semantics, token reuse, state completeness, accessibility, and anti-card-soup invariants across frontend codebases. Pure visual art direction belongs to design tools (Figma MCP, Stitch) or pre-built component kits (Shadcn/Radix blocks); this skill governs verifiable UI engineering.
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## 1. The Quality Floor (Non-Negotiable
|
|
14
|
-
|
|
15
|
-
Every UI edit must satisfy these 15 rules without exception:
|
|
16
|
-
|
|
17
|
-
1. **Token discipline:** All colors, spacing, and typography must resolve through declared design tokens or CSS variables. Zero raw hex codes (`#6366f1`) or arbitrary inline pixel values.
|
|
18
|
-
2. **Animation safety:** Never use `transition: all`. Never animate layout dimensions (`width`, `height`, `top`, `left`). Animate only GPU properties (`transform`, `opacity`).
|
|
19
|
-
3. **Reduced motion:** Every CSS animation or transition must respect `@media (prefers-reduced-motion: reduce)`.
|
|
20
|
-
4. **Focus visibility:** Never strip focus indicators (`outline-none`) without an immediate high-contrast `:focus-visible` replacement.
|
|
21
|
-
5. **No hallucinated material:** Never invent metrics, testimonials, customer quotes, or fake partner logos.
|
|
22
|
-
6. **No eyebrows or kicker tags:** Headings carry their own weight. Never place `text-[11px] uppercase tracking-wider` micro-labels above titles.
|
|
23
|
-
7. **No AI cliché gradients:** Never use purple-to-blue/indigo gradients or text clipping (`bg-clip-text text-transparent`).
|
|
24
|
-
8. **No card-in-card nesting:** Never nest rounded bordered cards inside other rounded cards.
|
|
25
|
-
9. **Single elevation declaration:** Choose either a 1px border OR an elevation shadow, never both (ban the ghost card).
|
|
26
|
-
10. **Mobile viewport unit:** Use `min-h-dvh` or `100dvh` for full-height containers, never `100vh` or `h-screen`.
|
|
27
|
-
11. **Mobile containment:** Set `overflow-x: clip` on root shells. Never leak horizontal scrolling.
|
|
28
|
-
12. **Touch targets:** Minimum 44×44px hit target with $\ge$ 8px clearance for all interactive touch controls.
|
|
29
|
-
13. **Contrast floor:** Meet WCAG 2.2 AA (4.5:1 normal text, 3:1 large text and UI component boundaries).
|
|
30
|
-
14. **Single-language purity:** Never mix languages on one surface; ban hybrid neologisms (`di-submit`, `meng-generate`).
|
|
31
|
-
15. **Icon semantics:** Never use raw unicode or emojis as icons. Use dedicated SVG icons; mark decorative icons `aria-hidden="true"`.
|
|
32
|
-
16. **Substance over restraint:** Stripping slop is only half the job. Replace removed ornaments with real substance: strong typographic scale contrast, full-field color anchors, and authentic interface fragments. Never leave an empty, sterile wireframe void.
|
|
33
|
-
17. **Product over skill (No geek cosplay):** The real-world domain dictates aesthetics. Never inject terminal windows, ASCII art, or pseudo-telemetry consoles into civic, educational, or commercial products (`references/modes/genre-calibration.md`).
|
|
34
|
-
18. **The Purpose-Gate:** Every component, widget, or scorecard must enable an actual user task. Never invent unearned widgets, sliders, or simulated feeds without real business data.
|
|
35
|
-
19. **Anti-card-soup invariant:** Never wrap structural layout sections (header, nav, rails, tables) into floating rounded card islands. Use a Unified Spatial Canvas with hairline dividers (`divide-y`, `border-r`). Cards are strictly for discrete, interchangeable items (`references/divergence.md`).
|
|
13
|
+
## 1. The Quality Floor (Non-Negotiable Invariants)
|
|
36
14
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
`<skill_directory>/references/<category>/<file>.md`
|
|
46
|
-
Identify the path of this `SKILL.md` file (provided by host/tooling) and resolve all reference paths relative to it.
|
|
47
|
-
|
|
48
|
-
2. **Step 1 — Two-Phase Enforcement Gate (MANDATORY GATE):**
|
|
49
|
-
- **Phase A (Structure & Hierarchy First):** Lock project domain genre (Civic, Enterprise, SaaS, DevTools) and read `references/modes/genre-calibration.md` + target mode reference (`references/modes/<mode>.md`). Lock the primary focal anchor and spatial posture before writing code.
|
|
50
|
-
- **Phase B (Visual System & Themes):** Read `references/craft/themes-catalog.md` and lock one of the 16 curated themes across 8 real-world domains (e.g., Sovereign Slate, Almanac Index, Editorial Ledger, Pharmacy Calm, Ink & Signal, Graphite Instrument) to prevent probabilistic palette slop.
|
|
51
|
-
*Do NOT proceed until you have read the genre, mode, and theme references into context.*
|
|
52
|
-
|
|
53
|
-
3. **Step 2 — Secondary Craft Ingestion:**
|
|
54
|
-
Execute `read_file` on at least one relevant craft reference for your task from Section 5 (e.g. `references/craft/typography.md`, `references/craft/color-surfaces.md`, or `references/divergence.md`).
|
|
55
|
-
|
|
56
|
-
4. **Step 3 — Workspace Material Inventory:**
|
|
57
|
-
Only AFTER loading the mode reference, inspect the workspace:
|
|
58
|
-
- **Design Tokens:** Read project CSS variables, Tailwind configuration, or existing components in `components/` or `ui/`. If `DESIGN.md` exists, read it (read-only). Never create or edit persistent checkpoint files.
|
|
59
|
-
- **Take Material Inventory:**
|
|
60
|
-
- **Real:** Concrete numbers, existing endpoints, actual data attributes.
|
|
61
|
-
- **Pictures:** Actual screenshots and product visual assets.
|
|
62
|
-
- **Absent:** Missing quotes, missing logos, or unverified metrics—these are omitted entirely.
|
|
15
|
+
1. **Token & primitive reuse:** Resolve all colors, radii, and spacing through project CSS variables/tokens and existing `components/ui/` primitives. Zero raw hex codes (`#6366f1`) and zero mixed neutral families (never mix `slate` with `stone`).
|
|
16
|
+
2. **Anti-card-soup rule:** Never stack two or more multi-column card grids consecutively on a page, and never render sequential steps (`01`, `02`, `03`), rubrics, or people directories as bordered cards.
|
|
17
|
+
3. **No card-in-card or ghost elevation:** Never nest a bordered rounded card inside another card. Choose either `border` OR `shadow-sm`, never both.
|
|
18
|
+
4. **GPU-only motion & reduced motion:** Never use `transition-all` or animate layout geometry (`width`, `height`, `top`, `left`). Respect `@media (prefers-reduced-motion: reduce)`.
|
|
19
|
+
5. **Focus & WCAG 2.2 AA contrast:** Maintain $\ge$ 4.5:1 text contrast (3:1 large text/controls). Never apply `outline-none` without an immediate `:focus-visible` ring replacement.
|
|
20
|
+
6. **Mobile containment & touch targets:** Use `min-h-dvh` (never `100vh`/`h-screen`), `overflow-x: clip` on root shells, and minimum **44x44px** hit targets on touch controls.
|
|
21
|
+
7. **Zero hallucinated proof or ornaments:** Never invent testimonials, partner logos, unbacked KPIs, small-caps eyebrow kickers above headings, purple-to-blue gradients, or terminal cosplay in non-developer apps.
|
|
22
|
+
8. **Single-language microcopy:** Keep every visible string on a surface in one language with natural domain terms—zero mixed-language neologisms and zero literal translation calques.
|
|
63
23
|
|
|
64
24
|
---
|
|
65
25
|
|
|
66
|
-
##
|
|
26
|
+
## 2. Pre-Flight & Reuse Gate (BLOCKING)
|
|
67
27
|
|
|
68
|
-
|
|
28
|
+
Before writing or refactoring any UI file (`*.tsx`, `*.jsx`, `*.vue`, `*.svelte`, `*.html`, `*.blade.php`, `*.css`):
|
|
69
29
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
- **
|
|
73
|
-
-
|
|
30
|
+
1. **Audit Workspace Primitives:** Inspect `components/ui/`, shared layouts, `app.css`/`globals.css`, and Tailwind config. Reuse existing tables, dialogs, buttons, and form primitives rather than inventing ad-hoc markup.
|
|
31
|
+
2. **Load Mandatory Reference Branch (1-Hop):**
|
|
32
|
+
- Building a new page, dashboard, or multi-section layout $\rightarrow$ **MUST** `read_file` `references/data-to-structure.md` before writing markup.
|
|
33
|
+
- Implementing async data views, forms, modals, or interactive controls $\rightarrow$ **MUST** `read_file` `references/states-and-a11y.md`.
|
|
34
|
+
- Adjusting responsive behavior, CSS tokens, or localized UI copy $\rightarrow$ **MUST** `read_file` `references/responsive-and-copy.md`.
|
|
74
35
|
|
|
75
36
|
---
|
|
76
37
|
|
|
77
|
-
##
|
|
38
|
+
## 3. Data-to-Structure Mapping
|
|
78
39
|
|
|
79
|
-
Never
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
40
|
+
Never default to `Card` grids as a generic layout wrapper. Select containers strictly by data shape:
|
|
41
|
+
|
|
42
|
+
| Data Shape | Required Semantic Structure |
|
|
43
|
+
| :--- | :--- |
|
|
44
|
+
| Sequential workflow (`Step 1 -> 4`) | Connected `<ol>` stepper or timeline |
|
|
45
|
+
| Criteria, weights, pricing, logs, records | `<table/>` with `sticky top-0` header & `tabular-nums` |
|
|
46
|
+
| Team members, rosters, activity streams | Compact `divide-y divide-border` rows |
|
|
47
|
+
| 3–5 summary counts / KPIs | Flat `<dl>` stat strip with hairline dividers |
|
|
48
|
+
| Independent catalog items / isolated auth form | Single-level `Card` container |
|
|
83
49
|
|
|
84
50
|
---
|
|
85
51
|
|
|
86
|
-
##
|
|
52
|
+
## 4. On-Demand Engineering References
|
|
87
53
|
|
|
88
54
|
> [!IMPORTANT]
|
|
89
|
-
>
|
|
90
|
-
|
|
91
|
-
|
|
|
92
|
-
|
|
93
|
-
|
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
| Typography, line-height & tabular numbers | `references/craft/typography.md` |
|
|
97
|
-
| Color tokens, 60-30-10 & elevation | `references/craft/color-surfaces.md` |
|
|
98
|
-
| Micro-interactions & GPU motion | `references/craft/motion.md` |
|
|
99
|
-
| Native surfaces (selection, caret, scrollbars) | `references/craft/browser-surfaces.md` |
|
|
100
|
-
| 50% reduction, active verbs & i18n | `references/copy-i18n.md` |
|
|
101
|
-
| Responsive reflow, dvh & touch targets | `references/mobile-responsive.md` |
|
|
102
|
-
| WCAG 2.2 AA contrast & keyboard operability | `references/accessibility.md` |
|
|
103
|
-
| The Data State Quad & mutation feedback | `references/states-feedback.md` |
|
|
104
|
-
| Anti-convergence, 4 Waves of Tells & Mirror Test | `references/divergence.md` |
|
|
105
|
-
| Structured UI audit matrix | `references/redesign-audit.md` |
|
|
55
|
+
> Paths below are relative to this `SKILL.md` directory (`.../skills/asc-ui/`). Prepend this skill's folder path when calling `read_file`.
|
|
56
|
+
|
|
57
|
+
| Engineering Concern | Reference Path |
|
|
58
|
+
| :--- | :--- |
|
|
59
|
+
| Anti-card-soup structural templates (`<ol>`, `<table>`, `divide-y`, `<dl>`) | `references/data-to-structure.md` |
|
|
60
|
+
| 4-state data contract, pending mutation lock & WCAG 2.2 AA focus/contrast | `references/states-and-a11y.md` |
|
|
61
|
+
| Brownfield token reuse, `100dvh` mobile reflow, GPU transitions & microcopy | `references/responsive-and-copy.md` |
|
|
106
62
|
|
|
107
63
|
---
|
|
108
64
|
|
|
109
|
-
##
|
|
65
|
+
## 5. Verification & Handoff Sweep
|
|
110
66
|
|
|
111
|
-
Before
|
|
112
|
-
1. **
|
|
113
|
-
2. **
|
|
114
|
-
3. **
|
|
115
|
-
4. **
|
|
116
|
-
5. **Contrast & Focus:** Verify keyboard tab flow and high-contrast `:focus-visible` styling.
|
|
117
|
-
6. **Lint Check:** Verify changes against `hooks/lib/known-ui-slop-patterns.json`.
|
|
67
|
+
Before declaring any UI task complete:
|
|
68
|
+
1. **Structural Rhythm Check:** Confirm the page does not stack consecutive card grids and uses `<table>`, `<ol>`, or `divide-y` lists where required.
|
|
69
|
+
2. **State & Mutation Check:** Verify loading skeleton, empty state, error state with retry, and `disabled` pending state on submit buttons.
|
|
70
|
+
3. **Mobile & Overflow Check:** Confirm `min-h-dvh`, wrapped horizontal tables (`overflow-x-auto`), and no fixed-pixel button widths (`w-[120px]`) that clip +30% text expansion.
|
|
71
|
+
4. **Rendered Preview (`asc preview`):** When a local server or static HTML target is available, run `asc preview <url|file> [--mobile]` to inspect rendered layout balance before handoff.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Deterministic Data-to-Structure Mapping (Anti-Card-Soup)
|
|
2
|
+
|
|
3
|
+
Code-generation models default to wrapping every dataset in an identical bordered card grid (`grid` + `rounded-xl` + `border` + `p-6`). Repeating card grids across three or more sections produces visually monotonous "Card Soup". Map every dataset deterministically to its semantic HTML structure instead.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Mandatory Structural Mapping Matrix
|
|
8
|
+
|
|
9
|
+
| Data Shape | Forbidden Pattern (Card Soup) | Required Semantic Container |
|
|
10
|
+
| :--- | :--- | :--- |
|
|
11
|
+
| **Sequential Steps / Workflow (`1 -> 2 -> 3`)** | 3–4 bordered cards with `01`, `02`, `03` badges | Connected `<ol>` stepper with horizontal/vertical connector lines |
|
|
12
|
+
| **Criteria, Rubrics, Pricing Tiers, Logs, Metrics** | Multi-row card grid with repeated labels/badges | Semantic `<table>` with `sticky top-0` header and `tabular-nums` |
|
|
13
|
+
| **People, Committees, Directories, Activity Feeds** | Profile cards with placeholder avatar circles | Compact `divide-y divide-border` roster list (single-line or two-column rows) |
|
|
14
|
+
| **Summary KPIs / Key Counts (3–5 numbers)** | Individual shadowed boxes per number | Flat typographic strip separated by hairline borders (`sm:divide-x divide-border`) |
|
|
15
|
+
| **FAQs / Reference Details** | Nested bordered boxes inside bordered panels | Native `<details>` / `<summary>` or unboxed `divide-y` accordion |
|
|
16
|
+
| **Independent Catalog Items / Single Isolated Form** | Card-inside-card nesting | Single-level `Card` (`border border-border` OR `shadow-sm`, never both) |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 2. Structural Reference Templates
|
|
21
|
+
|
|
22
|
+
### 2.1 Sequential Process -> Connected Stepper (`<ol>`)
|
|
23
|
+
```html
|
|
24
|
+
<ol class="grid grid-cols-1 gap-6 border-t border-border pt-6 md:grid-cols-4">
|
|
25
|
+
<li class="space-y-1.5">
|
|
26
|
+
<span class="text-xs font-mono font-semibold text-muted-foreground">Step 1</span>
|
|
27
|
+
<h3 class="text-sm font-semibold text-foreground">Authenticate Account</h3>
|
|
28
|
+
<p class="text-sm text-muted-foreground">Sign in with your assigned unit credentials.</p>
|
|
29
|
+
</li>
|
|
30
|
+
<li class="space-y-1.5">
|
|
31
|
+
<span class="text-xs font-mono font-semibold text-muted-foreground">Step 2</span>
|
|
32
|
+
<h3 class="text-sm font-semibold text-foreground">Submit Assessment</h3>
|
|
33
|
+
<p class="text-sm text-muted-foreground">Complete indicator scores per evaluation category.</p>
|
|
34
|
+
</li>
|
|
35
|
+
</ol>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 2.2 Weighted Criteria / Structured Records -> Matrix `<table>`
|
|
39
|
+
```html
|
|
40
|
+
<div class="overflow-x-auto border-y border-border">
|
|
41
|
+
<table class="w-full text-left text-sm">
|
|
42
|
+
<thead class="sticky top-0 bg-background border-b border-border text-xs font-medium text-muted-foreground">
|
|
43
|
+
<tr>
|
|
44
|
+
<th scope="col" class="py-3 pr-4">Category</th>
|
|
45
|
+
<th scope="col" class="py-3 px-4">Required Evidence</th>
|
|
46
|
+
<th scope="col" class="py-3 px-4 text-right">Weight</th>
|
|
47
|
+
<th scope="col" class="py-3 pl-4 text-right">Action</th>
|
|
48
|
+
</tr>
|
|
49
|
+
</thead>
|
|
50
|
+
<tbody class="divide-y divide-border">
|
|
51
|
+
<tr class="hover:bg-muted/40 transition-colors">
|
|
52
|
+
<td class="py-3 pr-4 font-medium text-foreground">Governance & Records</td>
|
|
53
|
+
<td class="py-3 px-4 text-muted-foreground">Decree PDF, annual roster</td>
|
|
54
|
+
<td class="py-3 px-4 text-right font-mono tabular-nums">20%</td>
|
|
55
|
+
<td class="py-3 pl-4 text-right"><a href="#details" class="font-medium text-primary hover:underline">Inspect</a></td>
|
|
56
|
+
</tr>
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>
|
|
59
|
+
</div>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2.3 Team / Roster Directory -> Compact `divide-y` List
|
|
63
|
+
```html
|
|
64
|
+
<ul class="divide-y divide-border border-y border-border">
|
|
65
|
+
<li class="flex flex-col gap-1 py-3.5 sm:flex-row sm:items-baseline sm:justify-between">
|
|
66
|
+
<div>
|
|
67
|
+
<span class="font-medium text-foreground">Dr. Budi Santoso</span>
|
|
68
|
+
<span class="ml-2 text-sm text-muted-foreground">Lead Auditor — Administrative Verification</span>
|
|
69
|
+
</div>
|
|
70
|
+
<span class="text-xs font-mono text-muted-foreground">District I–II</span>
|
|
71
|
+
</li>
|
|
72
|
+
</ul>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 2.4 Summary Figures -> Flat Stat Strip
|
|
76
|
+
```html
|
|
77
|
+
<dl class="grid grid-cols-2 gap-6 border-y border-border py-6 sm:grid-cols-4 sm:gap-0 sm:divide-x sm:divide-border">
|
|
78
|
+
<div class="sm:px-6 first:sm:pl-0">
|
|
79
|
+
<dt class="text-xs text-muted-foreground">Registered Units</dt>
|
|
80
|
+
<dd class="mt-1 text-2xl font-semibold tracking-tight font-mono tabular-nums text-foreground">40</dd>
|
|
81
|
+
</div>
|
|
82
|
+
<div class="sm:px-6">
|
|
83
|
+
<dt class="text-xs text-muted-foreground">Evaluation Domains</dt>
|
|
84
|
+
<dd class="mt-1 text-2xl font-semibold tracking-tight font-mono tabular-nums text-foreground">5</dd>
|
|
85
|
+
</div>
|
|
86
|
+
</dl>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## 3. Page Rhythm Rules
|
|
92
|
+
|
|
93
|
+
1. **Maximum One Card Grid Per View:** A single page must never stack two or more multi-column card grids consecutively. Alternate dense sections (`<table>`, `divide-y` list, `<dl>` stat strip, split 2-column prose/form).
|
|
94
|
+
2. **No Placeholder Avatars or Fake Chrome:** Omit empty gray silhouette circles when real user photos do not exist. Omit fake macOS traffic-light window dots (`red/yellow/green`) outside developer CLI documentation.
|
|
95
|
+
3. **Single Elevation Per Surface:** Use either `border border-border` OR `shadow-sm` on an isolated container—never combine heavy borders with drop shadows, and never nest a bordered card inside another bordered card.
|
|
96
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Token Reuse, Responsive Containment & Microcopy Hygiene
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
## 1. Brownfield Token & Component Reuse
|
|
6
|
+
|
|
7
|
+
1. **Inspect Existing Primitives First:** Before creating any markup or CSS, inspect `components/ui/`, `components/`, `app.css` / `globals.css`, and `tailwind.config.*`.
|
|
8
|
+
2. **Never Override Workspace Tokens:** When a repository already defines brand variables (`--primary`, `--background`, `--border`, `--radius`) or installed component primitives (Radix, Shadcn, Headless UI, Blade components), compose directly from them. Never introduce raw hex values (`#6366f1`) or competing neutral gray scales (do not mix `slate` with `stone` or `zinc` on the same surface).
|
|
9
|
+
3. **External Design Sources:** When Figma frames, design specs, or pre-built component blocks exist, translate those exact token and spacing contracts rather than inventing decorative CSS from scratch.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 2. Responsive Layout & GPU Motion
|
|
14
|
+
|
|
15
|
+
1. **Dynamic Viewport Height:** Use `min-h-dvh` (`100dvh`) for full-height shells—never `h-screen` or `100vh`, which clip behind mobile browser toolbars.
|
|
16
|
+
2. **Horizontal Overflow Containment:** Apply `overflow-x: clip` on the root layout shell. Wrap wide data tables in `<div class="overflow-x-auto">` so tables scroll internally without breaking mobile page width.
|
|
17
|
+
3. **Touch Hit Targets:** Interactive controls on mobile/touch viewports must provide at least a **44x44px** hit area (`min-h-11 min-w-11` or equivalent padding) with $\ge$ 8px gap between adjacent actions.
|
|
18
|
+
4. **Expansion Buffer (+30% Text Length):** Never hardcode fixed pixel widths on text buttons (`w-[120px]`). Use `px-4 py-2` with `min-w-*` so localized strings (such as Indonesian or German) expand without clipping.
|
|
19
|
+
5. **GPU-Only Transitions:** Never use `transition-all`. Specify exact properties (`transition-colors`, `transition-opacity`, `transition-transform`) and never animate layout geometry (`width`, `height`, `top`, `left`, `margin`).
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 3. Microcopy & Single-Language Purity
|
|
24
|
+
|
|
25
|
+
1. **50% Word Reduction:** Cut ornamental filler. Write direct operational labels:
|
|
26
|
+
- Button labels use `Verb + Object`: `Save Changes`, `Export CSV`, `Revoke Key` (avoid vague `Submit` or `Click Here`).
|
|
27
|
+
- Omit small-caps kicker tags (`text-[11px] uppercase tracking-wider`) above headings; let headings stand on their own.
|
|
28
|
+
2. **Strict Single-Language Surface:** Keep every visible string on a page—headings, table headers, placeholders, empty states, validation messages, and buttons—in one language.
|
|
29
|
+
- Never mix English and Indonesian (`meng-generate`, `di-submit`).
|
|
30
|
+
- In Indonesian interfaces, use natural idiomatic terms established in the codebase (*panel samping*, *garis pemisah*, *jendela dialog*, *unggah berkas*) rather than awkward literal calques (*laci sembul*, *garis rambut*, *jendela sembul*).
|
|
31
|
+
3. **Zero Fabricated Content:** Never invent customer quotes, partner company names, fake user counts (`10,000+ teams`), or unbacked telemetry metrics. Omit absent marketing proof entirely.
|
|
32
|
+
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Data States, Mutation Feedback & Accessibility Floor
|
|
2
|
+
|
|
3
|
+
Every interactive interface must enforce deterministic state coverage and WCAG 2.2 AA accessibility invariants before handoff.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. The 4-State Data Contract
|
|
8
|
+
|
|
9
|
+
Every asynchronous view, table, or list must explicitly handle all four states:
|
|
10
|
+
|
|
11
|
+
1. **Loading State:** Render layout-preserving skeletons matching actual row/column heights (`animate-pulse bg-muted`). Avoid full-screen blocking spinners on incremental refetches.
|
|
12
|
+
2. **Empty State:** State factually what is absent and provide one direct primary action when applicable (for example: *"No API keys created." -> `[Create API Key]`). Never write poetic or motivational empty-state essays.
|
|
13
|
+
3. **Error State:** Display a safe, specific failure reason (`role="alert"`) paired with an immediate `[Retry]` button that re-triggers the failed query without losing form inputs.
|
|
14
|
+
4. **Populated State:** Handle text overflow (`truncate` or `line-clamp-2` with accessible full value), missing optional fields (`—`), and pagination/virtualization when rows exceed 100 items.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2. Mutation & Form Safety
|
|
19
|
+
|
|
20
|
+
1. **Immediate Pending Lock:** Disable submit/destructive buttons (`disabled={isPending}` + `aria-busy="true"`) on click to prevent duplicate submissions.
|
|
21
|
+
2. **Preserve User Input on Failure:** Never clear form fields when a server request fails. Surface field-level validation errors adjacent to each input via `aria-describedby` and `aria-invalid="true"`.
|
|
22
|
+
3. **Explicit Outcome Notification:** Confirm non-obvious background mutations via a concise status banner or toast; never swallow caught errors silently.
|
|
23
|
+
4. **Destructive Confirmations Only:** Reserve modal dialogs strictly for irreversible destructive actions (delete, revoke) or isolated multi-step imports. Use inline forms or drawers for routine edits.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 3. WCAG 2.2 AA & Keyboard Operability
|
|
28
|
+
|
|
29
|
+
1. **Contrast Ratios:**
|
|
30
|
+
- Normal text (`< 18pt` / `< 14pt bold`): minimum **4.5:1** against its background.
|
|
31
|
+
- Large text, icons, and input boundaries: minimum **3:1**.
|
|
32
|
+
2. **Visible Focus Ring:** Never apply `outline-none` or `focus:outline-none` without pairing `focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`.
|
|
33
|
+
3. **Semantic Landmarks & Controls:**
|
|
34
|
+
- Use `<button type="button">` for actions and `<a href="...">` for navigation. Never attach `onClick` to non-interactive `<div>` or `<span>`.
|
|
35
|
+
- Pair every `<input>`, `<select>`, and `<textarea>` with an explicit `<label htmlFor="...">` or `aria-label`.
|
|
36
|
+
- Icon-only buttons require `aria-label` describing the action (`aria-label="Close panel"`), with inner SVG marked `aria-hidden="true"`.
|
|
37
|
+
4. **Reduced Motion:** Wrap non-essential CSS transitions and keyframe animations in `@media (prefers-reduced-motion: reduce)` fallbacks (`transition: none; animation: none;`).
|
|
38
|
+
|
package/gemini-extension.json
CHANGED
|
@@ -150,31 +150,36 @@ export function findBrowserExecutable() {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
export async function runPreviewCommand(args = []) {
|
|
153
|
-
const
|
|
153
|
+
const target = args.find(a => !a.startsWith('-'));
|
|
154
154
|
const shouldOpen = args.includes('--open');
|
|
155
|
-
const
|
|
156
|
-
const
|
|
155
|
+
const isMobile = args.includes('--mobile');
|
|
156
|
+
const width = isMobile ? 390 : (args.includes('--desktop') ? 1440 : 1280);
|
|
157
|
+
const height = isMobile ? 844 : (args.includes('--desktop') ? 900 : 800);
|
|
157
158
|
|
|
158
|
-
if (!
|
|
159
|
-
console.error('Usage: asc preview <html-file> [--open]');
|
|
159
|
+
if (!target) {
|
|
160
|
+
console.error('Usage: asc preview <html-file-or-url> [--open] [--mobile] [--desktop]');
|
|
160
161
|
process.exit(1);
|
|
161
162
|
}
|
|
162
163
|
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
process.
|
|
164
|
+
const isHttpUrl = /^https?:\/\//i.test(target);
|
|
165
|
+
let resolvedTarget = target;
|
|
166
|
+
if (!isHttpUrl) {
|
|
167
|
+
resolvedTarget = path.resolve(process.cwd(), target);
|
|
168
|
+
if (!fs.existsSync(resolvedTarget)) {
|
|
169
|
+
console.error(`File not found: ${resolvedTarget}`);
|
|
170
|
+
process.exit(1);
|
|
171
|
+
}
|
|
167
172
|
}
|
|
168
173
|
|
|
169
174
|
// Single fixed reusable slot in OS temp directory
|
|
170
175
|
const tempDir = os.tmpdir();
|
|
171
|
-
const outputPng = path.join(tempDir, 'asc-preview-active.png');
|
|
176
|
+
const outputPng = path.join(tempDir, isMobile ? 'asc-preview-mobile.png' : 'asc-preview-active.png');
|
|
172
177
|
|
|
173
178
|
// Open in default OS browser if requested
|
|
174
179
|
if (shouldOpen) {
|
|
175
180
|
try {
|
|
176
|
-
openInDefaultBrowser(
|
|
177
|
-
console.log(`[asc preview] Opened in default browser: ${
|
|
181
|
+
openInDefaultBrowser(resolvedTarget);
|
|
182
|
+
console.log(`[asc preview] Opened in default browser: ${resolvedTarget}`);
|
|
178
183
|
return;
|
|
179
184
|
} catch (err) {
|
|
180
185
|
console.error(`Failed to open default browser: ${err.message}`);
|
|
@@ -185,17 +190,17 @@ export async function runPreviewCommand(args = []) {
|
|
|
185
190
|
const browser = findBrowserExecutable();
|
|
186
191
|
if (!browser) {
|
|
187
192
|
console.warn('[asc preview] No supported headless browser detected (Brave, Edge, Chrome, Firefox). Falling back to OS opener.');
|
|
188
|
-
openInDefaultBrowser(
|
|
193
|
+
openInDefaultBrowser(resolvedTarget);
|
|
189
194
|
return;
|
|
190
195
|
}
|
|
191
196
|
|
|
192
197
|
try {
|
|
193
|
-
const
|
|
198
|
+
const targetUrl = isHttpUrl ? target : pathToFileURL(resolvedTarget).href;
|
|
194
199
|
let command;
|
|
195
200
|
if (browser.family === 'chromium') {
|
|
196
|
-
command = `"${browser.path}" --headless=new --disable-gpu --screenshot="${outputPng}" --window-size=${width},${height} "${
|
|
201
|
+
command = `"${browser.path}" --headless=new --disable-gpu --screenshot="${outputPng}" --window-size=${width},${height} "${targetUrl}"`;
|
|
197
202
|
} else if (browser.family === 'firefox') {
|
|
198
|
-
command = `"${browser.path}" -headless -screenshot "${outputPng}" -window-size ${width},${height} "${
|
|
203
|
+
command = `"${browser.path}" -headless -screenshot "${outputPng}" -window-size ${width},${height} "${targetUrl}"`;
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
execSync(command, { stdio: 'pipe', timeout: 15000 });
|
|
@@ -209,7 +214,7 @@ export async function runPreviewCommand(args = []) {
|
|
|
209
214
|
}
|
|
210
215
|
} catch (err) {
|
|
211
216
|
console.warn(`[asc preview] Headless snapshot failed: ${err.message}. Falling back to OS opener.`);
|
|
212
|
-
openInDefaultBrowser(
|
|
217
|
+
openInDefaultBrowser(resolvedTarget);
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
|
package/package.json
CHANGED