Repository navigation
feat(ai): dynamic package introspection and multi-source docs ingestion engine - #82
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
src/devops_cli/ai/library/introspector.py contains invalid exception syntax that will raise SyntaxError at import time, blocking the feature from running.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces a new AI “ingest” subsystem to generate deterministic library API contracts via runtime introspection and to ingest local/remote documentation into chunked knowledge files, wiring both into the devops ai ingest CLI and updating docs/tests accordingly.
Changes:
- Added
PackageIntrospector+ signature extractors andDocsIngesterfor local/remote docs ingestion with SSRF validation. - Introduced new Pydantic v2 models for library contracts and doc chunks, plus new AI ingestion exceptions.
- Added new
devops ai ingest (library|docs)CLI commands and synchronized README/CLI reference/docs + tests.
File summaries
| File | Description |
|---|---|
| tests/test_library_ingest.py | New unit tests covering signature extraction, serialization round-trip, and CLI behavior for library ingestion. |
| tests/test_docs_ingester.py | New unit tests covering local/remote docs ingestion, chunking, SSRF blocking, and CLI behavior. |
| src/devops_cli/models/library.py | New Pydantic models for library contracts and ingested documentation chunk metadata/results. |
| src/devops_cli/lang/en/help.py | Added help strings for new ai ingest commands/options. |
| src/devops_cli/exceptions/ai.py | Added LibraryIngestionError, LibraryNotFoundError, and DocsIngestionError exception types. |
| src/devops_cli/exceptions/init.py | Re-exported the new AI ingestion exceptions. |
| src/devops_cli/commands/ai.py | Wired the new ingest Typer app into devops ai and added ai_app alias. |
| src/devops_cli/commands/ai_ingest.py | New CLI implementation for devops ai ingest library and devops ai ingest docs. |
| src/devops_cli/ai/library/introspector.py | New package introspection + symbol/signature extraction + contract persistence. |
| src/devops_cli/ai/library/docs_ingester.py | New docs ingestion + markdown chunking + HTML extraction + SSRF guardrail integration. |
| src/devops_cli/ai/library/init.py | New package exports for the library ingestion subsystem. |
| README.md | Added devops ai ingest to the command matrix. |
| docs/LOG.md | Logged the new Phase 50.1/50.2 milestone work. |
| docs/ERRORS.md | Updated error catalog table (currently with issues in the new rows). |
| docs/commands/ai.md | Added documentation for the new devops ai ingest command group. |
| docs/CLI_REFERENCE.md | Added CLI reference entries for the new devops ai ingest commands/options. |
| docs/agent/task.md | Updated agent task tracking to mark phases complete and track PR creation/next phases. |
Review details
Suppressed comments (1)
docs/ERRORS.md:55
- These rows introduce duplicate entries for the same error code (
DEVOPS_CLI_ERROR), which doesn’t add actionable information and can confuse consumers of the error-code catalog. Either introduce dedicated error codes in code (preferred) or don’t list per-exception rows here until unique codes exist.
| `LLM_INFERENCE_ERROR` | `10` | Ai | Base exception for LLM provider invocation failures. |
| `DEVOPS_CLI_ERROR` | `1` | Ai | Base exception for package introspection and library ingestion errors. |
| `DEVOPS_CLI_ERROR` | `1` | Ai | Raised when target package cannot be imported or found in the environment. |
- Files reviewed: 17/17 changed files
- Comments generated: 8
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Sep 9, 2026
Merged
dan-petty
added a commit
that referenced
this pull request
Sep 10, 2026
* chore(release): initialize release/v0.2.14 branch and configure Dependabot * fix(docs): scrub private configuration values, internal hostnames, and homelab references * feat(ai): dynamic package introspection and multi-source docs ingestion engine (#82) * feat(ai): add dynamic package introspection and multi-source docs ingestion engine * fix(ai): enforce fully-qualified symbol index and dedicated error codes for library ingestion * fix(ai): filter built-in descriptors from class method extraction * feat(rag): dedicated library vector tier and valkey symbol cache store (#83) * feat(rag): dedicated library vector tier, valkey symbol cache, and routine observability audit * docs(roadmap): define v0.2.16 and v0.2.17 milestones for sandbox application lifecycle * feat(gh): integrate github pages, issues, projects, and views with fastmcp and agent instructions * docs(roadmap): enrich task context, technical specifications, and reprioritize milestones * docs: compact v0.1 release documentation and codify automated compaction policy * fix(rag): address code review feedback on library store and CLI client wiring * feat(gh): enhance project sync with rest resolution, rate-limit guards, and issue reconciliation * refactor(security): consolidate in-place security checks into canonical submodules * feat(gh): add pr review threads management and project custom fields reconciler * feat(ai): add ast prompt grounding and fastmcp library intelligence tools - Filter out private submodules and __main__ in package introspection to eliminate CLI execution hazard (Fixes #84). - Expose FastMCP library intelligence tools (ai_ingest_library, ai_query_library, ai_inspect_symbol) and resource://libraries/indexed dynamic resource (Closes #80). - Implement import-driven AST prompt grounding and API contract injection in review pipeline (Closes #78). - Add comprehensive contract, regression, and injection unit tests and sync roadmap. * feat(ai): integrate tree-sitter multilingual ast engine and library drift auditor Implement polyglot concrete syntax tree parsing, S-expression AST query execution, and cross-file code graph synthesis for Python, TypeScript, Go, Rust, Java, and HCL with zero-crash fallback parsers. Expose CLI commands `devops ai ast parse` and `devops ai ast graph`, add `--multilingual` support to `devops ai repomap`, and register FastMCP tools `ai_ast_parse` and `ai_ast_graph`. Implement workspace library API drift and deprecation usage auditor `devops ai audit-library-usage` comparing AST call sites against indexed library contracts to detect removed methods, unknown attributes, unrecognized kwargs, and deprecated calls. Flatten nesting depth to satisfy architectural invariant gates. Closes #74 Closes #79 * feat(ai): integrate ai context packing and symbol-pruned prompt synthesizer Implement `ContextPacker` in `src/devops_cli/ai/context_packer.py` to rank imported symbols, strip unreferenced private methods/docstrings, and skeletonize function/class bodies with ellipsis while preserving public interfaces, parameters, defaults, and type annotations. Expose CLI command `devops ai pack-context` and FastMCP tool `ai_pack_context`, and integrate context packing into `_collect_linked_snippets` in the review pipeline. Enforce strict cyclomatic complexity <= 10 and nesting depth <= 2. Closes #85 * feat(rag): autonomous rag index drift detection and auto-reindexing engine Closes #81 * chore(release): bump version to v0.2.14 * fix(docs): align jekyll configuration file naming to _config.yaml * fix(review): remediate copilot findings and enhance project tracking instructions - Harden security sanitizer with -p= and --token= sensitive argument prefixes - Implement non-mutating thread-safe DNS resolution with fail-closed non-public IP validation - Scope docs ingester chunk slugs to file relative paths, mask credentials in errors, and support multi-page crawling - Fully qualify introspected function and class symbol signatures and filter private submodules - Namespace Valkey cache keys and Qdrant vector point IDs with package qualification - Integrate Tree-Sitter native CST parsing fallback and S-expression query filtering - Disambiguate AST call graph edges against symbol bodies to prevent parameter shadowing - Enforce valid Python AST pruning under context budgets without arbitrary string truncation - Support module-level imports and alias attribute lookups in library drift auditor - Forward multi-label filters in GitHub client and paginate review threads via GraphQL - Align project custom field inference with declarative taxonomy label mappings - Enhance agent instructions, routine tasks, and knowledge base for proactive project bootstrap and card tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements Phase 50.1 (Dynamic Package Introspection & Type Stub Parser) and Phase 50.2 (Multi-Source Documentation & Standards Ingester) for the Multilingual Code Intelligence engine in milestone
v0.2.14.Key Enhancements
src/devops_cli/ai/library/introspector.py):--max-depth.extract_function_signature,extract_class_signature) extracting typed parameters, kinds, defaults, return annotations, docstrings, base classes, methods, and property descriptors.symbols_indexmapping qualified symbol identifiers to kind (function,class,method,constant).save_to_dirandload_from_dir.src/devops_cli/ai/library/docs_ingester.py):.md,.markdown,.rst, and.txtdocumentation.DocChunkobjects with breadcrumb headings and estimated token counts.validate_service_url(allow=False)blocking private, loopback, link-local, and metadata destinations.models/library.py,exceptions/ai.py):ParameterSignature,FunctionSignature,ClassSignature,ModuleContract,LibraryContract,DocChunk,IngestDocResult.LibraryIngestionError,LibraryNotFoundError,DocsIngestionErrorinheriting fromDevOpsCLIError.commands/ai_ingest.py,commands/ai.py):devops ai ingest library <package_name> [--max-depth <int>] [--output-dir <path>] [--format json|table]devops ai ingest docs <source> [--output-dir <path>] [--format json|table]ai_app = appand centralized help strings insrc/devops_cli/lang/en/help.py.Verification
tests/test_library_ingest.pyandtests/test_docs_ingester.py(100% pass rate).ai/library, 100% oncommands/ai_ingest.py.devops scan complexityandtests/test_architectural_invariants.py.devops ci.Closes #75
Closes #76