@eddacraft/anvil-aps 0.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.
Files changed (121) hide show
  1. package/AGENTS.md +155 -0
  2. package/LICENSE +14 -0
  3. package/README.md +57 -0
  4. package/TODO.md +40 -0
  5. package/dist/filter/context-bundle.d.ts +81 -0
  6. package/dist/filter/context-bundle.d.ts.map +1 -0
  7. package/dist/filter/context-bundle.js +230 -0
  8. package/dist/filter/index.d.ts +85 -0
  9. package/dist/filter/index.d.ts.map +1 -0
  10. package/dist/filter/index.js +169 -0
  11. package/dist/index.d.ts +16 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +15 -0
  14. package/dist/loader/index.d.ts +80 -0
  15. package/dist/loader/index.d.ts.map +1 -0
  16. package/dist/loader/index.js +253 -0
  17. package/dist/parser/index.d.ts +24 -0
  18. package/dist/parser/index.d.ts.map +1 -0
  19. package/dist/parser/index.js +22 -0
  20. package/dist/parser/parse-document.d.ts +17 -0
  21. package/dist/parser/parse-document.d.ts.map +1 -0
  22. package/dist/parser/parse-document.js +219 -0
  23. package/dist/parser/parse-index.d.ts +31 -0
  24. package/dist/parser/parse-index.d.ts.map +1 -0
  25. package/dist/parser/parse-index.js +251 -0
  26. package/dist/parser/parse-task.d.ts +30 -0
  27. package/dist/parser/parse-task.d.ts.map +1 -0
  28. package/dist/parser/parse-task.js +261 -0
  29. package/dist/state/index.d.ts +307 -0
  30. package/dist/state/index.d.ts.map +1 -0
  31. package/dist/state/index.js +689 -0
  32. package/dist/templates/generator.d.ts +71 -0
  33. package/dist/templates/generator.d.ts.map +1 -0
  34. package/dist/templates/generator.js +723 -0
  35. package/dist/templates/index.d.ts +5 -0
  36. package/dist/templates/index.d.ts.map +1 -0
  37. package/dist/templates/index.js +4 -0
  38. package/dist/types/index.d.ts +131 -0
  39. package/dist/types/index.d.ts.map +1 -0
  40. package/dist/types/index.js +107 -0
  41. package/dist/validator/index.d.ts +83 -0
  42. package/dist/validator/index.d.ts.map +1 -0
  43. package/dist/validator/index.js +611 -0
  44. package/docs/APS-Anvil-Integration.md +750 -0
  45. package/docs/APS-Conventions.md +635 -0
  46. package/docs/APS-NonGoals.md +455 -0
  47. package/docs/APS-Planning-Spec-v0.1.md +362 -0
  48. package/examples/README.md +170 -0
  49. package/examples/feature-auth.aps.md +87 -0
  50. package/examples/refactor-error-handling.aps.md +119 -0
  51. package/examples/system-ecommerce/APS.md +57 -0
  52. package/examples/system-ecommerce/modules/auth.aps.md +38 -0
  53. package/examples/system-ecommerce/modules/cart.aps.md +53 -0
  54. package/examples/system-ecommerce/modules/payments.aps.md +68 -0
  55. package/examples/system-ecommerce/modules/products.aps.md +53 -0
  56. package/package.json +34 -0
  57. package/project.json +37 -0
  58. package/scripts/generate-templates.js +33 -0
  59. package/src/filter/context-bundle.ts +312 -0
  60. package/src/filter/filter.test.ts +317 -0
  61. package/src/filter/index.ts +249 -0
  62. package/src/index.ts +16 -0
  63. package/src/loader/index.ts +364 -0
  64. package/src/loader/loader.test.ts +224 -0
  65. package/src/parser/__fixtures__/invalid-task-id-not-padded.aps.md +7 -0
  66. package/src/parser/__fixtures__/invalid-task-id.aps.md +8 -0
  67. package/src/parser/__fixtures__/minimal-task.aps.md +7 -0
  68. package/src/parser/__fixtures__/non-scope-hyphenated.aps.md +10 -0
  69. package/src/parser/__fixtures__/simple-index.aps.md +35 -0
  70. package/src/parser/__fixtures__/simple-plan.aps.md +19 -0
  71. package/src/parser/index.ts +30 -0
  72. package/src/parser/parse-document.test.ts +603 -0
  73. package/src/parser/parse-document.ts +262 -0
  74. package/src/parser/parse-index.test.ts +316 -0
  75. package/src/parser/parse-index.ts +298 -0
  76. package/src/parser/parse-task.test.ts +476 -0
  77. package/src/parser/parse-task.ts +325 -0
  78. package/src/state/__fixtures__/invalid-plan.aps.md +9 -0
  79. package/src/state/__fixtures__/test-plan.aps.md +20 -0
  80. package/src/state/index.ts +879 -0
  81. package/src/state/state.test.ts +645 -0
  82. package/src/templates/generator.test.ts +378 -0
  83. package/src/templates/generator.ts +776 -0
  84. package/src/templates/index.ts +5 -0
  85. package/src/types/index.ts +168 -0
  86. package/src/validator/__fixtures__/broken-links.aps.md +10 -0
  87. package/src/validator/__fixtures__/circular-deps-index.aps.md +26 -0
  88. package/src/validator/__fixtures__/circular-modules/module-a.aps.md +9 -0
  89. package/src/validator/__fixtures__/circular-modules/module-b.aps.md +9 -0
  90. package/src/validator/__fixtures__/circular-modules/module-c.aps.md +9 -0
  91. package/src/validator/__fixtures__/dup-modules/module-a.aps.md +9 -0
  92. package/src/validator/__fixtures__/dup-modules/module-b.aps.md +9 -0
  93. package/src/validator/__fixtures__/duplicate-ids-index.aps.md +15 -0
  94. package/src/validator/__fixtures__/invalid-task-id.aps.md +17 -0
  95. package/src/validator/__fixtures__/missing-confidence.aps.md +9 -0
  96. package/src/validator/__fixtures__/missing-h1.aps.md +5 -0
  97. package/src/validator/__fixtures__/missing-intent.aps.md +9 -0
  98. package/src/validator/__fixtures__/missing-modules-section.aps.md +7 -0
  99. package/src/validator/__fixtures__/missing-tasks-section.aps.md +7 -0
  100. package/src/validator/__fixtures__/modules/auth.aps.md +17 -0
  101. package/src/validator/__fixtures__/modules/payments.aps.md +13 -0
  102. package/src/validator/__fixtures__/scope-mismatch.aps.md +14 -0
  103. package/src/validator/__fixtures__/valid-index.aps.md +24 -0
  104. package/src/validator/__fixtures__/valid-leaf.aps.md +22 -0
  105. package/src/validator/index.ts +776 -0
  106. package/src/validator/validator.test.ts +269 -0
  107. package/templates/index-full.md +94 -0
  108. package/templates/index-minimal.md +16 -0
  109. package/templates/index-template.md +63 -0
  110. package/templates/leaf-full.md +76 -0
  111. package/templates/leaf-minimal.md +14 -0
  112. package/templates/leaf-template.md +55 -0
  113. package/templates/simple-full.md +56 -0
  114. package/templates/simple-minimal.md +14 -0
  115. package/templates/simple-template.md +30 -0
  116. package/tsconfig.json +19 -0
  117. package/tsconfig.lib.json +14 -0
  118. package/tsconfig.lib.tsbuildinfo +1 -0
  119. package/tsconfig.spec.json +9 -0
  120. package/tsconfig.tsbuildinfo +1 -0
  121. package/vitest.config.ts +15 -0
@@ -0,0 +1,119 @@
1
+ # Refactor: API Error Handling
2
+
3
+ **Scope:** API **Owner:** @engineering-team **Priority:** high
4
+
5
+ > Standardise error handling across all API endpoints with consistent response
6
+ > format, logging, and monitoring.
7
+
8
+ ## Tasks
9
+
10
+ ### API-001: Audit current error handling patterns
11
+
12
+ **Intent:** Survey all endpoints to document current error handling approaches
13
+ and inconsistencies **Expected Outcome:** Report listing error patterns, missing
14
+ cases, and inconsistency examples **Confidence:** low **Scopes:** API, AUTH,
15
+ PROD, CART, PAY **Tags:** audit, research, documentation **Inputs:**
16
+
17
+ - Access to all API endpoint code
18
+ - Error logs from production (last 30 days)
19
+
20
+ ### API-002: Design unified error response schema
21
+
22
+ **Intent:** Define standard error response format with codes, messages, and
23
+ metadata **Expected Outcome:** Error schema documented with examples for common
24
+ cases (validation, auth, not found, server error) **Confidence:** medium
25
+ **Scopes:** API **Tags:** design, schema, standards **Dependencies:** API-001
26
+
27
+ ### API-003: Create base error classes
28
+
29
+ **Intent:** Implement error class hierarchy (ApiError, ValidationError,
30
+ AuthError, NotFoundError, etc.) **Expected Outcome:** Error classes with proper
31
+ inheritance, serialisation, and HTTP status mapping **Confidence:** high
32
+ **Scopes:** API **Tags:** errors, classes, core **Dependencies:** API-002
33
+
34
+ ### API-004: Implement global error middleware
35
+
36
+ **Intent:** Create Express error middleware that catches all errors and formats
37
+ responses **Expected Outcome:** Middleware handling all error types with
38
+ logging, status codes, and response formatting **Confidence:** medium
39
+ **Scopes:** API **Tags:** middleware, errors, express **Dependencies:** API-003
40
+ **Inputs:**
41
+
42
+ - Logging strategy (structured JSON logs? Log aggregation tool?)
43
+ - Monitoring integration (Sentry, DataDog?)
44
+
45
+ ### API-005: Refactor authentication endpoints
46
+
47
+ **Intent:** Update all AUTH endpoints to use new error classes and middleware
48
+ **Expected Outcome:** AUTH endpoints throwing proper errors, tests updated,
49
+ error responses verified **Confidence:** high **Scopes:** API, AUTH **Tags:**
50
+ refactor, authentication **Dependencies:** API-003, API-004
51
+
52
+ ### API-006: Refactor product catalog endpoints
53
+
54
+ **Intent:** Update all PROD endpoints to use new error classes and middleware
55
+ **Expected Outcome:** PROD endpoints throwing proper errors, tests updated
56
+ **Confidence:** high **Scopes:** API, PROD **Tags:** refactor, products
57
+ **Dependencies:** API-003, API-004
58
+
59
+ ### API-007: Refactor shopping cart endpoints
60
+
61
+ **Intent:** Update all CART endpoints to use new error classes and middleware
62
+ **Expected Outcome:** CART endpoints throwing proper errors, tests updated
63
+ **Confidence:** high **Scopes:** API, CART **Tags:** refactor, cart
64
+ **Dependencies:** API-003, API-004
65
+
66
+ ### API-008: Refactor payment endpoints
67
+
68
+ **Intent:** Update all PAY endpoints to use new error classes and middleware
69
+ **Expected Outcome:** PAY endpoints throwing proper errors, Stripe error mapping
70
+ included **Confidence:** medium **Scopes:** API, PAY **Tags:** refactor,
71
+ payments **Dependencies:** API-003, API-004 **Inputs:**
72
+
73
+ - Stripe error code mappings
74
+ - PCI compliance considerations for error messages
75
+
76
+ ### API-009: Add error monitoring integration
77
+
78
+ **Intent:** Integrate error tracking service (Sentry) with automatic error
79
+ reporting **Expected Outcome:** All errors automatically sent to monitoring with
80
+ context (user, request, stack) **Confidence:** low **Scopes:** API, INFRA
81
+ **Tags:** monitoring, observability, sentry **Dependencies:** API-004
82
+ **Inputs:**
83
+
84
+ - Sentry account and DSN
85
+ - PII scrubbing rules
86
+ - Alert thresholds
87
+
88
+ ### API-010: Update API documentation
89
+
90
+ **Intent:** Document new error response format and codes in API docs **Expected
91
+ Outcome:** API docs with error section, examples, and troubleshooting guide
92
+ **Confidence:** high **Scopes:** DOCS **Tags:** documentation, api
93
+ **Dependencies:** API-002, API-005, API-006, API-007, API-008
94
+
95
+ ### API-011: Remove deprecated error handling code
96
+
97
+ **Intent:** Clean up old error handling patterns and remove dead code **Expected
98
+ Outcome:** Codebase with only new error handling, no legacy patterns remaining
99
+ **Confidence:** medium **Scopes:** API, AUTH, PROD, CART, PAY **Tags:** cleanup,
100
+ refactor, technical-debt **Dependencies:** API-005, API-006, API-007, API-008
101
+
102
+ ## Dependencies
103
+
104
+ - Monitoring service setup (Sentry or alternative)
105
+ - Logging infrastructure (structured logging)
106
+
107
+ ## Notes
108
+
109
+ - Consider rate limiting errors (e.g., don't log every 401)
110
+ - May need database migration if error codes are persisted
111
+ - Client applications will need updates to handle new error format
112
+ - Rollout strategy: shadow mode first (log but don't change responses)?
113
+ - Performance impact of error middleware needs measurement
114
+
115
+ ## Open Questions
116
+
117
+ - Should we version the error response schema?
118
+ - How do we handle errors in background jobs vs API requests?
119
+ - Do we need different error formats for internal vs external APIs?
@@ -0,0 +1,57 @@
1
+ # E-commerce Platform MVP
2
+
3
+ ## Overview
4
+
5
+ Build the minimum viable product for an e-commerce platform with authentication,
6
+ product catalog, shopping cart, and payment processing.
7
+
8
+ ## Modules
9
+
10
+ ### auth
11
+
12
+ - **Path:** [./modules/auth.aps.md](./modules/auth.aps.md)
13
+ - **Scope:** AUTH
14
+ - **Owner:** @alice
15
+ - **Priority:** high
16
+ - **Tags:** security, core, backend
17
+ - **Dependencies:** (none)
18
+
19
+ ### products
20
+
21
+ - **Path:** [./modules/products.aps.md](./modules/products.aps.md)
22
+ - **Scope:** PROD
23
+ - **Owner:** @bob
24
+ - **Priority:** high
25
+ - **Tags:** catalog, backend, api
26
+ - **Dependencies:** auth
27
+
28
+ ### cart
29
+
30
+ - **Path:** [./modules/cart.aps.md](./modules/cart.aps.md)
31
+ - **Scope:** CART
32
+ - **Owner:** @carol
33
+ - **Priority:** medium
34
+ - **Tags:** shopping, backend, api
35
+ - **Dependencies:** auth, products
36
+
37
+ ### payments
38
+
39
+ - **Path:** [./modules/payments.aps.md](./modules/payments.aps.md)
40
+ - **Scope:** PAY
41
+ - **Owner:** @david
42
+ - **Priority:** high
43
+ - **Tags:** billing, stripe, backend
44
+ - **Dependencies:** auth, cart
45
+
46
+ ## Open Questions
47
+
48
+ - Do we need inventory management in MVP or can we assume unlimited stock?
49
+ - Should we support guest checkout or require authentication?
50
+ - What payment methods beyond credit card (Stripe)?
51
+
52
+ ## Decisions
53
+
54
+ - Using Stripe for payment processing (decided 2025-12-15)
55
+ - PostgreSQL for primary database (decided 2025-12-10)
56
+ - JWT for authentication tokens (decided 2025-12-10)
57
+ - Redis for session/cart caching (decided 2025-12-12)
@@ -0,0 +1,38 @@
1
+ # Authentication Module
2
+
3
+ **Scope:** AUTH **Owner:** @alice **Priority:** high
4
+
5
+ > User authentication and session management with JWT tokens.
6
+
7
+ ## Tasks
8
+
9
+ ### AUTH-001: Implement user registration
10
+
11
+ **Intent:** Create registration endpoint that validates email uniqueness and
12
+ creates user accounts **Expected Outcome:** POST /auth/register endpoint
13
+ returning user data and JWT token **Confidence:** high **Scopes:** AUTH, DB
14
+ **Tags:** api, security, registration
15
+
16
+ ### AUTH-002: Implement login endpoint
17
+
18
+ **Intent:** Create login endpoint that validates credentials and issues JWT
19
+ tokens **Expected Outcome:** POST /auth/login endpoint with rate limiting and
20
+ secure password verification **Confidence:** high **Scopes:** AUTH, DB **Tags:**
21
+ api, security, authentication **Dependencies:** AUTH-001
22
+
23
+ ### AUTH-003: Create authentication middleware
24
+
25
+ **Intent:** Build middleware to protect routes and attach user context to
26
+ requests **Expected Outcome:** Reusable middleware that validates JWT and
27
+ returns 401 for invalid tokens **Confidence:** high **Scopes:** AUTH, API
28
+ **Tags:** middleware, security **Dependencies:** AUTH-002
29
+
30
+ ## Dependencies
31
+
32
+ - Database schema for users table
33
+ - Redis for token blacklist (optional for MVP)
34
+
35
+ ## Notes
36
+
37
+ - Password reset and email verification deferred to post-MVP
38
+ - Consider OAuth integration later
@@ -0,0 +1,53 @@
1
+ # Shopping Cart Module
2
+
3
+ **Scope:** CART **Owner:** @carol **Priority:** medium
4
+
5
+ > Session-based shopping cart with Redis caching.
6
+
7
+ ## Tasks
8
+
9
+ ### CART-001: Design cart data structure
10
+
11
+ **Intent:** Define cart schema for Redis with items, quantities, and expiry
12
+ **Expected Outcome:** Documented cart data structure with TTL strategy
13
+ **Confidence:** high **Scopes:** CART, CACHE **Tags:** design, redis, data-model
14
+
15
+ ### CART-002: Implement add to cart endpoint
16
+
17
+ **Intent:** Create POST /cart/items endpoint that adds products to user cart
18
+ **Expected Outcome:** Endpoint validating product exists and updating cart in
19
+ Redis **Confidence:** high **Scopes:** CART, API, CACHE **Tags:** api, shopping
20
+ **Dependencies:** CART-001, PROD-001, AUTH-003
21
+
22
+ ### CART-003: Implement view cart endpoint
23
+
24
+ **Intent:** Create GET /cart endpoint returning current cart with product
25
+ details **Expected Outcome:** Endpoint enriching cart with product info (name,
26
+ price, availability) **Confidence:** high **Scopes:** CART, API, CACHE **Tags:**
27
+ api, shopping **Dependencies:** CART-001, CART-002
28
+
29
+ ### CART-004: Implement update cart quantity endpoint
30
+
31
+ **Intent:** Create PATCH /cart/items/:productId endpoint for quantity changes
32
+ **Expected Outcome:** Endpoint handling quantity updates and item removal (qty
33
+ = 0) **Confidence:** high **Scopes:** CART, API, CACHE **Tags:** api, shopping
34
+ **Dependencies:** CART-002
35
+
36
+ ### CART-005: Add cart total calculation
37
+
38
+ **Intent:** Calculate cart subtotal, tax, and total in cart response **Expected
39
+ Outcome:** Cart endpoint including pricing breakdown **Confidence:** medium
40
+ **Scopes:** CART, API **Tags:** pricing, calculations **Dependencies:** CART-003
41
+ **Inputs:**
42
+
43
+ - Tax calculation rules (by region or flat rate?)
44
+
45
+ ## Dependencies
46
+
47
+ - Product module for validation
48
+ - Authentication module for user context
49
+
50
+ ## Notes
51
+
52
+ - Cart persistence (save for later) deferred to phase 2
53
+ - Guest cart migration on login deferred to phase 2
@@ -0,0 +1,68 @@
1
+ # Payment Processing Module
2
+
3
+ **Scope:** PAY **Owner:** @david **Priority:** high
4
+
5
+ > Stripe integration for payment processing and order completion.
6
+
7
+ ## Tasks
8
+
9
+ ### PAY-001: Set up Stripe integration
10
+
11
+ **Intent:** Configure Stripe SDK and webhook endpoints for payment events
12
+ **Expected Outcome:** Stripe client initialised with API keys and webhook
13
+ verification **Confidence:** high **Scopes:** PAY, API **Tags:** stripe,
14
+ integration, setup
15
+
16
+ ### PAY-002: Create payment intent endpoint
17
+
18
+ **Intent:** Implement POST /payments/intents endpoint that creates Stripe
19
+ PaymentIntent **Expected Outcome:** Endpoint returning client secret for
20
+ frontend payment confirmation **Confidence:** high **Scopes:** PAY, API, CART
21
+ **Tags:** stripe, api, checkout **Dependencies:** PAY-001, CART-003, AUTH-003
22
+ **Inputs:**
23
+
24
+ - Cart total from cart module
25
+ - User information for Stripe metadata
26
+
27
+ ### PAY-003: Implement payment confirmation webhook
28
+
29
+ **Intent:** Create webhook handler for Stripe payment success events **Expected
30
+ Outcome:** Webhook that creates orders and clears carts on successful payment
31
+ **Confidence:** medium **Scopes:** PAY, API, DB, CART **Tags:** stripe,
32
+ webhooks, orders **Dependencies:** PAY-001, PAY-002
33
+
34
+ ### PAY-004: Create order model and storage
35
+
36
+ **Intent:** Define Order model with items, amounts, and payment status
37
+ **Expected Outcome:** Order model with migrations and relations to users and
38
+ products **Confidence:** high **Scopes:** PAY, DB **Tags:** database, models,
39
+ orders **Dependencies:** PROD-001, AUTH-001
40
+
41
+ ### PAY-005: Implement order history endpoint
42
+
43
+ **Intent:** Create GET /orders endpoint returning user's order history
44
+ **Expected Outcome:** Paginated list of orders with items and status
45
+ **Confidence:** high **Scopes:** PAY, API **Tags:** api, orders, history
46
+ **Dependencies:** PAY-004, AUTH-003
47
+
48
+ ### PAY-006: Add payment failure handling
49
+
50
+ **Intent:** Handle failed payments and retry logic with user notifications
51
+ **Expected Outcome:** Webhook handlers for failed/cancelled payments preserving
52
+ cart **Confidence:** low **Scopes:** PAY, API, CART **Tags:** stripe,
53
+ error-handling, webhooks **Dependencies:** PAY-003 **Inputs:**
54
+
55
+ - Retry strategy (how many attempts? manual only?)
56
+ - Notification system integration
57
+
58
+ ## Dependencies
59
+
60
+ - Authentication for user context
61
+ - Cart module for cart totals
62
+ - Product module for order items
63
+
64
+ ## Notes
65
+
66
+ - Refunds and order cancellation deferred to phase 2
67
+ - Multiple payment methods (PayPal, etc.) deferred
68
+ - Subscription payments out of scope for MVP
@@ -0,0 +1,53 @@
1
+ # Product Catalog Module
2
+
3
+ **Scope:** PROD **Owner:** @bob **Priority:** high
4
+
5
+ > Product listing, search, and detail management.
6
+
7
+ ## Tasks
8
+
9
+ ### PROD-001: Create product database model
10
+
11
+ **Intent:** Define Product model with name, description, price, SKU, and
12
+ inventory fields **Expected Outcome:** Product model with migrations,
13
+ validation, and indexes **Confidence:** high **Scopes:** PROD, DB **Tags:**
14
+ database, models
15
+
16
+ ### PROD-002: Implement product listing endpoint
17
+
18
+ **Intent:** Create GET /products endpoint with pagination, filtering, and
19
+ sorting **Expected Outcome:** Endpoint returning paginated product list with
20
+ query parameters **Confidence:** high **Scopes:** PROD, API **Tags:** api,
21
+ catalog, search **Dependencies:** PROD-001
22
+
23
+ ### PROD-003: Implement product detail endpoint
24
+
25
+ **Intent:** Create GET /products/:id endpoint returning full product information
26
+ **Expected Outcome:** Endpoint with product data including inventory status
27
+ **Confidence:** high **Scopes:** PROD, API **Tags:** api, catalog
28
+ **Dependencies:** PROD-001
29
+
30
+ ### PROD-004: Add product search functionality
31
+
32
+ **Intent:** Implement full-text search across product names and descriptions
33
+ **Expected Outcome:** GET /products/search endpoint with relevance scoring
34
+ **Confidence:** medium **Scopes:** PROD, DB, API **Tags:** search, catalog
35
+ **Dependencies:** PROD-001, PROD-002 **Inputs:**
36
+
37
+ - Search indexing strategy (PostgreSQL full-text or Elasticsearch)
38
+
39
+ ### PROD-005: Create admin product management endpoints
40
+
41
+ **Intent:** Build CRUD endpoints for product management (admin only) **Expected
42
+ Outcome:** Protected endpoints for creating, updating, deleting products
43
+ **Confidence:** high **Scopes:** PROD, API, AUTH **Tags:** admin, api, crud
44
+ **Dependencies:** PROD-001, AUTH-003
45
+
46
+ ## Dependencies
47
+
48
+ - Authentication module for admin protection
49
+
50
+ ## Notes
51
+
52
+ - Image upload/storage deferred to separate module
53
+ - Categories/tags system can be added in phase 2
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@eddacraft/anvil-aps",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./parser": "./dist/parser/index.js",
10
+ "./loader": "./dist/loader/index.js",
11
+ "./filter": "./dist/filter/index.js",
12
+ "./validator": "./dist/validator/index.js",
13
+ "./state": "./dist/state/index.js",
14
+ "./templates": "./dist/templates/index.js",
15
+ "./types": "./dist/types/index.js"
16
+ },
17
+ "dependencies": {
18
+ "@types/mdast": "^4.0.4",
19
+ "remark-parse": "^11.0.0",
20
+ "unified": "^11.0.5",
21
+ "unist-util-visit": "^5.1.0",
22
+ "zod": "^4.3.6"
23
+ },
24
+ "devDependencies": {
25
+ "vitest": "^4.0.18"
26
+ },
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.lib.json",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "typecheck": "tsc --noEmit",
32
+ "generate-templates": "pnpm build && node scripts/generate-templates.js"
33
+ }
34
+ }
package/project.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@eddacraft/anvil-aps",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/aps/src",
5
+ "projectType": "library",
6
+ "release": {
7
+ "version": {
8
+ "manifestRootsToUpdate": ["{projectRoot}/dist"],
9
+ "currentVersionResolver": "git-tag",
10
+ "fallbackCurrentVersionResolver": "disk"
11
+ }
12
+ },
13
+ "tags": [],
14
+ "targets": {
15
+ "build": {
16
+ "executor": "nx:run-script",
17
+ "outputs": ["{projectRoot}/dist"],
18
+ "options": {
19
+ "script": "build"
20
+ },
21
+ "dependsOn": ["^build"]
22
+ },
23
+ "nx-release-publish": {
24
+ "options": {
25
+ "packageRoot": "{projectRoot}/dist"
26
+ }
27
+ },
28
+ "generate-templates": {
29
+ "executor": "nx:run-script",
30
+ "outputs": ["{projectRoot}/templates"],
31
+ "options": {
32
+ "script": "generate-templates"
33
+ },
34
+ "dependsOn": ["build"]
35
+ }
36
+ }
37
+ }
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Generate APS planning document templates
4
+ *
5
+ * Usage: node generate-templates.js [output-dir]
6
+ */
7
+
8
+ import { writeFileSync, mkdirSync } from 'node:fs';
9
+ import { join } from 'node:path';
10
+ import { generateAllTemplates } from '../dist/templates/generator.js';
11
+
12
+ const OUTPUT_DIR = process.argv[2] || './templates';
13
+
14
+ try {
15
+ // Create output directory
16
+ mkdirSync(OUTPUT_DIR, { recursive: true });
17
+
18
+ // Generate all templates
19
+ const templates = generateAllTemplates();
20
+
21
+ // Write each template to a file
22
+ writeFileSync(join(OUTPUT_DIR, 'index-template.md'), templates.index, 'utf8');
23
+ writeFileSync(join(OUTPUT_DIR, 'leaf-template.md'), templates.leaf, 'utf8');
24
+ writeFileSync(join(OUTPUT_DIR, 'simple-template.md'), templates.simple, 'utf8');
25
+
26
+ console.log(`✓ Generated templates in ${OUTPUT_DIR}/`);
27
+ console.log(' - index-template.md');
28
+ console.log(' - leaf-template.md');
29
+ console.log(' - simple-template.md');
30
+ } catch (error) {
31
+ console.error('✗ Failed to generate templates:', error);
32
+ process.exit(1);
33
+ }