Afunana
Afunana Documentation

Administration Guide

Everything an admin needs: users, collections, AS/400, builds, tags, and monitoring.

← Back to Docs

User Management

Location: Admin → Users

Creating Users

Click "Add User" and fill in username (unique), email, full name, role, initial password, and collection assignments.

Roles

RoleAccess
adminFull access: user management, configuration, builds, audit, all collections
userView assigned collections, browse documentation, use chat
viewerRead-only access to assigned collections
qaRead-only collection access, trigger builds, project management access

User Lifecycle

Collection Management

Location: Admin → Collections

Each collection is an isolated application with its own source code, documentation, search indices, tags, and user access controls.

Creating a Collection

FieldDescriptionExample
NameInternal identifier (no spaces)cblNinja
Display NameHuman-readable name in UICBL Ninja System
LanguageOutput language for generated docsen or he
Source LibraryIBM i library containing source filesCBLNINJA
Root ProgramEntry point for call treeOVDIM
Call DepthHow deep to trace call hierarchy9
Max ProgramsMaximum programs to analyze99
Library ListIBM i library list for name resolutionCBLNINJA QGPL QTEMP
App Code3-character code for extraction jobNJA

AS/400 Connection & Extraction

Afunana connects to IBM i via JDBC to extract source code, call relationships, file structures, and field definitions. The extraction is non-invasive — no changes are made to production objects.

Connection Setup

Location: Admin → Configuration → AS/400 Connection

Prerequisites: IBM i accessible via TCP/IP, ports 8471 (JDBC) and 21 (FTP) open, a read-only user account, and the TTDOCPGM1 extraction program installed.

SettingDescription
AS400_HOSTIBM i hostname or IP address
AS400_PORTJDBC port (default: 8471)
AS400_USERIBM i user profile
AS400_PASSWORDIBM i password
AS400_SSLEnable SSL for JDBC

Click "Test Connection" to verify JDBC connectivity before extracting.

Extraction Process

Admin triggers extract → SBMJOB on IBM i → TTDOCPGM1 runs → IFS output → FTP download → Data/{collection}/
  1. Afunana submits a batch job (SBMJOB) that runs TTDOCPGM1 on the IBM i
  2. TTDOCPGM1 extracts source members, relationships, and metadata into CSV files on the IFS
  3. Afunana polls the IFS every 60 seconds for a TTDOC_DONE flag file
  4. Files are downloaded via FTP in binary mode and stored in Data/{collection}/

Extraction Output

FileContent
TTPGMOUT.csvProgram list with metadata (name, type, description, source file, library)
TTPGM2PGM.csvCall relationships (caller, called, location, type)
TTPGM2FIL.csvProgram-to-file usage (program, file, access mode R/W/U)
TTFIL2FLD.csvFile-to-field definitions (file, field, position, length, type)
TTFLDKEY.csvKey field definitions (file, field, key sequence)
Source membersRaw COBOL/RPG/CL source code (EBCDIC to UTF-8)

Source Member Operations

Beyond extraction, Afunana can read and write individual source members on the IBM i for the AI change plan executor:

Building Documentation

Click "Build" on the collection. The AI pipeline processes all programs in the background:

  1. Parse — CSV metadata to structured data
  2. Build Documents — LLM generates program documentation JSON
  3. System Overview — LLM generates architecture analysis
  4. Embeddings — ChromaDB + BM25 search indices
  5. Auto-Tagging — AI classifies programs by business function

Monitor progress via the floating log window. Build history shows past builds with status, timing, and error counts.

Build Controls

ActionBehavior
Pause/ResumeCheckpoint build for later resumption
CancelStop running build, preserve completed programs
RebuildRe-process all programs from scratch

Specification Documents

On-demand generation of formal specs at three audience levels (business, analyst, programmer). Available for individual programs (Programs → Documents tab) and entire collections (System Overview → Documents). Documents are cached and regenerated when source changes.

Tags & Classification

Location: Admin → Tags

Tags classify programs and files for filtering and organization. Create tags with a key, Hebrew/English labels, color (8 options), and entity type (program or file).

During the build pipeline (Stage 5), the AI automatically assigns tags based on business function. Tags can be manually overridden. Users see tag pills on Programs and Files pages for filtering.

Configuration

Location: Admin → Configuration. Organized by category:

Prompt Management

Location: Admin → Prompts. System prompts control AI documentation and chat behavior. Editable per group (Build Program/File/System Overview, Chat Classifier/Planner/Tools). Changes take effect on the next build or chat query.

Monitoring & Logs

ViewLocationContent
Audit LogAdmin → Audit LogSecurity events with filtering by type, actor, severity, date. Export CSV/JSON. Hash chain verification.
Chat LogAdmin → Chat LogUser chat sessions: conversations, tool invocations, token counts
Build HistoryAdmin → Build HistoryPast builds: status, timing, program/file counts, error messages
App LogAdmin → App LogBackend errors/warnings with timestamps, severity, stack traces
Health CheckGET /healthReal-time system status (database, AS/400 connectivity)