मुख्य सामग्री पर जाएँ
Skillpedia
सामान्य कोडिंग7.8k · #13083

typescript-compile-check-resilient-fallback

यह क्या करती है

यह स्किल बताती है कि सामान्य कमांड टूटने पर TypeScript कोड में एरर कैसे जाँचें। यह बैकअप रास्ता समझाती है और असली कोड एरर को सेटअप की समस्याओं से कैसे अलग करें, यह भी। यह TypeScript प्रोजेक्ट पर काम करने वाले डेवलपर्स के लिए है।

कब इस्तेमाल करें

  • ✓जब सामान्य TypeScript जाँच कमांड ऐसी एरर दे जो आपके कोड से जुड़ी न हो।
  • ✓जब आपको खत्म करने से पहले जानना है कि आपके बदलाव कम्पाइल होते हैं या नहीं।
  • ✓जब आप असली टाइप एरर को टूल या वातावरण की समस्याओं से अलग करना चाहते हैं।

Skill का लिंक

https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient-fallback/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/HKUDS/AgentPilot/blob/main/openspace/legacy/v1/showcase/skills/typescript-compile-check-resilient-fallback/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“क्या आप जाँच सकते हैं कि मेरे TypeScript बदलाव कम्पाइल होते हैं, भले ही सामान्य जाँच कमांड काम न कर रही हो?”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट पहले मानक जाँच चलाता है। अगर टूल खुद फेल होता है, तो वह बैकअप तरीका इस्तेमाल करता है और फिर असली कोड एरर को सेटअप की समस्याओं से छांटता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

TypeScript Compile-Check Resilient Fallback

Use this workflow whenever you need to verify that TypeScript files compile cleanly after creating or modifying them, especially in environments where npx or direct ./node_modules/.bin/tsc invocations may return unexpected errors.


Step 1 — Attempt Primary Invocation

Run the compile check with run_shell using the standard approach:

npx tsc --noEmit

or, if you already know the project root:

./node_modules/.bin/tsc --noEmit

Evaluate the result:

  • If it exits cleanly (exit code 0, no unexpected output) → done.
  • If it exits with TypeScript diagnostic errors → proceed to Step 3.
  • If it exits with an unknown / tool-level error (e.g., npx not found, permission denied, spawn error, unclear non-zero exit unrelated to TS diagnostics) → proceed to Step 2.

Step 2 — Fallback via shell_agent

When the primary invocation fails with an unknown error, delegate to shell_agent so it can resolve environment issues automatically:

Task: "From the project directory <PROJECT_DIR>, run node node_modules/typescript/bin/tsc --noEmit and report all TypeScript diagnostic errors."

Example shell_agent task string:

From /path/to/project, run:
  node node_modules/typescript/bin/tsc --noEmit
Capture the full stdout/stderr output and return it.

shell_agent will handle PATH issues, working-directory changes, and retry on transient failures automatically.


Step 3 — Filter Pre-Existing Errors

TypeScript projects frequently have pre-existing errors in files you did not touch. To avoid false regressions:

  1. Identify the baseline error count for the project (e.g., determined at task start or documented in task context). A common baseline is 11 pre-existing errors in unrelated files.
  2. Collect the full diagnostic list from tsc output.
  3. Filter to keep only errors whose file path matches a file you created or modified in this task.
  4. Evaluate:
    • Zero errors in your new/modified files → ✅ no regression introduced.
    • One or more errors in your new/modified files → ❌ fix them before proceeding.

Filtering heuristic (pseudocode)

all_errors   = parse_tsc_output(tsc_stdout)
my_files     = [list of files created/modified in this task]
new_errors   = [e for e in all_errors if e.file in my_files]

if len(new_errors) == 0:
    print("✅ No new TypeScript errors introduced.")
else:
    for err in new_errors:
        print(f"❌ {err.file}:{err.line} — {err.message}")
    raise Exception("Fix TypeScript errors before continuing.")

Step 4 — Fix and Re-Run

If new errors are found:

  1. Fix the errors in your file(s).
  2. Repeat from Step 1.

Decision Tree Summary

run_shell: npx tsc --noEmit
        │
        ├─ clean exit ──────────────────────────────► ✅ Done
        │
        ├─ TS diagnostic errors ────────────────────► Step 3 (filter)
        │
        └─ unknown/tool error
                │
                └─ shell_agent: node .../tsc --noEmit
                        │
                        ├─ TS diagnostic errors ────► Step 3 (filter)
                        └─ clean exit ──────────────► ✅ Done

Notes

  • Always run tsc from the project root (where tsconfig.json lives).
  • The node node_modules/typescript/bin/tsc invocation is the most portable fallback because it bypasses npx, shell PATH lookups, and binary permission issues entirely.
  • When the baseline error count is unknown, run tsc before making any changes and record the count; that becomes your baseline.
  • Only report/act on errors in files you own; never attempt to fix pre-existing errors in third-party or unrelated project files unless explicitly asked.
अक्सर पूछे जाने वाले सवाल

फॉलबैक क्या है?

अगर सामान्य कमांड कोड से असंबंधित कारणों से फेल होता है, तो एजेंट किसी सहायक से जाँच दूसरे तरीके से चलवाता है।

एजेंट कैसे जानता है कि एरर असली है?

असली एरर TypeScript डायग्नोस्टिक संदेशों के साथ आते हैं, जबकि टूल की विफलताएं ऐसे नहीं आतीं।

क्या इससे मेरा कोड बदलता है?

नहीं। जाँच केवल कोड पढ़ती है और एरर बताती है।

जानकारी

लेखक का मूल विवरण

A resilient workflow for running TypeScript compile checks (tsc --noEmit) that falls back gracefully when npx or direct binary invocations fail, and distinguishes pre-existing errors from newly introduced ones.

repo: HKUDS/AgentPilot

लोकप्रियता

GitHub स्टार
7.8k
रैंकिंग में स्थान
#13083
लाइसेंस
MIT
अपडेट की गई
1/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills