kushi-agents 5.4.1 → 5.4.2
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.
- package/package.json +1 -1
- package/src/setup-wizard.mjs +39 -8
- package/src/setup-wizard.test.mjs +19 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kushi-agents",
|
|
3
|
-
"version": "5.4.
|
|
3
|
+
"version": "5.4.2",
|
|
4
4
|
"description": "Install Kushi — multi-source project evidence agent with Comprehensive Structured Capture (CSC) into weekly-only files across Email, Teams, OneNote, Loop, SharePoint, Meetings, CRM, ADO. Meetings retain a sibling verbatim/ audit folder. WorkIQ-only for M365 sources (Graph / m365_* FORBIDDEN as fallbacks; user-paste is first-class). Host-agnostic.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/setup-wizard.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// kushi v5.4.
|
|
1
|
+
// kushi v5.4.2 — interactive setup wizard.
|
|
2
2
|
// Non-interactive overrides (used by tests + CI):
|
|
3
|
-
// KUSHI_WIZARD_ROOT
|
|
4
|
-
// KUSHI_WIZARD_HOSTS
|
|
5
|
-
// KUSHI_WIZARD_GLOBAL
|
|
6
|
-
//
|
|
7
|
-
//
|
|
3
|
+
// KUSHI_WIZARD_ROOT — engagement root path
|
|
4
|
+
// KUSHI_WIZARD_HOSTS — comma list: clawpilot,vscode (or "both")
|
|
5
|
+
// KUSHI_WIZARD_GLOBAL — "y" or "n"
|
|
6
|
+
// KUSHI_WIZARD_WORKSPACE — "y" or "n" — scaffold cwd as a kushi workspace
|
|
7
|
+
// KUSHI_INSTALL_ROOT — override ~/.copilot/ for install target (test isolation)
|
|
8
|
+
// KUSHI_SKIP_INSTALL — "1" to skip the actual install step (tests)
|
|
8
9
|
|
|
9
10
|
import fs from 'node:fs';
|
|
10
11
|
import path from 'node:path';
|
|
@@ -41,7 +42,7 @@ function makePrompter() {
|
|
|
41
42
|
const v = process.env[key];
|
|
42
43
|
return (typeof v === 'string' && v.length > 0) ? v : null;
|
|
43
44
|
};
|
|
44
|
-
if (fromEnv('KUSHI_WIZARD_ROOT') || fromEnv('KUSHI_WIZARD_HOSTS') || fromEnv('KUSHI_WIZARD_GLOBAL')) {
|
|
45
|
+
if (fromEnv('KUSHI_WIZARD_ROOT') || fromEnv('KUSHI_WIZARD_HOSTS') || fromEnv('KUSHI_WIZARD_GLOBAL') || fromEnv('KUSHI_WIZARD_WORKSPACE')) {
|
|
45
46
|
return { interactive: false, ask: async (_q, _def, envKey) => fromEnv(envKey) };
|
|
46
47
|
}
|
|
47
48
|
if (!process.stdin.isTTY) {
|
|
@@ -60,15 +61,23 @@ function makePrompter() {
|
|
|
60
61
|
export async function runSetupWizard({ args = [] } = {}) {
|
|
61
62
|
const detectedRoot = detectEngagementRoot();
|
|
62
63
|
const detectedHosts = detectHosts();
|
|
64
|
+
const cwd = process.cwd();
|
|
65
|
+
const cwdHasKushi = fs.existsSync(path.join(cwd, '.kushi'));
|
|
66
|
+
const defaultWorkspace = cwdHasKushi ? 'n' : 'y';
|
|
63
67
|
const p = makePrompter();
|
|
64
68
|
|
|
65
69
|
console.log('');
|
|
66
|
-
console.log(' kushi setup wizard —
|
|
70
|
+
console.log(' kushi setup wizard — 4 questions, then I install.');
|
|
67
71
|
console.log('');
|
|
68
72
|
|
|
69
73
|
const root = (await p.ask(' Where is your engagement root?', detectedRoot, 'KUSHI_WIZARD_ROOT')) || detectedRoot;
|
|
70
74
|
const hosts = (await p.ask(' Install for clawpilot / vscode / both?', detectedHosts, 'KUSHI_WIZARD_HOSTS')) || detectedHosts;
|
|
71
75
|
const wantGlobal = (await p.ask(' Enable global wiki at ~/.kushi-global/?', 'y', 'KUSHI_WIZARD_GLOBAL')) || 'y';
|
|
76
|
+
const wantWorkspace = (await p.ask(
|
|
77
|
+
` Scaffold current directory (${cwd}) as a kushi workspace?${cwdHasKushi ? ' (already present)' : ''}`,
|
|
78
|
+
defaultWorkspace,
|
|
79
|
+
'KUSHI_WIZARD_WORKSPACE',
|
|
80
|
+
)) || defaultWorkspace;
|
|
72
81
|
|
|
73
82
|
if (p.close) p.close();
|
|
74
83
|
|
|
@@ -76,6 +85,8 @@ export async function runSetupWizard({ args = [] } = {}) {
|
|
|
76
85
|
engagementRoot: root,
|
|
77
86
|
hosts: hosts.toLowerCase(),
|
|
78
87
|
globalWiki: /^y/i.test(wantGlobal),
|
|
88
|
+
workspaceInstall: /^y/i.test(wantWorkspace),
|
|
89
|
+
workspacePath: cwd,
|
|
79
90
|
};
|
|
80
91
|
|
|
81
92
|
console.log('');
|
|
@@ -83,6 +94,7 @@ export async function runSetupWizard({ args = [] } = {}) {
|
|
|
83
94
|
console.log(` engagement root: ${answers.engagementRoot}`);
|
|
84
95
|
console.log(` hosts: ${answers.hosts}`);
|
|
85
96
|
console.log(` global wiki: ${answers.globalWiki ? 'yes' : 'no'}`);
|
|
97
|
+
console.log(` workspace: ${answers.workspaceInstall ? `yes (${cwd})` : 'no'}`);
|
|
86
98
|
console.log('');
|
|
87
99
|
|
|
88
100
|
if (process.env.KUSHI_SKIP_INSTALL === '1') {
|
|
@@ -122,6 +134,25 @@ export async function runSetupWizard({ args = [] } = {}) {
|
|
|
122
134
|
}
|
|
123
135
|
}
|
|
124
136
|
|
|
137
|
+
if (answers.workspaceInstall) {
|
|
138
|
+
try {
|
|
139
|
+
const { main } = await import('./main.mjs');
|
|
140
|
+
await main({
|
|
141
|
+
force: false,
|
|
142
|
+
yes: true,
|
|
143
|
+
noSettings: false,
|
|
144
|
+
noInstructions: false,
|
|
145
|
+
target: 'vscode',
|
|
146
|
+
profile: undefined,
|
|
147
|
+
withWorkiq: false,
|
|
148
|
+
workiqPath: undefined,
|
|
149
|
+
skipWorkiqCheck: true,
|
|
150
|
+
});
|
|
151
|
+
} catch (err) {
|
|
152
|
+
console.error(` workspace install skipped: ${err.message}`);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
125
156
|
console.log('');
|
|
126
157
|
console.log(' ✅ wizard complete — next steps:');
|
|
127
158
|
console.log(' kushi doctor');
|
|
@@ -31,18 +31,20 @@ async function withEnv(envOverrides, fn) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
test('setup-wizard: env-driven cases (sequential to avoid env race)', async (t) => {
|
|
34
|
-
await t.test('case 1: env overrides resolve all
|
|
34
|
+
await t.test('case 1: env overrides resolve all four prompts', async () => {
|
|
35
35
|
const root = path.join(TESTTMP, `wizard-root-${Date.now()}-1`);
|
|
36
36
|
fs.mkdirSync(root, { recursive: true });
|
|
37
37
|
const result = await withEnv({
|
|
38
38
|
KUSHI_WIZARD_ROOT: root,
|
|
39
39
|
KUSHI_WIZARD_HOSTS: 'clawpilot',
|
|
40
40
|
KUSHI_WIZARD_GLOBAL: 'n',
|
|
41
|
+
KUSHI_WIZARD_WORKSPACE: 'n',
|
|
41
42
|
KUSHI_SKIP_INSTALL: '1',
|
|
42
43
|
}, () => runSetupWizard());
|
|
43
44
|
assert.equal(result.engagementRoot, root, 'root from env');
|
|
44
45
|
assert.equal(result.hosts, 'clawpilot', 'host from env');
|
|
45
46
|
assert.equal(result.globalWiki, false, 'global wiki off');
|
|
47
|
+
assert.equal(result.workspaceInstall, false, 'workspace off');
|
|
46
48
|
});
|
|
47
49
|
|
|
48
50
|
await t.test('case 2: "both" hosts retained in answers', async () => {
|
|
@@ -52,6 +54,7 @@ test('setup-wizard: env-driven cases (sequential to avoid env race)', async (t)
|
|
|
52
54
|
KUSHI_WIZARD_ROOT: root,
|
|
53
55
|
KUSHI_WIZARD_HOSTS: 'both',
|
|
54
56
|
KUSHI_WIZARD_GLOBAL: 'n',
|
|
57
|
+
KUSHI_WIZARD_WORKSPACE: 'n',
|
|
55
58
|
KUSHI_SKIP_INSTALL: '1',
|
|
56
59
|
}, () => runSetupWizard());
|
|
57
60
|
assert.equal(result.hosts, 'both');
|
|
@@ -64,6 +67,7 @@ test('setup-wizard: env-driven cases (sequential to avoid env race)', async (t)
|
|
|
64
67
|
KUSHI_WIZARD_ROOT: installRoot,
|
|
65
68
|
KUSHI_WIZARD_HOSTS: 'clawpilot',
|
|
66
69
|
KUSHI_WIZARD_GLOBAL: 'y',
|
|
70
|
+
KUSHI_WIZARD_WORKSPACE: 'n',
|
|
67
71
|
KUSHI_SKIP_INSTALL: '1',
|
|
68
72
|
KUSHI_INSTALL_ROOT: installRoot,
|
|
69
73
|
}, () => runSetupWizard());
|
|
@@ -71,4 +75,18 @@ test('setup-wizard: env-driven cases (sequential to avoid env race)', async (t)
|
|
|
71
75
|
assert.equal(result.globalWiki, true);
|
|
72
76
|
assert.equal(result.engagementRoot, installRoot);
|
|
73
77
|
});
|
|
78
|
+
|
|
79
|
+
await t.test('case 4: workspace scaffold opt-in records cwd', async () => {
|
|
80
|
+
const root = path.join(TESTTMP, `wizard-root-${Date.now()}-4`);
|
|
81
|
+
fs.mkdirSync(root, { recursive: true });
|
|
82
|
+
const result = await withEnv({
|
|
83
|
+
KUSHI_WIZARD_ROOT: root,
|
|
84
|
+
KUSHI_WIZARD_HOSTS: 'clawpilot',
|
|
85
|
+
KUSHI_WIZARD_GLOBAL: 'n',
|
|
86
|
+
KUSHI_WIZARD_WORKSPACE: 'y',
|
|
87
|
+
KUSHI_SKIP_INSTALL: '1',
|
|
88
|
+
}, () => runSetupWizard());
|
|
89
|
+
assert.equal(result.workspaceInstall, true, 'workspace install requested');
|
|
90
|
+
assert.equal(result.workspacePath, process.cwd(), 'workspace path = cwd');
|
|
91
|
+
});
|
|
74
92
|
});
|