KB-54E2 rev 2

D28 — Nuxt/UI/Template Live Inventory Verification — Agent Prompt

10 min read Revision 2
dieu28promptagentinventoryverificationread-only2026-05-08

D28 — Nuxt/UI/Template Live Inventory Verification — Agent Prompt

Date: 2026-05-08 | Rev: 2 (GPT clarifications added) Status: APPROVED FOR DISPATCH — GPT review 2026-05-08 Agent target: claude-go hoặc codex-webtest Scope: READ-ONLY inventory. KHÔNG implement. KHÔNG sửa code. KHÔNG sửa Directus.


Mục tiêu

Kiểm kê live hệ thống Nuxt/UI/template để hoàn thành Tasks 3–7 từ verification report. Kết quả dùng để chỉnh phụ lục Điều 28 và design plan.


Hard boundaries

NO_NUXT_EDIT=true
NO_DIRECTUS_MUTATION=true
NO_PG_MUTATION=true
NO_FILE_WRITES=true
NO_PUBLISH=true
NO_TABLEIDMAP_CHANGE=true
NO_PERMISSION_CHANGE=true
NO_DEPLOY=true
NO_PACKAGE_INSTALL=true
READ_ONLY=true

Agent CHỈ được: đọc file, chạy grep, query Directus GET, query PG SELECT, list KB docs. KHÔNG ĐƯỢC sửa bất kỳ thứ gì.


GPT clarifications (rev2)

C1. Phụ lục Điều 28 là DRAFT, chưa enacted. Report ghi: d28_appendix_status=DRAFT_FOR_INVENTORY

C2. Grep findings PHẢI phân loại — không over-claim:

CONFIRMED_ISSUE    — chắc chắn là vấn đề
LIKELY_ISSUE       — khả năng cao là vấn đề, cần review
FALSE_POSITIVE     — grep match nhưng không phải vấn đề
NEEDS_REVIEW       — không đủ context để phân loại

C3. Read-only nghiêm ngặt: chỉ curl GET, SELECT, cat, grep, find, ls, wc. Không POST/PATCH/DELETE, không echo >, không docker exec ... psql -c "INSERT/UPDATE/DELETE".

C4. Report PHẢI tách nguồn dữ liệu:

LIVE_FACT              — xác nhận bằng query/grep live
KB_DOC_FACT            — từ KB doc, chưa verify live
HISTORICAL_REPORT      — từ report cũ, có thể stale
STALE_OR_UNCONFIRMED   — data cũ, không verify được

C5. KHÔNG chọn final route-resolution option. Chỉ thu evidence:

  • Bao nhiêu row match collection = entityType?
  • Bao nhiêu row match page_url convention?
  • Bao nhiêu row cần exception?
  • Runtime query có permission/auth issue không?

C6. Upload report KỂ CẢ khi FAIL hoặc BLOCKED. Partial data vẫn có giá trị.


Bước 0 — Đọc context trước khi chạy

Đọc từ KB (search_knowledge hoặc get_document):

  1. knowledge/dev/laws/dieu28-trien-khai/appendices/d28-nuxt-ui-assembly-governance-appendix-draft.md — phụ lục DRAFT
  2. knowledge/dev/laws/dieu28-trien-khai/appendices/d28-ui-template-design-implementation-index.md — chỉ mục

Nắm: danh sách templates, products, tools, legacy items cần verify.


Bước 1 — Reconcile table_registry live vs KB

1A. Query live Directus

curl -s "https://vps.incomexsaigoncorp.vn/items/table_registry?sort=id&fields=id,table_id,name,collection,status,page_url,module" \
  -H "Authorization: Bearer $DIRECTUS_ADMIN_TOKEN" | jq '.data[] | {id, table_id, name, collection, status, page_url}'

Ghi lại: tổng số rows, danh sách đầy đủ.

1B. List KB synced docs

# Qua Agent Data KB
list_documents path="registries/table_registry/"

Ghi lại: tổng số docs, danh sách.

1C. Reconcile

So sánh 2 danh sách:

  • Rows trong live Directus NHƯNG KHÔNG có trong KB = MISSING_FROM_KB
  • Docs trong KB NHƯNG KHÔNG có trong live = ORPHANED_KB_DOC

Output bảng reconcile.

1D. Route-resolution evidence (cho C5)

Từ 1A data, đếm:

  • Bao nhiêu rows có collection = entityType portion trong page_url? (Ví dụ: page_url /knowledge/registries/system_issue → entityType system_issue → collection system_issues → match hay không?)
  • Bao nhiêu rows có naming convention tbl_ + collection_name = table_id?
  • Bao nhiêu rows cần exception mapping?

Bước 2 — Verify templates / khuôn live status

2A. DirectusTable / SharedDirectusTable

ls -la web/components/shared/DirectusTable.vue
wc -l web/components/shared/DirectusTable.vue
ls -la web/composables/useDirectusTable.ts
wc -l web/composables/useDirectusTable.ts
grep -rn "DirectusTable\|SharedDirectusTable" web/ --include="*.vue" --include="*.ts" | wc -l
grep -rn "DirectusTable\|SharedDirectusTable" web/ --include="*.vue" --include="*.ts" | head -20

2B. DirectusMatrix

grep -rn "DirectusMatrix" web/ --include="*.vue" --include="*.ts"
find web/ -name "*Matrix*" -o -name "*matrix*" | grep -v node_modules

2C. DirectusTimeline

grep -rn "DirectusTimeline" web/ --include="*.vue" --include="*.ts"
grep -rn "UTimeline\|UStepper" web/ --include="*.vue" | head -10

2D. DirectusForm

grep -rn "DirectusForm" web/ --include="*.vue" --include="*.ts"

2E. DocsTreeView

grep -rn "DocsTreeView\|TreeView\|tree-view" web/ --include="*.vue" --include="*.ts"
find web/ -name "*tree*" -o -name "*Tree*" | grep -v node_modules

2F. CommentModule / WorkflowModule / TaskModule

grep -rn "CommentModule\|WorkflowModule\|TaskModule" web/ --include="*.vue" --include="*.ts"
grep -rn "comment-module\|workflow-module\|task-module" web/ --include="*.vue"

2G. Workflow supervisor UI

grep -rn "supervisor\|Supervisor" web/ --include="*.vue" --include="*.ts"
find web/pages/ -path "*workflow*" | head -20

Mỗi template: ghi Status + file path + line count + classify (template/product/legacy/missing)


Bước 3 — Verify tools / code paths

3A. Registry route and tableIdMap

cat web/pages/knowledge/registries/\[entityType\]/index.vue
grep -n "tableIdMap\|entityMap\|collectionMap" web/pages/knowledge/registries/\[entityType\]/index.vue

Output: exact content of tableIdMap (tất cả entries), line numbers, total count.

3B. Nuxt auth/session middleware

cat web/middleware/session.global.ts
grep -n "PUBLIC_PREFIXES\|public\|anon" web/middleware/session.global.ts

3C. DOT schema tools

grep -rn "dot-schema-snapshot\|dot-schema-diff" web/ tools/ scripts/ --include="*.ts" --include="*.sh" --include="*.js"
find . -name "*dot-schema*" | grep -v node_modules

3D. CI enforce-table-module

find .github/ -name "*table*" -o -name "*enforce*"
cat .github/workflows/enforce-table-module.yml 2>/dev/null || echo "NOT_FOUND"

3E. Custom Code Registry

# Read from KB
get_document "knowledge/dev/ssot/custom-code-registry.md"

Bước 4 — Identify legacy / rác

QUAN TRỌNG: Mỗi grep finding PHẢI phân loại theo C2 (CONFIRMED_ISSUE / LIKELY_ISSUE / FALSE_POSITIVE / NEEDS_REVIEW). Không report raw grep output mà không phân loại.

4A. DirectusDataTable (should be replaced)

grep -rn "DirectusDataTable" web/ --include="*.vue" --include="*.ts"

4B. Direct UTable usage outside DirectusTable

grep -rn "<UTable" web/ --include="*.vue" | grep -v "DirectusTable.vue"

4C. Custom HTML tables

grep -rn "<table\b" web/ --include="*.vue" | grep -v "DirectusTable.vue" | grep -v node_modules

4D. Direct PG access from Nuxt

grep -rn "pg\b\|postgres\|knex\|sequelize\|prisma\|pg_connect\|createPool" web/ --include="*.ts" --include="*.vue" | grep -v node_modules | grep -v ".nuxt"

Lưu ý: pg có thể match false positive (ví dụ: page, paragraph). Phân loại kỹ.

4E. Hardcoded routes/maps elsewhere

grep -rn "tableIdMap\|entityMap\|collectionMap" web/ --include="*.vue" --include="*.ts"

4F. Custom pages calculating business logic

grep -rn "\.reduce\(\|\.filter\(\|aggregate\|\.sum\|\.count\b" web/pages/ --include="*.vue" | head -30

Lưu ý: .filter().map() rất phổ biến trong Vue templates — chỉ report nếu context rõ ràng là business calculation.

4G. Server APIs

find web/server/ -name "*.ts" -o -name "*.js" 2>/dev/null | head -20
ls web/server/api/ 2>/dev/null || echo "NO_SERVER_API_DIR"

Bước 5 — Full page/route inventory

find web/pages/ -name "*.vue" | sort
find web/pages/ -name "*.vue" | wc -l

Report format

# D28 — Nuxt/UI/Template Live Inventory Verification Report

> Date: 2026-05-08
> Agent: [agent name]
> Prompt rev: 2
> Status: COMPLETE | PARTIAL | BLOCKED

## Attestation
d28_appendix_status=DRAFT_FOR_INVENTORY
read_only_attestation=true
file_writes=0
directus_mutations=0
pg_mutations=0
deploy_actions=0

## 1. table_registry reconciliation
total_live_rows=?
total_kb_docs=?
missing_from_kb=[...]
orphaned_kb=[...]
source_classification=LIVE_FACT

### Route-resolution evidence
rows_collection_equals_entitytype=?
rows_page_url_convention_match=?
rows_needing_exception=?
runtime_query_auth_issue=?
final_route_option_selected=false

## 2. Templates status
(per template: status + source_classification + evidence)

## 3. Tools
tableIdMap_entries=? (exact list)
tableIdMap_entry_count=?
ci_enforce_table_module=DEPLOYED|NOT
route_smoke=EXISTS|MISSING
dot_schema_tools=EXISTS|MISSING
custom_code_registry_entries=?

## 4. Legacy / rác
(per finding: classification + source_classification)

### Classification counts
grep_confirmed_issues=?
grep_likely_issues=?
grep_false_positives=?
grep_needs_review=?

## 5. Page/route inventory
total_pages=?

## 6. Data source summary
live_facts_count=?
kb_doc_facts_count=?
historical_report_facts_count=?
stale_or_unconfirmed_count=?

## 7. Cleanup taxonomy
KEEP=?
MIGRATE=?
QUARANTINE=?
DELETE=?
UNKNOWN=?

Report path: knowledge/dev/laws/dieu28-trien-khai/reports/d28-nuxt-ui-template-live-inventory-verification-report.md


Verification block

no_nuxt_edit=true
no_directus_mutation=true
no_pg_mutation=true
no_file_writes=true
no_publish=true
no_deploy=true
scope=READ_ONLY_INVENTORY
d28_appendix_status=DRAFT_FOR_INVENTORY
final_route_option_selected=false
report_uploaded=PASS|FAIL

D28 Live Inventory Verification | Agent Prompt rev2 | READ-ONLY | APPROVED FOR DISPATCH | 2026-05-08

Back to Knowledge Hub knowledge/dev/laws/dieu28-trien-khai/prompts/d28-nuxt-ui-template-live-inventory-verification-prompt.md