delimit-cli 3.6.2 → 3.6.4

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 (56) hide show
  1. package/README.md +125 -30
  2. package/gateway/ai/governance.py +4 -0
  3. package/package.json +11 -2
  4. package/.dockerignore +0 -7
  5. package/.github/workflows/api-governance.yml +0 -43
  6. package/.github/workflows/ci.yml +0 -22
  7. package/CODE_OF_CONDUCT.md +0 -48
  8. package/CONTRIBUTING.md +0 -67
  9. package/Dockerfile +0 -9
  10. package/SECURITY.md +0 -42
  11. package/adapters/codex-forge.js +0 -107
  12. package/adapters/codex-jamsons.js +0 -142
  13. package/adapters/codex-security.js +0 -94
  14. package/adapters/gemini-forge.js +0 -120
  15. package/adapters/gemini-jamsons.js +0 -152
  16. package/delimit.yml +0 -19
  17. package/glama.json +0 -1
  18. package/hooks/evidence-status.sh +0 -12
  19. package/hooks/git/commit-msg +0 -4
  20. package/hooks/git/pre-commit +0 -4
  21. package/hooks/git/pre-push +0 -4
  22. package/hooks/install-hooks.sh +0 -583
  23. package/hooks/message-auth-hook.js +0 -9
  24. package/hooks/message-governance-hook.js +0 -9
  25. package/hooks/models/claude-post.js +0 -4
  26. package/hooks/models/claude-pre.js +0 -4
  27. package/hooks/models/codex-post.js +0 -4
  28. package/hooks/models/codex-pre.js +0 -4
  29. package/hooks/models/cursor-post.js +0 -4
  30. package/hooks/models/cursor-pre.js +0 -4
  31. package/hooks/models/gemini-post.js +0 -4
  32. package/hooks/models/gemini-pre.js +0 -4
  33. package/hooks/models/openai-post.js +0 -4
  34. package/hooks/models/openai-pre.js +0 -4
  35. package/hooks/models/windsurf-post.js +0 -4
  36. package/hooks/models/windsurf-pre.js +0 -4
  37. package/hooks/models/xai-post.js +0 -4
  38. package/hooks/models/xai-pre.js +0 -4
  39. package/hooks/post-bash-hook.js +0 -13
  40. package/hooks/post-mcp-hook.js +0 -13
  41. package/hooks/post-response-hook.js +0 -4
  42. package/hooks/post-tool-hook.js +0 -126
  43. package/hooks/post-write-hook.js +0 -13
  44. package/hooks/pre-bash-hook.js +0 -30
  45. package/hooks/pre-mcp-hook.js +0 -13
  46. package/hooks/pre-read-hook.js +0 -13
  47. package/hooks/pre-search-hook.js +0 -13
  48. package/hooks/pre-submit-hook.js +0 -4
  49. package/hooks/pre-task-hook.js +0 -13
  50. package/hooks/pre-tool-hook.js +0 -121
  51. package/hooks/pre-web-hook.js +0 -13
  52. package/hooks/pre-write-hook.js +0 -31
  53. package/hooks/test-hooks.sh +0 -12
  54. package/hooks/update-delimit.sh +0 -6
  55. package/scripts/infect.js +0 -128
  56. package/tests/setup-onboarding.test.js +0 -147
@@ -1,142 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Delimit™ Codex Jamsons Adapter
4
- * Layer: Jamsons OS (strategy + operational governance)
5
- * Injects portfolio context, logs decisions, surfaces venture/priority state.
6
- */
7
-
8
- 'use strict';
9
-
10
- const axios = require('axios');
11
- const AGENT_URL = `http://127.0.0.1:${process.env.DELIMIT_AGENT_PORT || 7823}`;
12
- const JAMSONS_URL = `http://localhost:${process.env.JAMSONS_PORT || 8091}`;
13
-
14
- const VENTURES = {
15
- delimit: { priority: 'P0', status: 'active' },
16
- domainvested: { priority: 'P2', status: 'maintenance' },
17
- 'wire.report': { priority: 'held', status: 'held' },
18
- 'livetube.ai': { priority: 'held', status: 'held' },
19
- };
20
-
21
- class DelimitCodexJamsons {
22
- constructor() {
23
- this.name = 'delimit-jamsons';
24
- this.version = '1.0.0';
25
- }
26
-
27
- /**
28
- * Before suggestion: inject portfolio context so the model has strategic awareness.
29
- */
30
- async onBeforeSuggestion(context) {
31
- try {
32
- const portfolioCtx = await this._getPortfolioContext(context);
33
- // Attach context metadata — Codex passes this through to the model
34
- context._jamsons = portfolioCtx;
35
- } catch (_) { /* fail open */ }
36
- return { allow: true };
37
- }
38
-
39
- async onAfterAccept(context) {
40
- // Log accepted suggestion to Jamsons decision ledger
41
- try {
42
- await axios.post(`${JAMSONS_URL}/api/chatops/decisions`, {
43
- type: 'task',
44
- title: `Codex: accepted suggestion in ${context.file || 'unknown file'}`,
45
- detail: `Language: ${context.language || 'unknown'} | Tool: codex`,
46
- user_id: 'codex-adapter',
47
- tags: ['delimit', 'chatops'],
48
- }, {
49
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
50
- timeout: 2000,
51
- });
52
- } catch (_) { /* silent */ }
53
- }
54
-
55
- async _getPortfolioContext(context) {
56
- const [memory, decisions] = await Promise.allSettled([
57
- this._searchMemory(context.file || context.language || 'delimit'),
58
- this._getPendingDecisions(),
59
- ]);
60
-
61
- return {
62
- ventures: VENTURES,
63
- activeVenture: this._detectVenture(context),
64
- memory: memory.status === 'fulfilled' ? memory.value : [],
65
- pendingDecisions: decisions.status === 'fulfilled' ? decisions.value : [],
66
- timestamp: new Date().toISOString(),
67
- };
68
- }
69
-
70
- _detectVenture(context) {
71
- const path = (context.file || '').toLowerCase();
72
- if (path.includes('delimit')) return 'delimit';
73
- if (path.includes('domainvested')) return 'domainvested';
74
- return 'delimit'; // default active venture
75
- }
76
-
77
- async _searchMemory(query) {
78
- const r = await axios.get(`${JAMSONS_URL}/api/memory/search`, {
79
- params: { q: query, limit: 5 },
80
- timeout: 2000,
81
- });
82
- return r.data?.results || [];
83
- }
84
-
85
- async _getPendingDecisions() {
86
- const r = await axios.get(`${JAMSONS_URL}/api/chatops/decisions`, {
87
- params: { status: 'pending', limit: 5 },
88
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
89
- timeout: 2000,
90
- });
91
- return r.data?.decisions || r.data || [];
92
- }
93
-
94
- async handleCommand(command, _args) {
95
- const { execSync } = require('child_process');
96
- const cmds = {
97
- 'jamsons': 'delimit status --layer=jamsons',
98
- 'portfolio': 'delimit portfolio --summary',
99
- 'decisions': 'delimit decisions --pending',
100
- 'memory': 'delimit memory --recent',
101
- };
102
- if (cmds[command]) {
103
- try {
104
- return execSync(cmds[command], { timeout: 10000 }).toString();
105
- } catch (e) {
106
- return `[JAMSONS] Command failed: ${e.message}`;
107
- }
108
- }
109
- }
110
-
111
- /**
112
- * Returns structured Jamsons context for consensus use.
113
- */
114
- async getContext() {
115
- const [memory, decisions] = await Promise.allSettled([
116
- axios.get(`${JAMSONS_URL}/api/memory/search`, {
117
- params: { q: 'delimit strategy', limit: 5 },
118
- timeout: 3000,
119
- }),
120
- axios.get(`${JAMSONS_URL}/api/chatops/decisions`, {
121
- params: { status: 'pending' },
122
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
123
- timeout: 3000,
124
- }),
125
- ]);
126
-
127
- return {
128
- layer: 'jamsons',
129
- ventures: VENTURES,
130
- memory: memory.status === 'fulfilled' ? (memory.value.data?.results || []) : null,
131
- pendingDecisions: decisions.status === 'fulfilled' ? (decisions.value.data || []) : null,
132
- };
133
- }
134
- }
135
-
136
- if (typeof module !== 'undefined' && module.exports) {
137
- module.exports = new DelimitCodexJamsons();
138
- }
139
-
140
- if (typeof registerSkill === 'function') {
141
- registerSkill(new DelimitCodexJamsons());
142
- }
@@ -1,94 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Delimit™ Codex Security Skill Adapter
4
- * Layer: Delimit (code governance) — Security surface
5
- * Triggered on pre-code-generation and pre-suggestion events
6
- */
7
-
8
- 'use strict';
9
-
10
- const axios = require('axios');
11
- const AGENT_URL = `http://127.0.0.1:${process.env.DELIMIT_AGENT_PORT || 7823}`;
12
-
13
- class DelimitCodexSecurity {
14
- constructor() {
15
- this.name = 'delimit-security';
16
- this.version = '1.0.0';
17
- }
18
-
19
- async onBeforeSuggestion(context) {
20
- try {
21
- const { code, language, file } = context;
22
- const response = await axios.post(`${AGENT_URL}/security`, {
23
- action: 'codex_suggestion',
24
- code,
25
- language,
26
- file,
27
- tool: 'codex',
28
- }, { timeout: 3000 });
29
-
30
- const { severity, findings } = response.data;
31
-
32
- if (severity === 'critical') {
33
- return {
34
- allow: false,
35
- message: `[DELIMIT SECURITY] Blocked — critical finding: ${findings?.[0]?.message || 'see audit log'}`,
36
- };
37
- }
38
-
39
- if (severity === 'high') {
40
- return {
41
- allow: true,
42
- warning: `[DELIMIT SECURITY] High-severity finding: ${findings?.[0]?.message || 'review before accepting'}`,
43
- };
44
- }
45
-
46
- return { allow: true };
47
- } catch (err) {
48
- if (err.response?.data?.action === 'block') {
49
- return { allow: false, message: `[DELIMIT SECURITY] ${err.response.data.reason}` };
50
- }
51
- // Fail open — security service unavailable
52
- console.warn('[DELIMIT SECURITY] Scan unavailable:', err.message);
53
- return { allow: true };
54
- }
55
- }
56
-
57
- async onAfterAccept(context) {
58
- try {
59
- await axios.post(`${AGENT_URL}/audit`, {
60
- action: 'codex_security_accept',
61
- context,
62
- timestamp: new Date().toISOString(),
63
- }, { timeout: 2000 });
64
- } catch (_) { /* silent */ }
65
- }
66
-
67
- async handleCommand(command, _args) {
68
- if (command === 'security') {
69
- const { execSync } = require('child_process');
70
- try {
71
- return execSync('delimit security --verbose', { timeout: 10000 }).toString();
72
- } catch (e) {
73
- return `[DELIMIT SECURITY] Command failed: ${e.message}`;
74
- }
75
- }
76
- }
77
-
78
- async getContext() {
79
- try {
80
- const r = await axios.get(`${AGENT_URL}/security/status`, { timeout: 3000 });
81
- return { layer: 'delimit-security', status: 'ok', data: r.data };
82
- } catch (_) {
83
- return { layer: 'delimit-security', status: 'unavailable' };
84
- }
85
- }
86
- }
87
-
88
- if (typeof module !== 'undefined' && module.exports) {
89
- module.exports = new DelimitCodexSecurity();
90
- }
91
-
92
- if (typeof registerSkill === 'function') {
93
- registerSkill(new DelimitCodexSecurity());
94
- }
@@ -1,120 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Delimit™ Gemini CLI Forge Adapter
4
- * Layer: Forge (execution governance)
5
- * Used as: command handler called from Gemini CLI hooks and @commands
6
- */
7
-
8
- 'use strict';
9
-
10
- const axios = require('axios');
11
- const AGENT_URL = `http://127.0.0.1:${process.env.DELIMIT_AGENT_PORT || 7823}`;
12
-
13
- class DelimitGeminiForge {
14
- constructor() {
15
- this.id = 'delimit-forge';
16
- this.version = '1.0.0';
17
- }
18
-
19
- /**
20
- * Pre-generation: surface test failures and deploy locks to Gemini before it generates code.
21
- */
22
- async beforeCodeGeneration(request) {
23
- const [testState, deployState, releaseState] = await Promise.allSettled([
24
- axios.get(`${AGENT_URL}/test/status`, { timeout: 3000 }),
25
- axios.get(`${AGENT_URL}/deploy/status`, { timeout: 3000 }),
26
- axios.get(`${AGENT_URL}/release/status`, { timeout: 3000 }),
27
- ]);
28
-
29
- const warnings = [];
30
-
31
- if (testState.status === 'fulfilled') {
32
- const t = testState.value.data;
33
- if (t?.failing > 0) warnings.push(`[FORGE] ${t.failing} test(s) failing`);
34
- }
35
-
36
- if (deployState.status === 'fulfilled') {
37
- const d = deployState.value.data;
38
- if (d?.locked) warnings.push(`[FORGE] Deploy locked: ${d.reason || 'release in progress'}`);
39
- }
40
-
41
- if (releaseState.status === 'fulfilled') {
42
- const rel = releaseState.value.data;
43
- if (rel?.in_progress) warnings.push(`[FORGE] Release in progress: ${rel.version || 'unknown'}`);
44
- }
45
-
46
- if (warnings.length > 0) {
47
- console.warn(warnings.join('\n'));
48
- // Inject warnings into system prompt context
49
- request._forgeWarnings = warnings;
50
- }
51
-
52
- return request;
53
- }
54
-
55
- async afterResponse(response) {
56
- try {
57
- await axios.post(`${AGENT_URL}/audit`, {
58
- action: 'gemini_forge_response',
59
- response: {
60
- model: response.model,
61
- tokens: response.usage,
62
- timestamp: new Date().toISOString(),
63
- },
64
- }, { timeout: 2000 });
65
- } catch (_) { /* silent */ }
66
- return response;
67
- }
68
-
69
- async handleCommand(command, _args) {
70
- const { execSync } = require('child_process');
71
- const commands = {
72
- '@forge': 'delimit status --layer=forge',
73
- '@tests': 'delimit test --summary',
74
- '@deploy': 'delimit deploy --status',
75
- '@release': 'delimit release --status',
76
- };
77
- if (commands[command]) {
78
- try {
79
- return execSync(commands[command], { timeout: 10000 }).toString();
80
- } catch (e) {
81
- return `[FORGE] Command failed: ${e.message}`;
82
- }
83
- }
84
- }
85
-
86
- /**
87
- * Structured context for consensus — call this from hooks or consensus runners.
88
- */
89
- async getContext() {
90
- const [tests, deploy, release] = await Promise.allSettled([
91
- axios.get(`${AGENT_URL}/test/status`, { timeout: 3000 }),
92
- axios.get(`${AGENT_URL}/deploy/status`, { timeout: 3000 }),
93
- axios.get(`${AGENT_URL}/release/status`, { timeout: 3000 }),
94
- ]);
95
- return {
96
- layer: 'forge',
97
- tool: 'gemini',
98
- tests: tests.status === 'fulfilled' ? tests.value.data : null,
99
- deploy: deploy.status === 'fulfilled' ? deploy.value.data : null,
100
- release: release.status === 'fulfilled' ? release.value.data : null,
101
- };
102
- }
103
- }
104
-
105
- module.exports = new DelimitGeminiForge();
106
-
107
- if (typeof registerExtension === 'function') {
108
- registerExtension(new DelimitGeminiForge());
109
- }
110
-
111
- // CLI entrypoint for Gemini hook invocation
112
- if (require.main === module) {
113
- const instance = new DelimitGeminiForge();
114
- instance.getContext()
115
- .then(ctx => {
116
- process.stdout.write(JSON.stringify(ctx) + '\n');
117
- process.exit(0);
118
- })
119
- .catch(() => process.exit(0)); // fail open
120
- }
@@ -1,152 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Delimit™ Gemini CLI Jamsons Adapter
4
- * Layer: Jamsons OS (strategy + operational governance)
5
- * Injects portfolio context, logs decisions, surfaces venture/priority state.
6
- */
7
-
8
- 'use strict';
9
-
10
- const axios = require('axios');
11
- const AGENT_URL = `http://127.0.0.1:${process.env.DELIMIT_AGENT_PORT || 7823}`;
12
- const JAMSONS_URL = `http://localhost:${process.env.JAMSONS_PORT || 8091}`;
13
-
14
- const VENTURES = {
15
- delimit: { priority: 'P0', status: 'active' },
16
- domainvested: { priority: 'P2', status: 'maintenance' },
17
- 'wire.report': { priority: 'held', status: 'held' },
18
- 'livetube.ai': { priority: 'held', status: 'held' },
19
- };
20
-
21
- class DelimitGeminiJamsons {
22
- constructor() {
23
- this.id = 'delimit-jamsons';
24
- this.version = '1.0.0';
25
- }
26
-
27
- /**
28
- * Pre-generation: inject portfolio and decision context into request.
29
- */
30
- async beforeCodeGeneration(request) {
31
- try {
32
- const portfolioCtx = await this._getPortfolioContext(request);
33
- request._jamsons = portfolioCtx;
34
- } catch (_) { /* fail open */ }
35
- return request;
36
- }
37
-
38
- async afterResponse(response) {
39
- try {
40
- await axios.post(`${JAMSONS_URL}/api/chatops/decisions`, {
41
- type: 'task',
42
- title: `Gemini: session response logged`,
43
- detail: `Model: ${response.model || 'unknown'} | Tool: gemini`,
44
- user_id: 'gemini-adapter',
45
- tags: ['delimit', 'chatops'],
46
- }, {
47
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
48
- timeout: 2000,
49
- });
50
- } catch (_) { /* silent */ }
51
- return response;
52
- }
53
-
54
- async _getPortfolioContext(request) {
55
- const [memory, decisions] = await Promise.allSettled([
56
- this._searchMemory(request.prompt || 'delimit'),
57
- this._getPendingDecisions(),
58
- ]);
59
-
60
- return {
61
- ventures: VENTURES,
62
- activeVenture: this._detectVenture(request),
63
- memory: memory.status === 'fulfilled' ? memory.value : [],
64
- pendingDecisions: decisions.status === 'fulfilled' ? decisions.value : [],
65
- timestamp: new Date().toISOString(),
66
- };
67
- }
68
-
69
- _detectVenture(request) {
70
- const text = (request.prompt || request.context || '').toLowerCase();
71
- if (text.includes('delimit')) return 'delimit';
72
- if (text.includes('domainvested')) return 'domainvested';
73
- return 'delimit';
74
- }
75
-
76
- async _searchMemory(query) {
77
- const r = await axios.get(`${JAMSONS_URL}/api/memory/search`, {
78
- params: { q: query, limit: 5 },
79
- timeout: 2000,
80
- });
81
- return r.data?.results || [];
82
- }
83
-
84
- async _getPendingDecisions() {
85
- const r = await axios.get(`${JAMSONS_URL}/api/chatops/decisions`, {
86
- params: { status: 'pending', limit: 5 },
87
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
88
- timeout: 2000,
89
- });
90
- return r.data?.decisions || r.data || [];
91
- }
92
-
93
- async handleCommand(command, _args) {
94
- const { execSync } = require('child_process');
95
- const commands = {
96
- '@jamsons': 'delimit status --layer=jamsons',
97
- '@portfolio': 'delimit portfolio --summary',
98
- '@decisions': 'delimit decisions --pending',
99
- '@memory': 'delimit memory --recent',
100
- };
101
- if (commands[command]) {
102
- try {
103
- return execSync(commands[command], { timeout: 10000 }).toString();
104
- } catch (e) {
105
- return `[JAMSONS] Command failed: ${e.message}`;
106
- }
107
- }
108
- }
109
-
110
- /**
111
- * Structured context for consensus — call from hooks or consensus runners.
112
- */
113
- async getContext() {
114
- const [memory, decisions] = await Promise.allSettled([
115
- axios.get(`${JAMSONS_URL}/api/memory/search`, {
116
- params: { q: 'delimit strategy', limit: 5 },
117
- timeout: 3000,
118
- }),
119
- axios.get(`${JAMSONS_URL}/api/chatops/decisions`, {
120
- params: { status: 'pending' },
121
- headers: { Authorization: `Bearer ${process.env.CHATOPS_AUTH_TOKEN}` },
122
- timeout: 3000,
123
- }),
124
- ]);
125
-
126
- return {
127
- layer: 'jamsons',
128
- tool: 'gemini',
129
- ventures: VENTURES,
130
- memory: memory.status === 'fulfilled' ? (memory.value.data?.results || []) : null,
131
- pendingDecisions: decisions.status === 'fulfilled' ? (decisions.value.data || []) : null,
132
- };
133
- }
134
- }
135
-
136
- module.exports = new DelimitGeminiJamsons();
137
-
138
- if (typeof registerExtension === 'function') {
139
- registerExtension(new DelimitGeminiJamsons());
140
- }
141
-
142
- // CLI entrypoint for Gemini hook invocation
143
- if (require.main === module) {
144
- const instance = new DelimitGeminiJamsons();
145
- const event = process.argv[2] || 'before-agent';
146
- instance.getContext()
147
- .then(ctx => {
148
- process.stdout.write(JSON.stringify(ctx) + '\n');
149
- process.exit(0);
150
- })
151
- .catch(() => process.exit(0)); // fail open
152
- }
package/delimit.yml DELETED
@@ -1,19 +0,0 @@
1
- defaultMode: advisory
2
-
3
- rules:
4
- - name: "Production Protection"
5
- mode: enforce
6
- triggers:
7
- - gitBranch: [main, master, production]
8
-
9
- - name: "Payment Code Security"
10
- mode: enforce
11
- triggers:
12
- - path: "**/payment/**"
13
- - content: ["stripe", "payment", "billing"]
14
-
15
- - name: "Documentation Freedom"
16
- mode: advisory
17
- triggers:
18
- - path: "**/*.md"
19
- final: true
package/glama.json DELETED
@@ -1 +0,0 @@
1
- { "$schema": "https://glama.ai/mcp/schemas/server.json", "maintainers": ["infracore"] }
@@ -1,12 +0,0 @@
1
- #!/bin/bash
2
- echo "Evidence Collection Status"
3
- echo "========================="
4
- evidence_dir="${HOME}/.delimit/evidence"
5
- if [ -d "$evidence_dir" ]; then
6
- count=$(find "$evidence_dir" -name "*.json" 2>/dev/null | wc -l)
7
- echo "Evidence files: $count"
8
- echo "Latest evidence:"
9
- ls -lt "$evidence_dir" 2>/dev/null | head -5
10
- else
11
- echo "No evidence collected yet"
12
- fi
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
- # Delimit commit-msg hook
3
- echo "[DELIMIT] Validating commit message..."
4
- node /home/delimit/npm-delimit/bin/delimit-cli.js hook commit-msg "$1"
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
- # Delimit pre-commit hook
3
- echo "[DELIMIT] Running pre-commit governance check..."
4
- node /home/delimit/npm-delimit/bin/delimit-cli.js hook pre-commit
@@ -1,4 +0,0 @@
1
- #!/bin/bash
2
- # Delimit pre-push hook
3
- echo "[DELIMIT] Running pre-push governance check..."
4
- node /home/delimit/npm-delimit/bin/delimit-cli.js hook pre-push