uda-cli 0.4.1 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uda-cli",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Universal Dev AI — AI-agnostic context engineering + RAG for game development",
5
5
  "type": "module",
6
6
  "main": "./src/cli.js",
@@ -1,7 +1,9 @@
1
- import { createInterface } from 'readline';
2
- import { readFileSync } from 'fs';
3
- import { fileURLToPath } from 'url';
4
- import { dirname, join } from 'path';
1
+ import { createInterface } from 'readline'
2
+ import { readFileSync } from 'fs'
3
+ import { writeFile } from 'fs/promises'
4
+ import { fileURLToPath } from 'url'
5
+ import { dirname, join } from 'path'
6
+ import { loadConfig, saveConfig } from '../core/config.js'
5
7
  import { initProject } from '../core/init.js';
6
8
  import { handleScan } from './scan.js';
7
9
  import { handleSync } from './sync.js';
@@ -39,9 +41,34 @@ export async function handleInit(options) {
39
41
  console.log('✔ .uda/ directory created\n');
40
42
 
41
43
  // Step 2: Engine detection + plugin install prompt
42
- const engine = options.engine || await detectEngine(root);
44
+ const engine = options.engine || await detectEngine(root)
45
+ if (engine) {
46
+ console.log(`✔ Engine detected: ${engine}`)
47
+ }
48
+
49
+ // Step 2b: Create project profile
50
+ const projectName = root.split('/').pop() || 'Unknown'
51
+ const profilePath = join(root, '.uda', 'knowledge', 'project', 'profile.md')
52
+ const profileContent = `# Project Profile
53
+
54
+ Project: ${projectName}
55
+ Engine: ${engine || 'unknown'}
56
+ Initialized: ${new Date().toISOString().split('T')[0]}
57
+ `
58
+ await writeFile(profilePath, profileContent)
59
+ console.log('✔ Project profile created')
60
+
61
+ // Step 2c: Save engine to config
62
+ if (engine) {
63
+ try {
64
+ const config = await loadConfig(root)
65
+ config.engine = engine
66
+ await saveConfig(root, config)
67
+ } catch { /* config may not exist yet in edge cases */ }
68
+ }
69
+
70
+ // Step 2d: Plugin install prompt
43
71
  if (engine) {
44
- console.log(`✔ Engine detected: ${engine}`);
45
72
  const defaultUrl = DEFAULT_PLUGINS[engine];
46
73
  if (defaultUrl && !options.skipPlugin) {
47
74
  await promptPluginInstall(engine, defaultUrl);
@@ -1,5 +1,5 @@
1
1
  // src/commands/scan.js
2
- import { readdir, stat, readFile } from 'fs/promises';
2
+ import { readdir, stat, readFile, writeFile } from 'fs/promises'
3
3
  import { join, relative, extname } from 'path';
4
4
  import { RagManager } from '../rag/manager.js';
5
5
  import { udaPaths } from '../core/constants.js';
@@ -47,7 +47,27 @@ export async function handleScan() {
47
47
  }
48
48
  }
49
49
 
50
- console.log(`\n✔ Scan complete: ${files.length} files, ${totalChunks} chunks indexed`);
50
+ console.log(`\n✔ Scan complete: ${files.length} files, ${totalChunks} chunks indexed`)
51
+
52
+ // Update state/current.md
53
+ try {
54
+ const statePath = paths.state.current
55
+ const stateContent = `# Project State
56
+
57
+ ## Last Updated: ${new Date().toISOString().split('T')[0]}
58
+
59
+ ## Active Work
60
+ Project indexed. ${files.length} knowledge files, ${totalChunks} chunks in RAG.
61
+
62
+ ## Completed
63
+ - [x] UDA initialized
64
+ - [x] Knowledge base scanned
65
+
66
+ ## Decisions
67
+ (Architectural decisions will be recorded here)
68
+ `
69
+ await writeFile(statePath, stateContent)
70
+ } catch { /* non-critical, don't fail scan for state update */ }
51
71
  }
52
72
 
53
73
  async function collectMdFiles(dir) {
package/src/core/init.js CHANGED
@@ -19,14 +19,14 @@ const INITIAL_STATE = `# Project State
19
19
  ## Last Updated: ${new Date().toISOString().split('T')[0]}
20
20
 
21
21
  ## Active Work
22
- None yet. Run \`uda scan\` to index your project.
22
+ Initializing...
23
23
 
24
24
  ## Completed
25
25
  - [x] UDA initialized
26
26
 
27
27
  ## Decisions
28
28
  (Architectural decisions will be recorded here)
29
- `;
29
+ `
30
30
 
31
31
  export async function initProject(root) {
32
32
  const paths = udaPaths(root);