@aisdlc/core 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +200 -2
- package/dist/index.cjs +11241 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1656 -0
- package/dist/index.d.ts +1656 -0
- package/dist/index.js +11019 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Alfonso Troyano Montes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,201 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @aisdlc/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Core library for **AI-SDLC**, an AI-native Software Development Lifecycle framework focused on engineering governance, traceability, quality gates and controlled AI-assisted software delivery.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@aisdlc/core)
|
|
6
|
+
[](https://www.npmjs.com/package/@aisdlc/core)
|
|
7
|
+
|
|
8
|
+
## What is AI-SDLC?
|
|
9
|
+
|
|
10
|
+
AI-SDLC provides a structured approach to integrating AI into the software development lifecycle without losing engineering discipline, traceability or governance.
|
|
11
|
+
|
|
12
|
+
The framework is designed around concepts such as:
|
|
13
|
+
|
|
14
|
+
- Software Development Lifecycle governance
|
|
15
|
+
- AI-assisted engineering
|
|
16
|
+
- Traceability
|
|
17
|
+
- Quality gates
|
|
18
|
+
- Software requirements and specifications
|
|
19
|
+
- Change management
|
|
20
|
+
- Verification
|
|
21
|
+
- Engineering metrics and KPIs
|
|
22
|
+
- Agent-based workflows
|
|
23
|
+
- MCP integration
|
|
24
|
+
|
|
25
|
+
`@aisdlc/core` contains the core functionality used by the AI-SDLC ecosystem.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @aisdlc/core
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or with pnpm:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pnpm add @aisdlc/core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or with yarn:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
yarn add @aisdlc/core
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
The core package is intended to be used as the foundation for AI-SDLC tooling, automation, and custom integrations.
|
|
48
|
+
|
|
49
|
+
```typescript
|
|
50
|
+
import {
|
|
51
|
+
verifyQualityGate,
|
|
52
|
+
verifyTraceability,
|
|
53
|
+
verifySecrets,
|
|
54
|
+
scaffoldSddChange,
|
|
55
|
+
generateDashboardReport,
|
|
56
|
+
} from '@aisdlc/core';
|
|
57
|
+
|
|
58
|
+
// 1. Run the deterministic Quality Gate on the codebase
|
|
59
|
+
const qualityResult = verifyQualityGate({
|
|
60
|
+
rootDir: process.cwd(),
|
|
61
|
+
});
|
|
62
|
+
console.log(`Quality gate passed: ${qualityResult.success}`);
|
|
63
|
+
|
|
64
|
+
// 2. Audit 360° Requirements Traceability Matrix
|
|
65
|
+
const traceResult = verifyTraceability({
|
|
66
|
+
rootDir: process.cwd(),
|
|
67
|
+
});
|
|
68
|
+
console.log(`Missing test coverage count: ${traceResult.missingTests}`);
|
|
69
|
+
|
|
70
|
+
// 3. Scan for exposed credentials and high-entropy secrets
|
|
71
|
+
const secretResult = verifySecrets({
|
|
72
|
+
rootDir: process.cwd(),
|
|
73
|
+
});
|
|
74
|
+
console.log(`Secret violations found: ${secretResult.violations.length}`);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## AI-SDLC architecture
|
|
78
|
+
|
|
79
|
+
The project separates the core engineering capabilities from its interfaces and integrations:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
AI-SDLC
|
|
83
|
+
│
|
|
84
|
+
┌─────────┴─────────┐
|
|
85
|
+
│ │
|
|
86
|
+
@aisdlc/core Integration layer
|
|
87
|
+
│ ┌─────┴─────┐
|
|
88
|
+
│ │ │
|
|
89
|
+
│ @aisdlc/mcp @aisdlc/cli
|
|
90
|
+
│
|
|
91
|
+
└──── Core engineering capabilities
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
This separation allows the core functionality to be reused by different interfaces and integrations.
|
|
95
|
+
|
|
96
|
+
## Core Capabilities
|
|
97
|
+
|
|
98
|
+
`@aisdlc/core` provides comprehensive domain logic, verification engines, and governance utilities across 7 functional categories:
|
|
99
|
+
|
|
100
|
+
### 1. Spec-Driven Development (SDD) & PDaC Architecture
|
|
101
|
+
|
|
102
|
+
| Capability | Description | Primary Exports |
|
|
103
|
+
| --- | --- | --- |
|
|
104
|
+
| **Change Scaffolding** | Deterministically scaffolds active SDD change packages (`proposal.md`, `spec.md`, `design.md`, `tasks.md`) with correlative numbering and canonical `handoff.yaml` sidecar. | `scaffoldSddChange`, `getNextCorrelativeNumber`, `slugify` |
|
|
105
|
+
| **Product Handoff Sidecars** | Generates, deposits, and validates canonical `handoff.yaml` (`HOF-*`) sidecars with cryptographic SHA-256 citations across active changes. | `depositProductHandoffSidecar`, `loadProductHandoffSidecar`, `scanAllProductHandoffs` |
|
|
106
|
+
| **Change Integration & Promotion** | Promotes approved requirements to the active baseline, links architecture components, applies proposals, and archives change workspaces. | `integrateSddChange`, `verifySddIntegration`, `detectActiveChangeForIntegration` |
|
|
107
|
+
| **SDD Framework Adapters** | Polymorphic abstraction layer supporting multiple SDD specification formats (OpenSpec and SpecKit) seamlessly. | `getSddAdapter`, `OpenSpecAdapter`, `SpecKitAdapter` |
|
|
108
|
+
| **PDaC Graph & Cryptographic Drift** | Constructs the Product Definition as Code graph and audits SHA-256 digests across specifications to detect out-of-sync drift. | `verifyPdacGraph`, `syncPdacDigests`, `computeCanonicalSha256`, `extractCitations` |
|
|
109
|
+
| **Progressive Friction & Anti-Bypass** | Enforces governance gates based on change risk profile (`patch`, `standard`, `critical`) and prevents unauthorized modifications to protected core paths. | `verifyProgressiveFriction`, `detectProfileFromChange`, `isPathProtectedFromPatch` |
|
|
110
|
+
|
|
111
|
+
### 2. Quality Gates & AST Code Metrics
|
|
112
|
+
|
|
113
|
+
| Capability | Description | Primary Exports |
|
|
114
|
+
| --- | --- | --- |
|
|
115
|
+
| **Deterministic Quality Gate** | Evaluates codebases against formal policies (`quality-policy.yaml`) across Cyclomatic Complexity, Cognitive Complexity, Maintainability Index, and function length. | `verifyQualityGate`, `createDefaultQualityPolicy`, `parseQualityPolicy` |
|
|
116
|
+
| **Polyglot & TypeScript AST Analysis** | Native AST-based function and class metric extraction for TypeScript/JavaScript, plus zero-heuristic parsing for Python, Go, Java, C#, C++, and Rust. | `extractFunctions`, `extractFunctionsTypeScriptAst`, `extractFunctionsPolyglot`, `calculateMetrics` |
|
|
117
|
+
|
|
118
|
+
### 3. Verification & Compliance Engines
|
|
119
|
+
|
|
120
|
+
| Capability | Description | Primary Exports |
|
|
121
|
+
| --- | --- | --- |
|
|
122
|
+
| **360° Requirements Traceability Matrix** | Audits bidirectional traceability links between Upstream Product Handoffs (`HOF`), Midstream Arc42 Components (`CMP`), and Downstream Acceptance Tests (`.feature`). | `verifyTraceability`, `generateTraceabilityReportMarkdown`, `parseFrontmatter` |
|
|
123
|
+
| **Task Governance & Human Review Plans** | Audits task completion status, human review checklists, and autonomy classification levels (`AUTONOMOUS`, `HUMAN_REVIEW_PLAN`, etc.). | `verifyTasksGovernance`, `generateGovernanceReportMarkdown`, `parseTasksDoc` |
|
|
124
|
+
| **Verification & Acceptance Test Coverage** | Verifies that 100% of defined requirements and engineering tasks have corresponding automated tests implemented on disk. | `verifyTestingCoverage`, `scanAllTestArtifacts`, `generateTestingCoverageReportMarkdown` |
|
|
125
|
+
| **Specification Schema Validation** | Validates Markdown frontmatter and structure against canonical JSON Schemas (Draft 2020-12) for proposals, specs, designs, and tasks. | `verifyArtifactsSchemas`, `validateArtifactSchema`, `validateAgainstSchema` |
|
|
126
|
+
| **Duplicate Requirements Detection** | Tokenizes and computes lexical similarity (Jaccard $\ge 85\%$), duplicate hashes, and BDD scenario collisions before code authoring. | `verifyArtifactDuplicates`, `calculateJaccardSimilarity`, `generateDuplicatesReportMarkdown` |
|
|
127
|
+
| **BDD Gherkin Synchronization** | Extracts ````gherkin```` blocks from Markdown specifications and synchronizes them to standalone executable `.feature` files under `tests/features/`. | `extractGherkinFeatures`, `checkGherkinInSync`, `extractGherkinBlock` |
|
|
128
|
+
|
|
129
|
+
### 4. Security & Software Supply Chain (SCA / SAST)
|
|
130
|
+
|
|
131
|
+
| Capability | Description | Primary Exports |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| **License Compliance & SCA** | Scans direct and transitive dependencies, maps SPDX identifiers against `license-policy.yaml`, and flags restricted/blocked licenses. | `verifyLicenses`, `scanInstalledLicenses`, `scanWithNativeFs`, `scanWithTrivy`, `scanWithSyft` |
|
|
134
|
+
| **SBOM & Third-Party Notices** | Generates enterprise-ready CycloneDX 1.5 JSON SBOMs and compiles complete markdown third-party license notices. | `generateCycloneDxSbom`, `writeCycloneDxSbom`, `generateThirdPartyNotices`, `writeThirdPartyNotices` |
|
|
135
|
+
| **Secret Scanning & Entropy Auditing** | Scans git diffs and codebase files for exposed API keys, private credentials, and high-entropy strings (Shannon entropy $\ge 4.3$). Supports Gitleaks CLI integration. | `verifySecrets`, `calculateShannonEntropy`, `runGitleaksCli`, `generateSecretsReportMarkdown` |
|
|
136
|
+
| **Static Application Security (SAST)** | AST and pattern analysis for OWASP Top 10 vulnerabilities (SQLi, command injection, SSRF, path traversal, prompt injection). Supports Semgrep CLI. | `verifySast`, `scanFileForSast`, `runSemgrepCli`, `detectPromptInjection` |
|
|
137
|
+
|
|
138
|
+
### 5. Git 4-Tier Workflow, Commit Trailers & Agent Detection
|
|
139
|
+
|
|
140
|
+
| Capability | Description | Primary Exports |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| **4-Tier Git Branch Management** | Classifies and orchestrates the 4-tier branch hierarchy (`main` $\rightarrow$ `release/*` $\rightarrow$ `feat/*` $\rightarrow$ `task/*`) to ensure isolation and discipline. | `classifyBranch`, `generateBranchHierarchyPlan` |
|
|
143
|
+
| **Automated Task Checkout** | Resolves task context from active SDD changes and automatically checkouts or cascades required branch tiers. | `checkoutTaskBranch`, `locateTaskInActiveChanges`, `resolveBranchHierarchy` |
|
|
144
|
+
| **Commit Trailer Engine** | Parses, formats, and validates standardized Git commit trailers (`Task-ID`, `Handoff-Digest`, `Model`, `Autonomy`). | `parseCommitTrailers`, `formatCommitTrailers`, `inferMissingTrailers`, `extractCommitKpisFromRange` |
|
|
145
|
+
| **AI Agent Author Detection** | Universally and IDE-independently detects whether git commits or active sessions originate from a human developer or an AI agent. | `detectAuthorIdentity` |
|
|
146
|
+
| **Git Hook Installer** | Programmatically installs deterministic Git hooks (e.g. `prepare-commit-msg`) for automated metadata injection. | `installGitHooks` |
|
|
147
|
+
|
|
148
|
+
### 6. Reporting, Engineering KPIs & Interactive Dashboard
|
|
149
|
+
|
|
150
|
+
| Capability | Description | Primary Exports |
|
|
151
|
+
| --- | --- | --- |
|
|
152
|
+
| **Interactive Offline Dashboard** | Generates a 100% self-contained offline HTML dashboard with Cytoscape.js interactive graph for visualizing the full PDaC and RTM network. | `generateDashboardReport`, `buildGraphElements`, `renderDashboardHtml` |
|
|
153
|
+
| **Formal Code Quality Reporting** | Compiles granular polyglot code quality analysis into structured Markdown reports (`reports/QUALITY_REPORT.md`). | `generateQualityReport`, `writeQualityReport`, `calculateRating` |
|
|
154
|
+
| **Pull Request KPIs & Telemetry** | Calculates human vs. AI agent contribution ratios, review cycle duration, and token usage, formatting them for PR templates. | `aggregatePrKpis`, `formatPrKpiMarkdown`, `injectKpisIntoPrBody` |
|
|
155
|
+
| **Release KPIs & Defect Injection Rate** | Computes release-level engineering metrics, Defect Injection Rate (DIR) per author/model, rework costs, and defect density. | `aggregateReleaseKpis`, `formatReleaseKpiMarkdown`, `writeReleaseKpiReport` |
|
|
156
|
+
|
|
157
|
+
### 7. Repository Scaffolding & Governance Initialization
|
|
158
|
+
|
|
159
|
+
| Capability | Description | Primary Exports |
|
|
160
|
+
| --- | --- | --- |
|
|
161
|
+
| **AI-SDLC Project Bootstrapping** | Configures policies (`quality-policy.yaml`, `license-policy.yaml`), schemas, arc42 architecture templates, CI workflows, and AI agent rules. | `initProject`, `resolveAgentTargets`, `collectAgentFiles` |
|
|
162
|
+
|
|
163
|
+
## When should I use this package?
|
|
164
|
+
|
|
165
|
+
Use @aisdlc/core when you are:
|
|
166
|
+
|
|
167
|
+
- Building tooling on top of AI-SDLC
|
|
168
|
+
- Integrating AI-SDLC into an existing engineering platform
|
|
169
|
+
- Creating custom AI-assisted development workflows
|
|
170
|
+
- Developing extensions or integrations
|
|
171
|
+
- Building your own interface over the AI-SDLC capabilities
|
|
172
|
+
|
|
173
|
+
If you simply want to use AI-SDLC from the command line, start with [@aisdlc/cli](https://www.npmjs.com/package/@aisdlc/cli).
|
|
174
|
+
|
|
175
|
+
If you want MCP integration, see [@aisdlc/mcp](https://www.npmjs.com/package/@aisdlc/mcp).
|
|
176
|
+
|
|
177
|
+
## Related packages
|
|
178
|
+
|
|
179
|
+
| Package | Purpose |
|
|
180
|
+
| :--- | :--- |
|
|
181
|
+
| [@aisdlc/core](https://www.npmjs.com/package/@aisdlc/core) | Core AI-SDLC capabilities |
|
|
182
|
+
| [@aisdlc/cli](https://www.npmjs.com/package/@aisdlc/cli) | Command-line interface |
|
|
183
|
+
| [@aisdlc/mcp](https://www.npmjs.com/package/@aisdlc/mcp) | MCP integration |
|
|
184
|
+
|
|
185
|
+
## Project
|
|
186
|
+
|
|
187
|
+
AI-SDLC is an open-source project:
|
|
188
|
+
|
|
189
|
+
### GitHub: <https://github.com/altromon/AI-SDLC>
|
|
190
|
+
|
|
191
|
+
For architecture, governance, processes and the complete project documentation, see the repository.
|
|
192
|
+
|
|
193
|
+
## Contributing
|
|
194
|
+
|
|
195
|
+
Contributions, issues and architectural discussions are welcome.
|
|
196
|
+
|
|
197
|
+
Please see the GitHub repository for contribution guidelines and development information.
|
|
198
|
+
|
|
199
|
+
## License
|
|
200
|
+
|
|
201
|
+
See the repository license for the current licensing terms.
|