ai-dev-workflow 0.1.0__tar.gz

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 (41) hide show
  1. ai_dev_workflow-0.1.0/PKG-INFO +348 -0
  2. ai_dev_workflow-0.1.0/README.md +334 -0
  3. ai_dev_workflow-0.1.0/pyproject.toml +48 -0
  4. ai_dev_workflow-0.1.0/setup.cfg +4 -0
  5. ai_dev_workflow-0.1.0/tests/test_ado_provider.py +50 -0
  6. ai_dev_workflow-0.1.0/tests/test_ai_provider.py +59 -0
  7. ai_dev_workflow-0.1.0/tests/test_ai_workflow_cli.py +62 -0
  8. ai_dev_workflow-0.1.0/tests/test_bootstrap_project.py +38 -0
  9. ai_dev_workflow-0.1.0/tests/test_codespaces_environment.py +32 -0
  10. ai_dev_workflow-0.1.0/tests/test_codex_cloud_executor.py +82 -0
  11. ai_dev_workflow-0.1.0/tests/test_composite_work_item.py +74 -0
  12. ai_dev_workflow-0.1.0/tests/test_connection_and_mcp.py +63 -0
  13. ai_dev_workflow-0.1.0/tests/test_framework_update.py +100 -0
  14. ai_dev_workflow-0.1.0/tests/test_general_init.py +88 -0
  15. ai_dev_workflow-0.1.0/tests/test_issue_publisher.py +81 -0
  16. ai_dev_workflow-0.1.0/tests/test_package_install.py +20 -0
  17. ai_dev_workflow-0.1.0/tests/test_planning_context.py +75 -0
  18. ai_dev_workflow-0.1.0/tests/test_queue_dispatcher.py +633 -0
  19. ai_dev_workflow-0.1.0/tests/test_setup_wizard.py +64 -0
  20. ai_dev_workflow-0.1.0/tests/test_worker_registry.py +69 -0
  21. ai_dev_workflow-0.1.0/tools/ado_mcp.py +49 -0
  22. ai_dev_workflow-0.1.0/tools/ado_provider.py +245 -0
  23. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/PKG-INFO +348 -0
  24. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/SOURCES.txt +39 -0
  25. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/dependency_links.txt +1 -0
  26. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/entry_points.txt +2 -0
  27. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/requires.txt +1 -0
  28. ai_dev_workflow-0.1.0/tools/ai_dev_workflow.egg-info/top_level.txt +15 -0
  29. ai_dev_workflow-0.1.0/tools/ai_provider.py +149 -0
  30. ai_dev_workflow-0.1.0/tools/ai_workflow_cli.py +761 -0
  31. ai_dev_workflow-0.1.0/tools/composite_work_item.py +62 -0
  32. ai_dev_workflow-0.1.0/tools/framework_update.py +145 -0
  33. ai_dev_workflow-0.1.0/tools/github_work_item_provider.py +134 -0
  34. ai_dev_workflow-0.1.0/tools/issue_publisher.py +243 -0
  35. ai_dev_workflow-0.1.0/tools/planning_context.py +151 -0
  36. ai_dev_workflow-0.1.0/tools/setup_context.py +99 -0
  37. ai_dev_workflow-0.1.0/tools/setup_wizard.py +221 -0
  38. ai_dev_workflow-0.1.0/tools/source_connection.py +21 -0
  39. ai_dev_workflow-0.1.0/tools/work_item_provider.py +20 -0
  40. ai_dev_workflow-0.1.0/tools/work_item_registry.py +25 -0
  41. ai_dev_workflow-0.1.0/tools/worker_registry.py +170 -0
@@ -0,0 +1,348 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-dev-workflow
3
+ Version: 0.1.0
4
+ Summary: Provider-neutral AI-assisted development workflow and CLI
5
+ Author: vuthethienlong
6
+ Project-URL: Homepage, https://github.com/vuthethienlong/ai-dev-workflow
7
+ Project-URL: Repository, https://github.com/vuthethienlong/ai-dev-workflow
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3 :: Only
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: PyYAML>=6.0
14
+
15
+ # AI Dev Workflow
16
+
17
+ Reusable, provider-neutral workflow for AI-assisted software development.
18
+
19
+ This repository starts from the workflow proven in the Dragon's Dogma 2 project and keeps Superpowers-style artifacts as first-class inputs: brainstorming, spec, ADR, implementation plan, tests, PR evidence and runtime verification.
20
+
21
+ ## Default lifecycle
22
+
23
+ ```text
24
+ Brainstorm
25
+ -> Spec
26
+ -> ADR (when needed)
27
+ -> Issue Ready Freeze
28
+ -> Implementation Plan
29
+ -> TesterAgent writes executable tests
30
+ -> RED
31
+ -> ImplementerAgent implements
32
+ -> GREEN + regression
33
+ -> ReviewerAgent (optional/manual by default)
34
+ -> Integration
35
+ -> Runtime verification batch when required
36
+ -> Promotion / Done
37
+ ```
38
+
39
+ ## Roles
40
+
41
+ - `ArchitectAgent`: brainstorm, spec, ADR and acceptance criteria.
42
+ - `TesterAgent`: derives tests from the frozen contract and proves RED before implementation.
43
+ - `ImplementerAgent`: implements without changing the frozen test contract; must reach GREEN and run applicable regression checks.
44
+ - `ReviewerAgent`: optional semantic/architecture reviewer. Disabled/manual by default in v1.
45
+ - `RuntimeVerifierAgent`: optional, project-specific runtime verification role.
46
+
47
+ A role is not a model. GPT, Codex, Claude, local models or future providers are replaceable adapters under these contracts.
48
+
49
+ ## Core rules
50
+
51
+ - Work item is the task source of truth through a configurable WorkItemProvider (GitHub Issues or Azure DevOps).
52
+ - `Ready` is the commitment/freeze boundary.
53
+ - Test design happens before implementation.
54
+ - Implementer may report a bad test/spec as blocked, but must not rewrite expectations merely to make tests pass.
55
+ - Deterministic CI gates run before optional semantic AI review.
56
+ - Runtime verification is separate from offline/CI verification.
57
+ - Projects consume versioned reusable workflows such as `@v1`; they do not copy the engine.
58
+
59
+ ## Consumer project
60
+
61
+ A project keeps only project-specific context/config:
62
+
63
+ ```text
64
+ AGENTS.md
65
+ CURRENT.md (optional bootstrap/router)
66
+ .ai-workflow.yml
67
+ .github/workflows/ai.yml
68
+ project tests/runtime rules
69
+ ```
70
+
71
+ Its caller workflow will reference this repository's reusable workflow.
72
+
73
+ See:
74
+ - `AGENTS.md`
75
+ - `docs/lifecycle.md`
76
+ - `docs/agent-contracts.md`
77
+ - `docs/tdd-handoff.md`
78
+ - `.ai-workflow.example.yml`
79
+
80
+ Refs #1
81
+
82
+
83
+ ## Execution environments
84
+
85
+ Execution environments are provider-neutral. The first supported project contract is GitHub Codespaces with three modes:
86
+
87
+ - `off`: never use Codespaces.
88
+ - `on-demand`: provision/start a Codespace only when a routed task requires it.
89
+ - `always-on`: keep a Codespace available according to project policy.
90
+
91
+ The recommended default is `on-demand`.
92
+
93
+ Agent role, provider and environment are independent dimensions. For example, `ImplementerAgent` may run through different provider adapters while using the same Codespaces workspace.
94
+
95
+
96
+ ## Project bootstrap
97
+
98
+ The central framework owns the shared repository metadata contract.
99
+
100
+ Consumer repositories can run the reusable `bootstrap-project.yml` workflow to create or update the managed workflow labels. Bootstrap is idempotent and does not delete project-specific labels.
101
+
102
+ Managed labels currently include:
103
+ - workflow states: `status:ready`, `status:in-progress`, `status:blocked`, `status:in-review`, `status:runtime-pending`, `status:release-pending`;
104
+ - priorities: `priority:P0`, `priority:P1`, `priority:P2`.
105
+
106
+ This keeps label semantics portable when the framework or a project is copied to another repository/account.
107
+
108
+
109
+ ## Workspace planning context
110
+
111
+ Multi-repository brainstorming uses a workspace registry in `.ai-workspace.yml`.
112
+
113
+ Before a work item is published, the Planning Context Resolver normalizes:
114
+ - repositories and their purpose/ref/access;
115
+ - context paths relevant to architecture/brainstorming;
116
+ - the default target repository;
117
+ - GitHub Project identity;
118
+ - logical initiatives and repository-local milestone mappings.
119
+
120
+ ArchitectAgent then emits a planning decision identifying the correct target repository, affected repositories, initiative/release, dependencies, issue type, and runtime requirement.
121
+
122
+ This keeps brainstorming portable across ChatGPT, Claude, Codex, local models, or future providers and prevents repository selection from depending on model memory.
123
+
124
+
125
+ ## Azure DevOps initialization
126
+
127
+ Azure DevOps is supported through the provider-neutral WorkItemProvider boundary.
128
+
129
+ Run:
130
+
131
+ ```bash
132
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow init-ado \
133
+ --organization <org> \
134
+ --project <project>
135
+ ```
136
+
137
+ The initializer discovers the project's current process, Work Item Types, and all visible states through Azure DevOps REST API 7.1. It writes explicit per-WIT state mappings into `.ai-workflow.yml`; runtime execution does not guess custom state meanings.
138
+
139
+ Role/provider assignments can be supplied during init:
140
+
141
+ ```bash
142
+ ./bin/ai-workflow init-ado \
143
+ --organization <org> \
144
+ --project <project> \
145
+ --role-provider ArchitectAgent=claude \
146
+ --role-provider TesterAgent=codex \
147
+ --role-provider ImplementerAgent=codex
148
+ ```
149
+
150
+ Validate later with:
151
+
152
+ ```bash
153
+ ./bin/ai-workflow doctor \
154
+ --config .ai-workflow.yml \
155
+ --discovery .ai-workflow.yml.ado-discovery.json
156
+ ```
157
+
158
+ Doctor fails when ADO introduces a visible state that has no explicit mapping, when no ADO state maps to the canonical `ready` or `completed` state, or when required agent roles have no provider.
159
+
160
+
161
+ ## Plugin-style repository initialization
162
+
163
+ Existing repositories can install the workflow with one command:
164
+
165
+ ```bash
166
+ ./bin/ai-workflow init \
167
+ --work-items github-issues \
168
+ --environment codespaces \
169
+ --codespaces-mode on-demand
170
+ ```
171
+
172
+ For Azure DevOps:
173
+
174
+ ```bash
175
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow init \
176
+ --work-items azure-devops \
177
+ --ado-organization <org> \
178
+ --ado-project <project> \
179
+ --environment codespaces \
180
+ --role-provider ArchitectAgent=claude \
181
+ --role-provider TesterAgent=codex \
182
+ --role-provider ImplementerAgent=codex
183
+ ```
184
+
185
+ The initializer updates only workflow-owned configuration sections and preserves unrelated custom YAML. It creates missing `AGENTS.md`, `CURRENT.md`, Codespaces devcontainer, and GitHub workflow caller stubs without overwriting existing project files unless `--force` is supplied. Doctor validation runs after init.
186
+
187
+
188
+ ## Guided setup wizard
189
+
190
+ For first-time installation, prefer the step-by-step setup flow over raw `init` flags:
191
+
192
+ ```bash
193
+ GH_TOKEN=... ./bin/ai-workflow setup \
194
+ --work-items github-issues \
195
+ --github-repository owner/repo \
196
+ --environment codespaces
197
+ ```
198
+
199
+ For Azure DevOps:
200
+
201
+ ```bash
202
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow setup \
203
+ --work-items azure-devops \
204
+ --ado-organization <org> \
205
+ --ado-project <project> \
206
+ --environment codespaces
207
+ ```
208
+
209
+ Setup runs eight phases: repository context analysis, provider selection, current-status discovery, mapping confirmation, workflow policy, agent assignment, environment/credential guidance, then doctor/apply.
210
+
211
+ The setup context is exposed through a provider-neutral `SetupAgent` contract so an AI provider can recommend project-specific defaults after reading existing docs/tests/workflows. GitHub setup discovers existing labels and maps status-like labels; Azure DevOps setup discovers states per Work Item Type. Mapping is persisted explicitly and is never guessed during runtime.
212
+
213
+ Use `--plan-only` to generate `.ai-setup-plan.yml` without applying repository changes, or `--non-interactive` for automation.
214
+
215
+
216
+ ## AI provider registry
217
+
218
+ Agent roles reference provider IDs. Provider type, endpoint, model and authentication are configured separately.
219
+
220
+ Examples:
221
+
222
+ ```bash
223
+ ./bin/ai-workflow setup ... \
224
+ --ai-provider codex=chatgpt-codex,model=gpt-5.6-codex \
225
+ --ai-provider openai=openai,model=gpt-5.6,auth=api-key-env,env=OPENAI_API_KEY \
226
+ --ai-provider claude=anthropic,model=claude-sonnet,auth=api-key-env,env=ANTHROPIC_API_KEY \
227
+ --ai-provider litellm=litellm,base_url=http://litellm:4000/v1,auth=bearer-env,env=LITELLM_API_KEY \
228
+ --ai-provider local=local-openai-compatible,base_url=http://host.docker.internal:11434/v1,model=qwen-local,auth=none \
229
+ --role-provider ImplementerAgent=local
230
+ ```
231
+
232
+ Supported provider types are `openai`, `chatgpt-codex`, `anthropic`, `litellm`, `openai-compatible`, `local-openai-compatible`, and `interactive`.
233
+
234
+ Authentication is an independent strategy: `chatgpt-oauth`, `api-key-env`, `bearer-env`, or `none`. Secrets are never written into project configuration; configuration stores only the environment variable name or interactive auth strategy.
235
+
236
+
237
+ ## Connection-first setup
238
+
239
+ Guided setup now connects the source host before repository/provider discovery.
240
+
241
+ GitHub authentication supports:
242
+
243
+ - `gh-cli` (default): reuse the authenticated GitHub CLI OAuth session from `gh auth login`;
244
+ - `token-env`: read a PAT/token from an environment variable such as `GH_TOKEN`.
245
+
246
+ SSH keys remain valid for Git fetch/push but are not used as GitHub API/WorkItem authentication.
247
+
248
+ Example:
249
+
250
+ ```bash
251
+ gh auth login
252
+ ./bin/ai-workflow setup \
253
+ --github-auth gh-cli \
254
+ --github-repository owner/repo \
255
+ --work-items github-issues
256
+ ```
257
+
258
+ The WorkItemProvider is selected from a registry. Built-ins are currently `github-issues` and `azure-devops`; core validation is registry-based so future providers can be added without changing canonical workflow states.
259
+
260
+ ### Azure DevOps MCP
261
+
262
+ When Azure DevOps is the WorkItemProvider, setup can also configure Microsoft's Azure DevOps MCP connection for agents.
263
+
264
+ Remote MCP is the default:
265
+
266
+ ```bash
267
+ ./bin/ai-workflow setup \
268
+ --github-repository owner/repo \
269
+ --work-items azure-devops \
270
+ --ado-organization contoso \
271
+ --ado-project App \
272
+ --ado-mcp-mode remote \
273
+ --ado-mcp-auth interactive
274
+ ```
275
+
276
+ Local stdio MCP remains available with `--ado-mcp-mode local`. Supported MCP auth modes are `interactive`, `azcli`, `env`, `envvar`, and `pat`. Secrets are represented only by auth strategy/environment requirements and are never written to project configuration.
277
+
278
+
279
+ ## Worker registration
280
+
281
+ Setup can register local, Codespaces, or cloud workers separately from AI provider configuration.
282
+
283
+ Example local hybrid worker:
284
+
285
+ ```bash
286
+ ./bin/ai-workflow setup ... \
287
+ --worker desktop=hybrid,provider=local,environment=local,roles=ArchitectAgent|ImplementerAgent,assignee=my-github-login,planning_updates=approval-required
288
+ ```
289
+
290
+ Example Codespaces executor:
291
+
292
+ ```bash
293
+ ./bin/ai-workflow setup ... \
294
+ --worker cs=executor,provider=codex,environment=codespaces,roles=TesterAgent|ImplementerAgent,capacity=2
295
+ ```
296
+
297
+ Planner/hybrid workers can connect directly to the configured WorkItemProvider (for example Azure DevOps MCP) to read current work items, analyze repository/work-item context, brainstorm, and propose updates. Planning mutations default to approval-required; frozen ready contracts cannot be silently changed. Executor/hybrid workers project into the existing queue-dispatcher worker registry and follow the reservation → provider accepted → in-progress lifecycle.
298
+
299
+
300
+ ## Complete setup documentation
301
+
302
+ For the full first-run and customization guide, see:
303
+
304
+ - `docs/setup-guide.md` — human-readable step-by-step setup, examples, credentials, providers, workers, ADO/GitHub, Codespaces/local and multi-repo.
305
+ - `docs/setup-agent-playbook.md` — canonical AI-readable SetupAgent playbook, invariants, approval boundaries and customization contract.
306
+
307
+ Recommended workflow:
308
+
309
+ ```text
310
+ AI or user reads setup guide/playbook
311
+ → run setup --plan-only
312
+ → review discovered status/WIT mappings and recommendations
313
+ → approve/customize
314
+ → run setup/apply
315
+ → configure required secrets/sign-ins
316
+ → doctor
317
+ ```
318
+
319
+ The setup flow is customizable, but provider-specific states, credential values and frozen-contract changes must never be silently guessed.
320
+
321
+
322
+ ## Updating the framework
323
+
324
+ Use `./bin/ai-workflow update --check` to inspect the configured framework ref, and `./bin/ai-workflow update --to <ref>` to update framework-managed files and schema metadata. Project-owned configuration and files are preserved; locally modified managed files are skipped unless `--force` is explicitly used. See `docs/setup-guide.md` for the full update and migration rules.
325
+
326
+
327
+ ## Install from PyPI
328
+
329
+ Once a release is published to PyPI, consumers do not need to clone this repository:
330
+
331
+ ```bash
332
+ python -m pip install --upgrade ai-dev-workflow
333
+ ai-workflow --help
334
+ ai-workflow setup
335
+ ```
336
+
337
+ The GitHub repository may remain private because normal consumers install the built distribution from PyPI rather than cloning the source repository.
338
+
339
+ On another machine, install Python 3.10+ and run the same `pip install ai-dev-workflow` command. Project-specific configuration remains in each consumer repository.
340
+
341
+ Framework CLI/package upgrades and project installation upgrades are separate:
342
+
343
+ ```bash
344
+ python -m pip install --upgrade ai-dev-workflow
345
+ ai-workflow update
346
+ ```
347
+
348
+ The first command upgrades the installed CLI package. The second migrates/updates the workflow installation in the current project.
@@ -0,0 +1,334 @@
1
+ # AI Dev Workflow
2
+
3
+ Reusable, provider-neutral workflow for AI-assisted software development.
4
+
5
+ This repository starts from the workflow proven in the Dragon's Dogma 2 project and keeps Superpowers-style artifacts as first-class inputs: brainstorming, spec, ADR, implementation plan, tests, PR evidence and runtime verification.
6
+
7
+ ## Default lifecycle
8
+
9
+ ```text
10
+ Brainstorm
11
+ -> Spec
12
+ -> ADR (when needed)
13
+ -> Issue Ready Freeze
14
+ -> Implementation Plan
15
+ -> TesterAgent writes executable tests
16
+ -> RED
17
+ -> ImplementerAgent implements
18
+ -> GREEN + regression
19
+ -> ReviewerAgent (optional/manual by default)
20
+ -> Integration
21
+ -> Runtime verification batch when required
22
+ -> Promotion / Done
23
+ ```
24
+
25
+ ## Roles
26
+
27
+ - `ArchitectAgent`: brainstorm, spec, ADR and acceptance criteria.
28
+ - `TesterAgent`: derives tests from the frozen contract and proves RED before implementation.
29
+ - `ImplementerAgent`: implements without changing the frozen test contract; must reach GREEN and run applicable regression checks.
30
+ - `ReviewerAgent`: optional semantic/architecture reviewer. Disabled/manual by default in v1.
31
+ - `RuntimeVerifierAgent`: optional, project-specific runtime verification role.
32
+
33
+ A role is not a model. GPT, Codex, Claude, local models or future providers are replaceable adapters under these contracts.
34
+
35
+ ## Core rules
36
+
37
+ - Work item is the task source of truth through a configurable WorkItemProvider (GitHub Issues or Azure DevOps).
38
+ - `Ready` is the commitment/freeze boundary.
39
+ - Test design happens before implementation.
40
+ - Implementer may report a bad test/spec as blocked, but must not rewrite expectations merely to make tests pass.
41
+ - Deterministic CI gates run before optional semantic AI review.
42
+ - Runtime verification is separate from offline/CI verification.
43
+ - Projects consume versioned reusable workflows such as `@v1`; they do not copy the engine.
44
+
45
+ ## Consumer project
46
+
47
+ A project keeps only project-specific context/config:
48
+
49
+ ```text
50
+ AGENTS.md
51
+ CURRENT.md (optional bootstrap/router)
52
+ .ai-workflow.yml
53
+ .github/workflows/ai.yml
54
+ project tests/runtime rules
55
+ ```
56
+
57
+ Its caller workflow will reference this repository's reusable workflow.
58
+
59
+ See:
60
+ - `AGENTS.md`
61
+ - `docs/lifecycle.md`
62
+ - `docs/agent-contracts.md`
63
+ - `docs/tdd-handoff.md`
64
+ - `.ai-workflow.example.yml`
65
+
66
+ Refs #1
67
+
68
+
69
+ ## Execution environments
70
+
71
+ Execution environments are provider-neutral. The first supported project contract is GitHub Codespaces with three modes:
72
+
73
+ - `off`: never use Codespaces.
74
+ - `on-demand`: provision/start a Codespace only when a routed task requires it.
75
+ - `always-on`: keep a Codespace available according to project policy.
76
+
77
+ The recommended default is `on-demand`.
78
+
79
+ Agent role, provider and environment are independent dimensions. For example, `ImplementerAgent` may run through different provider adapters while using the same Codespaces workspace.
80
+
81
+
82
+ ## Project bootstrap
83
+
84
+ The central framework owns the shared repository metadata contract.
85
+
86
+ Consumer repositories can run the reusable `bootstrap-project.yml` workflow to create or update the managed workflow labels. Bootstrap is idempotent and does not delete project-specific labels.
87
+
88
+ Managed labels currently include:
89
+ - workflow states: `status:ready`, `status:in-progress`, `status:blocked`, `status:in-review`, `status:runtime-pending`, `status:release-pending`;
90
+ - priorities: `priority:P0`, `priority:P1`, `priority:P2`.
91
+
92
+ This keeps label semantics portable when the framework or a project is copied to another repository/account.
93
+
94
+
95
+ ## Workspace planning context
96
+
97
+ Multi-repository brainstorming uses a workspace registry in `.ai-workspace.yml`.
98
+
99
+ Before a work item is published, the Planning Context Resolver normalizes:
100
+ - repositories and their purpose/ref/access;
101
+ - context paths relevant to architecture/brainstorming;
102
+ - the default target repository;
103
+ - GitHub Project identity;
104
+ - logical initiatives and repository-local milestone mappings.
105
+
106
+ ArchitectAgent then emits a planning decision identifying the correct target repository, affected repositories, initiative/release, dependencies, issue type, and runtime requirement.
107
+
108
+ This keeps brainstorming portable across ChatGPT, Claude, Codex, local models, or future providers and prevents repository selection from depending on model memory.
109
+
110
+
111
+ ## Azure DevOps initialization
112
+
113
+ Azure DevOps is supported through the provider-neutral WorkItemProvider boundary.
114
+
115
+ Run:
116
+
117
+ ```bash
118
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow init-ado \
119
+ --organization <org> \
120
+ --project <project>
121
+ ```
122
+
123
+ The initializer discovers the project's current process, Work Item Types, and all visible states through Azure DevOps REST API 7.1. It writes explicit per-WIT state mappings into `.ai-workflow.yml`; runtime execution does not guess custom state meanings.
124
+
125
+ Role/provider assignments can be supplied during init:
126
+
127
+ ```bash
128
+ ./bin/ai-workflow init-ado \
129
+ --organization <org> \
130
+ --project <project> \
131
+ --role-provider ArchitectAgent=claude \
132
+ --role-provider TesterAgent=codex \
133
+ --role-provider ImplementerAgent=codex
134
+ ```
135
+
136
+ Validate later with:
137
+
138
+ ```bash
139
+ ./bin/ai-workflow doctor \
140
+ --config .ai-workflow.yml \
141
+ --discovery .ai-workflow.yml.ado-discovery.json
142
+ ```
143
+
144
+ Doctor fails when ADO introduces a visible state that has no explicit mapping, when no ADO state maps to the canonical `ready` or `completed` state, or when required agent roles have no provider.
145
+
146
+
147
+ ## Plugin-style repository initialization
148
+
149
+ Existing repositories can install the workflow with one command:
150
+
151
+ ```bash
152
+ ./bin/ai-workflow init \
153
+ --work-items github-issues \
154
+ --environment codespaces \
155
+ --codespaces-mode on-demand
156
+ ```
157
+
158
+ For Azure DevOps:
159
+
160
+ ```bash
161
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow init \
162
+ --work-items azure-devops \
163
+ --ado-organization <org> \
164
+ --ado-project <project> \
165
+ --environment codespaces \
166
+ --role-provider ArchitectAgent=claude \
167
+ --role-provider TesterAgent=codex \
168
+ --role-provider ImplementerAgent=codex
169
+ ```
170
+
171
+ The initializer updates only workflow-owned configuration sections and preserves unrelated custom YAML. It creates missing `AGENTS.md`, `CURRENT.md`, Codespaces devcontainer, and GitHub workflow caller stubs without overwriting existing project files unless `--force` is supplied. Doctor validation runs after init.
172
+
173
+
174
+ ## Guided setup wizard
175
+
176
+ For first-time installation, prefer the step-by-step setup flow over raw `init` flags:
177
+
178
+ ```bash
179
+ GH_TOKEN=... ./bin/ai-workflow setup \
180
+ --work-items github-issues \
181
+ --github-repository owner/repo \
182
+ --environment codespaces
183
+ ```
184
+
185
+ For Azure DevOps:
186
+
187
+ ```bash
188
+ AZURE_DEVOPS_TOKEN=... ./bin/ai-workflow setup \
189
+ --work-items azure-devops \
190
+ --ado-organization <org> \
191
+ --ado-project <project> \
192
+ --environment codespaces
193
+ ```
194
+
195
+ Setup runs eight phases: repository context analysis, provider selection, current-status discovery, mapping confirmation, workflow policy, agent assignment, environment/credential guidance, then doctor/apply.
196
+
197
+ The setup context is exposed through a provider-neutral `SetupAgent` contract so an AI provider can recommend project-specific defaults after reading existing docs/tests/workflows. GitHub setup discovers existing labels and maps status-like labels; Azure DevOps setup discovers states per Work Item Type. Mapping is persisted explicitly and is never guessed during runtime.
198
+
199
+ Use `--plan-only` to generate `.ai-setup-plan.yml` without applying repository changes, or `--non-interactive` for automation.
200
+
201
+
202
+ ## AI provider registry
203
+
204
+ Agent roles reference provider IDs. Provider type, endpoint, model and authentication are configured separately.
205
+
206
+ Examples:
207
+
208
+ ```bash
209
+ ./bin/ai-workflow setup ... \
210
+ --ai-provider codex=chatgpt-codex,model=gpt-5.6-codex \
211
+ --ai-provider openai=openai,model=gpt-5.6,auth=api-key-env,env=OPENAI_API_KEY \
212
+ --ai-provider claude=anthropic,model=claude-sonnet,auth=api-key-env,env=ANTHROPIC_API_KEY \
213
+ --ai-provider litellm=litellm,base_url=http://litellm:4000/v1,auth=bearer-env,env=LITELLM_API_KEY \
214
+ --ai-provider local=local-openai-compatible,base_url=http://host.docker.internal:11434/v1,model=qwen-local,auth=none \
215
+ --role-provider ImplementerAgent=local
216
+ ```
217
+
218
+ Supported provider types are `openai`, `chatgpt-codex`, `anthropic`, `litellm`, `openai-compatible`, `local-openai-compatible`, and `interactive`.
219
+
220
+ Authentication is an independent strategy: `chatgpt-oauth`, `api-key-env`, `bearer-env`, or `none`. Secrets are never written into project configuration; configuration stores only the environment variable name or interactive auth strategy.
221
+
222
+
223
+ ## Connection-first setup
224
+
225
+ Guided setup now connects the source host before repository/provider discovery.
226
+
227
+ GitHub authentication supports:
228
+
229
+ - `gh-cli` (default): reuse the authenticated GitHub CLI OAuth session from `gh auth login`;
230
+ - `token-env`: read a PAT/token from an environment variable such as `GH_TOKEN`.
231
+
232
+ SSH keys remain valid for Git fetch/push but are not used as GitHub API/WorkItem authentication.
233
+
234
+ Example:
235
+
236
+ ```bash
237
+ gh auth login
238
+ ./bin/ai-workflow setup \
239
+ --github-auth gh-cli \
240
+ --github-repository owner/repo \
241
+ --work-items github-issues
242
+ ```
243
+
244
+ The WorkItemProvider is selected from a registry. Built-ins are currently `github-issues` and `azure-devops`; core validation is registry-based so future providers can be added without changing canonical workflow states.
245
+
246
+ ### Azure DevOps MCP
247
+
248
+ When Azure DevOps is the WorkItemProvider, setup can also configure Microsoft's Azure DevOps MCP connection for agents.
249
+
250
+ Remote MCP is the default:
251
+
252
+ ```bash
253
+ ./bin/ai-workflow setup \
254
+ --github-repository owner/repo \
255
+ --work-items azure-devops \
256
+ --ado-organization contoso \
257
+ --ado-project App \
258
+ --ado-mcp-mode remote \
259
+ --ado-mcp-auth interactive
260
+ ```
261
+
262
+ Local stdio MCP remains available with `--ado-mcp-mode local`. Supported MCP auth modes are `interactive`, `azcli`, `env`, `envvar`, and `pat`. Secrets are represented only by auth strategy/environment requirements and are never written to project configuration.
263
+
264
+
265
+ ## Worker registration
266
+
267
+ Setup can register local, Codespaces, or cloud workers separately from AI provider configuration.
268
+
269
+ Example local hybrid worker:
270
+
271
+ ```bash
272
+ ./bin/ai-workflow setup ... \
273
+ --worker desktop=hybrid,provider=local,environment=local,roles=ArchitectAgent|ImplementerAgent,assignee=my-github-login,planning_updates=approval-required
274
+ ```
275
+
276
+ Example Codespaces executor:
277
+
278
+ ```bash
279
+ ./bin/ai-workflow setup ... \
280
+ --worker cs=executor,provider=codex,environment=codespaces,roles=TesterAgent|ImplementerAgent,capacity=2
281
+ ```
282
+
283
+ Planner/hybrid workers can connect directly to the configured WorkItemProvider (for example Azure DevOps MCP) to read current work items, analyze repository/work-item context, brainstorm, and propose updates. Planning mutations default to approval-required; frozen ready contracts cannot be silently changed. Executor/hybrid workers project into the existing queue-dispatcher worker registry and follow the reservation → provider accepted → in-progress lifecycle.
284
+
285
+
286
+ ## Complete setup documentation
287
+
288
+ For the full first-run and customization guide, see:
289
+
290
+ - `docs/setup-guide.md` — human-readable step-by-step setup, examples, credentials, providers, workers, ADO/GitHub, Codespaces/local and multi-repo.
291
+ - `docs/setup-agent-playbook.md` — canonical AI-readable SetupAgent playbook, invariants, approval boundaries and customization contract.
292
+
293
+ Recommended workflow:
294
+
295
+ ```text
296
+ AI or user reads setup guide/playbook
297
+ → run setup --plan-only
298
+ → review discovered status/WIT mappings and recommendations
299
+ → approve/customize
300
+ → run setup/apply
301
+ → configure required secrets/sign-ins
302
+ → doctor
303
+ ```
304
+
305
+ The setup flow is customizable, but provider-specific states, credential values and frozen-contract changes must never be silently guessed.
306
+
307
+
308
+ ## Updating the framework
309
+
310
+ Use `./bin/ai-workflow update --check` to inspect the configured framework ref, and `./bin/ai-workflow update --to <ref>` to update framework-managed files and schema metadata. Project-owned configuration and files are preserved; locally modified managed files are skipped unless `--force` is explicitly used. See `docs/setup-guide.md` for the full update and migration rules.
311
+
312
+
313
+ ## Install from PyPI
314
+
315
+ Once a release is published to PyPI, consumers do not need to clone this repository:
316
+
317
+ ```bash
318
+ python -m pip install --upgrade ai-dev-workflow
319
+ ai-workflow --help
320
+ ai-workflow setup
321
+ ```
322
+
323
+ The GitHub repository may remain private because normal consumers install the built distribution from PyPI rather than cloning the source repository.
324
+
325
+ On another machine, install Python 3.10+ and run the same `pip install ai-dev-workflow` command. Project-specific configuration remains in each consumer repository.
326
+
327
+ Framework CLI/package upgrades and project installation upgrades are separate:
328
+
329
+ ```bash
330
+ python -m pip install --upgrade ai-dev-workflow
331
+ ai-workflow update
332
+ ```
333
+
334
+ The first command upgrades the installed CLI package. The second migrates/updates the workflow installation in the current project.