@iservu-inc/adf-cli 0.14.6 → 0.17.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.
Files changed (37) hide show
  1. package/.project/chats/current/SESSION-STATUS.md +25 -279
  2. package/.project/docs/PHASE-6-ADVANCED-LEARNING.md +46 -0
  3. package/.project/docs/ROADMAP.md +72 -157
  4. package/.project/docs/designs/CUSTOM-ARTIFACT-UPLOAD.md +259 -0
  5. package/.project/docs/designs/LEARNING-RULES-EXCHANGE.md +77 -0
  6. package/CHANGELOG.md +2054 -2995
  7. package/README.md +4 -7
  8. package/bin/adf.js +80 -0
  9. package/conductor/tracks/session_resume_review_20260113/plan.md +18 -0
  10. package/conductor/tracks.md +4 -0
  11. package/gemini.md +3 -0
  12. package/lib/ai/ai-client.js +9 -9
  13. package/lib/commands/deploy.js +14 -0
  14. package/lib/commands/guide.js +32 -0
  15. package/lib/commands/import.js +439 -0
  16. package/lib/commands/init.js +17 -4
  17. package/lib/frameworks/interviewer.js +277 -85
  18. package/lib/frameworks/progress-tracker.js +18 -0
  19. package/lib/generators/a2a-generator.js +289 -0
  20. package/lib/generators/index.js +11 -0
  21. package/lib/learning/learning-manager.js +107 -8
  22. package/lib/learning/rules-exporter.js +103 -0
  23. package/lib/learning/rules-importer.js +141 -0
  24. package/lib/templates/shared/agents/analyst.md +1 -1
  25. package/lib/templates/shared/agents/architect.md +1 -1
  26. package/lib/templates/shared/agents/dev.md +1 -1
  27. package/lib/templates/shared/agents/pm.md +2 -2
  28. package/lib/templates/shared/agents/qa.md +1 -1
  29. package/lib/templates/shared/agents/sm.md +3 -3
  30. package/lib/templates/shared/memory/constitution.md +2 -2
  31. package/lib/templates/shared/templates/README.md +14 -14
  32. package/lib/templates/shared/templates/prd-template.md +1 -1
  33. package/lib/utils/artifact-detector.js +253 -0
  34. package/lib/utils/tool-feature-registry.js +6 -0
  35. package/package.json +1 -1
  36. package/tests/a2a-generator.test.js +288 -0
  37. package/tests/progress-tracker.test.js +16 -0
@@ -0,0 +1,259 @@
1
+ # Custom Artifact Upload Feature
2
+
3
+ ## Overview
4
+
5
+ Allow users to import existing markdown documentation (PRDs, design docs, specifications, architecture documents) from projects that have already undergone formal artifact generation outside of ADF's built-in frameworks (PRP, Balanced, BMAD).
6
+
7
+ ## Problem Statement
8
+
9
+ Many projects already have:
10
+ - Product Requirements Documents (PRDs) from Confluence, Notion, or Google Docs
11
+ - Architecture Decision Records (ADRs)
12
+ - Technical Design Documents (TDDs)
13
+ - API Specifications (OpenAPI/Swagger converted to markdown)
14
+ - User Story documents from Jira/Linear exports
15
+ - Custom specification formats from enterprise tools
16
+
17
+ Currently, ADF requires users to go through the full interview process even when comprehensive documentation already exists. This creates friction for teams with established documentation workflows.
18
+
19
+ ## Solution
20
+
21
+ Add an `adf import` command that:
22
+ 1. Accepts one or more markdown files as input
23
+ 2. Categorizes them into artifact types (PRD, Architecture, Stories, Tasks, Custom)
24
+ 3. Creates a synthetic session with the imported artifacts
25
+ 4. Makes them available for deployment to any supported tool
26
+
27
+ ## Command Interface
28
+
29
+ ```bash
30
+ # Import single file
31
+ adf import ./docs/PRD.md
32
+
33
+ # Import multiple files
34
+ adf import ./docs/PRD.md ./docs/architecture.md ./docs/tasks.md
35
+
36
+ # Import entire directory
37
+ adf import ./docs/
38
+
39
+ # Import with explicit type mapping
40
+ adf import ./docs/PRD.md --type prd
41
+ adf import ./docs/design.md --type architecture
42
+ adf import ./docs/backlog.md --type stories
43
+
44
+ # Import with custom artifact type
45
+ adf import ./docs/compliance.md --type custom --name "Compliance Requirements"
46
+
47
+ # Interactive mode (prompts for type of each file)
48
+ adf import ./docs/*.md --interactive
49
+ ```
50
+
51
+ ## Artifact Type Detection
52
+
53
+ ### Auto-Detection Heuristics
54
+
55
+ The system will attempt to auto-detect artifact types based on:
56
+
57
+ 1. **Filename patterns:**
58
+ - `*prd*`, `*requirements*`, `*product-req*` → PRD
59
+ - `*arch*`, `*design*`, `*technical*`, `*system*` → Architecture
60
+ - `*stories*`, `*user-stories*`, `*backlog*` → Stories
61
+ - `*tasks*`, `*implementation*`, `*todo*`, `*work-items*` → Tasks
62
+ - `*spec*`, `*specification*` → Specification
63
+ - `*constitution*`, `*guidelines*`, `*standards*` → Constitution
64
+
65
+ 2. **Content analysis (first 500 lines):**
66
+ - Headers containing "Requirements", "User Stories", "Architecture"
67
+ - Presence of story formats (As a... I want... So that...)
68
+ - Task list patterns (- [ ], checkboxes, numbered implementation steps)
69
+ - Technical diagrams (mermaid, plantuml references)
70
+
71
+ 3. **Frontmatter metadata:**
72
+ ```yaml
73
+ ---
74
+ type: prd
75
+ title: Product Requirements Document
76
+ version: 1.0
77
+ ---
78
+ ```
79
+
80
+ ### Supported Artifact Types
81
+
82
+ | Type | Description | Maps To |
83
+ |------|-------------|---------|
84
+ | `prd` | Product Requirements Document | `outputs/prd.md` |
85
+ | `architecture` | System/Technical Architecture | `outputs/architecture.md` |
86
+ | `stories` | User Stories / Backlog | `outputs/stories.md` |
87
+ | `tasks` | Implementation Tasks | `outputs/tasks.md` |
88
+ | `specification` | Feature Specification | `outputs/specification.md` |
89
+ | `constitution` | Quality Standards/Guidelines | `outputs/constitution.md` |
90
+ | `plan` | Technical/Project Plan | `outputs/plan.md` |
91
+ | `prp` | Agent-Native PRP Document | `outputs/prp.md` |
92
+ | `custom` | Custom artifact (user-named) | `outputs/custom/{name}.md` |
93
+
94
+ ## Session Creation
95
+
96
+ Imported artifacts create a synthetic session:
97
+
98
+ ```
99
+ .adf/sessions/{timestamp}_imported/
100
+ ├── _metadata.json
101
+ │ {
102
+ │ "framework": "imported",
103
+ │ "importedAt": "2026-01-21T...",
104
+ │ "sourceFiles": ["./docs/PRD.md", "./docs/arch.md"],
105
+ │ "artifactTypes": ["prd", "architecture"],
106
+ │ "projectPath": "/path/to/project"
107
+ │ }
108
+ ├── _progress.json
109
+ │ {
110
+ │ "status": "completed",
111
+ │ "importedArtifacts": 2
112
+ │ }
113
+ ├── outputs/
114
+ │ ├── prd.md # Copied/normalized from source
115
+ │ ├── architecture.md # Copied/normalized from source
116
+ │ └── custom/
117
+ │ └── compliance.md # Custom artifacts in subdirectory
118
+ └── sources/
119
+ ├── original_PRD.md # Original files preserved
120
+ └── original_arch.md
121
+ ```
122
+
123
+ ## Content Normalization
124
+
125
+ Imported files undergo light normalization:
126
+
127
+ 1. **Header standardization:** Ensure H1 title exists
128
+ 2. **Frontmatter injection:** Add ADF metadata if missing
129
+ 3. **Section markers:** Add section IDs for deployment parsing
130
+ 4. **Link resolution:** Convert relative links to absolute where possible
131
+ 5. **Image handling:** Copy referenced images to session directory
132
+
133
+ ### Normalization Example
134
+
135
+ **Input:**
136
+ ```markdown
137
+ # My PRD
138
+
139
+ ## Overview
140
+ This document describes...
141
+ ```
142
+
143
+ **Output:**
144
+ ```markdown
145
+ ---
146
+ adf_type: prd
147
+ adf_imported: true
148
+ adf_source: ./docs/PRD.md
149
+ adf_imported_at: 2026-01-21T10:30:00Z
150
+ ---
151
+
152
+ # My PRD
153
+
154
+ <!-- adf:section:overview -->
155
+ ## Overview
156
+ This document describes...
157
+ ```
158
+
159
+ ## Integration with Deploy
160
+
161
+ Imported sessions are treated identically to interview-generated sessions:
162
+
163
+ ```bash
164
+ # After import
165
+ adf import ./docs/PRD.md ./docs/architecture.md
166
+
167
+ # Deploy works normally
168
+ adf deploy windsurf
169
+ adf deploy cursor
170
+ adf deploy --all
171
+ ```
172
+
173
+ The deploy command:
174
+ 1. Finds the latest session (imported or interview-generated)
175
+ 2. Loads outputs from the session
176
+ 3. Generates tool-specific configurations
177
+
178
+ ## Merge with Existing Sessions
179
+
180
+ Users can augment an existing interview session with additional artifacts:
181
+
182
+ ```bash
183
+ # Add architecture doc to existing session
184
+ adf import ./docs/architecture.md --session latest
185
+
186
+ # Add to specific session
187
+ adf import ./docs/architecture.md --session 20260115_120000_balanced
188
+ ```
189
+
190
+ ## Implementation Plan
191
+
192
+ ### Phase 1: Core Import Command
193
+ - [ ] Create `lib/commands/import.js`
194
+ - [ ] Implement file reading and validation
195
+ - [ ] Add artifact type detection heuristics
196
+ - [ ] Create synthetic session structure
197
+ - [ ] Basic content normalization
198
+
199
+ ### Phase 2: Enhanced Detection
200
+ - [ ] Add content-based type detection
201
+ - [ ] Support frontmatter parsing
202
+ - [ ] Implement confidence scoring for type detection
203
+ - [ ] Add `--interactive` mode for manual type selection
204
+
205
+ ### Phase 3: Deployment Integration
206
+ - [ ] Update `ToolConfigGenerator` to handle imported sessions
207
+ - [ ] Ensure all generators support `framework: "imported"`
208
+ - [ ] Test deployment across all 12+ supported tools
209
+
210
+ ### Phase 4: Advanced Features
211
+ - [ ] Directory scanning with glob patterns
212
+ - [ ] Session merging (`--session` flag)
213
+ - [ ] Image and asset handling
214
+ - [ ] Link resolution and validation
215
+ - [ ] Export back to original format (round-trip)
216
+
217
+ ## CLI Help Text
218
+
219
+ ```
220
+ Usage: adf import [options] <files...>
221
+
222
+ Import existing markdown documentation into ADF
223
+
224
+ Arguments:
225
+ files Markdown files or directories to import
226
+
227
+ Options:
228
+ -t, --type <type> Artifact type (prd, architecture, stories, tasks, spec, custom)
229
+ -n, --name <name> Custom artifact name (used with --type custom)
230
+ -s, --session <id> Merge into existing session (use 'latest' for most recent)
231
+ -i, --interactive Prompt for type of each file
232
+ --no-normalize Skip content normalization
233
+ --dry-run Show what would be imported without creating session
234
+ -h, --help Display help for command
235
+
236
+ Examples:
237
+ $ adf import ./docs/PRD.md
238
+ $ adf import ./docs/*.md --interactive
239
+ $ adf import ./design.md --type architecture
240
+ $ adf import ./compliance.md --type custom --name "Compliance Requirements"
241
+ $ adf import ./docs/stories.md --session latest
242
+ ```
243
+
244
+ ## Success Criteria
245
+
246
+ 1. Users can import any markdown file as an ADF artifact
247
+ 2. Auto-detection correctly identifies common artifact types (>80% accuracy)
248
+ 3. Imported sessions deploy successfully to all supported tools
249
+ 4. Original files are preserved in `sources/` directory
250
+ 5. Merge with existing sessions works without data loss
251
+ 6. `--dry-run` provides accurate preview of import results
252
+
253
+ ## Future Considerations
254
+
255
+ - Support for non-markdown formats (PDF, DOCX, HTML) via conversion
256
+ - Integration with external tools (Notion API, Confluence API, Jira export)
257
+ - AI-assisted type detection and content summarization
258
+ - Bidirectional sync with source documents
259
+ - Version tracking for re-imported documents
@@ -0,0 +1,77 @@
1
+ # Design Specification: Learning Rules Exchange (Export/Import)
2
+
3
+ ## 1. Overview
4
+ The Learning Rules Exchange system allows developers to share AI-learned preferences and skip patterns across team members or different environments. By exporting high-confidence rules to a portable JSON format, teams can standardize their AI-assisted interview experience.
5
+
6
+ ## 2. Data Structure
7
+
8
+ ### 2.1 Rule Export Format (JSON)
9
+ ```json
10
+ {
11
+ "version": "1.0",
12
+ "metadata": {
13
+ "exportedBy": "String",
14
+ "exportedAt": "ISO-8601 Timestamp",
15
+ "projectType": "String (optional)",
16
+ "ruleCount": "Number",
17
+ "sourceFrameworks": ["Array of Strings"]
18
+ },
19
+ "rules": [
20
+ {
21
+ "id": "String (UUID)",
22
+ "questionId": "String",
23
+ "questionText": "String",
24
+ "category": "String",
25
+ "confidence": "Number (0-100)",
26
+ "type": "String (consistent_skip|category_skip|framework_skip)",
27
+ "recommendation": "String",
28
+ "origin": {
29
+ "sessionsAnalyzed": "Number",
30
+ "createdAt": "Timestamp"
31
+ }
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ ## 3. Core Features
38
+
39
+ ### 3.1 Export Process
40
+ - **Filter**: Only export high-confidence rules (default ≥75%).
41
+ - **Metadata**: Attach environment context (ADF version, project type) to help importers understand relevance.
42
+ - **Atomic Save**: Generate a single file (e.g., `adf-rules-2026-01-13.json`).
43
+
44
+ ### 3.2 Import Process & Merge Strategies
45
+ When importing, users must choose how to handle conflicts with existing local rules:
46
+
47
+ 1. **Replace (Overwrite)**: Deletes all local rules and replaces them with the imported set.
48
+ 2. **Merge (Append Unique)**: Adds new rules from the file. If a rule for the same `questionId` exists, it keeps the one with the higher confidence score.
49
+ 3. **Skip Duplicates**: Only adds rules for questions that don't already have a local rule.
50
+
51
+ ### 3.3 Validation & Security
52
+ - **Schema Validation**: Verify JSON structure before parsing.
53
+ - **Sanitization**: Strip any potential script injection in string fields (questionText, recommendation).
54
+ - **Provenance**: Track that a rule was "imported" in its local metadata to allow filtering/removal later.
55
+
56
+ ## 4. CLI Interface
57
+
58
+ ### 4.1 Integration into `adf config`
59
+ **Learning System Menu additions:**
60
+ - `[ ] Export Learned Rules`: Prompts for destination path.
61
+ - `[ ] Import Rules from File`: Prompts for file path and merge strategy.
62
+
63
+ ### 4.2 User Experience
64
+ - **Summary Before Import**: Show "Found 15 rules. 10 new, 5 existing. Strategy: Merge."
65
+ - **Confirmation**: "Apply these rules to your learning system? (y/n)"
66
+
67
+ ## 5. Implementation Plan
68
+
69
+ 1. **Exporter**: `lib/learning/rules-exporter.js`
70
+ - Logic to extract from `storage.js` and format JSON.
71
+ 2. **Importer**: `lib/learning/rules-importer.js`
72
+ - Logic to parse, validate, and apply merge strategies.
73
+ 3. **UI Integration**: `lib/learning/learning-manager.js`
74
+ - Add menu items and prompt logic.
75
+
76
+ ---
77
+ *Status: DESIGN COMPLETE*