delimit-cli 3.14.14 → 3.14.16

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.
@@ -11,6 +11,9 @@
11
11
  const fs = require('fs');
12
12
  const path = require('path');
13
13
 
14
+ // LED-213: Import canonical template for cross-model parity
15
+ const { getDelimitSection } = require('../lib/delimit-template');
16
+
14
17
  const HOME = process.env.HOME || '';
15
18
  const CURSOR_DIR = path.join(HOME, '.cursor');
16
19
  const CURSOR_RULES_DIR = path.join(CURSOR_DIR, 'rules');
@@ -50,35 +53,8 @@ function uninstallRules() {
50
53
  }
51
54
 
52
55
  function getDelimitRules(version) {
53
- return `# Delimit Governance (v${version})
54
-
55
- ## On every session start:
56
- 1. Call \`delimit_ledger_context\` to check for open tasks
57
- 2. Call \`delimit_gov_health\` to check governance status
58
-
59
- ## After editing code:
60
- - After editing UI/CSS: call \`delimit_design_validate_responsive\`
61
- - After editing API specs: call \`delimit_lint\`
62
- - After editing tests: call \`delimit_test_smoke\`
63
-
64
- ## Before deploying:
65
- 1. Call \`delimit_security_audit\`
66
- 2. Call \`delimit_test_smoke\`
67
- 3. Call \`delimit_deploy_plan\`
68
-
69
- ## Before committing:
70
- - Call \`delimit_repo_diagnose\` to check for common issues
71
-
72
- ## Governance enforcement:
73
- - All tool calls route through governance automatically (server-side)
74
- - Critical actions are blocked until approved
75
- - High-risk actions require approval in enforce mode
76
- - Check mode: advisory (warn only), guarded (block critical), enforce (block critical + high-risk)
77
-
78
- ## Links
79
- - Docs: https://delimit.ai/docs
80
- - GitHub: https://github.com/delimit-ai/delimit-mcp-server
81
- `;
56
+ // LED-213: Use canonical Consensus 123 template for Cursor parity
57
+ return getDelimitSection();
82
58
  }
83
59
 
84
60
  module.exports = { installRules, uninstallRules, getDelimitRules };
@@ -839,8 +839,62 @@ exit 127
839
839
  }
840
840
  log('');
841
841
 
842
- // Step 11: Done
843
- step(11, 'Done!');
842
+ // Step 11: Social target scanning config
843
+ step(11, 'Configuring social target scanner...');
844
+
845
+ const socialConfigPath = path.join(DELIMIT_HOME, 'social_target_config.json');
846
+ const socialDefaultConfig = {
847
+ platforms: {
848
+ x: { enabled: true, provider: 'twttr241' },
849
+ reddit: { enabled: true, provider: 'proxy' },
850
+ github: { enabled: true, provider: 'gh_cli' },
851
+ hn: { enabled: true, provider: 'algolia' },
852
+ devto: { enabled: true, provider: 'public_api' },
853
+ namepros: { enabled: false, provider: 'manual' },
854
+ },
855
+ subreddits: {},
856
+ github_queries: {},
857
+ scan_limit: 10,
858
+ min_engagement: { score: 1, comments: 2 },
859
+ };
860
+
861
+ if (!fs.existsSync(socialConfigPath)) {
862
+ fs.mkdirSync(path.dirname(socialConfigPath), { recursive: true });
863
+ fs.writeFileSync(socialConfigPath, JSON.stringify(socialDefaultConfig, null, 2) + '\n');
864
+ log(` ${green('\u2713')} Created ${dim(socialConfigPath)}`);
865
+ } else {
866
+ log(` ${dim(' Config already exists:')} ${socialConfigPath}`);
867
+ }
868
+
869
+ // Auto-detect available platforms
870
+ const detectedPlatforms = {};
871
+ // HN and Dev.to are always available (public APIs)
872
+ detectedPlatforms['hn'] = 'available (public API)';
873
+ detectedPlatforms['devto'] = 'available (public API)';
874
+ // GitHub: check gh CLI
875
+ try {
876
+ execSync('gh auth status', { stdio: 'pipe', timeout: 10000 });
877
+ detectedPlatforms['github'] = 'available (gh authenticated)';
878
+ } catch {
879
+ detectedPlatforms['github'] = 'unavailable (gh not authenticated)';
880
+ }
881
+ // X: check for RapidAPI key in env
882
+ if (process.env.RAPIDAPI_KEY) {
883
+ detectedPlatforms['x'] = 'available (RapidAPI key in env)';
884
+ } else if (process.env.XAI_API_KEY) {
885
+ detectedPlatforms['x'] = 'available (xAI key in env, fallback)';
886
+ } else {
887
+ detectedPlatforms['x'] = 'unavailable (no API key)';
888
+ }
889
+
890
+ for (const [plat, status] of Object.entries(detectedPlatforms)) {
891
+ const icon = status.startsWith('available') ? green('\u2713') : yellow('\u2717');
892
+ log(` ${icon} ${plat}: ${dim(status)}`);
893
+ }
894
+ log('');
895
+
896
+ // Step 12: Done
897
+ step(12, 'Done!');
844
898
  log('');
845
899
  log(` ${green('Delimit is installed.')} Your AI now has persistent memory and governance.`);
846
900
  log('');
@@ -872,87 +926,8 @@ exit 127
872
926
  log('');
873
927
  }
874
928
 
875
- function getDelimitSection() {
876
- const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
877
- const version = pkg.version || '0.0.0';
878
- return `<!-- delimit:start v${version} -->
879
- # Delimit
880
-
881
- Unify all AI coding assistants with persistent context, governance, and multi-model debate.
882
-
883
- ## Auto-Trigger Rules (Consensus 123)
884
-
885
- These rules fire automatically. The AI MUST call the specified tools without asking permission.
886
- The founder reviews and approves via email. The AI's job is to draft, send, and chain — not to ask.
887
-
888
- ### Session Lifecycle
889
- - **Session start**: call \`delimit_ledger_context\` + \`delimit_gov_health\` + \`delimit_inbox_daemon(action="start")\` + \`delimit_notify_routing(action="status")\`
890
- - **Session end or idle**: call \`delimit_session_handoff\` to preserve context for next session
891
- - If returning user, summarize what's pending. If new project, call \`delimit_scan\`.
892
-
893
- ### Code Development (debounced per edit batch)
894
- - After editing UI/CSS: call \`delimit_design_validate_responsive\`
895
- - After editing API specs: call \`delimit_lint\` + \`delimit_drift_check\`
896
- - After editing tests: call \`delimit_test_smoke\`
897
- - After any significant code change: call \`delimit_test_smoke\` if applicable tests exist
898
-
899
- ### Pre-Commit / Pre-Deploy Gates
900
- - Before \`git commit\`: call \`delimit_repo_diagnose\`
901
- - Deploy requested: \`delimit_security_audit\` then \`delimit_test_smoke\` then \`delimit_changelog\` then \`delimit_deploy_plan\`
902
- - Deploy succeeds: \`delimit_deploy_verify\` + \`delimit_evidence_collect\`
903
- - Verify succeeds: \`delimit_ledger_done\` (related task) + \`delimit_notify\`
904
-
905
- ### Content / Outreach (all drafts, never auto-post)
906
- - Social content drafted: ALWAYS call \`delimit_social_post\` or \`delimit_notify\` immediately
907
- - \`delimit_social_target\` scan completes: call \`delimit_notify\` with target summary
908
- - Screenshot of social thread shared: auto-draft reply + call \`delimit_notify\`
909
-
910
- ### Strategic / Business Operations
911
- - Strategic opportunity identified: call \`delimit_ledger_add\` immediately
912
- - \`delimit_ledger_add\` fires (non-P0): \`delimit_notify\` (batched, 15-min digest)
913
- - \`delimit_ledger_add\` fires (P0): \`delimit_notify\` (immediate) + \`delimit_agent_dispatch\`
914
- - Conflicting high-severity signals: call \`delimit_deliberate\` for multi-model consensus
915
-
916
- ### Monitoring / Sensors
917
- - GitHub issue state change (closed, merged, labeled): \`delimit_ledger_update\` + \`delimit_notify\` (immediate)
918
- - GitHub issue new comments: \`delimit_ledger_update\` + \`delimit_notify\` (batched digest)
919
- - \`delimit_drift_check\` finds drift: \`delimit_ledger_add\` + \`delimit_notify\`
920
-
921
- ### Approval Loop (Email Control Plane)
922
- - Approval email detected: execute the approved action based on context
923
- - Rejection email detected: \`delimit_ledger_update\` (mark rejected)
924
-
925
- ### Audit Trail
926
- - After security audit, test run, or deploy: call \`delimit_evidence_collect\`
927
- - Any gate failure: \`delimit_evidence_collect\` + \`delimit_ledger_add\` + \`delimit_notify\` (immediate)
928
-
929
- ### Storm Prevention
930
- - Edit triggers: debounce to once per assistant turn
931
- - Non-P0 notifications: batch into 15-minute digests
932
- - Max 5 immediate notifications per hour (overflow to digest)
933
- - Per-scan fan-out: max 10 targets per notification
934
-
935
- ## What Delimit does:
936
- - **API governance** -- lint, diff, semver classification, migration guides
937
- - **Persistent context** -- memory and ledger survive across sessions and models
938
- - **Security audit** -- dependency scanning, secret detection
939
- - **Test verification** -- confirm tests actually ran, measure coverage
940
- - **Multi-model deliberation** -- consensus from multiple AI models (3 free, then BYOK)
941
-
942
- ## GitHub Action
943
- Add breaking change detection to any repo:
944
- \`\`\`yaml
945
- - uses: delimit-ai/delimit-action@v1
946
- with:
947
- spec: api/openapi.yaml
948
- \`\`\`
949
-
950
- ## Links
951
- - Docs: https://delimit.ai/docs
952
- - GitHub: https://github.com/delimit-ai/delimit-mcp-server
953
- - Action: https://github.com/marketplace/actions/delimit-api-governance
954
- <!-- delimit:end -->`;
955
- }
929
+ // LED-213: Import canonical template from shared module
930
+ const { getDelimitSection } = require('../lib/delimit-template');
956
931
 
957
932
  function getClaudeMdContent() {
958
933
  return getDelimitSection() + '\n';
@@ -17,6 +17,9 @@ const path = require('path');
17
17
  const { execSync } = require('child_process');
18
18
  const os = require('os');
19
19
 
20
+ // LED-213: Import canonical template for cross-model parity
21
+ const { getDelimitSection, getDelimitSectionCondensed } = require('./delimit-template');
22
+
20
23
  // Use process.env.HOME to allow test overrides; fall back to os.homedir()
21
24
  function getHome() { return process.env.HOME || os.homedir(); }
22
25
  function getDelimitHome() { return path.join(getHome(), '.delimit'); }
@@ -348,25 +351,9 @@ function installCodexHooks(tool, hookConfig) {
348
351
  // Codex instructions.md -- acts as the session-start equivalent
349
352
  if (hookConfig.session_start) {
350
353
  const instructionsPath = tool.instructionsPath || path.join(codexDir, 'instructions.md');
354
+ // LED-213: Use canonical Consensus 123 template for Codex parity
351
355
  const delimitBlock = `<!-- delimit:hooks-start -->
352
- ## Delimit Governance
353
-
354
- On every session start:
355
- 1. Run this command to check governance status:
356
- \`\`\`
357
- npx delimit-cli hook session-start
358
- \`\`\`
359
- 2. Call \`delimit_inbox_daemon(action="start")\` to start email polling for approvals.
360
-
361
- Before committing changes, run:
362
- \`\`\`
363
- npx delimit-cli hook pre-commit
364
- \`\`\`
365
-
366
- After editing OpenAPI specs, run:
367
- \`\`\`
368
- npx delimit-cli hook pre-tool Edit
369
- \`\`\`
356
+ ${getDelimitSection()}
370
357
  <!-- delimit:hooks-end -->`;
371
358
 
372
359
  let content = '';
@@ -427,39 +414,20 @@ function installGeminiHooks(tool, hookConfig) {
427
414
  } catch { config = {}; }
428
415
  }
429
416
 
430
- const govInstructions = [
431
- 'Delimit governance is active.',
432
- 'On session start: (1) run: npx delimit-cli hook session-start,',
433
- '(2) call delimit_inbox_daemon(action="start") to start email polling.',
434
- 'Before committing, run: npx delimit-cli hook pre-commit',
435
- 'After editing API specs, run: npx delimit-cli hook pre-tool Edit',
436
- 'Call delimit_ledger_context and delimit_gov_health via MCP when available.',
437
- ].join(' ');
417
+ // LED-213: Use canonical Consensus 123 template (condensed for JSON)
418
+ const govInstructions = getDelimitSectionCondensed();
438
419
 
439
- if (!config.customInstructions || !config.customInstructions.includes('delimit-cli hook')) {
420
+ if (!config.customInstructions || !config.customInstructions.includes('Consensus 123')) {
440
421
  config.customInstructions = govInstructions;
441
422
  changes.push('customInstructions');
442
423
  }
443
424
 
444
425
  fs.writeFileSync(tool.configPath, JSON.stringify(config, null, 2));
445
426
 
446
- // Write a GEMINI.md governance file (equivalent of CLAUDE.md)
427
+ // LED-213: Write GEMINI.md with canonical Consensus 123 template
447
428
  const geminiMd = path.join(geminiDir, 'GEMINI.md');
448
- if (!fs.existsSync(geminiMd) || !fs.readFileSync(geminiMd, 'utf-8').includes('delimit')) {
449
- const content = `# Delimit Governance
450
-
451
- On every session start:
452
- 1. Run \`npx delimit-cli hook session-start\` to check open tasks and governance status
453
- 2. Call \`delimit_inbox_daemon(action="start")\` to start email polling for approvals
454
-
455
- After editing code:
456
- - After editing API specs: run \`npx delimit-cli hook pre-tool Edit\`
457
- - After editing tests: run \`npx delimit-cli hook pre-tool Edit\`
458
-
459
- Before committing:
460
- - Run \`npx delimit-cli hook pre-commit\` to check for issues
461
- `;
462
- fs.writeFileSync(geminiMd, content);
429
+ if (!fs.existsSync(geminiMd) || !fs.readFileSync(geminiMd, 'utf-8').includes('Consensus 123')) {
430
+ fs.writeFileSync(geminiMd, getDelimitSection() + '\n');
463
431
  changes.push('GEMINI.md');
464
432
  }
465
433
 
@@ -0,0 +1,111 @@
1
+ /**
2
+ * LED-213: Canonical Delimit instruction template.
3
+ *
4
+ * Single source of truth for the governance section injected into
5
+ * CLAUDE.md, Codex instructions.md, Gemini GEMINI.md / customInstructions,
6
+ * and Cursor .cursorrules. All models get identical Consensus 123 content.
7
+ */
8
+
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ /**
13
+ * Return the full Consensus 123 governance template (markdown).
14
+ * Used verbatim by Claude, Codex, and Cursor.
15
+ */
16
+ function getDelimitSection() {
17
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf-8'));
18
+ const version = pkg.version || '0.0.0';
19
+ return `<!-- delimit:start v${version} -->
20
+ # Delimit
21
+
22
+ Unify all AI coding assistants with persistent context, governance, and multi-model debate.
23
+
24
+ ## Auto-Trigger Rules (Consensus 123)
25
+
26
+ These rules fire automatically. The AI MUST call the specified tools without asking permission.
27
+ The founder reviews and approves via email. The AI's job is to draft, send, and chain — not to ask.
28
+
29
+ ### Session Lifecycle
30
+ - **Session start**: call \`delimit_ledger_context\` + \`delimit_gov_health\` + \`delimit_inbox_daemon(action="start")\` + \`delimit_notify_routing(action="status")\`
31
+ - **Session end or idle**: call \`delimit_session_handoff\` to preserve context for next session
32
+ - If returning user, summarize what's pending. If new project, call \`delimit_scan\`.
33
+
34
+ ### Code Development (debounced per edit batch)
35
+ - After editing UI/CSS: call \`delimit_design_validate_responsive\`
36
+ - After editing API specs: call \`delimit_lint\` + \`delimit_drift_check\`
37
+ - After editing tests: call \`delimit_test_smoke\`
38
+ - After any significant code change: call \`delimit_test_smoke\` if applicable tests exist
39
+
40
+ ### Pre-Commit / Pre-Deploy Gates
41
+ - Before \`git commit\`: call \`delimit_repo_diagnose\`
42
+ - Deploy requested: \`delimit_security_audit\` then \`delimit_test_smoke\` then \`delimit_changelog\` then \`delimit_deploy_plan\`
43
+ - Deploy succeeds: \`delimit_deploy_verify\` + \`delimit_evidence_collect\`
44
+ - Verify succeeds: \`delimit_ledger_done\` (related task) + \`delimit_notify\`
45
+
46
+ ### Content / Outreach (all drafts, never auto-post)
47
+ - Social content drafted: ALWAYS call \`delimit_social_post\` or \`delimit_notify\` immediately
48
+ - \`delimit_social_target\` scan completes: call \`delimit_notify\` with target summary
49
+ - Screenshot of social thread shared: auto-draft reply + call \`delimit_notify\`
50
+ - During ANY social interaction: scan for competitive signals, integration opportunities, and strategic items. Add to strategy ledger if significant.
51
+
52
+ ### Strategic / Business Operations
53
+ - Strategic opportunity identified: call \`delimit_ledger_add\` immediately
54
+ - \`delimit_ledger_add\` fires (non-P0): \`delimit_notify\` (batched, 15-min digest)
55
+ - \`delimit_ledger_add\` fires (P0): \`delimit_notify\` (immediate) + \`delimit_agent_dispatch\`
56
+ - Conflicting high-severity signals: call \`delimit_deliberate\` for multi-model consensus
57
+
58
+ ### Monitoring / Sensors
59
+ - GitHub issue state change (closed, merged, labeled): \`delimit_ledger_update\` + \`delimit_notify\` (immediate)
60
+ - GitHub issue new comments: \`delimit_ledger_update\` + \`delimit_notify\` (batched digest)
61
+ - \`delimit_drift_check\` finds drift: \`delimit_ledger_add\` + \`delimit_notify\`
62
+
63
+ ### Approval Loop (Email Control Plane)
64
+ - Approval email detected: execute the approved action based on context
65
+ - Rejection email detected: \`delimit_ledger_update\` (mark rejected)
66
+
67
+ ### Audit Trail
68
+ - After security audit, test run, or deploy: call \`delimit_evidence_collect\`
69
+ - Any gate failure: \`delimit_evidence_collect\` + \`delimit_ledger_add\` + \`delimit_notify\` (immediate)
70
+
71
+ ### Storm Prevention
72
+ - Edit triggers: debounce to once per assistant turn
73
+ - Non-P0 notifications: batch into 15-minute digests
74
+ - Max 5 immediate notifications per hour (overflow to digest)
75
+ - Per-scan fan-out: max 10 targets per notification
76
+
77
+ ## What Delimit does:
78
+ - **API governance** -- lint, diff, semver classification, migration guides
79
+ - **Persistent context** -- memory and ledger survive across sessions and models
80
+ - **Security audit** -- dependency scanning, secret detection
81
+ - **Test verification** -- confirm tests actually ran, measure coverage
82
+ - **Multi-model deliberation** -- consensus from multiple AI models (3 free, then BYOK)
83
+
84
+ ## GitHub Action
85
+ Add breaking change detection to any repo:
86
+ \`\`\`yaml
87
+ - uses: delimit-ai/delimit-action@v1
88
+ with:
89
+ spec: api/openapi.yaml
90
+ \`\`\`
91
+
92
+ ## Links
93
+ - Docs: https://delimit.ai/docs
94
+ - GitHub: https://github.com/delimit-ai/delimit-mcp-server
95
+ - Action: https://github.com/marketplace/actions/delimit-api-governance
96
+ <!-- delimit:end -->`;
97
+ }
98
+
99
+ /**
100
+ * Return a condensed single-line version for Gemini customInstructions (JSON string value).
101
+ * Newlines are literal \\n so it fits inside a JSON string.
102
+ */
103
+ function getDelimitSectionCondensed() {
104
+ return getDelimitSection()
105
+ .replace(/<!-- delimit:start[^>]*-->\n?/, '')
106
+ .replace(/<!-- delimit:end -->\n?/, '')
107
+ .replace(/\n/g, '\\n')
108
+ .trim();
109
+ }
110
+
111
+ module.exports = { getDelimitSection, getDelimitSectionCondensed };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "delimit-cli",
3
3
  "mcpName": "io.github.delimit-ai/delimit-mcp-server",
4
- "version": "3.14.14",
4
+ "version": "3.14.16",
5
5
  "description": "Unify Claude Code, Codex, Cursor, and Gemini CLI with persistent context, governance, and multi-model debate.",
6
6
  "main": "index.js",
7
7
  "files": [