@ryuenn3123/agentic-senior-core 3.0.37 → 3.0.39
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/.agent-context/prompts/bootstrap-design.md +109 -146
- package/.agent-context/rules/frontend-architecture.md +92 -108
- package/.agent-context/state/README.md +26 -0
- package/.agent-context/state/architecture-map.md +32 -17
- package/.agent-context/state/dependency-map.md +31 -22
- package/.cursor/mcp.json +10 -0
- package/.cursor/rules/agentic-senior-core.mdc +48 -0
- package/.cursorrules +22 -88
- package/.gemini/instructions.md +25 -16
- package/.github/copilot-instructions.md +25 -16
- package/.github/instructions/agentic-senior-core.instructions.md +47 -0
- package/.instructions.md +98 -207
- package/.windsurf/rules/agentic-senior-core.md +43 -0
- package/.windsurfrules +22 -88
- package/AGENTS.md +23 -26
- package/CLAUDE.md +43 -0
- package/CONTRIBUTING.md +7 -2
- package/GEMINI.md +43 -0
- package/README.md +25 -7
- package/lib/cli/backup.mjs +4 -4
- package/lib/cli/commands/init/project-context.mjs +101 -0
- package/lib/cli/commands/init/runtime-environment.mjs +59 -0
- package/lib/cli/commands/init/setup-decisions.mjs +83 -0
- package/lib/cli/commands/init.mjs +33 -250
- package/lib/cli/commands/optimize.mjs +1 -1
- package/lib/cli/commands/upgrade.mjs +34 -16
- package/lib/cli/compiler.mjs +59 -17
- package/lib/cli/constants.mjs +5 -0
- package/lib/cli/detector.mjs +4 -0
- package/lib/cli/init-detection-flow.mjs +9 -1
- package/lib/cli/init-selection.mjs +0 -5
- package/lib/cli/preflight.mjs +3 -3
- package/lib/cli/project-scaffolder/design-contract/validation.mjs +789 -0
- package/lib/cli/project-scaffolder/design-contract.mjs +119 -924
- package/lib/cli/project-scaffolder/prompt-builders.mjs +69 -84
- package/lib/cli/project-scaffolder.mjs +0 -2
- package/lib/cli/utils/filesystem.mjs +79 -0
- package/lib/cli/utils/managed-surface.mjs +237 -0
- package/lib/cli/utils/prompting.mjs +44 -0
- package/lib/cli/utils.mjs +33 -335
- package/package.json +21 -2
- package/scripts/bump-version.mjs +15 -13
- package/scripts/clean-local-artifacts.mjs +76 -0
- package/scripts/docs-quality-drift-report.mjs +5 -0
- package/scripts/frontend-usability-audit.mjs +23 -19
- package/scripts/governance-weekly-report.mjs +37 -15
- package/scripts/single-source-lazy-loading-audit.mjs +24 -0
- package/scripts/sync-thin-adapters.mjs +99 -129
- package/scripts/v3-purge-audit.mjs +5 -0
- package/scripts/validate/config.mjs +10 -0
- package/scripts/validate/coverage-checks.mjs +55 -0
- package/scripts/validate.mjs +20 -0
- package/.agent-context/marketplace/trust-tiers.json +0 -114
- package/.agent-context/state/benchmark-analysis.json +0 -431
- package/.agent-context/state/benchmark-evidence-bundle.json +0 -1040
- package/.agent-context/state/benchmark-history.json +0 -75
- package/.agent-context/state/benchmark-trend-report.csv +0 -5
- package/.agent-context/state/benchmark-trend-report.json +0 -140
- package/.agent-context/state/benchmark-writer-judge-matrix.json +0 -462
- package/.agent-context/state/memory-continuity-benchmark.json +0 -132
- package/.agent-context/state/onboarding-report.json +0 -102
- package/.agent-context/state/quality-trend-report.json +0 -89
- package/.agent-context/state/token-optimization-benchmark.json +0 -130
- package/.agent-context/state/weekly-governance-report.json +0 -329
- package/lib/cli/compatibility.mjs +0 -124
- package/scripts/validate-evidence-bundle.mjs +0 -76
package/AGENTS.md
CHANGED
|
@@ -2,45 +2,42 @@
|
|
|
2
2
|
|
|
3
3
|
Adapter Mode: thin
|
|
4
4
|
Adapter Source: .instructions.md
|
|
5
|
-
Canonical Snapshot SHA256:
|
|
5
|
+
Canonical Snapshot SHA256: 75652106d1fc453e9407eb9301e7f38de2e0159190dc47fb0b6e377859d91a46
|
|
6
6
|
|
|
7
|
-
This
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
This repository is governed by a strict instruction contract.
|
|
8
|
+
Use [.instructions.md](.instructions.md) as the canonical policy source.
|
|
9
|
+
Use .agent-context/ for technical rules, prompts, checklists, policies, and state.
|
|
10
|
+
Treat README.md as overview/install/user context only when governance files conflict.
|
|
11
11
|
|
|
12
12
|
## Critical Bootstrap Floor
|
|
13
13
|
|
|
14
|
-
- If
|
|
15
|
-
-
|
|
16
|
-
-
|
|
14
|
+
- If your host stops at this file, continue the chain manually before coding.
|
|
15
|
+
- Read `.agent-instructions.md` next when it exists.
|
|
16
|
+
- Memory continuity does not replace bootstrap loading.
|
|
17
|
+
- For UI, UX, layout, screen, tailwind, frontend, or redesign requests, load [bootstrap-design.md](.agent-context/prompts/bootstrap-design.md) and [frontend-architecture.md](.agent-context/rules/frontend-architecture.md) before code edits.
|
|
17
18
|
- For UI scope, include a one-line Motion/Palette Decision in the Bootstrap Receipt; product categories are heuristics, not style presets.
|
|
18
|
-
- For UI scope
|
|
19
|
-
- For documentation-first requests
|
|
20
|
-
- For backend, API, data, auth, error, event, queue, worker, or distributed-system requests
|
|
21
|
-
- For
|
|
22
|
-
-
|
|
23
|
-
- For ecosystem, framework, dependency, or Docker claims: perform live web research instead of relying on stale local heuristics.
|
|
19
|
+
- For UI scope, create or refine `docs/DESIGN.md` and `docs/design-intent.json` before UI implementation.
|
|
20
|
+
- For documentation-first requests, create or refine required project docs in English by default and do not write application, firmware, or UI code until the user asks or approves.
|
|
21
|
+
- For backend, API, data, auth, error, event, queue, worker, or distributed-system requests, load only relevant global rules from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
22
|
+
- For ecosystem, framework, dependency, or Docker claims, perform live web research.
|
|
23
|
+
- Resolve runtime choices from project evidence and live official documentation; resolve structural planning from constraints and architecture boundaries.
|
|
24
24
|
|
|
25
25
|
## Mandatory Bootstrap Chain
|
|
26
26
|
|
|
27
|
-
1. Load [.instructions.md](.instructions.md)
|
|
28
|
-
2.
|
|
29
|
-
3.
|
|
30
|
-
4. Apply
|
|
31
|
-
5. Enforce
|
|
32
|
-
6.
|
|
33
|
-
7.
|
|
34
|
-
8. Use runtime evidence, structure, and live research signals from project context docs.
|
|
27
|
+
1. Load [.instructions.md](.instructions.md).
|
|
28
|
+
2. Load `.agent-instructions.md` when present.
|
|
29
|
+
3. Load only relevant files from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
30
|
+
4. Apply matching prompts from .agent-context/prompts/ ([link](.agent-context/prompts)).
|
|
31
|
+
5. Enforce .agent-context/review-checklists/ ([link](.agent-context/review-checklists/pr-checklist.md)).
|
|
32
|
+
6. Use .agent-context/state/ ([link](.agent-context/state)) and .agent-context/policies/ ([link](.agent-context/policies)) only when relevant.
|
|
33
|
+
7. Use project docs and live evidence for runtime, dependency, and architecture claims.
|
|
35
34
|
|
|
36
35
|
## Bootstrap Receipt
|
|
37
36
|
|
|
38
37
|
For non-trivial coding, review, planning, or governance work, produce a short Bootstrap Receipt before implementation output: `loaded_files`, `selected_rules`, `skipped_rules`, `unreachable_files`, and `validation_plan`.
|
|
39
38
|
|
|
40
|
-
##
|
|
39
|
+
## Completion Gate
|
|
41
40
|
|
|
42
|
-
-
|
|
43
|
-
- Refactor or fix requests: propose plan first, then execute safely.
|
|
44
|
-
- Completion: run [.agent-context/review-checklists/pr-checklist.md](.agent-context/review-checklists/pr-checklist.md) before declaring done.
|
|
41
|
+
Run [pr-checklist.md](.agent-context/review-checklists/pr-checklist.md) before declaring work complete.
|
|
45
42
|
|
|
46
43
|
If this adapter drifts from canonical behavior, refresh from [.instructions.md](.instructions.md) and update the hash metadata.
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# CLAUDE.md - Thin Adapter
|
|
2
|
+
|
|
3
|
+
Adapter Mode: thin
|
|
4
|
+
Adapter Source: .instructions.md
|
|
5
|
+
Canonical Snapshot SHA256: 75652106d1fc453e9407eb9301e7f38de2e0159190dc47fb0b6e377859d91a46
|
|
6
|
+
|
|
7
|
+
This repository is governed by a strict instruction contract.
|
|
8
|
+
Use [.instructions.md](.instructions.md) as the canonical policy source.
|
|
9
|
+
Use .agent-context/ for technical rules, prompts, checklists, policies, and state.
|
|
10
|
+
Treat README.md as overview/install/user context only when governance files conflict.
|
|
11
|
+
|
|
12
|
+
## Critical Bootstrap Floor
|
|
13
|
+
|
|
14
|
+
- If your host stops at this file, continue the chain manually before coding.
|
|
15
|
+
- Read `.agent-instructions.md` next when it exists.
|
|
16
|
+
- Memory continuity does not replace bootstrap loading.
|
|
17
|
+
- For UI, UX, layout, screen, tailwind, frontend, or redesign requests, load [bootstrap-design.md](.agent-context/prompts/bootstrap-design.md) and [frontend-architecture.md](.agent-context/rules/frontend-architecture.md) before code edits.
|
|
18
|
+
- For UI scope, include a one-line Motion/Palette Decision in the Bootstrap Receipt; product categories are heuristics, not style presets.
|
|
19
|
+
- For UI scope, create or refine `docs/DESIGN.md` and `docs/design-intent.json` before UI implementation.
|
|
20
|
+
- For documentation-first requests, create or refine required project docs in English by default and do not write application, firmware, or UI code until the user asks or approves.
|
|
21
|
+
- For backend, API, data, auth, error, event, queue, worker, or distributed-system requests, load only relevant global rules from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
22
|
+
- For ecosystem, framework, dependency, or Docker claims, perform live web research.
|
|
23
|
+
- Resolve runtime choices from project evidence and live official documentation; resolve structural planning from constraints and architecture boundaries.
|
|
24
|
+
|
|
25
|
+
## Mandatory Bootstrap Chain
|
|
26
|
+
|
|
27
|
+
1. Load [.instructions.md](.instructions.md).
|
|
28
|
+
2. Load `.agent-instructions.md` when present.
|
|
29
|
+
3. Load only relevant files from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
30
|
+
4. Apply matching prompts from .agent-context/prompts/ ([link](.agent-context/prompts)).
|
|
31
|
+
5. Enforce .agent-context/review-checklists/ ([link](.agent-context/review-checklists/pr-checklist.md)).
|
|
32
|
+
6. Use .agent-context/state/ ([link](.agent-context/state)) and .agent-context/policies/ ([link](.agent-context/policies)) only when relevant.
|
|
33
|
+
7. Use project docs and live evidence for runtime, dependency, and architecture claims.
|
|
34
|
+
|
|
35
|
+
## Bootstrap Receipt
|
|
36
|
+
|
|
37
|
+
For non-trivial coding, review, planning, or governance work, produce a short Bootstrap Receipt before implementation output: `loaded_files`, `selected_rules`, `skipped_rules`, `unreachable_files`, and `validation_plan`.
|
|
38
|
+
|
|
39
|
+
## Completion Gate
|
|
40
|
+
|
|
41
|
+
Run [pr-checklist.md](.agent-context/review-checklists/pr-checklist.md) before declaring work complete.
|
|
42
|
+
|
|
43
|
+
If this adapter drifts from canonical behavior, refresh from [.instructions.md](.instructions.md) and update the hash metadata.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -63,7 +63,7 @@ If all three are "yes", it belongs here.
|
|
|
63
63
|
- Core principle (1-2 sentences)
|
|
64
64
|
- BANNED / REQUIRED sections with enforceable boundaries
|
|
65
65
|
- Decision tree or quick ruleset when it reduces ambiguity
|
|
66
|
-
3. Update
|
|
66
|
+
3. Update `.instructions.md` or `.agent-context/` as the source, then regenerate thin adapters with `npm run sync:adapters`
|
|
67
67
|
4. Update `review-checklists/pr-checklist.md` when the rule is part of review scope
|
|
68
68
|
5. Validate and PR
|
|
69
69
|
|
|
@@ -89,12 +89,14 @@ If all three are "yes", it belongs here.
|
|
|
89
89
|
- Rules without concrete enforcement boundaries
|
|
90
90
|
- Stack profiles for languages the author doesn't actually use in production
|
|
91
91
|
- Blueprints that are just folder structures without code patterns
|
|
92
|
-
- PRs that don't update the relevant
|
|
92
|
+
- PRs that don't update the relevant source files, generated adapters, and checklists
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
96
|
## Local Development
|
|
97
97
|
|
|
98
|
+
The npm package is published under `@ryuenn3123`, while the GitHub repository is hosted under `fatidaprilian`.
|
|
99
|
+
|
|
98
100
|
```bash
|
|
99
101
|
# Clone
|
|
100
102
|
git clone https://github.com/fatidaprilian/Agentic-Senior-Core.git
|
|
@@ -103,6 +105,9 @@ cd Agentic-Senior-Core
|
|
|
103
105
|
# Validate
|
|
104
106
|
npm run validate
|
|
105
107
|
|
|
108
|
+
# Clean ignored local reports/backups when the workspace gets noisy
|
|
109
|
+
npm run clean:local
|
|
110
|
+
|
|
106
111
|
# Test interactive CLI
|
|
107
112
|
node ./bin/agentic-senior-core.js init /tmp/test-project
|
|
108
113
|
```
|
package/GEMINI.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# GEMINI.md - Thin Adapter
|
|
2
|
+
|
|
3
|
+
Adapter Mode: thin
|
|
4
|
+
Adapter Source: .instructions.md
|
|
5
|
+
Canonical Snapshot SHA256: 75652106d1fc453e9407eb9301e7f38de2e0159190dc47fb0b6e377859d91a46
|
|
6
|
+
|
|
7
|
+
This repository is governed by a strict instruction contract.
|
|
8
|
+
Use [.instructions.md](.instructions.md) as the canonical policy source.
|
|
9
|
+
Use .agent-context/ for technical rules, prompts, checklists, policies, and state.
|
|
10
|
+
Treat README.md as overview/install/user context only when governance files conflict.
|
|
11
|
+
|
|
12
|
+
## Critical Bootstrap Floor
|
|
13
|
+
|
|
14
|
+
- If your host stops at this file, continue the chain manually before coding.
|
|
15
|
+
- Read `.agent-instructions.md` next when it exists.
|
|
16
|
+
- Memory continuity does not replace bootstrap loading.
|
|
17
|
+
- For UI, UX, layout, screen, tailwind, frontend, or redesign requests, load [bootstrap-design.md](.agent-context/prompts/bootstrap-design.md) and [frontend-architecture.md](.agent-context/rules/frontend-architecture.md) before code edits.
|
|
18
|
+
- For UI scope, include a one-line Motion/Palette Decision in the Bootstrap Receipt; product categories are heuristics, not style presets.
|
|
19
|
+
- For UI scope, create or refine `docs/DESIGN.md` and `docs/design-intent.json` before UI implementation.
|
|
20
|
+
- For documentation-first requests, create or refine required project docs in English by default and do not write application, firmware, or UI code until the user asks or approves.
|
|
21
|
+
- For backend, API, data, auth, error, event, queue, worker, or distributed-system requests, load only relevant global rules from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
22
|
+
- For ecosystem, framework, dependency, or Docker claims, perform live web research.
|
|
23
|
+
- Resolve runtime choices from project evidence and live official documentation; resolve structural planning from constraints and architecture boundaries.
|
|
24
|
+
|
|
25
|
+
## Mandatory Bootstrap Chain
|
|
26
|
+
|
|
27
|
+
1. Load [.instructions.md](.instructions.md).
|
|
28
|
+
2. Load `.agent-instructions.md` when present.
|
|
29
|
+
3. Load only relevant files from .agent-context/rules/ ([link](.agent-context/rules)).
|
|
30
|
+
4. Apply matching prompts from .agent-context/prompts/ ([link](.agent-context/prompts)).
|
|
31
|
+
5. Enforce .agent-context/review-checklists/ ([link](.agent-context/review-checklists/pr-checklist.md)).
|
|
32
|
+
6. Use .agent-context/state/ ([link](.agent-context/state)) and .agent-context/policies/ ([link](.agent-context/policies)) only when relevant.
|
|
33
|
+
7. Use project docs and live evidence for runtime, dependency, and architecture claims.
|
|
34
|
+
|
|
35
|
+
## Bootstrap Receipt
|
|
36
|
+
|
|
37
|
+
For non-trivial coding, review, planning, or governance work, produce a short Bootstrap Receipt before implementation output: `loaded_files`, `selected_rules`, `skipped_rules`, `unreachable_files`, and `validation_plan`.
|
|
38
|
+
|
|
39
|
+
## Completion Gate
|
|
40
|
+
|
|
41
|
+
Run [pr-checklist.md](.agent-context/review-checklists/pr-checklist.md) before declaring work complete.
|
|
42
|
+
|
|
43
|
+
If this adapter drifts from canonical behavior, refresh from [.instructions.md](.instructions.md) and update the hash metadata.
|
package/README.md
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
**Production-grade Rules Engine (Governance Engine) for AI coding agents.**
|
|
11
11
|
Works with Cursor, Windsurf, GitHub Copilot, Claude Code, Gemini, and other LLM-powered IDE workflows.
|
|
12
12
|
|
|
13
|
-
Latest release: 3.0.
|
|
13
|
+
Latest release: 3.0.39 (2026-04-30).
|
|
14
14
|
|
|
15
|
-
Highlights in 3.0.
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
Highlights in 3.0.39:
|
|
16
|
+
- Post-release hygiene removes stale V2 evidence-bundle and Bun lockfile drift surfaces.
|
|
17
|
+
- Package and lockfile validation now blocks version drift and accidental dual package-manager state.
|
|
18
|
+
- Repo-local agent context now documents frontend/backend governance boundaries and anti-grid wallpaper handling.
|
|
19
19
|
|
|
20
20
|
</div>
|
|
21
21
|
|
|
@@ -29,11 +29,12 @@ Highlights in 3.0.30:
|
|
|
29
29
|
npx @ryuenn3123/agentic-senior-core init
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
One command to initialize rules, checklists, and
|
|
32
|
+
One command to initialize rules, checklists, thin discovery adapters, and a compiled AI rulebook for your project.
|
|
33
33
|
|
|
34
34
|
> **See [docs/deep-dive.md](docs/deep-dive.md) and [docs/roadmap.md](docs/roadmap.md) for advanced configuration, planning mode, snapshot, and realtime options.**
|
|
35
35
|
|
|
36
36
|
- This command writes `.agent-context/state/v3-purge-audit.json` and reports whether static directory deletion is safe.
|
|
37
|
+
- Package scope is `@ryuenn3123`; the GitHub repository owner is `fatidaprilian`.
|
|
37
38
|
|
|
38
39
|
---
|
|
39
40
|
|
|
@@ -73,10 +74,11 @@ If you see `Property $schema is not allowed`, keep `.vscode/mcp.json` without `$
|
|
|
73
74
|
|
|
74
75
|
| Command | Purpose |
|
|
75
76
|
|---------|---------|
|
|
76
|
-
| `agentic-senior-core init` | Initialize the project guidance pack and compiled AI rulebook |
|
|
77
|
+
| `agentic-senior-core init` | Initialize the project guidance pack, thin adapters, and compiled AI rulebook |
|
|
77
78
|
| `agentic-senior-core upgrade --dry-run` | Preview safe upgrades |
|
|
78
79
|
| `agentic-senior-core optimize --show` | Show token optimization state |
|
|
79
80
|
| `npm run audit:v3-purge` | Run deep purge readiness audit (no deletion) |
|
|
81
|
+
| `npm run clean:local` | Remove ignored local reports, backups, benchmarks, and active-memory state |
|
|
80
82
|
| `agentic-senior-core mcp` | Start local MCP stdio runtime |
|
|
81
83
|
|
|
82
84
|
---
|
|
@@ -93,6 +95,22 @@ Use `--dry-run` first to preview changes safely, then apply with `--yes`.
|
|
|
93
95
|
Upgrade now performs managed-surface synchronization by default: obsolete governance files under managed paths are pruned so the pack stays aligned with the latest release.
|
|
94
96
|
Use `--no-prune` if you want to keep legacy managed files.
|
|
95
97
|
|
|
98
|
+
## Instruction Entrypoints
|
|
99
|
+
|
|
100
|
+
The canonical source is `.instructions.md`.
|
|
101
|
+
|
|
102
|
+
Generated bridge files stay small:
|
|
103
|
+
- `AGENTS.md`
|
|
104
|
+
- `CLAUDE.md`
|
|
105
|
+
- `GEMINI.md`
|
|
106
|
+
- `.cursor/rules/agentic-senior-core.mdc`
|
|
107
|
+
- `.windsurf/rules/agentic-senior-core.md`
|
|
108
|
+
- `.github/copilot-instructions.md`
|
|
109
|
+
- `.github/instructions/agentic-senior-core.instructions.md`
|
|
110
|
+
- `.gemini/instructions.md`
|
|
111
|
+
|
|
112
|
+
Legacy root files `.cursorrules`, `.windsurfrules`, and `.clauderc` are thin compatibility adapters. They point to `.agent-instructions.md` when the compiled rulebook exists, with `.instructions.md` as the fallback source.
|
|
113
|
+
|
|
96
114
|
---
|
|
97
115
|
|
|
98
116
|
## Terminology Mapping (Final)
|
package/lib/cli/backup.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import crypto from 'node:crypto';
|
|
4
4
|
import { pathExists, ensureDirectory } from './utils.mjs';
|
|
5
|
+
import { entryPointFiles } from './constants.mjs';
|
|
5
6
|
|
|
6
7
|
const BACKUP_DIR_NAME = '.agentic-backup';
|
|
7
8
|
|
|
@@ -44,7 +45,7 @@ async function getFilesInDirectory(dirPath) {
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Creates a backup of specific paths in the target directory.
|
|
47
|
-
* Currently backs up:
|
|
48
|
+
* Currently backs up: managed entrypoint files and the entire .agent-context directory.
|
|
48
49
|
* @param {string} targetDirectoryPath
|
|
49
50
|
*/
|
|
50
51
|
export async function createBackup(targetDirectoryPath) {
|
|
@@ -55,9 +56,8 @@ export async function createBackup(targetDirectoryPath) {
|
|
|
55
56
|
await ensureDirectory(objectsDir);
|
|
56
57
|
|
|
57
58
|
const pathsToTrack = [
|
|
58
|
-
path.join(targetDirectoryPath,
|
|
59
|
-
path.join(targetDirectoryPath, '.
|
|
60
|
-
path.join(targetDirectoryPath, '.agent-context')
|
|
59
|
+
...entryPointFiles.map((entryPointFileName) => path.join(targetDirectoryPath, entryPointFileName)),
|
|
60
|
+
path.join(targetDirectoryPath, '.agent-context'),
|
|
61
61
|
];
|
|
62
62
|
|
|
63
63
|
const resolvedFilesToTrack = [];
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { buildDesignIntentSeedFromSignals } from '../../project-scaffolder.mjs';
|
|
5
|
+
|
|
6
|
+
function normalizeContextLine(rawText) {
|
|
7
|
+
return String(rawText || '')
|
|
8
|
+
.replace(/\s+/g, ' ')
|
|
9
|
+
.trim();
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async function readTextIfExists(filePath) {
|
|
13
|
+
try {
|
|
14
|
+
return await fs.readFile(filePath, 'utf8');
|
|
15
|
+
} catch {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function extractMarkdownContext(rawMarkdown) {
|
|
21
|
+
return String(rawMarkdown || '')
|
|
22
|
+
.split(/\r?\n/)
|
|
23
|
+
.map((line) => normalizeContextLine(line.replace(/^#+\s*/, '')))
|
|
24
|
+
.filter((line) => line && !line.startsWith('---') && !line.startsWith('```'))
|
|
25
|
+
.slice(0, 3)
|
|
26
|
+
.join(' ');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function inferExistingProjectDescriptionHint(targetDirectoryPath) {
|
|
30
|
+
const evidence = [];
|
|
31
|
+
const packageJsonContent = await readTextIfExists(path.join(targetDirectoryPath, 'package.json'));
|
|
32
|
+
|
|
33
|
+
if (packageJsonContent) {
|
|
34
|
+
try {
|
|
35
|
+
const packageManifest = JSON.parse(packageJsonContent);
|
|
36
|
+
const packageSummary = [
|
|
37
|
+
normalizeContextLine(packageManifest.name),
|
|
38
|
+
normalizeContextLine(packageManifest.description),
|
|
39
|
+
].filter(Boolean).join(': ');
|
|
40
|
+
|
|
41
|
+
if (packageSummary) {
|
|
42
|
+
evidence.push(`package.json: ${packageSummary}`);
|
|
43
|
+
}
|
|
44
|
+
} catch {
|
|
45
|
+
// Invalid package metadata should not block init; other files can still provide context.
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
for (const relativeDocPath of ['docs/project-brief.md', 'docs/README.md', 'README.md']) {
|
|
50
|
+
const docContext = extractMarkdownContext(
|
|
51
|
+
await readTextIfExists(path.join(targetDirectoryPath, relativeDocPath))
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (docContext) {
|
|
55
|
+
evidence.push(`${relativeDocPath}: ${docContext}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return evidence.slice(0, 3).join(' | ');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function buildInitExistingProjectDesignIntentSeed({
|
|
63
|
+
targetDirectoryPath,
|
|
64
|
+
packageManifest,
|
|
65
|
+
selectedStackFileName,
|
|
66
|
+
selectedBlueprintFileName,
|
|
67
|
+
uiScopeSignals,
|
|
68
|
+
projectDescriptionHint,
|
|
69
|
+
}) {
|
|
70
|
+
const projectName = String(packageManifest?.name || path.basename(targetDirectoryPath)).trim() || 'existing-ui-project';
|
|
71
|
+
const isMobileUiProject = String(selectedStackFileName || '').toLowerCase().includes('react-native')
|
|
72
|
+
|| String(selectedStackFileName || '').toLowerCase().includes('flutter')
|
|
73
|
+
|| uiScopeSignals.signalReasons.some((signalReason) => signalReason.includes('android') || signalReason.includes('ios'));
|
|
74
|
+
const resolvedDomain = isMobileUiProject ? 'Mobile app' : 'Web application';
|
|
75
|
+
const projectDescription = String(packageManifest?.description || projectDescriptionHint || '').trim()
|
|
76
|
+
|| `Existing ${resolvedDomain.toLowerCase()} detected during init. Create a project-specific dynamic design contract before shipping new UI work.`;
|
|
77
|
+
|
|
78
|
+
return buildDesignIntentSeedFromSignals({
|
|
79
|
+
projectName,
|
|
80
|
+
projectDescription,
|
|
81
|
+
primaryDomain: resolvedDomain,
|
|
82
|
+
features: [],
|
|
83
|
+
initContext: {
|
|
84
|
+
stackFileName: selectedStackFileName,
|
|
85
|
+
blueprintFileName: selectedBlueprintFileName,
|
|
86
|
+
},
|
|
87
|
+
status: 'seed-generated-during-init',
|
|
88
|
+
supplementalFields: {
|
|
89
|
+
initSignals: {
|
|
90
|
+
detectedFrom: uiScopeSignals.signalReasons,
|
|
91
|
+
generatedBy: 'init-existing-project-seed',
|
|
92
|
+
},
|
|
93
|
+
repoEvidence: {
|
|
94
|
+
uiSignalReasons: uiScopeSignals.signalReasons,
|
|
95
|
+
frontendMetrics: uiScopeSignals.frontendEvidenceMetrics || null,
|
|
96
|
+
designEvidenceSummary: uiScopeSignals.designEvidenceSummary || null,
|
|
97
|
+
workspaceUiEntries: uiScopeSignals.workspaceUiEntries || [],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { RUNTIME_ENVIRONMENT_CHOICES } from '../../constants.mjs';
|
|
2
|
+
|
|
3
|
+
export function resolveRuntimeEnvironmentKeyFromLabel(selectedRuntimeEnvironmentLabel) {
|
|
4
|
+
const runtimeEnvironmentEntry = RUNTIME_ENVIRONMENT_CHOICES.find(
|
|
5
|
+
(runtimeEnvironmentChoice) => runtimeEnvironmentChoice.label === selectedRuntimeEnvironmentLabel
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
return runtimeEnvironmentEntry?.key || null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function resolveRuntimeEnvironmentLabelFromKey(runtimeEnvironmentKey) {
|
|
12
|
+
const runtimeEnvironmentEntry = RUNTIME_ENVIRONMENT_CHOICES.find(
|
|
13
|
+
(runtimeEnvironmentChoice) => runtimeEnvironmentChoice.key === runtimeEnvironmentKey
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
return runtimeEnvironmentEntry?.label || runtimeEnvironmentKey;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function detectRuntimeEnvironment() {
|
|
20
|
+
const isWslEnvironment = Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP || process.env.__IS_WSL_TEST__);
|
|
21
|
+
|
|
22
|
+
if (isWslEnvironment) {
|
|
23
|
+
return {
|
|
24
|
+
key: 'linux-wsl',
|
|
25
|
+
label: resolveRuntimeEnvironmentLabelFromKey('linux-wsl'),
|
|
26
|
+
shellFamily: 'bash',
|
|
27
|
+
isAutoDetected: true,
|
|
28
|
+
source: 'WSL environment markers',
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (process.platform === 'win32') {
|
|
33
|
+
return {
|
|
34
|
+
key: 'windows',
|
|
35
|
+
label: resolveRuntimeEnvironmentLabelFromKey('windows'),
|
|
36
|
+
shellFamily: 'powershell',
|
|
37
|
+
isAutoDetected: true,
|
|
38
|
+
source: 'process.platform',
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (process.platform === 'darwin') {
|
|
43
|
+
return {
|
|
44
|
+
key: 'macos',
|
|
45
|
+
label: resolveRuntimeEnvironmentLabelFromKey('macos'),
|
|
46
|
+
shellFamily: 'bash',
|
|
47
|
+
isAutoDetected: true,
|
|
48
|
+
source: 'process.platform',
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
key: 'linux',
|
|
54
|
+
label: resolveRuntimeEnvironmentLabelFromKey('linux'),
|
|
55
|
+
shellFamily: 'bash',
|
|
56
|
+
isAutoDetected: true,
|
|
57
|
+
source: 'process.platform',
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { PROJECT_SCOPE_CHOICES } from '../../constants.mjs';
|
|
2
|
+
import { matchFileNameFromInput, normalizeChoiceInput } from '../../utils.mjs';
|
|
3
|
+
|
|
4
|
+
export function resolveProjectScopeLabelFromKey(projectScopeKey) {
|
|
5
|
+
return PROJECT_SCOPE_CHOICES.find((scopeChoice) => scopeChoice.key === projectScopeKey)?.label
|
|
6
|
+
|| PROJECT_SCOPE_CHOICES.find((scopeChoice) => scopeChoice.key === 'both')?.label
|
|
7
|
+
|| 'Both (frontend + backend)';
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function inferProjectScopeFromDiscoveryAnswers(discoveryAnswers) {
|
|
11
|
+
const normalizedDomain = String(discoveryAnswers?.primaryDomain || '').trim().toLowerCase();
|
|
12
|
+
const normalizedDescription = [
|
|
13
|
+
discoveryAnswers?.projectDescription,
|
|
14
|
+
...(Array.isArray(discoveryAnswers?.features) ? discoveryAnswers.features : []),
|
|
15
|
+
].join(' ').toLowerCase();
|
|
16
|
+
|
|
17
|
+
if (
|
|
18
|
+
normalizedDomain.includes('api service')
|
|
19
|
+
|| normalizedDomain.includes('cli tool')
|
|
20
|
+
|| normalizedDomain.includes('library')
|
|
21
|
+
) {
|
|
22
|
+
return 'backend-only';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (normalizedDomain.includes('mobile app')) {
|
|
26
|
+
return 'frontend-only';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (normalizedDomain.includes('web application')) {
|
|
30
|
+
if (/(landing page|marketing site|showcase|portfolio|brochure|company profile)/.test(normalizedDescription)) {
|
|
31
|
+
return 'frontend-only';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return 'both';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return 'both';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function resolveSilentCiGuardrailsDefault({
|
|
41
|
+
initOptions,
|
|
42
|
+
selectedPreset,
|
|
43
|
+
selectedPolicyProfile,
|
|
44
|
+
}) {
|
|
45
|
+
if (typeof initOptions.ci === 'boolean') {
|
|
46
|
+
return {
|
|
47
|
+
value: initOptions.ci,
|
|
48
|
+
shouldAsk: false,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof selectedPreset?.ci === 'boolean') {
|
|
53
|
+
return {
|
|
54
|
+
value: selectedPreset.ci,
|
|
55
|
+
shouldAsk: false,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (selectedPolicyProfile.lockCi) {
|
|
60
|
+
return {
|
|
61
|
+
value: selectedPolicyProfile.defaultCi,
|
|
62
|
+
shouldAsk: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
value: selectedPolicyProfile.defaultCi,
|
|
68
|
+
shouldAsk: true,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function normalizeExplicitProfileFileName(rawInput, discoveredFileNames) {
|
|
73
|
+
const matchedFileName = Array.isArray(discoveredFileNames) && discoveredFileNames.length > 0
|
|
74
|
+
? matchFileNameFromInput(rawInput, discoveredFileNames)
|
|
75
|
+
: null;
|
|
76
|
+
|
|
77
|
+
if (matchedFileName) {
|
|
78
|
+
return matchedFileName;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const normalizedBaseName = normalizeChoiceInput(String(rawInput || '').replace(/\.md$/i, ''));
|
|
82
|
+
return normalizedBaseName ? `${normalizedBaseName}.md` : null;
|
|
83
|
+
}
|