@abarcenas/ai-workflow-template 1.39.0 → 1.40.0
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/bin/setup.js +3 -0
- package/package.json +3 -3
- package/scripts/setup/constants.js +1 -0
- package/scripts/setup/index.js +8 -0
- package/scripts/setup/index.test.js +43 -0
- package/scripts/setup/knowledgebase.js +2 -2
- package/scripts/setup/knowledgebase.test.js +5 -1
- package/scripts/setup/ui.js +9 -4
package/bin/setup.js
CHANGED
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
// 2 — Fatal error (discovery failure or unexpected exception)
|
|
14
14
|
// ═════════════════════════════════════════════════════════════════════════════
|
|
15
15
|
|
|
16
|
+
// Load consumer's .env into process.env before any phase runs
|
|
17
|
+
import 'dotenv/config'
|
|
18
|
+
|
|
16
19
|
try {
|
|
17
20
|
const { main } = await import('../scripts/setup/index.js')
|
|
18
21
|
const exitCode = await main(process.argv.slice(2))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abarcenas/ai-workflow-template",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.40.0",
|
|
4
4
|
"description": "A comprehensive template repository for AI-assisted development workflows using GitHub Copilot. This template provides a structured approach to leveraging AI assistance through pre-configured skills, prompts, agents, and coding standards.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@playwright/test": "^1.59.1",
|
|
59
59
|
"@vitest/coverage-v8": "^4.1.8",
|
|
60
|
-
"dotenv": "^17.4.2",
|
|
61
60
|
"husky": "^9.0.0",
|
|
62
61
|
"vitest": "^4.1.8"
|
|
63
62
|
},
|
|
64
63
|
"dependencies": {
|
|
65
64
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
66
65
|
"better-sqlite3": "^12.11.0",
|
|
67
|
-
"sqlite-vec": "^0.1.9"
|
|
66
|
+
"sqlite-vec": "^0.1.9",
|
|
67
|
+
"dotenv": "^17.4.2"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
70
|
"@xenova/transformers": "^2.17.0",
|
|
@@ -139,6 +139,7 @@ export const SUPPORTED_FLAGS = {
|
|
|
139
139
|
'--skip-prepare': 'skipPrepare',
|
|
140
140
|
'--skip-sync': 'skipSync',
|
|
141
141
|
'--skip-knowledgebase': 'skipKnowledgebase',
|
|
142
|
+
'--knowledgebase': 'knowledgebase',
|
|
142
143
|
'--help': 'help',
|
|
143
144
|
'-h': 'help',
|
|
144
145
|
'--version': 'version',
|
package/scripts/setup/index.js
CHANGED
|
@@ -141,6 +141,14 @@ export async function main(argv) {
|
|
|
141
141
|
return EXIT_CODES.SUCCESS
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
+
// When --knowledgebase is passed, run ONLY the knowledgebase phase
|
|
145
|
+
if (flags.knowledgebase) {
|
|
146
|
+
flags.skipHooks = true
|
|
147
|
+
flags.skipPrepare = true
|
|
148
|
+
flags.skipSync = true
|
|
149
|
+
flags.skipKnowledgebase = false
|
|
150
|
+
}
|
|
151
|
+
|
|
144
152
|
// ── 3. Display header banner ────────────────────────────────────────────
|
|
145
153
|
if (!flags.quiet) {
|
|
146
154
|
header()
|
|
@@ -116,6 +116,7 @@ const defaultFlags = {
|
|
|
116
116
|
skipPrepare: false,
|
|
117
117
|
skipSync: false,
|
|
118
118
|
skipKnowledgebase: false,
|
|
119
|
+
knowledgebase: false,
|
|
119
120
|
help: false,
|
|
120
121
|
version: false,
|
|
121
122
|
quiet: false,
|
|
@@ -549,6 +550,48 @@ describe('main() — setup orchestrator', () => {
|
|
|
549
550
|
expect(registerKnowledgebase).toHaveBeenCalledTimes(1)
|
|
550
551
|
})
|
|
551
552
|
|
|
553
|
+
// ── 16b. --knowledgebase flag (T6: run ONLY the knowledgebase phase) ─────
|
|
554
|
+
|
|
555
|
+
it('--knowledgebase: runs only discovery + knowledgebase phases, exits 0', async () => {
|
|
556
|
+
parseCliArgs.mockReturnValue({ ...defaultFlags, knowledgebase: true })
|
|
557
|
+
|
|
558
|
+
const code = await main(['--knowledgebase'])
|
|
559
|
+
|
|
560
|
+
expect(code).toBe(EXIT_CODES.SUCCESS)
|
|
561
|
+
expect(parseCliArgs).toHaveBeenCalledWith(['--knowledgebase'])
|
|
562
|
+
// Discovery always runs
|
|
563
|
+
expect(discover).toHaveBeenCalledTimes(1)
|
|
564
|
+
// All other phases are skipped by the --knowledgebase shortcut
|
|
565
|
+
expect(installHooks).not.toHaveBeenCalled()
|
|
566
|
+
expect(handlePrepare).not.toHaveBeenCalled()
|
|
567
|
+
expect(initHusky).not.toHaveBeenCalled()
|
|
568
|
+
expect(runSyncPhase).not.toHaveBeenCalled()
|
|
569
|
+
// Knowledgebase phase runs
|
|
570
|
+
expect(registerKnowledgebase).toHaveBeenCalledTimes(1)
|
|
571
|
+
// Header and summary shown (not quiet)
|
|
572
|
+
expect(header).toHaveBeenCalledTimes(1)
|
|
573
|
+
expect(summary).toHaveBeenCalledTimes(1)
|
|
574
|
+
})
|
|
575
|
+
|
|
576
|
+
it('--knowledgebase: still runs knowledgebase phase when skipKnowledgebase was also passed', async () => {
|
|
577
|
+
// --knowledgebase forces skipKnowledgebase back to false so the phase runs
|
|
578
|
+
parseCliArgs.mockReturnValue({
|
|
579
|
+
...defaultFlags,
|
|
580
|
+
knowledgebase: true,
|
|
581
|
+
skipKnowledgebase: true,
|
|
582
|
+
})
|
|
583
|
+
|
|
584
|
+
const code = await main(['--knowledgebase', '--skip-knowledgebase'])
|
|
585
|
+
|
|
586
|
+
expect(code).toBe(EXIT_CODES.SUCCESS)
|
|
587
|
+
expect(discover).toHaveBeenCalledTimes(1)
|
|
588
|
+
expect(installHooks).not.toHaveBeenCalled()
|
|
589
|
+
expect(handlePrepare).not.toHaveBeenCalled()
|
|
590
|
+
expect(initHusky).not.toHaveBeenCalled()
|
|
591
|
+
expect(runSyncPhase).not.toHaveBeenCalled()
|
|
592
|
+
expect(registerKnowledgebase).toHaveBeenCalledTimes(1)
|
|
593
|
+
})
|
|
594
|
+
|
|
552
595
|
// ── 17. Verify parseCliArgs receives the argv ───────────────────────────
|
|
553
596
|
|
|
554
597
|
it('passes argv array to parseCliArgs unchanged', async () => {
|
|
@@ -63,8 +63,8 @@ export async function registerKnowledgebase(context) {
|
|
|
63
63
|
// ── DATABASE_URL check ───────────────────────────────────────────────
|
|
64
64
|
if (!process.env.DATABASE_URL) {
|
|
65
65
|
const message =
|
|
66
|
-
'DATABASE_URL not configured. Set
|
|
67
|
-
'npx ai-workflow-template
|
|
66
|
+
'DATABASE_URL not configured. Set DATABASE_URL in your .env file, ' +
|
|
67
|
+
'then re-run: npx @abarcenas/ai-workflow-template --knowledgebase'
|
|
68
68
|
logWarn(
|
|
69
69
|
`[knowledgebase] Skipping Phase 6 \u2014 ${message}`,
|
|
70
70
|
)
|
|
@@ -161,8 +161,12 @@ describe('registerKnowledgebase', () => {
|
|
|
161
161
|
|
|
162
162
|
expect(result).toEqual({
|
|
163
163
|
action: 'skipped',
|
|
164
|
-
message: expect.stringContaining('DATABASE_URL'),
|
|
164
|
+
message: expect.stringContaining('DATABASE_URL not configured'),
|
|
165
165
|
})
|
|
166
|
+
// The warning must guide the consumer to set DATABASE_URL and re-run
|
|
167
|
+
// with the scoped package name and the --knowledgebase flag.
|
|
168
|
+
expect(result.message).toContain('@abarcenas/ai-workflow-template')
|
|
169
|
+
expect(result.message).toContain('--knowledgebase')
|
|
166
170
|
expect(spawn).not.toHaveBeenCalled()
|
|
167
171
|
})
|
|
168
172
|
|
package/scripts/setup/ui.js
CHANGED
|
@@ -422,6 +422,8 @@ export function help() {
|
|
|
422
422
|
skipHooks: 'Skip git hook installation phase',
|
|
423
423
|
skipPrepare: 'Skip prepare script modification phase',
|
|
424
424
|
skipSync: 'Skip file sync phase',
|
|
425
|
+
skipKnowledgebase: 'Skip knowledgebase registration phase',
|
|
426
|
+
knowledgebase: 'Run ONLY the knowledgebase registration phase',
|
|
425
427
|
help: 'Show this help message and exit',
|
|
426
428
|
version: 'Show the version number and exit',
|
|
427
429
|
quiet: 'Suppress non-error output (quiet mode)',
|
|
@@ -435,6 +437,8 @@ export function help() {
|
|
|
435
437
|
'skipHooks',
|
|
436
438
|
'skipPrepare',
|
|
437
439
|
'skipSync',
|
|
440
|
+
'skipKnowledgebase',
|
|
441
|
+
'knowledgebase',
|
|
438
442
|
'help',
|
|
439
443
|
'version',
|
|
440
444
|
'quiet',
|
|
@@ -446,7 +450,7 @@ export function help() {
|
|
|
446
450
|
write(`${BLD}${PACKAGE_NAME}${RST} ${GRN}v${version}${RST}`)
|
|
447
451
|
write()
|
|
448
452
|
write(` ${BLD}Usage:${RST}`)
|
|
449
|
-
write(` npx ${PACKAGE_NAME}
|
|
453
|
+
write(` npx ${PACKAGE_NAME} [options]`)
|
|
450
454
|
write(` ${BIN_NAME} [options]`)
|
|
451
455
|
write()
|
|
452
456
|
write(` ${BLD}Description:${RST}`)
|
|
@@ -468,9 +472,10 @@ export function help() {
|
|
|
468
472
|
|
|
469
473
|
write()
|
|
470
474
|
write(` ${BLD}Examples:${RST}`)
|
|
471
|
-
write(` npx ${PACKAGE_NAME}
|
|
472
|
-
write(` npx ${PACKAGE_NAME}
|
|
473
|
-
write(` npx ${PACKAGE_NAME}
|
|
475
|
+
write(` npx ${PACKAGE_NAME}`)
|
|
476
|
+
write(` npx ${PACKAGE_NAME} --dry-run --verbose`)
|
|
477
|
+
write(` npx ${PACKAGE_NAME} --knowledgebase`)
|
|
478
|
+
write(` npx ${PACKAGE_NAME} --force --skip-hooks`)
|
|
474
479
|
write(` ${BIN_NAME} --help`)
|
|
475
480
|
write()
|
|
476
481
|
}
|