@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
@@ -0,0 +1,587 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * SHIKIGAMI Cowork Plugin Builder
4
+ *
5
+ * Builds a Microsoft 365 Copilot Cowork plugin package (.zip)
6
+ * from SHIKIGAMI's Agent Skills.
7
+ *
8
+ * Usage: npx shikigami cowork [options]
9
+ * --out <dir> Output directory (default: ./dist)
10
+ * --check Dry-run validation only
11
+ * --help Show help
12
+ *
13
+ * Reference: https://learn.microsoft.com/microsoft-365/copilot/cowork/cowork-plugin-development
14
+ */
15
+
16
+ const fs = require('fs');
17
+ const path = require('path');
18
+ const { execSync } = require('child_process');
19
+
20
+ // ── Constants ──────────────────────────────────────────────────────────────
21
+
22
+ const MAX_COMPANIONS_PER_SKILL = 20;
23
+ const MAX_COMPANION_SIZE = 5 * 1024 * 1024; // 5 MB
24
+ const MAX_COMPANION_TOTAL = 10 * 1024 * 1024; // 10 MB per skill
25
+ const MAX_SKILLS = 20;
26
+
27
+ const PACKAGE_NAME = 'com.nahisaho.shikigami';
28
+ const APP_ID = 'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d'; // Stable GUID
29
+ const ACCENT_COLOR = '#6B46C1';
30
+
31
+ // ── Minimal PNG generators (no dependencies) ──────────────────────────────
32
+
33
+ function createMinimalPNG(width, height, r, g, b) {
34
+ // Creates a minimal valid PNG with a solid color
35
+ // PNG signature
36
+ const signature = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
37
+
38
+ function crc32(buf) {
39
+ let crc = 0xFFFFFFFF;
40
+ const table = new Int32Array(256);
41
+ for (let i = 0; i < 256; i++) {
42
+ let c = i;
43
+ for (let j = 0; j < 8; j++) c = (c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1);
44
+ table[i] = c;
45
+ }
46
+ for (let i = 0; i < buf.length; i++) {
47
+ crc = table[(crc ^ buf[i]) & 0xFF] ^ (crc >>> 8);
48
+ }
49
+ return (crc ^ 0xFFFFFFFF) >>> 0;
50
+ }
51
+
52
+ function makeChunk(type, data) {
53
+ const len = Buffer.alloc(4);
54
+ len.writeUInt32BE(data.length);
55
+ const typeAndData = Buffer.concat([Buffer.from(type), data]);
56
+ const crc = Buffer.alloc(4);
57
+ crc.writeUInt32BE(crc32(typeAndData));
58
+ return Buffer.concat([len, typeAndData, crc]);
59
+ }
60
+
61
+ // IHDR
62
+ const ihdr = Buffer.alloc(13);
63
+ ihdr.writeUInt32BE(width, 0);
64
+ ihdr.writeUInt32BE(height, 4);
65
+ ihdr[8] = 8; // bit depth
66
+ ihdr[9] = 2; // color type RGB
67
+ ihdr[10] = 0; // compression
68
+ ihdr[11] = 0; // filter
69
+ ihdr[12] = 0; // interlace
70
+
71
+ // IDAT - raw image data
72
+ const rowSize = 1 + width * 3; // filter byte + RGB per pixel
73
+ const rawData = Buffer.alloc(rowSize * height);
74
+ for (let y = 0; y < height; y++) {
75
+ rawData[y * rowSize] = 0; // no filter
76
+ for (let x = 0; x < width; x++) {
77
+ const offset = y * rowSize + 1 + x * 3;
78
+ rawData[offset] = r;
79
+ rawData[offset + 1] = g;
80
+ rawData[offset + 2] = b;
81
+ }
82
+ }
83
+
84
+ const zlib = require('zlib');
85
+ const compressed = zlib.deflateSync(rawData);
86
+
87
+ // IEND
88
+ const iend = Buffer.alloc(0);
89
+
90
+ return Buffer.concat([
91
+ signature,
92
+ makeChunk('IHDR', ihdr),
93
+ makeChunk('IDAT', compressed),
94
+ makeChunk('IEND', iend),
95
+ ]);
96
+ }
97
+
98
+ // ── SKILL.md Parser ────────────────────────────────────────────────────────
99
+
100
+ function parseFrontmatter(content) {
101
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
102
+ if (!match) return null;
103
+
104
+ const yaml = match[1];
105
+ const result = {};
106
+
107
+ // Simple YAML parser for frontmatter fields
108
+ let currentKey = null;
109
+ let blockValue = [];
110
+ let inBlock = false;
111
+
112
+ for (const line of yaml.split('\n')) {
113
+ if (inBlock) {
114
+ if (line.match(/^\s{2,}/) || line.trim() === '') {
115
+ blockValue.push(line.replace(/^\s{2}/, ''));
116
+ continue;
117
+ } else {
118
+ result[currentKey] = blockValue.join('\n').trim();
119
+ inBlock = false;
120
+ }
121
+ }
122
+
123
+ const kvMatch = line.match(/^(\w[\w.-]*)\s*:\s*(.*)/);
124
+ if (kvMatch) {
125
+ currentKey = kvMatch[1];
126
+ const value = kvMatch[2].trim();
127
+ if (value === '|' || value === '>') {
128
+ inBlock = true;
129
+ blockValue = [];
130
+ } else {
131
+ result[currentKey] = value.replace(/^["']|["']$/g, '');
132
+ }
133
+ }
134
+ }
135
+
136
+ if (inBlock && currentKey) {
137
+ result[currentKey] = blockValue.join('\n').trim();
138
+ }
139
+
140
+ return result;
141
+ }
142
+
143
+ // ── Companion File Consolidation ───────────────────────────────────────────
144
+
145
+ function consolidateCompanions(skillDir, skillName) {
146
+ /**
147
+ * If a skill has more than MAX_COMPANIONS_PER_SKILL companion files,
148
+ * consolidate them into category-level reference files.
149
+ * Returns an array of { relativePath, content } for the consolidated files.
150
+ */
151
+ const files = [];
152
+ const allFiles = [];
153
+
154
+ function walkDir(dir, prefix) {
155
+ if (!fs.existsSync(dir)) return;
156
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
157
+ for (const entry of entries) {
158
+ const fullPath = path.join(dir, entry.name);
159
+ const relPath = prefix ? `${prefix}/${entry.name}` : entry.name;
160
+ if (entry.isDirectory()) {
161
+ walkDir(fullPath, relPath);
162
+ } else if (entry.name !== 'SKILL.md') {
163
+ allFiles.push({ fullPath, relPath, name: entry.name });
164
+ }
165
+ }
166
+ }
167
+
168
+ walkDir(skillDir, '');
169
+
170
+ if (allFiles.length <= MAX_COMPANIONS_PER_SKILL) {
171
+ // No consolidation needed - return original files
172
+ return allFiles.map(f => ({
173
+ relativePath: f.relPath,
174
+ content: fs.readFileSync(f.fullPath),
175
+ }));
176
+ }
177
+
178
+ // Group by top-level directory
179
+ const groups = {};
180
+ for (const f of allFiles) {
181
+ const parts = f.relPath.split('/');
182
+ const topDir = parts.length > 1 ? parts[0] : '_root';
183
+ const subDir = parts.length > 2 ? parts.slice(0, 2).join('/') : topDir;
184
+ if (!groups[subDir]) groups[subDir] = [];
185
+ groups[subDir].push(f);
186
+ }
187
+
188
+ // If groups are still too many, merge into top-level categories
189
+ if (Object.keys(groups).length > MAX_COMPANIONS_PER_SKILL) {
190
+ const topGroups = {};
191
+ for (const f of allFiles) {
192
+ const topDir = f.relPath.split('/')[0] || '_root';
193
+ if (!topGroups[topDir]) topGroups[topDir] = [];
194
+ topGroups[topDir].push(f);
195
+ }
196
+
197
+ for (const [dir, dirFiles] of Object.entries(topGroups)) {
198
+ if (dir === '_root') {
199
+ for (const f of dirFiles) {
200
+ files.push({
201
+ relativePath: f.relPath,
202
+ content: fs.readFileSync(f.fullPath),
203
+ });
204
+ }
205
+ continue;
206
+ }
207
+
208
+ // Consolidate all files under this dir into one reference file
209
+ let consolidated = `# ${dir}\n\nConsolidated reference for ${skillName}.\n\n`;
210
+ for (const f of dirFiles) {
211
+ const content = fs.readFileSync(f.fullPath, 'utf-8');
212
+ const basename = path.basename(f.name, path.extname(f.name));
213
+ consolidated += `---\n\n## ${basename}\n\n${content}\n\n`;
214
+ }
215
+
216
+ files.push({
217
+ relativePath: `references/${dir}.md`,
218
+ content: Buffer.from(consolidated, 'utf-8'),
219
+ });
220
+ }
221
+ } else {
222
+ // Consolidate sub-directories into category files
223
+ for (const [subDir, subFiles] of Object.entries(groups)) {
224
+ if (subDir === '_root' || subFiles.length <= 1) {
225
+ for (const f of subFiles) {
226
+ files.push({
227
+ relativePath: f.relPath,
228
+ content: fs.readFileSync(f.fullPath),
229
+ });
230
+ }
231
+ continue;
232
+ }
233
+
234
+ let consolidated = `# ${subDir}\n\n`;
235
+ for (const f of subFiles) {
236
+ const content = fs.readFileSync(f.fullPath, 'utf-8');
237
+ const basename = path.basename(f.name, path.extname(f.name));
238
+ consolidated += `---\n\n## ${basename}\n\n${content}\n\n`;
239
+ }
240
+
241
+ files.push({
242
+ relativePath: `references/${subDir.replace(/\//g, '-')}.md`,
243
+ content: Buffer.from(consolidated, 'utf-8'),
244
+ });
245
+ }
246
+ }
247
+
248
+ return files;
249
+ }
250
+
251
+ // ── ZIP Builder (uses system zip or tar) ───────────────────────────────────
252
+
253
+ function createZip(outputPath, files) {
254
+ /**
255
+ * Creates a zip file from an array of { path, content } entries.
256
+ * Uses a temp directory and system zip command.
257
+ */
258
+ const tmpDir = fs.mkdtempSync(path.join(require('os').tmpdir(), 'shikigami-cowork-'));
259
+
260
+ try {
261
+ // Write all files to temp directory
262
+ for (const file of files) {
263
+ const filePath = path.join(tmpDir, file.path);
264
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
265
+ if (Buffer.isBuffer(file.content)) {
266
+ fs.writeFileSync(filePath, file.content);
267
+ } else {
268
+ fs.writeFileSync(filePath, file.content, 'utf-8');
269
+ }
270
+ }
271
+
272
+ // Create zip
273
+ const absOutput = path.resolve(outputPath);
274
+ try {
275
+ execSync(`cd "${tmpDir}" && zip -r "${absOutput}" .`, { stdio: 'pipe' });
276
+ } catch {
277
+ // Fallback: try PowerShell (Windows)
278
+ try {
279
+ execSync(
280
+ `powershell -Command "Compress-Archive -Path '${tmpDir}${path.sep}*' -DestinationPath '${absOutput}' -Force"`,
281
+ { stdio: 'pipe' }
282
+ );
283
+ } catch {
284
+ console.error('❌ zip command not found. Install zip or use PowerShell.');
285
+ process.exit(1);
286
+ }
287
+ }
288
+ } finally {
289
+ fs.rmSync(tmpDir, { recursive: true, force: true });
290
+ }
291
+ }
292
+
293
+ // ── Manifest Generator ─────────────────────────────────────────────────────
294
+
295
+ function generateManifest(skills, version) {
296
+ return {
297
+ '$schema': 'https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json',
298
+ manifestVersion: 'devPreview',
299
+ version: version,
300
+ id: APP_ID,
301
+ packageName: PACKAGE_NAME,
302
+ developer: {
303
+ name: 'nahisaho',
304
+ websiteUrl: 'https://github.com/nahisaho/SHIKIGAMI',
305
+ privacyUrl: 'https://github.com/nahisaho/SHIKIGAMI/blob/main/LICENSE',
306
+ termsOfUseUrl: 'https://github.com/nahisaho/SHIKIGAMI/blob/main/LICENSE',
307
+ },
308
+ name: {
309
+ short: 'SHIKIGAMI',
310
+ full: 'SHIKIGAMI - Deep Research & Consulting Agent Skills for Copilot Cowork',
311
+ },
312
+ description: {
313
+ short: 'AI-powered deep research and consulting framework analysis',
314
+ full: 'SHIKIGAMI provides 4 specialized Agent Skills for Copilot Cowork: '
315
+ + 'deep research with hallucination prevention, 50+ consulting frameworks '
316
+ + '(SWOT, PEST, 5Forces, BCG Matrix, etc.), structured report writing, '
317
+ + 'and project planning with 5 Whys/JTBD purpose discovery.',
318
+ },
319
+ icons: {
320
+ color: 'color.png',
321
+ outline: 'outline.png',
322
+ },
323
+ accentColor: ACCENT_COLOR,
324
+ agentSkills: skills.map(s => ({ folder: `./skills/${s.name}` })),
325
+ };
326
+ }
327
+
328
+ // ── Validation ─────────────────────────────────────────────────────────────
329
+
330
+ function validateSkill(skillDir, skillName) {
331
+ const errors = [];
332
+ const warnings = [];
333
+
334
+ const skillMdPath = path.join(skillDir, 'SKILL.md');
335
+ if (!fs.existsSync(skillMdPath)) {
336
+ errors.push(`SKILL.md not found in ${skillName}`);
337
+ return { errors, warnings };
338
+ }
339
+
340
+ const content = fs.readFileSync(skillMdPath, 'utf-8');
341
+ const frontmatter = parseFrontmatter(content);
342
+
343
+ if (!frontmatter) {
344
+ errors.push(`${skillName}: No YAML frontmatter found`);
345
+ return { errors, warnings };
346
+ }
347
+
348
+ // Validate name
349
+ if (!frontmatter.name) {
350
+ errors.push(`${skillName}: Missing 'name' field in frontmatter`);
351
+ } else {
352
+ if (frontmatter.name !== skillName) {
353
+ errors.push(`${skillName}: Frontmatter name '${frontmatter.name}' doesn't match folder '${skillName}'`);
354
+ }
355
+ if (frontmatter.name.length > 64) {
356
+ errors.push(`${skillName}: Name exceeds 64 characters`);
357
+ }
358
+ if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(frontmatter.name)) {
359
+ errors.push(`${skillName}: Name must be kebab-case`);
360
+ }
361
+ }
362
+
363
+ // Validate description
364
+ if (!frontmatter.description) {
365
+ errors.push(`${skillName}: Missing 'description' field in frontmatter`);
366
+ } else if (frontmatter.description.length > 1024) {
367
+ warnings.push(`${skillName}: Description exceeds 1024 characters (${frontmatter.description.length})`);
368
+ }
369
+
370
+ // Count companion files
371
+ const companions = consolidateCompanions(skillDir, skillName);
372
+ if (companions.length > MAX_COMPANIONS_PER_SKILL) {
373
+ errors.push(`${skillName}: ${companions.length} companion files after consolidation (max ${MAX_COMPANIONS_PER_SKILL})`);
374
+ }
375
+
376
+ const totalSize = companions.reduce((sum, f) => sum + f.content.length, 0);
377
+ if (totalSize > MAX_COMPANION_TOTAL) {
378
+ errors.push(`${skillName}: Total companion size ${(totalSize / 1024 / 1024).toFixed(1)}MB exceeds 10MB limit`);
379
+ }
380
+
381
+ const oversized = companions.filter(f => f.content.length > MAX_COMPANION_SIZE);
382
+ for (const f of oversized) {
383
+ errors.push(`${skillName}: ${f.relativePath} exceeds 5MB limit`);
384
+ }
385
+
386
+ return { errors, warnings, companions, frontmatter };
387
+ }
388
+
389
+ // ── Main ───────────────────────────────────────────────────────────────────
390
+
391
+ function parseArgs() {
392
+ const args = process.argv.slice(2);
393
+ return {
394
+ out: args.includes('--out') ? args[args.indexOf('--out') + 1] : './dist',
395
+ check: args.includes('--check') || args.includes('--dry-run'),
396
+ help: args.includes('--help') || args.includes('-h'),
397
+ };
398
+ }
399
+
400
+ function showHelp() {
401
+ console.log(`
402
+ 🎭 SHIKIGAMI Cowork Plugin Builder
403
+
404
+ Builds a Microsoft 365 Copilot Cowork plugin package (.zip)
405
+
406
+ Usage: npx shikigami cowork [options]
407
+
408
+ Options:
409
+ --out <dir> Output directory (default: ./dist)
410
+ --check Validation only (dry-run)
411
+ -h, --help Show this help
412
+
413
+ Output:
414
+ Creates shikigami-cowork-plugin.zip ready for M365 Admin Center upload.
415
+
416
+ Reference:
417
+ https://learn.microsoft.com/microsoft-365/copilot/cowork/cowork-plugin-development
418
+ `);
419
+ }
420
+
421
+ function build() {
422
+ const { out, check, help } = parseArgs();
423
+
424
+ if (help) {
425
+ showHelp();
426
+ process.exit(0);
427
+ }
428
+
429
+ console.log('');
430
+ console.log('🎭 SHIKIGAMI Cowork Plugin Builder');
431
+ console.log('====================================');
432
+ console.log('');
433
+
434
+ // Locate skills directory
435
+ const packageDir = path.resolve(__dirname, '..');
436
+ let skillsRoot = path.join(packageDir, 'github-assets', 'skills');
437
+
438
+ // If running from installed package, check node_modules path
439
+ if (!fs.existsSync(skillsRoot)) {
440
+ skillsRoot = path.join(packageDir, '.github', 'skills');
441
+ }
442
+ // Also check project's .github/skills (after init)
443
+ if (!fs.existsSync(skillsRoot)) {
444
+ skillsRoot = path.join(process.cwd(), '.github', 'skills');
445
+ }
446
+
447
+ if (!fs.existsSync(skillsRoot)) {
448
+ console.error('❌ Skills directory not found.');
449
+ console.error(' Run `npx shikigami init` first to copy skills to your project.');
450
+ process.exit(1);
451
+ }
452
+
453
+ // Read package version
454
+ let version = '1.0.0';
455
+ try {
456
+ const pkg = JSON.parse(fs.readFileSync(path.join(packageDir, 'package.json'), 'utf-8'));
457
+ version = pkg.version || version;
458
+ } catch { /* ignore */ }
459
+
460
+ // Discover skills
461
+ const skillDirs = fs.readdirSync(skillsRoot, { withFileTypes: true })
462
+ .filter(d => d.isDirectory() && d.name.startsWith('shikigami-'))
463
+ .map(d => d.name);
464
+
465
+ if (skillDirs.length === 0) {
466
+ console.error('❌ No skills found (expected shikigami-* directories)');
467
+ process.exit(1);
468
+ }
469
+
470
+ console.log(`📂 Skills root: ${skillsRoot}`);
471
+ console.log(`📦 Found ${skillDirs.length} skills`);
472
+ console.log('');
473
+
474
+ // Validate all skills
475
+ let hasErrors = false;
476
+ const validatedSkills = [];
477
+
478
+ for (const skillName of skillDirs) {
479
+ const skillDir = path.join(skillsRoot, skillName);
480
+ const result = validateSkill(skillDir, skillName);
481
+
482
+ if (result.errors.length > 0) {
483
+ hasErrors = true;
484
+ for (const err of result.errors) console.log(` ❌ ${err}`);
485
+ }
486
+ for (const warn of result.warnings) console.log(` ⚠️ ${warn}`);
487
+
488
+ if (result.errors.length === 0) {
489
+ const companionCount = result.companions ? result.companions.length : 0;
490
+ console.log(` ✅ ${skillName} (${companionCount} companion files)`);
491
+ validatedSkills.push({
492
+ name: skillName,
493
+ dir: skillDir,
494
+ companions: result.companions,
495
+ frontmatter: result.frontmatter,
496
+ });
497
+ }
498
+ }
499
+
500
+ console.log('');
501
+
502
+ if (hasErrors) {
503
+ console.error('❌ Validation failed. Fix errors above before building.');
504
+ process.exit(1);
505
+ }
506
+
507
+ if (validatedSkills.length > MAX_SKILLS) {
508
+ console.error(`❌ Too many skills: ${validatedSkills.length} (max ${MAX_SKILLS})`);
509
+ process.exit(1);
510
+ }
511
+
512
+ if (check) {
513
+ console.log('✅ Validation passed (dry-run mode)');
514
+ console.log(` ${validatedSkills.length} skills ready for packaging`);
515
+ process.exit(0);
516
+ }
517
+
518
+ // Build package
519
+ console.log('📦 Building Cowork plugin package...');
520
+
521
+ const zipFiles = [];
522
+
523
+ // 1. Generate manifest.json
524
+ const manifest = generateManifest(validatedSkills, version);
525
+ zipFiles.push({
526
+ path: 'manifest.json',
527
+ content: JSON.stringify(manifest, null, 2),
528
+ });
529
+ console.log(' ✅ manifest.json');
530
+
531
+ // 2. Generate icons
532
+ const colorPng = createMinimalPNG(192, 192, 107, 70, 193); // Purple (#6B46C1)
533
+ const outlinePng = createMinimalPNG(32, 32, 107, 70, 193);
534
+ zipFiles.push({ path: 'color.png', content: colorPng });
535
+ zipFiles.push({ path: 'outline.png', content: outlinePng });
536
+ console.log(' ✅ color.png (192×192)');
537
+ console.log(' ✅ outline.png (32×32)');
538
+
539
+ // 3. Copy skills with consolidation
540
+ for (const skill of validatedSkills) {
541
+ // Copy SKILL.md
542
+ const skillMd = fs.readFileSync(path.join(skill.dir, 'SKILL.md'));
543
+ zipFiles.push({
544
+ path: `skills/${skill.name}/SKILL.md`,
545
+ content: skillMd,
546
+ });
547
+
548
+ // Copy companion files (already consolidated)
549
+ for (const companion of skill.companions) {
550
+ zipFiles.push({
551
+ path: `skills/${skill.name}/${companion.relativePath}`,
552
+ content: companion.content,
553
+ });
554
+ }
555
+
556
+ console.log(` ✅ skills/${skill.name}/ (${skill.companions.length + 1} files)`);
557
+ }
558
+
559
+ // 4. Create ZIP
560
+ const outDir = path.resolve(out);
561
+ fs.mkdirSync(outDir, { recursive: true });
562
+ const zipPath = path.join(outDir, 'shikigami-cowork-plugin.zip');
563
+
564
+ // Remove old zip if exists
565
+ if (fs.existsSync(zipPath)) {
566
+ fs.unlinkSync(zipPath);
567
+ }
568
+
569
+ createZip(zipPath, zipFiles);
570
+
571
+ const zipSize = fs.statSync(zipPath).size;
572
+ console.log('');
573
+ console.log(`✅ Plugin package created: ${zipPath}`);
574
+ console.log(` Size: ${(zipSize / 1024).toFixed(1)} KB`);
575
+ console.log(` Skills: ${validatedSkills.length}`);
576
+ console.log(` Version: ${version}`);
577
+ console.log('');
578
+ console.log('📝 Next steps:');
579
+ console.log(' 1. Open M365 Admin Center > Manage Apps > Upload Custom App');
580
+ console.log(' 2. Upload shikigami-cowork-plugin.zip');
581
+ console.log(' 3. Open Cowork > Sources & Skills to verify');
582
+ console.log('');
583
+ console.log('📖 https://learn.microsoft.com/microsoft-365/copilot/cowork/cowork-plugin-development');
584
+ console.log('');
585
+ }
586
+
587
+ build();
package/scripts/cli.js CHANGED
@@ -32,7 +32,7 @@ Usage: npx shikigami [command] [options]
32
32
  Commands:
33
33
  init Initialize SHIKIGAMI files in current directory
34
34
  upgrade, update Upgrade SHIKIGAMI files (same as init --force) (v1.23.0)
35
- cowork [options] Set up Microsoft Copilot Cowork MCP (v2.0.0)
35
+ cowork [options] Build Copilot Cowork plugin package (v2.0.4)
36
36
  new [name] Create a new research project
37
37
  find-related [keyword] Find related projects by keywords (v1.7.0)
38
38
  inherit [options] Prepare knowledge inheritance from past reports (v1.8.0)
@@ -42,8 +42,9 @@ Commands:
42
42
  Examples:
43
43
  npx shikigami init # Initialize SHIKIGAMI
44
44
  npx shikigami upgrade # Upgrade to latest version
45
- npx shikigami cowork # Set up Copilot Cowork MCP (v2.0.0)
46
- npx shikigami cowork --status # Check Cowork installation status
45
+ npx shikigami cowork # Build Cowork plugin .zip
46
+ npx shikigami cowork --check # Validate skills (dry-run)
47
+ npx shikigami cowork --out ./dist # Specify output directory
47
48
  npx shikigami new my-research # Create new project "my-research"
48
49
  npx shikigami new # Create new project with auto-numbered name
49
50
  npx shikigami find-related レアアース # Find projects related to "レアアース"
@@ -71,10 +72,9 @@ if (command === 'upgrade' || command === 'update') {
71
72
  process.exit(0);
72
73
  }
73
74
 
74
- // Cowork command (v2.0.0)
75
+ // Cowork command (v2.0.4)
75
76
  if (command === 'cowork') {
76
- const { setup } = require('./setup-cowork.js');
77
- setup();
77
+ require('./build-cowork-plugin.js');
78
78
  process.exit(0);
79
79
  }
80
80
 
package/scripts/init.js CHANGED
@@ -14,7 +14,7 @@ const packageDir = path.resolve(__dirname, '..');
14
14
  const projectRoot = process.cwd();
15
15
 
16
16
  const itemsToCopy = [
17
- { src: '.github', dest: '.github', type: 'dir' },
17
+ { src: 'github-assets', dest: '.github', type: 'dir' },
18
18
  { src: '.vscode', dest: '.vscode', type: 'dir' },
19
19
  { src: 'mcp-server', dest: 'mcp-server', type: 'dir' },
20
20
  { src: 'AGENTS.md', dest: 'AGENTS.md', type: 'file' },
@@ -167,21 +167,10 @@ function init() {
167
167
  console.log(`📊 Summary: ${copiedCount} copied, ${overwrittenCount} overwritten, ${skippedCount} skipped`);
168
168
  console.log('');
169
169
 
170
- // Check Cowork MCP status
171
- try {
172
- const { isInstalled, isMcpConfigured } = require('./setup-cowork.js');
173
- if (!isInstalled() || !isMcpConfigured()) {
174
- console.log('🤝 Copilot Cowork MCP (M365連携):');
175
- console.log(' メール・カレンダー・Teams・OneDrive にCopilot CLIからアクセス可能に');
176
- console.log(' セットアップ: npx shikigami cowork');
177
- console.log('');
178
- } else {
179
- console.log('🤝 Copilot Cowork MCP: ✅ Configured');
180
- console.log('');
181
- }
182
- } catch {
183
- // Ignore errors from cowork check
184
- }
170
+ // Cowork plugin hint
171
+ console.log('🤝 Copilot Cowork:');
172
+ console.log(' npx shikigami cowork でCoworkプラグインパッケージを生成');
173
+ console.log('');
185
174
 
186
175
  console.log('📝 Next steps:');
187
176
  console.log(' 1. cd mcp-server && npm install && npm run build');
@@ -22,7 +22,7 @@ const packageDir = path.resolve(__dirname, '..');
22
22
  const projectRoot = path.resolve(packageDir, '..', '..', '..');
23
23
 
24
24
  const itemsToCopy = [
25
- { src: '.github', dest: '.github', type: 'dir' },
25
+ { src: 'github-assets', dest: '.github', type: 'dir' },
26
26
  { src: '.vscode', dest: '.vscode', type: 'dir' },
27
27
  { src: 'mcp-server', dest: 'mcp-server', type: 'dir' },
28
28
  { src: 'AGENTS.md', dest: 'AGENTS.md', type: 'file' },