@altotyler/alto-rootstock-cli 1.0.3 → 1.0.5

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.
@@ -5,24 +5,26 @@ const path = require('path');
5
5
  const chalk = require('chalk');
6
6
  const { fetchRemoteFile } = require('./fetcher');
7
7
 
8
- // Maps remote template paths → local project paths
8
+ const TEMPLATE_DIR = path.join(__dirname, '../../project-template');
9
+
10
+ // Maps template-relative paths → local project paths
9
11
  const SCAFFOLD_MANIFEST = [
10
- { remote: 'project-template/claude/CLAUDE.md', local: '.claude/CLAUDE.md' },
11
- { remote: 'project-template/claude/skills/rootstock-core.md', local: '.claude/skills/rootstock-core.md' },
12
- { remote: 'project-template/claude/skills/rootstock-soapi.md', local: '.claude/skills/rootstock-soapi.md' },
13
- { remote: 'project-template/claude/skills/rootstock-sydata.md', local: '.claude/skills/rootstock-sydata.md' },
14
- { remote: 'project-template/claude/skills/rootstock-sydatat.md', local: '.claude/skills/rootstock-sydatat.md' },
15
- { remote: 'project-template/claude/skills/rootstock-poloader.md', local: '.claude/skills/rootstock-poloader.md' },
16
- { remote: 'project-template/claude/skills/rootstock-manufacturing.md', local: '.claude/skills/rootstock-manufacturing.md' },
17
- { remote: 'project-template/claude/skills/rootstock-inventory.md', local: '.claude/skills/rootstock-inventory.md' },
18
- { remote: 'project-template/claude/skills/rootstock-testing.md', local: '.claude/skills/rootstock-testing.md' },
19
- { remote: 'project-template/claude/skills/rootstock-debug.md', local: '.claude/skills/rootstock-debug.md' },
20
- { remote: 'project-template/claude/skills/rootstock-session.md', local: '.claude/skills/rootstock-session.md' },
21
- { remote: 'project-template/cursor/rules/rootstock.mdc', local: '.cursor/rules/rootstock.mdc' },
22
- { remote: 'project-template/github/agents/Rootstock Agent.agent.md', local: '.github/agents/Rootstock Agent.agent.md' },
23
- { remote: 'project-template/github/copilot-instructions.md', local: '.github/copilot-instructions.md' },
24
- { remote: 'project-template/vscode/mcp.json', local: '.vscode/mcp.json' },
25
- { remote: 'project-template/vscode/tasks.json', local: '.vscode/tasks.json' },
12
+ { template: 'claude/CLAUDE.md', local: '.claude/CLAUDE.md' },
13
+ { template: 'claude/skills/rootstock-core.md', local: '.claude/skills/rootstock-core.md' },
14
+ { template: 'claude/skills/rootstock-soapi.md', local: '.claude/skills/rootstock-soapi.md' },
15
+ { template: 'claude/skills/rootstock-sydata.md', local: '.claude/skills/rootstock-sydata.md' },
16
+ { template: 'claude/skills/rootstock-sydatat.md', local: '.claude/skills/rootstock-sydatat.md' },
17
+ { template: 'claude/skills/rootstock-poloader.md', local: '.claude/skills/rootstock-poloader.md' },
18
+ { template: 'claude/skills/rootstock-manufacturing.md', local: '.claude/skills/rootstock-manufacturing.md' },
19
+ { template: 'claude/skills/rootstock-inventory.md', local: '.claude/skills/rootstock-inventory.md' },
20
+ { template: 'claude/skills/rootstock-testing.md', local: '.claude/skills/rootstock-testing.md' },
21
+ { template: 'claude/skills/rootstock-debug.md', local: '.claude/skills/rootstock-debug.md' },
22
+ { template: 'claude/skills/rootstock-session.md', local: '.claude/skills/rootstock-session.md' },
23
+ { template: 'cursor/rules/rootstock.mdc', local: '.cursor/rules/rootstock.mdc' },
24
+ { template: 'github/agents/Rootstock Agent.agent.md', local: '.github/agents/Rootstock Agent.agent.md' },
25
+ { template: 'github/copilot-instructions.md', local: '.github/copilot-instructions.md' },
26
+ { template: 'vscode/mcp.json', local: '.vscode/mcp.json' },
27
+ { template: 'vscode/tasks.json', local: '.vscode/tasks.json' },
26
28
  ];
27
29
 
28
30
  function writeFile(projectRoot, relPath, content) {
@@ -32,18 +34,19 @@ function writeFile(projectRoot, relPath, content) {
32
34
  fs.writeFileSync(full, content, 'utf8');
33
35
  }
34
36
 
37
+ // Used by `altors new` — reads from bundled project-template (fast, works offline)
35
38
  async function injectScaffolding(projectRoot) {
36
39
  const results = { ok: [], failed: [] };
37
40
 
38
41
  for (const entry of SCAFFOLD_MANIFEST) {
42
+ const src = path.join(TEMPLATE_DIR, entry.template);
39
43
  try {
40
- process.stdout.write(chalk.dim(` Fetching ${entry.local}...`));
41
- const content = await fetchRemoteFile(entry.remote);
44
+ const content = fs.readFileSync(src, 'utf8');
42
45
  writeFile(projectRoot, entry.local, content);
43
- process.stdout.write(`\r ${chalk.green('✓')} ${entry.local}\n`);
46
+ console.log(` ${chalk.green('✓')} ${entry.local}`);
44
47
  results.ok.push(entry.local);
45
48
  } catch (err) {
46
- process.stdout.write(`\r ${chalk.red('✗')} ${entry.local} ${chalk.dim(`(${err.message})`)}\n`);
49
+ console.log(` ${chalk.red('✗')} ${entry.local} ${chalk.dim(`(${err.message})`)}`);
47
50
  results.failed.push(entry.local);
48
51
  }
49
52
  }
@@ -51,8 +54,8 @@ async function injectScaffolding(projectRoot) {
51
54
  return results;
52
55
  }
53
56
 
57
+ // Used by `altors update` — fetches latest from remote distribution repo
54
58
  async function updateScaffolding(projectRoot) {
55
- // Same as inject but reports updated vs new
56
59
  const results = { updated: [], added: [], failed: [] };
57
60
 
58
61
  for (const entry of SCAFFOLD_MANIFEST) {
@@ -60,14 +63,14 @@ async function updateScaffolding(projectRoot) {
60
63
  const exists = fs.existsSync(fullPath);
61
64
  try {
62
65
  process.stdout.write(chalk.dim(` Fetching ${entry.local}...`));
63
- const content = await fetchRemoteFile(entry.remote);
66
+ const content = await fetchRemoteFile(`project-template/${entry.template}`);
64
67
  writeFile(projectRoot, entry.local, content);
65
68
  const label = exists ? chalk.blue('↑') : chalk.green('+');
66
- process.stdout.write(`\r ${label} ${entry.local}\n`);
69
+ process.stdout.write(`\r${' '.repeat(70)}\r ${label} ${entry.local}\n`);
67
70
  if (exists) results.updated.push(entry.local);
68
71
  else results.added.push(entry.local);
69
72
  } catch (err) {
70
- process.stdout.write(`\r ${chalk.red('✗')} ${entry.local} ${chalk.dim(`(${err.message})`)}\n`);
73
+ process.stdout.write(`\r${' '.repeat(70)}\r ${chalk.red('✗')} ${entry.local} ${chalk.dim(`(${err.message})`)}\n`);
71
74
  results.failed.push(entry.local);
72
75
  }
73
76
  }