@mengde1231/rudder 0.5.23 → 0.6.1
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 +148 -119
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +70 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +57 -2
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/workflow.d.ts +3 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +13 -1
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/claude/agents/rudder-check.md +37 -3
- package/dist/templates/codebuddy/agents/rudder-check.md +37 -3
- package/dist/templates/codex/agents/rudder-check.toml +10 -3
- package/dist/templates/codex/config.toml +30 -35
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/rudder-spec-bootstarp/references/spec-writing.md +70 -0
- package/dist/templates/cursor/agents/rudder-check.md +37 -3
- package/dist/templates/droid/droids/rudder-check.md +37 -3
- package/dist/templates/gemini/agents/rudder-check.md +37 -3
- package/dist/templates/kiro/agents/rudder-check.json +1 -1
- package/dist/templates/opencode/agents/rudder-check.md +37 -3
- package/dist/templates/pi/agents/rudder-check.md +68 -1
- package/dist/templates/qoder/agents/rudder-check.md +37 -3
- package/dist/templates/rudder/config.yaml +15 -2
- package/dist/templates/rudder/config_local.yml +17 -0
- package/dist/templates/rudder/gitignore.txt +1 -1
- package/dist/templates/rudder/index.d.ts +1 -0
- package/dist/templates/rudder/index.d.ts.map +1 -1
- package/dist/templates/rudder/index.js +1 -0
- package/dist/templates/rudder/index.js.map +1 -1
- package/dist/templates/rudder/scripts/common/config.py +37 -7
- package/dist/templates/rudder/scripts/common/rudder_config.py +26 -4
- package/dist/templates/rudder/workflow.md +6 -2
- package/dist/templates/shared-hooks/session-start.py +2 -0
- package/dist/utils/registry-config.d.ts +7 -0
- package/dist/utils/registry-config.d.ts.map +1 -0
- package/dist/utils/registry-config.js +171 -0
- package/dist/utils/registry-config.js.map +1 -0
- package/dist/utils/template-fetcher.d.ts +11 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +51 -2
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,119 +1,148 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
<picture>
|
|
3
|
-
<source srcset="assets/rudder.png" media="(prefers-color-scheme: dark)">
|
|
4
|
-
<source srcset="assets/rudder.png" media="(prefers-color-scheme: light)">
|
|
5
|
-
<img src="assets/rudder.png" alt="Rudder Logo
|
|
6
|
-
</picture>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
<a href="https://
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
1.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
<details>
|
|
90
|
-
<summary><strong>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</details>
|
|
95
|
-
|
|
96
|
-
<details>
|
|
97
|
-
<summary><strong>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
</details>
|
|
102
|
-
|
|
103
|
-
<details>
|
|
104
|
-
<summary><strong>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</details>
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<
|
|
118
|
-
<
|
|
119
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<picture>
|
|
3
|
+
<source srcset="assets/rudder-logo.png" media="(prefers-color-scheme: dark)">
|
|
4
|
+
<source srcset="assets/rudder-logo.png" media="(prefers-color-scheme: light)">
|
|
5
|
+
<img src="assets/rudder-logo.png" alt="Rudder Logo" width="500" style="image-rendering: -webkit-optimize-contrast; image-rendering: crisp-edges;">
|
|
6
|
+
</picture>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<strong>Your AI coding assistant keeps forgetting your project? This fixes that.</strong><br/>
|
|
11
|
+
<sub>Start a feature in Gemini, continue in Claude Code, hand it off to a teammate — no one needs to re-explain everything. Context, specs, and standards live in your repo and get injected automatically.</sub>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="./README_CN.md">简体中文</a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="https://www.npmjs.com/package/@mengde1231/rudder"><img src="https://img.shields.io/npm/v/@mengde1231/rudder.svg?style=flat-square&color=2563eb" alt="npm version" /></a>
|
|
20
|
+
<a href="https://www.npmjs.com/package/@mengde1231/rudder"><img src="https://img.shields.io/npm/dw/@mengde1231/rudder?style=flat-square&color=cb3837&label=downloads" alt="npm downloads" /></a>
|
|
21
|
+
<a href="https://github.com/MengDe1231/Rudder/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-AGPL--3.0-16a34a.svg?style=flat-square" alt="license" /></a>
|
|
22
|
+
<a href="https://github.com/MengDe1231/Rudder/stargazers"><img src="https://img.shields.io/github/stars/MengDe1231/Rudder?style=flat-square&color=eab308" alt="stars" /></a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
## What problem does this solve?
|
|
26
|
+
|
|
27
|
+
If you've used AI for coding, you know the drill: every new session the assistant has no idea about your project. You explain the same things over and over.
|
|
28
|
+
|
|
29
|
+
Rudder fixes that. **Your specs, memory, and task state all live in the repo. Every session gets exactly the context it needs — automatically.**
|
|
30
|
+
|
|
31
|
+
| Capability | What it changes |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| **Auto-injected specs** | Write your conventions once in `.rudder/spec/`, Rudder injects the right files into each session. No more copy-pasting rules every time. |
|
|
34
|
+
| **Task-centered flow** | PRDs, implementation records, and review context all live in `.rudder/tasks/`. AI work stays structured, not scattered across chat history. |
|
|
35
|
+
| **Project memory** | `.rudder/workspace/` journals carry forward what happened last time. New session? It knows where you left off. |
|
|
36
|
+
| **Team-shared standards** | Specs version-control with your code. One person figures out a good pattern, everyone gets it for free. |
|
|
37
|
+
| **14 platforms, one setup** | Same Rudder structure everywhere. Switch tools, keep your workflow. |
|
|
38
|
+
|
|
39
|
+
## Supported Platforms
|
|
40
|
+
|
|
41
|
+
14 AI coding platforms, one setup. Pick what you use:
|
|
42
|
+
|
|
43
|
+
| Agent | IDE / Platform |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| Claude Code | CLI, VS Code, JetBrains, Web |
|
|
46
|
+
| Gemini | Gemini CLI |
|
|
47
|
+
| Cursor | Cursor IDE |
|
|
48
|
+
| Codex | VS Code |
|
|
49
|
+
| OpenCode | OpenCode IDE |
|
|
50
|
+
| CodeBuddy | CodeBuddy IDE |
|
|
51
|
+
| Qoder | Qoder IDE |
|
|
52
|
+
| Kiro | Kiro IDE |
|
|
53
|
+
| Pi | Pi CLI |
|
|
54
|
+
| Windsurf | Windsurf IDE |
|
|
55
|
+
| Copilot | VS Code, JetBrains |
|
|
56
|
+
| Antigravity | Antigravity CLI |
|
|
57
|
+
| Kilo | Kilo CLI |
|
|
58
|
+
| Droid | Factory IDE |
|
|
59
|
+
|
|
60
|
+
## What you need
|
|
61
|
+
|
|
62
|
+
- **Node.js** >= 18
|
|
63
|
+
- **Python** >= 3.9
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# 1. Install
|
|
69
|
+
npm install -g @mengde1231/rudder@latest
|
|
70
|
+
|
|
71
|
+
# 2. Initialize (all platforms)
|
|
72
|
+
rudder init -u your-name
|
|
73
|
+
|
|
74
|
+
# 3. Or just the ones you actually use (cleaner)
|
|
75
|
+
rudder init --cursor --opencode --codex -u your-name
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## How it works
|
|
79
|
+
|
|
80
|
+
Rudder runs a 4-phase loop every session:
|
|
81
|
+
|
|
82
|
+
1. **Plan** — `rudder-brainstorm` walks through requirements and writes `prd.md`. Research-heavy stuff goes to a `rudder-research` sub-agent. Output: curated specs + research files, wired up via `implement.jsonl` / `check.jsonl`.
|
|
83
|
+
2. **Implement** — `rudder-implement` writes code from the PRD with context already injected. No git commit here — that's intentional.
|
|
84
|
+
3. **Verify** — `rudder-check` reviews the diff against specs, runs lint, type-check, compile, and tests. Fixes what it can, reports what it can't.
|
|
85
|
+
4. **Finish** — `rudder-update-spec` promotes new learnings back into `.rudder/spec/` so the next session starts smarter.
|
|
86
|
+
|
|
87
|
+
## FAQ
|
|
88
|
+
|
|
89
|
+
<details>
|
|
90
|
+
<summary><strong>How is this different from <code>CLAUDE.md</code>, <code>AGENTS.md</code>, or <code>.cursorrules</code>?</strong></summary>
|
|
91
|
+
|
|
92
|
+
Those are useful entry points — until they become 3,000-line monoliths nobody reads. Rudder layers things: scoped specs, per-task PRDs, workflow gates, cross-platform adapters. <strong>One simple rule: don't cram everything into one file.</strong>
|
|
93
|
+
|
|
94
|
+
</details>
|
|
95
|
+
|
|
96
|
+
<details>
|
|
97
|
+
<summary><strong>Is Rudder only for Claude Code?</strong></summary>
|
|
98
|
+
|
|
99
|
+
Nope. Rudder is a project-layer thing. Works across 14 coding agents and IDEs. Use Gemini for frontend today, Claude Code for backend tomorrow, Codex for review the day after.
|
|
100
|
+
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
<details>
|
|
104
|
+
<summary><strong>Solo dev or team?</strong></summary>
|
|
105
|
+
|
|
106
|
+
Both. Solo devs get project memory and repeatable workflow. Teams get the bigger win: shared standards, clear task boundaries, reviewable context, and platform portability.
|
|
107
|
+
|
|
108
|
+
</details>
|
|
109
|
+
|
|
110
|
+
<details>
|
|
111
|
+
<summary><strong>Do I have to write every spec file by hand?</strong></summary>
|
|
112
|
+
|
|
113
|
+
Nope. Most teams let AI draft specs from existing code first, then tighten the important stuff by hand. Rudder works best when the high-signal rules are explicit and versioned — the rest AI can figure out.
|
|
114
|
+
|
|
115
|
+
</details>
|
|
116
|
+
|
|
117
|
+
<details>
|
|
118
|
+
<summary><strong>Will this cause merge conflicts in a team?</strong></summary>
|
|
119
|
+
|
|
120
|
+
Nah. Personal workspace journals are per-developer. Shared specs and tasks go through git like any other artifact — merge conflicts are just merge conflicts, nothing new.
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
## A Note from the Author
|
|
125
|
+
|
|
126
|
+
**Why does the version start at 0.5?**
|
|
127
|
+
|
|
128
|
+
The version numbers aren't skipped — I iterated locally for many rounds before publishing. Rudder was born in May (the 5th month), so the major version is 0.5, with the first public release at 0.5.30.
|
|
129
|
+
|
|
130
|
+
Rudder draws from many open-source projects, and I grew up learning from the open-source community. But open-source covers a broad set of use cases — most of them aren't battle-tested in real production workflows. As a Java full-stack developer, I use Rudder daily myself and keep iterating on it. That makes it relatively more friendly to Java full-stack engineers — the Java spec templates are also being actively updated. That said, every other language works just as well — Rudder itself is completely platform-agnostic.
|
|
131
|
+
|
|
132
|
+
One person can only do so much, but every pit I fall into will be filled. Hope it helps you who are using AI to write code.
|
|
133
|
+
|
|
134
|
+
> 📖 Rudder's online documentation and user manual are being gradually improved. Stay tuned.
|
|
135
|
+
|
|
136
|
+
## Acknowledgments
|
|
137
|
+
|
|
138
|
+
Rudder wouldn't exist without the open-source coding agent community. We studied how many projects solve the same problems — context injection, workflow gates, multi-platform support — and built the version we wished we had.
|
|
139
|
+
|
|
140
|
+
## Star History
|
|
141
|
+
|
|
142
|
+
[](https://star-history.com/#MengDe1231/Rudder&Date)
|
|
143
|
+
|
|
144
|
+
<p align="center">
|
|
145
|
+
<a href="https://github.com/MengDe1231/Rudder">GitHub</a> •
|
|
146
|
+
<a href="https://discord.com/invite/tWcCZ3aRHc">Discord</a> •
|
|
147
|
+
<a href="https://github.com/MengDe1231/Rudder/blob/main/LICENSE">AGPL-3.0 License</a>
|
|
148
|
+
</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiFA,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAUvE;AAuBD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkC9D;AAmBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAoEA;AAgCD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOzD;AA+nBD,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA6DD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA+5B9D"}
|
package/dist/commands/init.js
CHANGED
|
@@ -15,13 +15,34 @@ import { agentsMdContent } from "../templates/markdown/index.js";
|
|
|
15
15
|
import { setWriteMode, writeFile, } from "../utils/file-writer.js";
|
|
16
16
|
import { emptyTaskJson } from "../utils/task-json.js";
|
|
17
17
|
import { detectProjectType, detectMonorepo, sanitizePkgName, } from "../utils/project-detector.js";
|
|
18
|
-
import { initializeHashes } from "../utils/template-hash.js";
|
|
18
|
+
import { initializeHashes, updateHashes } from "../utils/template-hash.js";
|
|
19
|
+
import { toPosix } from "../utils/posix.js";
|
|
19
20
|
import { fetchTemplateIndex, probeRegistryIndex, downloadTemplateById, downloadRegistryDirect, parseRegistrySource, TIMEOUTS, TEMPLATE_INDEX_URL, } from "../utils/template-fetcher.js";
|
|
20
21
|
import { setupProxy, maskProxyUrl } from "../utils/proxy.js";
|
|
21
22
|
import { migrateFromTrellis } from "../utils/trellis-migrate.js";
|
|
23
|
+
import { writeSpecRegistryConfig, } from "../utils/registry-config.js";
|
|
22
24
|
const MIN_PYTHON_MAJOR = 3;
|
|
23
25
|
const MIN_PYTHON_MINOR = 9;
|
|
24
26
|
const PYTHON_VERSION_RE = /Python (\d+)\.(\d+)/;
|
|
27
|
+
function collectSpecPaths(cwd) {
|
|
28
|
+
const specRoot = path.join(cwd, PATHS.SPEC);
|
|
29
|
+
const paths = new Set();
|
|
30
|
+
if (!fs.existsSync(specRoot))
|
|
31
|
+
return paths;
|
|
32
|
+
const walk = (dir) => {
|
|
33
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
34
|
+
const fullPath = path.join(dir, entry.name);
|
|
35
|
+
if (entry.isDirectory()) {
|
|
36
|
+
walk(fullPath);
|
|
37
|
+
}
|
|
38
|
+
else if (entry.isFile()) {
|
|
39
|
+
paths.add(toPosix(path.relative(cwd, fullPath)));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
walk(specRoot);
|
|
44
|
+
return paths;
|
|
45
|
+
}
|
|
25
46
|
export function isSupportedPythonVersion(versionOutput) {
|
|
26
47
|
const match = versionOutput.match(PYTHON_VERSION_RE);
|
|
27
48
|
if (!match)
|
|
@@ -857,11 +878,13 @@ export async function init(options) {
|
|
|
857
878
|
// handleReinit's joiner branch would otherwise mis-route the recovery.
|
|
858
879
|
const tasksDirEarly = path.join(cwd, PATHS.TASKS);
|
|
859
880
|
const tasksEmptyEarly = !fs.existsSync(tasksDirEarly) || fs.readdirSync(tasksDirEarly).length === 0;
|
|
881
|
+
const hasTemplateRequest = !!options.template || !!options.registry;
|
|
860
882
|
if (!isFirstInit &&
|
|
861
883
|
!migration.migrated &&
|
|
862
884
|
!options.force &&
|
|
863
885
|
!options.skipExisting &&
|
|
864
|
-
!tasksEmptyEarly
|
|
886
|
+
!tasksEmptyEarly &&
|
|
887
|
+
!hasTemplateRequest) {
|
|
865
888
|
const reinitDone = await handleReinit(cwd, options, developerName, pythonCmd);
|
|
866
889
|
if (reinitDone)
|
|
867
890
|
return;
|
|
@@ -883,9 +906,11 @@ export async function init(options) {
|
|
|
883
906
|
const detectedType = detectProjectType(cwd);
|
|
884
907
|
// Parse custom registry source early (needed by both monorepo + single-repo flows)
|
|
885
908
|
let registry;
|
|
909
|
+
let registrySourceForConfig;
|
|
886
910
|
if (options.registry) {
|
|
887
911
|
try {
|
|
888
912
|
registry = parseRegistrySource(options.registry);
|
|
913
|
+
registrySourceForConfig = options.registry;
|
|
889
914
|
}
|
|
890
915
|
catch (error) {
|
|
891
916
|
console.log(chalk.red(error instanceof Error ? error.message : "Invalid registry source"));
|
|
@@ -1081,6 +1106,19 @@ export async function init(options) {
|
|
|
1081
1106
|
else if (options.template) {
|
|
1082
1107
|
// Template specified via --template flag
|
|
1083
1108
|
selectedTemplate = options.template;
|
|
1109
|
+
if (registry) {
|
|
1110
|
+
const probeResult = await probeRegistryIndex(indexUrl, registry);
|
|
1111
|
+
registryBackend = probeResult.backend;
|
|
1112
|
+
if (probeResult.error) {
|
|
1113
|
+
console.log(chalk.red(`Error: ${probeResult.error.message}`));
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1116
|
+
if (probeResult.isNotFound) {
|
|
1117
|
+
console.log(chalk.red("Error: Registry has no index.json. Remove --template to use direct download mode."));
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
fetchedTemplates = probeResult.templates;
|
|
1121
|
+
}
|
|
1084
1122
|
}
|
|
1085
1123
|
else if (!options.yes) {
|
|
1086
1124
|
// Interactive mode: show template selection
|
|
@@ -1164,6 +1202,7 @@ export async function init(options) {
|
|
|
1164
1202
|
}
|
|
1165
1203
|
try {
|
|
1166
1204
|
registry = parseRegistrySource(customSource);
|
|
1205
|
+
registrySourceForConfig = customSource;
|
|
1167
1206
|
fetchedTemplates = []; // Reset so direct-download guard works correctly
|
|
1168
1207
|
// Probe index.json to detect marketplace vs direct download
|
|
1169
1208
|
const customIndexUrl = `${registry.rawBaseUrl}/index.json`;
|
|
@@ -1227,6 +1266,7 @@ export async function init(options) {
|
|
|
1227
1266
|
// Transient error (not 404) — loop back, don't misclassify
|
|
1228
1267
|
console.log(chalk.yellow(` ${customProbe.error?.message ?? "Could not reach registry. Try again or enter a different source."}`));
|
|
1229
1268
|
registry = undefined; // Reset so we don't fall through to direct download
|
|
1269
|
+
registrySourceForConfig = undefined;
|
|
1230
1270
|
}
|
|
1231
1271
|
}
|
|
1232
1272
|
catch (error) {
|
|
@@ -1290,6 +1330,7 @@ export async function init(options) {
|
|
|
1290
1330
|
// Download Remote Template (if selected or direct registry download)
|
|
1291
1331
|
// ==========================================================================
|
|
1292
1332
|
let useRemoteTemplate = false;
|
|
1333
|
+
let registrySpecConfigToPersist = null;
|
|
1293
1334
|
if (selectedTemplate) {
|
|
1294
1335
|
// Marketplace mode: download specific template by ID
|
|
1295
1336
|
console.log(chalk.blue(`📦 Downloading template "${selectedTemplate}"...`));
|
|
@@ -1304,6 +1345,12 @@ export async function init(options) {
|
|
|
1304
1345
|
else {
|
|
1305
1346
|
console.log(chalk.green(` ${result.message}`));
|
|
1306
1347
|
useRemoteTemplate = true;
|
|
1348
|
+
if (registry) {
|
|
1349
|
+
registrySpecConfigToPersist = {
|
|
1350
|
+
source: registrySourceForConfig ?? registry.gigetSource,
|
|
1351
|
+
template: selectedTemplate,
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1307
1354
|
}
|
|
1308
1355
|
}
|
|
1309
1356
|
else {
|
|
@@ -1347,6 +1394,9 @@ export async function init(options) {
|
|
|
1347
1394
|
else {
|
|
1348
1395
|
console.log(chalk.green(` ${result.message}`));
|
|
1349
1396
|
useRemoteTemplate = true;
|
|
1397
|
+
registrySpecConfigToPersist = {
|
|
1398
|
+
source: registrySourceForConfig ?? registry.gigetSource,
|
|
1399
|
+
};
|
|
1350
1400
|
}
|
|
1351
1401
|
}
|
|
1352
1402
|
else {
|
|
@@ -1395,6 +1445,24 @@ export async function init(options) {
|
|
|
1395
1445
|
if (hashedCount > 0) {
|
|
1396
1446
|
console.log(chalk.gray(`📋 Tracking ${hashedCount} template files for updates`));
|
|
1397
1447
|
}
|
|
1448
|
+
// Persist registry spec config (source + template) for update flow
|
|
1449
|
+
if (registrySpecConfigToPersist) {
|
|
1450
|
+
writeSpecRegistryConfig(cwd, registrySpecConfigToPersist);
|
|
1451
|
+
console.log(chalk.gray(`📋 Registry spec config written: source=${registrySpecConfigToPersist.source}${registrySpecConfigToPersist.template ? `, template=${registrySpecConfigToPersist.template}` : ""}`));
|
|
1452
|
+
}
|
|
1453
|
+
// Hash spec files from remote template so update can detect modifications
|
|
1454
|
+
if (useRemoteTemplate) {
|
|
1455
|
+
const specFilesToHash = new Map();
|
|
1456
|
+
for (const relativePath of collectSpecPaths(cwd)) {
|
|
1457
|
+
const fullPath = path.join(cwd, relativePath);
|
|
1458
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
1459
|
+
specFilesToHash.set(relativePath, content);
|
|
1460
|
+
}
|
|
1461
|
+
if (specFilesToHash.size > 0) {
|
|
1462
|
+
updateHashes(cwd, specFilesToHash);
|
|
1463
|
+
console.log(chalk.gray(`📋 Tracking ${specFilesToHash.size} remote spec files for updates`));
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1398
1466
|
// Initialize developer identity (silent - no output)
|
|
1399
1467
|
if (developerName) {
|
|
1400
1468
|
try {
|