javi-forge 1.6.0 → 1.7.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/README.md +45 -1
- package/ci-local/README.md +56 -11
- package/ci-local/ci-local.ps1 +445 -0
- package/ci-local/ci-local.sh +52 -9
- package/ci-local/docker/python.Dockerfile +7 -0
- package/ci-local/hooks/commit-msg +120 -44
- package/ci-local/hooks/commit-msg.test.sh +286 -0
- package/ci-local/hooks/pre-commit +9 -1
- package/ci-local/hooks/pre-push +13 -2
- package/ci-local/install.ps1 +367 -0
- package/ci-local/install.sh +151 -5
- package/ci-local/uninstall.ps1 +85 -0
- package/ci-local/uninstall.sh +95 -0
- package/dist/cli/dispatch/ci.d.ts +12 -0
- package/dist/cli/dispatch/ci.js +38 -0
- package/dist/cli/dispatch/security.d.ts +11 -0
- package/dist/cli/dispatch/security.js +68 -0
- package/dist/cli/dispatch/simple-renderers.d.ts +16 -0
- package/dist/cli/dispatch/simple-renderers.js +65 -0
- package/dist/cli/dispatch/skill-publish.d.ts +15 -0
- package/dist/cli/dispatch/skill-publish.js +44 -0
- package/dist/cli/dispatch/skills-cmd.d.ts +13 -0
- package/dist/cli/dispatch/skills-cmd.js +93 -0
- package/dist/cli/dispatch/tdd.d.ts +11 -0
- package/dist/cli/dispatch/tdd.js +45 -0
- package/dist/cli/dispatch/types.d.ts +29 -0
- package/dist/cli/dispatch/types.js +2 -0
- package/dist/cli/dispatch/workflow.d.ts +11 -0
- package/dist/cli/dispatch/workflow.js +67 -0
- package/dist/cli/help.d.ts +127 -0
- package/dist/cli/help.js +138 -0
- package/dist/cli/runtime.d.ts +16 -0
- package/dist/cli/runtime.js +38 -0
- package/dist/cli/validators.d.ts +17 -0
- package/dist/cli/validators.js +35 -0
- package/dist/commands/analyze.d.ts +1 -1
- package/dist/commands/analyze.js +14 -16
- package/dist/commands/ci.d.ts +50 -3
- package/dist/commands/ci.js +537 -182
- package/dist/commands/doctor.d.ts +2 -2
- package/dist/commands/doctor.js +112 -62
- package/dist/commands/init/report.d.ts +13 -0
- package/dist/commands/init/report.js +13 -0
- package/dist/commands/init/steps/agent-skills.d.ts +13 -0
- package/dist/commands/init/steps/agent-skills.js +45 -0
- package/dist/commands/init/steps/ai-sync.d.ts +15 -0
- package/dist/commands/init/steps/ai-sync.js +62 -0
- package/dist/commands/init/steps/ci.d.ts +24 -0
- package/dist/commands/init/steps/ci.js +74 -0
- package/dist/commands/init/steps/claude-md.d.ts +14 -0
- package/dist/commands/init/steps/claude-md.js +54 -0
- package/dist/commands/init/steps/code-graph.d.ts +16 -0
- package/dist/commands/init/steps/code-graph.js +68 -0
- package/dist/commands/init/steps/context-dir.d.ts +13 -0
- package/dist/commands/init/steps/context-dir.js +47 -0
- package/dist/commands/init/steps/docker-deploy.d.ts +16 -0
- package/dist/commands/init/steps/docker-deploy.js +60 -0
- package/dist/commands/init/steps/ghagga.d.ts +15 -0
- package/dist/commands/init/steps/ghagga.js +58 -0
- package/dist/commands/init/steps/git.d.ts +25 -0
- package/dist/commands/init/steps/git.js +81 -0
- package/dist/commands/init/steps/gitignore.d.ts +13 -0
- package/dist/commands/init/steps/gitignore.js +39 -0
- package/dist/commands/init/steps/local-ai.d.ts +14 -0
- package/dist/commands/init/steps/local-ai.js +53 -0
- package/dist/commands/init/steps/manifest.d.ts +13 -0
- package/dist/commands/init/steps/manifest.js +58 -0
- package/dist/commands/init/steps/memory.d.ts +15 -0
- package/dist/commands/init/steps/memory.js +60 -0
- package/dist/commands/init/steps/mock.d.ts +13 -0
- package/dist/commands/init/steps/mock.js +64 -0
- package/dist/commands/init/steps/sdd.d.ts +12 -0
- package/dist/commands/init/steps/sdd.js +40 -0
- package/dist/commands/init/steps/security.d.ts +28 -0
- package/dist/commands/init/steps/security.js +103 -0
- package/dist/commands/init/types.d.ts +30 -0
- package/dist/commands/init/types.js +2 -0
- package/dist/commands/init.d.ts +5 -4
- package/dist/commands/init.js +42 -387
- package/dist/commands/llmstxt.d.ts +1 -1
- package/dist/commands/llmstxt.js +36 -34
- package/dist/commands/plugin.d.ts +10 -1
- package/dist/commands/plugin.js +92 -47
- package/dist/commands/security.d.ts +11 -5
- package/dist/commands/security.js +236 -77
- package/dist/commands/skills/analysis.d.ts +19 -0
- package/dist/commands/skills/analysis.js +211 -0
- package/dist/commands/skills/benchmark.d.ts +6 -0
- package/dist/commands/skills/benchmark.js +82 -0
- package/dist/commands/skills/constants.d.ts +10 -0
- package/dist/commands/skills/constants.js +27 -0
- package/dist/commands/skills/directives.d.ts +21 -0
- package/dist/commands/skills/directives.js +101 -0
- package/dist/commands/skills/parsing.d.ts +16 -0
- package/dist/commands/skills/parsing.js +108 -0
- package/dist/commands/skills/rules.d.ts +5 -0
- package/dist/commands/skills/rules.js +32 -0
- package/dist/commands/skills/scoring.d.ts +47 -0
- package/dist/commands/skills/scoring.js +306 -0
- package/dist/commands/skills.d.ts +8 -69
- package/dist/commands/skills.js +9 -490
- package/dist/commands/tdd-pipeline.d.ts +17 -0
- package/dist/commands/tdd-pipeline.js +144 -0
- package/dist/commands/tdd.d.ts +1 -1
- package/dist/commands/tdd.js +21 -18
- package/dist/commands/workflow.d.ts +23 -0
- package/dist/commands/workflow.js +116 -0
- package/dist/constants.d.ts +15 -1
- package/dist/constants.js +161 -122
- package/dist/index.js +43 -280
- package/dist/lib/agent-skills.d.ts +36 -1
- package/dist/lib/agent-skills.js +168 -19
- package/dist/lib/atlassian-mcp.d.ts +42 -0
- package/dist/lib/atlassian-mcp.js +98 -0
- package/dist/lib/auto-skill-install.d.ts +37 -0
- package/dist/lib/auto-skill-install.js +91 -0
- package/dist/lib/auto-wire.d.ts +20 -0
- package/dist/lib/auto-wire.js +240 -0
- package/dist/lib/ci-config.d.ts +65 -0
- package/dist/lib/ci-config.js +297 -0
- package/dist/lib/claudemd.d.ts +13 -1
- package/dist/lib/claudemd.js +174 -24
- package/dist/lib/codex-export.d.ts +1 -1
- package/dist/lib/codex-export.js +26 -32
- package/dist/lib/common.d.ts +1 -1
- package/dist/lib/common.js +52 -44
- package/dist/lib/context.d.ts +17 -2
- package/dist/lib/context.js +142 -13
- package/dist/lib/crash-recovery.d.ts +34 -0
- package/dist/lib/crash-recovery.js +123 -0
- package/dist/lib/docker.d.ts +23 -2
- package/dist/lib/docker.js +168 -131
- package/dist/lib/exec.d.ts +10 -0
- package/dist/lib/exec.js +11 -0
- package/dist/lib/frontmatter.d.ts +1 -1
- package/dist/lib/frontmatter.js +29 -15
- package/dist/lib/harness-audit.d.ts +35 -0
- package/dist/lib/harness-audit.js +277 -0
- package/dist/lib/parallel-batch.d.ts +42 -0
- package/dist/lib/parallel-batch.js +88 -0
- package/dist/lib/plugin.d.ts +9 -3
- package/dist/lib/plugin.js +127 -70
- package/dist/lib/secret-scanner.d.ts +30 -0
- package/dist/lib/secret-scanner.js +274 -0
- package/dist/lib/security-analysis.d.ts +74 -0
- package/dist/lib/security-analysis.js +489 -0
- package/dist/lib/skill-publish.d.ts +40 -0
- package/dist/lib/skill-publish.js +164 -0
- package/dist/lib/skill-scanner.d.ts +63 -0
- package/dist/lib/skill-scanner.js +383 -0
- package/dist/lib/stack-detector.d.ts +38 -0
- package/dist/lib/stack-detector.js +207 -0
- package/dist/lib/supply-chain.d.ts +23 -0
- package/dist/lib/supply-chain.js +126 -0
- package/dist/lib/team-presets.d.ts +53 -0
- package/dist/lib/team-presets.js +201 -0
- package/dist/lib/template.d.ts +16 -1
- package/dist/lib/template.js +46 -17
- package/dist/lib/workflow/discovery.d.ts +27 -0
- package/dist/lib/workflow/discovery.js +85 -0
- package/dist/lib/workflow/index.d.ts +5 -0
- package/dist/lib/workflow/index.js +5 -0
- package/dist/lib/workflow/parser.d.ts +16 -0
- package/dist/lib/workflow/parser.js +198 -0
- package/dist/lib/workflow/renderer.d.ts +9 -0
- package/dist/lib/workflow/renderer.js +152 -0
- package/dist/lib/workflow/validator.d.ts +10 -0
- package/dist/lib/workflow/validator.js +189 -0
- package/dist/tasks/index.d.ts +4 -0
- package/dist/tasks/index.js +4 -0
- package/dist/tasks/scaffold-tasks.d.ts +3 -0
- package/dist/tasks/scaffold-tasks.js +14 -0
- package/dist/tasks/task-id.d.ts +30 -0
- package/dist/tasks/task-id.js +59 -0
- package/dist/tasks/task-tracker.d.ts +15 -0
- package/dist/tasks/task-tracker.js +81 -0
- package/dist/types/index.d.ts +134 -6
- package/dist/types/index.js +11 -1
- package/dist/ui/AnalyzeUI.d.ts +1 -1
- package/dist/ui/AnalyzeUI.js +38 -39
- package/dist/ui/App.d.ts +5 -3
- package/dist/ui/App.js +86 -46
- package/dist/ui/AutoSkills.d.ts +9 -0
- package/dist/ui/AutoSkills.js +124 -0
- package/dist/ui/CI.d.ts +2 -2
- package/dist/ui/CI.js +24 -26
- package/dist/ui/CIContext.d.ts +1 -1
- package/dist/ui/CIContext.js +2 -2
- package/dist/ui/CISelector.d.ts +2 -2
- package/dist/ui/CISelector.js +23 -15
- package/dist/ui/Doctor.d.ts +1 -1
- package/dist/ui/Doctor.js +35 -29
- package/dist/ui/Header.d.ts +1 -1
- package/dist/ui/Header.js +14 -14
- package/dist/ui/HookProfileSelector.d.ts +9 -0
- package/dist/ui/HookProfileSelector.js +54 -0
- package/dist/ui/LlmsTxt.d.ts +1 -1
- package/dist/ui/LlmsTxt.js +31 -22
- package/dist/ui/MemorySelector.d.ts +2 -2
- package/dist/ui/MemorySelector.js +28 -16
- package/dist/ui/NameInput.d.ts +1 -1
- package/dist/ui/NameInput.js +21 -21
- package/dist/ui/OptionSelector.d.ts +6 -2
- package/dist/ui/OptionSelector.js +83 -32
- package/dist/ui/Plugin.d.ts +4 -3
- package/dist/ui/Plugin.js +78 -35
- package/dist/ui/Progress.d.ts +3 -3
- package/dist/ui/Progress.js +23 -22
- package/dist/ui/Skills.d.ts +2 -2
- package/dist/ui/Skills.js +61 -32
- package/dist/ui/StackSelector.d.ts +2 -2
- package/dist/ui/StackSelector.js +27 -17
- package/dist/ui/Summary.d.ts +3 -3
- package/dist/ui/Summary.js +60 -50
- package/dist/ui/Welcome.d.ts +1 -1
- package/dist/ui/Welcome.js +15 -16
- package/dist/ui/theme.d.ts +1 -1
- package/dist/ui/theme.js +6 -6
- package/lib/common.psm1 +167 -0
- package/lib/common.sh +30 -0
- package/package.json +46 -24
- package/templates/common/atlassian/mcp-atlassian-snippet.json +16 -0
- package/templates/common/repoforge/mcp-repoforge-snippet.json +11 -0
- package/templates/common/repoforge/repoforge.yaml +34 -0
- package/templates/github/deploy-docker-zero-downtime.yml +140 -0
- package/templates/github/repoforge-graph.yml +45 -0
- package/templates/gitlab/deploy-docker-zero-downtime.yml +57 -0
- package/templates/local-ai/.env.example +17 -0
- package/templates/local-ai/docker-compose.yml +95 -0
- package/templates/security-hooks/claude-settings-security.json +30 -0
- package/templates/security-hooks/commit-msg-signing +29 -0
- package/templates/security-hooks/pre-commit-permissions +74 -0
- package/templates/security-hooks/pre-commit-secrets +74 -0
- package/templates/security-hooks/pre-push-branch-protection +62 -0
- package/templates/security-hooks/pre-push-deps +83 -0
- package/templates/security-hooks/pre-push-signing +67 -0
- package/templates/woodpecker/deploy-docker-zero-downtime.yml +50 -0
- package/templates/workflows/ci-pipeline.dot +15 -0
- package/templates/workflows/feature-flow.dot +21 -0
- package/templates/workflows/release.dot +16 -0
- package/dist/__integration__/helpers.d.ts +0 -20
- package/dist/__integration__/helpers.d.ts.map +0 -1
- package/dist/__integration__/helpers.js +0 -31
- package/dist/__integration__/helpers.js.map +0 -1
- package/dist/commands/analyze.d.ts.map +0 -1
- package/dist/commands/analyze.js.map +0 -1
- package/dist/commands/ci.d.ts.map +0 -1
- package/dist/commands/ci.js.map +0 -1
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/llmstxt.d.ts.map +0 -1
- package/dist/commands/llmstxt.js.map +0 -1
- package/dist/commands/plugin.d.ts.map +0 -1
- package/dist/commands/plugin.js.map +0 -1
- package/dist/commands/security.d.ts.map +0 -1
- package/dist/commands/security.js.map +0 -1
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/tdd.d.ts.map +0 -1
- package/dist/commands/tdd.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/agent-skills.d.ts.map +0 -1
- package/dist/lib/agent-skills.js.map +0 -1
- package/dist/lib/claudemd.d.ts.map +0 -1
- package/dist/lib/claudemd.js.map +0 -1
- package/dist/lib/codex-export.d.ts.map +0 -1
- package/dist/lib/codex-export.js.map +0 -1
- package/dist/lib/common.d.ts.map +0 -1
- package/dist/lib/common.js.map +0 -1
- package/dist/lib/context.d.ts.map +0 -1
- package/dist/lib/context.js.map +0 -1
- package/dist/lib/docker.d.ts.map +0 -1
- package/dist/lib/docker.js.map +0 -1
- package/dist/lib/frontmatter.d.ts.map +0 -1
- package/dist/lib/frontmatter.js.map +0 -1
- package/dist/lib/plugin.d.ts.map +0 -1
- package/dist/lib/plugin.js.map +0 -1
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js.map +0 -1
- package/dist/ui/AnalyzeUI.d.ts.map +0 -1
- package/dist/ui/AnalyzeUI.js.map +0 -1
- package/dist/ui/App.d.ts.map +0 -1
- package/dist/ui/App.js.map +0 -1
- package/dist/ui/CI.d.ts.map +0 -1
- package/dist/ui/CI.js.map +0 -1
- package/dist/ui/CIContext.d.ts.map +0 -1
- package/dist/ui/CIContext.js.map +0 -1
- package/dist/ui/CISelector.d.ts.map +0 -1
- package/dist/ui/CISelector.js.map +0 -1
- package/dist/ui/Doctor.d.ts.map +0 -1
- package/dist/ui/Doctor.js.map +0 -1
- package/dist/ui/Header.d.ts.map +0 -1
- package/dist/ui/Header.js.map +0 -1
- package/dist/ui/LlmsTxt.d.ts.map +0 -1
- package/dist/ui/LlmsTxt.js.map +0 -1
- package/dist/ui/MemorySelector.d.ts.map +0 -1
- package/dist/ui/MemorySelector.js.map +0 -1
- package/dist/ui/NameInput.d.ts.map +0 -1
- package/dist/ui/NameInput.js.map +0 -1
- package/dist/ui/OptionSelector.d.ts.map +0 -1
- package/dist/ui/OptionSelector.js.map +0 -1
- package/dist/ui/Plugin.d.ts.map +0 -1
- package/dist/ui/Plugin.js.map +0 -1
- package/dist/ui/Progress.d.ts.map +0 -1
- package/dist/ui/Progress.js.map +0 -1
- package/dist/ui/Skills.d.ts.map +0 -1
- package/dist/ui/Skills.js.map +0 -1
- package/dist/ui/StackSelector.d.ts.map +0 -1
- package/dist/ui/StackSelector.js.map +0 -1
- package/dist/ui/Summary.d.ts.map +0 -1
- package/dist/ui/Summary.js.map +0 -1
- package/dist/ui/Welcome.d.ts.map +0 -1
- package/dist/ui/Welcome.js.map +0 -1
- package/dist/ui/theme.d.ts.map +0 -1
- package/dist/ui/theme.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { MODULES_DIR } from "../../../constants.js";
|
|
4
|
+
import { ensureDirExists } from "../../../lib/common.js";
|
|
5
|
+
import { report } from "../report.js";
|
|
6
|
+
/**
|
|
7
|
+
* Step 6: Install memory module.
|
|
8
|
+
*
|
|
9
|
+
* - If memory === "none", reports "skipped".
|
|
10
|
+
* - Otherwise copies <MODULES_DIR>/<memory>/ → <project>/.javi-forge/modules/<memory>/.
|
|
11
|
+
* - For engram specifically, copies .mcp-config-snippet.json to project root
|
|
12
|
+
* replacing __PROJECT_NAME__ placeholders.
|
|
13
|
+
* - If the module source dir is missing, reports "error" with "module not found".
|
|
14
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
15
|
+
*
|
|
16
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 2 of 6).
|
|
17
|
+
*/
|
|
18
|
+
export const stepMemory = async (ctx) => {
|
|
19
|
+
const { projectDir, dryRun, onStep, options } = ctx;
|
|
20
|
+
const { memory, projectName } = options;
|
|
21
|
+
const stepId = "memory";
|
|
22
|
+
report(onStep, stepId, `Install memory module: ${memory}`, "running");
|
|
23
|
+
try {
|
|
24
|
+
if (memory !== "none") {
|
|
25
|
+
const moduleSrc = path.join(MODULES_DIR, memory);
|
|
26
|
+
if (await fs.pathExists(moduleSrc)) {
|
|
27
|
+
if (!dryRun) {
|
|
28
|
+
// Copy module files to project
|
|
29
|
+
const moduleDest = path.join(projectDir, ".javi-forge", "modules", memory);
|
|
30
|
+
await ensureDirExists(moduleDest);
|
|
31
|
+
await fs.copy(moduleSrc, moduleDest, {
|
|
32
|
+
overwrite: false,
|
|
33
|
+
errorOnExist: false,
|
|
34
|
+
});
|
|
35
|
+
// If engram, copy .mcp-config-snippet.json to project with placeholder replacement
|
|
36
|
+
if (memory === "engram") {
|
|
37
|
+
const snippetSrc = path.join(moduleSrc, ".mcp-config-snippet.json");
|
|
38
|
+
if (await fs.pathExists(snippetSrc)) {
|
|
39
|
+
const snippetDest = path.join(projectDir, ".mcp-config-snippet.json");
|
|
40
|
+
let content = await fs.readFile(snippetSrc, "utf-8");
|
|
41
|
+
content = content.replace(/__PROJECT_NAME__/g, projectName);
|
|
42
|
+
await fs.writeFile(snippetDest, content, "utf-8");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
report(onStep, stepId, `Install memory module: ${memory}`, "done");
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
report(onStep, stepId, `Install memory module: ${memory}`, "error", "module not found");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
report(onStep, stepId, `Install memory module: ${memory}`, "skipped", "none selected");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
report(onStep, stepId, `Install memory module: ${memory}`, "error", String(e));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=memory.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StepFn } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Step 10: Configure mock-first mode.
|
|
4
|
+
*
|
|
5
|
+
* - When options.mock is false, reports "skipped".
|
|
6
|
+
* - Otherwise writes .env.example (and .env from it) with mock values, only if
|
|
7
|
+
* the targets do not already exist.
|
|
8
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
9
|
+
*
|
|
10
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 3 of 6).
|
|
11
|
+
*/
|
|
12
|
+
export declare const stepMock: StepFn;
|
|
13
|
+
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { report } from "../report.js";
|
|
4
|
+
// Mock environment template — written verbatim to .env.example and .env
|
|
5
|
+
// when mock-first mode is enabled. Preserved byte-for-byte from init.ts baseline.
|
|
6
|
+
const envExample = `# Mock environment — no real API keys required
|
|
7
|
+
# Copy to .env to use: cp .env.example .env
|
|
8
|
+
|
|
9
|
+
# Database
|
|
10
|
+
DATABASE_URL=postgresql://mock:mock@localhost:5432/mock_db
|
|
11
|
+
|
|
12
|
+
# Auth
|
|
13
|
+
JWT_SECRET=mock-jwt-secret-for-local-development
|
|
14
|
+
SESSION_SECRET=mock-session-secret
|
|
15
|
+
|
|
16
|
+
# External APIs (mock mode — no real calls)
|
|
17
|
+
MOCK_MODE=true
|
|
18
|
+
API_KEY=mock-api-key-not-real
|
|
19
|
+
STRIPE_KEY=sk_test_mock_not_real
|
|
20
|
+
SENDGRID_KEY=SG.mock_not_real
|
|
21
|
+
|
|
22
|
+
# Feature flags
|
|
23
|
+
ENABLE_ANALYTICS=false
|
|
24
|
+
ENABLE_EMAILS=false
|
|
25
|
+
ENABLE_WEBHOOKS=false
|
|
26
|
+
`;
|
|
27
|
+
/**
|
|
28
|
+
* Step 10: Configure mock-first mode.
|
|
29
|
+
*
|
|
30
|
+
* - When options.mock is false, reports "skipped".
|
|
31
|
+
* - Otherwise writes .env.example (and .env from it) with mock values, only if
|
|
32
|
+
* the targets do not already exist.
|
|
33
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
34
|
+
*
|
|
35
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 3 of 6).
|
|
36
|
+
*/
|
|
37
|
+
export const stepMock = async (ctx) => {
|
|
38
|
+
const { projectDir, dryRun, onStep, options } = ctx;
|
|
39
|
+
const stepId = "mock";
|
|
40
|
+
if (options.mock) {
|
|
41
|
+
report(onStep, stepId, "Configure mock-first mode", "running");
|
|
42
|
+
try {
|
|
43
|
+
if (!dryRun) {
|
|
44
|
+
const envExamplePath = path.join(projectDir, ".env.example");
|
|
45
|
+
if (!(await fs.pathExists(envExamplePath))) {
|
|
46
|
+
await fs.writeFile(envExamplePath, envExample, "utf-8");
|
|
47
|
+
}
|
|
48
|
+
// Create .env from example
|
|
49
|
+
const envPath = path.join(projectDir, ".env");
|
|
50
|
+
if (!(await fs.pathExists(envPath))) {
|
|
51
|
+
await fs.writeFile(envPath, envExample, "utf-8");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
report(onStep, stepId, "Configure mock-first mode", "done", ".env.example + .env with mock values");
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
report(onStep, stepId, "Configure mock-first mode", "error", String(e));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
report(onStep, stepId, "Configure mock-first mode", "skipped", "not selected");
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=mock.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { StepFn } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Step 8: Set up SDD (openspec/) scaffolding.
|
|
4
|
+
*
|
|
5
|
+
* - When sdd is false, reports "skipped".
|
|
6
|
+
* - Otherwise ensures openspec/ exists and writes a default README.md if absent.
|
|
7
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
8
|
+
*
|
|
9
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 3 of 6).
|
|
10
|
+
*/
|
|
11
|
+
export declare const stepSDD: StepFn;
|
|
12
|
+
//# sourceMappingURL=sdd.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { ensureDirExists } from "../../../lib/common.js";
|
|
4
|
+
import { report } from "../report.js";
|
|
5
|
+
/**
|
|
6
|
+
* Step 8: Set up SDD (openspec/) scaffolding.
|
|
7
|
+
*
|
|
8
|
+
* - When sdd is false, reports "skipped".
|
|
9
|
+
* - Otherwise ensures openspec/ exists and writes a default README.md if absent.
|
|
10
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
11
|
+
*
|
|
12
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 3 of 6).
|
|
13
|
+
*/
|
|
14
|
+
export const stepSDD = async (ctx) => {
|
|
15
|
+
const { projectDir, dryRun, onStep, options } = ctx;
|
|
16
|
+
const { sdd, projectName } = options;
|
|
17
|
+
const stepId = "sdd";
|
|
18
|
+
report(onStep, stepId, "Set up SDD (openspec/)", "running");
|
|
19
|
+
try {
|
|
20
|
+
if (sdd) {
|
|
21
|
+
if (!dryRun) {
|
|
22
|
+
const openspecDir = path.join(projectDir, "openspec");
|
|
23
|
+
await ensureDirExists(openspecDir);
|
|
24
|
+
// Create a README if none exists
|
|
25
|
+
const readmePath = path.join(openspecDir, "README.md");
|
|
26
|
+
if (!(await fs.pathExists(readmePath))) {
|
|
27
|
+
await fs.writeFile(readmePath, `# openspec/\n\nSpec-Driven Development artifacts for ${projectName}.\n\nSee: /sdd:new <name> to start a new change.\n`, "utf-8");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
report(onStep, stepId, "Set up SDD (openspec/)", "done");
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
report(onStep, stepId, "Set up SDD (openspec/)", "skipped", "not selected");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
report(onStep, stepId, "Set up SDD (openspec/)", "error", String(e));
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=sdd.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StepFn } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Step 14: Scaffold security hooks.
|
|
4
|
+
*
|
|
5
|
+
* - When options.securityHooks is false, reports "skipped".
|
|
6
|
+
* - When SECURITY_HOOKS_DIR templates are missing, reports "error".
|
|
7
|
+
* - Otherwise copies the 6-layer git security hooks into
|
|
8
|
+
* ci-local/hooks/security/ (skipping existing files, chmod 0755) and copies
|
|
9
|
+
* the kiteguard-style runtime settings to .claude/settings.json when absent.
|
|
10
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
11
|
+
*
|
|
12
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 5 of 6).
|
|
13
|
+
* Grouped with stepHookProfile for cohesion — both manage ci-local/hooks/.
|
|
14
|
+
*/
|
|
15
|
+
export declare const stepSecurityHooks: StepFn;
|
|
16
|
+
/**
|
|
17
|
+
* Step 14b: Write hook reliability profile.
|
|
18
|
+
*
|
|
19
|
+
* - When options.securityHooks is false, reports "skipped".
|
|
20
|
+
* - Otherwise writes ci-local/hooks/profile.json with the resolved profile
|
|
21
|
+
* (defaults to "standard" when hookProfile is undefined).
|
|
22
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
23
|
+
*
|
|
24
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 5 of 6).
|
|
25
|
+
* Grouped with stepSecurityHooks for cohesion — both manage ci-local/hooks/.
|
|
26
|
+
*/
|
|
27
|
+
export declare const stepHookProfile: StepFn;
|
|
28
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import { SECURITY_HOOKS_DIR } from "../../../constants.js";
|
|
4
|
+
import { ensureDirExists } from "../../../lib/common.js";
|
|
5
|
+
import { report } from "../report.js";
|
|
6
|
+
/**
|
|
7
|
+
* Step 14: Scaffold security hooks.
|
|
8
|
+
*
|
|
9
|
+
* - When options.securityHooks is false, reports "skipped".
|
|
10
|
+
* - When SECURITY_HOOKS_DIR templates are missing, reports "error".
|
|
11
|
+
* - Otherwise copies the 6-layer git security hooks into
|
|
12
|
+
* ci-local/hooks/security/ (skipping existing files, chmod 0755) and copies
|
|
13
|
+
* the kiteguard-style runtime settings to .claude/settings.json when absent.
|
|
14
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
15
|
+
*
|
|
16
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 5 of 6).
|
|
17
|
+
* Grouped with stepHookProfile for cohesion — both manage ci-local/hooks/.
|
|
18
|
+
*/
|
|
19
|
+
export const stepSecurityHooks = async (ctx) => {
|
|
20
|
+
const { projectDir, dryRun, onStep, options } = ctx;
|
|
21
|
+
const { securityHooks } = options;
|
|
22
|
+
const stepId = "security-hooks";
|
|
23
|
+
report(onStep, stepId, "Scaffold security hooks", "running");
|
|
24
|
+
try {
|
|
25
|
+
if (securityHooks) {
|
|
26
|
+
if (await fs.pathExists(SECURITY_HOOKS_DIR)) {
|
|
27
|
+
if (!dryRun) {
|
|
28
|
+
// Copy 6-layer git security hooks into ci-local/hooks/security/
|
|
29
|
+
const secHooksDest = path.join(projectDir, "ci-local", "hooks", "security");
|
|
30
|
+
await ensureDirExists(secHooksDest);
|
|
31
|
+
const hookFiles = await fs.readdir(SECURITY_HOOKS_DIR);
|
|
32
|
+
const gitHooks = hookFiles.filter((f) => !f.endsWith(".json"));
|
|
33
|
+
for (const hook of gitHooks) {
|
|
34
|
+
const src = path.join(SECURITY_HOOKS_DIR, hook);
|
|
35
|
+
const dest = path.join(secHooksDest, hook);
|
|
36
|
+
await fs.copy(src, dest, { overwrite: false });
|
|
37
|
+
await fs.chmod(dest, 0o755);
|
|
38
|
+
}
|
|
39
|
+
// Copy runtime security settings (kiteguard-style) to .claude/
|
|
40
|
+
const settingsSrc = path.join(SECURITY_HOOKS_DIR, "claude-settings-security.json");
|
|
41
|
+
if (await fs.pathExists(settingsSrc)) {
|
|
42
|
+
const claudeDir = path.join(projectDir, ".claude");
|
|
43
|
+
await ensureDirExists(claudeDir);
|
|
44
|
+
const settingsDest = path.join(claudeDir, "settings.json");
|
|
45
|
+
if (!(await fs.pathExists(settingsDest))) {
|
|
46
|
+
await fs.copy(settingsSrc, settingsDest);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
report(onStep, stepId, "Scaffold security hooks", "done", dryRun
|
|
51
|
+
? "dry-run: would scaffold security hooks"
|
|
52
|
+
: "6 git layers + runtime hooks");
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
report(onStep, stepId, "Scaffold security hooks", "error", "security-hooks templates not found");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
report(onStep, stepId, "Scaffold security hooks", "skipped", "not selected");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
report(onStep, stepId, "Scaffold security hooks", "error", String(e));
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Step 14b: Write hook reliability profile.
|
|
68
|
+
*
|
|
69
|
+
* - When options.securityHooks is false, reports "skipped".
|
|
70
|
+
* - Otherwise writes ci-local/hooks/profile.json with the resolved profile
|
|
71
|
+
* (defaults to "standard" when hookProfile is undefined).
|
|
72
|
+
* - Errors are swallowed and reported as status:"error" — never thrown.
|
|
73
|
+
*
|
|
74
|
+
* Extracted VERBATIM from src/commands/init.ts (PR 5 of 6).
|
|
75
|
+
* Grouped with stepSecurityHooks for cohesion — both manage ci-local/hooks/.
|
|
76
|
+
*/
|
|
77
|
+
export const stepHookProfile = async (ctx) => {
|
|
78
|
+
const { projectDir, dryRun, onStep, options } = ctx;
|
|
79
|
+
const { securityHooks, hookProfile } = options;
|
|
80
|
+
const stepId = "hook-profile";
|
|
81
|
+
report(onStep, stepId, "Write hook reliability profile", "running");
|
|
82
|
+
try {
|
|
83
|
+
if (securityHooks) {
|
|
84
|
+
if (!dryRun) {
|
|
85
|
+
const hooksDir = path.join(projectDir, "ci-local", "hooks");
|
|
86
|
+
await ensureDirExists(hooksDir);
|
|
87
|
+
const profilePath = path.join(hooksDir, "profile.json");
|
|
88
|
+
const resolvedProfile = hookProfile ?? "standard";
|
|
89
|
+
await fs.writeJson(profilePath, { profile: resolvedProfile }, { spaces: 2 });
|
|
90
|
+
}
|
|
91
|
+
report(onStep, stepId, "Write hook reliability profile", "done", dryRun
|
|
92
|
+
? `dry-run: would write profile.json (${hookProfile ?? "standard"})`
|
|
93
|
+
: `ci-local/hooks/profile.json (${hookProfile ?? "standard"})`);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
report(onStep, stepId, "Write hook reliability profile", "skipped", "security hooks not selected");
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
report(onStep, stepId, "Write hook reliability profile", "error", String(e));
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { InitOptions, InitStep } from "../../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Callback invoked by each step to report progress.
|
|
4
|
+
* Steps emit at least 2 events: status:"running" followed by a terminal status
|
|
5
|
+
* ("done" | "skipped" | "error").
|
|
6
|
+
*/
|
|
7
|
+
export type StepCallback = (step: InitStep) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Context passed to every step. Built once by initProject and shared
|
|
10
|
+
* across all extracted step functions.
|
|
11
|
+
*
|
|
12
|
+
* Fields are intentionally minimal:
|
|
13
|
+
* - `options`: full InitOptions (steps can read any flag they need)
|
|
14
|
+
* - `projectDir`: convenience alias for options.projectDir
|
|
15
|
+
* - `dryRun`: convenience alias for options.dryRun
|
|
16
|
+
* - `onStep`: the progress callback (passed to report())
|
|
17
|
+
*/
|
|
18
|
+
export type StepContext = {
|
|
19
|
+
options: InitOptions;
|
|
20
|
+
projectDir: string;
|
|
21
|
+
dryRun: boolean;
|
|
22
|
+
onStep: StepCallback;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Step function signature. All step* functions follow this shape.
|
|
26
|
+
* Returns a promise that resolves when the step is complete
|
|
27
|
+
* (success, skipped, or recovered error — steps must NOT throw).
|
|
28
|
+
*/
|
|
29
|
+
export type StepFn = (ctx: StepContext) => Promise<void>;
|
|
30
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { InitOptions
|
|
2
|
-
type StepCallback
|
|
1
|
+
import type { InitOptions } from "../types/index.js";
|
|
2
|
+
import type { StepCallback } from "./init/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Main init orchestrator: bootstraps a project with CI, git hooks,
|
|
5
|
-
* memory module, AI config sync, SDD, and
|
|
5
|
+
* memory module, AI config sync, SDD, ghagga, and friends.
|
|
6
|
+
*
|
|
7
|
+
* Pure dispatch: every step lives in src/commands/init/steps/.
|
|
6
8
|
*/
|
|
7
9
|
export declare function initProject(options: InitOptions, onStep: StepCallback): Promise<void>;
|
|
8
|
-
export {};
|
|
9
10
|
//# sourceMappingURL=init.d.ts.map
|