fix(smartconfig): migrate project metadata and config handling to .smartconfig.json

This commit is contained in:
2026-03-24 18:56:18 +00:00
parent a2b596e5db
commit abdc2f2534
14 changed files with 357 additions and 272 deletions

View File

@@ -28,7 +28,7 @@ You create project descriptions and keywords for npm packages.
You have access to filesystem tools to explore the project.
IMPORTANT RULES:
- Only READ files (package.json, npmextra.json, source files in ts/)
- Only READ files (package.json, .smartconfig.json, source files in ts/)
- Do NOT write, delete, or modify any files
- Your final response must be valid JSON only
- Description must be a clear, concise one-sentence summary
@@ -43,7 +43,7 @@ PROJECT DIRECTORY: ${this.projectDir}
Use the filesystem tools to explore the project and understand what it does:
1. First, use list_directory to see the project structure
2. Read package.json to understand the package name and current description
3. Read npmextra.json if it exists for additional metadata
3. Read .smartconfig.json if it exists for additional metadata
4. Read key source files in ts/ directory to understand the implementation
Then generate a description and keywords based on your exploration.
@@ -83,8 +83,8 @@ Don't wrap the JSON in \`\`\`json\`\`\` - just return the raw JSON object.
const smartconfigJson = files.smartfilesNpmextraJSON;
const smartconfigJsonContent = JSON.parse(smartconfigJson.contents.toString());
smartconfigJsonContent['@git.zone/cli'].module.description = resultObject.description;
smartconfigJsonContent['@git.zone/cli'].module.keywords = resultObject.keywords;
smartconfigJsonContent['gitzone'].module.description = resultObject.description;
smartconfigJsonContent['gitzone'].module.keywords = resultObject.keywords;
smartconfigJson.contents = Buffer.from(JSON.stringify(smartconfigJsonContent, null, 2));
await smartconfigJson.write();

View File

@@ -27,7 +27,7 @@ export class ProjectContext {
this.projectDir,
);
const smartfilesNpmextraJSON = await plugins.smartfileFactory.fromFilePath(
plugins.path.join(this.projectDir, 'smartconfig.json'),
plugins.path.join(this.projectDir, '.smartconfig.json'),
this.projectDir,
);
const smartfilesMod = await plugins.smartfileFactory.virtualDirectoryFromPath(

View File

@@ -22,9 +22,9 @@ export class Readme {
const smartconfigJson = JSON.parse(
(await projectContext.gatherFiles()).smartfilesNpmextraJSON.contents.toString()
);
const legalInfo = smartconfigJson?.['@git.zone/tsdoc']?.legal;
const legalInfo = smartconfigJson?.['tsdoc']?.legal;
if (!legalInfo) {
const error = new Error(`No legal information found in smartconfig.json`);
const error = new Error(`No legal information found in .smartconfig.json`);
console.log(error);
}