@nahisaho/shikigami 2.0.3 → 2.0.5

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 (151) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +19 -0
  3. package/github-assets/copilot-instructions.md +44 -0
  4. package/mcp-server/package.json +1 -1
  5. package/package.json +11 -12
  6. package/scripts/build-cowork-plugin.js +587 -0
  7. package/scripts/cli.js +6 -6
  8. package/scripts/init.js +5 -16
  9. package/scripts/postinstall.js +1 -1
  10. package/scripts/setup-cowork.js +0 -367
  11. /package/{.github → github-assets}/prompts/shikigami-citation-formatter.prompt.md +0 -0
  12. /package/{.github → github-assets}/prompts/shikigami-comparison-table.prompt.md +0 -0
  13. /package/{.github → github-assets}/prompts/shikigami-consistency-check.prompt.md +0 -0
  14. /package/{.github → github-assets}/prompts/shikigami-deep-research.prompt.md +0 -0
  15. /package/{.github → github-assets}/prompts/shikigami-executive-sync.prompt.md +0 -0
  16. /package/{.github → github-assets}/prompts/shikigami-financial-analysis.prompt.md +0 -0
  17. /package/{.github → github-assets}/prompts/shikigami-framework-analysis.prompt.md +0 -0
  18. /package/{.github → github-assets}/prompts/shikigami-full-research.prompt.md +0 -0
  19. /package/{.github → github-assets}/prompts/shikigami-manifest.prompt.md +0 -0
  20. /package/{.github → github-assets}/prompts/shikigami-matching-analysis.prompt.md +0 -0
  21. /package/{.github → github-assets}/prompts/shikigami-phase-gate.prompt.md +0 -0
  22. /package/{.github → github-assets}/prompts/shikigami-purpose-discovery.prompt.md +0 -0
  23. /package/{.github → github-assets}/prompts/shikigami-qiita-article.prompt.md +0 -0
  24. /package/{.github → github-assets}/prompts/shikigami-report-writing.prompt.md +0 -0
  25. /package/{.github → github-assets}/prompts/shikigami-risk-sensitivity.prompt.md +0 -0
  26. /package/{.github → github-assets}/prompts/shikigami-source-critique.prompt.md +0 -0
  27. /package/{.github → github-assets}/prompts/shikigami-stakeholder-impact.prompt.md +0 -0
  28. /package/{.github → github-assets}/prompts/shikigami-swot-generation.prompt.md +0 -0
  29. /package/{.github → github-assets}/prompts/shikigami-trend-visualization.prompt.md +0 -0
  30. /package/{.github → github-assets}/skills/configs/auto-invoke-triggers.yaml +0 -0
  31. /package/{.github → github-assets}/skills/configs/triage-rules.yaml +0 -0
  32. /package/{.github → github-assets}/skills/configs/workflow-gates.yaml +0 -0
  33. /package/{.github → github-assets}/skills/shikigami-consulting-framework/SKILL.md +0 -0
  34. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/README.md +0 -0
  35. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/customer/nps.md +0 -0
  36. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/customer/rfm.md +0 -0
  37. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/decision-making/cost-benefit.md +0 -0
  38. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/decision-making/decision-matrix.md +0 -0
  39. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/decision-making/pros-cons.md +0 -0
  40. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/decision-making/risk-matrix.md +0 -0
  41. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/general/5w1h.md +0 -0
  42. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/general/jtbd.md +0 -0
  43. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/general/kpt.md +0 -0
  44. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/general/okr.md +0 -0
  45. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/general/smart.md +0 -0
  46. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/aarrr.md +0 -0
  47. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/business-model-canvas.md +0 -0
  48. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/design-thinking.md +0 -0
  49. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/lean-canvas.md +0 -0
  50. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/scamper.md +0 -0
  51. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/tam-sam-som.md +0 -0
  52. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/innovation/value-proposition-canvas.md +0 -0
  53. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/4c.md +0 -0
  54. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/4p.md +0 -0
  55. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/aidma-aisas.md +0 -0
  56. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/customer-journey.md +0 -0
  57. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/persona.md +0 -0
  58. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/positioning-map.md +0 -0
  59. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/marketing/stp.md +0 -0
  60. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/organization/7s.md +0 -0
  61. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/organization/raci.md +0 -0
  62. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/5whys.md +0 -0
  63. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/as-is-to-be.md +0 -0
  64. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/fishbone.md +0 -0
  65. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/issue-tree.md +0 -0
  66. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/logic-tree.md +0 -0
  67. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/mece.md +0 -0
  68. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/problem-solving/sora-ame-kasa.md +0 -0
  69. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/process/ecrs.md +0 -0
  70. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/process/ooda.md +0 -0
  71. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/process/pdca.md +0 -0
  72. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/README.md +0 -0
  73. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/bxt.md +0 -0
  74. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/digital-maturity.md +0 -0
  75. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/esg-integration.md +0 -0
  76. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/fit-for-growth.md +0 -0
  77. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/strategy-and.md +0 -0
  78. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/three-lines-defense.md +0 -0
  79. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/pwc/timm.md +0 -0
  80. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/3c.md +0 -0
  81. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/5forces.md +0 -0
  82. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/ansoff-matrix.md +0 -0
  83. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/bcg-matrix.md +0 -0
  84. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/blue-ocean.md +0 -0
  85. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/ge-matrix.md +0 -0
  86. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/pest.md +0 -0
  87. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/swot.md +0 -0
  88. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/value-chain.md +0 -0
  89. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/strategic/vrio.md +0 -0
  90. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/thinking/prep.md +0 -0
  91. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/thinking/pyramid.md +0 -0
  92. /package/{.github → github-assets}/skills/shikigami-consulting-framework/frameworks/thinking/so-what-why-so.md +0 -0
  93. /package/{.github → github-assets}/skills/shikigami-consulting-framework/templates/comparison-axes.yaml +0 -0
  94. /package/{.github → github-assets}/skills/shikigami-consulting-framework/templates/financial/financial_5year_plan.yaml +0 -0
  95. /package/{.github → github-assets}/skills/shikigami-consulting-framework/templates/indicator-extraction.yaml +0 -0
  96. /package/{.github → github-assets}/skills/shikigami-consulting-framework/templates/priority-criteria.yaml +0 -0
  97. /package/{.github → github-assets}/skills/shikigami-deep-research/SKILL.md +0 -0
  98. /package/{.github → github-assets}/skills/shikigami-deep-research/templates/entity-research.yaml +0 -0
  99. /package/{.github → github-assets}/skills/shikigami-planner/SKILL.md +0 -0
  100. /package/{.github → github-assets}/skills/shikigami-planner/configs/proposal-checklist.yaml +0 -0
  101. /package/{.github → github-assets}/skills/shikigami-planner/configs/success-condition-mapping.yaml +0 -0
  102. /package/{.github → github-assets}/skills/shikigami-planner/templates/persona-profile-template.yaml +0 -0
  103. /package/{.github → github-assets}/skills/shikigami-planner/templates/success-condition-types.yaml +0 -0
  104. /package/{.github → github-assets}/skills/shikigami-writing/SKILL.md +0 -0
  105. /package/{.github → github-assets}/skills/shikigami-writing/configs/quality-check-schema.yaml +0 -0
  106. /package/{.github → github-assets}/skills/shikigami-writing/configs/thinking-flow.yaml +0 -0
  107. /package/{.github → github-assets}/skills/shikigami-writing/templates/context-adaptation.yaml +0 -0
  108. /package/{.github → github-assets}/skills/shikigami-writing/templates/extraction-rules.yaml +0 -0
  109. /package/{.github → github-assets}/skills/shikigami-writing/templates/objection-types.yaml +0 -0
  110. /package/{.github → github-assets}/skills/shikigami-writing/templates/persona-adjustments.yaml +0 -0
  111. /package/{.github → github-assets}/skills/shikigami-writing/templates/personas/executive.yaml +0 -0
  112. /package/{.github → github-assets}/skills/shikigami-writing/templates/personas/procurement-manager.yaml +0 -0
  113. /package/{.github → github-assets}/skills/shikigami-writing/templates/personas/rd-manager.yaml +0 -0
  114. /package/{.github → github-assets}/skills/shikigami-writing/templates/proposal-template.md +0 -0
  115. /package/{.github → github-assets}/skills/shikigami-writing/templates/proposal-templates.yaml +0 -0
  116. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/ab-test-template.md +0 -0
  117. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/budget-approval-template.md +0 -0
  118. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/business-case-template.md +0 -0
  119. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/change-request-template.md +0 -0
  120. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/competitive-analysis-template.md +0 -0
  121. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/compliance-template.md +0 -0
  122. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/consideration-template.md +0 -0
  123. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/customer-success-template.md +0 -0
  124. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/due-diligence-template.md +0 -0
  125. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/executive-summary-template.md +0 -0
  126. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/immediate-approval-template.md +0 -0
  127. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/interview-guide-template.md +0 -0
  128. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/joint-research-proposal-template.md +0 -0
  129. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/market-analysis-template.md +0 -0
  130. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/pilot-approval-template.md +0 -0
  131. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/post-mortem-template.md +0 -0
  132. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/product-roadmap-template.md +0 -0
  133. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/project-status-template.md +0 -0
  134. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/qbr-template.md +0 -0
  135. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/rfi-template.md +0 -0
  136. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/rfp-template.md +0 -0
  137. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/risk-assessment-template.md +0 -0
  138. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/sales-playbook-template.md +0 -0
  139. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/security-assessment-template.md +0 -0
  140. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/sla-template.md +0 -0
  141. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/staged-approval-template.md +0 -0
  142. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/technical-report-template.md +0 -0
  143. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/thinking-flow-report-template.md +0 -0
  144. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/training-material-template.md +0 -0
  145. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/user-research-template.md +0 -0
  146. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/vendor-evaluation-template.md +0 -0
  147. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/white-paper-template.md +0 -0
  148. /package/{.github → github-assets}/skills/shikigami-writing/templates/report-templates/workshop-template.md +0 -0
  149. /package/{.github → github-assets}/skills/shikigami-writing/templates/research/joint-research-proposal.md +0 -0
  150. /package/{.github → github-assets}/skills/shikigami-writing/templates/talk-script-structure.yaml +0 -0
  151. /package/{.github → github-assets}/skills/shikigami-writing/templates/thinking-flow-template.md +0 -0
@@ -1,367 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * SHIKIGAMI - Copilot Cowork MCP Setup
4
- * Usage: npx shikigami cowork [options]
5
- *
6
- * Sets up Microsoft Copilot Cowork as an MCP server for GitHub Copilot CLI.
7
- * Enables access to M365 data (Mail, Calendar, Teams, Files) from Copilot CLI.
8
- *
9
- * v2.0.0: Initial release
10
- */
11
-
12
- const fs = require('fs');
13
- const path = require('path');
14
- const { execSync } = require('child_process');
15
-
16
- const COWORK_REPO = 'https://github.com/msartem/copilot_cowork_mcp.git';
17
- const COPILOT_DIR = path.join(require('os').homedir(), '.copilot');
18
- const PLUGINS_DIR = path.join(COPILOT_DIR, 'installed-plugins');
19
- const COWORK_DIR = path.join(PLUGINS_DIR, 'copilot_cowork_mcp');
20
- const MCP_CONFIG = path.join(COPILOT_DIR, '.mcp.json');
21
-
22
- function parseArgs() {
23
- const args = process.argv.slice(2).filter(a => a !== 'cowork');
24
- return {
25
- uninstall: args.includes('--uninstall'),
26
- status: args.includes('--status'),
27
- help: args.includes('--help') || args.includes('-h'),
28
- };
29
- }
30
-
31
- function showHelp() {
32
- console.log(`
33
- 🤝 SHIKIGAMI - Copilot Cowork Setup
34
-
35
- Usage: npx shikigami cowork [options]
36
-
37
- Options:
38
- --status Check installation status
39
- --uninstall Remove Cowork MCP configuration
40
- -h, --help Show this help message
41
-
42
- What is Copilot Cowork?
43
- Microsoft Copilot Cowork MCP enables GitHub Copilot CLI to access
44
- your M365 data: Mail, Calendar, Teams messages, and OneDrive files.
45
-
46
- Requirements:
47
- - Python 3.10+
48
- - Microsoft 365 account
49
- - First run requires browser sign-in (Edge/Chromium)
50
-
51
- After setup:
52
- 1. Restart Copilot CLI (or start a new session)
53
- 2. First use will open a browser for M365 authentication
54
- 3. After sign-in, tokens are cached for ~90 days
55
- `);
56
- }
57
-
58
- function checkPython() {
59
- try {
60
- const version = execSync('python3 --version 2>&1', { encoding: 'utf-8' }).trim();
61
- const match = version.match(/Python (\d+)\.(\d+)/);
62
- if (match && (parseInt(match[1]) > 3 || (parseInt(match[1]) === 3 && parseInt(match[2]) >= 10))) {
63
- return { ok: true, version };
64
- }
65
- return { ok: false, version, error: 'Python 3.10+ required' };
66
- } catch {
67
- return { ok: false, version: null, error: 'Python 3 not found' };
68
- }
69
- }
70
-
71
- function checkGit() {
72
- try {
73
- execSync('git --version', { encoding: 'utf-8' });
74
- return true;
75
- } catch {
76
- return false;
77
- }
78
- }
79
-
80
- function isInstalled() {
81
- return fs.existsSync(path.join(COWORK_DIR, 'server.py'));
82
- }
83
-
84
- function isMcpConfigured() {
85
- if (!fs.existsSync(MCP_CONFIG)) return false;
86
- try {
87
- const config = JSON.parse(fs.readFileSync(MCP_CONFIG, 'utf-8'));
88
- return !!(config.mcpServers && config.mcpServers.cowork);
89
- } catch {
90
- return false;
91
- }
92
- }
93
-
94
- function checkDependencies() {
95
- const deps = ['fastmcp', 'requests', 'playwright'];
96
- const results = {};
97
- for (const dep of deps) {
98
- try {
99
- execSync(`python3 -c "import ${dep}" 2>&1`, { encoding: 'utf-8' });
100
- results[dep] = true;
101
- } catch {
102
- results[dep] = false;
103
- }
104
- }
105
- return results;
106
- }
107
-
108
- function showStatus() {
109
- console.log('');
110
- console.log('🤝 Copilot Cowork MCP Status');
111
- console.log('════════════════════════════');
112
- console.log('');
113
-
114
- const python = checkPython();
115
- console.log(` Python: ${python.ok ? `✅ ${python.version}` : `❌ ${python.error}`}`);
116
-
117
- const installed = isInstalled();
118
- console.log(` Plugin: ${installed ? '✅ Installed' : '❌ Not installed'}`);
119
-
120
- if (installed) {
121
- const deps = checkDependencies();
122
- for (const [dep, ok] of Object.entries(deps)) {
123
- console.log(` ${dep.padEnd(14)} ${ok ? '✅' : '❌ Missing'}`);
124
- }
125
- }
126
-
127
- const configured = isMcpConfigured();
128
- console.log(` MCP Config: ${configured ? '✅ Configured' : '❌ Not configured'}`);
129
- console.log(` Config Path: ${MCP_CONFIG}`);
130
- console.log('');
131
-
132
- if (installed && configured) {
133
- console.log(' ✨ Ready to use! Restart Copilot CLI to activate.');
134
- } else {
135
- console.log(' Run "npx shikigami cowork" to set up.');
136
- }
137
- console.log('');
138
- }
139
-
140
- function installDependencies() {
141
- const deps = checkDependencies();
142
- const missing = Object.entries(deps).filter(([, ok]) => !ok).map(([dep]) => dep);
143
-
144
- if (missing.length === 0) {
145
- console.log(' ✅ All Python dependencies already installed');
146
- return true;
147
- }
148
-
149
- console.log(` 📦 Installing: ${missing.join(', ')}...`);
150
- try {
151
- // Try with --break-system-packages first (Ubuntu/Debian), fallback to without
152
- try {
153
- execSync(`pip install --break-system-packages ${missing.join(' ')} 2>&1`, {
154
- encoding: 'utf-8',
155
- stdio: 'pipe',
156
- });
157
- } catch {
158
- execSync(`pip install ${missing.join(' ')} 2>&1`, {
159
- encoding: 'utf-8',
160
- stdio: 'pipe',
161
- });
162
- }
163
-
164
- // Install Playwright browser if playwright was just installed
165
- if (missing.includes('playwright')) {
166
- console.log(' 🌐 Installing Playwright browser (chromium)...');
167
- execSync('python3 -m playwright install chromium 2>&1', {
168
- encoding: 'utf-8',
169
- stdio: 'pipe',
170
- });
171
- }
172
-
173
- console.log(' ✅ Dependencies installed');
174
- return true;
175
- } catch (err) {
176
- console.error(` ❌ Failed to install dependencies: ${err.message}`);
177
- console.log(' 💡 Try manually: pip install fastmcp requests playwright');
178
- return false;
179
- }
180
- }
181
-
182
- function clonePlugin() {
183
- if (isInstalled()) {
184
- console.log(' ✅ Plugin already installed');
185
- // Pull latest
186
- try {
187
- execSync(`git -C "${COWORK_DIR}" pull --quiet 2>&1`, {
188
- encoding: 'utf-8',
189
- stdio: 'pipe',
190
- });
191
- console.log(' 🔄 Updated to latest version');
192
- } catch {
193
- // Ignore pull errors
194
- }
195
- return true;
196
- }
197
-
198
- console.log(' 📥 Cloning Copilot Cowork MCP...');
199
- try {
200
- fs.mkdirSync(PLUGINS_DIR, { recursive: true });
201
- execSync(`git clone "${COWORK_REPO}" "${COWORK_DIR}" 2>&1`, {
202
- encoding: 'utf-8',
203
- stdio: 'pipe',
204
- });
205
- console.log(' ✅ Plugin cloned');
206
- return true;
207
- } catch (err) {
208
- console.error(` ❌ Failed to clone: ${err.message}`);
209
- return false;
210
- }
211
- }
212
-
213
- function configureMcp() {
214
- if (isMcpConfigured()) {
215
- console.log(' ✅ MCP already configured');
216
- return true;
217
- }
218
-
219
- console.log(' ⚙️ Configuring MCP server...');
220
- try {
221
- fs.mkdirSync(COPILOT_DIR, { recursive: true });
222
-
223
- let config = { mcpServers: {} };
224
- if (fs.existsSync(MCP_CONFIG)) {
225
- try {
226
- config = JSON.parse(fs.readFileSync(MCP_CONFIG, 'utf-8'));
227
- if (!config.mcpServers) config.mcpServers = {};
228
- } catch {
229
- // Corrupted config, start fresh but keep backup
230
- const backup = `${MCP_CONFIG}.bak`;
231
- fs.copyFileSync(MCP_CONFIG, backup);
232
- console.log(` ⚠️ Backed up corrupted config to ${backup}`);
233
- }
234
- }
235
-
236
- config.mcpServers.cowork = {
237
- type: 'stdio',
238
- command: 'python3',
239
- args: [path.join(COWORK_DIR, 'server.py')],
240
- env: {
241
- COWORK_SHOW_THINKING: 'false',
242
- },
243
- };
244
-
245
- fs.writeFileSync(MCP_CONFIG, JSON.stringify(config, null, 2) + '\n');
246
- console.log(' ✅ MCP configured');
247
- return true;
248
- } catch (err) {
249
- console.error(` ❌ Failed to configure MCP: ${err.message}`);
250
- return false;
251
- }
252
- }
253
-
254
- function uninstall() {
255
- console.log('');
256
- console.log('🤝 Uninstalling Copilot Cowork MCP...');
257
- console.log('');
258
-
259
- // Remove from MCP config
260
- if (fs.existsSync(MCP_CONFIG)) {
261
- try {
262
- const config = JSON.parse(fs.readFileSync(MCP_CONFIG, 'utf-8'));
263
- if (config.mcpServers && config.mcpServers.cowork) {
264
- delete config.mcpServers.cowork;
265
- fs.writeFileSync(MCP_CONFIG, JSON.stringify(config, null, 2) + '\n');
266
- console.log(' ✅ Removed from MCP config');
267
- } else {
268
- console.log(' ⏭️ Not in MCP config');
269
- }
270
- } catch {
271
- console.log(' ⚠️ Could not parse MCP config');
272
- }
273
- }
274
-
275
- // Remove plugin directory
276
- if (fs.existsSync(COWORK_DIR)) {
277
- fs.rmSync(COWORK_DIR, { recursive: true, force: true });
278
- console.log(' ✅ Removed plugin files');
279
- } else {
280
- console.log(' ⏭️ Plugin not installed');
281
- }
282
-
283
- console.log('');
284
- console.log(' ✨ Uninstall complete. Restart Copilot CLI to apply.');
285
- console.log('');
286
- }
287
-
288
- function setup() {
289
- const { uninstall: doUninstall, status, help } = parseArgs();
290
-
291
- if (help) {
292
- showHelp();
293
- return;
294
- }
295
-
296
- if (status) {
297
- showStatus();
298
- return;
299
- }
300
-
301
- if (doUninstall) {
302
- uninstall();
303
- return;
304
- }
305
-
306
- console.log('');
307
- console.log('🤝 Setting up Copilot Cowork MCP');
308
- console.log('═════════════════════════════════');
309
- console.log('');
310
-
311
- // Step 1: Check prerequisites
312
- console.log('Step 1/4: Checking prerequisites...');
313
- const python = checkPython();
314
- if (!python.ok) {
315
- console.error(` ❌ ${python.error}`);
316
- console.log(' 💡 Install Python 3.10+: https://www.python.org/downloads/');
317
- process.exit(1);
318
- }
319
- console.log(` ✅ ${python.version}`);
320
-
321
- if (!checkGit()) {
322
- console.error(' ❌ Git not found');
323
- process.exit(1);
324
- }
325
- console.log(' ✅ Git available');
326
- console.log('');
327
-
328
- // Step 2: Clone plugin
329
- console.log('Step 2/4: Installing plugin...');
330
- if (!clonePlugin()) process.exit(1);
331
- console.log('');
332
-
333
- // Step 3: Install dependencies
334
- console.log('Step 3/4: Installing dependencies...');
335
- if (!installDependencies()) process.exit(1);
336
- console.log('');
337
-
338
- // Step 4: Configure MCP
339
- console.log('Step 4/4: Configuring MCP...');
340
- if (!configureMcp()) process.exit(1);
341
- console.log('');
342
-
343
- // Done
344
- console.log('═════════════════════════════════');
345
- console.log('✨ Copilot Cowork MCP setup complete!');
346
- console.log('');
347
- console.log('📝 Next steps:');
348
- console.log(' 1. Restart Copilot CLI (or start a new session)');
349
- console.log(' 2. First use will open a browser for M365 sign-in');
350
- console.log(' 3. After sign-in, tokens are cached for ~90 days');
351
- console.log('');
352
- console.log('💡 Usage examples:');
353
- console.log(' "メールの未読を要約して"');
354
- console.log(' "明日の会議は?"');
355
- console.log(' "Teamsで自分にhelloとメッセージ送って"');
356
- console.log('');
357
- console.log('🔧 Commands:');
358
- console.log(' npx shikigami cowork --status # Check status');
359
- console.log(' npx shikigami cowork --uninstall # Remove');
360
- console.log('');
361
- }
362
-
363
- module.exports = { setup, showStatus, isInstalled, isMcpConfigured };
364
-
365
- if (require.main === module) {
366
- setup();
367
- }