aw-spec-cli 0.1.9 → 0.1.11

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 (58) hide show
  1. package/assets/.appweaver/ORCH-DIALECT.md +17 -5
  2. package/assets/.appweaver/orchestrator/README.md +1 -1
  3. package/assets/.appweaver/orchestrator/adapters/claude_agent_sdk.py +2 -2
  4. package/assets/.appweaver/orchestrator/adapters/google_antigravity.py +28 -6
  5. package/assets/.appweaver/orchestrator/modules/delta-spec.orch.yaml +13 -1
  6. package/assets/.appweaver/orchestrator/orchestrator.py +126 -39
  7. package/assets/.appweaver/orchestrator/workflows/aw-spec-adopt.orch.yaml +5 -0
  8. package/assets/.appweaver/orchestrator/workflows/aw-spec-characterize.orch.yaml +1 -0
  9. package/assets/.appweaver/orchestrator/workflows/aw-spec-onboard.orch.yaml +1 -0
  10. package/assets/.appweaver/orchestrator/workflows/aw-spec-specify.orch.yaml +888 -141
  11. package/assets/.appweaver/scripts/bash/aw-spec-actions.sh +826 -16
  12. package/assets/.appweaver/scripts/powershell/aw-spec-actions.ps1 +780 -12
  13. package/assets/.appweaver/stack-profiles/java-spring.json +3 -3
  14. package/assets/.appweaver/templates/spec-template.md +73 -62
  15. package/assets/.appweaver/templates/story-template.md +107 -0
  16. package/assets/guardrails/technology/java-spring/ai-rules.md +505 -0
  17. package/assets/guardrails/technology/java-spring/api-versioning.md +782 -0
  18. package/assets/guardrails/technology/java-spring/authorization.md +618 -0
  19. package/assets/guardrails/technology/java-spring/clean-architecture.md +960 -0
  20. package/assets/guardrails/technology/java-spring/coding-standards.md +821 -0
  21. package/assets/guardrails/technology/java-spring/dependency-policy.md +91 -0
  22. package/assets/guardrails/technology/java-spring/domain-driven-design.md +467 -0
  23. package/assets/guardrails/technology/java-spring/domain_abstraction.md +424 -0
  24. package/assets/guardrails/technology/java-spring/folder-structure.md +1537 -0
  25. package/assets/guardrails/technology/java-spring/global_exception_handler.md +247 -0
  26. package/assets/guardrails/technology/java-spring/logging.md +215 -0
  27. package/assets/guardrails/technology/java-spring/modular-monolith.md +77 -0
  28. package/assets/guardrails/technology/java-spring/persistence.md +316 -0
  29. package/assets/guardrails/technology/java-spring/problem_details.md +98 -0
  30. package/assets/guardrails/technology/java-spring/result_mapping.md +48 -0
  31. package/assets/guardrails/technology/java-spring/technology-constitution.md +168 -0
  32. package/assets/guardrails/technology/java-spring/testing.md +601 -0
  33. package/assets/guardrails/technology/java-spring/zero-trust.md +210 -0
  34. package/dist/index.js +0 -0
  35. package/dist/utils/config.d.ts +22 -0
  36. package/dist/utils/config.d.ts.map +1 -0
  37. package/dist/utils/config.js +76 -0
  38. package/dist/utils/config.js.map +1 -0
  39. package/dist/utils/copy-assets.d.ts.map +1 -1
  40. package/dist/utils/copy-assets.js +4 -11
  41. package/dist/utils/copy-assets.js.map +1 -1
  42. package/dist/utils/paths.d.ts.map +1 -1
  43. package/dist/utils/paths.js +11 -7
  44. package/dist/utils/paths.js.map +1 -1
  45. package/package.json +2 -1
  46. package/assets/guardrails/technology/java-spring/README.md +0 -62
  47. package/dist/commands/update.d.ts +0 -3
  48. package/dist/commands/update.d.ts.map +0 -1
  49. package/dist/commands/update.js +0 -142
  50. package/dist/commands/update.js.map +0 -1
  51. package/dist/utils/manifest.d.ts +0 -31
  52. package/dist/utils/manifest.d.ts.map +0 -1
  53. package/dist/utils/manifest.js +0 -91
  54. package/dist/utils/manifest.js.map +0 -1
  55. package/dist/utils/update-engine.d.ts +0 -52
  56. package/dist/utils/update-engine.d.ts.map +0 -1
  57. package/dist/utils/update-engine.js +0 -203
  58. package/dist/utils/update-engine.js.map +0 -1
@@ -0,0 +1,505 @@
1
+ # AI Operational Rules
2
+
3
+ > Common technology guardrails for Java/Spring applications built from the AppWeaver Java foundation.
4
+ >
5
+ > Technology-specific and domain-agnostic. Applies to all AI agents and all commands unless a higher-priority project rule explicitly overrides it.
6
+
7
+ AI agents MUST treat the **project constitution**, **AppWeaver Java foundation architecture**, and **applicable technology guardrails** as the authoritative source of truth.
8
+
9
+ AI agents MUST NOT replace established AppWeaver conventions with generic Java, Spring, DDD, or architectural assumptions.
10
+
11
+ ---
12
+
13
+ ## 1. Source-of-Truth Hierarchy
14
+
15
+ When multiple sources provide conflicting guidance, AI agents MUST resolve them in the following order:
16
+
17
+ 1. **Project Constitution**
18
+ 2. **AppWeaver Java Foundation Architecture and Package Structure**
19
+ 3. **Applicable Technology Guardrails**
20
+ 4. **Application/Module-Specific Rules**
21
+ 5. **Existing Repository Implementation and Established Conventions**
22
+ 6. **Generic Java/Spring Framework Defaults**
23
+ 7. **AI Agent's Pre-trained Assumptions**
24
+
25
+ Higher-priority rules MUST NOT be overridden by lower-priority conventions.
26
+
27
+ ---
28
+
29
+ ## 2. AppWeaver Java Foundation
30
+
31
+ The application MUST follow the predefined AppWeaver Java foundation.
32
+
33
+ The mandatory production Java source root is:
34
+
35
+ `backend/src/main/java/io/appweaver/`
36
+
37
+ The foundation defines the following four top-level architectural packages:
38
+
39
+ ```text
40
+ backend/src/main/java/io/appweaver/
41
+ ├── adapter/
42
+ ├── application/
43
+ ├── domain/
44
+ └── infrastructure/
45
+ ```
46
+
47
+ These four packages are the authoritative top-level production package structure.
48
+
49
+ ### Package rules
50
+
51
+ * All generated production Java code MUST be placed under one of the four approved top-level packages:
52
+
53
+ * `io.appweaver.adapter`
54
+ * `io.appweaver.application`
55
+ * `io.appweaver.domain`
56
+ * `io.appweaver.infrastructure`
57
+ * AI agents MUST NOT create another top-level package directly under `io.appweaver`.
58
+ * AI agents MUST NOT introduce alternative structures such as:
59
+
60
+ * `controller`
61
+ * `service`
62
+ * `repository`
63
+ * `model`
64
+ * `feature`
65
+ * `features`
66
+ * `vertical-slice`
67
+ * `common`
68
+ * or another top-level architectural package.
69
+ * Subpackages MAY be created underneath the four approved packages when required by the established Java foundation and module structure.
70
+ * AI agents MUST inspect the existing repository structure before deciding where new code belongs.
71
+ * AI agents MUST preserve the existing module and package organization.
72
+ * AI agents MUST NOT reorganize the foundation package structure as part of an unrelated feature change.
73
+ * Test source structure MUST follow the existing project conventions.
74
+
75
+ If a requested implementation cannot be placed correctly within the established foundation structure, the AI agent MUST request clarification rather than inventing an alternative structure.
76
+
77
+ ---
78
+
79
+ ## 3. Modular Monolith Architecture
80
+
81
+ The Java application follows a **Modular Monolith** architecture.
82
+
83
+ The application is a single deployable application containing internally separated modules.
84
+
85
+ AI agents MUST preserve module boundaries.
86
+
87
+ Each module MUST maintain ownership of its applicable:
88
+
89
+ * domain model
90
+ * application/use-case logic
91
+ * ports and contracts
92
+ * adapters
93
+ * infrastructure implementation
94
+ * persistence concerns
95
+
96
+ AI agents MUST NOT:
97
+
98
+ * introduce microservices unless explicitly requested
99
+ * introduce distributed communication between modules unless explicitly required
100
+ * directly access another module's internal domain objects
101
+ * directly access another module's repositories or persistence implementations
102
+ * bypass another module's public application contracts or ports
103
+ * introduce dependencies that violate the established module dependency direction
104
+
105
+ Cross-module interaction MUST use the mechanisms defined by the project's architecture.
106
+
107
+ ---
108
+
109
+ ## 4. Hexagonal Architecture
110
+
111
+ The application follows the established **Hexagonal Architecture / Ports and Adapters** model.
112
+
113
+ AI agents MUST preserve the separation between:
114
+
115
+ * domain/business logic
116
+ * application/use-case logic
117
+ * inbound adapters
118
+ * outbound adapters
119
+ * infrastructure/framework concerns
120
+
121
+ Business rules MUST NOT become dependent on infrastructure-specific implementation details unless explicitly permitted by the foundation.
122
+
123
+ AI agents MUST NOT introduce a competing architectural model such as:
124
+
125
+ * Vertical Slice Architecture
126
+ * traditional layered architecture
127
+ * controller-service-repository architecture as the primary architectural model
128
+ * MVC-centric domain design
129
+ * another package-oriented architecture
130
+
131
+ The predefined Java foundation remains authoritative.
132
+
133
+ ---
134
+
135
+ ## 5. Repository and Context Inspection
136
+
137
+ Before generating or modifying code, AI agents MUST inspect the relevant existing implementation.
138
+
139
+ At minimum, AI agents SHOULD determine:
140
+
141
+ * the owning module
142
+ * the relevant domain model
143
+ * the applicable application/use case
144
+ * existing ports
145
+ * existing adapters
146
+ * existing infrastructure components
147
+ * existing DTOs/contracts
148
+ * existing validation
149
+ * existing exception handling
150
+ * existing cross-cutting capabilities
151
+ * existing tests
152
+ * applicable configuration
153
+
154
+ AI agents MUST confirm existing symbol signatures through repository search rather than inferring them from generic framework knowledge.
155
+
156
+ Existing AppWeaver abstractions MUST be reused when applicable.
157
+
158
+ AI agents MUST NOT recreate an abstraction that already exists in the foundation or relevant module.
159
+
160
+ ---
161
+
162
+ ## 6. Code Generation Rules
163
+
164
+ AI agents MUST generate only the components required by the requested behavior and applicable architecture.
165
+
166
+ AI agents MUST NOT assume that every use case requires:
167
+
168
+ * Command
169
+ * Query
170
+ * Handler
171
+ * Specification
172
+ * DTO
173
+ * Mapper
174
+ * Service
175
+ * Repository
176
+ * Integration test
177
+ * or any other component
178
+
179
+ These components MUST be created only when required by the application's architecture, use case, or established conventions.
180
+
181
+ AI agents MUST:
182
+
183
+ * prefer existing abstractions
184
+ * follow existing naming conventions
185
+ * follow existing visibility conventions
186
+ * follow existing validation conventions
187
+ * follow existing exception conventions
188
+ * follow existing transaction conventions
189
+ * follow existing persistence conventions
190
+ * follow existing mapping conventions
191
+ * use Java and Spring capabilities appropriately
192
+
193
+ AI agents MUST NOT introduce speculative abstractions such as:
194
+
195
+ * single-implementation interfaces without an architectural requirement
196
+ * unnecessary generic wrappers
197
+ * duplicate framework abstractions
198
+ * abstractions created solely for theoretical future requirements
199
+
200
+ This follows **YAGNI** unless the constitution or architecture explicitly requires otherwise.
201
+
202
+ ---
203
+
204
+ ## 7. Dependency Rules
205
+
206
+ AI agents MUST NOT introduce new top-level dependencies unless explicitly approved or required by an existing project standard.
207
+
208
+ Before introducing a dependency, AI agents MUST verify whether the required capability is already provided by:
209
+
210
+ * Java
211
+ * Spring Boot
212
+ * Spring Framework
213
+ * Spring Data
214
+ * JPA/Hibernate
215
+ * an existing AppWeaver abstraction
216
+ * an already-approved project dependency
217
+
218
+ AI agents MUST NOT introduce a dependency merely to duplicate functionality already available through the established technology stack.
219
+
220
+ New dependencies MUST comply with the project's dependency-management and security standards.
221
+
222
+ ---
223
+
224
+ ## 8. AppWeaver Cross-Cutting Capabilities
225
+
226
+ AppWeaver provides a common set of reusable cross-cutting technology guardrails.
227
+
228
+ The following guardrails are part of the AppWeaver Java technology foundation:
229
+
230
+ * `authorization.md`
231
+ * `domain_abstraction.md`
232
+ * `global_exception_handler.md`
233
+ * `logging.md`
234
+ * `problem_details.md`
235
+ * `result_mapping.md`
236
+
237
+ These guardrails define **available standardized implementations and extension mechanisms**.
238
+
239
+ ### Important applicability rule
240
+
241
+ The existence of a cross-cutting guardrail does **NOT** mean that every application MUST enable or use that capability.
242
+
243
+ An application MUST use a cross-cutting capability when:
244
+
245
+ * the application's requirements require it;
246
+ * the project constitution requires it;
247
+ * the application architecture explicitly enables it; or
248
+ * the relevant technology standard declares it applicable.
249
+
250
+ AI agents MUST determine applicability from the project's requirements, constitution, architecture, and existing implementation.
251
+
252
+ AI agents MUST NOT automatically add or activate every available cross-cutting capability merely because the guardrail exists.
253
+
254
+ ### When a capability is applicable
255
+
256
+ When an application requires one of these capabilities, AI agents MUST:
257
+
258
+ * use the corresponding AppWeaver guardrail;
259
+ * reuse the provided implementation and abstractions;
260
+ * follow its documented extension points;
261
+ * integrate new application code with the existing mechanism;
262
+ * preserve its established behavior;
263
+ * avoid creating duplicate implementations.
264
+
265
+ AI agents MUST NOT silently replace an applicable AppWeaver cross-cutting capability with a custom implementation.
266
+
267
+ AI agents MUST NOT create feature-specific copies of a foundation-level cross-cutting concern when an approved AppWeaver implementation already exists.
268
+
269
+ AI agents MUST NOT globally disable an applicable cross-cutting capability without explicit authorization.
270
+
271
+ ### Examples
272
+
273
+ If authorization is required:
274
+
275
+ * use `authorization.md` and its established mechanism;
276
+ * do not create a separate authorization framework or custom authorization mechanism.
277
+
278
+ If global exception handling is required:
279
+
280
+ * use `global_exception_handler.md`;
281
+ * do not create another global exception handler.
282
+
283
+ If Problem Details is required:
284
+
285
+ * follow `problem_details.md`;
286
+ * do not introduce an unrelated error-response format.
287
+
288
+ If logging is required:
289
+
290
+ * follow `logging.md`;
291
+ * do not create a parallel logging abstraction or logging framework.
292
+
293
+ If a capability is not required by the application, AI agents MUST NOT introduce it merely for completeness.
294
+
295
+ ---
296
+
297
+ ## 9. Cross-Cutting Boundary Rules
298
+
299
+ Cross-cutting concerns MUST be implemented at the appropriate foundation/application level defined by their respective guardrail.
300
+
301
+ AI agents MUST NOT duplicate cross-cutting behavior inside individual modules when the AppWeaver foundation already provides the applicable mechanism.
302
+
303
+ AI agents MUST NOT bypass established cross-cutting mechanisms through:
304
+
305
+ * direct framework-specific alternatives
306
+ * local duplicate implementations
307
+ * feature-specific global handlers
308
+ * ad-hoc response formats
309
+ * ad-hoc logging mechanisms
310
+ * unauthorized security checks
311
+ * direct access to internal infrastructure
312
+
313
+ Module-specific behavior MAY extend a cross-cutting capability when the corresponding guardrail explicitly supports extension.
314
+
315
+ ---
316
+
317
+ ## 10. Testing Rules
318
+
319
+ Production changes MUST include appropriate automated tests according to the project's testing standards.
320
+
321
+ Tests MUST correspond to the responsibility of the code being changed.
322
+
323
+ Where applicable:
324
+
325
+ * domain behavior SHOULD be tested independently of infrastructure;
326
+ * application/use-case behavior SHOULD be tested independently of external infrastructure;
327
+ * adapters SHOULD have appropriate integration tests;
328
+ * infrastructure integrations SHOULD be covered by appropriate integration testing.
329
+
330
+ AI agents MUST NOT create unnecessary tests solely to satisfy a fixed test-count requirement.
331
+
332
+ AI agents MUST NOT remove or weaken existing tests merely to make an implementation pass.
333
+
334
+ When modifying existing behavior, affected tests MUST be updated accordingly.
335
+
336
+ Test-first development SHOULD be followed when required by the project development standards.
337
+
338
+ ---
339
+
340
+ ## 11. Database and Migration Rules
341
+
342
+ AI agents MAY create database migration files using the application's approved migration mechanism when a schema change is required.
343
+
344
+ Migrations MUST:
345
+
346
+ * follow the approved migration framework;
347
+ * follow existing naming and versioning conventions;
348
+ * be deterministic;
349
+ * be compatible with the application's deployment process;
350
+ * avoid unintended data loss.
351
+
352
+ AI agents MUST NOT execute database migrations against shared or production environments autonomously.
353
+
354
+ Destructive migrations MUST receive the required project review before deployment.
355
+
356
+ AI agents MUST NOT introduce a second migration framework when an approved framework already exists.
357
+
358
+ ---
359
+
360
+ ## 12. Transaction and Consistency Rules
361
+
362
+ Transaction boundaries MUST follow the application's established architecture and transaction rules.
363
+
364
+ AI agents MUST NOT introduce transactions merely to simplify implementation.
365
+
366
+ AI agents MUST NOT use transactions to bypass module boundaries.
367
+
368
+ AI agents MUST NOT introduce cross-module consistency mechanisms that contradict the application's domain or architecture rules.
369
+
370
+ Where consistency requirements span modules, AI agents MUST follow the project's established integration and consistency mechanism.
371
+
372
+ ---
373
+
374
+ ## 13. Security and Sensitive Data
375
+
376
+ AI agents MUST NOT:
377
+
378
+ * embed passwords or credentials in source code;
379
+ * embed API keys or access tokens;
380
+ * embed private keys;
381
+ * embed production connection strings;
382
+ * hard-code production secrets;
383
+ * hard-code production credentials;
384
+ * expose secrets through logs;
385
+ * expose sensitive information through API responses;
386
+ * expose sensitive information through exception messages.
387
+
388
+ AI agents MUST refuse or request clarification when a request requires introducing such information.
389
+
390
+ AI agents MUST preserve established security controls.
391
+
392
+ AI agents MUST NOT disable authentication, authorization, or other security controls globally.
393
+
394
+ ---
395
+
396
+ ## 14. Cross-Cutting Security and Operational Controls
397
+
398
+ Where these controls exist in the application, AI agents MUST preserve them:
399
+
400
+ * authentication
401
+ * authorization
402
+ * audit handling
403
+ * correlation/request context
404
+ * structured logging
405
+ * sensitive-data masking
406
+ * tenancy controls
407
+ * soft-delete behavior
408
+ * validation
409
+ * security interceptors
410
+ * other established operational controls
411
+
412
+ AI agents MUST NOT disable these controls globally merely to make a feature work.
413
+
414
+ If a feature legitimately requires an exception to an existing control, the AI agent MUST follow the extension mechanism defined by the applicable guardrail rather than bypassing the control.
415
+
416
+ ---
417
+
418
+ ## 15. Change Scope
419
+
420
+ AI-generated changes MUST remain within the scope explicitly requested.
421
+
422
+ AI agents MUST NOT perform unrelated:
423
+
424
+ * refactoring
425
+ * package restructuring
426
+ * architecture changes
427
+ * dependency upgrades
428
+ * framework migrations
429
+ * naming changes
430
+ * formatting changes across unrelated files
431
+
432
+ Drive-by refactoring is forbidden.
433
+
434
+ If an implementation requires an architectural change, the AI agent MUST identify that requirement rather than silently making the architectural change.
435
+
436
+ ---
437
+
438
+ ## 16. Backward Compatibility
439
+
440
+ AI agents SHOULD preserve existing API and behavioral compatibility unless a breaking change is explicitly requested or required by an approved architectural change.
441
+
442
+ Breaking changes MUST NOT be introduced implicitly.
443
+
444
+ When an API contract, persistence contract, module contract, or shared abstraction must change, affected consumers MUST be identified and handled according to the project's compatibility rules.
445
+
446
+ ---
447
+
448
+ ## 17. Comments and Documentation
449
+
450
+ AI agents MUST NOT add comments solely to explain standard Java, Spring, DDD, or architectural decisions already defined by the project standards.
451
+
452
+ The constitution, architecture documentation, and technology guardrails are the authoritative sources for those decisions.
453
+
454
+ Comments MAY be added when they explain:
455
+
456
+ * non-obvious implementation behavior;
457
+ * important technical constraints;
458
+ * security-sensitive behavior;
459
+ * compatibility requirements;
460
+ * complex algorithms;
461
+ * unavoidable framework-specific behavior.
462
+
463
+ ---
464
+
465
+ ## 18. Refusal and Clarification Conditions
466
+
467
+ AI agents MUST refuse or request clarification when a requested change would:
468
+
469
+ * violate a **NON-NEGOTIABLE** constitutional principle;
470
+ * violate the AppWeaver Java foundation architecture;
471
+ * create production code outside the approved foundation package structure;
472
+ * violate module boundaries;
473
+ * introduce an unauthorized architectural pattern;
474
+ * bypass an applicable AppWeaver cross-cutting capability;
475
+ * replace an established AppWeaver abstraction without approval;
476
+ * introduce an unauthorized dependency;
477
+ * embed secrets or production credentials;
478
+ * disable authentication or authorization globally;
479
+ * disable applicable security or operational controls globally;
480
+ * require an architectural change that has not been explicitly approved;
481
+ * require direct access to another module's internal implementation;
482
+ * require behavior that contradicts a higher-priority project rule.
483
+
484
+ When the conflict can be resolved by an existing project rule or established implementation, the AI agent MUST follow that rule rather than inventing a new solution.
485
+
486
+ ---
487
+
488
+ ## 19. Core Principle
489
+
490
+ AI agents MUST generate code that is **consistent with the existing AppWeaver Java foundation**, not code based on a generic interpretation of how a Java/Spring application should be structured.
491
+
492
+ The AI agent MUST preserve:
493
+
494
+ * the predefined Java foundation package structure;
495
+ * the Modular Monolith architecture;
496
+ * the Hexagonal Architecture / Ports and Adapters model;
497
+ * module boundaries;
498
+ * established AppWeaver abstractions;
499
+ * applicable cross-cutting capabilities;
500
+ * existing project conventions;
501
+ * and higher-priority constitutional rules.
502
+
503
+ The presence of a guardrail defines an **approved capability and its implementation standard**. It does not, by itself, make that capability mandatory for every application.
504
+
505
+ An application-specific requirement determines whether an available cross-cutting capability is applicable.