delimit-cli 1.0.0 → 2.1.1

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 (95) hide show
  1. package/.github/workflows/api-governance.yml +43 -0
  2. package/README.md +70 -113
  3. package/adapters/codex-skill.js +87 -0
  4. package/adapters/cursor-extension.js +190 -0
  5. package/adapters/gemini-action.js +93 -0
  6. package/adapters/openai-function.js +112 -0
  7. package/adapters/xai-plugin.js +151 -0
  8. package/bin/delimit-cli.js +921 -0
  9. package/bin/delimit.js +237 -1
  10. package/delimit.yml +19 -0
  11. package/hooks/evidence-status.sh +12 -0
  12. package/hooks/git/commit-msg +4 -0
  13. package/hooks/git/pre-commit +4 -0
  14. package/hooks/git/pre-push +4 -0
  15. package/hooks/install-hooks.sh +583 -0
  16. package/hooks/message-auth-hook.js +9 -0
  17. package/hooks/message-governance-hook.js +9 -0
  18. package/hooks/models/claude-post.js +4 -0
  19. package/hooks/models/claude-pre.js +4 -0
  20. package/hooks/models/codex-post.js +4 -0
  21. package/hooks/models/codex-pre.js +4 -0
  22. package/hooks/models/cursor-post.js +4 -0
  23. package/hooks/models/cursor-pre.js +4 -0
  24. package/hooks/models/gemini-post.js +4 -0
  25. package/hooks/models/gemini-pre.js +4 -0
  26. package/hooks/models/openai-post.js +4 -0
  27. package/hooks/models/openai-pre.js +4 -0
  28. package/hooks/models/windsurf-post.js +4 -0
  29. package/hooks/models/windsurf-pre.js +4 -0
  30. package/hooks/models/xai-post.js +4 -0
  31. package/hooks/models/xai-pre.js +4 -0
  32. package/hooks/post-bash-hook.js +13 -0
  33. package/hooks/post-mcp-hook.js +13 -0
  34. package/hooks/post-response-hook.js +4 -0
  35. package/hooks/post-tool-hook.js +126 -0
  36. package/hooks/post-write-hook.js +13 -0
  37. package/hooks/pre-bash-hook.js +30 -0
  38. package/hooks/pre-mcp-hook.js +13 -0
  39. package/hooks/pre-read-hook.js +13 -0
  40. package/hooks/pre-search-hook.js +13 -0
  41. package/hooks/pre-submit-hook.js +4 -0
  42. package/hooks/pre-task-hook.js +13 -0
  43. package/hooks/pre-tool-hook.js +121 -0
  44. package/hooks/pre-web-hook.js +13 -0
  45. package/hooks/pre-write-hook.js +31 -0
  46. package/hooks/test-hooks.sh +12 -0
  47. package/hooks/update-delimit.sh +6 -0
  48. package/lib/agent.js +509 -0
  49. package/lib/api-engine.js +156 -0
  50. package/lib/auth-setup.js +891 -0
  51. package/lib/decision-engine.js +474 -0
  52. package/lib/hooks-installer.js +416 -0
  53. package/lib/platform-adapters.js +353 -0
  54. package/lib/proxy-handler.js +114 -0
  55. package/package.json +38 -30
  56. package/scripts/infect.js +128 -0
  57. package/test-decision-engine.js +181 -0
  58. package/test-hook.js +27 -0
  59. package/dist/commands/validate.d.ts +0 -2
  60. package/dist/commands/validate.d.ts.map +0 -1
  61. package/dist/commands/validate.js +0 -106
  62. package/dist/commands/validate.js.map +0 -1
  63. package/dist/index.d.ts +0 -3
  64. package/dist/index.d.ts.map +0 -1
  65. package/dist/index.js +0 -71
  66. package/dist/index.js.map +0 -1
  67. package/dist/types/index.d.ts +0 -39
  68. package/dist/types/index.d.ts.map +0 -1
  69. package/dist/types/index.js +0 -3
  70. package/dist/types/index.js.map +0 -1
  71. package/dist/utils/api.d.ts +0 -3
  72. package/dist/utils/api.d.ts.map +0 -1
  73. package/dist/utils/api.js +0 -64
  74. package/dist/utils/api.js.map +0 -1
  75. package/dist/utils/file.d.ts +0 -7
  76. package/dist/utils/file.d.ts.map +0 -1
  77. package/dist/utils/file.js +0 -69
  78. package/dist/utils/file.js.map +0 -1
  79. package/dist/utils/logger.d.ts +0 -14
  80. package/dist/utils/logger.d.ts.map +0 -1
  81. package/dist/utils/logger.js +0 -28
  82. package/dist/utils/logger.js.map +0 -1
  83. package/dist/utils/masker.d.ts +0 -14
  84. package/dist/utils/masker.d.ts.map +0 -1
  85. package/dist/utils/masker.js +0 -89
  86. package/dist/utils/masker.js.map +0 -1
  87. package/src/commands/validate.ts +0 -150
  88. package/src/index.ts +0 -80
  89. package/src/types/index.ts +0 -41
  90. package/src/utils/api.ts +0 -68
  91. package/src/utils/file.ts +0 -71
  92. package/src/utils/logger.ts +0 -27
  93. package/src/utils/masker.ts +0 -101
  94. package/test-sensitive.yaml +0 -109
  95. package/tsconfig.json +0 -23
@@ -1,101 +0,0 @@
1
- /**
2
- * Privacy Shield Implementation
3
- * Removes sensitive data from OpenAPI specs before sending to API
4
- */
5
-
6
- export function maskSensitiveData(data: any): any {
7
- const SENSITIVE_KEYS = new Set([
8
- 'description',
9
- 'summary',
10
- 'example',
11
- 'examples',
12
- 'servers',
13
- 'contact', // Also mask contact info for privacy
14
- 'termsOfService',
15
- 'license'
16
- ]);
17
-
18
- // Handle null or undefined
19
- if (data === null || data === undefined) {
20
- return data;
21
- }
22
-
23
- // Handle arrays
24
- if (Array.isArray(data)) {
25
- return data.map(item => maskSensitiveData(item));
26
- }
27
-
28
- // Handle objects
29
- if (typeof data === 'object') {
30
- const maskedObj: Record<string, any> = {};
31
-
32
- for (const [key, value] of Object.entries(data)) {
33
- // Skip sensitive keys entirely
34
- if (SENSITIVE_KEYS.has(key)) {
35
- // For required fields like servers, provide minimal replacement
36
- if (key === 'servers') {
37
- maskedObj[key] = [{ url: 'https://api.example.com' }];
38
- }
39
- // Skip other sensitive fields
40
- continue;
41
- }
42
-
43
- // Special handling for info object - keep structure but mask content
44
- if (key === 'info' && typeof value === 'object' && value !== null) {
45
- const infoObj = value as any;
46
- maskedObj[key] = {
47
- title: infoObj.title || 'API',
48
- version: infoObj.version || '1.0.0',
49
- // Remove description, contact, license, etc.
50
- };
51
- continue;
52
- }
53
-
54
- // Recursively mask nested objects
55
- maskedObj[key] = maskSensitiveData(value);
56
- }
57
-
58
- return maskedObj;
59
- }
60
-
61
- // Return primitives as-is (strings, numbers, booleans)
62
- return data;
63
- }
64
-
65
- /**
66
- * Get statistics about what was masked
67
- */
68
- export function getMaskingStats(original: any, masked: any): {
69
- fieldsRemoved: number;
70
- bytesReduced: number;
71
- percentReduced: number;
72
- } {
73
- const originalSize = JSON.stringify(original).length;
74
- const maskedSize = JSON.stringify(masked).length;
75
- const bytesReduced = originalSize - maskedSize;
76
- const percentReduced = Math.round((bytesReduced / originalSize) * 100);
77
-
78
- // Count removed fields (simplified)
79
- const countFields = (obj: any): number => {
80
- let count = 0;
81
- if (obj && typeof obj === 'object') {
82
- for (const value of Object.values(obj)) {
83
- count++;
84
- if (typeof value === 'object') {
85
- count += countFields(value);
86
- }
87
- }
88
- }
89
- return count;
90
- };
91
-
92
- const originalFields = countFields(original);
93
- const maskedFields = countFields(masked);
94
- const fieldsRemoved = originalFields - maskedFields;
95
-
96
- return {
97
- fieldsRemoved,
98
- bytesReduced,
99
- percentReduced
100
- };
101
- }
@@ -1,109 +0,0 @@
1
- openapi: 3.0.3
2
- info:
3
- title: Proprietary Banking API
4
- version: 2.1.0
5
- description: |
6
- CONFIDENTIAL: Internal banking system for processing high-value transactions.
7
- This API handles sensitive financial data including customer SSNs, account numbers,
8
- and transaction histories. All endpoints require multi-factor authentication.
9
- Contact: security@megabank.internal
10
- contact:
11
- name: Security Team
12
- email: security@megabank.internal
13
- url: https://internal.megabank.com/security
14
- license:
15
- name: Proprietary - Internal Use Only
16
- url: https://legal.megabank.com/proprietary-license
17
- servers:
18
- - url: https://prod-api.megabank.internal
19
- description: Production server in AWS us-east-1
20
- - url: https://staging-api.megabank.internal
21
- description: Staging environment with real customer data
22
- - url: https://dev-api.megabank.internal
23
- description: Development server with anonymized data
24
- paths:
25
- /accounts/{accountId}/balance:
26
- get:
27
- summary: Get account balance with transaction history
28
- description: |
29
- Returns the current balance and last 100 transactions.
30
- This endpoint costs $0.02 per call due to mainframe access.
31
- parameters:
32
- - name: accountId
33
- in: path
34
- required: true
35
- schema:
36
- type: string
37
- example: "ACC-123456789-USD"
38
- responses:
39
- 200:
40
- description: Account balance retrieved
41
- content:
42
- application/json:
43
- schema:
44
- type: object
45
- properties:
46
- balance:
47
- type: number
48
- example: 1250000.50
49
- currency:
50
- type: string
51
- example: USD
52
- transactions:
53
- type: array
54
- items:
55
- type: object
56
- example:
57
- id: TXN-2024-001
58
- amount: 50000.00
59
- merchant: "Goldman Sachs"
60
- date: "2024-01-15"
61
- examples:
62
- highValueAccount:
63
- summary: High net worth individual account
64
- value:
65
- balance: 5750000.00
66
- currency: USD
67
- transactions:
68
- - id: TXN-2024-001
69
- amount: 250000.00
70
- merchant: "Private Jet Charter LLC"
71
- date: "2024-01-15"
72
- /transfers/wire:
73
- post:
74
- summary: Initiate wire transfer
75
- description: |
76
- SENSITIVE: This endpoint initiates SWIFT wire transfers.
77
- Maximum transfer limit: $10,000,000 per transaction.
78
- Requires VP-level approval for amounts over $1,000,000.
79
- requestBody:
80
- content:
81
- application/json:
82
- schema:
83
- type: object
84
- required:
85
- - fromAccount
86
- - toAccount
87
- - amount
88
- - currency
89
- properties:
90
- fromAccount:
91
- type: string
92
- toAccount:
93
- type: string
94
- amount:
95
- type: number
96
- currency:
97
- type: string
98
- examples:
99
- largeTransfer:
100
- summary: Large corporate transfer
101
- value:
102
- fromAccount: "ACC-CORP-001"
103
- toAccount: "SWIFT:CHASUS33XXX"
104
- amount: 5000000.00
105
- currency: "USD"
106
- memo: "Acquisition payment - Project Titan"
107
- responses:
108
- 201:
109
- description: Transfer initiated
package/tsconfig.json DELETED
@@ -1,23 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "CommonJS",
5
- "moduleResolution": "node",
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "declaration": true,
13
- "declarationMap": true,
14
- "sourceMap": true,
15
- "resolveJsonModule": true,
16
- "noUnusedLocals": true,
17
- "noUnusedParameters": true,
18
- "noImplicitReturns": true,
19
- "noFallthroughCasesInSwitch": true
20
- },
21
- "include": ["src/**/*"],
22
- "exclude": ["node_modules", "dist", "**/*.test.ts"]
23
- }