GeezerVison is showing github.com — Kevin/v1.2.0 by kevinwang5658 · Pull Request #64 · codifycli/codify
Kevin/v1.2.0
#64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
4e8b611
fix: fixed codify edit desktop installation. Fixed apply message
kevinwang5658 Jun 2, 2026
793cb91
chore: update download links for desktop app
kevinwang5658 Jun 5, 2026
3999b9f
feat: Added apply notes system
kevinwang5658 Jun 5, 2026
21288cc
feat: Made modifications to apply note. Improved the pretty printing …
kevinwang5658 Jun 5, 2026
4f81fa4
feat: Changed the diff display to be a structural diff
kevinwang5658 Jun 5, 2026
fdd62a7
feat: Improved plan printing more
kevinwang5658 Jun 5, 2026
33c9e45
fix: noops in object plans
kevinwang5658 Jun 10, 2026
3eb3c0b
feat: added shell check for plugins so that we know that shell output…
kevinwang5658 Jun 11, 2026
4ca9599
feat: added disable auto correct for zsh shells
kevinwang5658 Jun 11, 2026
217718d
feat: improved name and id matching for dependsOn. Allow type only, n…
kevinwang5658 Jun 12, 2026
87dfbcb
fix: error key issue. Improved codify test to resolve current latest …
kevinwang5658 Jun 15, 2026
acef2b3
fix: stdin mode not working for scirpts that actually require stdin. …
kevinwang5658 Jun 16, 2026
4cdf437
fix: pkg for the new patch ink script
kevinwang5658 Jun 16, 2026
cb5cb8c
feat: improve stdin ux
Jul 17, 2026
46599eb
feat: show cursor when stdin is true
Jul 17, 2026
e98e8e3
fix: raw mode fixes
Jul 17, 2026
e25aa25
chore: bump version
Jul 19, 2026
2f08a83
testing test fixes
Jul 19, 2026
6474463
testing test fixes
Jul 19, 2026
7f05bed
testing test fixes
Jul 19, 2026
d095853
Fix initialize tests
Jul 19, 2026
b178e1f
fix: ink tests
Jul 19, 2026
File filter
Filter by extension
.json
(2)
.ts
(7)
.tsx
(1)
All 3 file types selected
Only manifest files
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
feat: Added apply notes system
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
commit 3999b9f45186510307f219d71c980538a3a3f0ac
There are no files selected for viewing
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Original file line number
Diff line number
Diff line change
Expand Up
@@ -5,7 +5,7 @@
},
"dependencies": {
"@codifycli/ink-form": "0.0.12",
"@codifycli/schemas": "1.1.0-beta8 ",
"@codifycli/schemas": "1.1.0-beta.9 ",
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.1",
"@mischnic/json-sourcemap": "^0.1.1",
"@oclif/core": "^4.0.8",
Expand Down
Expand Up
@@ -43,7 +43,7 @@
},
"description": "Codify is a configuration-as-code tool that declaratively installs and manages developer tools and applications. Check out https://dashboard.codifycli.com for an editor.",
"devDependencies": {
"@codifycli/plugin-core": "^1.1.0-beta19 ",
"@codifycli/plugin-core": "^1.1.0-beta.25 ",
"@oclif/prettier-config": "^0.2.1",
"@types/chalk": "^2.2.0",
"@types/cors": "^2.8.19",
Expand Down
Original file line number
Diff line number
Diff line change
@@ -0,0 +1,4 @@
export interface ApplyNote {
message: string;
resourceType: string;
}
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,7 @@
import { ResourceOperation } from '@codifycli/schemas';
import { PluginError } from '../common/errors.js';
import { ApplyNote } from './apply-note.js';
import { ResourcePlan } from './plan.js';
export interface ApplyResultEntry {
Expand All
@@ -13,6 +14,7 @@ export interface ApplyResultEntry {
export interface ApplyResult {
entries: ApplyResultEntry[];
errors: PluginError[];
notes: ApplyNote[];
isPartialFailure(): boolean;
}
Expand All
@@ -21,9 +23,8 @@ export function createApplyResult(
succeededPlans: ResourcePlan[],
failedErrors: PluginError[],
skippedIds: Set<string>,
notes: ApplyNote[] = [],
): ApplyResult {
const failedByType = new Map(failedErrors.map((e) => [e.resourceType, e]));
const entries: ApplyResultEntry[] = [
...succeededPlans.map((p) => ({
id: p.id,
Expand All
@@ -46,6 +47,7 @@ export function createApplyResult(
return {
entries,
errors: failedErrors,
notes,
isPartialFailure() {
return failedErrors.length > 0;
},
Expand Down
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
import { CommandRequestData, CommandRequestResponseData } from '@codifycli/schemas';
import { ApplyNoteRequestData, CommandRequestData, CommandRequestResponseData } from '@codifycli/schemas';
import { EventEmitter } from 'node:events';
export enum Event {
Expand All
@@ -18,6 +18,7 @@ export enum Event {
PRESS_KEY_TO_CONTINUE_COMPLETED = 'press_key_to_continue_completed',
CODIFY_LOGIN_CREDENTIALS_REQUEST = 'codify_login_credentials_request',
CODIFY_LOGIN_CREDENTIALS_COMPLETED = 'codify_login_credentials_completed',
APPLY_NOTE_REQUEST = 'apply_note_request',
}
export enum ProcessName {
Expand Down
Expand Up
@@ -141,6 +142,10 @@ export const ctx = new class {
this.emitter.emit(Event.CODIFY_LOGIN_CREDENTIALS_COMPLETED, pluginName, credentials);
}
applyNoteRequested(pluginName: string, data: ApplyNoteRequestData) {
this.emitter.emit(Event.APPLY_NOTE_REQUEST, pluginName, data);
}
async subprocess<T>(name: string, run: () => Promise<T>): Promise<T> {
this.emitter.emit(Event.SUB_PROCESS_START, name);
const result = await run();
Expand Down
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,19 @@
import {
ApplyNoteRequestData,
ImportResponseData, ResourceDefinition,
ResourceJson,
ValidateResponseData,
} from '@codifycli/schemas';
import { InternalError, PluginError } from '../common/errors.js';
import { config } from '../config.js';
import { ApplyNote } from '../entities/apply-note.js';
import { ApplyResult, createApplyResult } from '../entities/apply-result.js';
import { Plan, ResourcePlan } from '../entities/plan.js';
import { Project } from '../entities/project.js';
import { ResourceConfig } from '../entities/resource-config.js';
import { ResourceInfo } from '../entities/resource-info.js';
import { SubProcessName, SubprocessFinishStatus, ctx } from '../events/context.js';
import { Event, SubProcessName, SubprocessFinishStatus, ctx } from '../events/context.js';
import { groupBy } from '../utils/index.js';
import { registerKillListeners } from '../utils/register-kill-listeners.js';
import { Plugin } from './plugin.js';
Expand Down
Expand Up
@@ -142,6 +144,12 @@ export class PluginManager {
const collectedErrors: PluginError[] = [];
const skippedIds = new Set<string>();
const succeededPlans: ResourcePlan[] = [];
const collectedNotes: ApplyNote[] = [];
const noteListener = (_pluginName: string, data: ApplyNoteRequestData) => {
collectedNotes.push({ message: data.message, resourceType: data.resourceType });
};
ctx.on(Event.APPLY_NOTE_REQUEST, noteListener);
for (const id of project.evaluationOrder ?? []) {
if (skippedIds.has(id)) {
Expand Down
Expand Up
@@ -179,7 +187,8 @@ export class PluginManager {
}
}
return createApplyResult(succeededPlans, collectedErrors, skippedIds);
ctx.emitter.removeListener(Event.APPLY_NOTE_REQUEST, noteListener);
return createApplyResult(succeededPlans, collectedErrors, skippedIds, collectedNotes);
}
async setVerbosityLevel(verbosityLevel: number): Promise<void> {
Expand Down
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
import {
ApplyNoteRequestData,
ApplyNoteRequestDataSchema,
CommandRequestData,
CommandRequestDataSchema,
CommandRequestResponseData,
Expand All
@@ -19,6 +21,7 @@ import { PluginMessage } from './plugin-message.js';
export const ipcMessageValidator = ajv.compile(IpcMessageV2Schema);
export const commandRequestValidator = ajv.compile(CommandRequestDataSchema);
export const pressKeyToContinueRequestValidator = ajv.compile(PressKeyToContinueRequestDataSchema);
export const applyNoteRequestValidator = ajv.compile(ApplyNoteRequestDataSchema);
const DEFAULT_NODE_MODULES_DIR = '/usr/local/lib/codify/node_modules/'
Expand Down
Expand Up
@@ -122,6 +125,21 @@ export class PluginProcess {
}
if (message.cmd === MessageCmd.APPLY_NOTE_REQUEST) {
const { data, requestId } = message;
if (!applyNoteRequestValidator(data)) {
throw new Error(`Invalid apply note request from plugin ${pluginName}. ${JSON.stringify(applyNoteRequestValidator.errors, null, 2)}`);
}
process.send({
cmd: returnMessageCmd(MessageCmd.APPLY_NOTE_REQUEST),
requestId,
data: {},
});
return ctx.applyNoteRequested(pluginName, data as unknown as ApplyNoteRequestData);
}
if (message.cmd === MessageCmd.CODIFY_CREDENTIALS_REQUEST) {
if (pluginName !== 'default') {
throw new Error(`Only the default Codify plugin is able to request Codify credentials. ${pluginName}`);
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -93,6 +93,18 @@ export function ApplyComplete({ result }: { result: ApplyResult }) {
</Box>
)}
{result.notes.length > 0 && (
<Box flexDirection="column" marginTop={1}>
{groupNotesByMessage(result.notes).map(({ message, resourceTypes }) => (
<Box key={message}>
<Text color="yellow" bold>{'⚠ '}</Text>
<Text bold>{resourceTypes.join(', ')}: </Text>
<Text>{message}</Text>
</Box>
))}
</Box>
)}
{!isPartial && (
<Box marginTop={1}>
<Text dimColor>Open a new terminal or source '{path.basename(ShellUtils.getPrimaryShellRc())}' for the new changes to be reflected</Text>
Expand All
@@ -102,3 +114,18 @@ export function ApplyComplete({ result }: { result: ApplyResult }) {
</Box>
);
}
function groupNotesByMessage(notes: ApplyResult['notes']): { message: string; resourceTypes: string[] }[] {
const map = new Map<string, string[]>();
for (const note of notes) {
const existing = map.get(note.message);
if (existing) {
if (!existing.includes(note.resourceType)) {
existing.push(note.resourceType);
}
} else {
map.set(note.message, [note.resourceType]);
}
}
return [...map.entries()].map(([message, resourceTypes]) => ({ message, resourceTypes }));
}
Original file line number
Diff line number
Diff line change
Expand Up
@@ -99,6 +99,7 @@ export class JsonReporter implements Reporter {
resourceType: error.resourceType,
data: error.errorData.data,
})),
notes: result.notes,
}, null, 2));
}
}
Original file line number
Diff line number
Diff line change
Expand Up
@@ -200,5 +200,28 @@ Use this init flow to get started quickly with Codify.
ctx.log('');
ctx.log('Open a new terminal or source \'.zshrc\' for the new changes to be reflected');
}
if (result.notes.length > 0) {
ctx.log('');
const grouped = groupNotesByMessage(result.notes);
for (const { message, resourceTypes } of grouped) {
ctx.log(chalk.yellow(`⚠ ${resourceTypes.join(', ')}: ${message}`));
}
}
}
}
function groupNotesByMessage(notes: ApplyResult['notes']): { message: string; resourceTypes: string[] }[] {
const map = new Map<string, string[]>();
for (const note of notes) {
const existing = map.get(note.message);
if (existing) {
if (!existing.includes(note.resourceType)) {
existing.push(note.resourceType);
}
} else {
map.set(note.message, [note.resourceType]);
}
}
return [...map.entries()].map(([message, resourceTypes]) => ({ message, resourceTypes }));
}
Loading
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.