Skip to content

Commit 3843416

Browse files
committed
refactor(convert-app): reorganize reference files under skill directory
Moved files: - conversion-bootstrap.md - deprecation-discovery.md - documentation-spec.md - final-audit-checklist.md - model-sourcing.md - pipeline-implementation.md - runsh-pitfalls.md - validation-protocol.md - cmake-and-deliverables.md From: .github/prompts/convert-app/ To: .github/skills/dlstreamer-coding-agent/convert-app/ Updated paths: - Fixed relative links to assets/ and references/ subdirectories - Fixed links to convert-app.prompt.md (now in parent prompts/) - Updated orchestrator links in convert-app.prompt.md Benefits: - Better code organization (skill files grouped with skill) - Clearer separation between prompts and skills - Easier maintenance and navigation
1 parent b8001d0 commit 3843416

14 files changed

Lines changed: 2094 additions & 0 deletions
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
description: Convert the provided application into a native Intel DL Streamer / OpenVINO C++ application.
3+
---
4+
5+
# Goal
6+
7+
Convert the provided application into a native Intel DL Streamer / OpenVINO C++
8+
application.
9+
10+
# How this prompt is organized
11+
12+
This prompt is intentionally short. It is a **sequential orchestrator** — each
13+
step links to a single, focused reference file under
14+
[`.github/skills/dlstreamer-coding-agent/convert-app/`](../skills/dlstreamer-coding-agent/convert-app/).
15+
Read the linked reference **at the moment you start a given step** (not all
16+
at once at the beginning) so the relevant rules stay in active attention
17+
while you work on that step.
18+
19+
| # | Step | Reference |
20+
|---|---|---|
21+
| 0 | Pipeline construction skill (always available) | [SKILL.md](../skills/dlstreamer-coding-agent/SKILL.md) |
22+
| 1 | Scaffold from scratch (source + output dir + env) | [conversion-bootstrap.md](../skills/dlstreamer-coding-agent/convert-app/conversion-bootstrap.md) |
23+
| 2 | Build the per-run deprecation deny-list | [deprecation-discovery.md](../skills/dlstreamer-coding-agent/convert-app/deprecation-discovery.md) |
24+
| 3 | Review the source app + build the functional block inventory | (this file, §Step 3) |
25+
| 4 | Plan model substitutions + 1-to-1 element mapping | [model-sourcing.md](../skills/dlstreamer-coding-agent/convert-app/model-sourcing.md) |
26+
| 5 | Implement (pipeline, probes, paths, encoders, traceability) | [pipeline-implementation.md](../skills/dlstreamer-coding-agent/convert-app/pipeline-implementation.md) + [cmake-and-deliverables.md](../skills/dlstreamer-coding-agent/convert-app/cmake-and-deliverables.md) |
27+
| 6 | Verify correctness (clean-shell runs + auto-fix loop) | [validation-protocol.md](../skills/dlstreamer-coding-agent/convert-app/validation-protocol.md) + [runsh-pitfalls.md](../skills/dlstreamer-coding-agent/convert-app/runsh-pitfalls.md) |
28+
| 7 | Document the conversion | [documentation-spec.md](../skills/dlstreamer-coding-agent/convert-app/documentation-spec.md) |
29+
| 8 | Final compliance audit (last gate before reporting completion) | [final-audit-checklist.md](../skills/dlstreamer-coding-agent/convert-app/final-audit-checklist.md) |
30+
31+
# Target platform
32+
33+
Intel hardware — iGPU / dGPU (Arc, Iris Xe), CPU, or NPU. Default to `GPU`
34+
with CPU fallback unless the user specifies otherwise.
35+
36+
# Checkpoint protocol (mandatory liveness signal)
37+
38+
After completing each numbered step below, the agent MUST emit a one-line
39+
checkpoint message of the form
40+
`Checkpoint N/8: <step name> — <one-line outcome>` AND make at least one tool
41+
call as part of that checkpoint (typically `manage_todo_list` to flip the step
42+
from `in-progress` to `completed` and the next from `not-started` to
43+
`in-progress`).
44+
45+
If a step is naturally large (e.g. step 5 Implement), emit additional
46+
intra-step checkpoints (`Checkpoint 5/8a`, `5/8b`, …) every time a major
47+
sub-artifact is created (CMakeLists, main `.cpp`, `run.sh`, `export_models.sh`).
48+
49+
**Never go more than ~3 minutes of wall-clock time without a tool call or a
50+
checkpoint message.** This guarantees a visible liveness signal lands in the
51+
chat for every step, so the user can distinguish a working agent from a
52+
stalled one even during a single long turn. If a substep is genuinely
53+
long-running (e.g. `cmake --build`, `omz_downloader`), break it up: emit a
54+
short `Checkpoint N/8x: <substep> — starting` before launching the command,
55+
then a follow-up checkpoint with the outcome when it returns.
56+
57+
# Steps
58+
59+
## Step 1 — Scaffold from scratch
60+
61+
Execute the procedure in
62+
[conversion-bootstrap.md](../skills/dlstreamer-coding-agent/convert-app/conversion-bootstrap.md):
63+
64+
- Resolve workspace root.
65+
- Idempotent source clone.
66+
- Create a **fresh numbered output directory** (`<app>_NNN/`).
67+
- Announce the directory name to the user up-front.
68+
- Apply the mandatory env-setup recipe (§4.1) in full, run the verification
69+
(§4.2), and if anything reports `MISSING:` apply the registry-cache
70+
recovery (§4.3) before proceeding.
71+
72+
All subsequent file writes happen inside the newly-created numbered directory.
73+
The exact same env-setup recipe MUST also be wired verbatim into the generated
74+
`run.sh` (see [cmake-and-deliverables.md](../skills/dlstreamer-coding-agent/convert-app/cmake-and-deliverables.md) §4).
75+
76+
## Step 2 — Run the upstream deprecation discovery
77+
78+
Execute the grep procedure in
79+
[deprecation-discovery.md](../skills/dlstreamer-coding-agent/convert-app/deprecation-discovery.md)
80+
and build the per-run deny-list. Keep it handy as the authoritative deny-list
81+
for steps 4–6.
82+
83+
## Step 3 — Review the source app + build the functional block inventory
84+
85+
Review the cloned source application to understand its functionality,
86+
structure, and generated output. Then build a **functional block inventory**
87+
— a numbered list of every distinct:
88+
89+
- inference stage (PGIE, SGIE, secondary detectors/classifiers),
90+
- pre/post-processing step,
91+
- tracking,
92+
- analytics,
93+
- visualization element
94+
95+
…together with what each block contributes to the visible output (bounding
96+
boxes, labels, counters, overlay text). This inventory is the contract for
97+
step 4 — every block listed here MUST receive a dedicated counterpart in the
98+
converted pipeline.
99+
100+
## Step 4 — Plan the conversion
101+
102+
Map **every** functional block from the step-3 inventory to a corresponding
103+
DL Streamer element or OpenVINO API. The mapping MUST be **strictly 1-to-1**
104+
— simplifications, merges, and stage drops are NOT permitted. Example: an
105+
N-stage cascade in the source app (e.g. detect → detect → classify) becomes
106+
an N-stage cascade in the conversion using the equivalent DL Streamer
107+
elements (e.g. `gvadetect``gvadetect` on upstream ROIs → `gvaclassify`).
108+
The only exception is blocks explicitly listed under *Scope → Exclude* in
109+
[cmake-and-deliverables.md](../skills/dlstreamer-coding-agent/convert-app/cmake-and-deliverables.md).
110+
111+
For model substitutions, precision, OCR language defaults, and device
112+
mapping, follow
113+
[model-sourcing.md](../skills/dlstreamer-coding-agent/convert-app/model-sourcing.md).
114+
115+
The agent MUST make all element-mapping decisions **autonomously** based on
116+
DL Streamer documentation, installed element properties
117+
(`gst-inspect-1.0 <element>`), sample code, and the coding-agent skill —
118+
**without** asking the user for confirmation. If multiple elements could
119+
satisfy a block, pick the best match (highest performance, lowest deprecation
120+
risk, closest semantic equivalence) and document the choice with a one-line
121+
justification in the README.
122+
123+
Cross-check every chosen element/property against the deny-list built in
124+
step 2.
125+
126+
## Step 5 — Implement
127+
128+
Implement the conversion in C++ following
129+
[pipeline-implementation.md](../skills/dlstreamer-coding-agent/convert-app/pipeline-implementation.md)
130+
end-to-end (see its §§1–10 for the full set of rules).
131+
132+
Generate the build system and wrapper per
133+
[cmake-and-deliverables.md](../skills/dlstreamer-coding-agent/convert-app/cmake-and-deliverables.md):
134+
`CMakeLists.txt` (with mandatory adjustments), `run.sh` (with `--help`,
135+
`--sink display|file|fake`, headless auto-detection, pre-flight resource
136+
audit), and `export_models.sh` if applicable.
137+
138+
Cross-check every element, property, file format, and metadata API against
139+
the deny-list from step 2.
140+
141+
## Step 6 — Verify correctness
142+
143+
Run the full validation protocol in
144+
[validation-protocol.md](../skills/dlstreamer-coding-agent/convert-app/validation-protocol.md):
145+
146+
1. Capture baseline outputs (if the original can be run on this host).
147+
2. Build (`cmake -S . -B build && cmake --build build -j$(nproc)`).
148+
3. Clean-shell `./run.sh` runs (`env -i …`) for all five invocations
149+
(`--help`, defaults, `--sink fake`, `--sink file`, `--sink invalid`) with
150+
the **auto-fix loop**.
151+
4. Compare against baseline (if available).
152+
5. Benchmark.
153+
6. Deprecated-API scan (dynamic grep against the step-2 deny-list).
154+
155+
When a clean-shell run fails, map the error to
156+
[runsh-pitfalls.md](../skills/dlstreamer-coding-agent/convert-app/runsh-pitfalls.md),
157+
apply the fix, and **re-run every test** — fixes for one bug frequently
158+
expose the next.
159+
160+
## Step 7 — Document
161+
162+
Generate the README **strictly** following
163+
[documentation-spec.md](../skills/dlstreamer-coding-agent/convert-app/documentation-spec.md) — see its §1
164+
(required README sections) and §3 (Conversion Notes sub-sections) for the
165+
full contract.
166+
167+
Source traceability comments in the C++ code are mandatory and are enforced
168+
by [pipeline-implementation.md](../skills/dlstreamer-coding-agent/convert-app/pipeline-implementation.md)
169+
§9 — not by the README itself.
170+
171+
## Step 8 — Final requirements compliance audit
172+
173+
Walk through the checklist in
174+
[final-audit-checklist.md](../skills/dlstreamer-coding-agent/convert-app/final-audit-checklist.md)
175+
and verify every requirement with a concrete artifact or test result. Emit
176+
the filled checklist (with `[x]` / `[ ]` and a one-line note per item) in the
177+
final user-facing summary message. Any remaining `[ ]` items block completion
178+
— fix them and re-audit.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# ==============================================================================
2+
# Copyright (C) 2026 Intel Corporation
3+
#
4+
# SPDX-License-Identifier: MIT
5+
# ==============================================================================
6+
#
7+
# CMakeLists.txt template for a standalone DL Streamer / OpenVINO C++ application.
8+
#
9+
# Usage:
10+
# 1. Copy this file as `CMakeLists.txt` into your application directory.
11+
# 2. Replace `{{TARGET_NAME}}` with the application name (no spaces).
12+
# 3. Remove sections marked OPTIONAL if your app does not need them
13+
# (OpenCV, custom compile flags).
14+
# 4. Place all `.cpp` and `.h` files in the same directory as this CMakeLists.txt
15+
# (they are picked up via GLOB).
16+
#
17+
# Build:
18+
# mkdir build && cd build
19+
# cmake ..
20+
# make -j$(nproc)
21+
# ==============================================================================
22+
23+
cmake_minimum_required(VERSION 3.20)
24+
25+
set(TARGET_NAME "{{TARGET_NAME}}")
26+
project(${TARGET_NAME} CXX)
27+
28+
# --- Required dependencies ----------------------------------------------------
29+
find_package(PkgConfig REQUIRED)
30+
31+
pkg_check_modules(GSTREAMER gstreamer-1.0>=1.16 REQUIRED)
32+
pkg_check_modules(GSTVIDEO gstreamer-video-1.0>=1.16 REQUIRED)
33+
pkg_check_modules(GSTANALYTICS gstreamer-analytics-1.0>=1.16 REQUIRED)
34+
pkg_check_modules(GLIB2 glib-2.0 REQUIRED)
35+
36+
# --- OPTIONAL: OpenCV (remove this block if your app does not use OpenCV) -----
37+
find_package(OpenCV OPTIONAL_COMPONENTS core imgproc)
38+
39+
# --- DL Streamer install layout (default Intel DL Streamer install paths) -----
40+
set(DLSTREAMER_INSTALL_PREFIX /opt/intel/dlstreamer)
41+
set(DLSTREAMER_INCLUDE_DIRS ${DLSTREAMER_INSTALL_PREFIX}/include)
42+
set(GSTREAMER_INCLUDE_DIR ${DLSTREAMER_INSTALL_PREFIX}/gstreamer/include/gstreamer-1.0)
43+
44+
link_directories(
45+
${DLSTREAMER_INSTALL_PREFIX}/lib
46+
${DLSTREAMER_INSTALL_PREFIX}/Release/lib
47+
${DLSTREAMER_INSTALL_PREFIX}/gstreamer/lib
48+
/usr/lib/x86_64-linux-gnu
49+
)
50+
51+
# --- Sources ------------------------------------------------------------------
52+
file(GLOB MAIN_SRC *.cpp)
53+
file(GLOB MAIN_HEADERS *.h)
54+
55+
add_executable(${TARGET_NAME} ${MAIN_SRC} ${MAIN_HEADERS})
56+
57+
set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 23)
58+
59+
# --- OPTIONAL: silence noisy GStreamer enum-conversion warnings ---------------
60+
include(CheckCXXCompilerFlag)
61+
check_cxx_compiler_flag(-Wno-deprecated-enum-enum-conversion HAVE_DEPRECATED_ENUM_CONVERSION)
62+
if(HAVE_DEPRECATED_ENUM_CONVERSION)
63+
target_compile_options(${TARGET_NAME} PRIVATE -Wno-deprecated-enum-enum-conversion)
64+
endif()
65+
66+
# --- Include directories ------------------------------------------------------
67+
target_include_directories(${TARGET_NAME}
68+
PRIVATE
69+
${DLSTREAMER_INCLUDE_DIRS}
70+
${DLSTREAMER_INCLUDE_DIRS}/dlstreamer/gst
71+
${GSTREAMER_INCLUDE_DIR}
72+
${GSTREAMER_INCLUDE_DIRS}
73+
${GSTVIDEO_INCLUDE_DIRS}
74+
${GSTANALYTICS_INCLUDE_DIRS}
75+
${GLIB2_INCLUDE_DIRS}
76+
${OpenCV_INCLUDE_DIRS} # OPTIONAL — remove if not using OpenCV
77+
)
78+
79+
# --- Link libraries -----------------------------------------------------------
80+
target_link_libraries(${TARGET_NAME}
81+
PUBLIC
82+
dlstreamer_gst_meta
83+
PRIVATE
84+
${GLIB2_LIBRARIES}
85+
${GSTREAMER_LIBRARIES}
86+
${GSTVIDEO_LIBRARIES}
87+
${GSTANALYTICS_LIBRARIES}
88+
${OpenCV_LIBS} # OPTIONAL — remove if not using OpenCV
89+
)

0 commit comments

Comments
 (0)