@paths.design/caws-cli 7.0.2 → 8.0.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 (217) hide show
  1. package/dist/budget-derivation.js +5 -4
  2. package/dist/commands/diagnose.js +24 -19
  3. package/dist/commands/init.js +51 -4
  4. package/dist/commands/quality-gates.js +147 -9
  5. package/dist/commands/specs.js +148 -14
  6. package/dist/commands/status.js +2 -2
  7. package/dist/commands/tool.js +2 -4
  8. package/dist/config/index.js +17 -8
  9. package/dist/generators/working-spec.js +19 -6
  10. package/dist/scaffold/git-hooks.js +245 -46
  11. package/dist/scaffold/index.js +53 -7
  12. package/dist/templates/.caws/tools/README.md +21 -0
  13. package/dist/templates/.cursor/README.md +311 -0
  14. package/dist/templates/.cursor/hooks/audit.sh +55 -0
  15. package/dist/templates/.cursor/hooks/block-dangerous.sh +83 -0
  16. package/dist/templates/.cursor/hooks/caws-quality-check.sh +52 -0
  17. package/dist/templates/.cursor/hooks/caws-scope-guard.sh +130 -0
  18. package/dist/templates/.cursor/hooks/caws-tool-validation.sh +121 -0
  19. package/dist/templates/.cursor/hooks/format.sh +38 -0
  20. package/dist/templates/.cursor/hooks/naming-check.sh +64 -0
  21. package/dist/templates/.cursor/hooks/scan-secrets.sh +46 -0
  22. package/dist/templates/.cursor/hooks/scope-guard.sh +52 -0
  23. package/dist/templates/.cursor/hooks/validate-spec.sh +83 -0
  24. package/dist/templates/.cursor/hooks.json +59 -0
  25. package/dist/templates/.cursor/rules/00-claims-verification.mdc +144 -0
  26. package/dist/templates/.cursor/rules/01-working-style.mdc +50 -0
  27. package/dist/templates/.cursor/rules/02-quality-gates.mdc +370 -0
  28. package/dist/templates/.cursor/rules/03-naming-and-refactor.mdc +33 -0
  29. package/dist/templates/.cursor/rules/04-logging-language-style.mdc +23 -0
  30. package/dist/templates/.cursor/rules/05-safe-defaults-guards.mdc +23 -0
  31. package/dist/templates/.cursor/rules/06-typescript-conventions.mdc +36 -0
  32. package/dist/templates/.cursor/rules/07-process-ops.mdc +20 -0
  33. package/dist/templates/.cursor/rules/08-solid-and-architecture.mdc +16 -0
  34. package/dist/templates/.cursor/rules/09-docstrings.mdc +89 -0
  35. package/dist/templates/.cursor/rules/10-documentation-quality-standards.mdc +390 -0
  36. package/dist/templates/.cursor/rules/11-scope-management-waivers.mdc +385 -0
  37. package/dist/templates/.cursor/rules/12-implementation-completeness.mdc +516 -0
  38. package/dist/templates/.cursor/rules/13-language-agnostic-standards.mdc +588 -0
  39. package/dist/templates/.cursor/rules/README.md +148 -0
  40. package/dist/templates/.github/copilot/instructions.md +311 -0
  41. package/dist/templates/.idea/runConfigurations/CAWS_Evaluate.xml +5 -0
  42. package/dist/templates/.idea/runConfigurations/CAWS_Validate.xml +5 -0
  43. package/dist/templates/.vscode/launch.json +56 -0
  44. package/dist/templates/.vscode/settings.json +93 -0
  45. package/dist/templates/.windsurf/workflows/caws-guided-development.md +92 -0
  46. package/dist/templates/COMMIT_CONVENTIONS.md +86 -0
  47. package/dist/templates/OIDC_SETUP.md +300 -0
  48. package/dist/templates/agents.md +1047 -0
  49. package/dist/templates/codemod/README.md +1 -0
  50. package/dist/templates/codemod/test.js +93 -0
  51. package/dist/templates/docs/README.md +150 -0
  52. package/dist/templates/scripts/quality-gates/check-god-objects.js +146 -0
  53. package/dist/templates/scripts/quality-gates/run-quality-gates.js +50 -0
  54. package/dist/templates/scripts/v3/analysis/todo_analyzer.py +1997 -0
  55. package/dist/tool-loader.js +6 -1
  56. package/dist/tool-validator.js +8 -2
  57. package/dist/utils/detection.js +4 -3
  58. package/dist/utils/git-lock.js +119 -0
  59. package/dist/utils/gitignore-updater.js +148 -0
  60. package/dist/utils/project-analysis.js +176 -16
  61. package/dist/utils/quality-gates.js +48 -7
  62. package/dist/utils/spec-resolver.js +27 -3
  63. package/dist/utils/yaml-validation.js +156 -0
  64. package/dist/validation/spec-validation.js +81 -2
  65. package/package.json +2 -2
  66. package/templates/.caws/schemas/waivers.schema.json +30 -0
  67. package/templates/.caws/schemas/working-spec.schema.json +133 -0
  68. package/templates/.caws/templates/working-spec.template.yml +74 -0
  69. package/templates/.caws/tools/README.md +21 -0
  70. package/templates/.caws/tools/scope-guard.js +208 -0
  71. package/templates/.caws/tools-allow.json +331 -0
  72. package/templates/.caws/waivers.yml +19 -0
  73. package/templates/.cursor/hooks/scope-guard.sh +2 -2
  74. package/templates/.cursor/hooks/validate-spec.sh +42 -7
  75. package/dist/budget-derivation.d.ts +0 -74
  76. package/dist/budget-derivation.d.ts.map +0 -1
  77. package/dist/cicd-optimizer.d.ts +0 -142
  78. package/dist/cicd-optimizer.d.ts.map +0 -1
  79. package/dist/commands/archive.d.ts +0 -50
  80. package/dist/commands/archive.d.ts.map +0 -1
  81. package/dist/commands/burnup.d.ts +0 -6
  82. package/dist/commands/burnup.d.ts.map +0 -1
  83. package/dist/commands/diagnose.d.ts +0 -52
  84. package/dist/commands/diagnose.d.ts.map +0 -1
  85. package/dist/commands/evaluate.d.ts +0 -8
  86. package/dist/commands/evaluate.d.ts.map +0 -1
  87. package/dist/commands/init.d.ts +0 -5
  88. package/dist/commands/init.d.ts.map +0 -1
  89. package/dist/commands/iterate.d.ts +0 -8
  90. package/dist/commands/iterate.d.ts.map +0 -1
  91. package/dist/commands/mode.d.ts +0 -24
  92. package/dist/commands/mode.d.ts.map +0 -1
  93. package/dist/commands/plan.d.ts +0 -49
  94. package/dist/commands/plan.d.ts.map +0 -1
  95. package/dist/commands/provenance.d.ts +0 -32
  96. package/dist/commands/provenance.d.ts.map +0 -1
  97. package/dist/commands/quality-gates.d.ts +0 -52
  98. package/dist/commands/quality-gates.d.ts.map +0 -1
  99. package/dist/commands/quality-monitor.d.ts +0 -17
  100. package/dist/commands/quality-monitor.d.ts.map +0 -1
  101. package/dist/commands/specs.d.ts +0 -71
  102. package/dist/commands/specs.d.ts.map +0 -1
  103. package/dist/commands/status.d.ts +0 -44
  104. package/dist/commands/status.d.ts.map +0 -1
  105. package/dist/commands/templates.d.ts +0 -74
  106. package/dist/commands/templates.d.ts.map +0 -1
  107. package/dist/commands/tool.d.ts +0 -13
  108. package/dist/commands/tool.d.ts.map +0 -1
  109. package/dist/commands/troubleshoot.d.ts +0 -8
  110. package/dist/commands/troubleshoot.d.ts.map +0 -1
  111. package/dist/commands/tutorial.d.ts +0 -55
  112. package/dist/commands/tutorial.d.ts.map +0 -1
  113. package/dist/commands/validate.d.ts +0 -15
  114. package/dist/commands/validate.d.ts.map +0 -1
  115. package/dist/commands/waivers.d.ts +0 -8
  116. package/dist/commands/waivers.d.ts.map +0 -1
  117. package/dist/commands/workflow.d.ts +0 -85
  118. package/dist/commands/workflow.d.ts.map +0 -1
  119. package/dist/config/index.d.ts +0 -29
  120. package/dist/config/index.d.ts.map +0 -1
  121. package/dist/config/modes.d.ts +0 -225
  122. package/dist/config/modes.d.ts.map +0 -1
  123. package/dist/constants/spec-types.d.ts +0 -41
  124. package/dist/constants/spec-types.d.ts.map +0 -1
  125. package/dist/error-handler.d.ts +0 -164
  126. package/dist/error-handler.d.ts.map +0 -1
  127. package/dist/generators/jest-config.d.ts +0 -32
  128. package/dist/generators/jest-config.d.ts.map +0 -1
  129. package/dist/generators/working-spec.d.ts +0 -13
  130. package/dist/generators/working-spec.d.ts.map +0 -1
  131. package/dist/index-new.d.ts +0 -5
  132. package/dist/index-new.d.ts.map +0 -1
  133. package/dist/index-new.js +0 -317
  134. package/dist/index.d.ts +0 -5
  135. package/dist/index.d.ts.map +0 -1
  136. package/dist/index.js.backup +0 -4711
  137. package/dist/minimal-cli.d.ts +0 -3
  138. package/dist/minimal-cli.d.ts.map +0 -1
  139. package/dist/policy/PolicyManager.d.ts +0 -104
  140. package/dist/policy/PolicyManager.d.ts.map +0 -1
  141. package/dist/scaffold/cursor-hooks.d.ts +0 -7
  142. package/dist/scaffold/cursor-hooks.d.ts.map +0 -1
  143. package/dist/scaffold/git-hooks.d.ts +0 -20
  144. package/dist/scaffold/git-hooks.d.ts.map +0 -1
  145. package/dist/scaffold/index.d.ts +0 -20
  146. package/dist/scaffold/index.d.ts.map +0 -1
  147. package/dist/spec/SpecFileManager.d.ts +0 -146
  148. package/dist/spec/SpecFileManager.d.ts.map +0 -1
  149. package/dist/test-analysis.d.ts +0 -182
  150. package/dist/test-analysis.d.ts.map +0 -1
  151. package/dist/tool-interface.d.ts +0 -236
  152. package/dist/tool-interface.d.ts.map +0 -1
  153. package/dist/tool-loader.d.ts +0 -77
  154. package/dist/tool-loader.d.ts.map +0 -1
  155. package/dist/tool-validator.d.ts +0 -72
  156. package/dist/tool-validator.d.ts.map +0 -1
  157. package/dist/utils/detection.d.ts +0 -7
  158. package/dist/utils/detection.d.ts.map +0 -1
  159. package/dist/utils/finalization.d.ts +0 -17
  160. package/dist/utils/finalization.d.ts.map +0 -1
  161. package/dist/utils/project-analysis.d.ts +0 -14
  162. package/dist/utils/project-analysis.d.ts.map +0 -1
  163. package/dist/utils/quality-gates.d.ts +0 -49
  164. package/dist/utils/quality-gates.d.ts.map +0 -1
  165. package/dist/utils/spec-resolver.d.ts +0 -88
  166. package/dist/utils/spec-resolver.d.ts.map +0 -1
  167. package/dist/utils/typescript-detector.d.ts +0 -63
  168. package/dist/utils/typescript-detector.d.ts.map +0 -1
  169. package/dist/validation/spec-validation.d.ts +0 -43
  170. package/dist/validation/spec-validation.d.ts.map +0 -1
  171. package/dist/waivers-manager.d.ts +0 -167
  172. package/dist/waivers-manager.d.ts.map +0 -1
  173. package/templates/apps/tools/caws/COMPLETION_REPORT.md +0 -331
  174. package/templates/apps/tools/caws/MIGRATION_SUMMARY.md +0 -360
  175. package/templates/apps/tools/caws/README.md +0 -463
  176. package/templates/apps/tools/caws/TEST_STATUS.md +0 -365
  177. package/templates/apps/tools/caws/attest.js +0 -357
  178. package/templates/apps/tools/caws/ci-optimizer.js +0 -642
  179. package/templates/apps/tools/caws/config.ts +0 -245
  180. package/templates/apps/tools/caws/cross-functional.js +0 -876
  181. package/templates/apps/tools/caws/dashboard.js +0 -1112
  182. package/templates/apps/tools/caws/flake-detector.ts +0 -362
  183. package/templates/apps/tools/caws/gates.js +0 -198
  184. package/templates/apps/tools/caws/gates.ts +0 -271
  185. package/templates/apps/tools/caws/language-adapters.ts +0 -381
  186. package/templates/apps/tools/caws/language-support.d.ts +0 -367
  187. package/templates/apps/tools/caws/language-support.d.ts.map +0 -1
  188. package/templates/apps/tools/caws/language-support.js +0 -585
  189. package/templates/apps/tools/caws/legacy-assessment.ts +0 -408
  190. package/templates/apps/tools/caws/legacy-assessor.js +0 -764
  191. package/templates/apps/tools/caws/mutant-analyzer.js +0 -734
  192. package/templates/apps/tools/caws/perf-budgets.ts +0 -349
  193. package/templates/apps/tools/caws/prompt-lint.js.backup +0 -274
  194. package/templates/apps/tools/caws/property-testing.js +0 -707
  195. package/templates/apps/tools/caws/provenance.d.ts +0 -14
  196. package/templates/apps/tools/caws/provenance.d.ts.map +0 -1
  197. package/templates/apps/tools/caws/provenance.js +0 -132
  198. package/templates/apps/tools/caws/provenance.js.backup +0 -73
  199. package/templates/apps/tools/caws/provenance.ts +0 -211
  200. package/templates/apps/tools/caws/security-provenance.ts +0 -483
  201. package/templates/apps/tools/caws/shared/base-tool.ts +0 -281
  202. package/templates/apps/tools/caws/shared/config-manager.ts +0 -366
  203. package/templates/apps/tools/caws/shared/gate-checker.ts +0 -849
  204. package/templates/apps/tools/caws/shared/types.ts +0 -444
  205. package/templates/apps/tools/caws/shared/validator.ts +0 -305
  206. package/templates/apps/tools/caws/shared/waivers-manager.ts +0 -174
  207. package/templates/apps/tools/caws/spec-test-mapper.ts +0 -391
  208. package/templates/apps/tools/caws/test-quality.js +0 -578
  209. package/templates/apps/tools/caws/validate.js +0 -76
  210. package/templates/apps/tools/caws/validate.ts +0 -228
  211. package/templates/apps/tools/caws/waivers.js +0 -344
  212. /package/{templates/apps/tools/caws → dist/templates/.caws}/schemas/waivers.schema.json +0 -0
  213. /package/{templates/apps/tools/caws → dist/templates/.caws}/schemas/working-spec.schema.json +0 -0
  214. /package/{templates/apps/tools/caws → dist/templates/.caws}/templates/working-spec.template.yml +0 -0
  215. /package/{templates/apps/tools/caws → dist/templates/.caws/tools}/scope-guard.js +0 -0
  216. /package/{templates/apps/tools/caws → dist/templates/.caws}/tools-allow.json +0 -0
  217. /package/{templates/apps/tools/caws → dist/templates/.caws}/waivers.yml +0 -0
@@ -0,0 +1,92 @@
1
+ # /caws-guided-development
2
+
3
+ ## CAWS-Guided Feature Development Workflow
4
+
5
+ **Purpose**: Guide agents through feature development with CAWS quality assurance
6
+
7
+ **Tags**: development, quality, caws, feature
8
+
9
+ ---
10
+
11
+ ### 1. Initialize CAWS Working Spec
12
+ ```
13
+ # Create comprehensive working specification
14
+ caws init feature-name --interactive
15
+
16
+ # Define acceptance criteria, scope, and risk assessment
17
+ # Working spec: .caws/working-spec.yaml
18
+ ```
19
+
20
+ ### 2. Plan Implementation Strategy
21
+ ```
22
+ # Get CAWS guidance for implementation approach
23
+ caws agent iterate --current-state "Planning phase complete, need implementation strategy"
24
+
25
+ # CAWS will suggest:
26
+ # - Implementation steps
27
+ # - Quality gates to consider
28
+ # - Risk mitigation strategies
29
+ # - Testing approach
30
+ ```
31
+
32
+ ### 3. Implement Core Functionality
33
+ ```
34
+ # Start coding with CAWS quality monitoring
35
+ # Real-time feedback via CAWS tools
36
+
37
+ # Regular quality checks
38
+ caws agent evaluate --quiet
39
+ ```
40
+
41
+ ### 4. Quality Assurance Integration
42
+ ```
43
+ # Run comprehensive quality gates
44
+ caws validate
45
+
46
+ # Address any failing gates
47
+ # Create waivers if justified
48
+ caws waivers create --reason emergency_hotfix --gates coverage_threshold
49
+ ```
50
+
51
+ ### 5. Testing & Validation
52
+ ```
53
+ # Unit tests
54
+ npm run test:unit
55
+
56
+ # Integration tests
57
+ npm run test:integration
58
+
59
+ # Contract tests
60
+ npm run test:contract
61
+ ```
62
+
63
+ ### 6. Final Quality Review
64
+ ```
65
+ # Complete CAWS evaluation
66
+ caws agent evaluate
67
+
68
+ # Generate provenance report
69
+ caws provenance generate
70
+
71
+ # Ready for integration
72
+ ```
73
+
74
+ ---
75
+
76
+ **Quality Gates**:
77
+ - ✅ Working spec validation
78
+ - ✅ Code quality standards
79
+ - ✅ Test coverage requirements
80
+ - ✅ Security scanning
81
+ - ✅ Performance budgets
82
+
83
+ **Success Criteria**:
84
+ - All CAWS quality gates pass
85
+ - Acceptance criteria met
86
+ - No critical security issues
87
+ - Performance requirements satisfied
88
+
89
+ **Call Other Workflows**:
90
+ - `/caws-testing-workflow` - Comprehensive testing
91
+ - `/caws-security-review` - Security validation
92
+ - `/caws-deployment-checklist` - Deployment preparation
@@ -0,0 +1,86 @@
1
+ # Commit Message Conventions
2
+
3
+ This repository uses [Conventional Commits](https://conventionalcommits.org/) for automated versioning and changelog generation.
4
+
5
+ ## Format
6
+
7
+ ```
8
+ <type>[optional scope]: <description>
9
+
10
+ [optional body]
11
+
12
+ [optional footer(s)]
13
+ ```
14
+
15
+ ## Types
16
+
17
+ - **feat**: A new feature
18
+ - **fix**: A bug fix
19
+ - **docs**: Documentation only changes
20
+ - **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
21
+ - **refactor**: A code change that neither fixes a bug nor adds a feature
22
+ - **perf**: A code change that improves performance
23
+ - **test**: Adding missing tests or correcting existing tests
24
+ - **build**: Changes that affect the build system or external dependencies
25
+ - **ci**: Changes to our CI configuration files and scripts
26
+ - **chore**: Other changes that don't modify src or test files
27
+
28
+ ## Examples
29
+
30
+ ### Feature
31
+ ```
32
+ feat: add user authentication system
33
+ ```
34
+
35
+ ### Bug Fix
36
+ ```
37
+ fix: resolve memory leak in data processing
38
+ ```
39
+
40
+ ### Documentation
41
+ ```
42
+ docs: update API documentation for new endpoints
43
+ ```
44
+
45
+ ### Refactoring
46
+ ```
47
+ refactor: extract user validation logic into separate module
48
+ ```
49
+
50
+ ### Breaking Change
51
+ ```
52
+ feat!: change API response format for user data
53
+
54
+ BREAKING CHANGE: The user object now returns additional fields and the format has changed
55
+ ```
56
+
57
+ ## Scope
58
+
59
+ The scope should be the name of the package or module affected by the change:
60
+
61
+ ```
62
+ feat(auth): add OAuth2 authentication
63
+ fix(api): resolve endpoint timeout issue
64
+ docs(cli): update installation instructions
65
+ ```
66
+
67
+ ## Automated Publishing
68
+
69
+ Commits following these conventions will automatically:
70
+
71
+ 1. **Trigger releases** when pushed to `main`
72
+ 2. **Generate changelogs** based on commit messages
73
+ 3. **Bump versions** according to semantic versioning:
74
+ - `fix:` → patch release (1.0.0 → 1.0.1)
75
+ - `feat:` → minor release (1.0.0 → 1.1.0)
76
+ - `feat!:` → major release (1.0.0 → 2.0.0)
77
+
78
+ ## CI/CD Integration
79
+
80
+ The automated release process includes:
81
+ - ✅ Linting and testing
82
+ - ✅ Package building
83
+ - ✅ NPM publishing with OIDC authentication
84
+ - ✅ Changelog generation
85
+ - ✅ Git tag creation
86
+ - ✅ Release notes generation
@@ -0,0 +1,300 @@
1
+ # OIDC Trusted Publisher Setup
2
+
3
+ This guide helps you set up OIDC (OpenID Connect) trusted publisher for automated publishing to package registries.
4
+
5
+ ## Overview
6
+
7
+ OIDC trusted publisher allows you to publish packages without storing long-lived tokens or passwords in your CI/CD environment. Instead, it uses short-lived tokens issued by the OIDC provider.
8
+
9
+ ## Supported Registries
10
+
11
+ - **npm**: npm Registry
12
+ - **PyPI**: Python Package Index
13
+ - **Maven Central**: Java packages
14
+ - **NuGet**: .NET packages
15
+
16
+ ## Setup Process
17
+
18
+ ### 1. Configure OIDC Provider
19
+
20
+ Most CI/CD platforms (GitHub Actions, GitLab CI, etc.) provide built-in OIDC support.
21
+
22
+ **GitHub Actions Example:**
23
+
24
+ ```yaml
25
+ # .github/workflows/publish.yml
26
+ name: Publish Package
27
+
28
+ on:
29
+ release:
30
+ types: [published]
31
+
32
+ jobs:
33
+ publish:
34
+ runs-on: ubuntu-latest
35
+ permissions:
36
+ contents: read
37
+ id-token: write
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - name: Setup Node.js
41
+ uses: actions/setup-node@v4
42
+ with:
43
+ node-version: '20'
44
+ registry-url: 'https://registry.npmjs.org'
45
+ - name: Install dependencies
46
+ run: npm ci
47
+ - name: Build package
48
+ run: npm run build
49
+ - name: Publish to npm
50
+ run: npm publish
51
+ env:
52
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
53
+ ```
54
+
55
+ ### 2. Registry Configuration
56
+
57
+ #### npm Registry
58
+
59
+ 1. **Create OIDC Integration**:
60
+
61
+ ```bash
62
+ # Using npm CLI
63
+ npm profile enable-2fa auth-and-writes
64
+ ```
65
+
66
+ 2. **Configure Trusted Publisher**:
67
+ - Go to npmjs.com → Account Settings → Access Tokens
68
+ - Create "Automation" token
69
+ - Configure OIDC integration
70
+
71
+ 3. **Repository Settings**:
72
+ ```json
73
+ // package.json
74
+ {
75
+ "publishConfig": {
76
+ "registry": "https://registry.npmjs.org/"
77
+ }
78
+ }
79
+ ```
80
+
81
+ #### PyPI (Python)
82
+
83
+ 1. **Create API Token**:
84
+
85
+ ```bash
86
+ # Using twine
87
+ twine upload --config-file ~/.pypirc dist/*
88
+ ```
89
+
90
+ 2. **OIDC Configuration**:
91
+ ```yaml
92
+ # .github/workflows/publish.yml
93
+ - name: Publish to PyPI
94
+ uses: pypa/gh-action-pypi-publish@release/v1
95
+ with:
96
+ password: ${{ secrets.PYPI_API_TOKEN }}
97
+ ```
98
+
99
+ ### 3. Security Best Practices
100
+
101
+ #### Token Management
102
+
103
+ - ✅ **Use short-lived tokens** (1-6 hours)
104
+ - ✅ **Scope tokens to specific repositories**
105
+ - ✅ **Rotate tokens regularly**
106
+ - ❌ **Never store long-lived tokens in code**
107
+ - ❌ **Never commit tokens to version control**
108
+
109
+ #### Environment Variables
110
+
111
+ ```bash
112
+ # Good: Short-lived, scoped token
113
+ NODE_AUTH_TOKEN=gho_shortlivedtoken123
114
+
115
+ # Bad: Long-lived, broad token
116
+ NPM_TOKEN=longlivedbroadtoken456
117
+ ```
118
+
119
+ #### Repository Secrets
120
+
121
+ Store sensitive tokens in repository secrets:
122
+
123
+ **GitHub**: Settings → Secrets and variables → Actions
124
+ **GitLab**: Settings → CI/CD → Variables
125
+ **Azure DevOps**: Pipelines → Library → Variable groups
126
+
127
+ ### 4. Testing the Setup
128
+
129
+ #### Local Testing
130
+
131
+ ```bash
132
+ # Test with dry run
133
+ npm publish --dry-run
134
+
135
+ # Test with local registry
136
+ npm publish --registry http://localhost:4873
137
+ ```
138
+
139
+ #### CI/CD Testing
140
+
141
+ ```yaml
142
+ # Add to your workflow for testing
143
+ - name: Test publish (dry run)
144
+ run: npm publish --dry-run
145
+ env:
146
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
147
+ ```
148
+
149
+ ### 5. Troubleshooting
150
+
151
+ #### Common Issues
152
+
153
+ **Token Expired**:
154
+
155
+ ```
156
+ npm ERR! code E401
157
+ npm ERR! Unable to authenticate, need: Basic
158
+ ```
159
+
160
+ **Solution**: Check token expiration and refresh if needed.
161
+
162
+ **Insufficient Permissions**:
163
+
164
+ ```
165
+ npm ERR! code E403
166
+ npm ERR! Forbidden
167
+ ```
168
+
169
+ **Solution**: Verify token has publish permissions for the package.
170
+
171
+ **OIDC Provider Issues**:
172
+
173
+ ```
174
+ Error: Failed to get OIDC token
175
+ ```
176
+
177
+ **Solution**: Check OIDC provider configuration and permissions.
178
+
179
+ #### Debug Mode
180
+
181
+ Enable debug logging:
182
+
183
+ ```bash
184
+ # npm
185
+ npm config set loglevel verbose
186
+
187
+ # Python
188
+ export TWINE_VERBOSE=1
189
+
190
+ # Maven
191
+ mvn deploy -X
192
+ ```
193
+
194
+ ### 6. Migration from Legacy Tokens
195
+
196
+ If you're migrating from username/password or long-lived tokens:
197
+
198
+ 1. **Audit existing tokens**:
199
+
200
+ ```bash
201
+ # npm
202
+ npm profile get
203
+
204
+ # List all tokens
205
+ npm token list
206
+ ```
207
+
208
+ 2. **Revoke old tokens**:
209
+
210
+ ```bash
211
+ npm token delete <token-id>
212
+ ```
213
+
214
+ 3. **Update CI/CD workflows**:
215
+ - Replace `NPM_TOKEN` with `NODE_AUTH_TOKEN`
216
+ - Add OIDC permissions
217
+ - Test in staging environment
218
+
219
+ ### 7. Monitoring and Alerts
220
+
221
+ Set up monitoring for:
222
+
223
+ - **Publish failures**: Alert on failed deployments
224
+ - **Token expiration**: Proactive token renewal
225
+ - **Security events**: Unusual publish patterns
226
+ - **Registry status**: External service health
227
+
228
+ #### Example Monitoring
229
+
230
+ ```yaml
231
+ # .github/workflows/monitor.yml
232
+ name: Monitor Publishing
233
+
234
+ on:
235
+ workflow_run:
236
+ workflows: ['Publish Package']
237
+ types: [completed]
238
+
239
+ jobs:
240
+ monitor:
241
+ runs-on: ubuntu-latest
242
+ steps:
243
+ - name: Check publish status
244
+ if: ${{ github.event.workflow_run.conclusion == 'failure' }}
245
+ run: |
246
+ echo "Publish failed! Check logs."
247
+ # Send alert to Slack/Teams/etc.
248
+ ```
249
+
250
+ ## CAWS Integration
251
+
252
+ For CAWS projects, OIDC setup integrates with:
253
+
254
+ - **Provenance tracking**: Automatic attestation of published packages
255
+ - **Security scanning**: Validation of published artifacts
256
+ - **Quality gates**: Ensure packages meet standards before publish
257
+
258
+ ### CAWS-Specific Configuration
259
+
260
+ ```yaml
261
+ # .caws/working-spec.yaml
262
+ non_functional:
263
+ security:
264
+ - 'oidc-authentication'
265
+ - 'token-rotation'
266
+ - 'publish-attestation'
267
+ ```
268
+
269
+ ### Automated Provenance
270
+
271
+ CAWS automatically generates provenance information:
272
+
273
+ ```bash
274
+ # Generate SBOM and attestation
275
+ caws attest --format=slsa
276
+
277
+ # Validate before publish
278
+ caws validate --security-scan
279
+ ```
280
+
281
+ ## Resources
282
+
283
+ - [npm OIDC Documentation](https://docs.npmjs.com/about-access-tokens)
284
+ - [GitHub Actions OIDC](https://docs.github.com/en/actions/deployment/security/hardening-your-deployments/about-security-hardening-with-openid-connect)
285
+ - [PyPI Trusted Publishing](https://docs.pypi.org/trusted-publishing/)
286
+ - [OIDC Specification](https://openid.net/connect/)
287
+
288
+ ## Support
289
+
290
+ For issues with OIDC setup:
291
+
292
+ 1. Check the troubleshooting section above
293
+ 2. Review registry-specific documentation
294
+ 3. Open an issue in the CAWS repository
295
+ 4. Contact your organization's security team
296
+
297
+ ---
298
+
299
+ **Note**: This guide provides general OIDC setup instructions. Always follow your organization's specific security policies and procedures.
300
+